instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>I'm using Eclipse for Java development. All my sources compile fine and the resulting application compiles fine. However, I keep getting an "red-x" error notification in the Package Explorer.</p> <p>All my sources in this source directory (too long for the snapshot) compile fine, none of the show the "red-x" error ...
<p>yeah, this happens sometimes for no apparent reason. You can go to the "Problems"-Tab (right next to console output) and see the error message, so maybe you can narrow it down that way.</p>
<p>Right click on the project with errors, then in the sub-menus select: <em>Maven</em> > <em>UpdateProject</em> > </p> <p>and then:</p> <ul> <li>Select the checkbox for all the dependent projects </li> <li>select force update of snapshots </li> <li>click OK.</li> </ul> <p>This worked for me..</p>
27,834
<p>I've a couple of extension methods I've been developing for a couple of projects, they currently rely heavily on some AJAX to make bits and pieces work. The problem is that they require copying and pasting JavaScript files to the project you want to use it in.</p> <p>As this JavaScript file only needs to be used on...
<p>This question is not specific to jQuery, but specific to JavaScript in general. The core problem is how to "channel" a variable in embedded functions. This is the example:</p> <pre><code>var abc = 1; // we want to use this variable in embedded functions function xyz(){ console.log(abc); // it is available here! ...
<p>I think it actually depends on what are you going to do inside your <code>doSomething</code> function. If you are going to access <code>MyObject</code> properties using this keyword then you have to use that. But I think that the following code fragment will also work if you are not doing any special things using <c...
43,854
<p>I have a bunch of perfmon files that have captured information over a period of time. Whats the best tool to crunch this information? Idealy I'd like to be able to see avg stats per hour for the object counters that have been monitored.</p>
<p>Perhaps look into using <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=890cd06b-abf8-4c25-91b2-f8d975cf8c07&amp;displaylang=en" rel="nofollow noreferrer">LogParser</a>. It depends on how the info was logged (Perfmon doesn't lack flexibility)</p> <p>If they're CSV you can even use the ODBC Text dr...
<p>Take a look at SmartMon (www.perfmonanalysis.com). It analyzes Perfmon data in CSV and SQL Server databases.</p>
4,676
<p>I have a CircleButton class in Actionscript. I want to know when someone externally has changed the 'on' property. I try listening to 'onChange' but it never hits that event handler.</p> <p>I know I can write the 'on' property as a get/setter but I like the simplicity of just using [Bindable]</p> <p>Can an object ...
<p>If you use the [Bindable] tag without specifying an event type, then when the property changes its value, an event of type: PropertyChangeEvent.PROPERTY_CHANGE, which is the string 'propertyChange', will be dispatched. </p> <p>Therefore, to be able to register to listen to that event, you need to say:</p> <pre><co...
<p>You could use BindingUtils.bindSetter()</p> <p>An example is found <a href="http://blog.flexexamples.com/2007/10/01/data-binding-in-flex/#more-217" rel="nofollow noreferrer">here</a>.</p>
25,864
<p>Is there a way to format a UTC time into any arbitrary string format I want in java? Basically I was thinking of having some class take the timestamp and I pass it is string telling it how I want it formated, and it returns the formatted string for me. Is there a way to do this?</p>
<p>The java.text.SimpleDateFormat class provides formatting and parsing for dates in a locale-sensitive manner.</p> <p>The javadoc header for <a href="http://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html" rel="nofollow noreferrer">SimpleDateFormat</a> is a good source of detailed information. There...
<p>Date instances are insufficient for some purposes.</p> <p>Use <a href="http://joda-time.sourceforge.net/" rel="nofollow noreferrer">Joda Time</a> instead.</p> <p>Joda time integrates with Hibernate and other databases.</p>
15,707
<p>Another thing I'm seeing with my new build. Late in a small print, the unit appears to perform operations "out of order" occasionally. Here's a picture where it's running a layer across the model.<br> <a href="https://i.stack.imgur.com/hGIJk.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hGIJk.j...
<p>This is just your slicer doing this. If you inspect the G-code file, you will see that the printer is faithfully doing what the slicer told it to. Most slicers use a fairly simple heuristic for determining the order in which lines are processed, which sometimes comes up with sub-optimal solutions like these.</p>
<p>I have seen this in Cura 2.5 when selecting different printers, then altering the specifications to suit. Changing the printer seems to change the slicing behavior. As yet there is no specific printer set up in Cura for the MEGA so you will probably have to find something that fits your needs, unless someone has the...
475
<p>I need to write a tool in C++ to determine the changed bits in a file compared against another file for replication. What would be the best method of accomplishing this?</p> <p>I don't have a specific OS or library in mind, I'm open to suggestions. My primary goal is reducing the amount of network traffic involve...
<p>Look at rsync - it splits the file into blocks, calculates a checksum for each block, and transmits only the checksum to determine if there are any changesto the destination before transmitting the block data only if necessary.</p>
<p>I would start by trying some implementation of diff (<a href="http://en.wikipedia.org/wiki/Diff" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Diff</a>)</p>
28,084
<p>first of all: that might be a newbie question. However after few searches I cannot find anything that would bring me further.</p> <p>Basically what would be the reasons to choose an app server over a Spring framework to develop a medium complex web application? I am fairly new to Spring, did some hard core WebSpher...
<p>Spring is awesome.</p> <p>Your terminology is way off though. Spring is a Framework. It's a library that you use to write a web application. </p> <p>An app Server is what your application runs in. You need both. For example, use the Spring Framework to create an app that runs in the Tomcat app server. </p>
<p>Bpapa,</p> <p>you got me there, yes the terminology is wrong. I meant Spring + web container vs. App Servers. Surely the web app has to be deployed somewhere. I guess that shifts the question to the server side features as per my first post.</p> <p>Topology example: Spring + Tomcat vs. WebSphere.</p> <p>As a side...
47,184
<p>I try to build a gui (Swing) for a simple java application. The application should have a start window like a menu. From there I would like to navigate to several other windows. </p> <p>My question is what is the best-practice to achieve such a navigation? Should I build several JFrames and switch the visibility of...
<p>I recommend</p> <ul> <li>Do <em>not</em> do a MDI application with sub-frames like those found in the old Windows days. They suck as they make the matter confusing.</li> <li>Do design a tabbed interface. The welcome page/menu will be displayed on a first tab that is always created on the start.</li> </ul> <p>All c...
<p>Multiple JFrames sounds like a better idea to me. Much more OO.</p>
41,390
<p>As a temporary stopgap until all the designers are in place we are currently hand-cranking a whole bunch of xml configuration files at work. One of the issues with this is file-versioning because people forget to update version numbers when updating the files (which is to be expected as humans generally suck at perf...
<p>In order to take control over the properties that you want to be cached you can call 'RefreshCache()' passing the properties that you want to hang around:</p> <pre class="lang-c# prettyprint-override"><code>System.DirectoryServices.DirectoryEntry entry = new System.DirectoryServices.DirectoryEntry(); ...
<p>Active Directory is pretty efficient at storing information and the retrieval shouldn't be that much of a performance hit. If you are really intent on storing the names, you'll probably want to store them in some sort of a tree stucture, so you can see the relationships of all the people. Depending on how the numb...
5,328
<p>In simple terms, what are the reasons for, and what are the differences between the GPL v2 and GPL v3 open source licenses? Explanations and references to legal terms and further descriptions would be appreciated.</p>
<p>The page linked to in another answer is a good source, but a lot to read. Here is a short list of some the major differences:</p> <ul> <li><p>internationalization: they used new terminology, rather than using language tied to US legal concepts</p> </li> <li><p>patents: they specifically address patents (including t...
<p>In (not entirely) cynical terms, the reason for the v3 license was Microsoft's patent deal with Novell.</p> <p>In reality, you should always consult a lawyer when dealing with legal issues.</p>
6,276
<p>I am working on car dealership business domain model/UML class diagram.</p> <p>I am new to modeling, so I would like to know how to validate the class diagram. It's very important for me to have an appropriate, if not 100 percent correct, class diagram to use further development (use cases, etc.).</p> <p>Is it pos...
<p>The short answer is that this is not very important. </p> <p>Use your domain class diagrams to keep a note of what you think is in the domain, that is all. It is not your god, and it will not hurt you to change it as you go.</p>
<p>The short answer is that this is not very important. </p> <p>Use your domain class diagrams to keep a note of what you think is in the domain, that is all. It is not your god, and it will not hurt you to change it as you go.</p>
26,524
<p>I have a XML response from an HTTPService call with the e4x result format.</p> <pre> <code> &lt;?xml version="1.0" encoding="utf-8"?> &lt;Validation Error="Invalid Username/Password Combination" /> </code> </pre> <p>I have tried:</p> <pre> <code> private function callback(event:ResultEvent):void { if(event.re...
<p>You have found the best way to do it:</p> <pre><code>event.result.attribute("Error").length() &gt; 0 </code></pre> <p>The <code>attribute</code> method is the preferred way to retrieve attributes if you don't know if they are there or not.</p>
<p>Here you go:</p> <pre><code>if(event.result.@error[0]){ //exists } </code></pre> <p>Easy, eh? :)</p>
17,984
<p>Sup bros,</p> <p>Is there anything out there for C++ which displays the class hierarchies as a tree on the left panel? I've been using VisualWorks Smalltalk for a while, and the way that classes are displayed, and methods broken out, makes it very easy to build a mental picture of what the class does. Sadly, I ca...
<p>Unfortunately C++ doesn't lend itself to this sort of class browser for two reasons:</p> <ul> <li><p>There is no central repository or image with all of the active classes in it. The class definitions are spread around many files.</p></li> <li><p>Class definitions and files live in a M:M relationship. Not all of ...
<p><strong>Caveat emptor:</strong> I've never used this tool myself. (Though perhaps I'll start...)</p> <p>From long experience I've learned that I can put <em>"emacs"</em> + <em>anything</em> into <em>google</em> and find it. (Literally anything! Some people have waayyy too much free time on their hands...)</p> ...
42,647
<p>I was reading a book on programming skills wherein the author asks the interviewee, "How do you crash a JVM?" I thought that you could do so by writing an infinite for-loop that would eventually use up all the memory.</p> <p>Anybody has any idea?</p>
<p><a href="http://en.wikipedia.org/wiki/Java_Native_Interface" rel="noreferrer">JNI</a>. In fact, with JNI, crashing is the default mode of operation. You have to work extra hard to get it not to crash.</p>
<p>If a 'Crash' is anything that interrupts the jvm/program from normal termination, then an Un-handled exception could do this.</p> <pre><code>public static void main(String args[]){ int i = 1/0; System.out.print(i); // This part will not be executed due to above unhandled exception } </code></pre> <p>So, i...
9,097
<p>I've created a a folder and after I open a file inside of that folder a write on it. It happens that after that I try to open the file but I have no permissions thus I have to change it manually.</p> <pre><code>/* str1 has tha name of the folder */ /* str the bytes I want to write in the file inside the folder*/ .....
<p>You are forgetting the third argument to <code>open()</code>.</p> <p>The third argument to <code>open()</code> with <code>O_CREAT</code> is precisely the permissions the newly created file will have.</p> <p>References:</p> <ul> <li><a href="http://www.opengroup.org/onlinepubs/009695399/functions/open.html" rel="n...
<p>The problem is that you're using the wrong path separator - you're trying to use a backslash <code>'\\'</code> to separate the components. This is the path separator for Windows. Since you appear to be using a *nix-based operating system, you should use forward slash <code>'/'</code> as a path separator. In fact,...
39,717
<p>Is there a way to avoid row deletion on an specific table using constrains?</p> <p>I'd like to (for example) deny row deletion if the id is 0,1 or 2</p> <p>This is in order to avoid users deleting master accounts for an application, and I'd like to avoid it even if someone tries it (by mistake) using sql directly....
<p>As far as enforcing this in a <em>constraint</em>, my solution would be to create a dependent table, so referenced rows cannot be deleted. </p> <pre><code>CREATE TABLE NoKillI ( id INT NOT NULL, FOREIGN KEY (id) REFERENCES Accounts(id) ON DELETE RESTRICT ); INSERT INTO NoKillI (id) VALUES (0); INSERT INTO NoKill...
<p>You could try filtering your queries by use of a function that checks to make sure that the user does not try to delete your master account.</p>
47,884
<p>I'm looking for a tool to generate a JavaScript stub from a WSDL.</p> <p>Although I usually prefer to use REST services with JSON or XML, there are some tools I am currently integrating that works only using SOAP.</p> <p>I already created a first version of the client in JavaScript but I'm parsing the SOAP envelop...
<p>I had to do this myself in the past and I found this <a href="http://www.codeproject.com/KB/ajax/JavaScriptSOAPClient.aspx" rel="noreferrer">CodeProject article</a>. I changed it up some, but it gave me a good foundation to implement everything I needed. One of the main features it already has is generating the SO...
<p>It would probably be an overkill, but NetBeans has this feature.</p>
6,273
<p>The RoR tutorials posit one model per table for the ORM to work. My DB schema has some 70 tables divided conceptually into 5 groups of functionality (eg, any given table lives in one and only one functional group, and relations between tables of different groups are minimised.) So: should I design a model per conce...
<p>I cover this in one of my large apps by just making sure that the tables/models are conceptually grouped by name (with almost 1:1 table-model relationship). Example:</p> <pre><code>events event_types event_groups event_attendees etc... </code></pre> <p>That way when I'm using TextMate or whatever, the model files...
<p>There may be a small number of cases where you can use the Rails standard single-table-inheritance model. Perhaps all of the classes in one particular functional grouping have the same fields (or nearly all the same). In that case, take advantage of the DRYness STI offers. When it doesn't make sense, though, use ...
8,800
<p>I have a structure:</p> <pre><code>struct pkt_ { double x; double y; double alfa; double r_kw; }; typedef struct pkt_ pkt; </code></pre> <p>A table of these structures:</p> <pre><code>pkt *tab_pkt; tab_pkt = malloc(ilosc_pkt * sizeof(pkt)); </code></pre> <p>What I want to do is to sort <code>tab_pkt</c...
<p>Something like this should work:</p> <pre><code>int porownaj(const void *p_a, const void *p_b) { /* Need to store arguments in appropriate type before using */ const pkt *pkt_a = p_a; const pkt *pkt_b = p_b; /* Return 1 or -1 if alfa members are not equal */ if (pkt_a-&gt;alfa &gt; pkt_b-&gt;alfa) return...
<p>Yes, I am sorting by alfa and r_kw decides if pkt is first (first value will have the biggest (or smallest) alfa and r_kw I think). That's how I understand the problem, I am not 100% sure.</p>
42,506
<p>There are a couple of tricks for getting glass support for .Net forms.</p> <p>I think the original source for this method is here: <a href="http://blogs.msdn.com/tims/archive/2006/04/18/578637.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/tims/archive/2006/04/18/578637.aspx</a></p> <p>Basically:</p> <pre>...
<p>There really isn't an easier way to do this. These APIs are not exposed by the .NET Framework (yet), so the only way to do it is through some kind of interop (or WPF).</p> <p>As for working with both Windows versions, the code you have should be fine, since the runtime does not go looking for the entry point to the...
<p>I don't mind the unmanaged calls - it's the hack of using a black box to mimic the alpha behaviour and the effect it then has on black element in some components on top that's the problem.</p>
11,165
<p>I have some reports in SQL Server Reporting Services 2005 that I need to keep audit logs for. The audit log should include who ran what report with what parameters. I can't use Windows authentication.</p> <p>What is the best way to log this information?</p>
<p>The previous comments were dead on accurate that you can mine the data from the ReportServer ExecutionLog table in SQL Server 2000/2005 or the ExecutionLogStorage table in SQL Server 2008. If you are using form-based authentication to access the reports instead of windows authentication, then you are probably passi...
<p>If you are using a custom security extention, you will still be able to get all the info you need from the ExecutionLog table. Unless off-course if all your users uses a shared login, in which case you probably need to reconsider your architecture, depending on the importance of the audit log.</p>
2,982
<p>I’ve writen a little python script that just pops up a message box containing the text passed on the command line. I want to pop it up only when the window —resulting from a previous call— is not open.</p> <pre><code>from Tkinter import * import tkMessageBox root = Tk() root.withdraw() # TODO not if a window wit...
<p>I believe you want:</p> <pre><code>if 'normal' != root.state(): tkMessageBox.showinfo("Key you!", " ".join(sys.argv[1:])) </code></pre>
<p>The previous answer works accordingly to the code you have provided. You say it does not work because the answerer complies with "sois bête et discipliné" rule in that he did not add <code>root.mainloop()</code> to his code since your question does not either.</p> <p>By adding the later line, for some reason caused...
6,745
<p>Are there any initiatives to implement/agree upon a standard API for connectivity between web browsers and client hardware.</p> <p>Example: The iPhone has a GPS/Camera/Accellerometer in it. It'd be very cool if my web app could communicate with them (rather than me having to write a thick ObjectiveC application).</...
<p>The closest thing I've seen to that is the Android phone API, which lets your programs access its hardware (relatively) painlessly. Google's pushing for it to become the new standard, but its hardly the same thing as a web-app (which, by most definitions, runs entirely in your browser?). </p>
<p>To add to my own question; Yahoo provides a geolocation service called FireEagle that could act as a mediator and provide similar functionality.</p> <p>In essence the phone communicates with a central Yahoo server updating its location. Your web app can then determine your approx location from that central server.<...
39,397
<p>I want to record user states and then be able to report historically based on the record of changes we've kept. I'm trying to do this in SQL (using PostgreSQL) and I have a proposed structure for recording user changes like the following.</p> <pre><code>CREATE TABLE users ( userid SERIAL NOT NULL PRIMARY KEY, ...
<p>This can be done, but would be a lot more efficient if you stored the end date of each log. With your model you have to do something like:</p> <pre><code>select l1.userid from status_log l1 where l1.status='s' and l1.logcreated = (select max(l2.logcreated) from status_log l2 ...
<p>@Tony the "end" date isn't necessarily applicable.</p> <p>A user might get moved from active, to suspended, to cancelled, to active again. This is a simplified version, in reality, there are even more states and people can be moved directly from one state to another.</p> <p>Additionally, there would be no "end dat...
22,010
<p>Is there a recommended way to upgrade Quartz in JBoss 4.2.x?</p> <p>JBoss bundles quartz 1.5.2, but I have encountered issues (<a href="http://jira.opensymphony.com/browse/QUARTZ-399" rel="nofollow noreferrer">QUARTZ-399</a>, <a href="http://jira.opensymphony.com/browse/QUARTZ-520" rel="nofollow noreferrer">QUARTZ-...
<pre><code>select unique colA, colB from atable select distinct colA, colB from atable </code></pre> <p>In this context, unique and distinct mean the same thing. </p> <p>Distinct however is ANSI standard, whereas unique is not.</p> <p>Please note that unique has many other meanings when used in other area's ie inde...
<p>AFAIR both mean the same. To get unique vel distinct LAT &amp; LONG from your table just do:</p> <p>SELECT DISTINCT LAT, LONG FROM table;</p>
21,091
<p>I want to print out a flat object without any support structure straight onto the build plate of my ender 5. It's going to be PLA and I need it to be thin enough to still be flexible.</p> <p>I don't have a picture available, but imagine that I wanted to print out the Coke Cola and then wrap it around a bland soda ca...
<p>With PLA you can just heat it to curve around the object. I've done this with up to 2mm. Real easy with 1mm.</p> <p>I haven't tried thicker but assume it would work ok.</p> <p>You'd have to glue it though to make it stick. My attempts were just to shape the prints, I didn't want them sticking so I shaped them around...
<p><strong>1 layer, of whatever thickness your device can print.</strong></p> <p>I did something like this to print letters for a flat sign. The letters were 1mm thick and didn't bend, but I'd accidentally printed quite a lot of brim lines which were a single layer thick, and they'd merged into each other.</p> <p>The ...
2,129
<p>In the ContainsIngredients method in the following code, is it possible to cache the <em>p.Ingredients</em> value instead of explicitly referencing it several times? This is a fairly trivial example that I just cooked up for illustrative purposes, but the code I'm working on references values deep inside <em>p</em>...
<p>Can't you simply write your boolean expression in a separate static function which you call from your lambda - passing p.Ingredients as a parameter...</p> <pre><code>private static bool IsIngredientPresent(IngredientBag i, string ingredientType, string ingredient) { return i != null &amp;&amp; i.Contains(ingred...
<p>I would say no in this case. I assume that the compiler can figure out that it uses the <code>p.Ingredients</code> variable 3 times and will keep the variable closeby on the stack or the registers or whatever it uses.</p>
9,189
<p>My web app has a secure area which users log in to via a JSP. The JSP posts the user name and password to a servlet, which then checks to see if the users credentials are valid. If they are valid then the user is directed to the secure resource. How can I ensure that users can't just navigate to the secure resour...
<p>A common approach is to set a token in the user's session i.e.,</p> <p><code>session.setAttribute("loggedIn", "true");</code></p> <p>or even</p> <p><code>session.setAttribute("loggedInUser", "someUserName");</code></p> <p>and check that on any page that should be secured. A good strategy is to perform the check ...
<p>Make sure people always access your app through a single servlet, where the servlet dispataches the request to a JSP, and returns the resulting response to the browser. This way you will always be in control of what happens because there is a single entry point.</p> <p>A different approach is to have a session vari...
45,293
<p>What is the best way to specify a property name when using INotifyPropertyChanged? </p> <p>Most examples hardcode the property name as an argument on the PropertyChanged Event. I was thinking about using MethodBase.GetCurrentMethod.Name.Substring(4) but am a little uneasy about the reflection overhead.</p>
<p>Don't forget one thing : <code>PropertyChanged</code> event is mainly consumed by components that will <strong>use reflection</strong> to get the value of the named property.</p> <p>The most obvious example is databinding.</p> <p>When you fire <code>PropertyChanged</code> event, passing the name of the property as...
<p>Take a look at this blog post: <a href="http://khason.net/dev/inotifypropertychanged-auto-wiring-or-how-to-get-rid-of-redundant-code" rel="nofollow noreferrer"> <a href="http://khason.net/dev/inotifypropertychanged-auto-wiring-or-how-to-get-rid-of-redundant-code" rel="nofollow noreferrer">http://khason.net/dev/inoti...
17,081
<p>What would you consider "worst practices" to follow when developing an embedded system?</p> <p>Some of my ideas of what not to do are:</p> <li>Avoid abstracting the hardware layer, instead spreading hardware accesses throughout the code.</li> <li>Not having any type of emulation environment, having only the actua...
<ul> <li>Uninitialized exception vectors (you know, for the ones that "will never be reached")</li> <li>Say it with me: Global variables. Especially ones shared between ISRs and tasks (or foreground loops) without protection.</li> <li>Failure to use "volatile" where necessary.</li> <li>Having routines that DisableInte...
<p>An important thing in embedded systems is to evaluate the technology, both software (compiler, libraries, os) and hardware (chipsets) independently from your application. Avoiding using test beds for these is dangerous. One should either buy evaluation kits or build his/her own test beds.</p>
31,310
<p>I'm trying to display a caret (<code>^</code>) in math mode in LaTeX to represent the exclusive or operation implemented in the "C languages". By default, <code>^</code> is for creating a superscript in math mode. The closest I can seem to get is by using <code>\wedge</code>, which isn't the same.</p>
<p>You might want to use the common symbol for exclusive or instead, \oplus (but give it a proper name with something like <code>\newcommand\XOR{\oplus}</code>). </p> <p>The caret is a bit too small to be noticeable as a binary operator. However, if you do insist using a caret instead, use this:</p> <pre><code>\newco...
<p>Within math mode, you can use:</p> <pre><code>$7 \^{ } 3 = 4$ </code></pre> <p>to do this, as shown from the online LaTeX renderer <a href="http://thornahawk.unitedti.org/equationeditor/equationeditor.php" rel="nofollow noreferrer">here</a>.</p> <p><img src="https://i.stack.imgur.com/qIxxp.jpg" alt="enter image d...
42,752
<p>I've always been able to allocate 1400 megabytes for Java SE running on 32-bit Windows XP (Java 1.4, 1.5 and 1.6).</p> <pre><code>java -Xmx1400m ... </code></pre> <p>Today I tried the same option on a new Windows XP machine using Java 1.5_16 and 1.6.0_07 and got the error:</p> <pre><code>Error occurred during ini...
<p>Keep in mind that Windows has virtual memory management and the JVM only needs memory that is contiguous <em>in its address space</em>. So, other programs running on the system shouldn't necessarily impact your heap size. What will get in your way are DLL's that get loaded in to your address space. Unfortunately opt...
<p>First, using a page-file when you have 4 GB of RAM is useless. Windows can't access more than 4GB (actually, less because of memory holes) so the page file is not used.</p> <p>Second, the address space is split in 2, half for kernel, half for user mode. If you need more RAM for your applications use the /3GB option...
20,643
<p>I'm trying to configure the Quick Launch menu to only display the ancestors and descendant nodes of the currently select node. The menu also needs to display all the childern of the root node. More simply:</p> <p>Given a site map of:</p> <p><strong>RootSite</strong></p> <p>---<strong>SubSite1</strong> = navigatio...
<p>I followed @Nat's guidance into the murky world Sharepoint webparts to achieve the behavior I described above. My approach was to roll my own version of the <a href="http://blogs.msdn.com/ecm/archive/2006/12/02/customizing-the-wss-3-0-moss-2007-menu-control-mossmenu-source-code-released.aspx" rel="nofollow noreferre...
<p>The approach we used to accomplish the affect you are looking for was to use the <a href="http://www.codeplex.com/cssfriendly" rel="nofollow noreferrer">CSS Friendly Control Adapters</a>. The adapters change the HTML that is rendered without changing the controls you used on your pages. You may need to tweak the m...
11,981
<p>What is the latest version of the Boost library that is compatible with Microsoft Visual C++ 6? And can you provide a link to download it directly?</p> <p>The Downloads link at <a href="http://www.boost.org" rel="nofollow noreferrer">http://www.boost.org</a> only gives a download for version 1.36.0, and the docume...
<p>Boost <a href="http://www.boost.org/users/history/version_1_34_1" rel="noreferrer">1.34.1</a> has been tested with vc6. The old versions are still available.</p>
<p>It's worth noting that Boost doesn't actively <em>not</em> support VC6 either. Most of the boost libs probably still work with VC6 (they haven't stripped out the VC6 compatibility code, as far as I know)</p> <p>So you could just try 1.36.1 and see how far you get.</p>
31,455
<p>I need to get the first and last day of a month in the format YYYY-MM-DD given only the month and year. Is there a good, easy way to do this?</p>
<pre><code>$first = date('Y-m-d', mktime(0, 0, 0, $month, 1, $year)); $last = date('Y-m-t', mktime(0, 0, 0, $month, 1, $year)); </code></pre> <p>See <a href="http://ie2.php.net/date" rel="noreferrer">date()</a> in PHP documentation.</p>
<p>By the way @ZombieSheep solution </p> <pre><code>date ('Y-m-d', mktime(0,0,0,$MM + 1,-1,$YYYY)); </code></pre> <p>does not work it should be </p> <pre><code>date ('Y-m-d', mktime(0,0,0,$MM + 1,0,$YYYY)); // Day zero instead of -1 </code></pre> <p>Of course @Michał Słaby's accepted solution is the simplest.</p>
6,520
<p>I have class method that returns a list of employees that I can iterate through. What's the best way to return the list? Typically I just return an ArrayList. However, as I understand, interfaces are better suited for this type of action. Which would be the best interface to use? Also, why is it better to return a...
<p>Personally, I would use a <a href="http://msdn.microsoft.com/en-us/library/6sh2ey19.aspx" rel="nofollow noreferrer">List</a>&lt;Employee> for creating the list on the backend, and then use <a href="http://msdn.microsoft.com/en-us/library/5y536ey6.aspx" rel="nofollow noreferrer">IList</a> when you return. When you u...
<p>Return type for your method should be <code>IList&lt;Employee&gt;</code>. </p> <p>That means that the caller of your method can use anything that <code>IList</code> offers but cannot use things specific to <code>ArrayList</code>. Then if you feel at some point that <code>LinkedList</code> or <code>YourCustomSuperDu...
5,062
<p>As a long time World of Warcraft player, and a passionate developer I have decided that I would like to combine the two and set about developing some addins. Not only to improve my gameplay experience but as a great opportunity to learn something new.</p> <p>Does anyone have any advice on how to go about starting ...
<p><a href="http://www.wowwiki.com/Getting_started_with_writing_addons" rel="noreferrer">This article</a> explains how to start pretty well.</p> <p>Your first bookmark is possibly the US Interface Forum, especially the Stickies for that:</p> <p><a href="http://us.battle.net/wow/en/forum/1011693/" rel="noreferrer">htt...
<p>Another useful tools you might like is <a href="http://www.codeplex.com/WarcraftAddOnStudio" rel="noreferrer">WarcraftAddOnStudio</a> which lets you make plugins in the visual studio environment.</p>
2,855
<p>I want to print the first 10000 prime numbers. Can anyone give me the most efficient code for this? Clarifications:</p> <ol> <li>It does not matter if your code is inefficient for n >10000.</li> <li>The size of the code does not matter.</li> <li>You cannot just hard code the values in any manner.</li> </ol>
<p><a href="http://en.wikipedia.org/wiki/Sieve_of_Atkin" rel="noreferrer">The Sieve of Atkin</a> is probably what you're looking for, its upper bound running time is O(N/log log N).</p> <p>If you only run the numbers 1 more and 1 less than the multiples of 6, it could be even faster, as all prime numbers above 3 are 1...
<pre><code>using System; namespace ConsoleApplication2 { class Program { static void Main(string[] args) { int n, i = 3, j, c; Console.WriteLine("Please enter your integer: "); n = Convert.ToInt32(Console.ReadLine()); if (n &gt;= 1) { ...
2,304
<p>How do I make gdb print functions of interest as they are called, indented according to how deep in the stack they are?</p> <p>I want to be able to say something like (made up):</p> <pre><code>(gdb) trace Foo* Bar* printf </code></pre> <p>And have gdb print all functions which begin with Foo or Bar, as they are c...
<p>In your case I would turn to the <code>define</code> command in gdb, which allows you to define a function, which can take up to 10 arguments.</p> <p>You can pass in the names of functions to "trace" as arguments to the function you define, or record them all in the function itself. I'd do something like the follow...
<p>You may call <code>gdb</code> in batch mode (using <code>-x</code> option), break where you need and ask for backtrace (<code>bt</code>), then you filter the result using <code>grep</code> or <code>egrep</code>.</p> <p>Indents are more difficult, however <code>bt</code> output is ordered so you have current functio...
40,199
<p>I have been researching asynchronous messaging, and I like the way it elegantly deals with some problems within certain domains and how it makes domain concepts more explicit. But is it a viable pattern for general domain-driven development (at least in the service/application/controller layer), or is the design ove...
<p>Great question :). The main problem with asynchronous messaging is that when folks use procedural or object oriented languages, working in an asynchronous or event based manner is often quite tricky and complex and hard for the programmer to read &amp; understand. Business logic is often way simpler if its built in ...
<p>I agree with @BradS too BTW</p> <p>BTW <a href="http://activemq.apache.org/camel/hiding-middleware.html" rel="nofollow noreferrer">here's a way of hiding the middleware from your business logic</a> while still getting the benefits of loose coupling &amp; SEDA - while being able to easily switch between a variety of...
9,849
<p>I'm using Visual Studio 2008 Team System with SP1, and I've noticed an annoying tendency for the IDE to hang for several (10-15) seconds whenever I stop debugging an application. At first I thought this only happened with WPF apps, but I've observed the behavior in Windows Forms apps and ASP.NET sites as well. I'v...
<p>Looking at your ProcMon results, it appears that it's that CreateFile() call that's taking all the time. I'm assuming that all activity is waiting for that thread to return. You can verify this -- with some difficulty -- in Process Explorer (also part of the SysInternals package previously linked), using the Threa...
<p>Does it hangover even with basic apps? Like making a new windows form then hitting debug, or is it only with more complicated apps? Because I've noticed that before too (maybe not quite 10-15 seconds, but there has been a bit of a lag that I've noticed) but when I just tried debugging a relatively simple windows f...
24,249
<p>I'm looking for a good pattern to resolve the following circular reference in a Windows Form application:</p> <ul> <li>Assembly 1 contains a Windows Form with an Infragistics menu item ".Show"ing a Form in Assembly 2</li> <li>Assembly 2 contains a Windows Form with an Infragistics menu item ".Show"ing a Form in Ass...
<p>You could (in both cases) make the button simply raise an event. The shell exe references both assemblies, and hooks up the even to show the other form.</p> <p>So the exe knows about both; neither of the forms knows about the other.</p> <p>For example (same concept):</p> <pre><code>using System; using System.Wind...
<p>What about using Interfaces? You could build a third library containing interfaces, and every window implements one interface from itself, and references the interface of the other window.</p>
47,369
<p>I'm searching for a code that will alow access to the SMS messages stored in a Pocket PC device with Windows Mobile so I can download/backup them to a Windows PC.</p> <p>Anyone knows how to do this?</p>
<p>You might start by looking at <a href="http://msdn.microsoft.com/en-us/library/ms839381.aspx" rel="nofollow noreferrer">the documentation</a>, on how to build SMS enabled applications that expose the API's for you.</p>
<p>Never played with it, but assembly Microsoft.WindowsMobile.PocketOutlook.dll contains classes SmsAccount and SmsMessage. Look at <a href="http://msdn.microsoft.com/en-us/library/microsoft.windowsmobile.pocketoutlook.aspx" rel="nofollow noreferrer">this documentation</a>.</p>
46,226
<p>I'm working with a Java program that has multiple components (with Eclipse &amp; Ant at the moment). </p> <p>Is there some way to start multiple programs with one launch configuration? I have an Ant target that does the job (launches multiple programs) but there are things I would like to do:</p> <ul> <li>I would...
<p>['multiple launch part':]</p> <p>If you have an ant launch configuration which does what you want, you can always transform it into a java launcher calling ant.</p> <pre><code>Main Class: org.apache.tools.ant.Main -Dant.home=${resource_loc:/myPath/apache_ant} -f ${resource_loc:/myProject/config/myFile-ant.xml} </c...
<p>There's actually a ticket opened at Eclipse site which requests this very same functionality. One of the contributors there proposed a plugin which allows grouping more launch configurations (possibly of different types) and start all of them with one mouse click. </p> <p>Although the plugin functionality is limite...
40,902
<p>I have been having some problems trying to get my PHP running. When I try and run any scripts they appear in the source and do not run properly. This is the htaccess file:</p> <pre><code># Use PHP5 as default AddHandler application/x-httpd-php5 .php AddType x-mapp-php5 .php AddHandler x-mapp-php5 .php </code></pre>...
<p>Change <code>AddHandler application/x-httpd-php5 .php</code> to <code>AddHandler application/x-httpd-php .php</code> and ensure the file you're hitting has the .php extension. Also comment out those other two <code>AddType</code>/<code>AddHandler</code> lines (the <code>x-mapp-*</code> ones). What someone else said...
<p>is libphp5.so loaded?</p> <p>That AddHandler directive, I believe, should be:</p> <p>AddType application/x-httpd-php .php</p> <p>I'm not sure what the x-mapp-php5 directives are for though...</p>
29,556
<p>Thinking about a Windows-hosted build process that will periodically drop files to disk to be replicated to several other Windows Servers in the same datacenter. The other machines would run IIS, and serve those files to the masses.</p> <p>The total corpus size would be millions of files, 100's of GB of data. It'...
<p>I've used rsync scripts with good success for this type of work, 1000's of machines in our case. I believe there is an rsync server for windows, but I have not used it on anything other than Linux.</p>
<p>We use ROBOCOPY in my organization to pass files around. It runs very seamlessly and I feel it worth a recommendation.</p> <p>Additionally, you are not doing anything too crazy. If you are also proficient in perl, I am sure you could write a quick script that will fulfill your needs. </p>
11,174
<p>document.body.offsetWidth returns the innerwidth value from left hand side to the left side of the vertical scrollbar in firefox. In IE it doesn't, instead it returns from left hand side to the right side of the vertical scrollbar. Does anyone know a sensible way I could make a veriable such as "var = offsetw;" for ...
<p>Check if you have "support for script debugging" enabled in Console. Its disabled by default for performance reasons.</p>
<p>I usually see this behavior if I forget to set a break point, or I have set the break points in places that don't get executed (so execution never stops, so the play button would never do anything).</p>
40,240
<p>i'm looking for a way to programatically convert word documents in docx format to doc format without using ole automation. i already have a windows service that does this but it means installing office on a server and it is a little unreliable and not supported. i am aware of the aspose.words product, and i will t...
<p>One option without using OLE automation would be to wrap the converter dlls coming with compatibility pack in order to convert from docx to doc without automating Office.</p> <p>This requires only that the Compatibility Pack of Office is installed on the machine.</p> <p>The Office converter dlls convert from the d...
<p>You could use <a href="http://dev.plutext.org" rel="nofollow noreferrer">docx4j</a> (or indeed, just poi) to read the docx, and poi to write it out as a .doc</p>
36,284
<p>I've got a C++ service which provides a named pipe to clients with a NULL SECURITY_ATTRIBUTES as follows:</p> <p><code> hPipe = CreateNamedPipe( lpszPipename, PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED, PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT, PIPE_UNLIMITE...
<p>The additional time could be due to Reporting Services rendering the report in addition to querying the data. For example if you have 55,000 rows returned for the report and the report server then has to group, sort and/or filter those rows to render the report then that could take additional time.</p> <p>I would h...
<p>Obviously getting the report running correctly (i.e. taking the same order of magnitude of time to select the data as SSMS) would be preferable but as a work around, would your report support execution snapshots (i.e. no parameters, or parameter defaults stored in the report)?</p> <p>This will allow a scheduled sna...
44,217
<p><a href="https://stackoverflow.com/questions/13699/choosing-a-c-unit-testing-toolframework#13897">This answer</a> to a question about C++ unit test frameworks suggests a possibility that had not occurred to me before: using C++/CLI and NUnit to create unit tests for native C++ code.</p> <p>We use NUnit for our C# t...
<p>We do this all of the time. We have many assemblies written with C++/CLI and use C# and NUnit to test them. Actually, since our goal is to provide assemblies that work well with C#, doing this makes sure that we have accomplished that.</p> <p>You can also write NUnit tests in C++/CLI and call unmanaged C++. Prob...
<p>I never used one, but isn't there a port? Perhaps <a href="http://cunit.sourceforge.net/documentation.html" rel="nofollow noreferrer">http://cunit.sourceforge.net/documentation.html</a> would work for you.</p>
30,184
<p>I was wondering if anyone has any preference for referencing images/ css or javascript files in their sites?</p> <p>The reason I ask is if a client wants to host the site we've writen under a virtual directory, the site usually has to have it's file references changed - even down to url (...image path) in CSS files...
<p><strong>Images</strong> (like background-url) <strong>in CSS are always referenced relative to the css file.</strong></p> <p>Example:</p> <pre><code>/img/a.gif /css/c.css </code></pre> <p>To reference <code>a.gif</code> from the css file, you must always reference it like such <code>../img/a.gif</code>, irrelevan...
<p>You can still use relative addresses with "up" navigation:</p> <p>E.g. In <code>/styles/main.css</code> for <code>/images/bg.png</code>:</p> <pre><code>background-image: url('../images/bg.png'); </code></pre> <p>Or in <code>/path/to/this/page.html</code> for <code>/index.html</code></p> <pre><code>&lt;a href=".....
48,948
<p>Will .Net 4.0 use a new version of the CLR (v2.1, 3.0) or will it stick with the existing v2.0?</p> <p>Supplementary: Is it possibly going to keep with CLR v2.0 and add DLR v1.0?</p> <p>Update: Whilst this might look like a speculative question which cannot be answered, the VS team appear to be releasing more and ...
<p>4.0 is going to be another side by side release from what I have read.</p> <p><a href="http://blogs.msdn.com/wenlong/archive/2008/09/07/net-4-0-wf-wcf-and-oslo.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/wenlong/archive/2008/09/07/net-4-0-wf-wcf-and-oslo.aspx</a></p>
<p>To state it yet another way - according to Microsoft's <a href="http://www.microsoft.com/downloads/details.aspx?familyid=752CB725-969B-4732-A383-ED5740F02E93&amp;displaylang=en" rel="nofollow noreferrer">Visual Studio 2010 and .NET Framework 4 Training Kit</a> - 4.0 will stand on it's own (i.e., will <strong><em>not...
17,929
<p>I've got an application that's using string.compare(string,string) to sort some values. The thing I can't figure out is why "1022" compares as less than "10-23" and "10-23" compares as less than "1024".</p> <p>Is there something specific to the value of "-" that causes this result? Will that overload of string.co...
<p>From the documentation of <a href="http://msdn.microsoft.com/en-us/library/84787k22.aspx" rel="nofollow noreferrer">string.Compare(String, String)</a>:</p> <blockquote> <p>The comparison is performed using word sort rules.</p> </blockquote> <p>and <a href="http://msdn.microsoft.com/en-us/library/system.globaliza...
<p>Well, ignoring the dashes is fairly innocent. If you want to include them, perhaps use <code>StringComparison.Ordinal</code> in the overload.</p> <p>Reading the <a href="http://msdn.microsoft.com/en-us/library/84787k22.aspx" rel="nofollow noreferrer">docs for <code>string.Compare</code></a>, it uses word sort rules...
33,131
<p>I use Eclipse (3.4) and my class compiles without warning or errors. My project uses an external jar file.</p> <p>Where do I need to put this external jar file in order not to get a <code>java.lang.NoClassDefFoundError</code> when using this class from another project (not in Eclipse)?</p> <p>I could just extract ...
<p>If you're wanting to include a JAR file to your Eclipse project, you would generally create a 'lib' folder inside the project folder, and put the file in there. You then need to tell eclipse to include it in your class path so your code will compile and run inside eclipse. <br/><br/> To do that:<br/> - Go into the p...
<p>I place it into a new folder. This folder has to be included into the build path. It does not matter if it's in Eclipse or outside. Eclipse has a project specific build path and it passes this path to the javac. If you want to execute javac outside of Eclipse, you have to pass the build path manually.</p>
42,160
<p>I am trying to write a servlet that will send a XML file (xml formatted string) to another servlet via a POST. (Non essential xml generating code replaced with "Hello there")</p> <pre><code> StringBuilder sb= new StringBuilder(); sb.append("Hello there"); URL url = new URL("theservlet's URL"); HttpU...
<p>This kind of thing is much easier using a library like <a href="http://hc.apache.org/httpclient-3.x/" rel="noreferrer">HttpClient</a>. There's even a <a href="http://svn.apache.org/viewvc/httpcomponents/oac.hc3x/trunk/src/examples/PostXML.java?view=markup" rel="noreferrer">post XML code example</a>:</p> <pre><code>...
<p>Don't forget to use: </p> <pre><code>connection.setDoOutput( true) </code></pre> <p>if you intend on sending output.</p>
12,197
<p>I'm working with a database schema that is running into scalability issues. One of the tables in the schema has grown to around 10 million rows, and I am exploring sharding and partitioning options to allow this schema to scale to much larger datasets (say, 1 billion to 100 billion rows). Our application must also...
<p>I agree with the other answers that you should look at your schema and indexes before resorting to sharding. 10 million rows is well within the capabilities of any of the major database engines.</p> <p>However if you want some resources for learning about the subject of sharding then try these: </p> <ul> <li><a h...
<p>10 million rows is really not large in DBMS terms and I'd be looking first at my indexing and query plans before starting to plan a physical distribution of data with shards or partitions, which shouldn't really be necessary until your table's grown by a couple of orders of magnitude.</p> <p>All IMHO, of course.</p...
37,260
<p>I have built a database in MS Access. There I have a table called Customers which also has a cell called Employee type: integer. I also built a program in C++ which controls all data.</p> <p>Let's say I have a string like this:</p> <pre><code>string sqlString = "SELECT * FROM Customers Where Customers.Employee = '...
<p>You need to convert id to a string, then your first approach should work.</p> <p>See this question for how to do the conversion: <a href="https://stackoverflow.com/questions/228005/alternative-to-itoa-for-converting-integer-to-string-c">Alternative to itoa() for converting integer to string C++?</a></p>
<p>you can use boost::format with boost::str</p> <pre><code>string = boost::str(boost::format("This is a string with some %s and %d numbers") %"strings" %42); </code></pre> <p>this should be better approach since you will have all the replacement variable in one place at the end.</p>
49,535
<p>I tend to do a lot of projects on short deadlines and with lots of code that will never be used again, so there's always pressure/temptation to cut corners. One rule I always stick to is encapsulation/loose coupling, so I have lots of small classes rather than one giant God class. But what else should I never compro...
<p>Not OOP, but a practice that helps in both the short and long run is DRY, Don't Repeat Yourself. Don't use copy/paste inheritance.</p>
<p>For this special case (short deadlines and with lots of code that will never be used again) I suggest you to pay attention to embedding some script engine into your OOP code. </p>
40,533
<p>I have some code that opens a word document using VBScript on an ASP.net page:</p> <pre><code>set objWord = CreateObject("Word.Application") objWord.Visible = True objWord.Documents.Open "c:\inetpub\wwwroot\JSWordTest\test.doc", False, False, False </code></pre> <p>This works great but opens the word doc in anot...
<p>You can use this technique to get the contents of the Word document without displaying any windows at all. </p> <pre><code>' Declare an object for the word application ' Set objWord = CreateObject("Word.Application") objWord.Visible = False ' Don''t show word ' objWord.Documents.open("C:\test.doc")...
<p>If it is an option to install an ActiveX component at the client machines, you can try <a href="http://www.officeocx.com/" rel="nofollow">EDraw Office Viewer component</a> or the cheapter <a href="http://www.ultrashareware.com/Ultra-Office-Control.htm" rel="nofollow">Ultra Office Control</a>. Both are based on the D...
33,309
<p>One of the features of the modern (64 bit OS X and iPhone OS) Objective C runtime is the ability for properties to dynamically synthesize ivars without explicitly declaring them in the class:</p> <pre><code>@interface MyClass : NSObject { // NSString *name; unnecessary on modern runtimes } @property (retain) NSSt...
<p>I went and looked at the documentation again just now, and I think you're misreading it. Synthesized ivars are created at compile time, not at run time.</p> <p>According to the <a href="http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_5_section_3.html" rel="noreferrer">Objective-...
<p>You add properties at run-time with the <a href="http://developer.apple.com/library/ios/#documentation/Cocoa/Reference/Foundation/Protocols/NSKeyValueCoding_Protocol/Reference/Reference.html" rel="nofollow">NSKeyValueCoding Protocol</a>.</p> <pre><code>[myObject setValue:@"whatever" forKey:@"foo"]; </code></pre>
34,657
<p>Aloha</p> <p>I have a method with (pseudo) signature:</p> <pre><code>public static T Parse&lt;T&gt;(string datadictionary) where T : List&lt;U&gt; </code></pre> <p>This doesn't build. How can I restrict the in the method to accept only generic List&lt;> objects (which should of cource not contain T's but somethi...
<p>Well, you can have two type parameters:</p> <pre><code>public static T Parse&lt;T, U&gt;(string datadictionary) where T : List&lt;U&gt; </code></pre> <p>That way you'll also actually know what U is (in a compile-time manner)...</p> <p>EDIT: Alternatively (and better), just specify the element type and change the ...
<p>Assuming I read the question correctly, and you want to return <code>T</code> where <code>T : List&lt;U&gt;</code> (for some <code>T</code> and <code>U</code>)...</p> <p>As an aside - subclassing <code>List&lt;T&gt;</code> isn't usually very useful... <code>List&lt;T&gt;</code> doesn't provide any useful virtual me...
40,928
<p>How would one code the following C# code in Managed C++</p> <pre><code>void Foo() { using (SqlConnection con = new SqlConnection("connectionStringGoesHere")) { //do stuff } } </code></pre> <p><strong>Clarificaton:</strong> For managed objects.</p>
<p>Assuming you mean C++/CLI (not the old Managed C++), the following are your options:</p> <p>(1) Mimic a using-Block with using automatic / stackbased objects:</p> <pre><code>{ SqlConnection conn(connectionString); } </code></pre> <p>This will call the Destructor of the "conn" Object when the next enclosing blo...
<p>If you're concerned about limiting the variable's lifetime rather than automatic disposal, you can always just put it into its own scope:</p> <pre><code>void Foo() { { SqlConnection con = new SqlConnection("connectionStringGoesHere"); // do stuff // delete it before end of scope of cours...
44,011
<p>I'm still new to 3D printing and I want to print something. I expect that I'll mess it up since I find nothing to adjust it but it is now laying around for 4 months and I'm sick of it.</p> <p>So my question is where do I find Windows software to print something and of course where do I get a 3D model?</p> <p>I own...
<h2>First; find a model!</h2> <p>To print something you require a <strong>model</strong> (usually this is in STL format, look into websites called <a href="http://www.thingiverse.com" rel="nofollow noreferrer">Thingiverse</a> and <a href="https://www.myminifactory.com/" rel="nofollow noreferrer">MyMiniFactory</a> for e...
<p>If you're just starting out then Tinkercad (website) is a good place to start designing your own objects. Later you can get to grips with OpenScad for more complex shapes. Both are free.</p>
1,294
<p>I would like to create a stored procedure in MySQL that took a list as argument. For example, say that I would like to be able to set multiple tags for an item in one call, then what I want to do is to define a procedure that takes the ID of the item and a list of tags to set. However, I can't seem to find any way t...
<p><a href="http://forums.mysql.com/read.php?98,50521,50521#msg-50521" rel="noreferrer">This</a> article has some good discussion on the problem of parsing an array to a stored procedure since stored procedures only allow valid table column data-types as parameters.</p> <p>There are some neat things you can do with th...
<p>Not sure if these will work specifically in a SP, but there are ENUM and SET datatypes in MySQL 5 which may do what you need. <a href="http://dev.mysql.com/doc/refman/5.0/en/enum.html" rel="nofollow noreferrer">http://dev.mysql.com/doc/refman/5.0/en/enum.html</a> <a href="http://dev.mysql.com/doc/refman/5.0/en/set.h...
3,029
<p>I was introduced to VisualAssist a few years ago and for me there's no going back. Are there any other tools I'm missing out on?</p>
<p>If you're a vim user, <a href="http://www.viemu.com" rel="nofollow noreferrer">ViEmu</a> is indispensable. It's a plugin available for Visual Studio (SQL Server and Office as well, although it's sold separately) that transforms the editor into Vim.</p> <p>Another plugin by the same company is <a href="http://www.co...
<p>I tried <a href="http://www.jetbrains.com/resharper/" rel="nofollow noreferrer">Resharper</a> for a while. It was great but too expensive for my taste and I could not get my employer to purchase it when the trial expired. You might take a look.</p>
11,377
<p>An odd issue that I have been trying to address in a project - my calls to WebClient.DownloadFileAsync seem to be getting ignored and no exceptions are being raised. So far I have been able to determine this might be due to destination folder not existing, but from the looks of the MSDN documentation for <a href="h...
<p>Here are a few more resources you should check out:</p> <ol> <li><p>This DevExpress WinForms control: <a href="http://www.devexpress.com/Products/NET/Controls/WinForms/Wizard/" rel="nofollow noreferrer">http://www.devexpress.com/Products/NET/Controls/WinForms/Wizard/</a></p></li> <li><p>A home-grown wizards framew...
<p>The easiest way to create a wizard dialog is to use one of the third-party versions available that handle all of the "hard stuff" (the page navigation, UI framework, etc.) for you. The one I like the most is from <a href="http://www.divelements.co.uk/net/" rel="nofollow noreferrer">Divelements</a>; they have both a ...
5,967
<p>I have a problems with 3rd dimension in MDX Query (on MS SQL Server 2005). I can use 3rd dimension in Visual Basic (I have a cube there, using browser I can make 3 dim. queries -- owing to ON PAGES). I snooped it via MS SQL Profiler (it records databases queries). But when I tried to put the query into MS SQL SERVER...
<p>When you query Analysis Services with SQL Server Management Studio (SSMS) you get an ADOMD.NET Cellset object. This object represents your query results in a multidimensional fashion, laying out the information in several axes: Axis 0 for columns, axis 1 for rows, axis 2 for pages, etc.</p> <p>Although your query m...
<p>You say you "put the query into MS SQL SERVER" - what exactly do you mean? Did you try the cube browser that comes with Analysis Services? It's pretty rubbish.</p> <p>I think the problem is as simple as the error message you got - "Results cannot be displayed". In other words, the viewing software can show tables (...
49,878
<p>I have multiple RequireFieldValidators on my aspx page.</p> <p>On the backend (C#) I want to be able to tell which control specifically wasn't valid so I can apply a style to that control. I use the Page.IsValid method to see if the overall page passed validation but I need to know specifically which one control fa...
<p>As others have mentioned, you need to loop the validator collection of the page and check their states. <a href="http://msdn.microsoft.com/en-us/library/dh9ad08f.aspx" rel="nofollow noreferrer">MSDN has examples here.</a></p> <pre><code>If (Me.IsPostBack) Then Me.Validate() If (Not Me.IsValid) Then Dim msg As S...
<p>From memory, after calling Page.Validate() you can then check the individual validators to see which are valid using IsValid on the validator.</p>
25,576
<p>I am trying to convert my web application into a fully dynamic system. One thing I am trying to do is to load a different logo (set in the masterpage template) depending on the host.</p> <p>But, even though the code is hit (in page_init), there is no image displayed on any page inheriting the masterpage - no image,...
<p>Arrays of pointers like char** are problematic in kernels, since the kernels have no access to the host's memory. <BR> It is better to allocate a single <B>continuous</B> buffer and to divide it in a manner that enables parallel access.<BR> In this case I'd define a 1D array which contains all the strings positioned...
<p>The problem seems to be associated with the char** parameter. Turning this into a char* solved the warning, so I suspect that cuda might have problems with this form of data. Perhaps cuda prefers that one uses the specific cuda 2D arrays in this case.</p>
36,905
<p>If you want to some code to execute based on two or more conditions which is the best way to format that if statement ?</p> <p>first example:-</p> <pre><code>if(ConditionOne &amp;&amp; ConditionTwo &amp;&amp; ConditionThree) { Code to execute } </code></pre> <p>Second example:-</p> <pre><code>if(ConditionOne)...
<p>I prefer Option A</p> <pre><code>bool a, b, c; if( a &amp;&amp; b &amp;&amp; c ) { //This is neat &amp; readable } </code></pre> <p>If you do have particularly long variables/method conditions you can just line break them</p> <pre><code>if( VeryLongConditionMethod(a) &amp;&amp; VeryLongConditionMethod(b) ...
<p>When condition is really complex I use the following style (PHP real life example):</p> <pre><code>if( $format_bool &amp;&amp; ( ( isset( $column_info['native_type'] ) &amp;&amp; stripos( $column_info['native_type'], 'bool' ) !== false ) || ( isset( $column_info['driver:decl_...
31,534
<p>I am currently working on a website to track projects. In it, it is possible to create Service Level Agreements (SLAs). These are configurable with days of the week that a project can be worked on and also the timespan on each of those days. Eg. on Monday it might be between 08:00 and 16:00 and then on friday from 1...
<p>Here's some C# code which might help, it could be much cleaner, but it's a quick first draft.</p> <pre><code> class Program { static void Main(string[] args) { // Test DateTime deadline = DeadlineManager.CalculateDeadline(DateTime.Now, new TimeSpan(4, 0, 0)); ...
<p>There's a recursive solution that could work, try thinking along these lines:</p> <pre><code>public DateTime getDeadline(SubmitTime, ProjectTimeAllowed) { if (SubmitTime+ProjectTimeAllowed &gt;= DayEndTime) return getDeadline(NextDayStart, ProjectTimeAllowed-DayEndTime-SubmitTime) else r...
23,367
<p>I ask this question in anticipation as part of a project. I have experience of developing and consuming web services in the past and am au fait with those. However I have been told that as part of this next project I will need to use "secure" web services. Can you provide some insight into what additional developmen...
<p>Unless you have a complex multi-hop scenario, then SSL is vastly more practical and interoperable than anything based on WS-Security or related specification</p>
<p>If your going to be using WCF, check out these guide lines on <a href="http://msdn.microsoft.com/en-us/library/ms735093.aspx" rel="nofollow noreferrer">MSDN</a></p> <p>Exising ASMX Web Service can be secured using <a href="http://msdn.microsoft.com/en-us/library/ms977317.aspx" rel="nofollow noreferrer">Web Services...
41,837
<p>What would be the best way to manage large number of instances of the same class in MATLAB?</p> <p>Using the naive way produces absymal results:</p> <pre><code>classdef Request properties num=7; end methods function f=foo(this) f = this.num + 4; end end end &gt;...
<p>This solution expands on <a href="https://stackoverflow.com/questions/276198/matlab-class-array#276530">Marc's answer</a>. Use <strong>repmat</strong> to initialize an array of RequestH objects and then use a loop to create the desired objects:</p> <pre><code>&gt;&gt; a = repmat(RequestH,10000,1);tic,for i=1:10000 ...
<p><code>repmat</code> is your friend:</p> <pre><code>b = repmat(Request, 1000, 1); Elapsed time is 0.056720 seconds b = repmat(RequestH, 1000, 1); Elapsed time is 0.021749 seconds. </code></pre> <p>Growing by appending is abysmally slow, which is why mlint calls it out.</p>
34,826
<p>I'm trying to set up Eclipse for php web development. What I would like to do is preview a php web page from within Eclipse, but I cannot figure out how to do this. Is there an integrated web server of some sort that allows this, or do I have to set up IIS/Apache to do it? If so, do I have to have my php files in...
<p>There is a plugin for Eclipse called PDT which makes PHP development a breeze.</p> <p>For an overview on how to install it, you can refer to the Eclipse website:</p> <blockquote> <p><a href="http://wiki.eclipse.org/PDT/Installation#Eclipse_3.4_.2F_Ganymede_.2F_PDT_2.0" rel="noreferrer">http://wiki.eclipse.org/PD...
<p>Visit this website <a href="https://eclipse.org/pdt/" rel="nofollow">https://eclipse.org/pdt/</a>. Go to where it says 'Update existing Eclipse'.</p> <p>The procedure is this "In Eclipse, click Help -> Install New Software and work with *: <a href="http://download.eclipse.org/tools/pdt/updates/3.6" rel="nofollow">h...
29,489
<p>Creating hashes of hashes in Ruby allows for convenient two (or more) dimensional lookups. However, when inserting one must always check if the first index already exists in the hash. For example:</p> <pre><code>h = Hash.new h['x'] = Hash.new if not h.key?('x') h['x']['y'] = value_to_insert </code></pre> <p>It wo...
<p>You can pass the <a href="http://www.ruby-doc.org/core/classes/Hash.html#M002868" rel="nofollow noreferrer"><code>Hash.new</code></a> function a block that is executed to yield a default value in case the queried value doesn't exist yet:</p> <pre><code>h = Hash.new { |h, k| h[k] = Hash.new } </code></pre> <p>Of co...
<p>Autovivification, as it's called, is both a blessing and a curse. The trouble can be that if you "look" at a value before it's defined, you're stuck with this empty hash in the slot and you would need to prune it off later.</p> <p>If you don't mind a bit of anarchy, you can always just jam in or-equals style declar...
20,543
<p>On windows mobile when there is no internet connection and I try to browse the web using internet explorer i get cannot connect information at the top of the screen. It says cannot connect with current connection settings. To change your connection settings, tap settings. And I am able to tap Settings and setup netw...
<p>Have you had a look at <a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getcwd.html" rel="noreferrer"><code>getcwd()</code></a>?</p> <pre><code>#include &lt;unistd.h&gt; char *getcwd(char *buf, size_t size); </code></pre> <p>Simple example:</p> <pre><code>#include &lt;unistd.h&gt; #include &lt;stdi...
<p>Use <b>getcwd</b></p> <pre><code>#include &lt;stdio.h&gt; /* defines FILENAME_MAX */ //#define WINDOWS /* uncomment this line to use it for windows.*/ #ifdef WINDOWS #include &lt;direct.h&gt; #define GetCurrentDir _getcwd #else #include &lt;unistd.h&gt; #define GetCurrentDir getcwd #endif int main(){ char bu...
38,215
<p>I've been putting together a small web form for our technicians to use from their phones out in the field. However I'm having a lot of trouble getting things working using ASP.NET Mobile, and there seems to be few resources out there to help learn this stuff. I'm also having trouble <a href="https://stackoverflow....
<p>Depends which phones your customers will use. Not all phones support the full and rich HTML produced by classic ASP.NET controls. Mobile controls tend to produce simpler and specific for the device. Certainly there are limitations on the controls, but this is due to the limitations of the end devices.</p> <p>So, te...
<p>Use mobile controls has same adventages that web controls in web. Using Mobile Controls + Controls Adapters + WURFL helps to developing very fast to many devices.</p> <p>Yes, you can use WTAI primitives of WML: <code>&lt;a ref="wtai://wp/mc;34123456789"&gt;Call&lt;/a&gt;</code></p>
38,280
<p>I am working in the Linux environment, and I have a C++ program, what I want is when I cancel the program with ctrl+c I would like that the program executes a function, to close some files and print some sutff, is there any way to do this?. Thank you. </p>
<p><code>signal()</code> can be dangerous on some OSes and is deprecated on Linux in favor of <code>sigaction()</code>. <a href="https://www.petesh.com/archives/2008/11/signal_versus_sigaction/" rel="nofollow noreferrer">"signal versus sigaction"</a></p> <p>Here's an example that I ran across recently (<a href="http:/...
<p>Short answer: look into the signal function, specifically catching SIGINT. You write a callback function and pass it to the system via the signal function, then when that particular signal happens, the system calls your callback function. You can close files and do whatever other cleanup stuff you want in there.</p>...
48,168
<p>I am working on refactoring some old code and have found few structs containing zero length arrays (below). Warnings depressed by pragma, of course, but I've failed to create by "new" structures containing such structures (error 2233). Array 'byData' used as pointer, but why not to use pointer instead? or array of l...
<p>Yes this is a C-Hack.<br> To create an array of any length:</p> <pre><code>struct someData* mallocSomeData(int size) { struct someData* result = (struct someData*)malloc(sizeof(struct someData) + size * sizeof(BYTE)); if (result) { result-&gt;nData = size; } return result; } </code></pre> <...
<p>It's worth pointing out IMO the best way to do the size calculation, which is used in the Raymond Chen article linked above.</p> <pre><code>struct foo { size_t count; int data[1]; } size_t foo_size_from_count(size_t count) { return offsetof(foo, data[count]); } </code></pre> <p>The offset of the first...
37,676
<p>One of our internally written tool is fed a cvs commit trace of the form:</p> <pre><code>Checking in src/com/package/AFile.java; /home/cvs/src/com/package/AFile.java,v &lt;-- Afile.java new revision: 1.1.2.56; previous revision: 1.1.2.55 done </code></pre> <p>The tool then acquires the file from cvs by...
<p>It is not clear what is your final goal: to bring whole repository into required state (choosen revision of the choosen branch) or to acquire the single file from the repository for further processing. I assume it is the latter.</p> <p>Then, you need this command:</p> <pre><code>cvs checkout -r &lt;revision&gt; -p...
<p>I did this:</p> <pre><code>cd &lt;to_your_file_directory&gt; mv user.cpp user.cpp.bak cvs update -r 1.55 user.cpp </code></pre>
23,085
<p>Specifically, I'm looking for a client-side, JavaScript and / or Flash based multiple file uploader. The closest thing I've found is <a href="http://digitarald.de/project/fancyupload/" rel="noreferrer">FancyUpload</a>. Anyone have experience with it? If not, what else is out there?</p>
<p>Yahoo's <a href="http://yuilibrary.com/yui/docs/uploader/uploader-dd.html" rel="nofollow noreferrer">YUI Uploader</a> is your friend.</p>
<p><a href="http://www.dropzonejs.com/" rel="nofollow">Dropzone</a> worked for me for simple drag-and-drop functionality that degrades gracefully. Very easy to set up.</p>
25,403
<p>We're seeing <code>JTable</code> selection get cleared when we do a <code>fireTableDataChanged()</code> or <code>fireTableRowsUpdated()</code> from the <code>TableModel</code>.</p> <p>Is this expected, or are we doing something wrong? I didn't see any property on the <code>JTable</code> (or other related classes) ...
<p>You need to preserve the selection and then re-apply it. </p> <p>First of all you will need to get a list of all the selected cells.</p> <p>Then when you re-load the JTable with the new data you need to programmatically re-apply those same selections.</p> <p>The other point I want to make is, if the number or row...
<p>I was facing same issue and when tried to search the reason I got this question but it seems a bug in Java SDK. <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4276786" rel="nofollow">http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4276786</a></p> <p>WORK AROUND</p> <p>A temporary work-around is ava...
31,702
<p>want to pass boost::bind to a method expecting a plain function pointer (same signature).</p> <pre><code>typedef void TriggerProc_type(Variable*,void*); void InitVariable(TriggerProc_type *proc); boost::function&lt;void (Variable*, void*)&gt; triggerProc ... InitVariable(triggerProc); error C2664: 'InitVariable' :...
<p>Has anyone noticed that the <a href="https://stackoverflow.com/a/282433/20003">accepted answer</a> only works with trivial cases? The only way that function&lt;>::target() will return an object that can be bound to a C callback, is if it was constructed with an object that can be bound to a C callback. If that's the...
<p>can you get it working with bind?</p> <pre><code>#include &lt;boost/function.hpp&gt; #include &lt;boost/bind.hpp&gt; void f(int x) { (void) x; _asm int 3; } typedef void (*cb_t)(int); int main() { boost::function&lt;void (int x)&gt; g = boost::bind(f, 3); cb_t cb = *g.target&lt;cb_t&gt;(); //targ...
35,757
<p>I remember reading at one point that indexing a field with low cardinality (a low number of distinct values) is not really worth doing. I admit I don't know enough about how indexes work to understand why that is.</p> <p>So what if I have a table with 100 million rows in it, and I am selecting records where a bit ...
<p>Consider what an index is in SQL - and index is really a chunk of memory pointing at other chunks of memory (i.e. pointers to rows). The index is broken into pages so that portions of the index can be loaded and unloaded from memory depending on usage.</p> <p>When you ask for a set of rows, SQL uses the index to f...
<p><strong>measure</strong> response time before and after and see if it is worthwhile; theoretically it should improve performance for queries using the indexed fields but it really depends on the distribution of true/false values and the other fields involved in the queries that you're concerned about</p>
28,606
<p>I have a String which I would like to modify in some way. For example: reverse it or upcase it. </p> <p>I have discovered that the fastest way to do this is by using a unsafe block and pointers. </p> <p>For example: </p> <pre><code> unsafe { fixed (char* str = text) { ...
<p>The .Net framework requires strings to be immutable. Due to this requirement it is able to optimise all sorts of operations. </p> <p><a href="http://en.wikipedia.org/wiki/String_intern_pool" rel="noreferrer">String interning</a> is one great example of this requirement is leveraged heavily. To speed up some string ...
<p>Agreed about StringBuilder, or just convert your string to an array of chars/bytes and work there. Also, you gave the example of "upcasing" -- the String class has a ToUpper method, and if that's not <em>at least</em> as fast as your unsafe "upcasing", I'll eat my hat.</p>
28,387
<p>I’m just getting my feet wet with 3D printing, and I’ve had a few prints do this. Curious if anyone has any ideas for me that might help clean this up? (I don’t really have anyone in my personal circle who can help out, so hoping this community can :) )</p> <p>Edit 5/23 The first layer of the print is inconsistent i...
<p>It looks like your nozzle is a little too close to the bed, if there is not enough space, you can see through the layer and pressure can build up and ooze out when there is a little more room in a different location (if the bed isn't completely flat/straight).</p> <p>You could level with a thicker piece of paper or ...
<p>It looks like a bed adhesion problem to me. Some additive information: What is your bed material?</p> <p>Z-calibration problem isn't the only suspect. I've seen the same problem with my printer before. There were defects in some parts of my glass print bed that prevented it from sticking.</p> <p>The molten filament ...
1,946
<p>How to include COM components on a published .Net site?</p>
<p>Finally i succeeded to solve the issue :</p> <p>To include the COM component on your published site :</p> <ol> <li>Include the reference of the assembly in you config file of server [Locally it gets added by itself when you add the reference] .</li> <li>Include the dll in your bin folder</li> <li>Goto start-->run-...
<p>Can I clarify? It sounds like you want to use client-side activex controls embedded in the html (via <code>&lt;object/&gt;</code>). Is that correct?</p> <p>This isn't a very safe approach; many browsers / platfroms simply won't work this way. If you <em>know</em> your client is IE/windows, then you can perhaps sign...
43,243
<p>When attempting to understand how a SQL statement is executing, it is sometimes recommended to look at the explain plan. What is the process one should go through in interpreting (making sense) of an explain plan? What should stand out as, "Oh, this is working splendidly?" versus "Oh no, that's not right."</p>
<p>I shudder whenever I see comments that full tablescans are bad and index access is good. Full table scans, index range scans, fast full index scans, nested loops, merge join, hash joins etc. are simply access mechanisms that must be understood by the analyst and combined with a knowledge of the database structure an...
<h2>Rules of Thumb</h2> <p>(you probably want to read up on the details too:</p> <ul> <li><a href="http://download.oracle.com/docs/cd/B28359_01/server.111/b28274/ex_plan.htm#PFGRF009" rel="nofollow noreferrer">Oracle Docs</a></li> <li><a href="http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:23181411...
10,464
<p>I have a project using GWT and it displays data in a table.</p> <p>I need a Table for GWT that supports:</p> <ul> <li>sorting by particular column</li> <li>scrolling the data, while the header is immobile</li> <li>filtering rows for data searched in the table</li> </ul> <p>The project is being created for interna...
<p>The standard <a href="http://code.google.com/intl/hu-HU/webtoolkit/doc/latest/DevGuideUiCellWidgets.html#celltable" rel="noreferrer">CellTable</a> supports sorting. (Hopefully more features will come soon.)</p>
<p><a href="http://code.google.com/p/gwt-ext/" rel="nofollow noreferrer">GWT Ext</a> provides a table that meets these requirements. </p> <p>It provides a wrapper around the Ext javascript library, so its best to commit to using either only GWT Ext widgets, or GWT widgests. They can be combined, but sometimes don't ...
19,547
<p><strong>back story:</strong> I am designing a portfolio website for myself. on its home page, the logo is front and center but on the sub pages the logo is top &amp; right. </p> <p>I thought it would be a nice visual cue (upon clicking a link to a sub page) to use jQuery to animate the movement of the logo from the...
<p>You also need to return false or prevent the default action of the anchor click event otherwise the browser will just follow the href. Anyway agreed a live demo is better than 1000 words.</p> <p><a href="http://pastebin.me/493e1605948d4" rel="noreferrer">See a live demo here</a></p> <p>e.g</p> <pre><code> $('#myL...
<p>Try this:</p> <pre><code> $("#thelink").click( function(){ $(this).animate( { animation stuff }, "medium", "easeboth", function(){ document.location = $(this).attr('href'); }); }); </code></pre> <p>Or when the link is not animated but the image (as your question states):</p> <pre><code> $("#thelink").c...
45,727
<p>Has Java 1.6 SDK been released for mac? I can't seem to find it...</p>
<p>Yes, but only for 64-bit Intel-based Macs, i.e. Macs using Core 2 (duo or solo) or Xeon chips. The original Core chip is not supported, nor is any PPC chip. Also, Java 6 is currently Leopard-only. The update should appear in Software Update, if you have a compatible Mac and recent-enough OS version.</p> <p>Here are...
<p>If you dont see it, you may have to go to the <a href="http://developer.apple.com/referencelibrary/Java/" rel="nofollow noreferrer">Developers Connection for apple</a>. If you want to download Java, you may have to signup for a free account.</p>
28,503
<p>I have a lot of nice MATLAB code that runs too slowly and would be a pain to write over in C. The MATLAB compiler for C does not seem to help much, if at all. Should it be speeding execution up more? Am I screwed?</p>
<p>I'll echo what dwj said: if your MATLAB code is slow, this is probably because it is not sufficiently vectorized. If you're doing explicit loops when you could be doing operations on whole arrays, that's the culprit.</p> <p>This applies equally to all array-oriented dynamic languages: Perl Data Language, Numeric P...
<p>By Matlab compiler you probably mean the command mcc, which does speed the code a little bit by circumventing Matlab interpreter. What would speed the MAtlab code significantly (by a factor of 50-200) is use of actual C code compiled by the mex command.</p>
16,575
<p>I am writing a DB upgrade script that will check to see if an index has the right two columns defined. If it doesn't, or if it only has one of them, then I will DROP it (is there a way to ALTER an index?) and then recreate it with both.</p>
<p>I don't have a database immediately on-hand to test this, but you should be able to see if a column exists in an index by using the following IF EXISTS statement.</p> <p>I'm not sure whether you can alter an index on the fly.</p> <pre><code>IF EXISTS ( SELECT MyIndex.Name AS IndexName, Columns.name A...
<p>Thanks for your help, Ed. Here is the solution I wrote using yours as a start. It has been verified. Basically it has all of the correct joins.</p> <pre> <code> IF EXISTS ( SELECT i.Name AS IndexName, c.Name AS ColumnName FROM sys.indexes i JOIN sys.index_columns ic ON i.object_id = i...
28,523
<p>Could someone tell me what the units the <code>SetTimeout(int)</code> method in the <code>ICriteria</code> interface uses?<br> Is it milliseconds, seconds, minutes or other?</p>
<p>A little bit of poking around suggests that it could be seconds:</p> <p>Assuming that ICriteria is the same as the Criteria interface in Hibernate core, then the JavaDoc for <a href="http://www.hibernate.org/hib_docs/v3/api/org/hibernate/Criteria.html#setTimeout(int)" rel="noreferrer">org.hibernate.Criteria</a> pro...
<p>I think it's seconds. The NHibernate API closely mirrors Hibernate Core for Java, where the <a href="http://www.hibernate.org/hib_docs/v3/api/org/hibernate/Criteria.html#setTimeout(int)" rel="nofollow noreferrer">Criteria.setTimeout(int)</a> method uses seconds as the units (see also <a href="http://java.sun.com/j2...
5,409
<p>I work at a college and have been developing an ASP.NET site with many, many reports about students, attendance stats... The basis for the data is an MSSQL server DB which is the back end to our student management system. This has a regular maintenance period on Thursday mornings for an unknown length of time (depen...
<p>Drop an html file called "app_offline.htm" into the root of your virtual directory. Simple as that.</p> <p><a href="http://weblogs.asp.net/scottgu/archive/2006/04/09/442332.aspx" rel="nofollow noreferrer">Scott Guthrie</a> on the subject and friendly errors.</p>
<p>Thanks for the replies so far I should point out I'm not the one that does the maintenance nor does I have access all the time to IIS. Also, I prefer options where I do nothing as like all programmers I am a bit lazy.</p> <p>I know one way is to check a flag on every page but I'm hoping to avoid it. Could I not do ...
11,443
<p>Whenever I use my MacBook away from my desk and later plug it into an external display (as primary), I get into the state of having windows deposited in both the notebook monitor and the external one.</p> <p>To move all windows to a single screen, my current solution is to "Turn on mirroring" in the display prefere...
<p><code>Cmd+F1</code> appears to be a Mirror Displays shortcut in Snow Leopard. Don't know about Lion, etc, though.</p> <p>Just tap it twice and see what happens (-:</p> <p>For the people who prefer to set up their function keys to act in the old-fashioned way (not as brightness/sound controls etc.), it will be <cod...
<p>Here is a command-line script to do just that: <a href="http://zach.in.tu-clausthal.de/software/" rel="nofollow noreferrer">http://zach.in.tu-clausthal.de/software/</a>.</p> <p>It's a little down the page under &quot;Move Off-Screen Windows to the Main Screen&quot;.</p> <hr /> <pre><code>-- Source: http://www.jonath...
6,011
<p>I've given up trying to apply lipstick to the pigs of installers that come out of <a href="http://en.wikipedia.org/wiki/Microsoft_Visual_Studio" rel="noreferrer">Visual Studio</a> and have decided to look at <a href="http://en.wikipedia.org/wiki/WiX" rel="noreferrer">WiX</a>.</p> <p>What resources would you recomme...
<ul> <li>The <a href="https://www.firegiant.com/wix/tutorial/" rel="noreferrer">WiX tutorial</a> is the #1 resource</li> <li>The people on the <a href="http://wixtoolset.org/documentation/mailinglist/" rel="noreferrer">mailing list</a> are very helpful</li> <li>There's a The Code Project article, <em><a href="http://ww...
<p>Chiming in with another shameless plug; I recently wrote an article where I somewhat desperately try to explain some of the concepts of WiX in a more easily-understood way than the others. No offence.</p> <p><a href="http://www.optimalbpm.se/wiki/index.php/WiX" rel="nofollow">http://www.optimalbpm.se/wiki/index.php...
39,992
<p>If i have the following directory structure:</p> <p>Project1/bin/debug<br> Project2/xml/file.xml</p> <p>I am trying to refer to file.xml from Project1/bin/debug directory</p> <p>I am essentially trying to do the following:</p> <pre><code>string path = Environment.CurrentDirectory + @"..\..\Project2\xml\File.xml"...
<p>It's probably better to manipulate path components as path components, rather than strings:</p> <pre><code>string path = System.IO.Path.Combine(Environment.CurrentDirectory, @"..\..\..\Project2\xml\File.xml"); </code></pre>
<p>Please note that using Path.Combine() might not give you the expected result, e.g:</p> <pre><code>string path = System.IO.Path.Combine(@"c:\dir1\dir2", @"..\..\Project2\xml\File.xml"); </code></pre> <p>This results in in the following string:</p> <pre><code>@"c:\dir1\dir2\dir3...
45,054
<p>I installed Visual Studio 2005 ( with SP1 ) and made the default settings as what is required for C++ . </p> <p>Now i open a solution and run the exe . Under " Tools " menu item i go and Select " Attach the process " and i attach it to the exe i just ran . I put breakpoints several places in the code ( this breakp...
<p>Perhaps it is attaching to "the wrong kind" of code.</p> <p>In the "Attach to Process" dialog, there is a setting that allows you to select the kind of code you want to debug. Try clicking "Select" button next to "Attach to" text box and checking only <s>"Managed code"</s> the relevant code type.</p> <p><a href="h...
<p>Are you in Debug mode? I've had this problem when I was trying to do it in Release mode. It doesn't complain, it just doesn't hit the breakpoints.</p>
11,754