instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>I am trying to use log4net in an ASP.NET application with Visual Studio 2005. I have declared an instance of the logger like so:</p> <pre><code>Private Shared ReadOnly log As ILog = LogManager.GetLogger("") </code></pre> <p>I am trying to use it in the following manner:</p> <pre><code>If log.IsDebugEnabled Then ...
<p>Before calling LogManager.GetLogger("")</p> <p>You have to call log4net.Config.XmlConfigurator.Configure(); In an ASP.NET app you probably want to put this call in Application_Start </p>
<p>Use this in any method before you use log :</p> <p>log4net.Config.XmlConfigurator.Configure();</p> <p>In App.Config ,the settings should be :</p> <pre><code>&lt;root&gt; &lt;level value="ALL" /&gt; &lt;appender-ref ref="AppenderName" /&gt; &lt;/root&gt; </code></pre>
27,083
<p>In C#4.0 we're going to get dynamic types, or objects whose "static type is dynamic", according to Anders. This will allow any method invocation resolution to happen at runtime rather than compile time. But will there be facility to bind the dynamic object to some sort of contract (and thereby also get full intellis...
<p>I'm not aware of anything really resembling duck typing, I'm afraid. I've <a href="http://msmvps.com/blogs/jon_skeet/archive/2008/10/30/c-4-0-dynamic-lt-t-gt.aspx" rel="nofollow noreferrer">blogged about the idea</a>, but I don't expect any support. It probably wouldn't be too hard to use Reflection.Emit to make a c...
<p>That's a cool idea. If I understand you, you're describing/proposing a capability of the CLR, whereby, when you try and cast a dynamic object to an interface, it should look at what methods/properties the dynamic object supports and see if it has ones that effectively implement that interface. Then the CLR would tak...
32,482
<p>My Flashforge Adventurer 3 is not printing properly. Filament feeder makes repetitive loud thumping noise and not enough filament is extruded. Resulting print (if completed) is not solid.</p> <p>Results vary with filament. Flashforge brand (red) PLA works best. Any other filament fails completely unless I print ...
<p>Advice from another source suggested thoroughly cleaning the feed gear on the bowden extruder. When I looked closely there were plastic flakes all over the mechanism. I used compressed air and a brush to clean it. I also discovered expert mode in the FlashPrint software, which enabled me to slow down the speed at...
<p>I had a lot of thumps lately after I moved my printer location.</p> <p>Turns out my printer wasn't level and the extruder was pushing harder (further down) on different places, causing thumps. This really shows because the calibration is only in 1 spot.</p> <p>I used some printer paper and a bubble level then reca...
1,133
<p>When an error occurs in a function, I'd like to know the sequence of events that lead up to it, especially when that function is called from a dozen different places. Is there any way to retrieve the call stack in VB6, or do I have to do it the hard way (e.g., log entries in every function and error handler, etc.)?...
<p>I'm pretty sure you have to do it the hard way. At a previous job of mine, we had a very elegant error handling process for VB6 with DCOM components. However, it was a lot redundant code that had to be added to every method, so much that we had home-grown tools to insert it all for you.</p> <p>I can't provide too...
<p>Compuware (or was it Numega at the time) DevStudio for Visual Basic 6 used to do this. The way was by adding adding instrumenation to every call that called a very small snippet that added to the code stack. On any error it dumped out that callstack, and then did things like mail or post to a webserver all the deb...
15,534
<p>So as the title said my heated bed stopped heating mid print. </p> <p>I'm pretty confident the bed itself is not the problem as I've ran continuity tests from the wires and a resistance check (which showed a total resistance of about 1.5 ohms, which is where it should be). I've done voltage checks across the input ...
<p>First you should check if the bed still works when applying 12V directly. You can then also check the voltage over the 12V output terminals to measure the power supply unit while it is powering the bed. It is unclear whether you measured the voltage of the PSU while it was powering a large load.</p> <p>It is also a...
<p>you can swap pins in Marlin firmware. When you download it from GitHub, there is a file called <a href="https://github.com/prusa3d/Prusa-Firmware/blob/MK3/Firmware/pins.h" rel="nofollow noreferrer">pins.h</a> (please be aware that this file is an example), and you can play with your setup to skip the broken mosfet.<...
930
<p>How do you run an external program and pass it command line parameters using C? If you have to use operating system API, include a solution for Windows, Mac, and Linux.</p>
<p>It really depends on what you're trying to do, exactly, as it's:</p> <ol> <li>OS dependent</li> <li>Not quite clear what you're trying to do.</li> </ol> <p>Nevertheless, I'll try to provide some information for you to decide.<br> On UNIX, <code>fork()</code> creates a clone of your process from the place where you...
<p>If you need to check/read/parse the output of your external command, I would suggest to use popen() instead of system().</p>
3,785
<p>How does one automatically find categories for text based on content?</p>
<ol> <li>Read <strong><a href="http://www.cs.waikato.ac.nz/~ml/weka/book.html" rel="nofollow noreferrer">Data Mining: Practical Machine Learning Tools and Techniques</a></strong> - Ian H. Witten, Eibe Frank</li> <li>Use <strong><a href="http://www.cs.waikato.ac.nz/~ml/weka/" rel="nofollow noreferrer">Weka</a></strong>...
<p>There is a good paper written on this: <a href="http://www.cs.utexas.edu/users/hyukcho/classificationAlgorithm.html" rel="nofollow noreferrer">http://www.cs.utexas.edu/users/hyukcho/classificationAlgorithm.html</a></p>
9,122
<p>I have a slow custom data source in a SSIS Dataa Flow Task.I have to run the package with multiple parameters</p> <p>If I want to upload data to a DB using SQL Data Destination(Bulk Insert) the connection times out</p> <p>If I write the data to a flat file I cannot run multiple instances of the package, since they...
<p>You can leverage JQuery UI 1.6's Effects (<a href="http://ui.jquery.com/repository/real-world/effects/" rel="nofollow noreferrer">Effects Demo Page</a>). The following accomplished the desired effect for me.</p> <pre><code>$('#toggleButton').bind('click', function(e) { $('#expandingFooter').toggle( 'sl...
<p>Try something like this: </p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Untitled&lt;/title&gt; &lt;script type="text/javascript" src="shared-scripts/jquery-1.2.4b.js"&g...
47,479
<p>I have a program 'foo' running different threads, fooT1, fooT2, .. fooTn.</p> <p>Now if I want write another program 'bar', which could kill the thread fooTr, is that possible?</p> <p>Reason: One of the thread fooTr tracks product license. If this thread is killed; one may run this product indefinitely. And killin...
<p>Actually the java debugger will allow you to kill a thread by injecting an exception into it. I was just trying to work out how to use this feature to kill a thread without wiping out the whole jvm, when I came across this question. If you run the jvm with command line options like:</p> <pre><code>java -Xdebug -X...
<p>Until now isn´t possible to run to diferent programs in the same JVM, but some people is investigating it, in order to reduce the startup time and the memory and cpu usage of diferent java programs runing in the same machine</p>
21,925
<p>I have a requirement to develop a .NET-based application whose data requirements are likely to exceed the 4 gig limit of SQL 2005 Express Edition.</p> <p>There may be other customers of the same application (in the future) with a requirement to use a specific DB platform (such as Oracle or SQL Server) due to in-hous...
<p>I suggest using NHibernate with postgres.</p> <p>You can do all your testing and development on sqlite so you don't need to have an instance of postgres running on your dev machine.</p> <p>If you aren't sure if you want to use mysql or postgres, I suggest trying them both out. Postgres is more compliant, but if y...
<p><a href="http://www.llblgen.com" rel="nofollow noreferrer">Llbgen</a> is very nice for your ORM mapper. At first there is quite a bit of a learning curve, but once you get the hang of it it's very good. It supports the databases you mentioned here, plus a few more.</p>
32,407
<p>For a registration form I have something simple like:</p> <pre><code> &lt;tr:panelLabelAndMessage label="Zip/City" showRequired="true"&gt; &lt;tr:inputText id="zip" value="#{data['registration'].zipCode}" contentStyle="widt...
<p>Problem is, the fields must layout horizontally. It's a no-go to put ZIP field and city not next to each other in one line. At least for me.</p> <p>A co-worker has pointed me to set a faclets variable inside the first tr:message and to put a rendered attribute at the second one that reacts on this variable. Havn't ...
<p>I know this won't be ideal, but if you remove the <code>panelLabelAndMessage</code> tag and just use the label attribute on the <code>inputText</code> tag that should remove the extra error message. </p>
11,751
<p>I'm trying to play a sound file from an iPhone program.</p> <p>Here's the code:</p> <pre><code>NSString *path = [[NSBundle mainBundle] pathForResource:@"play" ofType:@"caf"]; NSFileHandle *bodyf = [NSFileHandle fileHandleForReadingAtPath:path]; NSData *body = [bodyf availableData]; NSLog( @"length of play.caf %d",...
<p>The first parameter to NSLog is a format string; you're passing <code>[URL description]</code> as the format string to the second use of NSLog. That's bad, because if the description of the URL contains any <code>%</code> characters then it will wind up printing random stuff from the stack.</p> <p>Instead, write</...
<p>I tried the same with my application that plays sounds just fine. The sounds don’t play in the Simulator and when I try to <code>NSLog</code> the URL, I get the same garbage as You and <code>EXC_BAD_ACCESS</code> on the top of it. When I log the URL on the device, the URL is fine, but I get <code>EXC_BAD_ACCESS</cod...
32,197
<p>What security best-practices would you strongly recommend in maintaining a Linux server? <br />(i.e. bring up a firewall, disable unnecessary services, beware of suid executables, and so on.)</p> <p>Also: is there a definitive reference on Selinux?</p> <p>EDIT: Yes, I'm planning to put the machine on the Internet,...
<p>For SELinux I've found <a href="https://rads.stackoverflow.com/amzn/click/com/0131963694" rel="noreferrer" rel="nofollow noreferrer">SELinux By Example</a> to be really useful. It goes quite in-depth into keeping a sever as secure as possible and is pretty well written for such a wide topic.</p> <p>In general thoug...
<p>Don't use a DNS Server unless you have to . BIND has been a hotspot of security issues and exploits.</p>
22,606
<p>Is there a (standardized) way to get the name of the current method using c++? </p> <p>Using GNU GCC you can do this by using the macro <code>__FUNCTION__</code> and <code>__PRETTY_FUNCTION__</code> (surrounded by 2 underscores), however, this is of course non portable. Is there a way to do this in standard c++ or ...
<p>The <code>__func__</code> identifier is part of the C99 standard and is in the C++0x draft.</p> <p>The identifier <code>__func__</code> is implicitly declared by the compiler as if the following were at the very start of each function body:</p> <pre><code>static const char __func__[] = "function-name"; </code></pr...
<p>No, it is not supported by c++ standard.</p>
30,768
<p>Does anybody know a good place to find things about game development for windows mobile?</p> <p>thanks!</p>
<p>The first thing you will require is the <a href="http://msdn.microsoft.com/en-ca/windowsmobile/bb264337.aspx" rel="nofollow noreferrer">Tools</a> and <a href="http://msdn.microsoft.com/en-us/windowsmobile/bb264330.aspx" rel="nofollow noreferrer">Startup kit</a>. This link is for .Net for Windows Mobile.</p>
<p>You can also check these <a href="http://msdn.microsoft.com/en-us/windowsmobile/bb495180.aspx" rel="nofollow noreferrer">video from MSDN</a> that show you basic coding (not game but can help you) on Windows Mobile.</p>
44,867
<p>What's the easiest way to centre a <code>java.awt.Window</code>, such as a <code>JFrame</code> or a <code>JDialog</code>?</p>
<p>From <a href="https://web.archive.org/web/20080921040824/http://blog.codebeach.com/2008/02/center-dialog-box-frame-or-window-in.html" rel="noreferrer">this link</a></p> <blockquote> <p>If you are using Java 1.4 or newer, you can use the simple method setLocationRelativeTo(null) on the dialog box, frame, or ...
<p>Actually frame<code>.getHeight()</code> and <code>getwidth()</code> doesnt return values , check it by <code>System.out.println(frame.getHeight());</code> directly put the values for width and height ,then it will work fine in center. eg: as below</p> <pre><code>Dimension dimension = Toolkit.getDefaultToolkit().get...
17,473
<p>I'm interested to get a free, WYSIWYG HTML editor that is compatible with Django template. Any ideas?</p> <blockquote> <p>Thanks LainMH.</p> <p>But I afraid fckeditor is used in web app, for the purpose of editing HTML. What I want is an editor that allows me to write HTML that is Django compatible. </p>...
<p><a href="http://www.fckeditor.net/" rel="noreferrer">http://www.fckeditor.net/</a> ?</p> <p>EDIT: Just found this: <a href="http://blog.newt.cz/blog/integration-fckeditor-django/" rel="noreferrer">http://blog.newt.cz/blog/integration-fckeditor-django/</a></p>
<p>According to brief Googling (no personal experience with this), Aptana now supports Python development via Pydev. Pydev again can be configured to work with Django.</p> <p>Thus I would expect Aptana to be usable with Django templates aswell, though I have no complete guide these links should be helpful :</p> <ul> ...
8,639
<p>I need to implement a SSO between a SharePoint site and a custom PHP-based site which resides on a different domain. I need to use the SharePoint user accounts to log in the PHP site. (I'll have a full control over the PHP source)</p> <p>Is this possible? Any tips and tricks?</p>
<p>My assumption is you have full control over your php app/domain, but a different team is managing the sharepoint server. Also assume you can ask the sharepoint team to create a simple webpart for your SSO functionality.</p> <p>If this is the case, you can ask the sharepoint team to create a webpart which has a lin...
<p>well, we have been in same situation, but we are using asp.net in combination with php for SSO. the asp.net code does windows authentication, and creates a record in mysql database, which contains username and a unique key, and assign these values to a cookie. then, redirects the user to PHP app. </p> <p>the php ap...
30,050
<p>I need to do a join across two different database servers (IPs 10.0.0.50 and 10.0.0.51). What's the best way?</p>
<p>You need to use sp_linkedserver to create a linked server.</p> <pre><code>sp_addlinkedserver [ @server= ] 'server' [ , [ @srvproduct= ] 'product_name' ] [ , [ @provider= ] 'provider_name' ] [ , [ @datasrc= ] 'data_source' ] [ , [ @location= ] 'location' ] [ , [ @provstr= ] 'provider_string' ] [ , [ @catalo...
<p>You can, as mentioned, use sp_addlinkedserver. However, you may also do this via Enterprise Manager (2000) or SQL Server Management Studio (2005). Under the "Security" node, there is a "Linked Servers" node, which you can use to add and configure Linked Servers. You can specify security settings, impersonation, etc....
22,973
<p>Can anyone point me to some decent introductions to WS-Security?</p> <p>I'm looking for tutorials or something that provide a fairly gentle introduction to the subject, though I don't mind if it assumes basic knowledge of web services and SOAP. Most of the stuff I've seen so far is very technical and you need a lot...
<p>I think the best introduction to the (any) subject are some good examples.<br> <a href="http://www.codeproject.com/KB/webservices/WS-Security.aspx" rel="nofollow noreferrer">This article</a> at codeProject gives a fairly easy to follow guide trough web service security for a .NET application.</p>
<p>You can find some good article on WS-Security and <a href="http://ws.apache.org/rampart/" rel="nofollow noreferrer">Apache Rampart</a> - the open source WS-Security implementation - in <a href="http://wso2.org/library" rel="nofollow noreferrer">WSO2 Online Library</a>.</p> <p><a href="http://wso2.org/downloads/wsf/...
2,916
<p>I want to setup a CRON that runs a PHP script that in turn moves XML file (holding non-sensitive information) from one server to another. </p> <p>I have been given the proper username/password, and want to use SFTP protocol. The jobs will run daily. There is the potential that one server is Linux and the other is W...
<p>If both servers would be on Linux you could use <a href="http://samba.anu.edu.au/rsync/" rel="noreferrer">rsync</a> for any kind of files (php, xml, html, binary, etc). Even if one of them will be Windows there are rsync ports to Windows.</p>
<p>I had some similar situation. After some tries, I did some thing different</p> <p>We have 2 servers, a (that have the original files) b (files should moved to it)</p> <p>And for sure the data is NOT sensitive</p> <p>Now in server a I made a file to do the following when called: 1. Choose the file to move 2. Zip ...
30,352
<p>Hey, I'm really new to Haskell and have been using more classic programming languages my whole life. I have no idea what is going on here. I'm trying to make a very simple Viterbi algorithm implementation, but for only two states (honest and dishonest casino)</p> <p>I have a problem where I want to address my arr...
<p>I copied the code from the edit window (something in stackoverflow's parser is eating part of the code) and tried it on ghci, which found several errors. The first error was:</p> <pre><code>foo.hs:34:71: Couldn't match expected type `[e]' against inferred type `(a, b)' In the second argument of `listArray',...
<p>You can rewrite the trans-function like this:</p> <pre><code>trans :: Int -&gt; Int -&gt; Double -&gt; Double -&gt; Double trans 1 1 trans11 trans21 = trans11 trans 1 2 trans11 trans21 = 1-trans11 trans 2 1 trans11 trans21 = trans21 trans _ _ trans11 trans21 = 1-trans21 </code></pre>
37,217
<p>I really don't know how to describe it, but if you understood it and had experience on that field, may be you can help me with something 'Open Source' and 'Ready-made'.</p> <p>I want to create something like a box 'or widget', where you can change its content by hitting some buttons on the top of the box. (Hey the ...
<p>Just because the box is on a Web page doesn't mean it should use AJAX, Omar. Have you thought about using a third-party solution like <a href="http://www.clearspring.com/" rel="nofollow noreferrer">ClearSpring</a> or <a href="http://www.widgetbox.com/" rel="nofollow noreferrer">WidgetBox</a>? If you need to put yo...
<p>Have you tried Jquery?</p> <p>Visit www.jquery.com</p> <p>Some example can be found at <a href="http://www.openjs.com/scripts/events/keyboard_shortcuts/" rel="nofollow noreferrer">http://www.openjs.com/scripts/events/keyboard_shortcuts/</a></p> <p>Also please check the In-place editing example at <a href="http:/...
42,240
<p>Can anyone point me to an example of how to use ServletUnit to test JSP's? Do I need I need to call registerServlet()? If so, what class name do I pass?</p>
<p>You do not need to registerServlet if you are going use the default Jasper compiler. However, I needed Jasper jars and their dependencies on the CLASSPATH. The Maven dependencies I needed to get a basic JSP to compile and render were:</p> <pre><code>&lt;dependency&gt; &lt;groupId&gt;tomcat&lt;/groupId&gt; &lt;a...
<p>This is what I´m using now for testing JSP render and verify forms and forwards.</p> <p>First Maven dependencies</p> <pre><code> &lt;!-- Testing JSP --&gt; &lt;dependency&gt; &lt;groupId&gt;net.sourceforge.openutils&lt;/groupId&gt; &lt;artifactId&gt;openutils-testing4web&lt;/artifactId&gt; &lt;version&gt;...
38,003
<p>I am writing a game in python and have decided to create a DSL for the map data files. I know I could write my own parser with regex, but I am wondering if there are existing python tools which can do this more easily, like re2c which is used in the PHP engine.</p> <p>Some extra info:</p> <ul> <li>Yes, I <em>do</e...
<p>I've always been impressed by <a href="http://pyparsing.wikispaces.com/" rel="noreferrer">pyparsing</a>. The author, Paul McGuire, is active on the <a href="http://mail.python.org/mailman/listinfo/python-list" rel="noreferrer">python list</a>/<a href="http://groups.google.com/group/comp.lang.python" rel="noreferrer"...
<p>On the lines of declarative python, I wrote a helper module called 'bpyml' which lets you declare data in python in a more XML structured way without the verbose tags, it can be converted to/from XML too, but is valid python.</p> <p><a href="https://svn.blender.org/svnroot/bf-blender/trunk/blender/release/scripts/m...
44,051
<p>I'm working on some code to colorize an image in Java. Basically what I'd like to do is something along the lines of GIMP's colorize command, so that if I have a BufferedImage and a Color, I can colorize the Image with the given color. Anyone got any ideas? My current best guess at doing something like this is to ge...
<p>Let <code>Y = 0.3*R + 0.59*G + 0.11*B</code> for each pixel in the image, then set them to be</p> <p><code>((R1+Y)/2,(G1+Y)/2,(B1+Y)/2)</code></p> <p>if <code>(R1,G1,B1)</code> is what you are colorizing with.</p>
<p>I wanted to do the exact same thing as the question poster wanted to do but the above conversion did not remove colors like the GIMP does (ie green with a red overlay made an unpleasant brown color etc). So I downloaded the source code for GIMP and converted the c code over to Java.</p> <p>Posting it in this thread...
4,362
<p>I just read <a href="https://stackoverflow.com/questions/72271/no-newline-at-end-of-file-compiler-warning">this post</a> about why new-line warnings exist, but to be honest my team has people working on several different platforms and with several different editors (everyone uses what bests suites them), so the warn...
<p>There isn't one as far as i know, i've used GCC for years.</p> <p><strong>Update:</strong> There should not be any warnings raised with C++11 standard. <a href="https://stackoverflow.com/a/72409/463758">Related Q</a></p>
<p>I'm 90% sure there is no arguemnt to turn this off.</p> <p>The reason for the warning is that files without an endline give undefined behavior when compiled:</p> <p>See standard: <a href="http://c0x.coding-guidelines.com/5.1.1.2.html" rel="nofollow noreferrer">http://c0x.coding-guidelines.com/5.1.1.2.html</a></p> ...
35,833
<p>I have multiple layers in an application and i find myself having to bubble up events to the GUI layer for doing status bar changes, etc . . I find myself having to write repeated coded where each layer simply subscribes to events from the lower layer and then in the call back simply raise an event up the chain. Is...
<p>If all you're doing is firing an event handler from another event handler, you can cut out the middle man and hook the event handlers directly in the add/remove blocks for the event.</p> <p>For example, if you have a UserControl with a "SaveButtonClick" event, and all you want to do when is call the event handler w...
<p>You can have a central channel that only support events. This channel must be independent so the layer only publish or subscribe to it.</p>
26,700
<p>I haven't touched sharepoint in years. If I want to setup a development environment to get up to speed, what options do I have? I don't have an MSDN license, is there anyway I can get up and running for free? (for development only)</p>
<p>You <strong>need</strong> a Windows 2003 Server (or 2008 Server, but I have no experience with that), no way around that. You can then of course use Visual C# 2005 Express and the SHarepoint Services 3.0 if that's your target.</p> <p>If you want to do development on Sharepoint 2007, you have to buy a Sharepoint 200...
<p>The action pack is fantastic value, you can use the Windows Server from that, as well as SharePoint Enterprise / Standard.</p>
3,275
<p><code>std::swap()</code> is used by many std containers (such as <code>std::list</code> and <code>std::vector</code>) during sorting and even assignment.</p> <p>But the std implementation of <code>swap()</code> is very generalized and rather inefficient for custom types.</p> <p>Thus efficiency can be gained by ove...
<p>The right way to overload <code>std::swap</code>'s implemention (aka specializing it), is to write it in the same namespace as what you're swapping, so that it can be found via <a href="https://en.cppreference.com/w/cpp/language/adl" rel="noreferrer">argument-dependent lookup (ADL)</a>. One particularly easy thing ...
<p>While it's correct that one shouldn't generally add stuff to the std:: namespace, adding template specializations for user-defined types is specifically allowed. Overloading the functions is not. This is a subtle difference :-)</p> <blockquote> <p>17.4.3.1/1 It is undefined for a C++ program to add declaratio...
3,265
<p>I saw Scott Meyers' <a href="https://rads.stackoverflow.com/amzn/click/com/0321334876" rel="nofollow noreferrer" rel="nofollow noreferrer">"Effective C++"</a> third edition book having a small section on "Template Programming".</p> <p>Any other book/links containing information on "effective" usage of templates ?</...
<p>I like <a href="https://rads.stackoverflow.com/amzn/click/com/0201704315" rel="nofollow noreferrer" rel="nofollow noreferrer">Modern C++ Design: Generic Programming and Design Patterns Applied</a>. I found it very well written and clear. Contains a few advanced topics.</p> <p><a href="https://i.stack.imgur.com/Apkd...
<p>Scott Meyers deals with the Standard Template Library in <a href="https://rads.stackoverflow.com/amzn/click/com/0201749629" rel="nofollow noreferrer" rel="nofollow noreferrer">Effective STL</a>. That may be relevant for you.</p>
23,171
<p>I'm trying out asp.net mvc for a new project, and I ran across something odd. When I use the MVC UI helpers for textboxes, the values get persisted between calls. But, when I use a series of radio buttons, the checked state doesn't get persisted.</p> <p>Here's an example from my view.</p> <pre><code>&lt;li&gt; ...
<p>If you give the radio buttons the same name as the property on your model, then MVC will automatically set the checked attribute on the appropriate button.</p> <p>I think this relies on having a strongly typed Model.</p>
<p>View:</p> <pre><code>&lt;%=Html.RadioButton("providerType","1")%&gt;&lt;label&gt;Hospital&lt;/label&gt; &lt;%=Html.RadioButton("providerType","2")%&gt;&lt;label&gt;Facility&lt;/label&gt; &lt;%=Html.RadioButton("providerType","3")%&gt;&lt;label&gt;Physician&lt;/label&gt; </code></pre> <p>Controller:</p> <pre><code...
32,964
<p>While researching this issue, I found multiple mentions of the following scenario online, invariably as unanswered questions on programming forums. I hope that posting this here will at least serve to document my findings.</p> <p>First, the symptom: While running pretty standard code that uses waveOutWrite() to out...
<p>You're not alone with this issue: <a href="http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=100589" rel="nofollow noreferrer">http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=100589</a></p>
<p>Not sure about this particular problem, but have you considered using a higher-level, cross-platform audio library? There are a lot of quirks with Windows audio programming, and these libraries can save you a lot of headaches.</p> <p>Examples include <a href="http://portaudio.com" rel="nofollow noreferrer">PortAud...
23,780
<p>Is there any way to configure SQL Server 2000 Standard Edition (32 bit) to use more than 2Gb of memory on a server running Windows 2003 (64 bit)?</p> <p>Thanks for any help.</p>
<p>32 bit versions of SQL Server with Advanced Windowing Extensions (AWE) disabled can only access 2 GB of memory, (or 3 GB if the /3gb switch is used in boot.ini - although I'm not sure off the top of my head if this will work on 64 bit Windows). This is regardless of whether they are running on Windows 2003 32 bit o...
<p>It appears that this Microsoft article is of relevance:</p> <p><a href="http://support.microsoft.com/kb/274750" rel="nofollow noreferrer">How to configure SQL Server to use more than 2 GB of physical memory</a></p>
41,616
<p>I'm looking to patch a piece of abandonware with some code.</p> <p>The software is carbon based, so I can not use an InputManager (at least, I do not think I can). My idea was to add a dylib reference to the mach-o header, and launch a new thread when the initialization routine is called.</p> <p>I have mucked arou...
<p>I'm not entirely sure what you're trying to accomplish, but the easiest way to do this is probably to inject a thread into the mach task after it starts. A great source of information on doing this (as well as running code to do it) can be found here: <a href="http://rentzsch.com/mach_inject/" rel="noreferrer">http:...
<p>The easiest solution that doesn't involve patching the binary is to simply use the DYLD_INSERT_LIBRARIES environment variable and then run your application.</p> <pre><code>set DYLD_INSERT_LIBRARIES to /my/path/libAltInput.dylib </code></pre> <p>I'm assuming the reason the dynamic linker reported an error is becaus...
34,399
<p>It seems that any kind of graphic library like <a href="http://www.directfb.org/" rel="noreferrer">DirectFB</a> or <a href="http://www.minigui.org/" rel="noreferrer">MiniGui</a> requires some sort of underlying operation system like Linux or uClinux.</p> <p>I am challenged with writing a software for a micro contro...
<p>We have used "PEG", the C++ version, from Swellsoftware for many years. It is commercial software, not free, but the underlying screen driver can use just a pointer to graphics memory and they provide many sample drivers for different types of graphics hardware. We wrote our own custom driver(s) for our proprietar...
<p>512kb is small. Good luck!</p> <p>You might want to try a <a href="http://www.damnsmalllinux.org/" rel="nofollow noreferrer">dsl</a> combined with <a href="http://www.mplayerhq.hu/" rel="nofollow noreferrer">mplayer</a>. The latter does not need a GUI to display a movie. I guess it could also display images.</p> <...
47,813
<p>I printed a case for my phone, a Motorola G4 Plus. I found the model of the casing on <a href="https://www.thingiverse.com/thing:2482011" rel="nofollow noreferrer">Thingiverse</a></p> <p>I just downloaded the model, used Meshmixer to check for issues, after that, opened Simplify3d and saved it for printing using an...
<p>In short: Not really.</p> <p>longer version: It depends.</p> <p>The main culprit of losing details in this case would be the weight and speed of the thing moving. So if you have a heavy X-axis carriage, acceleration and decelerating the carriage won't be instant. Same with the bed (Y-axis).</p> <p>Another culprit...
<p>I'm under the impression that your question hints on rectilinear motion by aligning the print part to the axes motion of the printer. So, placing it under 45&deg; would suggest movement of both steppers to make a straight line opposed to one stepper movement for a straight line.</p> <p>Basically, the weight of the ...
1,302
<p>I have a ASP.net 2.0 app and I have made some changes the the source file ( cs files ). I uploaded the changes with the belief that it would auto-recompile. I also have the compiled dll in MY_APP/bin. I checked it and noticed that it did not recompile. Please understand I am new to this.</p>
<p>my #1 way to do this, add white space to the top of the web config file, after the xml declaration tag.</p> <p>It forces the node to re-cache and recompile. We even have a page deep in the admin called Flush.aspx that does it for us.</p>
<p>In VS menu you have Build -&gt; Rebuild Solution</p>
7,508
<p>I have a DataGridView control in a TabPage, and I listen for the SelectionChanged event. When the TabPage is selected, the DataGridView selects the first row and fires the SelectionChanged event. How can I stop it from automatically selecting a row?</p>
<p>I can think of two ways of working around this, If you know the event always fires, Have a bool flag that is set on the first selection, then only perform the rest of your SelectionChanged code.</p> <p>The other way is to have a hidden control that is the first TabStop for the TabPage and hence is the first control...
<p>Override the function "OnEnter" of the TabPage.</p> <p>Call the function "ClearSelecton" of the DataGridView within this function.</p>
29,649
<p>How can I find the index in a string that matches a boost regex?</p>
<p>If you use boost::regex_match it's the whole string that's matching.<br> Maybe you mean to use regex_search:</p> <pre><code>void index(boost::regex&amp; re,const std::string&amp; input){ boost::match_results&lt;std::string::const_iterator&gt; what; boost::match_flag_type flags = boost::match_default; st...
<p>Use the <code>position</code> member function of the <code>match_results</code>:</p> <pre><code>int find_match_offset(std::string const&amp; string_to_search, boost::regex const&amp; expression) { boost::smatch results; if(boost::regex_match(string_to_search,results,expression)) { ...
28,967
<p>I want to be able to run a function in my firefox sidebar js file when the selected tab in the main content window is reloaded or changed. So the sidebar can change depending on the site the user is looking at. </p> <p>Anyone able to point me in the right direction?</p>
<p>My solution pilfered from somewhere but can't remember where: </p> <pre><code>//add the load eventListener to the window object window.addEventListener("load", function() { functioname.init(); }, true); var functionname = { //add the listener for the document load event init: function() { var appconten...
<p>@oly1234 - your answer helped me to find the source:<br> <a href="https://developer.mozilla.org/en/Code_snippets/On_page_load" rel="nofollow noreferrer">Mozilla Developer Center - On page load</a> </p> <p>(<a href="https://developer.mozilla.org/en/Code_snippets/On_page_load" rel="nofollow noreferrer">https://develo...
30,563
<p>What is the masked text provider used for? Why is it different from regex?</p> <p>Is it possible to translate the regex format to mask or vise versa ?</p> <p>Thanks</p>
<p>A masked edit area forces the user to fill the field in a certain way: e.g. a mask that looks like ### will only allow a maximum of 3 numbers to be entered.</p> <p>A regular expression, on the other hand, is normally only checked for after the user has entered all the text. The validation happens too late to provid...
<p>A masked edit provides an input mask, with optional separators and placeholders. Users can only input data in the format supplied. As an extra you can set the mask type to Date or Time, so data is also validated for that particlar type.</p>
42,149
<p>I have a Stored Procedure called spGetOrders which accepts a few parameters: @startdate and @enddate. This queries an "Orders" table. One of the columns in the table is called "ClosedDate". This column will hold NULL if an order hasn't been closed or a date value if it has. I'd like to add a @Closed parameter w...
<p>Try this:</p> <pre><code>select * from orders o where o.orderdate between @startdate AND @enddate and ((@Closed = 1 And o.ClosedDate IS NULL) Or (@Closed = 0 And o.ClosedDate IS NOT NULL)) </code></pre> <p>Be vary careful about mixing AND's and OR's in the where clause. When doing this, the parenthesis to control...
<p>Or this:</p> <pre><code>select * from orders o where o.orderdate between @startdate AND @enddate and ( (@Closed = 1 AND o.ClosedDate IS NULL) OR (ISNULL(@Closed, 0) &lt;&gt; 1 AND o.ClosedDate IS NOT NULL) ) </code></pre> <p>It looks like you want all the orders between two dates that have inconsistent ...
46,029
<p>What's the best and most efficient way to count keywords in JavaScript? Basically, I'd like to take a string and get the top N words or phrases that occur in the string, mainly for the use of suggesting tags. I'm looking more for conceptual hints or links to real-life examples than actual code, but I certainly would...
<p>Cut, paste + execute demo:</p> <pre><code>var text = "Text to be examined to determine which n words are used the most"; // Find 'em! var wordRegExp = /\w+(?:'\w{1,2})?/g; var words = {}; var matches; while ((matches = wordRegExp.exec(text)) != null) { var word = matches[0].toLowerCase(); if (typeof words[...
<p>I would do exactly what you have mentioned above to isolate each word. I would then probably add each word as the index of an array with the number of occurrences as the value. </p> <p>For example:</p> <pre><code>var a = new Array; a[word] = a[word]?a[word]+1:1; </code></pre> <p>Now you know how many unique words...
17,065
<p>Unfortunatly I have to work in a older web application on a <code>PHP4</code> server; It now needs to parse a lot of <code>XM</code>L for calling <code>webservices (custom protocol, no SOAP/REST)</code>;</p> <p>Under <code>PHP5</code> I would use <code>SimpleXML</code> but that isn't available; There is <code>Dom X...
<p>There is a simpleXML backport avaliable: <a href="http://www.ister.org/code/simplexml44/index.html" rel="nofollow noreferrer">http://www.ister.org/code/simplexml44/index.html</a></p> <p>If you can install that, then that will be the best solution.</p>
<p>It might be a bit grass roots, but if it's applicable for the data you're working with, you could use XSLT to transform your XML in to something usable. Obviously once you upgrade to PHP5 the XSLT will still work and you can migrate as and when to DOM parsing.</p> <p>Andrew</p>
16,031
<p>I've been using Eclipse with RDT (not RadRails) a lot lately, and I'm quite happy with it, but I'm wondering if you guys know any decent alternatives. I know NetBeans also supports Ruby these days, but I'm not sure what it has to offer over Eclipse.</p> <p>Please, list any features you think are brilliant or useful...
<p>Have you tried <a href="http://www.aptana.com/" rel="nofollow noreferrer">Aptana</a>? It's based on Eclipse and they have a sweet <a href="http://www.aptana.com/rails" rel="nofollow noreferrer">Rails</a> plugin.</p>
<p>+1 for TextMate on Mac OS X.</p> <p>See also answers to <a href="https://stackoverflow.com/questions/16064/what-ide-to-use-for-developing-in-ruby-on-rails-on-windows#16086">this question</a>. I <a href="https://stackoverflow.com/questions/16064/what-ide-to-use-for-developing-in-ruby-on-rails-on-windows#16086">reco...
3,770
<p><code>Html.TextBox("ParentPassword", "", new { @class = "required" })</code></p> <p>what the gosh darned heck is the @ for the @class.</p>
<p><code>class</code> is a reserved keyword, so you can't use this as a variable name.</p> <p>The @ operator allows you to get around this rule. The reason why its being done here is that the anonymous object is used to populate attributes on a HTML element. A valid attribute name is "class", which lets you set the ...
<p><code>class</code> is a keyword. To use <code>class</code> as the name of a variable/property, in C#, you can prepend <code>@</code> to it, as <code>@class</code>. In the IL, for all .net is concerned, the name of the variable/property is still <code>class</code> - <code>@</code> is the way you have to do it in C#.<...
36,105
<p>I think I'm pretty good at using semantic markup on my pages but I still have a handful of classes like this:</p> <pre><code>/**** Aligns ****/ .right_align { text-align: right; } .left_align { text-align: left; } .center_align { text-align: center; } </code></pre> <p>Which, technically, is a no-no. But when yo...
<p>Why do you want to align the text?</p> <p>The answer to the question is the name of the id or class you need to have for your selector. Do you want to align it right because it's a price?</p> <pre><code>table .price { text-align: right } </code></pre> <p>Just ask yourself <em>why</em> do you want to apply a par...
<p>From experience, for usability reasons you should keep tokens on as many lines as possible. </p> <p>I use the following notation </p> <pre> matcher,&para; matcher&para; {&para; &middot;&middot;attribute:&middot;property;&para; }&para; </pre> <p>Why you ask? This solves many problems with collisions, as it reduces...
37,403
<p>When running <a href="https://github.com/MarlinFirmware/Marlin" rel="nofollow noreferrer">Marlin Firmware</a>, is it possible to run <a href="https://reprap.org/wiki/G-code" rel="nofollow noreferrer">G-code</a> scripts/series of commands automatically when you insert the SD card?</p> <hr> <p>I'm running Marlin on ...
<p>I am not <em>entirely sure</em> if this is what you are after, or if it will work, but from <a href="https://github.com/MarlinFirmware/Marlin/issues/2891#issuecomment-180980733" rel="nofollow noreferrer">this post</a> on <a href="https://github.com/MarlinFirmware/Marlin/issues/2891" rel="nofollow noreferrer">Printi...
<p>I don't know what you would like to achieve.</p> <p>As @typo mentioned there is similar functionality which triggers at printer startup: <a href="https://github.com/MarlinFirmware/Marlin/wiki/Autostart" rel="nofollow noreferrer">https://github.com/MarlinFirmware/Marlin/wiki/Autostart</a></p> <p>I found in Marlin's...
1,021
<p>I'm having trouble ordering by more than one field in my Linq to NHibernate query. Does anyone either know what might be wrong or if there is a work around?</p> <p>Code:</p> <pre><code>IQueryable&lt;AgendaItem&gt; items = _agendaRepository.GetAgendaItems(location) .Where(item =&gt; item.Minutes.Contains(query) ...
<p>This looks to me like a bug with Linq to NHybernate. One possible workaround is to convert to an array before sorting. A potentially big downside is that you can't limit the results using Skip() and Take() before enumerating, so this may not be sufficient for you.</p> <pre><code>var results = items .ToArray()...
<p>although i dont think it'd make a difference, what happens if you do your linq like this:</p> <p>(from i in items orderby i.prop1, i.prop2, i.prop3).Skip(...).Take(...).ToArray();</p>
8,582
<p>I am trying to RegisterClientScriptBlock in a method that is only called via an AJAX call. It doesn't appear to actually register the script on the page and I'm guessing this is because it's not actually reloading the entire page. Is there any way to register javascript on a page from within an ajax method call?</...
<p>With AJAX enabled pages, you should use the ScriptManager to register scripts:</p> <pre><code>ScriptManager.RegisterClientScriptBlock(Page, typeof(MyPage), "MyScript", "GoStuff()", true) </code></pre> <p>You can use this to register all your scripts (Original load, postback, AJAX postback).</p>
<p>As far as I know for this you would be forced to be calling this method via a PostBack and not an ajax call. There may be OTHER ways of doing this, but it is not possible with Page.ClientScript....</p>
38,000
<p>I have a list of structs and I want to change one element. For example :</p> <pre><code>MyList.Add(new MyStruct("john"); MyList.Add(new MyStruct("peter"); </code></pre> <p>Now I want to change one element:</p> <pre><code>MyList[1].Name = "bob" </code></pre> <p>However, whenever I try and do this I get the follow...
<pre><code>MyList[1] = new MyStruct("bob"); </code></pre> <p>structs in C# should almost always be designed to be immutable (that is, have no way to change their internal state once they have been created).</p> <p>In your case, what you want to do is to replace the entire struct in specified array index, not to try t...
<p>As of C#9, I am not aware of any way to pull a struct by reference out of a generic container, including <code>List&lt;T&gt;</code>. As Jason Olson's answer said:</p> <p><em>The real underlying issue is that structs are a Value type, not a Reference type. So when you pull out a &quot;reference&quot; to the struct fr...
7,461
<p>In VB.Net, I can declare a variable in a function as Static, like this:</p> <pre><code>Function EncodeForXml(ByVal data As String) As String Static badAmpersand As Regex = new Regex("&amp;(?![a-zA-Z]{2,6};|#[0-9]{2,4};)") data = badAmpersand.Replace(data, "&amp;amp;") ''// more processing return ...
<p>Ha! In posting the question, I found the answer! Rather than googling for C# I should have been looking for details on how VB.Net implements it, and typing up the question made that apparent to me. After applying that insight, I found this:<br> <a href="http://weblogs.asp.net/psteele/articles/7717.aspx" rel="noref...
<p>You have to declare this on the class level:</p> <pre><code>private static readonly RegEx badAmpersand = new RegEx("..."); </code></pre>
19,056
<p>For a particular application, I need the screen saver to be disabled while it's running. The operator COULD manually turn it off, and then back on later, but the easiest thing to do would be to just keep the screen saver at bay while the application is running.</p> <p>How do I do this? I've found code for actually...
<p><a href="https://devblogs.microsoft.com/oldnewthing/20090820-00/?p=17043" rel="nofollow noreferrer" title="Raymond Chen, The New Old Thing">theoldnewthing</a> has your answer: Use <a href="https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-setthreadexecutionstate" rel="nofollow noreferrer"><code>...
<p>try making your form topmost value <strong>true</strong> it works for me screen-saver never came even after the idle time...</p>
29,856
<p>Should the "visibility" for the <code>__destruct()</code> function be public or something else? I'm trying to write a standards doc for my group and this question came up.</p>
<p>In Addition to Mark Biek's answer:</p> <p>The __destruct() function must be declared public. Otherwise, the function will not be executed on script shutdown:</p> <pre><code>Warning: Call to protected MyChild1::__destruct() from context '' during shutdown ignored in Unknown on line 0 Warning: Call to private MyChil...
<p>I think it would need to be public in the case where a subclass needs to explicitly call the <strong>__destruct</strong> method of the parent class.</p> <p>Something like this would throw an error:</p> <pre><code>&lt;?php class MyParent { private function __destruct() { echo 'Parent::__destruct'; ...
28,500
<p>I'm having a difficult time figuring out how to add a .jar/library to a Netbeans project in such a way that I can get it committed to the repository.</p> <p>The typical way to add a library (per the Netbeans documents I've already gone through) ends up with it just being local to me. Anyone who checks out my proje...
<p>There are a couple ways to fix this.</p> <p>A. When you define your Library, use a path to a common location. A location that's identical on everyone's machine--such as the location of a JAR installed with a third-party app into Program Files or /usr/local/ works well or a network drive.</p> <p>Then, when they che...
<p>I ended up just downloading my own set and putting them on my local drive for this project. I setup my Netbeans to look there and warned the other guys what I did... Eventually, we'll have to do something a bit more scalable though... :-)</p>
36,482
<p>I know that you can use a dummy "int" parameter on <code>operator++</code> and <code>operator--</code> to override the postfix versions of those operators, but I vaguely recall something about a dummy parameter that you could declare on a destructor. Does anyone know anything about that, and if so, what that dummy p...
<p>You're possibly thinking of the placement and nothrow forms of operator delete, which have the signatures:</p> <pre><code>void operator delete(void *, void *) throw(); void operator delete(void *, const std::nothrow_t&amp;) throw(); void operator delete[](void *, void *) throw(); void operator delete[](void *, cons...
<p>You're not crazy. I have definitely seen an int parameter in a destructor before. Using HP's compiler on OpenVMS, I compiled a sample program show below. The list of symbols does include an destructor with an int parameter. I can only guess this is compiler specific.</p> <pre><code>$ create foo.cxx class foo { ...
33,549
<p>I just want my apache to register some of my predefined environment so that i can retrieve it using getenv function in php. How can i do this? I tried adding /etc/profile.d/foo.sh with export FOO=/bar/baz using root and restarted apache.</p>
<p>Environment variables are inherited by processes in Unix. The files in /etc/profile.d are only executed (in the current shell, not in a subshell) when you log in. Just changing the value there and then restarting a process will not update the environment. </p> <p>Possible Fixes:</p> <ul> <li>log out/log in, then s...
<p>You can use <a href="http://httpd.apache.org/docs/2.2/mod/mod_env.html#setenv" rel="nofollow noreferrer">SetEnv</a> in your config files (/etc/httpd/conf.d/*.conf, .htaccess ...). Additionally you should be able to define them in /etc/sysconfig/httpd (on RPM-based distribs) and <em>export</em> them (note: not tested...
13,945
<p>I need to make a mouseover menu that opens diagonally (from top-left to bottom-right). </p>
<p>Assuming your menu has id "mymenu", try this code to show it:</p> <pre><code>$('#mymenu').animate({width: '80px', height: '200px'}) </code></pre> <p>and this code to hide it:</p> <pre><code>$('#mymenu').animate({width: '0px', height: '0px', opacity: 'hide'}) </code></pre>
<p>Use a Tween to tween the height from 0 to whatever height you want, and width from 0 to whatever width you want.</p> <p>You can take examples of making a popup menu show from the code here, as well as examples of performing actions on hover.</p>
25,660
<p>I have clustered applications that requires one of the nodes to be designated as the master. The cluster nodes are tracked in a table with <strong>nodeID</strong>, <strong>isMaster</strong>, <strong>lastTimestamp</strong> columns.</p> <p>Each node in the cluster will try to become a master every <strong>X</strong> ...
<p>The normal way of avoiding the "delete then move fails problem" is:</p> <ul> <li>Write to file.new</li> <li>Move file.current to file.old</li> <li>Move file.new to file.current</li> <li>Delete file.new</li> </ul> <p>Then when you come to read, use file.new if file.current is missing, deleting file.old if you see i...
<p>I found it useful to wrap this pattern in it's own class.</p> <pre><code>class Program { static void Main( string[] args ) { using( var ft = new FileTransaction( @"C:\MyDir\MyFile.txt" ) ) using( var sw = new StreamWriter( ft.TempPath ) ) { sw.WriteLine( "Hello" ); ft.Com...
42,046
<p>How do I store binary data in <a href="http://en.wikipedia.org/wiki/MySQL" rel="noreferrer">MySQL</a>?</p>
<p>The answer by phpguy is correct but I think there is a lot of confusion in the additional details there.</p> <p>The basic answer is in a <code>BLOB</code> data type / attribute domain. <strong>BLOB</strong> is short for Binary Large Object and that column data type is specific for handling binary data.</p> <p>See...
<p>The question also arises how to get the data into the BLOB. You can put the data in an INSERT statement, as the PHP example shows (although you should use <a href="http://www.php.net/mysql-real-escape-string" rel="noreferrer">mysql_real_escape_string</a> instead of addslashes). If the file exists on the database ser...
2,237
<p>I am developing a system as an aid to musicians performing transcription. The aim is to perform automatic music transcription (it does not have to be perfect, as the user will correct glitches / mistakes later) on a single instrument monophonic recording. Does anyone here have experience in automatic music transcrip...
<p>Here is a graphic that illustrates the threshold approach to note onset detection:</p> <p><img src="https://i.imgur.com/MBWzwT8.gif" alt="alt text"></p> <p>This image shows a typical WAV file with three discrete notes played in succession. The red line represents a chosen signal threshold, and the blue lines repr...
<p>You could try to transform the wav signal into a graph of amplitude against time. Then a way to determine a consistent onset is to calculate the intersection of a tangent in the inflection point of the rising flank of a signal with the x axis.</p>
37,589
<p>So far, in my research I have seen that it is unwise to set AllowUnsafeUpdates on GET request operation to avoid cross site scripting. But, if it is required to allow this, what is the proper way to handle the situation to mitigate any exposure? </p> <p>Here is my best first guess on a reliable pattern if you absol...
<p>If you're performing any operations which modify something, then anyone that can convince the user to click on a link can perform that operation. For instance, let's assume that you have a GET request to a page which lets the user add an administrator to a site, and the user clicks a link to a page which does a Resp...
<p>Not so sure it is worth remembering the previous value of allow unsafe updates.</p> <p>I would want to wrap the call around the minimum possible amount of code, so that nested calls to it would not occur. </p> <p>Then you can just turn it to false afterwards.</p>
26,294
<p>I've coded some smaller projects using Silverlight 2.0, which is fairly impressive.</p> <p>Does Silverlight 2.0 have what it takes to be a game development platform for the web? <br/> (Are the framerates high enough, will there be 3D engines developed, and many more questions)</p> <p>Yes or no, with detail if desi...
<p>Silverlight is a very viable platform for 2D Web Games.</p> <p>I built <a href="http://www.physicspoweredgames.com/Games/Diver/Diver.aspx" rel="nofollow noreferrer">Diver</a> with it and the development experience was very pleasant. I'm close to releasing my second game and this time the dev experience was even bet...
<p>i think the main problem with SilverLight today is its very low browser penetration compared to Flash. Even FlashPlayer 10 which has been out for less than 6 months surpasses SilverLight's adoption. There's every reason to believe this <em>could</em> change over time, esp. on Windows platforms, and certainly because...
47,693
<p>I'm getting this problem:</p> <pre><code>PHP Warning: mail() [function.mail]: SMTP server response: 550 5.7.1 Unable to relay for chris.mahan@gmail.com in c:\inetpub\wwwroot\mailtest.php on line 12 </code></pre> <p>from this script:</p> <pre><code>&lt;?php $to = "chris.mahan@gmail.com"; $subject = "test"; $body ...
<p>Try removing the IP restrictions for Relaying in the SMTP server, and opening it up to all relays. If it works when this is set, then you know that the problem has to do with the original restrictions. In this case, it may be a DNS issue, or perhaps you had the wrong IP address listed.</p>
<p>@Espo: I'll do that re KB153119. Thanks.</p> <p>About the mail server: I hear you. </p> <p>I'll update when I uncover more.</p>
5,991
<p>I'm writing a web application that <em>dynamically</em> creates URL's based off of some input, to be consumed by a client at another time. For discussion sake these URL's can contain certain characters, like a <strong>forward slash (i.e. '/')</strong>, which should not be interpreted as part of the actual URL, but j...
<p>You didn't say which language you're using, but PHP has the useful <code>urlencode</code> function and C# has <code>HttpUtility.URLEncode</code> and <code>Server.UrlEncode</code> which should encode parts of your URL nicely.</p> <p>In case you need another way <a href="http://www.december.com/html/spec/esccodes.html...
<p>I believe what you're looking for, if using .net, is the HttpUtility.EncodeUrl() method, as it has many overrides. Look here: <a href="http://msdn.microsoft.com/en-us/library/system.web.httputility.urlencode.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/system.web.httputility.urlencode.aspx...
29,912
<p>Right now, I'm particularly interested in reading the data from MP3 files (ID3 tags?), but the more it can do (eg EXIF from images?) the better without compromising the ID3 tag reading abilities.</p> <p>I'm interested in making a script that goes through my media (right now, my music files) and makes sure the file ...
<p>There is a great post on using PowerShell and TagLibSharp on Joel "Jaykul" Bennet's <a href="http://huddledmasses.org/editing-media-tags-from-powershell/" rel="nofollow noreferrer">site</a>. You could use TagLibSharp to read the metatdata with any .NET based language, but PowerShell is quite appropriate for what yo...
<p>@Thomas Owens PowerShell is now part of the Common Engineering Criteria (as of Microsoft's 2009 Product Line) and starting with Serve 2008 is included as a feature. It stands as much of a chance to be installed as Python or Ruby. You also mentioned that you were willing to go to C#, which could use TagLibSharp. O...
4,828
<p>I'm not looking for bug tracking, per se. But more like a build tool: as a developer, it would be awesome if every time I compiled or tried to run code, I could redirect debugging output and record the bugs I most commonly introduce, how long they take to resolve, etc.</p> <p>Is there anything like this out there?...
<p>i know that <a href="http://www.fogcreek.com/FogBugz/" rel="nofollow noreferrer">FogBugz</a> has something that you can hit a webservice of theirs with specific information to log the bug. You might be able to add some code to only hit this service for debugging.</p> <p>We use them for our bug tracking and its an a...
<p>I think part of the problem here is thinking that the "mistakes" or "bugs" you make while developing are somehow "abnormal". They are not. They are part of "investigating the fix to the problem". :-)</p> <p>Mistakes in coding are not "Bugs" until they get checked into the master sources. If you find and fix them ...
37,124
<p>I want to search for files containing DOS line endings with grep on Linux. Something like this:</p> <pre class="lang-sh prettyprint-override"><code>grep -IUr --color '\r\n' . </code></pre> <p>The above seems to match for literal <code>rn</code> which is not what is desired.</p> <p>The output of this will be piped t...
<p>grep probably isn't the tool you want for this. It will print a line for every matching line in every file. Unless you want to, say, run todos 10 times on a 10 line file, grep isn't the best way to go about it. Using find to run file on every file in the tree then grepping through that for "CRLF" will get you one...
<p>If, like me, your minimalist unix doesn't include niceties like the <strong>file</strong> command, and backslashes in your <strong>grep</strong> expressions just don't cooperate, try this:</p> <pre><code>$ for file in `find . -type f` ; do &gt; dump $file | cut -c9-50 | egrep -m1 -q ' 0d| 0d' &gt; if [ $? -eq 0 ] ;...
9,952
<p>I have a BlackBerry app running in the background that needs to know when a "Missed call" system dialog is brought up by the system, and programmatically close it without user intervention. How can I do that?</p> <p>I could actually <em>almost</em> know when the dialog is brought up, i.e. a little later I programma...
<p>I don't think this is possible without a plugin. I've used activex in the past, maybe it would be possible to write a cross-platform java applet?</p>
<p>You can use google docs that give the facility of editing the documents. This is free and you can use it in your web application also. you just have to reference the dlls.</p> <p>Please see the following link for more details.<br /> <a href="http://code.google.com/apis/documents/docs/2.0/developers_guide_dotnet.htm...
39,811
<p>I am using an authentication attribute on some of my actions in an asp.net mvc page to refer people to a login screen if they have not authenticated. My problem is returning them to the referring page after they have logged in. I was just keeping track of the referring action and referring controller but that beco...
<p>In case you're using FormsAuthentication, when ASP.NET redirects a user to the login page, the URL looks something like this:</p> <pre><code>http://www.mysite.com/Login?ReturnUrl=/Something </code></pre> <p>The login form's action attribute should have the same ReturnUrl parameter (either as hidden input or as par...
<p>You should always ensure that the referring URL is within your domain and a plausible string that they could be coming from. Otherwise this has the potential of being used with flash or other client side technologies to do things like response splitting or other attacks, known and unknown.</p> <p>The HTTP referer ...
21,872
<p>So, I am a total beginner in any kind of <code>Windows</code> related programming. I have been playing around with the <code>Windows</code> <code>API</code> and came across a couple of examples on how to initialize create windows and such. </p> <p>One example creates a regular window (I abbreviated some of the code...
<p>I would say exposing properties on your custom dialog is the idiomatic way to go because that is how standard dialogs (like the Select/OpenFileDialog) do it. Someone could argue it is more explicit and intention revealing to have a ShowBirthdayDialog() method that returns the result you're looking for, but following...
<p>I've always done it exactly the way you're describing. I'm curious to see if there's a more accepted approach.</p>
5,761
<p>I'm a big fan of <a href="http://logging.apache.org/log4net" rel="noreferrer">log4net</a>, but recently, some (in my department) have questioned its inclusion in our projects because of the seemingly heaviness of each logging method. I would argue that there are better techniques than others, but that's another ques...
<p>I am not familiar with log4net, or log.DebugFormat(...).</p> <p>But the cost of logging is really in two areas.</p> <p>The first is the logging call, and the second is the actual persisting of the log information.</p> <p>The guards help reduce the logging call to a minimum when the logging is not actually necessa...
<p>The <a href="http://logging.apache.org/log4net/release/faq.html#perf-not-logging" rel="nofollow noreferrer">log4net FAQ has an answer to this</a>, although not to the level of detail you are looking for.</p> <p>In summary: use those guard clauses.</p>
21,581
<p>I'm using GDI+ in a C++/MFC application and I just can't seem to avoid flickering whenever the window is resized.</p> <p>I have already tried these steps:</p> <ul> <li>returned TRUE on <code>OnEraseBkGnd()</code>;</li> <li>returned NULL on <code>OnCtlColor()</code>;</li> <li>used double buffering according to this...
<p>To completely avoid flicker, you would need to complete <em>all</em> drawing in the interval between screen updates. Windows does not provide any easy means of accomplishing this for normal window painting (Vista provides composite drawing via the <a href="https://en.wikipedia.org/wiki/Desktop_Window_Manager" rel="n...
<p>Are there child windows on the form? The Window manager starts by getting the parent window to erase its background by sending a WM_ERASEBKGND message, THEN it sends a wM_PAINT message - presumably this maps to your wx::OnDraw method. Then it iterates over each child control and gets those to paint themselves. </p> ...
24,097
<p>I have the following tuple, which contains tuples:</p> <pre><code>MY_TUPLE = ( ('A','Apple'), ('C','Carrot'), ('B','Banana'), ) </code></pre> <p>I'd like to sort this tuple based upon the <strong>second</strong> value contained in inner-tuples (i.e., sort Apple, Carrot, Banana rather than A, B, C).</p>...
<pre><code>from operator import itemgetter MY_SORTED_TUPLE = tuple(sorted(MY_TUPLE, key=itemgetter(1))) </code></pre> <p>or without <code>itemgetter</code>:</p> <pre><code>MY_SORTED_TUPLE = tuple(sorted(MY_TUPLE, key=lambda item: item[1])) </code></pre>
<p>I achieved the same thing using this code, but your suggestion is great. Thanks!</p> <pre><code>templist = [ (line[1], line) for line in MY_TUPLE ] templist.sort() SORTED_MY_TUPLE = [ line[1] for line in templist ] </code></pre>
27,485
<p>Recently, I started changing some of our applications to support <code>MS SQL Server</code> as an alternative back end. </p> <p>One of the compatibility issues I ran into is the use of MySQL's CREATE TEMPORARY TABLE to create in-memory tables that hold data for very fast access during a session with no need for per...
<p>@Keith</p> <p>This is a common misconception: Table variables are NOT necessarily stored in memory. In fact SQL Server decides whether to keep the variable in memory or to spill it to TempDB. There is no reliable way (at least in SQL Server 2005) to ensure that table data is kept in memory. For more detailed info l...
<p>CREATE TABLE #tmptablename</p> <p>Use the hash/pound sign prefix</p>
4,749
<p>I was currently developing a desktop application in C# using mono and testing in SuSE and Windows. The concept doesn't matter much, but it is a "web lint" program that will scan a web site and return possible issues with security and/or cross browser compatibility. However, I want to be able to offer binaries for m...
<p>C# and Mono is probably cross-platform enough for most desktop environments. The trick will be the "mobile platform" requirement. </p> <p>Mobile operating systems are wildly diverse and there's not a lot you can do to generalize. Some have Java, like the Blackberry. C# may get you onto Windows Mobile-based plat...
<p>It really depends what you want to do. For web development, if HTML/JavaScript is enough then stick with it. If you need more advanced stuff I would use ASP.NET with Mono (what you probably did) since you already know that. (You can use Visual Studio here.)</p> <p>Another option might be (since you are a C# develop...
18,028
<p>I am working on a Perl script to read CSV file and do some calculations. CSV file has only two columns, something like below.</p> <pre><code>One Two 1.00 44.000 3.00 55.000 </code></pre> <p>Now this CSV file is very big ,can be from 10 MB to 2GB.</p> <p>Currently I am taking CSV file of size 700 MB. I tried to o...
<p>In *nix, you can use the tail command.</p> <pre><code>tail -1000 yourfile | perl ... </code></pre> <p>That will write only the last 1000 lines to the perl program.</p> <p>On Windows, there are <a href="http://sourceforge.net/project/showfiles.php?group_id=163416" rel="noreferrer">gnuwin32</a> and <a href="http://...
<p>Without relying on tail, which I probably would do, if you have more than $FILESIZE [2GB?] of memory then I'd just be lazy and do:</p> <pre><code>my @lines = &lt;&gt;; my @lastKlines = @lines[-1000,-1]; </code></pre> <p>Though the other answers involving <code></code>tail<code></code> or <code>seek()</code> are pr...
38,930
<p>Do you know any Javascript libraries which can present graph visually in a web page?</p> <p>Clarification: by graphs I mean something like workflow trees or decision trees. Sorry for not being clear.</p>
<p>I've been doing some research, looking for a JS component that would handle the live creation of flow charts / decision trees, mxGraph looks pretty handy: <a href="http://www.jgraph.com/mxgraph.html" rel="noreferrer">http://www.jgraph.com/mxgraph.html</a></p> <p>Disclaimer: I have no relationship at all with the ve...
<p>We used <a href="http://developer.yahoo.com/yui/" rel="nofollow noreferrer">YUI</a> in our last project. It's free and has a lot of neat features, check it out!</p> <p><strong>EDIT:</strong> Charts is the component that allows statistical type graphs, scatter plots and other charting stuff. I didn't realize you w...
47,469
<p>I'm interested in printing small machine parts (gears, linkages, structural components) so I'm looking for accuracy and mechanical strength over speed and volume.</p> <p>I'm also somewhat concerned about harmful emissions so would like a solution with some sort of filtration, whether it's built into the machine or ...
<p>Your environmental conditions will preclude finding a machine suitable for your purposes in the budget specified.</p> <p>Humidity is a problem with many material types, especially nylon, but also with PLA and ABS, the more common filaments used in 3D printing.</p> <p>You can likely reject PLA for your mechanical n...
<p>There is more than one question here. Which touches three topics: the choice of appropriate 3D printing technique, the choice of materials, and control of any hazardous, noxious, or annoying out-gassing. </p> <p>It is important to understand the limits of the 3D printing process you will choose. Each process has...
674
<p>I have an AI file. I paste it into Expression Blend and then export the XAML for use in my WPF project. Works for most of my files, but some export the XAML plus a seperate png file. What can I do so that the png is embedded into the paths of my image and not a seperate image? Can it be done?</p>
<p>Checkout this page that describes converting raster graphics to vector and then XAML -</p> <p><a href="http://weblogs.asp.net/rrobbins/archive/2007/11/11/how-to-convert-raster-graphics-to-xaml.aspx" rel="nofollow noreferrer">http://weblogs.asp.net/rrobbins/archive/2007/11/11/how-to-convert-raster-graphics-to-xaml.a...
<p>To convert raster images to vectorial images, I found <a href="http://www.inkscape.org/" rel="nofollow noreferrer">Inkscape</a> (free) to do an excellent job (comparable to VectorMagic, which is not free anymore by the way). </p> <p>In Inkscape, import your image and use the Path/Trace Bitmap function. It has a l...
21,624
<p>Usually the hardness of the material is considered primary for nozzles used with abrasive filaments. Has friction between between nozzle material and abrasive filaments been considered? It seems that friction as well as hardness would play a roll in how long the nozzle lasts. Perhaps, this is considered with ruby ...
<p>I think I found the problem. I think there was some crosstalk between the BLTouch wires and the other wires it was tied together leading to the hotend. When I moved the BLTouch wires away from the others the problem went away.</p> <p>I will be added a sheild to the cable in the future like in this <a href="https://w...
<p>The OP already found the problem and <a href="/a/16632/">answered</a> the question hinting to shielding of the cable. If this is the actual problem, of fiddling with the cables might have caused this, an alternative solution is presented as I've experienced similar behavior.</p> <p>If one side of the bed is higher t...
1,970
<p>The <a href="http://en.wikipedia.org/wiki/Law_of_Demeter" rel="noreferrer">Law of Demeter</a> indicates that you should only speak to objects that you know about directly. That is, do not perform method chaining to talk to other objects. When you do so, you are establishing improper linkages with the intermediary ...
<p>Grady Booch in "Object Oriented Analysis and Design":</p> <p>"The idea of cohesion also comes from structured design. Simply stated, cohesion measures the degree of connectivity among the elements of a single module (and for object-oriented design, a single class or object). The least desirable form of cohesion...
<p>In the situations where there seems to be a tradeoff between coupling and cohesion, I'd probably ask myself "if somebody else had already written this logic, and I were looking for a bug in it, where would I look first?", and write the code that way.</p>
19,719
<pre><code>import sys words = { 1 : 'one', 2 : 'two', 3 : 'three', 4 : 'four', 5 : 'five', 6 : 'six', 7 : 'seven', 8 : 'eight', 9 : 'nine', 10 : 'ten', 11 : 'eleven', 12 : 'twelve', 13 : 'thirteen', 14 : 'fourteen', 15 : 'fifteen', 16 : 'sixteen', 17 ...
<p>You can't group digits into "segments" going from left-to-right. The <code>range(0,len(),3)</code> is not going to work out well. You'll have to write the same algorithm for inserting digit separators. You start from the right, picking off segments of digits.</p> <p>What's left over (on the left, get it?) will ...
<p>Check out source for <a href="http://search.cpan.org/src/LHOWARD/Number-Spell-0.04/Spell.pm" rel="nofollow noreferrer">Number::Spell</a> Perl module. It is short and can be easily ported to Python (if it has not already been done).</p>
36,910
<p>I found some wild remarks that ASP.NET MVC is 30x faster than ASP.NET WebForms. What real performance difference is there, has this been measured and what are the performance benefits.</p> <p>This is to help me consider moving from ASP.NET WebForms to ASP.NET MVC.</p>
<p>We haven't performed the type of scalability and perf tests necessary to come up with any conclusions. I think ScottGu may have been discussing potential perf targets. As we move towards Beta and RTM, we will internally be doing more perf testing. However, I'm not sure what our policy is on publishing results of per...
<p><img src="https://i.stack.imgur.com/I7eXy.png" alt="enter image description here"></p> <p>I did a small VSTS load test experiment with some basic code and found ASP.NET MVC response time to be twice faster as compared to ASP.NET Webforms. Above is the attached graph with the plot. </p> <p>You can read this load t...
6,531
<p>We have a Silverlight application that needs to load a number of .png files. We can load the images OK, but Silverlight doesn't support reading the pixel data from the Image class.</p> <p>Can anyone suggest a simple solution for getting at this data? Our current best bet would be a third party .png loading librar...
<p>PNG decoding is hard to find.</p> <p>I wrote an article for MSDN that includes some open source code I cobbled together from Joe Stegman, FluxCapacity, and a few others. It includes PNG decoding (as well as GIF, JPG, and BMP) for those in this thread that are looking for that.</p> <p><a href="http://www.microsoft....
<p>Thanks - I've seen the Joe Stegman blog. It's very handy, but the decoder he doesn't have is a PNG one. We're using PNGs as we need transparency. The fluxtools link seems to be broken too.</p> <p>I'm still looking (unsuccessfully) for a PNG decoder I can drop into Silverlight.</p>
38,048
<p>I wan't to know the real size of a web page (HTML + CSS + Javascript + Images + etc.) but from the browser side, maybe with a software, Firefox Add-On or similar?</p>
<p>Use firefox, and get FireBug.</p> <p>Then get the YSlow addon for firefox.</p> <p>For IE, you can get the DebugBar which comes pretty close to giving the same information. </p>
<p>I think the Firefox Plugin <a href="https://addons.mozilla.org/de/firefox/addon/1433" rel="nofollow noreferrer">Extended Statusbar</a> can do that for you.</p> <p>It will give detailed information about what has been downloaded, including the size of the downloaded data.</p>
19,646
<p><p>In a database I am designing I have implemented profile based object level security. <p>Each user can view, edit, insert, update database tables according to the profiles (roles) he is a member of. <p>Now there is a need to implement "External Users" who can view only the relevant records and edit some of them (b...
<p>You should probably create a VIEW which limits the records and then apply the proper rights on the view. </p>
<p><p>I have my first draft. It goes like that: <p>The app is a Project Management/Issue Tracking/Event Management/Collaboration Web app. <p>I created a Role "External User". By default a user in that role </p> <ul> <li>can SELECT FROM Persons <li>can SELECT FROM Units (organizational units-companies-depts etc) <li>c...
27,233
<p>I'm making a web application and I got the design for it from a sub-contracted design company. The design is pretty nice, I like it, but I've stumbled across one thing I'm not sure how to implement nicely.</p> <p>The thing is - they've redesigned the looks of buttons to match the page style. So now I have two image...
<p>As far as I was aware the CSS Pseudo-classes are for links ONLY in IE. This may have changed in IE8 but I'm not aware of it. So basically I don;t think there is an elegant way of implementing it via CSS.</p> <p>That's not a useful answer so I'll also add that I would implement it using images and client-side script...
<p><a href="http://www.quirksmode.org/css/contents.html#t16" rel="nofollow">http://www.quirksmode.org/css/contents.html#t16</a></p> <p>"IE 7 supports :hover, but not :active, on all elements."</p>
44,150
<p>When setting up foreign keys in SQL Server, under what circumstances should you have it cascade on delete or update, and what is the reasoning behind it?</p> <p>This probably applies to other databases as well.</p> <p>I'm looking most of all for concrete examples of each scenario, preferably from someone who has u...
<p>Summary of what I've seen so far:</p> <ul> <li>Some people don't like cascading at all. </li> </ul> <h2>Cascade Delete</h2> <ul> <li>Cascade Delete may make sense when the semantics of the relationship can involve an exclusive <em>"is part of</em>" description. For example, an OrderLine record is part of its pa...
<p>If you're working on a system with many different modules in different versions, it can be very helpful, if the cascade deleted items are part of / owned by the PK holder. Else, all modules would require immediate patches to clean up their dependent items before deleting the PK owner, or the foreign key relation wou...
8,385
<p>I am a bit of a newbie to Reg Ex and don't fully understand the difference between the different flavors. However, I have a basic Reg Ex that works when I try it via the UNIX system (vi and grep) but not when I try to to use it in PHP's ereg functions. I suspect there is something different about the PHP ereg functi...
<p>You may need to escape the backslash:</p> <pre><code>$string = ereg_replace("&lt;em\\b[^&gt;]*&gt;(.*?)&lt;/em&gt;","\\1",$string); </code></pre> <p>This is because <code>\b</code> in a PHP string means something different from a <code>\b</code> in a regular expression. Using <code>\\</code> in the PHP string pass...
<p>If removing <code>&lt;em&gt;</code> tags is your intention, I would recommend the following:</p> <pre><code>&lt;?php $string = 'Feugiat &lt;em&gt;hendrerit&lt;/em&gt; sit iriuredolor aliquam.'; $string = ereg_replace("&lt;/?em\\b[^&gt;]*&gt;", "", $string); echo $string; ?&gt; </code></pre> <p><a href="https...
49,151
<p>Is there a way to produce a diagram showing existing tables and their relationships given a connection to a database?</p> <p>This is for SQL Server 2008 Express Edition.</p>
<p>Yes you can use SQL Server 2008 itself but you need to install SQL Server Management Studio Express (if not installed ) . Just right Click on Database Diagrams and create new diagram. Select the exisiting tables and if you have specified the references in your tables properly. You will be able to see the complete di...
<p>MySQL WorkBench is free software and is developed by Oracle, you can import an SQL File or specify a database and it will generate an SQL Diagram which you can move around to make it more visually appealing. It runs on GNU/Linux and Windows and it's free and has a professional look..</p>
20,370
<p>I can't seem to be able to disable ViewState for controls that I add to a page dynamically.</p> <p><strong>ASPX</strong></p> <pre><code>&lt;%@ Page Language="C#" AutoEventWireup="true" CodeFile="Page1.aspx.cs" Inherits="Page1" EnableViewState="false" %&gt; ... &lt;asp:PlaceHolder ID="DropDownPlaceHolder" runat="se...
<p>It's a "feature" -- <a href="http://support.microsoft.com/?id=316813" rel="nofollow noreferrer">http://support.microsoft.com/?id=316813</a></p> <p>Thanks, Microsoft!!</p>
<p>I tested this a bit and found it a little odd. It seems the post(back) will send the selected value, even if a control has it's viewstate turned off.</p> <p>I did find a good solution around it though, is that if you handle everything after the init and load, you will reload your control after the viewstate has bee...
29,032
<p>I have a JSP that allows users to dynamically create additional form fields to create multiple objects. Perhaps I want to allow users to be able to submit as many line items as they want when submitting an invoice form.</p> <p>How do I create a Struts 2 Action that will be able to take in an <code>ArrayList</code> ...
<p>I've seen this question pop up in a number of different forums over time. The original Blackberries were programmable in C++ but I think that RIM ran up against the problems of trying to implement a secure platform in the C/C++ compile to native paradigm. </p> <p>The devices do have JTAG ports, but unless one could...
<p>Unfortunately the official <a href="http://na.blackberry.com/eng/developers/" rel="nofollow noreferrer">SDK website</a> only seems to mention Java. According to <a href="http://en.wikipedia.org/wiki/BlackBerry#CPU" rel="nofollow noreferrer">wikipedia</a>, different versions of the BlackBerry use different processor...
16,271
<p>The following doesn't work, because it doesn't wait until the process is finished:</p> <pre><code>import subprocess p = subprocess.Popen('start /WAIT /B MOZILL~1.LNK', shell=True) p.wait() </code></pre> <p>Any idea how to run a shortcut and wait that the subprocess returns ?</p> <p><strong>Edit:</strong> original...
<p>You will need to invoke a shell to get the subprocess option to work:</p> <pre><code>p = subprocess.Popen('start /B MOZILL~1.LNK', shell=True) p.wait() </code></pre> <p>This however will still exit immediately (see @R. Bemrose).</p> <p>If <code>p.pid</code> contains the correct pid (I'm not sure on windows), then...
<p>Note: I am simply adding on Jim's reply, with a small trick. What about using 'WAIT' option for start?</p> <pre><code>p = subprocess.Popen('start /B MOZILL~1.LNK /WAIT', shell=True) p.wait() </code></pre> <p>This should work.</p>
45,492
<p><em>[NOTE: This questions is similar to but <strong>not the same</strong> as <a href="https://stackoverflow.com/questions/128634/how-to-use-system-environment-variables-in-vs-2008-post-build-events">this one</a>.]</em></p> <p>Visual Studio defines several dozen "Macros" which are sort of simulated environment varia...
<p>You might want to look into PropertySheets. These are files containing Visual C++ settings, including user macros. The sheets can inherit from other sheets and are attached to VC++ projects using the PropertyManager View in Visual Studio. When you create one of these sheets, there is an interface for creating user m...
<p>This is a bit hacky, but it could work.</p> <p>Why not call multiple .py scripts in a row?</p> <p>Each scripts can pass in a small subset of the parameters, and the values to a temp text file. The final script will read and work off of the temp text file.</p> <p>I agree that this method is filled with danger and ...
15,859
<p>Is it possible to expose an API in a .NET application by embedding a scripting language like IronPython?</p> <p>How is it done?</p>
<p>IronPython has a hosting API which can be used to execute IronPython scripts from a C#\VB application.</p> <p><a href="http://www.voidspace.org.uk/ironpython/dlr_hosting.shtml" rel="nofollow noreferrer">This</a> is a good example of embedding IronPython inside a winforms app.Note that the hosting APIs have changed ...
<p>I haven't used it personally, but you should look at <a href="http://msdn.microsoft.com/en-us/vsx2008/products/bb933739.aspx" rel="nofollow noreferrer">Visual Studio Tools for Applications</a></p> <p>I'm not sure if Iron Python is supported as a language for it or not, but that would be the easiest path to enable y...
25,564
<p>Lucky me, I have to work with Oracle. And packages. </p> <p>I have a package that a lot of different developers are touching and it's scaring me. Is it possible to put a package inside of Version Control? Is there some kind of software out there that already does this? If not, is there some kind of export procedure...
<p>How are they inputting it? The way we used to work at my last job is editing a text file, and loading it with SQL*Plus. You can just put that source file under version control. </p> <p>The source must be between "<code>CREATE OR REPLACE PACKAGE MYPACKAGE AS</code>" and "<code>END;</code>" followed by a single slash...
<p>Take also a look at <a href="http://deltasql.sourceforge.net" rel="nofollow">this link</a>. It's a PHP/mySQL versioning tool which works with any database type and is fairly simple to learn.</p>
36,563
<p>My company has login integration with GroupWise, and Exchange 5.5/2000+. The Exchange 5.5/GroupWise logic is done using wldap32.dll (win32), and so the login code is in a managed c++ class. When the configuration tool (or the backend service) tries to load the dll built off this managed c++ project on my XP develo...
<p>Have you changed your development environment recently? In particular have you installed a service pack or new release of Visual Studio?</p> <p>It appears you are linking against a C++ runtime that is not available on the client's server. You can use the Windows Event Viewer to identify the DLL failing to load, or ...
<p>Not to answer my own question, but support just updated the bug with the text following this paragraph. I'm still interested in thoughts on tracking down situations like this.</p> <p>Resolved by downloading and installing the Visual C++ 2008 Redistributable Package for Windows on the IMS: <a href="http://www.micro...
22,425
<p>I designed a data model which is represented by an XSD scheme. The data model also provides the types that are being used as web service parameters in a WSDL descriptor.</p> <p>I would like to send the XSD scheme around and ask the people involved to peer review the data model.</p> <p>What tool or presentation met...
<p>I know the following tools that generate documentation from XML Schema files (XSD):</p> <ul> <li><a href="http://xml.fiforms.org/xs3p" rel="noreferrer">xs3p </a> <ul> <li>XSLT stylesheet that generates single XHTML from XSD</li> </ul></li> <li><a href="http://xframe.sourceforge.net/xsddoc/index.html" rel="norefer...
<p>I recommend <em>using</em> the XSD for something. Specifically, show some actual applications, with examples as real code.</p> <p>Actual applications are what make a schema interesting. The examples don't have to be big, sophisticated or completely realistic. They just have to compile. Other people will want to...
24,691