instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>I'm writting a financial C# application which receive messages from the network, translate them into different object according to the message type and finaly apply the application business logic on them.</p>
<p>The point is that after the business logic is applied, I'm very sure I will never need this instance aga... | <p>Don't delete them right away. Calling the garbage collector for each object is a bad idea. Normally you <em>really</em> don't want to mess with the garbage collector at all, and even time critical processes are just race conditions waiting to happen if they're that sensitive. </p>
<p>But if you know you'll have ... | <p>In theory the GC shouldn't run if your CPU is under heavy load or unless it really needs to. But if you have to, you may want to just keep all of your objects in memory, perhaps a singleton instance, and never clean them up unless you're ready. That's probably the only way to guarantee when the GC runs.</p>
| 11,087 |
<p>I am creating a desktop app in Delphi and plan to use an embedded database. I've started the project using SQlite3 with the DISQLite3 library. It works but documentation seems a bit light. I recently found Firebird (yes I've been out of Windows for a while) and it seems to have some compelling features and support... | <p>I'm using Firebird 2.1 Embedded and I'm quite happy with it.I like the fact that the database size is practically unlimited (tested with > 4 GB databases and it works) and that the database file is compatible with the Firebird Server so I can use standard tools for database management and inspection. Distribution co... | <p>Firebird all the way. Does pretty well everything and so far version 2.1 is very solid.</p>
| 27,480 |
<p>I've got a (SQL Server 2005) database where I'd like to create views on-the-fly. In my code, I'm building a CREATE VIEW statement, but the only way I can get it to work is by building the entire query string and running it bare. I'd like to use parameters, but this:</p>
<pre><code>SqlCommand cmd = new SqlCommand(... | <p>Maybe I've not understood it correctly, but what prevents you to do:</p>
<pre><code>viewname="foo";
viewwhere="* from bar";
SqlCommand cmd = new SqlCommand("CREATE VIEW "+viewname+" AS SELECT "+viewwhere);
</code></pre>
| <p>It looks to me like you are trying to create a dynamic query using parameters, which is not how a parameterized query is intended to work. They do not simply get concatenated into the string. </p>
<p>If what you are trying to prevent is SQL injection, what I would do is validate that the view name only contains al... | 32,462 |
<p>Is it possible to install/register another local server instance in any SqlServer version, besides the default local instance, where only one SqlServer version is installed? </p>
| <p>Yes, it's possible. I have several combinations in my servers. I have one server that has both SQL Server 2000 and 2005 installed side by side. My desktop at work is a Windows 2003 Server, and I have SQL Server 2005 and 2008 installed side by side.</p>
<p>What you want is called a named instance. There will be a sc... | <p>Yes. Usually the installer will detect that you have one or more existing instances and will prompt you for a instance name. We have setup three SQL Server 2000 standard editions on a development box to emulate the three production servers at one of our clients.</p>
| 17,458 |
<p>How do I iterate over a set of records in RPG(LE) with embedded SQL?</p>
| <p>Usually I'll create a cursor and fetch each record.</p>
<pre><code> //***********************************************************************
// Main - Main Processing Routine
begsr Main;
exsr BldSqlStmt;
if OpenSqlCursor() = SQL_SUCCESS;
dow FetchNextRow() = SQL_SUCCESS;
exsr P... | <p>As Mike said, iterating over a cursor is the best solution. I would add to give slightly better performance, you might might want to fetch into an array to process in blocks rather than one record at a time.</p>
<p>Example:</p>
<pre><code> EXEC SQL
OPEN ... | 14,644 |
<p>What libraries are available for writing xml-rpc clients in native C++ or C?</p>
| <p>You might want to check out either <a href="http://xmlrpc-c.sourceforge.net/" rel="noreferrer">xmlrpc-c</a> or <a href="http://xmlrpcpp.sourceforge.net/" rel="noreferrer">xmlrpc++</a>.</p>
| <p>I found a <a href="http://www.xmlrpc.com/directory/1568/implementations" rel="nofollow noreferrer">list of xml-rpc implementations in many different languages</a>. Hopefully this list will be useful to others.</p>
| 27,476 |
<p>Does anyone know <strong>IF</strong>, <strong>WHEN</strong> or <strong>HOW</strong> I can get <a href="https://memcached.org/" rel="noreferrer">Memcached</a> running on a Windows 64bit environment? </p>
<p>I'm setting up a new hosting solution and would much prefer to run a 64bit OS, and since it's an ASP.Net MVC s... | <p>North Scale labs have released a build of memcached 1.4.4 for Windows x64:</p>
<p><a href="http://blog.couchbase.com/memcached-windows-64-bit-pre-release-available" rel="noreferrer">http://blog.couchbase.com/memcached-windows-64-bit-pre-release-available</a></p>
<p><a href="http://labs.northscale.com/memcached-pac... | <p>Are you sure that the 32-bit version doesn't just run on 64-bit Windows, without modification? Most things do.</p>
<p>Failing that, have you actually tried just compiling it for 64-bit? A brief scan of a few Google Groups etc where people asked this same question suggests that that may be exactly the solution to th... | 3,038 |
<p>Is there a way to turn this 'feature' off? </p>
| <p>Awesome, I just found it:</p>
<p><code>Tools -> Options -> Sql Server Object Explorer -> General Scripting Options</code></p>
<p><code>Script USE <database> -> False</code></p>
| <p>Tools -> Options -> Sql Server Object Explorer -> Scripting -> <strong>Script USE <database></strong> (under the <em>General scripting options</em> heading).</p>
<p>That's in SQL Server 2008 Management Studio, I'm told it's there in 2005, too.</p>
| 19,144 |
<p>I am about 2 minor revisions behind.</p>
| <p>I'm one of those guys who always upgrade stuff. But have a look at the official <a href="http://codeigniter.com/user_guide/changelog.html" rel="nofollow noreferrer">changelog</a> and see if the many bugfixes and new features are interesting enough to you.</p>
<p>I noticed 1.7.0 is out, and I'm definetly going to up... | <p>I always watch out for the latest version especially for a pet project of mine. There was just a problem with my upgrade to 1.7.0 which broke my authentication processes using CI sessions.</p>
<p>I ended up building my own Auth library using Native sessions.</p>
| 33,463 |
<p>I have a usercontrol that has several public properties. These properties automatically show up in the properties window of the VS2005 designer under the "Misc" category. Except two of the properties which are enumerations don't show up correctly.</p>
<p>The first on uses the following enum:</p>
<pre><code>publi... | <p>I made a little test with your problem (I'm not sure if I understood it correctly), and these properties shows up in the designer correctly, and all enums are shown appropriately. If this isn't what you're looking for, then please explain yourself further. </p>
<p>Don't get hang up on the _Ugly part thrown in there... | <p>Some things to try (designer mode in VS2005 I have found to be somewhat flaky):</p>
<ol>
<li>Open your web.config and add: <code>batch="false"</code> to your <code><compilation></code> tag.</li>
<li><p>Try setting defaults to your enums:</p>
<pre><code>public enum VerticalControlAlign
{
Center = 0,
T... | 8,961 |
<p>I have been going back and forth between C# and Java for the last 8 years. </p>
<p>One thing that strikes me is that I have completely stopped using the "Template Method" design pattern in C#. Actually, in C# I Have come to think of this pattern as an anti-pattern. </p>
<p><a href="http://en.wikipedia.org/wiki/Tem... | <p>When I used Java, yes. But for languages with "closures/delegates/function", Lua in my case, no I don't anymore, instead I've been leaning more and more towards <a href="http://en.wikipedia.org/wiki/Decorator_pattern" rel="nofollow noreferrer">decoration pattern</a> for most of my needs.</p>
| <p>Yes, I use template method all the time, in the D programming language. Closures, delegates and function pointers are by their nature very loosely coupled to the base class. This is a good thing when you want this loose coupling. On the other hand, sometimes the behaviors you're customizing are by their nature ve... | 39,735 |
<p>Being lazy (and liking DRY code), I'm the kind of guy who's going to write a few little wrappers for recurring HTML markup. Those provided by Rails are good already, but sometimes I have something a little more specific that I know I'm going to repeat over and over.</p>
<p>In some situations a partial can be the so... | <p>Good question! This is a technique I should abuse more frequently.</p>
<pre><code> #I go in environment.db (presumably it will work in one of the per-environment files, too.)
Dependencies.explicitly_unloadable_constants << 'NameOfHelperToReloadHere'
</code></pre>
<p>That array starts out empty, incid... | <p>It's not a real solution but you could use tests (TestUnit, RSpec or whatever) to make sure your helpers work as expected. That way, you wouldn't rely on automatic reloading of your helpers so much.</p>
| 19,644 |
<p>According to Wikipedia, Tetrahydrofuran dissolves PLA. It also apparently dissolves PET.</p>
<blockquote>
<p>THF is considered a relatively nontoxic solvent, with the median lethal dose (LD<sub>50</sub>) comparable to that for acetone.</p>
</blockquote>
<p>Wikipedia further states that it's not particularly dang... | <p>According to Shuichi Sato, Daiki Gondo, Takayuki Wada, Shinji Kanehashi & Kazukiyo Nagai: <em>Effects of various liquid organic solvents on solvent‐induced crystallization of amorphous poly(lactic acid) film</em> in <em>Journal of Applied Polymer Science</em>, Volume 129 Issue 3 (2013), p1607-1617<sup><a href="h... | <p>From what I have read, THF is not super effective, it seems that Dichloromethane or DCM is actually a better solvent. Unfortunately I have no personal experience with either. </p>
<p>It is rather nasty though, as the LD<sub>50</sub> is just 0.5 to 5 g/kg<sup><a href="https://www.researchgate.net/post/Solubility_of... | 519 |
<p>This is an antique problem with VB6 DLL and COM objects but I still face it day to day. What tools or procedures can be used to see which DLL file or version another DLL is referencing?</p>
<p>I am referring to compiled DLLs at runtime, not from within VB6 IDE.</p>
<p>It's DLL hell.</p>
| <p><a href="http://www.dependencywalker.com/" rel="noreferrer">Dependency Walker</a> shows you all the files that a DLL links to (or is trying to link to) and it's free.</p>
| <p><a href="http://technet.microsoft.com/en-us/sysinternals/default.aspx" rel="nofollow noreferrer">ProcessExplorer</a> shows you all the DLLs that are currently loaded in a process at a particular moment. This gives you another angle on <a href="http://www.dependencywalker.com/" rel="nofollow noreferrer">Dependency Wa... | 9,490 |
<p>I have an ASP.NET MVC (Beta 1) website that I'm using themes with. When I start my site (I'm still running using the ASP.Net Development Web Server) the default page gives me this error:</p>
<pre><code>Server Error in '/' Application.
Using themed css files requires a header control on the page. (e.g. <head run... | <p>The error is telling you that your ASP.NET page (or master page) needs to have a <head runat="server"> tag. Without it, you cannot use themes.</p>
<p>Since server side header tags shouldn't have a dependency on viewstate (as they are not contained in forms), it might still work.</p>
<p>Having said that, themes... | <p>I like your idea Jason, thanks for the tip. That would actually be very easy for me to implement. :)</p>
<p>Just as an fyi for anyone trying to do what I am/was doing with the Themes, I simply added the header element to the default.aspx page, and all was taken care of - just what Richard suggested.</p>
| 28,421 |
<p>I develop one application using VB.net (200%) that connects to MS-Access Database, I use TableAdapter and Dataset for connection to the Access DB file.</p>
<p>I need to implement a simple transaction method (commit, rollback) in saving to the DB?</p>
<p>Is there a way to do that without the need to use inline SQL ... | <p>As I read Microsoft Jet (Access DB Engine) supports transactions. So you can create a transaction like this (example from <a href="http://www.codeproject.com/KB/database/transactions.aspx" rel="noreferrer">CodeProject</a>):</p>
<pre><code> SqlConnection db = new SqlConnection("connstringhere");
SqlTransa... | <p>You can find a bunch of data access tutorials at <a href="http://www.asp.net/learn/data-access/" rel="nofollow noreferrer">http://www.asp.net/learn/data-access/</a></p>
| 38,163 |
<p>I wrote a SQL function to convert a datetime value in SQL to a friendlier "n Hours Ago" or "n Days Ago" etc type of message. And I was wondering if there was a better way to do it. </p>
<p>(Yes I know "don't do it in SQL" but for design reasons I have to do it this way).</p>
<p>Here is the function I've written:</... | <p>As you say, I probably wouldn't do it in SQL, but as a thought exercise have a MySQL implementation:</p>
<pre><code>CASE
WHEN compare_date between date_sub(now(), INTERVAL 60 minute) and now()
THEN concat(minute(TIMEDIFF(now(), compare_date)), ' minutes ago')
WHEN datediff(now(), compare_date) = 1... | <p>The posts above gave me some good ideas so here is another function for anyone using SQL Server 2012.</p>
<pre><code> CREATE FUNCTION [dbo].[FN_TIME_ELAPSED]
(
@TIMESTAMP DATETIME
)
RETURNS VARCHAR(50)
AS
BEGIN
RETURN
(
SELECT TIME_ELAPSED =
CASE
... | 7,283 |
<p>I own a website and I wonder if there is a script that get files for me from other links on the net a load it to my server.</p>
<p>Suppose I found a file with a size of 400 mb, I want to host it on my server. The normal way I used is to download the file to my pc then upload it to my server but is there a script or... | <p>As long as you have PHP use:</p>
<pre><code><?php
$remotefh = fopen('http://domain.tld/path/to/file.ext', 'r');
$localfh = fopen('local/file.ext', 'w');
while(!feof($remotefh))
{
fwrite($localfh, fread($remotefh, '4096'));
}
fclose($remotefh);
fclose($localfh);
?>
</code></pre>
| <p>If you can remote into your server you could just navigate to the web page containing your download from within the server and save it directly to the server that way.</p>
| 46,927 |
<p>In C#, what is the best way to access a property of the derived class when the generic list contains just the base class.</p>
<pre><code>public class ClassA : BaseClass
{
public object PropertyA { get; set; }
}
public class ClassB: BaseClass
{
public object PropertyB { get; set; }
}
public class BaseClass
... | <p>Certainly you can downcast, like so:</p>
<pre><code>for (int i = 0; i < MyList.Count; i++)
{
if (MyList[i] is ClassA)
{
var a = ((ClassA)MyList[i]).PropertyA;
// do stuff with a
}
if (MyList[i] is ClassB)
{
var b = ((ClassB)MyList[i]).PropertyB;
// do stuff wi... | <p>You might have some issues with Generics and subclasses (in which case you should go back to System.Collections.ArrayList), but you have to cast the BaseClass to the subclass you wish to use. If you use the 'as' directory, it will succeed if the BaseClass can be casted to the subclass, or it will be null if it canno... | 25,851 |
<p>I have a UIScrollView that shows vertical data, but where the horizontal component is no wider than the screen of the iPhone. The problem is that the user is still able to drag horizontally, and basically expose blank sections of the UI. I have tried setting:</p>
<pre><code>scrollView.alwaysBounceHorizontal = NO;
s... | <p>That's strange, because whenever I create a scroll view with frame and content size within the bounds of the screen on either dimension, the scroll view does not scroll (or bounce) in that direction.</p>
<pre><code>// Should scroll vertically but not horizontally
UIScrollView *scrollView = [[UIScrollView alloc] ini... | <p>In my case, i just need to set this line:</p>
<p><code>collectionView.bounces = false</code></p>
| 20,941 |
<p>How can you reliably and dynamically load a JavaScript file? This will can be used to implement a module or component that when 'initialized' the component will dynamically load all needed JavaScript library scripts on demand.</p>
<p>The client that uses the component isn't required to load all the library script ... | <p>You may create a script element dynamically, using <a href="http://www.prototypejs.org/" rel="nofollow noreferrer">Prototypes</a>:</p>
<pre><code>new Element("script", {src: "myBigCodeLibrary.js", type: "text/javascript"});
</code></pre>
<p>The problem here is that we do not know <em>wh... | <p>all the major javascript libraries like jscript, prototype, YUI have support for loading script files. For example, in YUI, after loading the core you can do the following to load the calendar control</p>
<pre><code>var loader = new YAHOO.util.YUILoader({
require: ['calendar'], // what components?
base: '... | 4,153 |
<p>Scenario:</p>
<p>Let's say I have four very similar applications (i.e. most of the functionality is the same, but they are different enough to justify each being seperate applications).</p>
<p>What is the best way to re-use the common functionality code between them? COM+? Web services?</p>
<p>In general I'd ty... | <p>If possible, you can create a Visual Studio solution with a DLL Project and a number of Web Application or Website projects. The web projects would have a "project" type reference to the DLL project, and everything would build at the same time. Then you could use the "Publish" tool for each of your web projects as... | <p>You can have your project, but instead of adding the common dll to the project reference add the common project to all solutions and then add a reference to the common project.</p>
<p>This way you can have one project on any number of solutions and you have your problem solved ;)</p>
| 43,363 |
<p>I have created a json object from ruby with cobravsmongoose, however the attributes have the <strong><code>@</code></strong> symbol in front of them. Whenever I try to access them with standard object notation in JavaScript, such as <code>object.object.object.@attribute</code> I get a <em>parse error</em>. Is ther... | <p>I would tend to be wary about using jobs like this to control execution. Either the delay between successive jobs would tend to be too short for the DBA to figure out what job to kill/ pause/ etc. or the delay would be long enough that a significant fraction of the run time would be spent in delays between successi... | <p>Another avenue to explore would be the dbms scheduler's support tools for execution windows and resource plans.</p>
<p><a href="http://www.oracle-base.com/articles/10g/Scheduler10g.php" rel="nofollow noreferrer">http://www.oracle-base.com/articles/10g/Scheduler10g.php</a></p>
<p>and also:</p>
<p><a href="http://d... | 31,349 |
<p>Are asymmetrical cryptographic keys fundamentally inter-convertible between the major key container formats? For example, can I convert an X.509 key file into a PGP or OpenGPG key file? </p>
<p>And--assuming the answer is yes--is it "security neutral" to keep one key pair in whatever format and convert into whichev... | <p>Yes and no: yes, the RSA keys embedded into certificates and privkeys are just numbers. You can extract them from the certificate and use them to build keys in other formats. This is commonly done to convert between different certificate formats. </p>
<p>PGP has some support for X.509 for S/MIME, but no ability to ... | <p>I'd also have a look at OpenSSL. It has so many different -in and -out functions that will likely be able to convert certs. from one type to the other.</p>
<p>Have a look at <a href="http://marc.info/?l=openssl-users&m=105162569405053&w=2" rel="nofollow noreferrer">http://marc.info/?l=openssl-users&m=10... | 8,160 |
<p>I have been developing websites for a couple of years now and I almost never check if my pages are valid HTML and CSS. My check is by using a site such as browsershots.org and checking how it looks in all the different browsers. However recently I have been taking a college course and the prof wants us to validate e... | <p>Yes, for the reasons <a href="https://stackoverflow.com/questions/170827/do-you-validate-your-websites">already covered here</a>.</p>
<p>I realise you are not necessarily talking about commercial websites, but it is good to act as if you are anyway.</p>
| <p>Yes. Your teacher may reduce your grade otherwise.</p>
| 23,812 |
<p>currently I'm dealing with a video processing software in which the picture data (8bit signed and unsigned) is stored in arrays of 16-aligned integers allocated as</p>
<pre><code>__declspec(align(16)) int *pData = (__declspec(align(16)) int *)_mm_malloc(width*height*sizeof(int),16);
</code></pre>
<p>Generally, wou... | <p>If you're planning to use SSE, storing the data in its native size (8-bit) is almost certainly a better choice, since loads of operations can be done without unpacking, and even if you need to unpack for pmaddwd or other similar instructions, its still faster because you have to load less data.</p>
<p>Even in scala... | <p>on the contrary, packing and unpacking is CPU commands expensive.</p>
<p>if you want to make a lot of a random pixel operations - it is faster to make it an array of int so that each pixel has its own address. </p>
<p>but if you iterate through your image sequencly you want to make a chars array so that it is smal... | 16,729 |
<p>I recently ran out of disk space on a drive on a FreeBSD server. I truncated the file that was causing problems but I'm not seeing the change reflected when running <code>df</code>. When I run <code>du -d0</code> on the partition it shows the correct value. Is there any way to force this information to be updated... | <p>This probably centres on <em>how</em> you truncated the file. <em>du</em> and <em>df</em> report different things as <a href="http://www.unix.com/unix-dummies-questions-answers/29223-sco-unix-disk-space.html" rel="nofollow noreferrer">this post on unix.com explains</a>. Just because space is not used does not necess... | <p>Does df --sync work?</p>
| 4,836 |
<p>There's this Excel file I want users to be able to download from my server. There must be an easy way to initiate the download of the file after a click on the "Download" button... but I have no clue how to make that happen.</p>
<p>I have this so far: (VBscript and ASP)</p>
<pre><code><head>
<script type... | <p>you're not going to believe this.
Found it...</p>
<pre><code>function exportmasterfile()
{ var url='../documenten/Master-File.xls';
window.open(url,'Download');
}
</code></pre>
<p>Sorry guys!</p>
| <p>Here's a VBScript function to download a binary file.</p>
<pre><code>Function SaveUrlToFile(url, path)
Dim xmlhttp, stream, fso
' Request the file from the internet.
Set xmlhttp = CreateObject("MSXML2.XMLHTTP")
xmlhttp.open "GET", url, false
xmlhttp.send
If xmlhttp.status <> 200 Then
SaveUrlT... | 45,423 |
<p>I'm lead to believe that I cannot count on the order of items added to a dictionary for enumeration purposes.</p>
<p><strong>Is there a class (generic if possible) to which items may be added with a key and which can be enumerated in addition order or which can be retrieved by key?</strong></p>
<p>Clarification: I... | <p>First, on your primary assumption, you are correct. A normal dictionary makes no guarantees about the order of enumeration.</p>
<p>Second, you'll need to be careful about going the <code>SortedDictionary</code> with custom <code>IComparer</code> route. The comparer is used for key equality as well as sorting the ... | <p>You could create your own generic class (and have it derive from Dictionary<,> or SortedDictionary<,>) and implement your own version of GetEnumerator() in which you can sort the dictionary by key and return the values sorted (or if you use SortedDictionary then it's already sorted).</p>
<p>You could also use... | 27,478 |
<p>Have recently been given a project to complete which uses XML quite extensively.Am looking at an existing project which uses SOA. Am eager to get up to speed on SOA and so wondered if anyone coulod recommend any good sites / books etc.</p>
<p>I have a book by Thomas Erl called Service-Oriented Architecture and am l... | <p>From a not so technical point of view there is this great book published by Sogeti and IBM called <a href="https://rads.stackoverflow.com/amzn/click/com/9075414145" rel="noreferrer" rel="nofollow noreferrer">SOA For Profit</a> wich covers SOA processes SOA Governance quite well. Its a short interesting book that giv... | <p>Maybe these ressources might help you:</p>
<p><a href="http://soa.sys-con.com/" rel="nofollow noreferrer">http://soa.sys-con.com/</a>
<a href="http://www-128.ibm.com/developerworks/webservices/newto/" rel="nofollow noreferrer">http://www-128.ibm.com/developerworks/webservices/newto/</a></p>
| 43,213 |
<p>From the haskell report:</p>
<blockquote>
<p>The quot, rem, div, and mod class
methods satisfy these laws if y is
non-zero:</p>
<pre><code>(x `quot` y)*y + (x `rem` y) == x
(x `div` y)*y + (x `mod` y) == x
</code></pre>
<p><code>quot</code> is integer division truncated
toward zero, while the result ... | <p>Many languages have a "mod" or "%" operator that gives the remainder after division with truncation towards 0; for example C, C++, and Java, and probably C#, would say:</p>
<pre><code>(-11)/5 = -2
(-11)%5 = -1
5*((-11)/5) + (-11)%5 = 5*(-2) + (-1) = -11.
</code></pre>
<p>Haskell's <code>quot</code> and <code>rem</... | <p>A simple example where it would matter is testing if an integer is even or odd.</p>
<pre><code>let buggyOdd x = x `rem` 2 == 1
buggyOdd 1 // True
buggyOdd (-1) // False (wrong!)
let odd x = x `mod` 2 == 1
odd 1 // True
odd (-1) // True
</code></pre>
<p>Note, of course, you could avoid thinking about these issues ... | 44,122 |
<p>Apart from commercial tools like Dundas, are there any open source or cheaper (and decent) 3rd party charting tools/controls for reporting services out there? </p>
| <p>You can try ChartFX for ReportingServices. It is not too expensive.</p>
<p><a href="http://www.softwarefx.com/sfxSqlProducts/cfxReportingServices/" rel="nofollow noreferrer">http://www.softwarefx.com/sfxSqlProducts/cfxReportingServices/</a> </p>
| <p>Microsoft chart controls is nice. I had used it in one of my project. </p>
<p>read more: <a href="http://parasdoshi1989.wordpress.com/2010/10/03/how-to-include-charts-in-visual-studio-2008-express-edition-using-microsoft-chart-control/" rel="nofollow">http://parasdoshi1989.wordpress.com/2010/10/03/how-to-include-ch... | 15,273 |
<p>I'm currently generating SQL insert statements from more than one tables, and in the generated data I need to use a CASE statement, like this:</p>
<pre><code>select 'INSERT INTO TABLE1 (f1, f2, f3, f4 ...) values ('
||t.f1||','
||CASE
WHEN t.f2 > 0 THEN '1'
ELSE '0'
... | <p>Use END instead of END CASE</p>
<pre><code>select 'INSERT INTO TABLE1 (f1, f2, f3, f4 ...) values ('
||t.f1||','
||CASE
WHEN t.f2 > 0 THEN '1'
ELSE '0'
END||','||t.f2
from table2 t , table3 t3
</code></pre>
| <p>For some similar situations, the "decode" function works quite well. </p>
<p>You might be able to feed the expression (t.f2 > 0) into a decode, and then translate
'T' into '1' and 'F' into '0'.</p>
<p>I haven't tried this.</p>
| 17,849 |
<p>I want to try to convert a string to a Guid, but I don't want to rely on catching exceptions (</p>
<ul>
<li>for performance reasons - exceptions are expensive</li>
<li>for usability reasons - the debugger pops up </li>
<li>for design reasons - the expected is not exceptional</li>
</ul>
<p>In other words the code:<... | <p><strong>Performance Benchmarks</strong></p>
<pre><code>Catch exception:
10,000 good: 63,668 ticks
10,000 bad: 6,435,609 ticks
Regex Pre-Screen:
10,000 good: 637,633 ticks
10,000 bad: 717,894 ticks
COM Interop CLSIDFromString
10,000 good: 126,120 ticks
10,000 bad: 23,134 ticks
</co... | <p>if TypeOf ctype(myvar,Object) Is Guid then .....</p>
| 13,043 |
<p>I have a weird bug involving Flash text and hyperlinks, htmlText in a TextField with <code><a></code> tags seem to truncate surrounding space:</p>
<p><a href="https://i.stack.imgur.com/FDA7a.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FDA7a.gif" alt="output"></a></p>
<p>Once I place my... | <p>Make sure you styleSheet declares what it is supposed to do with Anchors. You are obviously using htmlText if your using CSS so soon as it sees < in front of "a href" it immedietly looks for the CSS class definition for a and when it doesn't find one, the result is the different looking text you see.</p>
<p>Add... | <p>Does it make any difference if you put non-breaking spaces immediately before and after the anchor element?</p>
<pre><code><p> ... &nbsp;<a ... >Link text</a>&nbsp; ... </p>
</code></pre>
<p>Admittedly a workaround at best but it might buy you some time to research a real solution.<... | 7,263 |
<p>I want the IIS server to return <code>HTTP 304 (Not Modified)</code> when a particular file is accessed. </p>
<p>How can I set this up? </p>
| <p>Just subclass the type</p>
<pre><code>>>> class X(str):
... def my_method(self):
... return int(self)
...
>>> s = X("Hi Mom")
>>> s.lower()
'hi mom'
>>> s.my_method()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdi... | <p>Assuming that you can not change builtin classes.
To simulate a "class reopening" like Ruby in Python3 where <code>__dict__</code> is an mappingproxy object and not dict object :</p>
<pre><code>def open(cls):
def update(extension):
for k,v in extension.__dict__.items():
if k != '__dict__':
... | 45,908 |
<p>I am using a Flash Forge Creator, and when I print big parts (only in this case) I have about 25% of the bottom of the printed object sticking very hard to its support layer. And I spend a lot of time removing it with a cutter.</p>
<p>Is there any clue or good practice to avoid that?</p>
<p>I use ReplicatorG for m... | <p>I finally found out two causes:</p>
<ol>
<li><p>The 3D printer has default settings for ABS, and since there is no printer bed settings in ReplicatorG, the bed temperature was set to 110 °C instead of 60°C. I fixed the setting directly on the printer itself.</p></li>
<li><p>It seems that one side of the ... | <p>According to the manufacturer:</p>
<blockquote>
<p>... you are able to choose your favorite software such as
FlashPrint, Simplify3D, Cura and more.</p>
</blockquote>
<p>Not being familiar with ReplicatorG, I know that other slicer software can set the distance between supports and print (in terms of the amount... | 1,234 |
<p>I am developing an .net application which heavely depends on plugins. The application itself contains an connection to a remote server.</p>
<p>Recently I digged into Application domains and see them as the ideal solution for isolating the plugin code from the rest of the application. </p>
<p>However there is one b... | <p>Have you tried deriving from <a href="http://msdn.microsoft.com/en-us/library/system.marshalbyrefobject.aspx" rel="noreferrer">MarshalByRefObject</a>? It's a pain in that it screws up your inheritance hierarchy, but I think it's what you want.</p>
<p>From the docs:</p>
<blockquote>
<p>MarshalByRefObject is the b... | <p>To talk to the same instance between AppDomains, it must inherit from <a href="http://msdn.microsoft.com/en-us/library/system.marshalbyrefobject.aspx" rel="nofollow noreferrer">MarshalByRefObject</a>. Done this way, every method call to the object (including properties etc) is actually a remoting call to the other a... | 41,830 |
<p><strong>Here's the situation</strong>: I'm trying my hand at some MySpace page customisations. If you've <a href="https://stackoverflow.com/questions/116610/myspace-dom">ever tried</a> [stackoverflow], I'm sure you understand how frustrating it can be.<br>
Basically it can be all customised via CSS, within a certain... | <p>Have you tried the various values for the "overflow" css property? I think that may do what you need in some permutation.</p>
| <p>Your options are pretty limited, if you are using only CSS. You can try</p>
<pre><code> overflow: hidden
</code></pre>
<p>to hide the offending parts. CSS 3 supports <a href="http://www.w3.org/TR/css3-text/#wrapping" rel="nofollow noreferrer">text-wrap</a>, but support for it is probably non-existent. IIRC there i... | 16,715 |
<p>Because I am a newbie I am trying to log out any errors that may occur with stored procedures I write. I understand Try/Catch in SQL 2005 and error_procedure(), ERROR_MESSAGE() and the other built in functions. What I can't figure out how to do is capture what record caused the error on an update.</p>
<p>I could ... | <p>A try/catch block like this...</p>
<pre><code>BEGIN TRY
-- Your Code Goes Here --
END TRY
BEGIN CATCH
SELECT
ERROR_NUMBER() AS ErrorNumber,
ERROR_SEVERITY() AS ErrorSeverity,
ERROR_STATE() AS ErrorState,
ERROR_PROCEDURE() AS ErrorProcedure,
ERROR_LINE() AS ErrorLine,... | <p>Alternative: how about using transactions and @@IDENTITY ?</p>
<pre><code>DECLARE @problemClientID INT
BEGIN TRANSACTION
UPDATE ... --etc
IF @@ERROR <> 0
BEGIN
ROLLBACK TRANSACTION
SET @problemClientID = @@IDENTITY
PRINT N'There was a problem...' --etc
END
ELSE
... | 46,577 |
<p>I noticed that you can call Queue.Synchronize to get a thread-safe queue object, but the same method isn't available on Queue<T>. Does anyone know why? Seems kind of weird.</p>
| <p><strong>Update</strong> - in .NET 4, there now is <code>ConcurrentQueue<T></code> in System.Collections.Concurrent, as documented here <a href="http://msdn.microsoft.com/en-us/library/dd267265.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/dd267265.aspx</a>. It's interesting to note t... | <p>(I assume you mean Queue<T> for the second one.)</p>
<p>I can't specifically answer the question, except that the IsSynchronized and SyncRoot properties (but not Synchronise() explicitly) are inherited from the ICollection interface. None of the generic collections use this and the ICollection<T> interf... | 13,265 |
<p>Trying to keep all the presentation stuff in the xhtml on this project and I need to format some values in a selectItem tag have a BigDecimal value and need to make it look like currency. Is there anyway to apply a <code><f:convertNumber pattern="$#,##0.00"/></code> Inside a <code><f:selectItem></code> t... | <p>After doing some more research here I'm pretty convinced this isn't possible with the current implementation of JSF. There just isn't an opportunity to transform the value.</p>
<p><a href="http://java.sun.com/javaee/javaserverfaces/1.2/docs/tlddocs/f/selectItem.html" rel="nofollow noreferrer">http://java.sun.com/ja... | <p>You could setup a converter with that pattern, but that sounds like the exact opposite to what you want.</p>
| 11,202 |
<p>I'm having a frustrating problem with my recent built custom 3D printer
so every single print I made, from the third layer, the nozzle is "rubbing" on the already placed filament. This results in a complete mess, melting the previous layers with the nozzle / new extrusions coming, getting malformed and ou... | <p>I have made some learning on mechanical setup and discovered some issues on my printer, there are few:</p>
<ol>
<li>Bed warped, even with glass (thin thickness), making BAL confused with Z-movement over the bed.</li>
<li>Overextrusion making layer oversized in terms of thickness.</li>
<li>Some of missing mechanical... | <p>The first picture seems to show layer shift. Usual causes include:</p>
<ol>
<li>Missed Z movement, so the nozzle hits the build and the layer is offset.</li>
<li>Bad acceleration in X/Y, so there is missed X/Y movement, and the layer is offset.</li>
</ol>
<p>Adjustment: reduce Z G0 speed, and reduce X/Y speeds (G0... | 697 |
<p>How do I use groovy to search+replace in XML?</p>
<p>I need something as short/easy as possible, since I'll be giving this code to the testers for their SoapUI scripting.</p>
<p>More specifically, how do I turn:</p>
<pre><code><root><data></data></root>
</code></pre>
<p>into:</p>
<pre><c... | <p>Some of the stuff you can do with an XSLT you can also do with some form of 'search & replace'. It all depends on how complex your problem is and how 'generic' you want to implement the solution. To make your own example slightly more generic:</p>
<pre><code>xml.replaceFirst("<Mobiltlf>[^<]*</Mobilt... | <p>check this:
<a href="http://today.java.net/pub/a/today/2004/08/12/groovyxml.html?page=2" rel="nofollow noreferrer">http://today.java.net/pub/a/today/2004/08/12/groovyxml.html?page=2</a></p>
| 11,742 |
<p>I am building ASP.NET 2.0 websites and currently I some home grown assemblies for a DAL, some business objects and other assorted shared stuff. I've put together a basic set of objects to handle messages to the UI (i.e. errors and other status messaging). It consists of: </p>
<ul>
<li><p><strong>StatusMessage</st... | <p>Use an <code>List<StatusMessage></code> in session.</p>
| <p>To make the message refresh on any call, put it in its own <code>UpdatePanel</code> with its <code>RenderMode</code> set to <code>Always</code>.</p>
| 45,624 |
<p>I am running a Django through mod_python on Apache on a linux box. I have a custom authentication backend, and middleware that requires authentication for all pages, except static content.</p>
<p>My problem is that after I log in, I will still randomly get the log in screen now and again. It seems to me that each a... | <p>You are correct about how Apache handles the processes, and sometimes you'll get served by a different process. You can see this when you make a change to your site; new processes will pick up the change, but old processes will give you the old site. To get consistency, you have to restart Apache.</p>
<p>Assuming... | <p>Do you have standard database-driven sessions? Is caching enabled in settings?</p>
| 20,095 |
<p>When you get a badge or aren't logged in to stack overflow there's a groovy little notification bar at the top of the page that lets you know there's something going on.</p>
<p>I know the SOflow team use JQuery, but I was wondering if anyone knew of an implementation of the same style of notification system in asp.... | <p>I'm currently using this:</p>
<pre><code>String content = null;
URLConnection connection = null;
try {
connection = new URL("http://www.google.com").openConnection();
Scanner scanner = new Scanner(connection.getInputStream());
scanner.useDelimiter("\\Z");
content = scanner.next();
scanner.close();
}catch... | <p>Its not library but a tool named curl generally installed in most of the servers or you can easily install in ubuntu by </p>
<pre><code>sudo apt install curl
</code></pre>
<p>Then fetch any html page and store it to your local file like an example </p>
<pre><code>curl https://www.facebook.com/ > fb.html
</code... | 5,140 |
<p>I'm trying to draw images on the iPhone using with rounded corners, a la the contact images in the Contacts app. I've got code that generally work, but it occasionally crashes inside of the UIImage drawing routines with an <code>EXEC_BAD_ACCESS</code> - <code>KERN_INVALID_ADDRESS</code>. I thought this might be rela... | <p>Here is an even easier method that is available in iPhone 3.0 and up. Every View-based object has an associated layer. Each layer can have a corner radius set, this will give you just what you want:</p>
<pre><code>UIImageView * roundedView = [[UIImageView alloc] initWithImage: [UIImage imageNamed:@"wood.jpg"]];
// ... | <p>Set the Image in xib or storyboard (image width and height 41x41).</p>
<p>FirstViewController.h</p>
<pre><code>@interface....
IBOutlet UIImageView *testImg;
@end
</code></pre>
<p>FirstViewController.m</p>
<pre><code>-(void)viewDidLoad{
testImg.layer.backgroundColor=[[UIColor clearColor] CGColor];
... | 25,168 |
<p>I need to show an object in PropertyGrid with the following requirements: the object and its sub object must be read-only, able to activate PropertyGrid's CollectionEditors.</p>
<p>I found a sample that's closely match to what I need but there's an unexpected behaviour I couldn't figure out. I have more than one Pr... | <p>Try <a href="http://www.emacswiki.org/emacs/MultiTerm">MultiTerm</a>.</p>
<p>Its the only Emacs terminal mode that seems to play nice with zsh. It allows you to easily set which commands you want captured by emacs and which you want routed to the terminal. The default settings have been good enough for me so far th... | <p>I figured it out. It was an emacs config problem. This bit of elisp in my .emacs was causing it:</p>
<pre><code>(custom-set-variables
'(fringe-mode nil nil (fringe))
'(fringes-outside-margins t t))
</code></pre>
<p>Thanks for the help.</p>
| 47,957 |
<p>I have a SQL Server 2000 database with around a couple of hundred tables. There are several SQL user accounts that can access this database but each one has different permissions granted on tables in the DB. </p>
<p>How do I create a script to give me a report of the permissions granted to a particular user. i.e. t... | <p>I haven't read the book, but I have trouble believe that they wrote a book whose "basis ...is that Object Oriented Programming is highly wasteful memory-wise" (Full disclosure: Andy & Barbara are friends of mine). </p>
<p>Andy would never say the OOP is wasteful of memory. He WOULD say that a particular algor... | <p>Some of the answers are totally missing the point. OOP in C++ has many opportunities to be much faster than their C counterparts. I'll give the example from I think Effective C++ by Scott Meyers, which is that quicksort runs slower than C++ sort because the compiler is able to inline the function call easily in C++ ... | 26,138 |
<p>I'm trying to get a Firefox plugin to read data from a HTTP get, parse the results and present them as links in a bookmark-like drop-down menu.</p>
<p>My quesion then is: Does anyone have any sample code that will do this?</p>
| <p>Having never developed one myself, I'm not certain how this is typically done in Firefox plugins, but since plugin scripting is JavaScript, I can probably help out with the loading part. Assuming a variable named url containing the URL you want to request:</p>
<pre><code>var xmlhttp = new XMLHttpRequest();
xmlhttp.... | <p>Robert Walker did a great job of describing <a href="https://stackoverflow.com/questions/40125/reading-from-a-http-get-presenting-in-firefox-bookmarks#40167">how to send the request</a>. You can read more about <a href="http://developer.mozilla.org/En/XMLHttpRequest" rel="nofollow noreferrer">Mozilla's xmlhttpreque... | 6,134 |
<p>This is an open-ended question. What approaches should I consider?</p>
| <p>There are some parallel extensions to .NET that are currently in testing and available at Microsoft's <a href="http://msdn.microsoft.com/en-us/concurrency/default.aspx" rel="noreferrer">Parallel Computing Developer Center</a>. They have a few interesting items that you would expect like Parallel foreach and a parall... | <p>There are many options and the best solution will depend on the nature of the problem you are trying to solve. If you are trying to solve an <a href="http://en.wikipedia.org/wiki/Embarrassingly_parallel" rel="nofollow noreferrer">embarassingly parallel</a> problem then dividing and parallelising the tasks will be t... | 2,378 |
<p>I'm doing some FK analysis of our tables by making a directed
graph representing FK dependencies and then traversing the
graph. In my code, I name everything using directed graph
terminology, but I'd like to have something a bit more
"user friendly" in the report.</p>
<p>In this scenario:</p>
<pre><code>create ta... | <p>I'd say (things between brackets are optional, but I'd use them)</p>
<pre>
[Column a of] table t1 references [column b of] table t2
</pre>
<p>and</p>
<pre>
[Column b of] table t2 is referenced by [column a of] table t1
</pre>
<p>?</p>
<p>I'd also specify the action that happens on delete/update if any.</p>
<pr... | <p>In the explained scenario I think that the correct naming should be (technically speaking):<br>
<code>t2</code>is the parent of <code>t1</code><br>
<code>t1</code> is the child of <code>t2</code></p>
<p>The table of the constrained column is called <strong>child</strong>, while the table of the referenced column is... | 32,216 |
<p>I found an example of implementing the repository pattern in NHibernate on the web, and one of the methods uses this code to get the first result of a query:</p>
<pre><code>public IEnumerable<T> FindAll(DetachedCriteria criteria, int firstResult, int numberOfResults, params Order[] orders)
{
criteria.Set... | <p>So you're using Invoke to marshall back to the UI thread, by the looks of it - which is exactly what you need to do. I'd personally use an Action<Exception> for simplicity's sake, and possibly BeginInvoke instead of Invoke, but basically you're doing the right thing.</p>
| <p>I totally agree with Dror. In a formal way we can call this structure as FaultContract. Fundamentally when an exception has happened in another thread, the client thread can hardly do any thing at that moment except that to collect that information and act accordingly in it's own theread. If the thereads are in diff... | 22,923 |
<p>I know that <a href="http://wiki.lessthandot.com/index.php/How_to_find_the_first_and_last_days_in_years,_months_etc" rel="nofollow noreferrer">Sql Server has some handy built-in quarterly</a> stuff, but what about the .Net native <a href="http://msdn.microsoft.com/en-us/library/system.datetime_members(VS.80).aspx" r... | <p>I know you can calculate the quarter of a date by:</p>
<pre><code>Dim quarter As Integer = (someDate.Month - 1) \ 3 + 1
</code></pre>
<p>If you're using Visual Studio 2008, you could try bolting additional functionality on to the DateTime class by taking a look at <a href="http://msdn.microsoft.com/en-us/library/b... | <p>One thing to remeber, not all companies end their quarters on the last day of a month. </p>
| 12,810 |
<p>I work on a team with about 10 developers. Some of the developers have very exacting formatting needs. I would like to find a pretty printer that I could configure to these specifications and then add to the build processes. In this way no matter how badly other people mess up the format when it is pulled down from ... | <p>The easiest solution is for the team lead to mandate a format and everyone use it. The VS defaults are pretty good.</p>
<p>Jeff Atwood did that to us here on Stack Overflow and while I rebelled at first, I got over it :) Makes everything much easier!</p>
| <p>I second Jarrod's answer. If you have 2 developers with conflicting coding preferences, then get the rest of the team to vote, and then get the boss to back the majority decision. </p>
<p>Additionally, the problem with trying to automatically apply a pretty printer like that, is that there will always be exceptiona... | 36,351 |
<p>The idea is download a video in parts (from different servers) but starting to play before video file is complete.
The issue is that VideoDisplay component doesn't read the video file if it is opened for writing and vice-versa: writing is impossible if VideoDisplay plays the video...</p>
| <p>I know I may sound totally off-topic, but you should make sure you've properly considered video streaming thru Flash Media Server, Wowza or Red5 before you put that much effort in downloading a file in chunks. Just a thought..</p>
| <p>What about having multiple parts of the video, so playing can begin as soon as first part gets downloaded. So the parts have to be concatenated somehow at client side.</p>
<p>(Additionally, if one's connection is insufficient, showing a loading symbol is fine.)</p>
| 43,898 |
<p>How can I disable all table constrains in Oracle with a single command?
This can be either for a single table, a list of tables, or for all tables.</p>
| <p>It is better to avoid writing out temporary spool files. Use a PL/SQL block. You can run this from SQL*Plus or put this thing into a package or procedure. The join to USER_TABLES is there to avoid view constraints.</p>
<p>It's unlikely that you really want to disable all constraints (including NOT NULL, primary ... | <p>It doesn't look like you can do this with a single command, but <a href="http://oracle.ittoolbox.com/documents/popular-q-and-a/how-to-disable-all-constraints-via-single-sql-command-1948" rel="nofollow noreferrer">here'</a>s the closest thing to it that I could find.</p>
| 15,652 |
<p>Does hibernate HQL queries support using select min, max, count and other sql functions?</p>
<p>like:</p>
<p><code>select min(p.age) from person p</code></p>
<p>Thanks</p>
| <p>Yes, <code>min()</code>, <code>max()</code> and <code>count()</code> are supported in HQL.</p>
<p>see <a href="http://docs.jboss.org/hibernate/orm/5.2/userguide/html_single/Hibernate_User_Guide.html#hql-aggregate-functions" rel="nofollow noreferrer">aggregate functions</a> in the Hibernate Doc.</p>
| <p>Some aggregate functions are supported: look in the <a href="http://docs.jboss.org/hibernate/orm/5.2/userguide/html_single/Hibernate_User_Guide.html#hql-aggregate-functions" rel="nofollow noreferrer">manual</a></p>
| 42,860 |
<p>Is it possible to show other processes in progress on an Oracle database? Something like Sybases <code>sp_who</code></p>
| <p>I suspect you would just want to grab a few columns from V$SESSION and the SQL statement from V$SQL. Assuming you want to exclude the background processes that Oracle itself is running</p>
<pre><code>SELECT sess.process, sess.status, sess.username, sess.schemaname, sql.sql_text
FROM v$session sess,
v$sql ... | <p>Keep in mind that there are processes on the database which may not currently support a session.</p>
<p>If you're interested in all processes you'll want to look to v$process (or gv$process on RAC)</p>
| 24,317 |
<p>I'm looking for a way to create websites with the <em>cool stylings</em> of Windows Vista, like what is shown in this screenshot (taken from one of Microsoft's websites):</p>
<p><img src="https://www.istartedsomething.com/wp-content/uploads/2008/08/windows7update.jpg" alt="Microsoft Update Catalog"></p>
<p>Any sug... | <p><strong>FYI, the answers before this were in response to a very poorly worded question. The OP did not make it clear that they were after a web page. Thanks to <a href="https://stackoverflow.com/users/811/shog9">Shog9</a> for picking up the slack there.</strong></p>
<p>This is NOTHING to do with WPF or VS 2008. Its... | <p>The "cool Vista stylings" are done using <a href="http://en.wikipedia.org/wiki/Windows_Presentation_Foundation" rel="nofollow noreferrer">WPF</a>, for which you'll need <a href="http://msdn.microsoft.com/en-us/vstudio/default.aspx" rel="nofollow noreferrer">Visual Studio 2008</a>. 90-day trial downloads are <a href=... | 29,720 |
<p>I'm trying to use <code>jQuery</code> to format code blocks, specifically to add a <code><pre></code> tag inside the <code><code></code> tag:</p>
<pre><code>$(document).ready(function() {
$("code").wrapInner("<pre></pre>");
});
</code></pre>
<p>Firefox applies the formatting correctly, b... | <p>That's the difference between <a href="http://www.w3.org/TR/html4/struct/global.html#h-7.5.3" rel="noreferrer">block and inline</a> elements. <a href="http://www.w3.org/TR/html4/sgml/dtd.html#block" rel="noreferrer"><code>pre</code> is a block level element</a>. It's not legal to put it inside a <code>code</code> ta... | <p>Are you using the latest jQuery ?
What if you try </p>
<pre><code>$("code").wrapInner(document.createElement("pre"));
</code></pre>
<p>Is it any better or do you get the same result ?</p>
| 3,387 |
<p>How to 'group by' a query using an alias, for example:</p>
<pre><code>select count(*), (select * from....) as alias_column
from table
group by alias_column
</code></pre>
<p>I get 'alias_column' : INVALID_IDENTIFIER error message. Why? How to group this query?</p>
| <pre><code>select
count(count_col),
alias_column
from
(
select
count_col,
(select value from....) as alias_column
from
table
) as inline
group by
alias_column
</code></pre>
<p>Grouping normally works if you repeat the respective expression in the GROUP BY clause. Just mentioning an alias... | <p>If you don't have to use an alias you could do it this way:</p>
<pre><code>select
EXTRACT(year from CURRENT_DATE), count(*) from something
group by EXTRACT(year from CURRENT_DATE)
order by EXTRACT(year from CURRENT_DATE)
</code></pre>
<p>Instead of using alias and subquery. </p>
| 33,687 |
<p>I am adventuring into some AOP and it seems with .NET PostSharp is the way to go. </p>
<p>I want to do some simple logging to the db when an exception occurs. However I am finding it difficult to find any real solid examples of using PostSharp beyond the basics. I tried the following:</p>
<pre><code>[Serializable]... | <p>I got it to work by extending the <code>OnExceptionAspect</code>:</p>
<pre><code>[Serializable]
public sealed class LogExceptionAttribute : OnExceptionAspect
{
public override void OnException(MethodExecutionEventArgs eventArgs)
{
//do some logging here
}
}
</code></pre>
<hr>
<p><strong>Origin... | <p>I've used OnMethodBoundaryAspect instead of ExceptionHandlerAspect without problems. And I've not made mine sealed either.</p>
| 45,903 |
<p>Having friendly URLs is generally a good thing. However, there are sometimes when it seems like a bad idea. What is your rule of thumb?</p>
<p>For instance, consider a situation where I want to show a Registration Success page. I want all of the underlying logic to be the same. However, depending on how they re... | <p>Bear in mind that obfuscating URLs is <strong>NOT</strong> a security measure. You should never trust outside input - filter, sanitize and implement restrictive logic. No matter how clever you believe your obfuscation scheme to be, people have cracked much more complicated security schemes with relative ease.</p>
<... | <p>You could make some sort of checksum or hash on the querystring items, so if they mess around with the URL, the checksum fails and it kicks them out to the main page.</p>
| 44,457 |
<p>I am in a project where we are starting refactoring some massive code base. One problem that immediately sprang up is that each file imports a lot of other files. How do I in an elegant way mock this in my unit test without having to alter the actual code so I can start to write unit-tests?</p>
<p>As an example: Th... | <p>If you want to import a module while at the same time ensuring that it doesn't import anything, you can replace the <code>__import__</code> builtin function.</p>
<p>For example, use this class:</p>
<pre><code>class ImportWrapper(object):
def __init__(self, real_import):
self.real_import = real_import
... | <p>No difficult manipulation is necessary if you want a quick-and-dirty fix before your unit-tests.</p>
<p>If the unit tests are in the same file as the code you wish to test, simply delete unwanted module from the <code>globals()</code> dictionary.</p>
<p>Here is a rather lengthy example: suppose you have a module <... | 21,507 |
<p>I'm new to Rails development, and I'm trying to figure out how to use an older version of Rails with Apatana's RadRails IDE. I'm trying to help out a friend who has a site built on older version than the one that automatically gets downloaded by RadRails, and I'm pretty sure the two versions wouldn't be compatible ... | <p>Use the Rake task <code>rails:freeze:gems</code> in your rails project and give it the version you want to use. For example:</p>
<pre><code>rake rails:freeze:gems VERSION=2.1.0
</code></pre>
<p>That will put the right version of Rails into <code>vendor/rails</code>, which is loaded by default if it exists.</p>
| <p>If you don't want to freeze the gem into your project (using rake rails:freeze:gems), you can install the rails gem of the version you want to use:</p>
<p><code>gem install rails -v 2.0.2</code></p>
<p>and then specify the rails gem to use in your config/environment.rb:</p>
<p><code>RAILS_GEM_VERSION = '2.0.2'</c... | 27,543 |
<p>I'm starting a web project that likely should be fine with SQLite. I have SQLObject on top of it, but thinking long term here -- if this project should require a more robust (e.g. able to handle high traffic), I will need to have a transition plan ready. My questions:</p>
<ol>
<li>How easy is it to transition fro... | <p>3) Is quite an interesting question. In general, SQLite is pretty useless for web-based stuff. It scales fairly well for size, but scales terribly for concurrency, and so if you are planning to hit it with a few requests at the same time, you will be in trouble.</p>
<p>Now your idea in part 3) of the question is to... | <p>I'm not sure I understand the question.</p>
<p>The <a href="http://www.sqlobject.org/SQLObject.html#dbconnection-database-connections" rel="nofollow noreferrer">SQLObject documentation</a> lists six kinds of connections available. Further, the database connection (or scheme) is specified in a connection string. C... | 34,741 |
<p>I would like to create a batch script, to go through 20,000 links in a DB, and weed out all the 404s and such. How would I get the HTTP status code for a remote url?</p>
<p>Preferably not using curl, since I dont have it installed. </p>
| <p>CURL would be perfect but since you don't have it, you'll have to get down and dirty with sockets. The technique is:</p>
<ol>
<li>Open a socket to the server.</li>
<li>Send an HTTP HEAD request.</li>
<li>Parse the response.</li>
</ol>
<p>Here is a quick example:</p>
<pre><code><?php
$url = parse_url('http://w... | <p><a href="http://www.bin-co.com/php/scripts/load/" rel="nofollow noreferrer">This page</a> looks like it has a pretty good setup to download a page using either curl or fsockopen, and can get the HTTP headers using either method (which is what you want, really).</p>
<p>After using that method, you'd want to check $o... | 34,057 |
<p>This is a follow up from this <a href="https://stackoverflow.com/questions/198087/how-do-i-list-installed-msi-from-the-command-line">question</a>.</p>
<p>I'm using this slightly modified script to enumerate all installed MSI packages:</p>
<pre><code>strComputer = "."
Set objWMIService = GetObject("winmgmts:" &... | <p>Extreme slowness is a known/common problem for enumerating Win32_Products</p>
<p>If you need an alternate solution, consider building your own list of products using the 'Uninstall' registry entries (as suggested in one of the answers to the <a href="https://stackoverflow.com/questions/198087/how-do-i-list-installe... | <p>I suspected a network issue and Wireshark proved me right.</p>
<p>It seems that Windows Installer happily attempts to reopen all the original .msi files, including those who lived on network shares.</p>
| 25,558 |
<p>This has been driving me crazy. We have IIS (6) and windows 2008 and ActiveState Perl 5.10. For some reason whenever we do a warn or a carp it eventually corrupts the app pool. Of course, that's a pretty big deal since it means that our errors actually cause problems.</p>
<p>This happened with the previous versi... | <p>Check to make sure that IIS and the perl DLL are linked with the same version of the C runtime library. (Use depends.exe or dumpbin /dependents).</p>
<p>To expand: the problem may be that IIS has its FILE* table in one place, and the perl DLL thinks it's going to be in a slightly different place. When perl goes t... | <p>Try adding the following to the top of your scripts:</p>
<pre><code>BEGIN {
open STDERR, '>> c:/iisError.log'
or die "Can't write to c:/issError.log: $!\n";
binmode STDERR;
}
</code></pre>
<p>I'm not sure why you would have this problem. But several "wild" guesses as to sources for such a p... | 22,913 |
<p>I saw some code like the following in a JSP</p>
<pre><code><c:if test="<%=request.isUserInRole(RoleEnum.USER.getCode())%>">
<li>user</li>
</c:if>
</code></pre>
<p>My confusion is over the "=" that appears in the value of the <code>test</code> attribute. My understanding was that a... | <p>All that the <code>test</code> attribute looks for to determine if something is true is the string "true" (case in-sensitive). For example, the following code will print "Hello world!"</p>
<pre><code><c:if test="true">Hello world!</c:if>
</code></pre>
<p>The code within the <code><%= %></code> r... | <p><%=%> by itself will be sent to the output, in the context of the JSTL it will be evaluated to a string</p>
| 11,890 |
<p>Ive been smashing my head with this for a while. I have 2 completely identical .wmv files encoded with wmv3 codec. I put them both through ffmpeg with the following command:</p>
<pre><code>/usr/bin/ffmpeg -i file.wmv -ar 44100 -ab 64k -qscale 9 -s 512x384 -f flv file.flv
</code></pre>
<p>One file converts just fin... | <p>It is in fact the audio format, which causes trouble. Audio formats are identified by its TwoCC (0x0162 here). You can look up the different TwoCCs here: <a href="http://wiki.multimedia.cx/index.php?title=TwoCC" rel="noreferrer">http://wiki.multimedia.cx/index.php?title=TwoCC</a> and you'll find:</p>
<p>0x0162 Win... | <p>Or, alternatively, use mencoder</p>
| 11,334 |
<p>I have a php script and i'm using ajax with it. I have a textarea form connect with the ajax class</p>
<p>The problem when I pass a text like (<code>&some text</code>) the function return an empty text, I guess that I have a problem with (<code>&</code>).</p>
<p>The javascript function:</p>
<pre><code>fun... | <p>Make sure your & is encoded with &amp; if you're passing it using Javascript. All & need to be encoded, or some browsers can freak out a bit, and any validater will complain at you.</p>
| <p>when i see HTML and & and problem, i look to make sure that my character encoding is all properly specified. </p>
<p>also, the code in your PHP script may be choking on an un/escaped '&' character.</p>
| 32,940 |
<p>I wrote a class/function to send xml over https via PHP4/cURL, just wondering if this is the correct approach, or if there's a better one.</p>
<p>Note that PHP5 is not an option at present.</p>
<pre><code>/**
* Send XML via http(s) post
*
* curl --header "Content-Type: text/xml" --data "<?xml version="1.0"?&... | <p>If the protocol you are using is XML-RPC (looks like it based on what you said) and you are using at least PHP 4.2, have a look at <a href="http://phpxmlrpc.sourceforge.net/" rel="nofollow noreferrer">http://phpxmlrpc.sourceforge.net/</a> for libraries and resources.</p>
| <p>Use the <a href="http://us2.php.net/manual/en/function.soap-soapclient-construct.php" rel="nofollow noreferrer">SoapClient</a> class provided with most PHP installations</p>
<p>An example is:</p>
<pre><code>$soap = new SoapClient("http://some.url/service/some.wsdl");
$args = array("someTypeName" => "someTypeVal... | 29,540 |
<p>I have a 3D printer that I built using CD-ROM drives. It's all set and ready to go but when I generate <code>.stl</code> or <code>.obj</code> files my G-code sender program cannot load it. I have found that Slic3r will export the <code>.stl</code> into G-code but it has the option of changing the <em>G-code flavour<... | <p>From what I understand, you're trying to partition your object into smaller pieces with the hopes of putting them back together in a manner similar to a Jigsaw puzzle.</p>
<p>There are two options that I know of to do this, which requires using OpenSCAD:</p>
<ul>
<li>The <a href="https://www.thingiverse.com/thing:... | <p>Sorry to put it that way, but does 3D printing the best "tool" for your case? </p>
<p>it seems you want to generate a huge flat file when a CnC would be the best to generate a clean and solid part.</p>
<p>Otherwise, as others suggets you are looking for a tooling tool.</p>
| 714 |
<p>I am attempting to link an application with g++ on this Debian lenny system. ld is complaining it cannot find specified libraries. The specific example here is ImageMagick, but I am having similar problems with a few other libraries too.</p>
<p>I am calling the linker with:</p>
<pre><code>g++ -w (..lots of .o file... | <p>The problem is the linker is looking for <code>libmagic.so</code> but you only have <code>libmagic.so.1</code></p>
<p>A quick hack is to symlink <code>libmagic.so.1</code> to <code>libmagic.so</code></p>
| <p>Another way to solve this problem is to install the <code>-devel</code> package.</p>
<p>If the compiler is looking for <code>libabc.so</code> while you have <code>libabc.so.1</code>, you need to install the <code>-devel</code> package like <code>libabc-devel</code> as <code>libabc.so.1</code> is a runtime lib but <c... | 43,581 |
<p>I have a Boost unit test case which causes the object under test to throw an exception (that's the test, to cause an exception). How do I specify in the test to expect that particular exception.</p>
<p>I can specify that the test should have a certain number of failures by using BOOST_AUTO_TEST_CASE_EXPECTED_FAILUR... | <p>Doesn't this work?</p>
<pre><code>BOOST_CHECK_THROW (expression, an_exception_type);
</code></pre>
<p>That should cause the test to pass if the expression throws the given exception type or fail otherwise. If you need a different severity than 'CHECK', you could also use <code>BOOST_WARN_THROW()</code> or <code>B... | <p>You can also use BOOST_CHECK_EXCEPTION, which allows you to specify test function which validates your exception.</p>
| 20,824 |
<p>When you are starting a personal programming project, what is your first step? I'm trying to start a project thats just an idea at the moment. I get lots of these and I dive right into the code and after a while just completely lose interest and or just forget about the project.</p>
<p>When you are starting, what i... | <p>The only thing that works for me: Create the smallest possible implementation of it that's somehow usable and then use it.</p>
| <p>First plan out the basic outline of the final application. Most important features, basic GUI, program flow, etc. Then refine that so that you don't take on too much at first, remove unnecessary features, and add what else you want in the first version. Then use that outline to start a task list to create the smalle... | 8,603 |
<p>I have a third party JavaScript plug-in but including the file breaks IntelliSense for jQuery amongst other things. The only way I can get IntelliSense back working with jQuery is by commenting out the plug-in. Is there a way I can hide the plug-in file from the IntelliSense parser?</p>
| <p>Service Pack 1 added the following feature:</p>
<p>If you "anyfile.js" and "anyfile-vsdoc.js" in the same directory, then any references to "anyfile.js" will automagically be converted to a reference to "anyfile-vsdoc.js" behind the scenes.</p>
<p>Add an empty file next to your plugin with "-vsdoc" appended to the... | <p>It could be that third party JavaScript plugin you're using has some errors in it.<br>
I would check the code in <a href="http://www.jslint.com/" rel="nofollow noreferrer">JSLint</a> and directed this question to the author of the plugin.<br>
As for the question itself: I don't think you can exclude it if it's a par... | 36,248 |
<p>Within an article-oriented page (such as a blog post), the <code><h1></code> element (level 1 heading) is commonly used to markup either:</p>
<ul>
<li>the blog title (i.e. the often-large site title at the top of the page, <em>not</em> to the <code><title></code> element), or</li>
<li>the article title<... | <p>There is a <a href="http://www-mit.w3.org/QA/Tips/Use_h1_for_Title" rel="noreferrer">W3C Quality Assurance tip</a> about this topic:</p>
<blockquote>
<p><code><h1></code> is the HTML element for the
first-level heading of a document:</p>
<ul>
<li><p>If the document is basically
stand-alone, for e... | <p>There should only be one, and there must be one only <pre>h1</pre>; usually this is the page title.
Then it should follow h2, h3 etc.</p>
<p>So your page can look like this (without all the other html tags)</p>
<pre>
h1
h2
h2
h3
..etc
</pre>
| 33,694 |
<p>I set up all my certificates and keys today and am trying to run my project on my iPhone.
I'm encountering this strange error:</p>
<blockquote>
<p>Your mobile device has encountered an unexpected error (0xE800003A) during the install phase: Verifying application</p>
</blockquote>
<p>Poking around the Apple Devel... | <p>It turned out that I had 2 certs in keychain that were simultaneously overwriting each other! I hope this helps people in the future.</p>
| <p>Just want to say to everyone, when you go to edit Targets-> be sure to set "configuration" in the top left corner to "All Configurations" or the correct config you are building for (Debug or Release). You might think you have things set correctly but it will be for the wrong configuration.</p>
| 30,393 |
<p>First some background. I recently went for an interview and some of the questions asked to me was about Enterprise Content Management. Obviously, I did not have any experience and did not get the offer. </p>
<p>But, it increased my curiosity and tried Internet to get some info on the topic. Wikipedia made me more c... | <p>The domain is vast and is not easy to cover it with a short answer. According to Gartner (which IMHO gives very good definitions, see links):</p>
<blockquote>
<p><strong>Enterprise Content Management</strong> (ECM) is
an “umbrella term” and represents a
vision and framework for integrating a
broad range of ... | <p>CMS (Content Management System) describe systems that are used to manage content :-) as for example Joomla, Drupal, Sharepoint and etc. </p>
<p>Content management means document, records, processes and other information related to your company business management.</p>
<p>Enterprise Content Management, as far as I ... | 26,462 |
<p>Is there a way of reusing the same resultMap multiple times in a single query.</p>
<p>For example, suppose I have a "foo" resultMap:</p>
<pre><code><resultMap id="foo" class="Foo">
<result property="Bar" column="bar" />
</resultMap>
</code></pre>
<p>Is there a way to define another resultMap t... | <p>Almost. If you select the ID of the Foo in your query, you can have the Fizz result map execute a SELECT for that ID, which will use the Foo result map.</p>
<p><code><result property="Foo1" column="bar1Id" select="selectFoo"/></code></p>
<p>(Assuming you have a <code>selectFoo</code> query defined.) But th... | <p>you could use resultmaps, which extend another resultmap
e.g.</p>
<pre><code><resultMap id="document" class="Document">
<result property="Id" column="Document_ID"/>
<result property="Title" column="Document_Title"/>
<discriminator column="Document_Type" type="string"/>
<subMap va... | 25,137 |
<p>When using Subversion (svn) for source control with multiple projects I've noticed that the revision number increases across all of my projects' directories. To illustrate my svn layout (using fictitious project names): </p>
<pre>
/NinjaProg/branches
/tags
/trunk
/StealthApp/bra... | <p>I am surprised no has mentioned that this is discussed in Version Control with Subversion, which is available free online, <a href="http://svnbook.red-bean.com/en/1.5/svn.reposadmin.planning.html" rel="nofollow noreferrer">here</a>.</p>
<p>I read up on the issue awhile back and it really seems like a matter of perso... | <p>One repository per project.</p>
<p>Steven Murawski's comment about CC.NET is an interesting one. I would be interested to hear how it works if you need to specify several source control repositories.</p>
| 3,643 |
<p>My company has a large application written in VB6, and for historical reasons, the application is navigated with the Enter key instead of with the Tab key. I don't know VB6, but I know that they currently set the focus for each control in a big select statement in the Form's KeyUp event if it's an EnterKey. Now we... | <p>Use the string.Format command.</p>
<pre><code>output = String.Format("{0:0000}", intVariable);
</code></pre>
<p>More details: <a href="http://msdn.microsoft.com/en-us/library/fht0f5be.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/fht0f5be.aspx</a></p>
| <p><strong>In modern .NET 5.0+</strong> (2021 update)</p>
<pre><code>int myint = 100;
string zeroPadded = $"{myint:d8}"; // "00000100"
string leftPadded = $"{myint,8}"; // " 100"
string rightPadded = $"{myint,-8}"; // "100 "
</code></pre... | 23,883 |
<p>I see in the Stack Overflow footer that the SVN Revision number is displayed. Is this automated and if so, how does one implement it in ASP.NET?</p>
<p><em>(Solutions in other languages are acceptable)</em></p>
| <p>Make sure that the file has s<code>vn:keywords "Rev Id"</code> and then put <code>$Rev$</code> somewhere in there.</p>
<p>See <a href="https://stackoverflow.com/q/163/10221765">this question and the answers to it</a>.</p>
| <p>in our continuous integration setup we use <code>SVNRevisionLabeller</code> and pass the variables from this to MSBuild to use when creating the compiled website dll. It's then available to .NET using <code>GetCurrentAssembly()</code> in the final build.</p>
| 2,447 |
<p>I want the search box on my web page to display the word "Search" in gray italics. When the box receives focus, it should look just like an empty text box. If there is already text in it, it should display the text normally (black, non-italics). This will help me avoid clutter by removing the label.</p>
<p>BTW, thi... | <p>Another option, if you're happy to have this feature only for newer browsers, is to use the support offered by HTML 5's <strong>placeholder</strong> attribute:</p>
<pre><code><input name="email" placeholder="Email Address">
</code></pre>
<p>In the absence of any styles, in Chrome this looks like:</p>
<p><a ... | <p>User AJAXToolkit from <a href="http://asp.net" rel="nofollow noreferrer">http://asp.net</a></p>
<p>
</p>
| 13,359 |
<p>I have an MSSQL2005 stored procedure here, which is supposed to take an XML message as input, and store it's content into a table.
The table fields are varchars, because our delphi backend application could not handle unicode.
Now, the messages that come in, are encoded ISO-8859-1. All is fine until characters over ... | <p>I don't know if anybody with enough rights to edit the answer will see this but while the answer is correct I would like to add that without specifying the collation explicitly the default collation of the database would be used in this case since it is implicitly assigned to every varchar-variable without a collati... | <p>The errorcode you mention seems to come from the MSXML Library. How is that involved there? From your question I would assume that you pass a varchar parameter to a stored procedure, then insert or update a varchar column with that parameter.</p>
<p>However that does not match with your exception code so it must ha... | 14,531 |
<p>Let's say I'm performing a google search for <code>search term</code>.</p>
<p>Sometimes, one of the suggestions will be to a URL like this: <code>www.someothersearch.com/search+term/</code></p>
<p>How does "someothersearch.com" do this?</p>
| <p>In general, a page will only be in Google if some other page links to it. Google is not going to go to someothersearch.com and submit "search term" into the form, it is likely a hidden or nonhidden link on someothesearch.com.</p>
| <p>Why not? someothersearch.com presumably has its own index pages for terms searched previously; the Google spider is just indexing those index pages as well.</p>
| 41,592 |
<p>On an embedded target I use far pointers to access some parts of the memory map. </p>
<p>near pointer (without explicitely specifying __near):</p>
<pre>unsigned int *VariableOnePtr;</pre>
<p>Pointer to near pointer: <pre>unsigned int **VariableOnePtrPtr;</pre></p>
<p>far pointer: <pre>unsigned int *__far Variabl... | <p>I believe you would do this:</p>
<pre><code>unsigned int * __far *VariableThreePtrPtr;
</code></pre>
<p>A far pointer to a far pointer would be:</p>
<pre><code>unsigned int * __far * __far VariableFourPtrPtr;
</code></pre>
| <p>You can also use typedefs for that, for example</p>
<pre><code>typedef unsigned int *__far VariableTwoPtr_t;
VariableTwoPtr_t* VariableTwoPtrPtr;
</code></pre>
| 28,259 |
<p>I have 2 fields in the database month (numeric) and year (numeric) and I want to combine them in a report that combines those 2 fields and format them with MMM-YYYY. e.g 7-2008 becomes Jul-2008. How do I do that?</p>
| <p><code>DateSerial</code> is the correct answer:</p>
<p><a href="http://msdn.microsoft.com/en-us/library/bbx05d0c(VS.80).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/bbx05d0c(VS.80).aspx</a></p>
<p>SSRS uses VB.Net for expressions. Use the expression editor to browse the available functio... | <p>=DateSerial(year, month, day)</p>
| 18,319 |
<p>I'm using the wxGlade designer to generate the GUI for a small application.
It generates a class, inherited from wxFrame, which is the main application window.
In order to facilitate the maintenance, I'd like to avoid writing additional code in this generated class.</p>
<p>But all the widgets created with the wxGla... | <p>All classes inherited from wxWindow (wxFrame being one of them) have a function "<a href="http://docs.wxwidgets.org/stable/wx_wxwindow.html#wxwindowgetchildren" rel="nofollow noreferrer">GetChildren</a>", which returns a list of child windows that you can then enumerate over. If you are looking for a specific field ... | <p>May I recommend you try <a href="http://www.wxformbuilder.org" rel="nofollow noreferrer">wxFormBuilder</a>. I also used wxGlade before, but it presents too much constraints on how you use it. For example, with wxFormBuilder you can select 'visibility' (public,protected,private) for each control on the form. It can a... | 22,087 |
<p>In C# there is a method <code>SetApartmentState</code> in the class <code>Thread</code>.
How do I do the same thing in C++?</p>
| <p>For unmanaged processes, you control the apartment model used for a thread by passing appropriate parameters to <a href="http://msdn.microsoft.com/en-us/library/ms695279(VS.85).aspx" rel="noreferrer"><code>CoInitializeEx()</code></a>. Larry Osterman wrote up a <em>great</em> little guide to these:</p>
<blockquote>
... | <p>c++ doesn't have built in thread support. What you are looking for depends on how you are implementing threads in your application. Win32? pthreads? boost::threads? Whichever API you are using will determine the answer to your question.</p>
<p>EDIT: looks like this may have an example for you: <a href="http://msdn.... | 24,383 |
<p>I'm having some trouble with ASP.NET MVC Beta, and the idea of making routes, controller actions, parameters on those controller actions and Html.ActionLinks all work together. I have an application that I'm working on where I have a model object called a Plot, and a corresponding PlotController. When a user creates... | <p>The answer is pretty simple: You have to supply enough values in your "ActionLink" that will fulfill your Route. Example:</p>
<pre><code><%= Html.ActionLink("Click Here", "ViewDetails", "Plot", new { name="my-plot-name" }, null)%>
</code></pre>
<p>If you leave out the "name=" part of the ActionLink method, t... | <p>How about this code-fix? (Note the <em>name = null</em>, appened to the end of the 4th line....) </p>
<pre><code>routes.MapRoute(
"PlotByName",
"plot/{name}",
new { controller = "Plot", action = "ViewDetails", name = null }
);
</code></pre>
<p>and this should be renamed.. (notice <em>plotName</em> i... | 40,031 |
<p>I have a Wanhao Duplicator i3 v2 (A.K.A. Maker Select, Cocoon Create).</p>
<p>My extruder got clogged: I noticed that it wasn't extruding, so I stopped my print, removed the fan, heatsink and the extruder motor and I saw that the clog is at the heater block level.</p>
<p>This is a what I have:</p>
<p><a href="htt... | <p>I'm sure this is not the best solution, and if you have some ethyl acetate you should try that before going "the hard way".</p>
<p>Ethyl acetate is a solvent for PLA, so if you soak the extruder into it PLA should melt and free the extruder.</p>
<p>That said, this is the "hard" solution that worked for me.</p>
<h... | <p>Steps:</p>
<ol>
<li>Take the tip off, assuming it has a tip.</li>
<li>Heat up the extruder.</li>
<li>Take a length of plastic and push it though the extruder.</li>
<li>If the tip is clogged, then take a micro hand drill to clear the blockage.</li>
</ol>
| 502 |
<p>Besides the LD_PRELOAD trick , and Linux Kernel Modules that replace a certain syscall with one provided by you , is there any possibility to intercept a syscall ( open for example ) , so that it first goes through your function , before it reaches the actual open ?</p>
| <p>Why can't you / don't want to use the <a href="https://stackoverflow.com/questions/426230/what-is-the-ld-preload-trick">LD_PRELOAD trick</a>?</p>
<p>Example code here:</p>
<pre><code>/*
* File: soft_atimes.c
* Author: D.J. Capelis
*
* Compile:
* gcc -fPIC -c -o soft_atimes.o soft_atimes.c
* gcc -shared -o so... | <p>Sounds like you need auditd.</p>
<p>Auditd allows global tracking of all syscalls or accesses to files, with logging. You can set keys for specific events that you are interested in.</p>
| 9,526 |
<p>How do I load the edited <code>.emacs</code> file without restarting Emacs?</p>
| <p>M-x eval-buffer</p>
| <p>I use and recommend restart-emacs package on melpa</p>
| 20,257 |
<p>I'm looking for a plugin or way to simply go from any namespace, type, method, property, etc in my .Net code to the MSDN page that covers it via a context menu item or hyperlink-like mechanism. Does anyone know of anything that will do that? </p>
<p>The "Go to Definition" option when you right click <em>almost</e... | <p>Have you tried F1. This will automatically open the help to the appropriate method or object. Not sure if this works for namespaces.</p>
| <p>Besides using F1 (which doesn't always work) I haven't found an add-in for VS to do this, I have another quick way around it.</p>
<p>I use Launchy (from launchy.net) and setup the Weby plug-in so I can quickly do MSDN searches. So if I'm looking for String.Format, my keyboard only sequence (from VS, or anywhere els... | 24,124 |
<p>So if I have:</p>
<pre><code>public class ChildClass : BaseClass
{
public new virtual string TempProperty { get; set; }
}
public class BaseClass
{
public virtual string TempProperty { get; set; }
}
</code></pre>
<p>How can I use reflection to see that ChildClass is hiding the Base implementation of TempPr... | <p>We'll have to deal in terms of the methods of the property here rather than the property itself, because it is the get/set methods of the property that actually get overridden rather than the property itself. I'll use the get method as you should never have a property without one, though a complete solution should c... | <p>Correction, if you are using VB the property you are looking for is "IsHideBySig". This will be false in the case that the "new" keyword was used to define a method/property.</p>
<p>In the C# case, both instances are outputted as "hidebysig". Thanks for pointing that out Greg. I didn't realize I only tested this... | 36,703 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.