instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>A few years ago I did a lot of work with CGI.pm. I'm evaluating using it again for a quick project. Can someone bring me up to speed on the current state of developing with CGI.pm in the "Web 2.0" world? What are the best libraries on CPAN to use with it? Are there clean ways to include jQuery, YUI, other CSS li... | <p>Personally, I'm no fan of Catalyst (too heavy for my taste) or Mason (mixing code and HTML is bad ju-ju), but I do quite well using CGI.pm for input[1], HTML::Template for output, and CGI::Ajax to provide AJAX functionality where called for.</p>
<p>If you're looking at frameworks, you may also want to consider CGI:... | <p>There is also <a href="http://p3rl.org/CGI%3a%3aAjax" rel="nofollow">CGI::Ajax</a>.</p>
| 37,002 |
<p>I would like to be able to override the default behaviour for positioning the caret in a masked textbox.</p>
<p>The default is to place the caret where the mouse was clicked, the masked textbox already contains characters due to the mask.</p>
<p>I know that you can hide the caret as mentioned in this <a href="http... | <p>This should do the trick:</p>
<pre><code> private void maskedTextBox1_Enter(object sender, EventArgs e)
{
this.BeginInvoke((MethodInvoker)delegate()
{
maskedTextBox1.Select(0, 0);
});
}
</code></pre>
| <p>This solution works for me. Give it a try please.</p>
<pre><code>private void maskedTextBox1_Click(object sender, EventArgs e)
{
maskedTextBox1.Select(maskedTextBox1.Text.Length, 0);
}
</code></pre>
| 14,508 |
<p>I am trying to create a jar file which includes some class and java files needed, but I also would like to include some extra xml, xsl, html, txt (README) files.</p>
<p>I am using Eclipse on Windows XP.</p>
<p>Is there an easy way for me to set up a directory structure and package all my files into a jar?</p>
| <p>Add the files to a source folder and they can be included in the jar.</p>
<p>One common way is to have, at the root of your project, a src folder. Within that, folders for java files, and others. something like:</p>
<pre>src/
css/
java/
html/
images/</pre>
<p>Then you can make each of those subf... | <p>If you move to an ANT (or Maven, for you Maven fans) then you can automate the Jar building very nicely, and also use it outside of Eclipse (e.g., in an automated build environment). All you need to do is copy the files from your src, jsp, foobar and resources locations into a build staging folder, then Jar the resu... | 16,308 |
<p>I am a trying to learn C# .Net.</p>
<p>I had written small (hobby) Analog Clock application in VB sometime ago(edit: VB6, to be precise), and I thought I will rewrite in C#.NET, as part of my <em>learning</em> process.</p>
<p>In the VB application, I drew the hands of the clock in XOR Drawmode, so that I have to <... | <p>IMHO, until and unless you are targeting some really slow computers, you don't need to optimize performance by using XOR technique.</p>
<p>Since you'd be drawing the second hand only once in a second, a complete redraw of the clock would be much better. Also, the second hand will "look" good if drawn directly, and ... | <p>.NET/GDI+ does not support XOR drawing. You'll have to workaround it by using p/invoke calls of several native functions.</p>
<p>See the link below for more information</p>
<p><a href="http://www.vbaccelerator.com/home/net/code/libraries/Graphics/ZoomIn/article.asp" rel="nofollow noreferrer">http://www.vbaccelerat... | 32,195 |
<p>I'm looking for some general information about how other people are using <a href="http://hadoop.apache.org/core/" rel="noreferrer">Hadoop</a> or other MapReduce-like technologies. In general, I am curious to whether you are writing MR applications to process existing data sets (like web server log files), or are yo... | <p>Checkout the <a href="http://wiki.apache.org/hadoop/PoweredBy" rel="noreferrer">PowerdBy Hadoop</a> wiki for examples of everything from Facebook to FOX News and how they are using it.</p>
| <p>My two uses so far have been analysis of large behavioral data sets (gathered from the web, mobile handsets, &c) and parallelizing approaches to large problems (e.g., using genetic algorithms to find local optima in an NP-complete problem space).</p>
<p>In the general case, MR flows are multi-stage, so I'm freq... | 42,918 |
<p>Is there a way that my .NET CF app running on a Windows CE device can know when the device is docked/synced with the PC?</p>
| <p>I believe this will help <a href="http://msdn.microsoft.com/en-us/library/microsoft.windowsmobile.status.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/microsoft.windowsmobile.status.aspx</a></p>
| <p>See the following: Microsoft.WindowsMobile.Status and ConnectionsDesktopCount. If ConnectionsDesktopCount is > 0 then you are docked to a PC.</p>
<p>See the the SDK sample here <a href="http://msdn.microsoft.com/en-us/library/bb158637.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/bb158637.... | 28,693 |
<p>Are they the same thing? Just finished to watch <a href="https://www.asp.net/mvc/videos/mvc-1/aspnet-mvc-storefront/aspnet-mvc-storefront-part-1-architectural-discussion-and-overview" rel="noreferrer">Rob Connery's Storefront tutorial</a> and they seem to be similar techinques. I mean, when I implement a DAL object ... | <p>You're definitely not the one who confuses things. :-)</p>
<p>I think the answer to the question depends on how much of a purist you want to be. </p>
<p>If you want a strict DDD point of view, that will take you down one path. If you look at the repository as a pattern that has helped us standardize the interface ... | <p>From what I understand they can mean basically the same thing - but the naming varies based on context.</p>
<p>For example, you might have a Dal/Dao class that implements an IRepository interface.</p>
<p>Dal/Dao is a data layer term; the higher tiers of your application think in terms of Repositories.</p>
| 37,157 |
<p>I have Firefox as my default browser on my dev machine and when I start debugging from visual studio Firefox launches as I would expect and all the attributes of the experience are the same as IE except for one thing - when I close the browser. When using IE, when I close the browser visual studio will automatically... | <p>The reason for this behavior is very simple: Visual Studio attaches itself to the process to be debugged, and will drop out of run mode if it sees that process terminate. FireFox does not create a new process every time a window is launched: it reuses the existing process. IE is able to create a new one for each win... | <p>Try attaching the debugger to the FireFox process instead!</p>
<p>In VS (2008) select the Menu option Debug -> Attach to Process and then select firefox.exe - if you don't see this process you may have to ensure 'Show processes in all sessions' is checked. </p>
<p>I ran this and verified that it does work. I also ... | 41,626 |
<p>Is there an easy way to generate a PDF report from an RDL that's been uploaded to Report Manager and put that file somewhere on the server's disk? I already have a location on disk to put the file, I just need to know how to programmatically generate the PDF. This is for SQL Server 2005 Reporting Services. Code in e... | <p>This <strong><a href="https://web.archive.org/web/20160928012839/http://geekswithblogs.net:80/bsherwin/archive/2007/04/29/112094.aspx" rel="nofollow noreferrer">article</a></strong> will show you how you can generate PDF report from reporting service, without using report viewer. Only change you have to do is to wri... | <p>Do you have to do it programatically? Report Manager has this funcationality built in already. You just setup a new subscription for that report. Instead of setting the delivery as Email, change it to Windows File Share. You can also change the report format to PDF within those options. </p>
| 21,732 |
<p>I'm working on a consumer web app that needs to do a long running background process that is tied to each customer request. By long running, I mean anywhere between 1 and 3 minutes.</p>
<p>Here is an example flow. The object/widget doesn't really matter.</p>
<ol>
<li>Customer comes to the site and specifies object... | <p>Consider providing the search results via AJAX from a web service instead of your application. Presumably you could offload this to another server and let you web application deal with the content as you desire.</p>
<p>Just curious: 1-3 minutes seems like a long time for a lookup query. Have you looked at indexes... | <p>Not a complete answer but I would think using AJAX and passing the 2nd step to something thats faster then PHP (C, C++, C#) then a PHP function pick the results off of some stack most likely just a database.</p>
| 29,129 |
<p>I've setup a static website on GAE using hints found elsewhere, but can't figure out how to return a 404 error. My app.yaml file looks like</p>
<pre><code>- url: (.*)/
static_files: static\1/index.html
upload: static/index.html
- url: /
static_dir: static
</code></pre>
<p>with all the static html/jpg files ... | <p>You need to register a catch-all script handler. Append this at the end of your app.yaml:</p>
<pre><code>- url: /.*
script: main.py
</code></pre>
<p>In main.py you will need to put this code:</p>
<pre><code>from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
class ... | <p>I can't comment on jonmiddleton's answer, but the custom error responses is for App engine specific errors by the look of it.
I don't see a way to specify a custom 404 page.</p>
<p>Django let's you <a href="http://docs.djangoproject.com/en/dev/topics/http/urls/#handler404" rel="nofollow">specify</a> one though.</p>... | 23,017 |
<p>Is there any way instead of a JS hack where I can post from an iframe to another page outside the iframe?</p>
<p>the iframe is posting data to a 3rd party and then just responding back with a URL which is the redirection URl thus we cannot set the form target. We are PCI compliant and thus we cannot use <code>windo... | <p>What it boils down to, it seems, is this:<br />
1. You get a text url from a 3rd party in the iframe.<br />
2. You want to <strong>change your page's location</strong> to that url.<br />
3. Unless you have control over that 3rd party, all you are going to get is that text url.<br /></p>
<p>Now, the only way to <str... | <p><code><form></code> accepts a target parameter, e.g. target="_parent"</p>
| 21,761 |
<p>There are a couple of different .NET XSLT functions that I see used in the out of the box SharePoint web parts (RSS Viewer and Data View web part).</p>
<pre><code><xsl:stylesheet
xmlns:ddwrt="http://schemas.microsoft.com/WebParts/v2/DataView/runtime"
xmlns:rssaggwrt="http://schemas.microsoft.com/WebPar... | <p>I have been wanting more info on ddwrt as well. The most information I have been able to find is from Serge van den Oever that was later turned into the MSDN article referenced in the previous answer. </p>
<p><a href="http://weblogs.asp.net/soever/archive/2005/01/03/345535.aspx" rel="nofollow noreferrer">http://web... | <p>Here is some documentation I found that describes the ddwrt (<a href="http://schemas.microsoft.com/WebParts/v2/DataView/runtime" rel="nofollow noreferrer">http://schemas.microsoft.com/WebParts/v2/DataView/runtime</a>) namespace.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/aa505323.aspx" rel="nofollow no... | 13,258 |
<p>I have two tables:
Client(id,name,...)<br>
Purchase(id,item,date,client_id,...)</p>
<p>They have their respective Model, with their validations. What I need is to create a new client with a new purchase, all into the create method of Client controller. Something like this:</p>
<pre><code>def create
@client = C... | <p>Take a look at the following page on <a href="http://en.wikibooks.org/wiki/Ruby_on_Rails/ActiveRecord/Associations" rel="nofollow noreferrer">working with associations</a>.</p>
<p>Rails provides you with a bunch of handy methods on your objects.</p>
<p>Like the following:</p>
<pre><code>Client.purchases.empty?
Cl... | <p>Depends a little on the situation, but you can use validates_associated to run the validations on associated objects. Then you can create the user (but don't save), create the purchase (but don't save) and try to save the user. If you've done it right the user will fail to save with a validation error on the assoc... | 36,641 |
<p>I am a newbie at Flex, and I don't like the way you have to write the namespace mx: for every control declaration you write. It makes the code cluttery. I would like to write:</p>
<pre><code><Panel ...
</code></pre>
<p>rather than</p>
<pre><code><mx:Panel ...
</code></pre>
<p>I tried writing</p>
<pre><cod... | <p>I think that removing the mx namespace will almost certainly cause you trouble with name conflicts as your project gets larger.</p>
<p>Personally I think the mx namespace makes the code clearer rather than more cluttered, especially if you have component based flex development or a lot of your own controls. Having... | <p>The mx: is just a way to tell Flex that the Panel (along with any other component) is a part of the Flex framework, that it, built-in in Flex. This helps Flex to know where to look for the Panel, and will make your compiling process faster.</p>
<p>You can also use local: to access components that YOU created. Examp... | 36,103 |
<p>I have a database that hold's a user's optional profile. In the profile I have strings, char (for M or F) and ints.</p>
<p>I ran into an issue where I try to put the sex of the user into the property of my Profile object, and the application crashes because it doesn't know how to handle a returned null value.</p>
... | <p>rotard's answer (use <code>Is<ColumnName>Null()</code>) only works for typed data sets. </p>
<p>For untyped data sets, you have to use one of the patterns in the following code. If this code isn't definitive, let me know and I'll edit it until it is. This is an extremely common question that there should r... | <p>I would do it pretty much like you did. I would write a function for it:</p>
<p>Something that does:</p>
<pre><code>object.sex = handle(dt.Rows[0]["Sex"]);
</code></pre>
<p>And in handle you do the ==DBNull.Value check.</p>
| 41,177 |
<p>I am developing an application that needs to use regini (because of legacy reasons) to insert something into the registry. I have been trying to do this in such a way the the user of the application is not aware of this. I have written the following code:</p>
<pre><code>System.Diagnostics.ProcessStartInfo pi = new ... | <p>Try to add this line:</p>
<pre><code>pi.CreateNoWindow = true;
</code></pre>
| <p>I found this bug report on the Microsoft Connect Feedback Site: <a href="http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=95026" rel="nofollow noreferrer">System.Diagnostics.ProcessWindowStyle.Hidden shows window while executing</a></p>
<p>Maybe there is a hint of something you forgot... | 31,512 |
<p>I'm currently using abcPDF 7 to convert HTML to PDF. This is done via an ASPX page where I override the Render method.</p>
<pre><code>Doc theDoc = new Doc();
theDoc.SetInfo(0, "License", m_License );
theDoc.HtmlOptions.Paged = true;
theDoc.HtmlOptions.Timeout = 1000000;
string callUrl = "http:// my app page";
theD... | <p>"Only the first page of the document is drawn. Subsequent pages can be drawn using the AddImageToChain method."</p>
<p>From <a href="http://www.websupergoo.com/helppdf5net/source/5-abcpdf5/doc/1-methods/addimageurl.htm" rel="noreferrer">here</a></p>
<p>An example how to use AddImageToChain can be found <a href="ht... | <p>"Only the first page of the document is drawn. Subsequent pages can be drawn using the AddImageToChain method."</p>
<p>From <a href="http://www.websupergoo.com/helppdf5net/source/5-abcpdf5/doc/1-methods/addimageurl.htm" rel="noreferrer">here</a></p>
<p>An example how to use AddImageToChain can be found <a href="ht... | 36,458 |
<p>After a few months of printing with my Prusa Mk3 (with plans to get a second one soon), I have been wondering about making my third printer a home-built one was a larger print bed than the Mk3. One thing I wondered about is perfectly expressed in the title question.</p>
<p>Are there practical reasons to <strong>not... | <p>I am going to answer this as someone who actually did rework their Prusa i3 fleabay clone to use leadscrews for all axes. Before digging into the matter, the backlash issue can be solved easily with spring-loaded brass nuts, kinda like how ballscrews work. That's the simplest problem to solve though as there are a l... | <p>It is possible to use lead screws; specifically 4 start leadscrews. The only drawback is that you need to be wary of heat.</p>
<p>Let's breakdown the concerns</p>
<ul>
<li><p>Cost. Yes it costs more than belts, and it will last longer at higher speeds, whereas a belt <em>may</em> stretch. If cost is a factor then ... | 1,329 |
<p>From what I understand, when you hook up the <a href="http://rads.stackoverflow.com/amzn/click/B007KG0ZYI">Switching Power Supply 12v Dc 30a 360w</a> to the wall outlet, you have to be <strong>very careful</strong>; careful not to get the wires mixed up; careful not to have anyone or anything touch the leads (in fac... | <p>It is okay to just use bare wires in the type of screw connector found on your power supply. They're designed for it; they have a little plate under the screw that prevents the wires from being frayed by the screw.</p>
<p>If you want neater wire termination, you should use one of the spade type ones. Pick the small... | <p>The block on the supply will accept the bare wire</p>
<p><a href="https://i.imgur.com/RvlyTNR.jpg" rel="nofollow noreferrer"><img src="https://i.imgur.com/RvlyTNR.jpg" alt="enter image description here"></a></p>
<p>you <em>could</em> use the yellow in the middle on the right, but the screw on the block essentially... | 150 |
<p>Say you have a bunch of files.
Say you can store meta data to these files.
Say, one of these meta attributes were called "encryption"
Say everyone was allowed to look at these files, but since they are encrypted, only people who know how to decrypt them can actually read the contents.
Say, for every given value of "... | <p>The encryption isn't the hard part, here. Understanding the business needs, and especially, what threats you're trying to protect against, is the hard part. Key management isn't a trivial thing.</p>
<p>I highly recommend the book "<a href="http://www.schneier.com/book-applied.html" rel="nofollow noreferrer">Applied... | <p>The difficulty of this problem is why many businesses default to using OS-specific solutions, such as Active Directory.</p>
<p>For OS-agnostic, you have to re-create a lot of user-management stuff that the specific OS and/or Network vendors have already built.</p>
<p>But it can be done. For the encryption itself ... | 22,284 |
<p>I've got a JavaScript "object", built this way:</p>
<pre><code>function foo()
{
this.length = 0;
}
foo.prototype.getLength = function()
{
return this.length;
}
...
</code></pre>
<p>I know how to emulate namespaces with singleton JavaScript objects, but what is the best way to "namepace" an object such as... | <p>Simple:</p>
<pre><code>if(!MyNamespace) MyNamespace = {};
MyNamespace.foo = function() {
this.length = 0;
};
MyNamespace.foo.prototype.getLength = function() {
return this.length;
};
</code></pre>
| <p>Another alternative may be the <a href="http://www.bobjs.com" rel="nofollow">bob.js</a> framework:</p>
<pre><code>bob.ns.setNs('myApp.myFunctions', {
say: function(msg) {
console.log(msg);
}
});
//sub-namespace
bob.ns.setNs('myApp.myFunctions.mySubFunctions', {
hello: function(name) {
... | 4,296 |
<p>I have a TListBox with multiselect and ExtendedSelect both set to true. I need to be able to drag multiple items in the list box to re-arrange them. My problem is what happens when the user clicks on an item that is already selected without holding down the CTRL or SHIFT key.</p>
<p>Case 1: DragMode is set to dmMa... | <p>We had to do this on a product I worked on once. The answer was to compile all your regexes together into a <a href="http://en.wikipedia.org/wiki/Deterministic_finite_automaton" rel="noreferrer">Deterministic Finite State Machine</a> (also known as a deterministic finite automaton or <strong>DFA</strong>). The DFA... | <p>Try combining them into one big regex?</p>
| 23,452 |
<p>Am I correct to understand that the abort() method for XMLHttpRequest objects is only available starting from MSIE 7? If so, what equivalent option do I have for aborting an XMLHttpRequest object on timeout in MSIE 6?</p>
<p>Using a JS framework to abstract the problem away is not an option at this time I'm afraid ... | <p>On IE6, you instantiate the MSXML HTTPRequest manually, so it all comes down to what version you end up using.</p>
<p>abort is <a href="http://msdn.microsoft.com/en-us/library/ms760349(VS.85).aspx" rel="nofollow noreferrer">implemented in MSXML 3.0 and later</a>. In other words, if you can get this or a later versi... | <p>I'd look to a framework like jQuery for doing http requests with javascript. They nicely abstract away browser differences.</p>
| 44,184 |
<p>I have to implement a middleware system for file sharing, and it has to split the files not unlike what happens on bittorrent, where it sends and receives separate pieces simultaneously from varios sources. How do i do that? Is it a library or i have to implement the file splitting myself?</p>
| <p>Split the files into blocks let's say of 100KB each. Then calculate a SHA hash (or some other hashing algorithm) on each of the blocks. so if the file is 905KB, you would have 10 such hashes calculated. </p>
<p>The server would contain a hash definition file for each file that it serves. This hash definition fi... | <p>Look at the implementation of Split & Concat (GNU software).</p>
| 18,685 |
<p>In mysql, how do I get the primary key used for an insert operation, when it is autoincrementing.</p>
<p>Basically, i want the new autoincremented value to be returned when the statement completes.</p>
<p>Thanks!</p>
| <p>Your clarification comment says that you're interested in making sure that LAST_INSERT_ID() doesn't give the wrong result if another concurrent INSERT happens. Rest assured that it is safe to use LAST_INSERT_ID() regardless of other concurrent activity. LAST_INSERT_ID() returns only the most recent ID generated du... | <p>[select max(primary_key_column_name) from table_name]
Ahhh not nessecarily. I am not an MySQL guy but there are specific way to get the last inserted id for the last completed action that are a little more robust than this. What if an insert has happened between you writing to the table and querying it? I know about... | 19,963 |
<p>I have a ContextMenuStrip that contains a submenu of dynamically generated ToolStripMenuItems. There are up to 80 sub menu items. Pressing the first letter of a desired menu item selects it correctly, but if the item happens to be out of the visible range (in a range handled by the scroll arrows), it isn't display... | <p>I think what you are looking for is addressed in this question: </p>
<p><a href="https://stackoverflow.com/questions/300674/getting-raw-soap-data-from-a-web-reference-client-running-in-aspnet">Getting RAW Soap Data from a Web Reference Client running in ASP.net</a> </p>
<p>It looks like a lot of code though.</p>
| <p>For some reason Fiddler was not showing my local service calls when using the ASP.NET Development Server that comes with Visual Studio. To get around this I changed the web service Url at runtime to be the Fiddler port, just to capture the SOAP message.</p>
<p>You can do this from the Immediate window, for example:... | 39,473 |
<p>I've seen (and used) code to have a link spawn a javascript action many times in my life, but I've never come to a firm conclusion on if the href attribute should be blank or #. Do you have any preference one way or the other, and if so, why?</p>
<pre><code><a href="" onclick="javascript: DoSomething();">lin... | <p>You <strong>must</strong> have <em>something</em> for the <code>href</code> attribute, otherwise the browser will not treat it as a link (for example, making it focusable or giving it an underline) - that's why the use of "#" has become prevalent.</p>
<p>Also, the contents of the event attributes (<code>onclick</co... | <p>Why not have the href point to a page explaining they have JavaScript turned off and they need to turn it on to get the missing functionality ?</p>
<p>Since the link will only be followed when they have javascript turned off, let it be something informative!</p>
<p>Also remember people sometimes middle click on su... | 43,353 |
<p>What do you think of using a metric of function point to lines of code as a metric?</p>
<p>It makes me think of the old game show "Name That Tune". "I can name that tune in three notes!" I can write that functionality in 0.1 klocs! Is this useful?</p>
<p>It would certainly seem to promote library usage, but is ... | <p>I think it's a terrible idea. Just as bad as paying programmers by lines of code that they write.</p>
<p>In general, I prefer concise code over verbose code, but only as long as it still expresses the programmers' intention clearly. Maximizing function points per kloc is going to encourage everyone to write their... | <p>KLOC is tolerable if you strictly enforce code standards, kind of like using page requirements for a report: no putting five statements on a single line or removing most of the whitespace from your code.</p>
<p>I guess one way you could decide how effective it is for your environment is to look at several different... | 30,240 |
<p>My university doesn't support the POST cgi method (I know, it's crazy), and I was hoping to be able to have a system where a user can have a username and password and log in securely. Is this even possible?</p>
<p>If it's not, how would you do it with POST? Just out of curiosity.</p>
<p>Cheers!</p>
| <p>You can actually do it all with GET methods. However, you'll want to use a full challenge response protocol for the logins. (You can hash on the client side using javascript. You just need to send out a unique challenge each time.) You'll also want to use SSL to ensure that no one can see the strings as they go ... | <p>Logging in securely is very subjective. Full 'security' is not easy to achieve (if at all possible...debatable). However, you can come close. </p>
<p>If POST is not an option, maybe you can use a directory security method such as .htaccess or windows authentication depending on what system you're on.</p>
<p>Both... | 9,540 |
<p>Is there a graceful way to handle passing a list of ids as a parameter to a stored procedure? </p>
<p>For instance, I want departments 1, 2, 5, 7, 20 returned by my stored procedure. In the past, I have passed in a comma delimited list of ids, like the below code, but feel really dirty doing it. </p>
<p>SQL Server... | <p>Erland Sommarskog has maintained the authoritative answer to this question for the last 16 years: <em><a href="http://www.sommarskog.se/arrays-in-sql.html" rel="noreferrer">Arrays and Lists in SQL Server</a></em>.</p>
<p>There are at least a dozen ways to pass an array or list to a query; each has their own unique ... | <p>You could use XML. </p>
<p>E.g. </p>
<pre><code>declare @xmlstring as varchar(100)
set @xmlstring = '<args><arg value="42" /><arg2>-1</arg2></args>'
declare @docid int
exec sp_xml_preparedocument @docid output, @xmlstring
select [id],parentid,nodetype,localname,[text]
from ... | 6,484 |
<p>I'm using the asp.net SqlMembershipProvider and LinqToSql in a hobby/learning application. I have some user properties that I'm keeping in LinqtoSql, so my flow is:
Membership.CreateUser -> MyClass.AddUserDetails. I'd like to wrap the whole thing in a transaction, so if the myclass bit fails I can roll back the memb... | <p>The providers don't explicitly support transactions, I asked for this feature some time ago:</p>
<p><a href="http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=102268" rel="nofollow noreferrer"><a href="http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=1022... | <p>You can set the Transaction property of the DataContext to make it participate in a transaction you already have.</p>
| 20,198 |
<p>We generate graphs for huge datasets. We are talking 4096 samples per second, and 10 minutes per graph. A simple calculation makes for 4096 * 60 * 10 = 2457600 samples per linegraph. Each sample is a double (8 bytes) precision FP. Furthermore, we render multiple linegraphs on one screen, up to about a hundred. This ... | <p>A really popular toolkit for scientific visualization is <a href="http://www.vtk.org/" rel="nofollow noreferrer">VTK</a>, and I think it suits your needs:</p>
<ol>
<li><p>It's a high-level API, so you won't have to use OpenGL (VTK is built on top of OpenGL). There are interfaces for C++, Python, Java, and Tcl. I ... | <p>Not sure if this is helpful, but could you use time as a dimenion? i.e. one frame is one z? That might make things clearer, perhaps? Then perhaps you could effectively be applying deltas to build up (i.e on z axis) the image?</p>
| 27,067 |
<p>i need a report and i should use pivot table for it.Report will be group by categories .It is not good to use case when statement because there are many categories.u can think Northwind Database as sample and All Categories will be shown as Columns and Report will show customers preference among Categories.I dont kn... | <p>Once you get Oracle 11G there is a <a href="http://www.oracle.com/technology/pub/articles/oracle-database-11g-top-features/11g-pivot.html" rel="nofollow noreferrer">built-in PIVOT feature</a>. Prior to that, you are restricted to using CASE (or DECODE) expressions. I have an article on how to automate doing that <... | <p>It is painful to do row/column swaps in SQL. Each row you want to turn into a column, you have to ask for explicitly. So if you have many categories, your query will be very long, and it'll change every time you add/remove/change a category (this is probably the CASE method you're mentioning). You can write a stored... | 47,681 |
<p>I'm interested in looking at Erlang and want to follow the path of least resistance in getting up and running.</p>
<p>At present, I'm planning on installing <a href="http://www.erlang.org/download.html" rel="noreferrer">Erlang R12B-3</a> and <a href="http://erlide.sourceforge.net/" rel="noreferrer">Erlide</a> (<a h... | <p>I've only done a small bit of coding in Erlang but I found the most useful method was just to write the code in a text editor and have a terminal open ready to build my code as I need to (this was in Linux, but a similar idea would work in Windows, I'm sure).</p>
<p>Your question didn't mention it, but if you're lo... | <p>From what i've tried (and are still up to do), a good addition to an erlang dev. environment would be a virtual machine running ubuntu/yaws/erlang. Perhaps <a href="http://feeds.feedburner.com/10xSoftwareDevelopment?format=xml" rel="nofollow noreferrer">Erlyweb</a> (erlang/yaws framework) would be nice checking out ... | 2,484 |
<p>Can perforce be adjusted so I don't need to "open files for edit"? Someone told me that this was a "feature", and that s/he guessed it could be turned off.</p>
| <p>See <a href="http://www.perforce.com/perforce/doc.081/manuals/p4guide/02_config.html" rel="nofollow noreferrer">http://www.perforce.com/perforce/doc.081/manuals/p4guide/02_config.html</a> (section <b>Configuring workspace options</B>). You can set the <code>allwrite</code> option, but even then you would have to do ... | <p>One approach you can use is edit the readonly files on your synch'd branch. When you're ready to submit use the 'check consistency' File | More option to create a changelist on the basis of the modified files. There's probably a command-line way of doing this but I don't know what it is.</p>
| 20,757 |
<p>I am curious if anyone have used UnderC, Cint, Cling, Ch, or any other C++ interpreter and could share their experience.</p>
| <p>There is <strong><a href="http://cern.ch/cling" rel="noreferrer">cling</a> Cern's project</strong> of C++ interpreter based on <a href="http://clang.llvm.org/" rel="noreferrer">clang</a> - it's <em>new approach</em> based on 20 years of experience in <em>ROOT cint</em> and it's quite stable and recommended by Cern g... | <p>There is a program called <a href="http://neugierig.org/software/c-repl/" rel="nofollow noreferrer">c-repl</a> which works by repeatedly compiling your code into shared libraries using GCC, then loading the resulting objects. It seems to be evolving rapidly, considering <a href="http://packages.ubuntu.com/lucid/i38... | 9,491 |
<p>I am (unfortunately) developing an application in Excel 2000 VBA. I believe I have discovered that any error raised within a Custom Class property, function, or sub debugs as if the error were raised at the point in the VBA code where the property is called. That is, the VBE debugger does not take me to the point ... | <p>For Office 2003 you will get this behaviour when the debugger is configured to break on unhandled errors (the default configuration).</p>
<p>If you want it to break on the Err.Raise line, you need to configure it to break on all errors (Tools/Options/General/Error Trapping/Break on All Errors).</p>
<p>I believe it... | <p>This "feature" is the same in Excel 2003 and I'd be surprised if it's different in 2007.</p>
| 39,600 |
<p><strong>Please note the Edit below for a lot more information, and a possible solution</strong></p>
<p>We recently modified a large Delphi application to use ADO connections and queries instead of BDE connections and queries. Since that change, performance has become terrible.</p>
<p>I've profiled the application... | <p>I don't know about Delphi 2007, but I did same thing with Delphi 7 and Oracle 8.</p>
<p>Here are things I did:</p>
<ul>
<li>Set <strong>TAdoDataSet.CursorLocation</strong> according to query:
<ul>
<li><strong><em>clUseClient</em></strong> if query fetches records for GUI and query is relatively "simple" - no grou... | <p>For best performance, should get a look at our <a href="http://blog.synopse.info/post/2011/07/09/SynDBOracle:-Open-Source-native-Oracle-access" rel="nofollow noreferrer">Open Source direct access to Oracle</a>.</p>
<p>If you are processing a lot of TQuery, without using the DB components, we have a dedicated pseudo... | 48,214 |
<p>What is forward reference in C with respect to pointers?</p>
<p>Can I get an example?</p>
| <p>See this page on <a href="https://web.archive.org/web/20080314031412/http://h30097.www3.hp.com/docs/base_doc/DOCUMENTATION/V40F_HTML/AQTLTBTE/DOCU_024.HTM" rel="nofollow noreferrer">forward references</a>. I don't see how forward referencing would be different with pointers and with other PoD types.</p>
<p>Note th... | <p>Forward references allow C compiler to do less passes and significantly reduces compilation time. It is probably was important some 20 years ago when computers was much slower and compliers less efficient.</p>
| 42,263 |
<p>I've decided to integrate NUnit with VWD2008.</p>
<p>I did the following-
1) Installed NUnit - Ran a Sample project that was included with the installation all the tests were fine.
2) Installed TestDriven.Net 2.0 - Personal distribution.
3) I have written on an MVC Project a test and when I try to right click the c... | <p>Testdriven.Net doesn't work with the express editions of visual studio. Previous versions of Testdriven.Net did work with the Visual Studio Express editions but Microsoft didn't like that and put their lawyers on it.
<a href="http://weblogs.asp.net/nunitaddin/archive/2007/07/06/microsoft-amp-testdriven-net.aspx" rel... | <p>Like Mendelt said, TestDriven.Net doesn't work with the express editions. I've got VS2008 Standard Edition so I had to use the "long way" of using NUnit. You have the NUnit GUI open and load your dlls. Then you attach to that process from the Debug menu in VS2008 and run your code.</p>
<p>All that being said, I'... | 31,547 |
<p>I've create a maintenance plan on my SQL Server 2005 server. The backup should be written to another server. I'm using a UNC path for this. The user running the SQL Agent jobs has full access to the other server. It's admin on both servers.</p>
<p>The problem is that this statement fails ( has the correct server na... | <p>After having this problem myself, with none of the above solutions being clear enough, I thought I'd post a clearer response. The error is in fact nothing to do with syntax - it is entirely to do with permissions. The important thing here is that it is the SQL Server service account, NOT the SQL Server Agent account... | <p>Is it not the lack of a double-backslash before the server name?</p>
| 26,572 |
<p>I'm having trouble sending out a simple HTTP request using Actionscript 3's Socket() object. My onConnect listener is below:</p>
<pre><code>function sConnect(e:Event):void {
trace('connected');
s.writeUTFBytes('GET /outernet/client/rss/reddit-feeds HTTP/1.1\r\n');
s.writeUTFBytes('Host: 208.43.71.50:808... | <p>You have to write another "\r\n" to the stream before the flush to tell the HTTP server that you're finished sending the headers.</p>
| <p>Instead of using UTF, try with ANSI/ASCII. The encoding may be the cause of the issue.</p>
| 36,214 |
<p>I'm working on a website built with pure HTML and CSS, and I need a way to restrict access to pages located within particular directories within the site. The solution I came up with was, of course, ASP.NET Forms Authorization. I created the default Visual Studio log in form and set up the users, roles, and access r... | <p>I'd guess (since I don't have IIS7 handy ATM) that you'd need to turn off Anonomyous Auth, and enable Forms Auth in the IIS7 sections.</p>
| <p>At what point did you insert your login/password? Did you have a look at the tables that where created? Althought your password must be encrypted, maybe it's worth just checking if your user was actually created.</p>
| 4,505 |
<p>How do I serialize a 'Type'?</p>
<p>I want to serialize to XML an object that has a property that is a type of an object. The idea is that when it is deserialized I can create an object of that type.</p>
<pre><code>public class NewObject
{
}
[XmlRoot]
public class XmlData
{
private Type t;
public Type T... | <p><code>Type</code> class cannot be serialized because <code>System.RuntimeType</code> is not accessible to our code, it is an internal CLR type. You may work around this by using the type's name instead, like this:</p>
<pre><code>public class c
{
[XmlIgnore]
private Type t;
[XmlIgnore]
publi... | <p>The problem is that the type of XmlData.T is actually "System.RuntimeType" (a subclass of Type), which unfortunately is not public. This means there is no way of telling the serialise what types to expect. I suggest only serializing the name of the type, or fully qualified name as Jay Bazuzi suggests.</p>
| 37,088 |
<p>When you roll out changes to a live web site, how do you go about checking that the <em>live</em> system is working correctly? Which tools do you use? Who does it? Do you block access to the site for the testing period? What amount of downtime is acceptable?</p>
| <p>I tend to do all of my testing in another environment (not the live one!). This allows me to push the updates to the live site knowing that the code should be working ok, and I just do sanity testing on the live data - make sure I didn't forget a file somewhere, or had something weird go wrong.</p>
<p>So proper te... | <p>Run your main server on a port other than 80. Stick a lightweight server (e.g. nginx) in front of it on port 80. When you update your site, start another instance on a new port. Test. When you are satisfied that it has been deployed correctly, edit your proxy config file, and restart it. In nginx's case, this r... | 9,292 |
<p>So I started with a web services project (just a dynamic web project) that builds and debugs correctly from eclipse. We've pulled a chunk of common code out that we want to put into a shared library so now those classes are going into a separate jar project that the web project references.</p>
<p>On the web projec... | <p>Java EE module dependencies would solve this problem.
You have already done the task of extracting your common classes into its own project, <strong>possibly</strong> because other projects depend on these classes. Either way, you'll have to ensure that this is a Utility project (appears under Java EE in the project... | <p>I figured this out after spending some time on it. If you are in Eclipse Helios , go to <code>properties > deployment assembly > add > project</code> and select the dependent project you wish to add.</p>
| 42,326 |
<p>What's the coolest mashup you've built? What APIs did you use? How was the mashup better than the sum of its parts?</p>
| <p>Although probably not a true mashup, I created a script hat would read the Apple Movie Trailer RSS feed, and then visit the links in the feed to download the HTML of the pages linked to in the RSS feed. From there, it would download the container .mov files, and parse out the actual URL to the movie you can actually... | <p>I took <a href="http://career-resources.dice.com/tech_challenge/tech_chal_form.html" rel="nofollow noreferrer">2nd</a> place earlier this year in the "Spring Mashup Challenge"</p>
<p>Google Maps + Flickr</p>
<p><a href="http://www.desmoinesmashups.com" rel="nofollow noreferrer">http://www.desmoinesmashups.com</a><... | 40,379 |
<p>I have a procedure that is run for a lot of items, skipping over certain items who don't meet a criterion. However, I then go back and run it for some of the individuals who were missed in the first pass. I currently do this by manually re-running the procedure for each individual person, but would ideally like a ... | <p>Perhaps something on these lines:</p>
<pre><code>Dim Counter 'module level '
Sub RunSomeProc()
Counter = 0
'1st test '
SomeProc
'2nd Test skipped items'
For Each c In Range("c1:c" & Counter)
SomeProc
Next
End Sub
Sub SomeProc()
For Each c In Range("NamedRange1")
If SomeTe... | <p>You can iterate on it in this way:</p>
<pre>
set rgList = Range("name_of_range")
For i = 1 To rgList.Rows.Count
' Do something using rgList.Cells(i, 1)
RunProcedure(rgList.Cells(i, 1))
Next i
</pre>
<p>I assumed here that the range is on a column; was it on a row, you should have done the iteration on the ... | 45,318 |
<p>(All of the following is to be written in Java)</p>
<p>I have to build an application that will take as input XML documents that are, potentially, very large. The document is encrypted -- not with XMLsec, but with my client's preexisting encryption algorithm -- will be processed in three phases:</p>
<p>First, the... | <p>Stax is the right way. I would recommend looking at <a href="http://woodstox.codehaus.org/" rel="noreferrer">Woodstox</a></p>
| <p>Look at the <a href="http://xom.nu" rel="nofollow" title="XOM">XOM</a> library. The example you are looking for is <code>StreamingExampleExtractor.java</code> in the samples directory of the source distribution. This shows a technique for performing a streaming parse of a large xml document only building specific ... | 46,397 |
<p>If I need to choose a collation mode to work with, how do I know what collations are available?</p>
| <p>Use this query to list the available collation modes:</p>
<p>SELECT *
FROM fn_helpcollations()</p>
| <p>Use this query to list the available collation modes:</p>
<p>SELECT *
FROM fn_helpcollations()</p>
| 13,912 |
<p>What is the <a href="http://en.wikipedia.org/wiki/MIME" rel="noreferrer">MIME</a> type of javascript? </p>
<p>More specifically, what is the right thing to put in the "type" attribute of a script tag? <code>application/x-javascript</code> and <code>text/javascript</code> seem to be the main contenders.</p>
| <p>This is a common mistake. The MIME type for javascript wasn't standardized for years. It's now <a href="http://www.rfc-editor.org/rfc/rfc4329.txt" rel="noreferrer">officially</a>: "<strong>application/javascript</strong>".</p>
<p>The real kicker here is that most browsers won't use that attribute anyway, at least... | <p>The official RFC that defines the Javascript MIME Type is <a href="http://www.rfc-editor.org/rfc/rfc4329.txt" rel="nofollow">RFC4329</a>.</p>
<pre>
7. JavaScript Media Types
7.1. text/javascript (obsolete)
Type name: text
Subtype name: javascript
Required parameters: n... | 23,030 |
<p>I have about 200 Excel files that are in standard Excel 2003 format. </p>
<p>I need them all to be saved as Excel xml - basically the same as opening each file and choosing <strong>Save As...</strong> and then choosing <strong>Save as type:</strong> <em>XML Spreadsheet</em></p>
<p>Would you know any simple way of ... | <p>Here is a routine that will convert all files in a single directory that have a .xls extension.</p>
<p>It takes a straight forward approach. Any VBA code in a workbook is stripped out, the workbook is not saved with a .xlsm extension. Any incompatability warning are not dislayed, instead the changes are automatic... | <p>The simplest way is to record macro for one file and then manually edit macros to do such actions for files in folder using loop. In macro you can use standart VB functions to get all files in directory and to filter them. You can look <a href="http://www.xtremevbtalk.com/archive/index.php/t-247211.html" rel="nofoll... | 21,027 |
<p>I have a situation where I want to add hours to a date and have the new date wrap around the work-day. I cobbled up a function to determine this new date, but want to make sure that I'm not forgetting anything.</p>
<p>The hours to be added is called "delay". It could easily be a parameter to the function instead.</... | <p>You should probably write some automated tests for each condition you can think of, and then just start brainstorming more, writing the tests as you think of them. This way, you can see for sure it will work, and will continue to work if you make further changes. Look up Test Driven Development if you like the res... | <p>I've worked with the following formula (pseudocode) with some success:</p>
<pre><code>now <- number of minutes since the work day started
delay <- number of minutes in the delay
day <- length of a work day in minutes
x <- (now + delay) / day {integer division}
y <- (now + delay) % day {modulo remain... | 2,723 |
<p>The following is code I've used to create a <code>memory mapped file</code>:</p>
<pre><code>fid = open(filename, O_CREAT | O_RDWR, 0660);
if ( 0 > fid )
{
throw error;
}
/* mapped offset pointer to data file */
offset_table_p = (ubyte_2 *) shmat(fid, 0, SHM_MAP);
/* Initialize table */
memset(offset_table... | <p>As far as I can tell from reading documentation, you are doing it completely wrong. </p>
<p>Either use open() and mmap() or use shmget() and shmat().</p>
<p>If you use open() you will need to make the file long enough first. Use ftruncate() for that.</p>
| <p>First things first:</p>
<p>Examine the file both before and after the open() call. If on Linux, you can use the code:</p>
<pre><code>char paxbuff[1000]; // at start of function
sprintf (paxbuff,"ls -al %s",filename);
system (paxbuff);
fid = open(filename, O_CREAT | O_RDWR, 0660); // th... | 31,412 |
<p>I am looking to add the capability for users to write plugins to the program I have developed in Delphi. The program is a single executable with no DLLs used. </p>
<p>This would allow the user community to write extensions to my program to access the internal data and add capabilities that they may find useful. </p... | <p>The first question I would ask is, do you need the plugins to access the UI of your host application, or add any UI elements of their own? Or will the plugins be limited to querying and/or supplying data to your host app?</p>
<p>The latter is much easier and opens up two possibilities. Others have already mentioned... | <p>You could have a look at <a href="http://www.remobjects.com/hydra.aspx" rel="nofollow noreferrer">Hydra</a> from Remobjects. Not only will this allow you to add plugins, but also to mix win32 and .net.</p>
| 47,772 |
<p>am having trouble with visible attribute of an asp.net panel. Basically I have a page that calls a database table and returns the results in a detailsview. However, some of the values that are returned are null and if so I need to hide the image thats next to it. </p>
<p>I am using a panel to determine whether to h... | <p>Your syntax says VB.NET, but you're compiler says C# (the CS* compiler error). Since I trust your compiler more:</p>
<pre><code>Visible='<%# Eval("addr1") != DBNull.Value %>'
</code></pre>
| <p>Try: visible='<%# (Eval("addr1") is DbNull.Value? "False":"True") %>'</p>
<p>the proper syntax for iif is (condition?if true this value : if false this value) assuming your using c#</p>
| 49,932 |
<p>This is a really basic question but this is the first time I've used MATLAB and I'm stuck.
I need to simulate a simple series RC network using 3 different numerical integration techniques. I think I understand how to use the ode solvers, but I have no idea how to enter the differential equation of the system. Do I n... | <p>You are going to need a function file that takes <em>t</em> and <em>y</em> as input and gives <em>dy</em> as output. It would be its own file with the following header.</p>
<pre><code>function dy = rigid(t,y)
</code></pre>
<p>Save it as rigid.m on the MATLAB path.</p>
<p>From there you would put in your differen... | <p><a href="http://www4.ncsu.edu/~mahaider/NCSU_RTG_Site/RTM_Matlab_Intro.pdf" rel="nofollow noreferrer">The Official Matlab Crash Course</a> (PDF warning) has a section on solving ODEs, as well as a lot of other resources I found useful when starting Matlab.</p>
| 49,420 |
<p>GCC supports Setjump-longjump (sjlj) and Dwarf2 table-based unwinding (dw2) exception handling models. What is the difference between the two models and how to choose the appropriate model? Why is Dwarf2 table-based unwinding (dw2) the more efficient model? I understand that the two models cannot be mixed.</p>
<p>R... | <p>Well, dwarf2 builds up tables for every function, that contain what the callee saved registers are and where in the stack they are saved, and where the frame pointer/return address in the callstack is, and some other stuff. If you use dwarf2, the compiler can use those information and effectively restore registers, ... | <p>Avoid sjlj. Every "try" block will call setjmp which
saves registers, a performance hit even when no exceptions
are raised. Using tables, the normal flow of control
incurs no execution cost. Only when an exception is raised
does the exception handling mechanism have to grovel
through the tables to figure out... | 41,145 |
<p>I have already tried PreRenderComplete and unload is too late</p>
| <p>Generally, the only event after 'Render' for a control is 'Unload'</p>
| <p>Generally, the only event after 'Render' for a control is 'Unload'</p>
| 36,230 |
<p>Hi would like to send an email alert after checking the result of a query which will return the numbers of rows in a table. Does anyone have any ideas how I could do this in SQL Server 2000 in 2005 I would use a maintenence plan but not sure how in 2000?</p>
| <p>I did this a few years ago - hastily adapted from a MS Knowledgebase article. I changed the params to be hardcoded variables. I've removed the identifying servernames/email addresses etc etc from here but you should be able to figure it out!</p>
<p>CREATE PROCEDURE [dbo].[usp_SendSuccessMail]
--Adapted from a Micro... | <p>Because SQLMail is so useless for real world usage (MAPI, etc), we ended up using <a href="http://www.sqlanswers.com/" rel="nofollow noreferrer">SQLAnswersMail</a> which is very powerful and easy to use.</p>
| 35,548 |
<p>I want to be able to play sound files in my program. Where should I look?</p>
| <p>I wrote the following code that works fine. But I think it only works with <code>.wav</code> format.</p>
<pre><code>public static synchronized void playSound(final String url) {
new Thread(new Runnable() {
// The wrapper thread is unnecessary, unless it blocks on the
// Clip finishing; see comments.
publi... | <p>This thread is rather old but I have determined an option that could prove useful.</p>
<p>Instead of using the Java <code>AudioStream</code> library you could use an external program like Windows Media Player or VLC and run it with a console command through Java.</p>
<pre><code>String command = "\"C:/Program Files... | 4,588 |
<p>In Visual Studio, is there any way to make the debugger break whenever a certain file (or class) is entered? Please don't answer "just set a breakpoint at the beginning of every method" :)</p>
<p>I am using C#.</p>
| <p>Macros can be your friend. Here is a macro that will add a breakpoint to every method in the current class (put the cursor somewhere in the class before running it).</p>
<pre><code>Public Module ClassBreak
Public Sub BreakOnAnyMember()
Dim debugger As EnvDTE.Debugger = DTE.Debugger
Dim sel As En... | <p>Not that I'm aware of. The best you can do is to put a breakpoint in every method in the file or class. What are you trying to do? Are you trying to figure out what method is causing something to change? If so, perhaps a data breakpoint will be more appropriate.</p>
| 31,182 |
<p>I have a directory outside the webroot that is used for storing images uploaded from a separate admin system. Images are stored in this format:</p>
<pre><code>filepath/writable/images/00/00/23/65/filename-236581.jpg
</code></pre>
<p>(where the webroot is filepath/html)</p>
<p>...for example. Here, 236 is the ID o... | <p>The [L] means last.</p>
<p>What you really need to use as well is the [PT] flag to indicate that the resultant path from your rewrite rule should be passed through to next handler which in your case is the alias directive.</p>
<p>As the [PT] tag also implies the [L] tag you no longer require [L] aswell.</p>
| <p>That [L] you have after the RewriteRule means "Last"</p>
<p>To be honest, I believed this only meant further RewriteRule lines would be ignored, but it might be worth checking out.</p>
| 43,314 |
<p>Does anyone know how to unit test SiteMapNode? We’re building some custom navigation controls, which renders unordered html lists from Site Maps with custom attributes.</p>
<p>I’m trying to follow a test first approach but am finding that SiteMapNode has internal dependencies on HttpContext. To traverse the site ma... | <p>A rather dull question, so no surprise it didn't get a response! For anyone else who may stumble across this problem, here's my preferred solution: </p>
<p>I've found the best way to handle this is to load the physical site map into an xml document. I then have a NavigationNodeFactory, which validates and builds my... | <p>I think the problem may have been that from your description, you were attempting to test-first an already existing class - the SiteMapNode.</p>
<p>You will want to be testing the <strong>use</strong> of the sitemap node within your application, so I would advise that if you want to perform actions on the sitemapno... | 38,688 |
<p>I have a third party library that internally constructs and uses the SqlConnection class. I can inherit from the class, but it has a ton of overloads, and so far I have been unable to find the right one. What I'd like is to tack on a parameter to the connection string being used.</p>
<p>Is there a way for me to put... | <p>You can <a href="http://www.wintellect.com/cs/blogs/jrobbins/archive/2008/01/17/additional-net-framework-source-code-debugging-tricks.aspx" rel="nofollow noreferrer">download .NET source code</a> and set break point right in .NET FW source code.</p>
<p>You can use <a href="http://www.codeplex.com/NetMassDownloader"... | <p>OK, if you want definitive guide, here it is:</p>
<p><a href="http://blogs.msdn.com/sburke/archive/2008/01/16/configuring-visual-studio-to-debug-net-framework-source-code.aspx" rel="nofollow noreferrer">Configuring Visual Studio to Debug .NET Framework Source Code</a></p>
<p>If you want some help, go ahead and tel... | 8,644 |
<h2>Question</h2>
<p>Can I build a image database/library that has an e-commerce style checkout system and a powerful search in Oracle/Java? Are there existing elements out there I should be aware of? Or, is this better in another dev environment like PHP/MySQL?</p>
<h2>Overview</h2>
<p>I am working on an image data... | <p>Seems your question is really a struggle between Oracle/Java and PHP/MySQL. The details you state are none too difficult to implement using either of these tools sets or using a dozen others that I could think of.</p>
<p>If I am correct (only you could know), then this is a fabulous opportunity for you. You seem ... | <p>I can't comment on whether Jave is apropriate, but you might look at the Oracle Application Express environment <a href="http://apex.oracle.com" rel="nofollow noreferrer">http://apex.oracle.com</a>. This looks and sounds entirely within the scope that they aim for there.</p>
| 15,016 |
<p>I want to debug my project in Zend Framework in Eclipse. Zend Debugger is already running bud now I have problem with Debug tool in Eclipse. It give an extra GET parametrs and the project in Zend don't like it.</p>
<p>I tried to google it and found <a href="http://framework.zend.com/wiki/display/ZFDEV/Configuring+Y... | <p>I successfully use the debugger and my htaccess looks like this </p>
<pre><code><IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
RewriteCond %{REQUEST_FILENAME} (logs|library|application|config)
Rewri... | <p>I successfully use the debugger and my htaccess looks like this </p>
<pre><code><IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
RewriteCond %{REQUEST_FILENAME} (logs|library|application|config)
Rewri... | 48,194 |
<p>What is the best approach to write <strong>hooks</strong> for <strong>Subversion</strong> in <strong>Windows</strong>? As far as I know, only executable files can be used. So what is the best choice? </p>
<ul>
<li>Plain batch files (very limited but perhaps OK for very simple solutions)</li>
<li>Dedicated compiled ... | <p>I’ve just spent several days procrastinating about exactly this question. There are third party products available and plenty of PERL and Python scripts but I wanted something simple and a language I was familiar with so ended up just writing hooks in a C# console app. It’s very straight forward:</p>
<pre><code>pub... | <p>Depending on the complexity, each situation is different, If I am just simply moving files around, I'll write a quick batch file. If I want to do something more complex Ill normally just skip the scripting part and write a quick c# program that can handle it. </p>
<p>The question then is do you put that c# program ... | 2,711 |
<p>I have a Microsoft keyboard with a series of non-standard buttons such as "Mail", "Search" , "Web/Home" etc.</p>
<p>It would be nice to be able to bind these keys so they execute arbitrary programs.</p>
<p>Does anybody know how to do this in Debian Etch?</p>
| <p>I can't say for certain because I'm not using Debian but if you're using Gnome the easiest way is to run gnome-keybinding-properties (System > Preferences > Keyboard Shortcuts)</p>
<p>Instead of typing a shortcut such as <kbd>Ctrl</kbd>+<kbd>M</kbd>, hit the button on your keyboard.</p>
<p>If you would prefer to d... | <p>I used Gizmo Daemon for my PowerMate under Debian - it supports fancy keyboard keys as well (although I haven't tried it for those keys). Hacking on gizmod to get it to do what I wanted was pretty easy.</p>
<p><a href="http://gizmod.sourceforge.net/" rel="nofollow noreferrer">Gizmo Daemon</a></p>
| 2,851 |
<p>I am trying to debug a strange issue with users that have <a href="https://secure.logmein.com/home.asp" rel="nofollow noreferrer">LogMeIn</a> installed. After a few days, some of my dialogs that my app opens can end up offscreen. If I could reliable detect that, I could programmatically move the dialogs back where t... | <p>Simply use MonitorFromWindow with the MONITOR_DEFAULTTONULL flag. If the return value is null, your window is not visible. You can subsequently pass MONITOR_DEFAULTTONEAREST to be able to reposition your window on the nearest monitor.</p>
| <p>Hmm. This might not help, but when I did VB, you could do screen.width and screen.height, and then window.x and window.y...</p>
<p>Of course, I don't know how that works with multiple monitors.</p>
| 26,210 |
<p>The calculations in my code are well-tested, but because there is so much GUI code, my overall code coverage is lower than I'd like. Are there any guidelines on unit-testing GUI code? Does it even make sense?</p>
<p>For example, there are graphs in my app. I haven't been able to figure out how to automate the testi... | <p>Designs like MVP and MVC typically try to abstract as much logic out of the actual GUI as possible. One very popular article about this is <a href="http://web.archive.org/web/20151130093108/http://www.objectmentor.com/resources/articles/TheHumbleDialogBox.pdf" rel="noreferrer">"The Humble Dialog Box"</a> by Michael ... | <p>If you are using Swing, <a href="http://easytesting.org/swing/wiki/pmwiki.php" rel="nofollow noreferrer">FEST-Swing</a> is useful for driving your GUI and testing assertions. It makes it pretty straightforward to test things like <em>"if I click button A, dialog B should be displayed"</em> or <em>"if I select optio... | 26,481 |
<p>I have to use unsigned integers that could span to more than 4 bytes, what type should I use?</p>
<p>PS Sorry for the "noobism" but that's it :D</p>
<p>NB: I need integers because i have to do divisions and care only for the integer parts and this way int are useful</p>
| <p><em>long long</em>, 64 bit integer... <a href="http://msdn.microsoft.com/en-us/library/s3f49ktz(VS.80).aspx" rel="noreferrer">here</a> you can find some reference about the data types and ranges...</p>
| <p>unsigned long long - it is at least 64 bits long</p>
| 26,478 |
<p>Using python 2.4 and the built-in <code>ZipFile</code> library, I cannot read very large zip files (greater than 1 or 2 GB) because it wants to store the entire contents of the uncompressed file in memory. Is there another way to do this (either with a third-party library or some other hack), or must I "shell out" ... | <p>Here's an outline of decompression of large files.</p>
<pre><code>import zipfile
import zlib
import os
src = open( doc, "rb" )
zf = zipfile.ZipFile( src )
for m in zf.infolist():
# Examine the header
print m.filename, m.header_offset, m.compress_size, repr(m.extra), repr(m.comment)
src.seek( m.header... | <p>As of Python 2.6, you can use <a href="https://docs.python.org/2/library/zipfile.html#zipfile.ZipFile.open" rel="noreferrer"><code>ZipFile.open()</code></a> to open a file handle on a file, and copy contents efficiently to a target file of your choosing:</p>
<pre><code>import errno
import os
import shutil
import zi... | 44,025 |
<p>I am using the <code>ODBC</code> connector to access a MySQL db from Visual Studio 2008 and I'm facing performance problems when dealing with crystal reports and to solve this I need a native connector to visual studio. If someone has had a similar problem and knows a solution or tools (freeware preferable), I would... | <p>You want <a href="http://www.mysql.com/products/connector/net/" rel="noreferrer">Connector/Net</a></p>
<p><strong>Update:</strong> This link should take you to a more recent version:
<a href="http://dev.mysql.com/downloads/connector/net/5.2.html" rel="noreferrer">http://dev.mysql.com/downloads/connector/net/5.2.ht... | <p>Connector/Net <em>is</em> the native provider you are looking for. If you're having trouble using it then you should open a new question asking how to get it working with crystal reports. I don't use crystal reports, so I can't help you there myself.</p>
| 6,328 |
<p>A UITableViewCell comes "pre-built" with a UILabel as its one and only subview after you've init'ed it. I'd <em>really</em> like to change the background color of said label, but no matter what I do the color does not change. The code in question:</p>
<pre><code>UILabel* label = (UILabel*)[cell.contentView.subviews... | <p>Your code snippet works fine for me, but it must be done after the cell has been added to the table and shown, I believe. If called from the <code>initWithFrame:reuseIdentifier:</code>, you'll get an exception, as the <code>UILabel</code> <strong>subview</strong> has not yet been created.</p>
<p>Probably the best s... | <pre><code>for (UIView *views in views.subviews)
{
UILabel* temp = (UILabel*)[views.subviews objectAtIndex:0];
temp.textColor = [UIColor whiteColor];
temp.shadowColor = [UIColor blackColor];
temp.shadowOffset = CGSizeMake(0.0f, -1.0f);
}
</code></pre>
| 27,472 |
<p>I have always included clauses to transfer to my clients full author, ownership and use rights for all the source code, original images, original resources, etc. I develop/create for them.</p>
<p>Of course, I retain author, ownership and use rights for my libraries and I usually do not include source code for those... | <p>There might be a number of reasons for this. The most common one would be leverage. If part of the application you develop has broad applicability, the you might be able to retarget substantial parts of the solution to other clients. This would achieve one of two things: Shorter time to market which would imply... | <p>In case they write the next Google.</p>
| 27,134 |
<p>I've come across the problem where Excel will not play nice with UTF-8 encoded CSV files. See this <a href="https://stackoverflow.com/questions/155097/microsoft-excel-mangles-diacritics-in-csv-files">related question</a> on Stack Overflow.</p>
<p>I've followed the solution of exporting as UTF-16, however it seems t... | <p>For tab-delimited files, <a href="http://www.rfc-editor.org/rfc/rfc4180.txt" rel="noreferrer">http://www.rfc-editor.org/rfc/rfc4180.txt</a> mentions 'text/tab-separated-values'.</p>
<p>That format is (sparsely) described at <a href="http://www.iana.org/assignments/media-types/text/tab-separated-values" rel="norefer... | <p>Mime-type is an HTTP thing and only has meaning to the browser - it is not saved along with the file when you download a local copy. So Excel doesn't ever see your mime-type.</p>
| 33,093 |
<p>in tcsh I'm trying to redirect STDERR from a command from my .aliases file.</p>
<p>I found that I can redirect STDERR from the command line like this. . .</p>
<pre><code>$ (xemacs > /dev/tty) >& /dev/null
</code></pre>
<p>. . . but when I put this in my .aliases file I get an alias loop. . .</p>
<pre><... | <p>I suspect this is a case where NOT using an alias is the best option - try using a shell script instead:</p>
<pre><code>#!/bin/tcsh
(xemacs $* > /dev/tty ) >& /dev/null
</code></pre>
| <p>Try</p>
<pre><code>alias emacs '(\emacs \!* > /dev/tty) >& /dev/null'
</code></pre>
<p>The "badly placed ()'s" message comes from misplacing the input parameter to emacs. Without the "<code>\!*</code>" in the alias definition, "<code>emacs abc</code>" becomes </p>
<pre><code>(/usr/bin/emacs > /dev/t... | 16,491 |
<p>I have seen C# code that uses the <code>@</code> to tell the compiler the string has newlines in it and that it should be all in one line.
Is there something like that for C/C++?</p>
<p>Like if I want to put something like:</p>
<p>73167176531330624919225119674426574742355349194934
969835203127745063262395783180169... | <p>C and C++ didn't have anything like C# verbatim string literals at the time this answer was first written. The closest you could do is:</p>
<pre><code>"73167176531330624919225119674426574742355349194934"
"96983520312774506326239578318016984801869478851843"
"85861560789112949495459501737958331952853208805511"
"12... | <p>Sure, you can do:</p>
<pre><code>char *x = "73167176531330624919225119674426574742355349194934\n"
"96983520312774506326239578318016984801869478851843\n"
<lines removed for brevity>
"71636269561882670428252483600823257530420752963450";
</code></pre>
<p>and this will em... | 30,051 |
<p>In SQL Server 2005 I have an "id" field in a table that has the "Is Identity" property set to 'Yes'. So, when an Insert is executed on that table the "id" gets set automatically to the next incrementing integer. Is there an easy way when the Insert is executed to get what the "id" was set to without having to do a S... | <p>In .Net at least, you can send multiple queries to the server in one go. I do this in my app:</p>
<pre><code>command.CommandText = "INSERT INTO [Employee] (Name) VALUES (@Name); SELECT SCOPE_IDENTITY()";
int id = (int)command.ExecuteScalar();
</code></pre>
<p>Works like a charm.</p>
| <p>This is probably the best working solution I found for SQL Server..
<a href="https://stackoverflow.com/questions/17993606/sql-server-return-the-value-of-identity-column-after-insert-statement">Sql Server return the value of identity column after insert statement</a></p>
| 7,889 |
<p>I'm wondering if there's any way to have Firefox 3 (or IE 7 or safari 3.1 or Opera) flag that a redirect has occurred (i.e. any deltas between the hyperlink or URL entered into address bar, and the page you land on), whether you've arrived from a hyperlink or entering URL into address bar.</p>
<p>I've googled some,... | <p>I don't think this will help, since you don't want to do the right click for the linker add-on, but if I needed to do know if I was being redirected, I would use the <a href="http://livehttpheaders.mozdev.org/" rel="nofollow noreferrer" title="http://livehttpheaders.mozdev.org/">LiveHTTPHeaders</a> extension. It su... | <p>Not sure if that's exactly what you need, but the <strong><a href="https://addons.mozilla.org/en-US/firefox/addon/11787" rel="nofollow noreferrer">NoRedirect</a></strong> extension seems to be related to your problem. Quoting it's description:</p>
<blockquote>
<p>NoRedirect lets the user take control of HTTP redi... | 26,541 |
<p>Is there a problem with using <code>IEnumerable<T></code> as a return type?
FxCop complains about returning <code>List<T></code> (it advises returning <code>Collection<T></code> instead).</p>
<p>Well, I've always been guided by a rule "accept the least you can, but return the maximum."</p>
<p>Fro... | <p>This is really a two part question.</p>
<p>1) Is there inherently anything wrong with returning an IEnumerable<T></p>
<p>No nothing at all. In fact if you are using C# iterators this is the expected behavior. Converting it to a List<T> or another collection class pre-emptively is not a good idea. Do... | <p>I think your own guidance is great -- if you are able to be more specific about what you're returning without a performance hit (you don't have to e.g. build a List out of your result), do so. But if your function legitimately doesn't know what type it's going to find, like if in some situations you'll be working w... | 49,964 |
<p>I'm looking for a standard file format that used by systems needing to store currencies and also provide currency exchange (so we need both the buy and sell rates)</p>
<p>I looked online and found the <a href="http://filext.com/file-extension/CEX" rel="nofollow noreferrer">.cex</a> but have not been able to find it... | <p>I don't know if <a href="http://www.cloanto.com/specs/seriff.html" rel="nofollow noreferrer">SERIFF</a> is any better for your application, but at least it has documentation.</p>
| <p>Or maybe <a href="http://www.fixprotocol.org/" rel="nofollow noreferrer">FIX</a> is what you're after. </p>
| 38,791 |
<p>I have a class that compares 2 instances of the same objects, and generates a list of their differences. This is done by looping through the key collections and filling a set of other collections with a list of what has changed (this may make more sense after viewing the code below). This works, and generates an o... | <p>Are you using .NET 3.5? I'm sure LINQ to Objects would make a lot of this <em>much</em> simpler.</p>
<p>Another thing to think about is that if you've got a lot of code with a common pattern, where just a few things change (e.g. "which property am I comparing?" then that's a good candidate for a generic method taki... | <p>What framework are you targeting? (This will make a difference in the answer.)</p>
<p>Why is this a void function? </p>
<p>Shouldn't the signature look like:</p>
<pre><code>DiffResults results = object.CompareTo(object2);
</code></pre>
| 25,814 |
<p>For our Django App, we'd like to get an <code>AutoField</code> to start at a number other than 1. There doesn't seem to be an obvious way to do this. Any ideas?</p>
| <p>Like the others have said, this would be much easier to do on the database side than the Django side. </p>
<p>For Postgres, it'd be <a href="http://www.postgresql.org/docs/9.1/static/sql-altersequence.html" rel="noreferrer">like so</a>: <code>ALTER SEQUENCE sequence_name RESTART WITH 12345;</code> Look at your own ... | <p>I needed to do something similar. I avoided the complex stuff and simply created two fields:</p>
<pre><code>id_no = models.AutoField(unique=True)
my_highvalue_id = models.IntegerField(null=True)
</code></pre>
<p>In views.py, I then simply added a fixed number to the id_no:</p>
<p>my_highvalue_id = id_no + 1200</p... | 14,341 |
<p>I currently have a Java SAX parser that is extracting some info from a 30GB XML file. </p>
<p>Presently it is:</p>
<ul>
<li>reading each XML node</li>
<li>storing it into a string object, </li>
<li>running some regexex on the string</li>
<li>storing the results to the database</li>
</ul>
<p>For several million el... | <p>First, try to find out what's slowing you down. </p>
<ul>
<li>How much faster is the parser when you parse from memory? </li>
<li>Does using a <code>BufferedInputStream</code> with a large size help?</li>
</ul>
<p>Is it easy to split up the XML file? In general, shuffling through 30 GiB of any kind of data will ta... | <p>I would suggest to first import your massive XML file into <strong>a native XML database</strong> (such as <a href="http://exist.sourceforge.net/" rel="nofollow noreferrer">eXist</a> if you are looking for open source stuff, never tested it myself), and then perform <strong>iterative paged queries</strong> to proces... | 13,729 |
<p>I'm using several variants of the Validator controls (RequiredFieldValidator, CompareValidator, etc) and am using the CssClass property of the validator. I can see (via Firebug) that the class is being applied, but the validator control itself is adding a style element to it, namely color: red. But I don't want th... | <p>You can do this in your css file:</p>
<pre><code>.validator
{
color: blue !important;
}
</code></pre>
<p>This will override the inline red style.</p>
| <pre><code>Set Forecolor=""
</code></pre>
<p>And </p>
<pre><code>CssClass="your-css-class"
</code></pre>
| 30,730 |
<p>How can you find out what are the long running queries are on Informix database server? I have a query that is using up the CPU and want to find out what the query is.</p>
| <p>If the query is currently running watch the <strong>onstat -g act -r 1</strong> output and look for items with an <strong><em>rstcb</em></strong> that is not 0</p>
<pre><code>Running threads:
tid tcb rstcb prty status vp-class name
106 c0000000d4860950 0 ... | <pre><code>SELECT ELAPSED_TIME_MIN,SUBSTR(AUTHID,1,10) AS AUTH_ID,
AGENT_ID, APPL_STATUS,SUBSTR(STMT_TEXT,1,20) AS SQL_TEXT
FROM SYSIBMADM.LONG_RUNNING_SQL
WHERE ELAPSED_TIME_MIN > 0
ORDER BY ELAPSED_TIME_MIN DESC
</code></pre>
<p>Credit: <a href="http://it.toolbox.com/blogs/db2luw/sql-to-view-long-running-queries... | 7,426 |
<p>I am using an ASP.NET MVC project and everytime I add a class to a folder it makes really long namespaces. </p>
<p><strong>Example</strong>: </p>
<pre><code>Project = Tully.Saps.Data
Folder = DataAccess/Interfaces
Namespace = Tully.Saps.Data.DataAccess.Interfaces
Folder = DataAccess/MbNetRepositories
Names... | <p>Leave them alone and add the usings. You're asking for trouble manually changing things like that (harder to debug, inconsistent with other projects, et cetera).</p>
| <p>It is really up to you how you want to deal with it. If you are only going to be accessing a member of a namespace once or twice, then adding the "using" statement really doesn't do much for you. </p>
<p>If you are going to use it multiple times then reducing the namespace chain is probably going to make things eas... | 9,213 |
<p>The default generated hashCode and equals implementations are ugly at best.</p>
<p>Is it possible to make eclipse generate ones from HashCodeBuilder and EqualsBuilder, and perhaps even a toString with ToStringBuilder?</p>
| <p>Take a look at <a href="http://marketplace.eclipse.org/content/commons4e" rel="noreferrer">Commons4E</a></p>
<p>It hasn't been updated in a while, but then I don't guess it needs to change much?</p>
<p>Update: Just checked against 3.4.1 and it works fine.</p>
| <p>Eclipse java code templates for eclipse 3.5.0, derived from Bruno Conde's templates:</p>
<pre><code>@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
} else if (obj == this) {
return true;
} else if (obj.getClass() != this.getClass()) {
return false;
... | 35,564 |
<p>I'm looking to buy my first 3D Printer, on a tight budget of $250. Unfortunately, this printer that I found on Amazon comes with all the bells and whistles, <em>except</em> for a heated bed. </p>
<p>I want to know if this would affect printing severely, as I have read that the plastic/ filament cools down rather qu... | <p>I've tried to reduce the "Extrusion multiplier" from 1 to 0.95, but that caused gaps. Now I've minimized the clicking by setting the Slic3r option "Infill before perimeters" on the "Print Settings > Infill" page.</p>
| <p>I had this issue and it turned out to be the extruder cog rubbing on the inside of the hole in the heatsink, causing the stepper to slip. </p>
| 453 |
<p>Are there any specific type of FDM 3D printers that I should look for?</p>
| <p>and welcome to 3D Printing Stack Exchange.</p>
<p>No. Not all 3D printers can print flexible material.</p>
<p>The first place you will have trouble is in the extruder itself. Flexible filament will find any way to escape from the confines of the rollers and the guide tube. Any opening will allow the filament to... | <p>Not all printers are suitable to print flexible filament. E.g. 1.75 mm filament printers with a Bowden extruder/hotend combination will not work (you may have more luck using 2.85 mm filament, which is stiffer because of the increased diameter). For 1.75 mm filament you require a direct drive extruder, e.g. with the... | 1,019 |
<p>If any one can help me with Python code:
If I input a letter, How can I print all the words start with that word?</p>
| <pre><code>print [word for word in words if word.startswith(letter)]
</code></pre>
| <p>There are many ways of doing this, e.g.:</p>
<pre><code>words = ["zwei", "peanuts", "were", "walking", "down", "the", "strasse"]
letter = "w"
output = [x for x in words if x[0] == letter]
</code></pre>
<p>The contents of <code>output</code> will be:</p>
<pre><code>['were', 'walking']
</code></pre>
<p>Some notes:... | 39,277 |
<p>If I want to have a case-insensitive string-keyed dictionary, which version of StringComparer should I use given these constraints:</p>
<ul>
<li>The keys in the dictionary come from either C# code or config files written in english locale only (either US, or UK)</li>
<li>The software is internationalized and will r... | <p>There are three kinds of comparers:</p>
<ul>
<li>Culture-aware</li>
<li>Culture invariant</li>
<li>Ordinal</li>
</ul>
<p>Each comparer has a <strong>case-sensitive</strong> as well as a <strong>case-insensitive</strong> version.</p>
<p>An <strong>ordinal</strong> comparer uses ordinal values of characters. This i... | <p>The Invariant Culture exists specifically to deal with strings that are internal to the program and have nothing to do with user data or UI. It sounds like this is the case for this situation.</p>
| 22,816 |
<p>I am using <a href="http://www.svnkit.com" rel="nofollow noreferrer">SVNKit</a> in my application. I have a scenario wherein certain files should be ignored when doing svn operations. i.e. I need to set the svn:ignore property for certain patterns.</p>
<p>How do I do that using SVNKit?</p>
| <p>You could use the <a href="http://svnkit.com/kb/javadoc/org/tmatesoft/svn/core/wc/ISVNOptions.html" rel="nofollow noreferrer">ISVNOptions</a> class.</p>
<p>It has a <a href="http://svnkit.com/kb/javadoc/org/tmatesoft/svn/core/wc/ISVNOptions.html#addIgnorePattern%28java.lang.String%29" rel="nofollow noreferrer"><cod... | <p>The argument list is (file, propName, propValue, force, recursive, IPropertyHandler).</p>
<p>So if you want to recursively apply a property, just set it 5th argument(recursive) to true.</p>
| 46,315 |
<p>I have two (UNIX) programs A and B that read and write from stdin/stdout.</p>
<p>My first problem is how to connect the stdout of A to stdin of B <em>and</em> the stdout of B to the stdin of A. I.e., something like A | B but a bidirectional pipe. I suspect I could solve this by <a href="http://tldp.org/LDP/abs/html... | <p><a href="http://bisqwit.iki.fi/source/twinpipe.html" rel="noreferrer">http://bisqwit.iki.fi/source/twinpipe.html</a></p>
| <p>I'd suggest "coproc":</p>
<pre><code>#! /bin/bash
# initiator needs argument
if [ $# -gt 0 ]; then
a=$1
echo "Question $a"
else
read a
fi
if [ $# -gt 0 ]; then
read a
echo "$a" >&2
else
echo "Answer to $a is ..."
fi
exit 0
</code></pre>
<p>Then see this session:</p>
<pre><code>$ coproc ./dia... | 16,873 |
<p>I am a developer. An architect on good days. Somehow I find myself also being the DBA for my small company. My background is fair in the DB arts but I have never been a full fledged DBA. My question is what do I have to do to ensure a realiable and reasonably functional database environment with as little actual... | <p>Who else is involved in the database? Are you the only person making schema changes (creating new objects, releasing new stored procedures, permissioning new users)? </p>
<ul>
<li>Make sure that the number of users doing anything that could impact performance is reduced to as close to zero as possible, ideally incl... | <p>I would suggest:</p>
<ul>
<li>A script to quickly restore the latest backup of a database, in case it gets corrupted</li>
<li>What kind of backups are you doing? Full backups each day, or incremental every hour, etc?</li>
<li>Some scripts to create new users and grant them basic access.</li>
</ul>
<p>However, the... | 5,582 |
<p>I'm fairly new to Castle Windsor and am looking into the in's and out's of the logging facility. It seems fairly impressive but the only thing i can't work out is where Windsor sets the Logger property on my classes. As in the following code will set Logger to the nullLogger if the class hasn't been setup yet but wh... | <p>The logger is setup by the logging facility, which is in the <code><facilities></code> section of the configuration. For example to use log4net your app or web.config would look something like this:</p>
<pre><code><?xml version="1.0"?>
<configuration>
<configSections>
<sectio... | <p>Since you have a public Property with a Setter, every time you resolve your object from Windsor, it will also try to set any public properties with appropriate values from the container (in your case, an ILogger which your facility will populate into Windsor).</p>
<p>Meaning, if you resolve the Class from Windsor, ... | 30,438 |
<p>With so many ways to attack a site, it would be useful if there is a single guide, or resource, listing all known vunerabilties with possible preventative measures. Does anyone know of any?</p>
<p>Also, is there a library or framework that can deal with this kind of thing?</p>
| <p>ASP.NET does a good job of taking care of most security issues for you. Security is built into the framework. I would recommend reading some articles like these:</p>
<ul>
<li><a href="http://www.devx.com/dotnet/Article/32493" rel="nofollow noreferrer">Top 10 Security Vulnerabilities in .NET Configuration Files</a><... | <p>Check the OWASP development guide at www.owasp.org. It's a bit dated (2005), but it has information on many security issues regarding web applications. </p>
<p>I'm not aware of any single library or framework for dealing with this. That really depends on what technology and application frameworks you are employi... | 28,420 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.