instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>I have an annoying problem which I might be able to somehow circumvent, but on the other hand would much rather be on top of it and understand what exactly is going on, since it looks like this stuff is really here to stay.</p> <p>Here's the story: I have a simple OpenGL app which works fine: never a major problem ...
<p>Boost.Thread has quite a few possible build combinations in order to try and cater for all the differences in linking scenarios possible with MSVC. Firstly, you can either link statically to Boost.Thread, or link to Boost.Thread in a separate DLL. You can then link to the DLL version of the MSVC runtime, or the stat...
<p>Now this got even a bit more interesting... If I just add this somewhere in the source:</p> <pre><code>boost::posix_time::ptime pt = boost::posix_time::microsec_clock::universal_time(); </code></pre> <p>(together with the corresponding <code>#include</code> stuff), then it again works ok. So this is one quick and ...
27,491
<p>I'm especially interested in memory profiling, reducing the size of a compiled .swf, measuring network latency, etc. Also, I'm focussed entirely on AS3.</p>
<p>The latest <a href="http://www.adobe.com/products/flex/features/flex_builder/" rel="nofollow noreferrer">Flex Builder Professional</a> includes both memory and performance profilers built in:</p> <p><strong><em>Powerful testing tools (New in Flex Builder 3) (Professional edition only)</em></strong></p> <p><em>The ...
<p>FlexBuilder Pro definitely seems like a good option. Downloading the trial now...</p> <p>This article looks useful too:</p> <p><a href="http://flexblog.edchipman.ca/?p=7" rel="nofollow noreferrer">http://flexblog.edchipman.ca/?p=7</a></p> <p>I'm not actually concerned about measuring network latency, but I am co...
34,312
<p>I'm an MFC programmer. I just had my first taste of Vista (on a VPC... Yup, I'm late). I should be evaluating things in depth in the coming days. On taking a casual look, I noticed two major changes:</p> <ul> <li>The shell is new</li> <li>User Access Control</li> <li>Event Viewer has changed (would like more info o...
<p>There's a significant set of changes depending on what sort of software you write.</p> <p>It's never a bad idea to check out the <a href="https://winqual.microsoft.com/" rel="nofollow noreferrer">Windows Logo Certification (for Vista)</a>. There's a link to the Software technical requirements <a href="http://downl...
<p>1- Machine with Vista have usually more Ram, this is a good news for you :)</p> <p>2- Path to "Program files" are splitted in 2 : \Program Files (x86)\ and \Program Files\</p> <p>3- My Document has changed</p>
24,565
<p>Hey, I've been developing an application in the windows console with Java, and want to put it online in all of its console-graphics-glory.</p> <p>Is there a simple web applet API I can use to port my app over?</p> <p>I'm just using basic System.out and System.in functionality, but I'm happy to rebuild my I/O wrapp...
<p>Sure, just make into an applet, put a small swing UI on it with a JFrame with two components - one for writing output to, and one for entering inputs from. Embed the applet in the page.</p>
<p>I remember seenig telnet client applet implementationa around years ago (back when people used telnet). Maybe you could dig them out and modify them.</p>
16,720
<p>I am currently investigating how to make a connection to a SQL Server database from my Java EE web application using Windows Authentication instead of SQL Server authentication. I am running this app off of Tomcat 6.0, and am utilizing the Microsoft JDBC driver. My connection properties file looks as follows:</p> <...
<p>I do not think one can push the user credentials from the browser to the database (and does it makes sense ? I think not)</p> <p>But if you want to use the credentials of the user running Tomcat to connect to SQL Server then you can use Microsoft's JDBC Driver. Just build your JDBC URL like this:</p> <pre><code>jd...
<p>I was having issue with connecting to MS SQL 2005 using Windows Authentication. I was able to solve the issue with help from this and other forums. Here is what I did:</p> <ol> <li>Install the JTDS driver</li> <li>Do not use the "domain= " property in the jdbc:jtds:://[:][/][;=[;...]] string</li> <li>Install the nt...
20,226
<p>I'm pulling my hair out on this one.</p> <p>I have a site which is version controlled using Subversion. I use aptana (eclipse, subclipse) to do the svn. I have been checking in and out files, updating etc and everything is fine. However the system we have been building has been adding its own files and folders.</p>...
<p>If you want the generated files to be added to SVN, use <code>svn add</code> to recursively add them - this will make sure that all directories are part of the working copy, and all files and directories are added to SVN, and will be committed as part of the next <code>svn commit</code>.</p> <p>However, often gener...
<p>"Not a working copy" means that one of the places where your IDE is trying to run <code>svn</code> into is not controlled by <code>svn</code> itself (like adding files in a sub-directory not under <code>svn</code>). I'd say check your paths within the IDE.</p>
48,078
<p>I want my <kbd>AltGr</kbd> key to behave exactly like left <kbd>Alt</kbd>.<br> Usually, I do this kind of stuff with <a href="http://www.autohotkey.com/" rel="noreferrer">Autohotkey</a>, but I'm open to different solutions. </p> <p>I tried this:</p> <pre><code>LControl &amp; RAlt::Alt </code></pre> <p>And Autoho...
<p>Thank you all for answers. I was unable to solve this using AutoHotkey -- PhilLho's answer was close, but I really needed exatly the same behaviour as with left <kbd>Alt</kbd> key. </p> <p>However, the <a href="https://stackoverflow.com/questions/229633/how-to-globally-map-altgr-key-to-alt-key#396859">registry thi...
<p>In AHK, Can you do:</p> <pre><code>LControl &amp; RAlt::! </code></pre> <p>Or</p> <pre><code>&lt;^&gt;!::! </code></pre>
28,428
<p>What happens if the browser receives a redirect response to an ajax request?</p>
<p><em>What happens if the browser receives a redirect response to an ajax request?</em></p> <p>If the server sends a redirect (aka a 302 response plus a Location: header) the redirect is automatically followed by the browser. The response to the <em>second</em> request (assuming it also isn't another redirect) is wha...
<p>TLDR: it's doable with <code>fetch</code>.<br /> More info here: <a href="https://github.com/axios/axios/issues/932#issuecomment-515229573" rel="nofollow noreferrer">https://github.com/axios/axios/issues/932#issuecomment-515229573</a></p>
35,763
<p>Say I have a third party Application that does background work, but prints out all errors and messages to the console. This means, that currently, we have to keep a user logged on to the server, and restart the application (double-click) every time we reboot.</p> <p><em>Not so very cool.</em></p> <p>I was kind of ...
<p>Check out <a href="http://support.microsoft.com/kb/137890" rel="noreferrer"><code>srvany.exe</code></a> from the <a href="http://www.microsoft.com/downloads/details.aspx?familyid=9d467a69-57ff-4ae7-96ee-b18c4790cffd&amp;displaylang=en" rel="noreferrer">Resource Kit</a>. This will let run anything as a service.</p> ...
<p>I second the firedaemon option. You may also want to set the option to allow the service to interact with the desktop to allow it to display the cli output window. They no longer offer a free version but if you search around the web for firedaemon lite you can find the older free lite version or maybe go the for p...
20,041
<p>I can't get my GridView to enable a user to sort a column of data when I'm using a custom SqlDataSource.</p> <p>I have a GridView in which the code in the ASP reference to it in the HTML is minimal:</p> <pre><code>&lt;asp:GridView id="grid" runat="server" AutoGenerateColumns="False" AllowSorting="True"&gt; &lt;/as...
<p>First you need to add an event: </p> <pre><code>&lt;asp:GridView AllowSorting="True" OnSorting="gvName_Sorting" ... </code></pre> <p>Then that event looks like:</p> <pre><code>protected void gvName_Sorting( object sender, GridViewSortEventArgs e ) { ... //rebind gridview } </code></pre> <p>You basically ...
<p>I'm not sure about this one, but if you use a standard SqlDataSource and you click on a field to sort according to that field, the SqlDataSource is populated again with the data and it is rebound to the grid. So the sorting does not happen on the client side and also can be done only when the selectmethod of the SQL...
16,758
<p>In our application, we receive text files (<code>.txt</code>, <code>.csv</code>, etc.) from diverse sources. When reading, these files sometimes contain garbage, because the files where created in a different/unknown codepage.</p> <p>Is there a way to (automatically) detect the codepage of a text file? </p> <p>The...
<p>You can't detect the codepage, you need to be told it. You can analyse the bytes and guess it, but that can give some bizarre (sometimes amusing) results. I can't find it now, but I'm sure Notepad can be tricked into displaying English text in Chinese. </p> <p>Anyway, this is what you need to read: <a href="http:/...
<p>I use this code to detect Unicode and windows default ansi codepage when reading a file. For other codings a check of content is necessary, manually or by programming. This can de used to save the text with the same encoding as when it was opened. (I use VB.NET)</p> <pre><code>'Works for Default and unicode (auto d...
11,615
<p>I'm generating C++ code, and it seems like it's going to get very messy, even my simple generating classes already have tons of special cases. Here is the code as it stands now: <a href="http://github.com/alex/alex-s-language/tree/local%2Fcpp-generation/alexs_lang/cpp" rel="nofollow noreferrer">http://github.com/al...
<p>I wrote <a href="http://nedbatchelder.com/code/cog/index.html" rel="noreferrer">Cog</a> partly to generate C++ code from an XML data schema. It lets you use Python code embedded in C++ source files to generate C++ source.</p>
<p>I have a code generation system and one of the best choices I have taken with it is to put much of the resultant program in non generated code, e.g. a library/runtime. Using templates works well also. Complex template systems may be hard to work with by hand, but your not working with them by hand so leverage that. ...
37,596
<p>Why doesn't this Google Chart API URL render both data sets on this XY scatter plot? </p> <pre><code>http://chart.apis.google.com/chart?cht=lxy&amp;chd=t:10,20,30,40,50,60,70,80,90,100,110,120,130,140,150,160,170,180,190,200|0.10,0.23,0.33,0.44,0.56,0.66,0.79,0.90,0.99,1.12,1.22,1.33,1.44,1.56,1.68,1.79,1.90,2.02,...
<p>First a point of clarification. You talk about a "XY scatter plot", but these are actually 2 distinct chart types in the Google Chart API. Your URL refers to cht=lxy parameter which is an <a href="http://code.google.com/apis/chart/types.html#line_charts" rel="nofollow noreferrer">XY line chart</a>.</p> <p>The first...
<p>I think it actually does render both data sets, but you can only se one of them because there's only one scale on the y axis. (In other words, 0.10 is too small to show.)</p> <p>And, you should really be using percentages. 100 is the highest accepted value:</p> <blockquote> <p>Where chart data string consists of...
11,575
<p>Over the years I have slowly developed a <a href="http://en.wikipedia.org/wiki/Regular_expression" rel="noreferrer">regular expression</a> that validates <em>most</em> email addresses correctly, assuming they don't use an IP address as the server part.</p> <p>I use it in several PHP programs, and it works most of th...
<p>The <a href="http://ex-parrot.com/%7Epdw/Mail-RFC822-Address.html" rel="noreferrer">fully RFC 822 compliant regex</a> is inefficient and obscure because of its length. Fortunately, RFC 822 was superseded twice and the current specification for email addresses is <a href="https://datatracker.ietf.org/doc/html/rfc532...
<p>In order to validate an email address with JavaScript it is more convenient and efficient use this function (according with <a href="https://en.wikipedia.org/wiki/W3Schools" rel="nofollow noreferrer">W3Schools</a>):</p> <pre><code>function validateEmail() { var x = document.f.email.value; var atpos = x.index...
24,579
<p>I know there are several ways to deploy a .net windows client application:</p> <p>There's <a href="http://msdn.microsoft.com/en-us/library/aa367449(VS.85).aspx" rel="nofollow noreferrer">Windows Installer</a>, <a href="http://msdn.microsoft.com/en-us/library/t71a733d(VS.80).aspx" rel="nofollow noreferrer">Click Onc...
<p>I could see doing what you suggest within a corporate intranet environment, where the custom application can talk to a custom server and each understands the other well. Granted there would be possible connectivity and synchronization issues, but those could get worked on over time to some extent. I have done this...
<p>If the assemblies you're loading are digitally signed from a trusted provider, it shouldn't be so bad from a security standpoint. IF you <em>really</em> trust them... For example, if you go downloading an assembly from some third-rate third party vendor who might not keep good tabs on their secret key, then yes, I...
48,829
<p>Is it architecturally sound to use Rails and Oracle? My concern is that Oracle would be too "heavy and hi-end" for Rails. Any thoughts? Thanks.</p>
<p>The database needs of Rails more or less boil down to tables, indices and CRUD.</p> <p>Anything that provides those ought to be able to serve as the back-end to a Rails app, and Oracle certainly does those parts somewhere among the <strike>bloat</strike> vast range of features it provides. If you can use ActiveReco...
<p>I'm currently using Oracle with some Rails applications. There are both standard ActiveRecord and JDBC-ActiveRecord adapters (I'm hosting some apps with JRuby) and for the most part, things work great.</p> <p>I would suggest using the enhanced ActiveRecord Oracle adapter though.</p> <p><a href="http://rubyforge.o...
43,766
<p>Say I have several JavaScript includes in a page:</p> <pre><code>&lt;script type="text/javascript" src="/js/script0.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="/js/script1.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="/js/script2.js"&gt;&lt;/script&gt; &lt;script type="text/javascr...
<p>If you get the <a href="https://addons.mozilla.org/en-US/firefox/addon/1843" rel="noreferrer" title="Firebug">Firebug</a> firefox plugin and enable the consoles it should tell you when there are errors retrieving resources in the console.</p>
<p>If you don't want to check it manually on the client you will need to do this server-side. You need to make sure whichever webserver you are using is configured to log 404s and then check that log to see which HTTP requests have failed.</p>
8,144
<p>I use the p/invoke method to play <code>wav</code> sounds. There are ways of calling windows media player to play an <code>mp3</code> sound, but its slow &amp; cumbersome. </p> <p>Is there an easy way to play a short <code>mp3</code> file? </p> <p>This is primarily for application <strong>prompting</strong> and <s...
<p>CF Framework 3.5 now includes support for playing .WAV files:</p> <p><a href="http://msdn.microsoft.com/en-us/library/system.media.soundplayer.aspx" rel="nofollow noreferrer">Namespace System.Media.SoundPlayer</a></p> <p>Short WAV files for cues and sound-effects might even play <em>faster</em> than MP3s since the...
<p>CF Framework 3.5 now includes support for playing .WAV files:</p> <p><a href="http://msdn.microsoft.com/en-us/library/system.media.soundplayer.aspx" rel="nofollow noreferrer">Namespace System.Media.SoundPlayer</a></p> <p>Short WAV files for cues and sound-effects might even play <em>faster</em> than MP3s since the...
25,043
<p>How can you remove all of the trailing whitespace of an entire project? Starting at a root directory, and removing the trailing whitespace from all files in all folders.</p> <p>Also, I want to to be able to modify the file directly, and not just print everything to stdout.</p>
<p>Here is an OS X &gt;= 10.6 Snow Leopard solution.</p> <p><strong>It Ignores .git and .svn folders</strong> and their contents. Also it won't leave a backup file.</p> <pre><code>(export LANG=C LC_CTYPE=C find . -not \( -name .svn -prune -o -name .git -prune \) -type f -print0 | perl -0ne 'print if -T' | xargs -0 sed ...
<p>This is what works for me (Mac OS X 10.8, GNU sed installed by Homebrew):</p> <pre><code>find . -path ./vendor -prune -o \ \( -name '*.java' -o -name '*.xml' -o -name '*.css' \) \ -exec gsed -i -E 's/\t/ /' \{} \; \ -exec gsed -i -E 's/[[:space:]]*$//' \{} \; \ -exec gsed -i -E 's/\r\n/\n/' \{} \; </code...
17,965
<p>Hey! I was looking at this code at <a href="http://www.gnu.org/software/m68hc11/examples/primes_8c-source.html" rel="noreferrer">http://www.gnu.org/software/m68hc11/examples/primes_8c-source.html</a></p> <p>I noticed that in some situations they used hex numbers, like in line 134:</p> <pre><code>for (j = 1; val &a...
<p>In both cases you cite, the bit pattern of the number is important, not the actual number.</p> <p>For example, In the first case, <code>j</code> is going to be 1, then 2, 4, 8, 16, 32, 64 and finally 128 as the loop progresses.</p> <p>In binary, that is,</p> <p><code>0000:0001</code>, <code>0000:0010</code>, <code>0...
<p>Hex, or hexadecimal, numbers represent 4 bits of data, 0 to 15 or in HEX 0 to F. Two hex values represent a byte.</p>
30,192
<p>I've created a ListBox to display items in groups, where the groups are wrapped right to left when they can no longer fit within the height of the ListBox's panel. So, the groups would appear similar to this in the listbox, where each group's height is arbitrary (group 1, for instance, is twice as tall as group 2):<...
<p>By setting the Height property on the WrapPanel to the height of the ScrollContentPresenter, it will never scroll vertically. However, if you remove that Binding, it will never wrap, since in the layout pass, it has infinite height to layout in. </p> <p>I would suggest creating your own panel class to get the beh...
<p>I would think that you are correct that it has to do with the binding. What happens when you remove the binding? With the binding are you trying to fill up at least the entire height of the list box? If so, consider binding to MinHeight instead, or try using the <code>VerticalAlignment</code> property.</p>
9,987
<p>I understand that you can now create MVC-specific user controls, but will my existing standard ASCX user controls work in an MVC view? </p> <p>I understand that MVC pages have a completely different lifecycle but will, for example, a Page_Load method be invoked as normal when the control is sitting in a view?</p>
<p>If your standard ASCX controls do not have control events. There is no viewstate in MVC so that'll have to change.</p> <p>The normal page lifecycle is still executed. E.g. Page load, init, prerender, etc. The main thing is viewstate.</p>
<p>You can instantiate pre-built controls and call their RenderControl() method in order to use them in MVC views.</p> <p>Stackoverflow does this for reCAPTCHA control rendering. </p> <p>Also, the validation part is mapped to the route /captcha/post where the control is instantiated and the Validate() method is calle...
41,513
<p>Ever since switching from TABLE-layout to DIV-layout, one common problem remains:</p> <p><strong>PROBLEM</strong>: you fill your DIV with dynamic text and inevitably there is a super-long word that extends over the edge of your div column and makes your site look unprofessional.</p> <p><strong>RETRO-WHINING</stron...
<h2>Soft hyphen</h2> <p>You can tell browsers where to split long words by inserting soft hyphen (<code>&amp;shy;</code>):</p> <pre><code>averyvery&amp;shy;longword </code></pre> <p>may be rendered as</p> <blockquote> <p>averyverylongword</p> </blockquote> <p>or</p> <blockquote> <p>averyvery-<br /> longword</p> </block...
<p>A simple function (requires underscore.js) -- based off of @porneL answer</p> <pre><code> String.prototype.shyBreakString = function(maxLength) { var shystring = []; _.each(this.split(' '), function(word){ shystring.push(_.chop(word, maxLength).join('&amp;shy;')); }); ...
41,412
<p>With the plethora of communication methods available to co-workers, how do you manage to keep distractions at bay for a large enough block of time to accomplish some focused programming?</p> <p>Do you quit or close all communications, have you informed people that an away message really means you are a way, or some...
<p>My e-mail is on a separate computer from my coding machine at work so that helps. Most other diversions are blocked. Besides that all I have to distract me is the phone and coworkers walking by.</p> <p>StackOverflow isn't blocked, though, and that's becoming an increasing distraction. ;)</p>
<ul> <li>No instant messaging apps running in the background. Trust me, you will survive.</li> <li>No email notifications. Instead, dash in and out once every hour or two. Email was never meant to be an instantaneous communication channel - that's what the phone is for.</li> </ul> <p>As a programmer, it takes a goo...
11,827
<p>Is it possible to undo the changes caused by the following command? If so, how?</p> <pre><code>git reset --hard HEAD~1 </code></pre>
<p>Pat Notz is correct. You can get the commit back so long as it's been within a few days. git only garbage collects after about a month or so unless you explicitly tell it to remove newer blobs.</p> <pre><code>$ git init Initialized empty Git repository in .git/ $ echo "testing reset" &gt; file1 $ git add file1 $...
<p>git reset --hard - you can use to revert one page and after that you can stash or pull everything from origin again</p>
2,737
<p>I'd like to remove all of the black from a picture attached to a sprite so that it becomes transparent. </p>
<p>I'll copy and paste in case that link dies:</p> <p><em>" I used a 'Color Matrix' patch, setting 'Alpha Vector (W)' and 'Bias Vector(X,Y,Z)' to 1 and all other to 0. You will then find the alpha channel from the input image at the output."</em> </p> <p>I found this before, but I can't figure out exactly how to do i...
<p>This looks like it'll do the trick:</p> <p><a href="http://www.quartzcompositions.com/phpBB2/viewtopic.php?t=281" rel="nofollow noreferrer">http://www.quartzcompositions.com/phpBB2/viewtopic.php?t=281</a></p>
14,529
<p>I've found SVN to be extremely useful for documentation, personal files, among other non-source code uses. What other practical uses have you found to version control systems in general?</p>
<p>I've seen version control being used for other non-source code purposes, like,</p> <ol> <li>Schema files - a set of XML schema files that represent a real world schema</li> <li>Content files - content represented in a specific format, this is tied to a designer in VStudio, using source control, allows history, roll...
<p>Yes, I have a doc directory in git. I contains a todo list, a calendar and a few other documents.</p>
3,540
<p>My 11 year old son is very interested in programming. He has been working with <a href="http://scratch.mit.edu" rel="nofollow noreferrer">Scratch</a> for a couple years but has now outgrown it. I recently helped him install Visual C# Express Edition and he is very excited to work with it, but we're having a hard tim...
<p>I would recommend <a href="http://blogs.msdn.com/coding4fun/" rel="nofollow noreferrer">Coding4Fun</a>. There are some very nice projects out there which would appeal to an 11 year old. I recall seeing some games, screensavers, and even a sample which shows how to make a WinForms app look like it is bleeding (awes...
<p><a href="http://www.codeproject.com/" rel="nofollow noreferrer">Code Project</a> comes to mind. Lots of samples, projects, etc. available to play with.</p>
25,778
<p>Several of my ajax applications in the past have used GET request but now I'm starting to use POST request instead. POST requests seem to be slightly more secure and definitely more url friendly/pretty. Thus, i'm wondering if there is any reason why I should use GET request at all.</p>
<p>I generally set up the question as thus: <strong>Does anything important change after the request?</strong> (Logging and the like notwithstanding). If it does, it should be a POST request, if it doesn't, it should be a GET request.</p> <p>I'm glad that you call POST requests "slightly" more secure, because that's p...
<div class="s-table-container"> <table class="s-table"> <thead> <tr> <th>GET</th> <th>POST</th> </tr> </thead> <tbody> <tr> <td>In GET method, values are visible in the URL</td> <td>In POST method, values are not visible in the URL.</td> </tr> <tr> <td>GET has a limitation on the length of the values, generally 255 cha...
23,714
<p>I have found that when I execute the show() method for a contextmenustrip (a right click menu), if the position is outside that of the form it belongs to, it shows up on the taskbar also.</p> <p>I am trying to create a right click menu for when clicking on the notifyicon, but as the menu hovers above the system tra...
<p>Try assigning your menu to the ContextMenuStrip property of NotifyIcon rather than showing it in the mouse click handler.</p>
<p>The problem I have is that my menu is available from both a double middle-click <em>and</em> the notification icon.</p> <p>When right clicking the notification icon, there is no taskbar button, but when I manually Show(Cursor.Position) then it shows a taskbar button.</p>
16,079
<p>I currently have issues in Webkit(Safari and Chrome) were I try to load dynamically (innerHTML) some html into a div, the html contains css rules (...), after the html gets rendered the style definitions are not loaded (so visually I can tell the styles are not there and also if I search with javascript for them no ...
<p>I think it's a better practice to append a "link" tag to the head of your document. If that isn't possible, try to append a "style" tag to the head. Style tags shouldn't be in the body (Doesn't even validate).</p> <p>Append link tag:</p> <pre><code>var link = document.createElement('link'); link.setAttribute('rel...
<p>Besides the style tag based versions above, you can also add styles using javascript directly:</p> <pre><code>var style = document.getElementById('some-style-tag'); var sheet = style.sheet; sheet.insertRule('.mydiv { background-color: ' + color + '; }', sheet.cssRules.length); </code></pre> <p>This has the advanta...
45,785
<p>I am trying to understand what's the actual difference between SSL and Kerberos authentications, and why sometimes I have both SSL traffic and Kerberos. Or does Kerberos use SSL in any way?</p> <p>Anyone could help? Thank you!</p>
<p>While <a href="https://en.wikipedia.org/wiki/Kerberos_(protocol)" rel="nofollow noreferrer">Kerberos</a> and <a href="https://en.wikipedia.org/wiki/Transport_Layer_Security" rel="nofollow noreferrer">SSL</a> are both protocols, Kerberos is an authentication protocol, but SSL is an encryption protocol. Kerberos usual...
<p>SSL authentication uses certifiactes to verify youself to server whereas Kerberos works entirely different. SSL can be imported manually and added as per configurations in client and host manually. Whereas kerberos is authentication where no password are transmitted over network. Here kerberos KDC server doesn't nee...
13,654
<p>What is the best way to remove an entry from a hashtable that uses linear probing? One way to do this would be to use a flag to indicate deleted elements? Are there any ways better than this?</p>
<p>An easy technique is to:</p> <ol> <li>Find and remove the desired element</li> <li>Go to the next bucket</li> <li>If the bucket is empty, quit</li> <li>If the bucket is full, delete the element in that bucket and re-add it to the hash table using the normal means. The item must be removed before re-adding, because ...
<p>How about enhancing the hash table to contain pointers like a linked list? When you insert, if the bucket is full, create a pointer from this bucket to the bucket where the new field in stored.</p> <p>While deleting something from the hashtable, the solution will be equivalent to how you write a function to delete ...
35,333
<p>As you can see below, in the constructor I'm instantiating a validation object so I can validate a user's email in a set method. Is this architecture best practice or flawed? Can I avoid making my User class directly dependent on my Validation class?</p> <pre><code>Class User { Private Email //constructor User()...
<p>The proposals so far all seem to be way overkill, especially with all the IOC and AOP stuff.</p> <ol> <li><p>The <code>User</code> class needs an email address, so create an <code>EmailAddress</code> class and have the <code>User</code> class accept one via a property and/or its constructor. That validation can be...
<p>I would:</p> <ol> <li><p>Break the coupling to the concrete Validation object via dependency injection: define an abstract (pure virtual) Validation class, make a concrete validation class derive from it, and pass in (&quot;inject&quot;) a reference to the abstract Validation class in the User class's constructor.<...
45,354
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/53629/history-of-changes-to-a-particular-line-of-code-in-subversion">History of changes to a particular line of code in Subversion?</a> </p> </blockquote> <p>Using SVN and/or Tortoise SVN (or any other SVN tool...
<p>More specifically, you can use "svn blame" with some arguments to look at specific revisions. That can be large per file... <code>svn blame -r REV#</code></p> <p>iterating through multiple revisions (if you working from the command line) is a quick script. </p>
<p><code>svn blame</code></p>
27,015
<p>I'm passing /file:c:\myfile.doc and I'm getting back "/file:c:\myfile.doc" instead of "C:\myfile.doc", could someone please advise where I am going wrong?</p> <pre><code> if (entry.ToUpper().IndexOf("FILE") != -1) { //override default log location MyFileLocatio...
<p>You are splitting on "=" instead of ":"</p> <p>Try </p> <pre><code> if (entry.ToUpper().IndexOf("FILE:") == 0) { //override default log location MyFileLocation location = entry.Split(new char[] {':'},2)[1]; } </code></pre>
<p>You could also just lop off the 'file:' part. It is clearly defined and will be constant so it isn't THAT bad. Not great, but not horrible.</p>
23,285
<p>Is there any way in JavaScript to create a &quot;weak reference&quot; to another object? <a href="http://en.wikipedia.org/wiki/Weak_reference" rel="nofollow noreferrer">Here is the wiki page describing what a weak reference is.</a> <a href="https://community.oracle.com/blogs/enicholas/2006/05/04/understanding-weak-r...
<p><strong>Update: Since July, 2020 some implementations (Chrome, Edge, Firefox and Node.js) has had support for <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakRef" rel="nofollow noreferrer"><code>WeakRef</code></a>s as defined in the <a href="https://tc39.es/proposal-weak...
<p><a href="http://www.jibbering.com/faq/faq_notes/closures.html" rel="nofollow noreferrer">http://www.jibbering.com/faq/faq_notes/closures.html</a></p> <p>ECMAScript uses automatic garbage collection. The specification does not define the details, leaving that to the implementers to sort out, and some implementations...
33,436
<p>In xp 32bit this line compiles with not problem however in vista 64bit this line:</p> <pre><code>m_FuncAddr = ::GetProcAddress (somthing); </code></pre> <p>gives the following error</p> <blockquote> <p>error C2440: '=' : cannot convert from 'FARPROC' to 'int (__cdecl *)(void)'</p> </blockquote> <p>GetProcAdd...
<p>The return type should be INT_PTR (a 64-bit value in 64-bit builds). You shouldn't cast around this error -- the compiler is trying to tell you that something is wrong.</p> <p>From WinDef.h:</p> <pre><code>#ifdef _WIN64 typedef INT_PTR (FAR WINAPI *FARPROC)(); </code></pre> <p>So the declaration of m_FuncAddr sh...
<p>It's a coincidence that it compiles correctly in 32bit; the correct syntax is:</p> <pre><code>typedef int (WINAPI *FFuncType)(); FFuncType m_FuncAddr; m_FuncAddr = (FFuncType)::GetProcAddress (somthing); </code></pre> <p>You need to explicitly cast the result of ::GetProcAddress to the proper function signature. I...
25,892
<p>I've been working with <a href="http://msdn.microsoft.com/en-us/library/aa479030.aspx" rel="noreferrer">providers</a> a fair bit lately, and I came across an interesting situation where I wanted to have an abstract class that had an abstract static method. I read a few posts on the topic, and it sort of made sense, ...
<p>Static methods are not <em>instantiated</em> as such, they're just available without an object reference.</p> <p>A call to a static method is done through the class name, not through an object reference, and the Intermediate Language (IL) code to call it will call the abstract method through the name of the class t...
<p>The abstract methods are implicitly virtual. Abstract methods require an instance, but static methods do not have an instance. So, you can have a static method in an abstract class, it just cannot be static abstract (or abstract static).</p>
2,547
<p>I'd like some advice regarding defects on my print : <a href="https://i.stack.imgur.com/5x4u2.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5x4u2.jpg" alt="enter image description here"></a></p> <p><a href="https://i.stack.imgur.com/3CgUe.jpg" rel="nofollow noreferrer"><img src="https://i.stack...
<p>If you break up a large piece into multiple smaller pieces and properly glue them together, you basically add stiffeners (as a result of printing walls). This could lead to a more stiff model; this might have been confused by calling large prints more brittle opposed to constructed models.</p> <p>If printing is con...
<p>I'd recommend getting the object to fit together by design, rather than glue - though I tend (if the item is never to be disassembled) use Zap-a-gap - that stuff sticks like crazy though you must not squeeze the parts together but let it naturally sit.</p>
1,354
<p>I have an ActiveX control in IE (7). When it shows a dialog box, the dialog box is not showing in XP visual style. I have tried embedding manifests to no avail. Anybody got any idea? by the way, the dialog boxes were implemented using wtl.</p>
<p>Build your dll with #define ISOLATION_AWARE_ENABLED 1. Or put compiler directive /D ISOLATION_AWARE_ENABLED=1. Don't forget manifest should be embedded with id 2.</p> <p>More info here: <a href="http://msdn.microsoft.com/en-us/library/aa815321%28VS.85%29.aspx#_slate_set_the_isolation_aware_enabled_directive" rel="n...
<p>You might want to try <a href="http://www.codeproject.com/KB/wtl/CDialogRegionT.aspx" rel="nofollow noreferrer">Skinning a WTL dialog</a> over on Code Project.</p>
34,573
<p>I use this code in my Windows Service to be notified of USB disk drives being inserted and removed:</p> <pre><code>WqlEventQuery query = new WqlEventQuery("__InstanceOperationEvent", "TargetInstance ISA 'Win32_LogicalDisk' AND TargetInstance.DriveType=2"); query.WithinInterval = TimeSpan.FromSeconds(1); _devic...
<p>Not sure if this applies to your case but we've been using RegisterDeviceNotification in our C# code (which I can't post here) to detect when USB devices are plugged in. There's a handful of native functions you have to import but it generally works well. Easiest to make it work in C++ first and then see what you ha...
<p>Try looking for the InstanceCreationEvent, which will signal the creation of a new Win32_LogicalDisk instance. Right now you're querying for instance operations, not creations. You should know that the query interval on those events is pretty long - it's possible to pop a USB in and out faster that you'll detect.</...
13,210
<p>Aside from Episerver.com</p> <p>What other websites do people who develop using EPiServer use as development resources!? Been using coderesort.com but I find that it lacks examples of how to do stuff.</p> <p>Many thanks,</p> <p>J</p>
<p>Regarding missing examples on CodeResort, did you register and log in? It is running on Trac, which means all modules (committed to the hosted Subversion repository) is available with full source code, directly browsable. There is lots of code in there!</p> <p>See <a href="https://www.coderesort.com/p/epicode/brows...
<p>I've looked quite a bit at the source code for the edit/admin interface, its been very helpful. Browsing through the libraries in your favorite decompiler or the object explorer in visual studio.</p>
15,333
<p>How else might you compare two arrays ($A and $B )and reduce matching elements out of the first to prep for the next loop over the array $A?</p> <pre><code>$A = array(1,2,3,4,5,6,7,8); $B = array(1,2,3,4); $C = array_intersect($A,$B); //equals (1,2,3,4) $A = array_diff($A,$B); //equals (5,6,7,8) </code></pr...
<p>You've got it. Just use <code>array_diff</code> or <code>array_intersect</code>. Doesn't get much easier than that.</p> <p><strong>Edit:</strong> For example:</p> <pre><code>$arr_1 = array_diff($arr_1, $arr_2); $arr_2 = array_diff($arr_2, $arr_1); </code></pre> <p><a href="https://stackoverflow.com/a/8691348/2210...
<p>Try to this</p> <pre><code>$a = array(0=&gt;'a',1=&gt;'x',2=&gt;'c',3=&gt;'y',4=&gt;'w'); $b = array(1=&gt;'a',6=&gt;'b',2=&gt;'y',3=&gt;'z'); $c = array_intersect($a, $b); $result = array_diff($a, $c); print_r($result); </code></pre>
27,855
<p>We use <a href="http://hudson-ci.org/" rel="noreferrer">Hudson</a> as a continuous integration system to execute automated builds (nightly and based on CVS polling) of a lot of our projects.</p> <p>Some projects poll CVS every 15 minutes, some others poll every 5 minutes and some poll every hour.</p> <p>Every few ...
<p>This is Hudson issue 715 (<s><a href="http://issues.hudson-ci.org/browse/HUDSON-715" rel="nofollow noreferrer">http://issues.hudson-ci.org/browse/HUDSON-715</a></s>). The current recommendation is to set the 'maximum number of simultaneous polling threads' to keep the polling activity down.</p>
<p>Change system limits for per-process maximum open file descriptors? As in <code>ulimit -n</code> for the Java process?</p>
14,022
<p>This question is a follow up to: <a href="https://stackoverflow.com/questions/252267/why-cant-i-call-a-method-outside-of-an-anonymous-class-of-the-same-name">Why can’t I call a method outside of an anonymous class of the same name</a></p> <p>This previous question answer <b>why</b>, but now I want to know if javac ...
<p>This behavior of javac conforms to the spec. See <a href="http://java.sun.com/docs/books/jls/third_edition/html/expressions.html#20448" rel="nofollow noreferrer">§15.12 Method Invocation Expressions</a> in the Java Language Specification, specifically the paragraph under "Compile Time Step 1" explaining the meaning ...
<p>Sounds like a recipe for ambiguity and fragility to me - as soon as a new method is added in your base class (okay, not so likely for an interface...) the meaning of your code changes completely.</p> <p>Anonymous classes are pretty ugly already - making this bit of explicit doesn't bother me at all. </p>
31,713
<p>I haven't done a lot of .NET programming, but I've examined a few of the application blocks published by Microsoft's Patterns and Practices group. I was wondering how these are typically used:</p> <ul> <li>Linked directly into applications</li> <li>Source added into applications and built with them, perhaps with so...
<p>I usually put the source into my project, and then I can get better intellisense (and a better understanding of them). I don't tend to customize them at all though. I like to have them stock so I can just distribute the stock binaries anytime I need them.</p>
<p>We use the blocks by adding references to the DLLs, making sure that "copy local" is set so that they are deployed with the app into the app's bin folder. This means that we don't have to muck around with the GAC - much simpler!</p> <p>When debugging, Visual Studio can still step into the source code even if it's n...
7,920
<p>Just when I make friends with LINQ to SQL, it appears as though MS is pulling the rug out from under it. </p> <p><a href="http://blogs.msdn.com/adonet/archive/2008/10/29/update-on-linq-to-sql-and-linq-to-entities-roadmap.aspx" rel="noreferrer">http://blogs.msdn.com/adonet/archive/2008/10/29/update-on-linq-to-sql-an...
<p>1) They can't "kill" Linq-to-SQL as it is already part of the .net framework. What they can do is stop adding features to it. That doesn't prevent the thousands of developers out there that are already using L2S from extending it and improving it. Some core areas are tricky to touch but they're solid already and the...
<p>The next version of Windows Phone 7, codename Mango, includes a SQL Server Compact Edition accessible via Linq to SQL <a href="http://jesseliberty.com/2011/05/10/coming-in-mangosql-server-ce/" rel="nofollow">http://jesseliberty.com/2011/05/10/coming-in-mangosql-server-ce/</a></p>
31,483
<p>I've just created my first Preview 5 error and it doesn't seem to place nice with Resharper. All the C# in the Views are coming up with errors, things like &lt;%= Html.Password("currentPassword") %> has the "currentPassword" highlighted with the following error: Argument type "System.String" is not assignable param...
<p>Did you try <a href="http://www.jetbrains.net/confluence/display/ReSharper/ReSharper+4.0+Nightly+Builds" rel="nofollow noreferrer">latest nightly build</a> of ReSharper 4.1? In some cases the bug in 4.1 manifests itself with numerous ambiguity errors, and it has been fixed within the follow up build.</p>
<p>If anyone finds this blog, the fix suggested above worked for me - I downloaded the latest 4.1 build, and the ambiguous reference problem is gone.</p>
12,741
<p>I've got a menu in Python. That part was easy. I'm using <code>raw_input()</code> to get the selection from the user. </p> <p>The problem is that <code>raw_input</code> (and input) require the user to press <kbd>Enter</kbd> after they make a selection. Is there any way to make the program act immediately upon a key...
<p><strong>On Windows:</strong></p> <pre><code>import msvcrt answer=msvcrt.getch() </code></pre>
<p>The reason msvcrt fails in IDLE is because IDLE is not accessing the library that runs msvcrt. Whereas when you run the program natively in cmd.exe it works nicely. For the same reason that your program blows up on Mac and Linux terminals.</p> <p>But I guess if you're going to be using this specifically for window...
2,409
<p>This is probably a simple question, and I'm slightly embarrassed to ask it, but I've been working with this chunk of JavaScript ad code for a while and it's bothered me that it's never really made sense to me and is probably out dated now with modern browsers. My question is, do we need to check for browser types st...
<p>Mostly we use javascript libraries like <a href="http://jquery.com/" rel="nofollow noreferrer">jQuery</a> which handle this kind of thing for us.</p> <p>Strangely I find myself hacking per-browser CSS much more often these days.</p>
<p>This is why APIs (such as jQuery) are used. They offload the act of checking browser compatibility (and future compatibility) away from the developer. When a new browser or new version of a browser comes along, the API is updated, if necessary, so that your code continues to work.</p> <p>So see if you can come up w...
41,627
<p>I have a legacy application that I needed to implement a configuration page for to change text colors, fonts, etc.</p> <p>This applications output is also replicated with a PHP web application, where the fonts, colors, etc. are configured in a style sheet.</p> <p>I've not worked with CSS previously.</p> <p>Is the...
<p>It looks like someone's already done a VB.NET CSS parser which is F/OSS, so you could probably adapt it to your needs if you're comfortable with the license.</p> <p><a href="http://vbcssparser.sourceforge.net/" rel="nofollow noreferrer">http://vbcssparser.sourceforge.net/</a></p>
<p>Depending on how technically oriented your CSS editors are going to be, you could do it very simply by loading the whole thing up into a TextEdit field to let them edit it - then write it back to the file.</p> <p>Parsing and creating an interface for all the possibilities of CSS would be an astronomical pain. :-)</...
21,293
<p>What is the difference between multiprocessor programming and multicore programming?</p> <p>Preferably show examples in python how to write a small program for multiprocessor programming &amp; multicore programming</p>
<p>There is no such thing as "multiprocessor" or "multicore" programming. The distinction between "multiprocessor" and "multicore" <em>computers</em> is probably not relevant to you as an application programmer; it has to do with subtleties of how the cores share access to memory.</p> <p>In order to take advantage of...
<p>If you don't have Python 2.6 (which you don't if you're using Ubuntu Edgy or Intrepid for example), you can use the <a href="http://code.google.com/p/python-multiprocessing/" rel="nofollow noreferrer">Google code backported</a> version of multiprocessing. It is part of PyPI, which means you can easily install it usi...
24,946
<p>How can I launch an event that has accessors like this :</p> <pre><code>public event EventHandler CanExecuteChanged { add { CommandManager.RequerySuggested += value; } remove { CommandManager.RequerySuggested -= value; } } </code></pre> <p>If it were a no...
<p>That event is just subscribing to and unsubscribing from another event. If you want your subscribers (and <em>only</em> your subscribers - not separate ones to the other event) to be invoked, you'll need to keep hold of your subscribers separately. For instance, you could change the code to something like:</p> <pre...
<p><del>You've got to invoke the underlying events directly. In your case, it looks as though this would be:</p> <pre><code>&lt;blockquote&gt;CommandManager.RequerySuggested(sender, EventArgs.…)&lt;/blockquote&gt; </code></pre> <p></del> /EDIT: Ok, I didn't notice that <code>CommandManager</code> is a framework class...
25,527
<p>I am attempting to use the 'tempfile' module for manipulating and creating text files. Once the file is ready I want to save it to disk. I thought it would be as simple as using 'shutil.copy'. However, I get a 'permission denied' IOError:</p> <pre><code>&gt;&gt;&gt; import tempfile, shutil &gt;&gt;&gt; f = tempfile...
<p>The file you create with <code>TemporaryFile</code> or <code>NamedTemporaryFile</code> is automatically removed when it's closed, which is why you get an error. If you don't want this, you can use <code>mkstemp</code> instead (see the docs for <a href="https://docs.python.org/3/library/tempfile.html#tempfile.mkstemp...
<p>You could always use <em>shutil.copyfileobj</em>, in your example:</p> <pre><code>new_file = open('bar.txt', 'rw') shutil.copyfileobj(f, new_file) </code></pre>
11,980
<p>Most restrictions and tricks with windows forms are common to most programmers. But since .NET 3.0 there is also WPF available, the Windows Presentation Foundation. It is said that you can make "sexy applications" more easy with it and with .NET 3.5 SP1 it got a good speed boost on execution.</p> <p>But on the othe...
<p>WPF enables you to do some amazing things, and I LOVE it... but I always feel obligated to qualify my recommendations, whenever developers ask me whether I think they should be moving to the new technology.</p> <p>Are your developers willing (preferrably, EAGER) to spend the time it takes to learn to use WPF effect...
<p>For conversion projects (from <a href="http://en.wikipedia.org/wiki/Visual_Basic#Timeline" rel="nofollow noreferrer">Visual Basic 6.0</a>), it's hard to get a team to switch to WPF. Besides the learning curve, people are already used to the old interface. Windows Forms, although being phased out, will be around for ...
8,233
<p>I have a managed dll that calls into a native library. This native library generally returns IntPtrs. These can be passed in to other methods in the native library to do things, or to tell the library to free the instance associated with the IntPtr. But only some of the instances need to freed in this way, others...
<p>LinkageError is what you'll get in a classic case where you have a class C loaded by more than one classloader and those classes are being used together in the same code (compared, cast, etc). It doesn't matter if it is the same Class name or even if it's loaded from the identical jar - a Class from one classloader...
<p>As specified in <a href="https://stackoverflow.com/questions/2548384/java-get-a-list-of-all-classes-loaded-in-the-jvm">this question</a>, enabling the <code>-verbose:class</code> will make the JVM log information about all classes being loaded, which can be incredibly helpful to understand where the classes are comi...
30,319
<p>I want to write a tool that helps me search pdf/chm/djvu files in linux. Any pointers on how to go about it? </p> <p>The major problem is reading/importing data from all these files. Can this be done with C and shell scripting? </p>
<p><a href="https://wiki.ubuntu.com/Tracker" rel="nofollow noreferrer">Tracker</a> ships with Ubuntu 8.04 -- it was a significant switch from Beagle which users believed was too resource (CPU) intensive and didn't yield good enough results. It indexes both pdf and chm and according to <a href="http://bugs.debian.org/cg...
<p>How about a plugin for <a href="http://www.beagle-project.org/" rel="nofollow noreferrer">Beagle</a> ?</p> <p>It already searches PDFs but you can add other file types.</p> <p>Here is the relevant wikipedia page : <a href="http://en.wikipedia.org/wiki/Beagle_(software)" rel="nofollow noreferrer">http://en.wikipedi...
5,628
<p>My company currently evaluates the development of a Java FAT client. It should support a dynamic GUI and has as much logic as possible on the server side. Hence the idea came up to send the screen as XML to the FAT client, show it to the user and send the entered data similar to "html form" back in a structure like:...
<p>When I last looked for such a thing, two options were <a href="http://www.thinlet.com/index.html" rel="nofollow noreferrer">Thinlet</a> and <a href="http://commons.apache.org/jelly/libs/swing/index.html" rel="nofollow noreferrer">Apache Jelly</a>.</p> <p>The plus points were that you could separate the wiring and c...
<p>Try <a href="http://trolltech.com/products/appdev/programming-language-support/programming-language-support#additional-language-bindings" rel="nofollow noreferrer">QT Jambi</a>. This allows you to build form layouts in QT Designer and export them as a descriptor file of the sort you described.</p>
41,533
<p>PL/SQL is not my native tongue. Oracle supports writing stored procedures in Java. What are the advantages of doing this over writing the stored procedures in PL/SQL</p>
<p>In the Oracle world the general order of development should be:</p> <p>Wherever possible do it purely with SQL. If you need more than SQL do it with PL/SQL. If you need something that PL/SQL can't do, then use Java. If all else fails use C. If you can't do it with C, back slowly away from the problem....</p> <p>PL...
<p>The answer is <em>NEVER</em>. If you need to write programs to load or process data you need to do it outside of your data tier from another computer on the network.</p> <p>Running external applications directly on your data tier or god forbid in-process with your data tier or the misapplication of external langua...
9,546
<p>How do you add that little "X" button on the right side of a UITextField that clears the text? I can't find an attribute for adding this sub-control in Interface Builder in the iPhone OS 2.2 SDK.</p> <p><strong>Note:</strong> In Xcode 4.x and later (iPhone 3.0 SDK and later), you can do this in Interface Builder.<...
<p>This button is a built-in overlay that is provided by the <code>UITextField</code> class, but as of the iOS 2.2 SDK, there isn't any way to set it via Interface Builder. You have to enable it programmatically.</p> <p>Add this line of code somewhere (<code>viewDidLoad</code>, for example):</p> <p><strong>Objective...
<p>On Xcode Version 8.1 (8B62) it can be done directly in Attributes Inspector. Select the textField and then choose the appropriate option from Clear Button drop down box, which is located in Attributes Inspector. </p>
41,395
<p>Does anyone know tools which look at a MySQL database, show you all the tables graphically and allow you to create complicated JOIN statements via drag-and-drop?</p>
<p>Before you buy anything, see if the free, official <a href="http://dev.mysql.com/downloads/gui-tools/" rel="nofollow noreferrer">MySQL's GUI tools</a> (specifically the <strong>MySQL Query Browser</strong>) will work for you.</p> <p>Personally, I'm fairly comfortable interacting with MySQL's command line interface ...
<p><a href="http://www.sqlmanager.net/products/mysql/manager" rel="nofollow noreferrer">EMS SQL Manager for MySQL</a> has query constructor. Can't recall about joins, but they should be supported.</p>
10,846
<p>I am trying to connect to a Microsoft SQL 2005 server which is not on port 1433. How do I indicate a different port number when connecting to the server using SQL Management Studio?</p>
<p><code>127.0.0.1,6283</code></p> <p>Add a comma between the ip and port</p>
<p>On Windows plattform with server execute command:</p> <pre><code>netstat -a -b </code></pre> <p>look for <code>sql server</code> processes and find port f.e 49198</p> <p>Or easier. Connect with dbvisualizer, run <code>netstat -a -b</code> find dbvis.exe process and get port.</p>
11,506
<p>I have Virtual PC 2007. I am writing a C# program that will run on the Host and Virtual. It needs to communicate both ways.</p> <p><strong>What is the best way to do this?</strong></p> <p><strong>Can it be done in a way that does not require changing Virtual settings?</strong></p> <p>(the OSs will be XP, Vista,...
<p><a href="http://msdn.microsoft.com/en-us/netframework/aa663324.aspx" rel="nofollow noreferrer">WCF</a>. .NET Remoting without the calls to the suicide prevention hotline.</p>
<p>WCF is definitely the way to go. Whether or not is requires changing the virtual settings depends on how your virtual machine is set up.</p> <p>The most secure way would be to create a new private network that just the host and guest can access. That way you don't have to worry about changing any firewall settings...
29,684
<p>I'm looking for a standard way to connect to databases in PHP. We've all been there - first start with some rudimentary code to connect/query/iterate/insert/disconnect, then the code grew as the program grew, and it ended up with a mess that's hardly reusable.</p> <p>I know there are many PEAR, PECL, and other PHP ...
<p>if you're using PHP 5 <a href="http://php.net/pdo" rel="nofollow noreferrer">try out PDO</a></p>
<p>These two are the best in my opinion. I can't claim to have tried them all though :)</p> <ul> <li><a href="http://pear.php.net/package/MDB2" rel="nofollow noreferrer">MDB2</a> (PEAR DB's successor)</li> <li><a href="http://phplens.com/adodb/" rel="nofollow noreferrer">AdoDB</a> </li> </ul> <p>If on Linux you'll ne...
20,637
<p>has anyone been able to serve a word doc using metro (webservices) as a mtom stream? Does anyone have example, or know where there is example code please for client and server?</p>
<p>The <a href="https://metro.dev.java.net/guide/Large_Attachments.html" rel="nofollow noreferrer">Large Attachments</a> and <a href="https://metro.dev.java.net/guide/Binary_Attachments__MTOM_.html" rel="nofollow noreferrer">Binary Attachments (MTOM)</a> examples might help.</p>
<p>Dont know why folks at sun write half-baked stuff !</p> <p>tried giving a simple sample code. Hope this helps</p> <p><a href="https://stackoverflow.com/questions/1113656/jax-ws-mtom-sample-code-service-client-need-simple-one">JAX-WS MTOM Sample Code</a></p>
10,650
<p>I'm no crypto expert, but as I understand it, 3DES is a symmetric encryption algorithm, which means it doesnt use public/private keys.</p> <p>Nevertheless, I have been tasked with encrypting data using a public key, (specifically, a .CER file). If you ignore the whole symmetric/asymmetric thang, I should just be ab...
<p>cryptoProvider.Key = cert.GetPublicKey()?</p>
<p>I think what you are missing is converting the bytes from the string containing the key-bytes.</p> <p>Hope the method <strong><a href="http://msdn.microsoft.com/en-us/library/system.convert.frombase64string.aspx" rel="nofollow noreferrer">FromBase64String</a></strong> will help you:</p> <pre><code>byte[] keyBytes ...
14,774
<p>We're having a very frustrating problem in our production environment.</p> <p>We have a report that will sometimes return very quickly, and other times not return at all. When the problem is happening, the report will process for 15 minutes or so then the browser will display a "Cannot display webpage" error. Thi...
<p>Maybe try a smaller data set just to see if that changes it. </p> <p>Any CPU spikage on either server? </p> <p>Are the run times for the report matching up with what you are experiencing? ExecutionLog table in ReportServer should show this.</p> <p>Sounds very annoying - I empathize, wish I had better ideas.</p...
<p>I've not used ReportServer (so far), but I've seen similar problems with SQL server, caused just by faulty network switch (or other network hardware). Some packets lost and application is waiting for server indefinitely - and absolutely no activity on server.</p>
38,835
<p>I normally use the following idiom to check if a String can be converted to an integer.</p> <pre><code>public boolean isInteger( String input ) { try { Integer.parseInt( input ); return true; } catch( Exception e ) { return false; } } </code></pre> <p>Is it just me, or does ...
<p>If you are not concerned with potential overflow problems this function will perform about 20-30 times faster than using <code>Integer.parseInt()</code>.</p> <pre><code>public static boolean isInteger(String str) { if (str == null) { return false; } int length = str.length(); if (length == 0...
<pre><code>Integer.valueOf(string); </code></pre> <p>works for me most of the time!</p>
29,352
<p>I've defined an error-page in my web.xml:</p> <pre><code> &lt;error-page&gt; &lt;exception-type&gt;java.lang.Exception&lt;/exception-type&gt; &lt;location&gt;/error.jsp&lt;/location&gt; &lt;/error-page&gt; </code></pre> <p>In that error page, I have a custom tag that I created. The tag handler for this tag ...
<p>The errorPage isn't going to be used if you've already started sending data to the client. What I do is use a JavaScript callback to check for an incomplete page and then redirect to the error page. At the beginning of your page in an includes header or something, initialize a boolean javascript variable to false, ...
<p>Have you tried using the &lt;%@ page errorPage="/myerrorpage.jsp" %> directive?</p> <p>You also need to use &lt;% page isErrorPage="true" $> in myerrorpage.jsp, then.</p> <p>I think that may solve your problem. The only problem with that is that you need to include it in every JSP somehow.</p>
25,863
<p>I would like to gauge what solutions other people put in place to get Team System functionality. We all know that Team System can be pricey for some of us. I know they offer a small team edition with five licenses with a MSDN subscription, but what if your team is bigger than five or you don't want to use Team Sys...
<p>I'm stunned that nobody has mentioned the <strong>free</strong> and excellent <a href="http://www.jetbrains.com/teamcity/index.html" rel="noreferrer">TeamCity</a> product from JetBrains. It includes:</p> <ul> <li>Continous Integration </li> <li>Software Build management</li> <li>Project Management, Monitoring and ...
<p>SVN with the TortoiseSVN add-on makes for a solid and easy to use interface. WinMerge is a great tool to thrown in that mix as well.</p>
3,297
<p>So I'm using an app that stores images heavily in the DB. What's your outlook on this? I'm more of a type to store the location in the filesystem, than store it directly in the DB.</p> <p>What do you think are the pros/cons? </p>
<p>I'm in charge of some applications that manage many TB of images. We've found that storing <strong>file paths</strong> in the database to be best.</p> <p>There are a couple of issues:</p> <ul> <li>database storage is usually more expensive than file system storage</li> <li>you can super-accelerate file system acc...
<p>I would go with the file system approach. As noted by a few others, most web servers are built to send images from a file path. You'll have much higher performance if you don't have to write or stream out BLOB fields from the database. Having filesystem storage for the images makes it easier to setup static pages...
2,579
<p>Is there any reason to start a GUI program (application for Windows) written in VB.NET in the Sub Main of a module rather than directly in a form?</p> <p>EDIT: The program won't take any command line parameters and it will be executed as a GUI program always.</p>
<p>The primary reason for using Main() in VB .NET 1.x was for adding code that needed to run before any forms were loaded. For example, you might want to detect whether an instance of your Windows Forms app was already loaded. Or you might want to intercept any unhandled exception for the AppDomain:</p> <pre><code>Add...
<p>No, if you always want to show that form.<br> Yes, if you sometimes want to use your app without GUI, just using command line.</p>
40,124
<p><em>Note: I found this <a href="https://stackoverflow.com/questions/10412/creating-a-word-doc-in-cnet">"Creating a Word Doc in C#.NET"</a>, but that is not what I want.</em></p> <p>Do you know how to create a <strong>.odt</strong> to create file from C# .NET?<br> Is there a .NET component or wrapper for an OpenOffi...
<p>Have a look at AODL (see <a href="http://odftoolkit.org/projects/odftoolkit/pages/AODL" rel="nofollow noreferrer">http://odftoolkit.org/projects/odftoolkit/pages/AODL</a>).</p> <ul> <li>fully managed .NET 1.1 (so it runs on MS.Net and Mono)</li> <li>support for text and spreadsheet documents</li> <li>create, read, ...
<p>The code would look like this:</p> <pre><code>private XComponentContext oStrap = uno.util.Bootstrap.bootstrap(); XMultiServiceFactory oServMan = (XmultiServiceFactory) oStrap.getServiceManager(); XComponentLoader oDesk = (XComponentLoader) oServMan.createInstance("com.sun.star.frame.Desktop"); string url = @"privat...
27,636
<p>I had a method with a lot of persistence calls that used a nHibernate session, it worked, was alright. But I needed to refactor this method, extracting a method from a content inside a loop, for multithread reasons. Then I created an class with this method. It is like a normal refactoring, but the nHibernate session...
<p>Sessions are <strong>not thread safe</strong> in NHibernate <strong>by design</strong>. So it should be ok as long as you have a <em>session used by only one thread</em>.</p> <p>I'm not sure what you're thingResolver does, but if it does some persistance calls on <em>the same</em> session you've created in the orig...
<p>You can have one NHibernate SessionFactory for multiple threads as long as you have a separate NHibernate session for each thread.</p> <p>here is an example that will give exceptions because it uses the same session for each thread:</p> <p><a href="https://forum.hibernate.org/viewtopic.php?p=2373236&amp;sid=db537b...
30,088
<p>I want to do some checking in a writer accessor. My first idea was returning a boolean.</p> <pre><code>class MyClass def var=(var) @var = var # some checking return true end end m = MyClass.new retval = (m.var = 'foo') =&gt; "foo" </code></pre> <p>Can I set a return value in a writer accessor? If...
<p>I would use set_var(var) instead of what you are trying to do, an attribute writer is assumed to just work. What you are trying to do is nonstandard and non-obvious to the next poor person to use your code. (It may just be yourself) I would throw an exception if bad input is sent or something rather exceptional happ...
<p><em>I know this is a late response to the party...</em></p> <p>It's hard to know what you are attempting to do with the class. You mentioned wanting to check it before saving... to a database? file?</p> <p>What would you like to happen in the case of a bad attribute value? </p> <p>By using a boolean return, you e...
24,053
<p>When is it a good idea to use <a href="http://us3.php.net/manual/en/reserved.constants.php" rel="noreferrer"><code>PHP_EOL</code></a>?</p> <p>I sometimes see this in code samples of PHP. Does this handle DOS/Mac/Unix endline issues?</p>
<p>Yes, <code>PHP_EOL</code> is ostensibly used to find the newline character in a cross-platform-compatible way, so it handles DOS/Unix issues.</p> <p>Note that <a href="http://php.net/manual/en/reserved.constants.php" rel="noreferrer">PHP_EOL</a> represents the endline character for the <em>current</em> system. For ...
<p>I prefer to use \n\r. Also I am on a windows system and \n works just fine in my experience.</p> <p>Since PHP_EOL does not work with regular expressions, and these are the most useful way of dealing with text, then I really never used it or needed to.</p>
15,642
<p>I have my enumHelper class that contains these:</p> <pre><code>public static IList&lt;T&gt; GetValues() { IList&lt;T&gt; list = new List&lt;T&gt;(); foreach (object value in Enum.GetValues(typeof(T))) { list.Add((T)value); } return list; } </code></pre> <p>and</p> <pre><code>public static string Des...
<p>Take a look at this <a href="http://www.codeproject.com/KB/cs/enumdatabinding.aspx" rel="nofollow noreferrer">article</a>. You can do this using the System.ComponentModel.DescriptionAttribute or creating your own attribute:</p> <pre><code>/// &lt;summary&gt; /// Provides a description for an enumerated type. /// &l...
<p>Enum doesn't have a Description() method. The best you could do is have your enum implement an interface that has the Description() method. If you do that, then you can have</p> <pre><code>public static BindingList&lt;KeyValuePair&lt;T extends _interface_, String&gt;&gt; getBindingList() </code></pre> <p>and then ...
38,035
<p>I think it's best that I explain what my issue is before I explain how I arrived here. I have a Tronxy x5s with a stock board that I am repairing for the sake of repairing, even though I know I should probably just spring for a new board. It's the principle of the thing. </p> <ul> <li>The extruder thermistor accura...
<p>Thermal expansion is opening a connection somewhere. It might not be one of your solderings, but if you shorted the board bad enough to fry pins, it could have cooked something somewhere else, and putting current through it is heating up the spot enough to break the connection. Either somewhere else in/on the board,...
<p>I am having the same issue so in the firmware instead of changing to an empty pin, I swapped pins 6 and 7 so the nozzle temp would read from the bed temp plug on the board. Now the nozzle temp is reading properly i went into configurations.h line 291 and changed the 1 to 999 and on line 295 i changed the value to 60...
998
<p>The scenario is:</p> <ol> <li>svn cp or mv some file</li> <li>modify that file</li> <li>svn diff > mypatch</li> </ol> <p>On other machine (same working copy, but no changes):</p> <ol start="4"> <li>Try to apply mypatch.</li> <li>Fail -> tries to modify unexistant file.</li> </ol> <p>How can I make svn diff produ...
<p>With subversion, you can specify which diff binary to use, and parameters to pass to it. See <a href="http://svnbook.red-bean.com/en/1.1/re09.html" rel="noreferrer">the manual</a> on svn diff.</p> <p>You'd want to produce a regular patch file from a svn diff, so you'd want the svn diff to look like a normal diff. ...
<p>Without understanding the specific scenario you're trying to work upon its hard to identify why you'd want to do this. I get the feeling you're trying to make controlled changes in an isolated environment so to avoid impacting other users/applications.</p> <p>Could you solve this problem by;</p> <ul> <li>Create a ...
41,037
<p>Some time ago I got this error when building ANY Visual Studio Deployment project.</p> <p><strong>"Unrecoverable build error"</strong> </p> <p><em>I thought my VS installation was corrupted or I deleted some important files, but ...</em></p>
<p>...all I had to do was.</p> <p><strong>Close down</strong> Visual Studio.</p> <p>Start, <strong>Run</strong> or WIN+R, type <strong>cmd</strong>, OK.</p> <pre><code>regsvr32 &quot;C:\Program Files\Common Files\Microsoft Shared\MSI Tools\mergemod.dll&quot; regsvr32 ole32.dll </code></pre> <p><strong>For x64 bit machi...
<p>Reinstall (Repair) Visual Studio resolved the problem for me.</p>
44,035
<p>My application is pretty simple: it starts up with a view controller that holds a table view (in grouped view layout) with a few options. When the user taps on one of the options, I push another view controller onto my navigation controller.</p> <p>This second view controller simply displays a UIImageView, and the ...
<p>There does not appear to be a way to do this using the documented methods. </p> <p>I have filed a bug for this: rdar://6399924</p> <p>"There is no way to always restrict a UIViewController to one orientation"</p> <p>You can see it on open radar (along with a link to sample code to reproduce the problem) here: <a ...
<p>I wasn't able to get this to work the way I wanted. You ought to be able to set a particular orientation for a ViewController, but the NavigationController doesn't seem to always do the right thing.</p> <p>I ennded up re-designing my screens so that they all work in either orientation. That might be extra work, but...
40,557
<p>I'm quite confused about the basic concepts of a Hash table. If I were to code a hash how would I even begin? What is the difference between a Hash table and just a normal array? </p> <p>Basically if someone answered this question I think all my questions would be answered: If I had 100 randomly generated numbers (...
<p>The answers so far have helped to define hash tables and explain some theory, but I think an example may help you get a better feeling for them.</p> <p><em>What is the difference between a hash table and just a normal array?</em></p> <p>A hash table and an array are both structures that allow you to store and retr...
<p>I'll answer that part about the difference between a hash table and an array... but since I've never implemented a hashing algorithm of any import before, I'll leave that to somebody more knowledgeable :)</p> <p>An array is just an ordered list of objects. The object itself doesn't really matter... what's important...
35,813
<p>What's the best way in c# to determine is a given QFE/patch has been installed?</p>
<p>Use WMI and inspect the <a href="http://msdn.microsoft.com/en-us/library/aa394391.aspx" rel="nofollow noreferrer">Win32_QuickFixEngineering</a> enumeration.</p> <p>From TechNet:</p> <pre><code>strComputer = "." Set objWMIService = GetObject("winmgmts:" _ &amp; "{impersonationLevel=impersonate}!\\" &amp; strCom...
<p>The most reliable way is to determine which files are impacted by the QFE and use <code>System.Diagnostics.FileVersionInfo.GetVersionInfo(path)</code> on each file and compare the version numbers.</p> <p>edit: I think there's a way to check the uninstall information in the registry as well, but if the QFE ever beco...
8,187
<p>I am trying to implement Autocomplete in a text area (similar to <a href="http://www.pengoworks.com/workshop/jquery/autocomplete.htm" rel="nofollow noreferrer">http://www.pengoworks.com/workshop/jquery/autocomplete.htm</a>).</p> <p>What I am trying to do is when a user enters a specific set of characters (say inser...
<p>You can get the caret using document.selection.createRange(), and then examining it to reveal all the information you need (such as position). See <a href="http://javascript.nwbox.com/cursor_position/" rel="nofollow noreferrer">those</a> <a href="http://weblogs.asp.net/skillet/archive/2005/03/24/395838.aspx" rel="no...
<p>an ugly solution: </p> <p>for ie: use document.selection...</p> <p>for ff: use a pre behind textarea, paste text before cursor into it, put a marker html element after it (cursorPos), and get the cursor position via that marker element</p> <p>Notes: | code is ugly, sorry for that | pre and textarea font must be t...
44,342
<p>Posting a stack overflow question on stackoverflow.com, how amusing :-)</p> <p>I'm running some recursive Ruby code and I get the: <code>"Stack level too deep (SystemStackError)"</code></p> <p>(I'm quite sure the code works, that I'm not in an infinite recursive death spiral, but that is not the point anyway)</p> ...
<p>This question and its answers appear to date back to Ruby 1.8.x, which used the C stack. Ruby 1.9.x and later use a VM that has its own stack. In Ruby 2.0.0 and later, the size of the VM stack can be controlled via the <code>RUBY_THREAD_VM_STACK_SIZE</code> environment variable.</p>
<p>As of <a href="http://blog.tdg5.com/tail-call-optimization-in-ruby-background/" rel="nofollow noreferrer">Ruby 1.9.2</a> you can turn on tail-call optimization with something like:</p> <pre><code>RubyVM::InstructionSequence.compile_option = { tailcall_optimization: true, trace_instruction: false } RubyVM::Inst...
30,037
<p>I have a XULRunner application that needs to copy image data to the clipboard. I have figured out how to handle copying text to the clipboard, and I can paste PNG data from the clipboard. What I can't figure out is how to get data from a data URL into the clipboard so that it can be pasted into other applications.</...
<p>Here's a workaround that I ended up using that solves the problem pretty well. The variable <code>dataURL</code> is the image I was trying to get to the clipboard in the first place.</p> <pre><code>var newImg=document.createElement('img'); newImg.src=dataURL; document.popupNode=newImg; var command='cmd_copyImageC...
<p>Neal Deakin has an <a href="http://developer.mozilla.org/en/Using_the_Clipboard" rel="nofollow noreferrer">article on manipulating the clipboard</a> in xulrunner. I'm not sure if it answers your question specifically, but it's definitely worth checking out.</p>
9,360
<p>For a project I'm working on. I need to look for an executable on the filesystem. For UNIX derivatives, I assume the user has the file in the mighty $PATH variable, but there is no such thing on Windows.</p> <p>I can safely assume the file is at most 2 levels deep into the filesystem, but I don't know on what drive...
<p><a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html#listRoots()" rel="noreferrer">http://docs.oracle.com/javase/7/docs/api/java/io/File.html#listRoots()</a></p> <pre><code>File[] roots = File.listRoots(); for(int i = 0; i &lt; roots.length ; i++) System.out.println("Root["+i+"]:" + roots[i]); </...
<p>Of course there is a <code>PATH</code> environment variable <a href="http://en.wikipedia.org/wiki/Environment_variable#System_path_variables" rel="nofollow noreferrer">in Windows</a>.</p> <blockquote> <blockquote> <p><code>%PATH%</code> This variable contains a semicolon-delimited list of directories in w...
7,436
<p>I would like to enhance Eclipse so that when I press a custom key combo--say <kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>E</kbd>--then it will run a command on the current file (if my current buffer is foo.c then it will run `mycommand foo.c' in foo.c's directory). </p>
<p>Open the External Tools Configuration dialog from the Run menu. Create a new configuration with the following settings.</p> <p><strong>Location</strong>: c:\mycommand.exe (alter to your needs)</p> <p><strong>Working directory</strong>: ${container_loc}</p> <p><strong>Arguments</strong>: ${resource_loc}</p> <p>Un...
<p>Also, make sure that your "resource" (foo.c) is selected. It happened to me that when testing the external tool and horizontally scrolling the output pane, the resource gets deselected. When you run the external tool again after probably having made changes to its configuration, Eclipse will pop up an error box abo...
48,325
<p>I have read the answers for <a href="https://stackoverflow.com/questions/230062/whats-the-best-way-to-check-if-a-file-exists-in-c-cross-platform">What's the best way to check if a file exists in C? (cross platform)</a>, but I'm wondering if there is a better way to do this using standard c++ libs? Preferably without...
<p>Use <a href="http://www.boost.org/doc/libs/1_37_0/libs/filesystem/doc/index.htm" rel="noreferrer">boost::filesystem</a>:</p> <pre><code>#include &lt;boost/filesystem.hpp&gt; if ( !boost::filesystem::exists( "myfile.txt" ) ) { std::cout &lt;&lt; "Can't find my file!" &lt;&lt; std::endl; } </code></pre>
<p>If you are already using the input file stream class (<code>ifstream</code>), you could use its function <code>fail()</code>.</p> <p><strong>Example:</strong></p> <pre><code>ifstream myFile; myFile.open("file.txt"); // Check for errors if (myFile.fail()) { cerr &lt;&lt; "Error: File could not be found"; ...
33,626
<p>Through some bungling in creating and removing publications, I was left with a lot of obsolete publications which for some reason still remains in the Replication Monitor. </p> <p>How do you remove these publications? It doesn't seem to have a clear way to remove them.</p>
<p>This is an old question of mine, but then again at least I found a way to resolve it.</p> <p>I was able to remove the publications is by creating a new publication with the same name, then delete the publication again. This time the publication will no longer appear in the Replication Monitor. I did not remember if...
<p>An alternative situation which I noticed on one of our servers occurs when a database with publications is taken offline. The publication then disappears from the object browser but is still shown in the replication monitor as per this question.</p> <p>In this case, you can simply bring the database back online cau...
23,578
<p>I am trying to make a <code>JTable</code> that has column spans available. Specifically, I am looking to nest a <code>JTable</code> inside another <code>JTable</code>, and when the user clicks to view the nested table, it should expand to push down the rows below and fill the empty space. This is similar to what you...
<p>As a pointer in the right direction, try <a href="http://www.swingwiki.org/howto:column_spanning" rel="nofollow noreferrer">this article</a> at SwingWiki that explains the TableUI method of column spanning quite well. Before this, I also tried some alternatives such as overriding the TableCellRenderer paint methods ...
<p>You need to write your own TableUI for the master table. It can also helpful to use your own TableModel to save additional data like if a row is expanded. But this is optional.</p> <p>I write an equals TableUI that expand a row and show an text editor. In the TableUI you need to change the the row hight dynamically...
17,641
<p>I have a bunch of <strong>.NET</strong> frameworks installed on my machine.<br> I know that with the <strong>Java JDK</strong>, I can use the <strong>6.0</strong> version to target <strong>5.0</strong> and earlier. </p> <p>Can I do something similar with the <strong>.NET</strong> framework - target <strong>1.0</st...
<p>Visual Studio 2008 was the first to support targeting older versions of .NET. Unfortunately, it supports only .NET 2 and up.</p> <p>In other words, you'll need .NET framework SDK 1 or 1.1 to do this.</p>
<p>(<strong>Updated</strong>)</p> <p>You need to compile with the 1.0 compilers. These are only available with the 1.0 release of the runtime/SDK.</p> <p>The 2.0/3.5 compilers won't emit 1.0-compatible assemblies.</p> <p>Visual Studio 2008 can generate 2.0 assemblies, but 1.0 was left off.</p>
5,128
<p>Does anyone have any recommendations of tools that can be of assistance with moving literal values into resource files for localization?</p> <p>I've used a resharper plugin called RGreatX but was wondering if there is anything else out there.</p> <p>It's one heck of a long manual process for moving the strings acr...
<p>Here's one:</p> <p><a href="http://www.codeplex.com/ResourceRefactoring" rel="noreferrer">http://www.codeplex.com/ResourceRefactoring</a></p> <p>It'a actually a Microsoft "open source" Visual Studio(2005 and up) tool that integrates with the IDE. You can easily replace every occurence of a string with a ressource...
<p>Try <a href="https://visuallocalizer.codeplex.com" rel="nofollow">Visual Localizer</a> - you can batch-process whole code, select which strings may be localized and the tool will add them to a resource file and create a reference instead. Many other features easing localization are included.</p>
3,591
<p>Having a heckuva time with this one, though I feel I'm missing something obvious. I have a control that inherits from <code>System.Web.UI.WebControls.Button</code>, and then implements an interface that I have set up. So think...</p> <pre><code>public class Button : System.Web.UI.WebControls.Button, IMyButtonInterf...
<p>Longhorn213 almost has the right answer, but as as Sean Chambers and bdukes say, you should use </p> <pre><code>ctrl is IInterfaceToFind </code></pre> <p>instead of </p> <pre><code>ctrl.GetType() == aTypeVariable </code></pre> <p>The reason why is that if you use <code>.GetType()</code> you will get the true...
<p>If you're going to do some work on it if it is of that type, then TryCast is what I'd use.</p> <pre><code>Dim c as IInterface = TryCast(obj, IInterface) If c IsNot Nothing 'do work End if </code></pre>
4,825
<p>I wrote a windows service using VB that read some legacy data from Visual Foxpro Databases to be inserted in SQL 2005. The problem is this use to run fine in Windows server 2003 32-Bits, but the client recently moved to Windows 2003 64-Bits and now the service won't work. I'm getting a message the the VFP .NET OLEdb...
<p>Have you tried changing the target CPU to <code>x86</code> instead of <code>"Any CPU"</code> in the advanced compiler options? I know that this solves some problems with other <code>OLEDB</code> providers by forcing the use of the 32-bit version.</p>
<p><code>Sybase Anywhere</code> has a <code>OLEDB provider</code> for <code>VFP</code> tables. It states in the page that the server supports <code>64 bit Windows</code>, don't know about the <code>OLEDB provider</code>:</p> <blockquote> <p>Support 64-bit Windows and Linux Servers</p> <p>In order to further enhance sca...
2,314
<p>I will begin this question by admitting I am very new to MVC. The design pattern makes sense to me at a high level, but now that I'm exploring ASP.NET MVC, some of the architectural pieces are challenging my preconceived notions. Learning is a good thing.</p> <p>I've been working with <a href="http://www.codeplex.c...
<p>Your business logic goes in your business layer. The controllers use the business layer to create a model for your views to render. A good example is the MVC Storefront application that Rob Conery has produced. Oxite is currently getting lots of bad press as it apparently does not make good use of the MVC framewo...
<p>You could implement your business layer (i.e. the Model) with your entities, aggregates, repositories, and services. The services call the repositories, which pull data from your DAL in the form of entities.</p> <p>This can be set in a single, seperate project which is nothing more than a DLL.</p> <p>Next, have y...
48,593
<p>Let's say I want to write a regular expression to change all <code>&lt;abc&gt;</code>, <code>&lt;def&gt;</code>, and <code>&lt;ghi&gt;</code> tags into <code>&lt;xyz&gt;</code> tags.. and I also want to change their closing tags to <code>&lt;/xyz&gt;</code>. This seems like a reasonable regex (ignore the backticks; ...
<p>Move the question mark inside the capturing bracket. That way $1 will always be defined, but may be a zero-length string.</p>
<p>Add</p> <pre><code>no warnings 'uninitialized'; </code></pre> <p>or</p> <pre><code>s!&lt;(/)?(abc|def|ghi)&gt;! join '', '&lt;', ${1}||'', 'xyz&gt;' !ge; </code></pre>
16,486
<p>I hope this is the right place to ask[1], but I've read a lot of good comments on other topics here so I'll just ask. At the moment I'm searching for a topic for my dissertation (Ph.d in non-german countries I think), which must have to do something with parallelism or concurrency, etc. but otherwise I'm quite free ...
<p>Erlang programming!</p>
<p>Parallel processing and rules engines are both high-visibility topics in the commercial/industrial computing world. So, how about looking at parallel implementations of the Rete algorithm (introductory descriptions <a href="http://en.wikipedia.org/wiki/Rete_algorithm" rel="nofollow noreferrer">here</a> and <a href="...
39,227
<p>I'm using MessageFormat to format some addresses with a template like this:</p> <pre><code>"{0}\n{1}\n{2}\n{3}, {4} {5}" </code></pre> <p>where</p> <ul> <li>0 = street 1</li> <li>1 = street 2</li> <li>2 = street 3</li> <li>3 = city</li> <li>4 = state</li> <li>5 = zip</li> </ul> <p>Most of these fields are option...
<p><strong>EDIT: rewrite...</strong></p> <p>If you <em>don't care about design</em>, then you can readily pick a template engine at random, or because you like its name, or whatever. If you don't have criteria for selecting an engine, then who cares which one you pick?</p> <p>On the other hand, if you <em>do care a...
<p>Use Velocity or <a href="http://freemarker.org/" rel="nofollow noreferrer">Freemarker</a>.</p>
33,980