instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>I have two tables: a source table and a target table. The target table will have a subset of the columns of the source table. I need to update a single column in the target table by joining with the source table based on another column. The update statement is as follows:</p> <pre><code>UPDATE target_table tt SE...
<p>Your initial query executes the inner subquery once for every row in the outer table. See if Oracle likes this better:</p> <pre><code>UPDATE target_table SET special_id = st.source_special_id FROM target_table tt INNER JOIN source_table st WHERE tt.another_id = st.another_id </code></pre> <p...
<p>Not sure what Oracle has available, but MS Sql Server has a tuning advisor that you can feed your queries into and it will give recommendation for adding indexes, etc... I would assume Oracle has something similar.</p> <p>That would be the quickest way to pinpoint the issue.</p>
40,546
<p>I have been using git to keep two copies of my project in sync, one is my local box, the other the test server. This is an issue which occurs when I log onto our remote development server using ssh;</p> <pre><code>git clone me@me.mydevbox.com:/home/chris/myproject Initialized empty Git repository in /tmp/myproject/...
<p>Make sure <code>git-upload-pack</code> is on the path from a non-login shell. (On my machine it's in <code>/usr/bin</code>).</p> <p>To see what your path looks like on the remote machine from a non-login shell, try this:</p> <pre><code>ssh you@remotemachine echo \$PATH </code></pre> <p>(That works in Bash, Zsh, a...
<p>For zsh you need to put it in this file: ~/.zshenv</p> <p>For example, on OS X using the git-core package from MacPorts:</p> <p>$ echo 'export PATH=/opt/local/sbin:/opt/local/bin:$PATH' > ~/.zshenv</p>
27,846
<p>How would it be possible to capture the audio programmatically? I am implementing an application that streams in real time the desktop on the network. The video part is finished. I need to implement the audio part. I need a way to get PCM data from the sound card to feed to my encoder (implemented using Windows Medi...
<p>I don't think there is a direct way to do this using the OS - it's a feature that may (or may not) be present on the sound card. Some sound cards have a loopback interface - Creative calls it "What U Hear". You simply select this as the input rather than the microphone, and record from it using the normal waveInOp...
<p>I don't think there is a direct way to do this using the OS - it's a feature that may (or may not) be present on the sound card. Some sound cards have a loopback interface - Creative calls it "What U Hear". You simply select this as the input rather than the microphone, and record from it using the normal waveInOp...
13,681
<p>I need to create an API that will allow my customer's developers to use a proprietary C module that will be released as a library (think <code>.lib</code> or <code>.so</code> -- not source).</p> <p>I'd like to make the header as developer-friendly as possible (so I won't need to be), following best practices and pr...
<p>The header file itself should be clean and tidy and probably close to minimal. It should point to where the documentation can be found. It probably shouldn't include complete examples (notwithstanding some of my own headers that do that). It should include basic information about the copyright and licence and aut...
<p>Consider putting the docs online, in addition to whatever ships, and put the URL in the header. This will allow some maintenance programmer, several years down the road, access to the docs, even if the originals have been lost.</p>
34,904
<p>I'm developing multi-language support for our web app. We're using <a href="http://docs.djangoproject.com/en/dev/topics/i18n/" rel="noreferrer">Django's helpers</a> around the <a href="http://en.wikipedia.org/wiki/Gettext" rel="noreferrer">gettext</a> library. Everything has been surprisingly easy, except for the qu...
<p>2, with a potential twist.</p> <p>You certainly could localize the whole string, like:</p> <pre><code>loginLink=Please &lt;a href="/login"&gt;log in&lt;/a&gt; to continue </code></pre> <p>However, depending on your tooling and your localization group, they might prefer for you to do something like:</p> <pre><cod...
<ol> <li>Makes no sense, how would you translate "log in"?</li> <li>I don't think many translators have experience with HTML (the regular non-HTML-aware translators would be cheaper)</li> <li>I would go with option 3, or use "Please %slog in%s to continue" and replace the %s with parts of the link.</li> </ol>
34,501
<p>I have a control that, upon postback, saves form results back to the database. It populates the values to be saved by iterating through the querystring. So, for the following SQL statement (vastly simplified for the sake of discussion)...</p> <pre><code>UPDATE MyTable SET MyVal1 = @val1, MyVal2 = @val2 WHERE @i...
<p>First of all, I would suggest against adding all entries on the querystring as parameter names, I'm not sure this is unsafe, but I wouldn't take that chance.</p> <p>The problem is you're calling</p> <pre><code>Command.Parameters.AddWithValue("@val2", null) </code></pre> <p>Instead of this you should be calling:</...
<p>Update: The solution I gave is based on the assumption that it is a stored proc. <em>Will giving a default value of Null to the SQL Stored proc parameters work?</em></p> <p>If it is dynamic sql, always pass the correct number of params, whether it is null or the actual value or specify default values.</p>
9,130
<p>I understand that they are both supposed to be small, but what are the key differences between the two?</p>
<p><strong>Exokernel</strong> is an <strong>operating system from MIT</strong> (and a class of it's variants) which handles relatively little hardware abstraction. In exokernel, the low-level responsibilities of controlling hardware (particularly <strong>memory allocation</strong>) are often left in the hands of the d...
<p>I found one link which is really very helpful for differentiating monolithic micro and exokernels. link is--- <a href="http://www.scribd.com/doc/174682128/Difference-between-monolithic-microkernel-and-exokernel" rel="nofollow">http://www.scribd.com/doc/174682128/Difference-between-monolithic-microkernel-and-exokerne...
20,774
<p>I'm starting up a personal project to develop some open source software. I want to use Scrum as the PM process on this (as I like the Product Backlog, prioritisation, and if I can get them, the burndowns) but it seems to me that I won't get the full value because I can't at the outset guarantee the amount of time ...
<p>As this is a hobby project, are you actually concerned about deadlines? How much value would it in fact give you to know how much will be done after a Sprint?</p> <p>If your answers are no, you might want to look at a kanban approach as an alternative.</p>
<p>In a by the book setting you won't use real time for calculation of the burndown chart but rather story points. After a few sprint you will see an average velocity and thus be able to generate a burndown chart and use this velocity for commiting to the sprint items.</p> <p>And I strongly disagree with <a href="http...
39,706
<p>I'm using a vendor API to obtain a JDBC connection to the application's database. The API works when running in the application server or when running in a stand-alone mode. I want to run a series of SQL statements in a single transaction. I'm fine with them occurring in the context of the JTA transaction if it exis...
<p>Even if it's straight JDBC, you can have a JTA transaction enabled. Checking the autoCommit flag will NOT help in this regard. You can be in a transaction, distributed or otherwise, with autoCommit set to false. autoCommit set to true would tell you you're not in a distributed transaction but a value of false just m...
<p><strike>You could try to check the Connection's autoCommit flag to see if it is in a transaction (regardless of where it came from). </strike> (Apparently, see the accepted answer, this does not work too well. I am not deleting this answer because the following still stands: )</p> <p>But I think you should really m...
21,800
<p>I use TFS 2008. We run unit tests as part of our continuous integration build and integration tests nightly.</p> <p>What other types of testing do you automate and include in your build process? what technologies do you use to do so? </p> <p>I'm thinking about smoke tests, performance tests, load tests but don'...
<p>First, we have check-in (smoke) tests that must run before code can be checked in. It's done automatically by running a job that runs the tests and then makes the check-in to source control upon successful test completion. Second, cruise control kicks off build and regression tests. The product is built then several...
<p>Integrating load testing during you build process is a bad idea, just do your normal unit testing to make sure that all your codes work as expected. Load and performance testing should be done separately.</p>
5,451
<p>I've got my Rails (2.1) app setup to send email via Gmail, however whenever I send an email no matter what I set the from address to in my ActionMailer the emails always come as if sent from my Gmail email address. Is this a security restriction they've put in place at Gmail to stop spammers using their SMTP?</p> <...
<p>I believe it's just something Gmail does when mail is sent through its SMTP, as it was mentioned that they do this on a tutorial about using their SMTP to send mail.</p>
<p>This is most likely to stop people trying to send email from addresses that Google can't verify that the sender owns. This is fairly common amongst mail providers, and is probably a safeguard to stop people using Google's services for sending spam.</p>
13,479
<p>We have 50+ Java batch processes that run at different times of the day. They run on a Solaris box, and are started via cron. Currently, the only way we only know if they succeed or fail is by an email generated at the end of each batch process. We have a support team that monitors these emails. Recently, we've ...
<p>Is there currently some batch management system in-place? Or are the jobs run through the OS scheduler? (ie, Windows <code>Schedule Tasks</code> or *nix <code>cron</code>)</p> <p><a href="http://www.opensymphony.com/quartz" rel="nofollow noreferrer">Quartz</a> is an Open Source (Apache License) java-based job sche...
<p>There must be a way to use Nagios to see if daily tasks have run successfully, given that it can monitor things in so many different ways (from PID files to text files being present, to trawling log files, etc). Sadly Nagios isn't in my line of work so I can't go further.</p>
37,833
<p>In Bash, how do I count the number of non-blank lines of code in a project?</p>
<pre><code>cat foo.c | sed '/^\s*$/d' | wc -l </code></pre> <p>And if you consider comments blank lines:</p> <pre><code>cat foo.pl | sed '/^\s*#/d;/^\s*$/d' | wc -l </code></pre> <p>Although, that's language dependent. </p>
<p>There's already a program for this on linux called 'wc'.</p> <p>Just</p> <pre><code>wc -l *.c </code></pre> <p>and it gives you the total lines and the lines for each file.</p>
14,010
<p>I want to receive the following <code>HTTP</code> request in <code>PHP:</code></p> <pre><code>Content-type: multipart/form-data;boundary=main_boundary --main_boundary Content-type: text/xml &lt;?xml version='1.0'?&gt; &lt;content&gt; Some content goes here &lt;/content&gt; --main_boundary Content-type: multipart/...
<p><code>$HTTP_GET_VARS</code>, <code>$HTTP_POST_VARS</code>, etc. is an obsolete notation, you should be using <code>$_GET</code>, <code>$_POST</code>, etc.</p> <p>Now, the file contents should be in the <code>$_FILES</code> global array, whereas, if there are no element names, I'm not sure about whether the rest of ...
<p>Uploadeds files will be accessible through the $_FILE global variable, other parameters will be accessible trough the $_GET global variable.</p>
12,609
<p>For a WPF application which will need 10 - 20 small icons and images for illustrative purposes, is storing these in the assembly as embedded resources the right way to go?</p> <p>If so, how do I specify in XAML that an Image control should load the image from an embedded resource?</p>
<p>If you will use the image in multiple places, then it's worth loading the image data only once into memory and then sharing it between all <code>Image</code> elements.</p> <p>To do this, create a <a href="http://msdn.microsoft.com/en-us/library/system.windows.media.imaging.bitmapsource.aspx" rel="noreferrer"><code>...
<p>The following worked and the images to be set is resources in properties:</p> <pre><code> var bitmapSource = Imaging.CreateBitmapSourceFromHBitmap(MyProject.Properties.Resources.myImage.GetHbitmap(), IntPtr.Zero, Int32Rect.Empty, ...
45,237
<p>I am using this command:</p> <p>cut -d: -f2 <p>To sort and reedit text, Is there a more efficient way to do this without using sed or awk?</p> <p>I would also like to know how I would append a period to the end of each field</p> <p>At the moment the output is like $x['s'] and I would like it to be $x['s'] .</p>...
<p><strong>Short answer:</strong> not really</p> <p><strong>Longer answer:</strong> <code>cut</code> is intended for slicing up lines of text, it does that well. If you need a more complicated behavior, you'll need a text manipulation language. You have rejected the old time answers, so I'll recommend <code>perl</cod...
<blockquote> <p>edit: I just wanted to know if it was possible without sed or awk, otherwise how would you do it with awk?</p> </blockquote> <p>awk -F: '{print $2"."}'</p>
32,302
<p>There are several ways to iterate over a result set. What are the tradeoff of each?</p>
<p>The canonical way is to use the built-in cursor iterator.</p> <pre><code>curs.execute('select * from people') for row in curs: print row </code></pre> <hr> <p>You can use <code>fetchall()</code> to get all rows at once.</p> <pre><code>for row in curs.fetchall(): print row </code></pre> <p>It can be conv...
<p>There's also the way <code>psyco-pg</code> seems to do it... From what I gather, it seems to create dictionary-like row-proxies to map key lookup into the memory block returned by the query. In that case, fetching the whole answer and working with a similar proxy-factory over the rows seems like useful idea. Come to...
2,301
<p>My client gets a <code>sec_error_unknown_issuer</code> error message when visiting <a href="https://mediant.ipmail.nl" rel="noreferrer">https://mediant.ipmail.nl</a> with Firefox. I can't reproduce the error myself. I installed FF on a Vista and a XP machine and had no problems. FF on Ubuntu also works fine.</p> <p...
<p>Just had the same problem with a Comodo Wildcard SSL cert. After reading the docs the solution is to ensure you include the certificate chain file they send you in your config i.e.</p> <pre><code>SSLCertificateChainFile /etc/ssl/crt/yourSERVERNAME.ca-bundle </code></pre> <p>Full details on <a href="https://support...
<p>I've being going round in circles with Firefox 43, El Capitan and WHM/cPanel SSL installation continually getting the Untrusted site error - I didn't buy the certificate it was handed over to me to install as the last guy walked out the door. Turns out I was installing under the wrong domain because I missed off the...
34,774
<p>In .NET is there a way to enable Assembly.Load tracing? I know while running under the debugger it gives you a nice message like "Loaded 'assembly X'" but I want to get a log of the assembly loads of my running application outside the debugger, preferably intermingled with my Debug/Trace log messages. </p> <p>I'm t...
<p>Get the AppDomain for your application and attach to the AssemblyLoad event.</p> <p>Example (C#): </p> <pre><code>AppDomain.CurrentDomain.AssemblyLoad += new AssemblyLoadEventHandler(OnAssemblyLoad); </code></pre>
<p>Fusion Log Viewer is your friend.</p> <p>[edit] Actually this might be too over the top, the AssemblyResolve event is good too[edit]</p>
19,462
<p>I've seen a lot of commonality in regex capabilities of different regex-enabled tools/languages (e.g. perl, sed, java, vim, etc), but I've also many differences.</p> <p>Is there a <em>standard</em> subset of regex capabilities that all regex-enabled tools/languages will support? How do regex capabilities vary betwe...
<p>Compare Regular Expression Flavors</p> <p><a href="http://www.regular-expressions.info/refflavors.html" rel="noreferrer">http://www.regular-expressions.info/refflavors.html</a></p>
<p>There's no standard engine. However, the POSIX Extended Regular Expression format is a valid subset of most engines and is probably as close as you'll get to a standardised subset.</p>
4,987
<p>do I have to register the HttpVerb constraint in my route definition (when i'm registering routes) if i have decorated my action method with the [AcceptVerbs(..)] attribute already?</p> <p>eg. i have this.</p> <pre><code>[AcceptVerbs(HttpVerbs.Post)] public ActionResult Create(FormCollection formCollection) { .. }...
<p>The difference between the two is the following: Let's assume the <code>Create</code> method in question is on the <code>HomeController</code>.</p> <p>Using the <code>AcceptVerbs</code> attribute does not affect routing. It's actually something used by the action invoker. What it allows you to do is have 2 action m...
<p>First decorate like this:</p> <pre><code>[ActionName("ItemEdit"), AcceptVerbs(HttpVerbs.Post)] public virtual object ItemSave(Menu sampleInput) </code></pre> <p>then you need to add route like this:</p> <pre><code> AddRoute( "SampleEdit", "Admin/{sampleID}/Edit", ne...
35,892
<p>I recently decided to upgrade to auto bed-leveling using an inductive proximity sensor and an aluminum build plate on my Prusa i3. I also wanted to try to secure the build plate using neodymium magnets at 4 points, with the magnets being secured with bolts to the Y-carriage, and steel washers glued to the bottom of ...
<p>Good question. The magnets from the build plate will almost certainly interfere with your inductive sensor, the movement from the carriage will induce a current in the inductor as it approaches the magnet and may cause it to trigger. If you're looking for a mag build, I'd suggest looking at: <a href="http://www.3dpr...
<p>You might use the magnets themselves or additional ones on top for the leveling process, as partly discussed in this thread:<br> <a href="http://forums.reprap.org/read.php?1,479795" rel="nofollow">http://forums.reprap.org/read.php?1,479795</a></p> <p>A mechanical or piezo switch might also solve the issue for you w...
282
<p>I'm trying to get a kernel module to load at boot.</p> <p>If I run <code>insmod /path/to/module.ko</code>, it works fine. But this has to be repeated every time I reboot.</p> <p>If I run <code>modprobe /path/to/module.ko</code>, it can't find the module. I know modprobe uses a configuration file, but I can't get i...
<p>You can make a symbolic link of your module to the standard path, so depmod will see it and you'll be able load it as any other module.</p> <pre><code>sudo ln -s /path/to/module.ko /lib/modules/`uname -r` sudo depmod -a sudo modprobe module </code></pre> <p>If you add the module name to /etc/modules it will be loa...
<p>I think the key is to copy the module to the standard paths.</p> <p>Once that is done, modprobe only accepts the module name, so leave off the path and ".ko" extension.</p>
27,922
<p>I have implemented a session timeout warning using javascript that simply asks the user if they want to extend their session or logout. The problem is that this is for an intranet portal where power users will often have several browser windows or tabs open at the same time to the application. Currently, they will...
<p>You'd have to check the session state on the server using Ajax and keep track of all the open sessions/windows the user has. You'd then be able to target only one of the available sessions with the log out warning.</p> <p>In response to your comment:</p> <p>Don't use the built-in session mechanism, devise your own...
<p>Would this work?</p> <p>Store a Javascript cookie and check that to determine if the session has been extended in another tab?</p> <p>looks like this does work...</p>
47,496
<p>How do I get a list of all the tables defined for the database when using active record?</p>
<p>Call <a href="http://github.com/rails/rails/tree/master/activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rb#L21" rel="noreferrer"><code>ActiveRecord::ConnectionAdapters::SchemaStatements#tables</code></a>. This method is undocumented in the MySQL adapter, but is documented in the Postgr...
<p>Don't know about active record, but here's a simple query:</p> <p>select table_name from INFORMATION_SCHEMA.Tables where TABLE_TYPE = 'BASE TABLE'</p>
18,656
<p>I am looking at printing a fair amount of text, ideally using some custom fonts. I quite like <a href="https://pixelify.net/download/free-fonts/script-handwritten/stay-classy-font-free/" rel="nofollow noreferrer">Stay Classy</a> but will likely have to consider change if it causes issues.</p> <p>I am a little stuck ...
<p>I think @Trish answered your question more specifically, but an alternate route (that I think its simpler assuming you don't mind the learning curve) is using Blender.</p> <p>Rather than creating an svg in a different software and having to go from something like photoshop to inkscape to tinkercad to your printer so...
<p>Fonts are not saved in a format that is .svg compatible. However, text that is written in a font and saved as a black-and-white picture can be turned into a .svg by software. This .svg can be imported by Tinkercad then.</p> <h1>Step 1: Text Picture</h1> <p>Use any software to create a .png or .jpg or something simil...
1,842
<p>In my application I have a <code>UITextField</code> inside a <code>UITableViewCell</code>. If I click inside the text field and add some text I find that if try to move the insertion point it works the first time but fails on subsequent attempts. I am completely unable to move the selection; no "magnifying glass" ap...
<p>I spent a lot of time on this but I finally think that I have it nailed.</p> <p>The trick is that the table needs to be editable (i.e., its <code>editing</code> property needs to be set to <code>YES</code>). The good news is that you are now able to move the insertion point. Sometimes the magnifying glass doesn't a...
<p>It does sound like an OS bug. I would try to reproduce it by running the UICatalog sample against the 2.0, 2.1, and 2.2 SDKs to see if anything changes. (There's a bug related to table cell text alignment that occurs if you build for 2.2 but not if you build for 2.1, regardless of what version of the OS is on the de...
49,266
<p>I am going to write a database application for the camp I work for. I am thinking about writing it in C# with a Windows GUI interface but using a browser as the application is seeming more and more appelaing for various reasons. What I am wondering is why someone would not choose to write an application as a web app...
<p>There are plenty of cons:</p> <ul> <li>Speed and responsiveness tend to be significantly worse</li> <li>Complicated UI widgets (such as tree controls) are harder to do</li> <li>Rendering graphics of any kind is pretty tricky, 3D graphics is even harder</li> <li>You have to mess around with logins</li> <li>A central...
<p>You need to have a network access to the server that you are going to have the web application on (if there are going to be multiple users for the application - which is typically the case).</p> <p>Actually, there are more pros than cons - if you can give some details about your application, we could help a little ...
13,716
<p>We are using SQL Server 2000 and have to move data across servers to store it in a central database. We would rather not use DTS packages because we will move to SQL Server 2005 soon, and we don't want to have to upgrade to SSIS or have to support legacy DTS packages.</p> <p>Is there any way to use OSQL scripts, v...
<p>you can use <a href="http://msdn.microsoft.com/en-us/library/aa174646.aspx" rel="nofollow noreferrer">BCP</a> to export and then import data.</p>
<p>Use Red Gate Sql Compare and Data Compare?</p>
36,992
<p>Do you always follow the convention of putting branches, tags and trunk directories at the top level of your Subversion repository? Lately, I have stopped bothering and nothing bad has happened (yet)! </p> <p>It should be possible to move directory trees around if there's ever a need to create them. Am I buildin...
<p>Have you tried branching or tagging yet? Until then, there's no problem. However, an added benefit of using the branches,tags,trunk convention is that it's exactly that -- a convention. People expect to see that, so they know what to do when they need to fork.</p>
<p>Nope, have abandoned that approach for the projects currently in the queue. While the concept seems very valid, it just seems to waste more time than it saves in practice.</p>
15,003
<p>Within an n-tier app that makes use of a WCF service to interact with the database, what is the best practice way of making use of LinqToSql classes throughout the app?</p> <p>I've seen it done a couple of different ways but they seemed like they burned a lot of hours creating extra interfaces, message classes, and...
<p>This is like <code>keys()</code> in Perl and Python and other languages that have built in support for hashes (aka dictionaries). As your example illustrates, Mathematica supports hashes without any special syntax. Just say <code>a[1] = 2</code> and you have a hash. [1] To get the keys of a hash, I recommend addin...
<p>This seems to work; not sure how useful it is, though:</p> <pre><code>a[1] = 2 a[2] = 3 a[3] = 5 a[6] = 8 Part[DownValues[a], All, 1, 1, 1] </code></pre>
16,393
<p>When I asked this <a href="https://stackoverflow.com/questions/266121/is-there-a-windows-ide-that-can-handle-both-c-and-perl">previously</a> I should have mentioned that it's particularly a <strong>light-weight</strong> IDE that I'm after, so I’m having to ask again as a different question.</p> <p>Something that is...
<p><a href="http://www.zeusedit.com" rel="nofollow noreferrer">Zeus</a> is a language neutral IDE that can be be configured for almost any programming langauge.</p> <p>It has features like syntax highlighting, code folding, project/workspace management, class browsing, macro scripting, integrated version control, ftp ...
<p>The lightest-weight open-source text-editor that I'd consider a full IDE is <a href="http://icsharpcode.com/OpenSource/SD/Default.aspx" rel="nofollow noreferrer">SharpDevelop</a>, which is still a bit heavy-weight. It handles a number of different languages, although I'm not should if it does anything specific for P...
34,341
<p>One thing I've run into a few times is a service class (like a JBoss service) that has gotten overly large due to helper inner classes. I've yet to find a good way to break the class out. These helpers are usually threads. Here's an example:</p> <pre><code>/** Asset service keeps track of the metadata about assets ...
<p>On bytecode level inner classes are just plain Java classes. Since the Java bytecode verifier does not allow access to private members, it generates synthetic accessor methods for each private field which you use. Also, in order to link the inner class with its enclosing instance, the compiler adds synthetic pointer...
<p>Yeap. Probably you need to re-refactor those helpers and not move them all as they are. Some things belong to the service some other to the helper. Probable new classes should be used to encapsulate the data. </p> <p>One posibility you can use is to AOP to provide fine-grained access, and include in the point cut t...
27,032
<p>Helvetica is available in one form or another on Windows, Mac OS X, and Linux. Under Windows, I can see it from Microsoft Word. On the two UNIX platforms, I can find it with xlsfonts | grep -i helvetica; the name seems to be adobe-helvetica.</p> <p>But the JDK can't find it! It's not listed from GraphicsEnvironm...
<p>I realize that this isn't actually answering the question, but...</p> <p>On Windows, Helvetica isn't always installed. My machine at work (the one I'm using now) doesn't, despite having Microsoft Office XP.</p>
<p>I think if you put the the font file in your src folder and call it from there it will work.</p>
49,156
<p>It's been my experience that some security software (like Symantec's Norton AntiVirus) oftentimes prohibit their removal from a Windows system via the "Add or Remove Programs" utility, going so far as to occasionally require a removal program obtained from Symantec's homepage. (I assume this it to prevent a malicio...
<p>Norton is not the only one that does this, however McAfee and Norton are the only ones who make it almost impossible to remove the software. Not because they care about viruses or security threats, they don't want to give up control of the system. Many other Antivirus software that works just as well if not better...
<p>If you are looking for a "sollution" where the system can't be damaged by the user you don't need any hacks like that. Just don't give the user access to the administrator account. If the user is you, even easier, don't run anyting that is not trusted when logged in as administrator.</p>
26,486
<p>In working on a shortest path algorithm across a network I would like to generate a picture of the network. I'd like to represent nodes (circles), links (lines), cost to traverse the link (number in the middle of the link line), and capacity of the link (number on the link line next to the node it represents) in the...
<p>Sounds like a job for <a href="http://www.graphviz.org/" rel="nofollow noreferrer" title="GraphViz">GraphViz</a> , it generates graphs from a short text description file. I've used it to produce connected node graphs and I believe it should be possible to add link labels, as you require.</p>
<p>There are a bunch of visualizations of various algorithms here: <a href="http://www.cse.yorku.ca/~aaw/" rel="nofollow noreferrer">Algorithmics Animation Workshop</a></p>
37,899
<p>Should my ajax calls talk to webservices or to simple webpages? It seems to be so much easier to simply Response.Write() the content. Are webservices more reliable or secure?</p>
<p>Something you might want to look into to make AJAX calls is Page Methods. With ASP.NET Page methods you can call a server side function that exists in your code behind using javascript, without the overhead of the page lifecycle, because the method has to be static. For more information about Page methods, check o...
<p>Not in any way I can see. It's all just http traffic going back and forth.</p>
28,648
<p>What's the DOS FINDSTR equivalent for <a href="http://en.wikipedia.org/wiki/Windows_PowerShell" rel="noreferrer">PowerShell</a>? I need to search a bunch of log files for "ERROR".</p>
<p>Here's the quick answer </p> <pre><code>Get-ChildItem -Recurse -Include *.log | select-string ERROR </code></pre> <p>I found it <a href="http://www.interact-sw.co.uk/iangblog/2006/06/03/pshfindstr" rel="noreferrer">here</a> which has a great indepth answer!</p>
<pre><code>if ($entry.EntryType -eq "Error") </code></pre> <p>Being Object Oriented, you want to test the property in question with one of the standard comparison operators you can find <a href="http://www.computerperformance.co.uk/powershell/powershell_syntax.htm#Operators_" rel="nofollow noreferrer">here</a>.</p> <...
3,550
<p>I've been working on a "big bang" rewrite for, literally, over two years. The management has consistently and relentlessly ignored and belittled my calls to allocate time / resources for performance measurement, capacity planning, and optimization before the app replaces their mega-millions money maker flagship web ...
<p>Get them to agree on solid numbers for what they expect the system to be able to support (number of concurrent users/tasks/etc), then it becomes an obvious part of the development work to make certain the system can meet the requirements.</p>
<p>Take careful notes about this development project, including what performance problems crop up after deployment. People will bemoan the problems, and you can tactfully suggest that they prioritize that sort of problem higher earlier. Some people will only accept direct first-person evidence.</p>
34,641
<p>I am currently developing a Drupal webpage using PDT. When running without XDebug, the site works fine.</p> <p>When I enable XDebug, the site works fine but opens up tons of Javascript errors that I need to click through.</p> <p>Example:</p> <p>A Runtime Error has occurred. Do you wish to Debug?</p> <p>Line: 1 E...
<p>here is how to solve this problem:</p> <p>Turn off XDebug output capture:</p> <p>Window -> Preferences, expand PHP, expand Debug, select "Installed Debuggers", choose "XDebug", click "Configure" on the right to bring up the configure dialog. In the middle "Output Capture Settings", set "Capture stdout" to "Off".</...
<p>This is a bit of a guess, but try Windows => Preferences => JavaScript => Include Path</p>
9,131
<p>I would like to see the threads currently active in my application while debugging it.</p> <p>How can I do this using Visual Studio?</p>
<p>Yes, go to Debug->Windows->Threads</p>
<p>I've been using Allinea's DDTLite plugin recently - drops into VS2008 (SP1) pretty well and gives a number of really really useful windows for managing multiple threads (stepping, breakpoints, ..) or even just seeing where threads are at the same time (a sort of tree like view of the stacks, it's really cool).</p>
19,898
<p>For some reason when I download a zip folder from my server's folder it is always corrupted. Here is the code: </p> <pre><code> protected void gvFiles_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e) { string fileUrl = String.Empty; if(e.CommandName....
<p>I don't know asp.net at all, but this is pretty commonly a result of doing the download in a text mode instead of binary mode. Line ending characters get converted from \r\n to \n or vice versa, and everything goes nuts.</p>
<p>First, verify that the contents of the file actually looks like a zip file. You can do that simply by dropping the file into notepad, and looking at the contents. If the file starts with PK and some funny characters, it might be a zip file. If it contains HTML, that might be a clue as to why it is going wrong.</p> ...
49,199
<p>I have little knowledge of Flash but for a little Flash game I have to store score and successful tries of users in a database using PHP. Now the Flash runs locally on the users computer and connects to a remote server. How can I secure against manipulation of game scores. Is there any best practice for this use cas...
<p>You might want to check these other questions:</p> <ul> <li>Q46415 <a href="https://stackoverflow.com/questions/46415/">Passing untampered data from Flash app to server?</a></li> <li>Q73947 <a href="https://stackoverflow.com/questions/73947/">What is the best way to stop people hacking the PHP-based highscore table...
<p>This topic has been covered here @ stackoverflow, at least in part</p> <p><a href="https://stackoverflow.com/questions/73947">What is the best way to stop people hacking the PHP-based highscore table of a Flash game</a></p>
18,729
<p>In VB6 you can do this:</p> <pre><code>Dim a As Variant a = Array(1, 2, 3)</code></pre> <p>Can you do a similar thing in VB.NET with specific types, like so?:</p> <pre><code>Dim a() As Integer a = <strong>Array</strong>(1, 2, 3)</code></pre>
<pre><code>Dim a() As Integer = New Integer() {1, 2, 3} </code></pre>
<p>If you are new to .NET you will want to learn about the List collection and the flexibility it will give you in <a href="http://msdn.microsoft.com/en-us/library/41107z8a(VS.80).aspx" rel="nofollow noreferrer">respect to sorting, filtering, and iteration</a>.</p>
29,926
<p>I have written a function that gets a given number of random records from a list. Currently I can do something like:</p> <pre><code>IEnumerable&lt;City&gt; cities = db.Cites.GetRandom(5); </code></pre> <p>(where db is my DataContext connecting to a SQL Server DB)</p> <p>Currently, I have a function like this in ...
<p>JaredPar, I don't think you can do that with the :class inside the generic definition.</p> <p>I think this is the proper way to define type constraints:</p> <pre><code>public static IEnumerable&lt;T&gt; GetRandom&lt;T&gt;( this Table&lt;T&gt; table, int count) where T : class { ... } </code></pre> <p>More info ...
<p>Try this</p> <pre><code>public static IEnumerable&lt;T&gt; GetRandom&lt;T&gt;( this Table&lt;T&gt; table, int count) where T : class { ... } </code></pre>
45,824
<p>I'm using PHP to generate thumbnails. The problem is that I have a set width and height the thumbnails need to be and often times the images are stretched.</p> <p>What I'd like is the image to remain at the same proportions and just have black filler (or any color) either on the left &amp; right for tall images or ...
<p>You'll need to calculate the new width &amp; height to keep the image proportionat. Check out example 2 on this page:</p> <p><a href="http://us3.php.net/imagecopyresampled" rel="nofollow noreferrer">http://us3.php.net/imagecopyresampled</a></p>
<p>Have a look at this <a href="http://www.verot.net/php_class_upload.htm" rel="nofollow noreferrer">upload class</a>. It does what you want and a lot more besides.</p>
42,560
<p>I need to allow the vertical scrollbar in a multiselect listbox (VB6) however, when the control is disabled, I can't scroll.</p> <p>I would think there is an API to allow this, but my favorite <a href="http://vbnet.mvps.org" rel="nofollow noreferrer">VB6 site (MVPS VB.NET)</a> does not have a way.</p> <p>I toyed w...
<p>I came up with the following code, which hides all of the gnarly details behind a class. Basically, I implemented greg's idea of using overlaying another scrollbar on top of the disabled list box's scrollbar. In my code, I dynamically create another ListBox control (resized so that only its scrollbar is visible), an...
<p>This is a total VB hack, but I think you can leave the listbox enabled, and then drag a transparent label (with blank text) over all of the listbox except the scrollbar. The label will intercept any mouse clicks (although this won't affect keystrokes).</p> <p>This will only work if the label is transparent like I ...
37,387
<p>What is the easiest way to check if events have been logged in the eventlog during a period of time?</p> <p>I want to perform a series of automated test steps and then check if any errors were logged to the Application Event Log, ignoring a few sources that I'm not interested in. I can use System.Diagnostics.EventL...
<p>Just to be a good Wiki citizen and strive for completion, there are other ways. I didn't suggest it earlier because it is complete overkill for something that is only going to be run in-house as part of a test suite, and you said right in the title you wanted something easy.</p> <p>But if you need to see events as...
<p>Well the solution I've come up with does use <a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.eventlog.aspx" rel="nofollow noreferrer">System.Diagnostics.EventLog</a> and simply iterating over all events to filter for the ones I want. I guess this is straightforward, I just thought there would hav...
22,039
<p>My Alfawise EX8 (Anet A8 Clone) had an issue, so I flashed the <a href="https://www.dropbox.com/s/e1ab6p2s8j61w6q/Marlin.rar?dl=0" rel="nofollow noreferrer">firmware</a> provided on the GearBest page. After the flash the LCD is no longer doing anything and I can't really identify the LCD to confirm whether the corre...
<p>According to the <a href="https://www.dropbox.com/s/e1ab6p2s8j61w6q/Marlin.rar?dl=0" rel="nofollow noreferrer">link to the fork of Marlin</a> you need to be sure that a bootloader is present before flashing, see <a href="https://www.dropbox.com/s/e1ab6p2s8j61w6q/Marlin.rar?dl=0&amp;file_subpath=%2FMarlin%2Fpins_MELZ...
<p>I have the same problem.</p> <p>I think it is not a bootloader problem because the screen is all blue but machine can work with serial connexion. I tried to use the new Jakub's file but it doesn't work either.</p> <p>I found new type of screen for EX8 on Marlin V2 called &quot;WYH_L12864_LCD&quot; - Has anyone tried...
1,482
<p>I have a headless server running Windows Server 2003, and administer it via VNC. It is set to auto login to a specific user account.</p> <p>I want to change to using Remote Desktop/Terminal Services. However, when I log in remotely a new user session is created (in addition to auto logged in session). Essentially I...
<p>To logon as the 'console' user (the one to be used for logging in locally) then you use a parameter for mstsc.exe From a command prompt type in mstsc /h to see the help. MSTSC /ADMIN /V:YOURSERVERNAME or MSTSC /CONSOLE /V:YOURSERVERNAME</p> <p>(depending on the version that you have)</p>
<p>Here's how you can switch over.</p> <ol> <li>Start task manager</li> <li>Switch to the users tab</li> <li>There should be two users listed. The one you logged on with and the original session you are trying to connect to.</li> <li>Right click on the one you want to connect to and select "Switch" or "connect". I c...
42,547
<p>In our project, <a href="http://sharpwired.sourceforge.net/" rel="nofollow noreferrer">SharpWired</a>, we're trying to create a download component similar to the download windows in Firefox or Safari. That is, one single top down list of downloads which are custom controls containing progress bars, buttons and what ...
<p>If you don't want to use databinding (via the <code>DataRepeater</code> control, as mentioned above), you could use a regular <code>Panel</code> control and set its <code>AutoScroll</code> property to true (to enable scrollbars).</p> <p>Then, you could manually add your custom controls, and set the <code>Dock</code...
<p>.NET 3.5 SP1 introduced a <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualbasic.powerpacks.datarepeater.aspx" rel="nofollow noreferrer">DataRepeater</a> Windows Forms control which sounds like it'd do what you want. Bind it to the list of "downloads" (or whatever your list represents) and customize ...
4,732
<p>I have a .NET C# WPF application that I am trying to make into a single-instance application using a Mutex. </p> <p>This .NET application is called by a C++-based DLL using CreateProcessAsUser() and is given parameters via environment variables. </p> <p>Subsequent instances will also be created by the C++ DLL in t...
<p><em>The simplest I can think of is to export a function from the .NET application and then the subsequent instances can just call this function and pass the parameters to it.</em></p> <p>This is not how this works. You'll load the .NET assembly in the calling process, not magically cross the process boundary and ta...
<p>thanks for the reply, Paul!</p> <p>I've added more detail to my question above, though, coz I'm not sure if my scenario was understood correctly. </p> <p>But regarding your answer, the parent of the .NET app will be a C++-based DLL and all it will do is call the .NET app and give it parameters. The C++-based DLL w...
39,673
<p>I have a table called OffDays, where weekends and holiday dates are kept. I have a table called LeadTime where amount of time (in days) for a product to be manufactured is stored. Finally I have a table called Order where a product and the order date is kept.</p> <p>Is it possible to query when a product will be ...
<p>You can generate a table of working days in advance.</p> <pre><code>WDId | WDDate -----+----------- 4200 | 2008-01-08 4201 | 2008-01-09 4202 | 2008-01-12 4203 | 2008-01-13 4204 | 2008-01-16 4205 | 2008-01-17 </code></pre> <p>Then do a query such as</p> <pre><code>SELECT DeliveryDay.WDDate FROM WorkingDay OrderDay...
<p>Why are you against using loops?</p> <p>//some pseudocode</p> <pre><code>int leadtime = 5; date order = 2008-01-09; date finishdate = order; while (leadtime > 0) { finishdate.addDay(); if (!IsOffday(finishdate)) leadtime--; } return finishdate;</code></pre> <p>this seems like a too simple function to try to find ...
11,817
<p>I'm trying to create a newsletter standard for our org and having problems with Outlook rendering the text too large.</p> <p>Here is the css section of the page</p> <pre><code>body { margin: 0; padding: 0; font-family: Arial, Helvetica, sans-serif; font-size: 75%; background: url(http://www.bla...
<p>Have you tryed using <code>main *{font-size: 12pt;}</code> ?</p> <p>Outlook by default uses Trident, IE's engine for incoming mail, and Word HTML rendering engine for outgoing mail... <a href="http://blogs.zdnet.com/microsoft/?p=229" rel="nofollow noreferrer">Until Office 2007, and people hate it.</a></p> <p>Now, ...
<p>If you want to set a specific size for you fonts, then you should probably use a fixed size type like pt. Rather than a variable one like em/%</p> <p><a href="http://net.jasonpearce.com/tools/cssfontsizes.html" rel="nofollow noreferrer">See here</a> for what I mean.</p>
37,655
<p>I want the 2 columns to touch ie. remove the margins, how can I do this?</p> <p>My code:</p> <pre><code> &lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"&gt; &lt;HTML&gt; &lt;HEAD&gt; &lt;TITLE&gt;testing&lt;/TITLE&gt; &lt;!-- css --&gt; &lt;link rel="stylesheet" type="text/css" href="http...
<p>Add a class to the right column and set margin-left to 0. </p> <p>If that doesn't work you might have to increase the width by 1 or 2%. You can use firebug to check the applied styles and change them on the fly.</p>
<p><strong>Notice that you're using YUI (Yahoo UI).</strong> </p>
17,947
<p>Is there a way to bind a Generic List to a multicolumn listbox, yes listbox...I know but this is what I am stuck with and can't add a grid or listview.</p> <p>Thanks</p>
<p>You could bind a list to a listbox like this:</p> <pre><code>List&lt;int&gt; list = new List&lt;int&gt; { 1, 2, 4, 8, 16 }; listBox1.DataSource = list; </code></pre> <p>As for multicolumn listbox documentation says <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.listbox.multicolumn.aspx" rel=...
<p>For .NET 2.0 you can use the <code>UseCustomTabOffsets</code> and <code>CustomTabOffsets</code>, if you need multi-column support in your <code>ListBox</code>. See <a href="https://stackoverflow.com/questions/1365973/how-to-make-more-than-2-columns-in-listbox-using-c/1372212#1372212">how to make more than 2 column&#...
29,993
<p>I've kind of backed myself into a corner here.</p> <p>I have a series of UserControls that inherit from a parent, which contains a couple of methods and events to simplify things so I don't have to write lines and lines of near-identical code. As you do. The parent contains no other controls.</p> <p>What I want to...
<p>Declare the parent method virtual, override it in the child classes and call</p> <pre><code>base.checkReadyness(sender, e); </code></pre> <p>(or derevation thereof) from within the child class. This allows for future design evolution say if you want to do some specific error checking code before calling the parent...
<p>If your event is already defined in your parent class, you do not need to rewire it again in your child class. That will cause the event to fire twice.</p> <p>Do verify if this is what is happening. HTH :)</p>
11,589
<p>I am reading a binary file into a parsing program. I will need to iterate through the file and look for certain markers so I can split the file up and pass those parts into their respective object’s constructors.</p> <p>Is there an advantage to holding the file as a stream, either MemoryStream or FileStream, or sh...
<p>A <code>byte[]</code> or <code>MemoryStream</code> will both require bringing the entire file into memory. A <code>MemoryStream</code> is really a wrapper around an underlying byte array. The best approach is to have two <code>FileStream</code> (one for input and one for output). Read from the input stream looking f...
<p>A MemoryStream is basically a byte array with a stream interface, e.g. sequential reading/writing and the concept of a current position.</p>
3,763
<p>I've started to "play around" with PowerShell and am trying to get it to "behave".</p> <p>One of the things I'd like to do is to customize the PROMPT to be "similar" to what "$M$P$_$+$G" do on MS-Dos:</p> <p>A quick rundown of what these do:</p> <p><b>Character</b><b>| Description</b><br> <b>$m </b> The remote n...
<p>See if this does what you want:</p> <pre><code>function prompt { ## Get the history. Since the history may be either empty, ## a single item or an array, the @() syntax ensures ## that PowerShell treats it as an array $history = @(get-history) ## If there are any items in the history, find out the ...
<p>Thanks to EBGReens's answer, my "prompt" is now capable of showing the depth of the stack:</p> <pre><code> function prompt { ## Initialize vars $depth_string = "" ## Get the Stack -Pushd count $depth = (get-location -Stack).count ## Create a string that has $depth plus signs $depth_string...
19,096
<p>Is there a way for me to add logging so that entering and exiting methods gets logged along with parameters automatically somehow for tracing purposes? How would I do so?</p> <p>I am using Log4Net.</p>
<p>The best way to achieve this sort of thing is by using interception, There are a couple of ways to do this, though they all tend to be somewhat invasive. One would be to derive all your objects from ContextBoundObject. <a href="http://www.codeproject.com/KB/cs/aspectintercept.aspx" rel="noreferrer">Here</a> is an...
<p>You can use open source framework <a href="http://codeinject.codeplex.com" rel="nofollow">CInject</a> on CodePlex that has a LogInjector to mark entry and exit of a method call.</p> <p>Or you can follow the steps mentioned on this article on <a href="http://www.codetails.com/punitganshani/intercepting-method-calls-...
20,651
<p>I am evaluating VisualSVN for me and a small team of developers. I set it up on the server (VisualSVN server) without problems and installed TortoiseSVN and VisualSVN in order to integrate it in Visual Studio 2008. So far, it works well and we use it for the development of our main application.</p> <p>I've heard go...
<p>We did precisely that: switched from VisualSVN to AnkhSVN. The move went without any trouble at all. These plugins do not store specific information, and the .svn (or _svn) hidden folders are compatible with any svn client.</p> <p>The 1.x series of the Ankh plugin was awful: lots of crashes and annoyances (for exam...
<p>My experience with Ankh is terrible (too many runtime crashes), however this is for an older version of Ankh and they might have mitigated the problems already. That being said, stick first with a) what works, and then b) what you can afford.</p>
35,911
<p>I have what I believe to be a fairly well structured .NET 3.5 forms application (Unit Tests, Dependency Injection, SoC, the forms simply relay input and display output and don't do any logic, yadda yadda) I am just missing the winforms knowledge for how to get this bit to work.</p> <p>When a connection to the datab...
<p>I'm not sure about the correctness of your overall approach, but to specifically answer your question try changing the MySustainedDialog Hide() function to as follows:</p> <pre><code> public new void Hide() { if (this.InvokeRequired) { this.BeginInvoke((MethodInvoker)delegate { th...
<p>Might it be simpler to keep all the UI work on the main UI thread rather than using the BackgroundWorker? It's tricky to say without seeing more of your code, but I don't think you should need that.</p> <p>When you create your timer, you can assign it's Timer.SynchronizingObject to get it to use the main UI thread....
19,112
<p>Every now and again I encounter a problem where Visual Studio Professional 2008 (SP1) refuses to open an aspx page. My site is in a Web Application Project. </p> <p>Double clicking on the aspx page in solution explorer just causes the tree view node with the code behind and .designer.cs to collapse and expand, it'...
<p>Yeah, I'm getting that with just one aspx file in a webproj. I can open it with notepad fine, no one else is having a problem with the file on their computer and it just started happening to me today. I am using SourceSafe if that matters. I tried closing and reopening VS.</p>
<p>Do you have any extras/ plugins installed? I've seen problems like this that were fixed by uninstalling DevExpress add-ons</p>
43,928
<p>I have got some code to load an assembly and get all types, which implement a certain interface, like this (assume asm is a valid and loaded assembly).</p> <pre><code>var results = from type in asm.GetTypes() where typeof(IServiceJob).IsAssignableFrom(type) select type; </code></pre> <p>Now I'm stuck: I need t...
<p>Oh wow - I only <a href="http://www.madprops.org/blog/linq-with-reflection-part-2/" rel="noreferrer">blogged about this</a> a few days ago. Here's my method to return instances of all the types that implement a given interface:</p> <pre><code>private static IEnumerable&lt;T&gt; InstancesOf&lt;T&gt;() where T : clas...
<p>You can create an instance of a type with the <code>Activator.CreateInstance</code> method:-</p> <pre><code>IServiceJob x = Activator.CreateInstance(type); </code></pre> <p>So your code becomes:-</p> <pre><code>IServiceJob[] results = (from type in asm.GetTypes() where typeof(IServiceJob).IsAssignableFrom(type)...
35,485
<p>In PHP 5.2 there was a nice security function added called "input_filter", so instead of saying:</p> <pre><code>$name = $_GET['name']; </code></pre> <p>you can now say:</p> <pre><code>$name = filter_input (INPUT_GET, 'name', FILTER_SANITIZE_STRING); </code></pre> <p>and it automatically sanitizes your string, th...
<p>You could manually force it to read the arrays again by using <a href="http://uk3.php.net/manual/en/function.filter-var.php" rel="noreferrer">filter_var</a> and <a href="http://uk3.php.net/manual/en/function.filter-var-array.php" rel="noreferrer">filter_var_array</a></p> <pre><code>$name = filter_var ( $_GET['name'...
<p>PHP's new input_filter does not read <code>$_GET</code> or <code>$_POST</code> arrays. If you are overwriting Global's (like,<code>$_GET</code>,<code>$_POST</code>) then Don't go for filter_input. Instead use <code>filter_var ( $_GET['name'], FILTER_SANITIZE_STRING )</code> by manually passing variable.</p>
38,221
<p>I have read lots of information about page caching and partial page caching in a MVC application. However, I would like to know how you would cache data.</p> <p>In my scenario I will be using LINQ to Entities (entity framework). On the first call to GetNames (or whatever the method is) I want to grab the data from ...
<p>Here's a nice and simple cache helper class/service I use: </p> <pre><code>using System.Runtime.Caching; public class InMemoryCache: ICacheService { public T GetOrSet&lt;T&gt;(string cacheKey, Func&lt;T&gt; getItemCallback) where T : class { T item = MemoryCache.Default.Get(cacheKey) as T; ...
<p>You can also try and use the caching built into ASP MVC:</p> <p>Add the following attribute to the controller method you'd like to cache:</p> <pre><code>[OutputCache(Duration=10)] </code></pre> <p>In this case the ActionResult of this will be cached for 10 seconds.</p> <p>More on this <a href="http://weblogs.as...
44,724
<p>The Winform application is release with ClickOnce in our Intranet. We store personal preference for the GUI in the Isolated Storage. All works pretty fine :)</p> <p>The problem is when we have a new version of the application, we publish... all preferences are lost! User need to setup their preference over and over...
<p>You need to use <em>application</em> scoped, rather than <em>domain</em> scoped, isolated storage. This can be done by using one of <strong>IsolatedStorageFileStream's</strong> overloaded constructors.</p> <p>Example:</p> <pre><code>using System.IO; using System.IO.IsolatedStorage; ... IsolatedStorageFile appSco...
<p>You have to store a permanent version of user settings in a more durable store like database. Your application can decide to use the isolated storage if it is available. If it is not available (because of a newer version), the app should get the settings from database and use it to re-initialize the settings in isol...
24,689
<p>Assuming the you are implementing a user story that requires changes in all layers from UI (or service facade) to DB. </p> <p>In what direction do you move?</p> <ul> <li>From UI to Business Layer to Repository to DB?</li> <li>From DB to Repository to Business Layer to UI?</li> <li>It depends. (On what ?)</li> </ul...
<p>The best answer I've seen to this sort of question was supplied by the Atomic Object guys and their <a href="http://en.wikipedia.org/wiki/Presenter_First" rel="nofollow noreferrer">Presenter First</a> pattern. Basically it is an implementation of the MVP pattern, in which (as the name suggests) you start working fr...
<p>I'd do it bottom up, since you'll have some working results fast (i. e. you can write unit tests without a user interface, but can't test the user interface until the model is done).</p> <p>There are other opinions, though.</p>
16,234
<p>How have you explained nested arrays to a programmer. I'm thinking someone that has an entry level understanding of programming, but is trying to do more complicated coding.</p> <p>The array with array works, but they can't quite get their mind around the idea.</p> <p><strong>Edit:</strong> example of a nested arr...
<p>Tell them to think of an array as a list- it helps to give them something less abstract, like a grocery list. Then, a nested array is simply a list of lists.</p> <p>Maybe I have a todo list, a grocery list, and a wishlist at amazon.com . Now I have a list of all of my lists, and I can look at all of those elements ...
<p>If you are looking at C type, non-ragged, arrays, comparing it to numbers, the base 10 part, and there digits might help. Another good source for this same effect would be time as it has a non uniform base 60s = 1m, 60m = 1h, 24h = 1day, 7day = 1week</p>
32,574
<p>Suppose I have this interface</p> <pre><code>public interface IFoo { ///&lt;summary&gt; /// Foo method ///&lt;/summary&gt; void Foo(); ///&lt;summary&gt; /// Bar method ///&lt;/summary&gt; void Bar(); ///&lt;summary&gt; /// Situation normal ///&lt;/summary&gt; void ...
<p>You can always use the <code>&lt;inheritdoc /&gt;</code> tag:</p> <pre><code>public class Foo : IFoo { /// &lt;inheritdoc /&gt; public void Foo() { ... } /// &lt;inheritdoc /&gt; public void Bar() { ... } /// &lt;inheritdoc /&gt; public void Snafu() { ... } } </code></pre> <p>Using the <code>...
<p>Well, there is a kind of native solution, I found for .NET Core 2.2</p> <p>The idea is to use <code>&lt;include&gt;</code> tag.</p> <p>You can add <code>&lt;GenerateDocumentationFile&gt;true&lt;/GenerateDocumentationFile&gt;</code> your <code>.csproj</code> a file.</p> <p>You might have an interface:</p> <pre><c...
44,586
<p>I was just tinkering around with calling GetPrivateProfileString and GetPrivateProfileSection in kernel32 from .NET and came across something odd I don't understand.</p> <p>Let's start with this encantation:</p> <pre><code> Private Declare Unicode Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivat...
<p>Check to see if the file you are opening has a <a href="http://en.wikipedia.org/wiki/Byte-order_mark" rel="noreferrer">byte order mark</a> (a few bytes marking the type of text encoding).</p> <p>These Windows API calls don't seem to grok byte order marks and is causes them to miss the first section (hence everythin...
<p>Good call. Editing the ini file in VS.NET is of course (Duh) adding a utf-8 BOM. Grrr. Opening it in notepad and doing a SaveAs ASCII yields the expected results.</p> <p>So obvious. So obtuse. Another hour down the crapper. :-)</p> <p>Thanks! -=Chris</p>
15,173
<p>i run Apache web server on windows in order to work on some Perl CGI scripts. in production these scripts run on a linux box, and in the source code repository they all have shebangs like: <code>#!/usr/bin/perl</code>, but on my windows machine the shebangs would be <code>#!c:\perl\bin\perl.exe</code>, so i have a c...
<p>It sounds like the ScriptInterpreterSource line is being ignored. If it's set to Registry or Registry-Strict, it should ignore the shebang lines and use the registry <strong>only</strong>.</p> <p>Also, the <a href="http://httpd.apache.org/docs/2.2/mod/core.html#scriptinterpretersource" rel="noreferrer">Apache 2.2 ...
<p>Instead of running your perl code in separate CGI processes, consider using <strong>mod_perl</strong> (See <a href="http://perl.apache.org" rel="nofollow noreferrer">http://perl.apache.org</a>). </p> <p>Mod_perl is a lot more efficient, as the Perl code is loaded and parsed only once and then runs directly within t...
49,784
<p>I need to catch the HTML of a ASP.NET just before it is being sent to the client in order to do last minute string manipulations on it, and then send the modified version to the client.</p> <p>e.g.</p> <p>The Page is loaded Every control has been rendered correctly The Full html of the page is ready to be transferre...
<p>You can override the Render method of your page. Then call the base implementation and supply your HtmlTextWriter object. Here is an example</p> <pre><code>protected override void Render(HtmlTextWriter writer) { StringWriter output = new StringWriter(); base.Render(new HtmlTextWriter(output)); //This is...
<p>I don't think there is a specific event from the page that you can hook into; here is the ASP.Net lifecycle: <a href="http://msdn.microsoft.com/en-us/library/ms178472.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms178472.aspx</a></p> <p>You may want to consider hooking into the prerender ...
35,123
<p>When I use <kbd>CTRL</kbd>+<kbd>H</kbd> I end up on the Java Search tab. I would very much like a shortcut to go directly to File Search instead. Is that possible?</p> <p>See image here for what I'm talking about: <a href="https://i.stack.imgur.com/S3Qlf.png" rel="noreferrer"><img src="https://i.stack.imgur.com/S3Q...
<p>You can just define a key binding that opens the file search:</p> <ol> <li>Go to <em>Preferences</em> > <em>General</em> > <em>Keys</em></li> <li>Type "file search" in the search box. (If there are no results, and you have a really old Eclipse version, select the <em>Include Unbound Commands</em> check box.)</li> <...
<p>UPDATE: user @muescha, in the comments underneath the question, just pointed out to me that I accidentally answered the <em>wrong question!</em> Nevertheless, it is still a valuable answer (just not to this question), so I'm leaving it. </p> <h1>My answer answers the question: How do I use a hotkey directly to sear...
11,744
<p>I have a large legacy C++ project compiled under Visual Studio 2008. I know there is a reasonably amount of 'dead' code that is not accessed anywhere -- methods that are not called, whole classes that are not used.</p> <p>I'm looking for a tool that will identify this by <strong>static analysis</strong>.</p> <p>T...
<p>You'll want something along the lines of QA-C++ (<a href="http://www.programmingresearch.com/QACPP_MAIN.html" rel="noreferrer">http://www.programmingresearch.com/QACPP_MAIN.html</a>), also see <a href="http://en.wikipedia.org/wiki/List_of_tools_for_static_code_analysis" rel="noreferrer">http://en.wikipedia.org/wiki/...
<p>Write a script that randomly deletes a function (from the source code) and recompiles everything from scratch. If it still compiles - that function was dead code.</p>
41,573
<p>I'm trying to get a simple search form working in my RoR site. I've got the following code:</p> <p>(in note_controller.rb)</p> <pre><code> def search @results = Note.find_with_ferret(params[:term]).sort_by(&amp;:ferret_rank) respond_to do |format| format.html format.xml { render :xml =&gt; @n...
<p>I can't recall ever seeing that ferret error. There's two basic diagnostics: go into script/console, and do </p> <pre>Notes.find_with_ferret("some term that should be in index") </pre> <p>And then see what happens when you remove the indexes' directory (/appname/index/development), do another find_with_ferret to ...
<p>I've removed the index directory, and it seems to have regenerated itself but now my searches on the console are giving no results. Before I deleted the index directory I got results on the console, but not when used from the form in my app.</p> <p>Title and Body are both columns in my MySQL table. They were create...
29,220
<p>What are the main reasons personal projects (software apps etc) never get to the level of competing with your salary?</p> <p>To me one big problem is "on-the-fly" feature expansion, with this problem, the end only gets further and further away!</p>
<p>For me, it's simple: I work 8 hours a day already. I spend a few more hours a day keeping current. I have <strike>a girlfriend,</strike> some local family and a decent circle of friends. I have (gasp) non-computer-related interests and hobbies. In other words, I have a life.</p> <p>So ... <strong>Time.</strong> Tim...
<p>The biggest reason? Because if you can write it yourself and people like it, someone else can make an open source version with much better support than you can provide alone. Why not skip the middle man and release it as open source yourself? Sure, you miss out on the direct profit, but that looks very good come ...
26,248
<p>I keep looking around for 3D scanning software but can't find anything I like. Any suggestions? I'm more looking for a free app so I can use my android phone, but am open to desktop based solutions too.</p>
<h2>1. Meshroom</h2> <p><a href="https://alicevision.org/" rel="nofollow noreferrer">https://alicevision.org/</a></p> <p>Meshroom can take any number of overlapping photographs and turn them into a 3D model. Those pictures can be taken from any phone, or even a drone. For best results, you will need to know the make/mo...
<p>I personally use <a href="https://scann3d.it/" rel="nofollow noreferrer">SCANN3D</a>. It is available on Android but I don't know if it is for desktop too.</p>
2,031
<p>I have a list of times in a database column (representing visits to a website).</p> <p>I need to group them in intervals and then get a 'cumulative frequency' table of those dates.</p> <p>For instance I might have:</p> <pre><code>9:01 9:04 9:11 9:13 9:22 9:24 9:28 </code></pre> <p>and i want to convert that into...
<pre><code>create table accu_times (time_val datetime not null, constraint pk_accu_times primary key (time_val)); go insert into accu_times values ('9:01'); insert into accu_times values ('9:05'); insert into accu_times values ('9:11'); insert into accu_times values ('9:13'); insert into accu_times values ('9:22'); in...
<p>This uses quite a few SQL tricks (SQL Server 2005):</p> <pre><code>CREATE TABLE [dbo].[stackoverflow_165571]( [visit] [datetime] NOT NULL ) ON [PRIMARY] GO ;WITH buckets AS ( SELECT dateadd(mi, (1 + datediff(mi, 0, visit - 1 - dateadd(dd, 0, datediff(dd, 0, visit))) / 5) * 5, 0) AS visit_bucket ...
20,000
<p>Is it possible to hide or exclude certain data from a report if it's being rendered in a particular format (csv, xml, excel, pdf, html). The problem is that I want hyperlinks to other reports to not be rendered when the report is generated in Excel format - but they should be there when the report is rendered in HTM...
<p>The way I did this w/SSRS 2005 for a web app using the ReportViewer control is I had a hidden boolean report parameter which was used in the report decide if to render text as hyperlinks or not.</p> <p>Then the trick was how to send that parameter value depending on the rendering format. The way I did that was by d...
<p>I don't think this is possible in the 2000 version, but might be in later versions.</p> <p>If I remember right, we ended up making two versions of the report.</p>
10,815
<p>I would like to load a BMP file, do some operations on it in memory, and output a new BMP file using C++ on Windows (Win32 native). I am aware of <a href="http://www.imagemagick.org/" rel="nofollow noreferrer">ImageMagick</a> and it's C++ binding <a href="http://www.imagemagick.org/Magick%2B%2B/" rel="nofollow noref...
<p>When developing just for Windows I usually just use the ATL <a href="http://msdn.microsoft.com/en-us/library/bwea7by5(VS.80).aspx" rel="noreferrer">CImage</a> class </p>
<p>I've not used Magick++, but Windows has a library called the Windows Imaging Component which would likely suit your needs.</p>
24,302
<p>In Java 5 and above you have the foreach loop, which works magically on anything that implements <code>Iterable</code>:</p> <pre><code>for (Object o : list) { doStuff(o); } </code></pre> <p>However, <code>Enumerable</code> still does not implement <code>Iterable</code>, meaning that to iterate over an <code>Enum...
<p>Enumeration hasn't been modified to support Iterable because it's an interface not a concrete class (like Vector, which was modifed to support the Collections interface).</p> <p>If Enumeration was changed to support Iterable it would break a bunch of people's code.</p>
<p>It is possible to create an Iterable from any object with a method that returns an Enumeration, using a lambda as an adapter. In Java 8, use Guava's static <a href="https://guava.dev/releases/snapshot-jre/api/docs/com/google/common/collect/Iterators.html#forEnumeration(java.util.Enumeration)" rel="nofollow noreferre...
4,686
<p>Often, when I have a breakpoint on some line in Visual Studio, The program will run and stop there. great. I will then click the red circle (or press F9) to remove it. Obviously I don't want my program to keep stopping there. The problem is that the next time I refresh the page the breakpoint is back! The only way ...
<p>Helpful Key combo: to permanently delete all breakpoints, press CTRL + SHIFT + F9.</p>
<p>Wipe the breakpoint out using the Breakpoints Window (Ctrl + Alt + B).</p> <p>While debugging, when you hit the breakpoint, look at the BreakPoint window for the one that is bold. </p> <p>Then, right-click it and choose Delete.</p>
8,338
<p>Of course I am aware of Ajax, but the problem with Ajax is that the browser should poll the server frequently to find whether there is new data. This increases server load.</p> <p>Is there any better method (even using Ajax) other than polling the server frequently?</p>
<p>Yes, what you're looking for is COMET <a href="http://en.wikipedia.org/wiki/Comet_(programming)" rel="noreferrer">http://en.wikipedia.org/wiki/Comet_(programming)</a>. Other good Google terms to search for are AJAX-push and reverse-ajax.</p>
<p>You can also look into <a href="http://www.pushlets.com/" rel="nofollow noreferrer">Java Pushlets</a> if you are using jsp pages.</p>
4,033
<p>One of the joys of working for a government healthcare agency is having to deal with all of the paranoia around dealing with PHI (Protected Health Information). Don't get me wrong, I'm all for doing everything possible to protect people's personal information (health, financial, surfing habits, etc.), but sometimes ...
<p>I'm not sure if it'll work in all browsers but you should try setting autocomplete=&quot;off&quot; on the form.</p> <pre><code>&lt;form id=&quot;loginForm&quot; action=&quot;login.cgi&quot; method=&quot;post&quot; autocomplete=&quot;off&quot;&gt; </code></pre> <blockquote> <p>The easiest and simplest way to disable ...
<blockquote> <p>Is there a way for a site to tell the browser not to offer to remember passwords?</p> </blockquote> <p>The website tells the browser that it is a password by using <code>&lt;input type="password"&gt;</code>. So if you <em>must</em> do this from a website perspective then you would have to change tha...
5,229
<p>I have a .net project that has a web reference to a service. I would like to update that web reference as part of every build. Is that possible?</p>
<p>You can use MSBuild script with a task that calls <a href="http://msdn.microsoft.com/en-us/library/7h3ystb6(VS.80).aspx" rel="noreferrer">wsdl.exe</a> </p> <pre><code> &lt;Target Name="UpdateWebReference"&gt; &lt;Message Text="Updating Web Reference..."/&gt; &lt;Exec Command="wsdl.exe /o &amp;quot;$(OutDir...
<p>You can use svcutil (<a href="http://msdn.microsoft.com/en-us/library/aa347733.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/aa347733.aspx</a>) tool to generate the web reference for you. The tool will generate the proper client proxy classes and the proper config (and it can even merge it ...
19,308
<p>Strangest thing happened today with my ASP.NET MVC project. I built the installer project this afternoon, and all of a sudden, there were all these new dependencies! Yuck.</p> <pre><code>Microsoft.SqlServer.BatchParser.dll Microsoft.SqlServer.ConnectionInfo.dll Microsoft.SqlServer.Dmf.dll Microsoft.SqlServer.Mana...
<p>Well here we go:</p> <p><em>Microsoft.Web.Mvc.dll</em> is for experimental features of the MVC framework that probably won't make it into the final release</p> <p><em>Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll, Microsoft.VisualStudio.TeamSystem.Data.dll, Microsoft.VisualStudio.TeamSystem.Data.UnitT...
<p>To be honest, I do not have any idea of setup projects.</p> <p>But looks like your solution has some kind of database project (or database unit test project). You might need to exclude it from the list of things to build &amp; deploy.</p>
44,950
<p>What's the best way to get a regular anchor (<code>&lt;a href="..."&gt;</code>) to submit the form it is embedded in when clicked?</p> <pre><code>&lt;form&gt; &lt;ul&gt; &lt;li&gt; &lt;p&gt; The link could be &lt;span&gt;embedded &lt;a href="" onclick="?"&gt;at any level&lt;/...
<p>Why don't you use an <code>&lt;input&gt;</code> or <code>&lt;button&gt;</code> element and just tweak it with CSS? Then it works without Javascript and is therefore more reliable.</p>
<p>Similar <a href="https://stackoverflow.com/questions/313478/how-best-to-make-a-link-submit-a-form#313624">solution</a> to <a href="https://stackoverflow.com/users/35364/hasen-j">hasen j</a>, but using a recursive function to traverse the document.</p> <pre><code>function findParentForm(element) { if (element.pa...
40,418
<p>I've been doing a <code>convert(varchar,datefield,112)</code> on each date field that I'm using in 'between' queries in SQL server to ensure that I'm only accounting for dates and not missing any based on the time part of datetime fields.</p> <p>Now, I'm hearing that the converts aren't indexable and that there are...
<p>The best way to strip the time portion of a datetime field is using datediff and dateadd functions.</p> <pre><code> DateAdd(day, datediff(day,0, MydateValue), 0) </code></pre> <p>This takes advantedge of the fact that SQL Server stores dates as two integers, one representing the number of days since day "0" - ...
<p>There is also the way described at <a href="http://www.stillnetstudios.com/comparing-dates-without-times-in-sql-server/" rel="nofollow">http://www.stillnetstudios.com/comparing-dates-without-times-in-sql-server/</a></p> <pre><code>SELECT CAST(FLOOR(CAST( getdate() AS float )) AS datetime) </code></pre>
45,976
<p>I’m designing a part that will need to be autoclaved—it will be under steam at 121°C for about 15 min per job and I will want it to be able to go through the autoclave repeatedly. I ran a test PLA part through the autoclave and it warped noticeably; based on their glass transition temperatures, ABS (105ºC) and PETG ...
<p>It might seem that common 3D printer materials such as PLA and ABS should be capable of being autoclaved—unfortunately. However, although their melting temperatures are higher than autoclave temperature (typically 121ºC), their glass transition temperatures are below that limit so they can warp or undergo creep defo...
<p>You need to order the part printed by an SLA machine in PA, preferably with 10&nbsp;% mineral or glass content. The heat deflection temperature is suitably high for any autoclaving you'll do, and the material will resist most every that your lab and throw at it. I also went down this road with a part for my own lab ...
1,320
<p>I have a three-step process that is entirely reliant upon JavaScript and Ajax to load data and animate the process from one step to the next. To further complicate matters, the transition (forward and backward) between steps is animated :-(. As user's progress through the process anchor's appear showing the current ...
<p>Your closure scope chain is causing your problems. By declaring the handler function inline, you've created a closure. Obviously you did this to take advantage of the loop.</p> <p>However, since you have created a closure, you're playing by closure scoping rules. Those rules state that the local variables within...
<p>First, remember your execution scope in the click event. The <em>this</em> keyword in that context refers to the element being clicked on. Is there any way you can determine the dao_id from the element that is clicked on?</p>
40,755
<p>How do I track or get notified whenever a record is inserted or updated in a DB? I would like to notify an external application of the changes in near real time whenever such changes in DB occur. Are there DBMS independent and application programming language independent ways of doing this? If not, then is it possib...
<p>With SQL Server it is possible to load a DLL within SQL Server itself and call methods from this with extended stored procedures. The DLL could then notify other applications - usually via a TCP socket.</p>
<p>With MS-Access, I keep track of record changes or record additions with fields in the main table that store the user name and date when the record is created or updated.</p> <p>You need to use a windows API to record the user name, usually run when switchboard form is opened.</p> <p>I am digging to find a away to ...
41,508
<p>This is a broad question, so let me narrow it a bit. I am a graphic designer entering the world of web design. I'm not totally green in this field, but I know enough to know that I have a lot to learn. From friends and from posts on this site I realize there is often a harmful disconnect between design and developme...
<p>Perhaps the worst mistake that many designers make when working with developers is to assume that developers aren't creative, and that we couldn't possibly have any good ideas or inputs into the design. The fallacy of this is obvious because what we do all day, every day, is create things. It's taken for granted tha...
<p>Some ideas that may smooth the process : </p> <p>Talk to the developers directly and ask if they have any specific requirements. Different platforms have different needs and requirements. Communication is important.</p> <p>Get the basics of good HTML and CSS down. There are many references but you can try <a href=...
41,846
<p>I've been too lax with performing DB backups on our internal servers. </p> <p>Is there a simple command line program that I can use to backup certain databases in SQL Server 2005? Or is there a simple VBScript? </p>
<p>To backup a single database from the command line, use <a href="https://msdn.microsoft.com/en-us/library/ms162806.aspx" rel="noreferrer">osql</a> or <a href="https://msdn.microsoft.com/en-us/library/ms162773.aspx" rel="noreferrer">sqlcmd</a>.</p> <pre><code>"C:\Program Files\Microsoft SQL Server\90\Tools\Binn\osql....
<p>If you can find the DB files... "cp DBFiles backup/"</p> <p><em>Almost for sure <strong>not advisable</strong> in most cases</em>, but it's simple as all getup.</p>
14,923
<p>I am currently in the process of rewriting an application whereby teachers can plan curriculum online.</p> <p>The application guides teachers through a process of creating a unit of work for their students. The tool is currently used in three states but we have plans to get much bigger than that.</p> <p>One of the...
<p>I don't know that you actually need 4 tables for this. </p> <p>If you have a single table that tracks the parent_id and a level you can have infinite levels. </p> <blockquote> <p><strong>outcome</strong></p> <p>id, parent_id, level, name</p> </blockquote> <p>You can use recursion to track through the tree ...
<p>there is another way to handle trees in a database that is maybe not as "smart" than nested sets and other patterns described here, but that is really efficient and easy :</p> <p>instead of storing the level (or depth) of an item, you can store the full path in the tree, like this :</p> <pre><code>A B C D ...
44,128
<p>I need to programmatically determine out how many sectors, heads, and cylinders are on a physical disk from Windows XP. Does anyone know the API for determining this? Where might Windows expose this information?</p>
<p>Use <a href="http://msdn.microsoft.com/en-us/library/aa363216%28VS.85%29.aspx" rel="noreferrer">DeviceIoControl</a> with control code <a href="http://msdn.microsoft.com/en-us/library/aa365169%28VS.85%29.aspx" rel="noreferrer">IOCTL_DISK_GET_DRIVE_GEOMETRY</a> or <a href="http://msdn.microsoft.com/en-us/library/aa365...
<p>There's a control code you can pass to <a href="http://msdn.microsoft.com/en-us/library/aa365171(VS.85).aspx" rel="nofollow noreferrer">DeviceIoControl</a> to get the physical disk geometry.</p>
7,353
<p>In past many years I have registered on various applications and platforms hosted online or offline.</p> <p>Why white-spaces are not allowed in User Names as spaces are very natural to names and most of the computing systems can handle them efficiently.</p> <p>(Many people can raise similar questions about other s...
<p>I imagine because some code somewhere is still processing the input as a set of space seperated parameters, much the way the Windows command prompt handles unquoted file names. For example if you were to pass the user name to an external executable process, written in C, where the user name was passed on the comman...
<p>The only reason I know of that makes any sense is that if you're parsing tokens on whitespace, putting space in a user name will cause it to fail.</p> <p>However, I do agree with you: in today's environment, there's probably not a lot of reason to continue doing it, except where legacy compatibility makes sense (*n...
25,516
<p>I've been reading a few things about ASP.NET MVC, SOLID and so on, and I am trying to figure out a simple "recipe" for small-to-medium ASP.NET MVC apps that would put these concepts together; the issue that I am most concerned with is ending up with controllers that are too complex and being like code-behind files i...
<p>Ian Cooper had a good post on exactly this recently:</p> <p><a href="http://codebetter.com/blogs/ian_cooper/archive/2008/12/03/the-fat-controller.aspx" rel="nofollow noreferrer">The Fat Controller</a></p>
<p>These walkthroughs are quite helpful:</p> <p><a href="http://quickstarts.asp.net/previews/mvc/mvc_Framework.htm" rel="nofollow noreferrer">MVC Framework and Application Structure</a></p> <p><a href="http://quickstarts.asp.net/previews/mvc/mvc_CreateMvcProjectWalkthrough.htm" rel="nofollow noreferrer">Walkthrough: ...
45,868
<p>Given the following:</p> <pre><code>&amp;row-&gt;count </code></pre> <p>Would &amp;(row->count) be evaluated or (&amp;row)->count be evaluated in C++?</p> <p>EDIT: Here's a great <a href="http://www.cppreference.com/wiki/operator_precedence" rel="nofollow noreferrer">link</a> for C++ precedence.</p>
<p>As far as precedence rules go, I've always liked the one put forth by Steve Oualline in "Practical C":</p> <blockquote> <p>There are fifteen precedence rules in C (&amp;&amp; comes before || comes before ?:). The practical programmer reduces these to two:</p> <p>1) Multiplication and division come be...
<p>&amp;(row->count)</p>
18,723
<p>I'm working on a kind of unique app which needs to generate images at specific resolutions according to the device they are displayed on. So the output is different on a regular Windows browser (96ppi), iPhone (163ppi), Android G1 (180ppi), and other devices. I'm wondering if there's a way to detect this automatical...
<p>There is the <code>resolution</code> CSS media query — it allows you to limit CSS styles to specific resolutions:</p> <ul> <li><a href="http://www.w3.org/TR/css3-mediaqueries/#resolution" rel="noreferrer">http://www.w3.org/TR/css3-mediaqueries/#resolution</a></li> </ul> <p>However, <a href="http://www.browsersuppo...
<p>Can't you do anything else? For instance, if you are generating an image to be recognized by a camera (i.e. you run your program, swipe your cellphone across a camera, magic happens), can't you use something size-independent?</p> <p>If this is an application to be deployed in controlled environments, can you provid...
35,361