instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>This works (prints, for example, “3 arguments”):</p>
<pre><code>to run argv
do shell script "echo " & (count argv) & " arguments"
end run
</code></pre>
<p>This doesn't (prints only “Argument 3: three”, and not the previous two arguments):</p>
<pre><code>to run argv
do shell script "echo " & (c... | <p>Try this to avoid having to use the temporary file.</p>
<pre><code>to run argv
set accumulator to do shell script "echo " & (count argv) & " arguments" altering line endings false
repeat with i from 1 to (count argv)
set ln to do shell script "echo 'Argument " & i & "... | <p>Your problem appears to be unrelated to the loop, or the use of argv, for that matter. Here's a much simpler test case where only the last <code>do shell script</code> actually returns a result:</p>
<pre><code>do shell script "echo foo"
delay 2
do shell script "echo bar"
</code></pre>
<p>In addit... | 34,576 |
<p>What's the best way to get a nice clean URL structure like stack overflow has? </p>
<p>Do I need to use IIS for this? Or is there a way I can do it with some sort of mapping file in asp .net?</p>
<p>The site I want this for has hundreds of pages, and is already deployed.<br>
I would like a method that requires the... | <p>Perhaps <a href="http://weblogs.asp.net/scottgu/archive/2005/11/14/430493.aspx" rel="nofollow noreferrer">urlMappings</a> could work for you:</p>
<pre><code><system.web>
<urlMappings enabled="true">
<add url="~/test/" mappedUrl="~/test.aspx"/>
</urlMappings>
</code></pre>
<p>To make... | <p>i dont know if IIS6.0 supports it or not, but i use web.sitemap, i add an attribute with every node that equals the pretty name i want, then with Application_onBegin I map the pretty url of the request to the one in the sitemap...</p>
<p>you asked for the best way, but I dont think there is one "best" way, Ive seen... | 26,545 |
<p>I have created an <strong>application which needs 'hand-over'</strong> to the support group in the next month.</p>
<p>The application is <strong>fairly small</strong> (2 months development), and consists of two client side applications and a database, it's written in c# for the windows platform.</p>
<p><strong>I h... | <p>Having been on both sides of this process professionally, I can say that the following should be <strong><em>mandatory</em></strong>:</p>
<ul>
<li>the documentation of the code (javadoc, doxygen, etc) </li>
<li>details on build process
<ul>
<li>where to get current source</li>
<li>how to file bugs (they will happ... | <ul>
<li>A usermanual is a neat thing (pictures, descriptions, aso.)</li>
<li>A rundown of the different features within the application</li>
</ul>
<p>Thats what i'm thinking ontop of my head if this is "only" for support staff and not further development.</p>
| 25,161 |
<p>Today the blinkenlights <a href="http://blinkenlights.net/stereoscope" rel="nofollow noreferrer">stereoscope</a> project starts as part of the <a href="http://www.scotiabanknuitblanche.ca/" rel="nofollow noreferrer">nuit blanche</a> art event in Toronto. The Toronto city hall is transferred into a giant matrix displ... | <p>There's a ton of art projects involving technology / code over at <a href="http://processing.org/exhibition/index.html" rel="nofollow noreferrer">processing.org</a></p>
| <p>Every code project you work on should be a form of art, and wonderful to behold. </p>
<p>I am only being partly facetious here. Part of why people enjoy computer programming is the sculptural/artistic nature of the whole thing. Code for beauty of structure and appearance, and you often also have better code...<... | 20,430 |
<p>What is the % code-coverage on your project? I'm curious as to reasons why.</p>
<p>Is the dev team happy with it? If not, what stands in the way from increasing it? </p>
<p>Stuart Halloway is one whose projects aim for 100% (or else the build breaks!). Is anyone at that level?</p>
<p>We are at a painful 25% but ... | <p>We run at 85% code coverage, but falling below it does not break the build. I think using code coverage as an important metric is a dangerous practice. Just because something is covered in a test does not mean the coverage is any good. We try to use it as guidance for the areas we are weakly covered, not as a har... | <p>I often use code coverage under our automated test suite, but primarily to look for untested areas. We get about 70% coverage most of the time, and will never hit 100% for two reasons;</p>
<p>1) We typically automate new functionality <strong>after</strong> the release which is manually tested for it's first rele... | 23,673 |
<p>I haven't looked at this in a while, but if I recall correctly both ant and maven still rely on JUnit 3 for unit tests (as of maven 2.09 the default POM file still has JUnit 3.81). </p>
<p>Does it still make sense to stick to JUnit 3 instead of using the latest and greatest? Any good reason I might be missing?</p>
| <p>I don't see a reason to stick to the 3.x versions. Most tools have been compatible with 4.x for a while now. The only reason I would stick to 3.x is in a java 1.4 environment (because there is no other way).</p>
<p>By the way, maven is switching to Java 5 in 2.1, so there is a chance they will propose junit 4.x</p>... | <p>Maven has no explicit binding to Junit 3.81. You can switch to any version of junit you want. If you're running java 5 I think you should switch to at least 4.4 Spring 2.5 is not compatible with 4.5.</p>
| 42,859 |
<p>Is it possible to retrieve variable set in <code>onreadystatechange</code> function from outside the function?
<bR>--edit--<BR>
Regarding execution of functions:<BR>
If its possible i would like to execute ajaxFunction() with one click<BR>
and then popup() with next click, or
somehow wait for ajax function to end... | <p>The following code assumes that the ajax-request is synchronous:</p>
<pre><code>function popup(){
ajaxFunction();
alert(MyVariable);
}
</code></pre>
<p>But since synchronous requests are blocking the browser you should in almost all cases use asynchronous calls (If I remember correctly onreadystatechange s... | <p>Why not change <code>MyVariable</code>'s scope to outside of the function?</p>
<pre><code>var MyVariable;
function ajaxFunction(){
//creating AJAX
...
// Create a function that will receive data sent from the server
ajaxRequest.onreadystatechange = function (){
if(ajaxRequest.readyStat... | 36,984 |
<p>I just got the Ender 5 Plus with BLTouch set up today. I was having some massive issues and determined that my leveling was off because the BLTouch was flashing red and not connecting. When I turn on the printer there is about a 50% chance that it will probe correctly by deploying the pin and correctly retracting it... | <p>I have used a standard soldering iron to modify and fix 3D prints in the past. You have to keep some things in mind when doing so:</p>
<ul>
<li>Don't overheat your material. PLA can take a soldering iron of about 230 °C before charring.</li>
<li>Don't use a tip with solder, or you will get grey deposits in the plast... | <p>Cutting materials with a 'hot knife' isn't anything new. There should be a fairly established toolset for working foam. For 3D prints, I prefer to add coatings rather than modify surfaces with a hand held tool after. I do run a drill bit through printed holes though.</p>
| 1,913 |
<p>I am looking for a pseudo random number generator which would be specialized to work fast when it is given a seed before generating each number. Most generators I have seen so far assume you set seed once and then generate a long sequence of numbers. The only thing which looks somewhat similar to I have seen so far ... | <p>Seems like you're asking for a hash-function rather than a PRNG. Googling 'fast hash function' yields several promising-looking results.</p>
<p><a href="http://burtleburtle.net/bob/hash/integer.html" rel="noreferrer">For example</a>:</p>
<pre><code>uint32_t hash( uint32_t a)
a = (a ^ 61) ^ (a >> 16);
... | <p>If memory is not really an issue and speed is of utmost importance then you can prebuild a large array of random numbers and just iterate through it at runtime. For example have a seperate program generate 100,000 random numbers and save it as it's own file like </p>
<p>unsigned int randarray []={1,2,3,....}</p>
<... | 20,259 |
<p>I want to make sure people can't type the name of a PHP script in the URL and run it. What's the best way of doing this?</p>
<p>I could set a variable in the file that will be including this file, and then check that variable in the file being included, but is there an easier way?</p>
| <p>You could check the URI and see if that file is being called with `</p>
<pre><code>$_SERVER['SCRIPT_FILENAME']
</code></pre>
<p>or you could move the file outside the public folder, this is a better solution.</p>
| <p>The Zend Framework recommends you keep the files outside the web root, as Unkwntech has suggested. I'd say this is the safest and most fool proof solution.</p>
| 20,857 |
<p>SQL Server Version 2000.</p>
<p>We've a bunch of desktops talking to MSSQL Server. When looking for a specific record, some desktops return the correct data, but some do not. </p>
<p>The SQL Command is "SELECT * FROM PODORDH WHERE ([NO]=6141)"
On one or two desktops, this returns a record. On the server and on all... | <p>This error probably comes from an user who deleted/inserted that record within a transaction but did not yet commit said transaction.</p>
| <p>Perhaps one or two users who find records are using a different schema-name and thus a different tables. IE most users are using dbo.PODORDH, but one or two users are using otheruser.PODORDH.</p>
| 10,897 |
<p>Where to read up on (the best-practice in) source code formatting, for individual languages i.e. what are the conventions for naming variables etc., for indentation and where to place braces, how and where to include comments, etc. </p>
<p>For example for C Kernighan and Ritchie's book <a href="https://rads.stackov... | <p>I wouldn't give too much on such style-guides. They are a good start, but in the end you or your team will develop own coding-styles.</p>
<p>EDIT: Rob Kam made a comment, that he want to find out more about these 'starting-conventions'.</p>
<p>That's a good point. But mostly you will join existing projects, open-s... | <p>Hello and good day for everyone</p>
<p>Well i must say that it depends
It depends on if you work for a company
or if you work for you ;)</p>
<p>If you work for a company you mus accept the naming style and other rules</p>
<p>and for you, you only need to establish a style that everybody including yourself can ins... | 28,831 |
<p>My previous job involved maintenance and programming for a very large database with massive amounts of data. Users viewed this data primarily through an intranet web interface. Instead of having a table of user accounts, each user account was a real first-class account in the RDBMS, which permitted them to connect... | <p>I don't agree that using the database for user access control is as dangerous others are making it out to be. I come from the Oracle Forms Development realm, where this type of user access control is the norm. Just like any design decision, it has it's advantages and disadvantages. </p>
<p>One of the advantages ... | <p>It depends (like most things).</p>
<p>Having multiple database users negates connection pooling, since most libraries handle pooling based on connection strings and user accounts.</p>
<p>On the other hand, it's probably a more secure solution than anything you or I will do from scratch. It leaves security up to t... | 44,352 |
<p>Aloha</p>
<p>I received a nice wsdl with xs: documentation tags like:</p>
<pre><code><xs:complexType name="Supplier">
<xs:annotation>
<xs:documentation>
The supplier of the product
</xs:documentation>
</xs:annotation>
</code></pre>
<p>Is there any way to generate <c... | <p>I recommended the Sprintstar Solution. but if you don't like it, use this:</p>
<pre><code>$("a.editcontent").click(function(){
$(this).parents("h2").next(".content").trigger("edit");
});
</code></pre>
<p>If you have more that one "h2":</p>
<pre><code>$("a.editcontent").click(function(){
$(this).parents("h... | <p>I think its hard to read because you're having to go up from one element back down to another. If you reference both from a common container, those paths will seem more meaningful.</p>
<pre><code>var listitem11 = $("#someid-11");
listitem11.find('a.editcontent').bind('click'), (function(){
listitem11.find('.... | 48,922 |
<p>Let's say you have a function that returns a date:</p>
<pre><code>Date myFunc(paramA, paramB){
//conditionally return a date?
}
</code></pre>
<p>Is it appropriate to return <code>null</code> from this function? This seems ugly because it forces clients to check for <code>null</code>.</p>
<p>The "null object" ... | <p>The null object pattern is not for what you are trying to do. That pattern is about creating an object with no functionality in it's implementation that you can pass to a given function that requires an object not being null. An example is <a href="http://download.eclipse.org/eclipse/downloads/documentation/2.0/html... | <p>You could try using an output parameter </p>
<pre><code>boolean MyFunction( a,b,Date c)
{
if (good)
c.SetDate(....);
return good;
}
</code></pre>
<p>Then you can call it</p>
<pre><code>Date theDate = new Date();
if(MyFunction(a, b ,theDate )
{
do stuff with C
}
</code></pre>
<p>It still requires y... | 19,207 |
<p>I'm all for language diversity, but Objective C is insane. So I'm curious: is it possible to code iPhone apps with C++ while using the Cocoa API, etc?</p>
| <p>Short answer, yes, sort of. You can use Objective-C++, which you can read about at <a href="http://web.archive.org/web/20101203170217/http://developer.apple.com/library/mac/#/web/20101204020949/http://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/ObjectiveC/Articles/ocCPlusPlus.html" rel="noreferrer... | <p>I'm currently writing an Objective-C++ framework called Objective-X, wich makes PURE C++ iPHONE PROGRAMMING possible. You can do like this:</p>
<pre><code>#import "ObjectiveX.h"
void GUIApplicationMain() {
GUIAlert Alert;
GUILabel Label;
GUIScreen MainScreen;
Alert.set_text(@"Just a lovely ale... | 33,991 |
<p>I recently asked a <a href="https://stackoverflow.com/questions/137712/sql-tracing-linq-to-entities">question about tracing Linq-to-Entities</a></p>
<p>I think that <a href="https://stackoverflow.com/questions/137712/sql-tracing-linq-to-entities#138109">one of the answers</a> was not right, as they refer to using t... | <p><strong>LINQ to Entities uses ObjectContext, not DataContext.</strong> </p>
<p>Here is a short description of EF:</p>
<blockquote>
<p><a href="http://msdn.microsoft.com/en-us/library/bb399414.aspx" rel="noreferrer" title="LINQ and the Entity Data Model">LINQ to Entities, the ObjectContext Class, and the Entity D... | <p>There are a <strong>lot</strong> of these arbitary syntax differences. E.g. SubmitChanges (L2S) and SaveChanges (L2E). However, that would be just the tip of the differences between the two technologies.</p>
| 17,249 |
<p>For some reason when I create a new namespace in Visual Studio 2008 its not being recognized. I'm using asp.net mvc, I don't know if that has anything to do with it. </p>
<p>Has anyone come across this before?...and how do you fix it?
Also is there a way to force Visual Studio to maybe re-examine new namespaces?</p... | <p>Not sure how this happened but the build property for this class file was set to "content". The compiler didn't see the new namespace. As soon as I set it to "compile", it worked fine.</p>
<p>Weird!</p>
| <p>Questions:
Is the namespace and class thats not being picked up in the same project or is it referenced?<BR>
Is this a vb or a c# project? - I cant remember which way round (think its c#) but one of them defaults the root namespace to the project name. You can run into problems or get a confusing namespace e.g MyPro... | 17,666 |
<p>Most mature C++ projects seem to have an own <strong>reflection and attribute system</strong>, i.e for defining attributes which can be accessed by string and are automatically serializable. At least many C++ projects I participated in seemed to <strong>reinvent the wheel</strong>.</p>
<p>Do you know any <strong>go... | <p>This is what you get when C++ meets Reflection:</p>
<p><img src="https://i.stack.imgur.com/alBDj.jpg" alt="C++ meets Reflection"></p>
<p>Whatever you choose, it'll probably have horrible macros, hard to debug code or weird build steps. I've seen one system automatically generate the serialisation code from DevStud... | <p>Automatic introspection/reflection toolkit. Use meta compiler like Qt's and adding meta information directly into object files. Intuitive easy to use. No external dependencies. Even allow automatically reflect std::string and then use it in scripts. Please visit <a href="https://sites.google.com/site/idevkit/" rel="... | 11,356 |
<p>I am using Structure map like the MVC storefront by Rob Conery does and I have an AdminController and so to get to it I just type:</p>
<pre><code>website/Admin/action
</code></pre>
<p>however if I miss spell the controller name I get the error below:</p>
<p>Exception Details: System.ArgumentNullException: Value c... | <p>The problem is that if there is no controller with the expected type name (i.e. if the user types "<strong>Amdin</strong>" the ControllerFactory base class will look for "<strong>Amdin</strong>Controller" and won't find it, but will still call your overriden method). In that case, the controllerType variable will be... | <p>You have a couple different options (or if you want, two things you can combine for a solution). To remove some of the potential problems between the chair and address bar you can <a href="http://en.wikipedia.org/wiki/Soundex" rel="nofollow noreferrer">implement a SoundEx solution</a> <a href="http://www.csharphelp... | 32,169 |
<p>I have a vb application. Now I have developed that same vb application in Asp.net. In vb I had used MSAccess database. In asp.net I am using Sql server. Now I want to Move or copy the MSaccess database data into Sql server. </p>
| <p>Open your MS Access database, go to tools/database utilities/upsizing wizard. You're done. </p>
<p>Just follow the wizard's steps, make sure you have administrative rights on the SQL server, check all your steps with the integrated help for detailled table/indexes/rules upsizing.</p>
<p>Some database will not upsi... | <p>i think the probs is with data in tables ,not the table. All the tables might have primary keys. so the next run , due to primary key violation the package is getting failed. before each dump, delete the enteries in the existing sql server by using "Execute sql task " in ctrl flow. </p>
<p>if (table exits ) then... | 48,418 |
<p>I keep getting this NPE in my application and I can't seem to get rid of it because it is not showing up in any of my source code. As you can see from the stacktrace it is not happening in my code but in the Swing plaf. Has any of you had this problem and maybe figured out what is happening here?</p>
<pre><code> ... | <p>I managed to get around the problem!</p>
<p>The thing is that I add a <code>ListSelectionListener</code> to my <code>JTable</code>; in the <code>valueChanged</code> method of my listener I then call <code>scrollRectToVisible</code> and then <code>updateUI</code>, which then results in my exception.</p>
<p>What I d... | <p>I never had this particular problem but when I get these kind of "hidden" errors I always end up looking the original source code and try to figure out the problem ...</p>
<p>From this <a href="http://www.docjar.com/html/api/javax/swing/plaf/basic/BasicTableUI.java.html" rel="nofollow noreferrer">source</a> you can... | 44,211 |
<p>I have a field in a database that is nearly unique: 98% of the time the values will be unique, but it may have a few duplicates. I won't be doing many searches on this field; say twice a month. The table currently has ~5000 records and will gain about 150 per month.</p>
<p>Should this field have an index?</p>
<p>I... | <p>I think the 'nearly unique' is probably a red herring. The data is either unique, or it's not, but that doesn't determine whether you would want to index it for performance reasons.</p>
<h3>Answer:</h3>
<p>5000 records is really not many at all, and regardless of whether you have an index, searches will still be f... | <p>From what you say, it doesn't sound like an index is necessary. Rule of thumb is index fields that are being used in SELECTS a lot to speed up the searching, which in turn (can) slows down INSERTS and UPDATES.</p>
<p>On a recordset as small as yours, I don't think you will see much of a real world hit either way. <... | 36,216 |
<p>I'm using Visual Studio Team System 2008 at work to do web development. I've gotten quite used to it but can't really afford to purchase even VS 2008 Standard at this time.</p>
<p>I have never used any of the Express editions before but I was thinking about downloading VS C# Express and VS Web Developer Express.</... | <p>You can do serious development on the express editions. They have taken out a few things most notably the plug in system. If you are use to using a bunch of plug ins you may find that not being able to use them is a deterrent.</p>
<p>Here is a link to a comparison of the express edition and the other editions.</p>
... | <p>Here is a detailed list of available features on different editions of Visual Studio : <a href="http://msdn.microsoft.com/en-us/vs2008/products/cc149003.aspx" rel="nofollow noreferrer">Product Comparison</a></p>
| 10,877 |
<p>I am implementing web services for a PHP application and am trying to understand what both standard web services and RESTful web services have to offer.
My intent is to write wrapper code to abstract away the web service details so that developers can just "instantiate remote objects" and use them.
Here are my thou... | <p>They are different models... REST is <strong>data-centric</strong>, where-as SOAP is <strong>operation-centric</strong>. i.e. with SOAP you tend to have discrete operations "SubmitOrder", etc; but with REST you are typically a lot more fluid about how you are querying the data.</p>
<p>SOAP also tends to be associat... | <p>The key differences are basically tooling.</p>
<p>Many of the high end SOAP stacks shroud the vast bulk of the SOAP infrastructure from the developer, to where you are working pretty much solely with DTO's/Documents and RPC.</p>
<p>REST over HTTP puts more of that burden upon you the developer (negotiating formats... | 37,868 |
<p>We currently maintain a suit of MFC applications that are fairly well designed, however the user interface is beginning to look tired and a lot of the code is in need quite a bit of refactoring to tidy up some duplication and/or performance problems. We make use of quite a few custom controls that handle all their ... | <p>In my company, we are currently using Qt and are very happy with it.</p>
<p>I personnally never had to move a MFC-app into using the Qt framework, but here is something which might be of some interest for you :</p>
<p><strike><a href="http://www.qtsoftware.com/products/appdev/add-on-products/catalog/3/Windows/qtwi... | <p>It's a tricky problem, and I suspect that the answer depends on how much time you have. You will get a much better result if you port your custom controls to Qt - if you use the QStyle classes to do the actual drawing then you'll end up with theme-able code right out of the box.</p>
<p>In general, my advice would b... | 4,728 |
<p>I have a table of items, each of which has a date associated with it. If I have the date associated with one item, how do I query the database with SQL to get the 'previous' and 'subsequent' items in the table?</p>
<p>It is not possible to simply add (or subtract) a value, as the dates do not have a regular gap bet... | <p>Select max(element) From Data Where Element < 8 </p>
<p>Union</p>
<p>Select min(element) From Data Where Element > 8 </p>
<p>But generally it is more usefull to think of sql for set oriented operations rather than iterative operation. </p>
| <p>Try this...</p>
<pre><code>SELECT TOP 3 * FROM YourTable
WHERE Col >= (SELECT MAX(Col) FROM YourTable b WHERE Col < @Parameter)
ORDER BY Col
</code></pre>
| 24,873 |
<p>I have a website that can be accessed from www.blahblah.com and special.blahblah.com. The www site always works but occasionly I get a 'Content controls have to be top-level controls in a content page or a nested master page that references a master page' error on the special site.</p>
<p>It's exactly the same cod... | <p>If anyone gets this error message when dynamically switching master pages, make sure your code is </p>
<pre><code>MasterPageFile = "TheMasterPage.master"
</code></pre>
<p>Not </p>
<pre><code>this.master.MasterPageFile = "TheMasterPage.master"
</code></pre>
| <p>My issue was that i mixed up <code><ASP:CONTENT</code> with <code><ASP:ContentPlaceholder</code></p>
<p><code><ASP:CONTENT</code> goes on the content file...not the Master pages! Ensure you're using the correct control.</p>
| 40,410 |
<p>I'm putting together a small web app that writes to a database (Perl CGI & MySQL). The CGI script takes some info from a form and writes it to a database. I notice, however, that if I hit 'Reload' or 'Back' on the web browser, it'll write the data to the database again. I don't want this. </p>
<p>What is the... | <p>Do not use GET requests to make modifications! Be <a href="http://en.wikipedia.org/wiki/Representational_State_Transfer" rel="noreferrer">RESTful</a>; use POST (or PUT) instead the browser should warn the user not to reload the request. Redirecting (<a href="http://en.wikipedia.org/wiki/URL_redirection#HTTP_status_c... | <p>Do a POST every time you alter data, but never return an HTML response from a post... instead return a redirect to a GET that retrieves the updated data as a confirmation page. That way, there is no worry about them refreshing the page. If they refresh, all that will happen is another retrieve, never a data-alteri... | 39,325 |
<p>In <a href="http://www.asp.net/mvc/" rel="noreferrer">ASP.NET MVC</a>, the <code>ActionResult</code> class, which is the base for all results returned by action methods from a controller, is defined as an abstract class with the single method (© Microsoft):</p>
<pre><code>public abstract void ExecuteResult(Con... | <p>Interfaces are great for allowing a class to implement multiple contracts, such as when you know that a type must be two different things. In some cases, this can encourage creating a type that has too many responsibilities. </p>
<p>Action results have a single responsibility and it didn't seem like there would be ... | <p>You implement interfaces and you inherit from abstract classes.<br>
For me it is the difference between "being of a type" or "acting like a type"</p>
<p>Since C# doesn't support multiple inheritance you are forced to define your class as an ActionResult, instead of something that acts as an ActionResult.</p>
<p>Co... | 42,505 |
<p>I'm trying to attach an instance of UIScrollbar component to a dynamic text field inside of an instance of a class that is being made after some XML is loaded. The scroll bar component is getting properly attached, as the size of the slider varies depending on the amount of content in the text field, however, it won... | <p>You might try adding the scrollbar once your textfield is initialized from a separate function similar to this:</p>
<pre><code>private function assignScrollBar(tf:TextField, sb:UIScrollBar):void {
trace("assigning scrollbar");
sb.move(tf.x + tf.width, tf.y);
sb.setSize(15, tf.height);
sb.direction =... | <p>Have you tried putting the UI scrollbar onto the stage, binding it to the textfield at design time, and then calling update() during the loaded event?</p>
<p>I have had some <em>interesting</em> experiences in the past with dynamically creating UIScrollbars at runtime.</p>
| 8,115 |
<p>Does anyone know if it is possible to convert a HTML page (url) to a PDF using iText?</p>
<p>If the answer is 'no' than that is OK as well since I will stop wasting my time trying to work it out and just spend some money on one of a number of components which I know can :)</p>
| <p>I think this is exactly what you were looking for</p>
<p><a href="http://today.java.net/pub/a/today/2007/06/26/generating-pdfs-with-flying-saucer-and-itext.html" rel="noreferrer">http://today.java.net/pub/a/today/2007/06/26/generating-pdfs-with-flying-saucer-and-itext.html</a></p>
<p><a href="http://code.google.co... | <p>When I needed HTML to PDF conversion earlier this year, I tried the trial of Winnovative HTML to PDF converter (I think ExpertPDF is the same product, too). It worked great so we bought a license at that company. I don't go into it too in depth after that.</p>
| 29,187 |
<p>I can't seem to get Javascript debugging working for my ASP.NET MVC application even though I can for a traditional ASP.NET WebForm app.</p>
<p>I have followed the steps for unchecking the 'Disable Script Debugging' boxes for both IE and other.</p>
<p>when I add a simple function to display an alert in both the si... | <pre><code>function test()
{
debugger;
alert("hi");
}
</code></pre>
<p>I don't know if it will work with express, but when IE hits the "debugger" instruction, it asks me if I want to debug, and with wich tool. Visual studio is present in the list of options presented to me.</p>
<p>I don't know if express will be ... | <p>I don't use VS.Net Express, but in VS.Net Standard you can go to the Debug menu in your solution and choose "Attach to process". You will then get to choose the debug type: Native, Managed, or Script. Select Script, then select your process from the list. A list of scripts will now come up in your IDE. Click on scri... | 33,153 |
<p>I'm new to CodeIgniter, and I need some help. I'd like to implement the following:</p>
<ul>
<li><p>View a user's profile via:
http://localhost/profile/johndoe</p>
</li>
<li><p>Administrate a user's profile via:
http://localhost/admin/profile/johndoe</p>
</li>
<li><p>Be able to accomplish even further processing via:... | <p>This is not such a good idea.</p>
<p>If you want to implement those URLs, you need two controllers:</p>
<ol>
<li>Profile, with the function <code>index</code></li>
<li>Admin, with the function <code>profile</code></li>
</ol>
<p>In Admin, the <code>profile</code> function has to read the first argument (create/edit/[... | <p>I found the solution I was looking for:
<a href="http://www.clipmarks.com/clipmark/75D02C9E-3E76-483E-8CCE-30403D891969/" rel="nofollow noreferrer">http://www.clipmarks.com/clipmark/75D02C9E-3E76-483E-8CCE-30403D891969/</a></p>
<p>Thanks, Christian D, I like your solution better than mine. I'm going with it.</p>
| 16,136 |
<p>What is the best tool for Java for aspect-oriented programming? </p>
<p>The requirements for a tool are of course IDE support, expressiveness and proper documentation.</p>
| <p>JBossAOP and AspectJ are two commonly used, mature frameworks for AOP. Another popular choice is Spring AOP, but it lacks some of the features of the other two.</p>
<p>Both JBossAOP and AspectJ have similar features, one big difference being that AspectJ relies on extensions to the Java language, whereas JBoss AOP ... | <p>Regarding Spring AOP support. By default it's relevant only for Spring manageable objects and AFAIK it based on AspectJ.</p>
<p>I didn't check it by myself yet, but it looks like it allows use AOP and for other objects (e.g. load time weaving under Tomcat). Details are <a href="http://miloszikic.blogspot.com/2008/0... | 42,179 |
<p>If I accidentally closed the <em>scratch</em> buffer in Emacs, how do I create a new <em>scratch</em> buffer?</p>
| <p>GNU Emacs default bindings:</p>
<blockquote>
<p><kbd>C-x</kbd><kbd>b</kbd> <code>*scratch*</code> <kbd>RET</kbd></p>
</blockquote>
<p>or, more verbosely</p>
<blockquote>
<p><kbd>M-x</kbd> <code>switch-to-buffer *scratch*</code> <kbd>RET</kbd></p>
</blockquote>
<p>The <code>*scratch*</code> buffer is the buff... | <blockquote>
<p><kbd>C-x</kbd><kbd>b</kbd> and then type <code>*scratch*</code> <kbd>↩︎</kbd></p>
</blockquote>
<p>to create a new buffer which is in lisp interaction mode also.</p>
| 29,082 |
<p>For certain types of sql queries, an auxiliary table of numbers can be very useful. It may be created as a table with as many rows as you need for a particular task or as a user defined function that returns the number of rows required in each query.</p>
<p>What is the optimal way to create such a function?</p>
| <p>Heh... sorry I'm so late responding to an old post. And, yeah, I had to respond because the most popular answer (at the time, the Recursive CTE answer with the link to 14 different methods) on this thread is, ummm... performance challenged at best.</p>
<p>First, the article with the 14 different solutions is fine ... | <p>edit: see Conrad's comment below.</p>
<p>Jeff Moden's answer is great ... but I find on Postgres that the Itzik method fails unless you remove the E32 row.</p>
<p>Slightly faster on postgres (40ms vs 100ms) is another method I found on <a href="http://www.sqlservercentral.com/articles/T-SQL/67899/" rel="nofollow">... | 3,198 |
<p>I'm working an a very large scale projects, where the compilation time is <strong>very</strong> long. What tools can I use (preferably open source) on Linux, to find the most heavily included files and that optimize their useages?
Just to be clearer, I need a tool which will, given the dependencies, show me which he... | <p>Check out <a href="http://www.xfree86.org/current/makedepend.1.html" rel="nofollow noreferrer">makdepend</a></p>
| <p>IIRC gcc could create dependency files.</p>
| 10,651 |
<p>In my web application there is a process that queries data from all over the web, filters it, and saves it to the database. As you can imagine this process takes some time. My current solution is to increase the page timeout and give an AJAX progress bar to the user while it loads. This is a problem for two reasons ... | <p>To avoid excessive architecture astronomy, I often <a href="http://encosia.com/2007/10/03/easy-incremental-status-updates-for-long-requests/" rel="nofollow noreferrer">use a hidden iframe to call the long running process and stream back progress information</a>. Coupled with something like <a href="http://www.bram.... | <ol>
<li>How are you querying the remote data?</li>
<li>How often does it change?</li>
<li>Are the results something that could be cached for a period of time?</li>
<li>How long a period of time are we actually talking about here?</li>
</ol>
<p>The 'best method' is likely to depend in some way on the answers to these ... | 9,869 |
<p><strong>My requirement</strong></p>
<p>A table needs to maintain a <em>status</em> column.</p>
<p>This column represents one of 5 states.</p>
<p><br>
<strong>initial design</strong></p>
<p>I figured I can just make it an integer column and represent the states using a numeric value.</p>
<ul>
<li>0 = start</li>
... | <ul>
<li><p>Changing the set of values in an ENUM requires an <code>ALTER TABLE</code> which might cause a table restructure -- an incredibly expensive operation (the table restructure doesn't happen if you simply add one new value to the end of the ENUM definition, but if you delete one, or change the order, it does a... | <p>A table would be easier to internationalize. But so would a class outside the database entirely.
This kind of check can be hard to debug when it's not in the business logic, and would typically not be the responsibility of database people.</p>
<p>As an optimization, it's probably very premature; but OP mainly propo... | 47,253 |
<p>Visual Studio 2005 is very slow with a solution with 21 projects. Any ideas how to speed it up?</p>
| <p>There are a whole bunch of suggestions in this question: <a href="https://stackoverflow.com/questions/55517/very-slow-compile-times-on-visual-studio">Very slow compile times on Visual Studio</a>. A combination of a few of these will definitely help to some degree</p>
| <p>a) Buy more memory
b) Break up into different solutions
c) Upgrade to VS 2008
d) <a href="https://web.archive.org/web/20201027040910/http://geekswithblogs.net/Ahmed_Hussein_blog/archive/2007/11/12/116791.aspx" rel="nofollow noreferrer">Link</a></p>
| 29,992 |
<p>In Visual C++ a DWORD is just an unsigned long that is machine, platform, and SDK dependent. However, since DWORD is a double word (that is 2 * 16), is a DWORD still 32-bit on 64-bit architectures?</p>
| <p>Actually, on 32-bit computers a word is 32-bit, but the DWORD type is a leftover from the good old days of 16-bit.</p>
<p>In order to make it easier to port programs to the newer system, Microsoft has decided all the old types will not change size.</p>
<p>You can find the official list here:
<a href="http://msdn.m... | <p>Windows API defines DWORD sizes as follows:</p>
<ul>
<li><strong>x86:</strong> sizeof(DWORD) = <strong>4</strong></li>
<li><strong>x64:</strong> sizeof(DWORD) = <strong>4</strong></li>
</ul>
| 6,047 |
<p>I have tried SQL Server 2008 Management Studio and other third party tools to script all database objects (views, SPs & tables) and I can't get anything to generate a one file script which has a drop statement preceded with an "If exists.." statement for every object.</p>
<p>I need the "if exists" statement so ... | <p>SQL 2008 Management Studio can do this. Right click on the database name and select Tasks->Generate Scripts...check the box that says 'All Database Objects' and then on the next screen set Include If NOT EXISTS to True (this will also do the If Exists...though it's not apparent) and Script Drop to True. I think th... | <p>Set 'results to text' and run the following script. Cut and paste results into a window and run. You can fiddle the script to filter out certain tables if desired.</p>
<pre><code>select 'if object_id ('''+ s.name + '.' + t.name +
''') is not null drop table ' + s.name + '.' + t.name +
char (10) + '... | 45,643 |
<p>While plenty of solutions exist for entering dates (such as calendars, drop-down menus, etc.), it doesn't seem like there are too many "standard" ways to ask for a time (or time range).</p>
<p>I've personally tried drop-down menus for the hour, minute, and second fields (and sometimes an "AM/PM" field, as well). I... | <p>What I found works best is to really learn CSS. I mean <strong>really</strong> learn CSS.</p>
<p>It can be a confusing language to learn, but if you read enough about it and practice, eventually you'll learn the best way to do things.</p>
<p>The key is to do it enough that it comes natural. CSS can be very elegant... | <p>CSS takes a bit of time to learn, but the thing I initially found most discouraging was the fact that so many hacks were needed to get all browsers to behave the same way. Learning a system which doesn't adhere to logic seems dumb... but I've clung to the vague belief that there is logic behind each browser's idios... | 4,508 |
<p>Given:</p>
<pre><code>CR = %0d = \r
LF = %0a = \n
</code></pre>
<p>What does</p>
<p>%3E,
%3C </p>
<p>Mean?</p>
| <p>They are URL encoded characters. %3C is <, %3E is ></p>
<p>More info on <a href="http://www.blooberry.com/indexdot/html/topics/urlencoding.htm" rel="noreferrer">URL Encoding</a>, and <a href="http://www.asciitable.com/" rel="noreferrer">a chart</a> of some of the lower ASCII values.</p>
| <p>The two digits after the % is an <a href="http://wikipedia.org/wiki/ASCII" rel="nofollow noreferrer">ASCII</a> code represented in <a href="http://wikipedia.org/wiki/Hexadecimal" rel="nofollow noreferrer">hexadecimal</a>.</p>
| 38,105 |
<p>I'm looking for an OpenSource server monitoring tool that allows the following:</p>
<ul>
<li>Monitor a variety of services on TCP, UDP.</li>
<li>Supports custom port numbers.</li>
<li>Supports some basic response checking (beyond initial connection checking).</li>
<li>Basic dashboard overview of health status.</li>... | <p>I think exactly what happens will be dependent on which database engine you're using (there may even be differences between INNODB and MyISAM in MySQL).
Whatever happens, it's not going to be pretty.</p>
<p>You'd simply have to change the column type to a larger integer.</p>
| <p>Oracle doesn't support autoincrementing ID columns and standard practice is to use a sequence generator. A sequence generates integers of up to 28 digits, so if you run out of those then ... I guess you have a pretty big table. But behaviour would then be dependent on the configuration of the sequence generator -- e... | 31,614 |
<p>I have a <code>double</code> value <code>f</code> and would like a way to nudge it very slightly larger (or smaller) to get a new value that will be as close as possible to the original but still strictly greater than (or less than) the original.</p>
<p>It doesn't have to be close down to the last bit—it's more imp... | <p>Check your math.h file. If you're lucky you have the <a href="http://en.cppreference.com/w/c/numeric/math/nextafter" rel="noreferrer"><code>nextafter</code></a> and <a href="http://en.cppreference.com/w/c/numeric/math/nextafter" rel="noreferrer"><code>nextafterf</code></a> functions defined. They do exactly what you... | <p>I found this code a while back, maybe it will help you determine the smallest you can push it up by then just increment it by that value. Unfortunately i can't remember the reference for this code:</p>
<pre><code>#include <stdio.h>
int main()
{
/* two numbers to work with */
double number1, number2; ... | 18,791 |
<p>UIWebView is fine for displaying HTML, but I'd like to modify the loaded DOM from my Objective-C program. Does anybody know how to do that? This is a third party page, so I can't really include any custom JS to do so...unless I can modify the DOM somehow.</p>
| <p>This may be of some help, as not to plagiarize the solution provider in the link, here's the link:
<a href="http://lists.apple.com/archives/safari-iphone-web-dev/2008/Sep/msg00001.html" rel="nofollow noreferrer">http://lists.apple.com/archives/safari-iphone-web-dev/2008/Sep/msg00001.html</a></p>
| <p>Some more related techniques around Obj-C / JS communication:</p>
<p>Using UIWebView for local resources:</p>
<p><a href="http://dominiek.com/articles/2008/7/19/iphone-app-development-for-web-hackers" rel="nofollow noreferrer">http://dominiek.com/articles/2008/7/19/iphone-app-development-for-web-hackers</a></p>
<... | 12,445 |
<p>i'm using vs installer to build a setup package for my vb6 app.
and the problem is i can see that under the project explorer there's a list of dependencies attached to my exe file.</p>
<p><a href="http://img505.imageshack.us/img505/9696/croppercapture259lr8.png" rel="nofollow noreferrer">alt text http://img505.imag... | <p>It is not guaranteed that all those dlls will be present on the system that the software is being installed on. So they need to be included in your installer. From there you have two choices. </p>
<p>You can install them in your windows system folders or in your application folder. The difference is that if you ins... | <p>You should usually not have a "dlls" folder under the app folder for a normal Installer package but there are many factors involved (private standard DLLs, Reg-Free COM, etc.). Yes, the dependencies get included (unless you <em>exclude</em> them). They should each have a property that determines where they install... | 39,161 |
<p>Struts 1.3 application. Main website is NOT served by struts/Java. I need to forward the result of a struts action to a page in the website, that is outside of the struts context. Currently, I forward to a JSP in context and use a meta-refresh to forward to the real location. That seems kinda sucky. Is there a ... | <p>You can't "forward", in the strict sense. Just call <code>sendRedirect()</code> on the <code>HttpServletResponse</code> object in your <code>Action</code> class's <code>execute()</code> method and then, <code>return null</code>.</p>
<p>Alternately, either call <code>setModule()</code> on the <code>ActionForward</co... | <p>I ended up doing response.sendRedirect().</p>
| 8,939 |
<p>I'm debugging a Cocoa application that can act as a handler to a custom URL protocol. The application works fine when I click on a link after the application has launched, but something is causing the app to crash if it has not launched at the time the link is clicked.</p>
<p>Is there any way that I can start the a... | <p>You can do </p>
<pre><code>gdb --wait myAppName
</code></pre>
<p>and then click on the link to launch your app. This will cause your app to break into the debugger very, very early, before main has started.</p>
| <p>Could you attach to your process from XCode once the URL handler has been invoked? You could try putting a modal NSAlert in your URL handler code so that will pause it until you can attach to your process.</p>
| 25,806 |
<p>If you want to use a queuing product for durable messaging under Windows, running .NET 2.0 and above, which alternatives to MSMQ exist today? I know of ActiveMQ (<a href="http://activemq.apache.org/" rel="noreferrer">http://activemq.apache.org/</a>), and I've seen references to WSMQ (pointing to <a href="http://wsmq... | <p>I can't begin to say enough good things about Tibco EMS - an implementation of the Java JMS messaging spec. Tibco EMS has superb support for .NET clients - including Compact Framework .NET on WinCE. (They also have C client libraries too.)</p>
<p>So if you're building a heterogeneous distributed application involvi... | <p>If high availability is important Amazon SQS is worth looking at. There's not much additional overhead if messages come from different physical locations. Cheap and scalable!</p>
| 5,833 |
<p>I am introducing automated integration testing to a mature application that until now has only been manually tested.</p>
<p>The app is Windows based and talks to a MySQL database.</p>
<p>What is the best way (including details of any tools recommended) to keep tests independent of each other in terms of the databa... | <p>How are you verifying the results? </p>
<p>If you need to query the DB (and it sounds like you probably do) for results then I agree with Kris K, except I would endeavor to rebuild the DB after every test case, not just every suite.</p>
<p>This helps avoid dangerous <a href="http://xunitpatterns.com/Erratic%20Test... | <p>Please try AnyDbTest, I think it is the very tool you are finding. (<a href="http://www.anydbtest.com" rel="nofollow noreferrer">www.anydbtest.com</a>).</p>
<p>Features:</p>
<ul>
<li><p>1.Writing test case with Xml, not Java/C++/C#/VB code. Not need those expensive programming tools.</p></li>
<li><p>2.Supports all... | 11,317 |
<p>Our company is transitioning code from VS 2005. I know they won't be able to use VS 2008 to access it, but we have the patch to enable web access for TFS 2008 applied to our TFS server. This means they can access the source code via the web, but do the work in VS 2005. </p>
<p>The code will eventually be rewritt... | <p>VS2005 works great with TFS2008, the only thing to watch out for is in the area of Team Build where you might want a couple of VS2008 clients installed around to help you administer the builds. VS2008 and VS2005 can live happily side by side on the same machine.</p>
<p>Hope that helps,</p>
<p>Martin.</p>
| <p>We have done several upgrades from 2005 to 2008 and have had no real problems. Just open the solution in 2008 and let it do the upgrade. Then create a new project in TFS and add the upgraded source code to it. We keep the old TFS project and source code around for reference purposes, but we've rarely actually nee... | 44,278 |
<p>hey guys, i'm getting an exception on the following </p>
<p>inner exception: {"Value cannot be null.\r\nParameter name: String"}</p>
<p>Which reads like a simple error message, but none of the values (image, fileName) are null. How can i find out where this null String is?</p>
<pre><code>RipHelper.UploadImage(ima... | <p>The exception is in the static constructor of the class Helpers.RipHelper, at line 23 of RipHelper.cs. This line is calling Int32.Parse, passing a null value.</p>
<p>Perhaps the static constructor is referencing a static field that has not yet been initialized. If you are having trouble debugging this, post the c... | <p>Thanks guys. Lesson learnt 'Pay more attention to the error log'. Here the culprit</p>
<pre><code>private static readonly int previewImageHeight = int.Parse(ConfigurationManager.AppSettings["PreviewImageHeight"]);
</code></pre>
<p>PreviewImageHeight was misspelt in the config. </p>
| 47,408 |
<p>I'm sure there's some trivial one-liner with perl, ruby, bash whatever that would let me run a command in a loop until I observe some string in stdout, then stop. Ideally, I'd like to capture stdout as well, but if it's going to console, that might be enough. </p>
<p>The particular environment in question at the ... | <p>In Perl:</p>
<pre><code>#!/usr/local/bin/perl -w
if (@ARGV != 2)
{
print "Usage: watchit.pl <cmd> <str>\n";
exit(1);
}
$cmd = $ARGV[0];
$str = $ARGV[1];
while (1)
{
my $output = `$cmd`;
print $output; # or dump to file if desired
if ($output =~ /$str/)
{
exit(0);
}... | <pre><code>while (/bin/true); do
OUTPUT=`/some/command`
if [[ "x$OUTPUT" != "x" ]]; then
echo $OUTPUT
break
fi
sleep 1
done
</code></pre>
| 15,669 |
<p>I've got a lot of ugly code that looks like this:</p>
<pre><code>if (!string.IsNullOrEmpty(ddlFileName.SelectedItem.Text))
results = results.Where(x => x.FileName.Contains(ddlFileName.SelectedValue));
if (chkFileName.Checked)
results = results.Where(x => x.FileName == null);
if (!string.IsNullOrEmpty... | <p>I'd convert it into a single Linq statement:</p>
<pre><code>var results =
//get your inital results
from x in GetInitialResults()
//either we don't need to check, or the check passes
where string.IsNullOrEmpty(ddlFileName.SelectedItem.Text) ||
x.FileName.Contains(ddlFileName.SelectedValue)
... | <pre><code>results = results.Where(x =>
(string.IsNullOrEmpty(ddlFileName.SelectedItem.Text) || x.FileName.Contains(ddlFileName.SelectedValue))
&& (!chkFileName.Checked || string.IsNullOrEmpty(x.FileName))
&& ...);
</code></pre>
| 7,863 |
<p>I'm writing a java app using eclipse which references a few external jars and requires some config files to be user accessable.</p>
<ol>
<li><p>What is the best way to package it up for deployment?</p></li>
<li><p>My understanding is that you cant put Jars inside another jar file, is this correct?</p></li>
<li><p>C... | <p>There is no one 'best way'. It depends on whether you are deploying a swing application, webstart, applet, library or web application. Each is different.</p>
<p>On point 2, you are correct. Jar files cannot contain other jar files. (Well, technically they can, its just that the inner jar file won't be on your class... | <p>Ant. It's not the best thing in the world, but it's standard, it's apache, and it works.
There's some good examples on the web how to make a simple build.xml for any, and it's got some features like the 'war' task that knows how to put all the basic stuff (classes, web.xml etc) in the jar file for you.
You can also ... | 38,784 |
<p>I want to debug an application in Linux.
The application is created in C++. The GUI is created using QT.
The GUI is linked with a static library that can be treated as the back end of the application.</p>
<p>I want to debug the static library but am not sure how to do that.</p>
<p>I tried using gdb</p>
<pre><code... | <p>gdb will automatically debug functions in the library when they are called. just call it like</p>
<pre><code>gdb ./foo
run
</code></pre>
<p>:) . Be sure you build foo with debugging flags (<code>-g3</code> will enable all debugging stuffs for gcc :). You should not optimize when debugging (pass at most <code>-O1</... | <p>You can also use Kdbg or ddd</p>
| 41,402 |
<p>I'm trying to do this</p>
<pre><code>SELECT `Name`,`Value` FROM `Constants`
WHERE `Name` NOT IN ('Do not get this one'|'or this one');
</code></pre>
<p>But it doesn't seem to work.</p>
<p>How do I get all the values, except for a select few, without doing this:</p>
<pre><code>SELECT `Name`,`Value` FROM `Constan... | <p>You should put the constants in a table and then do a select statement from that table. If you absolutely don't want a permanent table you can use a temp table. And if don't want to do that, you can use the IN syntax:</p>
<p>NOT IN ('one', 'two')</p>
| <p>The IN syntax uses comma-seperated lists</p>
<pre><code>SELECT `Name`,`Value` FROM `Constants` WHERE `Name` NOT IN ('Do not get this one','or this one');
</code></pre>
| 18,158 |
<p>I have a html page open on my webbrowser object, I can enter username and password okay, but I'm stuck and don't know how to submit the info. Here is the html code for the username/password submit:</p>
<pre><code><div id="signin">
<h2 class="ir">
<em></em>Sign in</h2>
... | <p><code>WebBrowser1.Document.GetElementById(*element id string*).InvokeMember("submit")</code></p>
| <p>You could try giving an ID to the form, in order to get ahold of it, and then call form.submit() from a Javascript call.</p>
| 25,812 |
<p>I'm having an issue with CruiseControl.net where the web dashboard just won't work in IIS. I have tried switching ASP.Net between 64 and 32 bit modes and reinstalling cruise control, but nothing seems to work. Has anyone else had issues with CruiseControl.Net on 64 bit platforms?</p>
<p>Cheers,
Jamie</p>
<p>[Edit]... | <p>It seems I needed to enable Web Service Extensions for ASP.Net. I'm still not getting an ASP.Net tab in the cruise control website properties, but it is working.</p>
<hr>
<p>C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727> or C:\WINDOWS\Microsoft.NET\Framework64\v2.0.50727> for 64 bit</p>
<p>Type aspnet_regiis.exe ... | <p>Since you just want to know whether it works... it does.</p>
<p>I'm running it on a 64-bit Windows Server 2008 without a problem.</p>
<p>So now we've established it works, perhaps you can describe your issue in more detail?</p>
| 43,563 |
<p>I have a CUDA kernel which I'm compiling to a cubin file without any special flags:</p>
<pre><code>nvcc text.cu -cubin
</code></pre>
<p>It compiles, though with this message:</p>
<blockquote>
<p>Advisory: Cannot tell what pointer points to, assuming global memory space</p>
</blockquote>
<p>and a reference to a... | <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,904 |
<p>Is it possible to use the asp templating engine (With the partial code-behind class, dynamic <% ... %> blocks and such) to generate non HTML? I want to have a clean and maintainable way to generate code dynamically. (Specifically, I want to generate LaTeX code populated with values from a database.) </p>
<p>Curr... | <p>The T4 templating that comes with Visual Studio 2008 natively or with Visual Studio 2005 SDK, you can pretty much generate anything you want.</p>
<p>You can have more info on the following links:</p>
<ul>
<li><a href="https://www.hanselman.com/blog/t4-text-template-transformation-toolkit-code-generation-best-kept-vi... | <p>I don't see why not. Someone I knew at a former job created a database wrapper generator using ASP.NET pages and the repeater control to insert properties. He then wrote out the document contents to a source file.</p>
<p>If you are worried about ASP.NET will throw a fit, you can just create a very limited test ca... | 28,104 |
<p>I need to know the usage by other applications, in time of execution, of java methods of an api created in my project, does someone know any free tool to know this?</p>
<p>Thank you very much.</p>
| <p>Seems as if you need a profiler. <a href="https://visualvm.dev.java.net/" rel="nofollow noreferrer">VisualVM</a> contains one. It may not be the most powerful, but it's rather easy to use and it ships with the Sun JDK since 1.6.0_07.</p>
| <p>Perhaps you could try to apply some aspect oriented programming. Logging seems to be the classic example of its usage. Try e.g. <a href="http://en.wikipedia.org/wiki/AspectJ" rel="nofollow noreferrer">AspectJ</a>.</p>
| 43,273 |
<p>I've got the following SQL:</p>
<pre><code>select * from transaction_log where stoptime like '%2008%'
</code></pre>
<p>How do I write this in LINQ to SQL syntax?</p>
| <p>If you want to use the literal method, it's like this:</p>
<pre><code>var query = from l in transaction_log
where SqlMethods.Like(l.stoptime, "%2008%")
select l;
</code></pre>
<p>Another option is:</p>
<pre><code>var query = from l in transaction_log
where l.stoptime.Contains("2008... | <p>If you use the contains to method then you are doing a LIKE '%somestring%'. If you use a startswith method then it is the same as 'somestring%'. Finally, endswith is the same as using '%somestring'.</p>
<p>To summarize, contains will find any pattern in the string but startswith and endswith will help you find matc... | 11,745 |
<p>I've got a model in CakePHP that doesn't have a table, called Upload. I've got a validation in this Model for a field called source_id.</p>
<p>I've got a form that builds a nice looking $this-data, giving me a well formated set, including:</p>
<pre><code>$this->data['Upload']['source_id']
</code></pre>
<p>Howe... | <p>I'm dumb. You have to trigger a validation check, either with a save() or</p>
<pre><code>$this->Upload->set($this->data);
$this->Upload->validates();
</code></pre>
<p>Working now.</p>
| <p>You can also <em>fake</em> the database structure by setting the $_schema array, like so:</p>
<pre><code>var $useTable = false;
var $_schema = array(
'name' =>array('type'=>'string', 'length'=>100),
'email' =>array('type'=>'string', 'length'=>255),
'phone' =>array('type'=>'s... | 25,172 |
<p>Anyone have examples for creating a new user registration form where the web application checks for username availability via making an ajax call on the form and returning available or not on the same page without a full page post? Something similar to new user registration on Hotmail.</p>
| <p><a href="http://weblogs.asp.net/traviscollins/archive/2008/02/12/check-username-availability-with-asp-net-ajax.aspx" rel="nofollow noreferrer">This seems to be a pretty straight forward tutorial.</a> There really isn't that much to it.</p>
| <p>This article I wrote has a sample project. That can get you started: <a href="http://www.singingeels.com/Articles/Membership_Using_ASPNET_AJAX.aspx" rel="nofollow noreferrer">Membership Using ASP.NET AJAX</a></p>
| 38,224 |
<p>I have an existing Java project in Netbeans (a JSF web application). I'd like to experiment with GWT in a separate project - put pull in source from the original project. Is there any way to share source between two Netbeans projects. </p>
<p>When I attempt to add the source directory from the original project into... | <p>If you're only experimenting then copy the necessary part of the existing project to a different directory. Of course changes won't be synchronized later.</p>
<p>If you'd like to keep both projects alive then create a separate project with the common code, and use it as a library.</p>
| <p>Use source control. With CVS, use modules. With Subversion, use svn:externals.</p>
| 23,001 |
<p>I'm trying to create newspaper style columns using a block of text. I would like the text to be evenly spread out across 2 columns which could react to change of length in the text.</p>
<p>Is this possible using just HTML/CSS, if not could javascript be used?</p>
<p>Thanks</p>
| <p>Two notes:</p>
<ul>
<li>What works for a printed medium isn't good for a display medium. Having to scroll up to continue to read doesn't seem like a good idea for me. After all, Web pages aren't limited in length...</li>
<li>You cannot do that with CSS2. I think that CSS3 has support for that (not sure), I doubt it... | <p>I managed to do something like this but again, not in CSS, I used PHP to count words and split the text. Unfortunately counting words is a pretty bad way of going about doing it, since some words are longer than others and the columns don't match up. My design was inspired by the IHT website. It's not very hard to i... | 20,963 |
<p>Is there any simple way to programatically colorize images in .NET? Basically we have a black and white image and need to put a layer of say pink above it and reduce the opacity of that layer to make the picture colorized in pink.</p>
| <p>You should use the wonderful <a href="http://midimick.com/magicknet/" rel="nofollow noreferrer">ImageMagick</a> library. It has .NET bindings so no problem there.</p>
<p>Have fun! :)</p>
| <p>The way that springs to mind is using the Drawing packages to draw a rectangle over the picture in a given colour (you can set alpha). It's not very efficient but, with caching, it wouldn't do any harm, even on a busy server.</p>
| 17,843 |
<p>I'm using Python, and would like to insert a string into a text file without deleting or copying the file. How can I do that?</p>
| <p>Depends on what you want to do. To append you can open it with "a":</p>
<pre><code> with open("foo.txt", "a") as f:
f.write("new line\n")
</code></pre>
<p>If you want to preprend something you have to read from the file first:</p>
<pre><code>with open("foo.txt", "r+") as f:
old = f.read() # read everyt... | <p>If you know some unix you could try the following:</p>
<p>Notes: $ means the command prompt </p>
<p>Say you have a file my_data.txt with content as such:</p>
<pre><code>$ cat my_data.txt
This is a data file
with all of my data in it.
</code></pre>
<p>Then using the <code>os</code> module you can use the usual <c... | 15,284 |
<p>I have seen this theme present itself more than once now. I am hoping that people here who are currently in similar situations or have been in the past can offer some insightful advice. It might be useful if you share your past experiences as well.</p>
<p>So there is this fairly large windows forms application that... | <p>You need to rearchitect the Business Layer and then wire the UI back into this rearchitectured layer.<br>
You keep the existing UI and hardwired business logic going while this is done and switch it over to the new ones one form at a time.</p>
<p>This has the benfits of allowiing you to add all the unit tests and a... | <p>Sounds like a typical application to me.</p>
| 27,665 |
<p>I would like to create a window with a progressbar which shows the current status of Spring's object instantiation. From Spring.Net's <a href="http://www.springframework.net/docs/1.1.2/reference/html/objects.html#objects-factory-customizing" rel="nofollow noreferrer">documentation</a> it seems that <code>IObjectPos... | <p>When I interview people for a position of Client-Side developer I try to figure out:</p>
<pre>
1) Understanding DOM (what is that, how is it related to HTML etc)
2) Understanding XML/namespaces
3) Understanding JavaScript (object-oriented? what otherwise)
4) Knowing approaches to componentization (XBL, HTC) - plus
... | <p>I wouldn't put too much weight on it, as proper HTML/CSS is so simple that anyone can learn it in a week.</p>
<p>That said, you might want to review their portfolio to help you make a decision on their current skill level.</p>
| 24,158 |
<p>I am working on a web application (ASP.NET) game that would consist of a single page, and on that page, there would be a game board akin to Monopoly. I am trying to determine what the best architectural approach would be. The main requirements I have identified thus far are:</p>
<ul>
<li>Up to six users share a s... | <p>While updating a database seems like overkill, it has advantages when it comes time to scale up, as you can have multiple webheads talking to one backend.</p>
<p>A larger concern is how you communicate the game state to the clients. While a full update of the game state from time to time ensures that any changes ar... | <p>Why don't you just create an application level object to store your details. See <a href="http://www.dotnetheaven.com/UploadFile/mahesh/ApplicationState05102005051501AM/ApplicationState.aspx?ArticleID=e42f0985-9927-4fba-86bb-0012e072a0dc" rel="nofollow noreferrer">Application State and Global Variables in ASP.NET</a... | 30,900 |
<p>Just bought a 2.4GHz Intel Core 2 Duo iMac with 2GB of memory and a 320GB hard drive. I plan on doing some .net development on it using a BootCamp/VMWare combo since VMWare grants access to the bootcamp partition.</p>
<p>What is a recommended size for a BootCamp partition and how much memory should I give VMWare? A... | <p>I use VMWare Fusion 2.0 on my MacBook Pro and I wouldn't have it any other way.</p>
<p>I'd strongly recommend getting a min of 4gb RAM is you're going to run Windows + VS 2008 in virtualisation.</p>
<p>I have a 2gb RAM for my VM and you do notice a bit of chugging, particularly when you are compiling a large solut... | <p>I ran windows Xp on a mac (AMD 2.4 GHz) and i alloted 1.5GB and it was fairly slow, but it was a file based disk. I agree with the above that you need the ram, especially with vista. I dont think 2GB base is anough for mac and vmware with vista.</p>
<p>For the partition, give at least 40 Gb for os + software and wh... | 13,527 |
<p>We are attempting to install BizTalk Server 2006 R2 on a fresh server with x64 Windows 2008. The basic configuration is complaining that the “Default Web Site” we select for the BAM Portal installation is not validated due to “IIS is not 32-bit enabled.” Despite setting the appPool (Classic mode) 32-bit property to ... | <p>It looks like Microsoft’s official statement is Biztalk Server 2006 R2 with Windows 2008 is “not supported”. BizTalk Server 2009 is the one that is meant to be married to Windows 2008.</p>
<p><strong>UPDATE, MOFE INFO</strong></p>
<p>I should additionally comment that the process of <a href="http://go.microsoft.co... | <p>BizTalk 2006 R2 will not be supported on Windows 2008 and this will not change going forward, if you wish to get this configuration working you will need BizTalk 2009.</p>
| 23,991 |
<p>I'd like to put in an UIButton in the center of the navigation bar. Based on the document, it appears I need to set title view, and make sure the leftBarButtonItem is nil. But it is not work for me. Here is the code.</p>
<pre><code>UIButton *btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[btn setTitle:@"L... | <p>If you examine your button, you'll find that by using the convenience method to initialize it you are left with a 0x0 button that is positioned at 0,0 within the bounds of the view it is being added to. Before doing this, you must define the contents of the <code>frame</code> property of the button. See the code be... | <p>The view of the navigationItem is set, by default, to nil.</p>
<p>You need to use</p>
<pre><code>self.navigationItem.titleView = btn;
</code></pre>
| 44,580 |
<p>I recently introduced HTML into some RSS feeds that I publish (which up to now only had plain text, no markup), and I was wondering which method is better: use character encoding (such as htmlspecialchars) or just encapsulate everything in CDATA?</p>
<p>It seems to me that CDATA might be easier, but I'm unclear as ... | <p>CDATA is for any data that should not be parsed by the XML parser. Any tags not in a CDATA block <strong>will</strong> be parsed by the XML parser and may take on a different meaning.</p>
<p>CDATA can also incur an overhead for the parsers if there is no need for it. Try to avoid CDATA blocks any time you know HTML... | <p>htmlentities() works like a charm. No need to use CDATA.
<a href="http://php.net/manual/en/function.htmlentities.php" rel="nofollow">http://php.net/manual/en/function.htmlentities.php</a></p>
| 29,839 |
<p>For desktop application that is. This is just a general question that maybe only need general answers.</p>
| <p>A static class with static data members? But who cares. Static data members are just global variables with more politically correct packaging.</p>
<p>Don't let fashion override your common sense. There's nothing wrong with using a plain old global variable. The singleton pattern is often overkill and annoying... | <p>A common solution to this is to use single-instance classes instead of singleton/global variables. </p>
<p>Your application will be responsible for making sure you have only one instance.</p>
<p>This solution kinda sucks 'cause you can't prevent people from instanciating your class (is not a singleton) so it must ... | 47,684 |
<p>I have the following code:</p>
<pre><code>import javax.swing.JEditorPane;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.ScrollPaneConstants;
public class ScratchPad {
public static void main(String args[]) throws Exception {
String html ="<html>"+
"<head>"+... | <p>Use the follow line before setText and after setContentType.</p>
<pre><code>editor.getDocument().putProperty("IgnoreCharsetDirective", Boolean.TRUE);
</code></pre>
<p>This is one of the mystic undocumented features. setContentType create a new Document that it has no effect if you set it before.</p>
| <p>When I run the code, I can only see the HTML text when I delete the <strong><em>meta</em></strong> line. Maybe it has something to do with character settings of the system it runs on.</p>
| 21,536 |
<p>On linux, it's possible to create a tun interface using a tun driver which provides a "network interface psuedo-device" that can be treated as a regular network interface. Is there a way to do this programmatically on windows? Is there a way to do this without writing my own driver? </p>
| <p>You can do this on XP with the <a href="https://web.archive.org/web/20150217152013/http://support.microsoft.com/kb/839013" rel="nofollow noreferrer">Microsoft Loopback Adapter</a> which is a driver for a virtual network card.</p>
<p>On newer Windows version: <a href="https://support.microsoft.com/en-gb/help/2777200... | <p>In the Singularity project, Microsoft research communicates with the singularity VM through a "loopback" adapter. Maybe that'd help? </p>
<p>Running it is easy so it may be something fun to do anyway. :)</p>
<p><a href="http://research.microsoft.com/os/Singularity/" rel="nofollow noreferrer">http://research.micros... | 7,015 |
<p>I am running an Ubuntu 8.10, using Python 2.5 out of the box. This is fine from the system point of view, but I need Python2.4 since I dev on Zope / Plone.</p>
<p>Well, installing python2.4 is no challenge, but I can't find a (clean) way to make iPython use it : no option in the man nor in the config file.</p>
<p>... | <p>Ok, I answer my own question : I'm dumb :-)</p>
<pre><code>ls /usr/bin/ipython*
/usr/bin/ipython /usr/bin/ipython2.4 /usr/bin/ipython2.5
</code></pre>
<p>Now it's built-in...</p>
| <p>You can just:</p>
<pre><code>$ python2.4 setup.py install --prefix=$HOME/usr
$ python2.5 setup.py install --prefix=$HOME/usr
</code></pre>
<p>or </p>
<pre><code>alias ip4 "python2.4 $HOME/usr/bin/ipython"
alias ip5 "python2.5 $HOME/usr/bin/ipython"
</code></pre>
<p><a href="https://github.com/ipython/ipython/wik... | 39,699 |
<p>I want to create a draggable and resizable window in JavaScript for cross browser use, but I want to try and avoid using a framework if I can.</p>
<p>Has anyone got a link or some code that I can use?</p>
| <p>JQuery is more focused on a lot of nice utility functions, and makes DOM manipulation a whole lot easier. Basically, I consider it to be Javascript as it should have been. It's a supremely helpful addition to the Javascript language itself.</p>
<p>ExtJS is a suite of GUI components with specific APIs... Use it if y... | <p>Avoiding a framework altogether will leave you with lots of code and a bunch of tedious browser-testing.</p>
<p>If you would consider a framework I'd suggest jQuery with the <a href="http://dev.iceburg.net/jquery/jqDnR/" rel="nofollow noreferrer">jqDnR</a> plugin. I think it will solve your problem or perhaps you c... | 5,057 |
<p>I've created a simple desktop application in C# 3.0 to learn some C#, wpf and .Net 3.5.
My application essentially reads data from a csv file and stores it in a SQL server CE database. I use sqlmetal to generate the ORM code for the database.
My first iteration of this app is ugly as hell and I'm in the process of r... | <p>I would start with the <a href="http://codeplex.com/CompositeWPF" rel="nofollow noreferrer">Composite Application Guidance for WPF</a> (<em>cough</em> PRISM <em>cough</em>) from Microsoft's P&P team. With the download comes a great reference application that is the starting point for most of my WPF development t... | <p>I would say yes, it could easily be structured towards smaller applications. There is a learning curve towards getting started, but honestly, it helped me understand WPF better than attempting to start from scratch. After starting a project with CompositeWPF and then starting another project without it, I found myse... | 6,770 |
<p>I have a dropdown list that stores name/value pairs. The dropdown appears in each row of a gridview.</p>
<p>The values in the dropdown correspond to a third attribute (data type) not persisted in the dropdown list. I'd like to create a client-side "lookup" table so that when a user chooses a dropdown value, the pro... | <p>Found a nice solution at snipplr.com (<a href="http://tinyurl.com/67rzav" rel="nofollow noreferrer">http://tinyurl.com/67rzav</a>)</p>
<p>The function call looks something like this:</p>
<pre><code>var profileHeaders = new AArray();
profileHeaders .add("k01", "hi");
profileHeaders .add("k02", "ho");
var oC = pr... | <p>If you want it all to run client side, then your only option is probably JavaScript.</p>
<pre><code>var oVals = new Array('1','2','3','4','5');
document.getElementById("cell1").innerHTML = oVals[document.getElementById("dropdown1").selectedIndex];
</code></pre>
| 31,627 |
<p>I have a Stored Procedure that rolls-back a series of operations. I want to call this from within another SP.</p>
<p>The problem is that the inner SP returns a record set with a single value that indicates the degree of success. </p>
<p> This approach worked well and has some advantages in our context, but in retr... | <p>A stored procedure returns a record set like any other, so you can actually do this:</p>
<p>INSERT INTO MyTable (
MyValue
)</p>
<p>EXEC dbo.MyStoredProcedure</p>
<p>The EXEC takes the place of a SELECT statement. To get the value, just SELECT from the table you inserted into. Typically, this would be a temp... | <p>I tried Ant's approach and it worked a treat:</p>
<pre>
Declare @Success tinyint
Declare @Response Table (Success int)
Insert into @Response(Success)
Exec Fix_RollbackReturn 12345, 15
Select @Success=Success from @Response
</pre>
<p>As you can see I used a Table Variable rather than a temporary table because sligh... | 28,530 |
<p>Does anyone have, or know of, a binary patch generation algorithm implementation in C#?</p>
<p>Basically, compare two files (designated <em>old</em> and <em>new</em>), and produce a patch file that can be used to upgrade the <em>old</em> file to have the same contents as the <em>new</em> file.</p>
<p>The implement... | <p>Sorry I couldn't be more help. I would definately keep looking at xdelta because I have used it a number of times to produce quality diffs on 600MB+ ISO files we have generated for distributing our products and it performs very well.</p>
| <p>This is a rough guideline, but the following is for the rsync algorithm which can be used to create your binary patches.</p>
<p><a href="http://rsync.samba.org/tech_report/tech_report.html" rel="nofollow noreferrer">http://rsync.samba.org/tech_report/tech_report.html</a></p>
| 2,766 |
<p>First, to make my job explaining a bit easier, here's some of my code:</p>
<pre><code>JSpinner spin = new JSpinner();
JFormattedTextField text = getTextField(spin);
text.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
// Do stuff... | <p>I know this is not the action listener...but maybe this can work for you?</p>
<p><pre><code>
text.addKeyListener( new KeyAdapter() {
@Override
public void keyReleased( final KeyEvent e ) {
if ( e.getKeyCode() == KeyEvent.VK_ENTER ) {
System.out.println... | <p>I think what you are asking is that when we manually edit the JSpinner shown value, it doesn't actually change it but only show as it.</p>
<p>The reason is that JSpinner use something called editor and has a value. The editor is responsibe for showing the current value and also, changing it (but only using arrow but... | 49,749 |
<p>I am using a satellite assembly to hold all the localization resources in a C# application.</p>
<p>What I need to do is create a menu in the GUI with all the available languages that exists for the application. Is there any way to get information dynamically?</p>
| <p>This function returns an array of all the installed cultures in the App_GlobalResources folder - change search path according to your needs.
For the invariant culture it returns "auto".</p>
<pre><code>public static string[] GetInstalledCultures()
{
List<string> cultures = new List<string>();
for... | <p><em>Each satellite assembly for a specific language is named the same but lies in a sub-folder named after the specific culture e.g. fr or fr-CA.</em><br>
Maybe you can use this fact and scan the folder hierarchy to build up that menu dynamically.</p>
| 26,805 |
<p>I would like to utilize the ASP.NET AJAX Page Methods functionality with a user control. Is there a way to be able to specify my static [WebMethod] inside the UserControl's code behind instead of the Page's code behind? </p>
| <p>You probably can't. The user control doesn't have all the functionality of a page and can't be called directly. You should instead create a webservice (asmx) to handle this scenario. If you wanted, the webservice call could be routed to the static method inside your user control.</p>
| <p>The response TheXenocide gave would seem to work, but the developers state, "Control Methods for ASP.NET AJAX is provided "as is" with no guarantees or warranties express or implied, including
implied warranties of fitness for a particular purpose, merchantability, and non-infringement." </p>
<p>If you are looking... | 30,989 |
<p>I have been using ASP.NET for years, but I can never remember when using the # and = are appropriate.</p>
<p>For example:</p>
<pre><code><%= Grid.ClientID %>
</code></pre>
<p>or</p>
<pre><code><%# Eval("FullName")%>
</code></pre>
<p>Can someone explain when each should be used so I can keep it strai... | <p><%= %> is the equivalent of doing Response.Write("") wherever you place it.</p>
<p><%# %> is for Databinding and can only be used where databinding is supported (you can use these on the page-level outside a control if you call Page.DataBind() in your codebehind)</p>
<p><a href="http://msdn.microsoft.com/en-... | <p>Here's a <a href="http://blogs.msdn.com/dancre/archive/2007/02/13/the-difference-between-lt-and-lt-in-asp-net.aspx" rel="noreferrer">great blog post by Dan Crevier</a> that walks through a test app he wrote to show the differences.</p>
<p>In essence:</p>
<ul>
<li>The <%= expressions are evaluated at render time... | 14,045 |
<p>I know postgres has a datatype for storing geographical coordinates. But I'm looking for a RDBMS agnostic solution. Currently I'm using Decimal(25,20) in MySQL. I may be using this data to lookup these locations based on a given distance from a given location later. Which would be the best approach to store this kin... | <p>Another good technique is to multiply the values by a constant and store them as integer values. Using integers only can also help speed up calculations.</p>
<p>Unless you are in serious need of precision you should really only need to store 5+ values after the decimal point. </p>
<p>This <a href="http://www.tbs... | <p>Following @<a href="https://stackoverflow.com/questions/293997/most-efficient-way-for-storing-geolocations-in-a-database#294014">vfilby's</a> answer, why not store the two halves of the number as two separate int types?</p>
| 37,533 |
<p>I would actually love to have an AlternatingItemTemplate on a GridView, but all it offers is an AlternatingItemStyle. In my grid, each two column row (in a table layout), has an image in the first column, and a description in the second column. I would like to have the positioning of the image and description alte... | <p>You might consider managing this with AlternatingItemStyle for fun.</p>
<p>Use 1 column or a repeater:</p>
<p>Item Template:</p>
<pre><code><div class="MyImage"><img src="" /></div>
<div class="MyDescription">Blah...Blah...</div>
</code></pre>
<p>CSS:</p>
<pre><code>.MyItemStyle .M... | <p>You will need to either handle the data binding event to try and determine if it is an item or alternating item, or switch to using a control that supports Item and AlternatingItem templates.</p>
| 27,963 |
<p>I have a custom NSTableView subclass which is bound to a data source (an NSArray) which updates asynchronously. When items are added to the array, rows are automatically added to the tableview. Awesome!</p>
<p>My question is this: How can I detect that this magic has happened so that I can perform some other tasks ... | <p>You don't need to subclass NSTableView to change its height based on the number of rows. In your controller, just monitor the data array using KVO and adjust the frame size of the tableview's scrollview (you can find it using <code>enclosingScrollView</code>) when rows are added or removed. I've used this technique ... | <p>Looked high and low for days on this solution. It worked like a charm, thanks! Here's a sample of my code for others to follow:</p>
<pre><code>
// tv = NSTableView
// view = NSView
int height = ([tv rowHeight] + [tv intercellSpacing].height) * [itemNodes count];
NSScrollView *sv = [tv enclosingScrollView];
NS... | 39,085 |
<p>I finished the mount of my Anet A8, tested everything and apparently it was ok. I installed the driver that came with it, <code>CH341SER_MAC</code>, turned on the printer, connect USB cable, but nothing happened. </p>
<p>In Cura, I tried to add a printer many times and this message always appears</p>
<blockquote>
... | <p>There are a lot of problems with the CH340 chipset drivers to be found on 3D SE and various forums on the internet. To use this cheap CH340 chip that is used by a number of Arduino compatible (clone) boards to provide USB connectivity (a USB bus converter chip that converts USB bus signals to serial interface) you n... | <p>What Cura version do you have?
Cura only works with the Anet A8 via USB on versions 2.3 and lower according to this <a href="https://www.thingiverse.com/groups/anet-a8-prusa-i3/forums/general/topic:12212" rel="nofollow noreferrer">page</a>. The page is from thingiverse(A 3d printing forum + print files page)</p>
| 939 |
<p>I'm trying to use <a href="http://www.glish.com/css/9.asp" rel="nofollow noreferrer">this</a> layout with two 50% column width instead. But it seems that when the right columns reaches its 'min-width', it goes under the left column. Is there any way to use the 'shim' technique to set a min-width to the wrapper so bo... | <p>I was able to come up with a "no HTML tables required" solution based off of a technique by Stu Nicholls at CSS Play and I personally like it because not only does it work in IE6+ and FF2+, it is also valid CSS that does not require any hacks. For my argument on why a CSS-based layout is preferable over HTML tables,... | <p>Use a 2 column table. It will do exactly what you want. Div's are supposed to be used to simply divide up logically distinct blocks, and tables are there to lay out columned data. If you want two columns, use a table, rather than trying to force Div's to behave like a table.</p>
| 23,251 |
<p>Currently I have a stored procedure that makes some updates to a table, and after it makes them, I need to call a web service.</p>
<p>The procedure uses a transaction, and I need to call the web service at the end of the transaction. If the web service call should fail, the transaction would get rolled back.</p>
<... | <p>This <a href="http://www.simple-talk.com/sql/sql-server-2005/practical-sql-server-2005-clr-assemblies/" rel="nofollow noreferrer">Simple-Talk tutorial</a> shows you how to accomplish this.</p>
<p>You can also do this <a href="http://blog.davebouwman.net/CommentView,guid,6b2d6ed4-cb5e-40e8-ab88-7477c2ce69d0.aspx" re... | <p>If you have control over the data source that this web service is using (bound to) you may consider the option of adding this data source as linked server to your SQL 2005 server. This way you will be able to execute a SQL using OPENQUERY against this data source without accessing it through web service.</p>
| 31,505 |
<p>When ever I think I can use the yield keyword, I take a step back and look at how it will impact my project. I always end up returning a collection instead of yeilding because I feel the overhead of maintaining the state of the yeilding method doesn't buy me much. In almost all cases where I am returning a collectio... | <p>Note that with yield, you are iterating over the collection once, but when you build a list, you'll be iterating over it twice.</p>
<p>Take, for example, a filter iterator:</p>
<pre><code>IEnumerator<T> Filter(this IEnumerator<T> coll, Func<T, bool> func)
{
foreach(T t in coll)
if (... | <p>I've used yeild in non-linq code things like this (assuming functions do not live in same class):</p>
<pre><code>public IEnumerable<string> GetData()
{
foreach(String name in _someInternalDataCollection)
{
yield return name;
}
}
...
public void DoSomething()
{
foreach(String value in... | 41,029 |
<p>The Recent Projects panel on the Start Page of VS2008 Professional doesn't appear to work, and constantly remains empty.</p>
<p>I've noticed this on 3 of our developers VS2008 installations, in fact all the installations that weren't updated from 2005 but installed from scratch. I generally treat this as a bit of a... | <p>Is Tools | Options | Environment | General | "items shown in recently used lists" set to a number greater than 0?</p>
| <p>Is Tools | Options | Environment | General | "items shown in recently used lists" set to a number greater than 0?</p>
| 8,271 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.