instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>I'm trying to make some of my code a bit more friendly to non-pure-ascii systems and was wondering if there was a particular character encoding used for NEEDED entries in ELF binaries, or is it rather unstandard and based on the creating system's filesystem encoding (or even just directly the bytes that were passed ...
<p>ELF format specifies NEEDED fields as "null-terminated string" and does not say more about the encoding, which pretty much implies 8-bit ASCII string.</p> <p>I personally don't see any point in complicating executable file format specification that does not provide any additional value for the final product or deve...
<p>As far as I know, the standard Unix way of dealing with non-ASCII characters is to encode them as UTF-8.</p>
18,907
<p>I'm just about to make my first trip into the world of JNI (Java Native Interface) to provide file system change notifications from platform specific C/C++ code to Java. That is unless someone suggest some brilliant library for doing this that I've missed.</p> <p>Being new to JNI I've managed to find much documenta...
<p>I strongly dislike make because of its implicit ruleset and treatment of whitespace. Personally I would use cpp tasks (<a href="http://ant-contrib.sourceforge.net/cpptasks/index.html" rel="nofollow noreferrer">http://ant-contrib.sourceforge.net/cpptasks/index.html</a>) to do my C compilation. They are not as flex...
<p>You could also try the terp C++ tasks at <a href="http://codemesh.com/products/terp" rel="nofollow noreferrer">Codemesh</a>. They are not free but they offer a high level of abstraction coupled with the ability to discover/specify the C++ compiler and the ability to iterate over more than one compiler/processor arch...
3,611
<p>I want to implement an application (scholar exercise) over the AdventureWorks database. I have downloaded the diagram. Is there a less formal description of the database?</p> <p>Thanks, Lucian</p>
<p>See <a href="http://www.rubygems.org/read/chapter/11" rel="nofollow noreferrer">http://www.rubygems.org/read/chapter/11</a> and specify a <code>~/.gemrc</code> which defines a gemhome variable.</p> <p>For example:</p> <pre><code>gemhome: /usr/local/rubygems </code></pre> <p>You can also place this file in <code>/...
<p>To install the executable to a desired directory, the command line option <code>--bindir</code> may be used:</p> <pre><code>sudo gem install thegemname --bindir /usr/local/rubygems/bin </code></pre> <p>Tried this option successfully with gem version 2.0.14.1. <BR><BR> For more command line options, run <code>gem i...
43,231
<p>I've a fairly huge .gdbinit (hence not copied here) in my home directory.</p> <p>Now if I want to debug code inside Xcode I get this error: </p> <pre><code>Failed to load debugging library at: /Developer/Applications/Xcode.app/Contents/PlugIns/GDBMIDebugging.xcplugin/Contents/Resources/PBGDBIntrospectionSupport.A...
<h2>My "short" answer:</h2> <hr> <p>You may have noticed this already, but just in case:</p> <p>First of all, even when you see that error, (assuming that you click past it and continue), then you should <strong>still be able to use 99% of the debugging features</strong> in Xcode. In other words, that error means t...
<p>Strange... Looking around my Mac, I see that library just fine, and it looks sane.</p> <p>Have you tried using dtrace to see what Xcode and GDB are trying to do when the error happens?</p>
17,569
<p>I downloaded Squeak, the Image file, and the Sources file, but I can't figure out how to write Smalltalk code. Is there something obvious I'm missing? Is Squeak even the right IDE for serious Smalltalk development?</p>
<p>Squeak is a great environment for learning Smalltalk, but don't confuse that particular implementation with 'Smalltalk'. Some of the other implementations are very professional, but not surprisingly come at a financial cost.</p>
<p>Squeak is nice to learn the language and to see how creative a system like it can make people, which has two aspects: you see many interesting ideas and new concepts tried, but also a lot of junk and bad looking (some even abandoned) experiments. </p> <p>I admit that, for a beginner, it may be hard to see the big p...
23,668
<p>I don't think this is possible, but if is then I need it :)</p> <p>I have a auto-generated proxy file from the wsdl.exe command line tool by Visual Studio 2008.</p> <p>The proxy output is partial classes. I want to override the default constructor that is generated. I would rather not modify the code since it is a...
<p>This is not possible. Partial classes are essentially parts of the same class; no method can be defined twice or overridden, and that includes the constructor.</p> <p>You could call a method in the constructor, and only implement it in the other part file.</p>
<p>Nothing that I can think of. The "best" way I can come up with is to add a ctor with a dummy parameter and use that:</p> <pre><code>public partial class MyWebService : System.Web.Services.Protocols.SoapHttpClientProtocol { public override MyWebService(int dummy) { string myString = "overridden co...
30,783
<p>Is there any way to get the time down to the Millisecond in MySQL?</p>
<p>MySQL doesn't support milliseconds in any of the time / date columns, or return it in <code>NOW()</code> so unfortunately, no.</p> <p>If you have a string in a date / time + microseconds format you can use <code>SELECT MICROSECOND('1997-12-31 23:59:59.000010');</code> to extract the microseconds.</p>
<p>Just wanted to share it since I recently needed milliseconds for a MySQL project as well.</p> <p>You can write a UDF - <a href="http://dev.mysql.com/doc/refman/5.5/en/adding-udf.html" rel="nofollow noreferrer">User Defined Function</a> - to get you the system time down to a fairly small fraction of a second:</p> <...
40,162
<p>I'm not the best at PHP and would be extremely grateful if somebody could help. Basically I need to parse each line of a datafeed and just get each bit of information between each "|" - then I can add it to a database. I think I can handle getting the information from between the "|"'s by using explode but I need a ...
<p>You can read a file into an array of lines and do all the splitting with:</p> <pre><code>$lines = file("filename"); foreach($lines as $line) { $parts = explode("|", $line); // do the database inserts here } </code></pre> <p>If you already have all the text in a variable as you said (e.g., with something li...
<p>If the file is small, you can use <a href="http://www.php.net/file" rel="nofollow noreferrer">file() t</a>o read it into an array, one line per element.</p> <p>Failing that, read the file in loop using <a href="http://www.php.net/fgets" rel="nofollow noreferrer">fgets()</a></p> <pre><code>$handle = fopen("/tmp/inp...
27,088
<p>I am looking for <strong>specific guidelines</strong> for when to use Web Services frameworks versus a well-documented custom protocol that communicates using XML over HTTP.</p> <p>I am less concerned about performance than I am about maintainability and ease-of-development both for client-side and server-side code...
<p>The benefit of WS is typically derived from tooling support to generate the clients, server stubs and descriptors, and pipeline benefits such as security, encryption, and other extensibility. Without the tooling the burden to roll and process WS requests is high, and the value to your outcome is relatively low.</p>...
<p>RESTful web services are very low-ceremony. If something like the <a href="http://en.wikipedia.org/wiki/AtomPub" rel="nofollow noreferrer">Atom Publishing Protocol</a> works for you, that's the route I would take.</p>
15,663
<p>After a long time tweaking my new 3D printer I solved all the unexpected errors and I can print succesful pieces but I am facing a "problem", they are over sized, I found this problem trying to print a Raspberry Pi Case and an smartphone case, the printed pieces are bigger than the objects. </p> <p>Here some relate...
<p>You have to know:</p> <ul> <li>distance between belt teeth (usually 2mm)</li> <li>number of teeth on pulley</li> <li>motor step angle 1.8 deg?</li> <li>microstepping count, probably 16?</li> </ul> <p>Then you can enter all these numbers info the calculator here: <a href="https://www.prusaprinters.org/calculator/" ...
<p>I finally solved it by manually adjusting the <code>steps per unit</code> in the printer firmware. </p> <p>The process is easy just move the extruder to one position and draw two marks, one at the extruder position and another one 10 cm in the X axis from the extruder position then with Repetier or with the the pri...
784
<p>Are there any advantages compiling for .NET Framework 3.5 instead of 2.0?</p> <p>For example less memory consumption, faster startup, better performance...</p> <p>Personally I don't think so however, I may have missed something.</p> <h2>Edits</h2> <ol> <li><p>Of course there are more features in the 3.5 framework, b...
<p>There's a difference between compiling and targeting.</p> <p>Compiling the code with the (for example) C# 3.0 compiler will probably give you a boost on performance (very little one anyway) as some optimization for the generated IL code migh have been included. It also allows you to use some of the new features lik...
<p>3.5 has classes that 2.0 doesn't. Func&lt;...> for instance. If you aim for 2.0, you can't use them. </p>
9,229
<p>can I pass a cursor in a procedure?</p> <pre><code>CURSOR BLT_CURSOR IS SELECT BLT.sol_id, BLT.bill_id, BLT.bank_id FROM BLT; </code></pre> <p>Is my cursor.</p> <pre><code>Procedure abc(i want to pass the cursor here) </code></pre> <p>How do I do it.</p>
<p>I am assuming you are using Oracle (it would appear so).</p> <p>You can do this:</p> <pre><code>PROCEDURE abc( p_cursor IN SYS_REFCURSOR) IS v_sol_id blt.sol_id%TYPE; v_bill_id blt.bill_id%TYPE; v_bank_id blt.bank_id%TYPE; BEGIN LOOP FETCH p_cursor INTO v_sol_id, v_bill_id, v_bank_id; EXIT ...
<p>It's not possible in MSSQL2005. I don't know about 2008 or other platforms. </p> <p>There's been several times I'd like to do it. It would support a more modular architecture. I could have a proc that performs a common process on a dataset but be able to pass a cursor to that dataset from a variety of other pro...
48,085
<p>Have you found such a tool and used it successfully?</p>
<p>I was also looking for a profiler for AS, but I wanted an freeware/open source solution that works with FlashDevelop and Flex SDK. I found none. So I wrote a simple python script and an even simpler AS class. The script essentially takes any AS file and adds profiling code (i.e. calls to measure the total runtime of...
<p>There is a FlashPreloaderProfiler: <a href="http://jpauclair.net/flashpreloadprofiler" rel="nofollow">http://jpauclair.net/flashpreloadprofiler</a></p> <p>It's written in actionscript, doesn't need a java-application running in the background and have some more features like Memory Profiler.</p> <p>But I prefer PB...
46,663
<p>For an enterprise type WCF service, where potentially 10K's of thousands of clients will be authenticating and sending data to central servers, what is 'best' practice when it comes to sessions or authentication?</p> <ol> <li>does WCF support a session, if yes, should I use it? or should I simply pass username/pass...
<p>As <a href="https://stackoverflow.com/users/2525/blowdart">blowdart</a> mentioned, WCF Sessions are not the same as ASP.NET Sessions. You can read up on them here: <a href="http://msdn.microsoft.com/en-us/library/ms733040.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms733040.aspx</a>. Befo...
<p>If you host the service within IIS, you can still use the session that is from ASP.NET by enabling aspnetcompatibility for the service behaviour.</p>
29,755
<p>This is a minor style question, but every bit of readability you add to your code counts.</p> <p>So if you've got:</p> <pre><code>if (condition) then { // do stuff } else { // do other stuff } </code></pre> <p>How do you decide if it's better like that, or like this:</p> <pre><code> if (!condition) then ...
<p>I prefer to put the most common path first, and I am a strong believer in nesting reduction so I will break, continue, or return instead of elsing whenever possible. I generally prefer to test against positive conditions, or invert [and name] negative conditions as a positive.</p> <pre><code>if (condition) ret...
<p>As a general rule, if one is significantly larger than the other, I make the larger one the <code>if</code> block.</p>
20,119
<p>I have a C# Windows application which runs a service. I would like to leverage PowerShell in order to offer a command line management interface for administering my running service.</p> <p>From my point of view, I am trying to offer the same administrative interface a la Exchange 2007.</p> <p>Do you have any sugge...
<p>A solution would be for your Windows Service to expose an administrative interface through WCF. Your PowerShell commands would use this WCF service to pull out information and make the Windows Service perform actions.</p>
<p>Another way of exposing the internal state of the Windows Service came to mind. You could expose information through WMI which can be consumed from PowerShell or your PowerShell commands. </p> <p>I'm not sure if you are able to tell your service to perform actions through WMI but you would at least be able to pull ...
29,336
<p>I have written a very simple C# Console Application which will open a Crystal Report, refresh it and save it as a PDF to a specified location.</p> <p>When running within VS2005 everything runs fine; the pdf file is generated as expected. When I copy the .exe to my root C: drive and run it from the command line I ge...
<p>Does it work if you run the app from an elevated command prompt (WinKey followed by pressing cmd followed by Ctrl+Shift+Return)?</p> <p>It might be that one of processes you are calling requires elevation.</p>
<p>Well after a lot of link-chasing it looks like this behaviour is 'By Design'!</p> <p>StackOverflows own Jeff Atwood experienced the problem (<a href="https://blog.codinghorror.com/console-apps-and-appdomain-currentdomain-unhandledexception/" rel="nofollow noreferrer">see here</a>) and raised the issue on Microsoft ...
42,162
<p>I have a app that I'm deploying to a development server using Capistrano. I'd like to force this deployment to use the development database. So far the only way I've managed to do it is to make my production database info in <code>database.yml</code> equal to the development info. But this is a complete hack.</p>...
<p>I ended up using the solution over <a href="http://www.ahabman.com/blog/2008/05/mod_rails-set-rails_env-variable-to-qa-staging-or-production/" rel="nofollow noreferrer">here</a>. Basically a recipe to replace a line in environment.rb after deploy but before restart.</p> <p>The problems seems to be with DreamHost's...
<p>I'd use <a href="http://rubyforge.org/projects/capistrano/" rel="nofollow noreferrer">Capistrano Ext</a> in order to define multiple deployment environments. I have used this in the past to deply staging and production installations of my apps, so I think it'd work well for you.</p> <p><a href="http://weblog.jamisb...
31,846
<p>I'm querying a bunch of information from cisco switches using SNMP. For instance, I'm pulling information on neighbors detected using CDP by doing an snmpwalk on .1.3.6.1.4.1.9.9.23</p> <p>Can I use this OID across different cisco models? What pitfalls should I be aware of? To me, I'm a little uneasy about using...
<p>Once a MIB has been published it won't move to a new OID. Doing so would break network management tools and cause support calls, which nobody wants. To continue your example, the CDP MIB has been published at Cisco's <A HREF="http://tools.cisco.com/Support/SNMP/do/BrowseMIB.do?local=en&amp;step=2&amp;mibName=CISCO-C...
<ul> <li>I would avoid putting in numeric OIDs and instead use 'OID names' and leave that hard work (of translating) to whatever SNMP API you are using. </li> </ul> <p>If that is not possible, then it is okay to use OIDs as they should not change per the SNMP MIB guidelines. Unless the device itself changes but that r...
9,148
<p>I'm curious How do you people think ? (I mean a way of thinking) about design architecture of your Libraries, Systems, Frameworks, etc. before start coding it.</p> <p>I recently find my self feeling pain in what I've done, and practically every time I want to start everything from scratch..</p> <p>I do design befo...
<p>I usually do enough analysis of the problem domain on paper/white board to get a good enough understanding of the problem domain to start writing code. I rarely draw implementation or class diagrams on paper. A key technique I've found to achieve better design is to not get too attached to the code you write. If I d...
<p>Open question. There will be nearly as much answers as posters. 1) have a look at many software engeneering books. Some argue with good design the rest is a snap. That's a straigh lie 2) See how intrusive diverse Frameworks are, You better have to use them the intended way otherwise you better implement the stuff a...
48,903
<p>Other than standard OO concepts, what are some other strategies that allow for producing good, clean PHP code when a framework is not being used?</p>
<p>Remember: MVC, OOP and tiers are design concepts, not language constructs, nor file-structuring.</p> <p>For me, this means that when not using a framework, and when there's not different teams for programming and designing; there's no value in using <em>another</em> template system on top of PHP (which is a templat...
<p>Even If you don't use a framework, use a template engine. By using templates, you'll seperate the logic and presentation of your application. Then design, code and format the logic part like what you would do with any other language. Make the "designers" design the user interface :)</p>
23,647
<p>In regards to custom events in .NET, what is the preferred design pattern for passing event arguments? Should you have a separate <a href="http://msdn.microsoft.com/en-us/library/system.eventargs.aspx" rel="nofollow noreferrer">EventArgs</a> derived class for each event that can be raised, or it is acceptable to hav...
<p>You don't need to have a separate EventArgs derived class for each event. It's perfectly acceptable and even desirable to use existing EventArgs-derived classes rather than reinventing the wheel.</p> <p>These could be existing framework classes (e.g. System.Component.CancelEventArgs if all you want to do is give t...
<p>It depends on what the events are, but for the most part, for the sake of whoever is going to consuming your events, create a single custom class deriving from EventArgs.</p>
12,756
<p>Anyone have a good rule of thumb for choosing between different implementations of Java Collection interfaces like List, Map, or Set?</p> <p>For example, generally why or in what cases would I prefer to use a Vector or an ArrayList, a Hashtable or a HashMap?</p>
<p>I really like this cheat sheet from Sergiy Kovalchuk's blog entry, but unfortunately it is offline. However, the Wayback Machine has a <a href="https://web.archive.org/web/20200802192003/http://www.sergiy.ca/guide-to-selecting-appropriate-map-collection-in-java/" rel="noreferrer">historical copy</a>:</p> <p><img src...
<p>I found Bruce Eckel's Thinking in Java to be very helpful. He compares the different collections very well. I used to keep a diagram he published showing the inheritance heirachy on my cube wall as a quick reference. One thing I suggest you do is keep in mind thread safety. Performance usually means not thread s...
7,087
<p>How do you organize your Extension Methods? Say if I had extensions for the object class and string class I'm tempted to separate these extension methods into classes IE:</p> <pre><code>public class ObjectExtensions { ... } public class StringExtensions { ... } </code></pre> <p>am I making this too compli...
<p>I organize extension methods using a combination of namespace and class name, and it's similar to the way you describe in the question.</p> <p>Generally I have some sort of "primary assembly" in my solution that provides the majority of the shared functionality (like extension methods). We'll call this assembly "Fr...
<p>There are two ways that I organize the extension methods which I use,</p> <p>1) If the extension is specific to the project I am working on, then I keep it in the same project/assembly, but in its own namespace.</p> <p>2) If the extension is of a kind so that I may or is using it in other projects too, then I sepa...
12,224
<blockquote> <p><strong>See also:</strong> <br/> <em><a href="https://stackoverflow.com/questions/4950725">How can I see which Git branches are tracking which remote / upstream branch?</a></em></p> </blockquote> <p>How can I find out which remote branch a local branch is tracking?</p> <p>Do I need to parse <cod...
<p><a href="https://git-scm.com/docs/git-branch#Documentation/git-branch.txt--vv" rel="noreferrer">Here</a> is a command that gives you all tracking branches (configured for 'pull'), see:</p> <pre><code>$ git branch -vv main aaf02f0 [main/master: ahead 25] Some other commit * master add0a03 [jdsumsion/master] Some...
<p>I use <a href="https://people.gnome.org/~newren/eg/" rel="nofollow noreferrer">EasyGit (a.k.a. "eg")</a> as a super lightweight wrapper on top of (or along side of) Git. EasyGit has an "info" subcommand that gives you all kinds of super useful information, including the current branches remote tracking branch. Her...
20,682
<p>Since VS 2005, I see that it is not possible to simply build a dll against MS runtime and deploy them together (<a href="http://www.ddj.com/windows/184406482" rel="nofollow noreferrer">http://www.ddj.com/windows/184406482</a>). I am deeply confused by manifest, SxS and co: MSDN documentation is really poor, with cir...
<p>We use a simple include file in all our applications &amp; DLL's, vcmanifest.h, then set all projects to embedded the manifest file.</p> <p>vcmanifest.h</p> <pre><code>/*----------------------------------------------------------------------------*/ #if _MSC_VER &gt;= 1400 /*--------------------------------------...
<p>Thanks for the answer. For deployment per se, I can see 3 options, then:</p> <ul> <li>Using .msi merge directive.</li> <li>Using the redistributable VS package and run it before my own installer</li> <li>Copying the redistributable <em>files</em> along my own application. But in this case, how do I refer to it in a...
13,545
<p>I am implementing replication for a project I am developing, and would like to replicate changes in the Write database to the Read database.</p> <p>While this isn't a problem, I want to tune one database for reading from, and the other to writing to, so they would have different settings.</p> <p>Is there any resou...
<p>Index your databases differently. You probably need different indexes (maybe fewer indexes) to suppor the process of writing to the Write database than you do with the read database. If an index is only used for reading, then leave it off the Write database.</p> <p>I'm no expert on this, and my thinking might b...
<p>The most obvious difference will be the differing indexes required. Disk IO pattern will also be different but don't forget that the read database is also being written to by the replication procedure, you can't just optimise it completly for read. Other differences may also be evident in things like optimum memory ...
30,591
<blockquote> <p>See also <a href="https://stackoverflow.com/questions/1700917/how-does-a-wcf-server-inform-a-wcf-client-about-changes-better-solution-then-si">How does a WCF server inform a WCF client about changes? (Better solution then simple polling, e.g. Coment or long polling)</a></p> </blockquote> <p>I n...
<p>I've found a couple of solutions:</p> <p><a href="http://www.zeroc.com/" rel="nofollow noreferrer" title="ZeroC Ice">ZeroC Ice</a> GPL with a commercial option. Have only tested quickly. Looks more powerful than .NET Remoting and is very actively developed.</p> <p><a href="http://www.remobjectssdk.com/" rel="nofol...
<p>You can do following change in client for accessing duplex web service on Firewall enabled client.</p> <ul> <li>Set WebHttp option checked in Firewall -> Advanced -> Settings (of Network Connection Setting) -> Web Server (Http)</li> </ul>
4,235
<p>Does anybody have a suggestion for a java library that performs automatic cropping and deskewing of images (like those retrieved from a flatbed scanner)?</p>
<p><strong>Deskewing</strong></p> <p>Take a look at <a href="https://github.com/nguyenq/tess4j" rel="noreferrer">Tess4j (Java JNA wrapper for Tesseract)</a>. </p> <p>You can combine <a href="http://tess4j.sourceforge.net/docs/docs-2.0/index.html?com/recognition/software/jdeskew/ImageDeskew.html" rel="noreferrer">Imag...
<p>I'd imagine that someone has built a library on top of the <a href="http://java.sun.com/javase/technologies/desktop/media/jai/" rel="nofollow noreferrer">Java Advanced Imaging API</a> for doing this. You could try Googling for "Java Advanced Imaging deskew".</p>
34,463
<p>When people download files from my website, I don't want them to be able to download faster than 300KB/sec per file.</p> <p>Is there anyway to do this? I'm running IIS 6.0 on Windows Server 2003.</p>
<p>You can't limit download speed but you can limit the overall traffic to a particular website:</p> <ol> <li>Open IIS MMC</li> <li>Select Website</li> <li>Select Performance tab</li> <li>Enable 'Bandwidth throttling'</li> </ol>
<p>Reduce the speed of you Internet connection.</p>
15,794
<p>I have a https link that requires user login &amp; password. If I run it in FX like this: <a href="https://usernameassword@www.example.com/link/sublink" rel="nofollow noreferrer">https://usernameassword@www.example.com/link/sublink</a></p> <p>it will return the xml data as expected.</p> <p>However, what i'm trying...
<p>Look at <a href="https://stackoverflow.com/questions/129329/optimistic-vs-pessimistic-locking#129397">This discussion</a> for a review of different strategies or techniques for database locking in an application.</p>
<p>This is a big question with no easy answer. It call comes down to how willing are you to block one user while another user is working on it, and how do you prevent deadlocks and lousy performance while it's happening. Also, are you trying to prevent one user from updating the same row as the other, or just updatin...
20,203
<p>Are there any good PL/SQL libraries for JSON that you've worked with and found useful?</p> <p>In <a href="http://www.oracle.com/technology/tech/pl_sql/index.html" rel="noreferrer">PL/SQL</a>, I'm having to tediously hand code the return of <a href="http://www.json.org/" rel="noreferrer">JSON</a> values to JavaScript...
<p>@Geoff- </p> <p>The system, which has been in production for 8+ years, was architected to use PL/SQL for the CRUDs and <em>most</em> of the business logic. The PL/SQL also generates 90% of the presentation layer (HTML/JavaScript), using <a href="http://www.orafaq.com/wiki/Mod_plsql_FAQ" rel="nofollow noreferrer">...
<p>I wonder why you don't want to bring the data from Oracle into some application code and make JSON there?</p>
4,623
<p>I'm looking for a quality WinForms component that supports syntax highlighting, code folding and the like. The key criteria are:</p> <ol> <li>Stability </li> <li>Value (price)</li> <li>Ability to easily customize syntax to highlight</li> <li>Light weight</li> </ol>
<p><a href="http://www.icsharpcode.net/OpenSource/SD/" rel="nofollow noreferrer">ICSharpCode.TextEditor</a> is free and pretty stable.<br> As for commercial solution Actipro's <a href="http://www.actiprosoftware.com/Products/DotNet/SyntaxEditor/Default.aspx" rel="nofollow noreferrer">SyntaxEditor</a> might be a best ch...
<p>Try out <a href="http://www.codeplex.com/ScintillaNET" rel="nofollow noreferrer">ScintillaNET</a> it's a .NET WinForms wrapper around the excellent <a href="http://scintilla.org/" rel="nofollow noreferrer">Scintilla</a> control. Scintilla itself is a free source code editor component that is very customisable and ha...
6,319
<p>I am trying to compare two large datasets from a SQL query. Right now the SQL query is done externally and the results from each dataset is saved into its own csv file. My little C# console application loads up the two text/csv files and compares them for differences and saves the differences to a text file.</p> <p...
<p>If data in both of your CSV files is already sorted and have the same number of records, you could skip the data structure entirely and do in-place analysis.</p> <pre><code>StreamReader one = new StreamReader("C:\file1.csv"); StreamReader two = new StreamReader("C:\file2.csv"); String lineOne; String lineTwo; Stre...
<p>Well, there are several approaches that would work. You could write your own data structure that did this. Or you can try and use SortedList. You can also return the DataSets in code, and then use .Select() on the table. Granted, you would have to do this on both tables.</p>
10,298
<p>Please can someone help me make sense of the Batch madness?</p> <p>I'm trying to debug an Axapta 3.0 implementation that has about 50 Batch Jobs. Most of the batched classes do not implement the <strong><code>description()</code></strong> method, so when you look at the <em>Batch List</em> form (Basic>>Inquiries>>B...
<p>Jay's answer provides two comprehensive solutions. </p> <p>I've just discovered that the global class <strong>ClassId2Name</strong> does the same thing, so you can simply have:</p> <pre><code>display str Classname() { return ClassId2Name(this.ClassNum); } </code></pre>
<p>Alternative to get ClassName if ClassNum is not available.</p> <pre><code>display str Classname() { return classId2Name(ClassIdGet(this)); } </code></pre>
21,352
<p>I'm looking for the string <code>foo=</code> in text files in a directory tree. It's on a common Linux machine, I have bash shell:</p> <pre><code>grep -ircl &quot;foo=&quot; * </code></pre> <p>In the directories are also many binary files which match <code>&quot;foo=&quot;</code>. As these results are not relevant a...
<p>Use the shell <a href="https://man7.org/linux/man-pages/man7/glob.7.html" rel="noreferrer">globbing syntax</a>:</p> <pre><code>grep pattern -r --include=\*.cpp --include=\*.h rootdir </code></pre> <p>The syntax for <code>--exclude</code> is identical.</p> <p>Note that the star is escaped with a backslash to prevent ...
<p>To ignore all binary results from grep</p> <pre><code>grep -Ri "pattern" * | awk '{if($1 != "Binary") print $0}' </code></pre> <p>The awk part will filter out all the Binary file foo matches lines</p>
27,363
<p>I am currently working on a rather large multi tiered app that will be deployed overseas. Although I hope it won't fall over or blow up once depolyed I can't be 100% sure of this. Therefore it would be nice to know that I could request the log file, to work out exactly what went wrong and why.</p> <p>So basically...
<p>1 - Make a single log, with a standardized format. Doesn't matter much what it is, but ensure that ever entry has the same basic fields. Just calling "printf" probably won't cut it ( substitute System.err.println or whatever as appropriate )</p> <p>2 - Allow for at least one field to be an arbitrary string... the d...
<p>As long as you don't have to pay much for the performance, logging is important.</p> <p>In my experience the most important things you want to log are those sort of warnings, Oops's, sanity check failures, rainy-day scenarios, etc., that one tends to neglect while coding the sunny-day scenarios and sometimes waives...
23,605
<p>After watching The Dark Knight I became rather enthralled with the concept of the Prisoner's Dilemma. There <em>must</em> be an algorithm that that maximizes one's own gain given a situation.</p> <p>For those that find this foreign: <a href="http://en.wikipedia.org/wiki/Prisoner%27s_dilemma" rel="nofollow noreferre...
<p>Since there is only one choice to make, and in the absence of any changeable inputs, your algorithm is either going to be:</p> <pre><code>cooperate = true; </code></pre> <p>...or...</p> <pre><code>cooperate = false </code></pre> <p>It's more interesting to find a strategy for the Iterated Prisoner's Dilemma, whi...
<p>Ah yes. This made me remember this old article about <a href="http://www.spectacle.org/995/sw.html" rel="nofollow noreferrer">The Prisoner's Dilemma in Software Development</a></p> <p>For an algorithmic PD competition look <a href="http://www.prisoners-dilemma.com/" rel="nofollow noreferrer">here</a> </p> <p><a hr...
15,416
<p>Working through some programming interview challenges I found online, I had to write an algorithm to reverse a const char * and return a pointer to a new char *. I think I have it, but to make it work properly I had to do some wonky stuff - basically having to account for the null-terminating character myself. Someh...
<p>I had this question once. That's the first answer that comes to mind, but the follow-up is, "now do it without allocating any memory."</p> <pre><code>int length = strlen(string); for(int i = 0; i &lt; length/2; i++) { char c = string[i]; string[i] = string[length - i]; string[length - i] = c; } </code></pre> ...
<p>this works nicely:</p> <pre><code>#include &lt;algorithm&gt; #include &lt;iostream&gt; #include &lt;cstring&gt; void reverse_string(char *str) { char *end = str + strlen(str) - 1; while (str &lt; end) { std::iter_swap(str++, end--); } } int main() { char s[] = "this is a test"; rev...
27,008
<p>As a long time Microsoft developer, I find <a href="http://en.wikipedia.org/wiki/Microsoft_Developer_Network" rel="noreferrer">MSDN</a> to be an invaluable resource.</p> <p>However, when tinkering at home I am not able to play with the best latest technologies and the different offerings coming from Microsoft as I ...
<p>There is an Empower program that Microsoft has available. It gives you several Premium subscriptions for cheap, with the catch that you have to be an ISV working towards an actual product.</p> <p><a href="https://partner.microsoft.com/global/program/40066412" rel="nofollow noreferrer">This</a> (Not available anymor...
<p>Many MVP's have gift subscriptions that they can give away, so it pays off to be visible in the community.</p> <p>Speak at your local user group, start (or participate) in an open source project, start a blog... just generally get your name out there.</p> <p>Eventually you'll get one (or an MVP :)).</p> <p>What I...
6,395
<p>I know java and would normally put in getter/setter methods. I am interested in doing it in C# with the following code, but it throws a StackOverflow exception. What am I doing wrong?</p> <p>Calling Code</p> <pre><code>c.firstName = "a"; </code></pre> <p>Property Code </p> <pre><code>public String firstName; { ...
<p>It's because you're recursively calling the property - in the <code>set</code> you are setting the property again, which continues <em>ad infinitum</em> until you blow the stack.</p> <p>You need a private backing field to hold the value, e.g.</p> <pre><code>private string firstName; public string FirstName { ...
<p>StackOverflowExeption is inevitable in your snippet, and that's why.</p> <p>To understand that, we have to know what properties are and why we use them. Basically, a property is a set o methods, it's not a field. Via 'Property' we mean the collection of set method (which sets the value of something), and get method ...
47,925
<p>I have C# winforms application that needs to start an external exe from time to time, but I do not wish to start another process if one is already running, but rather switch to it.</p> <p>So how in C# would I so this in the example below?</p> <pre><code>using System.Diagnostics; ... Process foo = new Process(); ...
<p>This should do it for ya.</p> <p><a href="http://www.dreamincode.net/code/snippet1541.htm" rel="noreferrer">Check Processes</a></p> <pre><code>//Namespaces we need to use using System.Diagnostics; public bool IsProcessOpen(string name) { //here we're going to get a list of all running processes on //the c...
<blockquote> <p>Mnebuerquo wrote: </p> <blockquote> <p>Also, I had source code access to the process I was trying to start. If you can not modify the code, adding the mutex is obviously not an option.</p> </blockquote> </blockquote> <p>I don't have source code access to the process I want to r...
7,409
<p>It seems like such a simple thing, but I can't find any obvious solutions...</p> <p>I want to be able to take two or three feeds, and then merge then in to a single rss feed, to be published internally on our network.</p> <p>Is there a simple tool out there that will do this? Free or commercial..</p> <p>update: S...
<p>There are a whole pile of options here: <a href="http://allrss.com/rssremixers.html" rel="nofollow noreferrer">http://allrss.com/rssremixers.html</a>.</p>
<p>If you're using PHP, the <a href="http://simplepie.org/" rel="nofollow noreferrer">SimplePie</a> library will do this. <a href="http://www.webmaster-source.com/2007/08/06/merging-rss-feeds-with-simplepie/" rel="nofollow noreferrer">Here's a tutorial</a>.</p>
10,840
<p>What is the difference in the accessibility of the following variables in Java?</p> <pre><code>public class Joe { public int a; protected int b; private int b; int c; } </code></pre> <p>I'm most interested in what the last one is doing.</p>
<ul> <li><code>public</code>: read/writable for anyone</li> <li><code>protected</code>: read/writable for instances of subclasses <strong>and from within the enclosing package</strong></li> <li><code>private</code>: read/writable for <strong>any</strong> instance of the class and inner or outer (enclosing) instance</li...
<p>And all of these are compile time protections, they can be readily overridden through reflection at runtime.</p>
33,584
<p>I'm looking for an internal representation format for <strong>text</strong>, which would support basic formatting (font face, size, weight, indentation, basic tables, <strong>also supporting</strong> the following features:</p> <ul> <li>Bidirectional input (Hebrew, Arabic, etc.)</li> <li>Multi-language input (i.e. ...
<p>FCKeditor has a great API, supports several programming languages (considering it is javascript this isn't hard to achieve), can be loaded through HTML or instantiated in code; but most of all, allows easy access to the underlying form field, so having a jQuery or prototype ajax buffer shouldn't be terribly difficul...
<p>Small correction to laurens' answer above: As of now (May 2012), Xopus supports UTF8, but not BiDi editing. Right-to-left text is displayed fine if it came from another source, cannot be edited correctly. Source: I was recently asked to evaluate this, so have been testing it.</p>
17,710
<p>I'm quite confused by something. I've got 2 select lists, and if you choose an option in the first, I then load the 2nd with a certain set of options. I clear this out and repopulate it every time you change the selection in the first select element. Now, on postback, I need to know the value of the option that w...
<p>For the sake of completeness and accuracy , I am posting the actual code for inheriting from a krypton form.</p> <pre><code>public partial class Form1 : ComponentFactory.Krypton.Toolkit.KryptonForm </code></pre>
<p>The "New Krypton Form" used to show up not inside the "new project" dialog, but inside the "new item" dialog. (e.g. right-click on project, Add New Item)</p> <p>But I don't see it there either. Phil may have removed this from the installer.</p> <p>In any case, just add a regular Form, then make it derive from Kryp...
25,106
<p>This question is related to <a href="https://stackoverflow.com/questions/259663/vba-password-protection-how-it-works-is-it-secure-are-there-any-alternatives">my previous one</a>.</p> <p>Can you explain or provide a link to an explanation of how Excel VBA code password protection actually works in versions prior to ...
<p>VBA security is widely considered to be pretty poor. The VBA code isn't compiled, and the source is available in the excel file. The password protection is pretty easy to circumvent.</p> <p>As I understand it, Office 2003 and earlier saves the vba code as part of the binary format of the worksheet (or document / p...
<p>Someone made a working vba code that changes the vba protection password to "macro", for all excel files, including .xlsm (2007+ versions). You can see how it works by browsing his code.</p> <p>Here's the guy blog: <a href="http://lbeliarl.blogspot.com/2014/03/excel-removing-password-from-vba.html" rel="nofollow">h...
32,479
<p>Alright, I'm trying to read a comma delimited file and then put that into a ListView (or any grid, really). I have the delimiting part of the job taken care of, with the fields of the file being put into a multidimensional string array. The problem is trying to get it into the ListView.</p> <p>It appears that the...
<p>Just loop through each of the arrays in that you've created and create a new ListViewItem object (there is a constructor that takes an array of strings, I believe). The pass the ListViewItem to the ListView.Items.Add() method.</p>
<p>Is there a reason you can't use a DataTable? Use the DataSource member off of it.</p> <p>Also, I hope you are using the String.Split function, and not manually parsing...</p> <p>~S</p>
19,787
<p>I need to find the min and max value in an array. The <code>.max</code> function works but <code>.min</code> keeps showing zero.</p> <pre><code>Public Class Program_2_Grade Dim max As Integer Dim min As Integer Dim average As Integer Dim average1 As Integer Dim grade As String Private Sub Bu...
<p>You haven't shown where grade_enter is being created. My guess is that it's bigger than it needs to be, so there are "empty" entries (with value 0) which are being picked up when you try to find the minimum.</p> <p>You could change it to:</p> <pre><code>max = grade_enter.Take(counter).Max() min = grade_enter.Take(...
<p>I'm having a hard time finding where you defined grade_enter(). That code would easier to read if you broke it up into a few smaller methods. But I'm guessing you defined it as an array of integers with a static size that's large enough to hold however many items your professor told you to expect. In that case, a...
27,346
<p>I have three tables. This query will write down the right answer (x-lines for btv.id_user with appropriate btv.cas and race.id_zavod</p> <pre><code>SELECT `btv.id_user`, `btv.id_zavod`,`btv.cas` FROM `btv` JOIN `btu` ON `btv.id_user` = `btu.id_user` JOIN `race` ON 'btv.id_zavod' = `race.id_zavod` WHERE `race.type` ...
<p>The query you have written:</p> <pre><code>SELECT `btv.id_user`, `btv.id_zavod`, MIN( `btv.cas` ) FROM `btv` JOIN `btu` ON `btv.id_user` = `btu.id_user` JOIN `race` ON 'btv.id_zavod' = `race.id_zavod` WHERE `race.type` = '8' AND `btv.id_user` = '607' GROUP BY `btv.id_user`</code></pre> <p>won't run. You need a gr...
<p>Try:</p> <pre><code>SELECT `btv.id_user`, `btv.id_zavod`, MIN( `btv.cas` ) FROM `btv` Inner JOIN `btu` ON `btv.id_user` = `btu.id_user` Inner JOIN `race` ON 'btv.id_zavod' = `race.id_zavod` WHERE `btv.id_user` = '607' GROUP BY `btv.id_user` having `race.type` = '8' </code></pre>
47,552
<p>Is there any Java library that supports hierarchical column?</p> <p>For example (the first three row are columns) :</p> <pre><code>------------------------------------------------ 2008 | ------------------------------------------------ January | February ...
<p>May be a <a href="http://javadesktop.org/swinglabs/build/weekly/latest/swingx-HEAD/javadoc/org/jdesktop/swingx/JXTree.html" rel="nofollow noreferrer">JXTree</a> from <a href="https://swinglabs.dev.java.net/" rel="nofollow noreferrer">SwingLab</a> could approach what you are looking for.</p> <p>Illustration <a href=...
<p><a href="http://www.infragistics.com/java/netadvantage/jsf/webgridoverview.aspx" rel="nofollow noreferrer">Infragistics WebGrid for JSF</a>:</p> <p><a href="http://www.infragistics.com/uploadedImages/Products/NetAdvantage_for_JSF/Features/WebGrid/Gallery/WebGrid_Hierarchical.png" rel="nofollow noreferrer">alt text ...
40,428
<p>I'm trying to find the best solution for nonblocking IO via stdin/stdout with the following characteristics:</p> <ul> <li>As long as there is enough data, read in <em>n</em>-sized chunks.</li> <li>If there's not enough data, read in a partial chunk.</li> <li>If there is no data available, block until there is some ...
<p>Maybe <a href="http://www.boost.org/doc/libs/1_37_0/doc/html/boost_asio.html" rel="noreferrer">boost::asio</a> can be of use for you?</p>
<p>I did something similar to jwhitlock ... I ended up with a StdinDataIO class that wraps around the appropriate OS-specific implementation(*) so that the rest of my program can select() on the file descriptor StdinDataIO provides, remaining blissfully ignorant of Windows' limitations regarding stdin. Have a look <a ...
40,674
<p>How can I export a GridView's data to a Microsoft Excel 2007 file?</p> <p>Also, does Microsoft Excel 2007 support html elements and tags?</p>
<p>If your users are using IE, just have them right-click on the GridView (which will have been rendered as an HTML table), right-click, and select "Export to Excel." It isn't an amazing feature--and it requires IE--but otherwise if you need quick and dirty HTML table export to Excel is works fine--and you can tell 'em...
<p>I have used <a href="http://www.aspose.com" rel="nofollow noreferrer">Aspose.Cells</a> to do this. This component has a mechanism to programmatically create an Excel document from a GridView. I usually have a LinkButton whose click event handler constructs the document and writes the data into the Response.</p>
35,389
<p>I have recently started working on a very large C++ project that, after completing 90% of the implementation, has determined that they need to demonstrate 100% branch coverage during testing. The project is hosted on an embedded platform (Green Hills Integrity). I'm looking for suggestions and experiences from oth...
<p>100% branch coverage? That's quite the requirement, especially since some branches (defaults in case statements for state machines, for instance) should not be possible to run. I expect there are <em>some</em> exceptions, and if there aren't you might need to understand what coverage testing can and cannot accompl...
<p>See <a href="http://www.semanticdesigns.com/Products/TestCoverage/CppTestCoverage.html" rel="nofollow noreferrer">SD C++ Test Coverage</a>. This is a family of (branch) test coverage tools for a variety of dialects of C++ (ANSI, GNU, MS...) that plays nicely even in actual embedded systems hardware by virtue of ha...
25,397
<p>Is there some standard way or has anyone written something that allows you to log a message and have it be displayed either in a small scrolling section on the iphone screen or in a separate window in the iphone simulator?</p> <p>Update: For noobs like me and don't know, use the NSLog methods as decribed below and ...
<p>The Objective-C (more correct, really) method is</p> <pre><code>NSLog(@"message"); </code></pre> <p>But the standard C method will work also</p> <pre><code>printf("message"); </code></pre>
<p>For Swift, it's simply</p> <pre><code>print("log msg") </code></pre>
46,380
<p>I came across a class instance function that needed to temporarily change a class instance variable, and then restore it when the function completed. The function had return statements all over the place, and before each return there was a restoring statement. That seemed messy to me, not to mention scary when a exc...
<p>I agree with Adam Pierce and also think that you should prefer references over pointers:</p> <pre><code>template&lt;typename T&gt; class restorer { T&amp; ref_; T save_; public: restorer(T&amp; perm) : ref_(perm), save_(ref_) {}; ~restorer() { ref_ = save_; } }; </code></pre>
<p>This is how I would do it as well. This way if the function throws, or returns early for some reason, your Restorer object will be destroyed and the variable reset to the original value. The question really is, why do you need to have a variable that is reverted when the function returns? Is the object used from mor...
25,499
<p>(Bear with me, I promise this gets to shebang and windows.)</p> <p>I have about the simplest of WEBRick servers put together:</p> <pre><code>require 'webrick' include WEBrick s = HTTPServer.new(:Port=&gt;2000, :DocumentRoot=&gt;Dir::pwd) s.start </code></pre> <p>Couldn't be simpler. This basic server does accep...
<p>I think what you want is to associate the file extension with Ruby. I don't think it's possible to get the !# notation to work on Windows but it is possible to get Windows to automatically launch a script with a particular interpreter (as in your second example). A good step by step discussion of what you'd want t...
<p>Not really to argue... but why bother webrick when mongrel is much faster and with native compiled with windows? And of coz, that means no shebang is needed.</p>
29,875
<p>A design question.</p> <p>I have developed an online test engine web app earlier this year. I have used Java servlets and Freemarker templates and done it entirely following the MVC paradigm. </p> <p>One big missing feature in the application is that it provides no reporting. The initial design of the application ...
<p>While Jasper is a pretty good choice if you have fairly advanced requirements such as:</p> <ul> <li>Supporting esoteric formats</li> <li>Parent-child reports</li> <li>Charts and graphs </li> </ul> <p>But if you really only need to show tabular reports in popular formats such as HTML/PDF/XLS, then you can go a long...
<p>I would recommend art: <a href="http://art.sourceforge.net/" rel="nofollow">http://art.sourceforge.net/</a>. We are using this tool without any problems. It is still active project so if you add new feature you can add request for it.</p>
42,976
<p>How do i take advantage of MySQL's ability to cache prepared statements? One reason to use prepared statements is that there is no need to send the prepared statement itself multiple times if the same prepared statement is to be used again. </p> <pre><code>Class.forName("com.mysql.jdbc.Driver"); Connection conn = D...
<blockquote> <p>Is it possible to mimic this using pure JDBC?</p> </blockquote> <p>Is this not in fact what you've done by moving your prepared statement call out of the loop?</p> <p>I may be misunderstanding the way the MySQL cache works, but does the log file necessarily report the cache's work? It may be that ...
<p>First, your PreparedStatement is recreated in the loop, so the JDBC driver is allowed to discard the prepared data. So you asked for the ugly behaviour, and so you got it.</p> <p>And then, PreparedStatement in MySQL are a chapter on its own. To have real caching, you have to request it explicitly via a connection p...
27,380
<p>In Python, given a module X and a class Y, how can I iterate or generate a list of all subclasses of Y that exist in module X?</p>
<p>Here's one way to do it:</p> <pre><code>import inspect def get_subclasses(mod, cls): """Yield the classes in module ``mod`` that inherit from ``cls``""" for name, obj in inspect.getmembers(mod): if hasattr(obj, "__bases__") and cls in obj.__bases__: yield obj </code></pre>
<p>Given the module foo.py</p> <pre><code>class foo(object): pass class bar(foo): pass class baz(foo): pass class grar(Exception): pass def find_subclasses(module, clazz): for name in dir(module): o = getattr(module, name) try: if issubclass(o, clazz): yield name, o ...
6,609
<p>How do you create a database backup of a mysql database in VB.Net? </p>
<p>You can use <strong>MySqlBackup.NET</strong>, which is an alternative to mysqldump.</p> <p>Official Website &amp; Documentation > <a href="https://github.com/MySqlBackupNET/MySqlBackup.Net" rel="nofollow noreferrer">https://github.com/MySqlBackupNET/MySqlBackup.Net</a></p> <p>Examples:</p> <p><strong>Backup a MyS...
<p>You can read each table's data and write it to a new database.</p>
23,077
<p>What is the best encryption library in C/C++ In terms of: </p> <ul> <li>entropy </li> <li>quality </li> <li>ease of use</li> <li>readability</li> <li>portability </li> <li>performance</li> </ul> <p>What's your favorite and why do you like it? </p>
<p>We've used <a href="http://www.openssl.org/" rel="noreferrer">OpenSSL</a> with good success. Portable, standards compliant and easy to use.</p>
<p><a href="http://www.gnupg.org/related_software/gpgme/index.en.html" rel="nofollow noreferrer">GPGme</a>. Simple to use and compatible with the <a href="http://www.ietf.org/rfc/rfc4880.txt" rel="nofollow noreferrer">OpenPGP format</a></p>
21,821
<p>Why doesn't the designer work if you inherit from an own written genericform?</p> <p>Suppose I've got the following genericform</p> <pre><code>public class GenericForm&lt;T&gt; : System.Windows.Forms.Form { public T Test { get; set; } } </code></pre> <p>When I go to the designer I get ...
<p>Disclaimer : I dont work all that much under Windows</p> <p>In the general case, you shouldnt mess with your OS cache. It should be smart enough to cache data that are accessed often. If it isnt, you should use an application level cache. I dont know which language you are using, but most probably there is a good c...
<p>If your in .net and the file is a dll, look into the <a href="http://en.wikipedia.org/wiki/Global_Assembly_Cache" rel="nofollow noreferrer">Global Assembly Cache (GAC)</a>.</p>
40,501
<p>What does the &quot;bus error&quot; message mean, and how does it differ from a <a href="https://en.wikipedia.org/wiki/Segmentation_fault" rel="noreferrer">segmentation fault</a>?</p>
<p>Bus errors are rare nowadays on x86 and occur when your processor cannot even attempt the memory access requested, typically:</p> <ul> <li>using a processor instruction with an address that does not satisfy its alignment requirements.</li> </ul> <p>Segmentation faults occur when accessing memory which does not belon...
<p>A typical buffer overflow which results in Bus error is,</p> <pre><code>{ char buf[255]; sprintf(buf,"%s:%s\n", ifname, message); } </code></pre> <p>Here if size of the string in double quotes ("") is more than buf size it gives bus error.</p>
26,114
<p>I am trying to extract a table of values from an excel (2003) spreadsheet using vb6, the result of which needs to be stored in a (adodb) recordset. The table looks like this:</p> <pre> Name Option.1 Option.2 Option.3 Option.4 Option.5 Option.6 --------------------------------------------------------...
<p>The Excel ISAM driver by default looks into the first handful of your rows and guesses their data type. Should there be (later in the table) data that does not fit into the initial assumption, it frowns and turns it to NULL.</p> <p>Your <code>MaxScanRows=0</code> setting is the key to this problem. It sounds like i...
<p>The best advice I can give you is to stop doing it in the VB6 environment. Open Excel, press ALT+F11 and load the VBA IDE. Put your code in there. From within this environment you can access the full Excel object model. </p> <p>I've seen many people try and interact with Excel in many different ways and they al...
28,397
<p>How do you run Emacs in Windows?</p> <p>What is the best flavor of Emacs to use in Windows, and where can I download it? And where is the .emacs file located?</p>
<p>I use <a href="http://www.emacswiki.org/emacs/EmacsW32" rel="noreferrer">EmacsW32</a>, it works great. <em>EDIT: I now use regular GNU Emacs 24, see below.</em></p> <p>See its <a href="http://www.emacswiki.org/cgi-bin/wiki/EmacsW32" rel="noreferrer">EmacsWiki page</a> for details.</p> <p>To me, the biggest advanta...
<p>To access the .emacs file for your profile the easiest way is to open up emacs. Then do C-x C-, type in ~USERNAME/.emacs (or you can use init.el or one of the other flavours). Type your stuff into the file and C-x C-s (I think) to save it.</p> <p>The actual file is located (in Windows XP) in c:\Documents and Settin...
6,259
<p>How Do I Get Eclipse Style Function Completions in Emacs for C, C++ and JAVA? I love the power of the Emacs text editor but the lack of an "intellisense" feature leaves me using Eclipse.</p>
<p><code>M-/</code> is a quick and dirty autocomplete based on the contents of your current buffer. It won't give you everything you get in Eclipse but is surprisingly powerful.</p>
<p>I've written a C++-specific package on top of CEDET that might provide what you want. It provides an Eclipse-like function arguments hint. Overloaded functions are supported both for function arguments hint and for completion. Package is located here:</p> <p><a href="https://github.com/abo-abo/function-args" rel="n...
15,713
<p>I have an ASP.NET application that displays various views into a largish database of protein sequences. As a visitor browses the data, I'd like for them to be able to select a CheckBox in the GridView row to flag sequences for later download as a zipped text file. I don't want to store the selections so they shoul...
<p>Use AJAX via a Page Method to keep track of the checkbox status in the session state. This will minimize the round-trip cost.</p> <p>I don't think you'll be able to sort by the check box in the GridView as you need to specify the sort column. You may be able to do this by making a synthetic data source that basic...
<p>I'm not sure there's an easier way to do it, but as for your other questions:</p> <p>2.) You need to decide for yourself the balance between robustness and network traffic. If you use the check event, you're going to go back to the server quite a bit. If you use a different event (losing focus on the grid, an exp...
22,810
<p>Now, I know a difference between parameters in a URL and a POST parameter: some browsers may misbehave if the URL is too long, so it is not a good idea to stuff hundreds of parameters in a URL, even if your app can respond to a GET request.</p> <p>For the sake of discussion, let's suppose the following web applicat...
<p>The HTTP spec does not set limitations, but the browsers and servers do. See <a href="http://www.boutell.com/newfaq/misc/urllength.html" rel="nofollow noreferrer">here</a> for specifics.</p> <p>The browser will create a long URL if the method is set to GET for a form, so the above limitations apply.</p>
<blockquote> <p>I've also heard that &lt;form method="get"&gt; is completely equivalent to placing parameters in a URL ? </p> </blockquote> <p>That's true, here is the corresponding <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9.3" rel="nofollow noreferrer">RFC section</a></p> <blockquote> <p...
33,346
<p>I'm writing a client-server app using BSD sockets. It needs to run in the background, continuously transferring data, but cannot hog the bandwidth of the network interface from normal use. Depending on the speed of the interface, I need to throttle this connection to a certain max transfer rate.</p> <p>What is th...
<p>The problem with sleeping a constant amount of 1 second after each transfer is that you will have choppy network performance. </p> <p>Let BandwidthMaxThreshold be the desired bandwidth threshold.</p> <p>Let TransferRate be the current transfer rate of the connection.</p> <p>Then...</p> <p>If you detect your Tran...
<p>I've had good luck with <a href="http://monkey.org/~marius/trickle/" rel="nofollow noreferrer">trickle</a>. It's cool because it can throttle arbitrary user-space applications without modification. It works by preloading its own send/recv wrapper functions which do the bandwidth calculation for you.</p> <p>The bigg...
29,180
<p>How come the iPhone Interface Builder doesn't let me set the X,Y coordinates of a top-level UIView? (Meaning, a view whose direct parent is a UIViewController.) The X and Y boxes on the View Size tab are grayed out. I can change the X,Y values in code at runtime, so why not in the Interface Builder?</p> <p>Thanks.<...
<p>Because the view owned by a <code>UIViewController</code> fills the available space in its parent. Its parent will be either a <code>UIWindow</code> or the view controlled by something like a <code>UINavigationController</code> or <code>UITabBarController</code>. It will position the view for you. If you want to con...
<p>I agree this is a missing feature in IB. For basic usage i.e. creating a single top-level view for placement in a standard view controller, of course it's not necessary to set the view origin. However NIBs are designed to be able to hold any number of top-level views in an arbitrary object graph. Since this allow...
46,628
<p>I'm unable to make a remote connection to an Oracle XE install (through TOAD / SQL Developer). Here's the deal.</p> <p>I set up a new server (windows 2003). The goal was to make a new image with several applications preinstalled, Oracle XE being one of them. Got Oracle installed no problem, connected locally, re...
<p>ManuelF relates to access through the web front end, but isn't relevant to local access through the web front end.</p> <p>You don't say how hostname/address is being handled, or how you are connecting locally. If you are doing <code>SQLPLUS / AS SYSDBA</code> then you are attaching directly. If you are doing <code...
<p>I discovered that remote connections were failing to my Ubuntu box because I'd misconfigured the <code>/etc/hosts</code> file. The machine had a static IP set up in <code>/etc/interfaces</code>, but the entry in hosts had the wrong IP address:</p> <pre><code>127.0.0.1 localhost 127.0.1.1 fqdn.domain.com...
32,754
<p>I have a small program to order and sort email messages, outputting to a textfile using <code>$msg-&gt;decoded-&gt;string</code>. The perl program outputs to <code>stdout</code>, and I redirect it to a txt file. However, gedit is unable to open this text file because of a character set problem, and I would like to k...
<p>Different messages probably are in different encodings. Probably gedit detects it as UTF-8, but later finds out that parts of the file aren't UTF-8. Mixed files like this are major PITA.</p> <p>The best (perhaps only) solution is to check for the content type (<code>$message-&gt;contentType</code>) and convert ever...
<p>If you are simply redirecting Perl's output, then Perl will have a difficult time producing a decent file.</p> <p>You should try writing the file directly from Perl.</p> <p>You should also check whether you really have an encoding problem or whether characters that simply don't belong in your file still end up the...
48,119
<p>How do I escape a string in SQL Server's stored procedure so that it is safe to use in <code>LIKE</code> expression.</p> <p>Suppose I have an <code>NVARCHAR</code> variable like so:</p> <pre><code>declare @myString NVARCHAR(100); </code></pre> <p>And I want to use it in a <code>LIKE</code> expression:</p> <pre><...
<p>To escape special characters in a LIKE expression you prefix them with an escape character. You get to choose which escape char to use with the ESCAPE keyword. (<a href="http://msdn.microsoft.com/en-us/library/ms179859.aspx" rel="noreferrer">MSDN Ref</a>)</p> <p>For example this escapes the % symbol, using \ as the...
<p>Alternative escaping syntax:</p> <blockquote> <p><a href="https://learn.microsoft.com/en-us/sql/connect/jdbc/using-sql-escape-sequences?view=sql-server-2017" rel="nofollow noreferrer">LIKE Wildcard Literals</a></p> <p>The JDBC driver supports the <strong>{escape 'escape character'}</strong> syntax for using ...
32,307
<p>I need to signal a running application (Windows service) when certain things happen in SQL Server (2005). Is there a possibility to send a message from a trigger to an external application on the same system?</p>
<p>You can use a <a href="http://msdn.microsoft.com/en-us/library/ms345108.aspx" rel="noreferrer">SQL Service Broker</a> queue to do what you want. The trigger can create a conversation and send a message on the queue. When it starts, the external process should connect to the database and issue a WAITFOR (RECEIVE) sta...
<p>You can send an email from a trigger, but it isn't a recommended practice becasue if the email ssystem is down, no data changes can be made to the table. </p> <p>Personally if you can live with less than realtime, I would information about the event you are interested in to another table (so the real change of data...
39,319
<p>I am looking into mechanisms for better search capabilities against our database. It is currently a huge bottleneck (causing long-lasting queries that are hurting our database performance).</p> <p>My boss wanted me to look into <a href="http://lucene.apache.org/solr/" rel="nofollow noreferrer">Solr</a>, but on clo...
<p>I have had good experiences with Compass. It has really good integration with hibernate and can mirror data changes made through hibernate and jdbc directly to the Lucene indexes though its GPS devices <a href="http://www.compass-project.org/docs/1.2.2/reference/html/gps-jdbc.html" rel="nofollow noreferrer">http://w...
<p>For a pure performance boost with searching Lucene will certainly help out a lot. Only index what you care about/need and you should be good. You could use Hibernate or some other piece if you like but I don't think it is required.</p>
11,187
<p>Can anyone suggest a good implementation of a generic collection class that implements the <code>IBindingListView</code> &amp; <code>IBindingList</code> interfaces and provides Filtering and Searching capabilities?</p> <p>I see my current options as:<br /></p> <ul> <li>Using a class that someone else has written a...
<p>I used and built upon an implementation I found on and old MSDN forum post from a few years ago, but recently I searched around again and found a sourceforge project called <a href="http://blw.sourceforge.net/" rel="noreferrer">BindingListView</a>. It looks pretty nice, I just haven't pulled it in to replace my hac...
<p>A couple of solutions I can think of:</p> <ol> <li><p>The <a href="http://subsonicproject.com/" rel="nofollow noreferrer">SubSonic Project </a> has a pretty nice implementation of <code>BindlingList&lt;T&gt;</code> which is open source. Although this might require using the entire SubSonic binary to use their imple...
4,879
<p>Building an iPhone project results in: </p> <blockquote> <p>Failed to launch simulated application: SpringBoard failed to launch application with error: 7</p> </blockquote> <p>And the app doesn't install on the simulator. What's this all about? What's SpringBoard and what is error 7?</p>
<p>I had the exact same problem - I reset the iphone simulator and then quit the simulator (i.e. command q) then started it again.</p> <p>Worked.</p>
<p>I had the same problem.</p> <p>It happens as follow...</p> <p>I had a folder storing images in some sub-folders.</p> <p>If I add the root image folder as "directory", I receive this error.</p> <p>If I add the root image folder as "group", simulator runs fine.</p> <p>weird...</p>
38,575
<p>I have a textarea with many lines of input, and a JavaScript event fires that necessitates I scroll the textarea to line 345.</p> <p><code>scrollTop</code> sort of does what I want, except as far as I can tell it's pixel level, and I want something that operates on a line level. What also complicates things is that...
<p>You can stop wrapping with the wrap attribute. It is not part of HTML 4, but most browsers support it.<br /> You can compute the height of a line by dividing the height of the area by its number of rows.</p> <pre><code>&lt;script type=&quot;text/javascript&quot; language=&quot;JavaScript&quot;&gt; function Jump(line...
<p>Something to consider when referring to the accepted answer: you may not have specified the <code>rows</code> attribute in your <code>textarea</code> e.g. instead, you may have set the height of the <code>textarea</code> using CSS.</p> <p>Therefore referring to <code>ta.rows</code> will not work as per above (it's ...
18,779
<p>One of the feature requests I've got for the program I'm working on is to be able to save the list of credentials users enter in, so they can be shared around. The specific use case that inspired this request was using our program on a large corporate network, made up of fairly good LANs connected by a flaky WAN. Th...
<p>There is no save support in SecureString, it's intended as a mechanism to protect a in-memory managed string and is only used for interfacing with unmanaged APIs. If a password was stored in a System.String instance, security would be less due to the nature of System.String. The existence of garbage collection and...
<p>As stated here, <code>SecureString</code> is not the best way to use in this scenario.</p> <p>If I had the need to <strong>share</strong> the users credentials I would probably share the <em>username</em> and the <em>hashed + salted password</em>, so you would be safe and only share the <strong>representation of a ...
17,790
<p>I'm writing some code in python and I'm having trouble when trying to retrieve content of an Entry widget. The thing is: I want to limit the characters that can be typed, so I'm trying to clear the Entry widget when I reach the specific number of characters (2 in this case), but it looks like I always miss the last ...
<p>At first, after you do the deletion, the event goes on with its normal processing, i.e. the character gets inserted. You need to signal to Tkinter that the event should be ignored.</p> <p>So in your code above, add the marked line:</p> <pre><code>if len(self.__value) &gt; 2: widgetName.delete(2,4) return "...
<p>To be a bit more specific, Tk widgets have what are called "bindtags". When an event is processed, each bindtag on the widget is considered in order to see if it has a binding. A widget by default will have as its bindtags the widget, the widget class, the root widget, and "all". Thus, bindings to the widget will oc...
25,356
<p>I'm making a webpage with dynamic content that enters the view with AJAX polling. The page JS occasionally downloads updated information and renders it on the page while the user is reading other information. This sort of thing is costly to bandwidth and processing time. I would like to have the polling pause whe...
<p>Your best solution would be something like this:</p> <pre><code> var inactiveTimer; var active = true; function setTimer(){ inactiveTimer = setTimeOut("stopAjaxUpdateFunction()", 120000); //120 seconds } setTimer(); document.onmouseover = function() { clearTimeout ( inactiveTimer ); ...
<p>You can listen for mousemove and keypress events. If one of those has been fired in the past X seconds, then continue with your updating. Otherwise, don't update.</p> <p>It's not perfect, but I think it's the best you can do with pure JS.</p> <p>If you want to venture into the world of Flash, Silverlight, or Java,...
45,595
<p>I would like to hear about interesting projects which made use of Amazon's Mechanical Turk.</p>
<p>It was used to help search for <a href="http://en.wikipedia.org/wiki/Jim_Gray_(computer_scientist)" rel="noreferrer">James Gray</a> when he went missing.</p>
<p>www.nearlyeveryone.com is built on top of Mechanical Turk</p>
23,509
<p>I have the following xsl that sorts my xml alphabetically:</p> <pre><code>&lt;xsl:template match="/"&gt; &lt;xsl:apply-templates /&gt; &lt;/xsl:template&gt; &lt;xsl:key name="rows-by-title" match="Row" use="translate(substring(@Title,1,1),'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')" /&gt; &lt;xsl...
<p>Here is my solution.</p> <p>You can decide via parameters <code>"per-row"</code> and <code>"show-empty"</code> if you want empty cells to show up or if you want to hide them. I'm sure a much more elegant version exists, but I could not come up with one. ;-) Comments welcome.</p> <pre><code>&lt;xsl:stylesheet versi...
<p>I'm sort of confused by the question but I think what you're looking for is an xsl:if test with a combination of <a href="http://www.zvon.org/xxl/XSLTreference/Output/function_position.html" rel="nofollow noreferrer">position()</a> and <a href="http://www.zvon.org/xxl/XSL-Ref/Tutorials/Arithmetics/ar6.html" rel="nof...
49,416
<p>Following the development of Ruby very closely I learned that detailed character encoding is implemented in Ruby 1.9. My question for now is: How may Ruby be used at the moment to talk to a database that stores all data in UTF8?</p> <p>Background: I am involved in a new project where Ruby/RoR is at least an option....
<p>Ruby 1.8 works fine with UTF-8 strings for basic operations with the strings. Depending on your application's need, some operations will either not work or not work as expected.</p> <p>Eg:</p> <p>1) The size of strings will give you bytes, not characters since the mult-byte support is not there yet. But do you nee...
<p>Although I haven't tested it, the character-encodings library (currently in alpha) adds methods to the String class to handle UTF-8 and others. Its page on RubyForge is <a href="http://rubyforge.org/projects/char-encodings/" rel="nofollow noreferrer">here</a>. It is designed for Ruby 1.8.</p> <p>It is my experience...
19,351
<p>I'm capturing data from a tablet using Java (JPen library rocks) and would like to be able to paint a penstroke in a more natural way.</p> <p>Currently I'm drawing the pen stroke as straight line segments each with a different Stroke thickness. </p> <p>There has to be something in Java's Graphics Library that let...
<p>I've never done this, but here are a couple things you could try. First, you could implement a custom <a href="http://java.sun.com/javase/6/docs/api/java/awt/Stroke.html" rel="nofollow noreferrer">Stroke</a> that creates skinny trapezoids. The width of the end caps would be a function of the pressure at the end poin...
<p>PostScript RIPs often convert circles to curves and curves to a series of straight line segments. The number of segments depends on the flatness setting which defaults to one suitable for the raster display resolution.</p> <p>A thick line or thick line segments can be converted to a skinny filled polygon.</p>
6,407
<p>We have fairly large C++ application which is composed of about 60 projects in Visual Studio 2005. It currently takes 7 minutes to link in Release mode and I would like to try to reduce the time. Are there any tips for improving the link time?</p> <p>Most of the projects compile to static libraries, this makes test...
<p>If you're using the <a href="http://msdn.microsoft.com/en-us/library/0zza0de8.aspx" rel="noreferrer"><code>/GL</code></a> flag to enable Whole Program Optimization (WPO) or the <a href="http://msdn.microsoft.com/en-us/library/xbf3tbeh.aspx" rel="noreferrer"><code>/LTCG</code></a> flag to enable Link Time Code Genera...
<p>Step 1 in C++ build time reduction is more memory. After switching from 4GB to 12GB, I saw my link-all-projects time fall off a cliff: from 5:50 to 1:15.</p>
17,353
<p>I've got a report that works perfectly in development previews. But when I deploy I get the following error:</p> <p>In the Dev Environment the Error displayed is:</p> <blockquote> <p>Error 4 The data source 'myDataSource' cannot be found. c:\reporting services projects\reports\rest_of_path\my_report.rdl ...
<p>Did you upgrade the report files? the RDL spec changed between 2005 and 2008, you need to ensure that you are working with 2008 compatible tools if you are targeting 2008.</p>
<p>I got this to work with 2005, and to make it work I had to change the data source to use OLE DB and Sql Server Native Client 10.0. Another strange quirk was that the data source had to not have spaces in the name. I then had to reassign the report to use the new data source without spaces and then the 2005 rdl wor...
48,848
<p>I have always been interested in algorithms, sort, crypto, binary trees, data compression, memory operations, etc.</p> <p>I read Mark Nelson's article about permutations in C++ with the STL function next_perm(), very interesting and useful, after that I wrote one class method to get the next permutation in Delphi, ...
<p>My approach is a recursive generator that doesn't follow branches that contain illegal sequences.</p> <p>Here's the python 3 code:</p> <pre><code>def perm_maxlen(elements, prefix = "", maxlen = 2): if not elements: yield prefix + elements return used = set() for i in range(len(elemen...
<p>Krusty, I'm already doing that at the end of function, but not solves the problem, because is need to generate all permutations and check them each one.</p> <pre><code>consecutive := 1; IsValid := True; for n := 0 to len - 2 do begin if anyVector[n] = anyVector[n + 1] then consecutive := consecutive + 1...
49,467
<p>I am using Delphi TApplication.OnException Event to catch unhandled exceptions</p> <p>This works well but does not give sufficient information about where the exception happened i.e. ‘Catastrophic failure’ </p> <p>How can I find out which procedure made the error happened?</p> <pre><code>procedure TFrmMain.For...
<p>You can get the memory address where the exception was thrown by using the ExceptAddr variable (System unit). But if you want a stack trace you could use one of the 3rdParty tools MadExcept, EurekaLog or the open source JCLDebug (part of the JCL).</p>
<p>The simplest and quickest way would be to use the <a href="http://jcl.sf.net/" rel="noreferrer">JCL</a> exception and debugging support. After installing the JCL, make sure to insert the debug symbols into the binary (Projects -> JCL debug expert -> Insert JDBG data for this binary -> Enabled) and add a JCL exceptio...
45,196
<p>I have a class that contains a dynamically allocated array, say</p> <pre><code>class A { int* myArray; A() { myArray = 0; } A(int size) { myArray = new int[size]; } ~A() { // Note that as per MikeB's helpful style critique, no need to check against 0. ...
<p>For building containers you obviously want to use one of the standard containers (such as a std::vector). But this is a perfect example of the things you need to consider when your object contains RAW pointers.</p> <p>If your object has a RAW pointer then you need to remember the rule of 3 (now the rule of 5 in C++...
<ol> <li><p>Use array or common container for objects only if they have default and copy constructors. </p></li> <li><p>Store pointers otherwise (or smart pointers, but may meet some issues in this case).</p></li> </ol> <p>PS: Always define own default and copy constructors otherwise auto-generated will be used</p>
31,897
<p>I am developing a small ASP.NET website for online shopping, when testing it out in Visual Studio, everything works fine, however that is no longer the case when I deploy it to IIS.</p> <p>The problem seems to be in a DLL file that I reference, this DLL file contains the Classes I need to initialize and send query ...
<p>Usually, when something that works on the dev sever doesn't work on IIS, the problem is authorizations (the VS server runs under your credentials, but IIS runs as "Network Service" or another system user).</p> <p>For example, I see your code breaks on fulfiller.toLog().</p> <p>Could it be that the toLog() function...
<p>What is fulfiller.Initialize() doing? Can you post that code?</p> <p>Clearly you have a fulfiller reference, because you can't pass the constructor without error and then have a null-ref.</p>
34,270
<p>Is there a single algorithm that removes elements from a container as happens in the following code?</p> <pre><code>vec_it = std::remove_if( vec.begin(), vec.end(), pred ); vec.erase( vec_it, vec.end() ); </code></pre>
<p>The idiomatic way to do it is like jalf has said. You can build your own function to do that more easily:</p> <pre><code>template&lt;typename T, typename Pred&gt; void erase_if(T &amp;vec, Pred pred) { vec.erase(std::remove_if(vec.begin(), vec.end(), pred), vec.end()); } </code></pre> <p>So you can use</p> <p...
<p>I don't know. Maybe there is. But if there is, then it will be a hell of a statement. Nobody will be able to understand or maintain it. If those two lines do what you want, just stick with them. They are perfectly good.</p>
42,250
<p>I've seen news of <a href="http://github.com/jeresig/sizzle/tree/master" rel="noreferrer">John Resig's fast new selector engine named Sizzle</a> pop up in quite a few places, but I don't know what a selector engine is, nor have any of the articles given an explanation of what it is. I know Resig is the creator of j...
<p>A selector engine is used to query a page's DOM for particular elements, based on some sort of query (usually CSS syntax or similar). </p> <p>For example, this jQuery:</p> <pre><code>$('div') </code></pre> <p>Would search for and return all of the &lt;div&gt; elements on the page. It uses jQuery's selector engi...
<p>A selector engine is used to find elements in a document, in the same way as CSS stylesheets does. Currently only Safari has the built-in querySelectorAll function which does just that. With other browser you have to use external JavaScript implementations as <a href="http://llamalab.com/js/selector/" rel="nofollow ...
4,596
<p>I'm currently writing some methods that do some basic operations on form controls eg Textbox, Groupbox, these operations are generic and can be used in any application. </p> <p>I started to write some unit tests and was just wondering should I use the real form controls found in System.Windows.Forms or should I jus...
<p>If you're trying to unit test the application logic by simulating interaction with the UI controls, you should do some abstraction using the <a href="http://en.wikipedia.org/wiki/Model-view-controller" rel="noreferrer">MVC pattern</a>. Then you can just have a stub view and call the controller methods from your unit...
<p>What you are suggesting won't even compile if your code relies on System.Windows.Forms.Control. Your version of Control and Textbox are simply the wrong type.</p> <p>If, instead, you separated your UI and Logic with interfaces, then you could do this... Something like this:</p> <pre><code>public interface ITextB...
38,742
<p>Is there an easy way to read an entire Access file (.mdb) into a DataSet in .NET (specifically C# or VB)?</p> <p>Or at least to get a list of tables from an access file so that I can loop through it and add them one at a time into a DataSet?</p>
<p>Thanks for the suggestions. I was able to use those samples to put together this code, which seems to achieve what I'm looking for.</p> <pre><code>Using cn = New OleDbConnection(connectionstring) cn.Open() Dim ds As DataSet = new DataSet() Dim Schema As DataTable = cn.GetOleDbSchemaTable(OleDbSchemaGu...
<p>There is a discussion on this point in <a href="http://forum.lessthandot.com/viewtopic.php?f=95&amp;t=1262" rel="nofollow noreferrer">Less Than Dot</a>. Here is one example of code from the discussion.</p> <pre><code> public DataTable GetColumns(string tableName) { string[] restrictions = new string[4...
6,859
<p>Talking about <strong>schema definitions</strong>, what are you used to doing:</p> <ol> <li>put everything inside a unique and big bang XML schema?</li> <li>use a domain modularization approach, putting all entities that referes to the same context together?</li> <li>or just use a schema per entity?</li> </ol> <p>...
<p>One per namespace. Why do you need to break up a schema? I'd also quote the Rules of <a href="http://fetter.org/optimization.html" rel="nofollow noreferrer">Optimization Club</a>.</p> <p><strong>Edit:</strong> If you have many entities that are disjoint from each other (like plugins), it may make sense to start app...
<p>Personally from my experience, I've heard that there isn't too much of a difference either way from a performance standpoint. </p> <p>In my opinion though, I find a single nested schema to be much easier to understand, follow, and relate to the source document.</p>
45,573
<p>I would like to load a specific ConfigurationSection but the way the CLR loads the assemblies is giving me some trouble:</p> <p>My CustomConfigurationSection definition is on a specific assembly which cannot be found by the overall process of assembly loading, because I'm using an external tool which basically load...
<p>If you know the path to your assembly, then you should try ConfigurationManager.OpenExeConfiguration(exePath).</p>
<p>If your assembly is needed to deserialize your custom configuration section, but the CLR can't find the assembly, then I think you're out of luck (or am I misunderstanding the problem?). </p> <p>Is there any way you can get the CLR to find your assembly (providing a hint path maybe)? If not, maybe you'd be better...
47,890
<p>The function below is logging the "0", "z" and the "1" ok... but its not capturing the "Z" (shift-z)... any help would be appreciated...</p> <pre><code>__declspec(dllexport) LRESULT CALLBACK HookProc (UINT nCode, WPARAM wParam, LPARAM lParam) { if ((nCode == HC_ACTION) &amp;&amp; (wParam == WM_KEYUP)) { ...
<p>The keyboard does not send <em>characters</em>. It sends <em>keys</em>. Whether you're typing <em>z</em> or <em>Z</em>, you're still pressing the same key, and that key has the same VK code both times.</p> <p>You should also get notification when the Shift key is pressed or released. You can use those notifications...
<p>There's no virtual key code for Z. Try something like this:</p> <pre><code> case 90: if(GetKeyState(VK_LSHIFT|VK_RSHIFT) Logger[0] = L'Z'; break; else Logger[0] = L'z'; break; </code></pre>
44,481
<p>Is there a canonical ordering of submatch expressions in a regular expression? </p> <p>For example: What is the order of the submatches in<br> "(([0-9]{3}).([0-9]{3}).([0-9]{3}).([0-9]{3}))\s+([A-Z]+)" ?</p> <pre><code>a. (([0-9]{3})\.([0-9]{3})\.([0-9]{3})\.([0-9]{3}))\s+([A-Z]+) (([0-9]{3})\.([0-9]{3})\.([0...
<p>They tend to be numbered in the order the capturing parens start, left to right. Therefore, option b.</p>
<p>You count opening parentheses, left to right. So the order would be</p> <pre><code>(([0-9]{3}).([0-9]{3}).([0-9]{3}).([0-9]{3})) ([0-9]{3}) ([0-9]{3}) ([0-9]{3}) ([0-9]{3}) ([A-Z]+) </code></pre> <p>At least this is what Perl would do. Other regex engines might have different rules.</p>
11,285