instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>Using a configuration file I want to enable myself to turn on and off things like (third party) logging and using a cache in a C# website. The solution should not be restricted to logging and caching in particular but more general, so I can use it for other things as well.</p> <p>I have a configuration xml file in ...
<p>Why not just use the web.config and the System.Configuration functionality that already exists?</p> <p>Your web app is going to parse web.config on every page load anyway, so the overhead involved in having yet another XML config file seems overkill when you can just define your own section on the existing configur...
<p>Consult <a href="http://msdn.microsoft.com/en-us/library/ms178606.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms178606.aspx</a> for specifics regarding configuring cache.</p>
11,173
<p>Please forgive my long question. I have an idea for a design that I could use some comments on. Is it a good idea to do this? And what are the pit falls I should be aware of? Are there other similar implementations that are better?</p> <p><strong>My situation is as follows:</strong><br> I am working on a rewrite of...
<p>I have a similar situation here, though I use MySQL. Every database has a versions table that contains the version (simply an integer) and a short comment of what has changed in this version. I use a script to update the databases. Every database change can be in one function or sometimes one change is made by multi...
<p>Better don't create additional databases. At first glance you may think that you'll get some performance gain, but actually you get support nightmare. Remember - what can break, does break sooner or later. </p> <p>It is way simpler to perform and optimize queries in single database. It is much easier manage user pe...
31,524
<p>Google app engine tells me to optimize this code. Anybody any ideas what I could do?</p> <pre><code>def index(request): user = users.get_current_user() return base.views.render('XXX.html', dict(profiles=Profile.gql("").fetch(limit=100), user=user)) </code></pre> <p>And later in the templa...
<p>The high CPU usage will be due to fetching 100 entities per request. You have several options here:</p> <ul> <li>Using Profile.all().fetch(100) will be ever so slightly faster, and easier to read besides.</li> <li>Remove any extraneous properties from the Profile model. There's significant per-property overhead des...
<p>It depends where you get the warning of too much CPU.</p> <p>Is it in the dashboard, it probably is a lot of datastore CPU, no need for optimization.</p> <p>If the request takes more then 10 sec you need to optimize.</p> <p>If you get regular Log warnings that a certain request is x.xx over CPU limit it means you...
38,160
<p>I'm writing an image processing program to perform real time processing of video frames. It's in C# using the Emgu.CV library (C#) that wraps the OpenCV library dll (unmanaged C++). Now I have to write my own special algorithm and it needs to be as fast as possible. </p> <p>Which will be a faster implementation of ...
<p><i>it needs to be as fast as possible</i></p> <p>Then you're asking the wrong question.</p> <p>Code it in assembler, with different versions for each significant architecture variant you support.</p> <p>Use as a guide the output from a good C++ compiler with optimisation, because it probably knows some tricks tha...
<p>Running on the CPU is always going to be faster than running on a VM on the CPU. I can't believe people are trying to argue otherwise.</p> <p>For example, we have some fairly heavy image processing work on our web server that's queued up. Initially to get it working, we used PHP's GD functions.</p> <p>They were sl...
35,489
<p>I am encountering very infrequent yet annoying SQL deadlocks on a .NET 2.0 webapp running on top of MS SQL Server 2005. In the past, we have been dealing with the SQL deadlocks in the very empirical way - basically tweaking the queries until it work.</p> <p>Yet, I found this approach very unsatisfactory: time consu...
<p>Writing deadlock-proof code is really hard. Even when you access the tables in the same order you may still get deadlocks [1]. I wrote <a href="http://samsaffron.com/archive/2008/08/27/Deadlocked+" rel="noreferrer">a post on my blog</a> that elaborates through some approaches that will help you avoid and resolve dea...
<p>Quick answer is no, there is no guaranteed technique.</p> <p>I don't see how you can make any application deadlock proof in general as a design principle if it has any non-trivial throughput. If you pre-emptively lock all the resources you could potentially need in a process in the same order even if you don't end...
13,695
<p>Do you have any examples of real life applications of mutation testing? Does it work better than simple test coverage tools? Or is it useless?</p> <p>What are the advantages/disadvantages of mutation testing in the real world?</p>
<p>I looked at mutation test some time ago as a method for checking the efficacy of my automated regression testing scripts. Basically, a number of these scripts had missing checkpoints, so while they were exercising the application being tested correctly, they weren't verifying the results against the baseline data. ...
<p>Coverage vs mutation testing. An old question, but I recently came across a recent blog on the topic. Pretty opinionated. But the differences between coverage and mutation testing is clearly articulated.</p> <p><a href="https://pedrorijo.com/blog/intro-mutation/" rel="nofollow noreferrer">https://pedrorijo.com/blog...
30,048
<p>Suppose I have #define foo in various header files. It may expand to some different things. I would like to know (when compiling a .cc file) when a #define is encountered, to what it will expand, it which file it is and where it got included from.</p> <p>Is it possible? If not, are there any partial solutions that ...
<p>Use -E :</p> <pre><code># shows preprocessed source with cpp internals removed g++ -E -P file.cc # shows preprocessed source kept with macros and include directives g++ -E -dD -dI -P file.cc </code></pre> <p>The internals above are line-markers for gcc which are kinda confusing when you read the output. <code>-...
<p>Use #warning. It's described <a href="http://gcc.gnu.org/onlinedocs/gcc-3.1.1/cpp/Diagnostics.html#Diagnostics" rel="nofollow noreferrer">here</a>.</p>
37,103
<p>Is there any way to redefine a class or some of its methods without using typical inheritance? For example:</p> <pre><code>class third_party_library { function buggy_function() { return 'bad result'; } function other_functions(){ return 'blah'; } } </code></pre> <p>What can I do to re...
<p>It's called <a href="http://en.wikipedia.org/wiki/Monkey_patch" rel="noreferrer">monkey patching</a>. But, PHP doesn't have native support for it.</p> <p>Though, as others have also pointed out, the <a href="http://docs.php.net/runkit" rel="noreferrer">runkit library</a> is available for adding support to the langu...
<p>There's alway extending the class with a new, proper, method and calling that class instead of the buggy one.</p> <pre><code>class my_better_class Extends some_buggy_class { function non_buggy_function() { return 'good result'; } } </code></pre> <p>(Sorry for the crappy formatting)</p>
16,574
<p>I love vim and the speed it gives me. But sometimes, my fingers are too speedy and I find myself typing <code>:WQ</code> instead of <code>:wq</code>. (On a German keyboard, you have to press <kbd>Shift</kbd> to get the colon <code>:</code>.) Vim will then complain that <code>WQ</code> is <code>Not an editor command<...
<p>Try </p> <pre><code> :command WQ wq :command Wq wq :command W w :command Q q </code></pre> <p>This way you can define your own commands. See <code>:help command</code> for more information.</p>
<p>And you can use </p> <pre><code>:cmap WQ wq </code></pre> <p>as well. E.g. I have </p> <pre><code>cmap h tab help </code></pre> <p>in my <code>.vimrc</code> which means opening help pages in a new tab.</p> <p><a href="https://stackoverflow.com/questions/117150/can-i-re-map-commands-in-vim/119821#comment18676583...
14,271
<p>Does anyone know where I can get some samples/resources on 4GL language for Progress Database OTHER THAN THE PROGRESS DATABASE WEBSITE?</p> <p>Thanks</p>
<p>Here's a copy of the 4GL handbook from the Progress website.</p> <p><a href="http://www.progress.com/progress/products/documentation/docs/dvhbk/dvhbk.pdf" rel="nofollow noreferrer">http://www.progress.com/progress/products/documentation/docs/dvhbk/dvhbk.pdf</a></p>
<p>What kind of samples do you exactly need? If you want to improve 4GL skills, then 4GL Handbook is a very nice way to get known to the language, it comes with Progress Documentation.</p>
49,747
<p>I am using a <B> FTPS </b> connection to send a text file <i>[this file will contain EDI(Electronic Data Interchange) information]</i>to a mailbox INOVIS.I have configured the system to open a FTPS connection and using the PUT command I write the file to a folder on the FTP server. The problem is: what mode of file ...
<p>Many of the other answers to this question are a collection of nearly correct to outright wrong information.</p> <p>ASCII mode means that the file should be converted to canonical text form on the wire. Among other things this means:</p> <ul> <li>NVT-ASCII character set. Even if the original file is in some othe...
<p>If you want an exact copy the data use binary mode - using ascii mode will assume the data is 7bit text (chars 0-127) and truncate any data outside of this range. Dates back to arcane 7bit networking days where ascii mode could save you time.</p> <p>In a globalized environment that we live in - such that it is qui...
10,715
<p>How do I setup Public-Key Authentication for SSH?</p>
<p>If you have SSH installed, you should be able to run..</p> <pre><code>ssh-keygen </code></pre> <p>Then go through the steps, you'll have two files, <code>id_rsa</code> and <code>id_rsa.pub</code> (the first is your private key, the second is your public key - the one you copy to remote machines)</p> <p>Then, conn...
<p>For windows <a href="http://the.earth.li/~sgtatham/putty/0.53b/htmldoc/Chapter8.html" rel="noreferrer">this</a> is a good introduction and guide</p> <p>Here are some good ssh-agents for systems other than linux.</p> <ul> <li>Windows - <a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html" rel="n...
2,889
<p>I want to make a very simple event bus which will allow any client to subscribe to a particular type of event and when any publisher pushes an event on the bus using <code>EventBus.PushEvent()</code> method only the clients that subscribed to that particular event type will get the event.</p> <p>I am using C# and ....
<p>Tiny Messenger is a good choice, I've been using it in a live project for 2.5 years now. Some code examples from the Wiki (link below):</p> <p><strong>Publishing</strong></p> <pre><code>messageHub.Publish(new MyMessage()); </code></pre> <p><strong>Subscribing</strong></p> <pre><code>messageHub.Subscribe&lt;MyMe...
<p>You should check out episode 3 in <a href="http://ayende.com/hibernating-rhinos.aspx" rel="nofollow noreferrer">Hibernating Rhinos</a>, Ayende's screen casts series - "Implementing the event broker".</p> <p>It shows how you can implement a very simple event broker using Windsor to wire things up. Source code is inc...
48,075
<p>I am reading through the Public Review Draft of the <a href="http://docs.jboss.org/webbeans/spec/PDR/html/" rel="nofollow noreferrer">Web Beans specification</a> (JSR-299) and I am wondering why it is so 'tightly coupled' to JSF?</p> <p>Especially the Conversation Context seems only be specified for JSF.</p> <p>I ...
<p>You'll find more answers in my <a href="https://stackoverflow.com/questions/91791/grep-and-sed-equivalent-for-xml-command-line-processing" title="Grep and Sed Equivalent for XML">previous question</a>. <a href="http://xmlstar.sourceforge.net/" rel="nofollow noreferrer" title="XMLStarlet tool collection">xmlstar</a> ...
<p>NAnt, the .NET cousin of Ant, has <a href="http://nant.sourceforge.net/release/latest/help/tasks/xmlpeek.html" rel="nofollow noreferrer">XmlPeek</a> and <a href="http://nant.sourceforge.net/release/latest/help/tasks/xmlpoke.html" rel="nofollow noreferrer">XmlPoke</a> tasks that I've used to very good effect in editi...
40,883
<p>I'm playing with Java for the first time and need to be able to replace some words in a template. example template - </p> <p>"Dear PUT_THEIR_NAME_HERE,</p> <p>I'm contacting you ..... bla bla bla</p> <p>Regards,</p> <p>PUT_COMPANY_NAME_HERE"</p> <p>What's the simplest way (preferably using the standard library)...
<p>You're looking for java.text.MessageFormat:</p> <p>Here are some examples of usage (from JavaDoc):</p> <pre><code> Object[] arguments = { new Integer(7), new Date(System.currentTimeMillis()), "a disturbance in the Force" }; String result = MessageFormat.format( "At {1,time} on {1,date}, ther...
<p>Well, the simplest way would be to read the file into a string, do a replaceAll (once for each word you want to replace) and then write the result out to a new file. This isn't the most efficient approach but it works quite well for simple tasks.</p>
41,775
<p>I've long used cygwin's nm command for all my .lib symbol debugging needs, but recently I thought about referring to it in a SO answer and realized that most Windows developers don't have cygwin installed.</p> <p>So what is the Microsoft equivalent to nm, i.e., what command will list the symbols exported by a .lib ...
<p>Try dumpbin.exe.</p> <p><a href="http://msdn.microsoft.com/en-us/library/c1h23y6c(v=vs.120).aspx" rel="noreferrer">MSDN dumpbin.exe reference</a>.</p>
<ol> <li><p>Run <code>vcvarsall.bat</code> which might present in your installed path of Microsoft Visual Studio. This sets environmental variable required for <code>dumpbin.exe</code>.</p> <p><code>D:&gt;&quot;D:\Program Files (x86)\Microsoft Visual Studio 10.0\vcvarsall.bat&quot; x86</code></p> </li> <li><p>Then use ...
49,105
<p>I want to add the selected item from the <code>TreeView</code> to the <code>ListBox</code> control using <code>DataBinding</code> (If it can work with <code>DataBinding</code>). </p> <pre><code>&lt;TreeView HorizontalAlignment="Left" Margin="30,32,0,83" Name="treeView1" Width="133" ...
<p>You can bind to an element using ElementName, so if you wanted to bind the selected tree item to the ItemsSource of a ListBox:</p> <pre><code>ItemsSource="{Binding SelectedItem, ElementName=treeView1}" </code></pre>
<p>I'm pretty sure it is possible, since WPF is really flexible with data binding, but I haven't done that specific scenario yet.</p> <p>I've been following a <a href="http://blogs.msdn.com/wpfsdk/archive/2006/10/19/wpf-basic-data-binding-faq.aspx" rel="nofollow noreferrer">WPF Databinding FAQ</a> from the MSDN blogs ...
7,806
<p>Does anyone know where to find an explanation to the warnings in VS 2005 Code Analyses tool. I would like some documentation, explaining why it creates the warnings it does and what course of action one should take.</p>
<p>You should be able to right click the warnings it gives you in the Error List and view Error Help, right from within Visual Studio. There's also a <a href="http://msdn.microsoft.com/en-us/library/ee1hzekz(VS.80).aspx" rel="nofollow noreferrer">section of MSDN articles</a>, if you'd prefer.</p>
<p>I'm not sure which codeanalysis tool you are referring to.</p> <p>If you mean FxCop, look here: <a href="http://msdn.microsoft.com/en-us/library/bb429379(VS.80).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/bb429379(VS.80).aspx</a></p> <p>If you mean StyleCop, see the download here: <a hr...
15,001
<p>I am using VMWare tools for Ubuntu Hardy, but for some reason <code>vmware-install.pl</code> finds fault with my LINUX headers. The error message says that the "address space size" doesn't match.</p> <p>To try and remediate, I have resorted to <code>vmware-any-any-update117</code>, and am now getting the following ...
<p>This error ofter occurs because incompatibility of VMWare Tools Version and recent Kernels (You can test it using older Kernels). Sometimes you can fix some thing with patches all over the internet, but I prefer to downgrade my kernel or don't using latest distribution's version in VMWare. It can be really annoying....
<p>I've heard a lot of good things about VirtualBox from Sun. If you get fed up with VMWare, it's worth a look.</p>
5,118
<p>I need to do a union of two tables using NHibernate and HQL. I have found very little help online, and I want to know if it is possible and if so how?</p>
<p>Found my answer:</p> <p><a href="http://www.hibernate.org/117.html#A21" rel="nofollow noreferrer">http://www.hibernate.org/117.html#A21</a></p> <p>It doesn't currently support union or intersect.</p>
<p>I don't believe HQL supports unions, but you can write your own record transformer and author the sql by hand.</p>
30,686
<p>I have a situation where I am using wpf data binding and validation using the ExceptionValidationRule.</p> <p>Another part of the solution invovles collapsing some panels and showing others.</p> <p>If a validation exception is set - i.e. the UI is showing a red border around the UI element with the validation prob...
<p>If I remember correctly, this is a known issue. We re-templated textbox to include the following:</p> <pre><code>&lt;Setter Property="Validation.ErrorTemplate"&gt; &lt;Setter.Value&gt; &lt;ControlTemplate&gt; &lt;ControlTemplate.Resources&gt; &lt;BooleanToVisibilityConverter...
<p>I have an answer to the problem myself which is to change my button click event which changes the visibility of the panels. This would change to something like this:</p> <pre><code>private void Button_Click(object sender, RoutedEventArgs e) { if (panel1.Visibility == Visibility.Collapsed) { panel1.Visib...
41,585
<p>I have some simple .doc files I made in Word 2007 where I changed the text color and used highlights to compare some similar texts. What I'd like to do is change any instances of green text or gray highlighting to different respective colors for each.</p> <p>I'm sure there is a simple way to do this with VBA but an...
<p>This is not from 2007, but the idea should suit. This example changes any current highlight to the new default highlight (wdBrightGreen) and any green text to red.</p> <pre><code>Sub ChangeColor Options.DefaultHighlightColorIndex = wdBrightGreen Selection.Find.ClearFormatting Selection.Find.Highlight = Tru...
<p>This should work for your purpose:</p> <pre><code>Sub RehiliteAll() Const YOUR_REQUIRED_COLOR_IDX As Integer = 6 'RED' Dim doc As Range Set doc = ActiveDocument.Range With doc.Find .ClearFormatting 'resets default search options' .Highlight = True .Wrap = wdFindStop ...
28,453
<p>Has anyone seen this error before?</p> <p>An error occurred creating the configuration section handler for cachingConfiguration: Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Caching, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located ...
<p>That means it can't find the file. So you either need to put it into the GAC or the bin folder so that the assembly can be loaded.</p>
<p>This was the deal, when referencing dlls in the C:\EntLib4Src\bin, they are signed and could only be configured by the EntLibConfig.exe found in that same folder and not the one from "Start>Programs>Microsoft Patterns...>Ent Wasn't that tricky?</p>
22,833
<p>One of the tenants of DDD is to not allow your objects to enter an invalid state. To me this means there shouldn't be a public parameterless constructor because that's going to be an object in an invalid state 99% of the time. </p> <p>Is this a good way to move forward? It becomes a huge PITA when you just want to ...
<p>Good question. I have DDD nazi friends who say parameterless constructors are the devil. I agree with that to a certain extent, but I also feel it depends on the class's purpose.</p>
<p>It all depends on who calls the constructor. If only your factories do, then there isn't really a problem, because your factory methods become the "domain-side" constructors and the real constructors are an implementation detail.</p>
39,850
<p>I'm writing a C# wrapper for a third-party native library, which we have as a DLL. I would like to be able to distribute a single DLL for the new assembly. Is it possible for me to embed the win32 DLL in my .NET DLL, and still make calls into it using P/Invoke? If so, how?</p>
<p>I've never done it but I know of an opensource project that does this. They embed the native SQLite3 code into the managed SQLite assembly using their own tool called <a href="http://www.koushikdutta.com/2008/09/day-6-mergebin-combine-your-unmanaged.html" rel="nofollow noreferrer">mergebin</a>.</p> <p>Go and take a...
<p>I don't think you can do it directly, but it's possible to extract it at runtime to some temporary location and make call to that copy.</p>
48,051
<p>I'm attempting to utilize <a href="http://en.wikipedia.org/wiki/VBScript" rel="nofollow noreferrer">VBScript</a> to connect pull the <code>physicalDeliveryOfficeName</code> attribute in <a href="http://en.wikipedia.org/wiki/Active_Directory" rel="nofollow noreferrer">Active Directory</a> by providing the email addre...
<p>I ended up writing the following: </p> <pre><code>Function getOffice (strname, uname) strEmail = uname WScript.Echo "email: " &amp; strEmail Dim objRoot : Set objRoot = GetObject("LDAP://RootDSE") Dim objDomain : Set objDomain = GetObject("LDAP://" &amp; objRoot.Get("defaultNamingContext")) Dim cn : Set cn = Cre...
<p>If using an <a href="http://en.wikipedia.org/wiki/Lightweight_Directory_Access_Protocol" rel="nofollow noreferrer">LDAP</a> query (not sure if you need the server name in there in your case):</p> <pre><code>&lt;LDAP://SERVERNAME/DC=bobdom,DC=net&gt;;(&amp;(objectClass=user)(mail=mike.spencer@kenblanchard.com)); </c...
35,797
<p>Kinda long title, but anyways...</p> <p>I've been looking at these examples, specifically on the parts on writing and reading the size of the message to the byte streams<br> <a href="http://doc.trolltech.com/4.4/network-fortuneclient-client-cpp.html" rel="nofollow noreferrer">http://doc.trolltech.com/4.4/network-fo...
<p>Generally you would send the length first. Both ends should agree on what a length looks like - for example, you might be happy to use fixed 4-byte length prefix as binary:</p> <pre><code> byte[] data = ... int len = data.Length; byte[] prefix = Bitconverter.GetBytes(len); stream.Write(prefix, 0, prefix.Leng...
<p>When you say, "This doesn't work very well at all", I'd be curious about specifically what doesn't work. Are they .NET applications on both ends of the socket? If so, ignore this answer. If not, then could the problem be the byte ordering of the integer? A little endian vs big endian issue? This thread here d...
24,948
<p>Would this be right??</p> <ol> <li><p>Black Box</p> <p>1.1 Functional</p> <pre><code> 1.1.1 Equivalence 1.1.2 BVA 1.1.3 Use case 1.1.4 Regression 1.1.5 UAT </code></pre> <p>1.2 Non Functional</p> <pre><code> 1.2.1 Testing the System Design </code></pre></li> <li><p>White box</p> <p>2.1. F...
<p>You might also consider the case when several programs depending one on another are developed simultaneously. You have then to take into account the <strong><em>applicative architecture</em></strong> which groups all those applications into several <em>functional domains</em></p> <p>So, for instance, a financial ap...
<p>I think that your categorisation is a good first step.</p> <p>Separation between black box and white box (some prefer glass box) testing focuses on whether you have access only to the specification or more (design, source code).</p> <p>I would add a second separation between functional and structural testing, whic...
23,559
<p>I am using ActiveState Perl 5.6 on a Windows 2003 Server, and am having some memory leak issues. Are there any good tools (or even bad tools which would give a clue) which I would be able to use to help find them.</p>
<p>All perl program memory leaks will either be an XS holding onto a reference, or a circular data structure. <a href="http://search.cpan.org/dist/Devel-Cycle/" rel="noreferrer">Devel::Cycle</a> is a great tool for finding circular references, if you know what structures are likely to contain the loops. <a href="http:/...
<p>Since it's not been mentioned yet, <a href="https://metacpan.org/module/Devel::Size" rel="nofollow">Devel::Size</a> will report the size of a data structure. There's no other information given and the rules it uses to determine the 'boundary' of your data structure are opaque. For simple structures this isn't a prob...
37,747
<p>I'm trying to produce just the day number in a WPF text block, without leading zeroes and without extra space padding (which throws off the layout). The first produces the day number with a space, the second produces the entire date. According to the <a href="http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx" re...
<p>See <a href="http://msdn.microsoft.com/en-us/library/system.globalization.datetimeformatinfo.aspx" rel="nofollow noreferrer">here</a></p> <blockquote> <p>d, %d</p> <p>The day of the month. Single-digit days do not have a leading zero. The application specifies "%d" if the format pattern is not combined with ...
<p>The <code>{0:d}</code> format uses the patterns defined in the <a href="http://msdn.microsoft.com/en-us/library/az4se3k1.aspx" rel="nofollow noreferrer">Standard Date and Time Format Strings document of MSDN</a>. 'd' translates to the short date pattern, 'D' to the long date pattern, and so on and so forth.</p> <p>...
19,976
<p>I'm currently monitoring a large network with Hobbit and have been tasked with lowering the amount of false (or at least irrelevant) alarms. At the top of my list are the tests "http" and "conn", initiated by bbtest-net. This command checks ping, ssh, etc, and if for instance a ping times out, it immediately sets th...
<p>First, this is a programming site so you won't get many answers.</p> <p>But.... but ...</p> <p>If your server times out, isn't that a problem?</p> <p>Sounds to me like Hobbit does the job it is designed for: Telling you that you have something that needs your attention.</p> <p>Fix the timeout problem, and your l...
<p>You can use:</p> <pre><code>&lt;ip&gt; &lt;hostname&gt; # noconn </code></pre> <p>In bb-hosts for a server that doesn't respond to ping. Then test its aliveness through a service. </p>
38,302
<p>If so, how do you deal with things that just don't "feel" right such as:</p> <ul> <li>not writing unit tests</li> <li>not having a continuous build</li> <li>not refactoring</li> <li>not having a team coding standard</li> <li>not pair programming</li> <li>not doing iterations</li> <li>no daily standups</li> <li>no r...
<p>Actually, I'm a Waterfall developer in an Agile organization. </p> <p>Things that don't "feel" right to me include:</p> <ul> <li>Starting work on a project with barely any idea what it should do.</li> <li>Documenting the processes, but not the products; being unable to get information without having to go talk to...
<p>Firstly, Agile methodologies emphasize on these practices but they have not introduced them. They have been there in software development process well before Agile came in. So simply saying that if you are not using Scrum/XP/RUP then you are not following these practices is plain wrong. If you are a professional sof...
29,199
<p>How do get the startup path ( system.windows.forms.application.StartupPath ) of my exe without adding a reference to system.windows.forms?</p>
<p>You could try</p> <pre><code>System.AppDomain.CurrentDomain.BaseDirectory </code></pre> <p>which would work for most cases. </p>
<p>EDIT: @KiwiBastard's answer is the correct method:</p> <pre><code>System.AppDomain.CurrentDomain.BaseDirectory </code></pre> <hr> <p>Add a reference to <code>System.Reflection</code> and use</p> <pre><code>Assembly.GetExecutingAssembly().Location </code></pre> <p>EDIT: Depending where you intend getting the sta...
38,534
<p>I have been trying to learn more about lambda expressions lately, and thought of a interesting exercise...</p> <p>is there a way to simplify a c++ integration function like this:</p> <pre><code>// Integral Function double integrate(double a, double b, double (*f)(double)) { double sum = 0.0; // Evaluate i...
<p>What about this:</p> <pre><code>public double Integrate(double a,double b, Func&lt;double, double&gt; f) { double sum = 0.0; for (int n = 0; n &lt;= 100; ++n) { double x = a + n * (b - a) / 100.0; sum += f(x) * (b - a) / 101.0; } return sum; } </code></pre> <p>Test:</p> <pre><...
<p>The real power comes, as stated, when calling it. For example, in C#</p> <pre><code> static double Integrate(double a, double b, Func&lt;double, double&gt; func) { double sum = 0.0; // Evaluate integral{a,b} f(x) dx for(int n = 0 ; n &lt;= 100; ++n) { double x = a...
36,676
<p>In C# if I want to convert a double (1.71472) to an int then I get the answer 2. If I do this in Java using intValue() method, I get 1 as the answer.</p> <p>Does Java round down on conversions?</p> <p>Why do the Java API docs have such scant information about their classes i.e. </p> <blockquote> <p>Returns the...
<p>Java rounds toward zero when narrowing from a floating point to an integer type&mdash;and so does C#, when you use the casting conversion. It's <code>Convert.ToInt32</code> that rounds:</p> <pre><code>double d = 1.71472; int x = (int) d; // x = 1 int y = Convert.ToInt32(d); // y = 2 </code></pre> <p>Details can be...
<p>Jon Skeet is correct, but something else to watch for is that .NET uses <a href="http://blogs.msdn.com/ericlippert/archive/2003/09/26/bankers-rounding.aspx" rel="nofollow noreferrer">Banker's Rounding</a> as its rounding algorithm. When you're halfway between round towards the even integer.</p>
38,456
<p>Does anyone have a good technique (or tutorial) to implement rulers within a C# Windows Forms application? I want to display an image while showing rulers that indicate your mouse position to allow a more accurate positioning of the cursor. Just like the image below:</p> <p><img src="https://i.stack.imgur.com/QfIIi...
<p>I would build a custom control to do this in both X and Y location and use two controls.</p> <p>The control would have to override <code>Paint()</code> and use GDI methods to display the tick marks, it would then capture mouse events and update locations appropriately.</p>
<p>This is the best article I've found and used on the matter: <a href="http://www.codeproject.com/KB/miscctrl/ruler.aspx" rel="nofollow noreferrer">http://www.codeproject.com/KB/miscctrl/ruler.aspx</a></p>
18,076
<p>I recently asked this question: <a href="https://stackoverflow.com/questions/368521/api-design-expose-xml-or-objects" title="Expose XML or Objects">Expose XML or Objects</a> - thanks all for the responses.</p> <p>One point to clarify.</p> <ul> <li>The API will always be accessed remotely (i.e. as a service), most ...
<ul> <li>Objects can perform better (thinking binary serialization here). </li> <li>Objects can have stronger simple type validations. </li> <li>Objects allow you to put the validation and business rules closer to the data structure definition. </li> <li>Objects by their nature allow you to write simpler business ru...
<p>If you're looking for an argument in favour of XML (not that I am particularly in favour of XML) are:</p> <ul> <li><p>Exposing the XML and providing an XSD is self explanatory when it comes to data. You can pass off all the data in that form, it's self documenting and can be validated reasonably simply.</p></li> <...
49,149
<p>Below is what I'm trying to achieve. The problem is "errors" is not defined. If I remove my match logic, the errors are displayed on the web page. Is there anyway of evaluating the text the error contains?</p> <pre><code>&lt;logic:messagesPresent&gt; &lt;tr&gt; &lt;td class="errorcicon"&gt;&lt;img src="...
<pre><code>$(this).contents('img.expander') </code></pre> <p>This is what you want. It will select all of the nodes that are children of your list. In your case, all of your images are nested inside of the list element, so this will filter out only what you want.</p>
<p>Have you tried the .siblings() method?</p> <pre><code>$(this).siblings('img.expander').attr('src','img/content/info-close.gif'); </code></pre>
34,323
<p>In a one-to-many relationship what's the best way to handle data so it's flexible enough for the user to save the slave data before he saves the master table data.</p> <ul> <li>reserving the row ID of the master so the I can save de slave data with the reserved master id</li> <li>save slave data in a temporary tabl...
<p>Are your id's autogenerated? </p> <p>You have several choices all with possible problems.</p> <p>First don't define a FK relationship. Now how do you account for records in a partial state and those who never get married up to the real record? And how do you intend to marry up the records when the main record is i...
<p>Why can't you create the master row and flag it as incomplete?</p>
44,401
<p>So, what is the best way to prevent an XSRF attack for a GAE application? Imagine the following:</p> <ol> <li>Anyone can see a user's public object, and the db.Model id is used in the request to figure out which object to show. Malicious user now has the id.</li> <li>Malicious user creates their own object and ch...
<p>When you generate the page that lets the user delete an object, generate a random token and include it in a hidden form field. Also set a HTTP-only cookie with that value. When you receive a delete request, check that the random token from the form and the value from the cookie match.</p> <p>Your random token shoul...
<p>In server's response displaying the form create a magic hash (based on client ip + date/time + random salt, whatever). Put it into a cookie and store somewhere on the server. During submit action handling check the cookie hash against the database entry.</p> <p>If there's no such hash or it's different, reject the ...
24,184
<p>Jeff has previously blogged about <a href="https://blog.stackoverflow.com/2008/07/easy-background-tasks-in-aspnet/">using the cache</a> to perform &quot;out of band&quot; processing on his websites, however I was wondering what other techniques people are using to process these sorts of tasks?</p>
<p>Years ago, I saw Rob Howard describe a way to use an HttpModule to process tasks in the background. It doesn't seem as slick as using the Cache, but it might be better for certain circumstances.</p> <p><strong><a href="http://blogs.telerik.com/KevinBabcock/Posts/08-07-24/Using_an_HttpModule_to_Run_a_Background_Serv...
<p>Scheduled tasks, or cron jobs.</p>
6,441
<p>We created a tool which converts a language called P2, a language similar to assembly which I think exists only in Japan, to C#. There are at least a hundred modules written in P2 and we want to verify if the conversion to C# is right? How can we test this?</p>
<p>You don't test the converter, you test the final code. </p> <p>If the code doesn't compile, clearly your converter is failing. If the code compiles and your functionality tests fail, then you can tweak the code so that it passes the test. If you are fairly successful you should see that you only need to fix the mod...
<p>Short of a formal mathematical proof (which I imagine would be difficult), the proof of the pudding is in the unit tests. You have to find a way to wrap the converted C# snippets, compile the and run them under a similar environment, then compare the output against the original. Unless you're rigorous in your testin...
3,808
<p>I have written a game that uses GLUT, OpenGL and FMOD. The problem is that the binary won't run, unless Visual Studio 2008 is installed on the computer.</p> <p>Why is this?</p>
<p>Most likely you're linking with DLL versions of the C/C++ runtime. Go to project properties -> C++ -> Code Generation, and set Runtime Library to <em>not</em> be one of "DLL" kinds.</p> <p>Alternatively, you can link to DLL runtimes, but then you have to redistribute the runtime with your application.</p> <p>MSDN ...
<p>Do you have dependencies on debug libraries?</p>
45,411
<p>I'm wondering if it is possible to add methods in main program to an existing class defined in header file. For example: There is <code>class CFun</code> defined in file <code>CFun.hpp</code>, but in our <code>party.cpp</code> we want to add a method <code>void hello() {cout &lt;&lt; "hello" &lt;&lt; endl;};</code>w...
<p>No, but you could add a method that takes a reference/pointer to a CFun class - you just won't have access to private data:</p> <pre><code>void Hello(CFun &amp;fun) { cout &lt;&lt; "hello" &lt;&lt; endl; } </code></pre> <p>This is probably the best you'll be able to do. As pointed out by litb - this function ...
<p>Not to my knowledge. Although, you could do some kind of jury-rigging and make a namespace-y solution.</p>
30,898
<p>I am writing a DDL script to drop a number of tables but need to identify all dependencies for those tables first. Those dependencies include foreign key constraints, stored procedures, views, etc. Preferably, I want to programmatically script out dropping those dependencies using the system tables/views before drop...
<p>This is extremely messy to write from scratch. Have you considered a 3rd party tool like <a href="http://www.red-gate.com/products/SQL_Dependency_Tracker/index.htm" rel="nofollow noreferrer" title="Red-Gate SQL Dependency Tracker">Red-Gate SQL Dependency Tracker</a>?</p>
<p>You can use the sp_depends stored procedure to do this:</p> <p><code>USE AdventureWorks GO EXEC sp_depends @objname = N'Sales.Customer' ;</code></p> <p><a href="http://msdn.microsoft.com/en-us/library/ms189487(SQL.90).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms189487(SQL.90).aspx</a>...
7,648
<p>I have a library that reads/writes to a USB-device using CreateFile() API. The device happens to implement the HID-device profile, such that it's compatible with Microsoft's HID class driver.</p> <p>Some other application installed on the system is opening the device in read/write mode with no share mode. Which pre...
<p>Have you tried the tool called <a href="http://technet.microsoft.com/en-us/sysinternals/bb896655.aspx" rel="nofollow noreferrer">handle</a> from sysinternals?</p> <p>Anyway, neither windows does this (display the name of the application that locked the device): when you try to eject an USB device, Windows just says...
<p>Cool - I'll try those options, as they're probably better defaults given my intentions. Unfortunately, I know my device is there and I'll eventually need read/write access later on (once I inspect the descriptors and have verifed it is infact my device).</p> <p>Which means that my real goal IS to know what's using i...
4,319
<p><a href="http://tinlizzie.org/ometa/" rel="noreferrer">Ometa</a> is "a new object-oriented language for pattern matching." I've encountered pattern matching in languages like Oz tools to parse grammars like Lexx/Yacc or Pyparsing before. Despite looking at example code, reading discussions, and talking to a friend,...
<p>Also, most important to me, the Squeak port of Ometa allows for left-recursive rules.</p> <p>From its PEG heritage it gets backtracking and unlimited lookahead. Memoization of previous parse results allows for linear parse times (nearly all the time (*)).</p> <p>Higher-order productions allow one to easily refacto...
<p>It's a metalanguage, from what I can tell. You can create new language constructs, and create DSLs; but the most compelling thing is that you can subclass from existing parsers to extend a language. That's what I can remember about it, anyway.</p> <p>I found this to be interesting: <a href="http://www.moserware.com...
13,194
<p>A VBScript cannot edit the registry by default on Vista. How do I get elevation (even if the user has to do something when they run the script) so that the script can edit the registry?</p> <p>The error is:</p> <pre><code>--------------------------- Windows Script Host --------------------------- Script: blah bla...
<p>My understanding was that you could edit HKCU as a normal user, but the others were restricted. I could be wrong. Regardless, there are a couple of example <a href="http://www.winhelponline.com/articles/185/1/VBScripts-and-UAC-elevation.html" rel="nofollow noreferrer">here</a> to do what you want to do.</p>
<p>To make it work with native VBScript, you will most likely need a code signing certificate and sign your script with that. More info is in that thread at <a href="http://www.tek-tips.com/viewthread.cfm?qid=1475626" rel="nofollow noreferrer">tek-tips.com</a>.</p> <p>You could try to write the intended changes to a ....
31,139
<p>Is there an similar property like System.getProperty("java.home") that will return the JDK directory instead of the JRE directory? I've looked <a href="https://docs.oracle.com/javase/1.5.0/docs/api/java/lang/System.html#getProperties()" rel="nofollow noreferrer">https://docs.oracle.com/javase/1.5.0/docs/api/java/lan...
<p>One route would be to set a system environment variable like "JAVA_HOME" and use that. </p> <p>It may not be the best solution, but it would work, and this is what other apps which require JDK rather than JRE (like CruiseControl) require you to do when you set them up.</p>
<p>An alternative is to define the path to the JDK via a properties file. This can be in addition to the System environment variable to allow an override. </p> <p>Depending on your use case, you could put this properties file in the home directory or package with your app.</p>
46,084
<p>Ok, I've seen a few posts that <em>mention</em> a few other posts about not using SP wikis because they suck.</p> <p>Since we are looking at doing our wiki <em>in</em> SP, I need to know why we shouldn't do it for a group of 6 automation-developers to document the steps in various automated processes and the change...
<p>The default wiki included with Sharepoint doesn't support common wiki features well at all. There is no way to edit a single section of a page, and no way to link directly to a particular section on another page. The backend is in HTML so you lose the ability to edit in plaintext using simple syntax. The diff fea...
<p>My company rolled out sharepoint recently, and I have to say my user experience was <strong><em>Very Bad</em></strong>. And I'm not just saying I was apprehensive to using it: I went in with an open mind and tried it, and many things just felt like they didn't really work right.</p> <p>The reasons Luke mentioned m...
3,258
<p>I went to all the documentation, also I went to the IRC channel (BTW a great community) and they told me that is not possible to create a model and limit choices in a field where the 'current user' is in a ForeignKey. I will try to explain this with an example:</p> <pre><code>class Project(models.Model): name = m...
<p>This limiting of choices to current user is a kind of validation that needs to happen dynamically in the request cycle, not in the static Model definition.</p> <p>In other words: at the point where you are creating an <em>instance</em> of this model you will be in a View and at that point you will have access to th...
<p>Hmmm, I don't fully understand your question. But if you can't do it when you declare the model maybe you can achieve the same thing with overriding methods of the class of objects where you "send" the user object, maybe start with the constructor.</p>
19,350
<p>I'm a bit stuck on this. Basically I want to do something like the following SQL query in LINQ to SQL:</p> <pre><code>SELECT f.* FROM Foo f WHERE f.FooId IN ( SELECT fb.FooId FROM FooBar fb WHERE fb.BarId = 1000 ) </code></pre> <p>Any help would be gratefully received.</p>
<p>Have a look at <a href="http://blog.wekeroad.com/2008/02/27/creating-in-queries-with-linq-to-sql" rel="noreferrer">this article</a>. Basically, if you want to get the equivalent of IN, you need to construct an inner query first, and then use the Contains() method. Here's my attempt at translating:</p> <pre><code>va...
<p>Try this</p> <pre><code>var fooids = from fb in foobar where fb.BarId=1000 select fb.fooID var ff = from f in foo where f.FooID = fooids select f </code></pre>
7,438
<p>I've got two tables:</p> <pre><code>TableA ------ ID, Name TableB ------ ID, SomeColumn, TableA_ID (FK for TableA) </code></pre> <p>The relationship is one row of <code>TableA</code> - many of <code>TableB</code>.</p> <p>Now, I want to see a result like this:</p> <pre><code>ID Name SomeColumn 1. A...
<h3>1. Create the UDF:</h3> <pre><code>CREATE FUNCTION CombineValues ( @FK_ID INT -- The foreign key from TableA which is used -- to fetch corresponding records ) RETURNS VARCHAR(8000) AS BEGIN DECLARE @SomeColumnList VARCHAR(8000); SELECT @SomeColumnList = COALESCE(@SomeColumnList + ', ', '')...
<p>Solution below:</p> <pre><code>SELECT GROUP_CONCAT(field_attr_best_weekday_value)as RAVI FROM content_field_attr_best_weekday LEFT JOIN content_type_attraction on content_field_attr_best_weekday.nid = content_type_attraction.nid GROUP BY content_field_attr_best_weekday.nid </code></pre> <p>Use this, you also c...
13,650
<p>I'm trying to write a simple routine where I pass it a URL and it goes and renders the content of the webresponse as a jpg. I found a solution somehwere in C# and ported it to vb.net, however when I run it, it throws an argumentexception "parameter is not valid" when trying to instantiate the image. Can someone ta...
<p>What are you trying to do?</p> <p>Are you trying convert a web page to JPEG? This will require a bit more code, as what your code is trying to do is to download an already existing image (such as a gif, png, or even another jpeg) and converts it to jpeg. You would need to have something render the HTML document, th...
<p>I know you're asking for VB, but here's some C# code that I use in a project of mine to capture local thumbnails from image URLs (asynchronously). I've tried to strip out all the project-specific stuff so it makes sense as a stand-alone example.</p> <pre><code>var wc = new WebClient(); wc.CachePolicy = new RequestC...
49,720
<p>We have a few SGI Onyx 350 and Orgin 350 systems running IRIX 6.5.x that we would like to install Subversion on. One of them will likely be used as a simple repository server running svnserve. The others will only need client installs.</p> <p>The Subversion webpage has links to unofficial binaries for many *NIX s...
<p>For a machine like yours, the source code build is probably the way to go(it's one of the advantages of having source). The dependencies aren't that bad. The dependencies are <a href="http://www.zlib.net/" rel="nofollow noreferrer">zlib</a>, the <a href="http://apr.apache.org" rel="nofollow noreferrer">Apache Port...
<p>The guy that maintains <a href="http://www.futuretech.blinkenlights.nl/sgi.html" rel="nofollow noreferrer">This website</a> sells secondhand SGI gear. He sells them with CD's of contributed software. Maybe he can do something for you.</p> <p>Also, <a href="http://www.nekochan.net/weblog/archives/irix-software/" r...
36,165
<p>I wouldn't dare do anything complex in a database without transactions. There is nearly always a simple to use in-built command. But when you start working with other persistent data you just don't get this simple to use transaction support. Some example are</p> <ul> <li>file systems</li> <li>web services (none tha...
<p>I must respectfully disagree: transactional systems are not automatically and exclusively database engines, quite the contrary...</p> <p>I have implemented an application transaction mechanism (in .NET) that is distinct from a database transaction. It is actually rather easy (a few hours work including a unit tes...
<p>I had the situation I needed to treat a filesystem and a database as one transactional unit.</p> <p>In my case I only needed to download a set of files into the filesystem. I did it by creating random directories each time, putting the data there, and storing the directory name in a database table. Therefore all my...
37,970
<p>There have been a few questions asked here about why you can't define static methods within interfaces, but none of them address a basic inconsistency: why can you define static fields and static inner types within an interface, but not static methods?</p> <p>Static inner types perhaps aren't a fair comparison, sin...
<p>An <a href="http://docs.google.com/Doc?docid=dfkwr6vq%5F30dtg2z9d8&amp;hl=en" rel="noreferrer">official proposal</a> has been made to allow static methods in interfaces in Java 7. This proposal is being made under <a href="http://blogs.oracle.com/darcy/entry/project_coin" rel="noreferrer">Project Coin</a>. </p> <p>...
<p>Only static final fields may be declared in an interface (much like methods, which are public even if you don't include the "public" keyword, static fields are "final" with or without the keyword).</p> <p>These are only values, and will be copied literally wherever they are used at compile time, so you never actual...
15,716
<p>What fonts do you use for programming, and for what language/IDE? I use <a href="http://www.microsoft.com/downloads/details.aspx?familyid=22e69ae4-7e40-4807-8a86-b3d36fab68d3&amp;displaylang=en" rel="nofollow noreferrer" title="Consolas">Consolas</a> for all my Visual Studio work, any other recommendations?</p>
<p>Either Consolas <a href="http://www.microsoft.com/downloads/details.aspx?familyid=22e69ae4-7e40-4807-8a86-b3d36fab68d3&amp;displaylang=en">(download)</a> or Andale Mono <a href="http://prdownloads.sourceforge.net/corefonts/andale32.exe?download">(download)</a>. I mostly use Andale Mono. I wrote an article about prog...
<p>Any sans-serif.</p>
2,672
<p>I'm storing all localizable strings in a <code>ResourceDictionary</code> (in <code>App.xaml</code>) and assign those via the <code>StaticResource</code> markup extension to <code>TextBlock.Text</code>, <code>Button.Content</code> etc.</p> <p>In Beta 2 and RC0, <em>sometimes</em> parsing the XAML in <code>Initialize...
<p>Parser, at least in beta 2, didnt like whitespace...</p> <p>For instance: </p> <pre><code>Text="{StaticResource bleh}" </code></pre> <p>worked</p> <p>however this:</p> <pre><code>Text = "{StaticResource bleh}" </code></pre> <p>bombed</p>
<p>Basically it means bad xaml somewhere in the code you can see the Line number and Position and see something is wrong .. I got the same error in my xaml Once corrected everything seems working </p>
20,732
<p>I have a Windows Form project that I've just started. On the form I have a listbox that I'm loading with Products. When someone double clicks a Product, I want it to raise a ProductChanged event. Other things in my project will subscribe to this event and update things like other parts of the GUI when the Product ch...
<p>The product changed is a UI event, it would make sense if its raised on the form, and the other UI elements suscribe to the event.</p>
<p>Depends on what your event signifies. If the intent is to notify subscribers that the Product object was modified, then it belongs to the Product class and should be fired by a code inside that class. If the intent is to notify that another Product object was selected, then it belongs to the view that manages the li...
17,378
<p>I am making a small <strong>C#</strong> application and would like to extract a <strong>tag cloud</strong> from a simple plain text. Is there a function that could do that for me?</p>
<p>Building a tag cloud is, as I see it, a two part process:</p> <p>First, you need to split and count your tokens. Depending on how the document is structured, as well as the language it is written in, this could be as easy as counting the space-separated words. However, this is a very naive approach, as words like t...
<p>The <a href="http://www.tansharp.com/tag-cloud.aspx" rel="nofollow">Zoomable TagCloud Generator</a> which extracts keywords from a given source (text file and other sources) and displays the TagCloud as Zooming User Interface (ZUI)</p>
46,218
<p>How to do svn update of multiple files located across different directories ? </p> <p>For committing multiple files from different directories, we can put them all up in a text file and give that file as an argument to svn commit and it will happily commit all those files. But <b>update</b> ?</p> <p><b>EDIT:</b> M...
<p>Given that there are valid reasons for selectively updating from a repository when there are a lot of downstream changes available, my question would be whether you're trying to do this on a UNIX/Linux/etc. system or Windows. If Windows, I don't know how to do an equivalent of the following:</p> <pre><code>svn upda...
<p>THe fact that you even want to do this suggests to me that you're perhaps not using subversion particularly sensibly.</p>
29,277
<p>I've got an ASP.NET 2.0 website that connects to a SQL database. I've upgraded the SQL server from 2000 to 2008 and since then, one page refuses to work. </p> <p>I've worked out the problem is that the call to SqlDataReader.HasRows is returning false even though the dataset is not empty and removing the check allow...
<p>Does the stored procedure work if you invoke it in directly, say in SSMS? I'd start by making sure that it does.</p>
<p>First, check the procedure as @tvanfosson says. Second, the check for HasRows() is actually unnecessary in the code snippet. </p>
23,988
<p>When I debug locally in fire fox 2.0x many times my page won't have the styles added properly or the page will not completely render (the end is seemingly cut off). Sometimes it takes multiple refreshes or shift-refreshes to fix this. Is this a common issue or is it just me? Any solutions?</p> <p>I want to add that...
<p>This could be a <strong>problem with IPv6 and DNS</strong> of the Firefox browser. This issue is known to <em>slow down</em> Firefox on localhost:SOMEPORT. The effect would be that some external files won't load (css, js etc.) resulting in a partially rendered page.</p> <p>You can solve this issue by simply deactiv...
<p>One thing to do would be to check the source of the page(s) in question. My guess would be that the local server that VS runs is not giving you the entire source of the page. One way to verify this would be to run exactly the same code in the debug environment, as well as from a "real" server like IIS 6. If the same...
22,261
<p>I'm trying to access the Reporting Services via Web Services in my Visual Studio 2008 Application. How/where can I find my WSDL? </p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms154052.aspx" rel="noreferrer">The following example shows the format of the URL to the Reporting Services management WSDL file:</a></p> <p><a href="http://server/reportserver/ReportService2005.asmx?wsdl" rel="noreferrer">http://server/reportserver/ReportService2005...
<p>See <a href="http://msdn.microsoft.com/en-us/library/ms169816.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms169816.aspx</a></p>
21,206
<p>I have the following unmanaged C++ code:</p> <pre><code>MessageBox( NULL, strMessage, "Cool Product", MB_RETRYCANCEL | MB_ICONEXCLAMATION); </code></pre> <p>I want to disable the RETRY button for 10 seconds (for example), then enable it.</p> <p>How can I do this?</p>
<p>Like <a href="https://stackoverflow.com/questions/176062/how-do-i-disable-and-then-enable-the-retry-button-in-a-messagebox-c#176082">@ffpf</a> says, you need to make your own dialog to do this, using MFC, ATL, raw Win32, etc.</p> <p>Then create a timer that would enable and disable the button.</p>
<p>With the standard MessageBox call, you can't. You'd need to implement your own MessageBox in order to do this.</p>
21,210
<p>Is '' a valid piece of XML? Can '' insert into oracle xblob column or XML column from MSSQL?</p>
<p>No. The <a href="http://www.w3.org/TR/REC-xml/#sec-well-formed" rel="noreferrer">spec</a> says a well-formed XML document satisfies:</p> <pre><code>document ::= prolog element Misc* </code></pre> <p>where</p> <pre><code>element ::= EmptyElemTag | STag content ETag </code></pre>
<p>It's not valid xml. Valid xml requires an xml declaration with encoding type and a root node. Whether or not Oracle or SQL Server will accept it anyway is something you can check for yourself.</p>
49,257
<p>Good morning,</p> <p>I am the developer of a medium sized PDA application that will be used out on the streets. The PDA will contain some vaguely sensitive data (names and addresses, etc). The encryption on the mobile database is already handled, however if someone got hold of the PDA whilst it was logged in they c...
<p>One possible solution is to rely on the PDA's entering power idle state. You can register a notification for this using OpenNETCF.WindowsCE.PowerManager.PowerIdle Event. In fact it is a good idea to take into account power management considerations. You can't expect your PDA to be in the same state all the time.</p>...
<p>Check this post out:</p> <p><a href="http://social.msdn.microsoft.com/Forums/en-US/netfxcompact/thread/906b016d-f1ee-4b3e-b3df-1e3a6fea282a/" rel="nofollow noreferrer">http://social.msdn.microsoft.com/Forums/en-US/netfxcompact/thread/906b016d-f1ee-4b3e-b3df-1e3a6fea282a/</a> </p> <p>I wrestled with the same proble...
45,445
<p>What is exactly the function of Python's Global Interpreter Lock? Do other languages that are compiled to bytecode employ a similar mechanism?</p>
<p>In general, for any thread safety problem you will need to protect your internal data structures with locks. This can be done with various levels of granularity.</p> <ul> <li><p>You can use fine-grained locking, where every separate structure has its own lock.</p></li> <li><p>You can use coarse-grained locking wher...
<p>Maybe <a href="http://www.artima.com/weblogs/viewpost.jsp?thread=214235" rel="nofollow noreferrer">this</a> article by the BDFL will help.</p>
33,312
<p>I've got a C++ Win32 application that has a number of threads that might be busy doing IO (HTTP calls, etc) when the user wants to shutdown the application. Currently, I play nicely and wait for all the threads to end before returning from <code>main</code>. Sometimes, this takes longer than I would like and indee...
<p>Use overlapped IO so that you're always in control of the threads that are dealing with your I/O and can always stop them at any point; you either have them waiting on an IOCP and can post an application level shutdown code to it, OR you can wait on the event in your OVERLAPPED structure AND wait on your 'all thread...
<p>Instruct the user to unplug the computer. Short of that, you have to abandon your asynchronous activities to the wind. Or is that HWIND? I can never remember in C++. Of course, you could take the middle road and quickly note in a text file or reg key what action was abandoned so that the next time the program runs i...
25,652
<p>Let's say I have a line of text like this</p> <pre><code>Small 0.0..20.0 0.00 1.49 25.71 41.05 12.31 0.00 80.56 </code></pre> <p>I want to capture the last six numbers and ignore the <em>Small</em> and the first two groups of numbers.</p> <p>For this exercise, let's ignore the fact that it migh...
<p>If you want to keep each match in a separate backreference, you have no choice but to "spell it out" - if you use repetition, you can either catch all six groups "as one" or only the last one, depending on where you put the capturing parentheses. So no, it's not possible to compact the regex and still keep all six i...
<p>For usability, you should use string substitution to build regex from composite parts. </p> <pre><code>$d = "[0-9.]+"; $s = ".*?"; $re = "^(Small)$s$d$s$d$s($d)$s($d)$s($d)$s($d)$s($d)$s($d)"; </code></pre> <p>At least then you can see the structure past the pattern, and changing one part changes them all. </p>...
37,409
<p>This is a question that was sparked by <a href="https://stackoverflow.com/users/3631/rob-walker">Rob Walker</a>'s answer <a href="https://stackoverflow.com/questions/36455/alignment-restrictions-for-mallocfree#36466">here</a>.</p> <p>Suppose I declare a class/struct like so:</p> <pre><code>struct { char A; ...
<p>C99 §6.7.2.1 clause 13 states:</p> <blockquote> <p>Within a structure object, the non-bit-field members and the units in which bit-fields reside have addresses that increase in the order in which they are declared.</p> </blockquote> <p>and goes on to say a bit more about padding and addresses. The C89 equi...
<p>While browsing the related topics at the right, I looked at <a href="https://stackoverflow.com/questions/127290/is-it-possible-to-subclass-a-c-struct-in-c-and-use-pointers-to-the-struct-in-c">this question</a>. I figure this may be an interesting corner case when thinking about these issues (unless it's more common...
35,556
<p>In VS2008, I have a web-site project. When I use find in files and search for a string, the find results window will list every occurence twice.</p> <p>What could be causing this?</p> <p>[EDIT]</p> <p>Below is the screen capture from VS. I was searching for the work CommissionBucketProductID within my website pro...
<p>I had the same issue which was annoying. I just fixed it. What I've done is to change "Entire solution" to "current project" in "Look in" field when doing search. Then I noticed the result would not be doubled. After I switched back to "entire solution" the problem was gone.</p>
<p>Try closing VS2008, renaming the file (USPostalApplciation.aspx and the code behind file too), then re-opening VS2008, refresh everything you can think of (project, solution, etc...) then try doing the search again.</p>
28,857
<p>How can I use JUnit idiomatically to test that some code throws an exception?</p> <p>While I can certainly do something like this:</p> <pre><code>@Test public void testFooThrowsIndexOutOfBoundsException() { boolean thrown = false; try { foo.doStuff(); } catch (IndexOutOfBoundsException e) { thrown = t...
<p>It depends on the JUnit version and what assert libraries you use.</p> <ul> <li>For JUnit5 and 4.13 <a href="https://stackoverflow.com/a/2935935/2986984">see answer</a></li> <li>If you use AssertJ or google-truth, <a href="https://stackoverflow.com/a/41019785/2986984">see answer</a></li> </ul> <p>The original answer...
<p>I wanted to comment with my solution to this problem, which avoided needing any of the exception related JUnit code.</p> <p>I used assertTrue(boolean) combined with try/catch to look for my expected exception to be thrown. Here's an example:</p> <pre><code>public void testConstructor() { boolean expectedExcept...
18,931
<p>Coming from a corporate IT environment, the standard was always creating a class library project for each layer, Business Logic, Data Access, and sometimes greater isolation of specific types.</p> <p>Now that I am working on my own web application project, I don't see a real need to isolate my code in this fashion....
<p>Start with the simplest thing possible and add complexity if and when required. Sounds as though a single assembly would work just fine for your case. However, do take care not to violate the layers by having layer A access an internal member of layer B. That would make it harder to pull the layers into separate ass...
<p>I'd say it depends on how serious you are about testing and unit-testing.</p> <p>If you plan to only do user/manual tests, or use basically, only test from the UI downward, then it doesn't really make a difference.</p> <p>On the other hand, if you plan on doing sort of unit-testing, or business rules validation, i...
8,333
<p>I have a table in SQL server that has the normal tree structure of Item_ID, Item_ParentID. Suppose I want to iterate and get all CHILDREN of a particular Item_ID (at any level).</p> <p>Recursion seems an intuitive candidate for this problem and I can write an SQL Server function to do this. </p> <p>Will this affec...
<p>With the new MS SQL 2005 you could use the <code>WITH</code>keyword</p> <p>Check out <a href="https://stackoverflow.com/questions/91360/how-to-calculate-the-sum-of-values-in-a-tree-using-sql">this question</a> and particularly <a href="https://stackoverflow.com/questions/91360/how-to-calculate-the-sum-of-values-in-...
<p>Perhaps some more detail is in order.</p> <p>If you have a master-detail relationship as you describe, then won't a simple JOIN get what you need?</p> <p>As in:</p> <pre><code>SELECT SOME_FIELDS FROM MASTER_TABLE MT ,CHILD_TABLE CT WHERE CT.PARENT_ID = MT.ITEM_ID </code></pre>
23,216
<p>I need to create a historical timeline starting from 1600's to the present day. I also need to have some way of showing events on the timeline so that they do not appear cluttered when many events are close together.</p> <p>I have tried using Visio 2007 as well as Excel 2007 Radar Charts, but I could not get the re...
<p>SIMILIE Timeline would probably suit your needs. <a href="http://simile.mit.edu/timeline/" rel="noreferrer">http://simile.mit.edu/timeline/</a></p> <p>Timeline .NET: <a href="http://www.codeplex.com/timelinenet" rel="noreferrer">http://www.codeplex.com/timelinenet</a></p> <p>Oh, i guess i should ask... for persona...
<p>@Pascal this page? <a href="http://tools.mscorlib.com/timeline/Default.aspx" rel="nofollow noreferrer">http://tools.mscorlib.com/timeline/Default.aspx</a>. If it's looking like ascii maybe look for a js error, but that renders on my system fine. If all else fails, it's a decent js library by the MIT team as it is, s...
3,333
<p>It seems that IE6 ignores any form of cache invalidation sent via http headers, I've tried setting Pragma to No Cache and setting Cache Expiration to the current time, yet in IE6, hitting back will always pull up a cached version of a page I am working on.</p> <p>Is there a specific HTTP Header that IE6 does listen...
<p><code>Cache-Control: private, max-age=0</code> should fix it. From classic ASP this is done with <code>Response.Expires=-1</code>.</p> <p>Keep in mind when testing that just because your server is serving pages with caching turned off doesn't mean that the browser will obey that when it has an old cached page that ...
<p>Have you tried setting an ETag in the header? They're a pretty reliable way to indicate that content has changed <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.19" rel="nofollow noreferrer">w3c Spec</a> &amp; <a href="http://en.wikipedia.org/wiki/HTTP_ETag" rel="nofollow noreferrer">Wikipedia...
6,371
<p>A client wants me to do some maintenance work to a VB 6.0 application (migration to .NET is also in the pipeline), but he doesn't have the development tools because he received just the source code and running application from the original programmer, who is no longer available.</p> <p>Microsoft doesn't sell Visual...
<p>From what I recall the Visual Studio 6.0 is available for MSDN Subscribers.</p>
<p>To get a feel of the code, you could try to compile parts of the application in MS Office / VBA.</p> <p>Of course, this will only offer limited functionality, but may suffice for some testing.</p>
22,523
<p>OK -- a bit of an undefined question (is the pattern of plugs in an Eniac plugboard a language ??) but contenders include:</p> <ul> <li>Konrad Zuse's PlanKalkül (1940s) - never implemented (generally accepted as the first). </li> <li>Whatever Ada Lovelace (1840s) programmed in (not Ada) -- if she is the first progr...
<p>The PBS series Connections made the argument that the holes punched in tiles to control the patterns created on looms (circa 1700s??) were the first programming "language".</p> <p>These were followed by player piano scrolls: Codes, on paper, which are read by, and control the operation of a machine. That's a prog...
<p>I would say that the first programming language actually <em>used</em> was the machine language of the first stored program computer, which I believe was Baby: <a href="http://www.computer50.org/" rel="nofollow noreferrer">http://www.computer50.org/</a></p>
11,092
<p>In Java, suppose I have a String variable S, and I want to search for it inside of another String T, like so:</p> <pre><code> if (T.matches(S)) ... </code></pre> <p>(note: the above line was T.contains() until a few posts pointed out that that method does not use regexes. My bad.)</p> <p>But now suppose S may ...
<p>String.contains does not use regex, so there isn't a problem in this case.</p> <p>Where a regex is required, rather rejecting strings with regex special characters, use java.util.regex.Pattern.quote to escape them.</p>
<p>Regex uses the backslash character '\' to escape a literal. Given that java also uses the backslash character you would need to use a double bashslash like:</p> <pre><code> String S = "\\[hi" </code></pre> <p>That will become the String:</p> <pre><code> \[hi </code></pre> <p>which will be passed to the regex...
20,358
<p>I used a query a few weeks ago in MySQL that described a table and suggested possible improvements to its structure. For example, if I have an int field but only the numbers 1-3 in that field, it will suggest set(1,2,3) as the type.</p> <p>I think I was using phpMyAdmin but I've been through all the functions I can...
<p>This is what phpMyAdmin gives me:</p> <pre><code>SELECT * FROM `table_name` PROCEDURE ANALYSE ( ) </code></pre>
<p>In phpMyAdmin 2.11.6 Go to Structure tab of your table. Below list of fields there are 3 buttons with labels: "Print view" "Relation view" "Propose table structure" .</p> <p>Last one is what you need.</p>
45,448
<p>I have a collection of objects in a database. Images in a photo gallery, products in a catalog, chapters in a book, etc. Each object is represented as a row. I want to be able to arbitrarily order these images, storing that ordering in the database so when I display the objects, they will be in the right order.</...
<p>An other alternative would be (if your RDBMS supports it) to use columns of type array. While this breaks the normalization rules, it can be useful in situations like this. One database which I know about that has arrays is PostgreSQL.</p>
<p>I had the same issue and have probably spent at least a week concerning myself about the proper data modeling, but I think I've finally got it. Using the array datatype in PostgreSQL, you can store the primary key of each ordered item and update that array accordingly using insertions or deletions when your order c...
4,155
<p>When the view property of a UIViewController is accessed, it first checks to see if it's got an existing view, and returns that. If not, it loads its nib or calls -loadView. </p> <p>When a controller receives a -didReceiveMemoryWarning message, the default behavior is to remove that cached view (assuming it's not i...
<p>Since iPhone OS 3.0, you can use the <a href="https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instm/UIViewController/isViewLoaded" rel="noreferrer"><code>isViewLoaded</code></a> method to see if a view is loaded.</p>
<p>You could use <a href="http://developer.apple.com/documentation/Cocoa/Reference/ObjCRuntimeRef/Reference/reference.html#//apple_ref/doc/uid/TP40001418-CH1g-SW1" rel="nofollow noreferrer">object_getIvar()</a> to get at the value without going through the accessor. In essence, it lets you get at _view without needing ...
44,111
<p>I've been using Emacs's sql interactive mode to talk to the MySQL db server and gotten to enjoy it. A developer has set up another db on a new non-default port number but I don't know how to access it using sql-mysql.</p> <p>How do I specify a port number when I'm trying to connect to a database?</p> <p>It would b...
<p>After digging through the sql.el file, I found a variable that allows me to specify a port when I try to create a connection.</p> <p>This option was added GNU Emacs 24.1.</p> <blockquote> <p><strong>sql-mysql-login-params</strong></p> <p>List of login parameters needed to connect to MySQL.</p> </blockquote> <p>I add...
<pre><code>(setq sql-mysql-options (list "-P &lt;port number&gt;")) </code></pre>
3,369
<p>Has anyone got the steps to compile darwin libraries on gcc for arm on ubuntu?</p>
<p>There is a <a href="http://ostatic.com/darwin-arm" rel="nofollow noreferrer">site</a> that provides patches for and arm darwin kernel.</p> <blockquote> <p>Darwin on ARM develops and provides patches for the Apple Darwin-xnu kernel sources so that it can be cross-compiled to run on an ARM processor.</p> </blockquo...
<p><a href="https://github.com/tpoechtrager/osxcross" rel="nofollow noreferrer">https://github.com/tpoechtrager/osxcross</a></p> <p>step by step install it ref to <a href="https://enigma-dev.org/docs/wiki/index.php?title=CrossCompileLinuxOSX" rel="nofollow noreferrer">https://enigma-dev.org/docs/wiki/index.php?title=C...
37,729
<p>I have VS2005 and I am currently trying to debug an ASP.net web application. I want to change some code around in the code behind file, but every time I stop at a break point and try to edit something I get the following error message: "Changes are not allowed when the debugger has been attached to an already runnin...
<p>The application is actually running off of a compiled version of your code. If you modify it it will have to recompile it in order for your changes to work, which means that it will need to swap out the running version for the new compiled version. This is a pretty hard problem - which is why I think Microsoft has...
<p>Check that you are not in release mode. In release mode you cannot edit your code while debugging. Just change mode to Debug</p>
10,198
<p>How do you do your own fonts? I don't want a heavyweight algorithm (freetype, truetype, adobe, etc) and would be fine with pre-rendered bitmap fonts.</p> <p>I do want anti-aliasing, and would like proportional fonts if possible.</p> <p>I've heard I can use Gimp to do the rendering (with some post processing?)</p>...
<p>In my old demo-scene days I often drew all characters in the font in one big bitmap image. In the code, I stored the (X,Y) coordinates of each character in the font, as well as the width of each character. The height was usually constant throughout the font. If space isn't an issue, you can put all characters in a g...
<p>Pre-rendered bitmap fonts are probably the way to go. Render your font using whatever, arrange the characters in a grid, and save the image in a simple uncompressed format like PPM, BMP or TGA. If you want antialiasing, make sure to use a format that supports transparency (BMP and TGA do; PPM does not).</p> <p>In...
17,341
<p>If a company often requires users to be created in a partner's active directory, and vice versa, does it make sense to set up a federated / trusted relationship between the AD instances? If so, what should be considered? Does the ACL for users in the partner AD still work the same way? What security risks does this ...
<p>I've been researching this a bit more, and I've found a good solution. Since both companies both need to use the same system, the system itself just needs to verify if a user exists in either of the user stores(authentication), and then to the authorization at the system level. </p> <p>The idea behind giving both c...
<p>I've been researching this a bit more, and I've found a good solution. Since both companies both need to use the same system, the system itself just needs to verify if a user exists in either of the user stores(authentication), and then to the authorization at the system level. </p> <p>The idea behind giving both c...
34,458
<p>When you plot things in Matlab, the most recently plotted data series is placed on top of whatever's already there. For example:</p> <pre><code>figure; hold on plot(sin(linspace(0,pi)),'linewidth',4,'color',[0 0 1]) plot(cos(linspace(0,pi)),'linewidth',4,'color',[1 0 0]) </code></pre> <p>Here, the red line is show...
<p>Use the <strong>uistack</strong> command. For example:</p> <pre><code>h1 = plot(1:10, 'b'); hold on; h2 = plot(1:10, 'r'); </code></pre> <p>will plot two lines with the red line plotted on top of the blue line. If you then do:</p> <pre><code>uistack(h1); </code></pre> <p>the blue line will be brought to the fr...
<p>You can also accomplish this by setting the order of the children vector of the current axes. If you do the following:</p> <pre><code>figure; hold on h1 = plot(sin(linspace(0,pi)),'linewidth',4,'color',[0 0 1]); h2 = plot(cos(linspace(0,pi)),'linewidth',4,'color',[1 0 0]); h = get(gca, 'Children'); </code></pre> ...
25,419
<p>In Delphi, I want to be able to create an private object that's associated with a class, and access it from all instances of that class. In Java, I'd use:</p> <pre><code>public class MyObject { private static final MySharedObject mySharedObjectInstance = new MySharedObject(); } </code></pre> <p>Or, if MyShare...
<p>Here is how I'll do that using a class variable, a class procedure and an initialization block:</p> <pre><code>unit MyObject; interface type TMyObject = class private class var FLogger : TLogLogger; public class procedure SetLogger(value:TLogLogger); class procedure FreeLogger; end; impl...
<p>Before version 7, Delphi didn't have static variables, you'd have to use a global variable.</p> <p>To make it as private as possible, put it in the <code>implementation</code> section of your unit.</p>
9,730
<p>Are there major advantages to <a href="https://web.archive.org/web/20090207080811/http://www.innodb.com:80/hot-backup/features/" rel="nofollow noreferrer">InnoDB hot backup</a> vs ZRM <a href="https://www.zmanda.com/zrm-enterprise/" rel="nofollow noreferrer">snapshots</a> in terms of disruption to the running site, ...
<p>Rebooting while updating an access database can trash it.</p> <p>You need some more info so that you have a better understanding of what is going on. They need to collect some information for you on a workstation that is having the problem. Using task manager you can have them get the following info:</p> <ul> <l...
<p>Sounds like a big memory leak to me. </p> <p>Some customers will leave your application running for longer than others, and will be harder hit.</p> <p>Using Access where there are more than a few concurrent users inevitably results in pain.</p>
35,628
<pre><code>Option Explicit On Option Strict On Public Class Class1 Dim l As List(Of A) Public Sub New() l = New List(Of B) End Sub End Class Public Class A End Class Public Class B Inherits A End Class&lt;p&gt; </code></pre> <p>I've run into this problem.<br> I have a list declared of a G...
<p>It's a matter of variance, which C# doesn't support for generics. See <a href="http://blogs.msdn.com/rmbyers/archive/2005/02/16/375079.aspx" rel="nofollow noreferrer">Rick Byer's post on the subject</a>.</p>
<p>If you could cast a list of As as a list of Bs, then what would happen if you added an A?</p>
21,769
<p>I'm wondering how slow it's going to be switching between 2 databases on every call of every page of a site. The site has many different databases for different clients, along with a "global" database that is used for some general settings. I'm wondering if there would be much time added for the execution of each sc...
<p>Assuming that both databases are on the same machine, you don't need to do the mysql_select_db. You can just specify the database in the queries. For example;</p> <pre><code>SELECT * FROM db1.table1; </code></pre> <p>You could also open two connections and use the DB object that is returned from the connect call a...
<p>You're asking two quite different questions.</p> <ol> <li><p>Connecting to multiple database instances</p></li> <li><p>Switching default database schemas.</p></li> </ol> <p>MySQL is known to have quite fast connection setup time; making two <code>mysql_connect()</code> calls to different servers is barely more exp...
33,007
<p>I want to migrate from Embarcadero Delphi to Visual Studio, but without a <a href="http://docs.codegear.com/docs/radstudio/radstudio2007/RS2007_helpupdates/HUpdate4/EN/html/delphivclwin32/DBClient_TClientDataSet.html" rel="nofollow noreferrer">TClientDataset</a> class it is very difficult. This class represents an i...
<p>Visual studio has DataSet and DataTable classes which are very close to what a TClientDataSet is in Delphi.</p> <p>See <a href="http://msdn.microsoft.com/en-us/library/system.data.dataset.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/system.data.dataset.aspx</a></p>
<p>Visual studio has DataSet and DataTable classes which are very close to what a TClientDataSet is in Delphi.</p> <p>See <a href="http://msdn.microsoft.com/en-us/library/system.data.dataset.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/system.data.dataset.aspx</a></p>
16,817
<p>Can someone explain this in a practical way? Sample represents usage for one, low-traffic Rails site using Nginx and 3 Mongrel clusters. I ask because I am aiming to learn about page caching, wondering if these figures have significant meaning to that process. Thank you. Great site!</p> <pre><code>me@vps:~$ fre...
<p>Physical memory is all used up. Why? Because it's there, the system should be using it.</p> <p>You'll note also that the system is using 113M of swap space. Bad? Good? It depends. </p> <p>See also that there's 103M of cached disk; this means that the system has decided that it's better to cache 103M of disk and sw...
<p>by my reading of this, you have used almost all your memory, have 6 M free, and are going into about 10% of your swap. A more useful tools is to use top or perhaps ps to see how much each of your individual mongrels are using in RAM. Because you're going into swap, you're probably getting more slowdowns. you might f...
29,385
<p>Is there any persistence solution for Common Lisp, such as Elephant, that allows function persistence? Currently my app stores an identifier on the db and later searches in a function table which it is, but this method does not allow dynamically created functions to be stored.</p>
<p>It's not a database persistence mechanism, but most Common Lisps have a way of <a href="http://www.franz.com/support/documentation/8.1/doc/operators/excl/fasl-write.htm" rel="nofollow noreferrer">writing FASLs</a> for all kinds of objects, including functions. For example:</p> <pre><code>cl-user(1): (compile (defun...
<p>Be careful that storing code may not be that good. The Zope developers learned it the hard way.</p>
37,399
<pre><code>SELECT pe.prodtree_element_id prodID, pe.prodtree_element_name_s, li.line_name, av2.value FROM prodtree_element pe LEFT JOIN prodtree_link pl ON pe.prodtree_element_id = pl.to_prodtree_node_id LEFT JOIN line li ON pe.line_code = li.line_code INNER JOIN attribute_values av ...
<pre><code>INNER JOIN attribute_values av ON av.attribute_definition_id = #statusCode# LEFT JOIN attribute_values av2 ON pe.prodtree_element_id = av.prodtree_element_id </code></pre> <p>This is the problem. There is a cross join between pe and av, followed by an outer join onto the cross join. You're lucky it...
<p>Without knowing the DDL its very hard to test. 30-50K rows should still take only a few seconds. </p> <p>Try switching the where clause ordering. You should probably have this implemented</p> <pre><code> INNER JOIN attribute_values av ON av.attribute_definition_id = #statusCode# </code></pre> <p>in the ...
46,109
<p>I need to deploy a few .net dlls. They need to be put in the GAC and the required entries need to be in the registry. On my machine I have both the SDK and Visual Studio running, so currently I am utilizing .net sdk tools like gacutil and regasm. However, when I need to install these dlls on a customer machine, how ...
<p>The 'proper' way to do this is using MSI (via one of the various ways of making MSI files - like WiX)</p> <p>This might be useful to you:</p> <p><a href="http://blogs.msdn.com/astebner/archive/2006/11/04/why-to-not-use-gacutil-exe-in-an-application-setup.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/astebn...
<p>The most robust way would be to use your setup project. Open the File System view for the project, add the special folder "Global Assembly Cache", and add your assemblies to it, then build the setup project and you're good.</p> <p>If you don't use a setup project, I don't really know...</p>
43,026
<p>Is there something like a panel that I can use in a MFC application. This is to overlay the default window in MFC (a dialog application). Then to paint the panel black and paint some random stuff on top of it. Something like a view port.</p> <p>is there a better option than this to achieve the same effect ?</p>
<p>Sure. It's called a window! Create a class that derives from CWnd and overrides OnPaint().</p> <p>In your dialog's OnInitInstance(), instantiate a CMyWnd object and call it's Create() member. Of course, make sure the lifetime of your CMyWnd object is the same as the dialog's object lifetime window. iow, make it a m...
<p>Another solution would be to derive from <code>CDialog</code>. This way you can use the resource editor to edit the panel visually and you don't need to paint anything yourselve. Also the Panel class is rather thin and just needs to propagate the <code>Create()</code> and <code>Show()</code> calls to support subpane...
30,320