instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>How do I create subdomain like <code>http://user.mywebsite.example</code>? Do I have to access <code>.htaccess</code> somehow? Is it actually simply possible to create it via pure PHP code or I need to use some external script-server side language?</p> <p>To those who answered: Well, then, should I ask my hosting if...
<p>You're looking to create a custom <strong>A record</strong>.</p> <p>I'm pretty sure that you can use wildcards when specifying A records which would let you do something like this:</p> <pre><code>*.mywebsite.example IN A 127.0.0.1 </code></pre> <p><em><code>127.0.0.1</code> would be the IP address of yo...
<h3>You can accomplish this via two steps.</h3> <ol> <li>Setup wildcard subdomain</li> <li>Get the subdomain entered by user</li> <li>Validate the subdomain</li> </ol> <hr /> <h3>1. Setup wildcard subdomain</h3> <p>This might vary depending on your hosting provider. I use Namecheap.com, and the process was as simple as...
22,242
<p>I am creating a custom UserType in Hibernate for a project. It has been relatively straightforward until I came to the isMutable method. I am trying to figure out what this method means, contract-wise. </p> <p>Does it mean the class I am creating the UserType for is immutable or does it mean the object that holds a...
<p>Hibernate will treat types marked as "mutable" as though they could change (i.e. require an UPDATE) <em>without</em> pointing to a new reference. If you assign a new reference to a Hibernate-loaded property Hibernate will recognize this even if the type is immutable - this happens all the time with, for instance, St...
<p>The typical example here is the String class - it is Immutable, i.e. once the string is created you cannot change its contents or state, and if you want to then you're going to have to process it into a new copy. </p> <p>isMutable returning true means you are saying this object can have its state changed by outside...
27,735
<p>Ok, here's one for the Java/JavaScript gurus:</p> <p>In my app, one of the controllers passes a TreeMap to it's JSP. This map has car manufacturer's names as keys and Lists of Car objects as values. These Car objects are simple beans containing the car's name, id, year of production etc. So, the map looks something...
<p>Well anyway, as i said, i finally managed to do it by myself, so here's my answer... </p> <p>I receive the map from my controller like this (I'm using Spring, don't know how this works with other frameworks):</p> <pre><code>&lt;c:set var="manufacturersAndModels" scope="page" value="${MANUFACTURERS_AND_MODELS_MAP}"...
<p>How about something like this, using prototype? First, your select box of categories:</p> <pre><code>&lt;SELECT onchange="changeCategory(this.options[this.selectedIndex].value); return false;"&gt; &lt;OPTION value="#categoryID#"&gt;#category#&lt;/OPTION&gt; ... </code></pre> <p>Then, you output N different s...
18,982
<p>I need to get the image dimensions of a JPEG in C++. I'm looking for either a fairly simple way to do it or a smallish library that provides that functionality. I'm working in C++ on OpenVMS, so any external libraries may have to be adapted to compile on our systems - so please don't post me links to big, closed sou...
<p>You have this <a href="http://carnage-melon.tom7.org/stuff/jpegsize.html" rel="nofollow noreferrer">C function</a> which may extract the relevant data for you.</p> <blockquote> <p>This is a C routine but should compile fine with C++.<br> Pass it a normal FILE pointer (from fopen) to the beginning of a jpeg file...
<p>You may want to try <a href="https://gdal.org/" rel="nofollow noreferrer">GDAL</a> library which serves as an abstraction layer for large number of raster data formats, mostly used in geospatial applications for GIS/RS.</p> <p>GDAL provides number of APIs, for C, C++ and scripting languages. Of course, it supports <...
40,960
<p>How would I go about binding the following object, Car, to a gridview?</p> <pre> public class Car { long Id {get; set;} Manufacturer Maker {get; set;} } public class Manufacturer { long Id {get; set;} String Name {get; set;} } </pre> <p>The primitive types get bound easy but I have found no way of dis...
<p>Allright guys... This question was posted waaay back but I just found a fairly nice &amp; simple way to do this by using reflection in the cell_formatting event to go retrieve the nested properties.</p> <p>Goes like this:</p> <pre><code> private void Grid_CellFormatting(object sender, DataGridViewCellFormatting...
<p>I would assume you could do the following:</p> <pre><code>public class Car { public long Id {get; set;} public Manufacturer Maker {private get; set;} public string ManufacturerName { get { return Maker != null ? Maker.Name : ""; } } } public class Manufacturer { long Id {get; set;} ...
14,752
<p>I don't expect a straightforward silver bullet answer to this, but what are the best practices for ensuring good performance for SharePoint 2007 sites?</p> <p>We've a few sites for our intranet, and it generally is thought to run slow. There's plenty of memory and processor power in the servers, but the pages just ...
<p>Andrew Connell's latest book (Professional SharePoint 2007 Web Content Management Development) has an entire chapter dedicated to imporving performance of SharePoint sites.</p> <p>Key topics it covers are Caching, Limiting page load (particularly how to remove CORE.js if it's not needed), working with Disposable ob...
<p>Just a few ideas...</p> <p>Is displaying your pages as slow when doing it from the Server or from a Client? If slower from client, do check your network.</p> <p>Are your pages very "heavy"? (means, many elements, web parts and so on?) Than maybe it's normal.</p> <p>Have you noticed they load slowlier since you've...
13,745
<p>One of the stated goals of the PureMVC framework is to avoid platform dependencies in order to be portable. Considering that because of language and API differences application code will always be heavily dependent on the platform, and that avoiding platform dependencies makes the framework reinvent the wheel and/or...
<p>I've worked with PureMVC. They're trying to implement their stuff in quite a lot of languages. You may be right about the least common denominator, but overall, it's not a bad framework, and I've seen a really nice AS3 app in PureMVC.</p> <p>I don't think they're talking about portability in terms of porting actual...
<p>Are there examples of people using PureMVC to build and port applications across multiple platforms?</p> <p>My company is building a Flex application that we may need to port to other platforms:</p> <ul> <li>Silverlight (likely)</li> <li>Mobile (maybe)</li> <li>Desktop (maybe -- not just AIR!)</li> <li>TV sets (ma...
17,317
<p>I have some content that i have to render as a excel file in browser. I was able to render a grid content to excel with the below code.</p> <pre><code> Response.Clear(); Response.AddHeader("content-disposition", "attachment;filename=FileName.xls"); Response.Charset = ""; Response.ContentType = "application/v...
<p>I've been using the same kind of hacks to get grid data (html tagged) into excel.</p> <p>If it is HTML data you are writing there, just add &lt;IMG SRC="MYFILENAME.JPG> into the HTML text where you want the images.</p> <p>What will happen, is that Excel will ask your server (asp.net app) for that file.</p> <p>You...
<p>Oh. Another more complex way would be to create a .MHT file (webarchive) file. That contain both the HTML and images embedded in the same file. That way you only have one stream out. But I dont know if Excel will recognize the MHT content and show it.</p>
36,997
<p>I need to generate random text strings of a particular format. Would like some ideas so that I can code it up in Python. The format is &lt;8 digit number>&lt;15 character string>. </p>
<pre><code>#!/usr/bin/python import random import string digits = "".join( [random.choice(string.digits) for i in xrange(8)] ) chars = "".join( [random.choice(string.letters) for i in xrange(15)] ) print digits + chars </code></pre> <p>EDIT: liked the idea of using random.choice better than randint() so I've updated...
<p>Here's a simpler version:</p> <pre><code>import random import string digits = "".join( [random.choice(string.digits+string.letters) for i in xrange(10)] ) print digits </code></pre>
47,978
<p>Is there a case insensitive version of the <a href="http://docs.jquery.com/Selectors/contains" rel="noreferrer">:contains</a> jQuery selector or should I do the work manually by looping over all elements and comparing their .text() to my string?</p>
<p>What I ended up doing for jQuery 1.2 is :</p> <pre><code>jQuery.extend( jQuery.expr[':'], { Contains : "jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase())&gt;=0" }); </code></pre> <p>This will extend jquery to have a :Contains selector that is case insensitive, the :contains selector remains ...
<p>I had a similar problem with the following not working...</p> <pre><code>// This doesn't catch flac or Flac $('div.story span.Quality:not(:contains("FLAC"))').css("background-color", 'yellow'); </code></pre> <p>This works and without the need for an extension</p> <pre><code>$('div.story span.Quality:not([data*="f...
22,715
<p>What is the functional programming approach to convert an <code>IEnumerable&lt;string&gt;</code> to a delimited string? I know I can use a loop, but I'm trying to wrap my head around functional programming. </p> <p>Here's my example: </p> <pre><code>var selectedValues = from ListItem item in checkboxL...
<pre><code>string.Join(", ", string[] enumerable) </code></pre>
<p>This is 3.5 compatible:</p> <pre><code>var selectedValues = String.Join(",", (from ListItem item in checkboxList.Items where item.Selected select item.Value).ToArray()); </code></pre>
20,184
<p>Yesterday @headius / Charles Nutter came up with a very interesting idea on twitter:</p> <blockquote> <p>@danny_l Gafter made the same mistake; I don't mean a forked Java any more than Groovy is a fork. I want a "mostly Java" with closures. </p> </blockquote> <p>or the reply by @danny_l / Danny Lagrouw:</p> <bl...
<p>The word 'preprocessor' takes me back to C++ and it scares me. </p> <p>There is a weird dichotomy: I celebrate the diverse garden of languages on the JVM, but I think that "Mama Bear" (aka Java) should not become fragmented like this. We need a solid foundation.</p> <p>That said, I am in favour of BGGA closures. ...
<p>The problem with making these things a bolt on is that you create a fragmented language. </p> <p>The java language is the smallest part of what makes java, java. The libraries and the culture make up the larger part. Making closures and generics a bolt on means that either they cannot be used in the core librari...
23,555
<p>When I subscribe for a report, I may chose to have a subject like: <code>@ReportName was executed at: @ExecutionTime</code></p> <p>I would like a name like this: <code>Your "@ReportName" report covering Sep 10 2008 - Sep 16 2008</code></p> <p><code>Sep 10 2008 - Sep 16 2008</code> are values of the two report para...
<p>Check out <a href="http://www.sqlservercentral.com/articles/Development/datadrivensubscriptions/2432/" rel="nofollow noreferrer">this article</a>. The author shows how to execute a data driven subscription from code and provides a stored procedure for doing so. The stored procedure allows you to specify the email ...
<p>I don't believe anything other than those 2 parameters are available to report subscription emails (at least in SSRS 2005). </p> <p>You may be able to do something via a data-driven subscription, but the values you want to use need to be in the data source used for the subscription data - SSRS is still not able to...
10,864
<p>Requirement is to pass module name and function name from the command-line argument. I need to get the command-line argument in the program and I need to call that function from that module</p> <p>For example, calling a try.pl program with 2 arguments: MODULE1(Module name) Display(Function name)</p> <pre><code> pe...
<p>There's many ways to do this. One of them is:</p> <pre><code>#!/usr/bin/perl use strict; use warnings; my ( $package, $function ) = @ARGV; eval "use $package; 1" or die $@; $package-&gt;$function(); </code></pre> <p>Note the the first argument of the function will be $package.</p>
<p>I'd use <a href="http://search.cpan.org/~mschwern/UNIVERSAL-require-0.10/lib/UNIVERSAL/require.pm" rel="nofollow noreferrer">UNIVERSAL::require</a>. It allows you to require or use a module from a variable. So your code would change to something like this: </p> <pre><code>use UNIVERSAL::require; $ARGV[0]-&gt;us...
25,653
<p>At the moment I am using Visual Source Safe (yeah yeah!) to store my Technical Specification documentation.</p> <p>The actual docs are written in MS word.</p> <p>If find that having the spec written in word format to be a big burden, for specs to be truly used there shouldn't be any barrier to usage and more impor...
<p>Wikis are great for creating and maintaining specs. However, it is difficult to generate a big ol' paper document that makes a satisfying "thud" when you drop it on peoples' desks.</p> <p>I've gotten by with Word. Just learn to take advantage of all the automation it has for cross-referencing, indexes, tables, pa...
<p>I believe Word supports the idea of sub-documents (links to other documents), however I'm not sure how well it works without VSS, much less with VSS. But it's something to look into.</p> <p>A wiki is, however, pretty much what you are looking for.</p>
29,832
<p>It may sound stupid, but sometimes I run into version conflicts between two versions of subversion. I mount a directory on a development server with sshfs and then edit the code with my local Vim. For subversion stuff like updating, committing etc. I ssh on the server and do it there. However, sometimes I mix up my ...
<p>Maybe this FAQ-entry could be helpful: <a href="http://subversion.tigris.org/faq.html#working-copy-format-change" rel="nofollow noreferrer">http://subversion.tigris.org/faq.html#working-copy-format-change</a></p>
<p>I am not sure if I understand correctly your problem, but here are some tips:</p> <p>First one tip -- did you try SVN <em>Clean</em> command?</p> <p>The next one is probably useless for you:), but many people used to use CVS don't realize that SVN has feature like that, so I write it down.</p> <p>If you use Windo...
16,417
<p>How to find fifth highest salary in a single query in SQL Server</p>
<p>In SQL Server 2005 &amp; 2008, create a ranked subselect query, then add a where clause where the rank = 5.</p> <pre><code>select * from ( Select SalesOrderID, CustomerID, Row_Number() Over (Order By SalesOrderID) as RunningCount From Sales.SalesOrderHeader Where SalesOrderID &gt; 10000 Order ...
<p>You can try some thing like :</p> <pre><code>select salary from Employees a where 5=(select count(distinct salary) from Employees b where a.salary &gt; b.salary) order by salary desc </code></pre>
46,755
<p>I'm looking into tightening up our ad code by moving it to an external jQuery script, but I obviously still need some HTML to target the ad to. So I was wondering if I can target a noscript element (or within a noscript element) since I'm going to have to leave that on the page anyway, or if I need to have some othe...
<p><code>&lt;noscript&gt;</code> content is not only not displayed when JS is active, it apparently is also not in the DOM. I tried accessing content inside a <code>&lt;noscript&gt;</code> area (hoping you could <code>clone()</code> it with jQuery and insert it somewhere else) but got back nothing.</p>
<p>You could always use the JS to hide that ad using CSS, if nothing else.</p>
34,288
<p>I'm using a the TreeView control and it scrolls automatically to left-align TreeViewItem when one of them is clicked. I've gone looking at my Styles and ControlTemplates, but I haven't found anything. Is there a default ControlTemplate that causes this? I want to disable it.</p>
<p>The items scroll because the ScrollViewer calls BringIntoView() on them. So one way to avoid scrolling is to suppress the handling of the RequestBringIntoView event. You can try that out quickly by subclassing TreeView and instantiating this control instead:</p> <pre><code>public class NoScrollTreeView : TreeView...
<p>It looks like I found a good clue on <a href="http://social.msdn.microsoft.com/forums/en-US/wpf/thread/9abff78f-481d-4db1-a545-c461f7d19200/" rel="nofollow noreferrer">MSDN</a>:</p> <blockquote> <p>Sounds like this is an interaction with the scrollviewer and the focus system.</p> <p>When an element is fo...
30,384
<p>How do I convert the value of a PHP variable to string?</p> <p>I was looking for something better than concatenating with an empty string:</p> <pre><code>$myText = $myVar . ''; </code></pre> <p>Like the <code>ToString()</code> method in Java or .NET.</p>
<p>You can use the <a href="http://us3.php.net/manual/en/language.types.type-juggling.php" rel="noreferrer">casting operators</a>:</p> <pre><code>$myText = (string)$myVar; </code></pre> <p>There are more details for string casting and conversion in the <a href="http://us3.php.net/manual/en/language.types.string.php#l...
<p>I use <a href="https://github.com/lingtalfi/VariableToString" rel="nofollow noreferrer">variableToString</a>. It handles every PHP type and is flexible (you can extend it if you want).</p>
4,775
<p>The web applications I develop often require co-dependent configuration settings and there are also settings that have to change as we move between each of our environments.</p> <p>All our settings are currently simple key-value pairs but it would be useful to create custom config sections so that it is obvious when...
<p><strong>Using attributes, child config sections and constraints</strong></p> <p>There is also the possibility to use attributes which automatically takes care of the plumbing, as well as providing the ability to easily add constraints.</p> <p>I here present an example from code I use myself in one of my sites. Wit...
<p>You can accomplish this with Section Handlers. There is a basic overview of how to write one at <a href="http://www.codeproject.com/KB/aspnet/ConfigSections.aspx" rel="nofollow noreferrer">http://www.codeproject.com/KB/aspnet/ConfigSections.aspx</a> however it refers to app.config which would be pretty much the same...
2,435
<p>Ender 3 Pro, PLA, temps 200 °C and 60 °C.</p> <p>I want to not heat the nozzle until after Auto Bed Leveling (CR Touch) is complete. I can do that in the start G-code, but by then, Cura has already heated the nozzle to the temp specified under material and filament starts oozing out during bed leveling. I'd rather...
<p>I've sorted this out. <em>IF</em> I include my own heating commands in my start G-Code, Cura knows to NOT add its own heating commands at the start of the G-Code file.</p> <p>The variables I was referring to have dedicated names. <code>material_print_temperature_layer_0</code> is the printing (extruder/nozzle) temp...
<p>Go to the <code>Settings</code> -&gt; <code>Printers</code> menu from the top menu,</p> <p><a href="https://i.stack.imgur.com/jmivX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jmivX.png" alt="enter image description here" /></a></p> <p>select your active printer (or <code>Activate</code> it) a...
2,152
<p>Am developing my web application using Django, and is seems CSS is the only way i can format my pages to look and feel nice. Where can i get a free and good css editor?</p> <p>NB: Is there another way to format forms in Django?</p>
<p>Cool stuff for Eclipse...</p> <p><a href="http://aptana.com/studio" rel="nofollow noreferrer">http://aptana.com/studio</a></p>
<p>There are other ways to format forms but CSS is the best way. I'll second the recommendation for Aptana, and according to Lifehacker <a href="http://lifehacker.com/5073005/css-toolbox-is-a-killer-text-editor-for-web-designers" rel="nofollow noreferrer">CSS Toolbox</a> is also quite good.</p>
32,634
<p>If you check my earlier questions you may have noticed I just don't get the SelectList and Html.DropDown(). I find it intrigueing that I seem to be the only one in this. So maybe I should try to change my mindset or maybe there are things I don't know that will clear this all up. I really love the whole MVC framewor...
<p>I feel your pain. Forgive the shameless plug, but you might look into <a href="http://lunaverse.wordpress.com/2008/11/24/mvcfluenthtml-fluent-html-interface-for-ms-mvc/" rel="nofollow noreferrer">MvcFluentHtml</a>. You can still use SelectList and MultiSelectList, but you have several other choices. Should work f...
<p>I feel your pain. Forgive the shameless plug, but you might look into <a href="http://lunaverse.wordpress.com/2008/11/24/mvcfluenthtml-fluent-html-interface-for-ms-mvc/" rel="nofollow noreferrer">MvcFluentHtml</a>. You can still use SelectList and MultiSelectList, but you have several other choices. Should work f...
43,664
<p>I have some UI in VB 2005 that looks great in XP Style, but goes hideous in Classic Style.</p> <p>Any ideas about how to detect which mode the user is in and re-format the forms on the fly?</p> <hr> <p>Post Answer Edit:</p> <p>Thanks Daniel, looks like this will work. I'm using the first solution you posted with...
<p>Try using a combination of <a href="http://www.pinvoke.net/default.aspx/uxtheme/GetCurrentThemeName.html" rel="nofollow noreferrer">GetCurrentThemeName</a> (<a href="http://msdn.microsoft.com/en-us/library/bb773365%28VS.85%29.aspx" rel="nofollow noreferrer">MSDN Page</a>) and <a href="http://msdn.microsoft.com/en-us...
<p>There's the <a href="http://msdn.microsoft.com/en-us/library/bb759813%28VS.85%29.aspx" rel="nofollow noreferrer">IsThemeActive</a> WinAPI function.</p>
5,506
<p>The code</p> <pre><code>&lt;%=Html.CheckBox("SendEmail") %&gt; </code></pre> <p>evaluates to two HTML elements when it's rendered</p> <pre><code>&lt;input id="SendEmail" name="SendEmail" type="checkbox" value="true" /&gt; &lt;input name="SendEmail" type="hidden" value="false" /&gt; </code></pre> <p>Is this by ...
<p>I was having some trouble this morning with retrieving selected values from a checkbox group in my MVC app. I sent this out to my team and thought I'd share it with everyone else.</p> <p>When posting back values for checkboxes, the standard behaviour of all browsers is to completely leave out un-checked checkboxes ...
<p>I think I found <a href="http://forums.asp.net/p/1314753/2603373.aspx" rel="nofollow noreferrer">something on the web</a> that is directly related to my question.</p>
48,843
<p>How can I monitor the memory being used by a native C DLL that is being called from Java via JNI? Using standard Java monitoring tools and options I can see the Java memory space, but I cannot view any memory used by the C DLL. Java is using ~70MB, but the task in the Task Manager shows 200Mb+, and I'd like to se...
<p>You can monitor the native heap with counters in the performance montitor. (perfmon32) however it wont break it down for you on a per DLL basis, even jvm.dll will be included here.</p> <p>Most profiling tools out there can attach to a process and capture and track memory allocations and deallocations. This allows ...
<p>I believe even doing this inside the C DLL would not be very easy. </p> <p>As far as I understand the Standard Java Monitoring tools gather information by querying the Virtual Machine, thus even though that memory is in the same process unless the virtual machine knows how to inspect your dynamically linked librar...
22,352
<p>I'm working on a site that involves displaying a ton of product images from a variety of online retailers. Since most of the page weight is in the images, I thought it'd be worth looking into techniques for trimming down the file size a bit more. </p> <p>The images are already JPEGs. I know PNGs have a lot of extra...
<p>Do you use thumbnail images? If so, are they saved separately or is the larger image loaded in full and just resized on the webpage? Having separate thumbnails sized as you're displaying them on your pages will save a lot of bandwidth. </p> <p>You can decrease the quality factor on the JPEGs until you can see it...
<ul> <li><p>There are lossless compresions like .ZIP but they are usually worse and not very usefull for an already compresed format.</p></li> <li><p>JPEG can have diferent levels of compression. It's your decision how much quality is just enough. A photo from a digital camera can be compressed un one tenth it's size w...
31,411
<p>Say you have several webparts, one as a controller and several which take information from the controller and act on it. This is fairly easy to model using the Consumer/Producer interface introduced in ASP 2.0. </p> <p>How would you be able to add interactions the other way around whilst still maintaining the above...
<p>A quick and dirty solution to enable arbitrary control communication is to use recursive find control and events. Have the controls search the control tree by control type for what they need and then subscribe to publicly exposed events on the publishing control. </p> <p>I have previous used the trick to enable sta...
<p>I don't see anything wrong with webpart A getting a reference to webpart B and calling public/internal methods/properties or subscribing handlers to public/internal events. One point of mention when doing this though: EnsureChildControls. I have witnessed with my own eyes one webpart being run clear to PreRender w...
19,066
<p>I have a SQL database (SQL Server 2008) which contains the following design</p> <h2>ITEM</h2> <ul> <li>ID (Int, Identity)</li> <li>Name (NVarChar(50))</li> <li>Description (NVarChar(200))</li> </ul> <h2>META</h2> <ul> <li>ID (Int, Identity)</li> <li>Name (NVarChar(50))</li> </ul> <p>There exists a N-N relations...
<p>This should work for you:</p> <pre><code>string[] criteria = new[] { "Car", "Ford", "Offroad" }; var items = from i in db.Item let wantedMetas = db.Meta.Where(m =&gt; criteria.Contains(m.Name)) let metas = i.ItemMeta.Select(im =&gt; im.Meta) where wantedMetas.All(m =&gt; metas.Contains(m)) sel...
<p>this brings back anything that matchs any of the meta criteria, and then filters it down to only things that match all the criteria. (also, keep in mind that you'll need to have your relationship defined in your datacontext). Let us know if you need clarification.</p> <pre><code>var db = new YourDataContext(); var ...
31,355
<p>How do you return 1 value per row of the max of several columns:</p> <p><strong>TableName</strong></p> <pre><code>[Number, Date1, Date2, Date3, Cost] </code></pre> <p>I need to return something like this:</p> <pre><code>[Number, Most_Recent_Date, Cost] </code></pre> <p>Query?</p>
<p>Here is another nice solution for the <code>Max</code> functionality using T-SQL and SQL Server</p> <pre><code>SELECT [Other Fields], (SELECT Max(v) FROM (VALUES (date1), (date2), (date3),...) AS value(v)) as [MaxDate] FROM [YourTableName] </code></pre> <p>Values is the <a href="https://learn.microsoft.com/en-...
<p>here is a good solution:</p> <pre><code>CREATE function [dbo].[inLineMax] (@v1 float,@v2 float,@v3 float,@v4 float) returns float as begin declare @val float set @val = 0 declare @TableVal table (value float ) insert into @TableVal select @v1 insert into @TableVal select @v2 insert into @TableVal select @v3 insert...
9,644
<p>i have two servers a main site and a static server. i want to get a file's content from ajax in runtime, which is stored in static server. obviously cross domain problem will occur.</p> <p>so what i am trying to do is storing that ajax .js in the static server, so that calling the local file wont be a problem.</p>...
<p>This might be a stretch, but check one of php's number one confusions with relative path resolution. </p> <pre><code>'./' </code></pre> <p>is relative to wherever Entrypoint is, not the script, which is why I use </p> <pre><code>dirname(__FILE__).'/' </code></pre> <p>everywhere instead. </p>
<p>Are you sure the path to <code>info.xml</code> is correct? That gets me sometimes when I am including a file from a subdirectory.</p>
39,137
<p>I'm generating a ton of XML that is to be passed to an API as a post variable when a user click on a form button. I also want to be able to show the user the XML before hand.</p> <p>The code is sorta like the following in structure:</p> <pre><code>&lt;?php $lots of = "php"; ?&gt; &lt;xml&gt; &lt;morexml&g...
<pre><code>&lt;?php ob_start(); ?&gt; &lt;xml/&gt; &lt;?php $xml = ob_get_clean(); ?&gt; &lt;input value="&lt;?php echo $xml ?&gt;" /&gt;͏͏͏͏͏͏ </code></pre>
<p>You could try this:</p> <pre><code>&lt;?php $string = &lt;&lt;&lt;XMLDoc &lt;?xml version='1.0'?&gt; &lt;doc&gt; &lt;title&gt;XML Document&lt;/title&gt; &lt;lotsofxml/&gt; &lt;fruits&gt; XMLDoc; $fruits = array('apple', 'banana', 'orange'); foreach($fruits as $fruit) { $string .= "\n &lt;fruit&gt;".$fr...
20,655
<p>I've been trying to install PDT in Eclipse 3.4 for a few hours now and I'm not having any success.</p> <p>I have a previous installation of the Eclipse for Java EE developers (my main deal) distro and I just want to add the PDT to my install so I can also work on some of my websites in Eclipse. </p> <p>I've done ...
<p>If you have a list of all the plugins that you already have it may be faster and easier to go to <a href="http://www.yoxos.com/ondemand/" rel="nofollow noreferrer">YOXOS</a> and download a new copy of eclipse with all the plugins already loaded. just remember to change your workspace if you do this.</p>
<p>I have looked at lots of guides, but i finaly figured it out on myself:</p> <ol> <li>Download Ganyamede SDK</li> <li>Through update manager install Web Developer Tools ( v 3.0.x )</li> <li>Again using update manager instal DLTK version 1.0 or higher</li> <li><p>manualy download latest integration or nightly od PDT ...
12,289
<p>Suppose I have one long long int and want to take its bits and construct four unsigned short ints out of it.</p> <p>Particular order doesn't matter much here.</p> <p>I generally know that I need to shift bits and truncate to the size of unsigned short int. But I think I may make some weird mistake somewhere, so I...
<pre><code>#include &lt;stdint.h&gt; #include &lt;stdio.h&gt; union ui64 { uint64_t one; uint16_t four[4]; }; int main() { union ui64 number = {0x123456789abcdef0}; printf("%x %x %x %x\n", number.four[0], number.four[1], number.four[2], number.four[3]); return 0; } </co...
<pre><code>union LongLongIntToThreeUnsignedShorts { long long int long_long_int; unsigned short int short_ints[sizeof(long long int) / sizeof(short int)]; }; </code></pre> <p>That should do what you are thinking about, without having to mess around with bit shifting.</p>
17,862
<p>The build machine at work has many projects, but we are only experiencing a problem with one. </p> <p>Two projects are very similar, one builds in debug mode, the other in release mode. They both clear out the projects directory, and then does a full Get from source safe. The debug build gets the source fine and...
<p>In the end we have switched from SourceSafe to SourceGear Vault (mainly for branching features, but speed and reliability were also large factors).</p> <p>We have also moved our build machine from an old pc to a server which has a 1Gb/s connection to the source server, rather than 100Mb/s, which has helped consider...
<p>Are the Debug and Release builds running at the same time? If so, I could see one waiting for the other to finish.</p>
32,790
<p>I'm trying to verify if a schema matches the objects I'm initializing.</p> <p>Is there a way to get the TableName of a class other than simply reflecting the class name?</p> <p>I am using some class with explicit TableNames</p> <p>Edit: using Joe's solution I added the case where you don't specify the table name,...
<p>If you have something like the following:</p> <pre><code>[ActiveRecord(Table = "NewsMaster")] public class Article { [PrimaryKey(Generator = PrimaryKeyType.Identity)] public int NewsId { get; set; } [Property(Column = "NewsHeadline")] public string Headline { get; set; } [Property(Column = "Ef...
<p>You could also use:</p> <pre><code>ActiveRecordModel.GetModel(typeof(Article)).ActiveRecordAtt.Table </code></pre> <p>see <a href="http://svn.castleproject.org:8080/svn/castle/trunk/ActiveRecord/Castle.ActiveRecord.Tests/PluralizationTestCase.cs" rel="nofollow noreferrer">this testcase</a></p>
24,134
<p>I installed Aptana Studio plugins for Eclipse and now Eclipse startup is slower than ever because Aptana Studio always checks for updates at startup -- and it's really slow! </p> <p>How do I turn off auto updates in Aptana? </p>
<p>Window->Preferences, find the Install/Update item in the tree and locate Automatic Updates. You can change the update behavior here.</p>
<p>For Aptana updates go to Window->Preferences. Then open the Aptana->Install/Update->Automatic_Updates preference panel. Once there deselect the "Automatically find new updates and notify me" check box.</p>
48,663
<p>How many messages does the queue for a standard window hold? What happens when the queue overflows?</p> <p>The documentation for <code>GetMessage</code> and relatives doesn't say anything about this, and <code>PeekMessage</code> only gives you a yes/no for certain classes of messages, not a message count.</p> <p><...
<p>10000 by default, but it can be adjusted via the registry.</p> <p>If queue overflows, PostMessage fails.</p> <p>Documentation here:</p> <p><a href="http://msdn.microsoft.com/en-us/library/ms644944.aspx" rel="noreferrer"><code>PostMessage</code> function on MSDN</a></p>
<p>As stated in the MSDN article, if you need to worry about the size of the message queue, you might be better off redesigning your application.</p>
15,005
<p>I've got an application that just shipped. Since I wrote it, I've learned about amfphp and propel. Both would be 'nice' to be used in the application but I can't say that it would be required at this point.</p> <p>What types of things do you consider before you refactor code?</p>
<p>Have unit tests to check the code after refactoring. </p>
<p>Create a fork for the current production code base in your source control and do all the refactoring in the experimental branch of the source control.</p>
49,724
<p>English is not my mother tongue. However, I have to write comments in English. I want to improve my "comment English" by studying a piece of code which is commented in a good English. Please recommend an open source project which contains a lot of meaningful comments written by people with an excellent command of th...
<p>I can recommend Simon Tatham's Puzzle Collection.</p> <p>The comments I've read look like correct English to me. Also, they're clearly written and contain useful information about why things are done the way they are.</p> <p>The developer documentation is also easy to read and understand, and as a side benefit yo...
<p>I've only ever looked at small pieces of it, but I hear the linux kernel is very well commented.</p>
30,865
<p>What is the best way to survey and detect bad users behavior or attacks like deny of services or exploits on my web app ?</p> <p>I know server's statistics (like <a href="http://awstats.sourceforge.net/" rel="nofollow noreferrer">Awstats</a>) are very useful for that kind of purpose, specially to see 3XX, 4XX and 5...
<p>Log everything. Then examine the logs by hand, and find things that are uninteresting and write a parser that discards those log entries. Once you've done that, rinse and repeat until you're left with just the interesting things. Now that you have only interesting log entries to read, decide which ones are dangerous...
<p>More network as a whole but SATAN is very good</p> <p><a href="http://www.porcupine.org/satan/" rel="nofollow noreferrer">http://www.porcupine.org/satan/</a></p> <p>SATAN is a tool to help systems administrators. It recognizes several common networking-related security problems, and reports the problems without ac...
16,762
<p>I am working on a small project with a few friends and need to set up a server to run our tools. I looked around at hosted solutions like <a href="http://unfuddle.com/" rel="nofollow noreferrer">Unfuddle</a> but they don't provide a CI server.</p> <p>I am now considering buying a <a href="http://www.linode.com/" re...
<p>I'm not sure how much power you need, but what I've done in the past is grabbed an old desktop computer. Wiped the hard drive and installed an appropriate OS and then loaded my tools on that.</p> <p>I setup port forwarding on my router to send incoming requests to it. And I got my hands a dynamic IP address URL (th...
<p>If you have Ruby installed, you can pull down the <a href="http://www.deprec.org/" rel="nofollow noreferrer" title="Deprec2">deprec gem</a> ("deprec" is for "deploy recipe", not "deprecated"). It's geared toward Rails, but will set up Trac and source control and let you perform other admin tasks. It may or may not...
41,129
<p>I'm trying to run a command-line process (which is extraction of a .7z archive) on a file that lies in a temporary folder on the windows user temp directory (C:\Documents and Settings\User\Local Settings\Temp), using Process in my c# app.</p> <p>I think the process return error that happens because of "access denie...
<p>Assuming that you are using regular .NET (not CF/Silverlight, etc) Accessing files in the user's temp area is entirely expected. I wonder if the problem isn't more that you've accidentally left the file open after creating it, perhaps by not using a "using" or similar?</p> <p>I probably wouldn't suggest using envir...
<p>running the same process using command-line (cmd) helped to figure out my problem was that I specified path arguments to the process using long-path-name.</p> <p>Solution to this can be found here:</p> <p><a href="https://stackoverflow.com/questions/258367/standard-way-to-convert-to-long-path-in-net">standard way ...
32,237
<p>Can anyone tell me what the need/advantage is to using a web service with an asp.net gui and using Linq to SQL? The web service layer seems unnecessary. Linq to SQL is completely new to me and I am researching as I am setting up a new project. Does anyone have any experience with this?</p>
<p>You would expose services for those cases in which other applications may need to access your data (such as a smart client, another application, a winforms app, etc.). A lot of people will develop using web services to prevent themselves from having to restructure to web services in the future.</p> <p>In almost an...
<p>Agreed with previous poster. You'd probably want to do this to apply the "Separation of Concerns" idea...</p>
31,346
<p>I came across an issue that makes me think there is bug in the 3.0 framework. When I try to use extension methods I get the following error: </p> <pre><code>Missing compiler required member 'System.Runtime.CompilerServices.ExtensionAttribute..ctor' </code></pre> <p>When using this simple code:</p> <pre><code>publ...
<p>I have the exact same problem. The error <code>System.Runtime.CompilerServices.ExtensionAttribute..ctor</code> is rather cryptic, and could mean a number of different things.</p> <p>However, for me It boiled down to the fact that I'm using <code>Newtonsoft.Json.Net</code>. I removed the reference to the file <co...
<p>Extensions are introduced in C# 3.0, which on the other hand was introduced in .NET 3.5 so you can't really use them in .NET 3.0 directly.</p>
25,194
<p>Here's the code:</p> <pre><code>render :file =&gt; @somedir + "/blah.xml" </code></pre> <p>...but the resulting MIME type is text/html when I check in FireBug. How do I specify a MIME type in this case?</p>
<p>Actually there are two ways to set the content-type (I think this is what you mean by mime-type). You should use the second option, if it works for your Rails version.</p> <pre><code>class FileController &lt; ApplicationController def index filename = 'some.xml' extname = File.extname(filename)[1..-1] ...
<p>Per <a href="http://api.rubyonrails.org/classes/Mime/Type.html" rel="nofollow noreferrer">http://api.rubyonrails.org/classes/Mime/Type.html</a>, you could specify it like so:</p> <pre><code>render file: @somedir + "/blah.xml", mime_type: Mime::Type.lookup("text/xml") </code></pre>
38,454
<p>Is there any easier solution in porting a windows manual-reset event to pthread, than a pthread conditional-variable + pthread mutex + a flag if event is set or unset?</p>
<p>Pthreads are low level constructs. No, there isn't a simpler mechanism; <code>pthread_cond__*</code> is conceptually similar to an auto-reset event. Be careful, <code>pthread_cond_wait</code> may have spurious wakeups, so it should never be used without some sort of external flag regardless of the situation.</p> ...
<p>We (full disclosure: I work at NeoSmart Technologies) wrote an open source (MIT licensed) library called <a href="https://github.com/NeoSmart/PEvents" rel="nofollow">pevents</a> which <a href="http://neosmart.net/blog/2011/waitformultipleobjects-and-win32-events-for-linux-and-read-write-locks-for-windows/" rel="nofo...
21,459
<p>How can I reboot a Windows XP64 Machine in a Python Script? This machine does not have the "shutdown" or "restart" executables available.</p>
<p>found it </p> <p>win32api.InitiateSystemShutdown("localhost", "Maintenance Reboot", 60, 1, 1)</p>
<p>You can use win32api module and call WinApi functions. <a href="http://code.activestate.com/recipes/360649/" rel="nofollow noreferrer">Recipe at code.activestate.com</a></p>
44,326
<p>How do I have a Python script that a) can accept user input and how do I make it b) read in arguments if run from the command line?</p>
<p>To read user input you can try <a href="https://docs.python.org/dev/library/cmd.html" rel="noreferrer">the <code>cmd</code> module</a> for easily creating a mini-command line interpreter (with help texts and autocompletion) and <a href="https://docs.python.org/2/library/functions.html#raw_input" rel="noreferrer"><co...
<p>In Python 2:</p> <pre><code>data = raw_input('Enter something: ') print data </code></pre> <p>In Python 3:</p> <pre><code>data = input('Enter something: ') print(data) </code></pre>
9,629
<p>I want something similar to the following pseudocode:</p> <pre><code>myGridView.SelectedIndex = myGridView.DataKeys.IndexOf("mySpecificKey"); </code></pre> <p>I've done some Intellisense exploring, but I haven't found an obvious way to do this. I would want to set SelectedIndex to -1 if DataKey was not found.</p>...
<p>I've ended up with</p> <pre><code> For n As Integer = 0 To myGridView.DataKeys.Count - 1 If myGridView.DataKeys(n).Value = myKeyObj Then myGridView.SelectedIndex = n End If Next </code></pre>
<p>Put something like this in your GridView_RowDataBound() event:</p> <pre><code>Dim p As Catalog.Product = CType(e.Row.DataItem, Catalog.Product) If p IsNot Nothing Then If p.Bvin = MySpecificID Then e.Row.RowState = DataControlRowState.Selected End If End If </code></pre> <p>In this example, we ar...
45,616
<p>I was playing around with my own Sudoku solver and was looking for some pointers to good and fast design when I came across this:</p> <pre><code>def r(a):i=a.find('0');~i or exit(a);[m in[(i-j)%9*(i/9^j/9)*(i/27^j/27|i%9/3^j%9/3)or a[j]for j in range(81)]or r(a[:i]+m+a[i+1:])for m in'%d'%5**18] from sys import*;r(a...
<p>Well, you can make things a little easier by fixing up the syntax:</p> <pre><code>def r(a): i = a.find('0') ~i or exit(a) [m in[(i-j)%9*(i/9^j/9)*(i/27^j/27|i%9/3^j%9/3)or a[j]for j in range(81)] or r(a[:i]+m+a[i+1:])for m in'%d'%5**18] from sys import * r(argv[1]) </code></pre> <p>Cleaning up a little:</p> ...
<p>The code doesn't actually work. You can test it yourself. Here is a sample unsolved sudoku puzzle:</p> <p>807000003602080000000200900040005001000798000200100070004003000000040108300000506</p> <p>You can use this website (<a href="http://www.sudokuwiki.org/sudoku.htm" rel="nofollow">http://www.sudokuwiki.org/sudoku...
24,598
<p>I want to impersonate other user in Windows. For example: I create a directory with permission only for user A and for the administrators, when logon with user B and run .exe I want to impersonate user A to have permission to edit/remove/insert in that specific directory.</p> <p>I found this: <a href="http://msdn.m...
<p>As a start, check out this article on windows user impersonation:</p> <p><a href="http://www.codeproject.com/KB/system/UserImpersonation.aspx" rel="nofollow noreferrer">http://www.codeproject.com/KB/system/UserImpersonation.aspx</a></p> <p>It should give you a place to start. If you need more controll you will nee...
<p>If you want access to the folders of User A and the folders of User B, then you just need to setup folder permissions in such a way that administrators have permissions to get into all the folders. Normally machine administrators already have those rights. I am assuming here that are talking about normal windows use...
26,009
<p>I am currently working on automating/improving the release process for packaging my shop's entire product. Currently the product is a combination of: </p> <ul> <li>Java server-side codebase </li> <li>XML configuration and application files</li> <li>Shell and batch scripts for administrators</li> <li>Statically serv...
<p>Indeed, to complete Craig Angus's answer, the rule of thumb here should be to <strong><em>not include any meta-informations in your normal delivery files</em></strong>, but to report those meta-data (version number, release date, and so on) into <em>one</em> special file -- included in the release --.</p> <p>That h...
<p>In addition to Craig Angus' ones include the version of tools used.</p>
28,003
<p>My ClickOnce application uses a third party tool that requires the Visual C++ 2005 redistributable. The third party tool will not work if only the VC++ 2008 redistributable is installed. However, in Visual Studio 2008, the ClickOnce prerequisites do not allow a version to be specified for the VC++ redistributable; i...
<p>If you can find a machine with VS 2005 installed, the solution shouldn't be too hard. You have the ability to customize what appears in the Prerequisites dialog on the Publish tab of your project.</p> <ol> <li>On a machine with VS 2005 installed, go to <strong>\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Boot...
<p>I believe you can open the manifest file for your app and modify the versions of the redists your app should be linking against. The listings in the manifest should match what you have in your C:\Windows\WinSxS dirs. There is a <a href="http://www.codeproject.com/KB/cpp/vcredists_x86.aspx" rel="nofollow noreferrer">...
14,895
<p>We have two branches: 1. HEAD - the latest version (AKA Trunc) 2. PROD - the released version</p> <p>When you fix bugs in the released version, which of these do you do:</p> <ol> <li>Fix it in PROD, then merge to HEAD</li> <li>Fix it in HEAD, then merge to PROD</li> </ol> <p>The advantage of (1) is that this way ...
<p>Bug fixes should be applied to the branch and merged to the the main line of development. You need to do this to avoid bringing new features into a production release that are not intended to be there. Note that easiest way to do this if you need the change in the HEAD may be to apply identical changes in both bra...
<p>(1) as well.</p> <p>Do not forget that <strong>not every bugs fixed into PROD have to be merged back into HEAD</strong>.</p> <p>Sometimes, your current code has already evolved in such a way the bugs fixed into PROD are no longer relevant.</p>
40,441
<p>What is the difference between using angle brackets and quotes in an <code>include</code> directive?</p> <ul> <li><code>#include &lt;filename&gt;</code></li> <li><code>#include &quot;filename&quot;</code></li> </ul>
<p>What differs is the locations in which the preprocessor searches for the file to be included.</p> <ul> <li><p><code>#include &lt;filename&gt;</code>   The preprocessor searches in an implementation-defined manner, normally in directories pre-designated by the compiler/IDE. This method is normally used to include hea...
<p>There exists two ways to write #include statement.These are:</p> <pre><code>#include"filename" #include&lt;filename&gt; </code></pre> <p>The meaning of each form is </p> <pre><code>#include"mylib.h" </code></pre> <p>This command would look for the file <code>mylib.h</code> in the current directory as well as the...
4,174
<p>I'm a PHP developer who is being considered for a job implementing <a href="http://www.brainbankinc.com/idealinkOpen.aspx" rel="nofollow noreferrer">IdeaBank</a>, idea management software written in .net. The software appears to have been selected based on its features and clients. The <a href="http://ideabank.ope...
<p>Despite the similar names, the IdeaBank community feature on OpenDNS has nothing to do with the .Net software you cite. It's based on Pligg, which uses PHP.</p>
<p>Despite the similar names, the IdeaBank community feature on OpenDNS has nothing to do with the .Net software you cite. It's based on Pligg, which uses PHP.</p>
49,758
<p>I'm looking for a generic "Row Picker" for JQuery.</p> <p>We've all seen the cool "Picker" tools like date pickers, color pickers, time pickers, etc, where you click in a text box and a little calendar or color palate or clock or something comes up. You select something (like a date) and the text box is then popul...
<p>I don't know about totally generic though you can certainly achieve a row selector fairly easily in jQuery. </p> <pre><code>&lt;script type="text/javascript"&gt; $(function() { $('table#data_table tr').click(function() { alert($(this).find('td.id').html()); }); }); &lt;/script&gt; ...
<p>I know I'm a year late, and that I'm probably missing something here, but what's wrong with the <code>select</code> element with the <code>size</code> attribute?</p> <pre><code>&lt;select name="test" size="5"&gt; &lt;option value="1"&gt;One&lt;/option&gt; &lt;option value="2"&gt;Two&lt;/option&gt; &lt;option ...
24,344
<p>I am going to spend 30 minutes teaching Perl to an experienced programmer. The best way to learn Perl is by writing code. In addition to CPAN, what would you show a programmer so they would understand the expressiveness of Perl, the amount of functionality provided by CPAN, while keeping everything clean and tidy ...
<p>We wrote a whole book on that called <a href="http://shop.oreilly.com/product/0636920018452.do" rel="nofollow noreferrer">Learning Perl</a>. Check out the table of contents.</p> <p>This book is a product of teaching people Perl since 1995. It's not geared to any particular application, and shows people the parts of...
<p>I agree with some of the other commenters that it truly depends on the type of task that Perl is being used for. Is this person a Windows system admin? Then I'd cover using WMI from Perl (scriptomatic would be a good resource here).</p> <p>I'd grab a copy of Oreilley's "Perl Cookbook", and find some interesting top...
41,372
<p>This is my first post here and I wanted to get some input from people doing iPhone development. Other than the Apple DevCenter, where are there good sites to learn iPhone developement?</p> <p>I know Apple has a tough NDA but there has to be people talking about writing applications for the iPhone.</p>
<p><a href="http://www.icodeblog.com/tag/iphone/" rel="nofollow noreferrer">This site</a> covers some of the basics with little regard for the NDA. Start at the bottom and work up.</p>
<p>In <a href="http://www.raywenderlich.com/tutorials" rel="nofollow">http://www.raywenderlich.com/tutorials</a> you will find a lots of good tutorials, and you will be up to date with new iOS features as soon as Apple release then.</p>
4,165
<p>Is it possible to get the progress of an XMLHttpRequest (bytes uploaded, bytes downloaded)? </p> <p>This would be useful to show a progress bar when the user is uploading a large file. The standard API doesn't seem to support it, but maybe there's some non-standard extension in any of the browsers out there? It see...
<p>For the bytes uploaded it is quite easy. Just monitor the <code>xhr.upload.onprogress</code> event. The browser knows the size of the files it has to upload and the size of the uploaded data, so it can provide the progress info.</p> <p>For the bytes downloaded (when getting the info with <code>xhr.responseText</cod...
<p>The only way to do that with pure javascript is to implement some kind of polling mechanism. You will need to send ajax requests at fixed intervals (each 5 seconds for example) to get the number of bytes received by the server.</p> <p>A more efficient way would be to use flash. The flex component <a href="http://li...
10,259
<p>I have an if statement with two conditions (separated by an OR operator), one of the conditions covers +70% of situations and takes far less time to process/execute than the second condition, so in the interests of speed I only want the second condition to be processed if the first condition evaluates to false.</p> ...
<p>For C, C++, C#, Java and other .NET languages boolean expressions are optimised so that as soon as enough is known nothing else is evaluated.</p> <p>An old trick for doing obfuscated code was to use this to create if statements, such as:</p> <pre><code>a || b(); </code></pre> <p>if "a" is true, "b()" would never ...
<p>Since this is tagged language agnostic I'll chime in. For Perl at least, the first option is sufficient, I'm not familiar with PHP. It evaluates left to right and drops out as soon as the condition is met.</p>
5,534
<p>What are the pros and cons of adopting Open Source software for an organisation? Is there anybody out there who has done this and how well has it been working out with some examples of the softwares they adopted and how it has been in use?</p> <p>Usually contributions come because people do it as a hobby, then how ...
<p>The term "Open Source" only describes a licensing model. Strictly speaking, the only pro that you are guaranteed to have are the freedoms given by the license, and there are no cons that you are guaranteed to have.</p> <p>There are many Open Source products that are also commercial, created, maintained, and suppor...
<p>It doesn't matter what Manager opposing Open Source is saying.</p> <p>You have to know well Open Source product you are about to use.<br> You have to be sure that it right solution for company. You have to be confident that you can find people on market who know or can learn to use that product. You have to know TC...
41,969
<p>Is there a way I can configure the MidPointRounding enumeration default setting in a config file (I.e. web.config or app.config) I have a considerable source code base, and I need to configure at the application scope how rounding will occur, whether used in Math.Round or decimal type rounding... I would like to d...
<p>You can play games with post-compile tools that alter the assembly to call your function instead of Math.Round. However, I would just bite the bullet and change the source code.</p>
<p>Enum.Parse() is your friend here</p> <pre><code>MyEnum GetEnumValue(string enumString) { return (MyEnum)Enum.Parse(typeof(MyEnum),enumString); } </code></pre> <p>Obviously you'd also need some error-checking on the string you're getting from you're config file in which case you might want to return a default.</p...
8,911
<p>I'm running JBoss 4.0.5 on Windows 2003 x64 and wonder if there is any way to get a dump of all threads? </p> <ul> <li><p>It's stared with FireDaemon so I don't have a console windows in which to ctrl-break.</p></li> <li><p>It's running under java 1.5 so jstack won't work.</p></li> <li><p>I tried some program some...
<p>I actually found a better way than what <a href="https://stackoverflow.com/users/3253/gowri">Gowri</a> suggested (after starting to implementing the jsp).</p> <p>There is actually a way to dump the threads from the jmx-console in the Server Info MBean, see <a href="http://www.jboss.org/community/docs/DOC-9804" rel=...
<p>You could just write a jsp that does <code>Thread.getAllStackTraces()</code> and print out the stacktracelements in an amenable format. Then hitting the URL of that jsp at any time would give you the stack dump of all threads at that time.</p>
39,754
<p>According <a href="http://msdn.microsoft.com/en-us/library/y3bwdsh3.aspx" rel="noreferrer">this MSDN article</a> <em>HttpApplication</em>.EndRequest can be used to close or dispose of resources. However this event is not fired/called in my application.</p> <p>We are attaching the handler in Page_Load the following ...
<p>You can use your own HttpModule to capture the EndRequest if you don't want to use the global.asax.</p> <pre><code>public class CustomModule : IHttpModule { public void Init(HttpApplication context) { context.EndRequest += new EventHandler(context_EndRequest); } private void context_EndReq...
<p>The page is probably being disposed before the event fires. You might want to try to do your work in the Page_Unload handler.</p>
29,683
<p>I'm kind of curious how I should approach a problem with iPhones and communication between two phones.</p> <p>I have an idea for an application that needs to send data between two known phones. The problem is that the data could be very small or very large. I want to have intermediate storage on a server and a mess...
<p>Have you given the WiTap sample from Apple a try? It addresses the issue of discoverability (via Bonjour) and connectivity (via basic TCP). It may not be as robust as what you are looking for, but it's worth a look:</p> <p><a href="http://developer.apple.com/iphone/library/samplecode/WiTap/index.html" rel="nofoll...
<p>Look at the docs for Game Kit in the iPhone 3.0 SDK. It allows iPhones to connect to one another locally with Bluetooth, or via wi-fi/3G. It addresses both peer-to-peer and client-server architectures. It provides unreliable and reliable links.</p>
23,607
<p>I'd like to do something like this</p> <blockquote> <pre><code>raiserror(concat('Error in case @isFishy =', @isFishy, ' @isSmarmy=', @isSmarmy, ' @isTasty = ', @isTasty), 10, 1) --or raiserror('Error in case @isFishy =' + @isFishy + ' @isSmarmy=' + @isSmarmy + ' @isTasty = ' + @isTasty, 10, 1) </code></pre> </block...
<p>The error message in RAISERROR has actually similar syntax to printf function in C, so assuming your arguments are of the type of integer you would need to use:</p> <pre><code>raiserror(N'Error in case @isFishy = %d @isSmarmy = %d @isTasty = %d',10,1,@isFishy,@isSmarmy,@isTasty) </code></pre> <p>check out <a href=...
<p>I use raiserror a lot. We have some stored procedures that are called from a .Net app each night for batch processing, and the .Net app wants to log the procedure output this way. I don't know why, but I generally have to build the string before calling raiserror. </p>
27,964
<p>I'm trying to write a regex that will parse out the <strong>directory and filename</strong> of a fully qualified path using matching groups.</p> <p>so...</p> <pre><code>/var/log/xyz/10032008.log </code></pre> <p>would recognize <code>group 1 to be "/var/log/xyz"</code> and <code>group 2 to be "10032008.log"</code...
<p>Try this:</p> <pre><code>^(.+)\/([^\/]+)$ </code></pre> <p>EDIT: escaped the forward slash to prevent problems when copy/pasting the Regex</p>
<p>Try this:</p> <pre><code>/^(\/([^/]+\/)*)(.*)$/ </code></pre> <p>It will leave the trailing slash on the path, though.</p>
20,399
<p>Java 1.5, Linux</p> <p>I do have a screen which contains different textareas and textfields. I do have acess to the application frame, but not to the components inside the frame, because i only get an implementation of an interface.</p> <p>When i try to add german umlauts i see a rectangle in the text component, b...
<p>It sounds like a character encoding problem or font problem... Like using "windows" encoding in a Linux environment. You should check the following:</p> <ul> <li>Can you write those characters in a normal texteditor in your linux distro? </li> <li>Are those characters from input files in your java application or is...
<p>The square box is the unicode symbol for when the character in question can't be displayed as the font doesn't contain it.</p> <p>You'll either need to switch the text boxes to a font that does contain the German characters, or find some other way of doing the substitution for just that character (which may not be ...
42,180
<p>I was working with a new C++ developer a while back when he asked the question: "Why can't variable names start with numbers?"</p> <p>I couldn't come up with an answer except that some numbers can have text in them (123456L, 123456U) and that wouldn't be possible if the compilers were thinking everything with some ...
<p>Because then a string of digits would be a valid identifier as well as a valid number.</p> <pre><code>int 17 = 497; int 42 = 6 * 9; String 1111 = "Totally text"; </code></pre>
<p>I think the simple answer is that it can, the restriction is language based. In C++ and many others it can't because the language doesn't support it. It's not built into the rules to allow that. </p> <p>The question is akin to asking why can't the King move four spaces at a time in Chess? It's because in Chess ...
44,479
<p>How do I capture the output of "%windir%/system32/pnputil.exe -e"? (assume windows vista 32-bit)</p> <p>Bonus for technical explanation of why the app normally writes output to the cmd shell, but when stdout and/or stderr are redirected then the app writes nothing to the console or to stdout/stderr?</p> <pre> C:\W...
<p>Doesn't seem like there is an easy way at all. You would have to start hooking the call to WriteConsole and dumping the string buffers. See <a href="http://objectmix.com/tcl/366746-autoexpect-under-windows-later-mac-linux.html#post1359780" rel="nofollow noreferrer">this post</a> for a similar discussion.</p> <p>O...
<p>Some applications are written so that it works in piping scenarios well e.g.</p> <pre><code>svn status | find "? " </code></pre> <p>is a command that pipes output of <code>svn status</code> into <code>find "? "</code> so it would filter subversion output down to unknown files (marked with a question mark) in my re...
7,819
<p>Are <a href="http://jquery.com/demo/thickbox/" rel="noreferrer">modal windows/dialogs</a> considered a good practice for websites? One of the things that concerns me about using a modal window is that it is so much like a pop-up window and it could cause user frustration or cause users to simply close it because it...
<p>From a practice standpoint - excluding accessibility - modal windows provide an alternative that are less startling as, say, dialog boxes and feel less intrusive than pop-up windows. They usually have a more cohesive feel to the site than either of the two aforementioned method. Aside from pictures or media, I've us...
<p>37Signals has an interesting post on modals <a href="http://www.37signals.com/svn/posts/1149-modal-overlays-beyond-the-dialog-box" rel="nofollow noreferrer">here</a>. They talk about using modals to indicate importance through screen size, where the modal overlay isn't important enough to necessitate navigating to a...
25,251
<p>I am currently creating a custom control that needs to handle animation in a C# project. It is basically a listbox that contains a fixed number of elements that are subject to move. An element (another user control with a background image and a couple of generated labels) can move upwards, downwards or be taken out ...
<p>your best bet for flicker-free animation is to do the painting yourself (use the Graphics object in the Paint event handler) and use double-buffering. In your custom control you will need code like this in the constructor:</p> <pre><code>this.SetStyle(ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer | ...
<p>The normal way to get flicker-free animation is to implement double-buffering. Take a look at this Code Project article</p> <p><a href="http://www.codeproject.com/KB/GDI-plus/flickerFreeDrawing.aspx" rel="nofollow noreferrer">http://www.codeproject.com/KB/GDI-plus/flickerFreeDrawing.aspx</a></p> <p>Minimizing cal...
22,040
<p>Is there a free software for creating windows help files for your program?</p> <p>I would like something that allows an output of both CHM and HTML files.</p>
<p>Yes. HelpMaker from <a href="http://sourceforge.net/projects/helpmaker/" rel="nofollow noreferrer">sourceforge</a> (The original site <a href="http://www.vizacc.com" rel="nofollow noreferrer">www.vizacc.com</a> is down). Best free help utility ever.</p>
<p>It's not "free" but the best software I've ever come across is HelpScribble from Just Great Software. I use it on Windows 7 without any problem. What I like most is its ability to integrate SHG files into the helpfile. A picture is worth a thousand words so I tend to use screen images where I capture buttons, tex...
17,512
<p>I wrote a simple batch file as a PowerShell script, and I am getting errors when they run.</p> <p>It's in a scripts directory in my path. This is the error I get:</p> <blockquote> <p>Cannot be loaded because the execution of scripts is disabled on this system. Please see "get-help about-signing".</p> </block...
<p>It could be PowerShell's default security level, which (IIRC) will only run signed scripts.</p> <p>Try typing this:</p> <pre class="lang-none prettyprint-override"><code>set-executionpolicy remotesigned </code></pre> <p>That will tell PowerShell to allow local (that is, on a local drive) unsigned scripts to run.<...
<p>On Windows 10: Click change security property of myfile.ps1 and change "allow access" by right click / properties on myfile.ps1</p>
3,184
<p>I would like to use Haskell more for my projects, and I think if I can get started using it for web apps, it would really help that cause. I have tried happs once or twice but had trouble getting off the ground. Are there simpler/more conventional (more like lamp) frameworks out there that I can use or should I just...
<p>The best tools as of 2011 are:</p> <ul> <li><a href="http://snapframework.com/" rel="nofollow noreferrer">Snap</a></li> <li><a href="http://www.yesodweb.com/" rel="nofollow noreferrer">Yesod</a>; or</li> <li><a href="http://happstack.com/" rel="nofollow noreferrer">Happstack</a></li> </ul> <p>The web development c...
<p>There is also <a href="http://hope.bringert.net/about" rel="nofollow noreferrer">Hope</a> (link is depreciated), although it doesn't seem to have gained as much traction as <a href="http://happs.org/" rel="nofollow noreferrer">HApps</a> and <a href="http://www2.informatik.uni-freiburg.de/~thiemann/WASH/" rel="nofoll...
7,388
<p>I have a string that looks like this:</p> <pre><code>"Name1=Value1;Name2=Value2;Name3=Value3" </code></pre> <p>Is there a built-in class/function in Python that will take that string and construct a dictionary, as though I had done this:</p> <pre><code>dict = { "Name1": "Value1", "Name2": "Value2", "N...
<p>There's no builtin, but you can accomplish this fairly simply with a generator comprehension:</p> <pre><code>s= "Name1=Value1;Name2=Value2;Name3=Value3" dict(item.split("=") for item in s.split(";")) </code></pre> <p><strong>[Edit]</strong> From your update you indicate you may need to handle quoting. This does ...
<pre><code>easytiger $ cat test.out test.py | sed 's/^/ /' p_easytiger_quoting:1.84563302994 {'Name2': 'Value2', 'Name3': 'Value3', 'Name1': 'Value1'} p_brian:2.30507516861 {'Name2': 'Value2', 'Name3': "'Value3'", 'Name1': 'Value1'} p_kyle:7.22536420822 {'Name2': ['Value2'], 'Name3': ["'Value3'"], 'Name1': ['Value1'...
22,617
<p>Is there a way I can access (for printout) a list of sub + module to arbitrary depth of sub-calls preceding a current position in a Perl script?</p> <p>I need to make changes to some Perl modules (.pm's). The workflow is initiated from a web-page thru a cgi-script, passing input through several modules/objects end...
<p>You can use <a href="http://search.cpan.org/dist/Devel-StackTrace/" rel="noreferrer">Devel::StackTrace</a>.</p> <pre><code>use Devel::StackTrace; my $trace = Devel::StackTrace-&gt;new; print $trace-&gt;as_string; # like carp </code></pre> <p>It behaves like Carp's trace, but you can get more control over the frame...
<p>One that is more pretty: <a href="https://metacpan.org/pod/Devel::PrettyTrace" rel="nofollow" title="Devel::PrettyTrace">Devel::PrettyTrace</a></p> <pre><code>use Devel::PrettyTrace; bt; </code></pre>
28,344
<p>Let's say at your job your boss says,</p> <blockquote> <p>That system over there, which has lost all institutional knowledge but seems to run pretty good right now, could we dump double the data in it and survive?</p> </blockquote> <p>You're completely unfamiliar with the system.</p> <p>It's in SQL Server 2000 ...
<ol> <li><p>Set up a test environment, even if I have to do it on my laptop.</p></li> <li><p>Enable some kind of logging on the production system to get an idea of the volume of transactions in addition to the volume of data.</p></li> <li><p>Read the source code as I run stress tests on my laptop with increasing amount...
<p>it mostly depends on its current level. If doubling is going from 2GB to 4GB just do it. If it's going from 1TB to 2TB you've got some planning to do.</p> <p>I'd collect some info using Performance Monitor and provide it to help make an educated decision.</p>
38,347
<p>After some find and replace refactoring I ended up with this gem:</p> <pre><code>const class A { }; </code></pre> <p>What does "const class" mean? It seems to compile ok.</p>
<blockquote> <p>What does "const class" mean? It seems to compile ok.</p> </blockquote> <p>Not for me it doesn't. I think your compiler's just being polite and ignoring it.</p> <p><strong>Edit:</strong> Yep, VC++ silently ignores the const, GCC complains.</p>
<p>Try compiling it with GCC, it will give you below error:<br> <code>error: qualifiers can only be specified for objects and functions.</code></p> <p>As you can see from the error that only objects(variables, pointers, class objects etc.) and functions can be constant. So try making the object as constant, then it sh...
25,367
<p>Disclaimer: I've solved the problem using Expressions from System.Linq.Expressions, but I'm still looking for a better/easier way.</p> <p>Consider the following situation :</p> <pre><code>var query = from c in db.Customers where (c.ContactFirstName.Contains("BlackListed") || c.ContactLastName....
<p>@Geoff has the best option, justing Dynamic LINQ.</p> <p>If you want to go the way of building queries at runtime using Lambda though I'd recomment that you use the PredicateBuilder (<a href="http://www.albahari.com/nutshell/predicatebuilder.aspx" rel="noreferrer">http://www.albahari.com/nutshell/predicatebuilder.a...
<p>Since this is not LINQ to Objects, but rather LINQ to SQL, you have no other alternative beside using either Expressions or a stored procedure.</p>
29,018
<p><code>mime_content_type()</code> is deprecated.</p> <p>How can I find the <code>MIME type</code> of a local file using <code>PHP5</code> but without using this deprecated method or the <code>PECL fileinfo</code> extension?</p> <p>Edit: That's what I was afraid of. It's unfortunate that they deprecated a built-in ...
<p>If you can't use the fileinfo extension, and you don't want to use mime_content_type, your options are limited.</p> <p>Most likely you'll need to do a lookup based on the file extension. mime_content_type did something a bit more intelligent and actually looked for special data in the file to determine the mime ty...
<p>The <a href="http://getid3.sourceforge.met" rel="nofollow noreferrer" title="getId3">getID3()</a> library is a quick and easy works-most-of-the-time option. Originally named for a project to obtain MP3 ID3 data, the library does two hecks of a lot more than that and is quite convenient for all sorts of common or odd...
7,401
<p>In the spirit of <a href="https://stackoverflow.com/questions/171156/best-practices-always-return-a-never-a">Best Practices: Always return a ____, never a ____</a>, I face a similar question in my upcoming <a href="https://stackoverflow.com/questions/219164/generics-in-legacy-code">migration from JDK1.4.2 to JDK5 an...
<p>Prefer Collection (or List, or Set as appropriate) to an array. With generics you get the type-checking that was lacking pre-Java 5. Also, by exposing only the interface, you are free to change the implementation later (e.g. switch an ArrayList for a LinkedList).</p> <p>Arrays and generics don't mix very well. S...
<p>Check out the unmodifiable* methods in <code>Collections</code> class to make returned collections read-only/immutable. This will wrap the original collection in a list that prevents access to changing the list itself (the elements themselves are not immutable though).</p> <p><a href="http://java.sun.com/javase/6/d...
27,882
<p>Does anyone know of a good tool for debugging JSPs from within Eclipse? I'd like to be able to set and watch breakpoints, step through the Java code/tags, etc within Eclipse while the app is running (under JBoss in my case).</p> <p>Presumably, it's reasonably straightforward to debug the servlet class that's genera...
<p>If you have <a href="https://en.wikipedia.org/wiki/Eclipse_(software)#Web_Tools_Platform" rel="nofollow noreferrer">WTP</a> installed, you can set breakpoints within a JSP and they work fine in a regular "remote debug" session. However, once you've stopped on a breakpoint, stepping through the code is nigh on imposs...
<p>Apparently, Eclipse has <a href="http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.wst.server.ui.doc.user%2Ftopics%2Ftdbgjsp.html" rel="nofollow">a troubleshooting page</a> on this, though when I tried it I did get a 404 with it. Hopefully this can at least get you started in a good direction.</p>
15,019
<p>Within SQL Server Integration Services (SSIS) there is the ability to setup a connection to a flat file that can hold millions of records and have that data pushed to a SQL DB. Furthermore, this process can be called from a C# app by referencing and using the Microsoft.SqlServer.Dts.Runtime namespace. </p> <p>Would...
<p>I can only speak for myself and my experience. I would go with SSIS, since this is one of those cases where you might be re-inventing the wheel unnecessarily. This is a repetitive task that has already been solved by SSIS.</p> <p>I have about 57 jobs (combination of DTS and SSIS) that I manage on a daily basis. Fou...
<p>SSIS is incredibly fast. In addition, if it's something that needs to occur repeatedly, you can setup an agent to fire it off on schedule. Writing it yourself is one thing, trying to make it multithreaded gets a lot more complicated than it appears at first.</p> <p>I'd recommend SSIS 9 times out of ten.</p>
17,662
<p>I need lucene to search for synonyms as well as the actual keyword. that is if I search for "CI", I want it to search for CI OR "continues integration". at the moment I search for keywords I have the synonyms for and replace them with the "OR-ed" version, but I suspect there should be a better way to do this. my met...
<p>That's pretty much how I was planning on implementing this functionality. I was planning on building my own version of this but then I ran across this site <a href="https://www.ebswift.com/wordnetnet.html" rel="nofollow noreferrer">WordNet.Net</a> which seems to try to address the issue of building the synonyms. The...
<p>At least in the Java version of Lucene, you could write yourself a recursive function that digs through the BooleanQuery Query objects that the QueryParser will build; every time it finds a TermQuery, it could replace it with a BooleanQuery that OR's the original term with the new term you want added into the query....
22,968
<p>I'm writing a simple photo album app using ASP.NET Ajax.<br> The app uses async Ajax calls to pre-load the next photo in the album, without changing the URL in the browser.</p> <p>The problem is that when the user clicks the <strong>back</strong> button in the browser, the app doesn't go back to the previous photo,...
<p><strong>Update: There is now the HTML5 History API (pushState, popState) which deprecates the HTML4 <code>hashchange</code> functionality. <a href="https://github.com/balupton/history.js" rel="nofollow noreferrer">History.js</a> provides cross-browser compatibility and an <a href="https://github.com/balupton/history...
<p>The 3.5 SP1 update has support for browser history and back button in ASP.NET ajax now.</p>
4,974
<p>I would like to create an SSL connection for generic TCP communication. I think I figured out how to do it in the code, using the info here: <a href="http://msdn.microsoft.com/en-us/library/system.net.security.sslstream.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/system.net.security.ssls...
<p>I haven't found a <em>simple</em> way to do this yet, but I found <a href="http://www.herongyang.com/crypto/openssl_crt.html" rel="nofollow noreferrer">this site</a> helpful a few months back.</p> <p>O'Reilly also published a book called Network Security Hacks (available on Safari) that has a section starting at Ha...
<p>For anybody else attempting this the pkcs12 certificate created as detailed here <a href="https://stackoverflow.com/questions/440762/openssl-command-line-troubles">openssl question</a> and using the X509Certificate2.CreateFromCertFile method gets past the private key problem. Note I used openssl with cygwin on Windo...
4,114
<p>I have 3 projects in my VS solution. One of them is a Web app, the second one is a Windows Service and the last one a Setup project for my Web app. </p> <p>What I want is by the end of the installation of the web app in my setup project, within my custom action to try and install my windows service given that I hav...
<p>Ok, here is what REALLY worked for me, it has been tested on multiple machines with different OS ( Vista, XP, Win2k, Win2003 server )</p> <p>The code has been taken from <a href="http://www.tech-archive.net/Archive/VB/microsoft.public.vb.winapi/2006-08/msg00238.html" rel="noreferrer">here</a> so full credit goes to...
<p>Use below code to install windows service using C#:</p> <pre><code>public void InstallWinService(string winServicePath) { try { ManagedInstallerClass.InstallHelper(new string[] { winServicePath}); } catch (Exception) { throw; } } </code></pre>...
46,773
<p>I'm trying to create a dialog box using C++ and the windows API, but I don't want the dialog defined in a resource file. I can't find anything good on this on the web, and none of the examples I've read seem to define the dialog programmatically.</p> <p>How can I do this?</p> <p>A simple example is fine. I'm not d...
<p>Raymond Chen wrote a few posts about the dialog manager:</p> <ul> <li><a href="https://devblogs.microsoft.com/oldnewthing/20050329-00/?p=36043" rel="nofollow noreferrer">The dialog manager, part 1: Warm-ups</a></li> <li><a href="https://devblogs.microsoft.com/oldnewthing/20050330-00/?p=36023" rel="nofollow noreferr...
<p>Take a look at <a href="http://www.codeproject.com/KB/wtl/resourcelessdialogtoolkit.aspx" rel="nofollow noreferrer">this toolkit</a> that describes how to create dialogs without resource files.</p> <p>It's in WTL. However, I'm sure you can pick apart the internals to achieve the same thing using the Win32 API direc...
8,685
<p>I have an Java desktop application which connects directly with the DB (an Oracle). The application has multiple user accounts. What is the correct method to send the user's password (not DB password) over the network? I don't want to send it in plain text.</p>
<p>You could connect over a secure socket connection, or hash the password locally before sending it to the database (or better, both) - Ideally, the only time the password should exist in plain text form is prior to hashing. If you can do all of that on the client side, more the better.</p>
<p>If you don't want to send the data in plain text, use encryption !!!</p> <p>Use some encryption algorithm such as AES, Twofish etc.</p> <p>You must also take into consideration where your client and server are. If they both are in the same machine, there is no use of using an encryption. If they are in different m...
9,558
<p>I've got a whole directory of dll's I need to register to the GAC. I'd like to avoid registering each file explicitly- but it appears that gacutil has no "register directory" option. Anyone have a fast/simple solution?</p>
<p>GACUTIL doesn't register DLLs -- not in the "COM" sense. Unlike in COM, GACUTIL copies the file to an opaque directory under %SYSTEMROOT%\assembly and that's where they run from. It wouldn't make sense to ask GACUTIL "register a folder" (not that you can do that with RegSvr32 either).</p> <p>You can use a batch FOR...
<p>Use </p> <blockquote> <p>gacutil /il YourPathTo_A_TextFile.txt</p> </blockquote> <p>switch, if you have dlls in multiple different folders. Otherwise go with the <code>for ... in</code> loop mentioned by Euro.</p> <p>The text file should contain a list of assembly paths (one path per line) which should be insta...
5,544
<p>I need to update a field (which is currently empty) based on a match with another table. This should be simple, but my syntax is wrong.</p> <p>In SQLServer 2005, the syntax would be </p> <pre><code>UPDATE Facilities-NOID SET Facilities-NOID.ID = Facilities-ID.ID FROM Facilities-NOID, Facilities-ID WHERE [Faciliti...
<p>I think this is what you want:</p> <pre><code>UPDATE Facilities-NOID INNER JOIN Facilities-ID ON Facilities-NOID.[Structure ID] = Facilities-ID.[Structure ID] SET Facilities-NOID.ID= Facilities-ID.ID </code></pre> <p>You are updating Facilities-NOID based on a match on Structure ID occurring in Facilities-ID...
<p>Remove the FROM clause completely</p> <pre><code>UPDATE Facilities-NOID SET Facilities-NOID.ID = Facilities-ID.ID WHERE [Facilities-ID].[Structure ID] = [Facilities-NOID].[Structure ID]; </code></pre> <p>(that's the way that the query builder ends up constructing them)</p>
49,629
<p>Is it possible to do 3.1 or 5.1 audio using Flash? We're starting a project here for an interactive kiosk, and we've been told to use Flash. However, we also have a requirement to support either 3.1 or 5.1 audio (where 5.1 is the most wanted feature). </p> <p>I haven't done any high-tech audio stuff using Flash,...
<p>A quick google search gave me this forum <a href="http://board.flashkit.com/board/showthread.php?t=715062" rel="nofollow noreferrer">http://board.flashkit.com/board/showthread.php?t=715062</a> where they state that Flash is unable to handle 5.1 audio and the alternative is to use another application that can communi...
<p>As far as I know this is not possible. </p> <p>You <strong>might</strong> be able to do it if you use uncompressed wave files already encoded in DTS or something and put a surround receiver in between. This will however stop you from doing anything with the sound before outputting it, not even changing the volume. ...
5,531
<p>I'm looking for a way to configure a DB connection at runtime; specifically using the Enterprise Library. I see that there's a *.Data.Configuration (or something close to this ... don't recall off the top of my head) assembly but am finding not much on the interwebs. Complicating matters is the fact that the API h...
<p>If you're using a winforms app you could try using <a href="http://msdn.microsoft.com/en-us/library/aa221771(office.11).aspx" rel="nofollow noreferrer">UserProperties</a> to store this info. Another possible solution could be <a href="http://msdn.microsoft.com/en-us/library/2tw134k3.aspx" rel="nofollow noreferrer">c...
<p>If you don't want it saved, you do not need to execute the cfg.Save command. </p> <p>The Configuration object will store your changes until it isn't needed anymore.</p>
3,650
<p>What is the best way to set the time on a remote machine remotely? The machine is running Windows XP and is receiving the new time through a web service call. The goal is to keep the remote machines in synch with the server. The system is locked down so that our web service is the only access, so I cannot use a t...
<p>I would use Windows built-in internet time abilities. You can set up a <a href="http://en.wikipedia.org/wiki/Time_server" rel="nofollow noreferrer">time server</a> on your server, have it get time from a 2nd-tier timeserver, and have all your client machines get time from it.</p> <p>I've been down the application-s...
<p>You could also probably do this in a batch file using some combination of</p> <pre><code>TIME </code></pre> <p>to set the time, and</p> <pre><code>net time \\server_name </code></pre> <p>to retrieve the time from a server.</p>
25,103
<p>All, </p> <p>I currently have two projects that are under SourceSafe that I am unable to migrate to our SVN server for a number of reasons. </p> <p>However I am currently in the process of trying to merge fixes from one project into the other. </p> <p>I know Sourcesafe isn't the best at this but the process I am ...
<p>It might be worthwhile to check out the different versions and use a 3rd-party tool to merge them. Take a look at kdiff3 (<a href="http://kdiff3.sourceforge.net" rel="nofollow noreferrer">http://kdiff3.sourceforge.net/</a>) -- it runs on linux or Windows and will merge up to 3 different versions quite intelligently...
<p>winmerge can combine with sourcesafe. support folder comparision.</p>
28,396
<pre> create table person ( name varchar(15), attr1 varchar(15), attr2 varchar(1), attr3 char(1), attr4 int ) </pre> <p>How I can use basic ORM in Perl by taking a simple table like the one above and mapping it to Perl objects? Next I'd like to perform basic operations like select results using so...
<p>Rule #1, don't write your own.</p> <p>There are quite a number of ORMs on CPAN, including ...</p> <ul> <li><a href="http://search.cpan.org/dist/DBIx-Class" rel="noreferrer">DBIx::Class</a> - probably #1 in popularity at the moment</li> <li><a href="http://search.cpan.org/dist/Rose-DB-Object" rel="noreferrer">Rose:...
<p>(Chiming late) Data::ObjectDriver (also on CPAN) provides great flexibility especially if partitioning and caching is on the list of your requirements.</p>
35,610