input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Cascading Deletes/Updates using JPA or Inside of Database? <p>Performance is key: Is it better to cascade deletes/updates inside of the Database or let Hibernate/JPA take care of it?</p>
<p>Will this effect the ability to query for the data if cascades are inside of the DBMS?</p>
<p>I am using HSQLDB if that matters... | <p>In the case of cascading updates, you simply cannot do it in application space if you have foreign key constraints in the database.</p>
<p>Example: say you have a lookup table for US states, with a primary key of the two-letter abbreviation. Then you have a table for mailing addresses that references it. Someone... |
PHP standard input? <p>I know PHP is usually used for web development, where there <em>is</em> no standard input, but PHP claims to be usable as a general-purpose scripting language, if you do follow it's funky web-based conventions. I know that PHP prints to <code>stdout</code> (or whatever you want to call it) with <... | <p>It is possible to read the <code>stdin</code> by creating a file handle to <code>php://stdin</code> and then read from it with <code>fgets()</code> for a line for example (or, as you already stated, <code>fgetc()</code> for a single character):</p>
<pre><code><?php
$f = fopen( 'php://stdin', 'r' );
while( $line... |
ASP.NET MVC: Binding a Complex Type to a Select <p>I am trying to work out if there is built-in support for binding complex types to form elements.</p>
<p>To use a common hypothetical situation:
I have a Product entity that belongs to a Category - the models look something like this:</p>
<pre><code>public class Produ... | <p>See <a href="http://weblogs.asp.net/scottgu/archive/2008/10/16/asp-net-mvc-beta-released.aspx#three">here</a> and <a href="http://haacked.com/archive/2008/10/23/model-binding-to-a-list.aspx">here</a> and <a href="http://www.hanselman.com/blog/ASPNETWireFormatForModelBindingToArraysListsCollectionsDictionaries.aspx">... |
What application do you use to synchronize work directory with ftp directory? <p>I'd like to poll this question: What application do you use to synchronize the working directory at local PC and remote directory (via FTP)?</p>
<p>I'm kind of bored of using FTP client to transfer each file I edit all the time.</p>
| <p>In a simple case you can use <code>scp</code> or <code>ftp</code> command line programs to write a small command line script that can upload all your files. I use a bash script that zips up all my files, puts it on my webspace, and unzips the file over ssh. Although this would be easily done with bash on linux I t... |
How can I stop Filezilla changing my linebreaks? <p>I'm downloading a perl CGI file from a Linux web server.</p>
<p>It has Unix linebreaks. I edit it on a Windows PC with a decent text-editor (Geany) which preserves those linebreaks.</p>
<p>I then upload it again with Filezilla and it has DOS linebreaks, which stop i... | <p>In FileZilla 2.2.32, go Edit > Settings > File transfer settings > ASCII/Binary. Set it to always binary: that should do the trick.</p>
<p>In FileZilla 3.5.0 the setting is in Edit > Settings > Transfers > File Types > Default transfer type > Binary.</p>
|
Diagnosing and improving performance of a java jnlp compared to jar file <p>Customer X has asked for ways to improve the startup time of a Java process he uses. The problem is, it is not run through a jar file, but rather 'jnlp' (which I am assuming indicates it is a java webstart application)</p>
<pre><code>StartUser... | <p>Check the proxy settings on the slow machine. That user might not have correct proxy settings, and a lot of extra network traffic/timeouts could be occurring? </p>
<p>We've had that issue with webstart before, downloading a jar from a local server was round tripping through the proxy to the other coast and back.<... |
Linq return IEnumerable<MyObject>, how to return MyListObject instead? <p>Is there a way without looping all the IEnumerable to get back the data inside the object (that inherited BindingList)?</p>
<pre><code>MyListObject--> Transformed with Linq --> Back the data inside MyListObject
</code></pre>
<p>I know tha... | <p>One option is to wrap the returned IEnumerable into your collection type by using/adding constructor that takes IEnumerable as CStick suggest. Perhaps a bit more ellegant way is to add an extension method for the IEnumerable type that would return your collection:</p>
<pre><code>static MyListObject ToMyList(this IE... |
Templates: Use forward declarations to reduce compile time? <p>I have to deal with a library that consists of many templated classes, which are of course all implemented in header files. Now I'm trying to find a way to reduce the unbearably long compile times that come from the fact that I pretty much have to include t... | <p>You can't forward declare "parts" of classes like that. Even if you could, you'd still need to instantiate the code somewhere so you could link against it. There are ways to handle it, you could make yourself a little library with instantiations of common containers (e.g. vector) and link them in. Then you'd only ev... |
Semi-modal editing / auto prefixing keys <p>Most emacs modes include some sort of prefix to activate their features. For example, when using <em>GUD</em> "next" is "C-c C-n". Of these modes, many provide special buffers where one can use a single key to activate some functionality (just 'n' or 'p' to read next/previous... | <p>I agree with Joe Casadonte's answer that the way to go is to define your own minor (or major) mode.</p>
<p>That being said, your question is interesting.</p>
<p>Here's a solution that prompts you for a key sequence and it takes the prefix keystrokes and promotes that keymap to the top level.</p>
<p>e.g. Assume th... |
SWIFT MT message validation <p>I am looking for java library or a vb addin that can be used for
- SWIFT message syntax validation
- Building SWIFT message from available data.
- Retrieving the required tag/field data.</p>
<p>Can anybody help me in this regard??</p>
<h2>I have seen few of the available libraries l... | <p>with "SWIFT message syntax validation" I guess you are speaking about getting the FIN syntax right?</p>
<p>If so, I have just posted an answer to another SWIFT related question on StackOverflow.</p>
<p>I have copy and pasted my response below again for your convenience (from here: <a href="http://stackoverflow.com... |
Finding Memory Usage in Java <p>Following is the scenario i need to solve. I have struck with two solutions.</p>
<p>I need to maintain a cache of data fetched from database to be shown on a Swing GUI.
Whenever my JVM memory exceeds 70% of its allocated memory, i need to warn user regarding excessive usage. And once JV... | <p>Just a side note: <code>Runtime.freeMemory()</code> doesn't state the amount of memory that's left of allocating, it's just the amount of memory that's free within the currently allocated memory (which is initially smaller than the maximum memory the VM is configured to use), but grows over time.</p>
<p>When starti... |
How to update specific files via msi installation <p>I want to make a installation which can be both new installation and update installation.
When it was used as an update installation, I want some files to be updated regardless the version and modified datetime. And some files would never be updated.</p>
<p>What I t... | <p>MSI has specific <a href="http://blogs.msdn.com/astebner/archive/2005/08/30/458295.aspx" rel="nofollow">File replacement logic</a>.</p>
<p>I would look into doing a <a href="http://msdn.microsoft.com/en-us/library/aa369786(VS.85).aspx" rel="nofollow">Major upgrade</a>.</p>
<p>Assuming these are unversioned files (... |
Linq to SQL null values in GridView <p>Normally if I'm linking an ObjectDataSource to a GridView and I have a TemplateColumn that has an Eval in it and it's Null, I can just put a ".ToString()" it works fine. For some reason, this doesn't work the same when you're using Linq to SQL.</p>
<p>I originally was using XSD ... | <p>Most everything that LINQ returns is of <a href="http://msdn.microsoft.com/en-us/library/2cf62fcy.aspx" rel="nofollow">Nullable types</a>. So in your binding expressions you need to use GetValueOrDefault().ToString() or the new "??" null coalescing operator rather than just plain old ToString(). I hope this helps. C... |
How do I get all the values of a Dictionary<TKey, TValue> as an IList<TValue>? <p>I have a the following dictionary:</p>
<pre><code>IDictionary<int, IList<MyClass>> myDictionary
</code></pre>
<p>and I am wanting to get all the values in the dictionary as an IList....</p>
<p><hr /></p>
<p>Just to add a b... | <p>Because of how a dictionary (or hash table) is maintained this is what you would do. Internally the implementation contains keys, buckets (for collision handling) and values. You might be able to retrieve the internal value list but you're better of with something like this: </p>
<pre><code>IDictionary<int, ILis... |
what is the purpose of a css link placed like this style.css?23409823098 <p>Duplicate of <a href="http://stackoverflow.com/questions/438821/what-does-do-in-a-css-link">what does do in a css link</a></p>
<p>I've seen a few sites who list a stylesheet with parameters in it.
does anyone know what its called and what purp... | <p>The parameter is changed every time the content of the file changes. This allows the site hoster to set an infinite cache timeout, which keeps the browser from re-requesting the CSS. Without the parameter, updates would never reach the client.</p>
<p>See also the <a href="http://blog.stackoverflow.com/2009/01/podca... |
Error reporting tool/service <p>I was wondering if there is any tool out there which could be easily integrated into my existing application infrastructure and handle the error reporting. Kind of a service.</p>
<p>It should allow me (as an application developer) to send unhandled errors into it .. e.g. using a webserv... | <p>Have a look at <a href="http://www.gurock.com/products/smartinspect/" rel="nofollow">SmartInspect</a>.</p>
|
NHibernate one-to-many problem <p>I have a Vessel object that has a one-to-many relationship with a
VesselDetail object. When I add a VesselDetail object to the Vessel object and try to save the Vessel object, it seems NHibernate does not add the foreign key when inserting the VesselDetail object.</p>
<p>Where am I g... | <p>It seems I was missing some fundamental NHibernate skills. Reading a little bit up on this it seems you need to let the child object be responsible for the one-to-many relation.</p>
<p>This fixed the problem for me:</p>
<pre><code>public class VesselMap: ClassMap<Vessel>
{
public VesselMap()
{
... |
Is it a good idea to store serialized objects in a Database instead of multiple xml text files? <p>I am currently working on a web application that requires certain requests by users to be persisted. I have three choices:</p>
<ol>
<li>Serialize each request object and store it as an xml text file.</li>
<li>Serialize t... | <p>Short answer: If option 2 fits your needs well, use it. There's nothing wrong with storing your data in the database.</p>
|
DataGridView Value appearing as 1,000 when I would like it to appear as 1000 <p>I have a <code>DataGridView</code> and I am writing integers in to one of the columns, I would like these values not to have a comma in them when the value >= 1000. But at the moment, when i enter a value which is >= 1000 they appear in the... | <blockquote>
<p>the comma could be translated
incorrectly in certain areas</p>
</blockquote>
<p>If you mean "certain countries/locales" by that then this is incorrect. Your numbers are being formatted according to the rules of the current user's locale, so a comma in one locale would become a dot in other etc.
Ot... |
Is there anything like IPython / IRB for Perl? <p>I've grown accustomed to using IPython to try things out whilst learning Python, and now I have to learn Perl for a new job. </p>
<p>Is there anything out there like IPython for Perl? In particular, I'm interested in completion and access to help.</p>
| <p>I usually just use <code>perl -de0</code>, but I've heard of:</p>
<ul>
<li><a href="http://search.cpan.org/perldoc?Devel%3A%3AREPL">Devel::REPL</a></li>
<li><a href="http://www.sukria.net/perlconsole.html">perlconsole</a></li>
</ul>
|
Generate Images for formulas in Java <p>I'd like to generate an image file showing some mathematical expression, taking a String like "(x+a)^n=â_(k=0)^n" as input and getting a more (human) readable image file as output. AFAIK stuff like that is used in Wikipedia for example. Are there maybe any java libraries that d... | <p>First and foremost you should familiarize yourself with <a href="http://en.wikipedia.org/wiki/TeX" rel="nofollow">TeX</a> (and <a href="http://en.wikipedia.org/wiki/LaTeX" rel="nofollow">LaTeX</a>) - a famous typesetting system created by Donald Knuth. Typesetting mathematical formulae is an advanced topic with many... |
How do I upper case an email address? <p>I expect this should be a pretty easy question. It is in two parts:</p>
<ol>
<li>Are email addresses case sensitive? (i.e. is foo@bar.com different from Foo@bar.com?)</li>
<li>If so, what is the correct locale to use for capitalising an email address? (i.e. capitalising the ema... | <p>Judging from the specs the first part <em>can</em> be case sensitive, but normally it's not.<br>
Since it's all ASCII you should be safe using a "naive" uppercase function. </p>
<p>Check out the <a href="http://en.wikipedia.org/wiki/E-mail_address#RFC_specification" rel="nofollow">RFC spec part of the wikipedia art... |
Cannot locate 'org.springframework.security.annotation.Jsr250MethodDefinitionSource' <p>When I configure method security under Spring Security I get the error shown above (see stack trace below). I am running Spring 2.5.6, Spring Security 2.0.4 under Eclipse 3.4 with a Tomcat 6 runtime. I need any suggestion as to what... | <p>And I found the answer. For annotations you need the following jar in your classpath:</p>
<p>spring-security-core-tiger-2.0.4.jar</p>
|
URL Rewriting <p>i am using URL rewriting in my asp.net application using regx</p>
<p>virtual URL is</p>
<pre><code>/ProductDatabaseCMS/(?<category>\w*)/Product/(?<product>\w*)\.aspx
</code></pre>
<p>original URL is</p>
<pre><code>/ProductDatabaseCMS/Product.aspx?PROD_ID=${product}
</code></pre>
<p>app... | <p>If you use a relative URI to reference the external stylesheet, you have to consider this: Relative URIs are always resolved from a base URI which is the URI of the current resource if not declared otherwise.</p>
<p>So if you request <code>/foo/bar</code> and there is a relative URI reference <code>css/baz.css</cod... |
SQL "group by" question - I can't select every column <p>I have a database where each row has an id, a URL, and an XML.
The IDs are unique, but URLs column can have duplicates.
I need all the URLs, without duplicates, and for each URL I need the id and XML.</p>
<p>If I ask only for the URL and the Id, I use the follow... | <pre><code>select id, url, xml
from table1
where id in (
select min(id)
from table1
group by url)
</code></pre>
<p>would give you rows with duplicate urls removed (and only the first instance of duplicate urls included)</p>
|
HttpContext.Current accessed in static classes <p>Can I call <code>HttpContext.Current</code> from within a static class and Method?</p>
<p>I want to store a value on a per-user basis but want to be able to access it in a static manner.</p>
<p>e.g. Will this work?</p>
<pre><code>public static class StaticClass
{
... | <p>Yes thats one way in which it is helpful, of course the thread on which it is called must currently be processing a request to make it useful.</p>
|
Does the Google Ad javascript really need to be in the HEAD tag? <p>The google ad manager help site is pretty prescriptive about how the calls to their Javascript API need to be made and how combining blocks of javascript calls could cause code to break.</p>
<p>(<a href="http://www.google.com/admanager/help/en_US/tips... | <p>Have done the move with the Google Ad section outside of HEAD and just in the BODY part itself. Really doesn't make a difference since when it was moved, it was just right after the parameters used for the ads to display.</p>
<p>Probably has more to do with trying to have the script loaded before the necessary hook... |
jquery session - dynamic variable naming <p>just having a problem here.
i'm doing the UI of a web-based app using jquery, css.
there's a shopping a cart, and i want to store the selected items in the session, i used jquery.session plugin.
e.g. <code>var $.session("var1","item1");</code></p>
<p>What i want is to dynami... | <p>If there's a shopping cart, that data should be handled by a server side scripting language like PHP. I'm assuming at the end they will be charged via credit card? This kind of data needs to be secure.</p>
<p>In addition, that's a pretty big part of functionality to be handled by a non-secure client-side language... |
How to get raw query that the ODBC driver tries to execute? <p>I'm using C++ to query a SQL Server 2005 database using ODBC. The queries contain parameters that I set using SQLSetParam(). I run the queries by calling SQLExecute().</p>
<p>Occasionally a query will fail, and I need to log the context of the failure. I a... | <p>You can enable ODBC tracing on the client via the control panel, but be prepared for a major performance hit and some very large log files to read. </p>
|
Is F# a usable language for .net windows development <p>I have been hearing about F# and Microsoft now have a guy who is blogging and coding away in redmond somewhere about it. Can you really write GUI code from F# (I'd love to see an example of say adding a button to a form and subscribing to the onclick event for in... | <p>Yes, you can certainly write WinForms apps - although you wouldn't override the OnClick method, you'd subscribe to the Click event.</p>
<p>Yes, F# has full access to .NET, although you won't get very idiomatic functional code if you use a lot of mutable types.</p>
<p><a href="http://tomasp.net/">Tomáš PetÅÃÄe... |
ServiceContainer, IoC, and disposable objects <p>I have a question, and I'm going to tag this <em>subjective</em> since that's what I think it evolves into, more of a discussion. I'm hoping for some good ideas or some thought-provokers. I apologize for the long-winded question but you need to know the context.</p>
<p>... | <p>One option might be to go with a factory pattern, so that the objects created directly by the IoC container never need to be disposed themselves, eg</p>
<pre><code>IBinaryDataProviderFactory factory =
ServiceContainer.Global.Resolve<IBinaryDataProviderFactory>();
using(IBinaryDataProvider provider = facto... |
Can I pretty-print the DBIC_TRACE output in DBIx::Class? <p>Setting the DBIC_TRACE environment variable to true:</p>
<pre><code>BEGIN { $ENV{DBIC_TRACE} = 1 }
</code></pre>
<p>generates very helpful output, especially showing the SQL query that is being executed, but the SQL query is all on one line.</p>
<p>Is there... | <p><a href="http://blog.afoolishmanifesto.com/archives/1444">As of DBIx::Class 0.08124 it's built in.</a></p>
<p>Just set <code>$ENV{DBIC_TRACE_PROFILE}</code> to <code>console</code> or <code>console_monochrome</code>.</p>
|
YUI 3 Chaining <p>YUI 3 allows you to write<br />
<code>Y.all(".foo").removeClass("bar");</code></p>
<p>However it does not allow writing<br />
<code>Y.all(".foo").removeClass("bar").set("innerHTML", "baz");</code></p>
<p>It seems all the "operational" methods always terminate the call chain.<br />
This means YUI 3 o... | <p>It seems that because Y.all returns a list of things, after doing removeClass, an array of objects gets returned, not the Node object.</p>
<p>If, however, you use</p>
<pre><code>Y.get("#foo").removeClass("bar").set("innerHTML", "baz");
</code></pre>
<p>everything works as you expect, because it's working on a sin... |
Recommendations for Java + OpenPGP? <p>I want to develop a small OpenPGP client and I'm searching for a Java library for OpenPGP.</p>
<p>Are there any (open source) recommendations for this approach?</p>
<p><a href="http://www.cryptix.org/" rel="nofollow">Cryptix.org</a> does not seem alive anymore...</p>
| <p>I found the <a href="http://www.bouncycastle.org">BouncyCastle</a> library, for Java and C#. I haven't any experiences with it. I will try it and report here.</p>
<p>It provides:</p>
<ol>
<li>A lightweight cryptography API for Java and C#.</li>
<li>A provider for the Java Cryptography Extension and the Java Crypto... |
Python list serialization - fastest method <p>I need to load (de-serialize) a pre-computed list of integers from a file in a Python script (into a Python list). The list is large (upto millions of items), and I can choose the format I store it in, as long as loading is fastest.</p>
<p>Which is the fastest method, and ... | <p>I would guess <a href="http://docs.python.org/library/pickle.html#module-cPickle" rel="nofollow">cPickle</a> will be fastest if you really need the thing in a list.</p>
<p>If you can use an <a href="http://docs.python.org/library/array.html" rel="nofollow">array</a>, which is a built-in sequence type, I timed this ... |
Bash script does not continue to read the next line of file <p>I have a shell script that saves the output of a command that is executed to a CSV file. It reads the command it has to execute from a shell script which is in this format:</p>
<pre><code>ffmpeg -i /home/test/videos/avi/418kb.avi /home/test/videos/done/418... | <p>I think that should do the same and seems to be correct:</p>
<pre><code>#!/bin/bash
CSVFILE=/tmp/file.csv
cat "$@" | while read line; do
echo "Executing '$line'"
START=$(date +%s)
eval $line &> /dev/null
END=$(date +%s)
let DIFF=$END-$START
echo "$line, $START, $END, $DIFF" >>... |
How to debug a "debug assertion failure" in VC++ 6 <p>I wonder how to debug the following error:</p>
<pre><code>Debug Assertion failure
Program: tomtoprog.exe
File: dbgheap.c
Line: 1044
Expression:_CrtIsValidHeapPointer(pUserData)
...
</code></pre>
<p>I'm quiet new to windows development with VC++ 6 ... is there a ... | <p>It looks like you either have heap corruption or you are doing a double free of the same pointer. If you break into the debugger what is the last line of your code that is being called when the assert occurs?</p>
<p>The best way to check for issues like this is to use a page heap verifier like <a href="http://supp... |
XSLT: sum of tree fragment will always return 0 ! <p>I am stuck with a problem which seems stupid but I cannot find out the solution... With XLST, I need to sum a list of values calculated by a template. So I stored these values in a tree structure (a list of "Number" elements contained in a root element "Numbers"). Bu... | <p>Thank you very much Dimitre ! That's exactly what solved my problem : the X-Path expression I used in the sum function.</p>
<p>But why does this work :</p>
<pre><code><xsl:value-of select="sum($vNums/*/*)"/>
</code></pre>
<p>and not that :</p>
<pre><code><xsl:value-of select="sum($vNums/nums/num)"/>
... |
Where can I find an ICQ library for C#? <p>Is there any (preferably native) C# library which allows me to send some messages via the ICQ protocol? Is there something better than just wrapping libgaim or something?</p>
| <p>Perhaps this can help you out:</p>
<p><a href="http://sourceforge.net/projects/oscarlib/" rel="nofollow">http://sourceforge.net/projects/oscarlib/</a></p>
<p>Download the source and check the OscarLib. </p>
|
Bit Operation For Finding String Difference <p>The following string of mine tried to find difference between two strings.
But it's horribly slow as it iterate the length of string:</p>
<pre><code>#include <string>
#include <vector>
#include <iostream>
using namespace std;
int hd(string s1, string s... | <p>Try to replace the for loop by:</p>
<pre><code>for (unsigned i = 0; i < s1.size(); i++ ) {
if (b1[i] != b2[i]) {
dif++;
}
}
</code></pre>
<p>This should be a lot faster because no new strings are created.</p>
|
Change the characters in mysql with Convert failing - Still getting Não <p>I am populating this mysql table with data from a php (via post and using filter_input).
The database is utf8 but when I have a user that inputs words with ^,',',~ like Não I get this -> Não</p>
<p>What do I have to do to make it show th... | <p>First, make sure your page is utf-8</p>
<pre><code><meta http-equiv="Content-type" content="text/html; charset=UTF-8"/>
</code></pre>
<p>next, if your on Apache, make sur your in UTF-8 in config file : </p>
<pre><code>AddDefaultCharset UTF-8
</code></pre>
<p>or your can do it in a .php file like this : </p... |
How to join strings in PHP? <p>I have three strings:</p>
<p>$str1 = "abc";
$str2 = "def";
$str3 = "ghi";</p>
<p>I can get the value of all of them like this:</p>
<p>echo "$str1$str2$str3";</p>
<p>But I heard there is a way to join them together, so I can echo all of them without quotes.</p>
| <p>As well as concatenating like this</p>
<pre><code>echo $str1 . $str2 . $str3;
</code></pre>
<p>You can also just output them in sequence, which avoids evaluating an intermediate string</p>
<pre><code>echo $str1 , $str2 , $str3;
</code></pre>
<p>Finally, you can use braces in string to disambiguate string replace... |
Should I Always Fully Qualify Column Names In SQL? <p>Out of interest when working with SQL statements should I always use the fully qualifed column name (tablename.columnname) even if only working with one table e.g.</p>
<pre><code>SELECT table.column1, table.column2 FROM table
</code></pre>
| <p>It's better if you do - it doesn't add any complexity, and it can prevent errors in the future.</p>
<p>But in a well-defined system, you shouldn't <em>have</em> to - it's like namespaces in programming languages. The ideal is not to have conflicts, but it can clutter the code with the superfluous use of explicit n... |
D programming language IRC library <p>Hey, I'm searching for a D IRC library. Yes I know there is <a href="http://www.dprogramming.com/dirclib.php" rel="nofollow">dirclib</a>, but this one unfortunately doesn't seem to be compatible with version 1 or 2 of the language (anymore). When I try to use it with the 2.014 alph... | <p>As a general statement, D2 is bleeding edge and therefore library support for it is very poor. Most libraries out there work with D1 and maybe have versions in testing for D2. If you want to use D for something that requires complex infrastructure like libraries and tools, I'd stick with D1 for now because the lan... |
How to get the type of T from a generic List<T>? <p>Let say I have a <code>List<T> abc = new List<T>;</code> inside a class <code>public class MyClass<T>//...</code>. </p>
<p>Later, when I initialize the class, the <code>T</code> becomes <code>MyTypeObject1</code>. So I have a generic list, <code>Li... | <p>If I understand correctly, your list has the same type parameter as the container class itself. If this is the case, then:</p>
<pre><code>Type typeParameterType = typeof(T);
</code></pre>
<p>If you are in the lucky situation of having <code>object</code> as a type parameter, see Marc's answer.</p>
|
Django - having middleware communicate with views/templates <p>Alright, this is probably a really silly question but I am new to Python/Django so I can't really wrap my head around its scoping concepts just yet. Right now I am writing a <a href="http://docs.djangoproject.com/en/dev/topics/http/middleware/#topics-http-m... | <ol>
<li><p>It's not the best way. You could set my_var on the request rather than on the settings. Settings are global and apply to the whole site. You don't want to modify it for every request. There could be concurrency issues with multiple request updating/reading the variable at the same time.</p></li>
<li><p>To a... |
Populate a form and print out document <p>I have a word document which is a blank form. I need to be able to fill it in programatically using .NET, and print out the result.</p>
<p>The form I have is a Word document, but I could obviously convert this to PDF if it is needed. </p>
| <p>Do you have Word document in Open XML format or is it in old binary format?</p>
<p>In Open XML this task can as easy as manipulation of XML inside a package (ZIP file).</p>
<p>If you have binary Word file this can be tricky. You will need to use .NET Programmability Support for Office and <a href="http://msdn.micr... |
How can I trace IIS 500 errors thrown by my webservice <p>I have deployed a new version of an ASP.NET webservice. The IIS logfile reports an errorcode 500 when this service is being called by a client. My own (test) can use the service without any error. I have enabled errorlogging in my ASP.NET webservice, but no erro... | <p>Which version of IIS are you using?</p>
<p>In IIS7 you have extensive tracing capabilities. </p>
<p>Take a look at: <a href="http://www.iis.net/learn/troubleshoot/using-failed-request-tracing/troubleshooting-failed-requests-using-tracing-in-iis" rel="nofollow">Troubleshooting Failed Requests Using Tracing in IIS 7... |
Native looking GUI framework for Mac and Windows <p>I am currently searching for a GUI framework that looks and works native under Mac and Windows. Further I dont want to use C++ but e.g. C#, Java, Ruby or Python.</p>
<p>Thx a lot.</p>
| <p>Look at <a href="http://www.wxwidgets.org/">wxWidgets</a> or <a href="http://www.qtsoftware.com/products/">QT</a>.</p>
<p>However, consider that those toolkits will only get you an approximate platform look and feel. Usually, it feels "OK" on Windows, but on the Mac it typically looks and feels more like a "ported"... |
What versioning design pattern would you recommend <p>I have a requirement to build 'versioning' into an application and was wondering how best to approach it. </p>
<p>I have this general pattern:</p>
<p>Model A has many B's</p>
<p>Where on update the attributes of A need to be versioned and its associated objects (... | <p>I don't think there is no specific GoF design pattern per se for versioning because there exists many implementations of it. </p>
<p>The most simple implementation of versioning is a linked list of objects. Where each node in the list is a new revision of whatever the versionable object is. To save space you also i... |
develop own WORKFLOW <p>I m in an internship in an enterprise that wants to develop its own WORKFLOW, but they are only interested to "Time management" ..I am now understanding jBoss jbpm
so what do you think about that?
From where can I start in this project?
thanks</p>
| <p>Is this question inviting opinion? </p>
<p>Surely the best platforms and tools for developing and hosting workflows are relatively dependent upon the enterprise in question, their ability to maintain and support such systems etc etc, aren't they? </p>
<p>For example, lots of larger enterprises invest heavily in Mi... |
I am getting a blank page while deploying MVC application on IIS <p>I am currently deploying my application built using RC of MVC ASP.NET on the production server which is showing nothing now.
The routes in my global.ascx are typical i.e. </p>
<pre><code>routes.MapRoute(
"Default", ... | <p>You will also get a blank page when you have error handling setup in your global.asax and something generic is wrong (like an assembly that could not be found).</p>
<p>When you disable it in the global.asax, you can see the server error.
Don't forget to enable it again after fixing those initial bugs.</p>
<pre><co... |
Raising Events From Interface (win forms) <p>My scenario:</p>
<p>Windows Forms Application with a base master (mdi) form.</p>
<p>An Interface that has an event:</p>
<pre><code>Public Interface IDoSomething
Event AddFilter()
</code></pre>
<p>Modal popup window implements the interface and decalres event: </p>
<pre... | <p>The critical part is initializing m_Popup correctly. You haven't said anything about that. Some sample code:</p>
<p>Form2:</p>
<pre><code>Public Class Form2
Implements IDoSomething
Public Event AddFilter() Implements IDoSomething.AddFilter
Private Sub Button1_Click(ByVal sender As System.Object, ByV... |
Clickonce Upgrade and application setting <p>We have a winform application deplyed using Clickonce which has a configuration file. </p>
<p>What we need is when there is an upgrade available, to merge the configuration in local machine with what is coming from the deplyoment.</p>
<p>Any ideas or experiences?</p>
| <p>There's an Upgrade method on Properties.Settings.Default that is supposed to do that if you call it before you access any of the settings.</p>
|
Find the unix platform name <p>I want to be able to determine the output folder based on the platform name: AS3, AS4, AS5, SUN. </p>
<p>I couldn't figure out how to extract the platform name from the system. I experimented with:</p>
<pre><code>uname -a
file /bin/bash
</code></pre>
<p>Thanks</p>
<p><strong>Solution... | <p>I think you'll have to look in a specific file for each OS. For example, on SunOS, you can type:</p>
<pre><code>uname -s -r -v
</code></pre>
<p>For RHEL, check <code>/etc/issue</code>.</p>
|
Does linq to sql automatically lazy load associated entities? <p>Does linq to sql automatically lazy load associated entities?</p>
<p>I would think it would but I can't find an article stating it as such.</p>
| <p>It depends how you define "lazy-load".</p>
<p>If you say</p>
<pre><code>var person = (from p in db.People
where p.PersonId = pid
select p).First();
var spouse = person.Spouse; // based on the SpouseId FK
// back into the People table.
</code></pre>
<p... |
Why can't I do ??= in C#? <p>I often find myself doing:</p>
<pre><code>foo = foo ?? x;
</code></pre>
<p>Why can't I do:</p>
<pre><code>foo ??= x;
</code></pre>
<p><strong>Edit</strong>: I know it's not part of the language... My question is "why not"? I find the necessity to repeat "foo" to be unpleasing and poten... | <p>When I think about it, </p>
<pre><code>foo = foo ?? x
</code></pre>
<p>is really just </p>
<pre><code>foo = foo != null ? foo : x
</code></pre>
<p>and at that point, the analogy to += starts to fall apart.</p>
|
How to update Dynamic Resource within a Dynamic Resource? <p>I have a visual brush which is a group of shapes, the main colour of which is a dynamic resource itself - so the shape is for example MyShape and the Colour, MyColour which is referenced by the Shape object.<br />
My problem is when I update the colour for th... | <p>Unless I misunderstand the situation, exactly what you're talking about works pretty well. I just tried it out with this Xaml:</p>
<pre><code><Window x:Class="ConditionalTest.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"... |
Does `Using Namespace;` consume more memory? <p>Does <code>Using Namespace;</code> consume more memory?</p>
<p>I'm currently working on a mobile application and I was just curious if those unneeded using statements that visual studio places when creating a class make my application require some extra memory to run.</p... | <p>To put it simply: no.</p>
<p>Those statements aren't translated into any form of IL. They're just shortcuts to avoid using (ugly!) fully qualified type names.
But, if you're using VS2008 and/or R# you can remove unused ones automagically.</p>
|
Best practices for DataBinding in asp.net for maintainability <p>I would like to know what are the best practices for using asp.net DataBinding, in terms of maintainability. </p>
<p>I don't want the application to fall appart when I have to make changes to the database.</p>
<p>Should I databind completely in codebehi... | <p>My philosophy on this is that data access stuff has no business in the markup. Object Data Sources are better then SQL Data Sources, but I like to keep my markup as only stuff that will get rendered on to the page. I also prefer the control you have on what stuff is databound that you get from always doing it from t... |
How do I change the color of a Cocos2d MenuItem? <pre><code>[MenuItemFont setFontSize:20];
[MenuItemFont setFontName:@"Helvetica"];
//I'm trying to change the color of start (below item)
MenuItem *start = [MenuItemFont itemFromString:@"Start Game"
target:self
... | <pre><code>MenuItemFont *start = [MenuItemFont itemFromString:@"Start Game"
target:self
selector:@selector(startGame:)];
[start.label setRGB:0 :0 :0]; // Black menu item
</code></pre>
<p>Label is a property of MenuItemFont, a s... |
secure file exchange <p>I would like to set up a web application on my company's Linux box for enabling secure file exchange with our customers. I'm looking for an open source application, preferably with a large user base, that supports these features:</p>
<ul>
<li>works over HTTPS (so SFTP or other similar solutions... | <p>How about <a href="http://www.webdav.org/" rel="nofollow">WebDAV</a>? This is what <a href="http://subversion.tigris.org/" rel="nofollow">subversion</a> uses to sync files over HTTPS. Here's a <a href="http://www.webdav.org/projects/" rel="nofollow">list of open source WebDAV projects</a>.</p>
|
Where to store database credentials in a web app? <p>I'm wondering what techniques you use to store the database credentials for your application. I'm specifically concerned with java webapps, but I don't think there's any need to limit the questions to that. </p>
<p>things to consider:<br />
Do you use property fil... | <p>Since you're leaving the question open to platform, I'll add that database credentials for .NET apps are stored in the web.config file. From version 2.0 and above, there is a specific ConnectionStrings section that allows for easier programmatic access to the connection string.</p>
<p>In addition to having IIS auto... |
Solution structure / best practices <p>I just recently started a new personal project, with a goal of having it able to scale from the start.</p>
<p>I got a suggestion for the structure, to create something like this: </p>
<pre><code><solution>
|-- project.client.sql.queries
|-- project.admin.sql.queries
|-- pr... | <p>Here is the best advice anyone can ever give you at this point in time:</p>
<blockquote>
<p>The crappy first version is infinitly better then the perfect version that doesnt exist.</p>
</blockquote>
<p>I forget where I got that from, Ive seen that advice many places. It is 100% true.</p>
|
Where can I learn about biomechanical algorithms? <p>I'm planning to start the development of human motion recognition software which will monitor accelerations and recognize motion patterns (run, walk, jump...).</p>
<p>I have started collecting books about biomechanics and it would be good to get some good book about... | <blockquote>
<p>Where can I get started with some reading material that might be useful for the project?</p>
</blockquote>
<p>I'd suggest get started by talking with a domain expert in that domain ... and/or in a university library.</p>
<p>I discovered that my local university, which receives some money from the go... |
Is this a reasonable user registration process? <p>I'm working on a registration process for an internal application. My initial design is below.</p>
<p>My main question is whether it's really necessary to include a <code>registration_confirmation_code</code>. Does it protect the app from a realistic threat or just ad... | <p>Don't trust people even if they are internal to your organization. It sounds bad but unless you're dealing with a very small group, your method is a wise choice.</p>
<p>One more thing, you may want to ensure their email is unique.</p>
|
Saving HABTM records when not all join table columns are foreign keys <p>I am trying to update tables with a has and belongs to many (HABTM) relationship.</p>
<p>When my join table looked like this:</p>
<pre><code>CREATE TABLE IF NOT EXISTS `items_labels` (
`item_id` int(11) NOT NULL,
`label_id` int(11) NOT NULL
... | <p>This should work:</p>
<pre><code>Array
(
[Item] => Array
(
[id] => 1
)
[Label] => Array
(
[Label] => Array
(
[0] => Array
(
[label_id] => 4
... |
What's really good about .NET Framework 3.5 (except LINQ)? <p>I'm moving from .NET Framework 2.0 to 3.5.</p>
<p>I'm not a big fan of LINQ. So beside of that and "extensions" what should I do know and take advantage of in .NET Framework 3.5?</p>
| <p>Lambdas, Type Inferance.. most of the underlying things that were created to support LINQ.</p>
<p>Why are you not a fan of LINQ?</p>
<p>EDIT: AS a followup, when I say LINQ I am not talking about LINQ to SQL I am talking about LINQ (Language Integrated Query). I think this distinction needs to be made in general ... |
How to make an network-ip scan in c++? <p>I am experimenting with C++ winsockets. I want to create a method with which I can find the server on the network, without knowing it's IP. To do this I simply loop my connect method through IP adresses 192.168.1.0 to 192.168.1.255. However, the time between each connect is qui... | <p>The long delay is caused by the socket's need to time out before returning to the caller. To reduce the total execution time, you should make multiple worker threads that simultaneously connect to separate IP-addresses.</p>
|
SQL query to return top N rows per ID across a range of IDs <p>Lets say I have a table containing several hundred million rows that looks something like this:</p>
<pre><code>memID | foo | bar | foobar
1 | blah | blah | blah
1 | blah | blah | blah
1 | blah | blah | blah
1 | blah | blah | blah
1 | ... | <pre><code>declare @startID int, @endID int, @rowsEach int
select @startID = 0, @endID = 2, @rowsEach = 3
select *
from
(
select memID, foo, bar, foobar, row_number() over (partition by dense_rank order by dense_rank) [rank_row]
from
(
select memID, foo, bar, foobar, dense_rank() over (order by memID... |
How to predict MySQL tipping points? <p>I work on a big web application that uses a MySQL 5.0 database with InnoDB tables. Twice over the last couple of months, we have experienced the following scenario: </p>
<ol>
<li>The database server runs fine for weeks, with low load and few slow queries.</li>
<li>A frequently-e... | <p>The MySQL Performance Blog is a fantastic resource. Namely, <a href="http://www.mysqlperformanceblog.com/2007/11/01/innodb-performance-optimization-basics/" rel="nofollow">this</a> post covers the basics of properly tuning InnoDB-specific parameters.</p>
<p>I've also found that the PDF version of the <a href="http:... |
.NET User Management Customization <p>I was wondering if anyone could point me to some resources concerning customization of the user management system that is built in .NET. What I am talking about is: <a href="http://msdn.microsoft.com/en-us/library/ms998347.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/libra... | <p>In my opinion, you should not extend the membership tables at all. You should, instead, create your own tables and reference the membership data. One technique I use is to use the Membership GUID ID as a foriegn key to my own "users" table which contains my extended data.</p>
<p>This works out for the best becaus... |
How can I return the results of a function to a cell in Excel? <p>Suppose I have a function attached to one of my Excel sheets:</p>
<pre><code>Public Function foo(bar As Integer) as integer
foo = 42
End Function
</code></pre>
<p>How can I get the results of <code>foo</code> returned to a cell on my sheet? I've tr... | <p>Try following the directions <a href="http://web.archive.org/web/20090220142331/http://exceltip.com/st/Writing_Your_First_VBA_Function_in_Excel/631.html" rel="nofollow">here</a> to make sure you're doing everything correctly, specifically about where to put it. ( <code>Insert->Module</code> )</p>
<p>I can confir... |
XPath SelectNodes in .NET <pre><code><Document>
<A>
<B>
<C></C>
</B>
</A>
<E>
<F>
<C></C>
</F>
<G>
<C></C>
</G>
</E>
</Document>
</code></pre>
<p>If i load the above XML... | <p>Simply: a leading // means "at any level" in the same <em>document</em> as the selected node.</p>
<p>From the <a href="http://www.w3.org/TR/xpath">spec</a>:</p>
<ul>
<li>//para selects all the para descendants of the document root and thus selects all para elements in the same document as the context node</li>
<li... |
windows service stops and starts immediately, but it shouldn't <p>I'm creating a windows service and after installing the service, it stops and starts immediately, but it shouldn't be at all. Previously, I was getting errors that the service was not responding to the start command in a timely fashion, so I took the ini... | <p>It might be stopped unexpectedly if your main thread terminates on exception.</p>
|
Entity Linq - Retrieve record and only the first child record in a one to many relationship <p>I have an entity called "Requests" which has a navigation called "StatusHistories" </p>
<p>I need to retrieve all of the Requests where the last StatusHistory is "Open"</p>
<p>StatusHistory has the fields
StartDate (the hig... | <pre><code>var result = from r in Requests
where <condition>
select r.field1, r.field2, (from s in StatusHistory
where <join codition>
order by s.StartDate descending
... |
Best practice for using window.onload <p>I develop Joomla websites/components/modules and plugins and every so often I require the ability to use JavaScript that triggers an event when the page is loaded. Most of the time this is done using the <code>window.onload</code> function.</p>
<p><strong>My question is:</stro... | <p><code>window.onload = function(){};</code> works, but as you might have noticed, <strong>it allows you to specify only 1 listener</strong>.</p>
<p>I'd say the better/newer way of doing this would be to use a framework, or to just to use a simple implementation of the native <code>addEventListener</code> and <code>a... |
Question about yield return statement <p>Take the example here:</p>
<pre><code> public static IEnumerable<BigInt> EvenNumbers(IEnumerable<BigInt> numbers)
{
foreach (BigInt number in numbers)
{
if (number % 2 == 0)
{
yield return number;
}
... | <p>"return" simply won't work here (since it would try to return a <code>BigInt</code>, and the method declares an <code>IEnumerable<BigInt></code>. Jon Skeet has a good write-up of iterator blocks (what this is) in the <strong>free</strong> chapter 6 of <a href="http://www.manning.com/skeet/" rel="nofollow">C# i... |
jQuery JSON Problem <p>I want to populate form fields with values from a database immediately after the user enters a value in the #sid field. Here is my jQuery/HTML example:</p>
<pre><code><script src="jquery-1.3.1.min.js"></script>
<script type="text/JavaScript">
$(document).ready(function()
{
$... | <p>Nice little injection attack waiting to happen there ;)</p>
<p>Try changing</p>
<pre><code>$.each(data.items,
</code></pre>
<p>to:</p>
<pre><code>$.each(data,
</code></pre>
<p><em>Edit</em>: to answer your comment, I like to name my fields the same as the data key:</p>
<pre><code><input type="text" name="sa... |
How to download fast lots of web pages in ruby? Parallelizing download? <p>I need to scrape(using scrAPI) 400+ web pages ruby, my actual code is very sequential:</p>
<pre><code>data = urls.map {|url| scraper.scrape url }
</code></pre>
<p>Actually the code is a bit different (exception handling and stuff).</p>
<p>How... | <pre><code>th = []
data = []
dlock = Mutex.new
urls.each do |url|
th << Thread.new(url) do |url|
d = scraper.scrape url
dlock.synchronize { data << d }
end
end
th.each { |t| t.join }
</code></pre>
<p>Tada! (Caution; written from memory, not tested, may eat your kitten, etc)</p>
<p><strong>E... |
getline() in C++ - _GNU_SOURCE not needed? <p>Firstly, I'm pretty new to C++. I believe that <code>getline()</code> isn't a standard C function, so <code>#define _GNU_SOURCE</code> is required to use it. I'm now using C++ and g++ tells me that <code>_GNU_SOURCE</code> is already defined:</p>
<pre><code>$ g++ -Wall -We... | <p>I think g++, from version 3, automagically defines <code>_GNU_SOURCE</code>. This is supported by your third line in the error stating that the first definition was done on the command line (with nary a <code>-D_GNU_SOURCE</code> in sight):</p>
<pre><code><command-line>: error: this is the location of the pr... |
How to limit user access at database level in Hibernate <h3>The App</h3>
<p>I need to implement a web app that will be used by different users. Each user has different privileges on various tables, e.g. </p>
<p><li> User A can see fields 'name' and 'address' from the table <code>Student</code> </li>
<li> User B can ... | <ol>
<li><p>Add a security key to your entities, create a table for permissions and link user with permission with entitytype and also with security key with role. This way you can say things like: Admin_role can access Student (Entitiy type) and do read (Operation in Permission) and Write (Operation) while Student_rol... |
Looking for Java spell checker library <p>I am looking for an open source Java spell checking library which has dictionaries for at least the following languages: French, German, Spanish, and Czech. Any suggestion?</p>
| <p>Another good library is JLanguageTool <a href="http://www.languagetool.org/usage/" rel="nofollow">http://www.languagetool.org/usage/</a>
It has a pretty simple api and does both spelling and grammar checking/suggestions.</p>
<pre class="lang-java prettyprint-override"><code>JLanguageTool langTool = new JLanguageToo... |
Selecting empty mysql datetime fields <p>Is there a better way to select empty datetime fields than this?</p>
<pre><code>SELECT * FROM `table` WHERE `datetime_field` = '0000-00-00 00:00:00'
</code></pre>
| <p>Better in what way? That query does everything you ask of it and, provided there's an index on <code>datetime_field</code>, it's as fast as it's going to get.</p>
<p>If you're worried about the query looking "ugly", don't be. Its intent is quite clear.</p>
<p>The only possible improvement you could consider is to ... |
Is getting JSON data with jQuery safe? <p>JSON allows you to <a href="http://docs.jquery.com/Ajax/jQuery.get">retrieve data in multiple formats</a> from an AJAX call. For example:</p>
<pre><code>$.get(sourceUrl, data, callBack, 'json');
</code></pre>
<p>could be used to get and parse JSON code from <code>sourceUrl</c... | <p>The last time I looked (late 2008) the JQuery functions get() getJSON() etc internally eval the JSon string and so are exposed to the same security issue as eval.</p>
<p>Therefore it is a very good idea to use a parsing function that validates the JSON string to ensure it contains no dodgy non-JSON javascript code,... |
iPhone: Popping a modalViewController off of a UINavigationController stack <p>Ever since I've taken one of my UIViewController subclasses and present it to the user in the form of a modal view, with presentModalViewController:animated.. I haven't been able to dismiss it using:</p>
<pre><code>[self dismissModalViewCon... | <p>Make sure you call dismissModalViewControllerAnimated on the parent of the modal view controller, not on the modal view controller itself.</p>
|
About ProgramData folder's right with UAC turned on under Vista <p>I login in with Administrator on Vista with UAC turned on, is it OK for me to create, modifty or delete file in ProgramData folder. My test result is YES, but I found my AP can access the folder which name is "MicroSoft", is there any starndard document... | <p>It should be fine, yes. The Program Data folder is there for programs for that purpose.</p>
<p>In terms of permission, you should be able to check or modify file permissions using .NET. See the <code>System.IO.DirectoryInfo</code> class as a reference, and see <code>System.Management</code> and <code>System.Managem... |
ROWID and RECID <p>what is ROWID and RECID actually in progress.Can we use the RECID instead of ROWID.what is the diffrrence between them??</p>
| <p>Both <a href="http://documentation.progress.com/output/OpenEdge102a/oe102ahtml/wwhelp/wwhimpl/common/html/wwhelp.htm?context=dvref&file=dvref-15-48.html">RECID</a> and <a href="http://documentation.progress.com/output/OpenEdge102a/oe102ahtml/wwhelp/wwhimpl/common/html/wwhelp.htm?context=dvref&file=dvref-15-6... |
what language are the apps for the iphone created with? <p>what language is it similar to? cause i was looking at the dev page on apple for the iphone and it doesnt look like anything that i'm used to or know.</p>
| <p>iPhone applications are created using objective-C as the primary language. You can also use C/C++ in the applications, but the Cocoa Touch API uses objective-C.</p>
<p>Also, if you have never programmed on the Mac before it will take some getting used to. Apple uses the MVC (Model View Controller) design pattern ex... |
how do you print a bag datatype? <pre><code>Bag<String> wordFrequencies = getWordFrequencies(text);
</code></pre>
<p>how do i see what this wordfrequencies bag contains..
i ve used
org.apache.commons.collections15.Bag
org.apache.commons.collections15.bag.HashBag packages</p>
| <pre><code>public static String bagToString(Bag<?> bag) {
StringBuilder sb = new StringBuilder();
for (Object o : bag.uniqueSet() {
sb.append(o);
sb.append(":");
int nItems = bag.getCount(o);
sb.append(nItems);
sb.append(" ");
}
return sb.toString();
}
</co... |
Why can't I use multiple ids here? <p>I'm trying to get a bit of code working. I'm using xfade, latest version. Homebrew Javascript image fader that fades between all img tags in a div, assigned by the Javascript. There's an image fade script I found that uses Javascript to fade between images in a div. However, it can... | <p>You could consider implementing and learning jQuery, which has a few plugins to fade things as well as built in functions such as fadeIn(), fadeOut(), etc.</p>
<p>You could use multiple divs fade using a selector like this</p>
<pre><code>$('#div1, #div2').fadeOut(1000);
</code></pre>
<p>Good luck!</p>
<h2>Extra ... |
Conditional compilation in Python <p>How to do conditional compilation in Python ?</p>
<p>Is it using DEF ?</p>
| <p>Python isn't compiled in the same sense as C or C++ or even Java, python files are compiled "on the fly", you can think of it as being similar to a interpreted language like Basic or Perl.<sub>1</sub></p>
<p>You can do something equivalent to conditional compile by just using an if statement. For example:</p>
<pre... |
Introducing agile practices in a subproject only? <p>Imagine you work as a contractor in a large project involving multiple systems, and you are creating one of them. The whole project uses a traditional process, but there are smells that tell you that an agile process would be much better.</p>
<p>Now the question. Do... | <p>Here's a great diary of how a guy changed his whole company towards Agile over a period of a couple of years - yes, starting with his own subproject, i.e. "bottom-up". But he does go into the pros and cons of trying a "top-down" change.</p>
<p><a href="http://jamesshore.com/Change-Diary/" rel="nofollow">http://jame... |
MSMQ with WCF problem <p>This is a though on to explain, here i go.</p>
<p>We are creating a program where sender and receiver of the msmq is using WCF. We implemented a fault handle very similar as this:
<a href="http://msdn.microsoft.com/en-us/library/ms751472.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/lib... | <p>I finally found my problem. </p>
<p>On the receiving side of the queue I was using a nested transaction scope. When this happend:
- Invalid message received
- Exception
- catch the exception
- Dispose of the nested transaction</p>
<p>But the exception was thrown a little bit early, the nested transaction wasn't op... |
Microsoft SQL Server 2008 External Backup <p>I would like to save my backups from my SQL 2008 server to another server location.
We have 2 servers:</p>
<ul>
<li>Deployment server</li>
<li>File Server</li>
</ul>
<p>The problem is that the deployment server doesn't have much space. And we keep 10 days backups of our da... | <p>You can use 3rd party tools like <a href="http://SqlBackupAndFTP.com">SqlBackupAndFTP</a></p>
|
Performance of data <p>I have 60 columns in a table. </p>
<p>1). I want to add one more column to that table. Will there be any impact on performance?</p>
<p>2). How many columns can I add?</p>
<p>3). any idea for the avoid recursion. <em>[I have no idea here - annakata]</em></p>
| <p>Yes, but one more column is less of a problem than the fact that you already have 60.</p>
<p>I bet most of them are nullable?</p>
<p>With very wide tables (many columns) it becomes harder to write maintainable SQL. You are forced to deal with lots of exceptions due to the NULLS.</p>
<p>See also this post which a... |
Handling WCF Proxy null return issue <p>I have a WCF Client Proxy connected to a third party webservice.
The proxy works fine with nearly everything except on function.</p>
<p>This function works just fine with a ASMX proxy.</p>
<p>I have added service trace logging and can see the response from the service coming ba... | <p>You can try to use Trace Viewer to analyse WCF communications in more detail and find out more detail when errors are encountered. </p>
<p>Within the app.config (Client) and web.config (Server), you can add blocks. To enable tracing, simply add dignostics blocks and trace files will be generated in the specified l... |
What is the win32 API function for private bytes? <p>What is the win32 API function for private bytes (the ones you can see in perfmon).</p>
<p>I'd like to avoid the .NET API</p>
| <pre><code>BOOL WINAPI GetProcessMemoryInfo(
__in HANDLE Process,
__out PPROCESS_MEMORY_COUNTERS ppsmemCounters,
__in DWORD cb
);
</code></pre>
<p>ppsmemCounters can be a PROCESS_MEMORY_COUNTERS or PROCESS_MEMORY_COUNTERS_EX structure. </p>
<p>PROCESS_MEMORY_COUNTERS_EX.PrivateUsage is what you're looking ... |
Flash toggle button <p>I need a button in Flash/AS3 that toggles between on and off. So I was glad to see that the <a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/fl/controls/Button.html" rel="nofollow"><code>Button</code></a> class has the <a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLan... | <p>Here's how I coded my way around this:</p>
<pre><code>private buttonState:Boolean;
private function buttonToggle(button:SimpleButton){
var currDown:DisplayObject = button.downState;
button.downState = button.upState;
button.upState = currDown;
buttonState = !buttonState;
}
private function clickEv... |
Flex memory limit - how to configure <p>Can I control the memory limit (i.e. when GC has to run) in my Flex application?</p>
| <p>Check out the flash.system.System class. The "totalMemory" property will show you (in bytes) how much memory the current application is using. Calling System.gc() will run a GC. You could use a Timer to periodically check totalMemory and then preform gc if it exceeds a threshold. More info:</p>
<p><a href="http:... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.