instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>We have our own ORM we use here, and provide strongly typed wrappers for all of our db tables. We also allow weakly typed ad-hoc SQL to be executed, but these queries still go through the same class for getting values out of a data reader.</p>
<p>In tweaking that class to work with Oracle, we've come across an inte... | <p>I find it better to use null, instead of DB null.</p>
<p>The reason is because, as you said, you're separating yourself from the DB world.</p>
<p>It is generally good practice to check reference types to ensure they aren't null anyway. You're going to be checking for null for things other than DB data, and I find ... | <p>Use <code>DBNull</code>.<br>
We encouintered some sort of problems when using null.<br>
If I recall correctly you cannot INSERT a null value to a field, only DBNull.<br>
Could be Oracle related only, sorry, I do not know the details anymore.</p>
| 3,390 |
<p>When I compile an application with VS2008 I sometimes end up with 2 identical config files:</p>
<ul>
<li>*.exe.config</li>
<li>*.vshost.exe.config</li>
</ul>
<p>What is the latter one for?</p>
| <p>Here's a blog post that talks about the vshost process and its purpose.</p>
<p><a href="http://blogs.msdn.com/dtemp/archive/2004/08/17/215764.aspx" rel="noreferrer">http://blogs.msdn.com/dtemp/archive/2004/08/17/215764.aspx</a></p>
| <p>I noticed something else about this behaviour.</p>
<p>Whilst VS WILL create a config called [appname].vshost.exe.config, the API call:</p>
<pre><code>var s = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile
</code></pre>
<p>does not return this name, rather it returns: [appname].config</p>
<p>This was ... | 36,161 |
<p>According to <a href="http://git-scm.com/docs/git-svn" rel="noreferrer">the manual</a>, <code>git dcommit</code> “will create a revision in SVN for each commit in git.” But is there a way to avoid multiple Subversion revisions? That is, to have git merge all changes prior to performing the <code>svn commit</code>?</... | <p>If you work on a branch in git, you can <a href="http://git-scm.com/docs/git-merge" rel="nofollow noreferrer"><code>git-merge --squash</code></a>, which does that within git. You could then push that one squashed commit to SVN.</p>
<p>Of course, lots of small commits are good, so why would you want to squash them?... | <p><a href="http://tomayko.com/writings/the-thing-about-git" rel="noreferrer">Ryan Tomayko</a> wrote a bit about <code>git rebase -i</code>, which he said:</p>
<blockquote>
<p>…[it's] a bit like git commit --amend hopped up on acid and holding a chainsaw – completely insane and quite dangerous but capable of exposin... | 19,171 |
<p>By default it seems that objects are drawn front to back. I am drawing a 2-D UI object and would like to create it back to front. For example I could create a white square first then create a slightly smaller black square on top of it thus creating a black pane with a white border. <a href="http://gpwiki.org/index... | <p>The following call will turn off depth testing causing objects to be drawn in the order created. This will in effect cause objects to draw back to front.</p>
<pre><code>glDepthFunc(GL_NEVER); // Ignore depth values (Z) to cause drawing bottom to top
</code></pre>
<p>Be sure you do not call this:</p>
<pre><c... | <p>As AlanKley pointed out, the way to do this is to disable the depth buffer. The painter's algorithm is really a 2D scan-conversion technique used to render polygons in the correct order when you don't have something like a z-buffer. But you wouldn't apply it to 3D polygons. You'd typically transform and project them... | 22,443 |
<p>I have a form that excepts a file upload in ASP.NET. I need to increase the max upload size to above the 4 MB default.</p>
<p>I have found in certain places referencing the below code at <a href="http://msdn.microsoft.com/en-us/library/system.web.configuration.httpruntimesection.maxrequestlength.aspx" rel="noreferr... | <p>This setting goes in your web.config file. It affects the entire application, though... I don't think you can set it per page.</p>
<pre class="lang-xml prettyprint-override"><code><configuration>
<system.web>
<httpRuntime maxRequestLength="xxx" />
</system.web>
</configuration>... | <p>If you use sharepoint you should configure max size with Administrative Tools too:
<a href="http://support.microsoft.com/kb/925083" rel="nofollow">kb925083</a></p>
| 36,743 |
<p>So I'm looking at writing an iPhone application that shows things on a map. What frameworks/methodologies are out there for doing this?</p>
<p>Searching around on Google, I could only find this one:
<a href="http://code.google.com/p/iphone-google-maps-component/" rel="nofollow noreferrer">http://code.google.com/p/i... | <p>I'm pretty sure your only options for now are:</p>
<ol>
<li>Call openURL: to switch to the Maps app</li>
<li>Use the Google Maps component you linked to</li>
<li>Roll your own thing</li>
<li>Wait for Apple to expose a "MapKit" framework</li>
</ol>
| <p>just use mapkit framework.really good</p>
<p>alternatively: <code>[[uiapplication sharedapplication]openurl:@"www.maps.google.com];</code><br/>
that will open the google map,but one problem with this is that it will navigate you to safari and your application will be exited and if you want to move back to your appl... | 13,292 |
<p>I have 3 versions of the same assembly in the GAC (Global Assembly Cache), but i physically need a specific version, when going into the framework folder i.e.</p>
<p>c:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\ </p>
<p>the assembly located in the folder is the latest version. </p>
<p>Can i physically retrieve th... | <p>Should be able to do that with the <a href="http://www.codeproject.com/KB/system/gacapi.aspx" rel="nofollow noreferrer">GAC Api</a>. </p>
| <p>gacutil /l <assembly_name></p>
| 30,392 |
<p>I'm looking for the equivalent of the Unix 'tail' command that will allow me to watch the output of a log file while it is being written to.</p>
| <p>If you use PowerShell then this works: </p>
<pre><code>Get-Content filenamehere -Wait -Tail 30
</code></pre>
<p>Posting Stefan's comment from below, so people don't miss it </p>
<p>PowerShell 3 introduces a -Tail parameter to include only the last x lines </p>
| <p>I'm using <em>Kiwi Log Viewer</em>. It's free.</p>
| 22,725 |
<p>I'm using EPIC, but it seems to have some drawbacks. Are there any other Perl plugins for Eclipse?</p>
| <p>There does not seem to be any other serious eclipse plugin for Perl out there, aside EPIC.</p>
<p>Regarding the problematic behaviors, did you check the question <a href="https://stackoverflow.com/questions/373282">Why does the EPIC eclipse plugin not show any info in “Explain Errors/Warnings”?</a> and its associat... | <p>A new plugin is Perlipse <a href="http://www.eclipseplugincentral.com/Web_Links-index-req-viewlink-cid-1133.html" rel="nofollow noreferrer">http://www.eclipseplugincentral.com/Web_Links-index-req-viewlink-cid-1133.html</a>
It is far from complete atm.</p>
| 49,347 |
<p>I've been looking for a <em>simple</em> Java algorithm to generate a pseudo-random alpha-numeric string. In my situation it would be used as a unique session/key identifier that would "likely" be unique over <code>500K+</code> generation (my needs don't really require anything much more sophisticated). </p>
<p>Id... | <h2>Algorithm</h2>
<p>To generate a random string, concatenate characters drawn randomly from the set of acceptable symbols until the string reaches the desired length.</p>
<h2>Implementation</h2>
<p>Here's some fairly simple and very flexible code for generating random identifiers. <em>Read the information that follow... | <p>Yet another solution...</p>
<pre><code>public static String generatePassword(int passwordLength) {
int asciiFirst = 33;
int asciiLast = 126;
Integer[] exceptions = { 34, 39, 96 };
List<Integer> exceptionsList = Arrays.asList(exceptions);
SecureRandom random = new SecureRandom();
String... | 6,239 |
<p>I'm sure this must be possible, but I can't find out how to do it.</p>
<p>Any clues?</p>
| <p>Use:</p>
<pre><code>ii .
</code></pre>
<p>which is short for</p>
<pre><code>Invoke-Item .
</code></pre>
<p>It is one of the most common things I type at the PowerShell command line.</p>
| <p>I wanted to write this as a comment but I do not have 50 reputation. </p>
<p>All of the answers in this thread are essentially to use Invoke-Item or to use explorer.exe directly; however, this isn't completely synonymous with "open containing folder", so in terms of opening an Explorer window as the question states... | 41,464 |
<p>I am calling an executable in C#. When the executable runs, it writes out to the console so the C# code is getting the console output and writing it to a text file. When the crash happens a couple of things occur.</p>
<p>1) The output of the text file is not completely written out.
2) The executable process seems t... | <p>Try adding a flush after the tw.Write. That should cause the complete output up to the point of failure to be produced, which may include error messages from the executable (if that's what is crashing?)</p>
| <p>I've tested your code with a number of different executables and was unable to get it to crash the way you describe. Maybe it's an issue with the process you're executing?</p>
| 46,107 |
<p>I am trying to use onkeypress on an input type="text" control to fire off some javascript if the enter button is pressed. It works on most pages, but I also have some pages with custom .NET controls.</p>
<p>The problem is that the .NET submit fires before the onkeypress. Does anybody have an insight on how to mak... | <p>I strongly suspect that GetType() will take significantly less time than any actual logging. Of course, there's the possibility that your call to Logger.Log won't do any actual IO... I still suspect the difference will be irrelevant though.</p>
<p>EDIT: Benchmark code is at the bottom. Results:</p>
<pre><code>type... | <p>I get very different results.<br/>
For this I created a new console app in another project, and used a class with inheritance.<br/>
<br/>
I created an empty loop to withdraw from the results, for a clean comparison.<br/>
I created a const and a static for the cycles (manually switching which to use).<br/>
Something ... | 46,017 |
<p>I'm running OSX(10.4.11) & I'm trying to get a decent C(preferably C++) binding for MySQL figured out. I have some data in an offsite database I want to analyze.</p>
<p>I'm trying to get MySQL++ working, but it's being funky. </p>
<p>I'm looking for other bindings, preferably ones with a no-headache install.</... | <p>MySQL Connector/C++ is a C++ implementation of JDBC 4.0 </p>
<p>The reference customers who use MySQL Connector/C++ are:
- OpenOffice - MySQL Workbench</p>
<p>Learn more: <a href="http://forums.mysql.com/read.php?167,221298" rel="nofollow noreferrer">http://forums.mysql.com/read.php?167,221298</a></p>
| <p>You might want to look at <a href="http://soci.sourceforge.net" rel="nofollow noreferrer">SOCI</a>. Although it builds upon the MySQL C API, it presents a much nicer C++-friendly interface than using the C bindings.</p>
| 27,185 |
<p>It seems to me obfuscation is an idea that falls somewhere in the "security by obscurity" or "false sense of protection" camp. To protect intellectual property, there's copyright; to prevent security issues from being found, there's <em>fixing those issues</em>. In short, I regard it as a technical solution to a soc... | <p>You asked for engineering reasons, so this is not strictly speaking an answer to the question. But I think it's a valid clarification.</p>
<p>As you say, obfuscation is intended to address a social problem. And social (or business) problems, unlike technical ones, rarely have a complete solution. There are only deg... | <p>Use encryption to protect information on the way.</p>
<p>Use obfuscation to protect information while your program still has it.</p>
| 5,183 |
<p>As recently as several years ago, the developers actually made the builds that went to clients. This was obviously a disaster for reasons too numerous to list.</p>
<p>Then when we started to learn the errors of our ways, we looked for a way to auto-build the entire application on a dedicated build machine. The cu... | <p>I'm currently using CruiseControl integrated with Ant to control project builds. This allows flexibility of build schedules and means you can automate the entire build process fairly easily using Ant scripts. Also, during defect fixing periods you can have CruiseControl set up to watch for source control submissions... | <p>We use the Hudson buildbot for for big Java web app building from ant build scripts. Hudson is pretty sweet for our purposes. It has a master/slave setup so builds can be done concurrently (on a timer or on-demand). Slave nodes can be any OS/hardware combo provided it has the needed build tools already on it and is ... | 23,203 |
<p>I'm not really sure how to title this question but basically I have an interface like this:</p>
<pre><code>public interface IFoo
{
string ToCMD();
}
</code></pre>
<p>a couple of absract classes which implement IFoo like:</p>
<pre><code>public abstract class Foo : IFoo
{
public abstract string ToCMD();
}
p... | <p>The need for an inheritance chain is questionable, in general. </p>
<p>However the specific scenario of combining an abstract base class with an interface.. I see it this way:</p>
<p>If you have an abstract base class like this, you should also have a corresponding interface. If you have an interface, then use the... | <p>I am not quite sure if this is what you are looking for but perhaps what you want to do is scrap the interface all together and do this:</p>
<pre><code>abstract class Base
{
public abstract string ToCMD();
}
abstract class Foo : Base { }
abstract class Bar : Base { }
</code></pre>
<p>Hopefully you have other... | 49,306 |
<p>What is the simplest way to get: <code>http://www.[Domain].com</code> in asp.net?</p>
<p>There doesn't seem to be one method which can do this, the only way I know is to do some string acrobatics on server variables or Request.Url. Anyone?</p>
| <p>You can do it like this:</p>
<pre><code>string.Format("{0}://{1}:{2}", Request.Url.Scheme, Request.Url.Host, Request.Url.Port)
</code></pre>
<p>And you'll get the <a href="http://www.faqs.org/rfcs/rfc2396.html" rel="nofollow noreferrer">generic URI syntax</a> <protocol>://<host>:<port></p>
| <p>This method handles http/https, port numbers and query strings.</p>
<pre><code>'Returns current page URL
Function fullurl() As String
Dim strProtocol, strHost, strPort, strurl, strQueryString As String
strProtocol = Request.ServerVariables("HTTPS")
strPort = Request.ServerVariables("SERVER_PORT")
s... | 27,493 |
<p>I know that CSS can be used to control the presentation of (X)HTML in modern browsers. I was under the impression that this was possible for arbitrary XML as well. (Am I mistaken?)</p>
<p><strong>A concrete example</strong>: given the following XML</p>
<pre><code><log>
<entry revision="1">
<a... | <p>It is indeed possible to use CSS to format an XML document.</p>
<p><a href="http://www.w3schools.com/Xml/xml_display.asp" rel="nofollow noreferrer">W3 schools example</a></p>
<p>(The W3C do recommend using xslt to do this sort of thing instead CSS though)</p>
| <p>yes it is possible. you simply write a rule for each element:</p>
<pre><code>author{
display:block;
color:#888888;
}
</code></pre>
<p>etc.</p>
| 35,275 |
<p>I asked a question about Currying and closures were mentioned.
What is a closure? How does it relate to currying?</p>
| <h2>Variable scope</h2>
<p>When you declare a local variable, that variable has a scope. Generally, local variables exist only within the block or function in which you declare them.</p>
<pre class="lang-js prettyprint-override"><code>function() {
var a = 1;
console.log(a); // works
}
console.log(a); // fails
<... | <p>Here is another real life example, and using a scripting language popular in games - Lua. I needed to slightly change the way a library function worked to avoid a problem with stdin not being available.</p>
<pre><code>local old_dofile = dofile
function dofile( filename )
if filename == nil then
error( 'Can ... | 5,724 |
<p>Answers to a recent post (Any chances to imitate times() Ruby method in C#?) use the <b>=></b> operator in the usage examples. What does this operator do? I can't locate it in my C# book, and it is hard to search for symbols like this online. (I couldn't find it.)</p>
| <p>It's not really an operator as such, it's part of the syntax for lambda expressions. In particular => is the bit which separates the parameters from the body of the lambda expression.</p>
<p>Does your book cover C# 3.0? If not, it won't include lambda expressions. If it does, it should really cover them! Hopefully ... | <p>That will be for a lambda expression:</p>
<p><a href="http://msdn.microsoft.com/en-us/library/bb397687.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/bb397687.aspx</a></p>
<p>An example is here:</p>
<pre><code>MyControl.OnMouseDown += (sender, e) =>
{
// Do something in the mouse dow... | 21,513 |
<p>Is there a way to view more than the last 300 lines in the terminal tab on OctoPrint? Or is there a txt file of a log? Or even a setting/plugin that does either?</p>
<p>I keep finding my prints pausing as if I said to change the filament even though that wasn't set in the slicer, but I catch it long after the 300<s... | <p><strong>Yes</strong>, you can show more than 300 lines in the terminal; just <a href="https://github.com/foosel/OctoPrint/commit/e9623fdc36c658a5b8abe7769b1b308edfc3f424" rel="nofollow noreferrer">disable auto scrolling</a> (<a href="https://github.com/foosel/OctoPrint/issues/286#issuecomment-99215149" rel="nofollow... | <p><strong>Yes</strong>, you can show more than 300 lines in the terminal; just <a href="https://github.com/foosel/OctoPrint/commit/e9623fdc36c658a5b8abe7769b1b308edfc3f424" rel="nofollow noreferrer">disable auto scrolling</a> (<a href="https://github.com/foosel/OctoPrint/issues/286#issuecomment-99215149" rel="nofollow... | 1,193 |
<p>I have a question regarding an update function I created...</p>
<pre><code>CREATE OR REPLACE FUNCTION rm_category_update(icompany bpchar, iraw_mat_cat_code bpchar, iraw_mat_cat_desc bpchar)
RETURNS character AS
$BODY$
DECLARE
loc_result CHAR(50);
BEGIN
UPDATE rm_category
SET
raw_mat_cat_code = ... | <p>First of all, a model class shall not talk to a view class. A TextView is part of the view.</p>
<p><a href="http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/Art/cocoa_mvc.gif">alt text http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/Art/cocoa_mvc.gif</a></p>
<... | <p>Re: the recursive <code>#import</code> problem, what you're looking for is the <code>@class</code> directive. In most cases, all your class interface needs to know about other classes is their names, since all of the actual implementation-specific stuff is in your <code>*.m</code> files. The <code>@class</code> di... | 38,633 |
<p>I'm teaching myself Python and my most recent lesson was that <a href="http://dirtsimple.org/2004/12/python-is-not-java.html" rel="noreferrer">Python is not Java</a>, and so I've just spent a while turning all my Class methods into functions.</p>
<p>I now realise that I don't need to use Class methods for what I wo... | <p>Class methods are for when you need to have methods that aren't specific to any particular instance, but still involve the class in some way. The most interesting thing about them is that they can be overridden by subclasses, something that's simply not possible in Java's static methods or Python's module-level func... | <p>A class defines a set of instances, of course. And the methods of a class work on the individual instances. The class methods (and variables) a place to hang other information that is related to the set of instances over all.</p>
<p>For example if your class defines a the set of students you might want class vari... | 5,914 |
<p>Notice in the bottom right hand corner of this page it has the SVN revision id? I'm assuming that's dynamic.</p>
<p>I'd love to add that to some of my sites, just as a comment in the source to make sure code pushes are going through.</p>
<p>NOTE: You can also assume that the working directory of the site in questi... | <p>You can use the <a href="http://svnbook.red-bean.com/en/1.5/svn-book.html#svn.ref.svnversion" rel="nofollow noreferrer"><code>svnversion</code></a> CLI utility to get a more specific look at the revision, including the highest number. You could then use regular expressions to parse this.</p>
<p>Subversion has no co... | <p>Read up on Keyword substitution. See</p>
<p><a href="http://svnbook.red-bean.com/en/1.4/svn.advanced.props.special.keywords.html" rel="nofollow noreferrer">http://svnbook.red-bean.com/en/1.4/svn.advanced.props.special.keywords.html</a></p>
| 17,538 |
<p>There is a GUI ADM2 Progress v9 application using AppServer. </p>
<p>It needs to give users an ability to view MS Excel files stored on the AppServer. So far it:</p>
<ol>
<li>Pulls .xls file from AppServer to a local drive.</li>
<li>Fires up a copy of MS Excel and opens the file.</li>
</ol>
<p>The problem is that... | <p>You can run Excel using the os-command function in Progress and tell it to wait until you're done viewing to come back to the progress code. Once you're out of Excel run the os-delete command against the file.</p>
| <p>If you are "firing up a copy of Excel", is there any special reason you can't just point that "fired-up" Excel application at the file on your App Server?<br>If you are starting Excel from a command-line shell, you could just go <code>Excel.exe "http://myserver/myexcelbook.xls"</code> right?
<br><br>If you are openi... | 18,453 |
<p>Is there a way to know the main/calling request in an httpmodule? I only want my module code to run for the main aspx page, not the images and scripts. I could check the path for ".aspx" but it seems like there should be a better way.</p>
| <p>From your module you could call HttpContext.Current.Handler and see if it is a Page. You'd probably have to do this in the PostMapRequestHandler event or a later event in the life cycle.</p>
<p>Alternatively, maybe you can check which HttpHandlerFactory is being used for the request. If it is the PageHandlerFactory... | <p>IIS won't invoke the ASP.NET handler on images and scripts*, so a HTTPModule should only run on ASPX requests anyways.</p>
<ul>
<li>Unless you mean scripts served by as an embedded resource, ie webresource.axd.</li>
</ul>
| 35,330 |
<p>Is it possible to actually make use of placement new in portable code when using it for arrays?</p>
<p>It appears that the pointer you get back from new[] is not always the same as the address you pass in (5.3.4, note 12 in the standard seems to confirm that this is correct), but I don't see how you can allocate a ... | <p>Personally I'd go with the option of not using placement new on the array and instead use placement new on each item in the array individually. For example:</p>
<pre><code>int main(int argc, char* argv[])
{
const int NUMELEMENTS=20;
char *pBuffer = new char[NUMELEMENTS*sizeof(A)];
A *pA = (A*)pBuffer;
for... | <p>I think gcc does the same thing as MSVC, but of course this doesn't make it "portable".</p>
<p>I think you can work around the problem when NUMELEMENTS is indeed a compile time constant, like so:</p>
<p><code>
typedef A Arr[NUMELEMENTS];</p>
<p>A* p = new (buffer) Arr;
</code></p>
<p>This should use the scalar p... | 3,607 |
<p>I'm wondering where the callbacks are (or if there are anything) for animations in a CALayer. Specifically, for implied animations like altering the frame, position, etc. In a UIView, you could do something like this:</p>
<pre><code>[UIView beginAnimations:@"SlideOut" context:nil];
[UIView setAnimationDuration:.3];... | <p>I answered my own question. You have to add an animation using <code>CABasicAnimation</code> like so:</p>
<pre><code>CABasicAnimation* anim = [CABasicAnimation animationWithKeyPath:@"frame"];
anim.fromValue = [NSValue valueWithCGRect:layer.frame];
anim.toValue = [NSValue valueWithCGRect:frame];
anim.delegate = self... | <p>You can set the name of a given animation when setting up the CAAnimation object. In animationDiStop:finished, just compare the name of theAnimation object provided to perform you specific functionality based on the animation.</p>
| 37,980 |
<p>In SQL Server 2005, I want to print out a blank line with the PRINT statement, however, when I run</p>
<pre><code>PRINT ''
</code></pre>
<p>it actually prints a line with a single space.</p>
<p>Does anyone know if it's possible to just print a blank line without the space?</p>
<p>If I print a new line character,... | <p>You could just add a newline on your previous print statement, if you have one.</p>
<p>Instead of:</p>
<pre><code>PRINT 'BLABLABLA'
PRINT ''
</code></pre>
<p>You could write:</p>
<pre><code>PRINT 'BLABLABLA
' <- the string finishes here!
</code></pre>
| <p>AFAIK there is no way around this, it is the way the print statement works</p>
| 34,276 |
<p>I recently tried switching from using <code>python-mode.el</code> to <code>python.el</code> for editing python files in emacs, found the experience a little alien and unproductive, and scurried back. I've been using <code>python-mode.el</code> for something like ten years, so perhaps I'm a little set in my ways. I... | <p>For what it's worth, I do not see the behavior you are seeing in issue #1, "Each buffer visiting a python file gets its own inferior interactive python shell."</p>
<p>This is what I did using python.el from Emacs 22.2.</p>
<p>C-x C-f foo.py
[insert: print "foo"]</p>
<p>C-x C-f bar.py
[insert: print "bar"]</p>
<p... | <p>Debian has deleted the python-mode package, alas, so I felt compelled to try python.el. I loaded it and ran "describe-bindings". It appeared to be designed for elisp coders who think <code>c-X ;</code> is the intuitive binding for commenting a line of Python code. (Wow.) Also, I found no way at all to ... | 47,318 |
<p>I'd like to generate unique random numbers between 0 and 1000 that never repeat (i.e. 6 doesn't show up twice), but that doesn't resort to something like an O(N) search of previous values to do it. Is this possible?</p>
| <p>Initialize an array of 1001 integers with the values 0-1000 and set a variable, max, to the current max index of the array (starting with 1000). Pick a random number, r, between 0 and max, swap the number at the position r with the number at position max and return the number now at position max. Decrement max by... | <p>Someone posted "creating random numbers in excel". I am using this ideal.
Create a structure with 2 parts, str.index and str.ran;
For 10 random numbers create an array of 10 structures.
Set the str.index from 0 to 9 and str.ran to different random number.</p>
<pre><code>for(i=0;i<10; ++i) {
arr[i].index =... | 23,817 |
<p><code>:vimgrep</code> looks like a really useful thing.</p>
<p>Here's how to use it:</p>
<pre><code>:vim[grep][!] /{pattern}/[g][j] {file} ...
</code></pre>
<p><code>:help</code> says that you can essentially glob <code>{file}</code> to name, say, <code>*.c</code> for the current directory. I may have started Vi... | <p>Can't you catch the result in these commands into a register (<code>:h :redir</code>), and insert it back into <code>:vimgrep</code> call (with a <code>:exe</code>).</p>
<p>Something like:</p>
<pre><code>:exe "vimgrep/pattern/ " . lh#askvim#Exe(':args')
</code></pre>
<p>Notes:</p>
<ul>
<li><a href="https://githu... | <p>Very helpful script !
A minor fix: The search finds one of the buffers twice - first time as the numbered buffer, second as buffer #0 => alternate buffer.
Hence, we shall change the line to "<strong>range(1, bufnr('$'))</strong>" to skip the alternate buffer and show the search results once.</p>
| 34,126 |
<p>Is it possible to connect two pieces of 1.75 mm filament end to end, with no change in width? I am asking the question because I am interested in creating a multi-filament feeder to a single extruder, and I am curious about the process of changing filament while the 3-d printer extruder continues uninterrupted. My c... | <p>You'd have to ensure that the joining portion of the two filaments do not "bloom" or increase in diameter, which would happen if unconstrained at the melting and joining time. Alignment is also critical, otherwise you have a varying diameter from one color to the next at the point of join.</p>
<p>There's an item on... | <p>I haven't tried this but it is something I have thought about. The simplest way to try this that I could think of was to try cutting the ends flat and then using a soldering iron or just the printers printing nozzle to melt the ends and then quickly press them together, then you could sand the filamelt to try and cl... | 316 |
<p>I'm working on a database in SQL Server 2000 that uses a GUID for each user that uses the app it's tied to. Somehow, two users ended up with the same GUID. I know that microsoft uses an algorithm to generate a random GUID that has an extremely low chance of causing collisons, but is a collision still possible?</p>
| <p>Basically, no. I think someone went mucking with your database. Depending on the version GUID you're using the value is either unique (for things like version 1 GUIDs), or both unique and unpredictable (for things like version 4 GUIDs). SQL Server's implementation for their NEWID() function appears to use a 128-b... | <p>Sure it's possible, and maybe even likely. It's not like each GUID is in a random portion of the possible number space. In the event that two threads attempted to generate one simultaneously, barring some kind of centralized GUID function with a semaphore around it, they could end up with the same value.</p>
| 22,360 |
<p>I'm trying to add a pojo to a collection in another pojo. I'm sure I'm making a really stupid mistake somewhere along the lines but I can't figure out how to solve it.</p>
<p>I have a pojo LookupTable which contains a list of Columns:</p>
<pre><code>public class LookupTable {
private long id;
// More propertie... | <p>Turns out I didn't have a transaction at all. I used almost the same transaction configuration in one of my other config files. </p>
<p>The pointcut over there was also called "managers", so my advisor here was referencing the pointcut in the other file.</p>
<p><em>Renaming the pointcut solved my problem.</em></p>... | <p>If you only want a transaction over a part of your code you can use something like this:</p>
<pre><code>import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
</code></pre>
<p>and in the class:</p>
<pre><code>@Autowired private SessionFactory sessionFactory;
</code></... | 27,237 |
<p>Whilst trawling through some old code I came across something similar to the following:</p>
<pre><code>class Base
{
public:
virtual int Func();
...
};
class Derived : public Base
{
public:
int Func(); // Missing 'virtual' qualifier
...
};
</code></pre>
<p>The code compiles fine (MS VS2008) with no... | <p>The <code>virtual</code> will be carried down to all overriding functions in derived classes. The only real benefit to adding the keyword is to signify your intent a casual observer of the Derived class definition will immediately know that <code>Func</code> is virtual.</p>
<p>Even classes that extend Derived will ... | <p>Someone told me once that very old C++ compilers, not conforming to the spec, require virtual to be set for all subclasses. That's not an issue anymore.</p>
| 44,235 |
<p><strong>Emacs</strong>: <code>C-U (79) #</code> » a pretty 79 character length divider</p>
<p><strong>VIM</strong>: <code>79-i-#</code> » see above</p>
<p><strong><a href="http://macromates.com/" rel="nofollow noreferrer">Textmate</a></strong>: ????</p>
<p>Or is it just assumed that we'll make a Rub... | <p>I would create a bundle command to do this.</p>
<p>You can take editor selection as input to your script, then replace it with the result of execution. This command, for example, will take a selected number and print the character '#' that number of times.</p>
<pre><code>python -c "print '#' * $TM_SELECTED_TEXT"
... | <p>By taking the</p>
<pre><code>python -c "print '#' * $TM_SELECTED_TEXT"
</code></pre>
<p>a step further, you can duplicate the examples you gave in the question. </p>
<p>Just make a snippet, called divider or something, set the <code>tab trigger</code> field to something appropriate <code>'--'</code> for example, ... | 8,990 |
<p>Since I have started using this site, I keep hearing about the Boost library. I am wondering what are some of the major benefits of the Boost library (hence why should I use it) and how portable is the Boost library?</p>
| <p>Boost is organized by several members of the standard committee.<br />
So it is a breeding ground for libraries that will be in the next standard.</p>
<ol>
<li>It is an extension to the STL (it fills in the bits left out)</li>
<li>It is well documented.</li>
<li>It is well peer-reviewed.</li>
<li>It has high activit... | <p>Also note most of boost is templates so does not require building<br>
(just include the correct header files). </p>
<p>The few parts that do require building are optional:<br>
These can each be built independently thus preventing unnecessary bloat for unneeded code.</p>
| 17,991 |
<p>Example:</p>
<pre><code>select ename from emp where hiredate = todate('01/05/81','dd/mm/yy')
</code></pre>
<p>and </p>
<pre><code>select ename from emp where hiredate = todate('01/05/81','dd/mm/rr')
</code></pre>
<p>return different results</p>
| <p><a href="http://oracle.ittoolbox.com/groups/technical-functional/oracle-dev-l/difference-between-yyyy-and-rrrr-format-519525" rel="noreferrer">http://oracle.ittoolbox.com/groups/technical-functional/oracle-dev-l/difference-between-yyyy-and-rrrr-format-519525</a></p>
<blockquote>
<p>YY allows you to retrieve just ... | <p>RR stands for after 1990 and yy assumes 90 as 2090....as we are in the current yr,...</p>
| 3,956 |
<p>Is it possible to delete a middle node in the single linked list when the only information available we have is the pointer to the node to be deleted and not the pointer to the previous node?After deletion the previous node should point to the node next to deleted node. </p>
| <p>It's definitely more a quiz rather than a real problem. However, if we are allowed to make some assumption, it can be solved in O(1) time. To do it, the strictures the list points to must be copyable. The algorithm is as the following:</p>
<p>We have a list looking like: ... -> Node(i-1) -> Node(i) -> Node(i+1) -> ... | <pre><code>Void deleteMidddle(Node* head)
{
Node* slow_ptr = head;
Node* fast_ptr = head;
Node* tmp = head;
while(slow_ptr->next != NULL && fast_ptr->next != NULL)
{
tmp = slow_ptr;
slow_ptr = slow_ptr->next;
fast_ptr = fast_ptr->next->next;
}... | 9,464 |
<p>Where can I find either literature or video demonstration of unit testing applications using VB.NET? As a novice/hobbyist programmer I would like to build a solid foundation in developing applications using the unit testing methodology.</p>
| <p>If it helps any, you may want to learn C# if you plan on staying in the .NET world and ever plan to use .NET professionally. I've answered why <a href="https://stackoverflow.com/questions/260325/which-net-programming-language-should-i-learn-as-a-web-developer#260389">here</a>. Now, on to your question: O'Reilly an... | <p>You can find some info on <a href="http://www.typemock.com/vbpage.php" rel="nofollow noreferrer">unit testing vb</a> on Typemock’s site</p>
| 37,640 |
<p>Given a point (pX, pY) and a circle with a known center (cX,cY) and radius (r), what is the shortest amount of code you can come up with to find the point on the circle closest to (pX, pY) ?</p>
<p>I've got some code kind of working but it involves converting the circle to an equation of the form (x - cX)^2 + (y - ... | <p>where P is the point, C is the center, and R is the radius, in a suitable "mathy" language:</p>
<pre><code>V = (P - C); Answer = C + V / |V| * R;
</code></pre>
<p>where |V| is length of V.</p>
<p>OK, OK</p>
<pre><code>double vX = pX - cX;
double vY = pY - cY;
double magV = sqrt(vX*vX + vY*vY);
double aX = cX + v... | <p>Here is a simple method I use in unity... for the math kn00bs amongst us.
Its dependent on the transform orientation but it works nicely. I am doing a postion.z = 0 but just fatten the axis of the 2d circle you are not using.</p>
<pre><code>//Find closest point on circle
Vector3 closestPoint = transform.InverseTrans... | 38,582 |
<p>Is it absolutely critical that I always close Syslog when I'm done using it? Is there a huge negative impact from not doing so?</p>
<p>If it turns out that I definitely need to, what's a good way to do it? I'm opening Syslog in my class constructor and I don't see a way to do class destructors in Ruby, and currentl... | <p>The open method accepts a block. Do something like this:</p>
<pre><code>class Foo
def do_something
Syslog.open do
# work with the syslog here
end
end
end
</code></pre>
| <p>It looks like you're opening it as a class variable... so the proper way would be to do...</p>
<pre><code>class Foo
def initialize
@@log = Syslog.open("foo")
end
def Foo.finalize(id)
@@log.close if @@log
end
end
</code></pre>
<p>Though this is not necesssarily predictable or supported. It's the wa... | 13,693 |
<p>What is the most elegant way to solve this:</p>
<ul>
<li>open a file for reading, but only if it is not already opened for writing</li>
<li>open a file for writing, but only if it is not already opened for reading or writing</li>
</ul>
<p>The built-in functions work like this</p>
<pre><code>>>> path = r"... | <p>I don't think there is a fully crossplatform way. On unix, the fcntl module will do this for you. However on windows (which I assume you are by the paths), you'll need to use the win32file module.</p>
<p>Fortunately, there is a portable implementation (<a href="https://github.com/WoLpH/portalocker" rel="noreferre... | <p>To make you safe when opening files within one application, you could try something like this:</p>
<pre><code>import time
class ExclusiveFile(file):
openFiles = {}
fileLocks = []
class FileNotExclusiveException(Exception):
pass
def __init__(self, *args):
sMode = 'r'
sFileN... | 22,528 |
<p>In IntelliJ when editing Java files <kbd>CTRL</kbd>+LEFTCLICK on an identifier takes me to where that identifier is defined. For some reason it doesn't work when editing Ruby code. Any ideas?</p>
| <p>This is because the program doesn't know where to find that identifier... it's more of a program use question than a programming problem.</p>
| <p>No, this is not the case. When I hover over the identifier, in 95% of cases IntelliJ is able to work out precisely what the identifier is (local variable, member variable, class etc) and show me the fully qualified class name etc in a tool tip. </p>
<p>Even the holding <kbd>CTRL</kbd> and hovering over the identif... | 11,822 |
<p>Someone at work just asked for the reasoning behind having to wrap a wait inside a synchronized.</p>
<p>Honestly I can't see the reasoning. I understand what the javadocs say--that the thread needs to be the owner of the object's monitor, but why? What problems does it prevent? (And if it's actually necessary, w... | <p>If the object does not own the object monitor when it calls Object.wait(), it will not be able to access the object to setup a notify listener until the the monitor is released. Instead, it will be treated as a thread attempting to access a method on a synchronized object.</p>
<p>Or to put it another way, there is ... | <p>Here's my understanding on why the restriction is actually a requirement. I'm basing this on a C++ monitor implementation I made a while back by combining a mutex and a condition variable. </p>
<p>In a <em>mutex+condition_variable=monitor</em> system, the <a href="http://www.opengroup.org/onlinepubs/007908775/xsh... | 28,004 |
<p>Would you (or your customers) rather download a 1mb installer and perhaps be prompted to download and install .NET, or a 23mb installer and never need to even know what .NET is?</p>
<p>Chris</p>
| <p>I'd recommend the 1mb installer or "bootstrapper" approach. Unless you're going cutting edge, most Windows machines out there now have the 2.0 framework already installed on them, and getting the application downloaded and installed fast is typically on most users minds.</p>
| <p>I would rather have one install put one and exactly one piece of software on my machine. When we deploy to our customers, we want to be able to control the installation of dependencies ourselves.</p>
<p>EDIT: Note that I am speaking of an enterprise environment where we centrally manage software deployment to our c... | 25,674 |
<p>I'm using reflection to get the Authorize Attributes from controllers and methods.</p>
<p>Since I will need to get this information over and over I'm wondering if it is faster to cache it or to simply continue to use reflection to get it.</p>
<p>Any thoughts?</p>
| <p>The problem only happens when <code><System.Runtime.CompilerServices.Extension()></code> is present.
The VB compiler imposes a restriction that the constraints must be verifiable with the first argument alone. Since the first argument for the extension method (<code>Dictionary(Of KeyType, ListType)</code>) is... | <p>I would suspect that the problem is that you used ValueType for as the name for one of the type parameters, which is an actual type in the .NET class library (System.ValueType). I can imagine that C# and VB.NET handles this differently. Try it with a different name, like TValue (and TKey just to be consistent).</p>
| 44,321 |
<p>Please recommend me a simple web-based document repository for keeping my small company documents (.DOCs, .PDFs) so i can access them from everywhere. There are many available on the internet, but they are heavy and filled with unnecessary features and requirements.</p>
<p>I have little requirements: pleasant inter... | <p>The most simple, and probably easiest to set up, would be a Subversion repository, so you can actually store, delete, add, and modify documents from anywhere, and then add ViewVC on top of it so that you can see the different files from a web browser.</p>
<p>Another possible option, although it is a little bit more... | <p><a href="http://docs.google.com/" rel="nofollow noreferrer">Google docs</a></p>
<p>Not exactly what you're asking for, but great for creating and sharing documents online.</p>
| 26,050 |
<p>So far I've read some blog articles about cloud computing and services for hosting applications in the grid. </p>
<p>If I'd wanted to have a web application running in the cloud for as little cost as possible, what would be the best solution?</p>
<p>Let's assume the following configuration:</p>
<ul>
<li>J2EE web ... | <p>This space is changing very quickly right now so I think you will find a lot of different good answers. If I where to do something on the cheap right now I would probably pick the following stack:</p>
<ul>
<li>Web server: apache</li>
<li>App server: tomcat - use the <a href="http://tomcat.apache.org/tomcat-5.5-doc/... | <p>I think you can get no where closer to <a href="http://jelastic.com" rel="nofollow">Jelastic</a>. It has all the stuffs that @carson mentioned. Specially I will mention their unique web console and they do not have any dependency for any API or console to be installed. I use their platform for many of the clients fo... | 42,460 |
<p>Has anyone used Mono, the open source .NET implementation on a large or medium sized project? I'm wondering if it's ready for real world, production environments. Is it stable, fast, compatible, ... enough to use? Does it take a lot of effort to port projects to the Mono runtime, or is it really, really compatible e... | <p>I've used it for a number of internal and commercial projects with great success. My warnings:</p>
<ul>
<li>Write lots of unit tests and make sure they ALL pass under Mono -- this will save you a lot of trouble.</li>
<li>Unless you absolutely have to, do NOT use their embedding API. It's damn easy to use, but it'... | <p>I've got a bunch of shell apps in production.</p>
<p>I agree with @cody-brocious, write a lot of unit tests. I found in the past that Regular Expressions didn't work exactly the same way as the windows CLR. </p>
<p>It's actually simplier than you think to get into, just compile and run. If you use NAnt on your pro... | 21,938 |
<p>I have a query that has 7 inner joins (because a lot of the information is distributed in other tables), a few coworkers have been surprised. I was wondering if they should be surprised or is having 7 inner joins normal?</p>
| <p>it's not unheard of, but I would place it into a view for ease of use, and maintenance</p>
| <p>I think what you want to avoid is a join depth greater than 7. 7 inner joins of less than 7 joins in depth certainly isn't unheard of, but sometimes people hear "7 joins" and think the no-no is 7 joins, not depth.</p>
| 31,757 |
<p>We are working on an inquiry management system using J2EE. We're looking at a feature, allowing users to send inquiries to particular mail-id and entering into the database. Catch is to automatically allocate it to some categories. </p>
| <p>You'll notice that the docs indicate that NAnt's <a href="http://nant.sourceforge.net/release/0.85/help/tasks/solution.html" rel="noreferrer"><code><solution</code>></a> task doesn't support solution files newer than VS2003. </p>
<p>I recommend using <a href="http://nantcontrib.sourceforge.net/release/0.85/help/... | <p>See <a href="https://stackoverflow.com/questions/426199/building-the-platform-code-with-nant-and-vs2008/543648#543648">Building the platform code with nant and VS2008</a></p>
<p>This is here on Stack overflow. Basically you only have a couple of options, control all the builds yourself with project build files, co... | 42,481 |
<p>Let's say you have a two dimensional plane with 2 points (called a and b) on it represented by an x integer and a y integer for each point.</p>
<p>How can you determine if another point c is on the line segment defined by a and b?</p>
<p>I use python most, but examples in any language would be helpful.</p>
| <p>Check if the <strong>cross product</strong> of (b-a) and (c-a) is 0, as tells Darius Bacon, tells you if the points a, b and c are aligned.</p>
<p>But, as you want to know if c is between a and b, you also have to check that the <strong>dot product</strong> of (b-a) and (c-a) is <em>positive</em> and is <em>less</e... | <p>how about just ensuring that the slope is the same and the point is between the others?</p>
<p>given points (x1, y1) and (x2, y2) ( with x2 > x1)
and candidate point (a,b)</p>
<p>if (b-y1) / (a-x1) = (y2-y2) / (x2-x1) And x1 < a < x2 </p>
<p>Then (a,b) must be on line between (x1,y1) and (x2, y2)</p>
| 42,530 |
<p>Finding a good way to do this has stumped me for a while now: assume I have a selection box with a set of points in it. By dragging the corners you can scale the (distance between) points in the box. Now for an axis aligned box this is easy. Take a corner as an anchor point (subtract this corner from each point, sca... | <p>Any box is contained inside a circle.<br>
You find the circle which binds the box, find its center and do exactly the same as you do with an axis aligned box.</p>
| <p>Let's say that the box is defined as a set of four points (P1, P2, P3 and P4).
For the sake of simplicity, we'll say you are dragging P1, and that P3 is the opposite corner (the one you are using as an anchor).</p>
<p>Let's label the mouse position as M, and the new points you wish to calculate as N1, N2 and N4. P3... | 43,544 |
<p>And why don't they change it?</p>
<p>Edit:
The reason ask is because I'm new to emacs and I would like to use Emacs as a "programmer calculator". So, I can manipulate 32-bit & 64-bit integers and have them behave as they would on the native machine.</p>
| <p>Emacs-Lisp is a dynamically-typed language. This means that you need type tags at runtime. If you wanted to work with numbers, you would therefore normally have to pack them into some kind of tagged container that you can point to (i.e. “box” them), as there is no way of distinguishing a pointer from a machine int... | <p>That is only true for 32 bit architectures, and can be changed based on build options. The other bits are used for tagging the basic data structures.</p>
<p>You can use a 64-bit build which has larger integers, and there are packages for arbitrarily large integer arithmetic.</p>
<p>Or, you're just asking a rhetor... | 13,217 |
<p>In some screen capture software when you press a key it's possible for the client to select a portion of the screen. How can I implement that in my software written in framework 2.0 .Net?</p>
<p>Here is a image of what I would like to do : <a href="http://img341.imageshack.us/img341/3782/portionpb9.png" rel="nofoll... | <p>I know it might not be a solution that you could easily copy&paste but this open source project in C# does have the behavior that your application want : <a href="http://www.codeplex.com/cropper" rel="nofollow noreferrer">http://www.codeplex.com/cropper</a></p>
<p>You might be able to take a piece of their code... | <p>Here is a <a href="http://www.codeguru.com/csharp/csharp/cs_graphics/screencaptures/article.php/c6139" rel="nofollow noreferrer">tutorial</a> that captures the screen. You can either only copy the part of the screen that was selected or try to change the code to only capture that part.</p>
| 48,987 |
<p>Given my new understanding of the power of "includes" with PHP, it is my guess that ALL of my pages on my site will be <code>.php</code> extension.</p>
<p>Would this be considered strange?</p>
<p>I used to think that most pages would be <code>.htm</code> or <code>.html</code>, but in looking around the net... | <p>The thing that actually matters to the browser isn't the file's extension; it's the MIME Type that it gets sent in the HTTP headers. Headers are data that gets sent before the actual file and tell what kind of data it is, how big it is, and a bunch of other unimportant junk. You can configure your server to send any... | <p>As far as url etiquette goes - I really don't think etiquette is involved; however if you have sophisticated users visiting your website who have strong views on platforms and technologies, using .php or .aspx extensions could put off users - perhaps subconsciously.</p>
<p>If you use apache, it's fairly easy to mak... | 41,799 |
<p>I have an application with multiple "pick list" entities, such as used to populate choices of dropdown selection boxes. These entities need to be stored in the database. How do one persist these entities in the database?</p>
<p>Should I create a new table for each pick list? Is there a better solution?</p... | <p>Well, you could do something like this:</p>
<pre><code>PickListContent
IdList IdPick Text
1 1 Apples
1 2 Oranges
1 3 Pears
2 1 Dogs
2 2 Cats
</code></pre>
<p>and optionally..</p>
<pre><code>PickList
Id Description
1 Fruit
2 Pets
</code><... | <p>Depending on your needs, you can just have an options table that has a list identifier and a list value as the primary key.</p>
<pre><code>select optionDesc from Options where 'MyList' = optionList
</code></pre>
<p>You can then extend it with an order column, etc. If you have an ID field, that is how you can refer... | 11,251 |
<p>I want to write (or find) a guide to effective bug reporting in a style similar to ESR's <a href="http://www.catb.org/~esr/faqs/smart-questions.html" rel="nofollow noreferrer">How To Ask Questions The Smart Way</a></p>
<p>What are your top tips for effective bug reports?</p>
| <ul>
<li>Step-by-step instructions on how to recreate the bug</li>
<li>Make sure you've attempted to isolate the bug to what you are actually writing a bug against, instead of something else that could be the cause.</li>
<li>List attempts to isolate the bug to something other than the software you are writing a bug aga... | <p>Write the steps to reproduce the bug. If you can't reproduce it, it won't get fixed.</p>
| 29,748 |
<p>I was wondering if anyone had successfully used DPAPI with a user store in a web farm enviroment?</p>
<p>Because our application is a recently converted from 1.1 to 2.0 ASP.NET app, we're using a custom wrapper which directly calls the <code>CryptUnprotect</code> methods. But this should be the same as the <code>Pr... | <p>In a web farm environment, rather than using DPAPI to encrypt/decrypt your data directly, you would instead use it to encrypt the <strong>key</strong> that you later use to decrypt your protected data.</p>
<p>You would "install" the key onto each server as part of the deployment process. The installation script wou... | <p>Twelve years later . . . you can try using <a href="https://learn.microsoft.com/en-us/windows/win32/seccng/cng-dpapi" rel="nofollow noreferrer">CNG DPAPI</a>, which was meant to work in cloud environments that may or may not be load-balanced. From that link (in case it gets taken down):</p>
<blockquote>
<p>Microsof... | 24,662 |
<p><a href="http://www.w3.org/TR/REC-CSS2/selector.html#attribute-selectors" rel="noreferrer">CSS Attribute selectors</a> allow the selection of elements based on attribute values. Unfortunately, I've not used them in years (mainly because they're not supported by all modern browsers). However, I remember distinctly th... | <p>As for CSS 2.1, see <a href="http://www.w3.org/TR/CSS21/selector.html#attribute-selectors" rel="noreferrer">http://www.w3.org/TR/CSS21/selector.html#attribute-selectors</a></p>
<p>Executive summary:</p>
<pre>
Attribute selectors may match in four ways:
[att]
Match when the element sets the "att" attri... | <p>Note that, in Antti's example you'd probably want to add a catch for any absolute links you may have to your own domain, which you probably <strong>don't</strong> want to flag as 'external', e.g.:</p>
<pre><code>a[href^="http://your.domain.com"]
{
background: none;
padding: 0;
}
</code></pre>
<p>And you'd ... | 7,189 |
<p>I'm scraping a static html site and moving the content into a database-backed CMS. I'd like to use Textile in the CMS. </p>
<p>Is there a tool out there that converts HTML into Textile, so I can scrape the existing site, convert the HTML to Textile, and insert that data into the database?</p>
| <p>I know this is an old question, but I found myself trying to do this the other day and not finding anything useful, until I found <a href="http://johnmacfarlane.net/pandoc/" rel="nofollow">Pandoc</a>. It can convert loads of other markup formats as well - it's quite brilliant.</p>
| <p>This is a simple markup replacement, nothing a good regex could not fix.</p>
<p>I recommend Perl, LWP::Simple and some regexes to do the whole thing (spidering, stripping design and menus, converting to textile, and then posting to the database.)</p>
| 21,074 |
<p>I recently had a need to interpret a DEC 32-bit floating point representation. It differs from the IEEE floating point representations in the number of bits allocated to the exponent and mantissa.</p>
<p>Here's a description of a bunch of floating point formats:</p>
<p><a href="http://www.quadibloc.com/comp/cp020... | <p>You mean like <a href="http://pubs.usgs.gov/of/2005/1424/" rel="nofollow noreferrer" title="libvaxdata">libvaxdata</a>?</p>
<p>I've never used it - I just found it by googling. But it looks like what you're looking for. </p>
<p>It's a C library rather than C++, but converting floating point data should work fine... | <p>Ha ... not sure why I didn't check Code Project:</p>
<p><a href="http://www.codeproject.com/KB/applications/libnumber.aspx" rel="nofollow noreferrer">http://www.codeproject.com/KB/applications/libnumber.aspx</a></p>
| 23,683 |
<p>I have to setup team foundation server for a company, something that I don't have any experience in.</p>
<p>The company will have about 5 or so developers that will be using it.</p>
<p>Is this a big task or something that is fairly easy to do (with instructions)?<br>
Any helpful tutorials that you can recommend?</... | <p>Your first step should be to download the latest TFS Installation Guide (TFSInstall.chm) from here: <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=FF12844F-398C-4FE9-8B0D-9E84181D9923&displaylang=en" rel="noreferrer">http://www.microsoft.com/downloads/details.aspx?FamilyID=FF12844F-398C-4FE9-8... | <p>See the link below for a condensed walkthrough:</p>
<p><a href="http://blogs.vertigosoftware.com/teamsystem/archive/2006/04/04/2512.aspx" rel="nofollow noreferrer">Cliff's Notes for a Team System Install</a></p>
| 8,212 |
<p>How does the new Microsoft asp.net mvc implementation handle partitioning your application - for example:</p>
<pre><code>--index.aspx
--about.aspx
--contact.aspx
--/feature1
--/feature1/subfeature/action
--/feature2/subfeature/action
</code></pre>
<p>I guess what I am trying to say is that it seems everything has ... | <p>There isn't any issues with organizing your controllers. You just need to setup the routes to take the organization into consideration. The problem you will run into is finding the view for the controller, since you changed the convention. There isn't any built in functionality for it yet, but it is easy to creat... | <p>In terms of how you arrange your views, you can put your views in subfolders if you'd like and create your own view structure. All views can always be referenced by their full path using the ~syntax. So if you put Index.aspx in \Views\Feature1\Home then you could reference that view using ~/Views/Feature1/Home/Index... | 4,626 |
<p>I am developing a multi-threaded application in Cocoa. The main thread takes values from the user, and when a button is clicked I invoke a secondary thread in which a long calculation takes place. Now from this thread I have to return the output of every step of the calculation to the main thread. I want to periodic... | <p>There are a number of ways to do this, in rough order of complexity (easiest first): </p>
<ul>
<li>use NSObject's performSelectorOnMainThread:withObject:waitUntilDone: which is pretty self explanatory.</li>
<li>use performSelector:onThread:withObject:waitUntilDone:, which will let you go the other way</li>
<li>use ... | <p>Have a look at the Apple docs for this.</p>
<p>You may need to create an ADC member account, but this is free</p>
<p><a href="http://developer.apple.com/DOCUMENTATION/Cocoa/Conceptual/CocoaFundamentals/AddingBehaviortoaCocoaProgram/chapter_4_section_6.html" rel="nofollow noreferrer">Multi-threaded Cocoa Programs</... | 45,432 |
<p>Can two domain objects show on the same page, when the list method is called, for example?</p>
<p><a href="http://APP_NAME/foo/list" rel="nofollow noreferrer">http://APP_NAME/foo/list</a></p>
<hr>
<pre><code>def list = {
if(!params.max) params.max = 10
[ fooList: Foo.list( params ) ]
[ barList: Bar.li... | <p>Pretty sure you can return multiple things in that last line:</p>
<p>[ fooList: Foo.list( params ),
barList: Bar.list( params ) ]</p>
| <p>The comma in the accepted answer is correct, you can remove the // line.</p>
| 25,385 |
<p>I'm currently learning functional programming in my spare time with Scala, and I have an idle newbie question.</p>
<p>I can see the elegance of having immutable objects when doing something like calculating a Haar wavelet transform - i.e. when the data itself being represented by the objects doesn't change.</p>
<p... | <blockquote>
<p>To me it would seem like there would be a ginormous swarm of new instances each 'tick'.</p>
</blockquote>
<p>Indeed, that is the case. I have a Haskell application that reads a market data feed (about five million messages over the course of a six-hour trading day, for the data in which we're interes... | <p>Like pretty much every tool in programming, Immutable objects are powerful, but dangerous in the wrong situation. I think the game example is not a very good one or at least very contrived. </p>
<p>Eric Lippert has some interesting <a href="http://blogs.msdn.com/ericlippert/archive/tags/Immutability/default.aspx" r... | 20,097 |
<p>I have an SQL 2005 table, let's call it Orders, in the format:</p>
<pre><code>OrderID, OrderDate, OrderAmount
1, 25/11/2008, 10
2, 25/11/2008, 2
3, 30/1002008, 5
</code></pre>
<p>Then I need to produce a report table showing the ordered amount on each day in the last 7 days:</p>
<pre><code>Day,... | <p>SQL isn't "skipping" dates... because queries run against <em>data</em> that is actually in the table. So, if you don't have a DATE in the table for January 14th, then why would SQL show you a result :)</p>
<p>What you need to do is make a temp table, and JOIN to it.</p>
<pre><code>CREATE TABLE #MyDates ( TargetDa... | <p>Since you will want to use this date table frequently in other queries as well, I suggest you make it a permanent table and create a job to add the new year's dates once a year.</p>
| 42,688 |
<p>One thing I struggle with is planning an application's architecture before writing any code.</p>
<p>I don't mean gathering requirements to narrow in on what the application needs to do, but rather effectively thinking about a good way to lay out the overall class, data and flow structures, and iterating those thoug... | <p>I really find that a first-off of writing on paper or whiteboard is really crucial. Then move to UML if you want, but nothing beats the flexibility of just drawing it by hand at first.</p>
| <p>I try to break my thinking down into two areas: a representation of the things I'm trying to manipulate, and what I intend to do with them.</p>
<p>When I'm trying to model the stuff I'm trying to manipulate, I come up with a series of discrete item definitions- an ecommerce site will have a SKU, a product, a custom... | 37,318 |
<p>I recently moved from a windows based development environment to an ubuntu one. I need to have both PHP4 and PHP5 available (PHP4 is a company requirement, so not much I can decide about it). My problem is that I can't install PHP4, as it's not available as a package an it seems that the only way to get it would be ... | <p>Well, the real problem is that your company is requiring you to run PHP4, which is a EOLd product. That means no more security fixes. I would be <em>very</em> afraid of deploying something like that.</p>
<p>That being said, you could probably run both by running one as CGI and the other as an apache module, or both... | <p>php4 packages seems to be available in dapper.</p>
<p>You could add dapper's repos to your sources.list just the time you need to install php4 :-) (that's not very clean, but it might be more clean than somethingelse).</p>
<p>(Or you can set source preferences by package but i don't know how to do it, i just know ... | 38,856 |
<p>How can I extract the list of colors in the System.Drawing.Color struct into a collection or array?</p>
<p>Is there a more efficient way of getting a collection of colors than using this struct as a base?</p>
| <p>So you'd do:</p>
<pre><code>string[] colors = Enum.GetNames(typeof(System.Drawing.KnownColor));
</code></pre>
<p>... to get an array of all the collors.</p>
<p>Or... You could use reflection to just get the colors. KnownColors includes items like "Menu", the color of the system menus, etc. this might not be wh... | <p>In System.Drawing there is an Enum KnownColor, it specifies the known system colors.</p>
<p>List<>:
List allColors = new List(Enum.GetNames(typeof(KnownColor)));</p>
<p>Array[]
string[] allColors = Enum.GetNames(typeof(KnownColor));</p>
| 35,268 |
<p>How can I copy and paste in irb (Interactive Ruby Shell) on Windows?</p>
| <p>To avoid having to open the drop-down menu and clicking, you need to change the command window settings. To do this, right-click the title bar, choose Properties, turn on "QuickEdit Mode" under the Properties tab (and keep "Insert Mode" on), then OK.</p>
<p>Now, to copy: drag to select, right-click to copy.</p>
<... | <p>check out console2--very nice and allows you to paste by using right click or what not.</p>
<p>Update: conemu is even better: <a href="http://conemu.github.io/" rel="nofollow noreferrer">http://conemu.github.io/</a></p>
| 17,477 |
<p>Like most *nix people, I tend to play with my tools and get them configured just the way that I like them. This was all well and good until recently. As I do more and more work, I tend to log onto more and more machines, and have more and more stuff that's configured great on my home machine, but not necessarily on ... | <p>I've had pretty good luck keeping my files under a revision control system. It's not for everyone, but most programmers should be able to appreciate the benefits.
Read </p>
<blockquote>
<p><a href="http://www.onlamp.com/pub/a/onlamp/2005/01/06/svn_homedir.html" rel="noreferrer">Keeping Your Life in Subversion</a... | <p>Depending on your environment you can also use (fully backupped) NFS shares ...</p>
| 20,472 |
<p>I have a very large cascading menu system with over 300 items in it. <em>(I know it's large but it's a requirement.)</em><br>
Currently, it's written in javascript so the external file is cached by browsers. </p>
<p>To improve search engine results I need to convert this to a css menu system.<br>
I realize the bro... | <p>The best way to accomplish what you want to do is using <a href="https://www.google.com/webmasters/tools/docs/en/protocol.html" rel="nofollow noreferrer">SiteMaps</a> to inform Google about the urls for your web site. Basically you will want to translate your hierarchial data for the menus into a SiteMap.</p>
| <p>You could generate the menus beforehand into static html / javascript files, and have all the pages pull the site from the same URL on your site. That way, the client side browser will do the caching. You'll just have to have a step in your deployment that generates the html files for the menu.</p>
<p>Try to have... | 7,958 |
<p>I have an unsorted list of noisy X, Y points. They do, however, form a path through the world. I would like an algorithm to draw an approximation of this data using line segments.</p>
<p>This is similar to how you would use a line -fitting algorithm to pick an approximation of linear data. My problem is only harder... | <p><a href="http://en.wikipedia.org/wiki/Bezier_curves" rel="nofollow noreferrer">Bezier Interpolation</a> may fit your problem.</p>
<p><img src="https://i.stack.imgur.com/wM1gG.gif" alt="Bezier Interpolation"></p>
<p>This does not address the ordering of the points into a path, however; there are a number of approac... | <p>It seems that you know the 'golden curve' from your answers to questions, I would suggest finding the Bezier curve of the 'golden curve' as suggested by @jamesh and drawing that.</p>
| 29,772 |
<p>What is the most efficient way to determine how many comments a particular blog post has? We want to store the data for a new web app. We have a list of permalink URl's as well as the RSS feeds. </p>
| <p>If I understand correctly, you want a heuristic to estimate the number of comments in an HTML page which is known to be a blog post, yes?</p>
<p>Very often, a specific blog will have some features which make it easy to work out. If you look at mine over at <a href="http://kstruct.com/" rel="nofollow noreferrer">htt... | <p>Blogs almost always have an RSS feed for comments. If you have that, then you can determine the exact number of comments, since the feeds 99% of the time follow a standard. Even if the blog is your own, if you are already generating an RSS feed, then don't bother making a call to your DB. You already did that to gen... | 7,018 |
<p>How can I make Visual Studio 2005 call a WCF service?</p>
| <p>Yes, using the wsHttpBinding will expose the service as a standard web service.</p>
| <p>You need to use the basic HTTP binding. See <a href="http://msdn.microsoft.com/en-us/library/ms751433.aspx" rel="nofollow noreferrer">this article</a> for details.</p>
| 46,573 |
<p>I need a way to modify a value in a table after a certain amount of time has passed. My current method is as follow:</p>
<ul>
<li>insert end time for wait period in table</li>
<li>when a user loads a page requesting the value to be changed, check to see if current >= end time</li>
<li>if it is, change the value an... | <p>why not use a cron to update this information behind the scenes? that way you offload the checks on each page hit, and can actually schedule the timing to meet your app's requirements.</p>
| <p>If performance really starts to be an issue, (which means a lot more than you probably realize) you could use memchached to store the info...</p>
| 14,966 |
<p>I recently have been moving a bunch of MP3s from various locations into a repository. I had been constructing the new file names using the ID3 tags (thanks, TagLib-Sharp!), and I noticed that I was getting a <code>System.NotSupportedException</code>: </p>
<blockquote>
<p><em>"The given path's format is not suppor... | <p>To clean up a file name you could do this</p>
<pre><code>private static string MakeValidFileName( string name )
{
string invalidChars = System.Text.RegularExpressions.Regex.Escape( new string( System.IO.Path.GetInvalidFileNameChars() ) );
string invalidRegStr = string.Format( @"([{0}]*\.+$)|([{0}]+)", invalid... | <pre><code>using System;
using System.IO;
using System.Linq;
using System.Text;
public class Program
{
public static void Main()
{
try
{
var badString = "ABC\\DEF/GHI<JKL>MNO:PQR\"STU\tVWX|YZA*BCD?EFG";
Console.WriteLine(badString);
Console.WriteLine(Sa... | 39,869 |
<p>I wonder how you guys manage deployment of a database between 2 SQL Servers, specifically SQL Server 2005.
Now, there is a development and a live one. As this should be part of a buildscript (standard windows batch, even do with current complexity of those scripts, i might switch to PowerShell or so later), Enterpri... | <p>I've taken to hand-coding all of my DDL (creates/alter/delete) statements, adding them to my .sln as text files, and using normal versioning (using subversion, but any revision control should work). This way, I not only get the benefit of versioning, but updating live from dev/stage is the same process for code and ... | <p>I agree with keeping everything in source control and manually scripting all changes. Changes to the schema for a single release go into a script file created specifically for that release. All stored procs, views, etc should go into individual files and treated just like .cs or .aspx as far as source control goes... | 2,299 |
<p>I need to detect whether my application is running within a virtualized OS instance or not.</p>
<p>I've found <A HREF="http://www.codeproject.com/KB/system/VmDetect.aspx" rel="noreferrer">an article</A> with some useful information on the topic. The same article appears in multiple places, I'm unsure of the origina... | <p>Have you heard about <a href="http://web.archive.org/web/20100725003848/http://www.redlightsecurity.com/2008/04/virtualization-red-pill-or-blue.html" rel="nofollow noreferrer">blue pill, red pill?</a>. It's a technique used to see if you are running inside a virtual machine or not. The origin of the term stems from ... | <p>Check the tool <a href="http://linux.die.net/man/1/virt-what" rel="nofollow">virt-what</a>. It uses previously mentioned dmidecode to determine if you are on a virtualized host and the type. </p>
| 18,626 |
<p>I have the following Linq to SQL query, in which I'm trying to do a multi-column GROUP BY:</p>
<pre><code>return from revision in dataContext.Revisions
where revision.BranchID == sourceBranch.BranchID-1
&& !revision.HasBeenMerged
group revision by new Task(revision.TaskSourceCo... | <p>OK, I figured this out. I had two problems; first of all, ToUpper() doesn't translate into SQL, and secondly, I don't think Linq to SQL supports orderby on objects; at least not non-entities. By decomposing the orderby into its constituent columns, everything started to work as planned.</p>
<pre><code>return from... | <p>I think you need a select before your group by - you want to convert objects to Tasks, then order by something else (Task.start or something)</p>
| 41,757 |
<p>I have a windows c# application and I want to display a pdf file, located on a webserver, in an acrobat com object added to my form. </p>
<pre><code>pdf.loadfile(@"http://somewhere.com/nowwhere.pdf")
</code></pre>
<p>As my pdf is large, the application seems to hang till the entire file is loaded. </p>
<p>I want ... | <p>I would do the following:</p>
<ol>
<li>Create another thread to import the pdf.</li>
<li>Display some kind of a progress bar to the user. perhaps with a cancel button.</li>
</ol>
| <p>Obviously, if you can use a background thread to do the loading - you'd be all set:</p>
<pre><code>Pdf pdf;
void ShowPdf() {
if (this.InvokeRequired) {
this.Invoke(() => this.ShowPdf());
}
// give pdf a window...
}
void LoadPdf() {
System.Threading.ThreadPool.QueueUserWorkItem(() => {
... | 22,342 |
<p>I am using SimpleTest, a PHP-based unit testing framework. I am testing new code that will handle storing and retrieving website comments from a database. I am at a loss for how to structure the project to test the database access code.</p>
<p>I am looking for any suggestions as to best practices for testing db cod... | <p>This is an old question but I thought I'd add some specific experience we've had with this. </p>
<p>Other posters are technically correct that this is a form of integration test but from where I sit there is often too much logic in MySQL to be stubbed out in unit testing. If you are like us and have large, comple... | <p>Testing against a database usually indicates bad tests, probably due to lack of encapsulation in the code under test. You should try to isolate the code that interacts with the database from the rest of your code as much as possible, keeping this interaction layer so simple that you can get away with a few, very bas... | 21,118 |
<p>In Ruby 1.8 and earlier,</p>
<pre><code>Foo
</code></pre>
<p>is a constant (a Class, a Module, or another constant). Whereas</p>
<pre><code>foo
</code></pre>
<p>is a variable. The key difference is as follows:</p>
<pre><code>module Foo
bar = 7
BAZ = 8
end
Foo::BAZ
# => 8
Foo::bar
# NoMethodError: und... | <p>I don't know what ruby would do if you used extended UTF8 characters as identifiers in your source code, but I know what I would do, which would be to slap you upside the back of the head and tell you DON'T DO THAT</p>
| <blockquote>
<p>I would love to see</p>
</blockquote>
<pre><code>my_proc = λ { |...| ... }
x ∈ my_enumerable # same as my_enumerable.include?(x)
my_infinite_range = (1..∞)
return 'foo' if x ≠ y
2.21 ≈ 2.2
</code></pre>
<p>I would love to see someone trying to type that program on an English keyboard :P</p>
| 4,278 |
<p>I'm learning c# , and I reached the LinkedList<T> type and I still need to know more, like when should I use it, how do I create one, how do I to use it. I just want information.</p>
<p>If any one knows a good article about this subject, or if you can show me some examples with explanation, such as how to cre... | <p>You can find more information on <a href="http://msdn.microsoft.com/en-us/library/he2s3bh7.aspx" rel="nofollow noreferrer">LinkedList<T></a> at MSDN, including an example of how to create and use one. <a href="http://en.wikipedia.org/wiki/Linked_list" rel="nofollow noreferrer">Wikipedia</a> has a reasonable a... | <p>Do you know what a standard Linked List is? It's like one of those (doubly linked) but using .NET Generics to allow you to easily store any Type inside of it.</p>
<p>Honestly, I don't use it, I prefer the more basic List or Dictionary.</p>
<p>For more info on Linked Lists, check out <a href="http://en.wikipedia.or... | 29,348 |
<p>Seems like there are two categories of APIs for websites today. </p>
<ol>
<li><p>APIs which allow the functionality of the site to be extended like Facebook, Myspace, etc. These APIs seem to be very diverse.</p></li>
<li><p>APIs which allow interaction with the existing site functionality like Twitter, Flickr, et... | <p>We're doing some research in this area ourselves. Not a lot out there in terms of "gold standard" for website API references.</p>
<p>The most common website APIs referenced are:</p>
<ul>
<li>Google APIs <a href="http://developers.google.com/api-client-library/java/apis" rel="nofollow noreferrer">http://developers.... | <p>Force (previously known as SalesForce) API: <a href="http://www.salesforce.com/us/developer/docs/api/index.htm" rel="nofollow noreferrer">http://www.salesforce.com/us/developer/docs/api/index.htm</a></p>
| 37,987 |
<p>Let's say that I'm writing a library in C# and I don't know who is going to consume it. </p>
<p>The public interface of the library has some unsigned types - uint, ushort. Apparently those types are not CLS-compliant and, theoretically speaking, there may be languages that will not be able to consume them.</p>
<p>... | <p>I believe in the original version of VB.NET, unsigned types were usable but there was no support for them built into the language. This has been addressed in later versions, of course.</p>
<p>Additionally, I suspect that the now-defunct J# has no support for unsigned types (given that Java doesn't have any).</p>
| <p>Visual Basic..?</p>
| 47,645 |
<p>I would like to be able to render a view and send it as an email, similar to what can be done with Ruby on Rails. What is the best way to do this?</p>
<p>EDIT: My solution so far is to use a templating engine (NHaml, StringTemplate.net). It works but I would prefer not to have a second template engine in my site.</... | <p>Once the post <a href="https://stackoverflow.com/questions/115060/mvc-preview-5-rendering-a-view-to-string-for-testing">mvc-preview-5-rendering-a-view-to-string-for-testing</a> has an answer with a solution in it, that solution applies to this one as well. Once you have a string, you coud mail it using default .net ... | <p>Sorry mate, but I thing there is something wrong with your understanding of ASP.NET MVC. It's still the part of ASP.NET and framework, so you can use the same techniques you used there like SendMail and SmtpClient.</p>
| 14,430 |
<p>I want to develop Java apps, real quick, what IDE should I choose?</p>
| <p>I think CodeGear <a href="http://www.codegear.com/products/jbuilder" rel="nofollow noreferrer">jbuilder</a> is a very good start.</p>
| <p>For web apps - <a href="http://www-01.ibm.com/software/awdtools/developer/application/" rel="nofollow noreferrer">IBM RAD</a> - it's based on Eclipse, but contains much more advance features.</p>
| 42,109 |
<p>What is the state generating Excel documents from a PHP application on a Linux server?</p>
<p>I am interesting in creating Office 97 (xls) Excel files. My limited research on the subject has turned up this <a href="http://pear.php.net/package/Spreadsheet_Excel_Writer" rel="nofollow noreferrer">Pear package</a>. I... | <p>There is something much better than the PEAR package out there!</p>
<p><a href="http://phpexcel.codeplex.com/" rel="nofollow noreferrer">PHPExcel</a></p>
| <p>Everything is in beta status nowadays. Do you actually need excel files with forumlas and all that or do you just need to open a list of records in excel to work on?</p>
<p>Usually, I've found that when a client wants an Excel file, really I can just generate a CSV file and they can work on it in Excel and add for... | 27,944 |
<p>I'm encountering problems with my .NET Framework 3.0 SP1 application. It is a C# winforms application communicating with a COM exe. Randomly either the winforms app or the COM exe crashes without any error message and the event log contains this entry:</p>
<p>[1958] .NET Runtime
Type: ERROR
Computer: CWP... | <p>Microsoft released a hotfix</p>
<p><a href="https://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=16827&wa=wsignin1.0" rel="nofollow noreferrer">https://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=16827&wa=wsignin1.0</a></p>
| <p>These seem to be mainly caused by a bad install of the framework. See if you can repro the error on another machine, or uninstall/reinstall the Framework bits.</p>
| 43,402 |
<p>I'm building the world's simplest library application. All I want to be able to do is scan in a book's UPC (barcode) using a typical scanner (which just types the numbers of the barcode into a field) and then use it to look up data about the book... at a minimum, title, author, year published, and either the Dewey D... | <p>There's a very straightforward web based solution over at ISBNDB.com that you may want to look at.</p>
<p><strong>Edit:</strong> Updated API documentation link, now there's version 2 available as well</p>
<p><a href="https://isbndb.com/isbn-database" rel="noreferrer">Link to prices and tiers here</a></p>
<p>You can ... | <p>Working in the library world we simply connect to the LMS pass in the barcode and hey presto back comes the data. I believe there are a number of free LMS providers - Google for "open source lms".</p>
<p>Note: This probably works off ISBN...</p>
| 13,253 |
<p>Has anyone run into this error message before when using a timer on an ASP.NET page to update a <code>DataGrid</code> every x seconds? </p>
<p>Searching google yielded this <a href="http://weblogs.asp.net/leftslipper/archive/2007/02/26/sys-webforms-pagerequestmanagerparsererrorexception-what-it-is-and-how-to-avoid... | <p>The RoleProvider sets a cookie to cache role information in a cookie. When the cookie resets during an asynch post back from AJAX, you will get this error. The solution is to either set the cookieTimeout in the roleManager section of your web.config to a very large number of minutes, or set the cacheRolesInCookie=... | <p>Regarding the formatting of your post: If you use the quote-button instead of code-button, people do not have to scroll to see the complete error message.</p>
| 4,713 |
<p>Why do some sites (or advertisers that give clients javascript code) employ a technique of splitting the <code><script></code> and/or <code></script></code> tags up within <code>document.write()</code> calls?</p>
<p>I noticed that Amazon does this as well, for example:</p>
<pre><code><script type='t... | <p><code></script></code> has to be broken up because otherwise it would end the enclosing <code><script></script></code> block too early. Really it should be split between the <code><</code> and the <code>/</code>, because a script block is supposed (according to SGML) to be <a href="http://www.w3... | <p>The solution Bobince posted works perfectly for me. I wanted to offer an alternative method as well for future visitors:</p>
<pre><code>if (typeof(jQuery) == 'undefined') {
(function() {
var sct = document.createElement('script');
sct.src = ('https:' == document.location.protocol ? 'https' : 'ht... | 29,212 |
<p>I have a simple web app that runs inside Tomcat. I need to call a web service from this web app and I'm not sure how to go about it. It seems there are two methods depending on whether you are using a managed or unmanaged environment:</p>
<p>JNDI service lookup (managed)</p>
<p>and</p>
<p>JAX-RPC ServiceFactory... | <p>You don't have to necessarily use those techniques. Assuming you're using Axis as the web services engine and ant as the build tool(<a href="http://ws.apache.org/axis/java/user-guide.html" rel="nofollow noreferrer">http://ws.apache.org/axis/java/user-guide.html</a>), you need to do the following<br><br>
1) generate ... | <p>If it is a web-service, why not use apache's <a href="http://hc.apache.org/httpclient-3.x/" rel="nofollow noreferrer">httpclient</a>?</p>
| 16,955 |
<p>CodeIgniter allows access to POSTed data via:</p>
<pre><code>$this->input->post('input_name');
</code></pre>
<p>where 'input_name' is the name of a form field. This works well for a static form where each input name in known ahead of time.</p>
<p>In my case, I am loading a collection of key/value pairs from... | <p>According to the documentation, no. I would suggest just using <code>array_keys($_POST)</code> to get the keys.</p>
| <p>Surely if you have an array of keys from the database you can use that, like :</p>
<pre><code>foreach ($arrayFromDb as $key => $value) {
$newValue = $this->input->post($key);
}
</code></pre>
<p>Then you have the advantage that people if people submit additional fields (e.g. by modifying the form and p... | 38,432 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.