instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>I've been frustrated by this for the entire weekend, plus a day or two, so any help would be significantly appreciated.</p> <p>I'm trying to write a program that can programmatically go into a SharePoint 2007 doc library, open a file, change the contents of the file, then put the file back. I've gotten all but the ...
<p>You should use stream's to write back the changed OOXML into the SPFile. I hope this example helps!</p> <blockquote> <pre><code>Stream fs = mySPFile.OpenBinaryStream(); using (WordprocessingDocument ooxmlDoc = WordprocessingDocument.Open(fs, true)) { MainDocumentPart mainPart = wordDoc.MainDocumentPart; Xm...
<p>Yesterday I saw a webcast with Andrew Connell where he opened a doc from a doc library, added a watermark and saved the file again. It sure sounds like you should have a look at that webcast: <a href="https://msevents.microsoft.com/CUI/WebCastRegistrationConfirmation.aspx?culture=en-US&amp;RegistrationID=1299758384&...
40,350
<p>I am trying to write a macro that would "click" a command button that is in another workbook. Is that possible? Without changing any of the code within that other workbook?</p>
<p>For an ActiveX button in another workbook:</p> <pre><code>Workbooks("OtherBook").Worksheets("Sheet1").CommandButton1.Value = True </code></pre> <p>For an MSForms button in another workbook:</p> <pre><code>Application.Run Workbooks("OtherBook").Worksheets("Sheet1").Shapes("Button 1").OnAction </code></pre>
<p>There's not a clean way to do this through code, since the button's click event would typically be a private method of the other workbook.</p> <p><em>However</em>, you can automate the click through VBA code by opening the workbook, finding the control you want, and then activating it and sending it a space charact...
15,806
<p>I have an ATL control that I want to be Unicode-aware. I added a message handler for WM_UNICHAR:</p> <pre><code>MESSAGE_HANDLER( WM_UNICHAR, OnUniChar ) </code></pre> <p>But, for some reason, the OnUniChar handler is never called.</p> <p>According to the documentation, the handler should first be called with "UNI...
<p>What are you doing that you think should generate a WM_UNICHAR message?</p> <p>If your code (or the ATL code) ultimately calls CreateWindowW, then your window is already Unicode aware, and WM_CHAR messages will be UTF-16 format.</p> <p>The documentation is far from clear on when, exactly, a WM_UNICHAR message gets...
<pre><code>void CMFCProView::OnUniChar (UINT xChar, UINT nRepCnt, UINT nFlags) void CMFCProView::OnChar (UINT xChar, UINT nRepCnt, UINT nFlags) </code></pre> <p>The range of UINT (unsigned int) is 0 to 4294967295 decimal (16-bit).</p> <p>OnChar can do whatever you want OnUniChar to do. Click an English character <...
49,545
<p>I have an object that has cutouts in it (alignment pins fit in the cutouts). The shape of the hole is a right triangle with the point clipped off to create a flat surface in the deep part of the hole.</p> <p>When I print the object in vertical orientation the wall in the deepest part of the cutout is printed proper...
<p>I think this is caused by the shape of the hole. The shape is parabolic or circular, this means that if you slice it as in the green part, the slicer determines the placing of the layers along the curvature. If it has a shallow curvature, and slicing layer height is relatively thick, the curvature of the object cann...
<p>I think this is caused by the shape of the hole. The shape is parabolic or circular, this means that if you slice it as in the green part, the slicer determines the placing of the layers along the curvature. If it has a shallow curvature, and slicing layer height is relatively thick, the curvature of the object cann...
1,148
<p>I play a <a href="https://en.m.wikipedia.org/wiki/Berimbau" rel="noreferrer">berimbau</a> for Capoeira. One of the most fragile (and most expensive) bits is the <em>cabaça</em>, a hollow gourd used as a resonator.</p> <p><img src="https://i.stack.imgur.com/tRNcL.jpg" alt="cabaças"></p> <p>I'm not very familiar wit...
<p>I can't answer this from a technical 3D printing angle. But, from a musical angle:</p> <p>Where the body of an instrument has the primary function of enclosing a vibrating air column, the material has often been demonstrated to perhaps make a difference, but only a subtle one. As an example, a recent range of pla...
<p>I'll take a stab here, but my gut instinct is to say that a printed part will not sound the same as your original gourd resonator.</p> <p>I believe the acoustics rely on the hardness, shape, and size of the material. In which case, a gourd is a hard and often thin material (after gutting it). Typical 3D printing ma...
661
<p><a href="http://www.joelonsoftware.com/articles/fog0000000043.html" rel="nofollow noreferrer">Joel Test</a> is a good and famous list checking some requisites every software company should concern about.</p> <p>They are:</p> <ol> <li>Do you use source control?</li> <li>Can you make a build in one step?</li> <li>Do...
<p>My current project: 1 Y, 2 N, 3 N, 4 Y, 5 N, 6 N, 7 N, 8 N, 9 N, 10 Y, 11 N, 12 N<br/> Total score: 3</p> <p>Guess what, it sucks. The dev team has been pushing hard for 2, 3, and 5, but it never quite gets approved by management. The operational software is so buggy that hack fixes take all the time and no one ...
<p>Current Company across most projects, some are worse(much worse!)<br> 1:Y, 2:Y, 3:Y, 4:Y, 5:N, 6:N, 7:Usually, 8:N, 9:N, 10:N, 11:N, 12:N </p> <p>For me the big issues in my current Company are 10 and 11. </p> <p>We don't have a dedicated test resource even though we have a development resource of 100+ developers...
16,098
<p>I am looking for a simple but "good enough" Named Entity Recognition library (and dictionary) for java, I am looking to process emails and documents and extract some "basic information" like: Names, places, Address and Dates</p> <p>I've been looking around, and most seems to be on the heavy side and full NLP kind o...
<p>You might want to have a look at one of <a href="https://stackoverflow.com/questions/163923/methods-for-geotagging-or-geolabelling-text-content#164722">my earlier answers</a> to a similar problem.</p> <p>Other than that, most lighter NER systems depend a lot on the domain used. You will find a whole lot of tools an...
<p>You might want to try <a href="http://www.alchemyapi.com/" rel="nofollow">Alchemy API</a> as well. Its similar to Open Calais.</p>
22,807
<p>Something that confuses me, but has never caused any problems... the recommended way to dispatch an event is as follows:</p> <pre><code>public event EventHandler SomeEvent; ... { .... if(SomeEvent!=null)SomeEvent(); } </code></pre> <p>In a multi-threaded environment, how does this code guarantee that anoth...
<p>As you point out, where multiple threads can access <code>SomeEvent</code> simultaneously, one thread could check whether <code>SomeEvent</code>is null and determine that it isn't. Just after doing so, another thread could remove the last registered delegate from <code>SomeEvent</code>. When the first thread attempt...
<p>I would like to suggest an slight improvment to RoadWarrior's answer by utilizing an extention function for the EventHandler:</p> <pre><code>public static class Extensions { public static void Raise(this EventHandler e, object sender, EventArgs args = null) { var e1 = e; if (e1 != null) ...
35,802
<p>I need to make some changes to a ClickOnce application that I haven't touched for over a year and therefore the certificate has expired.</p> <p>I've read that publishing with a new certificate will make the application fail, because it will be signed with a different key.</p> <p>Therefore I think I need to use the...
<p>If you're after a quick solution, then you can "renew" your existing certificate and just give it a longer expiry date.</p> <p>Cliff Stanford has cleaned up the Microsoft "workaround" and made it available as a simple command line exe - available here: <a href="http://may.be/renewcert/" rel="noreferrer">http://may....
<p>If I remember correctly, I ran into the same problem and just created a new certificate.</p> <p>I think the automatic update broke between those versions, but there was no lasting damage. It might have helped that my application was for internal use only, so I didn't need a properly signed certificate.</p>
35,467
<p>Our application is written in C++ and used on Windows XP. On some client machines with only a C: drive, an error pop ups when the application starts: </p> <p><em>There is no disk in the drive. Please insert a disk into drive "D"</em> </p> <p>If they hit "Continue" or insert a CD (even an empty one!) and press "Try...
<p>It would certainly be a good idea to find out what's trying to access the D drive and fix it. But it's possible to suppress this behaviour, if desired, with a call to <a href="http://msdn.microsoft.com/en-us/library/ms680621(VS.85).aspx" rel="noreferrer">SetErrorMode</a> using the SEM_FAILCRITICALERRORS flag. It may...
<p>Oh yes, we used to have errors like these ... unfortunately i can't tell you what the fix was but it was something utterly stupid, that much i remember. I could still find the comment in our CDebugStackWalk class, so it may have to do with stack unrolling ... somewhere, somehow...</p>
32,661
<p>What are some recommendations for finding Expression Blend/WPF Designers to perform contract work? I think a (local) freelance designer might be the most reasonably priced, but I don't even know where to start.</p> <p>As additional background, I am located in the Midwest region of the US, where designers are not a...
<p>I think you might discover it is extremely difficult to find these people right now ... as most designers are familiar with the Adobe suite of products and not the Expression suite.</p> <p>I think a lot of people are learning that these skills need to be cultivated ... whether a software developer with designer ten...
<p>Yeah I agree that the role of Expression Blend 'Integrators'is hard to find. Check out the <a href="http://projectrosetta.com/" rel="nofollow noreferrer">site</a> , which is an intiative to boost the design world <a href="http://projectrosetta.com/" rel="nofollow noreferrer">http://projectrosetta.com/</a></p>
22,677
<p>I need to know how to turn on Code Coverage when running TFS builds on a solution with a .testrunconfig file. </p> <p>There is an option in the testrunconfig file that is for code coverage, but when running a TFS build there is no code coverage results.</p> <p>I am running my tests using the *Tests.dll mask and N...
<p>How are you running the tests? Are you using a .vsmdi file or just specifying that you run all tests in *Tests.dll assemblies?</p> <p>If it is the latter and you are using TFS 2008, then you need to add the following to the and of the first PropertyGroup in your TFSBuild.proj file for the build.</p> <pre><code>&l...
<p>You'll need the RunConfigFile entry whether you use the .vsmdi file for Test Lists or just specify the assembly file pattern. In that .testrunconfig file you specify the assemblies you want to apply code coverage to.</p>
10,595
<p>I am trying to learn some programming related terms, and I often come over the word &quot;handler&quot;. Can anyone please explain what it means and when to use it?</p>
<p>A handler is a routine/function/method which is specialized in a certain type of data or focused on certain special tasks.</p> <p>Examples:</p> <ul> <li><p>Event handler - Receives and digests events and signals from the surrounding system (e.g. OS or GUI).</p></li> <li><p>Memory handler - Performs certain special...
<p>I think it's a very general term, without a 'hard' definition. The meaning is highly contextual, varies depending on the general code design.</p> <p>For me, it usually means some code that is called from an inner core and is supposed to do some things and return. That 'inner' part can have several 'handlers' avai...
23,731
<p>I want to do this C# code in F#</p> <pre><code> string[] a = new string[5]; string b = string.Empty; a[0] = "Line 1"; a[2] = "Line 2"; foreach (string c in a) { b = c + Environment.NewLine; } </code></pre>
<p>Its a lot better to use the built-in String.Join method than rolling your own function based on repeated string concatting. Here's the code in F#:</p> <pre><code>open System let a = [| "Line 1"; null; "Line 2"; null; null;|] let b = String.Join(Environment.NewLine, a) </code></pre>
<p>The '^' operator concatenates two strings. Also, '+' is overloaded so it can work on strings. But using a StringBuilder or Join is a better strategy for this.</p>
43,067
<p>I have one class that needs to grab an attribute that is set in another. It's not a standard data type though. Here's the code;</p> <pre><code>class graphics: def __init__(self, Fullscreen = False, Width = 640, Height = 480): print "Graphics Init" SCREEN_SIZE = (Width, Height) pygame.init() if Fulls...
<p>You rarely, if ever, reference attributes of a class. You reference attributes of an object.</p> <p>(Also, class names should be uppercase: <code>Graphics</code>).</p> <pre><code>class Graphics: SCREEN_SIZE = (640, 480) def __init__(self, Fullscreen = False, Width = 640, Height = 480): print "Graphics Init" ...
<p>It's likely an <code>object</code> type so</p> <pre><code>self.screen = object() </code></pre> <p>might work (If I understood your question correctly).</p>
49,794
<p>From the <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map" rel="noreferrer">Mozilla Developer Network</a>:</p> <pre><code>[1,4,9].map(Math.sqrt) </code></pre> <p>will yield:</p> <pre><code>[1,2,3] </code></pre> <p>Why then does this:</p> <pre><code>['1','2','3'...
<p>The callback function in <code>Array.map</code> has <em>three</em> parameters:</p> <p>From the same <a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/map" rel="noreferrer">Mozilla page</a> that you linked to:</p> <blockquote> <p>callback is invoked with three arguments: the va...
<p><code>parseInt</code> IMHO should be avoided for this very reason. You can wrap it to make it more safe in these contexts like this:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-over...
32,847
<p><em>Javascript: The Good Parts</em> is a great book. Often I find myself reading passages like the following from the perspective of a language designer:</p> <blockquote> <p><code>undefined</code> and <code>NaN</code> are not constants. They are global variables, and you can change their values. This should not b...
<p>The web site 'lambda the ultimate' is very much about programming languages, and they occasionally have some good resources, although they tend to be more interested in academic kinds of things. Functional programming is big there, for instance.</p> <p><a href="http://lambda-the-ultimate.org/node/3" rel="noreferre...
<p>There are great books explaining the design principles applied in widely used languages, but if you really want to "understand" the design principles you should dig deeper. I would surely recommend <a href="https://mitpress.mit.edu/books/design-concepts-programming-languages" rel="nofollow noreferrer">"Design concep...
47,902
<p>I've heard a lot of people asking how long information stays in Google Cache. To me, this is irrelevant (at least until someone libels my name).</p>
<p>There is probably not a good answer, or at least there is probably not a good answer that you will get outside of Googleplex.</p> <p>For Google to crawl and cache your page, usually someone has to link to you, or you have to request they crawl your site.</p> <p>You can influence how frequently it visits your site ...
<p>Well, a page is saved in Google cache for ever :-)</p> <p>And I think it is saved in Google cache when it has been crawled.</p>
45,693
<p>I'm writing a structural modeling tool for a civil enginering application. I have one huge model class representing the entire building, which include collections of nodes, line elements, loads, etc. which are also custom classes. </p> <p>I have already coded an undo engine which saves a deep-copy after each modifi...
<p>Most examples I've seen use a variant of the <a href="http://en.wikipedia.org/wiki/Command_pattern" rel="noreferrer">Command-Pattern</a> for this. Every user-action that's undoable gets its own command instance with all the information to execute the action and roll it back. You can then maintain a list of all the c...
<p>I don't know if this is going to be of any use to you, but when I had to do something similar on one of my projects, I ended up downloading UndoEngine from <a href="http://www.undomadeeasy.com" rel="nofollow">http://www.undomadeeasy.com</a> - a wonderful engine and I really didn't care too much about what was under ...
7,237
<p>My WPF application generates sets of data which may have a different number of columns each time. Included in the output is a description of each column that will be used to apply formatting. A simplified version of the output might be something like:</p> <pre><code>class Data { IList&lt;ColumnDescription&gt;...
<p>Here's a workaround for Binding Columns in the DataGrid. Since the Columns property is ReadOnly, like everyone noticed, I made an Attached Property called BindableColumns which updates the Columns in the DataGrid everytime the collection changes through the CollectionChanged event. </p> <p>If we have this Collect...
<p>There is a sample of the way I do programmatically:</p> <pre><code>public partial class UserControlWithComboBoxColumnDataGrid : UserControl { private Dictionary&lt;int, string&gt; _Dictionary; private ObservableCollection&lt;MyItem&gt; _MyItems; public UserControlWithComboBoxColumnDataGrid() { _Di...
41,397
<p>I've got 256 colors working great in my terminal (<a href="http://www.frexx.de/xterm-256-notes/" rel="noreferrer">test scripts here</a>), but it stops working when I use ncurses (via Ruby-ncurses). Printing the escape sequences given on that page works fine, but when I initialize ncurses 'puts' stops working and I c...
<p>njsf: You were partially right here, and after tinkering a lot more I eventually got it to work. Thanks for your help. The story: XTerm (and rxvt, and Eterm) support 256 colors via escape sequences (what I was seeing) but 'tput colors' will say '8' and ncurses won't be able to get at them, because ncurses is playing...
<p>setting</p> <p>ENV['TERM'] += '-256color' if ENV['TERM'] == 'xterm' # activate 256 colors</p> <p>works on ubuntu 10.04 +</p>
20,673
<p>I have a backroundrb scheduled task that takes quite a long time to run. However it seems that the process is ending after only 2.5 minutes.</p> <p>My background.yml file:</p> <pre><code>:schedules: :named_worker: :task_name: :trigger_args: 0 0 12 * * * * :data: input_data </code></pre> <p>I hav...
<p>There's not much information here that allows us to get to the bottom of the problem. Because backgroundrb operates in the background, it can be quite hard to monitor/debug.</p> <p>Here are some ideas I use:</p> <ol> <li>Write a unit test to test the worker code itself and make sure there are no problems there</li...
<p>Thanks Andrew. Those debugging tips helped. Especially the begin..rescue..end block. </p> <p>It was still a pain to debug though. In the end it wasn't BackgroundRB cutting short after 2.5 minutes. There was a network connection being made that wasn't being closed properly. Once that was found and closed, everything...
15,910
<p>I've seen this in a few <a href="https://stackoverflow.com/questions/221294/how-do-you-get-a-timestamp-in-javascript#221357">places</a></p> <pre><code>function fn() { return +new Date; } </code></pre> <p>And I can see that it is returning a timestamp rather than a date object, but I can't find any documentatio...
<p>That's the <code>+</code> unary operator. It's equivalent to:</p> <pre><code>function(){ return Number(new Date); } </code></pre> <p>See <a href="http://xkr.us/articles/javascript/unary-add" rel="noreferrer">http://xkr.us/articles/javascript/unary-add</a> and <a href="https://developer.mozilla.org/en-US/docs/Web/Jav...
<p>It does exactly the same thing as:</p> <pre> function(){ return 0+new Date; } </pre> <p>that has the same result as:</p> <pre> function(){ return new Date().getTime(); } </pre>
27,312
<p>Are there anyone with experiences/examples on releasing early/releasing often for commercial software? Does it work?</p> <p>I was thinking of VMware where they have a lot of revisions release between each major version. And the installation experience was awful, sometimes they would break the existing VMs and other...
<p>Kenny is right: it depends.</p> <p>We work on Enterprise software, where a customer may run an internal 3+ month project to upgrade to a new release. In that environment frequent releases do <strong>not</strong> work. Customers will stay on an old release for years and we have to keep supporting them, so the more...
<p>It depends on your resources. If you're MicroSoft, you can early-release a bug-ridden POS that rhymes with Sista, and rely on your marketing power to make people forget their early experiences with the product.</p> <p>If you're hoping for good word-of-mouth, releasing an early version is not a good idea (unless yo...
34,612
<p>I'm looking to write a html sanitiser, and obviously to test/prove that it works properly, I need a set of XSS examples to pitch against it to see how it performs. Here's a <a href="http://www.codinghorror.com/blog/archives/001167.html" rel="noreferrer">nice example from Coding Horror</a></p> <pre><code>&lt;img src...
<p>Take a look at this XSS Cheat List : <a href="https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet" rel="nofollow noreferrer">https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet</a></p>
<p>Check out <a href="http://www.owasp.org/index.php/Main_Page" rel="nofollow noreferrer">OWASP</a>. They have good guidance on how XSS works, what to look for, and even the <a href="http://www.owasp.org/index.php/Category:OWASP_WebGoat_Project" rel="nofollow noreferrer">WebGoat</a> project, where you can try your hand...
31,909
<p>Can some one post an example of using syslog outputter for log4r, I am currently using stdout but want to log to syslog.</p> <pre><code>mylog = Logger.new 'mylog' mylog.outputters = Outputter.stdout mylog.info "Starting up." </code></pre> <p>raj</p> <hr> <p>Thanks also to the following blog posts.<br> </p> <p><...
<p>Kind of lame answering my own question, but I found answer to this and adding it for later searches.</p> <p>For some reason I need to require log4r/outputter/syslogoutputter explicitly other wise SyslogOutputter would cause "uninitialized constant SyslogOutputter (NameError)" error. Other outputters do not seem to ...
<p>I found this very helpful, but I had to make further edits. Something tried to re-open the syslog, causing an unhandled RuntimeError. I fixed it with this axe-crazy override in environments/production.rb:</p> <pre><code>require 'rubygems' require 'log4r' require 'log4r/outputter/syslogoutputter' # The outputter ne...
24,622
<p>I'm using Notepad++ for python development, and few days ago I found out about free Komodo Edit.</p> <p>I need Pros and Cons for Python development between this two editors...</p>
<p>I have worked a bit with Python programming for Google App Engine, which I started out in Notepad++ and then recently shifted over to Komodo using two excellent startup tutorials - both of which are conveniently linked from <a href="http://blogs.activestate.com/2008/04/komodo-does-it" rel="nofollow noreferrer" title...
<p>Downloaded both myself. Like Komodo better. </p> <p>Komodo Pros: Like it better. Does more. Looks like an IDE. Edits Django templates</p> <p>Notepad++ Cons: Don't like it as much. Does less. Looks less like and IDE.</p>
39,830
<p>I have the following code (adapted from an example given in <a href="http://diveintopython.net/file_handling/file_objects.html#d0e14928" rel="nofollow noreferrer">Dive Into Python</a>) that reads the entire contents of a file into a buffer.</p> <pre><code>buffer = "" try: file = open(postFileName, 'rU') tr...
<p>I find that finally blocks are often overused. The file close (and a few other similar patterns) are so important that Python 3.0 will have a <strong>with</strong> statement just to cover this base in a slightly less obscure way.</p> <ul> <li><p>Do I need an except with a finally? </p> <p>That hits on the confusi...
<p>With a recent version of Python, you don't need to nest try-except and try-finally. try-except-finally has been unified:</p> <pre><code>try: non_existing_var except: print 'error' finally: print 'finished' </code></pre>
49,025
<p>Simple ASP.NET application.</p> <p>I have two drop-down controls. On the first-drop down I have a JavaScript <code>onChange</code> event. The JavaScript enables the second drop-down and removes a value from it (the value selected in the first drop-down). If they click the blank first value of the drop-down, then th...
<pre><code>&lt;%@ Page Language="C#" %&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;script runat="server"&gt; protected void indexChanged(object sender, EventArgs e) { Label1.Text = " I did something! "; } &...
<p>If the second dropdown is initially enabled through javascript (I'm assuming this is during a javascript onchange, since you didn't specify), then clicking the back button to reload the previous postback will never enable it. </p> <p>Mixing ASP.NET with classic javascript can be hairy. You might want to have a look...
3,078
<p>We have an app that monitors a folder for file drop and need to initiate a virus scan before using any incoming files.</p> <p>This needs to be a part of the Delphi app and the file must pass the Virus Scan otherwise we delete the file.</p> <p>I know that there are command shell options available, however this <str...
<p>The procedure is described <a href="http://msdn.microsoft.com/en-us/library/ms537371(VS.85).aspx" rel="nofollow noreferrer" title="Introduction to the Antivirus API">here</a>, in the section entitled 'Internet Explorer 5 and Office 2000 Implementation'.</p> <p>A Delphi implementation of enumerating the category is ...
<p>Check out the mail servers with virus scanning. VPOP3 supports two scanners, one of them Sophos (business oriented AV). That will lead you to the APIs.</p>
39,024
<p>According to the instructions I have read, you use the same output on the printers mainboard to control a 110&nbsp;V heated bed with a solid state relay, as you do to power the 12/24&nbsp;V heated bed that comes with the printer. </p> <p>The relay's datasheet states that its max input current is 25&nbsp;mA, obvious...
<blockquote> <p>How does Marlin know that the heated bed pins are controlling a relay now instead of a bed directly, and therefore should limit their current output?</p> </blockquote> <p>Marlin does not (need to) know this. Simply put, all Marlin does is switch on/off the <em>voltage</em> at the heated bed output. T...
<p>There are two current parameters which you are looking at in your instructions for the solid state relay. The first one (the 25mA) is for the <em>control</em> circuit. This is how much amperage the device itself will draw when in operation. The second is for the <em>load</em> circuit. This is the max amperage which ...
1,505
<p>I just want to ask if anyone has successfully printed a screw (M3 or M4). Is the printed output usable as a screw? What printer is capable of printing screws? I am using an M3D printer - is there a configuration to successfully print a screw that is usable?</p> <p>Can anyone share a picture of the best 3D printed s...
<p>well... it's hard to imagine printing M3 or even M4 I haven't try but I haven't because I'm pretty sure it's not possible (on my printer of course)</p> <p>but some time ago I've tried M8 which is of course way from your needs it was printed on 0.1mm layer height</p> <p>it went ok into the nut without any problems ...
<p>Not very likely unfortunately.</p> <p>M3D nozzle diameter is too wide to be able to print something that would print reliably, not to mention any FDM machine won't have the precision to build good threads. even 0.05mm layer heights won't run very well. </p> <p>I've tried on a Form1 (SLA style printer) and even tha...
445
<p>I am attempting to provide a general solution for the migration of data from one schema version to another. A problem arises when the column data type from the source schema does not match that of the destination. I would like to create a query that will perform a preliminary compare on the columns data types to ret...
<p>I have always been in the fortunate position to have Red Gate <a href="http://www.red-gate.com/products/SQL_Compare/index.htm" rel="nofollow noreferrer">Schema compare</a> which i think would do what you ask. Cheap at twice the price!</p>
<p>I have always been in the fortunate position to have Red Gate <a href="http://www.red-gate.com/products/SQL_Compare/index.htm" rel="nofollow noreferrer">Schema compare</a> which i think would do what you ask. Cheap at twice the price!</p>
10,970
<p>How do you scan a directory for folders and files in C? It needs to be cross-platform.</p>
<p>The following POSIX program will print the names of the files in the current directory:</p> <pre><code>#define _XOPEN_SOURCE 700 #include &lt;stdio.h&gt; #include &lt;sys/types.h&gt; #include &lt;dirent.h&gt; int main (void) { DIR *dp; struct dirent *ep; dp = opendir (&quot;./&quot;); if (dp != NULL) ...
<p>You can find the sample code on the <a href="https://en.wikibooks.org/wiki/C_Programming/dirent.h" rel="nofollow noreferrer">wikibooks link</a></p> <pre><code>/************************************************************** * A simpler and shorter implementation of ls(1) * ls(1) is very similar to the DIR command ...
3,350
<p>We started some overseas merge replication 1 year ago and everything is going fine till now. My problem is that we have now so much data in our system that any crash on one of the subscriber's servers will be a disaster: reinitialising a subscription the standard way will take days (our connexions are definitely slo...
<p><kbd>Shift</kbd> + <kbd>F10</kbd> works in most Windows applications, but I don't have Visual Studio.</p>
<p>You could also press the shortcut on your keyboard, if you have that key of course. <kbd>Shift</kbd> + <kbd>F10</kbd> works as well.</p>
15,304
<p>I mean what the most efficient way to get information about the quantity of your page's items and make sql query with LIMIT that you need. or I should get all items and then crop array with php functions?</p> <p>now I do 2 queries: first to count all items and second to get items that I need with LIMIT. </p> <p...
<p>I'm assuming you want a count of the number of rows you'll be reading so as to do some pagination or similar? I don't understand your need for the LIMIT in the context of your question. However, if you just want a count of how many rows have been found, use one of the following.</p> <p>You select the count of all r...
<p>I'm assuming you want a count of the number of rows you'll be reading so as to do some pagination or similar? I don't understand your need for the LIMIT in the context of your question. However, if you just want a count of how many rows have been found, use one of the following.</p> <p>You select the count of all r...
36,866
<p>I am using the SharpZipLib open source .net library from <a href="http://www.icsharpcode.net" rel="nofollow noreferrer">www.icsharpcode.net</a></p> <p>My goal is to unzip an xml file and read it into a dataset. However I get the following error reading the file into a dataset: "Data at the root level is invalid. Li...
<p>Well, what does the final file look like? (compared to the original). You don't show the zipping code, which might be part of the puzzle, especially as you are partially swallowing the exception.</p> <p>I would also try ensuring everything <code>IDisposable</code> is <code>Dispose()</code>d, ideally via <code>using...
<p>I compared the original with the final using TextPad and they are identical. Also I rewrote the code to take advantage of the using. Here is the code. My issue seems to be centered around file locking or something. If I unzip the file quit the application then start it up it will read find.</p> <pre><code>private ...
44,006
<p>Excel has a Conditional Formatting... option under the Format menu that allows you to change the style/color/font/whatever of a cell depending upon its value. But it only allows three conditions.</p> <p>How do I get Excel to display say, six different background cell colors depending upon the value of the cell? (...
<p>You will need to write something in VBA.</p> <p>See example here: <a href="http://www.ozgrid.com/VBA/excel-conditional-formatting-limit.htm" rel="nofollow noreferrer">Get Around Excels 3 Criteria Limit in Conditional Formatting</a>:</p> <pre><code>Private Sub Worksheet_Change(ByVal Target As Range) Dim icolor As ...
<p>You can use VBA macros to do this... </p> <p>here is one vba macro that might be better if need lots of cases <a href="http://chandoo.org/wp/2008/10/14/more-than-3-conditional-formats-in-excel/" rel="nofollow noreferrer">http://chandoo.org/wp/2008/10/14/more-than-3-conditional-formats-in-excel/</a></p> <p>you need...
33,819
<p>I want to display tabular type data, but it will not be coming from a single datasource. I am currently using a label, but the alignment doesn't look that great.</p> <p>Any ideas?</p> <p>Again, the data is not being loaded from a datagrid or anything, each row is basically a label and a number e.g.</p> <p>Total ...
<p>Options:</p> <ol> <li>organize your data into a datatable and use a grid control. </li> <li>use the <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.tablelayoutpanel.aspx" rel="nofollow noreferrer">TableLayoutPanel</a> to align you information.</li> </ol>
<p>If you don't want to use a datagrid to display data I sugest using a textbox with a monospace font at least, like courier new.</p>
15,602
<p>I've got two tables:</p> <pre><code>Employees: uid (number) | first_name (string) | last_name (string) | ... Projects: uid | project_title (string) | point_of_contact_id (FK: Employees.uid) | ... </code></pre> <p>I'd like to create a form for Projects with a "Point of Contact" combo box (dropdown) field. The dis...
<p>According to <a href="http://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=124842" rel="noreferrer">the bug report</a> this is a known issue, still not fixed and there is no workaround.</p>
<p>This happens to me also, but it is most notable when I'm connecting to different servers. If you connect to the same server every time then it should remember your password every time.</p> <p>Maybe one day, SP3 perhaps, Microsoft will release a nice fix for this somewhat continuous annoyance.</p>
18,463
<p>Is there a way of programmatically determining a rough geographical position of a mobile phone using J2ME application, for example determining the current cell? This question especially applies to non-GPS enabled devices. </p> <p>I am not looking for a set of geographical coordinates, but an ability for a user to d...
<p>If the device supports the <a href="http://jcp.org/en/jsr/detail?id=179" rel="nofollow noreferrer">JSR 179</a> location API, you can use this. Last time I looked into this hardly any devices supported it, but that was a few years back.</p>
<p>I don't believe there is a general J2ME API for determining location.</p> <p>I do know that BlackBerry has a specific API for retrieving not only the rough 'cell' location, but also a GPS API as well.</p> <p>I'm afraid, at the moment, the GPS solutions are proprietary by manufacturer.</p>
28,400
<p><a href="https://stackoverflow.com/questions/286584/can-i-specify-interfaces-when-i-declare-a-member#287669">Can I specify interfaces when I declare a member?</a></p> <p>After thinking about this question for a while, it occurred to me that a static-duck-typed language might actually work. Why can't predefined clas...
<p>Statically-typed languages, by definition, check types at <em>compile time</em>, not <em>run time</em>. One of the obvious problems with the system described above is that the compiler is going to check types when the program is compiled, not at run time.</p> <p>Now, you could build more intelligence into the compi...
<p>Sounds like Mixins or Traits:<br> <a href="http://en.wikipedia.org/wiki/Mixin" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Mixin<br> </a> <a href="http://www.iam.unibe.ch/~scg/Archive/Papers/Scha03aTraits.pdf" rel="nofollow noreferrer">http://www.iam.unibe.ch/~scg/Archive/Papers/Scha03aTraits.pdf </a>...
36,807
<p>Given:</p> <pre><code>my @mylist1; push(@mylist1,"A"); push(@mylist1,"B"); push(@mylist1,"C"); my @mylist2; push(@mylist2,"A"); push(@mylist2,"D"); push(@mylist2,"E"); </code></pre> <p>What's the quickest way in Perl to insert in mylist2 all elements that are in mylist1 and not already in mylist2 (ABCDE). </p>
<pre><code>my %k; map { $k{$_} = 1 } @mylist1; map { $k{$_} = 1 } @mylist2; @mylist2 = keys %k; </code></pre> <p>Alternatively:</p> <pre><code>my %k; map { $k{$_} = 1 } @mylist2; push(@mylist2, grep { !exists $k{$_} } @mylist1); </code></pre> <p>Actually - these might be wrong because they don't account for whether ...
<pre><code>my(%work); @work{@mylist1, @mylist2} = undef; @mylist2 = sort keys %work; </code></pre>
42,025
<p>How can I compare strings in a case insensitive way in Python?</p> <p>I would like to encapsulate comparison of a regular strings to a repository string, using simple and Pythonic code. I also would like to have ability to look up values in a dict hashed by strings using regular python strings.</p>
<p>Assuming ASCII strings:</p> <pre><code>string1 = 'Hello' string2 = 'hello' if string1.lower() == string2.lower(): print(&quot;The strings are the same (case insensitive)&quot;) else: print(&quot;The strings are NOT the same (case insensitive)&quot;) </code></pre> <p>As of Python 3.3, <a href="https://docs.p...
<pre><code>def insenStringCompare(s1, s2): """ Method that takes two strings and returns True or False, based on if they are equal, regardless of case.""" try: return s1.lower() == s2.lower() except AttributeError: print "Please only pass strings into this method." print "You...
41,301
<p>I have a list of things (I'll call it L), an index(N) and a new thing(NEW). If I want to replace the thing in L at N with NEW, what is the best way to do this? Should I get the sublist up to N and from N to the end of the list and then glue together a new list from the first part, NEW, and the last part using list? ...
<pre><code>(setf (nth N L) NEW) </code></pre> <p>should do the trick.</p>
<pre><code>(defun replace-nth-from-list (list n elem) (cond ((null list) ()) (t (append (subseq list 0 n) elem (subseq list (+ 1 n)(length list)))))) </code></pre>
20,613
<p>I want to create a DTS Package to pull data from an Oracle table into a SQL2K table. How can I insert rows that are not already in the SQL2K table and update rows that already exist in the SQL2K table?</p> <p>I guess I could truncate and repopulate the entire table or create a temporary table and then do update...
<p>You can do that in a DTS package using two data driven query tasks: one for the inserts and one for the updates. The data driven query tasks are a bit of a pain to use, but they work. I've also done this (a "merge") in sql server 2000 with an AS/400 database using a dynamic t-sql. You'd write a t-sql script that out...
<p>Are you keeping the same primary key values?</p> <p>If you are you have a number of options, some versions of SQL support the MERGE statement which will update or insert just like you require.</p> <p>Or you can write your own.</p> <p>Something along the lines of loading all the rows into a staging table in your ...
28,218
<p>I need to store large amounts of metering data in a database. <b>A record consists of an id that identifies the data's source, a timestamp and a value. The records are later retrieved via the id and their timestamp.</b></p> <p>According to my previous experience (I am developing the successor of an application that...
<p>"groups of rows that match a range of ids and timestamps"</p> <p>You have two dimensions: the source and time. I'm sure the data source has lots of attributes. Time, I know, has a lot of attributes (year, month, day, hour, day of week, week of year, quarter, fiscal period, etc., etc.)</p> <p>While your facts hav...
<p>Option 1:</p> <p>Make a good guess on what is going to be loaded together often and put that in one, not too large chunk. Example: have one chunk a day</p> <p>Pros:</p> <ul> <li>easy, data lookup can be done with a simple calculation (which days are involved in the request time range?), rather than keeping an ind...
32,741
<p>I have an application deployed into multiple zones and there are some issues with opening larger documents (20-50MB) across the WAN. </p> <p>Currently the documents are stored in Zone 1 (Americas) and a link stored in the database to the docs. </p> <p>I have heard some things about blobs in oracle and store bina...
<p>Your best option here may be caching the document in the requested zone the first time it is requested, and pinging the source document's last modified each time the cached document is requested in order to determine if it needs refreshed. In this case you're only requesting a small piece of information (a date) acr...
<p>If you're running on Windows you could look at <a href="http://en.wikipedia.org/wiki/Distributed_File_System_(Microsoft)" rel="nofollow noreferrer">Distributed File Systems</a></p>
3,125
<p>Has anyone looked at <a href="http://developer.yahoo.com/flash/" rel="nofollow noreferrer">Yahoo's ASTRA</a>? It's fairly nifty, but I had some issues creating a custom label for a pie chart. They have an example for a line chart, which overrides an axis's series's label renderer. My solution was to override the <c...
<p>Okay... so no-one's tried Astra, or people just avoid Flash questions.</p> <p>After a lot of guess work it turns out I needed to cast the series to a PieSeries and then work with those member functions, as the ISeries was useless on it's own.</p> <pre><code>myPieChart.dataTipFunction = function (item:Object, in...
<p>The Astra components are distributed with the complete source code. Flash CS3 components use compiled shims because otherwise you'd need to manually add the raw source files to your classpath. As a bonus, they also improve compile times because they're already built for you. Look in the "Source" folder in the Astra ...
5,367
<p>I come from a fairly strong OO background, the benefits of OOD &amp; OOP are second nature to me, but recently I've found myself in a development shop tied to a procedural programming habits. The implementation language has some OOP features, they are not used in optimal ways. </p> <p>Update: everyone seems to have...
<p>Most all of these questions are confounded by the problem that individual programmer productivity varies by an order of magnitude or more; if you happen to have an OO programmer who is one of the gruop at productivity x, and a "procedural" programmer who is a 10x programmer, the procedural programmer is liable to wi...
<p>I doubt you will find a definitive study. As several people have mentioned this is not a reproducible experiment. You will find anecdotal evidence, a lot of it. Some people may find some statistical studies, but I would examine them carefully. I am not aware of any really good ones.</p> <p>I also will make another ...
43,131
<p>I have a method that takes an IQueryable. Is there a LINQ query that will give me back the size of each column in the IQueryable?</p> <p>To be more clear: this is Linq-to-objects. I want to get the length of the ToString() of each "column".</p>
<p>It depends. If you mean is there a completely generic way to make this determination the answer is no. All IQueryable will give access to is the Type of each expression. There is no way to arbitrarily map a Type to a column size. </p> <p>If on the other hand you have the ability to map a Type to members and mem...
<p>You said for each "column", that would map to each property. In Linq to Objects, this should work, although too manual:</p> <pre><code>var lengths = from o in myObjectCollection select new { PropertyLength1 = o.Property1.ToString().Length, PropertyLengt...
20,776
<p>In relation to this question on <a href="https://stackoverflow.com/questions/14413/using-opengl-extensions-on-windows">Using OpenGL extensions</a>, what's the purpose of these extension functions? Why would I want to use them? Further, are there any tradeoffs or gotchas associated with using them?</p>
<p>The OpenGL standard allows individual vendors to provide additional functionality through extensions as new technology is created. Extensions may introduce new functions and new constants, and may relax or remove restrictions on existing OpenGL functions. </p> <p>Each vendor has an alphabetic abbreviation that is u...
<p><strong>OpenGL Extensions</strong> are new features added to the <strong>OpenGL specification</strong>, they are added by the OpenGL standards body and by the various graphics card vendors. These are exposed to the programmer as new function calls or variables. Every new version of the OpenGL specification ships wit...
3,801
<p>I'm working profesionally on a php web application which contains contacts, among other data. I was wondering how hard it would be to make this data available to external programs using the LDAP protocol.</p> <p>Are there specific tools out there for this? I couldn't really find anything, but I can't imagine I'm th...
<p>The LDAP server protocol is big, and I don't think there is a PHP server in existence. I would suggest running an LDAP server and pushing records to it.</p> <p>I like OpenLDAP, but there are plenty of servers out there, depending on your platform. Even ActiveDirectory is an LDAP server.</p> <p>Typically, LDAP obje...
<p>Are you wanting to implement an LDAP server in PHP, or just exchange data?</p> <p>You might think about implementing something like <a href="http://en.wikipedia.org/wiki/LDAP_Data_Interchange_Format" rel="nofollow noreferrer">LDIF</a> if you just want to exchange data.</p>
22,642
<p>I am sketching the architecture for a set of programs that share various interrelated objects stored in a database. I want one of the programs to act as a service which provides a higher level interface for operations on these objects, and the other programs to access the objects through that service.</p> <p>I am c...
<p>Yes you can. I do it using the pythoncom libraries that come included with <a href="http://www.activestate.com/Products/activepython/index.mhtml" rel="noreferrer">ActivePython</a> or can be installed with <a href="https://sourceforge.net/projects/pywin32/" rel="noreferrer">pywin32</a> (Python for Windows extensions)...
<p><a href="https://www.chrisumbel.com/article/windows_services_in_python" rel="nofollow noreferrer">https://www.chrisumbel.com/article/windows_services_in_python</a></p> <ol> <li><p>Follow up the PySvc.py</p></li> <li><p>changing the dll folder </p></li> </ol> <p>I know this is old but I was stuck on this forever. F...
5,233
<p>Most of my C/C++ development involves monolithic module files and absolutely no classes whatsoever, so usually when I need to make a <strong>DLL</strong> with accessible functions I just export them using the standard <code>__declspec(dllexport)</code> directive. Then access them either dynamically via <code>LoadLi...
<blockquote> <p>What about late-binding? As in loading it with LoadLibrary() and GetProcAddress() ? I'm used being able to load the library at run time and it would be great if you could do that here.</p> </blockquote> <p>So there are two ways to load the DLL. The first is to reference one or more symbols ...
<p>If you're willing to put a vtable in the class you're exporting, you can export a function that returns an interface and implement the class in the .dll, then put that in the .def file. You might have to do some declaration trickery, but it shouldn't be too hard.</p> <p>Just like COM. :)</p>
4,766
<p>I am interested in seeing if I can improve the way we use NUnit in a Visual Studio solution containing 30+ projects.</p> <p>First, would you have one assembly of tests for every assembly in the solution, or would you try to keep the number of test assemblies down? I started off creating many test assemblies, but I ...
<p>To answer your first question:</p> <p>You can use <a href="http://www.nunit.org/index.php?p=category&amp;r=2.4.8" rel="noreferrer">categories</a> to keep everything organised in a single assembly if that's how you want to go. As to whether it would cut down on build time, I would hazard a guess at perhaps, I don't ...
<p>Just as an aside, we find <a href="http://testdriven.net/" rel="nofollow noreferrer">TestDriven.Net</a> to be an excellent VisualStudio add-in front end for NUnit, free for open source use / students. </p>
20,915
<p>Running sp_attach_single_file_db gives this error:</p> <pre><code>The log scan number (10913:125:2) passed to log scan in database 'myDB' is not valid </code></pre> <p>Isn't it supposed to re-create the log file? </p> <p>How else would I be able to attach/repair that .mdf file?</p>
<p>For semi-immediate programming tasks I use TODO comments in code and ReSharper for Visual Studio to view them.</p> <p>For longer-term tasks I use Team Foundation Server to record work items.</p> <p>For non-programming tasks I use Google Calendar.</p>
<p>I don't know of an add-on (I use <a href="http://www.rememberthemilk.com/" rel="nofollow noreferrer">Remember The Milk</a> externally), but I think you are onto a good idea there.</p>
12,045
<p>Is there an easy way with LINQ to flatten an XML file?</p> <p>I can see a number of ways with XSLT but wondered what the best option with LINQ would be?</p> <p>I cant put the xml structure up exactly as stackoverflow seems to filter chevron chars. But its something like this </p> <p>nodeA </p> <p>--nodeA1 </p> ...
<p>OK; it depends on the output you want - with XElement you'd need to do a bit of work to remove all the descendent nodes etc. However, it is actually quite simple with XmlDocument:</p> <pre class="lang-cs prettyprint-override"><code>string xml = @"&lt;xml&gt;&lt;nodeA&gt;&lt;nodeA1/&gt;&lt;nodeA2/&gt;&lt;/nodeA&gt;&...
<p>The last part of what Marc said is what I think you're looking for. Here is an example that you can drop into <a href="http://www.linqpad.net/" rel="nofollow noreferrer">LINQPad</a> and see the results of the "flatten."</p> <pre><code>string xml = @"&lt;xml&gt;&lt;nodeA&gt;&lt;nodeA1&gt;&lt;inner1/&gt;&lt;inner2/&g...
27,278
<p>I'm using jQuery and wanting to target the nth &lt;li&gt; in a list after clicking the nth link.</p> <pre><code>&lt;ul id="targetedArea"&gt; &lt;li&gt;&lt;/li&gt; &lt;li&gt;&lt;/li&gt; &lt;li&gt;&lt;/li&gt; &lt;li&gt;&lt;/li&gt; &lt;/ul&gt; &lt;div id="clickedItems"&gt; &lt;a&gt;&lt;/a&gt; &lt;a&gt;&lt;...
<p>how about something like this:</p> <pre><code>$('#clickedItems a').click(function() { // figure out what position this element is in var n = $('#clickedItems a').index($(this) ); // update the targetedArea $('#targetedArea li:eq('+n+')').html('updated!'); return false; }); </code></pre> <p>assuming a 1:1 ...
<p>i dont know if jquery has something like this in mootools</p> <pre><code>$$('a.clickedItems').addEvent('click', function(e){ e.preventDefault(); $('targetedArea').getChildren()[this.getAllPrevious().length].addClass('selected'); }); </code></pre>
32,518
<p>I have input field value from that is used for forming XPath query. What symbols in input string should I check to minimise possibility of XML injection?</p>
<p>This <a href="http://packetstormsecurity.org/papers/bypass/Blind_XPath_Injection_20040518.pdf" rel="nofollow noreferrer"><strong>document</strong></a> describes in detail the concept of "Blind XPath Injection".</p> <p>It provides concrete examples of XPath injections and discusses ways of preventing such.</p> <p>I...
<p>Closing this vulnerability is just a hotfix. So applying policy "Default Deny" is too dangerous now. I decided to check input for following symbols [,",',*,=,{,\,.,space. I think this could prevent most common attacks Thank you all for answers!</p>
47,414
<p>i've got the following linq2sql query, and i'm setting the result to a POCO. One of my POCO properties is an enumeration.</p> <pre><code>public IQueryable&lt;Models.Achievement&gt; GetAchievements() { return from a in _sqlDatabase.Achievements select new Models.Achievement { ...
<p>You can actually use enums directly in LINQ-to-SQL (but not Entity Framework); just change the type of the property (in the dbml/designer) to the fully qualified enum type, and it will do the cast for you. You might want to call it AchievementType, of course - and this assumes a straight (cast) translation.</p> <p>...
<p>Maybe you could try something like this in you Models.Achievement declaration:</p> <pre><code> AchievementType achievementType{ get { return this.AchievementTypeId.ToEnum&lt;Models.AchievementType&gt;(); } set { this.AchievementTypeId = (int)value; } } </code>...
48,083
<p>Is there anything built into Windows and the .Net framework for programmatically installing and executing applications remotely? Ie: an API for remote software deployment. I'd like to build a tool that can install services on a pool of new computers from one central admin workstation.</p> <p>Update: The computers a...
<p>I am assuming that all the computers concerned are XP Pro, a member of an AD Domain and under the control of a single company. This is then the same as our set up at work. We use group policy to set firewall configuration on members computers, this opens the DCOM port because it is required to allow 'Offer Remote A...
<p>All of the pieces are there (copying files to a remote machine, spawning a process on a remote machine, etc.) You will be looking at a fair amount of programming to put it all together into a robust application. You will also need to make sure the clients are configured properly and safely. Naively configuring the c...
29,858
<p>Is there a way to accept input from more than one mouse separately? I'm interested in making a multi-user application and I thought it would be great if I could have 2 or more users holding wireless mice each interacting with the app individually with a separate mouse arrow.</p> <p>Is this something I should try to...
<p>You could try the <a href="http://www.microsoft.com/downloads/details.aspx?familyid=F851122A-4925-4788-BC39-409644CE0F9B&amp;displaylang=en" rel="nofollow noreferrer">Microsoft Windows MultiPoint Software Development Kit 1.1</a></p> <p>or the new <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=0eb...
<p>You could use DirectInput with C/C++ (there's probably also bindings in other languages). You use <a href="http://msdn.microsoft.com/en-us/library/bb205950(VS.85).aspx" rel="nofollow noreferrer"><code>IDirectInput8::EnumDevices()</code></a> (using DX8; same function, different interface in other versions of DirectX...
29,350
<p>I'm trying to make a little function to interpolate between two values with a given increment.</p> <pre><code>[ 1.0 .. 0.5 .. 20.0 ] </code></pre> <p>The compiler tells me that this is deprecated, and suggests using ints then casting to float. But this seems a bit long-winded if I have a fractional increment - do ...
<p>TL;DR: <strong>F# PowerPack's <code>BigRational</code> type is the way to go</strong>.</p> <hr> <h2>What's Wrong with Floating-point Loops</h2> <p>As many have pointed out, <code>float</code> values are not suitable for looping:</p> <ul> <li>They do have Round Off Error, just like with <code>1/3</code> in decima...
<p>Try the following sequence expression</p> <pre><code>seq { 2 .. 40 } |&gt; Seq.map (fun x -&gt; (float x) / 2.0) </code></pre>
49,367
<p>I'm implementing a JAX-WS webservice that will be consumed by external Java and PHP clients.</p> <p>The clients have to authenticate with a username and password stored in a database per client.</p> <p>What authentication mechanism is best to use to make sure that misc clients can use it?</p>
<p>Basic WS-Security would work with both Java and PHP clients (amongst others) plugged in to JAAS to provide a database backend . How to implement that kind of depends on your container. Annotate your web service methods with the @RolesAllowed annotation to control which roles the calling user must have. All J2EE cont...
<p>Is there a way independent on the current container? I'd like to define which class is responsible for authorisation. That class could call database or have password elsewhere.</p>
49,491
<p>I am looking for a high-performance graphic library for .NET and Mono. I have taken a look at <a href="http://www.taoframework.com/" rel="nofollow noreferrer">Tao framework</a> and, while it is very complete, it's quite lacking in terms of usability. It should be cross-platform compatible.</p> <p>What other alterna...
<p>OpenGL would be my choice, .NET bindings exist from many open source wrappers, with OpenGL you're set for cross platform. </p>
<p>I agree with mhutch - OpenTK is a very good .NET/Mono wrapper for OpenGL. For one, it has its own vector/matrix math library that, among other things, contains some of the more useful GLUT functions (I used to miss) like CreatePerspectiveFieldOfView and LookAt. I've found this library especially useful now that the ...
13,600
<p>It currently is 700MB but it's conceivable that it'll grow beyond the 1GB. Normally I just copy this file to another location (for the curious, it's the database of a Zope instance, a ZODB file).</p> <p>This file changes little from day to day, but I understand Bacula can't do inside-the-file subdivision for increm...
<p>Online backup of a large database file is risky business, as the file might change while you are reading it, rendering the backup inconsistent and possibly useless. I believe you should not be making backups of the ZODB file itself, but rather of diffs created daily by the <strong>repozo</strong> tool. This way, you...
<p>For the open source bacula (bacula.org) the best idea is to use the "Set Maximum Volume Jobs = 1" directive indeed. </p> <p>If you want the "inside-the-file subdivision for incremental backups", please consider the Delta Plugin from Bacula Systems - <a href="https://www.baculasystems.com/products/bacula-enterprise-...
30,296
<p>I would like to make an ajax call to a different server (same domain and box, just a different port.) e.g.</p> <p>My page is</p> <pre> http://localhost/index.html </pre> <p>I would like to make a ajax get request to:</p> <pre> http://localhost:7076/?word=foo </pre> <p>I am getting this error:</p> <pre> Access ...
<p>Have a certain page on your port 80 server proxy requests to the other port. For example:</p> <pre><code>http://localhost/proxy?port=7076&amp;url=%2f%3fword%3dfoo </code></pre> <p>Note the url encoding on the last query string argument value.</p>
<p>This is a browser restriction. All javascript calls must be to the same server and port of the home of the script. This will require something server-side to get around. I.E. have the process at <code>localhost</code> forward the request to <code>localhost:7076</code>.</p>
8,164
<p>I was asked to make some drools traning for my teammates. Just to show them how it can be used and how usefull it may be. To do this training I first have to learn Drools, and I figured that the best way to learn it will be small project centered around drools. </p> <p>Any interesting ideas? </p> <p>My idea for th...
<p>Actually, we have a drools based project, you could try to mimic that. :-)</p> <p>Suppose you have incoming SMS messages arriving on an HTTP based protocol. An HTTP request contains the Anumber (telephone number of the sender) the Bnumber (telephone number of the recipient) and the text of the message.</p> <p>Your...
<p>Why are you training them on a tool you don't even use? How are you planning on applying it? A contrived example is just that -- contrived. If you have a real need for the technology, then apply it to that domain. At a minimum this can act as a very rough proof of concept to see if the tech is even applicable to you...
14,208
<p>If you declare variables of type byte or short and attempt to perform arithmetic operations on these, you receive the error "Type mismatch: cannot convert int to short" (or correspondingly "Type mismatch: cannot convert int to byte"). </p> <pre><code>byte a = 23; byte b = 34; byte c = a + b; </code></pre> <p>In th...
<p>Although the arithmetic operators are defined to operate on any numeric type, according the Java language specification (5.6.2 Binary Numeric Promotion), operands of type byte and short are automatically promoted to int before being handed to the operators.</p> <p>To perform arithmetic operations on variables of ty...
<p>In Java Language Specification (5.6.2 Binary Numeric Promotion):</p> <blockquote> <p>1 If any expression is of type double, then the promoted type is double, and other expressions that are not of type double undergo widening primitive conversion to double.</p> <p>2 Otherwise, if any expression is of type float, then...
10,704
<p>Which Ajax framework/toolkit can you recommend for building the GUI of web applications that are using struts?</p>
<p>I'd say that your AJAX/javascript library choice should depend less on how your backend is implemented and more on what your UI is going to be. </p> <p>If your site is mostly going to be static web pages with some AJAX thrown in then it would be better to use a lighter javascript framework like <a href="http://jque...
<p>Struts already come with <a href="http://dojotoolkit.org/" rel="nofollow noreferrer">Dojo</a> framework. You can set your application theme to ajax and you will be able to use it.</p> <p>Give a look at struts.ui.theme property at struts.properties file!</p> <p>A good article for you to read is <a href="http://www....
19,072
<p>How can I programatically cause a control's tooltip to show in a Winforms app without needing the mouse to hover over the control? (P/Invoke is ok if necessary). </p>
<p>If you are using the <code>Tooltip</code> control on the form, you can do it like this:</p> <p><code>ToolTip1.Show("Text to display", Control)</code></p> <p>The <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.tooltip.show.aspx" rel="noreferrer">MSDN documentation for the ToolTip control's "Sh...
<p>This is the code I use:</p> <pre><code>static HWND hwndToolTip = NULL; void CreateToolTip( HWND hWndControl, TCHAR *tipText ) { BOOL success; if( hwndToolTip == NULL ) { hwndToolTip = CreateWindow( TOOLTIPS_CLASS, NULL, WS_POPUP | ...
8,891
<p>I have somewhat interesting development situation. The client and deployment server are inside a firewall without access to the Subversion server. But the developers are outside the firewall and are able to use the Subversion server. Right now the solution I have worked out is to update my local copy of the code and...
<p>I've found <a href="http://samba.anu.edu.au/rsync/" rel="nofollow noreferrer">rsync</a> extremely useful for synchronizing directory trees across multiple systems. If you have shell access to your server from a development workstation, you can regularly check out code locally and run rsync, which will transfer only ...
<p>You don't provide information on what is allowed through the firewall. I'm not familiar with UnleashIT.</p> <p>I guess you could have a script that exports from SVN to a folder on the SVN server. The script then zips the exported files. You can then transport the ZIP file however you want and extract to the deploym...
6,367
<p>I have a site behind basic authentication (IIS6).</p> <p>Part of this site calls a web service that is also part of the site and thus behind basic authentication as well.</p> <p>However, when this happens the calling code receives a 401 Authentication Error.</p> <p>I've tried a couple of things, with the general ...
<h2>Solution: (I am almost certain this will help someone)</h2> <p><strong>See <a href="http://forums.asp.net/t/1172902.aspx" rel="nofollow noreferrer">this link</a> for the source of this solution in VB (thanks jshardy!), all I did was convert to C#.</strong></p> <p><strong>NB:</strong> You must be using ONLY basic ...
<p>The Line:</p> <pre><code>s.Credentials = System.Net.CredentialCache.DefaultCredentials();</code></pre> <p>Maybe you should try :</p> <pre><code>s.Credentials = HttpContext.Current.User.Identity;</code></pre>
30,501
<p>I've got the following url route and i'm wanting to make sure that a segment of the route will only accept numbers. as such, i can provide some regex which checks the word.</p> <p>/page/{currentPage}</p> <p>so.. can someone give me a regex which matches when the word is a number (any int) greater than 0 (ie. 1 &lt...
<pre><code>/^[1-9][0-9]*$/ </code></pre> <p>Problems with other answers:</p> <pre><code>/([1-9][0-9]*)/ // Will match -1 and foo1bar #[1-9]+# // Will not match 10, same problems as the first [1-9] // Will only match one digit, same problems as first </code></pre>
<pre><code>string testString = @"/page/100"; string pageNumber = Regex.Match(testString, "/page/([1-9][0-9]*)").Groups[1].Value; </code></pre> <p>If not matched pageNumber will be ""</p>
31,474
<p>I noticed that my version of Ultimaker Cura was out of date, so I tried to go to <a href="https://ultimaker.com" rel="nofollow noreferrer">their website</a> and download a new version. For whatever reason, I could not get the <a href="https://ultimaker.com/en/products/ultimaker-cura-software/download-request/191" r...
<p>The answer to your question is: <strong>&quot;From the application developer itself!&quot;</strong>.</p> <p>Below is the explanation how you can (directly) download Ultimaker Cura from the most reputable source: Ultimaker.com</p> <hr /> <h2>Regular download</h2> <p>When clicking the <a href="http://ultimaker.com/en/...
<p>Cura is a software tool developed by Ultimaker for 3D printers. There is a downloadable page for this tool: <a href="https://ultimaker.com/en/products/ultimaker-cura-software/list" rel="nofollow noreferrer">https://ultimaker.com/en/products/ultimaker-cura-software/list</a>. There is no restriction to download it.</p...
966
<p>How does the event creation and handling work in Java Swing?</p>
<p>The java event mechanism is actually an implementation of the Observer design pattern. I suggest you do alittle reading on the observer pattern, this will give you a lot of insight on how the event mechanism in Java works.</p> <p><a href="http://en.wikipedia.org/wiki/Observer_pattern" rel="noreferrer">See observer ...
<p>There's a tutorial on eveng handling here: <a href="http://java.sun.com/docs/books/tutorial/uiswing/events/index.html" rel="nofollow noreferrer">http://java.sun.com/docs/books/tutorial/uiswing/events/index.html</a></p> <p>It's about Swing. If that doesn't work maybe you could be a bit more specific?</p>
29,622
<p>A question related to <a href="https://stackoverflow.com/questions/28002">Regular cast vs. static_cast vs. dynamic_cast</a>:</p> <p>What cast syntax style do you prefer in C++?</p> <ul> <li>C-style cast syntax: <code>(int)foo</code></li> <li>C++-style cast syntax: <code>static_cast&lt;int&gt;(foo)</code></li> <li>...
<p>It's best practice <em>never</em> to use C-style casts for three main reasons:</p> <ul> <li>as already mentioned, no checking is performed here. The programmer simply cannot know which of the various casts is used which weakens strong typing</li> <li>the new casts are intentionally visually striking. Since casts of...
<p>C-style cast syntax, do not error check. C++-style cast syntax, does some checking. When using static_cast, even if it doesn't do checking, at least you know you should be carefull here.</p>
5,210
<p>I'm working on an application that consists of an overall Quartz-based scheduler and "CycledJob" run using CronTriggers. The purpose of the application is to process inputs from different email inboxes based on the source country. </p> <p>Based on the country that it comes in from (i.e. US, UK, FR, etc.) the applic...
<p>At the top of each country's processing thread, put the country code into Log4j's mapped diagnostic context (MDC). This uses a ThreadLocal variable so that you don't have to pass the country up and down the call stack explicitly. Then create a custom filter that looks at the MDC, and filters out any events that don'...
<p>I may be completely off base on my understanding of what you are attempting to accomplish, but I will take a stab at the solution. It sounds like you want a separate log file for each country for which you are processing email. Based on that understanding, here is a possible solution:</p> <ol> <li><p>Set up an appe...
17,262
<p>Here's what I am trying to do: </p> <pre><code>typedef enum { ONE, TWO, THREE } Numbers; </code></pre> <p>I am trying to write a function that would do a switch case similar to the following: </p> <pre><code>char num_str[10]; int process_numbers_str(Numbers num) { switch(num) { case ONE: case TWO: ...
<pre><code>// Define your enumeration like this (in say numbers.h); ENUM_BEGIN( Numbers ) ENUM(ONE), ENUM(TWO), ENUM(FOUR) ENUM_END( Numbers ) // The macros are defined in a more fundamental .h file (say defs.h); #define ENUM_BEGIN(typ) enum typ { #define ENUM(nam) nam #define ENUM_END(typ) }; // Now in o...
<p>If the enum index is 0-based, you can put the names in an array of char*, and index them with the enum value.</p>
17,730
<p>I have the following in my .emacs file:</p> <pre><code> (defun c++-mode-untabify () (save-excursion (goto-char (point-min)) (while (re-search-forward "[ \t]+$" nil t) (delete-region (match-beginning 0) (match-end 0))) (goto-char (point-min)) (if (search-forward "\t" nil t) (un...
<p>write-contents-hooks is also obsolete. This is what you're after:</p> <pre><code>(add-hook 'c++-mode-hook '(lambda () (add-hook 'before-save-hook (lambda () (untabify (point-min) (point-max)))))) </code></pre> <p>This is distilled from what I use, which does a...
<p>Try adding your hook like this:</p> <pre><code> (add-hook 'c++-mode-hook '(lambda () (add-hook 'write-contents-hooks 'c++-mode-untabify nil t))) </code></pre> <p>Notice the two extra aguments to add-hook. If I'm reading it right, according to the documentation that trailing t should do wha...
41,173
<p>Consider the following code:</p> <pre><code>$("a").attr("disabled", "disabled"); </code></pre> <p>In IE and FF, this will make anchors unclickable, but in WebKit based browsers (Google Chrome and Safari) this does nothing. The nice thing about the disabled attribute is that it is easily removed and does not effect...
<p>I assume that you have an onclick event handler bound to these anchor elements. Just have your event handler check the "disabled" attribute and cancel the event if it is set. Your event handler would look something like this:</p> <pre><code>$("a").click(function(event){ if (this.disabled) { event.preventDefau...
<p>I had to fix this behavior in a site with a lot of anchors that were being enabled/disabled with this attribute according to other conditions, etc. Maybe not ideal, but in a situation like that, if you prefer not to fix each anchor's code individually, this will do the trick for all the anchors:</p> <pre><code>$('a...
21,123
<p>I have noticed that <a href="http://slic3r.org/" rel="noreferrer">Slic3r</a> offers a speed setting called "<a href="http://slic3r.org/blog/new-stable-1.2.9" rel="noreferrer">auto speed</a>" meant to give a constant filament pressure at the extruder, which I believe could eliminate filament grinding issues at higher...
<p>Auto speed is calculated from maximum volumetric speed in mm<sup>3</sup> per second. If you normally print at 80 mm/s, your extrusion width is 0.5 mm and you are printing 0.2mm high layers, your volumetric speed would be 80 * 0.5 * 0.2 = 8 mm<sup>3</sup>/s, which is the volume of plastic extruded by your printer eve...
<p>There's no fixed maximum volumetric speed that works for everyone, there's simply too much variables to account for. By using @Ian Williams explanation you can convert from volumetric to regular speeds but you still need to test what speed works best for your setup.</p> <p>Just a few of the other variables affectin...
125
<p>As the title describes, what are the different doctypes available and what do they mean? I notice that the layout looks a little different in IE7 when I switch from </p> <pre><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" &gt; </code></pre> <p>to</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-/...
<p>Traditionally, a <strong>Doctype</strong>, or <strong>Document Type Declaration</strong> associates the document with a <strong>Document Type Definition</strong>.</p> <p>The <strong>Document Type Definition</strong> is a standard for a specific XML or SGML document. XML and SGML themselves doesn't have much of a sc...
<p>Basically, the doctype determines how crazy IE is going to be. </p> <p>If you don't set it to XHTML, or "strict" you'll be living in a world of hurt when it comes to IE (even if you set it, you'll still be hating on IE, but it does make it a lot better).</p>
31,875
<p>I recently bought a Titan Aero hot end which came with a 24 V 30 W heater cartridge from E3D. I'd like to use this but the cable length is only 1 meter long and I need it to be 2 meters. The ends terminate with prong connections and there is no polarity to the prongs. How can I safely extend the leads one meter a...
<h1>Heater polarity doesn't matter</h1> <p>The heater cartridges are just large resistors and so polarity is irrelevant. Either can be positive or negative.</p> <p>You can extend the leads by cutting and splicing in ~20 gauge wires* to a two pin JST connector line you suggest.</p> <hr /> <p>*<sup>At 24 volts and 30 wat...
<p>1 meter puts you far enough away from the heater than you don't need high temperature wiring to extend it. The larger the guage(e.g. 20 guage) the less resistance you will add to the heater circuit. This doesn't matter as long as you can still achieve your maximum temperature (if you can still achieve the same cur...
1,918
<p>Would it be benefical to add a generic way to add info to a Throwable without creating a new Throwable?</p> <p>I often see code like this:</p> <pre><code>try { foo(); } catch (Exception e) { throw new Exception(e.getMessage() + " extra info=" + blah, e); } </code></pre> <p>Would it be better to instead ad...
<p>Chained exceptions already take care of removing redundant stack frames. That is, you'll only see a given stack frame listed once. It's a matter of opinion, but I'd consider lack of a chained exception a drawback.</p> <p>Discouraging extension of <code>RuntimeException</code> would be good. This might help in that ...
<p>In general, I think that it is better to use the standard idioms in cases like this. In this case, the standard idiom is to wrap the exception, like this:</p> <pre><code>try { foo(); } catch (Exception e) { throw new MySpecificException("extra info=" + blah, e); } </code></pre> <p>Also, in general it is best n...
38,852
<p>We have a Windows Form application which hosts an IE browser control. Our users run the application and open links to documents stored in MOSS. We are trying to set the application up to pass in credentials of a service account so that we can avoid giving all users access to the MOSS site. We have used code found <a...
<p>Under what Internet Zone does the website you are pointing to run under? Even if you are using your own browser control, it will still be in some zone. Determine what zone it is by using a normal browser to go to the relevant site, and determine what zone it is in.<br> ...
<p>Would impersonation not help here? You can run that bit of code (the form) under the guise of the service account user you're talking about and the browser control should then run within the same context.</p> <p>the following links might help;</p> <p><a href="http://msdn.microsoft.com/en-us/library/b80a7e92.aspx" ...
33,474
<p>I have a MFC application in which I want to add internationalization support. The project is configured to use the "multi-byte character set" (the "unicode character set" is not an option in my situation).</p> <p>Now, I would expect the CWnd::OnChar() function to send me multi-byte characters if I set my keyboard ...
<p>And help here? <a href="http://www.geocities.com/yongweiwu/multibyte.htm" rel="nofollow noreferrer">Multibyte Functions in Microsoft C Run-time</a></p>
<p>There is actually a very simple (but weird) way of force the OnChar function to send unicode characters to the application even if it's configured in multi-byte character set:</p> <pre><code>SetWindowLongW( m_hWnd, GWL_WNDPROC, GetWindowLong( m_hWnd, GWL_WNDPROC ) ); </code></pre> <p>Simply by calling the unicode ...
42,035
<p>The new awesome <kbd>Ctrl</kbd> + <kbd>.</kbd> keyboard shortcut to show smart tags has suddenly stopped working, a week or so after I discovered it :( </p> <p>I am missing it badly, having had to revert back to <kbd>Ctrl</kbd> + <kbd>Alt</kbd> + <kbd>F10</kbd>, which really just isn't the same.</p> <p>I recently ...
<p>From the <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSCalendarDate_Class/Reference/Reference.html" rel="noreferrer">documentation</a>:</p> <blockquote> <p>Use of NSCalendarDate strongly discouraged. It is not deprecated yet, however it may be in the next major OS re...
<p>Convert your current date and time to a Unix date (seconds since 1970) or DOS style (since 1980), then add 24 hours and convert it back. Then reset the hours, minutes and seconds to zero to get to midnight.</p>
21,904
<p>I'd like to do the same in C#. Is there anyway of using properties in C# with parameters in the same way I've done with the parameter 'Key' in this VB.NET example?</p> <blockquote> <pre><code>Private Shared m_Dictionary As IDictionary(Of String, Object) = New Dictionary(Of String, Object) </code></pre> </blockquote...
<blockquote> <p>Is there anyway of using properties in C# with parameters</p> </blockquote> <p>No. You only can provide the <em>default</em> property in C# with an argument, to model indexed access (as in a dictionary):</p> <pre><code>public T this[string key] { get { return m_Dictionary[key]; } set { m_Dic...
<p>Your code sample strikes me as a very strange design and an abuse of what properties are intended for. Why not just an instance method <code>AddOrUpdateKey</code>:</p> <pre><code>Public Sub AddOrUpdateKey(ByVal Key As String, ByVal Value as Object) If m_Dictionary.ContainsKey(Key) Then m_Dictionary(Key)...
29,272
<p>I understand how I can change the <code>dns</code> settings for my domains by editing my bind configs, when I run my own name-servers. I know that I can define the name-servers with my registrar via their online control panels. But I have no idea how that part works...</p> <p>How does my registrar store the data ab...
<p>The registrar is responsible for setting the Root DNS entry that says, "When someone asks for stackoverflow.com, tell them that the authoritative DNS is xxx.xxx.xxx.xxx". They have an interface that allows them to make changes to the records they own.</p> <p>Then the requester must go to the authoritative DNS (Whi...
<p>Sorry I can't help toooooo much, but go to <a href="http://twit.tv" rel="nofollow noreferrer">http://twit.tv</a>, and find the Security Now podcast - they did one a couple of weeks ago on DNS - get the first one. It has a good explanation of how it works etc (which may help).</p> <p>The second one on that site is a...
6,839
<p>I've implemented a few poor solutions for bringing up an AJAX loader before dynamically updating a content DIV, but none seem to be "universal", and I find each time I do it I'm reworking it. If I have a DIV with content that updates depending on what a user clicks on the page, and I want to display the loader over ...
<p>Some JavaScript libraries allow listening to opening and closing requests. Check out Prototype's request Responder <a href="http://www.prototypejs.org/api/ajax/responders" rel="nofollow noreferrer">http://www.prototypejs.org/api/ajax/responders</a>.</p> <p>You would do something like this:</p> <pre><code>Ajax.Resp...
<p>You could use a <a href="http://ui.jquery.com/repository/latest/demos/functional/#ui.progressbar" rel="nofollow noreferrer">JQuery progress bar</a> or something similar in a different library.</p>
23,531
<p>In short, how can I search, view, and modify in-memory values in linux, preferably as easily/simply as possible.</p> <p><a href="http://www.raymond.cc/blog/archives/2007/02/27/how-to-cheat-and-hack-flash-based-games/" rel="nofollow noreferrer">Like this</a>.</p>
<p>closest you'll get is scanmem</p> <p>sudo apt-get install scanmem</p>
<p>WOW!!! Didn't know something like that existed for Windows! Thanks for sharing!</p> <p>SNES9X had a similar capability to hack, tweak and even re-program SNES ROM images while playing them (I read it was inspired by the Game Genie), I used that a lot when on my teens to get infinite ammo, life, hidden scenes or cha...
26,159
<p>I'm trying to use Visual Studio 2008's extensibility to write an addin that will create a project folder with various messages in it after parsing an interface. I'm having trouble at the step of creating/adding the folder, however. I've tried using </p> <pre><code>ProjectItem folder = item.ProjectItem.Collection.A...
<p>Yup, that was it...</p> <pre><code>DirectoryInfo dirInfo = new DirectoryInfo(newDirectoryParent + newDirectoryName); if (dirInfo.Exists) { dirInfo.Delete(true); item.DTE.ExecuteCommand("View.Refresh", string.Empty); } ProjectItem folder = item.ProjectItem.Collection.AddFolder(newDirectoryName, string.Empt...
<p>here's an idea i thought of because i've been using NAnt for so long and thought it might work. </p> <p>Open the .csproj file in a text editor and add the directory as such:</p> <pre><code>&lt;ItemGroup&gt; &lt;compile include="\path\rootFolderToInclude\**\*.cs" /&gt; &lt;/ItemGroup&gt; </code></pre> <p>if an ...
8,991
<p>C#, .NET 3.5</p> <p>I am trying to get all of the properties of an object that have BOTH a getter and a setter for the instance. The code I <em>thought</em> should work is </p> <pre><code>PropertyInfo[] infos = source.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.SetProperty |...
<p>Call <a href="http://msdn.microsoft.com/en-us/library/system.reflection.propertyinfo.getgetmethod.aspx" rel="noreferrer"><code>GetGetMethod</code></a> and <a href="http://msdn.microsoft.com/en-us/library/system.reflection.propertyinfo.getsetmethod.aspx" rel="noreferrer"><code>GetSetMethod</code></a> on the property ...
<p>To make it a little more generic you can inherit from 'ObjectWithDefaultValues' and/or call obj.SetDefaultValues() extension method. Both are listed below.</p> <p>Code:</p> <pre><code>public abstract class ObjectWithDefaultValues : object { public ObjectWithDefaultValues () : this(true){ } public Obj...
38,841
<p>I have a sparse array in Jscript, with non-null elements occuring at both negative and positive indices. When I try to use a for in loop, it doesn't traverse the array from the lowest (negative) index to the highest positive index. Instead it returns the array in the order that I added the elements. Enumeration does...
<p>Technically, "A" isn't in the Array at all since you can't have a negative index. It is just a member of the arrName object. If you check the arrName.length you will see that it is 21 (0,1,2,...,20) Why don't you use a plain object instead (as a hashtable). Something like this should work:</p> <pre><code>&lt;script...
<p>You're bumping into the boundary between <code>Array</code>s and <code>Object</code>s in Javascript. Array elements are accessed by ordinal, an integer between 0 and 4294967294 (maximum unsigned 32-bit integer - 1), inclusive. Object properties are accessed by name. Since -10 isn't a valid ordinal number, it is inte...
17,384
<p>What are some practical uses for the "<a href="http://en.wikipedia.org/wiki/Curiously_Recurring_Template_Pattern" rel="noreferrer">Curiously Recurring Template Pattern</a>"? The "<a href="http://en.wikipedia.org/wiki/Curiously_Recurring_Template_Pattern#Object_counter" rel="noreferrer">counted class</a>" example co...
<p><a href="http://c2.com/cgi/wiki?SimulatedDynamicBinding" rel="noreferrer">Simulated dynamic binding</a>. Avoiding the cost of virtual function calls while retaining some of the hierarchical benefits is an enormous win for the subsystems where it can be done in the project I am currently working on. </p>
<p>Generally it is used for polymorphic-like patterns where you do not need to be able to choose the derived class at runtime, only at compile time. This can save the overhead of the virtual function call at runtime.</p>
17,998
<p>I'm sure this one is easy but I've tried a ton of variations and still cant match what I need. The thing is being too greedy and I cant get it to stop being greedy.</p> <p>Given the text:</p> <pre><code>test=this=that=more text follows </code></pre> <p>I want to just select:</p> <pre><code>test= </code></pre> ...
<p>here:</p> <pre><code>// matches "test=, test" (\S+?)= or // matches "test=, test" too (\S[^=]+)= </code></pre> <p>you should consider using the second version over the first. given your string <code>"test=this=that=more text follows"</code>, version 1 will match <code>test=this=that=</code> then continue parsing...
<p>if you want only "text=", I think that a simply:</p> <pre><code>^(\w+=) </code></pre> <p>should be fine if you are shure about that the string "text=" will always start the line.</p> <p>the real problem is when the string is like this:</p> <blockquote> <p>this=that= more test= text follows</p> </blockquote> <...
25,785
<p>Are Adobe's plugin architectures for Photoshop and Lightroom related in any way? If I have source code for a plugin, that works with PS 3.0-CS3 as well as PS Elements 6.0 can I use it with Lightroom directly? If not, what would I have to modify?</p>
<p>No.. lightroom plugins are written in the scripting language lua, photoshop plugins are written in C++.</p>
<p>As pointed out by Rob, the Lightroom SDK does not expose any interface that allows manipulations of the image files themselves. Partly this is because Lightroom is a non-destructive editor. None of the edits made in its Develop module are applied to the original image file; they are applied to the file generated whe...
34,313
<p>I'm using Hudson and Maven 2 for my automated build/CI. I can build fine with maven from the command line, but when I run the same goal with Hudson, the build fails complaining of missing artifacts. I'm running Hudson as a windows XP service.</p>
<p>Besides another commercial product, like <a href="http://www.wowzamedia.com/" rel="nofollow noreferrer">Wowza Media Server</a>, you could go with a CDN (Content Delivery Network), like <a href="http://www.limelightnetworks.com/" rel="nofollow noreferrer">Limelight Networks</a> or <a href="http://www.voxel.net/" rel=...
<p>It looks like WebOrb can do it: <a href="http://www.themidnightcoders.com/weborb/dotnet/faq.shtm" rel="nofollow noreferrer">WebOrb FAQ</a> (last entry)</p> <blockquote> <p>Can I stream Flash video to a Flex/Flash client through WebORB? Yes, WebORB supports FLV video streaming. An example is included with the We...
6,582