instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>I stumbled across my rather ancient photo objects disks, and sadly found out the company (hemera) doesn't provide support for it anymore. this has left me with a whole pile of .hpi files. Luckily, I found <a href="http://www.halley.cc/ed/linux/interop/hemera.html" rel="nofollow noreferrer">this information</a> on ex...
<p>It seems the regexp is wrong. That's why I wrote a little C program to do it for me:</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #define MAX_SIZE 1048576 char stuff[MAX_SIZE]; int main (int argc, char **argv) { unsigned int j_off, j_len, p_off, p_len; FILE *fp, *jp, *pp; fp = fo...
<p>For <code>.jpeg</code> and <code>.mov</code> files there is <a href="http://www.rfc1149.net/devel/recoverjpeg.html" rel="nofollow">recoverjpeg</a>, which I tested on linux (but may be compatible with other platforms). </p> <p>On some debian systems it's available through <code>apt get install recoverjpeg</code></p>...
28,238
<p>I am trying to figure out how to click a button on a web page programmatically.</p> <p>Specifically, I have a WinForm with a WebBrowser control. Once it navigates to the target ASP.NET login page I'm trying to work with, in the DocumentCompleted event handler I have the following coded:</p> <pre><code>HtmlDocumen...
<p>How does this work? Works for me</p> <pre><code>HtmlDocument doc = webBrowser1.Document; doc.All["userIDTextBox"].SetAttribute("Value", "user1"); doc.All["userPasswordTextBox"].SetAttribute("Value", "Password!"); doc.All["logonButton"].InvokeMember("Click"); </code></pre>
<p>You posted a comment along the lines of not wanting to use a client side script on @Phunchak's answer. I think what you are trying to do is impossible. The only way to interact with the form is via a client side script. The C# code can only control what happens before the page is sent out to the browser. </p>
12,173
<p>The code golf series seem to be fairly popular. I ran across some code that converts a number to its word representation. Some examples would be (powers of 2 for programming fun):</p> <ul> <li>2 -> Two</li> <li>1024 -> One Thousand Twenty Four</li> <li>1048576 -> One Million Forty Eight Thousand Five Hundred Seve...
<p>Lisp, using only standard functions:</p> <pre><code>(format nil "~r" 1234) ==&gt; "one thousand two hundred thirty-four" </code></pre> <p>Bonus:</p> <pre><code>(format nil "~@r" 1234) ==&gt; "MCCXXXIV" </code></pre>
<p>A few years ago I created this in C# for multi language applications.</p> <p>This one is base class:</p> <pre><code>public abstract class ValueSource { public abstract object Value { get; } } </code></pre> <p>This one is for wordify..</p> <pre><code>public abstract class NumberTextValueSource:ValueSource { ...
39,926
<p>I can get easily see what projects and dlls a single project references from within a Visual Studio .NET project.</p> <p>Is there any application or use of reflection that can build me a full dependency tree that I can use to plot a graphical chart of dependencies?</p>
<p>In addition to NDepend, you can also try this addin for <a href="http://www.codeplex.com/reflectoraddins/Wiki/View.aspx?title=Graph&amp;referringTitle=Home" rel="nofollow noreferrer">Reflector</a> for showing assembly dependency graph.</p>
<p><a href="http://www.headwaysoftware.com/products/structure101/index.php" rel="nofollow noreferrer">Structure101</a> can do that. You can browse a model by assembly and/or namespace, and clicking on any dependency at any level give you all the code-level references that cause the dependency. The .NET version is in be...
10,572
<p>Is there a .NET equivalent of Java Web Start?</p> <p>I want a one-click, from the web, lightweight install for a group of .NET assemblies and resources. Hopefully, the link would continue to keep the user updated with the latest version, similar to what Java Web Start does. </p> <p>The application is written in F#...
<p>I think you're talking about ClickOnce Deployment</p> <p><a href="http://msdn.microsoft.com/en-us/library/t71a733d(VS.80).aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/t71a733d(VS.80).aspx</a></p>
<p>Aha, you can publish a .NET application using the msbuild.exe that ships with the .NET framework (not with Visual Studio). You can do it all from the command line with the free tools. </p> <p>Documentation on publishing from the command line with msbuild is here: <a href="http://msdn.microsoft.com/en-us/library/ms1...
30,918
<p>I have a simple HTML. I am using the JQuery for AJAX purpose. Now, I want to put my javascript function in a separate javascript file. What is the syntax for this? For example, currently my script section in the HTML is something like this:</p> <pre><code>&lt;script&gt; &lt;script type="text/javascript" src="scrip...
<p>Move the scripts.js <code>script</code> tag down beneath the jQuery <code>script</code> tag and then just move the whole of that inline script block into scripts.js. As jQuery will already have been instantiated by the time scripts.js loads, the Javascript will just execute inline in the same way that it does at the...
<pre><code>$('head').append('&amp;lt;script type="text/javascript" src="scripts/scripts.js"/&amp;gt;') </code></pre>
21,382
<p>My motto for Java is "just because Java has static blocks, it doesn't mean that you should be using them." Jokes aside, there are a lot of tricks in Java that make testing a nightmare. Two of the most I hate are Anonymous Classes and Static Blocks. We have a lot of legacy code that make use of Static Blocks and thes...
<p><a href="http://powermock.org" rel="noreferrer">PowerMock</a> is another mock framework that extends EasyMock and Mockito. With PowerMock you can easily <a href="http://code.google.com/p/powermock/wiki/SuppressUnwantedBehavior" rel="noreferrer">remove unwanted behavior</a> from a class, for example a static initiali...
<p>Not really an answer, but just wondering - isn't there any way to "reverse" the call to <code>Mockit.redefineMethods</code>?<br> If no such explicit method exists, shouldn't executing it again in the following fashion do the trick?</p> <pre><code>Mockit.redefineMethods(ClassWithStaticInit.class, ClassWithStaticInit...
8,626
<p>When you use the POISSON function in Excel (or in OpenOffice Calc), it takes two arguments:</p> <ul> <li>an integer</li> <li>an 'average' number</li> </ul> <p>and returns a float.</p> <p>In Python (I tried RandomArray and NumPy) it returns an array of random poisson numbers. What I really want is the percentage t...
<p><code>scipy</code> has what you want</p> <pre><code>&gt;&gt;&gt; scipy.stats.distributions &lt;module 'scipy.stats.distributions' from '/home/coventry/lib/python2.5/site-packages/scipy/stats/distributions.pyc'&gt; &gt;&gt;&gt; scipy.stats.distributions.poisson.pmf(6, 2.6) array(0.031867055625524499) </code></pre> ...
<p><a href="http://numpy.sourceforge.net/numdoc/HTML/numdoc.htm#pgfId-305426" rel="nofollow noreferrer">This page</a> explains why you get an array, and the meaning of the numbers in it, at least.</p>
35,516
<p>I've noticed that Internet Explorer adds a number in square brackets to files downloaded from the internet (usually [1]). This creates a big problem with downloading Excel spreadsheets as square brackets are not a valid filename character inside Excel worksheet name. That problem is IE specific, others browsers are ...
<p>I've got it working using VBA provided by this cool guy (think of him fondly). It renames the file and then reattaches the pivots.</p> <p><a href="http://php.kennedydatasolutions.com/blog/2008/02/05/internet-explorer-breaks-excel-pivot-tables/" rel="nofollow noreferrer">http://php.kennedydatasolutions.com/blog/2008...
<p>In .NET I have found from experience only this seems to work for me:</p> <pre><code> Response.AddHeader("Content-Disposition", "attachment; filename=excel.xls"); Response.AddHeader("Content-Type", "application/vnd.ms-excel"); Response.ContentType = "application/vnd.ms-excel"; </co...
14,651
<p>What is the best SVN Ignore Pattern should TortoiseSVN have for a VB.NET solution?</p>
<p>this is what I use for C# w/resharper, should work just the same with vb.net:</p> <pre><code>build deploy */bin */bin/* obj *.dll *.pdb *.user *.suo _ReSharper* *.resharper* bin </code></pre>
<p>I always add Thumbs.db in as well, because I hate having those files versioned. Probably more of an issue for web developers </p>
2,612
<p>I have a bit of an odd request. I am studying the vulnerability of 3D printers and would like to know if there is a way to disable the limit switches on, for example, an Ender 3 in the G-code.</p> <p>Ideally, the exploit would be used by plugging in the malicious code via SD card into the 3D printer. I have found wa...
<h2>Ethics and justification:</h2> <p>If you have physical access to the device you could just... physically damage the device. Running arbitrary G-code is just more complicated</p> <p>Most printer farms have a strict no outside G-code policy for good reason. Because direct physical access to the printer does not provi...
<h2>Potential threat?</h2> <p>I can imagine that this is a potential threat for printers that are operated in an environment where there are lots of people using the printer where there is access to the SD card (e.g. schools, libraries or maker spaces). It would literally take a file on the SD card to be run the next t...
2,089
<p>I need to disable windows-update service from my installation. I already use vbscript to do some stuff so I would like to do it in vbscript.</p> <p>My knowledge of vbscript (or any other script language) is very limited so...can anybody help me out with that? I'll really appreciate it!</p> <p>Thanks.</p>
<p>Thanks Tomalak and Patrick Cuff. I really appreciate your help. I think this could be a good and complete answer.</p> <p>Method 1: prevents the "Automatic Updates" service from starting automatically when the machine boots.</p> <pre><code>strComputer = "." 'could be any computer, not just the local one ' Set objW...
<p>If you want to use VBScript, use WMI:</p> <pre><code>strComputer = "." 'could be any computer, not just the local one ' Set objWMIService = GetObject("winmgmts:\\" &amp; strComputer &amp; "\root\cimv2") Set colServiceList = objWMIService.ExecQuery _ ("Select * from Win32_Service where Name = 'wuauserv'") For Eac...
37,773
<p>I'm wondering if it's possible to define a foreign key in a models.py file in Django that is a reference to a table in another app?</p> <p>In other words, I have two apps, called cf and profiles, and in cf/models.py I have (amongst other things):</p> <pre><code>class Movie(models.Model): title = models.CharFie...
<p>According to the docs, your second attempt should work:</p> <blockquote> <p>To refer to models defined in another application, you must instead explicitly specify the application label. For example, if the Manufacturer model above is defined in another application called production, you'd need to use:</p> </block...
<p>OK - I've figured it out. You can do it, you just have to use the right <code>import</code> syntax. The correct syntax is:</p> <pre><code>from prototype.cf.models import Movie </code></pre> <p>My mistake was not specifying the <code>.models</code> part of that line. D'oh!</p>
41,918
<p>I wanted to use <code>fstream</code> to read a txt file.</p> <p>I am using <code>inFile &gt;&gt; characterToConvert</code>, but the problem is that this omits any spaces and newline.</p> <p>I am writing an encryption program so I need to include the spaces and newlines.</p> <p>What would be the proper way to go a...
<p>Probably the best way is to read the entire file's contents into a string, which can be done very easily using ifstream's <a href="http://en.cppreference.com/w/cpp/io/basic_ios/rdbuf" rel="nofollow noreferrer"><code>rdbuf()</code></a> method:</p> <pre><code>std::ifstream in("myfile"); std::stringstream buffer; buf...
<p>As Charles Bailey correctly pointed out, you don't need fstream's services just to read bytes. So forget this iostream silliness, use fopen/fread and be done with it. C stdio is part of C++, you know ;)</p>
14,247
<p>The code is,</p> <pre><code>set VAR=before if "%VAR%" == "before" ( set VAR=after; echo %VAR% ) </code></pre> <p>What will the preceding Windows .bat file code segment display? Why? (i.e. why doesn't it behave as you might first think)?</p>
<p>Obviously, you'd think the output would be "after", given that we reset the env variable inside the loop. </p> <p>But the output will actually be "before". The reason is that variable substitution is done in .bat files by the interpreter when a command is read, rather than when it's executed. So, for the compoun...
<p>The substitution for <code>%VAR%</code> occurs before the execution of the command. Even though there are several commands spread over several lines, the grouping of them in parens <code>(...)</code> causes the cmd.exe parser to read the whole thing in as a single command. So what gets executed looks like the follow...
27,042
<p>I'd like to popup a simple dialog with an editor box, to let user enter some value then just return. I am wondering whether iPhone SDK has that kind of support.</p> <p>Thanks.</p>
<p>I found a solution at : <a href="http://www.iphonedevsdk.com/forum/iphone-sdk-development/1704-uitextfield-inside-uialertview.html" rel="nofollow noreferrer">http://www.iphonedevsdk.com/forum/iphone-sdk-development/1704-uitextfield-inside-uialertview.html</a></p> <p>Here is the code which works for me. </p> <pre><...
<p>Add this function to your code it is called before the Alert is displayed. </p> <ul> <li>(void)willPresentAlertView:(UIAlertView *)alertView { alertView.frame = CGRectMake( x, y, width, heigth ); }</li> </ul>
35,872
<p>Right now I'm making an extremely simple website- about 5 pages. Question is if it's overkill and worth the time to integrate some sort of database mapping solution or if it would be better to just use plain old JNDI. I'll have maybe a dozen things I need to read/write from the database. I guess I have a basic under...
<p>Short answer: It depends on the complexity you want to support.</p> <p>Long answer:</p> <p>First of all, ORM ( object relational mapping - database mapping as you call it - ) and JNDI ( Java Naming and Directory Interfaces ) are two different things. </p> <p>The first as you already know, is used to map the Dat...
<p>Look at the various toplink guides here, they have intro, examples, scenarios etc</p> <p><a href="http://docs.oracle.com/cd/E14571_01/web.1111/b32441/toc.htm" rel="nofollow">http://docs.oracle.com/cd/E14571_01/web.1111/b32441/toc.htm</a></p>
14,908
<p>I'm wondering if I'm missing something about Java Beans. I like my objects to do as much initialization in the constructor as possible and have a minimum number of mutators. Beans seem to go directly against this and generally feel clunky. What capabilities am I missing out on by not building my objects as Beans?</p...
<p>It sounds like you are on the right track. It's not you who's missing the point of Java Beans, it is other programmers that are misusing them.</p> <p>The Java Beans specification was designed to be used with visual tools. The idea was that an application designer would be able to configure an instance of an object ...
<p>Beans are configured that way so automated tools can create and modify the Beans. They aren't meant to necessarily be great design patterns.</p> <p>Examples of these tools:</p> <p><a href="http://www.hibernate.org/" rel="nofollow noreferrer">Hibernate</a><br> <a href="http://java.sun.com/javase/technologies/core/...
40,679
<p>I have been playing with the Linq to Sql and I was wondering if it was possible to get a single result out? For example, I have the following:</p> <pre><code>using(DataClassContext context = new DataClassContext()) { var customer = from c in context.table where c.ID = textboxvalue ...
<p>Yes, it's possible.</p> <pre><code>using(DataClassContext context = new DataClassContext()) { var customer = (from c in context.table where c.ID = textboxvalue select c).SingleOrDefault(); } </code></pre> <p>This way you get 1 result or null if there isn't any result.</p> <p>You can also use <code>Single()</code>, w...
<pre><code>var customer = context.table.SingleOrDefault(c =&gt; c.ID == textboxvalue); </code></pre>
48,468
<p>I have been working on this for the greater part of the day and I cant seem to make this part of my code work. The intent of the code is to allow the user to input a set of values in order to calculate the missing value. As an additional feature I placed a CheckBox on the form to allow the user to do further calcula...
<p>Without really knowing what the problem is, a few things look a bit odd:</p> <ul> <li>Also, mixing decimal and int in a calculation can lead to unexpected results unless you really know what you are doing. I suggest using only decimals (or doubles, which are way faster and usually have enough precision for engineer...
<p>I don't know if this is huge but you are setting the text of the tb3_aic textbox twice when maybe you are trying to concatenate?</p> <pre><code>tb3_aic.Text = z.ToString(); tb3_aic.Text = Math.Round(z,0).ToString(); </code></pre> <p>You seem to be doing this in both methods. </p> <p>The more that I look at it, t...
47,100
<p>I'm trying to do a SQL Server 2008 setup and I've been given a Cross Language Installation failure. More specifically:</p> <p>Rule "cross language installation: failed. the Setup language is different than the language of existing SQL Server features. To continue, use SQL Server Setup installation media of the sa...
<p>I restarted the setup after facing the same problem, and I realized that man should not close the installation center till the setup process is completed. If you leave it open it will work.</p>
<p>If you've previously installed SQL on the machine (or apparently some RedGate tools) have you checked for any SQL detritus in the registry?</p> <p>If not then the <a href="https://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3493955&amp;SiteID=1" rel="nofollow noreferrer">MS forums</a> have details of some reg ke...
14,975
<p>I got this logic in a control to create a correct url for an image. My control basically needs to diplay an image, but the src is actually a complex string based on different parameters pointing at an image-server.</p> <p>So we decided to to create a control MyImage derived from asp:Image - it works like a charm. N...
<p>It can be similarly done. I believe on the Oracle AS there is an option at the bottom of the page when you create datasource which says add properties. I believe you can add the following over there and give it a try.</p> <pre><code>// Set the Client encryption level "oracle.net.encryption_client" = Service.getLe...
<p>Late reply somehow, but for any one who come across this question again</p> <p><strong><em>For Enryption/Integrity:</em></strong></p> <p>you will need to insert this properties manually in $J2EE_HOME/config/data-sources.xml as follows : -not tested thoroughly but should work, at least with little twicking , but sh...
28,824
<p>Open Source projects that ship with unit tests based on NUnit also usually ship the NUnit runners and accompanying binaries. For NUnit 2.4.8, distributing its <code>bin</code> directory verbatim with the actual project amounts to 46 files and a blank <code>addins</code> directory. What would be the minimum set of fi...
<p>I can successfully run tests with only the following 6 NUnit files present:</p> <ul> <li>nunit.core.dll</li> <li>nunit.core.interfaces.dll</li> <li>nunit.framework.dll</li> <li>nunit.util.dll</li> <li>nunit.console-runner.dll</li> <li>nunit-console.exe</li> </ul>
<p>For 2.6, in addition to Mooki's list, I had to add:</p> <ul> <li>nunit-agent.exe</li> </ul>
44,472
<p>I have an application that needs to send a moderately high volume of messages between a number of AppDomains. I know that I could implement this using remoting, but I have also noticed that there are cross-domain delegates. Has anyone looked at this kind of problem?</p>
<p>I have had good success using WCF with a named pipes binding. Using named pipes creates no network traffic and uses binary encoding, so it should be pretty fast without sacrificing the ability to distribute in future scaling scenarios.</p> <p>EDIT: Refer <a href="https://stackoverflow.com/questions/50153/interproc...
<p>This is just a quick thought, but I heard that even for cross-domain communication <strong>WCF</strong> would be the recommended approach, starting from .NET 3.0 of course. Actually this makes sense, as remoting is just another technology wrapped by WCF.</p>
40,539
<p>I have the following code making a GET request on a URL:</p> <pre><code>$('#searchButton').click(function() { $('#inquiry').load('/portal/?f=searchBilling&amp;pid=' + $('#query').val()); }); </code></pre> <p>But the returned result is not always reflected. For example, I made a change in the respon...
<p>You have to use a more complex function like <code>$.ajax()</code> if you want to control caching on a per-request basis. Or, if you just want to turn it off for everything, put this at the top of your script:</p> <pre><code>$.ajaxSetup ({ // Disable caching of AJAX responses cache: false }); </code></pre>
<p>Try this:</p> <pre><code>$("#Search_Result").load("AJAX-Search.aspx?q=" + $("#q").val() + "&amp;rnd=" + String((new Date()).getTime()).replace(/\D/gi, '')); </code></pre> <p>It works fine when i used it.</p>
20,395
<p>I have recently, in anticipation of printing carbon-fiber-reinforced nylon filament (Polymaker PA6-CF) on my Prusa i3 MK3S, built a filament drybox. It is made out of a large aluminum equipment enclosure which I had spare, every seam, rivet, hinge mount, foot screw, sealing lip, etc of which has been sealed with cop...
<p>Track humidity graph over days (one measurement every 3 hours is fine). Be careful that polling the sensor too often may warm it up and cause inaccuracies, the temperature dependence is quite strong. Also, you may need to poll twice at 5 s interval and discard the first reading if you want more accurate values.</p> ...
<p>Alright, there were some good suggestion in the comments, and I gave them a look, but I think I solved this myself.</p> <p>I think, after a lot more testing, that it was some combination of stratification and a faulty sensor. I managed to find four more DHT22s with which I could test the box, and found that the sens...
2,120
<p>My project requires a file where I will store key/value pair data that should be able to be read and modified by the user. I want the program to just expect the keys to be there, and I want to parse them from the file as quickly as possible.</p> <p>I could store them in XML, but XML is way to complex, and it would ...
<p>Use the <a href="http://msdn.microsoft.com/en-us/library/5tbh8a42.aspx" rel="noreferrer">KeyValuePair</a> class for you Key and Value, then just serialize a <a href="http://msdn.microsoft.com/en-us/library/6sh2ey19.aspx" rel="noreferrer">List</a> to disk with an <a href="http://msdn.microsoft.com/en-us/library/syste...
<p>Format the file this way:</p> <pre><code>key1=value1 key2=value2 </code></pre> <p>Read the entire file into a string (there is a simple convenience function that does that, maybe in the File or string class), and call string.Split('='). Make sure you also call string.Trim() on each key and value as you traverse th...
36,152
<p>In the question <a href="https://stackoverflow.com/questions/101066/what-little-things-do-i-need-to-do-before-deploying-a-rails-application">What little things do I need to do before deploying a rails application</a> I am getting a lot of answers that are bigger than "little things". So this question is slighly diff...
<p><strong>Set up Capistrano to deploy</strong> You'll want to learn capistrano if you don't already know it, and use it to deploy your code in an automated way. This will involve setting up your shared directory and shared resources like database.yml.</p> <p><strong>Install C Based MySQL gem</strong> If you don't hav...
<h2>Choose a web server / load balancer</h2> <p>My preferred server is nginx, but the common pattern is to start with apache + mod_proxy_http. </p>
12,672
<p>I have a UserControl in my Asp.net project that has a public property. I do not want this property to show up in the Visual Studio Property Window when a user highlights an instance of the UserControl in the IDE. What attribute (or other method) should I use to prevent it from showing up?</p> <pre><code>class MyCon...
<p>Use the following attribute ...</p> <pre><code>using System.ComponentModel; [Browsable(false)] public bool SampleProperty { get; set; } </code></pre> <p>In VB.net, this <a href="https://stackoverflow.com/questions/71440/set-a-usercontrol-property-to-not-show-up-in-vs-properties-window#71481">will be</a>:</p> <pr...
<p><a href="http://www.c-sharpcorner.com/UploadFile/mgold/PropertyGridInCSharp11302005004139AM/PropertyGridInCSharp.aspx" rel="nofollow noreferrer">Tons of attributes</a> out there to control how the PropertyGrid works.</p> <pre><code>[Browsable(false)] public bool HiddenProperty {get;set;} </code></pre>
9,694
<p>I use a pattern that looks something like this often. I'm wondering if this is alright or if there is a best practice that I am not applying here.</p> <p>Specifically I'm wondering; in the case that an exception is thrown is the code that I have in the finally block enough to ensure that the connection is closed a...
<p>Wrap your database handling code inside a "using"</p> <pre><code>using (SqlConnection conn = new SqlConnection (...)) { // Whatever happens in here, the connection is // disposed of (closed) at the end. } </code></pre>
<p>Might I suggest this:</p> <pre><code> class SqlOpener : IDisposable { SqlConnection _connection; public SqlOpener(SqlConnection connection) { _connection = connection; _connection.Open(); } void IDisposable.Dispose() { _c...
17,055
<p>I'm looking for a good GUI designer for swing in eclipse. My preference is for a free/open-source plugin.</p>
<p><a href="https://developers.google.com/java-dev-tools/wbpro/" rel="noreferrer">Window Builder Pro</a> is a great GUI Designer for eclipse and is now offered for free by google.</p>
<p>I use GWTDesigner <a href="http://www.instantiations.com/gwtdesigner/" rel="nofollow noreferrer">http://www.instantiations.com/gwtdesigner/</a> which is not free but works well. Best of all, their customer support is top notch - very responsive.</p>
4,907
<p>Is there a .dll version of the <a href="http://t3.dotgnu.info/blog/php/messy-programmers-beware.html" rel="nofollow noreferrer">inclued</a> extension for <a href="http://us2.php.net/manual/en/intro.inclued.php" rel="nofollow noreferrer">PHP</a>? The manual's link for <a href="http://pecl4win.php.net/ext.php/php_incl...
<p>As best as I can tell, the Windows version doesn't exist anymore. Maybe whoever was maintaining it before had to stop for some reason.</p> <p>I wonder what it takes to compile a PECL extension under Windows.</p> <hr> <p><strong>Edit</strong></p> <p>Here's some info on compiling a different PECL extension <a hre...
<p>Isn't this their DLL download site? <a href="http://pecl4win.php.net/list_dlls.php" rel="nofollow noreferrer">http://pecl4win.php.net/list_dlls.php</a></p> <p>Unless I'm off on my browsing of the site?</p>
29,854
<p>I'm trying to setup an Apache/PHP/Postgresql server locally on my machine. I'm using Windows vista business 32bit. I tried to install everything manually (one thing at a time, apache, postgresql and php (all the latest stable releases)) and after I get everything up and running.</p> <p>Whenever I try to run a scrip...
<p>You should have something like this in your httpd.conf file:</p> <pre><code>LoadModule php5_module "c:/php/php5apache2_2.dll" AddType application/x-httpd-php .php PHPIniDir "c:/php" </code></pre> <p>Make sure that's in place, and don't forget to restart apache!</p> <p>In Windows, the default location for your con...
<p>are you on Windows?</p> <p>I use <a href="http://www.wampserver.com/en/" rel="nofollow noreferrer">Wamp server</a>, which is an excellent way of getting Apache, MySQL and PHP installed and configured without any hassle on Windows.</p> <p>If you want to use Postgres instead, provided that you've got it installed se...
21,508
<p>I want to upload and then process a file in a Ruby on Rails app. The file upload is usually quite short, but the server-side processing can take some time (more than 20 seconds) so I want to give the user some indicator - something better than a meaningless 'processing...' screen.</p> <p>I'm trying to use the foll...
<p><code>periodically_call_remote()</code> updates a <code>div</code>. It won't call your JavaScript function. I'm no JavaScript guru, but to solve your problem, you should do your own <code>xmlhttp</code> call. If I were you, I'd use prototype's AJAX request</p> <p><a href="http://www.prototypejs.org/api/ajax/request...
<p>The <code>:update</code> option should only list the div you want to update, NOT have Javascript that you want to evaluate.</p> <p>The Rails helpers are still very good for this situation, there's no need to write much custom JS. If you wish to execute JS on return, an easy way would be to render an RJS template. ...
14,620
<p>What data structure does the following declaration specify?</p> <pre><code> List&lt;ArrayList&gt;[] myArray; </code></pre> <p>I think it should declare an array where each element is a <code>List</code> (e.g., a <code>LinkedList</code> or an <code>ArrayList</code>) and require that each <code>List</code> contain <...
<p>The answer is that arrays can only hold reified types. And generified classes are not reified. That is, the runtime "type" of the List&lt;ArrayList&gt; is just List. Generics are erased at runtime (google "wall of erasure" for more). </p> <p>So this: </p> <pre><code>List&lt;ArrayList&gt;[] myArray </code...
<p>You are correct in saying: </p> <blockquote> <p>After running some tests, I determined the declaration means an array where each element is an ArrayList object.</p> </blockquote> <p>Executing this code</p> <pre><code>List&lt;ArrayList&gt;[] myArray = new ArrayList[2]; myArray[0] = new ArrayList&lt;String&gt;(...
22,451
<p>Does anyone know of a <code>SQL</code> library in <code>ASP.NET</code> that can be used to manage tables?</p> <p>E.g.</p> <pre><code>SQLTable table = new SQLTable(); table.AddColumn(“First name”, varchar, 100); table.AddColumn(“Last name”, varchar, 100); if(table.ColumnExists(“Company”)) table.RemoveColumn(“Comp...
<p>Use Microsoft.SqlServer.Management.Smo</p> <p>Other option would be to install the Microsoft Sql Server Web Data Administrator</p> <p><a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=C039A798-C57A-419E-ACBC-2A332CB7F959&amp;displaylang=en" rel="nofollow noreferrer">Sql Server Web Data Administrato...
<p>I would tell you to use SQL DMO, but it looks like it's being discontinued by the looks of it:</p> <p><a href="http://msdn.microsoft.com/en-us/library/ms131540.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms131540.aspx</a></p> <p>Not sure what it's being replaced with.</p>
45,766
<p>When I restart my apache2 and reload a page, the log file shows</p> <pre><code>boogie.tontut.fi - - [28/Oct/2008:03:27:49 +0200] "GET /test HTTP/1.1" 404 457 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3" </code></pre> <p>...as supposed to, as it's <code>03:27:49</...
<p>sudo vim /etc/php5/apache2/php.ini</p> <h1>Add time zone</h1> <p>date.timezone=&quot;Europe/London&quot;</p> <p>restart apache2 /etc/init.d/apache2 restart</p>
<p>Try and set your timezone explicitly in the <code>httpd.conf</code>:</p> <pre><code>SetEnv TZ GMT+2 </code></pre>
29,957
<p>We can see in a directory files ordered by Name in Windows Explorer.</p> <p>If I try the same thing in the Windows command prompt it orders by name differently - <em>correctly</em>:</p> <pre><code>dir *.jpg /ON /B cubierta.jpg pag00.jpg pag06.jpg pag08.jpg pag09.jpg pag100.jpg pag101.jpg pag102.jpg pag103.jpg pag...
<p>Your best option (if possible) is to add enough leading zeros (two, in this case) to your smaller numbers so that the sort does come out as expected. </p>
<p>No, there's no way to do this. Windows Explorer uses a different approach to handle this.</p>
30,083
<p>As a follow-up to another <a href="https://stackoverflow.com/questions/162991/selecting-proper-toolkit-for-a-2d-simulation-project-in-java">question</a>, I was wondering what would be the best way to use SVG in a Java project.</p>
<p>The Apache <a href="http://xmlgraphics.apache.org/batik/" rel="nofollow noreferrer">Batik</a> project is an open source SVG renderer written in Java. You can pass it an SVG file, or create a document programatically via a DOM-style API accesssible from Java code.</p>
<p>Besides Batik there is also <a href="https://svgsalamander.java.net/" rel="nofollow noreferrer">SVG Salamander</a>.</p> <p>Personally I prever Salamander, it only doesn't support all SVG features, eg. Gaussian blurring.</p>
19,783
<p>How can I redirect the response to an IFrame?</p>
<p>Do you mean from the server-side? - You can't!</p> <p><strong>You'll have to do it on the client side.</strong></p> <p>Say, use a javascript that sends an <em>AJAX request</em> and then embed your response information in the <em>AJAX response</em>. And have the javascript read the response and changes the page in ...
<p>. . . not totally sure what your trying to do, but you normally control the source of an iframe through javascript</p>
9,847
<p>I'm having some trouble uploading and getting my web app on the net with my chosen host. I built a war file in Net Beans and asked my host to deploy it for me. This worked fine but to access it I had to point my browser to:</p> <pre><code>www.myDomain.co.uk/explodedWar </code></pre> <p>What of course I wanted wa...
<p>If you name your war ROOT.war (in Tomcat) it should do what you want.</p>
<p>This is a question you need to ask your host about since they are deploying it for you.</p>
41,735
<p>I've created a table in Microsoft Sql CE that I'm using to hold some data. I've generated an ORM via SqlMetal and I've pulled the datasource into my WPF project.</p> <p>I want to create a simple WPF form that can be used to edit a record in the table via the ORM-generated classes. I want this form to support typi...
<p>Paul Stovell has a brilliant article about creating an adapter for the IEditableObject interface that allows you to databind and allow apply/revert behaviour.</p> <p><a href="http://www.paulstovell.com/blog/runtime-ui-binding-behavior-ieditableobject-adapter" rel="noreferrer">http://www.paulstovell.com/blog/runtime...
<p>One possible solution would be to look for a cancel result from the dialog and, using the ORM object's primary key, retrieve the data from the database every time the user cancels to verify that the object contains the value it had in the database. This assumes that the value's most recently confirmed value has alr...
45,177
<p>Not <em>strictly</em> a programming question, but I was programming at the time and couldn't find an answer, so I thought, "Hey, I'll give StackOverflow a try!"</p> <p>So I'm connected to my Windows XP work PC over a Remote Desktop connection through VPN. In a command window (on the remote PC), I foolishly type <c...
<p>If it makes you feel any better, most of us have done something similar. I can't offer a suggestion that doesn't involve human intervention, but I can offer two ways to prevent a &quot;next time&quot; for you:</p> <ol> <li><p>Look into a remote power controller. Cheap (inexpensive, hobbyist-grade) options are avai...
<p>Try giving a call to the office and get someone(if any) to restart your computer or ipconfig /renew</p>
31,988
<p>Can I have a custom service providing the storage of the models I use in Django? That service would not be speaking SQL.</p> <p>I would like to build a web frontend to a system that consists of multiple services linked with a network based IPC, one of which provides an interface to commonly used, persistent objects...
<p>You might take a look at <a href="http://lethain.com/entry/2008/aug/18/an-introduction-to-using-couchdb-with-django/" rel="noreferrer">An introduction to using couchdb with django</a>. Dunno if connecting to CouchDB is directly something that interests you, but this is a pretty good example of how to use django to ...
<p>I think you want to write a custom database backend and then use it via the DATABASE_ENGINE setting. Models will pick it up automatically then.</p> <p>I couldn't find good docs, but I'd start here:</p> <p><a href="http://djangoapi.matee.net/django.db-module.html" rel="nofollow noreferrer">http://djangoapi.matee.n...
24,094
<p>I want to return top 10 records from each section in one query. Can anyone help with how to do it? Section is one of the columns in the table.</p> <p>Database is SQL Server 2005. I want to return the top 10 by date entered. Sections are business, local, and feature. For one particular date I want only the top (1...
<p>If you are using SQL 2005 you can do something like this...</p> <pre><code>SELECT rs.Field1,rs.Field2 FROM ( SELECT Field1,Field2, Rank() over (Partition BY Section ORDER BY RankCriteria DESC ) AS Rank FROM table ) rs WHERE Rank &lt;= 10 </code></pre> <p>If y...
<p>You can try this approach. This query returns 10 most populated cities for each country.</p> <pre><code> SELECT city, country, population FROM (SELECT city, country, population, @country_rank := IF(@current_country = country, @country_rank + 1, 1) AS country_rank, @current_country := country FRO...
21,314
<p>I would like to read the text and binary attachments in a saved Outlook message (.msg file) from a Java application, without resorting to native code (JNI, Java Native Interface). </p> <p><a href="http://poi.apache.org/hsmf/index.html" rel="noreferrer">Apache POI-HSMF</a> seems to be in the right direction, but it'...
<ul> <li><p>You could use Apache POIFS, which seems to be a little more mature, but that would appear to duplicate the efforts of POI-HSMF.</p></li> <li><p>You could use POI-HSMF and contribute changes to get the features you need working. That's often how FOSS projects like that expand.</p></li> <li><p>You could use ...
<p>Have you tried to use Jython with the Python win32 extensions (<a href="http://www.jython.org/Project/" rel="nofollow noreferrer">http://www.jython.org/Project/</a> + <a href="http://python.net/crew/mhammond/win32/" rel="nofollow noreferrer">http://python.net/crew/mhammond/win32/</a>)? If this is for a "personal" o...
9,157
<p>I'm interested in writing software that depends on being able to identify that there is a face in a picture (or video frame). It doesn't have to ID the face - so no metrics other than:</p> <ul> <li>Is there a human face in the picture (or more than one)</li> <li>Where, approximately, are the eyes and mouth or nose...
<p>Check out the OpenCV library, here is a link for a <a href="http://opencv.willowgarage.com/wiki/" rel="nofollow noreferrer">good wiki about it</a>.</p> <p><a href="http://opencv.willowgarage.com/wiki/FaceDetection" rel="nofollow noreferrer">And here</a> you can see a sample program of implementing a face recognitio...
<p>This is not a complete answer but it might help. Eigen-vectors are also used in face recognition: <a href="http://en.wikipedia.org/wiki/Eigenface" rel="nofollow noreferrer">eigenfaces</a>.</p>
22,939
<p>This sounds dumb, but I can't get it to work. I think i just dont' understand the difference between <code>%%v, %v% and %v</code></p> <p>Here's what I'm trying to do:</p> <pre><code>for %%v in (*.flv) do ffmpeg.exe -i "%%v" -y -f mjpeg -ss 0.001 -vframes 1 -an "%%v.jpg" </code></pre> <p>This successfully generate...
<p>For people who found this thread looking for how to actually perform string operations on for-loop variables (uses <a href="http://ss64.com/nt/delayedexpansion.html" rel="noreferrer">delayed expansion</a>):</p> <pre><code>setlocal enabledelayedexpansion ... ::Replace "12345" with "abcde" for %%i in (*.txt) do ( ...
<p>Yet another way that I prefer is to create a <em>sub-routine</em> (:processMpeg) that I call for each element in the For loop, to which I pass the %%v variable. </p> <pre><code>for %%v in (*.flv) do call :processMpeg "%%v" goto :eof :processMpeg set fileName=%~n1 echo P1=%1 fileName=%fileName% fullpath=%~dpn...
31,438
<p>I am using Rob Connery's excellent MVC Storefront as a loose basis for my new MVC Web App but I'm having trouble porting the LazyList code to VB.NET (don't ask).</p> <p>It seems that VB doesn't allow the GetEnumerator function to be specified twice with only differing return types. Does anyone know how I might get ...
<p>VB.NET allows you to specify a name for the function which differs from the function you are implementing.</p> <pre><code>Public Function GetEnumerator() As IEnumerator(Of T) _ Implements IEnumerable(Of T).GetEnumerator Return Inner.GetEnumerator() End Function Public Function GetListEnumerator() As IEnumerat...
<p>Sorry, I don't know how to get around this using VB, but one of the advantages of .NET is that at runtime you can use assemblies built using different languages. Therefore, you could create a very simple C# assembly containing the LazyList class and just reference that assembly. This is the whole point of the cross-...
38,734
<p>I have heard that WPF primitives will not be supported by remote desktop on windows XP. The implication of this is that if you run a WPF application on a vista machine and display it on an XP machine (via remote desktop) the display will be sent as a compressed bitmap.</p> <p>This issue is resolved in Vista-Vista ...
<p>As of .NET 3.5 SP1, all WPF graphics are remoted as bitmaps, even on Vista-to-Vista communication. From <a href="http://blogs.msdn.com/jgoldb/archive/2008/05/15/what-s-new-for-performance-in-wpf-in-net-3-5-sp1.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/jgoldb/archive/2008/05/15/what-s-new-for-performance-...
<p>i guess this depends on your wpf app. if you have lots of gradients, animations, brushes, etc...your app will definitely run slower over the wire...</p>
24,112
<p>I'm using Cruise Control .Net 1.4 for Continuous integration and have installed it on my Windows 2000 desktop. I have Nant 0.85 for the Build. My Source control is in Borland Starteam 2005. I have the .Net 2003 framework installed which I use for creating VB.Net windows applications. I have installed CCNet and I thi...
<p>I had challenges in understanding the documentation for installing and configuring CruiseControl.Net with StarTeam as the souce control in a Vista system running IIS 7. Finally I have successfully set up cruise control to work. I am listing the steps to get it working.</p> <p>Step 1:Grab a copy of CruiseControl.Net...
<p>I am not surprised, I've used Star Team once and I can only say that the level of crap I had to get used to in that repository tool has only been surpassed ever in my entire programming career by Source Safe...</p> <p>Don't use Star Team, if I were to start a big new project today I'd probably use GIT...</p>
39,176
<p>For example: Updating all rows of the customer table because you forgot to add the where clause.</p> <ol> <li>What was it like, realizing it and reporting it to your coworkers or customers? </li> <li>What were the lessons learned?</li> </ol>
<p>I think my worst mistake was</p> <pre><code>truncate table Customers truncate table Transactions </code></pre> <p>I didnt see what MSSQL server I was logged into, I wanted to clear my local copy out...The familiar "OH s**t" when it was taking significantly longer than about half a second to delete, my boss noticed...
<p>I dropped the live database and deleted it.</p> <p>Lesson learned: ensure you know your SQL - and make sure that you back up before you touch stuff.</p>
3,323
<p>I want to exclude a subdirectories by pattern in subversion because the development tool we are using is generating them. Getting the tool to generate the directories elsewhere is not an option. We don't want to edit the global-ignore property in ~/.subversion/config as it is difficult to maintain consistency with ...
<blockquote> <p>Can be done using an svn:ignore on rootdir</p> </blockquote> <p>No. <code>svn:ignore</code> specifically are <em>not</em> applied recursively but only on the current folder. Since each folder holds its own versioning information, nothing is propagated to subfolders. See <a href="http://svnbook.red-be...
<p>You might consider another approach.</p> <p>Typically, the desire to exclude subdirectories and/or files from source control is an indication that those subdirectories and/or files are in the wrong place--they should be moved out of the source tree. For example, if they are build output, then reconfigure your buil...
49,604
<p>How do you convert a number to a string showing dollars and cents?</p> <pre><code>eg: 123.45 =&gt; '$123.45' 123.456 =&gt; '$123.46' 123 =&gt; '$123.00' .13 =&gt; '$0.13' .1 =&gt; '$0.10' 0 =&gt; '$0.00' </code></pre>
<p>PHP also has <a href="http://php.net/money_format" rel="noreferrer">money_format()</a>.</p> <p>Here's an example:</p> <pre><code>echo money_format('$%i', 3.4); // echos '$3.40' </code></pre> <p>This function actually has tons of options, go to the documentation I linked to to see them.</p> <p>Note: money_format ...
<pre><code>/* Just Do the following, */ echo money_format("%(#10n","123.45"); //Output $ 123.45 /* If Negative Number -123.45 */ echo money_format("%(#10n","-123.45"); //Output ($ 123.45) </code></pre>
37,645
<p>I have a VB6 picture box that gets an image from a video capture device.</p> <p>I'm trying to figure out how to then convert the picture box to a byte array.</p>
<pre><code>Private Type BITMAP bmType As Long bmWidth As Long bmHeight As Long bmWidthBytes As Long bmPlanes As Integer bmBitsPixel As Integer bmBits As Long End Type Private Declare Function GetObject Lib "gdi32" Alias "GetObjectA" (ByVal hObject As Long, ByVal nCount As Long, lpObject As ...
<p>It's been a long time since I've worked with VB6 but as far as I remember, you can just serialize the image into a <code>PropertyBag</code> and get the contents as a byte array.</p> <p>The only alternative I know requires heavy use of WinAPI to accomplish the same.</p>
35,272
<p>First off, let me start off that I am not a .net developer. The reason why I am asking this question is that we rolled out our REST-API and one of our first integration partners is a .net shop.</p> <p>So basically we assumed that .net would provide some sort of wrapper to create JSON, but the developer in question ...
<p>There are a couple first-party and third-party options. <a href="http://www.west-wind.com/weblog/posts/442969.aspx" rel="noreferrer">Rick Strahl</a> has a good overview. <a href="http://james.newtonking.com/pages/json-net.aspx" rel="noreferrer">JSON.net</a> is the most popular third-party option.</p>
<p>Check out <a href="http://msdn.microsoft.com/en-us/library/bb410770.aspx" rel="nofollow noreferrer">DataContractJsonSerializer</a>.</p>
19,214
<p>I have a Prusa i3 (from FLSun). I have assembled the printer, calibrated it (fairly decently), and have successfully demonstrated extrusion manually. However, when I try to run a print job (the G-code clearly contains E commands), the extruder motor never rotates. Is this a common problem? Any suggestsions for how t...
<p>According to all the information:</p> <ul> <li>No reassignment of the extruder in the Gcode</li> <li>You can extrude if you push the filament by hand</li> <li>Extruder motor works when switched to Z driver</li> <li>Z Motor works</li> </ul> <p>I come to the conclusion that some of your electronics or the motor have...
<p>This should have been a comment: when you say "manual extrusion", do you mean moving filament by hand or using extruder position commands from printer menu? Is extruder motor working at all? You can for example plug it instead of a Z-motor to check.</p> <p>Suggested points to check:</p> <ul> <li>Motor wire connect...
729
<p>Do you write <code>createSomething()</code> or <code>addSomething()</code>?</p> <p>Do you write <code>readSomething()</code>, <code>getSomething()</code> or <code>fetchSomething()</code>?</p> <p>This is totally a petty gripe. In the meeting room we refer to it as CRUD, but in actual code, it's becoming AGUD.</p> ...
<p>I prefer <strong>CRUD</strong> over <strong>AGUD</strong> and <strong>AFUD</strong>.</p> <hr> <p><strong>CREATE</strong> Vs <strong>ADD</strong></p> <p>We are trying to use both of these words to indicate that we are building something new. <strong>CREATE</strong> leaves no room for interpretation; something tha...
<p>I think this is fairly common. Our DAOs certainly are of the Add, Get, Update, Delete (set status to 'C'ancelled, etc) method names. At the DB level they're Inserts, Selects, Updates and Deletes - ISUD.</p> <p>It could be Persist, Fetch, Delete. Persist either Adding or Updating as necessary.</p>
47,023
<p>If php code like below how it's like as mysql stored procedure equivalent. If any links tutorial on advance stored procedure mysql please put.</p> <pre><code>$sql = " SELECT a,b FROM j "; $result = mysql_query($sql); if(mysql_num_rows($result) &gt; 0) { while($row = mysql_fetch_array($result)) { $sql_...
<p>There's a pretty complete example here. The article is about Qcodo, but there's a good example using the <code>mysqli</code> API.</p> <p><a href="http://amountaintop.com/php-5-and-mysql-5-stored-procedures-error-and-solution-qcodo" rel="nofollow noreferrer">http://amountaintop.com/php-5-and-mysql-5-stored-procedur...
<p>You could look into mysqli and use prepared statements?</p>
48,386
<p>I am a newbie in the software development field. I am hungry for more avenues through which I can develop, nurture, and mature in my development, scripting, and programming skills, more so outside of work time. I'd like to know what type of set-up (hardware and/or software) would be extremely beneficial or that othe...
<p><strong>Write Code:</strong></p> <p>In this <A href="http://www.codinghorror.com/blog/archives/001160.html" rel="noreferrer">article</A> <A href="http://stackoverflow.com/users/1/jeff-atwood">Jeff Atwood</A> talks about how to become better at designing and writing software by designing and writing a lot of softwar...
<p>I recommend KATE (part of KDE) as an editor. It's a lightweight and easy editor with syntax highlighting, multiple files, and a built-in terminal. It's not imposing like emacs or vim, and it is great for all sorts of projects, because of the terminal. It's sort of like a mini-IDE.</p>
38,988
<p>Does anyone have a library or JavaScript snippet to validate the check digit of credit cards before the user hits Submit?</p>
<p>The <a href="http://bassistance.de/jquery-plugins/jquery-plugin-validation/" rel="noreferrer">jQuery Validation Plugin</a> has a <a href="http://jquery.bassistance.de/api-browser/plugins.html#jQueryvalidatormethodscreditcard" rel="noreferrer">method</a> for validating credit card numbers.</p> <p>There are other spe...
<p>You can use this function if you're not already using the jQuery plugin. It's based on the Luhn algorithm and is tolerant of spaces or dashes so should work for most data entry cases you would need it for.</p> <p><a href="http://af-design.com/blog/2010/08/18/validating-credit-card-numbers/" rel="nofollow noreferrer...
31,872
<p>What options do I have for error handling in ASP.NET MVC?</p> <p>Do I call GetLastError on the error page and send out the email or log it?</p>
<p>Depending on what tools you are looking at, just give him SQL Server Management Studio. He can then execute the stored procedure and save the results in a CSV format. That is your most elegant way to be able to do it in a dynamic fashion.</p> <p>Otherwise, you might look at creating an SSIS package if the values ...
<p>Take a look at SQL Server Reporting services. You can export the results of a report to Excel.</p>
44,295
<p>I have noted that the default SharePoint databases are created with a "Full" in Recovery Model, 1 Mb autogrowth on Data and a 10% growth on the log file.</p> <p>I know that these settings should be adjusted to the specific customer, but I have not yet been able to find any rules of thumb about the optimal db settin...
<p>The SharePoint configuration database and the SharePoint content databases, should in a production environment always be configured with full recovery. You might otherwise lose the ability to roll back the databases beyond the point of an accidental data loss. The SSP databases can be on Simple Recovery, which I thi...
<p>You cannot allow SharePoint to create your content databases. The default as you have noted is 1MB default size with a 10% growth. If a database autogrow occurs during use of your database, all web sites inside that site collection will stop while the database allocates more space. Also you will be all but guarante...
49,685
<p>Inside a service, what is the best way to determine a special folder path (e.g., &quot;My Documents&quot;) for a specific user? <code>SHGetFolderPath</code> allows you to pass in a token, so I am assuming there is some way to impersonate the user whose folder you are interested in.</p> <p>Is there a way to do this b...
<p>Please, do not go into the registry to find this information. That location might change in future versions of Windows. Use SHGetFolderPath instead.</p> <p><a href="http://msdn.microsoft.com/en-us/library/bb762181(VS.85).aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/bb762181(VS.85).aspx</a></p> <p...
<p>This information is stored in the registry in the key "HKEY_USERS\S-1-5-21-616815238-485949776-2992451252-3228\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders". </p> <p>The "S-1-5-21-616815238-485949776-2992451252-3218" is the GUID of the user. You need to get this GUID to find the correspondi...
24,128
<p>Given a list <code>[&quot;foo&quot;, &quot;bar&quot;, &quot;baz&quot;]</code> and an item in the list <code>&quot;bar&quot;</code>, how do I get its index <code>1</code>?</p>
<pre><code>&gt;&gt;&gt; [&quot;foo&quot;, &quot;bar&quot;, &quot;baz&quot;].index(&quot;bar&quot;) 1 </code></pre> <p>Reference: <a href="https://docs.python.org/tutorial/datastructures.html#more-on-lists" rel="noreferrer">Data Structures &gt; More on Lists</a></p> <h1>Caveats follow</h1> <p>Note that while this is per...
<p>Simple option:</p> <pre><code>a = [&quot;foo&quot;, &quot;bar&quot;, &quot;baz&quot;] [i for i in range(len(a)) if a[i].find(&quot;bar&quot;) != -1] </code></pre>
21,310
<p>Our team has built a site using Sharepoint and a few custom webparts. We've noticed that the site takes a while to load when first accessing the site in the morning. Subsequent accesses are fine. We suspect that Sharepoint is reindexing its lists, etc. </p> <p>Has anyone else seen this problem with Sharepoint? ...
<p>By default an IIS application will recycle its worker processes during the night. You can turn this off in IIS manager, but a better option may be to just add a warmup script to a timed job. You can do this in SharePoint but simpler is probably to just add a scheduled task in Windows to fire off the a warmup script ...
<p>Of course, Bjorn highlight the main cause of the "issue". Application pool get recycled during the night. </p> <p>However, this should take something like 30 seconds.</p> <p>If it takes something like 2 or 3 minutes, consider reading <a href="http://www.muhimbi.com/blog/2009/04/new-approach-to-solve-sharepoints.ht...
46,732
<p>Which is the best way to display a custom form for each new document being added to a specific document library?</p> <p>I want the user to have some control over some actions that adding the document will cause - specifically, tasks created for users in a Task List, which the contributing user will have to OK befor...
<p>I don't know how well it works with the CD/DVD distribution front, but the first thing that comes to mind is <a href="http://code.google.com/p/gears/" rel="nofollow noreferrer">Gears</a>. On the .NET side of the fence there's <a href="http://www.microsoft.com/silverlight/" rel="nofollow noreferrer">Silverlight 2</a>...
<p>You could create an image of your server as a VMware instance and distribute it with a copy of VMware player (licensing allowing of course). Personally I'd build it on top of a Linux distribution like CentOS5.</p>
42,902
<p>I'm using the <code>File::Find</code> module to traverse a directory tree. Once I find a specific file, I want to stop searching. How can I do that?</p> <pre><code> find (\$processFile, $mydir); sub processFile() { if ($_ =~ /target/) { # How can I return from find here? } } </code><...
<p>Seems like you will have to die:</p> <pre><code>eval { find (\$processFile, $mydir); }; if ( $@ ) { if ( $@ =~ m/^found it/ ) { # be happy } else ( $@ ) { die $@; } } else { # be sad } sub processFile() { if ($_ =~ /target/) { die 'found it'; } } </code></pre>
<p>The function processFile() should return true if it finds the file, and false otherwise. So, every time that processFile calls himself should check this return value. If it is true, some recursive call has found the file, so there's no need to call himself again, and it must also return true. If it's false, the file...
49,993
<p>In applying for jobs via agents I sometimes get blocked by an agent who says do you know software package X. When I reply that I know the similar package Y they might say unless you know X I cannot put you forward.</p> <p>The problem is that some of these agents don't know what they talking about, they are merely b...
<p>I'll state my bias upfront - Oracle is far more complex than Sql Server. So it depends what you'll be asked to do. You say that this is not for a DBA position but that definition is pretty fluid. At my company, Developers are charged with designing tables, adding the correct indexes, determining partitioning. </p> ...
<p>I went from SQL Server to Oracle in 2001 where I went from working on a VB6/SQL Server project (as a developer) to working as an Oracle development DBA for a large J2EE project. Here are the edited highlights of my experiences and some reflections.</p> <p>For development, the basic principle of SQL is not radicall...
22,057
<p>I need to <strong>disable PUT, DELETE &amp; TRACE HTTP requests</strong> on my Application Server, Apache Tomcat 6.0.</p> <p>All other sources, i have searched till now, have directed me towards the limit parameter in <em>httpd.conf</em>, Hence I'd put it before-hand that I am not using Apache Web Server, and reque...
<p>Inside your WEBINF, add you can add a security constraint:</p> <pre class="lang-xml prettyprint-override"><code>&lt;security-constraint&gt; &lt;web-resource-collection&gt; &lt;web-resource-name&gt;Forbidden&lt;/web-resource-name&gt; &lt;url-pattern&gt;/blah/*&lt;/url-pattern&gt; &...
<p>The answer lies in the servlet specification. In looking at the API for the servlet: <a href="http://java.sun.com/products/servlet/2.5/docs/servlet-2_5-mr2/javax/servlet/http/HttpServlet.html" rel="nofollow noreferrer">http://java.sun.com/products/servlet/2.5/docs/servlet-2_5-mr2/javax/servlet/http/HttpServlet.html<...
41,524
<p>I use <a href="http://xfire.codehaus.org/" rel="nofollow noreferrer">XFire</a> to create a webservice wrapper around my application. XFire provides the webservice interface and WSDL at runtime (or creates them at compile time, don't know exactly).</p> <p>Many of our customers don't know webservices very well and ad...
<p>XFire is slowly headed for /dev/null. Use <a href="http://cxf.apache.org/" rel="nofollow noreferrer">CXF</a> instead. In other words, XFire is being deprecated in favor of CXF - it's pretty much the same developers.</p> <p>Since you use the Java-first approach, I suggest you generate you WSDL once and for all with ...
<p>Let's me add my two cents regarding XFire. We had very serious issue with XFie under JDK6 (both Tomcat 6.0 and 5.5).Please take a glance at <a href="http://jira.codehaus.org/browse/XFIRE-1033" rel="nofollow noreferrer">that issue</a>. In our case XFire with 4+ web services under JDK6 leads to hanging application ser...
22,048
<p>Businesses Analyst from my team keeps sending us the updated Requirements documents often and I end up hunting the recent changes by comparing the old version. Is their a good way of comparing the Word documents? </p> <p>Note: We have the track changes option ON, but now the documents looks like a blood bath, compl...
<p>Use this option in Word 2003: </p> <blockquote> <p><strong>T</strong>ools | Compare and Merge <strong>D</strong>ocuments</p> </blockquote> <p>Or this in Word 2007: </p> <blockquote> <p><strong>R</strong>eview | Co<b>m</b>pare</p> </blockquote> <p>It prompts you for a file with which to compare the file you...
<p>The document comparison features in Word 2003 are extremely poor, and often results in the user removing parts of documents they did not want too</p> <p>The only rational choice is to use other software. There are a multitude of text comparing software in the marketplace, but to do this within Word, the simplest an...
11,548
<p>Is it possible to handle POSIX signals within the Java Virtual Machine?</p> <p>At least <a href="http://en.wikipedia.org/wiki/SIGINT_(POSIX)" rel="noreferrer">SIGINT</a> and <a href="http://en.wikipedia.org/wiki/SIGKILL" rel="noreferrer">SIGKILL</a> should be quite platform independent.</p>
<p>The JVM responds to signals on its own. Some will cause the JVM to shutdown gracefully, which includes running shutdown hooks. Other signals will cause the JVM to abort without running shutdown hooks.</p> <p>Shutdown hooks are added using <a href="http://java.sun.com/javase/6/docs/api/java/lang/Runtime.html#addShut...
<p>Perhaps <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Runtime.html#addShutdownHook%28java.lang.Thread%29" rel="nofollow noreferrer">Runtime#addShutdownHook</a> ?</p>
6,162
<p>I have searched around, and it seems that this is a limitation in MS Access, so I'm wondering what creative solutions other have found to this puzzle.</p> <p>If you have a continuous form and you want a field to be a combo box of options that are specific to that row, Access fails to deliver; the combo box row sour...
<p>I also hate Access, but you must play with the cards you are dealt. Continuous forms are a wonderful thing in Access, until you run into any sort of complexity as is commonly the case, like in this instance. </p> <p>Here is what I would do when faced with this situation (and I have implemented similar workarounds b...
<p>Disclaimer: I hate Access with a passion.</p> <p>Don't use continuous forms. They're a red herring for what you want to accomplish. Continuous forms is the same form repeated over and over with different data. It is already a kludge of Access's normal mode of operation as you can't have the same form opened multipl...
11,180
<p>I have a search form with a query builder. The builder is activated by a button. Something like this</p> <pre><code>&lt;h:form id="search_form"&gt; &lt;h:outputLabel for="expression" value="Expression"/&gt; &lt;h:inputText id="expression" required="true" value="#{searcher.expression}"/&gt; &lt;button onclick=...
<p>A button in an HTML form is assumed to be used to submit the form. Change button to input type="button" and that should fix it.</p> <p>Alternatively, add type="button" to the button element.</p>
<p><strong>if there is a single input field</strong> within the form, many browsers submit the forms automatically when the enter key is hit. </p> <p>Try</p> <ol> <li>Add another input field. Hide it by styling it so it isn't visible. (e.g., <code>&lt;input type="text" name="bogusField" style="display: none;" /&gt...
14,274
<p>I have a problem regarding hosting of a WCF service on IIS 6.</p> <p>My host is fine, I assume, and I can connect to it from a normal app, and get my stuff done. But now I want to stress test the service and I wanna do it from a web client, normal aspx page calling the wcf service with a click of a button, and bein...
<p>I've had similar problems before, I had to ensure that I closed the factory as soon as I'd finished with it. You can increase the number of allowed connection to the service too, but you should make sure that you close the factory the moment you've finished with it.</p> <p>As always, check out <strong>Nicholas Alle...
<p>Try tracing the services and read the generated logs with the <a href="http://msdn.microsoft.com/en-us/library/ms732023.aspx" rel="nofollow noreferrer">SvcTraceViewer</a></p>
24,106
<p>I need to get array fragments from an array. I'm sick of using Array.Copy(). new ArraySegment(..).Array returns the original [full] array. The one below is what I came up with but I feel it's pretty lame. Is there a better way to do this?</p> <p><code></p> <pre><code>class Program { static void Main(string[...
<p>Vyas, I am <em>truly</em> sorry for having posted this useless pile of <code>****</code>. It's been ages since I've actually used <code>ArraySegment</code> and I simply assumed that it implemented a (more or less) consistent interface. Someone (Jon?) please tell me which drugs were used during the implementation of ...
<p>Just another side-effect of poor iterator design in C# btw. There are many instances similar (just as 'lame') where it would just plain good design to be able to pass or point or control segments (aka concept called range) without all the archane shickanery.. copy semantics or not, array is also a well-defined conce...
49,744
<p>For a school project, my teacher gave me a brand new Longer 3D printer to create parts with. After one good job, the printer cannot get past the raft creation without air printing. The thickness of the printed filament tapers down until no filament is coming out. I do not believe there is a jam in the hot end becaus...
<p>If you use a build surface such as PEI, acetone frosts your surface, leaving a white film appearance. If you have no additional surface on a glass or metal bed, it is incomplete cleaning. If incomplete cleaning, you could try isopropyl alcohol (IPA) immediately after acetone, followed immediately by a water based ...
<p>If you use a build surface such as PEI, acetone frosts your surface, leaving a white film appearance. If you have no additional surface on a glass or metal bed, it is incomplete cleaning. If incomplete cleaning, you could try isopropyl alcohol (IPA) immediately after acetone, followed immediately by a water based ...
1,871
<p>I have designed a simple windows service in .NET 2.0.</p> <p>I am trying to deploy it on my local machine. I have switched to design view, and setup ServiceInstaller and ServiceProcessInstaller objects. There is a Project Installer. I have also wrapped the Windows Service into a .NET setup project and install it, l...
<p>We actually create an installer built into our application. It's a console app that has a command line to install/uninstall the server as well as run as a service or in console mode.</p> <p>See this article on a <a href="http://alt.pluralsight.com/wiki/default.aspx/Craig/SelfInstallingService.html" rel="nofollow no...
<p>Here's another reference specific to .NET services.</p> <p><a href="http://bytes.com/forum/thread739857.html" rel="nofollow noreferrer">http://bytes.com/forum/thread739857.html</a></p>
34,731
<p>I am running an english language version of WindowsXP, but have set Spanish as my only accepted language in Firefox. I had naively expected the browser's language to be set as the default when I load an applet in a browser session, but this does not appear to be the case. The applet starts up in English, the default...
<p>The java plugin uses the OS locale not the browser one.</p> <p>To override the default locale, go in the java control panel - java tab, Press the View button of the Applet Runtime Settings, and add the required parameter in the 4th column, it is editable even if it's grayed. </p> <p>In your case, try something lik...
<p>Previously, the default locale for applets and for Java-applications was derived from the locale of Windows. With jre 7 this is still true for Java-applications, but it is no longer true for applets. The default locale for applets is en_US no matter how you set the Windows locale. This must truely be a bug related t...
28,199
<p>How can I set Resharper to wrap, say, the generated equality members with regions when selected from the Alt+Insert menu?</p> <p>Thanks</p>
<p>there is usually a "wrap in regions" option towards the bottom of the dialog box, but not for this one. I would submit that to JetBrains as a request. For the time being, you'll have to select the generated methods and use the ctrl->E,U,5 (surroundwith shortcut) to get the expected result.</p>
<p>it doesn't really answer your question, but I just can't resist to try to convince you NOT to use regions. Why would you want to do it? The obvious disadvantages of regions are:</p> <ul> <li>they don't compile, so you can never know if the name of the region really describes what is inside</li> <li>regions are ofte...
33,170
<p>Can I safely rename the cygdrive folder? Also, I would like to add other folders at root and map them to folders on windows in the same way as /cygdrive/c maps to my C drive. Is that possible?</p>
<p>Yes, you can. See <a href="http://www.cygwin.com/cygwin-ug-net/using.html#mount-table" rel="noreferrer">The Cygwin Mount Table</a> in Cygwin's documentation. I have my documents folder mounted as /doc. These mounts end up in the registry and are retained across reboots etc.</p>
<p>I wouldn't rename cygdrive as I don't know what that would do, but you can map other directories at root to various windows directories using the <code>mount</code> command.</p>
11,735
<p>Any ideas on how to implement tab completion for a .NET (C#) Console Application? And I mean within an application that is run and then loops for user input (like if you run ftp.exe without any arguments), like this: </p> <pre><code> string line = string.Empty; while (line != "exit") { ...
<p>Take a look at this code from the Mono project <a href="http://tirania.org/blog/archive/2008/Aug-26.html" rel="noreferrer">http://tirania.org/blog/archive/2008/Aug-26.html</a> I played with it some the other day. It does a lot of command line editingy, but I don't think it does line completion.</p>
<p><a href="https://github.com/tonerdo/readline" rel="nofollow noreferrer">https://github.com/tonerdo/readline</a> is what you need. great lib available as a nuget from the talented dev tonerdo.</p> <p><em>pasted from the site:</em></p> <blockquote> <p>...<br/> <strong>ReadLine</strong> is a GNU Readline like library b...
6,843
<p>How is it possible in Eclipse JDT to convert a multiline selection to String. Like the following</p> <p>From:</p> <pre><code>xxxx yyyy zzz </code></pre> <p>To:</p> <pre><code>"xxxx " + "yyyy " + "zzz" </code></pre> <p>I tried the following template </p> <pre><code>"${line_selection}${cursor}"+ </code></pre> <...
<p>Maybe this is not what you mean but...</p> <p>If I'm on a line in Eclipse and I enter double quotation marks, then inside that paste a multiline selection (like your xyz example) it will paste out like this:</p> <pre><code>"xxxx\n" + "yyyy\n" + "zzz" </code></pre> <p>Then you could just find/replace in a sel...
<p>This may not be exactly the answer you're looking for. You can easily achieve what you're asking by using the sed stream editor. This is available on all flavors of Unix, and also on Windows, by downloading a toolkit like <a href="http://www.cygwin.com/" rel="nofollow noreferrer">cygwin</a>. On the Unix shell com...
14,739
<p>Recently I had to do some very processing heavy stuff with data stored in a DataSet. It was heavy enough that I ended up using a tool to help identify some bottlenecks in my code. When I was analyzing the bottlenecks, I noticed that although DataSet lookups were not terribly slow (they weren't the bottleneck), it wa...
<p>Via <a href="http://www.red-gate.com/products/reflector/" rel="nofollow noreferrer">Reflector</a> the steps for DataRow["ColumnName"] are:</p> <ol> <li>Get the DataColumn from ColumnName. Uses the row's DataColumnCollection["ColumnName"]. Internally, DataColumnCollection stores its DataColumns in a Hastable. O(1)</...
<p>I imagine that any lookups would be O(n), as I don't think they would use any type of hashtable, but would actually use more of an array for finding rows and columns.</p>
17,475
<p>So I have a pointer to an array of pointers. If I delete it like this:</p> <pre><code>delete [] PointerToPointers; </code></pre> <p>Will that delete all the pointed to pointers as well? If not, do I have to loop over all of the pointers and delete them as well, or is there an easier way to do it? My google-fu d...
<p>Yes you have to loop over the pointers, deleting individually.</p> <p>Reason: What if other code had pointers to the objects in your array? The C++ compiler doesn't know if that's true or not, so you have to be explicit.</p> <p>For an "easier way," two suggestions: (1) Make a subroutine for this purpose so at lea...
<p>I don't know why this was answered so confusingly long.</p> <p>If you delete the array of pointers, you will free the memory used for an array of usually ints.<br> a pointer to an object is an integer containing the adress.</p> <p>You deleted a bunch of adresses, but no objects.</p> <p>delete does not care about ...
7,046
<p>I'd like to externalize all of the strings used in the project into one file and be able to use it inside aspx, C# code behind and on the client side in JavaScript.<br> The reason I want to do it is because many strings are shared, i.e. the same in two places. </p> <p>Is it possible? Is there a better way?</p>
<p><a href="http://www.json.org/" rel="nofollow noreferrer">JSON</a> is a good fit - a similar question: <a href="https://stackoverflow.com/questions/239832/how-do-you-share-configuration-information-or-business-rules-between-languages">How do you share configuration information or business rules between languages</a><...
<p>Sounds like it's right up XML's alley....</p>
32,421
<p>I am writing an Objective-C application which communicates with a USB device. The application writes certain data to the device continuously and displays the status of the write operation in a textView, which is an object of NSTextView. I call the <code>-[NSTextView insertText:]</code> method in the loop when I get ...
<p>Mac OS X does not flush changes to views to the screen immediately, to avoid the flicker and tearing that's common in such situations. This means you can't just sit in a loop and perform blocking operations while you update a view; if you do this, neither the view nor anything else in your application's human inter...
<p>I have a loop that is accessing data off the 'net and stuffing it in a db. As I'm processing, I would like a console-like window (not the one in Xcode since this would be a compiled app.) </p> <p>So I have a NSTextView that I'm changing the textStorage of and scrolling to the bottom each time through the loop. Unfo...
44,610
<p>When running an MSI through the command line what does passing the arguement "CHECKDB=FALSE" really do?</p> <p>The MSI of course can be anything from Microsoft, to Compuware DevPartner, to a programmer compiled MSI from .NET.</p>
<p>Running an MSI with that parameter would set the public property named CHECKDB equal to a false value. I have not seen that particular property before and I don't see any reference to it online. I suspect that it is specific to the MSI that you are using.</p>
<p>I am not sure but CHECKDB could be a property added to Installshield's default template file. Since many setups are made based on those templates, you would end up with the property showing up in many MSI files. I suspect that it might be used by Installshield's SQLServer deployment features, and if I were to guess ...
29,886
<p>A weird bug was occurring in production which I was asked to look into.<br/> The issue was tracked down to a couple of variables being declared within a For loop and not being initialized on each iteration. An assumption had been made that due to the scope of their declaration they would be &quot;reset&quot; on each...
<p><strong>Most</strong> of the time, it does not matter whether you declare a variable inside or outside the loop; the rules of definite assignment ensure that it doesn't matter. In the debugger you might occasionally see old values (i.e. if you look at a variable in a breakpoint before it is assigned), but static-ana...
<p>This does surprised me as well. I would have thought that scope would have changed inside a “for” loop. This does not seem to be the case. The values are being retained. The compiler seems to be smart enough to declare the variable one time when the “for” loop is first entered.</p> <p>I do agree with the previous p...
44,894
<p>Can anyone recommend good simulation software for mobile devices? I am most interested in Nokia smart phones.</p>
<p>Are you looking for Emulator for Nokia phones? You can find those <a href="http://www.forum.nokia.com/main/resources/tools_and_sdks/listings/" rel="nofollow noreferrer">here</a>..</p> <p>Otherwise explain clearly what kind of simulation software you are looking for!</p>
<p>OK, I am showing my newb-ness with mobile development. I am talking about emulation rather than simulation.</p> <p>I am contemplating porting an application to a phone platform and like the look (and ubiquity in my market) of Nokia smart phone, which I think run Symbian. What I would like to do is experiment by c...
18,985
<p>Alright, so maybe I shouldn't have shrunk this question sooo much... I have seen the post on <a href="https://stackoverflow.com/questions/622/most-efficient-code-for-the-first-10000-prime-numbers">the most efficient way to find the first 10000 primes</a>. I'm looking for <strong>all possible ways</strong>. The goa...
<p><a href="http://en.wikipedia.org/wiki/Sieve_of_Eratosthenes" rel="nofollow noreferrer">The Sieve of Eratosthenes</a> is a decent algorithm:</p> <blockquote> <ol> <li>Take the list of positive integers 2 to any given Ceiling.</li> <li>Take the next item in the list (2 in the first iteration) and remove all mul...
<p>If you're wanting to find a way of generating prime numbers, this have been covered in a <a href="https://stackoverflow.com/questions/622/most-efficient-code-for-the-first-10000-prime-numbers#2753">previous question</a>.</p>
2,891
<p>I've taken the plunge and upgraded (or maybe downgraded?!) from WinXP to Vista.</p> <p>Everything appeared to be working ok except that when I fired up my machine this morning and opened my C# application in Visual Studio I got a few "Load of property 'OutputPath' failed. The entered path is not a valid output path...
<p>On top of my head:</p> <ol> <li>Disable User Access Control.</li> <li>Make sure you've not checked in your executables into source control (they may be readonly) :)</li> </ol> <p>EDIT: I'd few problems on my Vista x64 box that got me confused as well [I was also running as Administrator]. Disabling UAC got rid o...
<p>Oh.. this is a cool one =D</p> <p>have you tried to change your output path?</p> <p>Well, click on the right button on your project in the "solution explorer". Go on properties, in the Build tab. There you can try to work some things out..</p> <p>VS2008 is a very strange thing, since it was developed to run in Vi...
36,329
<p>I created a way to dynamically add <code>SettingsProperty</code> to a .NET <code>app.config</code> file. It all works nicely, but when I am launching my app the next time I can only see the properties that are created in the designer. How can I load back the properties runtime?</p> <p>My code for creating the <code...
<p>They are saved in the &lt;solutionname&gt;.suo file. SUO stands for Solution User Options, and should not be added to source control.</p> <p>No .vbproj.user files should be in source control either!</p>
<p>Starting from Visual Studio 2015 CTP solution and project related files are stored in the .vs directory. The path to the suo file is .vs\&lt;SolutionName&gt;\v14\.suo for Visual Studio 2015.</p>
24,403
<p>How do I intercept a paste event in an editbox, possibly before the value is transferred to the object?</p>
<p>Look up <a href="http://msdn.microsoft.com/en-us/library/ms997565.aspx" rel="nofollow noreferrer">subclassing windows</a>.</p>
<p>Subclass the edit box and handle the WM_PASTE message.</p>
12,187
<p>So far, I've only been passing javascript strings to my web methods, which get parsed, usually as Guids. but now i have a method that accepts an IList... on the client, i build this array of objects and then attempt to pass it like: </p> <pre><code>$.ajax({ type: 'POST', url: 'personalization.aspx/SetPersonaliz...
<blockquote> <p>data: "{'backerEntries':" + backerEntries + "}",</p> </blockquote> <p>..is the same as </p> <pre><code>data: "{'backerEntries':" + backerEntries.toString() + "}", </code></pre> <p>...which is pretty much useless. Use <a href="https://stackoverflow.com/questions/255216/why-doesnt-jquery-turn-my-arra...
<p>This is NOT valid JSON: { 'foo': 'bar' }</p> <p>Isn't, wasn't ever, never will be. JSON processors are often very forgiving, which of course is a false convenience. </p> <p>Read the specification. A string is defined to be enclosed in double quotes, not single quotes, not smiley face characters, not pieces of meta...
31,845
<p>I have a situation where I want to copy the output assembly from one project into the output directory of my target application using MSBuild, without hard-coding paths in my MSBuild Copy task. Here's the scenario:</p> <ul> <li>Project A - Web Application Project</li> <li>Project B - Dal Interface Project</li> <li>...
<p>I have made this work, though I would love to find a cleaner solution that takes advanctage of the built-in parameters within MSBuild (like $(TargetDir), etc but to point at the project I want to grab the output for). Anyway, here is what I've done:</p> <pre><code>&lt;Target Name="AfterBuild"&gt; &lt;Copy SourceFil...
<p>So, you want to have a reference, but not have it visible in VS. So you want it built if needed, and copied to output like any other <code>Content</code> file. Here's how you'd do it:</p> <pre><code>&lt;Target Name="IncludeDALImplementation" BeforeTargets="AfterBuild"&gt; &lt;MSBuild Projects="..\DalImplementatio...
33,464
<p>I'm sure there are a million posts about this out there, but surprisingly I'm having trouble finding something. </p> <p>I have a simple script where I want to set the onClick handler for an <code>&lt;A&gt;</code> link on initialization of the page.</p> <p>When I run this I <strong>immediately</strong> get a 'foo' ...
<p>Try:</p> <pre><code>document.getElementById("foo").onclick = function (){alert('foo');}; </code></pre>
<p>The YUI example above should really be:</p> <pre><code>&lt;script&gt; YAHOO.util.Event.onDOMReady(function() { Dom.get("foo").onclick = function (){alert('foo');}; }); &lt;/script&gt; </code></pre>
30,960
<p>For a simple linked list in which random access to list elements is not a requirement, are there any significant advantages (performance or otherwise) to using <code>std::list</code> instead of <code>std::vector</code>? If backwards traversal is required, would it be more efficient to use <code>std::slist</code> an...
<p>As usual the best answer to performance questions is to <a href="https://stackoverflow.com/questions/61278/quick-and-dirty-way-to-profile-your-code">profile</a> both implementations for your use case and see which is faster. </p> <p>In general if you have insertions into the data-structure (other than at the end) t...
<ul> <li>std::vector is insanely faster than std::list to find an element</li> <li>std::vector always performs faster than std::list with very small data</li> <li>std::vector is always faster to push elements at the back than std::list</li> <li>std::list handles large elements very well, especially for sorting or inser...
29,443
<p>Let's say I have an existing System.Threading.Timer instance and I'd like to call Change on it to push it's firing time back:</p> <pre><code>var timer = new Timer(DelayCallback, null, 10000, Timeout.Infinite); // ... (sometime later but before DelayCallback has executed) timer.Change(20000, Timeout.Infinite); </cod...
<p>it sounds like what you really want is the application-idle event</p> <pre><code>System.Windows.Forms.Application.Idle </code></pre>
<p>I've actually had to build my own "Timing" class for an MMORPG I've made. It could keep track of over 100,000 "entities" that had timers for processing AI, and other tasks. Based on different actions that could be taken, I would have to momentarily delay an event.</p> <p>Now, my timing class was completely hand wri...
43,097