instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/334879/how-do-i-get-the-application-exit-code-from-a-windows-command-line">How do I get the application exit code from a Windows command line?</a> </p>
</blockquote>
<p>In Unix/bash, I can simply say:</p>
<blo... | <p>Use "errorlevel", like this:</p>
<pre><code>IF ERRORLEVEL 1 GOTO ERROR
</code></pre>
<p>The errorlevel command is a little peculiar; it returns true if the return code was equal to or <strong>higher</strong> than the specified errorlevel. You can also write</p>
<pre><code>IF %ERRORLEVEL% NEQ 0 GOTO ERROR
</code><... | <p>check for the ERRORLEVEL</p>
| 34,988 |
<p>Like most developers I have grown to love dual monitors. I won't go into all the reasons for their goodness; just take it as a given.</p>
<p>However, they are not perfect. You can never seem to line them up "just right". You always end up with the monitors at slight funny angles. And of course the bezel always gets... | <p>can <a href="http://jgpaiva.donationcoders.com/gridmove.html" rel="noreferrer">gridmove</a> be of any assistance?</p>
<p>very handy tool on larger screens...</p>
| <p>What about just using virtual desktops? You can spread your windows around among multiple workspaces. Something like <a href="http://virt-dimension.sourceforge.net/" rel="nofollow noreferrer">Virtual Dimension</a> should give you most of that functionality. I use virtual desktops all the time on Linux, and it's the ... | 46,183 |
<p>In my <a href="https://stackoverflow.com/questions/222442/sql-server-running-large-script-files">eternal</a> <a href="https://stackoverflow.com/questions/224830/how-do-i-set-a-sql-server-scripts-timeout-from-within-the-script">saga</a> to insert 1.4 million rows of data from a SQL script, I've written a basic WinFor... | <p><a href="http://msdn.microsoft.com/en-us/library/ms188365.aspx" rel="noreferrer">BULK INSERT</a> won't work for you? Or the SQL Server Import/Export Wizard (<a href="http://www.databasejournal.com/features/mssql/article.php/3580216" rel="noreferrer">here</a> or <a href="http://technet.microsoft.com/en-us/library/ms... | <p>I believe that IDENTITY INSERT can only be overridden one table at a time, per session.</p>
<p>You will have to maybe batch up 2 or 300 insert statements at a time and precede each batch with the ident insert. </p>
<p>so the app will execute a block like this....</p>
<pre><code>SET IDENTITY_INSERT [Table] OFF;
IN... | 28,526 |
<ol>
<li>Is there a way that I can select a bunch of rows or cells from a SilverLight DataGrid and Copy them for pasting into e.g. excel?</li>
</ol>
<p>The DataGrid doesn't seem to have this functionality built in!</p>
<p>Thanks a lot </p>
| <p>Silverlight 4 is great, Ctrl-A a datagrid, copy and paste it into Excel.</p>
<p>You can even customize what gets copied using ClipboardContentBinding, which is quite useful if you are using a TemplateColumn.</p>
| <p>Silverlight uses a vector rendering system. The text is not the same as text in Notepad- it's being rendered as a vector image. You can't highlight text in Silverlight or Flash.</p>
<p>If you're writing the app, offer a "download Excel file" button that redirects to an Excel file generator.</p>
| 39,100 |
<p>Im trying to add a third party framework in Xcode but I'm getting an error that it can't be found</p>
<blockquote>
<p>error: MKAbeFook/MKAbeFook.h: No Such File or Directory</p>
</blockquote>
<p>I've added it in the Linked Frameworks group and added it to the Target for this project. I've also added it to a new ... | <p>Best way to diagnose this is to post the compiler invocation line, not just the error (you can just drag and drop the line from the Build Results window that says "Compiling foo.m"). My expectation is that you don't have a Frameworks Search Path set up for the location of the framework. Xcode usually adds that man... | <p>Perhaps the author mistook MKFaceBook for MKAbeFook?</p>
<p>EDIT: Never mind, it looks like that is actully the name of the framework.</p>
| 49,761 |
<p>To quote wikipedia:</p>
<blockquote>
<p>Scrum is facilitated by a ScrumMaster, whose primary job is to remove impediments to the ability of the team to deliver the sprint goal. The ScrumMaster is not the leader of the team (as they are self-organizing) but acts as a buffer between the team and any distracting inf... | <p>Unfortunately we don't have the luxury of having dedicated scrum masters. I am also a team leader and senior developer which more than fills the day.</p>
| <p>A Scrum Master role implemented correctly, is invaluable to the Project and should not be look upon as a Part time role. The most important aspect of the role is to act as an obstacle remover for any queries raised in the Scrum meetings by the Development Teams. A Technical Scrum Master (which is what most SMs tend ... | 15,557 |
<p>There is a groupwall of which I want to download and store all messages in a db.
In the documentation I cannot find a good way to do it. Did I miss something? What's the good way to do this?</p>
| <p>As I need the subscript, I cannot avoid the custom formatting. What I found out to be an ugly, but obviously possible solution is the following:</p>
<pre><code><MenuItem>
<MenuItem.Header>
<StackPanel Orientation="Horizontal">
<AccessText>_O</AccessText>
<TextBlock... | <p>Do you even need to use an AccessKey at all? Assuming that you didn't need/want the custom styling of the MenuItem header text, you could get the same affect by doing the following:</p>
<pre><code><MenuItem HeaderText="_02" />
</code></pre>
<p>Would just putting an underscore before the 0 work? Although I se... | 41,458 |
<p>For our application, we keep large amounts of data indexed by three integer columns (source, type and time). Loading significant chunks of that data can take some time and we have implemented various measures to reduce the amount of data that has to be searched and loaded for larger queries, such as storing larger g... | <blockquote>
<p>This made me wonder if the performance impact of disk I/O is actually much heavier than I thought.</p>
</blockquote>
<p>Definitely. If you have to go to disk, the performance hit is many orders of magnitude greater than memory. This reminds me of the classic Jim Gray paper, <a href="http://research.m... | <p>I made a similar discovery when working within Python on a database: the cost of accessing a disk is very, very high. It turned out to be much faster (ie nearly two orders of magnitude) to request a whole chunk of data and iterate through it in python than it was to create seven queries that were narrower. (One pe... | 4,561 |
<p>I have a server access log, with timestamps of each http request, I'd like to obtain a count of the number of requests at each second. Using <code>sed</code>, and <code>cut -c</code>, so far I've managed to cut the file down to just the timestamps, such as:</p>
<blockquote>
<p>22-Sep-2008 20:00:21 +0000<br>
22-... | <p>I think you're looking for</p>
<pre><code>uniq --count
</code></pre>
<blockquote>
<p>-c, --count
prefix lines by the number of occurrences</p>
</blockquote>
| <p>maybe use xargs? Can't put it all together in my head on the spot here, but use xargs on your sort -u so that for each unique second you can grep the original file and do a wc -l to get the number. </p>
| 15,618 |
<p>We have a multi-tiered/hierarchical YUI menu activated via a YUI menu button. Everything in this menu works pretty well. If you mouseover a menu item with a submenu, the submenu appears as expected. You can select an item from this submenu just fine. </p>
<p>The problem, however, is that you can also click on t... | <p>Todd Kloots, author of the YUI Button and Menu widgets here. Took at look at your request. Unfortunately the current version YUI Button and Menu aren't designed to support the type of interaction you are looking to create. Feel free to file a feature request via SourceForge and I'll try to work on this for a futu... | <p>It's not exactly what you asked for, but have you looked at <a href="http://code.google.com/p/iui/" rel="nofollow noreferrer">iUI</a>? You may be able to pick up some tricks from the implementation.</p>
| 28,953 |
<p>(best in your own eyes) Most features? Coolest Features? Slickest Design?</p>
<p><a href="http://www.centreon.com/" rel="nofollow noreferrer">Centreon</a>?</p>
<p><a href="http://www.nagvis.org/" rel="nofollow noreferrer">NagVis</a>?</p>
<p>Other?</p>
| <p>Centreon is the best ! We use it in our company. Have a look at FAN(Fully automated Nagios) ! best best best.. and don't forget to use the lm_sensors for linux and Notify By Jabber plugin if you use Jabber and linux servers in your company and google talk ;-)</p>
| <p>NagVis seems to be better even if only from purely aesthetic prospective. But then for me it's one of the key elements. Maybe if you would ask more specific question (what criteria do you use to define <em>best</em>) it could be easier to answer you question.</p>
| 12,687 |
<p>How to find and remove unused Delphi runtime packages from a project that uses packages?</p>
<p>I have a Delphi project that is made up of several packages, in the requires part of the packages there are several Borland/3rd party packages listed (rtl.dcp, vcl.dcp ect) I know I need most of them, but there are ones ... | <p>If you specify a package to be used as runime package, all the packages that package requires need to be deployed as runtime package as well. Delphi's compiler automatically checks if this is the case. So you don't need to explicitly require rtl.dcp, as long as you require one of your other packages that does. This ... | <p>I was getting a compile error for a package that I didn't have implicitly called and couldn't figure out how to get rid of. I asked my guru and got the following solution which worked well.</p>
<p>"You can delete the .dproj and open the app (via RAD) using the .dpr file. Do a build and save. Then you should have a ... | 40,471 |
<p>How would I have a <a href="http://en.wikipedia.org/wiki/JavaScript" rel="noreferrer">JavaScript</a> action that may have some effects on the current page but would also change the URL in the browser so if the user hits reload or bookmark, then the new URL is used? </p>
<p>It would also be nice if the back button ... | <p>If you want it to work in browsers that don't support <code>history.pushState</code> and <code>history.popState</code> yet, the "old" way is to set the fragment identifier, which won't cause a page reload.</p>
<p>The basic idea is to set the <code>window.location.hash</code> property to a value that contains whatev... | <p>I've had success with:</p>
<pre><code>location.hash="myValue";
</code></pre>
<p>It just adds <code>#myValue</code> to the current URL. If you need to trigger an event on page Load, you can use the same <code>location.hash</code> to check for the relevant value. Just remember to remove the <code>#</code> from the v... | 16,514 |
<h2>General</h2>
<ul>
<li>Follow the same standards for all tests.</li>
<li>Be clear about what each test state is.</li>
<li>Be specific about the expected behavior.</li>
</ul>
<h2>Examples</h2>
<p>1) MethodName_StateUnderTest_ExpectedBehavior</p>
<pre><code>Public void Sum_NegativeNumberAs1stParam_ExceptionThrown(... | <p>I am pretty much with you on this one man. The naming conventions you have used are:</p>
<ul>
<li>Clear about what each test state is.</li>
<li>Specific about the expected behaviour.</li>
</ul>
<p>What more do you need from a test name?</p>
<p>Contrary to <a href="https://stackoverflow.com/questions/96297/naming-... | <p>As long as you follow a single practice, it doesn't really matter. Generally, I write a single unit test for a method that covers all the variations for a method (I have simple methods;) and then write more complex sets of tests for methods that require it. My naming structure is thus usually test (a holdover from J... | 12,191 |
<p>I have a simple app that uses an SQL Express 2005 database. When the user closes the app, I want to give the option to back up the database by making a copy in another directory. However, when I try to do it, I get "The process cannot access the file '...\Pricing.MDF' because it is being used by another process." ... | <p>You don't want to copy the mdf directly because SQL keeps most of the changes in the transaction log, take a look at the modified time after running some queries, it doesn't write directly to the file. I noticed this while setting up an rsync job.</p>
<p>Having SQL generate the backup is much safer and more desirab... | <p>There's an example in <a href="http://forums.microsoft.com/msdn/showpost.aspx?postid=487021&siteid=1" rel="nofollow noreferrer">this post</a> that shows how to back up a SQL Express database within a program.</p>
| 41,307 |
<p>I am looking for the cleanest way. I am tempted to use delegates not sure though.</p>
| <p>Are you after something like this?</p>
<pre><code>class A
{
public int Value;
public int Add(int a) { return a + Value; }
public int Mul(int a) { return a * Value; }
}
class Program
{
static void Main( string[] args )
{
A a = new A();
a.Value = 10;
Func<int, int> f... | <p>You might need to add more details. Delegates are a good option option, as is reflection if you only have the method name, not an actual pointer to it.</p>
| 27,623 |
<p>I need to create a site map/list, but I need the link-name to show up as well.</p>
<p>What I mean by that is given, say, www.google.com, I need the following list to be created.</p>
<pre><code>Google - www.google.com
Images - http://images.google.com/imghp?hl=en&tab=wi
...
My Account - http://images.google.com... | <p>Use SQL Server Profiler - it can connect to Analysis Services... When you create a trace make sure you click "Show All Events" and capture the "Execute MDX" events.</p>
| <p>I remember doing something along these lines a few years ago. I am not sure that Analysis Services will actually log the MDX it uses, but it does log something. I believe you can right-click the server properties in AS, and there is a tab to tell it a file to log queries to. </p>
<p>(Sorry I cant be more specific, ... | 39,286 |
<p>We have YouTube videos on a site and want to detect if it is likely that they will not be able to view them due to (mostly likely) company policy or otherwise.</p>
<p>We have two sites:</p>
<p>1) Flex / Flash
2) HTML</p>
<p>I think with Flex I can attempt to download <a href="http://youtube.com/crossdomain.xml" r... | <p>I like lacker's solution, but yes, it creates a <a href="http://en.wikipedia.org/wiki/Race_condition" rel="noreferrer" title="Race Condition on Wikipedia">race condition</a>.
This will work and won't create a race contition:</p>
<pre><code>var image = new Image();
image.onload = function(){
// The user can access y... | <p>This worked for me... Its also my first post, hope it helps some one too.</p>
<pre><code><?php
$v = file_get_contents("https://www.youtube.com/iframe_api");
//Tie counts to a variable
$test = substr_count($v, 'loading');
if ($test > 0)
{ ?>
<iframe>YOUTUBE VIDEO GOES HERE</iframe>
... | 36,333 |
<p>I've been trying to submit a form with the FormPanel using the Action class Ext defaults to. However, I'd like it to consider the response as a script, not JSON-encoded.</p>
<p>Has anyone had any experience on this?</p>
| <p>The best plan would be to create a custom action by extending <code>Ext.form.Action</code>.</p>
<p>You can then <code>eval</code> the <code>response</code> object or the <code>result</code> object in the <code>success</code> callback of your custom action.</p>
<p>Your custom action can be called from <code>Ext.for... | <p>using <code>Form.getForm().submit()</code> as your action response call works great and will automatically submit your form values to your backend as well as any custom values you would want to supply. On the return response you are passed a response object, which could be anything you want. So you could easily eval... | 18,284 |
<p><strong>I am very, very new to MYSQL.I tried to create a table named "option".</strong>
<strong>My SQL Query is :</strong></p>
<p>create table option( </p>
<p>id int not null primary key auto_increment,</p>
<p>choice varchar(30)</p>
<p>)</p>
<p><strong>While executing this query it shows the following error</st... | <p>Pick a different name (one that isn't a reserved word in your RDBMS) and save yourself and whoever else might work on it many headaches. </p>
| <p><strong>option</strong> is a <a href="http://dev.mysql.com/doc/mysqld-version-reference/en/mysqld-version-reference-reservedwords-5-0.html" rel="nofollow noreferrer">reserved word</a> in MySQL. Save yourself a world of pain and use <strong>choice</strong> for your table name.</p>
| 42,482 |
<p>Is there any point to freeing memory in an atexit() function?</p>
<p>I have a global variable that gets malloc'ed after startup. I could write an atexit() function to free it, but isn't the system going to reclaim all that memory when the program exits anyway?</p>
<p>Is there any benefit to being tidy and actively... | <p>Not in C - it's like rearranging the deck chairs while the ship sinks around you.</p>
<p>In C++ the answer is different, because objects can delete temporary files and so forth in their destructors, so you need to make sure those get called.</p>
| <p>not freeing memory before process termination isn't a memory leak. it's a memory leak when you lose a handle to it. but memory is not the only type of resource, and other resources persist across processes (like window handles and file handles), so you do need to 'free' those.</p>
| 28,602 |
<p>Is it possble to have something like this in ASP.NET MVC...</p>
<pre><code>[Authorize]
[AcceptVerbs(HttpVerbs.Get)]
public string AddData(string Issues, string LabelGUID)
{
return "Authorized";
}
[AcceptVerbs(HttpVerbs.Get)]
public string AddData()
{
return "Not Authorized";
}
</code></pre>
<p>So if the u... | <p>Yes, its possible. You would need to create your own <code>ControllerActionInvoker</code> and override the <code>FindActionMethod</code> member. I'd let the base class do it's work and then check to see if the method it returns satisfies your criteria and if not, return a better match.</p>
<p>I'm doing something ... | <p>I don't believe so. The controller action with the best parameter match will get selected and then the attributes will be applied.</p>
<p>You could use</p>
<pre><code>if (Request.IsAuthenticated)
{
return "Authorized";
}
else
{
return "Not Authorized";
}
</code></pre>
<p>Under the hood [Authorize] is ... | 42,701 |
<p>Quick thing: Please tell me if I misuse any of the terminology</p>
<p>On a replicator+, I have been printing successfully for a while, when suddenly the raft started to warp. I was doing a bunch of models that covered the whole tray, so I shrunk to just a small area, but It still warped I read up on how to fix, but... | <p>I'm not sure I am reading your post correctly, but if you are doing a batch of small prints, I would recommend to <strong>space them enough so as each of them has its own mini-raft, rather than all of them sharing the same large one</strong>.</p>
<p>If you are using cura, you can tweak how much the raft goes past t... | <p>Lowering the raft temp to 200 degrees C should help. You should also apply hairspray and purple gluestick to your entire printed to help with raft adhesion to the bed.</p>
| 821 |
<p>I am forced to use VSS at work, but use SVN for a personal repository. What is the best way to sync between VSS and sync?</p>
| <p>To get rid of the manual merge step, I could use a separate svn branch (svn://branches/VSS) as follows:</p>
<ol>
<li>Create a working copy of svn://branches/VSS</li>
<li>Do a VSS Get Latest on this working copy</li>
<li>svn commit</li>
<li>svn merge from svn://trunk</li>
<li>svn commit</li>
<li>Do a VSS diff and ch... | <p>What I have done in the past is as follows:</p>
<ol>
<li>Make sure all my changes are committed to svn://trunk</li>
<li>Do a get latest from VSS into my working copy.</li>
<li>Manually merge the changes in my working copy.</li>
<li>Commit the merged code into the svn://trunk</li>
<li>Do a VSS diff and checkout any ... | 8,156 |
<p>In C and C++ a variable can be marked as <a href="http://en.wikipedia.org/wiki/Volatile_variable" rel="noreferrer"><strong>volatile</strong></a>, which means the compiler will not optimize it because it may be modified external to the declaring object. Is there an equivalent in Delphi programming? If not a keyword... | <p>Short answer: no.</p>
<p>However, I am not aware of any situation in which the conservative approach of the compiler will change the number of reads or writes if you follow this approach:</p>
<p>When reading a cross-thread visible location, save its value to a local before doing any further manipulation; similarly... | <p>Use dynamically allocated pointers?</p>
<pre><code>var
MyVarPtr: ^integer;
begin
New(MyVarPtr);
MyVarPtr^ := 5;
...
</code></pre>
<p>This should keep the compiler from using a register for the integer value (but it might still use one for the address). I am not sure how that compares to volatile, though.</p>... | 28,726 |
<p>We all know that commenting our code is an important part of coding style for making our code understandable to the next person who comes along, or even ourselves in 6 months or so.</p>
<p>However, sometimes a comment just doesn't cut the mustard. I'm not talking about obvious jokes or vented frustraton, I'm talki... | <p>Just the typical Comp Sci 101 type comments:</p>
<pre><code>$i = 0; //set i to 0
$i++; //use sneaky trick to add 1 to i!
if ($i==$j) { // I made sure to use == rather than = here to avoid a bug
</code></pre>
<p>That sort of thing.</p>
| <p>I thought this was about the worst comment on a SO post, and was disappointed to find otherwise.</p>
| 17,320 |
<p>Very simply put, I have the following code snippet:</p>
<pre><code>FILE* test = fopen("C:\\core.u", "w");
printf("Filepointer at: %d\n", ftell(test));
fwrite(data, size, 1, test);
printf("Written: %d bytes.\n", size);
fseek(test, 0, SEEK_END);
printf("Filepointer is now at %d.\n", ftell(test));
fclose(test);
</code... | <p>Since you're opening the file in text mode, it will convert end-of-line markers, such as LF, into CR/LF.</p>
<p>This is likely if you're running on Windows (and you probably are, given that your file name starts with <code>"c:\"</code>).</p>
<p>If you open the file in <code>"wb"</code> mode, I suspect you'll find ... | <p>what does fwrite return? normally the return value should be the number of bytes written.
Also, what does the ftell() answer with right before the fseek?</p>
<p>It might help to know what operating system, C compiler version and C library.</p>
| 17,485 |
<p>In my child window I have </p>
<pre><code>$('#opfile').addOption("someval",sometext");
</code></pre>
<p>Problem is #opfile is an a parent window I cant get it to communicate</p>
<p>I tried</p>
<p>window.opener.$('#opfile').addOption("someval",sometext");</p>
<p>but no luck any ideas?</p>
<p>Update</p>
<p>Emba... | <p>This may be helpful.</p>
<p><a href="http://www.sfpeter.com/2008/03/13/communication-between-browser-windows-with-jquery-my-new-plugin/" rel="nofollow noreferrer">Communication between browser windows</a></p>
<p>Though this is not directly related to the select box example, but the concepts may be applied here.</p... | <p>try this by changing array in options</p>
<p>window.opener.document.getElementById("opfile").options[0] = new Option("someval",sometext");</p>
| 44,207 |
<p>I am thinking about a DB Design Problem.</p>
<p>For example, I am designing this stackoverflow website where I have a list of Questions.</p>
<p>Each Question contains certain meta data that will probably not change.
Each Question also contains certain data that will be consistently changing (Recently Viewed Date, ... | <p>When designing a database structure, it's best to <a href="http://en.wikipedia.org/wiki/Database_normalization" rel="nofollow noreferrer">normalize</a> first and change for performance after you've profiled and benchmarked your queries. Normalization aims to prevent data-duplication, increase integrity and define th... | <p>You should have the two table separated out as you might want to record the history of the question. The main Question table is indexed by question ID then the Status table is indexed by query ID and date/time stamp and contains a row for each time the status changes.</p>
<p>Don't know that the updates are really s... | 48,283 |
<p>I want to insert something into a STL list in C++, but I only have a reverse iterator. What is the usual way to accomplish this?</p>
<p>This works: (of course it does)</p>
<pre><code>std::list<int> l;
std::list<int>::iterator forward = l.begin();
l.insert(forward, 5);
</code></pre>
<p>This doesn't wor... | <p><code>l.insert(reverse.base(), 10);</code> will insert '10' at the end, given your definition of the 'reverse' iterator. Actually, <code>l.rbegin().base() == l.end()</code>. </p>
| <p>Just in case it is helpful, as this it the first hit on a search, here is a working example of using <code>rbegin</code>. This should be faster than using <code>std::stringstream</code> or <code>sprint</code>. I defiantly call a member <code>fmt_currency</code> many thousands of times in some print jobs. The <code>s... | 38,551 |
<p>When launching a process from Java, both stderr and stdout can block on output if I don't read from the pipes. Currently I have a thread that pro-actively reads from one and the main thread blocks on the other.</p>
<p>Is there an easy way to join the two streams or otherwise cause the subprocess to continue while ... | <p>Set the redirectErrorStream property on ProcessBuilder to send stderr output to stdout:</p>
<pre><code>ProcessBuilder builder = new ProcessBuilder(command);
builder.redirectErrorStream(true);
</code></pre>
<p>You should then create a thread to deal with the process stream, something like the following:</p>
<pre><... | <p>Just have two threads, one reading from stdout, one from stderr?</p>
| 8,946 |
<p>Method chaining is the only way I know to build fluent interfaces.</p>
<p>Here's an example in C#:</p>
<pre><code>John john = new JohnBuilder()
.AddSmartCode("c#")
.WithfluentInterface("Please")
.ButHow("Dunno");
Assert.IsNotNull(john);
[Test]
public void Should_Assi... | <p>You can create a fluent interface in any version of .NET or any other language that is Object Oriented. All you need to do is create an object whose methods always return the object itself.</p>
<p>For example in C#:</p>
<pre><code>public class JohnBuilder
{
public JohnBuilder AddSmartCode(string s)
{
... | <p>Dynamic keyword in C# 4.0 will make it possible to write dynamic style builders. Take a look at following <a href="http://www.nikhilk.net/CSharp-Dynamic-Programming-JSON.aspx" rel="nofollow noreferrer">article</a> about JSON object construction.</p>
| 37,441 |
<p>I thought I am not bad at Google, but simply I am unable to find a G-code for doing circular motion for nozzle cleaning. It is possible to write a simple circular motion in G-code?</p>
| <p>To draw a circle, you need to approximate the circle as a sufficient number of line segments. This requires computing or using a table of sine and cosine values for each angle step. Then you just emit a sequence of <code>G1</code> commands.</p>
<p>Some printer firmware also supports arc drawing commands you could us... | <p>While many 3D printers support using G2 and G3 for circles and arcs, most people are not used to them because the STL files consist entirely of flat triangles (straight lines).</p>
<p>If you want a simple 2D circle, see the following for help:</p>
<p><a href="https://marlinfw.org/docs/gcode/G002-G003.html" rel="nofo... | 2,056 |
<p>Is it possible (and if yes, how) to bypass DNS when doing a HTTP request ?</p>
<p>I want to hit directly a front-end with an HTTP request, without getting through NLB but with the correct host header.
As I have the IP of my server, I just need to bypass the DNS.</p>
<p>I tried to use WebRequest, replacing the URL... | <p>At the time this question was asked this was not possible to do with the WebRequest class. However following a Microsoft Connect issue raised as a result of this question, Microsoft Added the Host property to the HttpWebRequest class in .Net version 4.0. As such if you are using .net 4.0 or later you can achieve wha... | <p>I had a similar problem myself, but managed to get around it using sockets (As mentioned by Martin Brown. Here is my answer: <a href="https://stackoverflow.com/questions/359041/request-web-page-in-c-spoofing-the-host#359299" title="My Answer">https://stackoverflow.com/questions/359041/request-web-page-in-c-spoofing... | 41,838 |
<p>I've been printing PLA on a Pegasus 12" for 2 years. Print quality has been great but in the last few months the quality of the prints has deteriorated. After looking into it, it seems when the head moves away from the spool and puts the filament in tension (and pulls on the spool) the extruder cog slips on the fila... | <p>The soldering in the Tevo components is very low quality as I replaced/resoldered most of the end-stops.</p>
<p>As the gantry goes down - please ensure that the cable is not pulled over (no contact) and there is contact on the edge of the acrylic and the end-stop, also the small acrylic switch holder could bend/sli... | <p>I'm not familiar with your particular model, so this may not be directly applicable.</p>
<p>For many printer models, a swing thru thingiverse.com will find you a replacement z-stop switch mount that uses a threaded screw to set the z-height at which the microswitch fires. It may well be that you simply need to off... | 1,065 |
<p>I was wondering what is the best data structure to deal with a lot of moving objects(spheres, triangles, boxes, points, etc)? I'm trying to answer two questions, Nearest Neighbor and Collsion detection.</p>
<p>I do realize that traditionally, data structures like R trees are used for nearest neighbor queries and O... | <ol>
<li><p>You can partition the scene in an octree and utilize scene coherence. Your moving object that you are testing is going to be in a specific node of the tree for a specific amount of frames depending on its speed. This means you can assume it will be in the node and therefore quickly cut out a lot of objects ... | <p>sweep and prune broad phase + gjk narrow phase</p>
| 29,167 |
<p>Depends on your experience could you recommend something?
I've use <a href="http://izpack.org/" rel="noreferrer">izpack</a>, and it's very nice tool, is there any other, better tool? </p>
| <p>In MS Windows <a href="http://nsis.sourceforge.net/Main_Page" rel="noreferrer">NSIS</a> is great and it's free & OSS</p>
<p>Ref: <a href="http://nsis.sourceforge.net/Java_Launcher_with_automatic_JRE_installation" rel="noreferrer">Java Launcher with automatic JRE installation</a></p>
| <p>We are using IZPack for quit a while and are very satisfied. You can build installers for nearly all platforms and it integrates well with your build tools like maven.</p>
| 20,893 |
<pre><code>devenv mysolution.sln /build "Release|Win32" /project myproject
</code></pre>
<p>When building from the command line, it seems I have the option of doing a <code>/build</code> or <code>/rebuild</code>, but no way of saying I want to do "project only" (i.e. not build or rebuild the specified project's depend... | <p>Depending on the structure of your build system, this may be what you're looking for:</p>
<pre><code>msbuild /p:BuildProjectReferences=false project.proj
</code></pre>
| <p>Thanks for the answers. I see from a bit of looking into <code>msbuild</code> that it can deal with a <code>.sln</code> file rather than a <code>.vcproj</code>; can this be accomplished that way instead of having to know the location of the <code>.vcproj</code>?</p>
<p>Let me take a step back. We have a big solutio... | 15,038 |
<p>Anyone working on the Android ('gPhone') have or know of a place where I can find a good ORM tool for it? The code is written in Java, and the database is SQLite. What I would like to find is a tool that given the object definition, can auto-generate the tables and the CRUD functions (that would be awesome), or, bar... | <p>Thought I'd just add my $0.02 here about my <a href="http://ormlite.com/" rel="nofollow noreferrer">ORMLite package</a>.</p>
<p>It is a lightweight replacement to Hibernate and uses native Android OS database calls to support SQLite on Android. It also supports many other database types using JDBC on other archite... | <p>Had negative experience with db4o (v. 8): indexing didn't work properly (exception etc.). So I didn't managed how to avoid creating duplicates in foreign tables when having object in object structure. More detailed explanation in my <a href="https://stackoverflow.com/questions/7402127/restrict-child-duplicates-on-cr... | 48,556 |
<p>I have tried following guides like <a href="http://docs.djangoproject.com/en/dev/howto/deployment/modpython/" rel="nofollow noreferrer">this one</a> but it just didnt work for me.</p>
<p><strong>So my question is this:</strong> What is a good guide for deploying Django, and how do you deploy your Django.</p>
<p>I ... | <p><code>mod_wsgi</code> in combination with a <code>virtualenv</code> for all the dependencies, a mercurial checkout into the virtualenv and a <code>fabric</code> recipe to check out the changes on the server.</p>
<p>I wrote an article about my usual workflow: <a href="http://lucumr.pocoo.org/2008/7/17/deploying-pyth... | <p>The easiest way would be to use one of the sites on <a href="http://djangofriendly.com/hosts/" rel="nofollow noreferrer">http://djangofriendly.com/hosts/</a> that will provide the hosting and set up for you, but even if you're wanting to roll your own it will allow you to see what set up other sites are using.</p>
| 13,930 |
<p>I have a UIImageView and the objective is to scale it down proportionally by giving it either a height or width. </p>
<pre><code>UIImage *image = [[UIImage alloc] initWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://farm4.static.flickr.com/3092/2915896504_a88b69c9de.jpg"]]];
UIImageView *imageVi... | <p>Fixed easily, once I found the documentation!</p>
<pre><code> imageView.contentMode = .scaleAspectFit
</code></pre>
| <p>Here is how you can scale it easily.</p>
<p>This works in 2.x with the Simulator and the iPhone.</p>
<pre><code>UIImage *thumbnail = [originalImage _imageScaledToSize:CGSizeMake(40.0, 40.0) interpolationQuality:1];
</code></pre>
| 22,459 |
<p>I was noticing on a print I had just done that the quality was not up to typical snuff. I had just started using a roll of PLA filament that I had been keeping on a shelf without a wrapper for a couple months. How long can you store filament before it gets too hydrated from the air to print? I expected more than a c... | <p>In <strong>theory</strong>, most filaments don't go bad within a year. However, praxis shows, that averse conditions can impact the filaments over time and age them to unusability.</p>
<p>Among the damaging factors is heat, but most filaments also are hygroscopic and absorb water to some small degree, or even heavil... | <p>To answer your question: it depends on the relative humidity. Generally, a few weeks in a semi-arid environment. But, it'll still print really well. If you're looking for really tight filament diameter tolerances, a week or even less could change the diameter .001 or more if there is moisture in the air. I've used P... | 1,103 |
<p>Is there any way to Write files to App_Data under medium trust hack?</p>
<p>Im sure I've heard about some hack, is that true?</p>
| <p>I don't think you are able to create new files, but you should be able to write to existing files in the App_Data folder. But I have honestly never experienced any problems with Medium Trust and writing to the App_Data folder. Are you sure it has the necessary permissions needed for writing files to the hard drive... | <p>I don't think you are able to create new files, but you should be able to write to existing files in the App_Data folder. But I have honestly never experienced any problems with Medium Trust and writing to the App_Data folder. Are you sure it has the necessary permissions needed for writing files to the hard drive... | 5,245 |
<p>We're having a bit of fun here at work. It all started with one of the guys setting up a Hackintosh and we were wondering whether it was faster than a Windows Box of (nearly) same specs that we have. So we decided to write a little test for it. Just a simple Prime number calculator. It's written in Java and tells us... | <p>Well I see a couple of quick optimizations that can be done.
First you don't have to try each number up to half of the current number.</p>
<p>Instead you only have try up to the square root of the current number.</p>
<p>And the other optimization was what BP said with a twist:
Instead of</p>
<pre><code>int count ... | <p>C#</p>
<p>Enhancement to <a href="https://stackoverflow.com/questions/288200/prime-number-calculation-fun#288339">Aistina's code</a>:</p>
<p>This makes use of the fact that all primes greater than 3 are of the form 6n + 1 or 6n - 1.</p>
<p>This was about a 4-5% speed increase over incrementing by 1 for every pass... | 36,680 |
<p>I have an ASP.NET webforms application (3.5 SP1) that I'm working on, and attempting to enable gzip fpr HTML and CSS that comes down the pipe. I'm using <a href="http://www.stardeveloper.com/articles/display.html?article=2007110401&page=1" rel="nofollow noreferrer">this implementation</a> (and tried a few others... | <p>Is it only CSS files that get corrupted? Do JS files (or any other static text files) come through ok?</p>
<p>Also can you duplicate the behavior if you browse directly to the CSS file?</p>
<p>I've only enabled compression on Windows 2003 server's IIS using this approach:</p>
<ol>
<li>IIS → Web Sites → Properties... | <p>If you will be deploying on IIS 6 or IIS 7, just use the built-in IIS compression. We're using it on production sites for compressing HTML, CSS, and JavaScript with no errors. It also caches the compressed version on the server, so the compression hit is only taken once.</p>
| 4,255 |
<p>Are there any good professional associations for IT Managers that I could join and network with other managers to share ideas and information?</p>
| <p><a href="http://www.computer.org/portal/site/ieeecs/index.jsp" rel="noreferrer">The IEEE Computer Society</a> and the <a href="http://www.aitp.org/" rel="noreferrer">Association of Information Technology Professionals</a>. Michigan has a few <a href="http://www.aitp.org/organization/chapters/chapters.jsp#Michigan" r... | <p><a href="http://www.linkedin.com/" rel="nofollow noreferrer">Linked</a> in have groups for informal networks.</p>
<p>For something more serious or accredited: in Ireland there is the ICT, I'm sure there's something similar in Michigan or at the federal level in the US. Maybe like the ACM mentioned by Paul C.</p>
| 31,127 |
<p>How to run NAnt scripts in command line and get the timings of each task on the log file?</p>
<pre><code>using nant <record> task or
NAnt -buildfile:testscript.build testnanttarget
</code></pre>
<p>This produces console output but I can't see any timing information.</p>
<p>All I want each log message prefi... | <p>You can use the <a href="http://nant.sourceforge.net/release/0.85-rc3/help/tasks/tstamp.html" rel="noreferrer">tstamp task</a> to display the current date/time. Just include it everywhere where you want timing information. It will not prefix each line with a timestamp, but at least you can time some strategic point... | <p>Here is a sample of tstamp</p>
<p></p>
<pre><code> <echo>
-----------------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------------
TASK : I... | 42,612 |
<p>How long can I expect a client/server TCP connection to last in the wild?</p>
<p>I want it to stay permanently connected, but things happen, so the client will have to reconnect. At what point do I say that there's a problem in the code rather than there's a problem with some external equipment?</p>
| <p>I agree with Zan Lynx. There's no guarantee, but you can keep a connection alive almost indefinitely by sending data over it, assuming there are no connectivity or bandwidth issues.</p>
<p>Generally I've gone for the application level keep-alive approach, although this has usually because it's been in the client sp... | <p>Pick a value. One drop every hour is probably fine. Ten unexpected connection drops in 5 minutes probably indicates a problem.</p>
<p>TCP connections will generally last about two hours without any traffic. Either end can send keep-alive packets, which are, I think, just an ACK on the last received packet. This... | 19,194 |
<p>I'm looking for a little help on programmatically passing parameters to a SSRS report via VB.NET and ASP.NET. This seems like it should be a relatively simple thing to do, but I haven't had much luck finding help on this.</p>
<p>Does anyone have any suggestions on where to go to get help with this, or perhaps even... | <p>You can do the following,: (it works both on local reports as in Full Blown SSRS reports. but in full mode, use the appropriate class, the parameter part remains the same)</p>
<pre><code>LocalReport myReport = new LocalReport();
myReport.ReportPath = Server.MapPath("~/Path/To/Report.rdlc");
ReportParameter myParam... | <p>It's been a while since I did this code, but it may help:
Your web project has to be a Web Site, and not a project of type "ASP.Net Web Application", or you won't be able to add the reference mentioned below.
Right click on the project and add an ASP.Net folder - App_WebReferences. You'll have to specify the server... | 48,147 |
<p>I'm working with a SQL Server 2000 database that likely has a few dozen tables that are no longer accessed. I'd like to clear out the data that we no longer need to be maintaining, but I'm not sure how to identify which tables to remove.</p>
<p>The database is shared by several different applications, so I can't b... | <p>MSSQL2000 won't give you that kind of information. But a way you can identify what tables ARE used (and then deduce which ones are not) is to use the SQL Profiler, to save all the queries that go to a certain database. Configure the profiler to record the results to a new table, and then check the queries saved ther... | <p>If you have lastupdate columns you can check for the writes, there is really no easy way to check for reads. You could run profiler, save the trace to a table and check in there</p>
<p>What I usually do is rename the table by prefixing it with an underscrore, when people start to scream I just rename it back</p>
| 5,552 |
<p>I have a multi-core server hosting my asp.net solution. In the past with dual-core, etc. you had to modify your app to NOT use in-proc session state, etc. Is this still the case if its a dual core?</p>
<p>Also, does server cache play a part in this? I have had no issues with session, but when i try to clear the c... | <p>In Process != In Processor. </p>
<p>You should have no problem (except for the ones that session brings) using the in process model on a multi proc machine, because the process (aspnet_wp.exe or w3wp.exe) is able to execute on any or all of the processors. </p>
<p><a href="http://msdn.microsoft.com/en-us/library/s... | <p>you need to use an out of process cache client such as microsofts velocity which can handle both cache and session out of process. This will also scale out if you end up with more than one server.</p>
| 41,059 |
<p>I am writing a UDF for Excel 2007 which I want to pass a table to, and then reference parts of that table in the UDF. So, for instance my table called "Stock" may look something like this:</p>
<blockquote>
<p>Name Cost &nbs... | <p>This is very basic (no pun intended) but it will do what you describe. For larger tables it may become slow as under the hood it's going back and forth between the macro function and the worksheet, and that kind of activity adds up.</p>
<p>It assumes that you have one row of headers and one column of names (hence t... | <p>Note: I dont have Excel 2007 and I am trying to write this using MSDN doc on the web.<br>
Looks like the range will have ListColumns collection</p>
<p>So, the syntax could be table.ListColumns("Cost").<br>
Does this work?</p>
| 23,179 |
<p>I'm writing tests for a business method that invokes some DAO classes to perform operations over a database.</p>
<p>This method, firstly retrieves a JDBC connection from a DataSource object, The same connection is passed to all DAO instances, so I can use it to control the transaction. So, if everything works prope... | <p>You need to mock <code>DataSource</code> <em>and</em> <code>Connection</code> so that your mock <code>DataSource</code> returns your mock <code>Connection</code>. And yes, this kind of thing ends up becoming a real pain...</p>
| <p>Make the bussines class retrieve the local variables from a global/static object factory. That way you could put the factory in test mode and make it return mock objects instead of real ones. </p>
<p>That should make it. </p>
| 28,900 |
<p>The VS Database Project does not seem to have the "Show All Files" option in the Solution Explorer. Does anyone know of a way to turn the option on in VS?</p>
<p>The "Show All Files" option on the solution explorer actually does two things. With the option selected, VS shows "hidden/nested" files within the proje... | <p>The correct answer to this issue is:-</p>
<p>You must have the Database Project root node selected in the Solution Explorer. </p>
<p>Selecting any other node in the Solution Explorer other than the Database Project root node will cause the "Show All Files" button to become hidden.</p>
| <p>it is by design. Some project types just don't allow you to. You might be able to go into the sln file in notepad and try something, but it might just screw up your solution.</p>
| 17,000 |
<p>Is there a way to use a Graphics object's 'setClip()' method to clip using a Line-ish shape? Right now I'm trying to use a Polygon shape but I'm having problems simulating the "width" of the line. I basically draw the line, and when I reach the end, I redraw it but this time subtract the line width from y-coordina... | <p>If there is a better way, I've never run across it. The best I can think of is to use some trigonometry to make the line width more consistent.</p>
| <p>Maybe you could use a Stroke.createClippedShape to do this? (May need to use an Area to add subtract the stroked shape from/to your original shape depending on what exactly you are trying to do.</p>
| 21,214 |
<p>It is generally accepted that the use of cursors in stored procedures should be avoided where possible (replaced with set based logic etc). If you take the cases where you need to iterate over some data, and can do in a read only manner, are fast forward (read only forward) cursor more or less inefficient than say w... | <p>While a fast forward cursor does have some optimizations in Sql Server 2005, it is <em>not</em> true that they are anywhere close to a set based query in terms of performance. There are very few situations where cursor logic cannot be replaced by a set-based query. Cursors will always be inherently slower, due in ... | <p>The 'Best Practice' of avoiding cursors in SQL Server dates back to SQL Server 2000 and earlier versions. The rewrite of the engine in SQL 2005 addressed most of the issues related to the problems of cursors, particularly with the introduction of the fast forward option. Cursors are not neccessarily worse than set... | 5,765 |
<p>We are in the process of upgrading our projects from C# 2.0 / VS2005 to C# 3.0 / VS2008. As part of the upgrade, we are adding some items to our coding standards document.</p>
<p>How would (or did) you change your coding standards document when upgrading from C# 2.0 / VS2005 to C# 3.0 / VS2008?</p>
| <p>You could/should give advice about:</p>
<ul>
<li>When to use query expressions vs dot notation</li>
<li>Any restrictions on the use of lambda expressions (e.g. "don't modify captured variables). (This could also apply to anonymous methods in C# 2 of course.)</li>
<li>When to write extension methods</li>
<li>When to... | <p>My standards for new features for 2008:</p>
<ul>
<li>Use var sparingly only with anonymous types.</li>
<li>Encourage use of lambda expressions over delegates.</li>
<li>Only use extension methods when you don't have control of the source code</li>
</ul>
| 44,154 |
<p>I miss it so much (used it a lot in C#). can you do it in C++?</p>
| <p>Yes, you can. See <a href="http://msdn.microsoft.com/en-us/library/b6xkz944(VS.80).aspx" rel="noreferrer">here</a>.</p>
<pre><code>#pragma region Region_Name
//Your content.
#pragma endregion Region_Name
</code></pre>
| <p>The Visual assist add-in for VC supports regions for c++. Don't know if 2008 has build in regions for C++ though. </p>
| 17,815 |
<p>The number of products out there right now still seems to be slim.</p>
| <p><a href="http://www.sqlis.com/post/Row-Number-Transformation.aspx" rel="nofollow noreferrer">Konesans Row Number Transformation</a></p>
| <p>I've had good success using <a href="http://www.sqlbi.com/Projects/TableDifference/tabid/74/language/en-US/Default.aspx" rel="nofollow noreferrer">TableDifference</a> for data warehousing scenarios.</p>
| 33,829 |
<p>I noticed methods marked optional in several protocols defined in the iPhone SDK, such as the <code>UIActionSheetDelegate</code> protocol for example.</p>
<p>How can I define a protocol of my own, and set a few of the methods as optional?</p>
| <p>From the Apple page on "<a href="https://developer.apple.com/library/ios/documentation/cocoa/conceptual/ProgrammingWithObjectiveC/WorkingwithProtocols/WorkingwithProtocols.html" rel="noreferrer">Formal Protocols</a>":</p>
<blockquote>
<p>Optional Protocol
methods can be marked as optional
using the @optional... | <p>Protocols act the same as abstract classes, so the @optional keyword defines those methods that are optional for implementation.</p>
<p>So, in the code, someMethod1, someMethod2 and someMethod4 are required methods (must be implemented). someMethod3 is optional - if we didn't implement this method, the compiler wil... | 41,746 |
<p>I will have around 200,000 images as part of my website. Each image will be stored 3 times: full size, thumbnail, larger thumbnail. Full size images are around 50Kb to 500Kb.</p>
<p>Normal tech: Linux, Apache, MySQL, PHP on a VPS.</p>
<p>What is the optimum way to store these for fast retrieval and display via a b... | <p>I'd use a split directory structure, three or four levels deep, the idea being split all the files evenly across many directories, to enable mainly easy maintenance and fast access.</p>
<p>How to do it? There are various alternatives:</p>
<ul>
<li>Taking the first characters of the images names</li>
<li>Taking the... | <p>Depends on how you're indexing them, for how to retrieve them.</p>
<p>There's nothing particularly against storing them all in a single folder, but it becomes difficult to manage. If you're storing them by filename, and the filenames are reasonably normally distributed, you might want to have subfolders separated ... | 40,721 |
<p>I'm wondering what the best way is to have a "if all else fails catch it".</p>
<p>I mean, you're handling as much exceptions as possible in your application,
but still there are bound to be bugs, so I need to have something that
catches all unhandled exceptions so I can collect information and store
them in a datab... | <p>I have just played with AppDomain's UnhandledException behavior,
(this is the last stage the unhandled exception is registered at)</p>
<p>Yes, after processing the event handlers your application will be terminated and the nasty "... program stopped working dialog" shown.</p>
<p>:)
You <em>still</em> can avoid tha... | <p>I am using the following approach, which works and reduces greatly the amount of code ( yet I am not sure if there is a better way or what the pitfalls of it might be.
Whenever you call:
I quess the quys giving minuses would be polite enough to clarify their actions ; )</p>
<pre><code>try
{
CallTheCodeThatMig... | 27,036 |
<p>If I update an Assembly that holds a workflow, I have to restart the appropriate Windows Process to pick up the new Assemblies.</p>
<p>For Web parts & stuff, this is just the IIS Application Pool in question (iisapp /r), and for Timer Jobs it is OWSTIMER.exe (net stop/start SPTimerV3)</p>
<p>But who runs the w... | <p>The hierarchy is like this:</p>
<ul>
<li>Application Pool</li>
<li>Web Application</li>
<li>Site Collection</li>
<li>Site</li>
</ul>
<p>The workflows for a certain SharePoint web application run in the worker process set up for the application pool that is hosting that particular web application. </p>
<p>Central... | <p>Sharepoint workflows runs on <strong>OWSTIMER</strong> process</p>
| 48,577 |
<p>I have not been able to print smooth and round shapes using Cura 3.3.1 (or earlier) without bumps. I think they are seams? The filament is PLA.</p>
<p>Combing is enabled, which I thought makes it so that the nozzle travels over already printed areas, instead of flying over the air...<em>right</em>?</p>
<p>I have b... | <p>Following on from Toon's answer, here is a run down of <a href="https://www.youtube.com/channel/UCb8Rde3uRL1ohROUVg46h1A" rel="nofollow noreferrer">Thomas Sanladerer</a>'s excellent
video: <a href="https://www.youtube.com/watch?v=Mbn1ckR86Z8" rel="nofollow noreferrer">3D printing guides: Calibration and why you mig... | <p>Have you correctly calibrated your steps per mm a.k.a. esteps? Tom made a great video about it:</p>
<p><a href="https://www.youtube.com/watch?v=Mbn1ckR86Z8" rel="nofollow noreferrer">3D printing guides: Calibration and why you might be doing it wrong</a></p>
| 902 |
<p>What's the easiest way to get the data for a single table, delete a single table or break up the whole dump file into files each containing individual tables? I usually end up doing a lot of vi regex munging, but I bet there are easier ways to do these things with awk/perl, etc. The first page of Google results brin... | <p>When I need to pull a single table from an sql dump, I use a combination of grep, head and tail.</p>
<p>Eg:</p>
<pre><code>grep -n "CREATE TABLE" dump.sql
</code></pre>
<p>This then gives you the line numbers for each one, so if your table is on line 200 and the one after is on line 269, I do:</p>
<pre><code>hea... | <p>I am a bit late on that one, but if it can help anyone, I had to split a huge SQL dump file in order to import the data to another Mysql server.
what I ended up doing was splitting the dump file using the system command. </p>
<p><strong>split -l 1000 import.sql splited_file</strong></p>
<p>The above will split the... | 36,121 |
<p>We have several websites on different domains and I'd like to be able to track users' movements on these sites.</p>
<ul>
<li>Obviously cookies are not feasable, because they don't cross domain borders. </li>
<li>I could look at a combination of IP address and User Agent, but there are some cases where that does not... | <p>You can designate one domain or subdomain to tracking and have it serve a 1x1 pixel image which you include in all pages you would like to track. Serve a cookie with the image, look at the tracking domain's server logs, voilà.</p>
| <p>You do not give any context to your situation -just the basic problem. So it is difficult to give an answer that clearly fits. However, here are some techniques/mechanisms for passing information from one page to another, regardless of what domain is involved.</p>
<ul>
<li>include hyperlink to a 1x1 pixel transpa... | 26,607 |
<p>My problem:</p>
<p>I'm looking for a way to represent a person's name and address as an encoded id. The id should contain only alpha-numeric characters, be collision-proof, and be represented in a smallest number of characters possible. My first thought was to simply use a cryptographic hash function like MD5 or ... | <p>I know you said no to MD5 and SHA1, but I think you should consider them anyway. As well as being well studied hashing algorithms, the length gives you more protection against possible collisions. No hash is collision-proof, but the cryptographic ones generally are less collision-prone than something you couuld co... | <p>Well, if there's more than one person at the same address with the same name, you're toast here, (w/o adding code to detect this and add a discriminator of some kind).</p>
<p>but assuming that issue is not, then the street address and zip code portion of the full addresss is sufficient to guaranteee uniqueness the... | 42,978 |
<p>I keep hearing from associates about grid computing which, from what I can gather, is highly distributed stuff along the lines of SETI@Home.</p>
<p>Is anyone working on these sort of systems for business use? My interest is in figuring out if there's a commercial reason for starting software development in this fie... | <p>Grid computing is really only needed if you have a lot of WORK that needs to be done, like folding proteins, otherwise a simple server farm will likely be plenty.</p>
| <p>Obviously Google are major users of Grid Computing; all their search service relies on it, and many others.</p>
<p>Engines such as BigTable are based on using lots of nodes for storage and computation. These are commercially very useful because they're a good alternative to a small number of big servers, providing ... | 13,261 |
<p>Currently my workflow with Emacs when I am coding in C or C++ involves three windows. The largest on the right contains the file I am working with. The left is split into two, the bottom being a shell which I use to type in compile or make commands, and the top is often some sort of documentation or README file th... | <p>You'll have to be specific as to what you mean by "the rest". Except for the object inspector (that I"m aware of), emacs does all the above quite easily:</p>
<ul>
<li>editor (obvious)</li>
<li>compiler - just run <code>M-x compile</code> and enter your compile command. From there on, you can just <code>M-x compil... | <p>In the Unix or X windows style, I don't know that there is an integrated IDE that works for everything. </p>
<p>For interacting with debuggers, just one component of an IDE, consider <a href="https://github.com/realgud" rel="nofollow noreferrer">realgud</a>. The other thing it has that I find useful are parsers for... | 8,889 |
<p>Does anyone know how SQL Server determines the order triggers (of same type, i.e. before triggers) are executed. And is there any way of changing this so that I can specify the order I want. If not, why not.</p>
<p>Thanks.</p>
| <p>If you're at the point of worrying about trigger orders then you really should take a step backwards and consider what you are trying to do and if there is there a better way of doing it. The fact that this isn't an easy thing to change should be telling you something.</p>
<p>Triggers always look like a really neat... | <p>Use this system stored procedure:</p>
<pre><code>sp_settriggerorder[@triggername = ] 'triggername', [@order = ] 'value', [@stmttype = ] 'statement_type'
</code></pre>
| 11,975 |
<p>In our Flex AIR app, we have the problem that our main app window is fairly narrow. This means Alert dialog boxes are chopped on both side, while the right click menu is cropped. How can we get these windows to not get cropped by our main window?</p>
| <p>Turn your main AIR window into an invisible transparent window and make your app's primary working window a child of the invisible one. Then when you AIR app starts, make the invisible window the size that encompasses the desktop. You'll then be able to position as many windows and dialogs as you want on this deskto... | <p>With flex applications running inside of the flash player, windows cannot be shown outside of the stage. So the only way to make this work would be to make your app larger. </p>
<p>You could though use the flex/ajax bridge and call a javascript alert box instead, they would not be bound by the stage. But it woul... | 40,700 |
<p>Hello again ladies and gents!</p>
<p>OK, following on from my other question on <a href="https://stackoverflow.com/questions/6681/aspnet-web-service-results-proxy-classes-and-type-conversion">ASP.NET Web Service Results, Proxy Classes and Type Conversion</a>. I've come to a part in my project where I need to get my ... | <p>The .Net XML (de)serialisation is pretty nicely implemented. At first thought, I don't think this is a bad idea at all.</p>
<p>If the two applications import the same C# class(es) definition(s), then this is a relatively nice way of getting copy-constructor behaviour for free. If the class structure changes, then e... | <p>I had some great answers on a very similar topic yesterday that might be useful for you:</p>
<p><a href="https://stackoverflow.com/questions/16529/communication-between-javascript-and-the-server">Communication between javascript and the server</a></p>
| 3,831 |
<p>I really want to write .NET apps that run on any platform (PC, Linux and Mac). I am not really concerned about UI capabilities because these are mostly background services. I have heard of MONO and that it allows you to write .NET apps that run on Mac and Linux, but I want to be able to write a single app that whe... | <p>Yes, Mono has the windows service stuff ported to Linux, but you are going to have to think of a better way to store configuration settings than Registry... Using XML files for instance would be cross platform.</p>
<p>You should also check out mono's wiki on how to develop portable applications <a href="http://www.... | <p>Short answer: no.
You could create an application which will run on both Windows and Linux.
But there are platform-specific features and right now Mono could not automatically 'translate' those for you. A Windows Service is a good example of that.</p>
| 13,434 |
<p>I'm working with a VB Script file written by someone else that uses Windows Management Instrumentation (WMI) calls to check on the status of several Windows Services. This script runs every few minutes on set schedule. I need to upgrade/replace the .exe for those services.</p>
<p>I stop the VB Script, stop the se... | <p>I'm also looking for a solution to this problem. Would also like to understand why wmiprsve has handles on some of my service executables but not on others.</p>
<p>The workaround I'm using is to kill the wmiprvse process. You can use the SysInternals command line tools (pslist, pskill) to automate getting the pro... | <p>You can simply restart the WMI service (winmgmt) to force it to release your files. If your service isn't registered when WMI starts it won't put a lock on the files.</p>
<p>Stop service, uninstall service, restart WMI, replace files, start service.</p>
| 38,817 |
<p><strong>Problem solved:</strong> Thanks guys, see my answer below.</p>
<p>I have a website running in Tomcat 5.5 hooked up to a MySQL5 database using Hibernate3.</p>
<p>One record simply refuses to keep any changes performed on it. If I change the record programmatically, the values revert back to what they were p... | <p>You could temporarily enable the mysql query logging and see exactly what sql statement altered the value. Since you say it changes immediately after the server starts you should be able to figure out the statement pretty quickly.</p>
<p><a href="http://dev.mysql.com/doc/refman/5.0/en/query-log.html" rel="nofollow... | <p>It's getting close to halloween, so you have to expect this sort of thing (plus it was just a full moon), but I'd keep looking for the culprit in the web application ... it HAS to be there. A couple values I'd immediately search for in the webapp source code:</p>
<ul>
<li>The id of the record being changed.</li>
<... | 25,381 |
<p>Eclipse issues warnings when a <code>serialVersionUID</code> is missing. </p>
<blockquote>
<p>The serializable class Foo does not declare a static final
serialVersionUID field of type long</p>
</blockquote>
<p>What is <code>serialVersionUID</code> and why is it important? Please show an example where missing... | <p>The docs for <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/io/Serializable.html" rel="noreferrer"><code>java.io.Serializable</code></a> are probably about as good an explanation as you'll get:</p>
<blockquote>
<p>The serialization runtime associates with each serializable class a version... | <p>A Simple Explanation:</p>
<ol>
<li><p>Are you serializing data?</p>
<p>Serialization is basically writing class data to a file/stream/etc. De-serialization is reading that data back to a class. </p></li>
<li><p>Do you intend to go into production?</p>
<p>If you are just testing something with unimportant/fake d... | 36,302 |
<p>Well I am querying my DB, a table called bookBilling, to get a value under the column of billingID. </p>
<p>In my first query I get the customer ID from a table based on what value the cookie holds.
In my second query I take that custID value and am looking to get the billingID associated with it.</p>
<pre><code>... | <p>Hey, is it a typo that you don't have this?</p>
<blockquote>
<p>query = "SELECT billingID FROM bookBilling WHERE custID="&custID&""</p>
<p><em><strong>objRS =</strong></em> objConn.Execute(query)</p>
</blockquote>
<p>To reload the recordset with the data and definition of the second query... | <pre><code>query = "SELECT billingID FROM bookBilling WHERE custID="&custID&""
objConn.Execute(query)
</code></pre>
<p>You're not opening a resordset for that second query.
And, not sure if that has any influence at all, but I never name my queries identical. To be sure I guess.</p>
<p>Edit, well that's kind ... | 46,893 |
<p>With ViEmu you really need to unbind a lot of resharpers keybindings to make it work well.</p>
<p>Does anyone have what they think is a good set of keybindings that work well for resharper when using ViEmu?</p>
<p>What I'm doing at the moment using the Visual Studio bindings from Resharper. Toasting all the confli... | <p>You can also create mappings in ViEmu that will call the VS and R# actions. For example, I have these lines in my _viemurc file for commenting and uncommenting a selection:</p>
<pre><code>map <C-S-c> gS:vsc Edit.CommentSelection<CR>
map <C-A-c> gS:vsc Edit.UncommentSelection<CR>
</code></pr... | <p>I use both plugins, but I really prefer the power of the Vi input model that ViEmu gives. I really don't miss so much the Resharper keybindings...</p>
| 11,295 |
<p>I've just started skimming 'Debugging MS .Net 2.0 Applications' by John Robbins, and have become confused by his evangelism for Debug.Assert(...).</p>
<p>He points out that well-implemented Asserts store the state, somewhat, of an error condition, e.g.:</p>
<pre><code>Debug.Assert(i > 3, "i > 3", "This means... | <p>Assertions are not for parameter checking. Parameter checking should always be done (and precisely according to what pre-conditions are specified in your documentation and/or specification), and the <code>ArgumentOutOfRangeException</code> thrown as necessary.</p>
<p>Assertions are for testing for "impossible" situ... | <p>Here is by 2 cents.</p>
<p>I think that the best way is to use both assertions and exceptions. The main differences between the two methods, imho, if that Assert statements can be removed easily from the application text (defines, conditional attributes...), while Exception thrown are dependent (tipically) by a con... | 8,636 |
<h2>Short version</h2>
<p>How do i use an API call when i cannot guarantee that the window
handle will remain valid? </p>
<p>i can guarantee that i'm holding a reference to my form (so the form is not being disposed). That doesn't guarantee that the form's <strong>handle</strong> will stay valid all that time. </p>
... | <p>Have you looked at the functionality in the NativeWindow class?</p>
| <p>I think that the form's OnClose function (or related event) should be overriden.</p>
<p>Alternative - each form implements IDisposable - why don't you add code to the Dispose method of the form that belong to that handle.</p>
| 46,936 |
<p>I have stumbled across something truly puzzling regarding <code>System.getProperty("os.name")</code>. According to <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6220825" rel="nofollow noreferrer">a Java bug on the matter</a> and <a href="http://java.sun.com/j2se/1.5.0/ReleaseNotes.html#150_10" rel="nof... | <p>It might be that Java runs in XP compatibility mode. In that case, Vista will fake the windows version number, making Java believe that it runs on XP. Check the compatibility tab of the executable.</p>
| <p>The actual windows version number of Windows 2000 was 5.0. Windows XP was 5.1. Vista is supposedly 6.0, so your test program is functioning correctly. It sounds to me like Java is definitely getting this wrong.</p>
<p>You might have to rely on a JNI to get the right answer. I sort of assume that you've already aske... | 34,507 |
<p>I can set the PHP include path in the <code>php.ini</code>:</p>
<pre><code>include_path = /path/to/site/includes/
</code></pre>
<p>But then other websites are affected so that is no good.</p>
<p>I can set the PHP include in the start of every file:</p>
<pre><code>$path = '/path/to/site/includes/';
set_include_pa... | <p>If you're using apache as a webserver you can override (if you allow it) settings using <em>.htaccess</em> files. See <a href="http://us2.php.net/configuration.changes" rel="nofollow noreferrer">the PHP manual</a> for details.</p>
<p>Basically you put a file called <em>.htaccess</em> in your website root, which con... | <p>You can set <code>include_path</code> in your php.ini file too. I'm a perl guy, so I expect to be able to load includes and have <code>include</code> do the right thing. I have all my includes in a specific directory, which is added to <code>include_path</code>. I can do things like </p>
<pre><code>require_once "Cl... | 4,427 |
<p>Where I work, people don't like to write specs. (Boy, does anyone?) So they don't do it, unless forced by their bosses. If they are forced to write them, they make them as short as possible. (By the way, <em>they</em> also includes <em>me</em>.)</p>
<p>This results in specifications like</p>
<ul>
<li>This software... | <p>I don't think that you can do exactly what you are asking. When MVC invokes an action it looks for parameters in routes, request params and the query string. It's always looking to match the parameter name. </p>
<p>Perhaps good old query string will meet your needs.</p>
<pre><code>~/mycontroller/myaction/?fooba... | <p>Although you still can't use the <code>FromUri</code> attribute, you can however use the <code>Route</code> attribute, like so</p>
<pre><code>[Route("~/Policy/PriorAddressDelete/{sequence}")]
public ActionResult PriorAddressDelete(int sequence)
{
Policy.RemoveScheduledPriorAddressItem(sequence);
return Redirect... | 44,691 |
<p>I want to put my master pages in a central library so I can use them in several projects without having the maintanance nightmare.
Everything is refactored in a generic and central way, they are all in a "shared" namespace.
But if put them in a seperate project, I can't reference them</p>
| <p>I don't believe you can put that actual .master pages in an external library. You can place your own customer MasterPage-derived class in the library, and have your client apps derive from that, but I don't think that's what your intent is, since you're tagged with asp.net-mvc (implying very narrow views without muc... | <p>Just for reference's sake, I'll put Phil's mail here too:</p>
<blockquote>
<p>Sorry for the late response. You could try using a VirtualPathProvider, but this would require full trust. Other than that, I don't know of any way to do this.</p>
<p>Phil</p>
</blockquote>
<p>so there you go.</p>
| 25,125 |
<p>I'm using C# & .NEt 3.5. What is the difference between the OptionA and OptionB ?</p>
<pre><code>class MyClass
{
private object m_Locker = new object();
private Dicionary<string, object> m_Hash = new Dictionary<string, object>();
public void OptionA()
{
lock(m_Locker){
... | <p>Option B uses the object to be protected to create a critical section. In some cases, this more clearly communicates the intent. If used consistently, it guarantees only one critical section for the protected object will be active at a time:</p>
<pre><code>lock (m_Hash)
{
// Across all threads, I can be in one ... | <p>Locking the object that you're using is simply a matter of convenience. An external lock object <em>can</em> make things simpler, and is also needed if the shared resource is private, like with a collection (in which case you use the <code>ICollection.SyncRoot</code> object). </p>
| 28,560 |
<p>I need to scan uploaded files for viruses on a Linux server, but I'm not sure how to go about it.</p>
<p>What are my options, if any? I'm also interested in how the scanners perform when multiple users send multiple files at the same time.</p>
| <p>I would have a look at <a href="http://www.clamav.net/" rel="noreferrer">Clam AntiVirus</a>. It provides a <code>clamscan</code> program that can scan a given file and return a pass/fail indication. It's free and automatically updates its database regularly.</p>
<p>As for integrating such a product into your file u... | <p>You should try to find an anti-virus vendor that has a public API for it's scanner. That way you can programmatically scan a file. It will make it much easier in the long run than trying to mess with other processes via your upload script.</p>
| 18,325 |
<p>I just asked <a href="https://stackoverflow.com/questions/201686/linq-to-sql-select-optimization">this question</a>. Which lead me to a new question :)</p>
<p>Up until this point, I have used the following pattern of selecting stuff with Linq to SQL, with the purpose of being able to handle 0 "rows" returned by the... | <p>Why can you keep doing the samething? Is it giving you an error?</p>
<pre><code>var person = (from p in [DataContextObject].Persons
where p.PersonsID == 1
select new { p.PersonsID, p.PersonsAdress, p.PersonsZipcode }).FirstOrDefault();
if (person == null) {
// handle 0 "rows" r... | <p>You can still use <code>FirstOrDefault</code>. Just have </p>
<pre><code>var PersonFields = (...).FirstOrDefault()
</code></pre>
<p>PersonFields will be be null or an object with those properties you created.</p>
| 24,656 |
<p>I have a problem and i would like to learn the correct way to solve this. </p>
<p>I have a Data Objeckt</p>
<pre><code>class LinkHolder {
public string Text;
public string Link;
}
</code></pre>
<p>I would like to present to the user a RadioButton list that uses the LinkHolder.Text value as descriptive tex... | <p>You need to set DataTextField and DataValueField on your RadioButtonList.
Then the correct values should show up. </p>
<p>You can try to cast the selectedItem into a LinkHolder.</p>
| <p>Your method should work. I think you should use accessors in your class though</p>
<pre><code>class LinkHolder {
public string Text { get; set;}
public string Link { get; set;}
}
</code></pre>
<p>Bind your RadioButtonList to a f.ex. <code>List<LinkHolder></code></p>
<p>Why would you use a radiobutto... | 44,168 |
<p>I often use Dictionary in C#2.0 with the first key as string that was containing a unique identifier.</p>
<p>I am learning C#3.0+ and it seems that I can now simply use a List and simply do LINQ on that object to get the specific object (with the .where()).</p>
<p>So, if I understand well, the Dictionary class has... | <p>no, a dictionary is still more efficient for getting things back out given a key.</p>
<p>a list you still have to iterate through the list to find what you want. A dictionary does a lookup.</p>
| <p>IMHO the Dictionary approach will be MUCH faster than LINQ, so if you have an array with a lot of items, you should rather use Dictionary.</p>
| 30,382 |
<p>I am curious about what tools are used to build the next version of themselves.</p>
<p>For example, Delphi has long claimed that "<a href="http://en.wikipedia.org/wiki/Borland_Delphi#Products_developed_with_Delphi" rel="nofollow noreferrer">Delphi is written in Delphi</a>".</p>
<p>I assume Visual Studio is written... | <p>Interestingly, the VB.NET & C# compilers themselves are written in unmanaged C++ (leading to the C++ team's T-Shirt: "My compiler compiled yours"). The C# team hopes to have a fully managed-C# hosted C# compiler for VS2010.</p>
| <p><a href="http://maven.apache.org/" rel="nofollow noreferrer">Maven2</a> is built using Maven2.
Ok, it's not built (i.e. <em>written</em>) using itself, as it is a tool to build (i.e. <em>compile</em>) project, but it is using its own code to compile...</p>
| 32,304 |
<p>Can someone tell me how to get path geometry from a WPF FlowDocument object? Please note that I do <strong>not</strong> want to use <code>FormattedText</code>. Thanks.</p>
| <p>A <code>FlowDocument</code> can be viewed in any number of ways, but a <code>Path</code> is a fixed shape. I think maybe you really want some simplified, visual-only form of a <code>FlowDocument</code>'s contents.</p>
<p>In that case you might try converting the <code>FlowDocument</code> to an XPS <code>FixedDocum... | <p>Can you use </p>
<blockquote>
<p>ChildVisual = VisualTreeHelper.GetChild(Visual yourVisual)</p>
</blockquote>
<p>Dunno if you can take a Visual and turn it into a path geometry.. </p>
| 9,139 |
<p>Java supplies standard User Interface guidelines for applications built using Java Swing. The basic guidelines are good, but I really feel the look and feel is really boring and outdated. </p>
<p>Is anyone aware of a publicly available Java User Interface Guide that has better look & feel guidelines than the Su... | <p>Along the line of Chii's answer, I would recommend taking a look at the <a href="http://msdn.microsoft.com/en-us/library/aa511258.aspx" rel="nofollow noreferrer" title="Windows Vista User Experience Guidelines">Windows Vista User Experience Guidelines</a> for general tips on making user interfaces.</p>
<p>Although ... | <p>I don't think there are any other complete guidelines. But if you are not talking about the spacing/positioning of components (I don't think that part of Look And Feel Design Guidelines is outdated), but only about the look and feel good starting points are singlabx / swingx:</p>
<p><a href="http://swinglabs.org" r... | 13,855 |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 4