instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>When obtaining the DPI for the screen under Windows (by using ::GetDeviceCaps) will the horizontal value always be the same as the vertical? For example:</p> <pre><code>HDC dc = ::GetDC(NULL); const int xDPI = ::GetDeviceCaps(dc, LOGPIXELSX); const int yDPI - ::GetDeviceCaps(dc, LOGPIXELSY); assert(xDPI == yDPI); ...
<p>It's possible for it to be different, but that generally only applies to printers. It can be safely assumed that the screen will always have identical horizontal and vertical DPIs.</p>
<p>I've never seen a case where they're different, but the fact that there are two separate calls for it strongly suggests that they might be sometimes.</p>
40,585
<p>I'm currently using a UIImageView with an array of images to create a small looping animation sequence with about 20 images in there (at 320x480). Whilst this works okay for 20 - 30 images, any more and the app quits on the iphone. There is nothing else in my test app at the moment so I know it's just down to the an...
<p>This could be a simple memory issue. 20 images (320x480) is about 3 MB of memory, assuming 8bpp (if they're higher color, obviously even more). You might try loading and unloading as needed (though, of course, that'll mean rolling your own animation, rather than using UIImageView). </p>
<p>Sounds like a simple memory issue.</p> <p>You could load one or two frames at a time, or actually play a movie instead.</p>
32,372
<p>I am trying to have one one layer, and center images within. I.E., if I have 3 images and want 3 links beneath them, is there a way to do this without using a separate div tag for each link and image? To automatically make the links be centered under the images, and the images to be spaced evenly within a layer? </p...
<p>Yes, you'll have to put a container element, such as a div, around each image and its caption to keep them together.</p> <pre><code>&lt;div class="pictureBox"&gt; &lt;div&gt; &lt;img /&gt; caption caption &lt;/div&gt; &lt;div&gt; &lt;img /&gt; more caption &lt;/div&gt...
<p>nickf is right, z-index only applies to absolutely positioned elements.</p> <p>You could make the containing element position:relative, then give both the image and link position:absolute to affect their stacking order.</p>
37,794
<p>I can't find any post regarding the cache on logout so I'm going to ask this question. If there is a similar question. Please let me know.</p> <p>I have a Logout page that basically call FormAuthentications signout method then redirect the user to the login page. It work fine but the problem is user can click on th...
<p>Depending on your requirements a possible solution might be to set the Cache-Control header to "no-cache" on every authenticated page. This will prevent pages from being cached downstream. It could be achieved by writing a custom <a href="http://msdn.microsoft.com/en-us/library/system.web.ihttpmodule.aspx" rel="nofo...
<p>There's no foolproof way to accomplish this. The user ultimately has control over the cache settings and no-cache headers can't override these.</p> <p>Is there a particular concern you are trying to address here (security?), or are you just trying to ensure that users aren't seeing stale data?</p>
49,091
<p>I have a basically sql select question that people gave me different answers over the years. Say I have a couple of tables designed each with over 40 columns and potentially will hold ten and thousands of row, I'm using SqlServer2005.</p> <p>On joining these tables, in the where clause if I have things like</p> <...
<p>In general, with database optimization, you should write SQL which is conceptually correct first, and then tweak performance if profiling shows it to be necessary. When doing an inner join, it is better to use SQL-92, explicit INNER JOINs than Cartesian products. So I would begin by writing your SQL as follows:</p> ...
<p>Firstly, construct the query using an explicit JOIN syntax, rather than the cartesian product. It probably won't make any difference performance-wise for any modern optimiser, but it does make the information on how the JOINs work more accessible for the programmers.</p> <pre><code> SELECT Player.Name, Game.Date F...
49,247
<p>How do I create a view dynamically in SQL Server using C#?</p>
<p>Something like this, obviously your connection code will be different (better):</p> <pre><code>SqlConnection conn = null; conn = new SqlConnection("yourConnectionString"); conn.Open(); string strSQLCommand = "CREATE VIEW vw_YourView AS SELECT YOurColumn FROM YourTable"; SqlCommand command = new SqlCommand(strSQLCom...
<p>You can use the following code to write the query for a view:</p> <pre><code>query = " Create View [Viewname] Select ...."; </code></pre> <p>Execute the query.</p>
43,681
<p>How do you usually go about <strong>separating your codebase and associated unit tests</strong>? I know people who create a separate project for unit tests, which I personally find confusing and difficult to maintain. On the other hand, if you mix up code and its tests in a single project, you end up with binaries r...
<p>I definitely advocate separating your tests out to a separate project. It's the only way to go in my opinion.</p> <p>Yes, as <a href="https://stackoverflow.com/users/6369/garry-shutler">Gary</a> says, it also forces you to test behavior through public methods rather than playing about with the innards of your class...
<p>I definitely agree with everyone else that you should separate the tests from your production code. If you insist on not, however, you should define a conditional comiplation constant called TEST, and wrap all of your unit test classes with a </p> <pre><code>#if TEST #endif </code></pre> <p>first to ensure that t...
10,752
<p>I've got a program that tends to crash quite often while I'm asleep and I need to keep it running. So I thought I might writeup a vb6 application that monitors the process list, if something disappears it will relaunch it. Anyone know of an easy way?</p>
<p>Use <a href="http://en.wikipedia.org/wiki/Windows_Management_Instrumentation" rel="nofollow noreferrer">WMI</a>.<br/><br/> If you're stuck with VB6, search the web for WMI+VB6.<br/> Otherwise, interfacing c# and WMI is much easier.</p>
<p>I've used scheduled task (running at each 10 min), starting cmd file with next content:</p> <pre><code>tasklist |find "myapp.exe" &gt;nul || c:\mypath\myapp.exe </code></pre> <p>You can execute such command file from VB6 Shell or just use Task Scheduler :)</p>
41,137
<p>I want to check if an app is alredy installed through launch conditions.If yes i want to exit the installer,if no the installation should continue.Could anyone tell how to achive this in c# installer?.</p> <p>Regards, Harsh Suman</p>
<p>Put an entry in the registry on install. If, when the installer runs, the entry is there, then the program is already installed (or your user has hacked the registry to make the installer think it has been). If it's not, then you haven't installed it yet.</p>
<p>If you don't want to put anything in the registry (due to admin rights or anything like that), you can simply check to see if the folders or files you install are present. Yes, this assumes you install to the same folder every time, but it's an option.</p>
25,942
<p>There are numerous times you have an interface that accepts similar type arguments that have a separate domain logic meaning:</p> <pre><code>public static class Database { public static bool HasAccess(string userId, string documentId) { return true; } } </code></pre> <p>Now it's quite easy to have someone key d...
<p>I think you answered your own question - better data integrity and validation, better system</p>
<p>Yes, it is sometimes a good idea. But if you get too obsessed with this you become an architecture astronaut.</p> <p>As regards the type safety argument - it does increase type safety but lots of languages manage fine without it.</p> <p>In my opinion the best way to go is leave it as a String to start with, and th...
20,966
<p>Suddenly my Flex Apps can no longer connect to salesforce.com via its API, I am getting a security sandbox violation. Login credentials are correct, I have tried them via a different means, and I have obfuscated them below.</p> <p>This was working fine earlier today and I have not been coding since then.</p> <p>A...
<p>You have to make sure to load the policy from the /services tree, the default policy at the root won't help you. You need to load this policy <a href="https://www.salesforce.com/services/crossdomain.xml" rel="nofollow noreferrer">https://www.salesforce.com/services/crossdomain.xml</a></p>
<p>Did you recently upgrade to flash player 10? Flash player 10 changes the way policy files work to some degree, and the crossdomain.xml file needs to be updated to address this. In short, Salesforce.com probably isn't prepared for users upgrading to Flash Player 10 yet.</p>
39,510
<p>I am looking for a tool/framework to (automatically) generate a Swing user interface to perform CRUD operations on an underlying database.</p> <p>I would also like to configure the database fields that should be exposed. Something like django (via <a href="http://docs.djangoproject.com/en/dev/topics/forms/modelfor...
<p>NetBeans does seem like an obvious answer. These guys make a NetBeans plugin that does just that: <a href="http://www.morelisland.com/java_services/netbeans_tutorial/midbmetadata_se.htm" rel="nofollow noreferrer">http://www.morelisland.com/java_services/netbeans_tutorial/midbmetadata_se.htm</a></p> <p>I've heard j...
<p>I'm using Netbeans (latest). I guess it's far from Django (haven't tried it, but as far as I understand it is kind of rails/symfony-like,) but it does reverse engineer the database and give you a basic application including a master/detail view.</p>
46,979
<p>I'm writing a lightweight game engine and while doing some research for it I've come across a number of compelling articles advocating the implementation of Game Objects through a "collection of components" model rather than an "inheiritance from concrete classes" model. There are lots of advantages:</p> <ul> <li>...
<p>Composable architectures usually rely on interfaces. A component then is implementation+data, enabling designers to re-use available implementations with different data. e.g. using the rocket code once with a rocket graphic and once with an arrow graphic. The flexibility comes from being able to "configure" such com...
<p>It sounds a little over-engineered; what do you gain by making location an abstract component of an object instead of a fundamental property?</p> <p>But if you really want to do it that way, I guess you could set up a dependancy-graph where everything's explicitly connected. So the (eg) collision-volume has a locat...
24,710
<p>I have a team lead who seems to think that business logic is very subjective, to the point that if my stored procedure has a <code>WHERE ID = @ID</code> — he would call this <em>“business logic”</em></p> <p>What approach should I take to define <em>“business logic”</em> in a very objective way without offending my ...
<p>I really think you just need to agree on a clear definition of what you mean when you say "business logic". If you need to be "politically sensitive", you could even craft the definition around your team lead's understanding, then come up with another term ("domain rules"?) that defines what you want to talk about....
<p>You could try to argue your point with a timed example, run a sql select against an indexed table and then run a loop to find exactly the same item in the same set but this time in code. The code will be much slower.</p> <p>Let the database do what it was designed to do, select sets and subsets of data :) I think r...
7,633
<p>So I'm basically a beginner when it comes to Vim, nonetheless I do know the basic things (open files, edit, move around, basic grep, .vimrc, etc)</p> <p>I would submit this link first</p> <p><a href="http://weblog.jamisbuck.org/2008/11/17/vim-follow-up" rel="nofollow noreferrer">http://weblog.jamisbuck.org/2008/11...
<p>I'd say <code>:help leader</code> will give you what you need, is an anti-slash by default.</p> <p>Thus, <code>map &lt;leader&gt;d</code> will be launched when you do <code>\d</code>.</p>
<p>In addition to what others have said (d mapped to the command), the command, itself:</p> <pre><code>:execute 'NERDTreeToggle ' . getcwd()&lt;CR&gt; </code></pre> <p>Is simply executing the NERDTreeToggle command with the first argument as the current working directory. The at the end is a carriage return, and is ...
45,570
<p>I have a <code>Rakefile</code> with a Rake task that I would normally call from the command line:</p> <pre><code>rake blog:post Title </code></pre> <p>I'd like to write a Ruby script that calls that Rake task multiple times, but the only solution I see is shelling out using `` (backticks) or <code>system</code>.</...
<p>from <a href="http://web.archive.org/web/20090412040557/http://timocracy.com:80/articles/2008/02/21/calling-invoking-rails-rake-tasks-from-within-ruby-for-testing-try-2" rel="nofollow noreferrer">timocracy.com</a>:</p> <pre><code>require 'rake' def capture_stdout s = StringIO.new oldstdout = $stdout $stdout ...
<p>In a script with Rails loaded (e.g. <code>rails runner script.rb</code>)</p> <pre><code>def rake(*tasks) tasks.each do |task| Rake.application[task].tap(&amp;:invoke).tap(&amp;:reenable) end end rake('db:migrate', 'cache:clear', 'cache:warmup') </code></pre>
2,563
<p>A python script is running two parallel python processes ( created via os.fork() ) each of which eventually tries to check out a subversion repository leaf into the same working copy dir.</p> <p>Before running 'svn co ...' command in a sub-process ( via python subprocess module ) the parent python code checks if th...
<p>This sounds like a potential race condition, in that something like the following can happen:</p> <ol> <li>Process A checks to see if the directory exists (it doesn't yet).</li> <li>Process B checks to see if the directory exists (it doesn't yet).</li> <li>Process A invokes <code>svn</code>, which creates the direc...
<p>Within the directory, there should be a directory called '.svn'. Within this, a file named 'locked' indicates that the directory is locked.</p>
23,947
<p>currently I have only seen products from smartertools for email servers that run on windows boxes.</p> <p>what are you guys running? Is there any other options? </p> <p>It gets expensive when you have multiple servers requiring their software.</p>
<p>Imail Server works well for small organizations. <a href="http://www.imailserver.com/" rel="nofollow noreferrer">http://www.imailserver.com/</a></p>
<p>We use <a href="http://www.kerio.com/kms_home.html" rel="nofollow noreferrer">Kerio Email Server</a>. It works well for us.</p>
32,380
<p>While working on SVG implementation for Internet Explorer to be based on its own VML format I came to a problem of translation of an SVG elliptical arc to an VML elliptical arc.</p> <p>In VML an arc is given by: two angles for two points on ellipse and lengths of radiuses, In SVG an arc is given by: two pairs of co...
<p>So the solution is here:</p> <p>The parametrized formula of an ellipse:</p> <pre> x = x0 + a * cos(t) y = y0 + b * sin(t) </pre> <p>Let's put known coordinates of two points to it:</p> <pre> x1 = x0 + a * cos(t1) x2 = x0 + a * cos(t2) y1 = y0 + b * sin(t1) y2 = y0 + b * sin(t2) </pre> <p>Now we have a system of...
<p>TypeScript implementation based on the answer from Rikki. </p> <p>Default DOMMatrix and DOMPoint are used for the calculations (Tested in the latest Chrome v.80) instead of the external library.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippe...
24,050
<p>Is there a tool out there which can convert SQL syntax to LINQ syntax? </p> <p>I just want to rewrite basic queries with join, etc., to <a href="http://en.wikipedia.org/wiki/Language_Integrated_Query" rel="noreferrer">LINQ</a>. It would save me a lot of time.</p>
<p>Edit 7/17/2020: I cannot delete this accepted answer. It used to be good, but now it isn't. Beware really old posts, guys. I'm removing the link.</p> <p>[<strong>Linqer</strong>] is a SQL to LINQ converter tool. It helps you to learn LINQ and convert your existing SQL statements.</p> <p>Not every SQL statement can b...
<p>I know that this isn't what you asked for but <a href="http://en.wikipedia.org/wiki/LINQPad" rel="noreferrer">LINQPad</a> is a really great tool to teach yourself <a href="http://en.wikipedia.org/wiki/Language_Integrated_Query" rel="noreferrer">LINQ</a> (and it's free :o).</p> <p>When time isn't critical, I have be...
37,982
<p>How can I have it so Visual Studio doesn't keep re-creating this folder that I never use. It's annoying ot keep looking and unnecessary.</p>
<p>Add a trailing slash to the default projects location:</p> <p><a href="http://rerrify.wordpress.com/2012/03/22/get-rid-of-the-annoying-vsmacros80-folder-5/" rel="nofollow">Get Rid of the Annoying VSMacros80 Folder</a></p>
<pre><code>Tools-&gt;Options-&gt;Addin/Macro Security </code></pre> <p>Change Paths there.</p>
4,771
<p>I need to conduct a survey of 3 questions:</p> <ul> <li><p>The first question will be Yes/No.</p></li> <li><p>The second will have multiple answers, in which you can select multiple answers for just that question, as well as an "other" box that you can use to fill in an answer.</p></li> <li><p>The last question wil...
<p>I looked into this a few years ago. Surveymonkey is a web service that appears to be widely used, especially by non-computer literate. If you want to modify, serve and count yourself (possible for free), see <a href="http://websurveytoolbox.org/FeatureTable.html" rel="nofollow noreferrer" title="this comparison ch...
<p><a href="http://www.surveymonkey.com" rel="nofollow noreferrer">http://www.surveymonkey.com</a> works well in my experience.</p>
31,658
<p>I want to create visuals along the lines of CNN's "red-state, blue-state" shadings of the states in the U.S. for my project. I'm planning to do something fancier than just shading the state's shape in a color. Are there open source libraries of state shapes/polygons (or - if not open source - others) that I can impo...
<p>you could try google charts, it looks like <a href="http://www.woot.com" rel="nofollow noreferrer">http://www.woot.com</a> is doing something similar to what you need</p>
<p>There might be a couple parts to the question you are asking, but to address the first part "Are there open source libraries of state shapes/polygons...", here's a resource to check out:</p> <p><a href="http://commons.wikimedia.org/wiki/Category:SVG_maps_of_the_United_States" rel="nofollow noreferrer">http://common...
27,712
<p>What is <a href="http://docs.oracle.com/javase/6/docs/api/java/awt/Component.html#getName%28%29" rel="noreferrer"><code>java.awt.Component.getName()</code></a> used for? It always seems to be <code>null</code> in the applications I build with NetBeans. I'm thinking of storing some help text per component in it -- ...
<p>Component.setName(..) is used in the JDK mostly by the look and feel implementation classes to set ID-like strings for each component, e.g. BasicOptionPaneUI might call it on a button component to set its name to "OptionPane.button".</p> <p>The getName() is used in toString() methods, when setting the names of chil...
<p>I have searched many answers for getting name and i think this is the only easy solution </p> <pre><code>public static void main(String[] args) { ActionListener actionListener = new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { String name = actionEvent.getSource...
28,106
<p>I've been tasked with implementing a Date/Time selector for several areas of our web project, and instructed to use a control that another developer created as part of it. The control I'm working on is supposed to allow the user to choose a date from a calendar, choose a format for the display of that date (from se...
<p>Why would you start a thread and then join against it immediately?</p> <p>I'd normally do something like this:</p> <pre><code>List&lt;Thread&gt; threads = new List&lt;Thread&gt;(); foreach (string item in items) { string copy = item; // Important due to variable capture ThreadStart ts = () =&gt; DoWork(co...
<p>Why not have your parameters be part of the class, make them properties, and have the get/set methods lock around them? If you have enough parameters, make the parameter object itself a property of the object, and then lock that parameter block. As in:</p> <pre><code>class GonnaDoSomeThreading { private Object...
31,824
<p>What are the benefits of Perforce?</p> <p>I'd love to have some insight as to how Perforce can work better in a given situation than, say, Subversion.</p> <p>If you have experience with both Perforce and Subversion and you don't believe that there are any advantages, or believe that svn has advantages over Perforc...
<p>I've worked with Perforce for years, as well as Clearcase, Sourcesafe, RCS, PVCS, CVS and Subversion. More recently I've started using GIT too.</p> <p>From this experience my opinion is that, for most purposes, Perforce is the best version control system for commercial environments. While not as simple, initially, ...
<p>A Perforce server can <b>read and write arbitrary files on the client, and thus execute arbitrary code.</b> The Perforce configuration is all server-side, so the server could simply treat the entire hard disc of the clients' computer as a repository, and do <b>whatever it wanted to it.</b></p> <p>Never run Perforce...
31,028
<p>My end goal is getting high quality dash footage from a 6 month road trip I'm going on. From my research, very few dash cams support 4k 30fps filming, and the ones that do overwrite their own footage really quick, so instead of that I'd like to use my iPhone. I have a wide angle lens for it, and I figure I can mount...
<p>You'd <a href="https://3dprinting.stackexchange.com/questions/6119/can-you-put-pla-parts-in-your-car-in-the-sun">need to print in a heat resistant material</a> - ASA for example - and design the part for your needs, but this project is certainly feasible and doable with 3D printing. If that isn't enough for you, you...
<p>Why not try a GoPro camera? They now have 4K, image stabilized camera with all kinds of accessory mounts.</p> <p><a href="https://shop.gopro.com/cameras/hero7-silver/CHDHC-601-master.html" rel="nofollow noreferrer">https://shop.gopro.com/cameras/hero7-silver/CHDHC-601-master.html</a></p>
1,398
<p>the problem I have is that I have two sets of values in a drop down list. If type 'A' is selected I want a text box to be populated with a value from the database and be read only. If Type 'B' is selected the box is to be empty and editable.</p> <p>My original code is written in jsp/struts and I have sort of achiev...
<p>AJAX is your only other option my friend, unless on the original page load you load all the other possible values of the Text Box so you don't need to go back to the database. Well, you could try putting the text box in an IFRAME, but you will probably run into more problems with that approach than just going with ...
<p>Without AJAX what you are asking is going to be difficult. Another option (which is ugly) is to write out all possible values for the second list box into a data structure like an array or dictionary.</p> <p>Then write some javascript to get the values from the data structure when the user selects from the first li...
35,176
<p>I was looking into the best encryption for a license key for an application, and someone said that someone can easily decompile the application and then just skip the test for the license key.</p> <p>how would someone go about doing that practically speaking? So they have my .dll, they have to decompile it somehow...
<p>Try opening your application with <a href="http://www.red-gate.com/products/reflector/" rel="noreferrer">Reflector</a>. You will probably be surprised :-)</p> <p>And once a cracker has located the right location in your code, they can use a combination of <a href="http://msdn.microsoft.com/en-us/library/f7dy01k1(VS...
<p>Even without Reflector, people have been doing this for ages. Basically you watch the app with a debugger - something like WinDBG will do - and then find out when the license check happens. You watch the return value, and then you simply patch the application to jump directly to the "all good" check. </p> <p>I'd re...
33,245
<p>I've used all three of these when making local programmatic connections to databases. Is there any real difference between them?</p>
<p>The final result is the same. The difference is: </p> <ul> <li>'localhost' resolves at the TCP/IP level and is equivalent to the IP address 127.0.0.1</li> <li>Depending on the application "(local)" could be just an alias for 'localhost'. In SQLServer, '(local)' and '.' mean that the connection will be made using th...
<p>As far as I know the dot <strong><em>"."</em></strong> and <strong><em>"local"</em></strong> are windows application terms, not a "standard" term, <strong><em>localhost</em></strong> resolves to <strong><em>127.0.0.1</em></strong> in the TCP/IP level so if you want to make sure you are "compatible" across platforms ...
18,839
<p>In jQuery, how do you select the <code>&lt;a&gt;</code> which href is pointing to the current URL</p> <p>For example:<br> URL = <a href="http://server/dir/script.aspx?id=1" rel="nofollow noreferrer">http://server/dir/script.aspx?id=1</a></p> <p>I want to select this <code>&lt;a&gt;</code><br> <code>&lt;a href="/di...
<p>It sounds like you're trying to solve the selected tab 'pattern'. I've found I can solve this myself with the following code:</p> <pre><code>var nav = location.pathname.substr(1).split('/', 2)[0] || '/'; if (nav) { $('#ulTopMenu a[href$="' + nav + '"]').parent().addClass('selected'); } </code></pre> <p>This ba...
<p>I do not know the answer to your question but is that selector syntax valid?</p> <pre><code>'#ulTopMenu a["http://www.foo.com"*=href]' </code></pre> <p>I'd imagine if such a thing is possible it'd be written as</p> <pre><code>'#ulTopMenu a[href*="http://www.foo.com"]' </code></pre>
41,760
<p>I'm not familiar with shell scripting, so I'm not sure how to do it or if it is possible. If you can give me links or advice, that would be great.</p> <p>What I want to do is:</p> <ul> <li><p>Create a file, simple text file EX:</p> <p>param1 (RANDOMVALUE)</p> <p>Where randomvalue is a random number generated.</p> ...
<p>You have almost written the script already. The only missing thing is the random number; I'll do it with Perl. Here is a quick &amp; dirty solution in sh (or bash; I'm presuming you're on a Linux/Unix system):</p> <pre><code>#!/bin/sh perl -e 'print "TheWord (", int(rand(1000)), ")\n"' &gt; tempfile ./program tempf...
<p>Shell scripting is mostly just putting together different programs in ways that get the job done. There are a lot of programs that do just one simple thing and can be combined to accomplish larger tasks that you will learn of as you get into the shell scripting world. An example of a large shell script is <a href="...
42,764
<p>If I want to bind a collection to a some form of listing control in Silverlight. Is the only way to do it so make the underlying objects in the collection implement INotifyPropertyChanged and for the collection to be an Observablecollection?</p> <p>If I was using some sort of third party object, for example that re...
<p>No, once you add a service reference to your silverlight project in Visual Studio, you can right click it and configure it such that it uses an ObservableCollection (which is the default setting anyway)</p> <p>Also, the Service Reference will by default ensure that the service's returned types already implement INo...
<p>Just to be clear, you can <strong>OneTime</strong> bind to any object. If you want to <strong>OneWay</strong> or <strong>TwoWay</strong> bind you will ned an object supports one of those interfaces. As mentioned, creating the Service Reference does this for you for objects delivered via webservice. However, if fo...
14,785
<p>What is a realistic use for VB.Net's MyClass keyword?</p> <p>I understand the <a href="http://msdn.microsoft.com/en-us/library/b3b35kyk.aspx" rel="noreferrer">technical usage of MyClass</a>; I don't understand the practical usage of it in the real world.</p> <p>Using MyClass only makes sense if you have any virtua...
<p><code>MyClass</code>, from a compiler's perspective, is a way to omit a <code>callvirt</code> instruction in favor of a <code>call</code> instruction. Essentially when you call a method with the virtual semantics (<code>callvirt</code>), you're indicating that you want to use the most derived variation. In cases w...
<p>I guess the only case I could see a use for it, would be if you want the base condition, and an inherited condition at the same time? I.E. where you want to be able to inherit a member, but you want the ability to access a value for that member that hasn't been changed by inheritance?</p>
18,854
<p>What's the best / simplest / most accurate way to detect the browser of a user?</p> <p>Ease of extendability and implementation is a plus.</p> <p>The less technologies used, the better.</p> <p>The solution can be server side, client side, or both. The results should eventually end up at the server, though.</p> <...
<p>On the server you're pretty much limited to the UserAgent string the browser provides (which is fraught with problems, have a read about the <a href="http://www.webaim.org/blog/user-agent-string-history/" rel="noreferrer">UserAgent string's history</a>).</p> <p>On the client (ie in Javascript), you have more option...
<p>For internet explorer and Style sheets you can use the following syntax:</p> <pre><code>&lt;!--[if lte IE 6]&gt;&lt;link href="/style.css" rel="stylesheet" type="text/css" /&gt;&lt;![endif]--&gt; </code></pre> <p>This applys to IE 6 or earlier. You can change the IE version and also have:</p> <pre><code>&lt;!--[i...
12,619
<p>I've got a big file on which I'm opening a FileInputStream. This file contains some files each having an offset from the beginning and a size. Furthermore, I've got a parser that should evaluate such a contained file.</p> <pre><code>File file = ...; // the big file long offset = 1734; // a contained file's offset l...
<p>It sounds like what you really want is a sort of "partial" input stream - one a bit like the ZipInputStream, where you've got a stream within a stream.</p> <p>You could write this yourself, proxying all InputStream methods to the original input stream making suitable adjustments for offset and checking for reading ...
<p>You could use a wrapper class on a RandomAccessFile - try <a href="http://www-mipl.jpl.nasa.gov/vicar/vicar290/html/javadoc/jpl/mipl/io/streams/RandomAccessFileInputStream.html" rel="nofollow noreferrer">this</a> </p> <p>You could also try wrapping that in a BufferedInputStream and see if the performance improves.<...
47,888
<p>I'm trying to create routes which follow the structure of a tree navigation system, i.e I want to include the entire path in the tree in my route. So if I had a tree which looked like this</p> <ul> <li>Computers <ul> <li>Software <ul> <li>Development</li> <li>Graphics</li> </ul></li> <li>Hardware <ul> <li>CPU</l...
<p>Routes ignore query string parameters. But at the same time, query string parameters are passed in to an action method as long as there isn't a route URL parameter of the same name. So I would use just the second route, and pass in title via the query string.</p> <p>Another option is more complicated. You write a c...
<h2>Greedy segment anywhere in the URL</h2> <p>I've written <code>GreedyRoute</code> class that supports greedy (catch all) segment anywhere in the URL. It's been a while since you needed it, but it may be useful to others in the future.</p> <p>It supports any of the following patterns:</p> <ul> <li><code>{segment}/...
38,631
<p>It sounds like Mozilla is having good luck improving JavaScript performance with <a href="http://weblogs.mozillazine.org/roadmap/archives/2008/08/tracemonkey_javascript_lightsp.html" rel="noreferrer">TraceMonkey</a>. See also Andreas Gal's <a href="http://www.ics.uci.edu/~franz/Site/pubs-pdf/ICS-TR-06-16.pdf" rel="n...
<p>There's a research JVM by Andreas Gal called <a href="http://HotPath.Org/" rel="nofollow noreferrer">HotPath</a>, and some people from his team are currently working on adding nested trace tree based JITting to <a href="http://Research.Sun.Com/projects/maxine/" rel="nofollow noreferrer">Maxine</a> (Sun's new researc...
<p>The only possible answer to this is: <strong>Hopefully!</strong></p>
16,970
<p>I prefer to use jQuery with my ASP.NET MVC apps than the Microsoft Ajax library. I have been adding a parameter called "mode" to my actions, which I set in my ajax calls. If it is provided, I return a JsonViewResult. If it isn't supplied, I assume it was a standard Http post and I return a ViewResult.</p> <p>I'd li...
<p>Here's an except from MVC RC1 release notes - Jan 2009</p> <p><strong>IsMvcAjaxRequest Renamed to IsAjaxRequest</strong></p> <blockquote> <p>The IsMvcAjaxRequest method been renamed to IsAjaxRequest. As part of this change, the IsAjaxRequest method was updated to recognize the X-Requested-With HTTP header. This is a...
<p>Ok, I have taken this one step farther and modified my jQuery file to load the additional parameter into the post data, so I don't have to repeat the "__JQUERYASYNCPOST: true" for every call to post. For anybody that's interested, here's what my new definition for $.post looks like:</p> <pre><code>post: function(ur...
36,808
<p>What is the best way to close a browser window of an AJAX ASP.NET application after the server-side has been executed.</p> <p>I found this <a href="https://stackoverflow.com/questions/250450/aspnet-ajax-close-window-after-ajax-call">solution</a>, but it seems a little complex for what I want to accomplish. Or is t...
<p>No, there is no way to close a browser window without the user's consent. You can log them out of their application, but you can't forcibly close the browser window. </p>
<p>That's pretty much it. You can just use <code>ScriptManager.RegisterStartupScript(...)</code></p>
46,202
<p>I am writing an application that if the user hits back, it may resend the same information and mess up the flow and integrity of data. How do I disable it for users who are with and without javascript on?</p>
<p>It's not possible, sadly. However, consider your applications navigation model. Are you using Post/Redirect/Get PRG Model? <a href="http://en.wikipedia.org/wiki/Post/Redirect/Get" rel="noreferrer">http://en.wikipedia.org/wiki/Post/Redirect/Get</a>?</p> <p>This model is more back button friendly than the Postback mo...
<p>You could post the data on each form to a _NEW window. This will disable the back button on each window, but without javascript it might be difficult to force the old one closed.</p>
11,300
<p>Is there any way to include the SVN repository revision number in the version string of a .NET assembly? Something like Major.Minor.SVNRev</p> <p>I've seen mention of doing this with something like CC.NET (although on ASP.NET actually), but is there any way to do it without any extra software? I've done similar t...
<p>Here's and C# example for updating the revision info in the assembly automatically. It is based on the answer by Will Dean, which is not very elaborate.</p> <p>Example :</p> <ol> <li>Copy AssemblyInfo.cs to AssemblyInfoTemplate.cs in the project's folder <em>Properties</em>.</li> <li>Change the <em>Build Action</e...
<p>You can use a shared Assembly Version file that you can reference in all of your projects.</p> <p><a href="http://uppercut.googlecode.com" rel="nofollow noreferrer">UppercuT</a> does this - <a href="http://ferventcoder.com/archive/2009/05/21/uppercut---automated-builds---versionbuilder.aspx" rel="nofollow noreferre...
3,327
<p>I have written a windows service using the Apache.NMS and Apcahe.NMS.ActiveMQ (version 1.0) libraries. The service consumes messages from ActiveMQ from a vendor server.</p> <p>The service spins up a connection and listens for messages (I handle the OnMessage event)</p> <p>The connection is a transacted connection...
<p>I have discovered the problem. After establishing the connection and the message listener the service went into a loop with Thread.Sleep(500). Dumb. I refactored the service to start everything up in OnStart and dispose of it in OnStop.</p> <p>Since doing that, everything is running perfectly.</p> <p>Classic ID...
<p>we have just come across exactly the same issue using a .Net service talking to ActiveMQ, but ours locks up after only about 10-20 messages being delivered.</p> <p>Have tried it with and without the spring framework and it's slightly better without (unless I'm imagining things).</p> <p>Would you mind checking over...
33,832
<p>Enterprise Architect has a way to generate the documentation in HTML/RTF/etc. that you could publish, but you have to use its GUI to do that manually. When you have your *.eap files in a CVS/Subversion server, it would be useful to have a script that would check out daily the latest version and publish it in a web s...
<p>I think that you might run into concurrency and contention problems no matter what configuration you use as long as you are attempting to have two different processes log to the same file.</p> <p>You should look into sending log events from both processes to a third, centralized location - take a look at <a href="h...
<p>Even if the question is quite old (and marked as answered) and you're probably already finished with your project:</p> <p>log4net and log4cxx are distinct logging framworks that don't know of each other so you can't configure them to write to the same file. Only one of the framworks will have the file open for writ...
27,327
<p>I have a client sending me requests without HTTP chunking (they use content-length). When my server responds, chunking is enabled, and the client can't handle this - even though they should be able to as they are using HTTP 1.1..... </p> <p>I have tried to disable chunking by removing the entry below from the ax...
<p>you can disable Chunking programatically as follows:</p> <p>Options options = new Options(); [...] options.setProperty(HTTPConstants.CHUNKED, "false");</p> <p>Source: <a href="http://jcesarperez.blogspot.com/2008/10/resolviendo-problemas-de.html" rel="noreferrer">http://jcesarperez.blogspot.com/2008/10/resolviendo...
<p>If you created a stub for your web service, just do this:</p> <p><code>myStub._getServiceClient().getOptions().setProperty(HTTPConstants.CHUNKED, false);</code></p>
34,170
<p>Is there a way to configure an assembly in GAC? I want to add a custom configuration to my assembly with System.Configuration.</p> <p>Mher</p>
<p>If I understand your question right, no, there is no way to do this.</p> <p>An assembly uses the configuration file of the application that loads it.</p>
<p>Depending on what scenario you are trying to achieve, you could include your App.config file as an embedded resource and when required extract to somewhere on disk and load using the advice given to <a href="https://stackoverflow.com/questions/163803/how-do-i-select-a-net-application-configuration-file-from-a-comman...
20,078
<p>Is there anyone using Subsonic with asp.net mvc framework? If so, can you tell us something about your experience. Are there tips and tricks that can be shared?</p>
<p>If you're planning on doing database first design, and you don't need any mapping (i.e. you're in control of your db naming) then SubSonic is a decent option.</p> <p>It's straight-forward, doesn't hide a lot from you. On the same token, for advanced scenarios I have to side-step it a lot and execute raw sql (or a ...
<p>I totally agree with Ben <em>SubSonic</em> is an <em>ORM</em> and works well with the MVC concept but doesn't have anything that ties it with <em>MVC</em>.</p> <p>For small projects or for projects that you already have a Database and don't really care to much about the domain then <em>SubSonic</em> is great and wi...
16,038
<p>How do I convert text between multi-byte text strings, for example Simplified Chinese GB 2312, into UTF8 using c++ ?</p>
<p>On unix systems you'd best use the iconv library.</p> <p>See <a href="http://www.manpagez.com/man/3/iconv_open/" rel="nofollow noreferrer">iconv_open</a>, <a href="http://www.manpagez.com/man/3/iconv/" rel="nofollow noreferrer">iconv</a>, <a href="http://www.manpagez.com/man/3/iconv_close/" rel="nofollow noreferrer...
<p>WinAPI: <a href="http://msdn.microsoft.com/en-us/library/ms776413(VS.85).aspx" rel="nofollow noreferrer">MultiByteToWideChar</a> and vice versa, <a href="http://msdn.microsoft.com/en-us/library/ms776420(VS.85).aspx" rel="nofollow noreferrer">WideCharToMultiByte</a>. I can post a sample later.</p> <p>However, UTF-8 ...
27,262
<p>Basically I have the following class:</p> <pre><code>class StateMachine { ... StateMethod stateA(); StateMethod stateB(); ... }; </code></pre> <p>The methods stateA() and stateB() should be able return pointers to stateA() and stateB(). How to typedef the StateMethod?</p>
<p><a href="http://www.gotw.ca/gotw/057.htm" rel="noreferrer">GotW #57</a> says to use a proxy class with an implicit conversion for this very purpose.</p> <pre><code>struct StateMethod; typedef StateMethod (StateMachine:: *FuncPtr)(); struct StateMethod { StateMethod( FuncPtr pp ) : p( pp ) { } operator FuncPtr(...
<p>I can never remember the horrible C++ function declspec, so whenever I have to find out the syntax that describes a member function, for example, I just induce an intentional compiler error which usually displays the correct syntax for me.</p> <p>So given:</p> <pre><code>class StateMachine { bool stateA(int s...
19,457
<p>I thought that I had the latest CTP of PowerShell 2 but when I try the command:</p> <p><code>invoke-expression –computername Server01 –command 'get-process PowerShell'</code></p> <p>I get an error message:<br> <strong>A parameter cannot be found that matches parameter name 'computername'.</strong></p> <p>So the q...
<p><code>$host.version.tostring()</code> will return the version number.</p> <p>RTM of v1 is 1.0.0.0</p> <p>Couldn't honestly tell you what the latest version of the previews are because I haven't had a chance to play yet.</p>
<p>I'm guessing that this is a change to the cmdlet made during the configuration process Configure-Wsman.ps1. I don't have an environment setup to test right now, but I'm guessing something went wrong with the configuration. I can verify that on XP the parameter is not available (duh). I'd assume that you will find...
3,352
<p>I'm building an open source project that uses python and c++ in Windows. I came to the following error message:</p> <pre><code> ImportError: No module named win32con </code></pre> <p>The same happened in a "prebuilt" code that it's working ( except in my computer :P ) </p> <p>I think this is kind of "popular" mo...
<p>This module contains constants related to Win32 programming. It is not part of the Python 2.6 release, but should be part of the download of the pywin32 project.</p> <p><strong>Edit:</strong> I imagine that the executable is an installation program, though the last time I downloaded pywin32 it was just a zip file....
<p>navigate to: C:\Python27\Lib\site-packages\win32\lib and copy the win32con.py file into your project directory.</p>
28,207
<p>What would be the best method to implement extra functionality in a database layer that uses Linq-to-SQL? Currently I'm looking at implementing functions for adding information based on presets and similar tasks?</p> <p>Inserts, updates and deletes requires access to the <code>DataContext</code> and in the <code>Ta...
<p>Entity classes in Linq to SQL are partial. You could extend them with the rules you need. </p> <p>Or you could build your own business entities from the Linq to SQL entities. Your business entities would then contain the rules on when to do what.</p>
<p>I hate to say it, but what about stored procedures? </p> <p>On my project, whatever extra functionality we want to provide we stick in a partial class. The data context class is marked partial, so you can add methods to the context without worrying about re-generating the context nuking your work. </p>
23,366
<p>I have a table with N rows, and I wanna select N-1 rows. </p> <p>Suggestions on how to do this in one query, if it's possible..?</p>
<p>Does the last row have the highest ID? If so, I think this would work:</p> <pre><code>SELECT * FROM TABLE WHERE ID != (SELECT MAX(ID) FROM TABLE) </code></pre> <p>MySQL does allow subselects in the current version, right?</p> <p>However, in most cases, it'd probably perform better if you selected all the rows and...
<p>Another way to do this could be:</p> <pre><code>SELECT * FROM table WHERE ID &lt;&gt; LAST_INSERT_ID() </code></pre> <p>Reference: <a href="http://dev.mysql.com/doc/refman/5.7/en/getting-unique-id.html" rel="nofollow">http://dev.mysql.com/doc/refman/5.7/en/getting-unique-id.html</a></p>
40,747
<p>The following SQL:</p> <pre><code>SELECT notes + 'SomeText' FROM NotesTable a </code></pre> <p>Give the error:</p> <blockquote> <p>The data types nvarchar and text are incompatible in the add operator.</p> </blockquote>
<p>The only way would be to convert your text field into an nvarchar field.</p> <pre><code>Select Cast(notes as nvarchar(4000)) + 'SomeText' From NotesTable a </code></pre> <p>Otherwise, I suggest doing the concatenation in your application.</p>
<p>If you are using SQL Server 2005 (or greater) you might want to consider switching to NVARCHAR(MAX) in your table definition; TEXT, NTEXT, and IMAGE data types of SQL Server 2000 will be deprecated in future versions of SQL Server. SQL Server 2005 provides backward compatibility to data types, but you should probabl...
7,795
<p>What tool or method do you recommend to find and replace values in your code? If code is on Linux/Unix, are find and grep the best method?</p>
<p>Take a look at <a href="http://petdance.com/ack/" rel="nofollow noreferrer">ack</a>, which is designed for searching big codebases.</p> <p>For replacing, look at Perl's -i, -p and -e flags. You can do stuff like:</p> <pre><code>$ perl -i -p -e's/\bthisword\b/thatword/g' $(find . -name *.html) </code></pre> <p>to...
<p>find and grep don't build indecies, so they're always going to be slower than alternatives that do. That said, they work fine if your codebase is only a few dozen files.in Fi</p> <p>Eclipse has a nice file search feature (Ctrl+H). It can also take language semantics into consideration if you have the right plugins ...
28,615
<p><strong>How can you make the experience with Eclipse faster?</strong> </p> <p>For instance: <em>I disable all the plugins I don't need (Mylyn, Subclipse, &hellip;).</em></p> <p>Instead of using a plugin for <a href="http://en.wikipedia.org/wiki/Mercurial" rel="noreferrer">Mercurial</a>, I configure <a href="https...
<p>The three most influential factors for Eclipse speed are:</p> <ul> <li>Using the <strong>latest version of Eclipse</strong> (2020-06 as on 26 June 2020)<br /> Note that <a href="https://stackoverflow.com/users/822870/david-bala%C5%BEic">David Balažic</a>'s <a href="https://stackoverflow.com/questions/316265/how-can-...
<p>There could be several things that could delay the start and exit of eclipse. One of them is like familiar to what we have a lookalike in Windows. Disabling the windows animations and disabling startup activities speeds up windows to certain extent</p> <p>Similar to what in eclipse we can have the same thing Window...
40,834
<p>What experience have you had with introducing a Ribbon style control to legacy MFC applications? </p> <p>I know it exists in the new VC2008 Feature Pack, but changing compilers from VC2005 is a big deal for our source base and integration to our environment, Intel FORTRAN, ClearCase, many 3rd libraries.</p> <p>The...
<p>In my projects I'm using the MFC Feature Pack in Visual Studio 2008, which is based on code from <a href="http://www.bcgsoft.com" rel="nofollow noreferrer">BCGSoft</a>. Their BCGControlBar Library Professional Edition includes a ribbon control and is compatible with Visual Studio 2005.</p> <p>I'm not aware of any o...
<p>We implemented a ribbon in our app due to pressure to have the latest/flashiest looking UI. It looks good, but the usability isn't good compared to using a plain toolbar!</p> <p>To adhere to Microsoft's License to use the ribbon, you have to stick to their guidlines on how it should be used. Eg.. only the user can ...
13,344
<p>I would like to be able to add a "message" to a unit test, such that it actually appears within the TestResult.xml file generated by NUnit. For example, this is currently generated:</p> <pre><code>&lt;results&gt; &lt;test-case name="MyNamespace.Tests.MyTest" executed="True" success="True" time="0.203" asserts=...
<p>This may be missing the point, but how about naming the tests so they indicate what they test - then you may not even need the message. </p> <p>If it proves to be absolutely necessary, I think you'll need to produce your own testrunner that would (off the top of my head) read an additional attribute off the TestCas...
<p>I can't see anything available at run time, but there are a couple of features that you might want to investigate: the <a href="http://www.nunit.org/index.php?p=description&amp;r=2.4.8" rel="nofollow noreferrer">Description</a> attribute and the <a href="http://www.nunit.org/index.php?p=property&amp;r=2.4.8" rel="no...
6,638
<p>I'm trying some of the ASP.NET MVC tutorials and one of them has the following steps:</p> <ul> <li>Right-click on the "App_Data" folder, and choose "Add New item"</li> <li>Choose "SQL Server Database" under the "Data" category.</li> </ul> <p>However, once I do that, I get the following message from Visual Studio:<...
<p>Actually SQL express is a whole different database engine then SQL Server 2005. So yes if you want to use mdf files you'd need SQL Express. </p>
<p>I have the same problem but I've sql 2008 express installed. any way to make it work with sql 2008 express so I don't have to install the 4th sql instance on my machine?? I already have sql 2005, sql 2008, sql 2008 express</p> <p>what the F... :)</p>
37,430
<p>I need to convert a value which is in a <code>DateTime</code> variable into a <code>varchar</code> variable formatted as <code>yyyy-mm-dd</code> format (without time part).</p> <p>How do I do that?</p>
<p>With Microsoft Sql Server:</p> <pre><code>-- -- Create test case -- DECLARE @myDateTime DATETIME SET @myDateTime = '2008-05-03' -- -- Convert string -- SELECT LEFT(CONVERT(VARCHAR, @myDateTime, 120), 10) </code></pre>
<p>You don't say what language but I am assuming <code>C#/.NET</code> because it has a native <code>DateTime</code> data type. In that case just convert it using the <code>ToString</code> method and use a format specifier such as:</p> <pre><code>DateTime d = DateTime.Today; string result = d.ToString("yyyy-MM-dd"); </...
10,001
<p>Sorry for the bad title, but I couldn't think of a better one.</p> <p>I'm having a class A and a class B which is kind of a sub class of A, like so:</p> <p>(Is there actually a correct name for it? Isn't "sub class" reserved for inheritance?)</p> <pre><code>class A { int i = 0; class B { int j = 1...
<p>There doesn't seem to be a way to access the outer class from outside. But you can do it like this:</p> <pre><code>class A { int i = 0; class B { final A outer = A.this; int j = 1; } } class Test { public static void main() { A a = new A(); A.B b = a.new B(); ...
<p>this seemed to work for me</p> <pre><code>class A { int i = 0; class B { int j = 1; } } class Test { public static void main() { A a = new A(); A.B b = a.new B(); A c = (A)b.getClass().getDeclaredField("this$0").get(b); } } </code></pre>
44,056
<p><a href="http://blogs.msdn.com/drnick/archive/2007/03/23/preventing-anonymous-access.aspx" rel="noreferrer">http://blogs.msdn.com/drnick/archive/2007/03/23/preventing-anonymous-access.aspx</a> </p> <p>Can someone clarify whether it is possible to use wsHttpBinding in WCF and disable anonymous access in IIS without ...
<p>you are right, afaik in the scenario you describe wsHttpBinding requires us to use the internal WCF security stack. So what you would typically do is</p> <ul> <li>leave anonymous access enabled</li> <li>create a serviceBehavior with &lt;serviceAuthorization principalPermissionMode="UseWindowsGroups" /&gt;</li> <li>...
<p>we want to use windows integrated security. If you disable anonymous access in IIS and allow just windows, you cannot seem to use wsHttpBinding with WCF without using some security mode (e.g. transprot security which requires ssl). </p> <p>We only want to use windows authentication we don't necessarily want to use ...
28,250
<p>I'm asking all of you who aren't using a library for this, but are constructing your own objects for managing data flowing to and from your database tables. Do I have a recordset object? one object per row of data? Both? Neither? Any suggestions or experiences welcome. Please don't tell me to use an ORM or other ...
<p>i'd strongly suggest picking up <a href="http://martinfowler.com/" rel="nofollow noreferrer">martin fowler</a>'s <a href="https://rads.stackoverflow.com/amzn/click/com/0321127420" rel="nofollow noreferrer" rel="nofollow noreferrer">patterns of enterprise application architecture</a>, it describes a number of databas...
<p>To manage the actual data flowing in and out of the database (without an ORM), you should look at Jakarta Commons DbUtils.</p> <p>It provides very light-weight helpers to run queries and updates, such as automatically turning ResultSets into Lists of beans and such.</p>
21,263
<p>In Moss 2007 you have the ability to set the target audience for each individual web part within a page. Is there a way to preview how the page will look to another user without logging in as that user? What I am looking for is a way for someone with full control/design permissions on a site to be able to preview ...
<p>Edit: After re-reading the question I released that you want the users to be able to preview a page. I think you will need to look into writing a preview control that uses Impersonation to load the page. Not sure how feasible this is, but surely someone has created a preview feature. Sounds like a pretty common ...
<p>First I don't think it is possible to have a preview feature if you are using NT security. Maybe it is something you can do with forms authentication but I never used it.</p> <p>On that subject. I think when you are developing new features or integrating stuff on a MOSS/WSS server you need a little flexibility.</p>...
18,600
<p>Is there any reason to avoid using <code>text-align: justify;</code>? </p> <p>Does it reduce readability or cause problems?</p>
<p>Firstly, this is purely a design-related problem and solution. The design of your grid specifies if justifying text is needed. I think justify align alone has no major effect on usability. Bad typography that makes text illegible is what decreases usability. That said, make sure you have solid contrasts and a good ...
<p>I think it is perfectly OK on print, but it is clunky on most Web browsers, by lack of fine control of spacing and hyphenation. Typographers can even play slightly on letter spacing or font contraction in some cases, as pages/columns (at least in magazines) can be finely tuned.</p>
40,782
<p>Is Occam-pi a good language to learn to program LEGO MINDSTORMS &amp; Surveyor Corporation SRV-1 robots for an programming newbie. Are there any opensource projects making use of the same -- to read source code. url for occam-pi :- <a href="http://www.transterpreter.org/" rel="nofollow noreferrer">http://www.transte...
<p>I have used the <a href="http://www.occam-pi.org" rel="nofollow noreferrer">occam-pi</a> on the <a href="http://www.transterpreter.org" rel="nofollow noreferrer">transterpreter</a> and it seems to do a good job. You may want to check this <a href="http://www.sububi.org/" rel="nofollow noreferrer">blog</a> out. It is...
<p>Probably not. It's a research language, so there won't be the support for what you want. sorry.</p> <p>The LEGO MINDSTORMS Education NXT Software is probably a better bet for a programming newbie. The SRV-1 is cool - but doesn't really have the supporting resources for beginners. </p> <p>Good luck!</p>
18,301
<p>In my page, I am displaying a report after the user selects some information. On a button <code>onclick</code> event, I am displaying an image which rotates itself to indicate to the user that the request is being processed. The image rotates in the Firefox but not in IE(it just displays the image). Please give me ...
<p>I'm guessing this is because your page has submitted a standard, synchronous request to the server and is waiting for the response. I've noticed that in certain versions of IE even an animated GIF will freeze up.</p> <p>You may want to change your server request to be asynchronous (a la AJAX). And one of the bene...
<p>Try opening that page on other machine.</p>
36,979
<p>Being new to test based development, this question has been bugging me. How much is too much? What should be tested, how should it be tested, and why should it be tested? The examples given are in C# with NUnit, but I assume the question itself is language agnostic.</p> <p>Here are two current examples of my own, t...
<p>I would say that what you're actually testing are equivalence classes. In my view, there is no difference between a adding to a list that has 3 items or 7 items. However, there is a difference between 0 items, 1 item and >1 items. I would probably have 3 tests each for Add/Remove methods for these cases initially...
<p>Is <code>_list</code> an instance of a class you wrote? If so, I'd say testing it is reasonable. Though in that case, why are you building a custom List class?</p> <p>If it's not code you wrote, don't test it unless you suspect it's in some way buggy.</p> <hr> <p>I try to test code that's independent and modular....
20,502
<p>I'm using <a href="http://urlrewriter.net/" rel="nofollow noreferrer">http://urlrewriter.net/</a> to rewrite urls at my website. For example, I'm rewriting:</p> <blockquote> <p><a href="http://www.example.com/schedule.aspx?state=ca" rel="nofollow noreferrer">http://www.example.com/schedule.aspx?state=ca</a></p> <...
<p>personally, I would 301 redirect from the un-rewritten one to the re-written one, and only use the single copy of the page. It is easier for users, and from an SEO perspective, you have 1 copy of the content.</p>
<p>I think that's the job of <a href="http://msdn.microsoft.com/en-us/library/system.web.httpcontext.items.aspx" rel="nofollow noreferrer">HttpContext.Current.Items</a>.</p> <p>You can save the "Redirection" in HttpContext.Current.Items and then in your pages, you can check it for a certain added value.</p> <p>I beli...
32,370
<p>I'm trying to change assembly binding (from one version to another) dynamically.</p> <p>I've tried this code but it doesn't work:</p> <pre><code> Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); ConfigurationSection assemblyBindingSection = config.Sections["...
<p>The best way I've found to dynamically bind to a different version of an assembly is to hook the <code>AppDomain.AssemblyResolve</code> event. This event is fired whenever the runtime is unable to locate the exact assembly that the application was linked against, and it allows you to provide another assembly, that y...
<p>RuntimeSection of the config file update at runtime using this code: </p> <pre><code>private void ModifyRuntimeAppConfig() { XmlDocument modifiedRuntimeSection = GetResource("Framework35Rebinding"); if(modifiedRuntimeSection != null) { Configuration config = ConfigurationManager.OpenExeConfiguration(C...
42,200
<p>Visual studio 2005 comes with a project that lets you use the asp.net membership provider to look up, add, edit, and delete users and roles. It unfortunaltly can't be used online, and in order to have an adminiistration area in your site, it appears that you have to code your own admin interface. </p> <p>Is there a...
<p>You might want to have a look at this project on codeplex <a href="http://www.codeplex.com/AspNetWSAT" rel="nofollow noreferrer">http://www.codeplex.com/AspNetWSAT</a>, which has an admin interface that you can use. I think there are a few other similar ones around too.</p>
<p>I am not aware of anything that is readily available, although I have a general solution that I have been considering packaging up and making available as a general freebie, but I've found that there isn't much demand as most of the time it is all specific implementations anyway.</p>
44,548
<p>I am a COM object written in ATL that is used from a C++ application, and I want to pass an array of BYTEs between the two. My experience of COM/IDL so far is limited to passing simple types (BSTRs, LONGs, etc.).</p> <p>Is there a relatively easy way to have the COM object pass an array to the caller? For example...
<p>Try passing a safearray variant to the COM Object. Something like this to put a BYTE array inside a safearray variant....</p> <pre><code>bool ArrayToVariant(CArray&lt;BYTE, BYTE&gt;&amp; array, VARIANT&amp; vtResult) { SAFEARRAY FAR* psarray; SAFEARRAYBOUND sabounds[1]; sabounds[0].lLbound=0; sabounds[0].cElemen...
<p>You can use BSTR to pass an array of bytes.</p> <pre><code>BYTE array[buffer_size]; ... BSTR toBePassed = SysAllocStringByteLen((OLECHAR*)array,length); YourCOMMethod(toBePassed); SysFreeString(toBePassed); </code></pre> <p>In your method:</p> <pre><code>BYTE* pData = (BYTE*)bstrPassed; DWORD dataLength = SysStri...
37,687
<p>I have two lists that are of the same length, is it possible to loop through these two lists at once?</p> <p>I am looking for the correct syntax to do the below</p> <pre><code>foreach itemA, itemB in ListA, ListB { Console.WriteLine(itemA.ToString()+","+itemB.ToString()); } </code></pre> <p>do you think this is...
<p>[edit]: to clarify; this is useful in the generic LINQ / <code>IEnumerable&lt;T&gt;</code> context, where you <strong>can't use</strong> an indexer, because a: it doesn't exist on an enumerable, and b: you can't guarantee that you can read the data more than once. Since the OP mentions lambdas, it occurs that LINQ m...
<p><a href="http://msmvps.com/blogs/senthil/default.aspx" rel="nofollow noreferrer">Senthil Kumar's tech blog</a>, has a series covering implementations of <strong>(Python) Itertools for C#</strong>, including <a href="http://docs.python.org/library/itertools.html#itertools.izip" rel="nofollow noreferrer"><code>itertoo...
30,008
<p>I need a way to check for Wi-Fi routers/access points on my DS homebrew. I'm using PAlib.</p>
<p>i used the code from ds_wifi_test (which comes with the original dswifi library) when i tried to implement this. Basically, access points are scanned internally when you invoke <code>Wifi_ScanMode()</code>. You can then have the number of AP identified with <code>Wifi_GetNumAP()</code> and retrieve the information f...
<p>If I were you, I'd steer clear of PALib. It's built atop an outdated version of libnds, and isn't updated with the new version in the interests of backwards-compatibility. Instead, take the time to learn libnds, and reap the benefits of a well-maintained library that doesn't have dependencies of its own. The same co...
27,285
<p>Coming from a background, I'm familiar with GUI editors that do a poor job of producing code. However, I've never written a GUI using .NET. Does the GUI editor in Visual Studio have the same problem(s)? Are both the source files and output GUI good?</p>
<p>The GUI editor in Visual Studio is probably the best I've used. Also, because C# supports <a href="http://msdn.microsoft.com/en-us/library/wa80x488(VS.80).aspx" rel="nofollow noreferrer">partial classes</a>, there is a clean separation between the IDE-generated code and your own.</p>
<p>Yes, for the most, you should use the GUI editor. Not that you won't have to work around it every now and again.</p> <p>Also it depends if you are talking WPF or Winforms.</p> <p>Winforms I'd use it almost the majority of the time. WPF, I'd hand roll a lot of it and occassionally use blend or something to do some...
23,006
<p>What does the following code do? A link to something in the PHP manual would also be nice.</p> <pre><code>if ($_SERVER['SERVER_PORT'] &lt;&gt; 443) { doSomething(); } </code></pre>
<p>Same as !=, "Not equal"</p> <pre><code>false &lt;&gt; true // operator will evaluate expression as true false != true // operator will evaluate expression as true </code></pre> <p>Here is some reference: <a href="http://www.php.net/operators.comparison" rel="noreferrer">PHP Comparison Operators</a></p>
<p><code>$_SERVER['SERVER_PORT']</code> gets the port used by the web server to serve HTTP requests. <code>$_SERVER['SERVER_PORT'] &lt;&gt; 443</code> checks if the port is not equal to 443 (the default HTTPS port) and if not, invokes <code>doSomething()</code> </p>
30,990
<p>I just got a new Ender3 version two for Christmas and was very excited to use it so I put it together and used the sample filament that came with the printer and everything worked okay for a bit.</p> <p>That was until I switched something in the settings, or in Cura, or something happened, because the nozzle is too ...
<p>This is probably caused by too few top layers in combination with a too low infill percentage. Increase skin layers and increase infill percentage.</p> <p>If you have multiple layers already (at least about 4 for 0.2 mm layer height, for smaller layer heights even more), you might be printing at a too high temperatu...
<p>To combat the bad top layers, I usually use usually 5 top layers for any model of layer height 0.1 to 0.3 mm. I generally don't print with less than 9 % infill for PLA, which I have found sufficient to support even complex geometry on top.</p> <p>Also, I generally use a mixed setup of layers: the outermost layers I ...
1,814
<p>If we are writing about power-wise option - is using a console-based application in C#(.NET) better than having Windows GUI and what's the real difference expept few libraries loaded in operational memory?</p> <p>The issue is about text comparisons and working with strings, connecting to Internet, gathering data, ...
<p>From your description it seems that you want to write an HTML scraping software or some kind of web spider. I think your decision whether to write a GUI or a command line application should depend on who (users) or which other software components will use or integrate your program.</p> <p>If there is no user intera...
<p>There is no difference in what you can do with the things you mentioned (strings, internet, database). The difference between console and GUI apps is solely in how you interact with the user. Everything else is the same.</p> <p>If you meant power consumption instead, then I'm afraid I misunderstood your question.</...
26,404
<p>I have been reading through the <a href="http://yosefk.com/c++fqa/" rel="noreferrer">C++ FAQ</a> and was curious about the <a href="http://yosefk.com/c++fqa/friend.html" rel="noreferrer"><code>friend</code></a> declaration. I personally have never used it, however I am interested in exploring the language. </p> <p>...
<p>Firstly (IMO) don't listen to people who say <code>friend</code> is not useful. It IS useful. In many situations you will have objects with data or functionality that are not intended to be publicly available. This is particularly true of large codebases with many authors who may only be superficially familiar with ...
<p>Friends are also useful for callbacks. You could implement callbacks as static methods</p> <pre><code>class MyFoo { private: static void callback(void * data, void * clientData); void localCallback(); ... }; </code></pre> <p>where <code>callback</code> calls <code>localCallback</code> internally, and t...
3,809
<p>I have done this on Websphere (re: title of this topic) using wsdl2java for generating wsdl to java mapping xml file. My endpoint is a generic stateless EJB. The code in EJB is generated by traversing the each wsdl and getting the wsdl operation and stuck it in the generated remote EJB interface. Each EJB method imp...
<p>You want to create a WS client which runs under Sun AS? I don't know Sun AS in detail and I don't know the WS libraries it supplies. But you may want to use a public WS library:</p> <ul> <li><a href="http://ws.apache.org/axis2/" rel="nofollow noreferrer">Apache Axis 2</a></li> <li><a href="http://cxf.apache.org/" r...
<p>I've never used it myself, but I just recently read about the <code>wsdlLocation()</code> attribute of the <code>WebService</code> annotation, which is supposed to map the service to a preexisting WSDL document (not sure if you're even using EJB3, though).</p>
38,422
<p>I have a few 'helper' style extension methods I use quite regularly now <em>(they are mostly quite simple, intuitive, and work for good not evil, so please don't have this descend into a discussion around whether or not I should use them).</em> They are largely extending core .NET CLR classes.</p> <p>Currently, I h...
<p>If you don't want to create a whole project just for the extension methods, you can link the same file into separate projects without copying the file:</p> <ol> <li>In Solution Explorer, select the target project. </li> <li>Select the Project menu. </li> <li>Select Add Existing Item. </li> <li>In the Add Existing I...
<p>Several answers suggests that someone would put the extension functions into a common assembly. Which is the right answer. But there's a weird thing for beginners: the IntelliSense couldn't help well enough. Let's say I extended the <code>ObservableCollection</code> with a <code>ReplaceRange</code> function / method...
19,434
<p>Despite the documentation, NetworkStream.Write does not appear to wait until the data has been sent. Instead, it waits until the data has been copied to a buffer and then returns. That buffer is transmitted in the background.</p> <p>This is the code I have at the moment. Whether I use ns.Write or ns.BeginWrite does...
<p>I'm not a C# programmer, but the way you've asked this question is slightly misleading. The only way to know when your data has been "received", for any useful definition of "received", is to have a specific acknowledgment message in your protocol which indicates the data has been fully processed.</p> <p>The data ...
<p>Perhaps try setting <code>tcp.NoDelay = true</code></p>
9,332
<p>.NET throws an exception trying to parse a datetime string in this format:</p> <p><strong>Fri, 10 Oct 2008 00:05:51 CST</strong> </p> <p>Convert.ToDateTime("Fri, 10 Oct 2008 00:05:51 CST") results in an exception:</p> <blockquote> <p>The string was not recognized as a valid DateTime. There is a unknown word...
<p><a href="http://msdn.microsoft.com/en-us/library/ey1cdcx8.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ey1cdcx8.aspx</a></p> <p>You need to use the overloaded DateTime.Parse to accurately parse timezones.</p>
<p>If a specific date and time format will be parsed across different locales, use one of the overloads of the ParseExact method and provide a format specifier. </p>
23,469
<p>I have looked on FaceBook Developer page and found that it's possible to create a FaceBook application, however this application must be hosted by you!</p> <p>I'm new, does any one have an experience on that?</p>
<p>I don't really see a question. Surely a lot developers created such an application (see all the available apps in facebook).</p> <p>I personally tried it once. And yes, you need a place to publish your aplication (webserver)...</p> <p>Some help to start: <a href="https://developers.facebook.com/docs/" rel="nofollo...
<p>You don't have to host your application. <a href="http://joyent.com/developers/facebook" rel="nofollow noreferrer">Here's a company that will host your Facebook application for free for one year.</a></p>
40,250
<p>I run a subprocess using:</p> <pre><code> p = subprocess.Popen("subprocess", stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE) </code></pre> <p>This subprocess could either exit immediately with an error on stderr, or kee...
<p>Have you tried using the Popen.Poll() method. You could just do this:</p> <pre><code>p = subprocess.Popen("subprocess", stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE) time.sleep(SECONDS_TO_WAIT) retcode = p.poll() if retcode is not...
<p>This is a paraphrase on Evan's answer, but it takes into account the following :</p> <ol> <li>Explicitly canceling the Timer object : if the Timer interval would be long and the process will exit by its "own will" , this could hang your script :(</li> <li><p>There is an intrinsic race in the Timer approach (the tim...
43,850
<p>Is there a regular expression which checks if a string contains only upper and lowercase letters, numbers, and underscores?</p>
<p>To match a string that contains <em>only</em> those characters (or an empty string), try</p> <pre class="lang-none prettyprint-override"><code>&quot;^[a-zA-Z0-9_]*$&quot; </code></pre> <p>This works for .NET regular expressions, and probably a lot of other languages as well.</p> <p>Breaking it down:</p> <pre class="...
<h3>Required Format</h3> <p>Allow these three:</p> <ol> <li>0142171547295</li> <li>014-2171547295</li> <li>123abc</li> </ol> <p>Don't allow other formats:</p> <pre class="lang-js prettyprint-override"><code>validatePnrAndTicketNumber(){ let alphaNumericRegex=/^[a-zA-Z0-9]*$/; let numericRegex=/^[0-9]*$/; le...
43,614
<p>I am wanting to store the "state" of some actions the user is performing in a series of different ASP.Net webforms. What are my choices for persisting state, and what are the pros/cons of each solution?</p> <p>I have been using Session objects, and using some helper methods to strongly type the objects:</p> <pre>...
<p>There is nothing inherently evil with session state.</p> <p>There are a couple of things to keep in mind that might bite you though:</p> <ol> <li>If the user presses the browser back button you go back to the previous page but your session state is not reverted. So your CurrentAccount might not be what it original...
<p>Short term information, that only needs to live until the next request, can also be stored in the <code>ViewState</code>. This means that objects are serialized and stored in the page sent to the browser, which is then posted back to the server on a click event or similar. Then the <code>ViewState</code> is decoded ...
16,130
<p>Is it possible to use <a href="http://www.python.org/" rel="nofollow noreferrer">CPython</a> to develop Adobe Flash based applications?</p>
<p>You can try <a href="http://www.libming.org/" rel="nofollow noreferrer">ming</a>, a library for generating Macromedia Flash files (.swf).</p> <p>It's written in C but it has wrappers that allow it to be used in C++, PHP, Python, Ruby, and Perl. </p>
<p>I guess it would be possible to compile the python interpreter to flash bytecode using this <a href="http://labs.adobe.com/downloads/alchemy.html" rel="nofollow noreferrer">http://labs.adobe.com/downloads/alchemy.html</a> and then use it to run python programs. But apart from that the answer is no.</p>
39,177
<p>I have the following snippet of code, changeTextArea is a TextArea object.</p> <pre><code>changeTextArea.addKeyboardListener(new KeyboardListenerAdapter() public void onKeyPress( Widget sender, char keyCode, int modifier){ //do something //I WISH TO STOP THE EVENT THAT MAPS TO THIS KEYPRESS FROM BUBBLING ...
<p>As far as I know you can't do it via a keyboard listener, but it is possible by adding an event preview using the DOM class:</p> <pre><code>DOM.addEventPreview(EventPreview preview) </code></pre> <p>Then when you get the event:</p> <pre><code>onEventPreview(Event event) </code></pre> <p>You should return false...
<p>you could reach it when possible by doing <code>event.doit = false</code></p>
26,340
<p>I am wanting to buy a 3D printer to add to my shop.</p> <p>I am an engineer and enjoy making/building things so the kit idea sounds fun and economical.</p> <p>I see Tronxy has two different styles for their larger printers:</p> <ul> <li>P802 (reprap frame) style</li> <li>X3 (metal frame) style.</li> </ul> <p>As ...
<p>You can not tell this by looking at the STL file alone, because how much material will be used depends on the print settings (obviously, printing at 100% infill will consume much more material than 10%).</p> <p>The best way to check the material usage is to load the model into a slicer and slice it using your prefe...
<p>This is a link I found that analyzes your G-code ( filament usage, time, etc.): <a href="http://gcode.ws/" rel="nofollow noreferrer">gCodeViewer</a></p> <p>From the description (emphasis is mine):</p> <blockquote> <ul> <li>Analyze GCode <ul> <li>Print time, <strong><em>amount of plastic used</em></stron...
549
<p>I'm using <a href="http://www.codeplex.com/bizunit" rel="noreferrer" title="BizUnit">BizUnit</a> to unit-tests my Biztalk orchestrations, but some orchestrations consume a WebService,and testing these seems more like integration testing than unit testing.</p> <p>I'm familiar with using a mocking framework to mock t...
<p>This goes to the heart of one of my main irritations as a BizTalk developer - BizTalk does not lend it self to unit testing. From the fact the 99% of your interfaces into BizTalk applications are message based and have a huge number of possible inputs, through to the opaque nature of orchestrations, BizTalk offers n...
<p>I haven't had to do this in a while, but when I would test my Biztalk Apps I always used either soap ui or web service studio. I was able to test different input values without effort. </p>
32,051
<p>Delphi has a $WARN compiler directive that allows one to selectively enable or disable specific warnings. The Delphi 2009 help file describes the syntax:</p> <pre><code>{$WARN identifier ON|OFF} </code></pre> <p>But it only lists the identifiers for 6 warnings.</p> <p>I'd like to have a complete list of all the ...
<p>I looked through the help and didn't see a full list...so poking around the code it appears the compiler warning constants are all listed in: CodeGear\RAD Studio\6.0\sources\toolsapi\DCCStrs.pas</p> <p>Search for "Implicit_String_Cast_Loss" and you'll see the constant sIMPLICIT_STRING_CAST_LOSS = 'DCC_IMPLICIT_STR...
<p>If you press <em>Ctrl+O</em> twice it will add all the compiler directives to the top of the unit including all the warnings. Find the one you want and delete the rest.</p>
49,329
<p>I have several strings in the rough form:</p> <pre><code>[some text] [some number] [some more text] </code></pre> <p>I want to extract the text in [some number] using the Java Regex classes.</p> <p>I know roughly what regular expression I want to use (though all suggestions are welcome). What I'm really intereste...
<p>Full example:</p> <pre><code>private static final Pattern p = Pattern.compile("^([a-zA-Z]+)([0-9]+)(.*)"); public static void main(String[] args) { // create matcher for pattern p and given string Matcher m = p.matcher("Testing123Testing"); // if an occurrence if a pattern was found in a given string.....
<p>if you are reading from file then this can help you</p> <pre><code> try{ InputStream inputStream = (InputStream) mnpMainBean.getUploadedBulk().getInputStream(); BufferedReader br = new BufferedReader(new InputStreamReader(inputStream)); String line; /...
29,328
<p>I've been wanting to become proficient in a new language for a while. There are a few languages I want to learn but it's pretty important for me to be able to create a (Application) GUI. I work in C# so I have become very accustom to the GUI designer. </p> <p>I would love to get better with C++ or Java (both of whi...
<p>I would recommend you to look at Delphi. It's object pascal with a nice IDE and a nice community!</p> <p>Take a look at <a href="http://www.codegear.com" rel="nofollow noreferrer">www.codegear.com</a></p> <p>CodeGear have also a C++ IDE, so you can have the bundle and put your hand dirty at Delphi and C++!</p> <p...
<p>Netbeans IDE for Java as a sweet GUI designer.</p>
19,291
<p>I have fname and lname in my database, and a name could be stored as JOHN DOE or john DOE or JoHN dOE, but ultimately I want to display it as John Doe</p> <p>fname being John and lname being Doe</p>
<p>seeing it is tagged PHP:<br> either </p> <blockquote> <p><code>string ucfirst ( string $str );</code> </p> </blockquote> <p>to uppercase first letter of the first word </p> <p>or </p> <blockquote> <p><code>string ucwords ( string $str );</code> </p> </blockquote> <p>to uppercase the first letter of...
<p>Change the names to lower and then add ('A' - 'a') to the first letter of fname &amp; lname.</p>
22,077
<p>I'm trying to read a single XML document from stream at a time using dom4j, process it, then proceed to the next document on the stream. Unfortunately, dom4j's SAXReader (using JAXP under the covers) keeps reading and chokes on the following document element.</p> <p>Is there a way to get the SAXReader to stop read...
<p>I was able to get this to work with some gymnastics using some internal JAXP classes:</p> <ul> <li>Create a custom scanner, a subclass of XMLNSDocumentScannerImpl <ul> <li>Create a custom driver, an implementation of XMLNSDocumentScannerImpl.Driver, inside the custom scanner that returns END_DOCUMENT when it sees ...
<p>Most likely, you don't want to have more than one document in the same stream at the same time. I don't think that the SAXReader is smart enough to stop when it gets to the end of the first document. Why is it necessary to have multiple documents in the same stream like this?</p>
27,953
<p>There is a conversion process that is needed when migrating Visual Studio 2005 web site to Visual Studio 2008 web application projects.</p> <p>It looks like VS2008 is creating a .designer. file for every aspx when you right click on a file or the project itself in Solution Explorer and select 'Convert to Web Applic...
<p>They hold all the form designer stuff that used to go in the #Region " Web Form Designer Generated Code " section of the code. instead of putting it in the .aspx.vb file where people might edit it (mistakenly or not), it's been moved to a separate file, so that you don't have ever look at it.</p>
<p>What kibbee said. </p> <p>For the part of your question about existing on a release build, it depends on what kind of web site you have. If you have a pre-compiled web site, then <em>none</em> of code files (.vb, .cs, etc) need to be deployed the server. They are compiled into .dlls (assemblies) and deployed tha...
4,811
<p>Just wondering where is best to put functionality in an MFC application that is triggered when the whole window is resized. I was thinking mainfrm but I couldn't seem to capture any OnSize messages... </p> <p>Can someone tell me what I am doing wrong?</p>
<blockquote> <p>Can someone tell me what I am doing wrong?</p> </blockquote> <p>You didn't include any interesting details, so here are a few guesses (because <em>of course</em> the mainframe normally gets sent <code>WM_SIZE</code> messages...):</p> <ul> <li>You didn't set up your message handler properly. Perhaps ...
<p>I am guessing that you are using the Multiple Document Interface ( MDI ) application type. In this case, you should capture the WM_SIZE message in each of your views - the classes you have derived from CView.</p>
32,780
<p>I have never quite understood how/why I would use Maven modules (reactor builds).</p> <p>We have tens of libraries that we share (as dependencies) among our products, and between libraries as well. If we were to switch to making them Maven modules, how would we set it up, both in SVN and in our working copies?</p>...
<p>No ... a modular project should only be used when the child project is integrated into the parent to create a larger artifact, so an example might be an Enterprise project, where your modules contain the EJB (server and client), the WAR, and then those are combined into an EAR file. This modularity is only for conv...
<p>No ... a modular project should only be used when the child project is integrated into the parent to create a larger artifact, so an example might be an Enterprise project, where your modules contain the EJB (server and client), the WAR, and then those are combined into an EAR file. This modularity is only for conv...
20,106
<p>I have a system (Ubuntu) with many processes and one (or more) have a memory leak. Is there a good way to find the process that has the leak? Some of the process are JVMs, some are not. Some are home grown some are open source.</p>
<p>You can run the <code>top</code> command (to run non-interactively, type <code>top -b -n 1</code>). To see applications which are leaking memory, look at the following columns:</p> <ul> <li>RPRVT - resident private address space size</li> <li>RSHRD - resident shared address space size</li> <li>RSIZE - resident mem...
<p>Difficult task. I would normally suggest to grab a debugger/memory profiler like <a href="http://valgrind.org/" rel="nofollow noreferrer">Valgrind</a> and run the programs one after one in it. Soon or later you will find the program that leaks and can tell it the devloper or fix it yourself.</p>
17,350