instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p><strong>Premise:</strong> Usually during preparation of a new Ruby on Rails App, I draw out models and relations regarding user navigations. Usually I hit a place where I need to ask myself, whether or not I should go beyond the usual "rule of thumb" of nesting no more 1 level deep. Sometimes I feel the need to nest...
<p>I tend to follow Jamis Buck's <a href="http://weblog.jamisbuck.org/2007/2/5/nesting-resources" rel="nofollow noreferrer">advice</a> and never nest more than one level deep.</p> <p>Edit: If you are going to nest more than 1 level I would check out the new <a href="http://ryandaigle.com/articles/2008/9/7/what-s-new-i...
<p>Whilst it sounds good in theory, I've found nesting more than one level can start to get confusing - particularly if you have the same named controller at different levels (which can be quite common)</p> <p>Eg</p> <pre><code> user/x/blog/y/profile/z, and user/x/profile/a </code></pre> <p>I'll often find I'm wo...
19,889
<p>I want to get my databases under version control.</p> <p>I'll always want to have at least <em>some</em> data in there (as <a href="https://stackoverflow.com/users/80/alumb">alumb</a> mentions: user types and administrators). I'll also often want a large collection of generated test data for performance measurements...
<p>Martin Fowler wrote my favorite article on the subject, <a href="http://martinfowler.com/articles/evodb.html" rel="noreferrer">http://martinfowler.com/articles/evodb.html</a>. I choose not to put schema dumps in under version control as <em>alumb</em> and others suggest because I want an easy way to upgrade my prod...
<p>An alternative to version controlling your database is to use a version-controlled database, of which there are now several.</p> <p><a href="https://www.dolthub.com/blog/2021-09-17-database-version-control/" rel="nofollow noreferrer">https://www.dolthub.com/blog/2021-09-17-database-version-control/</a></p> <p>These ...
2,264
<p>I started web programming with raw PHP, gradually moving on to its various frameworks, then to Django and Rails. In every framework I've used, pretty much everything I need to do with a database (even involving relatively complex things like many-to-many relationships) could be taken care of by the automatically gen...
<p><a href="http://grails.org" rel="nofollow noreferrer">Grails</a> for the win. Groovy is very similar to Java but with a lot of nice dynamic language additions/simplifications. Grails has GORM, which is exactly what you're looking for.</p>
<p>Get <a href="http://ibatis.apache.org/" rel="nofollow noreferrer">iBatis</a> for Java. It isn't as robust as Django's ORM (nothing is), but it's a big, big step above JDBC.</p>
32,590
<p>What is a simple way of downloading a file from a URL path?</p>
<pre><code>using (var client = new WebClient()) { client.DownloadFile("http://example.com/file/song/a.mpeg", "a.mpeg"); } </code></pre>
<pre class="lang-cs prettyprint-override"><code>static void Main(string[] args) { DownloadFileAsync().GetAwaiter(); Console.WriteLine(&quot;File was downloaded&quot;); Console.Read(); } private static async Task DownloadFileAsync() { We...
39,609
<p>I tried scouring the web for help on this issue, but there are so many generic words in there, that I couldn't find much of anything that was relevant.</p> <p>I have MS Office 2007 installed on Vista and later installed XML Notepad 2007 (also a Microsoft product). It seems that the MS Access help system is using s...
<p>Okay, I found the answer and I'm a little embarrassed by it. In fact, my question was pretty much off the mark.</p> <p>First, there is no involvement in this problem with XML Notepad 2007. It didn't hijack a file extension or make a registry entry or anything else like that. It's a great little program if you ju...
<p>Do a repair on your Office installation. That, or remove XMl Notepad (it's not that good imho).</p>
11,139
<p><strong>Note: Mathematical expression evaluation is not the focus of this question. I want to compile and execute new code at runtime in .NET.</strong> That being said...</p> <p>I would like to allow the user to enter any equation, like the following, into a text box:</p> <pre><code>x = x / 2 * 0.07914 x = x^2 /...
<p>Yes! Using methods found in the <a href="http://msdn.microsoft.com/en-us/library/microsoft.csharp.aspx">Microsoft.CSharp</a>, <a href="http://msdn.microsoft.com/en-us/library/system.codedom.compiler.aspx">System.CodeDom.Compiler</a>, and <a href="http://msdn.microsoft.com/en-us/library/system.reflection.aspx">Syste...
<p>I would do a recursive function that doesn't write code but instead applies basic operators to portions of a string based on special characters found in that string. If more than one special character is found, it breaks up the string and calls itself on those two portions.</p>
28,988
<p>How do I display a leading zero for all numbers with less than two digits?</p> <pre class="lang-none prettyprint-override"><code>1 → 01 10 → 10 100 → 100 </code></pre>
<p>In Python 2 (and Python 3) you can do:</p> <pre><code>number = 1 print(&quot;%02d&quot; % (number,)) </code></pre> <p>Basically <strong>%</strong> is like <code>printf</code> or <code>sprintf</code> (see <a href="https://docs.python.org/3/library/stdtypes.html#printf-style-string-formatting" rel="noreferrer">docs</a...
<p>If dealing with numbers that are either one or two digits:</p> <p><code>'0'+str(number)[-2:]</code> or <code>'0{0}'.format(number)[-2:]</code></p>
16,342
<p>I have been working on a web services related project for about the last year. Our team found <a href="http://www.soapui.org" rel="noreferrer">soapUI</a> near the start of our project and we have been <em>mostly</em>(*) satisfied with it (the free version, that is).</p> <p>My question is: are there other tools/cli...
<p>I use soapUI, and it's generally pretty good. Be aware that it seems to leak memory, and eventually it will no longer save your project, so save regularly!</p> <p>This is about the only hassle I have with it (other than the general ugliness that almost every Java application has!), and I can't live without it.</p>...
<p>We've been using SoapUI since 1.x (will soon be adopting 3.0 from 2.5.1) and are all happy. It's much more stable when running with native LnF (File - Preferences - UI Settings - Native LF). I know it's available as an Eclipse plugin as well, but last I tried I failed to find how to add JAR-files to it (i.e. bin/ext...
5,196
<p>I'm following several tutorials and references trying to get my kernel set up. I've come across some unfamiliar code in a tutorial that isn't explaining it at all. It's code that I'm told maps the <code>16 IRQs (0-15)</code> to ISR locations <code>32-47</code>:</p> <pre><code>void irq_remap(void) { outportb(0x2...
<p><code>outb</code> and similar, write to hardware IO ports. Basically, there are 2 primary options for communicating with a device. You can have the device mapped to memory or IO ports.</p> <p>As for how this code works, i'll comment it for you:</p> <p>ICW stands for "Initialization Commands Words"</p> <pre><code>...
<p>The simple answer is that in protected mode the interrupts used by the 1st Programmable Interrupt Controller are protected mode exceptions, which means that they have to be remapped.</p> <blockquote> <p></p> </blockquote> <p>The happy answer is that only the first <code>PIC</code> needs to be remapped ( the rema...
35,852
<p>My current solution for renaming the project folder is:</p> <ul> <li>Remove the project from the solution.</li> <li>Rename the folder outside Visual Studio.</li> <li>Re-add the project to the solution.</li> </ul> <p>Is there a better way?</p>
<blockquote> <p><em>TFS users:</em> If you are using source control that requires you to warn it before your rename files/folders then look at <strong><em><a href="https://stackoverflow.com/a/10853509/10245">this answer instead</a></em></strong> which covers the extra steps required.</p> </blockquote> <hr> <p>To re...
<p>Right click project &rarr; <em>Properties</em>, and set (name) to the required name.</p>
25,949
<p>I have been tasked to implement a WCF service that makes use of NetMsmqBinding. I wrote the service and it works fine. The problem is that in the last minute they told me that there will be no Active Directory integration. So I don't know how to configure the security of the service. There is a VPN tunnel between th...
<p>I'm not sure I understand your question so correct me, if I'm wrong. I have recently been woring on a WCF service that was hosted on a computer with no Active Directory available. We secured it using certificates. Is it an option for you? It's pretty painless (if you get past the 'put the certificate in the store an...
<p>You should be able to take advantage of network transparency.</p> <p>Use webservices to communicate from one system to the other. You might have to deal with extra latency, but it should still be usable.</p>
25,977
<p>Is there a way to determine the number of users that have active sessions in an ASP.NET application? I have an admin/tools page in a particular application, and I would like to display info regarding all open sessions, such as the number of sessions, and perhaps the requesting machines' addresses, or other credenti...
<p><a href="http://technet.microsoft.com/en-us/library/cc775901.aspx" rel="noreferrer">ASP.NET Performance Counters</a> like State Server Sessions Active (The number of active user sessions) should help you out. Then you can just <a href="http://www.developer.com/net/net/article.php/11087_3356561_1" rel="noreferrer">re...
<p>You can use PerformanceCounter to get data from System.Diagnostics namespace. It allows you to get "Sessions Active" and much more. It allows you to get from local server as well as remote.</p> <p>Here is an example of how to do it on local machine</p> <pre><code>void Main() { var pc = new PerformanceCounter...
18,821
<p>This originally was a problem I ran into at work, but is now something I'm just trying to solve for my own curiosity.</p> <p>I want to find out if int 'a' contains the int 'b' in the most efficient way possible. I wrote some code, but it seems no matter what I write, parsing it into a string and then using indexOf...
<p>It <em>should</em> be faster string way, because your problem is textual, not mathematical. Notice that the your "contains" relationship says nothing about the numbers, it only says something about their <em>decimal</em> representations.</p> <p>Notice also that the function you want to write will be unreadable - an...
<p>FYI</p> <p><a href="http://refactormycode.com/" rel="nofollow noreferrer">http://refactormycode.com/</a></p> <p>Could work for you.</p>
28,710
<p>The code looks like below:</p> <pre><code>namespace Test { public interface IMyClass { List&lt;IMyClass&gt; GetList(); } public class MyClass : IMyClass { public List&lt;IMyClass&gt; GetList() { return new List&lt;IMyClass&gt;(); } } } </code></pr...
<p>To answer the "why" part of the question as to why not <a href="https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.list-1" rel="noreferrer"><code>List&lt;T&gt;</code></a>, The reasons are future-proofing and API simplicity.</p> <p><strong>Future-proofing</strong></p> <p><a href="https://learn....
<p>Well the Collection class is really just a wrapper class around other collections to hide their implementation details and other features. I reckon this has something to do with the property hiding coding pattern in object-oriented languages.</p> <p>I think you shouldn't worry about it, but if you really want to pl...
34,180
<p>Can't find anything relevant about Entity Framework/MySQL on Google so I'm hoping someone knows about it.</p>
<p>It's been released - Get the <a href="http://www.mysql.com/downloads/connector/net" rel="noreferrer">MySQL connector for .Net v6.5</a> - this has support for [Entity Framework]</p> <p>I was waiting for this the whole time, although the support is basic, works for most basic scenarios of db interaction. It also ...
<p>I didn't see the link here, but there's a beta .NET Connector for MySql. Click "Development Releases" to download 6.3.2 beta, which has EF4/VS2010 integration:</p> <p><a href="http://dev.mysql.com/downloads/connector/net/5.0.html#downloads" rel="nofollow noreferrer">http://dev.mysql.com/downloads/connector/net/5.0...
10,213
<p>I have heard using PDB files can help diagnose where a crash occurred.<br> My <em>basic</em> understanding is that you give Visual studio the source file, the pdb file and the crash information (from Dr Watson?)<br> Can someone please explain how it all works / what is involved? (Thank you!)</p>
<p>PDB files are generated when you build your project. They contain information relating to the built binaries which Visual Studio can interpret.</p> <p>When a program crashes and it generates a crash report, Visual Studio is able to take that report and link it back to the source code via the PDB file for the applic...
<p>You should look into setting up a symbol server and indexing the PDB files to your source code control system. I just recently went through this process for our product and it works very well. You don't have to be concerned about making PDB files available with the binaries, nor how to get the appropriate source cod...
9,768
<p>How can I calculate the last business day of the month in .NET?</p>
<p>I would do it like this for a Monday through Friday business week:</p> <pre><code>var holidays = new List&lt;DateTime&gt;{/* list of observed holidays */}; DateTime lastBusinessDay = new DateTime(); var i = DateTime.DaysInMonth(year, month); while (i &gt; 0) { var dtCurrent = new DateTime(year, month, i); if(dt...
<p>Here is how to find the last day of the month in C#:</p> <pre><code>DateTime today = DateTime.Today; DateTime endOfMonth = new DateTime(today.Year, today.Month, DateTime.DaysInMonth(today.Year, today.Month)); </...
34,387
<p>All, </p> <p>I currently have my solution comprising of 2 Class librarys and a Web Site building within teamCity using Msbuild. Now I want to precompile the website and make it available as an artifact. However when i try to Precompile it using </p> <pre><code>&lt;Target Name="PrecompileWeb" DependsOnTargets="Buil...
<p>Is this a Web Site or Web Application Project? If the latter, instead of doing an AspNetCompiler task, do an MSBuild task to the csproj/vbproj file, calling the targets <code>Rebuild;ResolveReferences;_CopyWebApplication</code> and specifying the <code>OutDir</code> property.</p> <p>If you are using a website, then...
<p>I am not sure this will work as this will happen on every build? I only want to do this when I run the build on the TeamCity Server not local builds. </p> <p>Essentially I currently </p> <p>Build all the required solutions Execute the unit tests Create the Zip folder for the artifact</p> <p>Cheers</p>
39,805
<p>When I type <code>uname -a</code>, it gives the following output.</p> <pre><code>Linux mars 2.6.9-67.0.15.ELsmp #1 SMP Tue Apr 22 13:50:33 EDT 2008 i686 i686 i386 GNU/Linux </code></pre> <p>How can I know from this that the given OS is 32 or 64 bit?</p> <p>This is useful when writing <code>configure</code> script...
<p>Try <a href="http://linuxmanpages.net/manpages/fedora16/man1/uname.1.html" rel="noreferrer"><code>uname -m</code></a>. Which is short of <code>uname --machine</code> and it outputs: </p> <pre><code>x86_64 ==&gt; 64-bit kernel i686 ==&gt; 32-bit kernel </code></pre> <hr> <p>Otherwise, <strong>not for the Linux k...
<p>First you have to download Virtual Box. Then select new and a 32-bit Linux. Then boot the linux using it. If it boots then it is 32 bit if it doesn't then it is a 64 bit.</p>
30,522
<p>I came across <a href="http://www.catonmat.net/blog/edsger-dijkstra-discipline-in-thought/" rel="nofollow noreferrer">this article</a> about programming styles, seen by Edsger Dijsktra. To quickly paraphrase, the main difference is Mozart, when the analogy is made to programming, fully understood (debatable) the pr...
<p>The Mozart programming style is a complete myth (everybody has to edit and modify their initial efforts), and although "Mozart" is essentially a metaphor in this example, it's worth noting that Mozart was substantially a myth himself.</p> <p>Mozart was a supposed magical child prodigy who composed his first sonata ...
<p>Progress in computing is worth a sacrifice in glory or genius here and there.</p>
37,344
<p>I have a native VC++ project that uses a dll (which is not in a project). Now, I must to put the dll in one the "Search Path Used by Windows to Locate a DLL" <a href="http://msdn.microsoft.com/en-us/library/7d83bc18(VS.80).aspx" rel="nofollow noreferrer">link</a></p> <p>but I don't want the dll to sit in the exect...
<p>Summing up all the techniques I have found:</p> <ul> <li>If you use a managed project as the startup project (which is actually my case) use Enviroment class</li> </ul> <p>string temp = "myFullDirectoryPathToDll"; string temp2 =Environment.GetEnvironmentVariable("PATH") + ";" + temp; Environment.SetEnvironmentVar...
<p>If you're launching from a Windows shortcut, you could specify the DLL's path in the "Start in" location, while specifying the .exe's full name and path in the "Target" location.</p> <p>If there are DLLs in the .exe's directory that are needed, Windows <em>should</em> be able find them as well, because I believe th...
28,431
<p>I have been tasked with developing a solution that tracks changes to a database.</p> <p>For updates I need to capture:</p> <ul> <li>date of update</li> <li>old value</li> <li>new value</li> <li>field affected</li> <li>person doing change</li> <li>record id</li> <li>table record is in</li> </ul> <p>For deletes:</p...
<p>A trigger wouldn't have all the information you need for a bunch of reasons - but no user id is the clincher.</p> <p>I'd say you're on the right track with a common sp to insert wherever a change is made. If you're standardizing on sp's for your interfaces then you're ahead of the game - it will be hard to sneak in...
<p>we built our own and just needed the user and pc passed into each add/update stored procedure. then it's just a matter of getting the original record adn populating the variables and comparing them to the passed in variables and logging the data to our table. for deletes we just have a copy of the originating table...
38,440
<p>Code:</p> <pre><code>&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;title&gt;Unusual Array Lengths!&lt;/title&gt; &lt;script type="text/javascript"&gt; var arrayList = new Array(); arrayList = [1, 2, 3, 4, 5, ]; alert(arrayList.length); &lt;/script&gt; &lt;/...
<p>It seems to me that the Firefox behavior is correct. What is the value of the 6th value in IE (sorry I don't have it handy to test). Since there is no actual value provided, I imagine it's filling it with something like 'null' which certainly doesn't seem to be what you intended to have happen when you created the...
<p><a href="https://stackoverflow.com/questions/29053/javascript-browser-quirks-arraylength#29073">@John</a>: The value of arrayList[5] comes out to be 'undefined'.</p> <p>Yes, there should never be a dangling comma in declarations. Actually, I was just going through someone else's long long javascript code which some...
4,872
<p>Is it possible to throw an exception in a JSP without using scriptlet code?</p>
<p>You really shouldn't be doing anything at the JSP layer that explicitly throws exceptions. The reason you don't want to use scriptlets in JSPs is because that puts application logic in your view. Throwing an exception is inherently application logic, so it doesn't belong in your JSP, scriptlet or not.</p>
<p>You can throw an exception if you do this:</p> <pre><code>&lt;c:out value="${1/0}" /&gt; </code></pre> <p>or something that is similarly "illegal"</p> <p>Ideally though, since JSPs are associated with the view...you don't want to throw an exception. You want to catch them with <code>&lt;c:catch&gt;</code></p>
14,912
<p>In Django's template language, you can use <code>{% url [viewname] [args] %}</code> to generate a URL to a specific view with parameters. How can you programatically do the same in Python code?</p> <p>What I need is to create a list of menu items where each item has name, URL, and an active flag (whether it's the ...
<p>If you need to use something similar to the <code>{% url %}</code> template tag in your code, Django provides the <code>django.core.urlresolvers.reverse()</code>. The <code>reverse</code> function has the following signature:</p> <pre><code>reverse(viewname, urlconf=None, args=None, kwargs=None) </code></pre> <p><...
<p>Be aware that using <code>reverse()</code> requires that your urlconf module is 100% error free and can be processed - iow no <code>ViewDoesNotExist</code> errors or so, or you get the dreaded <code>NoReverseMatch</code> exception (errors in templates usually fail silently resulting in <code>None</code>).</p>
6,489
<p>As title. I didn't find one via google, at any rate.</p> <p>Update: thanks for the links from the two answers; this is very useful, but not what I was after - I am curious to see whether it is possible to query an IRepository backed by memcached (or some other distributed cache), backed by a RDBMS. I've really no...
<p>If you don't mind throwing <a href="http://www.hibernate.org/343.html" rel="nofollow noreferrer">NHibernate</a> between them, you can use <a href="http://ayende.com/Blog/archive/2007/03/16/Linq-for-NHibernate.aspx" rel="nofollow noreferrer">LINQ to NHibernate</a> to query entities which <a href="http://www.hibernate...
<p>I encounter some problem with linq for memcached also. But you should check out the serialization of your linq DBML whether it's Unidirectional or not.</p> <p>you might have luck for this solution, worth to try out. For me, i sitll having problem with linq, but other object that have [Serilizable] attribute works f...
29,889
<p>To start with, as stated in the title, I am very new to 3D printing.</p> <p>We're a toy/boardgame shop and we're experimenting with 3D printing because it could open up a huge market for us. To this end, I'm asked to try to get this off the ground, but also for me it's a big experiment.</p> <h2>General Information</...
<p>There are several issue at hand here, first you have an adhesion problem.</p> <p><a href="https://i.stack.imgur.com/2CU9L.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2CU9L.png" alt="enter image description here" /></a></p> <p>This print shows that the print (as it is printed upright) has come ...
<p><strong>Adhesion</strong></p> <p>Try raising your bed temperature a couple of degrees at a time. Presumably your filament has some &quot;suggested temperatures&quot; on the spool, but they sometimes only give a hotend's temp. For PLA some people get good results with a 50 degree C bed, I find nothing less than 60...
2,173
<p>Is it true that a WCF either runs as a console application that you have to manually start OR under a more traditional IIS application (like a website or webservice)</p>
<p><strong>EDIT</strong>: No, that is not quite true. </p> <p>Those are two hosting options for WCF. There are others.</p> <hr> <p>orig answer:</p> <p>you can actually execute a wcf service everywhere, where you can execute managed code. i've seen wcf services running inside sql server, wpf apps, windows services...
<p>Yes, that's correct... you can also host them as a Windows Service</p>
25,609
<p>I would like to be able to drop to the python REPL from the debugger -- if this is not possible is there an easier way to evaluate python expressions in the context of the current breakpoint other than manually adding them all as watch expressions?</p>
<p>I don't use <em>pydev</em>, but to drop to python's interactive REPL from code:</p> <pre><code>import code code.interact(local=locals()) </code></pre> <p>To drop to python's debugger from code:</p> <pre><code>import pdb pdb.set_trace() </code></pre> <p>Finally, to run a interactive REPL after running some code, ...
<p>As Dag Høidahl said, the PyDev Console is actually the best option (at least on Eclipse Indigo), no need to hack around. </p> <p>Just go to Open Console: <img src="https://i.stack.imgur.com/nXYND.png" alt="Open Console"></p> <p>Then select PyDev Console:</p> <p><img src="https://i.stack.imgur.com/nx9M1.png" alt="...
29,960
<p><a href="https://stackoverflow.com/questions/12073/what-is-the-best-xml-editor">https://stackoverflow.com/questions/12073/what-is-the-best-xml-editor</a> was a great question regarding XML editors on Windows. What about on OS X?</p> <p>Oxygen is feature complete, but, it's a Java app and a bit clunky on OSX. It's ...
<p><a href="http://www.editix.com/" rel="nofollow noreferrer">EditiX XML Editor</a> (starts at $60) or maybe <a href="http://www.oxygenxml.com/" rel="nofollow noreferrer">oXygen</a> ($299 is less than $300, right).</p> <p>You'll find a big list of the optiosn over at <a href="http://xmacl.com/" rel="nofollow noreferre...
<p>Netbeans could be a good and free choice too.</p>
6,796
<p>How can a .net class library project and resulting dll be protected so it cant be referenced by other applications (.net projects) except those projects in my own solution?</p>
<p>I think you can't forbid other applications to reference you library.<br> You can make library's classes internal and provide access to them via <a href="http://msdn.microsoft.com/en-us/library/system.runtime.compilerservices.internalsvisibletoattribute.aspx" rel="nofollow noreferrer">InternalVisibleTo</a> attribute...
<p>Forgive my ignorance, but if they're all class libraries, what does the code do? Isn't the purpose of having a dll so that the code can be referenced.</p> <p>In any case if you mark everything <a href="http://msdn.microsoft.com/en-us/library/7c5ka91b.aspx" rel="nofollow noreferrer"><code>internal</code></a> it won...
6,022
<p>Why does Resharper want you to change most variables to var type instead of the actual type in the code?</p>
<p>It's just an option. You can disable it:</p> <p>ReSharper -> Options -> Code Inspection -> Inspection Severity -> Code Redundencies -> Use 'var' keyword where possible: change this to "Do not show"</p> <p>There's also the context (lightbulb) option which will take you in each direction - this is under ReSharper ->...
<p>Vars help to make the code more readable inside a method, especially if you use generics.</p> <p>As Jon says, it is just an option.</p>
37,954
<p>So here I am just about to start a big project using LINQ to SQL and then I read this:</p> <p><a href="http://www.infoq.com/news/2008/11/DLINQ-Future" rel="nofollow noreferrer">Is LINQ to SQL Truly Dead?</a> by Jonathan Allen for InfoQ.com</p> <p>Well, I don't want to be supporting LINQ to SQL indefinitely if it's...
<p>How Do I...? Videos</p> <ul> <li><a href="http://blogs.msdn.com/adonet/archive/2008/05/20/how-do-i-new-entity-framework-videos.aspx" rel="noreferrer">How Do I Get Started with the Entity Framework?</a> </li> <li><a href="http://blogs.msdn.com/adonet/archive/2008/05/20/how-do-i-new-entity-framework-videos.aspx" rel...
<p>Conference Sessions</p> <p><a href="http://channel9.msdn.com/pdc2008/TL20/" rel="nofollow noreferrer">PDC 2008 Entity Framework Futures session</a></p>
32,319
<p>I am newbie to <code>Spring Webflow</code>, I have am using Custom <code>FlowHandler</code> </p> <p>I can reach the respective Controller, but if set an attribute in a request Object I don't get it in JSP that is <code>View state</code>.</p> <p>How can I proceed in this?</p>
<p>you shouldn't set anything to your request attributes in spring webflow - there is no need, besides webflow does some internal request redirecting and probably your attributes are los. </p> <p>all the variables you create in the flow are available in view as if they were set by adding attribute to request. wether y...
<p>Hey Miceuz thanks for Replying .....</p> <pre><code>&lt;on-start&gt; &lt;evaluate expression="XXXXControllerwsf.firstHit(flowRequestContext)" result="flowScope.res"/&gt; &lt;/on-start&gt; &lt;decision-state id="urlcheck"&gt; &lt;if test="flowScope.res.reurl== 'splash' " then="splash" else="change"/&g...
49,444
<p>I'm tired of opening Dia and creating a database diagram at the beginning of every project. Is there a tool out there that will let me select specific tables and then create a database diagram for me based on a MySQL database? Preferably it would allow me to edit the diagram afterward since none of the foreign keys ...
<p>Try MySQL Workbench, formerly DBDesigner 4:</p> <p><a href="http://dev.mysql.com/workbench/" rel="noreferrer">http://dev.mysql.com/workbench/</a></p> <p>This has a "Reverse Engineer Database" mode:</p> <p>Database -> Reverse Engineer</p> <p><a href="https://i.stack.imgur.com/wcoq9.png" rel="noreferrer"><img src=...
<p>The "Reverse Engineer Database" mode in Workbench is only part of the paid version, not the free one.</p>
2,460
<p>This is what I have so far: </p> <pre><code>myArray.map!{ rand(max) } </code></pre> <p>Obviously, however, sometimes the numbers in the list are not unique. How can I make sure my list only contains unique numbers without having to create a bigger list from which I then just pick the n unique numbers?</p> <p><st...
<p>This uses Set:</p> <pre><code>require 'set' def rand_n(n, max) randoms = Set.new loop do randoms &lt;&lt; rand(max) return randoms.to_a if randoms.size &gt;= n end end </code></pre>
<p>Here is one solution:</p> <p>Suppose you want these random numbers to be between <code>r_min</code> and <code>r_max</code>. For each element in your list, generate a random number <code>r</code>, and make <code>list[i]=list[i-1]+r</code>. This would give you random numbers which are monotonically increasing, guaran...
14,488
<p>Is there any way to restrict users with administrative privileges from managing specific Windows service based applications? I would like to restrict administrators from stopping or re-starting my service very similar to the Windows event log service. What are some of the more popular approaches or recommended appro...
<p>To remove the stop option from the service management mmc. With .net service you:</p> <pre><code>ServicesToRun = new ServiceBase[] { new Service1() }; ServicesToRun[0].CanStop = false; </code></pre> <p>With win32 see the <a href="http://msdn.microsoft.com/en-us/library/ms685996(VS.85).aspx" rel="nofollow noreferre...
<p>Here is one approach using access control - <a href="http://support.microsoft.com/?kbid=288129" rel="nofollow noreferrer">http://support.microsoft.com/?kbid=288129</a></p>
37,386
<p>I'm building an application against some legacy, third party libraries, and having problems with the linking stage. I'm trying to compile with Visual Studio 9. My compile command is:</p> <pre><code>cl -DNT40 -DPOMDLL -DCRTAPI1=_cdecl -DCRTAPI2=cdecl -D_WIN32 -DWIN32 -DWIN32_LEAN_AND_MEAN -DWNT -DBYPASS_FLEX -D_IN...
<p>These are standard library references. Make sure that all libraries (including the standard library) are using the <em>same</em> linkage. E.g. you can't link statically while linking the standard lib dynamically. The same goes for the threading model used. Take special care that you and the 3rd party library use the...
<p>After trying to get this stuff to compile under VS 2008, I tried earlier versions of VS - 2005 worked with warnings, and 2003 just worked. I double checked the linkages and couldn't find any problems, so either I just couldn't find it, or that wasn't the problem. </p> <p>So to reiterate, downgrading to VS 2003 fi...
4,321
<p>Let's say I have the following code:</p> <pre><code>@sites = Site.find(session[:sites]) # will be an array of Site ids @languages = Language.for_sites(@sites) </code></pre> <p>for_sites is a named_scope in the Language model that returns the languages associated with those sites, and languages are associated with ...
<p>You could extend the array returned by Site.find.</p> <pre><code>class Site def find(*args) result = super result.extend LanguageAggregator if Array === result result end end module LanguageAggregator def languages Language.find(:all, :conditions =&gt; [ 'id in (?)', self.collect { |site| sit...
<p>Your instance variable @sites is an Array object and not Site so I don't think named_scope can be used. You can open up Array class to achieve this effect though (yikes)</p> <pre><code>class Array def languages ... end end </code></pre>
27,099
<p>We all write reusable classes and code. </p> <p>We factor in configurability to allow us to reuse this fantastic new class again and again. </p> <p>We tell our bosses that spending this extra time now will save us time and money later. </p> <p>But in reality, for those of us who don't write third party librari...
<p>My common rule of thumb is:</p> <ol> <li>If you repeat it once, copy it.</li> <li>If you repeat it twice, refactor it.</li> </ol>
<p>I agree with you insofar as there is no point in coding in a way that makes the class easy to use outside of the current application. Most if us don't do this and in business environments there is no need to. If another application needs this functionality at a later date then extracting and commonalising the code c...
42,156
<p>How would you take an arbitrary list of strings (of the form "%[text]%") and a database column, and turn them into a SQL query that does a LIKE comparison for each string in the list?</p> <p>An example: I have three strings in my list, "%bc%", "%def%" and "%ab%". This builds the query:</p> <pre><code>([ColumnName]...
<p>To answer your question directly,</p> <pre><code>string.join(" and ", (new[] { "%bc%", "%def%", "%ab%" }) .Select(x =&gt; string.Format("[{0}] LIKE '{1}'",columnName, x)) .ToArray()); </code></pre> <p>To solve your problem, you should use the Sql Server full-text search tools. the query would be:</p> ...
<p>It's just a string join on a map:</p> <pre><code>&gt;&gt;&gt; los=['ab', 'cd', 'ef'] &gt;&gt;&gt; ' and '.join(("somecolumn like '%%%s%%'" % s) for s in los) "somecolumn like '%ab%' and somecolumn like '%cd%' and somecolumn like '%ef%'" </code></pre> <p>or</p> <pre><code>&gt;&gt;&gt; ' and '.join(("somecolumn lik...
41,267
<p>How do I find out whether or not Caps Lock is activated, using VB.NET?</p> <p>This is a follow-up to my <a href="https://stackoverflow.com/questions/58937/how-do-i-toggle-caps-lock-in-vbnet">earlier question</a>.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.control.iskeylocked.aspx" rel="noreferrer">Control.IsKeyLocked(Keys) Method - MSDN</a></p> <pre><code>Imports System Imports System.Windows.Forms Imports Microsoft.VisualBasic Public Class CapsLockIndicator Public Shared Sub Main() ...
<p>The solution posted by <a href="https://stackoverflow.com/a/58993/7444103">.rp</a> works, but conflicts with the <code>Me.KeyDown</code> event handler.<br> I have a sub that calls a sign in function when enter is pressed (shown below).<br> The <code>My.Computer.Keyboard.CapsLock</code> state works and does not confl...
8,343
<p>I want to know when an image has finished loading. Is there a way to do it with a callback?</p> <p>If not, is there a way to do it at all?</p>
<p><strong><code>.complete</code> + callback</strong></p> <p>This is a standards compliant method without extra dependencies, and waits no longer than necessary:</p> <pre><code>var img = document.querySelector('img') function loaded() { alert('loaded') } if (img.complete) { loaded() } else { img.addEventListe...
<p>If you are using React.js, you could do this:</p> <pre><code>render() { </code></pre> <p>// ...</p> <pre><code>&lt;img onLoad={() =&gt; this.onImgLoad({ item })} onError={() =&gt; this.onImgLoad({ item })} src={item.src} key={item.key} ref={item.key} /&gt; </code></pre> <p>// ... }</p> <p>Where: <li>- on...
35,400
<p>I am a Delphi novice, but I'm trying to understand the relationship between TApplication and TfrmMain windows using Spy++. It seems that the TfrmMain window is the real window that has proper screen coordinates, but the TApplication window is the one that appears in the Windows taskbar. Also, they don't seem to be r...
<p>TApplication is the class that encapsulates your application and handles things like the Windows Messaging. TfrmMain will be a subclass of TForm which will be your Applications "Main Form".</p> <p>So basically, TApplication is the controller so to speak and it owns and creates TfrmMain, and forwards messages to it,...
<p>With applications made with versions of Delphi BEFORE Delphi 2007, the "secret window" would be the visible window in Vista's Flip 3D or preview. Here's a great article explaining how to compile Delphi applications on Delphi 2006 (and earlier) so that the "secret window" is not shown: <a href="http://www.installatio...
45,763
<p>I'm currently displaying a UIViewController like this:</p> <pre><code>[[self navigationController] presentModalViewController:modalViewController animated:YES]; </code></pre> <p>and hiding it like this:</p> <pre><code>[self.navigationController dismissModalViewControllerAnimated:YES]; </code></pre> <p>The animat...
<p>For iPhone 3.0+, a basic crossfade is easiest to do like this:</p> <pre><code>modalViewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; [[self navigationController] presentModalViewController:modalViewController animated:YES]; </code></pre>
<p>It should be <code>[self.view.window]</code> in order for the code to work</p> <p>(at least that's the way that it is in ios 3.2)</p>
29,371
<p>What exactly is GUID? Why and where I should use it? <br/> I've seen references to GUID in a lot of places, and in wikipedia, but it is not very clear telling you where to use it. If someone could answer this, it would be nice. Thanks</p>
<p>GUID technically stands for globally unique identifier. What it is, actually, is a 128 bit structure that is <em>unlikely</em> to ever repeat or create a collision. If you do the maths, the domain of values is in the <a href="https://en.wikipedia.org/wiki/Names_of_large_numbers#Standard_dictionary_numbers" rel="nor...
<p>To actually see what it looks like on a windows computer, go to cmd or powershell.</p> <ol> <li><p>Powershell =&gt; <code>[guid]::NewGuid()</code></p> </li> <li><p>CMD =&gt; <code>powershell [guid]::NewGuid()</code></p> </li> </ol> <p><a href="https://i.stack.imgur.com/LMEoD.png" rel="nofollow noreferrer"><img src=...
48,594
<p>I need to extract the icon from a windows shortcut (.lnk) file (or find the icon file, if it's just pointed to by the shortcut).</p> <p>I'm not asking about extracting icons from exe's, dll's, etc. The shortcut in question is created when I run a installation program. And the icon displayed by the shortcut is not...
<p>This thread provides interesting informations about the <a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1407242&amp;SiteID=1" rel="noreferrer">data contained in a .lnk file</a></p> <p>The <a href="http://www.codeproject.com/KB/shell/systemiconsimagelist.aspx?display=PrintAll" rel="noreferrer">sSHGetF...
<p>To add a few more resources to this, because presumeably you wan't the Application's icon and not icon that has the shortcut in the bottom left corner:</p> <ul> <li><a href="http://www.msjogren.net/dotnet/eng/samples/dotnet_shelllink.asp" rel="nofollow noreferrer">Here's how to parse the LNK format using the WinApi...
44,626
<p>This is baffling me, maybe somebody can shine the light of education on my ignorance. This is in a C# windows app. I am accessing the contents of a listbox from a thread. When I try to access it like this<pre><code>prgAll.Maximum = lbFolders.SelectedItems.Count;</code></pre> I get the error. However, here is the...
<pre><code>prgAll.Maximum = lbFolders.SelectedItems.Count; </code></pre> <p>On that line you perform an assignment (<strong>set/add</strong>), which by default is not thread-safe.</p> <p>On the second line it's just a <strong>get</strong> operation, where thread-safety merely doesn't matter.</p> <p>EDIT: I don't mea...
<p>Try this:</p> <pre><code>private delegate void xThreadCallBack(); private void ThreadCallBack() { if (this.InvokeRequired) { this.BeginInvoke(new xThreadCallBack(ThreadCallBack)); } else { //do what you want } } </code></pre> <p>Though, the answer with the lambda expression ...
30,332
<p>For those of us that like to use the graphical version of Vim or Emacs, instead of the console version, which version do you recommend?</p> <p>For Vim, there's <a href="http://sourceforge.net/projects/macosxvim/" rel="nofollow noreferrer">Mac OS X Vim</a>, <a href="http://code.google.com/p/macvim/" rel="nofollow no...
<p><strong>MacVim</strong> works well and certainly looks more mature than Vim-Cocoa, moreover there is a Cocoa plugin architecture in the pipeline for MacVim (and someone is already working on a TextMate style file browser tray plugin which is a huge ++ IMHO).</p> <p>There was also a Carbon version of Vim, but this d...
<p>I love CarbonEmacs because it sticks very close to the standard GNU Emacs distribution, while still fitting in nicely with the Mac desktop. To me, it "felt" like Emacs on my Ubuntu desktop even if it looked like a Mac application.</p>
2,386
<p>is there a way to add an existing classic ASP webapp into a solution in VS? The application is around 4000 files large and currently maintained outisde Visual Studio.</p>
<p>The best way to do this IMO is:-</p> <p>In VS 2008 File | Open | Web Site...</p> <p>In the dialog ensure File System is selected. Navigate to the physical folder that represents the root of your Web app.</p> <p>Click Open. Job Done.</p>
<p>There's no real point though is there? As Classic ASP files aren't compiled. I keep just opening them individually as needed from File Explorer. </p> <p>Although you could add them all to a VBProj or CSProj so you get them all showing up in your Solution Explorer, and could use features like Project -> Deploy. </p...
12,539
<p>how come this work </p> <pre><code>public IQueryable&lt;Category&gt; getCategories(int postId) { subnusMVCRepository&lt;Categories&gt; categories = new subnusMVCRepository&lt;Categories&gt;(); subnusMVCRepository&lt;Post_Category_Map&gt; postCategoryMap = new subnusMVCRepository&lt;Post_Category_Map...
<p>The issue is most likely in the implementation of the query provider.</p> <p>pcm.PostId == 1 </p> <p>and</p> <p>pcm.PostId == postId </p> <p>actually have a big difference. In the expression tree the first is generated as a ConstantExpression which doesnt need to be evaulated.</p> <p>With the second, the compil...
<p>The problem is not the linq itself, you need to be sure that the context or provider object is able to fetch the data. try testing the </p> <pre><code>subnusMVCRepository&lt;Categories&gt; categories = new subnusMVCRepository&lt;Categories&gt;(); subnusMVCRepository&lt;Post_Category_Map&gt; postCategoryMap = new su...
36,924
<p>Lets say I have a single object of type Car which I want to render as HTML:</p> <pre><code>class Car { public int Wheels { get; set; } public string Model { get; set; } } </code></pre> <p>I don't want to use the ASP.NET Repeater or ListView controls to bind because it seems too verbose. I just have the one obj...
<p>if the page is about a specific item (For exemple, Car.aspx?CarID=ABC123), I normally have a public property on the page called "CurrentCar"</p> <pre><code>public Car CurrentCar { get; set; } </code></pre> <p>And I can then have the following:</p> <pre><code>&lt;div&gt; Wheels: &lt;%= CurrentCar.Wheels %&gt;&lt...
<p>One drawback of the protected property solution is that you cannot use it to bind to properties of controls.</p> <p>For example, the following would not work:</p> <pre><code>&lt;asp:Label ID="Label1" Text="Probably a truck" Visible='&lt;%# CurrentCart.Wheels &gt; 4 %&gt;' runat="server" /&gt; </code></pre>
27,841
<p>All I need is a way to make a property of one class only 'settable' from one other class (a sort of manager class).</p> <p>Is this even possible in c#?</p> <p>My colleague 'reliably' informs me that I have a design flaw, but I feel I should at least ask the community before I concede defeat!</p>
<p>No, it's not really possible to do this in any clean way in C#. You probably have a design flaw ;-)</p>
<p>if it is a design flaw depends on what you want to do. You could use the StackTrace class from System.Diagnostics to get the Type of the class setting your property and then compare to the type you want to allow setting yor property..but maybe there are better ways for performing something like this (e.g. boxing)</p...
29,657
<p>I'm just starting my first project in ASP.NET MVC. In my webforms experience, I would usually have a separate project dedicated to my domain layer. In here, I would have my Domain specific objects along with my NHibernate mapping files and some business logic. Most of the examples I am seeing online are putting thes...
<p>If you plan to reuse the model outside of the MVC app, a separate class library is still an acceptable setup. I do that, but leave the Models folder and put the models for my views in it.</p> <p>If you would put your DAL in App_Code in a Webforms project, then I would put it in Models in your MVC project. Otherwise...
<p>I layout my solutions in a similar manner -- businessLogic, dataaccess, domain objects all reside in one project. The view(s) (Web, Web services, windows forms, WPF..) all go into their own separate projects.</p> <p>That way UI specific code doesn't filter down in to the lower layers of the application. In most we...
48,660
<p>This follows on from <a href="https://stackoverflow.com/questions/292395/php-templating">this question</a> where I was getting a few answers assuming I was using files for storing my HTML templates.</p> <p>Before recently I've always saved 'compiled' templates as html files in a directory (above the root). My templ...
<p><strong>Don't Store Editable HTML In the database</strong></p> <p>Seriously, because the maintenance overhead for mere changes becomes exhaustive once you realise you can no longer just pop open a text editor. </p> <p>I worked on many projects which had HTML content in the database, and it was a constant nightmare...
<p>I pretty much agree with the gist of Kent Fredric's answer. But, if you really want to know, which is more efficient/faster, you cannot reasonably expect to get the answer here. If you want that answer, there is only one way to get it: profile the application both ways.</p>
37,312
<p>How do I go from this string: "ThisIsMyCapsDelimitedString"</p> <p>...to this string: "This Is My Caps Delimited String"</p> <p>Fewest lines of code in VB.net is preferred but C# is also welcome.</p> <p>Cheers!</p>
<p>I made this a while ago. It matches each component of a CamelCase name.</p> <pre><code>/([A-Z]+(?=$|[A-Z][a-z])|[A-Z]?[a-z]+)/g </code></pre> <p>For example:</p> <pre><code>"SimpleHTTPServer" =&gt; ["Simple", "HTTP", "Server"] "camelCase" =&gt; ["camel", "Case"] </code></pre> <p>To convert that to just insert sp...
<p>There's probably a more elegant solution, but this is what I come up with off the top of my head:</p> <pre><code>string myString = "ThisIsMyCapsDelimitedString"; for (int i = 1; i &lt; myString.Length; i++) { if (myString[i].ToString().ToUpper() == myString[i].ToString()) { myString = myString....
18,778
<p>I've seen a few fixes for allowing PNG images to have transparency in Internet Explorer 6, but I've yet to find one that also allows you to set the background position in CSS. If you use sprites, it's a deal-breaker. I've resorted to using GIF's (which are not as high quality), not using transparent images at all, o...
<p>Yes. Convert your images to use indexed pallets (png256). You can support transparency (just like gif), but not an alpha channel.</p> <p>You can do this using <a href="http://www.irfanview.com/" rel="nofollow noreferrer">Irfanview</a> and the pngout plugin, <a href="http://www.libpng.org/pub/png/apps/pngquant.htm...
<p>You can actually use pure CSS to get positioned background images with alpha transparency in IE6 by taking advantage of IE6's alpha filters and the CSS <code>clip</code> property. Julien Lecomte <a href="http://www.julienlecomte.net/blog/2007/07/4/" rel="nofollow noreferrer">describes the technique on his blog</a>.<...
11,205
<p>I have seen some gridview header freezing examples on the web but I have a special case where the gridview is in a fixed width div. The examples I tried make the header fixed but the full width of the header is shown and it overflows out of the div while the grid body has a horizontal scroll bar.</p> <p>I need it t...
<p>I just wrote a jQuery plugin that does exactly what you need. You just build 1 table with a thead and tbody and it does the rest for you. Very simple to use...i posted the solution under another question linked below. Supported in IE6/7/8 too.</p> <p><a href="https://stackoverflow.com/questions/486576/frozen-table...
<p>Did you see this example? <a href="http://web.tampabay.rr.com/bmerkey/examples/locked-column-csv.html" rel="nofollow noreferrer">http://web.tampabay.rr.com/bmerkey/examples/locked-column-csv.html</a></p>
32,962
<p>I am trying to input data from a .txt file into a scheme structure. Each element is separated by a tab in the data file and each structure set is on a new line. I want to be able to read in the data from one line into a structure and make a list of each structure set in the file. Any suggestions?</p>
<p>Not really sure what structures you had in mind, but say you had a text file like the following:</p> <pre> --> cat blah.txt foo bar baz 1 2 3 4 5 aa bb cc dd ee </pre> <p>You could convert it directly into a list of lists in scheme using sed:</p> <pre> --> echo "(define mylist '("`sed -e 's/\(.*\)/(\1)/' blah.tx...
<p>Sounds like a CSV file with tabs instead of commas. If you're using PLT Scheme (DrScheme/mzscheme) neil's csv library is probably what you want.</p> <p><a href="http://planet.plt-scheme.org/package-source/neil/csv.plt/1/2/doc.txt" rel="nofollow noreferrer">Here is the documentation</a>.</p> <p>Here is how to load ...
42,523
<p>Regarding the same program as <a href="https://stackoverflow.com/questions/20061/store-data-from-a-c-application">my question a few minutes ago</a>... I added a setup project and built an MSI for the program (just to see if I could figure it out) and it works great except for one thing. When I tried to install it o...
<p>Indeed, boot from a clean CD (use a known good machine to build <a href="http://nu2.nu/pebuilder/" rel="nofollow noreferrer">BartPE</a> or something similar) and scan your machine thoroughly. Another good thing to check, though, would be exactly which virus Avast! thinks your program is. Once you know that, you sh...
<p>The very first thing to do would be to scan your build PC for viruses.</p>
4,051
<p>I'd love to figure it out myself but I was wondering <strong>roughly what's the algorithm for converting a function with yield statements into a state machine for an enumerator?</strong> For example how does C# turn this:</p> <pre><code>IEnumerator&lt;string&gt; strings(IEnumerable&lt;string&gt; args) { IEnumerato...
<p>The particular code sample you are looking at involves a series of transformations. Please note that this is an approximate description of the algorithm. The actual names used by the compiler and the exact code it generates may be different. The idea is the same, however.</p> <p>The first transformation is the "for...
<p>Raymond Chen answers this <a href="https://devblogs.microsoft.com/oldnewthing/20080812-00/?p=21273" rel="nofollow noreferrer">here</a>.</p>
15,997
<p>Is it possible for a stand alone executable to generate a report and output it as PDF (or one of the other export options available from the report viewer) without displaying the ReportViewer control? </p> <p>The report definition should be embedded in the executable and should not use the Reporting Services web se...
<p>Actually you don't need a ReportViewer at all, you can directly instantiate and use a LocalReport:</p> <pre><code>LocalReport report = new LocalReport(); report.ReportPath = "templatepath"; // or use file from resource with report.ReportEmbeddedResource // add parameters, datasource, etc. Warning[] warnings; stri...
<p>Can you pass a .rdlc report directly to pdf with parameters? I have two dropdownlists that i pull my report with. I can't get the parameters to work when automatically exporting to pdf. Here is the error I get: Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: One or more parameters required to...
16,727
<p>I am looking for a simple, clean, correct XML parser to use in my C++ project. Should I write my own?</p>
<p>How about <a href="http://rapidxml.sourceforge.net/" rel="noreferrer"><strong>RapidXML</strong></a>? RapidXML is a very fast and small XML DOM parser written in C++. It is aimed primarily at embedded environments, computer games, or any other applications where available memory or CPU processing power comes at a pre...
<p>Try <a href="http://sourceforge.net/projects/tinyxml" rel="nofollow noreferrer">TinyXML</a> or <a href="http://www.ambiera.com/irrxml/" rel="nofollow noreferrer">IrrXML</a>...Both are lightweight XML parsers ( I'd suggest you to use TinyXML, anyway ). </p>
20,591
<p>I am trying to take a shapefile of subdivisions within a county that I have created and line it up with another shapefile that was given to me by the County Appraisal District (parcel data). When I try to get them to line up then my streets shapefiles is not aligned with everything else. They are all on the same c...
<p>This is a question with answers that may be simple or may be very complex, depending on your situation. As a GIS developer, I've most commonly seen this as a symptom of an incorrectly defined coordinate system. However, whether this is the case or not, and what the solution is strongly depends on your environment....
<p>Your problem is probably one of projection</p> <p>| projection: character string that names a map projection to use. See | 'mapproject' (in the 'mapproj' library). The default is to | use a rectangular projection with the aspect ratio chosen so | that longitude and latitude scales are ...
29,013
<p>I have designed this in Blender:</p> <p><a href="https://i.stack.imgur.com/ucC7j.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ucC7j.png" alt="Screenshot"></a></p> <p>The bottom is a regular n-gon with 0.8mm in height. In Slic3r, I see that the bottom-most layer is not solid:</p> <p><a href="...
<p>I printed the thing for some layers to see what the printer actually does: <a href="https://i.stack.imgur.com/mwBgB.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mwBgB.jpg" alt="Inner ring"></a></p> <p>There are clearly too many retractions and unretractions.</p> <p>This can be seen in advance...
<p>Blender is not a preferred program to model solids, it is great though for many other visualizations. Apparently, the green parts are not solid models in your original Blender design, they are most probably surfaces, when you create an STL, the model is not solid, it contains surfaces. All this causes problems for y...
1,111
<p>How do I configure Apache 2.0's log format so that it timestamps each request log with millisecond (or microsecond) accuracy? The <a href="http://httpd.apache.org/docs/2.0/logs.html" rel="nofollow noreferrer">docs</a> say that timestamps are specified in strftime format and strftime doesn't seem to handle anyting sm...
<p>I don't think it's possible (without rewriting APR, atleast). Apache uses <a href="https://apr.apache.org/docs/apr/2.0/group__apr__time.html#ga3f5e1aa45e735f3bcf8c13fb718c214f" rel="nofollow noreferrer">apr_strftime</a>. On Unix, this calls the C library's strftime, but doesn't even fill milliseconds into struct tm ...
<p>use %D option for microsecond accuracy</p>
43,505
<p>I need to cast single figures (1 to 9) to (01 to 09). I can think of a way but its big and ugly and cumbersome. I'm sure there must be some concise way. Any Suggestions</p>
<p>First of all, your description is misleading. <code>Double</code> is a floating point data type. You presumably want to pad your digits with leading zeros in a string. The following code does that:</p> <pre><code>$s = sprintf('%02d', $digit); </code></pre> <p>For more information, refer to the documentation of <a ...
<p>Here is my solution to handle both positive and negative numbers</p> <pre class="lang-php prettyprint-override"><code>&lt;?php // add zeros to a number at left or right side. function add_zeros_to_number( $number, $number_of_zeros, $zeros_position=&quot;left&quot;){ // check if number is negative $is_negati...
42,006
<p>Often times I find myself using std::pair to define logical groupings of two related quantities as function arguments/return values. Some examples: row/col, tag/value, etc.</p> <p>Often times I should really be rolling my own class instead of just using std::pair. It's pretty easy to see when things start breaking ...
<p>This is what <a href="http://www.boost.org/doc/libs/1_36_0/libs/tuple/doc/tuple_users_guide.html" rel="nofollow noreferrer">Boost.Tuple</a> was made for.</p> <p>But you should probably be using <a href="http://en.cppreference.com/w/cpp/utility/tuple" rel="nofollow noreferrer">std::tuple</a> now...</p>
<p>Unfortunately <a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2141.html" rel="nofollow noreferrer">strong <code>typedef</code>s</a> will not make it into <a href="http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2008/n2565.html" rel="nofollow noreferrer">C++0x</a>, it has been given the classific...
24,738
<p>I am using VC++. Is <code>assert(false)</code> ignored in release mode?</p>
<p>If compiling in release mode includes defining NDEBUG, then yes.</p> <p>See <a href="https://msdn.microsoft.com/library/9sb57dw4.aspx" rel="noreferrer">assert (CRT)</a></p>
<p>I think it is a mistake to rely too much on the exact behavior of the assert. The correct semantics of "assert(expr)" are:</p> <ul> <li>The expression expr may or may not be evaluated.</li> <li>If expr is true, execution continues normally.</li> <li>If expr is false, what happens is undefined.</li> </ul> <p>More ...
33,995
<p>This article on Microsoft's tech net site supplies an <code>exe</code> that will calculate your windows machine's minimum time resolution - this should be the smallest "tick" available to any application on that machine:</p> <p><a href="http://technet.microsoft.com/en-us/sysinternals/bb897568.aspx" rel="nofollow no...
<p>You can get down to 1 ms with <a href="http://msdn.microsoft.com/en-us/library/ms712704(VS.85).aspx" rel="nofollow noreferrer">multimedia timers</a> and even further with QueryPerformanceCounter.</p> <p>See also <a href="https://stackoverflow.com/questions/49668/getlocaltime-api-time-resolution#49720">GetLocalTime(...
<p>The <a href="http://en.wikipedia.org/wiki/Intel_APIC_Architecture" rel="nofollow noreferrer">APIC</a> on the processor runs at bus speed and has a timer. They may be using that instead of the system time. (Or they might just be giving a bunch of precision that isn't there.)</p> <p>This <a href="http://osdev.berli...
16,384
<p><code>Checkboxes</code> in <code>HTML</code> forms don't have implicit <em>labels</em> with them. Adding an explicit label (some text) next to it doesn't toggle the <code>checkbox</code>.</p> <p><strong>How do I make a checkbox toggle from clicking on the text label as well?</strong></p>
<p>If you correctly markup your HTML code, there is no need for javascript. The following code will allow the user to click on the label text to tick the checkbox.</p> <pre><code>&lt;label for="surname"&gt;Surname&lt;/label&gt; &lt;input type="checkbox" name="surname" id="surname" /&gt; </code></pre> <p>The <em>for</...
<p>Wrapping with the label still doesn't allow clicking 'anywhere in the box' - still just on the text! This does the job for me:</p> <pre><code>&lt;div onclick="dob.checked=!dob.checked" class="checkbox"&gt;&lt;input onclick="checked=!checked" id="dob" type="checkbox"/&gt;Date of birth entry must be completed&lt;/div...
2,431
<p>I want to keep my website/s in version control (Subversion specifically) and use <code>svn co</code> to update it when there are stable versions to update, but I'm concerned about the security of doing so, as all the <code>.svn</code> folders will be public, and these include all sorts of private data, not least of ...
<p>Two things:</p> <ol> <li><p>Do not use IfModule for functionality you need to be present. It's okay to do it for the autoindex because it might not be present and is not crucial to the scheme. But you are counting on rewrite being present to protect your content. Thus, it's better to remove the IfModule directive a...
<p>Hiding the directories as Vinko says should work. But it would probably be simpler to use <a href="http://svnbook.red-bean.com/en/1.5/svn.ref.svn.c.export.html" rel="nofollow noreferrer">svn export</a> instead of svn co. This should not generate the .svn directories. </p>
26,415
<p>Ok, so I'm building bread crumbs and depending on the value of the breadcrumb an image will be the seperator. So "HOME" will have one image and "SEARCH" will have another. </p> <p>I know I can do this programatically (at least I ASSUME) but is there an easier way to do this? Can I link an image to a node based on t...
<p>You can put an</p> <pre><code>&lt;asp:Image ... /&gt; </code></pre> <p>into the PathSerparatorTemplate but you still have to set the image url from code.</p>
<p>I see you have already accepted an answer, but I thought some code would help, so here is some:</p> <h2>Site1.Master</h2> <hr> <pre><code> &lt;asp:SiteMapPath ID="SiteMapPath1" Runat="server" OnItemDataBound="Item_Bound"&gt; &lt;PathSeparatorTemplate&gt; &lt;asp:Image ID="SepImage" runat="s...
24,218
<p>For example:</p> <pre><code>public class A : A.B { public class B { } } </code></pre> <p>Which generates this error from the compiler:</p> <blockquote> <p>Circular base class dependency involving 'A' and 'A.B'</p> </blockquote> <p>I always figured a nested class behaved just like a regular class except w...
<p>There's no implicit inheritance involved as far as I can tell. I would have expected this to be okay - although I can imagine weirdness if A and B were generic.</p> <p>It's specified in section 10.1.4 of the spec:</p> <blockquote> <p>When a class B derives from a class A, it is a compile-time error for A to ...
<p>This makes no sense to me... You are trying to extend something that doesn't exist !!! Class B only exists in the scope of class A and because of this I think there is some kind of inheritance.</p>
33,293
<p>I'm trying to write some LINQ To SQL code that would generate SQL like</p> <pre><code>SELECT t.Name, g.Name FROM Theme t INNER JOIN ( SELECT TOP 5 * FROM [Group] ORDER BY TotalMembers ) as g ON t.K = g.ThemeK </code></pre> <p>So far I have</p> <pre><code>var q = from t in dc.Themes join g in dc.Groups on t.K...
<p>Just bracket your query expression and call Take on it:</p> <pre><code>var q = from t in dc.Themes join g in dc.Groups on t.K equals g.ThemeK into groups select new { t.Name, Groups = (from z in groups orderby z.TotalMembers select z.Name).Take(5) }; </code></pre> <p>In fact, the query expression isn't r...
<p>Just bracket your query expression and call Take on it:</p> <pre><code>var q = from t in dc.Themes join g in dc.Groups on t.K equals g.ThemeK into groups select new { t.Name, Groups = (from z in groups orderby z.TotalMembers select z.Name).Take(5) }; </code></pre> <p>In fact, the query expression isn't r...
31,684
<p>I created a couple of tables procedurally via C# named something like <code>[MyTableOneCustom0]</code> and <code>[MyTableTwoCustom0]</code>. When I try to return all of the values from these tables via &quot;Open Table&quot; in MSSQL Server Management Studio, I receive the following error:</p> <blockquote> <p>Error ...
<p>Based on a similar post loacated at at <a href="http://www.eggheadcafe.com/software/aspnet/30462589/exception-has-been-thrown.aspx" rel="nofollow noreferrer">Egg Head Cafe</a>, it looks like the Management Studio will thrown an exception if there are too many columns included explicitly in the query. Select * return...
<p>I hesitate to ask, but normally you would not want 800 or columns in a database, so why did you do this? Given how databases store information you are possibly creating many problems for yourself with a design like that in terms of data retrieval and storage. How many bytes of data woudl a full row have? You know th...
12,866
<p>When I was learning Java coming from a background of some 20 years of procedural programming with basic, Pascal, COBOL and C, I thought at the time that the hardest thing about it was wrapping my head around the OOP jargon and concepts. Now with about 8 years of solid Java under my belt, I have come to the conclusi...
<p>There are a number of techniques which are coming into the public consciousness just now (as in: the last few years). A big one would be actors. This is something that Erlang first brought to the grid iron but which has been carried forward by newer languages like Scala (actors on the JVM). While it is true that ...
<p>Writing all the code in a multi-threaded application very... carefully! I don't know any better answer than that. (This involves stuff like <a href="https://stackoverflow.com/questions/256517/best-programming-approachmethodology-to-assure-thread-safety#256535">jonnii</a> mentioned). </p> <p>I've heard people argue ...
32,010
<p>I have installed Delphi Prism and XNA Game Studio 3.0. I have managed to translate to Delphi Prism XNA Tutorial 1 "Displaying a 3D Model on the Screen" (<a href="http://msdn.microsoft.com/en-us/library/bb197293.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/bb197293.aspx</a>). Project compi...
<p>You could just manually build the content project using msbuild. It might not have the same integration where you can just add content and change settings in solution explorer ... but it'll do the trick :-) </p> <p>here is more info about this: <a href="http://blogs.msdn.com/shawnhar/archive/2006/11/07/build-it-a...
<p>I haven't done any XNA stuff yet, but here is my best guess :-)</p> <p>So, the Content Project type is a sub-project for a standard XNA project that just compiles the game content (textures, sound etc) as a nested compile process, correct?</p> <p>So I would assume that there must be some reference to the sub-proje...
42,016
<p>I have an enumeration: <code>ENUM( 'alpha', 'beta', 'gamma', 'delta', 'omega' )</code></p> <p>If I sort my table by this column I get them in the correct order defined above.</p> <p>However, I can't find a way to select a subset of these, e.g. everything before delta. Using <code>WHERE status &lt; 'delta'</code> o...
<p>You're trying to use data-manipulation methods on metadata, and this is bound to be awkward. </p> <p>This is a good reason to replace the <code>ENUM</code> with a foreign key to a lookup table. Then you can use conventional data-manipulation techniques.</p>
<p>Create a function:</p> <pre><code>CREATE fEnumIndex(_table VARCHAR(50), _col VARCHAR(50), _val VARCHAR(50)) RETURNS INT DETERMINISTIC BEGIN DECLARE _lst VARCHAR(8192); DECLARE _ndx INT; SELECT REPLACE(REPLACE(REPLACE(COLUMN_TYPE,''', ''',','),'enum(',''),')','') FROM information_schema.COLUMNS WHER...
37,601
<p>IIS is literally sending <code>&lt;?php ... ?&gt;</code> code to the browser rather then executing it.</p> <p>But, only for the root <code>http://domain.com/index.php</code> file.</p> <p>All other .php files in that folder and index.php files in subfolders execute as expected.</p> <p>How can I get my root index.p...
<ul> <li><a href="http://forums.devshed.com/iis-97/iis-5-1-does-not-run-php-properly-under-root-163070.html" rel="nofollow noreferrer">IIS 5.1 does not run PHP properly under root directory, but fine in all other folders</a></li> <li><a href="http://www.simmonsconsulting.com/2008/04/21/running-a-wordpress-blog-in-site-...
<p>All though this is an old question, over 11 years later this is still an issue. My work around was to create default.aspx file and perform a redirect from within it. Save the file to the root directory of your website and add default.aspx to the default documents in IIS. Make sure you move it to the top of the list...
22,904
<p>I've seen this weird behavior on several sites recently: I scroll down a page and follow a link to another page. When I click the Back button and return, I am left back at the top of the previous page, not at the link. This is very annoying if I'm clicking on links in a search results page or a list of "10 Best Foo ...
<p>Many sites have a text box (for searching the site, or something) that is set to automatically take focus when the page loads (using javascript or something). In many browsers, the page will jump to that text box when it gets focus.</p> <p>It really is very annoying :(</p>
<p>Typically this behaviour is caused by the browser cache set by the site having a small or no time before expiry.</p> <p>On many sites, when you hit "back" you get brought back to the link you hit, as your browser is pulling the page from your cache. If this cache has not been set, a new page request is made, and th...
9,523
<p>What is the best way of doing case-insensitive string comparison in C++ without transforming a string to all uppercase or all lowercase?</p> <p>Please indicate whether the methods are Unicode-friendly and how portable they are.</p>
<p>Boost includes a handy algorithm for this:</p> <pre><code>#include &lt;boost/algorithm/string.hpp&gt; // Or, for fewer header dependencies: //#include &lt;boost/algorithm/string/predicate.hpp&gt; std::string str1 = "hello, world!"; std::string str2 = "HELLO, WORLD!"; if (boost::iequals(str1, str2)) { // Strin...
<pre class="lang-c++ prettyprint-override"><code>bool insensitive_c_compare(char A, char B){ static char mid_c = ('Z' + 'a') / 2 + 'Z'; static char up2lo = 'A' - 'a'; /// the offset between upper and lowers if ('a' &gt;= A and A &gt;= 'z' or 'A' &gt;= A and 'Z' &gt;= A) if ('a' &gt;= B and B &gt;= 'z' or '...
3,273
<p>From a desktop application developer point of view, is there any difference between developing for Windows XP and developing for Windows Vista?</p>
<p><strong>User Interface</strong></p> <p>Looking at the <a href="http://msdn.microsoft.com/en-us/library/aa511258.aspx" rel="nofollow noreferrer">Windows Vista User Experience Guidelines</a> you can see that they have changed many UI elements, which you should be aware of. Some major things to take note of:</p> <ul...
<p>By far the most painful part of moving an application from XP to Vista (from my point of view) is dealing with the numerous services and IPv6 stuff that uses ports which were previously free, and dealing with the Wireless Provisioning -> Native WiFi transition.</p> <p>The UAC stuff is basically a moot point; there ...
4,268
<p>I have a button inside an update panel that I would like to update the whole page. I have set <code>ChildrenAsTriggers="false"</code> and <code>UpdateMode="Conditional"</code>.</p> <p>I have some sample code here that demonstrates my problem.</p> <pre><code>&lt;asp:UpdatePanel ID="myFirstPanel" runat="server" Chil...
<p>Try adding a PostBackTrigger to the first UpdatePanel, for the secound button. That will tell that update panel, that the button should make a full postback.</p>
<p>If the label is not in an update panel the only way to refresh the value is by refreshing the entire page like in a normal postback. You would have to do a redirect to the same page to refresh it. The ajax framework knows to handle the redirects even if the request is from an update panel so just do an Response.Redi...
27,322
<p>What I'd like to avoid: </p> <pre><code>ManagementClass m = new ManagementClass("Win32_LogicalDisk"); ManagementObjectCollection managementObjects = m.GetInstances(); List&lt;ManagementObject&gt; managementList = new List&lt;ManagementObject&gt;(); foreach(ManagementObject m in managementObjects){ managemen...
<p>What version of the framework? With 3.5 you could presumably use:</p> <pre><code>List&lt;ManagementObject&gt; managementList = managementObjects.Cast&lt;ManagementObject&gt;().ToList(); </code></pre> <p>(edited to remove simpler version; I checked and <code>ManagementObjectCollection</code> only implements the non...
<p>you can convert like below code snippet</p> <pre><code>Collection&lt;A&gt; obj=new Collection&lt;return ListRetunAPI()&gt; </code></pre>
22,773
<p>Input: A positive integer K and a big text. The text can actually be viewed as word sequence. So we don't have to worry about how to break down it into word sequence.<br> Output: The most frequent K words in the text.</p> <p>My thinking is like this. </p> <ol> <li><p>use a Hash table to record all words' frequency...
<p>This can be done in O(n) time</p> <p><strong>Solution 1:</strong></p> <p>Steps:</p> <ol> <li><p>Count words and hash it, which will end up in the structure like this</p> <pre><code>var hash = { "I" : 13, "like" : 3, "meow" : 3, "geek" : 3, "burger" : 2, "cat" : 1, "foo" : 100, ... ... </code></...
<p>Suppose we have a word sequence "ad" "ad" "boy" "big" "bad" "com" "come" "cold". And K=2. as you mentioned "partitioning using the first letter of words", we got ("ad", "ad") ("boy", "big", "bad") ("com" "come" "cold") "then partitioning the largest multi-word set using the next character until you have k single-wor...
22,467
<p>I will choose Java as an example, most people know it, though every other OO language was working as well.</p> <p>Java, like many other languages, has interface inheritance and implementation inheritance. E.g. a Java class can inherit from another one and every method that has an implementation there (assuming the ...
<p>Short answer: Yes it is possible. But you have to do it on purpose and no by chance ( using final, abstract and design with inheritance in mind, etc. )</p> <p>Long answer:</p> <p>Well, inheritance is not actually for "code re-use", it is for class "specialization", I think this is a misinterpretation. </p> <p>For...
<p>You should read Design Patterns. You will find that Interfaces are critical to many types of useful Design Patterns. For example abstracting different types of network protocols will have the same interface (to the software calling it) but little code reuse because of different behaviors of each type of protocol.</p...
15,052
<p>I have a system which generates a large number of XML documents every day (of the order of 1 million) and I would like to be able to store and index these so that I can, for example, search for all documents with a certain field set to a given value.</p> <p>I understand that there are fundamentally two types of XML...
<p>Microsoft SQL Server has support for XML columns. This is more than just BLOB/TEXT support. </p> <p>You can use XML columns in an unstructured manner, where SQL Server will just ensure they are correct XML. This allows storage of arbitrary XML documents inside SQL Server, but still ensuring you're dealing with XML ...
<p>Definitely try MS-SQL, Oracle, and other existing systems that support XQuery.</p> <p>But, if the XML-based queries you'll need are known in advance, it might be easier to just store the XML in a BLOB, and add an indexed field or two with a copy of the relevant XML element(s).</p>
23,823
<p>I am using Scribd API (www.scribd.com) to display the PDF files in my website. I just want to know is there any other PDF API which i can use to embed the PDF in my website. FASTER and MORE customizable than Scribd, Mainly i want to put my company logo in that API, whereas in scribd they are displaying there logo.</...
<p>Depending on how much functionality you're looking for, it's not incredibly difficult to roll your own. <a href="http://www.swftools.org/" rel="noreferrer">SWFTools</a> lets you convert PDF to SWF, a format you can load in to a simple Flash viewer.</p>
<p>May be you could try this one: <a href="http://lededansdubocal.net/spip.php?article22" rel="nofollow noreferrer">FreepapeR</a></p>
47,637
<p>One of our clients is upgrading their servers because the old machines can't handle the load of the database anymore. They have been using sql 2000 for the last 6 years and the db has grown to hold a few GB of data.</p> <p><strong>Will it be worth upgrading to 2005 or 2008? What are the major benefits of the new ve...
<p>I you are planing to upgrade from SqlServer 2000 I would skip 2005 and go directly to SqlServer 2008</p> <p>It has all the features of 2005 plus some extras (for example an option to pass a table variable as a parameter to stored procedure, new date types, spatial data handling,etc.)</p> <p>You can refer to <a hre...
<p>Online index rebuilds are a nice feature to have. I think it might only be an option in Enterprise edition though.</p>
42,810
<p>In the spirit of being helpful, this is a problem I had and solved, so I will answer the question here. </p> <p><strong>Problem</strong></p> <p>I have:</p> <p>An application that has to be installed on on Redhat or SuSE enterprise. </p> <p>It has huge system requirements and requires OpenGL.</p> <p>It is part o...
<p><strong>Solution</strong></p> <p>I installed two pieces of software:</p> <p><a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/" rel="noreferrer">PuTTY</a></p> <p><a href="http://www.straightrunning.com/XmingNotes/" rel="noreferrer">XMing-mesa</a> The mesa part is important.</p> <p><strong>PuTTY configur...
<p>For OpenGL, running an X server is definitely a better solution. Just make sure the application is developed to be networked. It should NOT use immediate mode for rendering and textures should be RARELY transferred. </p> <p>Why is X server a better solution in this case (as opposed to VNC)? Because you get accelera...
13,167
<p>From my experiments, it does not appear to do so. If this is indeed true, what is the best method for removing line breaks? I'm currently experimenting with the parameters that TRIM accepts of the character to remove, starting with trimming <code>\n</code> and <code>\r</code>.</p>
<p>My line breaks were in the middle of the string, and I didn't have control over the source data. The following mysql command worked for me:</p> <pre><code>REPLACE(FIELD,'\r\n',' ') </code></pre>
<p><code>REPLACE(FIELD,'\r\n',' ')</code> works perfectly on MySql 5.1 database </p>
35,658
<p>We have a application that should always be running. Does anyone know of a way to create an automated way of monitoring to see if this application is running (possibly using a batch file)? If it is not running, then send an email notification and start the application?</p>
<p><a href="http://www.nagios.org/" rel="nofollow noreferrer">Nagios</a> is generally what's used by systems administrators that I've come across. You can script it to do whatever check you need and alert based on a variety of conditions. Works well with cacti so you can graph stuff too :)</p> <p>If you want to ensure...
<p>You don't mention an OS but if you're looking for something on Windows, <a href="http://www.jockersoft.com/english/appmonitor_index.php" rel="nofollow noreferrer">Application Monitor</a> might be a good start.</p> <p>If you're on Linux, <a href="http://mmonit.com/monit/" rel="nofollow noreferrer">monit</a> look pre...
36,415
<p>I'm involved on a project to make a survey system. We've been hammering out the logic for a few question types, and I could use a second opinion on what is the best way to proceed. We work on a ASP.NET 2.0 website using VB(VS2005) with an Oracle database.</p> <p>In our oracle server, we plan for some tables to or...
<p>Unfortunately no, until they sort out, at the least, the following issue:</p> <p>When you visit a site that needs Flash and you haven't got Flash installed, you get a very standard looking popup asking you if you to install it, and mentioning in the notes that it may not be safe to install an untrusted plugin.</p> ...
<p>No.<br> The competition on desktop application market is much bigger, and users are expectiong more functionality and performance from desktop application than from web application, and AIR is just not there yet wrt performance and desktop capabilities.</p>
44,774
<p>Basically, I'm trying to write the following (pseudocode) in an ASP.NET HttpModule:</p> <pre><code>*pre-code* try { handler.ProcessRequest(...) } catch (Exception) { *error-code* } finally { *post-code* } </code></pre> <p>I've found that I can hook into HttpModule.PreExecuteHandler for "pre-code" and .Error for "e...
<p>There is no way to do what you want (in a HttpModule, at least), other than to not call Response.End. <a href="http://www.west-wind.com/Weblog/posts/494.aspx" rel="nofollow noreferrer">This article</a> explains it pretty well and offers an alternative to Response.End in case it is a side-effect of your having called...
<p>Add this to your Global.asax file:</p> <pre><code>protected void Application_PreRequestHandlerExecute(object sender, EventArgs e) { // } protected void Application_PostRequestHandlerExecute(object sender, EventArgs e) { // } </code></pre> <p>That should work 100%.</p>
36,855
<p>is it possible to create something like <a href="https://web.archive.org/web/20200805044711/http://geekswithblogs.net/AzamSharp/archive/2008/02/24/119946.aspx" rel="nofollow noreferrer">this</a> i ASP.NET MVC beta 1</p> <p>i have tried but the</p> <pre><code>override bool OnPreAction(string actionName, ...
<p>In the blogpost you are referring to, the author states that </p> <blockquote> <p>One way to solve this problem is by using the attribute based security as shown on this post. But then you will have to decorate your actions with the security attribute which is not a good idea.</p> </blockquote> <p>I think it's a...
<p>What is the reasoning for not wanting to decorate your actions with an authorization attribute? Sorry, but I think I'll have to understand your situation better, if I am to try to provide a better answer than the one already given.</p>
41,121
<p>I'm writing an Excel Addin using COM Interop from .net. I have a command that pops up a dialog, and from the dialog I do some work like collecting data from the used range of several sheets. The problem is that if a cell is in edit mode, some of the calls that I need to make will throw exceptions. I would like a way...
<p>There is an Application.Ready property that is supposed to give you this information but in practice it doesn't work reliably. See <a href="http://www.codeproject.com/KB/office/Excel_Edit_Mode.aspx" rel="noreferrer">here</a> for a hackaround.</p> <p>You might also want to look at setting Application.Interactive=fal...
<p>You didn't mention which language you're using. <a href="https://stackoverflow.com/a/25057820/3626160">SZL's function</a> is written in VB. Since I'm using C# I had to convert it. Worked great. Here is the equivalent C# code.</p> <pre><code> bool IsInEditMode(ref Microsoft.Office.Interop.Excel.Application exapp...
27,372
<p>I am using LINQ-to-SQL for an application that queries a legacy database. I need to call a stored procedure, that selects a single integer value. Changing the stored procedure is not an option.</p> <p>The designer creates a method with this signature:</p> <pre><code>private ISingleResult&lt;sp_xal_seqnoResult&gt; ...
<p>This would be trivial with a scalar function (UDF) rather than an SP. However, it should work easily enough - although if the SP is complex (i.e. FMT_ONLY can't inspect it 100%) then you might need to "help" it...</p> <p>Here's some dbml that I generated from a simplfied SP that returns an integer; you can edit the...
<p>If you are using Visual Studio's .xsd file in a Linq to SQL classes project, make sure you:</p> <ol> <li>Right click the stored procedure or function call in the Adapter.</li> <li>Select Properties</li> <li><strong>Change Execute Mode to Scalar</strong></li> </ol> <p>That will make your adapter function return typ...
36,519
<p>Every so often I get an error saying one of my tables "is marked as crashed and should be repaired". I then do a REPAIR TABLE and repair it. What causes them to be marked as crashed and how can I prevent it? I am using MyISAM tables with MySQL 5.0.45.</p>
<p>There can be a few reasons tables get corrupted, it is discussed in detail in the <a href="http://dev.mysql.com/doc/refman/5.0/en/corrupted-myisam-tables.html" rel="noreferrer">manual</a>. </p> <p>To combat it, the following things work best:</p> <ol> <li>Make sure you always MySQL shutdown properly</li> <li>Cons...
<p>It could be many things, but <a href="http://www.mysqlperformanceblog.com/2006/06/17/using-myisam-in-production/" rel="nofollow noreferrer" title="Using MyISAM in production">MySQL Performance Blog</a> mentions bad memory, OS or MySQL bugs that could cause hidden corruption. Also, that and <a href="http://www.mysqlp...
12,238
<p>I get the following error when attempting to install <a href="http://docs.rubygems.org/" rel="nofollow noreferrer">RubyGems</a>. I've tried Googling but have had no luck there. Has anybody encountered and resolved this issue before?</p> <pre><code> C:\rubygems-1.3.0> ruby setup.rb . . install -c -m 0644 rubygems/val...
<p>I assume you're not trying to install under cygwin; that install is meant for unix-like operating systems. Edit: (Actually, from the log above it looks like there is some Windows-specific stuff being run... perhaps you're running into a UAC protection issue?)</p> <p>If you just use the <a href="http://rubyforge.org...
<p>I have rubygems 1.2.0 installed on Vista and it works fine. I have no tested rubygems 1.3.0 yet.</p>
18,200