input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
C#: Refactoring a Reynolds number calculator <p>I'm trying to learn some C# over the weekend and am following the 15 exercises found here: <a href="http://www.jobsnake.com/seek/articles/index.cgi?openarticle&8533" rel="nofollow">http://www.jobsnake.com/seek/articles/index.cgi?openarticle&8533</a></p>
<p>Yester... | <p>I think there is an error in your code but I made an assumption. Your second "if" would never evaluate tree as number < 2000 already makes the first branch true.</p>
<p>I would create an ENUM:</p>
<pre><code>enum FlowType
{
Laminar
, Transient
, Turbulent
};
static FlowType Reynolds(int d, int v, ... |
Regular expression to parse an array of JSON objects? <p>I'm trying to parse an array of JSON objects into an array of strings in C#. I can extract the array from the JSON object, but I can't split the array string into an array of individual objects.</p>
<p>What I have is this test string:</p>
<pre><code>string json... | <p>Balanced parentheses are literally a textbook example of a language that cannot be processed with regular expressions. JSON is essentially balanced parentheses plus a bunch of other stuff, with the braces replaced by parens. In the <a href="http://en.wikipedia.org/wiki/Chomsky_hierarchy">hierarchy of formal language... |
Stack, Static, and Heap in C++ <p>I've searched, but I've not understood very well these three concepts. When do I have to use dynamic allocation (in the heap) and what's its real advantage? What are the problems of static and stack? Could I write an entire application without allocating variables in the heap? </p>
... | <p><a href="http://stackoverflow.com/questions/79923/what-and-where-are-the-stack-and-heap">A similar question</a> was asked, but it didn't ask about statics.</p>
<h2>Summary of what static, heap, and stack memory are:</h2>
<ul>
<li><p>A static variable is basically a global variable, even if you cannot access it glo... |
Catch MainLoop exceptions and displaying them in MessageDialogs <p>I have a wxPython application that relies on an external config file. I want provide friendly message dialogs that show up if there are any config errors. I've tried to make this work by wrapping my app.MainLoop() call in a try/except statement.</p>
... | <p>Don't know if this will work for a wxPython application, but in the sys module you can overwrite the excepthook attribute, which is a function called with 3 arguments, <code>(type, value, traceback)</code>, when an uncaugth exception is caught. You can install your own function in there that handles only the excepti... |
What is the difference between Swing and AWT? <p>Can someone please explain me what's the difference between Swing and AWT?</p>
<p>Are there any cases where AWT is more useful/advised to use than swing or vice-versa?</p>
| <p>AWT is a Java interface to native system GUI code present in your OS. It will not work the same on every system, although it tries.</p>
<p>Swing is a more-or-less pure-Java GUI. It uses AWT to create an operating system window and then paints pictures of buttons, labels, text, checkboxes, etc., into that window and... |
Mass Memory Default directory <p>in my application i want to support both mass memory and memory card. but is the defualt drive name for mass memory "F:" ?</p>
<p>or it might change . and how could i know if it changes ?!?</p>
<p>Note : Lang is C# , windows application , Mobile series :S60</p>
<p>thnx</p>
| <p>I think you mean Mass Storage Device? There is no default drive letter, and the user can always change them. It's best not to rely on the drive letter that the device will be assigned, and instead pop up a list of possible devices (see Google's picasa as an exmample)</p>
|
IOCP, Cross platform libraries? <p>I've recently bumped into something called IOCP on the windows platform, to be more precise: Input/Output Control Ports. This seems to be <i>the</i> most efficient way to code your server software when it needs to hold thousands of users concurrently.
(Correct me if I'm wrong, but thr... | <p>Have you looked at boost::asio?
I'm not sure if it has all this functionality yet, but I believe that's one of the things it's intended for.</p>
|
Generating WordML Reports Using Templates and XPath using ASP.Net <p>I need to know how we can Generate WordML Reports Using Templates and XPath using ASP.Net.
What are its advantages.</p>
<p>A Simple How To Tutorial is what I require.</p>
| <blockquote>
<p>I need to know how we can Generate WordML Reports Using Templates and XPath using ASP.Net. ... A Simple How To Tutorial is what I require.</p>
</blockquote>
<p>Create (using Word) a document in WordML format which you'll use as a template.</p>
<p>Look at your WordML template: see that it's in XML fo... |
How to structure a Java EE system? How is the term application and thus the content of an EAR defined? <p>I am in the process of designing a build system and the directory structure for a large software system developed with Java EE 5. The build system will be implemented using ant.</p>
<p>We have multiple different s... | <p>Lots of questions here.</p>
<p>Java EE projects are either EAR or WAR deployments that use Java EE technology. If you have a WAR with JSPs and JDBC access of a relational database, that's a Java EE project. The original intent was that EAR files were "enterprise", and that meant EJBs. An EAR file an contain EJBs... |
Remove whitespace before a field using AWK <p>(<em>Almost exact duplicate of <a href="http://stackoverflow.com/questions/408469/keeping-original-format-post-passing-through-awk">http://stackoverflow.com/questions/408469/keeping-original-format-post-passing-through-awk</a> submitted by same person.</em>)</p>
<p>I have ... | <pre><code>awk '{sub(/^[ \t]+/, ""); print}'
</code></pre>
<p>This is from the famous awk 1 liners list, can be found here: <a href="http://student.northpark.edu/pemente/awk/awk1line.txt" rel="nofollow">http://student.northpark.edu/pemente/awk/awk1line.txt</a></p>
|
Accessing a Class that is NOT declared in App_Code in ASP.NET <p>I sometimes define Business Logic classes to "help" my ASPX code-behind classes. It makes the most sense to me to include them both in the code-behind file since they work together. However, I'd occasionally like to access the Business Logic classes fro... | <p>Make sure you place your classes in a sensible namespace.</p>
<p>Place 'using' keyword in code behind files you would like to access them.</p>
<p>Or <%@ import if you are using them in inline code.</p>
<p>Put the dll that contains your classes in the /bin folder.</p>
<p>TBH I prefer to keep the separate libra... |
Which license can I release stand-alone (exe, dmg) shoes-applications under? <p>If I create an application, using <a href="http://shoooes.net/" rel="nofollow">Shoes</a>, would I have to license it under a open source license, or can I use it for closed-source/propietary stuff? The framework consists of a lot of moving ... | <p>Shoes is distributed under an MIT license:</p>
<pre><code>Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without restriction,
including without limitation the rights to use, copy, modify, merg... |
What do you write in your log book? <p>Everywhere I've worked, programmers carry about a ruled A4 hard-back note book. To avoid attracting attention, I dutifully carry one also, and once or twice in every meeting I nod sagely and pretend to write down something interesting. Occasionally people leave theirs unattended... | <blockquote>
<p>Day 417. </p>
<p>Still here. We have no source code.</p>
<p>We lost the last of Joel's 12 tests two days ago.</p>
<p>I can not get out.</p>
<p>The end comes.</p>
<p>Management failures.</p>
<p>Management failures in the deep.</p>
<p>They are coming.</p>
</blockquote>... |
Anybody using .netTiers? <p>I'm considering adopting .nettiers for a new project as it seems to provide a lot of functionality I could use.</p>
<p>Is anybody using it in anger (I'm getting the feeling it hasn't got the following it once had) and if so, what are your perceptions of it?</p>
<p>Also, I can't find any co... | <p>Look at <a href="http://forums.subsonicproject.com/forums/p/340/1517.aspx" rel="nofollow">this</a>. It provides you with a good X vs Y comparison between the two of them.</p>
<p>A Key point that i always revise when selecting a framework to work with is:</p>
<p><strong>Will this Simplify, Make me more Productive</... |
How to vectorize with gcc? <p>The v4 series of the <code>gcc</code> compiler can automatically vectorize loops using the <a href="http://en.wikipedia.org/wiki/SIMD" rel="nofollow">SIMD</a> processor on some modern CPUs, such as the AMD Athlon or Intel Pentium/Core chips. How is this done?</p>
| <p>This page offers details on getting gcc to automatically vectorize
loops, including a few examples:</p>
<p><a href="http://gcc.gnu.org/projects/tree-ssa/vectorization.html">http://gcc.gnu.org/projects/tree-ssa/vectorization.html</a></p>
<p>In summary, the following options will work for x86 chips with SSE2,
giving... |
Sorting and Grouping Nested Lists in Python <p>I have the following data structure (a list of lists)</p>
<pre><code>[
['4', '21', '1', '14', '2008-10-24 15:42:58'],
['3', '22', '4', '2somename', '2008-10-24 15:22:03'],
['5', '21', '3', '19', '2008-10-24 15:45:45'],
['6', '21', '1', '1somename', '2008-10-24 15:4... | <p>For the first question, the first thing you should do is sort the list by the second field:</p>
<pre><code>x = [
['4', '21', '1', '14', '2008-10-24 15:42:58'],
['3', '22', '4', '2somename', '2008-10-24 15:22:03'],
['5', '21', '3', '19', '2008-10-24 15:45:45'],
['6', '21', '1', '1somename', '2008-10-24 15:45:... |
Running an OpenID organization <p>I wrote an application recently, which relies on OpenID for authentication. A lot of web applications these days are moving to OpenID, insofar that they <em>already</em> have userid/password authentication scheme, and OpenID is just an add-on. Since my application is a new one, I decid... | <p>This doesn't directly answer their question, but how many folks are on the internet and don't have an account with Yahoo, Flickr, AIM, WordPress, Myspace, Google, or MSN? They're all OpenID providers.</p>
<p>I'd argue that for the tiny % of the 'net population who uses none of those services, just point them to Vi... |
Auto-vectorizing vs. vectorized code by hand <p>Is it better in some sense to vectorize code by hand, using explicit pragmas or to rely on or use auto-vectorization? For optimum performance using auto-vectorization, one would have to monitor the compiler output to ensure that loops are being vectorized or modify them ... | <p>Auto vectorization never worked out well for me. To me it seems like auto-vectorization only works for very trivial loops at the moment.</p>
<p>I use the pragma/intrinsic approach and take a look at the assembly. If the compiler generates bad code (like spilling SSE registes onto the stack or adding redundant moves... |
Protecting your images, CSS and Javascript files from being used by external sites with Apache? <p>I came across a site that demonstrated a Javascript library and it asked that you please not link to the Javascript file directly from your site. That's a reasonable request. In fact, it wouldn't have occurred to me to ... | <p>Using an htaccess file you can do this.</p>
<p>Simply create a .htaccess file in the directory of the files you wish to protect with the following inside it:</p>
<pre><code>RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?yourdomain.com(/)?.*$ [NC]
</code></pre>
<p>For... |
Can you lock on a generic dictionary? <p>Or should you always create some other lock object?</p>
| <p>Yes, cast it to an IDictionary and lock on <code>.SyncRoot</code>:</p>
<pre><code>Generic.Dictionary<int, int> dic = new Generic.Dictionary<int, int>();
lock (((IDictionary)dic).SyncRoot)
{
// code
}
</code></pre>
<p>Thanks to this <a href="http://en.csharp-online.net/CSharp_Generics_Recipes%E2%80... |
What is Java written in? <p>What language is Sun's <code>JVM</code> written in?</p>
| <p>Sun actually has multiple JVMs. The <a href="http://OpenJDK.Java.Net/groups/hotspot/">HotSpot JVM</a> is written largely in C++, because HotSpot is heavily based on the <a href="http://Strongtalk.Org/">Animorphic Smalltalk VM</a> which is <a href="http://Code.Google.Com/p/strongtalk/source/browse/#svn/trunk/vm">writ... |
mySQL stored procedure with .NET connector problem <p>I've seen other topics that deal with this error but none that seem to correspond to my situation.</p>
<p>First of all, my code works completely fine when i run it locally.</p>
<p>But when i upload it to the server, i get the error:</p>
<p>Parameter '?PuserName' ... | <p>turned out microsoft Visual Web Developer wasn't correctly ftp-ing my files during the "publish" method. i downloaded filezilla and ftp-ed the files again and it worked....</p>
|
Printing named parameters <p>Archaelus suggested in <a href="http://stackoverflow.com/questions/383407/what-are-some-interesting-projects-to-solve-in-erlang-for-learning-purposes#383456">this post</a> that writing a new format routine to handle named parameters may be a good learning exercise. So, in the spirit of lear... | <p>Without comment on the algorithm, or on use of appropriate library functions... </p>
<p>I would have expected to see more use of pattern matching and recursion; for example parse_character (no longer folded) might be replaced with something like:</p>
<pre><code>parse_in_format ([], FmtStr, ParmStrs, ParmName) ->... |
Using Reflection To Instantiate 'Builder Pattern' (Joshua Bloch) <p>When attempting to use Joshua Bloch's "Builder Pattern" [Item 2 in <em>Effective Java Second Edition</em>] with reflection [<strong>object = constructors[index].newInstance(constructorParameterValues);</strong>] the following exception occurs:</p>
<p>... | <p>Note: This has been resolved. The accessible (private) constructor was being discarded and a non-accessible (override = false) was being attempted. Bottom Line: Programmer Error </p>
|
Linking page title block to home - best practises? <p>I do most if not all my sites to have the page title block (generally a styled h1 on my pages) to link back to the home page. </p>
<p>Should this be linked on the first page, i.e. the home page? I read that this shouldn't be linked, but one thing I do when I go to ... | <p>See sites such as facebook - the facebook logo always links to the homepage.</p>
<p>It's a strong convention, and I try to utilize it where ever practicable.</p>
|
Ruby Basics <p>What is the best online resource for learning the ruby language? Preferably intermediate and advanced topics.</p>
| <p>For start with the language:</p>
<ul>
<li><a href="http://www.ruby-lang.org/en/documentation/" rel="nofollow">Ruby Documentation</a></li>
<li>Why's Poignant Guide To Ruby (offline since August 2009)
<ul>
<li><a href="http://www.scribd.com/doc/8545174/Whys-Poignant-Guide-to-Ruby" rel="nofollow">Mirror 1</a> (Scribd)... |
Table per Concrete Class Hierarchy in Hibernate <p>I have the following Hibernate Mapping, which has to be mapped using the Table per Concrete Class Hierarchy:</p>
<pre><code><hibernate-mapping package='dao'>
<meta attribute='class-description'></meta>
<class name='PropertyDAO'>
&l... | <p>IMHO your model in the DB is wrong as you have redundant information across multiple tables which are related. </p>
<p>Table per concrete class is an inheritance model which gives problems at runtime as you can have the situation where one updates the address of Land but not of House while they're the same (semanti... |
Can I change the thickness of the border of a window with MFC? <p>Normally, the thickness of a window is 4 pixels, which can be retrieved by GetSystemMetrics method. Can I change its value, for example 2 pixels?</p>
<p>Thank you very much!</p>
| <p>Simple answer: No. Not for a specific window.</p>
<p>Complicated answer: The border is drawn as part of the "non-client" region of the window. This is all handled (under the hood) by the default processing (i.e. DefWindowProc), along with the caption, minimize, maximize buttons, etc. You can override this by handli... |
How can I make a button like 'Digg it' for my website? <p>I've got a blogging site hosted on Windows Sever, ASP.Net 3.5, ASP.Net AJAX, SQL Server in background.</p>
<p>I want to give bloggers a button like 'digg-it' which they can put on their blogs for the readers to click to thumb-up the post if they like it.</p>
<... | <p>You can look into using SCRIPT callbacks loading JSON data instead of using XmlHttpRequest to get around the crossdomain issues.</p>
<pre><code>function dynScript(url){
var script=document.createElement('script');
script.src=url;
script.type="text/javascript";
document.getElementsByTagName('head')[0... |
How to trace a NullPointerException in a chain of getters <p>If I get a NullPointerException in a call like this:</p>
<pre><code>someObject.getSomething().getSomethingElse().
getAnotherThing().getYetAnotherObject().getValue();
</code></pre>
<p>I get a rather useless exception text like:</p>
<pre><code>Exception ... | <p>The answer depends on how you view (the contract of) your getters. If they may return <code>null</code> you should really check the return value each time. If the getter should not return <code>null</code>, the getter should contain a check and throw an exception (<code>IllegalStateException</code>?) instead of re... |
"#include" a text file in a C program as a char[] <p>Is there a way to include an entire text file as a string in a C program at compile-time?</p>
<p>something like:</p>
<ul>
<li><p>file.txt:</p>
<pre><code>This is
a little
text file
</code></pre></li>
<li><p>main.c:</p>
<pre><code>#include <stdio.h>
int main... | <p>I'd suggest using (unix util)<a href="http://www.manpagez.com/man/1/xxd/">xxd</a> for this.
you can use it like so</p>
<pre><code>$ echo hello world > a
$ xxd -i a
</code></pre>
<p>outputs:</p>
<pre><code>unsigned char a[] = {
0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x77, 0x6f, 0x72, 0x6c, 0x64, 0x0a
};
unsigned... |
What is involved in open sourcing proprietary software? <p>My primary motivation for asking this question is <a href="http://stackoverflow.uservoice.com/pages/general/suggestions/29462-make-your-software-open-source" rel="nofollow">this uservoice suggestion</a>. Jeff declined the ticket to make the SO software open so... | <p>Usually it requires all contributors to agree, for some projects that means you have to ask quite a few people if its ok to open their code too.</p>
<p>For other projects, it requires the libraries you've used to be either open source, or taken out of the project where you've used them. IIRC Sun said they couldn't ... |
How do I select individual words of a camelized word in IntelliJ IDEA <p>What is the shortcut in IntelliJ IDEA to move across or select individual words of a camelized word? Lets say I have aLongMultiWordVariableName, I want to be able to move the cursor to each word for editing or select parts of the variable.</p>
<p... | <p>IDEA has the same keystrokes as Eclipse for camel-case words, but you have to have the CamelHumps option turned on (it's in Settings -> Editor -> General -> Smart Keys -> Use "CamelHumps" words )</p>
|
Do you usually set the default value before or set it in the else? <p>Which one of the following do you do:</p>
<pre><code>var = true;
if (...) var = false;
</code></pre>
<p>Or</p>
<pre><code>if (...) var = false;
else var = true;
</code></pre>
<p>Is there a reason you pick on or the other?</p>
<p>I'm working on t... | <p>how about var = { ...} directly since it's boolean ?</p>
|
Subversion Repository on Linux Dev <p>What's the best practice for setting up a subversion repository on a linux development machine. External users need to be able to access a specific repository, but nothing else on the machine. I know one answer is to set up a dedicated repository, but I'm looking for a single mac... | <p>One of the popular access methods to Subversion is via Apache module. You can set put different rights at the directory level to control access. See <a href="http://svnbook.red-bean.com/en/1.5/svn.serverconfig.choosing.html" rel="nofollow">Choosing a Server Configuration</a> and <a href="http://svnbook.red-bean.com/... |
Use HTTP Keep-Alive for server to communicate to client <p>Recently in an interview I was asked how I would approach an online chat client application. I went through the standard "polling" solution but was cut off because the interviewer was looking for the "HTTP 1.1 keep-alive" method. Having used HTTP for quite a ... | <p>Keep-alive simply holds a TCP socket open, so each time you poll, you save the overhead of the TCP setup/teardown packets--but you still have to poll.</p>
<p>However, "long polling" is a strategy for the web server to broadcast notifications to the client. Essentially, the client issues a GET request, but instead o... |
Understanding IEquatable <p>If i want to compare objects and they implement the IEquatable<> interface, i have a few questions:</p>
<ol>
<li>Why do i have to override Equals(object ) if i have to implements Equals<></li>
<li>can i use == and != once i implement IEquatable ?</li>
</ol>
| <p>Regarding #1:</p>
<p>From <a href="http://msdn.microsoft.com/en-us/library/ms131187.aspx">MSDN:</a></p>
<blockquote>
<p>If you implement <code>IEquatable<T></code>, you should also override the
base class implementations of
<code>Object::Equals(Object)</code> and
<code>GetHashCode()</code> so that th... |
How to create a series of dates in Cocoa for a week <p>I am current writing an application and need to show the current days of the week.</p>
<p>So, for the coming week I need to generate the follow dates.</p>
<p>Monday, 5 January 2009
Tuesday, 6 January 2009
Wednesday, 7 January 2009
Thursday, 8 January 2009
Friday,... | <p>Look at <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSCalendar_Class/Reference/NSCalendar.html" rel="nofollow">NSCalendar</a> and <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSDateComponents_Class/Reference/Reference.html" rel="nofollo... |
Why does FogBugz require that the DEP is turned off? <p>I am really wondering why FogBugz when installed locally insists that <a href="http://support.microsoft.com/default.aspx/kb/875352" rel="nofollow">DEP</a> is turned off? </p>
| <p>FogBugz 6 (and earlier) requires that Data Execution Prevention (DEP) be disabled on versions of Windows that have DEP, <strong>because of a third-party COM component</strong> that we use for parsing email. We will fix this in the next major release of FogBugz: FogBugz will no longer use this third-party component (... |
Enterprise Library Unity vs Other IoC Containers <p>What's pros and cons of using Enterprise Library Unity vs other IoC containers (Windsor, Spring.Net, Autofac ..)?</p>
| <p>I am preparing a presentation for a usergroup. As such I just went through a bunch of them. Namely: AutoFac, MEF, Ninject, Spring.Net, StructureMap, Unity, and Windsor.</p>
<p>I wanted to show off the 90% case (constructor injection, which is mainly what people use an IOC for anyway).
<a href="https://cid-b0ed6c07... |
How can I parse dates and convert time zones in Perl? <p>I've used the <a href="http://perldoc.perl.org/functions/localtime.html">localtime</a> function in Perl to get the current date and time but need to parse in existing dates. I have a GMT date in the following format: "20090103 12:00" I'd like to parse it into a d... | <p>Because the Perl built in date handling interfaces are kind of clunky and you wind up passing around a half dozen variables, the better way is to use either <a href="http://search.cpan.org/perldoc?DateTime">DateTime</a> or <a href="http://search.cpan.org/perldoc?Time::Piece">Time::Piece</a>. DateTime is the all-sin... |
How do I retrieve a Django model class dynamically? <p>Without having the full module path of a Django model, is it possible to do something like:</p>
<pre><code>model = 'User' [in Django namespace]
model.objects.all()
</code></pre>
<p>...as opposed to:</p>
<pre><code>User.objects.all().
</code></pre>
<p>EDIT: I am... | <p>I think you're looking for this:</p>
<pre><code>from django.db.models.loading import get_model
model = get_model('app_name', 'model_name')
</code></pre>
<p>There are other methods, of course, but this is the way I'd handle it if you don't know what models file you need to import into your namespace. (Note there's... |
Possible to call Oracle FUNCTION from .Net using Enterprise Library? <p>I have the following Oracle function:</p>
<pre><code>function get_job_no return number is
V_job_no number;
begin
select appwork.tlm_corphier_job.nextval into V_job_no from dual;
return V_job_no;
end get_job_no... | <p>Ok, this seems to work:</p>
<pre><code>Public Function GetNextJobNumber() As Object
Dim db As Database = DatabaseFactory.CreateDatabase()
Using cmd As DbCommand = db.GetStoredProcCommand("CORPHIER_PKG.get_job_no")
db.AddParameter(cmd, "retval", DbType.Int32, 0, ParameterDirection.ReturnValue, True, ... |
RewriteRule but keep the subdomain <p>I would like to redirect the following as an example:</p>
<pre><code>A.olddomain.com.au/blah.html > A.newdomain.com/blah.html
B.olddomain.com.au/blah.html > B.newdomain.com/blah.html
</code></pre>
<p>Essentially, I have a variable number of subdomains and I only want to... | <p>This should work for the HTTP case</p>
<pre><code>RewriteCond %{HTTP_HOST} (.*)\.olddomain\.com\.au
RewriteRule (.*) http://%1.newdomain.com/$1
</code></pre>
<p>If you use both HTTP and HTTPS you'd have to use two set of rules, one for HTTP and the other for HTTPS</p>
<pre><code>RewriteCond %{HTTPS} on
RewriteCon... |
How do I skip items when tabbing without using tabindex? <p>Is there a good way, in a javascript onfocus() handler, to trampoline the focus to the next item in the tab order, without having to manually enter the ID of the item that should be next?</p>
<p>I built an HTML date picker in Django/jQuery. It's a line edit ... | <p>Set tabindex = "-1" for that control and browser will skip that control from tabbing.</p>
|
TDD - How much do you test? <p>I'm working on a new project and I'm using the repository pattern, I have my repository that pulls the data from the database and a "service" class which uses the repository and does all the business logic.</p>
<p>something similar to the following;</p>
<pre><code>public class UserRepos... | <p>You should test them both, because it's possible that someday there will be other clients of UserRepository than UserService, and those clients may use UserRepository differently than UserService.</p>
|
FormsAuthentication.SignOut() does not log the user out <p>Smashed my head against this a bit too long. How do I prevent a user from browsing a site's pages after they have been logged out using FormsAuthentication.SignOut? I would expect this to do it:</p>
<pre><code>FormsAuthentication.SignOut();
Session.Abandon();
... | <p>Users can still browse your website because cookies are not cleared when you call <code>FormsAuthentication.SignOut()</code> and they are authenticated on every new request. In MS documentation is says that cookie will be cleared but they don't, bug?
Its exactly the same with <code>Session.Abandon()</code>, cookie i... |
Combine paths in Java <p>Is there a Java equivalent for <a href="http://msdn.microsoft.com/en-us/library/system.io.path.combine.aspx"><code>System.IO.Path.Combine()</code></a> in C#/.NET? Or any code to accomplish this?</p>
<p>This static method combines one or more strings into a path.</p>
| <p>Rather than keeping everything string-based, you should use a class which is designed to represent a file system path.</p>
<p>If you're using Java 7 or Java 8, you should strongly consider using <a href="http://docs.oracle.com/javase/8/docs/api/java/nio/file/Path.html"><code>java.nio.file.Path</code></a>; <code>Pat... |
Problem compiling gnustep-gui-0.16.0 undefined reference to png_sizeof <p>I'm trying to compile GNUstep on a linux box but gnustep-gui-0.16.0 package is failing. I downloaded GNUstep Startup stable 0.20.1 (<a href="http://wwwmain.gnustep.org/resources/downloads.php" rel="nofollow">http://wwwmain.gnustep.org/resources/d... | <p>Note that you can run <code>make messages=yes</code> to let GNUstep-make be more verbose about what it is doing.</p>
|
Best practices/algorithm/approach for implementing temporary transaction password for banking/financial website <p>What are the best practices for implementing temporary transaction password feature for website?</p>
<p>For e.g in banking/finance scenarios like
- While transfering funds from one account to another, a t... | <p><strong>Edit after updated question</strong>:</p>
<p>Well, one way would be to simply store it in the session variable, that would make it forcibly go away whenever the service is restarted.</p>
<p>Additionally you would need to have a timer on it, basically you store expiration time+password somewhere, and whenev... |
How to to send and retrieve data from flickr flickr.test.echo method using JQuery Ajax REST? <p>I want to display whatever the response of flickr.test.echo was on the page using rest (jquery ajax - because thats what im using)</p>
<p>I need to supply an api_key</p>
<hr>
<p>The REST Endpoint URL is <a href="http://ap... | <p>I'm not sure how you're going to retrieve their data with Ajax, since Ajax doesn't work cross-domain.</p>
<p>Have you seen their $.getJSON demo?
<a href="http://docs.jquery.com/Ajax/jQuery.getJSON" rel="nofollow">http://docs.jquery.com/Ajax/jQuery.getJSON</a></p>
<p>It lets you specify a callback and returns json ... |
Image Uploading in ASP.NET with C# <p>I created 2 pages: page1.aspx and page2.aspx. I defined 5 fileuploader controls in page 2 but I want to save Page1.aspx on save button.</p>
<p>Actually, the page contains a Back Button in which I store all Uploading file in a string object and it populate on Page1.aspx as a sessio... | <p>Here are some links which can help you out with this:</p>
<p>1) <a href="http://www.codeproject.com/KB/aspnet/multiuploads.aspx" rel="nofollow">http://www.codeproject.com/KB/aspnet/multiuploads.aspx</a></p>
<p>2) <a href="http://www.dotnetcurry.com/ShowArticle.aspx?ID=68&AspxAutoDetectCookieSupport=1" rel="nof... |
SQL Delete (Suspended in activity monitor) <p>I have a table containing hundreds of entries and I am trying to delete a small range. It is taking a long time, in fact it is not being executed.</p>
<p>I monitored the query from the activity monitor and its status is "Suspended"</p>
<p>Is there anyone knows what may ca... | <p>What's the SQL you're running? Any triggers on the table, or any cascaded deletes to tables that have triggers on? Anything in the "Blocked By" column or Wait Type?</p>
<p>Try executing the following in management studio (on the database in question):</p>
<pre><code>dbcc checkdb
dbcc checkcatalog
</code></pre>
|
ORM and SOA in the .NET world <p>From my experience the major ORM frameworks for .NET (<a href="http://nhforge.org" rel="nofollow">NHibernate</a>, <a href="http://msdn.microsoft.com/en-us/library/bb425822.aspx" rel="nofollow">LinqToSql</a>, <a href="http://msdn.microsoft.com/en-us/library/aa697427%28VS.80%29.aspx" rel=... | <p><a href="http://www.llblgen.com" rel="nofollow">LLBLGen Pro</a> has change tracking inside the entities. This means that you can fetch a graph from the database using prefetch paths (so one query per graph node) and serialize it over the wire to the client, change it there, send it back and directly save the graph a... |
IE prompts for password when saving an excel file <p>File is sent to the client using Response.writefile and content diposition as inline. When user chooses to Save As, they are asked to authenticate with IIS again even though Anonymous access in enabled</p>
| <p>At a guess, I'd suggest looking at the ownership of the Excel file. Presumably it would need to be readable and writable by the IUSR.</p>
|
Testing tools for Django Project <p>Can anyone please suggest some good testing tools for a Django project? </p>
<p>I need to test the different use case scenarios, unit-testing, as well as load-testing for my project. Are there any good standard testing suites available?<br>
Any other suggestion(s) for the testing pr... | <p>This article about <a href="http://docs.djangoproject.com/en/dev/topics/testing/">Django Testing</a> should be a good starting point.</p>
|
NHibernate.Search with Lucene.NET without using DB? <p>Could I use NHibernate.Search only with luceneâs index without database? Because I would like to store all data only in my luceneâs index, but I really like features in NHibernate.Search.</p>
| <p>Not really, as they are tightly coupled. The point of the NHSearch/Lucene.NET/NHibernate integration is that you can do a full text search, but the results returned are domain entities, i.e. from the database.</p>
<p>So, without storing them in the database, there would be no way for NHSearch to inflate the domain ... |
Best way to work with an array of pointers in Objective-C? <p>I'm trying to mimic the following Java code:</p>
<pre><code>int[][] multi; // DIMENSIONS ARE UNKNOWN AT CREATION TIME
// LATER ON...
multi = new int[10][];
multi[5] = new int[20];
multi[5][11] = 66;
// LATER ON...
multi = null; // PROPER WAY OF FREEING EVER... | <p>Free doesn't zero out the memory address in the pointer, it just invalidates it. So, if you're running this loop more than once, you will get exceptions when you try to free memory that has already been invalidated. You can use an NSPointerArray or wrap your integers in objects and use an NSMutableArray for your pur... |
Excel VBA: Is there any way to format chart axes through VBA only? <p>I have to make column charts in Excel using VBA only (no user input). I wanted to format the labels of the x-axis so that the alignment for every label becomes -270 degrees. (This can be done manually by changing the "Custom angle" property in the "A... | <p>If you are using Excel 2007, try using an earlier version because 2007's macro recorder is a bit crippled.</p>
<p>This is what I got:</p>
<pre><code>ActiveSheet.ChartObjects("Chart 1").Activate
ActiveChart.Axes(xlCategory).Select
Selection.TickLabels.Orientation = xlUpward
</code></pre>
|
Registering object _instances_ instead of _types_ with .NET remoting? <p>There's something I'm just not getting about .NET remoting. Well, two things actually:</p>
<ol>
<li><p>Why is the emphasis back on classes that inherit from MarshalByRef instead of interfaces ala the original COM style (which I liked)?</p></li>
<... | <p>The problem with Nickd's answer: I wanted to know how to associate an already created instance with a URL, rather than how to get .NET remoting to do this for me (some instance that I have created that does not have a default constructor, for example).</p>
<p>I was hoping there'd be some epic response explaining th... |
Start program on usb hardware plugin <p>Is there a way to detect when a specific device is plugged into a usb port, what I would like to happen is when I plug my laptop into my docking station it run up several apps to account for my different keyboard, mouse and monitors. Specifically I have an issue with some softwar... | <p>Try using <a href="http://www.icsharpcode.net/OpenSource/SharpUSBLib/default.aspx" rel="nofollow">SharpUSBLib</a>. It's a C# wrapper around the libusb project.</p>
<p>I'm pasting a code sample below (included in the download - just tried it myself). It seems simple enough and I think it will provide you with quite ... |
Excel VBA: Which OLE/OCX control to use to display a chart in a form? <p>I have to display a column chart in a user form in VBA. Exporting the chart to GIF and importing in a picture box works; but I cannot use it because the chart needs to be modified based on options chosen by the user from the same form. I have been... | <p>Just use Microsoft Chart, it's the same engine as Microsoft Excel.</p>
<p>Assuming you're using Excel 2003 ... the control is called "Microsoft Office Chart 11.0"</p>
<p>If you have Excel 2007, Microsoft did not ship the chart control. But you can still <a href="http://www.microsoft.com/downloads/details.aspx?Fami... |
Configuration of BIND DNS server, I'm lost <p>I hope you'll forgive me for thinking that configuring a DNS server would be easy. It turns out it is quite hard... especially if you never did it before.</p>
<p>To recap a little, I previously asked if someone could recommend a personal DNS server for Windows XP for use i... | <p>A zone file like this should suffice (on my system this would be in /etc/bind/zones/devdomain2.dev.hosts)</p>
<pre><code>devdomain2.dev. IN SOA localhost. johannesh.devdomain2.dev. (
1102522753
10800
3600
604800
38400
)
devdomain2.dev. IN NS localhost.
*.devdomai... |
Sharepoint: Is there some OOB way to delete provision files? <p>I'm using OOB functionality to upload files to sharepoint. I'm using <code><module</code>> tags and feature which wraps all data. (it is described <a href="http://msdn.microsoft.com/en-us/library/ms441170.aspx" rel="nofollow">here</a>)</p>
<p>Here is e... | <p>I believe the way you are doing it is the only way.</p>
|
C#: How to remove namespace information from XML elements <p>How can I remove the "xmlns:..." namespace information from each XML element in C#?</p>
| <p>Zombiesheep's cautionary answer notwithstanding, my solution is to wash the xml with an xslt transform to do this.</p>
<p><strong>wash.xsl:</strong></p>
<pre><code><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="no" encoding="UTF-8"/>
... |
How do i auto-populate fields in django? <p>I have a model Question with a field called <strong>userid</strong>, before one ask a question, one needs to login, i want when saving to capture the user ID of the currently logged-in user and assign it to the userid of the Question model.</p>
<p>Please note am not showing ... | <p>Your code may look like this:</p>
<pre><code>from django.contrib.auth.decorators import login_required
class QuestionForm(forms.ModelForm):
class Meta:
model = Question
@login_required
def ask(request):
form = QuestionForm(request.POST)
if form.is_valid():
question = form.save(False)... |
Which is the maximum number of Windows concurrent tcp/ip connections? <p>In .NET I have already tried the configuration below successfully:</p>
<pre><code> <system.net>
<connectionManagement>
<add address="*" maxconnection="100"/>
</connectionManagement>
</system.net>
</c... | <p>The client versions of Windows are restricted in the number of half-open connections. The 10 limit for XP is well known, Vista has other limits depending on the version (e.g. Home Basic has a limit of 2, Ultimate has 25). You can Google "Patch for Event ID 4226" to alleviate these limits. Post Vista SP2 the behavior... |
When I run the rake:db migrate command I get an error "Uninitialized constant CreateArticles" <p>I created a model ruby script/generate model Article (simple enuff)</p>
<p>Here is the migration file create_articles.rb:</p>
<pre><code>def self.up
create_table :articles do |t|
t.column :user_id, :integer
t.co... | <p>Be sure that your file name and class name say the same thing(except the class name is camel cased).The contents of your migration file should look something like this, simplified them a bit too:</p>
<pre><code>#20090106022023_create_articles.rb
class CreateArticles < ActiveRecord::Migration
def self.up
... |
moodle file.php returns a blank 0 bytes file <p>For some reason one installation of Moodle 1.9.3+ has a problem that file.php returns a blank 0 byte file sometimes, even the apache log shows 0 bytes were returned. Another moodle installation works OK with the same htm files.</p>
<p>What could be causing this? Probl... | <p>A completely blank response may indicate a PHP error; check the PHP error log.</p>
|
Visual Studio web user control events only show up in design mode? <p>Calling all Visual Studio gurus â when I'm working on a .ascx or .aspx file in a c# web project, the <strong>events</strong> do not show up in the properties panel unless I switch into the design view from the code view. Is this an intentional func... | <p>I don't know if that's the way VS is 'intended to work, but yes that's a limitation. In case you've noticed sometimes clicking on the control and pressing F4 (or clicking on the properties tab) fails to load the properties for the correct control, and then you gotta select it from the list.</p>
<p><em>Sigh</em></p>... |
Fastest way to "jump back" to a file in TextMate? <p>Often, when I am reading code or debugging, I want the ability to quickly jump around files. I especially want to "go back" to where I was. I know about "Command+T", "Command+Shift+T", and, bookmarks. But, I cannot figure out a way to jump around files quickly.</... | <p>It's subtle.</p>
<p>The command-T thing has the files listed in Most Recently Used order.
So, you can go command-T return to get back to your last file real quick. At first I couldn't find it either.</p>
<p>I don't think there's a go to last edit location as there is in, say, IDEA/RubyMine.</p>
|
What is the point of www in web urls? <p>I've been trying to collect analytics for my website and realized that Google analytics was not setup to capture data for visitors to www.example.com (it was only setup for example.com). I noticed that many sites will redirect me to www.example.com when I type only example.com. ... | <p>History lesson.</p>
<p>There was a time when the Web did not dominate the Internet. An organisation with a domain (e.g. my university, aston.ac.uk) would typically have several hostnames set up for various services: gopher.aston.ac.uk, news.aston.ac.uk, ftp.aston.ac.uk. They were just the obvious names for accessin... |
What is the right way to initialize a non-empty static collection in C# 2.0? <p>I want to initialize a static collection within my C# class - something like this:</p>
<pre><code>public class Foo {
private static readonly ICollection<string> g_collection = ???
}
</code></pre>
<p>I'm not sure of the right way t... | <p>If I fully understand your question, it seems some others have missed the point, you're looking to create a static collection in a similar manner to Java in that you can declare and populate in a single line of code without having to create a dedicated method to do this (as per some of the other suggestions). This ... |
Optimising if statements by reordering <p>I remember reading once that the order of the members of an evaluation is important.
Such as</p>
<pre><code>if (null == myClass)
</code></pre>
<p>is better (faster?) then</p>
<pre><code>if (myClass == null)
</code></pre>
<p>is this the case?
If so could someone explain how ... | <p>No, it is not faster. This is a relic from the old C days, it avoided doing bugs like</p>
<pre><code>if(myClass = null) /* accident, sets myClass to null instead of comparing */
</code></pre>
<p>so you would always have the constant at the left:</p>
<pre><code>if(null = myClass) /* throws an error at compile time... |
Visual Studio on a Mac <p>My job is currently based on Visual Studio (ASP.NET).<br/>
Looking for experiences using Visual Studio on a Mac.<br/>
Does it work?</p>
| <p>In a word, <strong>yes</strong>.</p>
<p>I use a Mac Mini 1.67 GHz machine with 2GB of RAM. That's not an impressive box, but performance under WinXP is excellent. I have used VS2005, VS2008, MySQL Server, Sql Server Express, and dozens of little utilities.</p>
<p>The only issues I've ever had were when I used a ... |
How to programmatically select an item in a WPF TreeView? <p>How is it possible to programmatically select an item in a WPF <code>TreeView</code>? The <code>ItemsControl</code> model seems to prevent it.</p>
| <p>For those who are still looking for the right solution to this problem here is the one below. I found this one in the comments to the Code Project article âWPF TreeView Selectionâ <a href="http://www.codeproject.com/KB/WPF/TreeView_SelectionWPF.aspx" rel="nofollow">http://www.codeproject.com/KB/WPF/TreeView_Sele... |
Ribbon UI Control for WinForms <p>Is there a Ribbon UI Control available in VS 2008? Will it be available if i have office 2007 installed on the development and deployment machines?</p>
<p><br />
EDIT: I would imagine that Microsoft would include the Ribbon UI control in VS 2008 as this is the way the UI of office is... | <p>Yes - it was included as part of the Visual Studio 2008 Service Pack 1 - at least for C++/MFC support anyhow.</p>
<p>See this <a href="http://stackoverflow.com/questions/33909/ribbon-toolbar-and-visual-studio-2008-service-pack-1">similar question</a> for more info.</p>
|
How to compose `not` with a function of arbitrary arity? <p>When I have some function of type like</p>
<pre><code>f :: (Ord a) => a -> a -> Bool
f a b = a > b
</code></pre>
<p>I should like make function which wrap this function with not.</p>
<p>e.g. make function like this</p>
<pre><code>g :: (Ord a) =... | <p>Unless you want to go hacking around with typeclasses, which is better left for thought experiments and proof of concept, you just don't generalize to multiple arguments. Don't try.</p>
<p>As for your main question, this is most elegantly solved with Conal Elliott's <em>semantic editor combinators</em>. A semanti... |
How can I prevent/detect an underflow in a Postgresql calculation that uses EXP() <p>I am receiving a value out of range: underflow error from pgsql, in a query that uses the EXP(x) function. What values of x trigger this? How do I prevent or detect it?</p>
| <p>The function exp is called the exponential function, and its inverse is the natural logarithm, or logarithm to base e. The number e is also commonly defined as the base of the natural logarithm</p>
<p>In other words, exp(x) and e^x are the same function. However, since e is a transcendental number, and therefore i... |
Is there a good Java networking library? <p>I'm currently searching for a Java networking library. What I want to do is sending XML, JSON or other serialized messages from a client to another client and/or client to server.</p>
<p>My first attempt was to create an POJO for each message, plus a MessageWriter for sendin... | <p>You have several options depending on how abstracted from raw sockets you want to get. Once you depart from socket level programming, you're pretty much into <em>remoting</em> territory,</p>
<ul>
<li>Standard Remoting Options for Java: RMI or JMS</li>
<li>Implement JMX Mbeans in each client and the servers and use ... |
How should I import highly formatted data from Excel to a database? <p>What is the best way to import highly formatted data from Excel to SQL server.
Basically I have 250+ Excel files that have been exported from a reporting tool in a format that our business users would prefer. This is a 3rd party tool that can not ex... | <p>you could write a simple parser application. there are many api that will handle reading excel files.</p>
<p>I have written one in java and it only took a day or two.</p>
<p><a href="http://jexcelapi.sourceforge.net/" rel="nofollow">here</a> is one api.</p>
<p>Good Luck</p>
<p>EDIT: Forgot to mention we will al... |
Able Commerce POS Data Merge <p>We are building an AbleCommerce 7 web store and trying to integrate it with an existing point-of-sale system. The product inventory will be shared between a phyical store and a web store so we will need to periodically update quantity on hand for each product to keep the POS and the web... | <p>I've done this with POS software. It wasn't AbleCommerce, but retail sales and POS software is generic enough (no vendor wants to tell prospects that "you need to operate differently") that it might work.</p>
<p>Sales -> Inventory </p>
<p>Figure out how to tap into the Data Port for near-real-time sales info. I f... |
Are Apache Ant Javadocs Included in the Eclipse Plugin? <p>I was trying to add Ant libraries to a project in eclipse, and I used the ones that were part of eclipse's plugins folder. When I tried to associate them with Javadocs, I couldn't locate them in the plugin folder. I searched for them online, and I found <a href... | <p>The ant javadocs may or may not be included with eclipse, depending on which version you have. <strong>Edit: Anyway, it's better not to depend on the version bundled with the IDE.</strong> Otherwise everyone who works on the project will have to use the same version of the IDE, and eclipse automatic updates can br... |
exchange powershell : parsing an array boolean value <p>In my output, I get</p>
<p>@{ActiveSyncEnabled=False}</p>
<p>how do I parse this so that it just says "False"?</p>
<p>the output is coming from this line of code: </p>
<pre><code> $pda = get-casmailbox -Anr $user.displayname | select activesyncenabled
</code><... | <p>To access the value directly:</p>
<p>(get-casmailbox -Anr $user.displayname).activesyncenabled </p>
<p>You can skip anr and use the identity member:</p>
<p>Get-CASMailbox $user.Identity</p>
<p>To get all activesyncenabled enabled mailboxes:</p>
<p>get-casmailbox -resultSize unlimited -filter {activesyncenabled ... |
python "'NoneType' object has no attribute 'encode'" <p>I wrote this tiny Python snippet that scrapes a feed and prints it out. When I run the code, something in the feed triggers the error message you see here as my question. Here's the complete console output on error:</p>
<pre><code>> Traceback (most recent call... | <blockquote>
<pre><code>> sys.stdout.write(entry["title"]).encode('utf-8')
</code></pre>
</blockquote>
<p>This is the culprit. You probably mean:</p>
<pre><code>sys.stdout.write(entry["title"].encode('utf-8'))
</code></pre>
<p>(Notice the position of the last closing bracket.)</p>
|
LINQ sorting anonymous types? <p>How do I do sorting when generating anonymous types in linq to sql?</p>
<p>Ex:</p>
<pre><code>from e in linq0
order by User descending /* ??? */
select new
{
Id = e.Id,
CommentText = e.CommentText,
UserId = e.UserId,
User = (e.User.FirstName + " " + e.User.LastName).Trim()... | <p>If you're using LINQ to Objects, I'd do this:</p>
<pre><code>var query = from e in linq0
select new
{
Id = e.Id,
CommentText = e.CommentText,
UserId = e.UserId,
User = (e.User.FirstName + " " + e.User.LastName).Trim()),
... |
WPF DataGrid Sync Column Widths <p>I've got two WPF Toolkit <code>DataGrids</code>, I'd like so that when the user resizes the first column in the first grid, it resizes the first column in the second grid. I've tried binding the width of the <code>DataGridColumn</code> in the second grid to the appropriate column in t... | <p>Well, I don't think that it is possible using straight XAML, but I still feel like it should because <code>DataGridColumn</code> does derive from <code>DependencyObject</code>. I did find a way to do it programatically though. I'm not thrilled about it, but it works:</p>
<pre><code>DataGridColumn.WidthProperty.AddV... |
Rails: Creating an HTML Snippet with a Variable? <p>I have a submit button that is a block of HTML code because of styling and images to make it look better. (I stole most of it from Wufoo).</p>
<p>This is one every form in the application and I was wondering if there is a cleaner way to do this. Something like a part... | <p>consider partials (<a href="http://api.rubyonrails.org/classes/ActionView/Partials.html" rel="nofollow">http://api.rubyonrails.org/classes/ActionView/Partials.html</a>)</p>
|
How do you set up solution configuration specific config files? <p>I have a web service that needs different settings for different environments (debug, test, prod). What's the easiest way to setup separate config files for these different environments? Everything I find on the web tells me how to use configuration man... | <p>I find having several config files for each environment works well. ie:</p>
<ul>
<li>config\local.endpoints.xml</li>
<li>config\ dev.endpoints.xml</li>
<li>config\ test.endpoints.xml</li>
<li>config\ staging.endpoints.xml</li>
<li>config\ prod.endpoints.xml</li>
</ul>
<p>I then link to a "master" version of this u... |
Javascript HAML editor <p>Does anyone know of a Javascript based <a href="http://haml.hamptoncatlin.com/" rel="nofollow">HAML</a> editor out there? I'm looking for for something like <a href="http://tinymce.moxiecode.com/" rel="nofollow">TinyMCE</a> that just understands HAML (so it does indenting and highlighting corr... | <p>HAML was designed as a more elegant way to define page structure; It was not intended to be used for formatting text, like what you're asking it to do.</p>
<p>In this case, you're probably better off using something like <a href="http://daringfireball.net/projects/markdown/" rel="nofollow">Markdown</a> or <a href="... |
How to Test Standard HTML Forms <p>What tools are best for lightweight testing of HTML forms? My particular use is <strong>very light:</strong> no multithreading issues nor elaborate test scripts: just fill in a form with particular values and let <strong>me</strong> click submit.</p>
<p>A Firefox plugin would be fine... | <p>Have you looked at <a href="http://seleniumhq.org/">Selenium IDE</a> or does this not fit the light weightness?</p>
<p>It is a Firefox plugin and although it does use scripts, it can record and playback with little effort.</p>
|
Why am I suddenly getting Missing Template errors with edge Rails (2.3)? <p>After freezing edge rails, all my controller examples are failing with
MissingTemplate errors.
e.g., "Missing template attachments/create.erb in view path app/views"</p>
<p>Trying to actually render the views gives me the same error.</p>
<p>I... | <p>Just found this, which answers my question:</p>
<p><a href="http://rails.lighthouseapp.com/projects/8994/tickets/1590-xhrs-require-explicit-respond_to" rel="nofollow">http://rails.lighthouseapp.com/projects/8994/tickets/1590-xhrs-require-explicit-respond_to</a></p>
|
Change Tracking Structure <p>We are looking to implement Optimistic locking in our WCF/WPF application. So far the best way I've come up with doing this is to implement a generic Optimistic which will store a copy of the original and any changes (so it will store two copies: the original and modified) of any value obje... | <p>If you are using SQL server you can use a timestamp column. The timestamp column is changed anytime a row is modified. Essentially when your updating the DB you can check if the timestamp column is the same as when the client first got the data, if so no one has modified the data. </p>
<h1>Edit</h1>
<p>If you want... |
Best method of Instantiating an XMLHttpRequest object <p>What is the best method for creating an <a href="http://en.wikipedia.org/wiki/XMLHttpRequest">XMLHttpRequest</a> object?</p>
<p>It should work in all capable browsers.</p>
| <p>For a library-less solution, you can emulate Prototype's use of <code>Try.these</code> fairly easily:</p>
<pre><code>function newAjax() {
try { return new XMLHttpRequest(); } catch(){}
try { return new ActiveXObject('Msxml2.XMLHTTP.6.0'); } catch(){}
try { return new ActiveXObject('Ms... |
ExtJS: AJAX Links in Grid in Tab in Window <p>I am working on my first project using ExtJS.</p>
<p>I have a Data Grid sitting inside a Tab that is inside a Window.</p>
<p>I want to add a link or button to the each element of the grid (I am using extended elements at the moment with HTML content through the RowExpande... | <p>If you are looking to add the link to the grid itself, you can specify another column in your ColumnModel and apply a renderer to the column. The function of the renderer is to return formatted content to be applied to that cell, which can be tailored according to the value of the dataIndex of the column (you should... |
Generate XML documentation for private members <p>Is there a way to generate XML documentation for private members? Be default it only generates it for public members, which is correct for published code but not for code only used within a company.</p>
| <p>Try using <a href="http://www.roland-weigelt.de/ghostdoc/" rel="nofollow">GhostDoc</a>.</p>
|
.NET Class Refactoring Dilemma <p>So I'm refactoring a legacy codebase I've inherited, and in the process I found a static class that encapsulates the logic for launching 3rd party applications. It essentially looks like this (shortened for brevity to only show one application):</p>
<pre><code>using System.IO;
using S... | <p>Here is another way of refactoring this:</p>
<pre><code>using System.IO;
public class ExternalApplication
{
public ExternalApplication(string path)
{
this.Path = path;
}
public string Path { get; protected set; }
public bool Exists()
{
if(string.IsNullOrEmpty(this.Path))
th... |
How do you find out what users really want? <p>I've read somewhere (I forget the source, sorry - I think the MS Office developer's blog?), that when you do a survey of users asking them about what features they would like to see in your software/website, they will more often than not say that they want every little thi... | <p>Contrary to popular belief, you <em>don't</em> ask them. Well, you don't listen to them when they <em>tell</em> you what they want. You watch them while they use what they have right now. If they don't have anything, you listen to them enough to give them a prototype, then you watch them use that. How a person a... |
Flash security: problem loading Flash 8 AS2 modules into Flash 6 AS1 module <p>I have an old program written in Actionscript 1, compiled in Flash 6. It loads 10 other modules, of which 3 are written in Actionscript 2, compiled in Flash 8. The original program is embedded into an html and works perfectly when the html f... | <p>The rules of Flash's security model get kind of arcane, but it seems you're up against a cross-scripting restriction. One option might be to work around it, for example by installing Apache (or whatever) and accessing the content via <code>http://localhost...</code> rather than <code>file://...</code>. However, the ... |
How do I make Tomcat stop caching my servlet responses? <p>I'm learning Servlets programming, using Apache Tomcat 6 on a Ubuntu 8.10 machine, and I'm running with a very annoying issue -- apparently, related to caching.</p>
<p>This is what I'm doing: I write a servlet, put it in a nice directory structure and deploy i... | <p>The advice from Adeel Ansari is flawed: you should never modify CATALINA_HOME/conf/context.xml with webapp-specific configuration. That's what your-webapp/META-INF/context.xml is for.</p>
<p>You should also never specify the "docBase" attribute of <Context>.
You should also never specify the "path" attribute ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.