input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
In C# what is the recommended way of passing data between 2 threads? <p>I have my main GUI thread, and a second thread running inside it's own ApplicationContext (to keep it alive, even when there is no work to be done). I want to call a method on my 2nd thread from my GUI thread, but if I just call thread.Method(); it... | <p>Wow, I can't believe how may people didn't bother reading the question.</p>
<p>Anyways, this is what I do.</p>
<ol>
<li>Create you "message" classes. This stores all the information you want to share.</li>
<li>Create a Queue<T> for each thread. Use a SyncLock (C# lock) to read/write to it.</li>
<li>When you ... |
LINQ with FoxPro? <p>Is there a reasonable way to access FoxPro databases using LINQ?</p>
| <p>I just finished working on implementation.
<a href="http://linqtovfp.codeplex.com/">http://linqtovfp.codeplex.com/</a></p>
|
nHibernate slow performance on a hosted website <p>I have a webapp being hosted with a public hosting company, the site is not live yet, and I am still doing some testing with it. I am using nHibernate with Windsor Castle Container for dependency injection and the site seems to be responding very slow from time to time... | <p>You don't know how slow your application is when you don't measure it. I'm using a <a href="http://haacked.com/archive/2008/07/02/httpmodule-for-timing-requests.aspx" rel="nofollow">timing http module</a> during development to notice big performance issues fast.
When one of your pages loads slow, you should use a p... |
Question: VB.net coding standard regarding declaring variable <p>I've seen some variable declare in VB.net in several way like:</p>
<pre><code>print("dim _Foo as string");
</code></pre>
<p>and
print("dim m_Foo as string");
and
print("dim foo as string");</p>
<p>I will like to know what's the standard for VB... | <p>It all depends on the scope. In the case of:</p>
<pre><code>Private Dim m_Foo As String
</code></pre>
<p>That implies that m_Foo is a member of a class. This also implies the same thing:</p>
<pre><code>Private Dim _Foo As String
</code></pre>
<p>It's a matter of preference.</p>
<p>On the other hand, something... |
How do I restrict the number of records to be processed in an SSIS package? <p>I have a table with 7M records I want to trim down to 10k for dev. I tried a delete, but the whole world was nearly overpowered by the transaction log size, so I truncated the table.</p>
<p>Now I wish to insert 10k records from the origina... | <p>There's really no need to use SSIS to do this. You should be able to insert the records using SQL. First, you will need to set IDENTITY_INSERT to on. Then, you should be able to execute something like this:</p>
<p>SET IDENTITY_INSERT db.schema.dev_table ON</p>
<p>INSERT INTO dev_table SELECT TOP (10000) * FROM ... |
Showcasing Flex - Tour de Flex <p>I ran across <a href="http://flex.org/tour" rel="nofollow">Tour de Flex</a> a couple days ago. It's a demo that showcases all the Flex controls, with cross-references to source and references. It's a great way to get an idea of the resources available, and how to use them.</p>
<p>Not ... | <p>Q: When is a question not a question?</p>
<p><hr /></p>
<p>A: When it is rhetorical.</p>
<p>It think it would be best to make this question answerable rather than try to avoid taking credit. For instance, I would have asked something like:</p>
<blockquote>
<p>What are some good resources for understanding Fle... |
iPhone designmode support <p>Anyone knows if Safari on the iPhone and iPod touch supports iFrame in design mode and if so, how I can enable it? I have tried following ways, but none work (but it works on my PC):</p>
<pre><code>theIframe.contentWindow.document.body.contentEditable = true;
theIframe.contentWindow.docum... | <p>According to [1], contenteditable, at least, should work:</p>
<blockquote>
<p>contenteditable</p>
<p>If true, the element can be edited on the fly; if false, it cannot.></p>
<p>Availability</p>
<p>Available in Safari 1.2 and later. Available in iPhone OS 1.0 and later.</p>
</blockquote>
<p>.. but ... |
Parsing XML with REGEX in Java <p>Given the below XML snippet I need to get a list of name/value pairs for each child under DataElements. XPath or an XML parser cannot be used for reasons beyond my control so I am using regex.</p>
<pre><code><?xml version="1.0"?>
<StandardDataObject xmlns="myns">
<Dat... | <p>XML is not a regular language. You <b>cannot</b> parse it using a regular expression. An expression you think will work will break when you get nested tags, then when you fix that it will break on XML comments, then CDATA sections, then processor directives, then namespaces, ... It cannot work, use an XML parser.</p... |
Matching dashes in a URL regex <p>I have used the following regex to get the urls from text (e.g. <code>"this is text http://url.com/blabla possibly some more text"</code>).</p>
<pre><code>'@(https?://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?)@'
</code></pre>
<p>This works for all URLs but I just found out it doesn'... | <p>Short answer: <code>[\w/_\.]</code> doesn't match <code>-</code> so make it <code>[-\w/_\.]</code></p>
<p>Long answer:</p>
<pre><code>@ - delimiter
( - start of group
https?:// - http:// or https://
([-\w.]+)+ - capture 1 or more hyphens, word characters or dots, 1 or more times.... |
Porting VB.NET Winforms Application to C# <p>Are there any 'good' resources for porting a VB.NET winforms application to C#? I'm sure there are is software that just translates the code, but I'm looking to refactor the code at the same time. Keeping it in its current form is problematic, since it uses some of the 'ba... | <p>Based on my experience working with some large applications that mix VB and C# projects, I would recommend leaving it in VB.NET. If there are problems with the design, then fix them, but converting the whole thing to C# sounds like a messy, unnecessary distraction to me.</p>
<p>The non-stylistic differences between... |
ASP.NET Explicitly Post To Server From Checkbox Control OnCheckChanged Event <p>I have an asp:checkbox control, and I want to change the visibility of a Label when it is checked or unchecked. To do this I'm attempting to use the OnCheckChanged event, which apparently only fires after a post to the server. This means th... | <p>Well, do you need the checkbox control to post to the server when is clicked?</p>
<p>if the answer is no, then you could use an html input control and use javascript to handle the onclick event. This way the action would be immediate and you save a post back to the server.</p>
|
Using boost::shared_ptr in a library's public interface <p>We have a C++ library that we provide to several different clients. Recently we made the switch from using raw pointers in the public interface to using boost::sharedptr instead. This has provided an enormous benefit, as you might guess, in that now the clients... | <p>One possible solution is to ship boost::shared_ptr with your project. As it all consists of headers, this would free your clients from having to install the boost libraries manually. You can use <a href="http://www.boost.org/doc/libs/1_37_0/tools/bcp/bcp.html">bcp</a> to get all files needed by a particular boost li... |
What is a debug working set (Eclipse)? <p>I'm using Eclipse IDE and notice an option in the Debug perspective in the Breakpoints view that allows me to chose/create a working set. I've found all kinds of help online that tells me how to make a working set or choose a working set, but nothing that explains what a workin... | <p>A working set is a subset of other objects. You can create a breakpoint working set that contains only some of your breakpoints, or a project working set that contains only part of your project, and so on. You would use working sets to let you easily switch back and forth between different parts of a project or wo... |
ASP.NET sites, hiring external design firms and standards <p>Hey. We're building a large ASP.NET website, and have hired an external firm to do the design (CSS + protoype pages). In fitting the design to the page, we've found a number of problems that indicate ASP.NET's workings were never considered. My question is - ... | <p>Any time I've worked with design firms building asp.net pages I've always just had them design what it should look like. Nothing to do with the markup or css. This leaves a lot of work to be done by the developers, but avoids all the mistakes you just mentioned. I've always had designers deliver a PSD file and chopp... |
A question about datasource objects in ASP.net <p>When using DataSources in ASP.net applications, paging and sorting along with GridView only works out of the box when using DataSet, DataTable, DataViews if you are using anything else you need to implement methods that perform paging as well as partial data retrieval f... | <p>You may have already come across them, but I've found Scott Mitchell's <a href="http://www.asp.net/learn/data-access" rel="nofollow">data access tutorials</a> very helpful in the past. Tutorials #24-27 cover paging and sorting, and he uses the ObjectDataSource.</p>
|
Making Applications programmed in .NET languages work on older machines <p>Wondering if anyone knows how to see what parts of the .NET framework need to be installed to get cerftain functions working on older machines. Is there a way I can install them with my application without installing the entire .NET framework?<... | <p>You could use <a href="http://mono-project.com" rel="nofollow">Mono</a>, the open source implementation of the .NET framework. The Mono
installer is smaller than the .NET installer. Also, Mono works with Windows versions older than XP. </p>
<p>With Mono you can use the <a href="http://www.mono-project.com/Linker" ... |
Is .NET MVC must learn technology? <p>Is it here to stay, or is this something just pushed out quickly as a "me too" offering, in response to the Rails community?</p>
<p>Is it necessary to go through the learning curve, and will the Framework move to only working this way, without the Page behind model?</p>
<p>If so ... | <p>I personally prefer MVC, it's better structured and makes me a happy lad! I got to use MVC for a project at work, because it had to be finished quickly, and I believed that even though I knew no MVC, that I could learn it and finish the project quicker than I could do it using WebForms, and I was right! Learnt MVC a... |
How do you detect that monkey patching has occurred in Ruby? <p>How do you check that monkey patching has been done to a specific class in Ruby? If that is possible, is it also possible to get the previous implementation(s) of the attribute that's been patched?</p>
| <p>There are the hooks <code>method_added</code> and <code>method_undefined</code>. Garry Dolley has written an I<a href="http://scie.nti.st/2008/9/17/making-methods-immutable-in-ruby" rel="nofollow">mmutable module</a> that prevents monkey patching.</p>
|
What techniques are available for memory optimizing in 8051 assembly language? <p>I need to optimize code to get room for some new code. I do not have the space for all the changes. I can not use code bank switching (80c31 with 64k). </p>
| <p>You haven't really given a lot to go on here, but there are two main levels of optimizations you can consider:</p>
<p><strong>Micro-Optimizations:</strong>
eg. XOR A instead of MOV A,0
Adam has covered some of these nicely earlier.</p>
<p><strong>Macro-Optimizations:</strong>
Look at the structure of your pr... |
Collision Detection between two images in Java <p>I have two characters displayed in a game I am writing, the player and the enemy. defined as such:</p>
<pre><code>public void player(Graphics g) {
g.drawImage(plimg, x, y, this);
}
public void enemy(Graphics g) {
g.drawImage(enemy, 200, 200, this);
}
</code></... | <p>I think your problem is that you are not using good OO design for your player and enemies. Create two classes:</p>
<pre><code>public class Player
{
int X;
int Y;
int Width;
int Height;
// Getters and Setters
}
public class Enemy
{
int X;
int Y;
int Width;
int Height;
// Ge... |
Non-axis aligned scaling <p>Finding a good way to do this has stumped me for a while now: assume I have a selection box with a set of points in it. By dragging the corners you can scale the (distance between) points in the box. Now for an axis aligned box this is easy. Take a corner as an anchor point (subtract this co... | <p>Any box is contained inside a circle.<br />
You find the circle which binds the box, find its center and do exactly the same as you do with an axis aligned box.</p>
|
Create a Search Engine with SQL 2000 and ASP.NET C# <p>I am looking to create a search engine that will be based on 5 columns in a SQL 2000 DB. I have looked into Lucene.NET and read the documentation on it, but wondering if anyone has any previous experience with this?</p>
<p>Thanks</p>
| <p>IMHO it's not so much about performance, but about maintainability. In order to index your content using Lucene.NET you'll have to create some mechanism (service of triggered) which will add new rows (and remove deleted rows) from the Lucene index. </p>
<p>From a beginner's perspective I think it's probably easier ... |
What are the uses of svn copy? <p>Example: </p>
<pre><code>$ svn copy foo.txt bar.txt
A bar.txt
</code></pre>
<ul>
<li>When would you use this technique, and why? </li>
<li>Will this command (taken from svn's "red book") creates a copy of <code><foo.txt></code> while preserving the history of it to be sha... | <p>Aside from branching/tagging, you can also use it when you split a file in two. In this case both new files will have history and you'll be able to look at the code before the split.</p>
<p>BTW: that's one of few features that SVN has, but Git doesn't (Git will try to guess origin of code after the fact, especially... |
What is the relative difference between in-proc, interprocess, and inter machine calls? <p>Ignoring payload size, what is relative difference in latency between an in-proc call (say in C++ or Java), a socket call to a process on the same machine, and a socket call to a process on another machine? This can be expressed ... | <p>That is a good idea... not precise, but it gives the rough ratios:</p>
<p>method call -- ~100s ns
synchronized method call -- ~1000s ns
reflective method call -- low ~10,000s ns</p>
<p>machine loopback -- ~30,000-150,000 ns</p>
<p>local sub-network -- 1-2 ms</p>
<p>internet -- 30-100 ms</p>
|
Discarding the output of a function that needs an output iterator <p>Suppose there´s a template function in C++ that does some useful work but also outputs a sequence of values via an output iterator. Now suppose that that sequence of values sometimes is interesting, but at others is not useful. Is there a ready-to-us... | <p>The STL does not provide such an iterator. But you could code it yourself (tested that code):</p>
<pre><code>struct null_output_iterator :
std::iterator< std::output_iterator_tag,
null_output_iterator > {
/* no-op assignment */
template<typename T>
void operator=(T co... |
Regex expression to split string into items <p>I've got text in a form of</p>
<pre><code>[1/12/2008 2:32:11 p.m. - name]
line 1
[1/12/2008 2:36:00 p.m. - name] - PRIVATE
line 2 [some text] sd
[1/12/2008 2:36:00 p.m. - name]
line 3
</code></pre>
<p>which i want to split into items so i have access to time, name and te... | <p>It looks like this gets you what you want.</p>
<pre><code>\[([0-9\/ \:\.apm]+?) - ([a-z_\-0-9]+?)\](.*?\r\n.+.*?)
</code></pre>
<p>I tested it out on <a href="http://iowacomputergurus.com/free-products/regular-expression-tester.aspx" rel="nofollow">my RegEx tester</a> and it appears to get the proper format.</p>
|
What causes svn commit to fail and report a file/dir as obstructed? <p>I am pretty much the only person making check ins to the svn repo but for some reason over the past week Tortoise is reported that my WCF Service Reference directory is 'obstructed' and I cant commit my changes. If I have no even made any changes to... | <p>You've probably deleted/moved some files / directories directly from the file system, and not through SVN commands. This can sometimes lead to a directory becoming obstructed if it can not work out the differences against the repository. </p>
<p>Try performing a clean-up first, and if that fails, revert that direct... |
Regular Expression for alphanumeric and underscores <p>I would like to have a regular expression that checks if a string contains only upper and lowercase letters, numbers, and underscores.</p>
| <p>To match a string that contains <em>only</em> those characters (or an empty string), try</p>
<pre><code>"^[a-zA-Z0-9_]*$"
</code></pre>
<p>This works for .NET regular expressions, and probably a lot of other languages as well.</p>
<p>Breaking it down:</p>
<pre><code>^ : start of string
[ : beginning of character... |
How to redirect to (or enforce) SSL connection? <p>I am using Zend Framework(MVC part of it), and need to either redirect user to SSL enabled page or to force SSL from controller somehow and don't quite see how to do that? Maybe someone can share the knowledge? </p>
<p>Thanks!</p>
| <p>It's easy to do at the web server level.</p>
<p>In Apache, you'd do it like this:</p>
<pre><code>RewriteEngine On
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
</code></pre>
|
How can I enforce a maximum amount of forked children? <p>EDIT: I've tagged this C in a hope to get more response. It's more the theory I'm interested in than a specific language implementation. So if you're a C coder please treat the following PHP as pseudo-code and feel free to respond with an answer written in C.<... | <p>The best thing I can come up with is to add all the tasks to a queue, launch the maximum number of threads you want, and then have each thread requesting a task from the queue, execute the task and requesting the next one. Don't forget to have the threads terminate when there are no more tasks to do.</p>
|
I need help...........sample project <p>Can anybody give me one sample Asp.Net Project where all the Object oriented concept like class, abstraction, polymorphism, Inheritance and array list has been used for my practice purpose.</p>
<p>I am new to this platform i know all the above mentioned concept but i don't know ... | <p>Download from : <a href="http://www.dotnetspider.com/" rel="nofollow">http://www.dotnetspider.com/</a></p>
<p>Available sample projects over there are :</p>
<ol>
<li>Course Finder - Search Colleges and Courses</li>
<li>Library Management System</li>
<li>Student Project - Personal Assistant</li>
<li>Academic Projec... |
Prerequisites Needed to Read Books on Neural Networks (and understand them) <p>I've been trying to learn about Neural Networks for a while now, and I can understand some basic tutorials online, and I've been able to get through portions of <a href="http://rads.stackoverflow.com/amzn/click/0852742622">Neural Computing ... | <p>If you want a list of college courses that you'll need to understand the book, here it is:</p>
<ul>
<li>Calculus (I, II and III)</li>
<li>Differential Equations</li>
<li>Linear Algebra</li>
<li>Statistics (or a good covering of Bayes)</li>
</ul>
<p>However, I did just fine in my NN classes without Diff. Eq. and ju... |
Somebody explain me Html.DropDown and it's dearest friend SelectList <p>If you check my earlier questions you may have noticed I just don't get the SelectList and Html.DropDown(). I find it intrigueing that I seem to be the only one in this. So maybe I should try to change my mindset or maybe there are things I don't k... | <p>I feel your pain. Forgive the shameless plug, but you might look into <a href="http://lunaverse.wordpress.com/2008/11/24/mvcfluenthtml-fluent-html-interface-for-ms-mvc/" rel="nofollow">MvcFluentHtml</a>. You can still use SelectList and MultiSelectList, but you have several other choices. Should work fine with bi... |
Explicit script end tag always converted to self-closing <p>I'm using xslt to transform xml to an aspx file. In the xslt, I have a script tag to include a jquery.js file. To get it to work with IE, the script tag must have an explicit closing tag. For some reason, this doesn't work with xslt below.</p>
<pre><code><... | <p>If you're creating the XmlWriter yourself you need to pass the transform's OutputSettings to the XmlWriter, eg:</p>
<pre><code>XmlDocument doc = new XmlDocument();
doc.LoadXml("<book><author>Trudi Canavan</author><title>Voice of the Gods</title></book>");
XslCompiledTransform tr... |
Enable ListView multiselect by dragging <p>How do I enable multi-select in a WPF ListView by dragging? </p>
<p>Setting the SelectionMode property to Extended does allow multi-select using Shift and Ctrl, but not by clicking and dragging. Setting the SelectionMode property to Multiple gives a sticky selection which isn... | <p>You could extend <code>ListView</code> and <code>ListViewItem</code> to implement click and drag multi-select behavior.</p>
<p>A very similar solution was posted <a href="http://stackoverflow.com/questions/6364029/drag-select-with-listbox/6728555#6728555">here</a>.</p>
|
ASP.NET: Custom client-side validator for "one of two fields must be filled"? <p>Can you tell me if there anybody has implemented a <strong>custom validator for checking that one of two (or N)</strong> input fields are filled?</p>
<pre><code> "Insert phone number or email address"
</code></pre>
<p>I'm using ASP.NET... | <p>I just did this (requires jQuery):</p>
<p>JS:</p>
<pre><code>function validatePhoneOrEmail(source, args) {
if ($("[id$='txtEmail']").val() == "" && $("[id$='txtTel']").val() == "")
args.IsValid = false;
else
args.IsValid = true;
}
</code></pre>
<p>ASP.NET:</p>
<pre><code><asp:... |
Chaining containers with StructureMap <p>Is it possible to link containers together in StructureMap like it is in WindsorContainer.AddChildContainer()?</p>
<p>I want to achieve having 3 container levels;
- 1 page request level
- 1 session level
- 1 application level</p>
<p>These would then be chained together so only... | <p>This seems to do the trick, not sure if there is a better way or what the implications are. So far looks ok...</p>
<pre><code>childContainer.PluginGraph.Registries.ForEach(
registry => parentContainer.Configure(expression => expression.AddRegistry(registry))
);
</code></pre>
<p>where parentContainer & ... |
How do you apply patches on a web project at production server? <p>We recently had a project where we released beta of a big web app on our client's server. Our client requested us to do bug fixes as they come, and we tried to do it same way. Normally while building an app on our prototype server is way easier, as I ju... | <p>Depending on the tools available on the server, you could either do a <code>svn diff -r x:y</code> where x is the revision you last updated too and y the last revision you want to update to (probably the last revision on your repository) to generate a patch and then apply the patch with the <code>patch</code> comman... |
core dump at _dl_sysinfo_int80 () <p>I have created a TCP client that connects to a listening server.
We implemeted TCP keep alive also.
Some times the client crashes and core dumped.
Below are the core dump traces.</p>
<p>Problem is in linux kernel version Update 4, kernel 2.6.9-42.0.10.</p>
<p>we had two core dumps... | <p><code>_dl_sysinfo_int80</code> is just a function which does a system call into the kernel. So the core dump is happening on a system call (probably the one used by <code>connect</code> in the first example and <code>nanosleep</code> in the second example), probably because you are passing invalid pointers.</p>
<p>... |
How to write your own .net obfuscator <p>I am very curious as to how people write their own obfuscator.</p>
<p>How hard would it be to simply do the following:</p>
<ol>
<li>rename all public methods with GUID type names.</li>
</ol>
<p>Where would I start? How would I go about reading the .net dll assemby, pulling t... | <p>You can check those two projects that are using <a href="http://www.mono-project.com/Cecil" rel="nofollow" title="Cecil">Cecil</a> to write an open-source obfuscator:</p>
<ul>
<li><a href="http://code.google.com/p/obfuscar/" rel="nofollow">http://code.google.com/p/obfuscar/</a></li>
<li><a href="http://www.codeplex... |
Why is Visual Studio's table adapter query not returning the same data as the stored procedure it represents? <p>I'm using a table adapter in Visual Studio to make a query to a stored procedure in my SQL Server 2005 database. When I make the call via my website application it returns nothing. When I make the same cal... | <p>Dates need to have quotes around them in SQL else they don't work. </p>
|
How do integrate Delphi with Active Directory? <p>We need to validate an user on Microsoft's Active Directory using Delphi 7, what is the best way to do that?</p>
<p>We can have two scenarios: the user inputs its network username and password, where the username may include the domain, and we check on active directory... | <p>Here's a unit we wrote and use. Simple and gets the job done.</p>
<pre><code>unit ADSI;
interface
uses
SysUtils, Classes, ActiveX, Windows, ComCtrls, ExtCtrls, ActiveDs_TLB,
adshlp, oleserver, Variants;
type
TPassword = record
Expired: boolean;
NeverExpires: boolean;
CannotChange: boolean;
end;... |
Javascript Marquee to replace <marquee> tags <p>I'm hopeless at Javascript. This is what I have:</p>
<pre><code><script type="text/javascript">
function beginrefresh(){
//set the id of the target object
var marquee = document.getElementById("marquee_text");
if(marquee.scrollLeft >... | <p>Here is a jQuery plugin with a lot of features:</p>
<p><a href="http://jscroller2.markusbordihn.de/example/image-scroller-windiv/">http://jscroller2.markusbordihn.de/example/image-scroller-windiv/</a></p>
<p>And this one is "silky smooth"</p>
<p><a href="http://remysharp.com/2008/09/10/the-silky-smooth-marquee/">... |
Is it worth it to code different functionality for users with javascript disabled? <p>I'm currently building a project and I would like to make use of some simple javascript - I know some people have it disabled to prevent XSS and other things. Should I...</p>
<p>a) Use the simple javascript, those users with it disab... | <p>Degrade gracefully - make sure the site works without JavaScript, then add bells and whistles for those with JavaScript enabled.</p>
|
How to Debug .NET Mobile Device Application using multiple instances of Device Emulator <p>I would like to Debug .NET Mobile Device Application using multiple instances of Device Emulator. If I right click the project and go to Debug -> Start new instance in Visual Studio 2008 when an instance is already running I get... | <p>I just discovered a way you can (sort of) do this. You can't deploy from two instances of Visual Studio to two instances of the same type of emulator, but you <em>can</em> deploy to instances of two <em>different</em> types of emulator. Although not without a small trick.</p>
<p>To see how this works, open two in... |
Matrix Template Library matrix inversion <p>I'm trying to inverse a matrix with version Boost boost_1_37_0 and MTL mtl4-alpha-1-r6418. I can't seem to locate the matrix inversion code. I've googled for examples and they seem to reference lu.h that seems to be missing in the above release(s). Any hints?</p>
<p><a href=... | <p>Looks like you use <code>lu_factor</code>, and then <code>lu_inverse</code>. I don't remember what you have to do with the pivots, though. From the <a href="http://www.osl.iu.edu/research/mtl/reference/html/index.html" rel="nofollow">documentation</a>.</p>
<p>And yeah, like you said, it looks like their documenta... |
Create an Array of the Last 30 Days Using PHP <p>I am trying to create an array starting with today and going back the last 30 days with PHP and I am having trouble. I can estimate but I donât know a good way of doing it and taking into account the number of days in the previous month etc. Does anyone have a good s... | <p>Try this:</p>
<pre><code><?php
$d = array();
for($i = 0; $i < 30; $i++)
$d[] = date("d", strtotime('-'. $i .' days'));
?>
</code></pre>
|
Python subprocess.call() fails when using pythonw.exe <p>I have some Python code that works correctly when I use python.exe to run it, but fails if I use pythonw.exe.</p>
<pre>
def runStuff(commandLine):
outputFileName = 'somefile.txt'
outputFile = open(outputFileName, "w")
try:
... | <p><code>sys.stdin</code> and <code>sys.stdout</code> handles are invalid because pythonw does not provide console support as it runs as a deamon, so default arguments of <code>subprocess.call()</code> are failing.</p>
<p>Deamon programs close stdin/stdout/stderr purposedly and use logging instead, so that you have to... |
SubSonic "Version" fails due to missing dependencies <p>I am using SubSonic 2.1 Final but having problems running "Version" with the SubCommander. I think this problem began when I installed SQL Server 2008 on my local machine and removed 2005.</p>
<p>This is the error I get:</p>
<pre><code>ERROR: Trying to execute V... | <p>You probably have to compile SubCommander with the SqlServer 2008 version of Microsoft.SqlServer.Management.Smo dlls</p>
|
Avoiding a javascript race condition <p>Here's the scenario:</p>
<p>My users are presented a grid, basically, a stripped down version of a spreadsheet. There are textboxes in each row in the grid. When they change a value in a textbox, I'm performing validation on their input, updating the collection that's driving ... | <p>Use the semaphore (let's call it StillNeedsValidating). if the SaveForm function sees the StillNeedsValidating semaphore is up, have it activate a second semaphore of its own (which I'll call FormNeedsSaving here) and return. When the validation function finishes, if the FormNeedsSaving semaphore is up, it calls the... |
Suggest a good PHP wiki engine <p>I am looking for a small wiki engine that is easy to embed into an existing PHP application. Or perhaps a set of libraries to handle all the typical wiki functions.</p>
<p>Currently I am using <a href="http://erfurtwiki.sourceforge.net/">ErfurtWiki</a>, but it is starting to show its... | <p>I highly recommend <a href="http://www.mediawiki.org/wiki/MediaWiki">MediaWiki</a>, the wiki engine that runs wikipedia.</p>
<p>EDIT: As per your comment, MediaWiki is highly embeddable. I've integrated it in numerous projects over the years.</p>
|
Warnings using format strings with sprintf() in C++ <p>Compiling this lines</p>
<pre><code> long int sz;
char tmpret[128];
//take substring of c, translate in c string, convert to int,
//and multiply with 1024
sz=atoi(c.substr(0,pos).c_str())*1024;
snprintf(tmpret,128,"%l",sz);
</code></pre>
... | <p>Your format lacks type, because l is a "sizeof" modifier. Should be %ld </p>
|
Visual Studio 2008 sometimes won't open .aspx html markup <p>Every now and again I encounter a problem where Visual Studio Professional 2008 (SP1) refuses to open an aspx page. My site is in a Web Application Project. </p>
<p>Double clicking on the aspx page in solution explorer just causes the tree view node with th... | <p>Yeah, I'm getting that with just one aspx file in a webproj. I can open it with notepad fine, no one else is having a problem with the file on their computer and it just started happening to me today.
I am using SourceSafe if that matters. I tried closing and reopening VS.</p>
|
TimedRotatingFileHandler Changing File Name? <p>I am trying to implement the python logging handler called TimedRotatingFileHandler. </p>
<p>When it rolls over to midnight it appends the current day in the form: "YYYY-MM-DD".</p>
<pre><code>LOGGING_MSG_FORMAT = '%(name)-14s > [%(levelname)s] [%(asctime)s] : %(mes... | <p>"How can i change how it alters the filename?"</p>
<p>Since it isn't documented, I elected to read the source. This is what I concluded from reading the source of <code>logging/handlers.py</code></p>
<pre><code>handler = logging.handlers.TimedRotatingFileHandler("C:\\isis_ops\\logs\\Rotate_Test",'midnight',1)
han... |
GUI App with Visual C++ Express Edition <p>What tool (preferably free) can be used with Visual C++ 2008 Express Edition to create Win32 GUI applications? As you know the Express Edition does not include a GUI resource editor.</p>
| <p>It doesn't, but that doesn't stop you from creating a Win32 GUI app; you can still do this in code.</p>
<p>If that's unappealing for you, just do a Google search for "win32 Resource Editor." There are a few available. Any tool that creates .rc files can be compiled into your C++ project.</p>
|
What is special about HashSet<T> in .NET 3.5? <p>Here's an interesting puzzle.</p>
<p>I downloaded Snippet Compiler to try some stuff out, and wanted to write the following code:</p>
<pre><code>using System;
using System.Collections.Generic;
public class MyClass
{
public static void RunSnippet()
{
HashS... | <p>is your reference use </p>
<p>Namespace: System.Collections.Generic</p>
<p>Assembly: System.Core (in System.Core.dll)</p>
<p>version 3.5?</p>
|
How do I find the type of the object instance of the caller of the current function? <p>Currently I have the function CreateLog() for creating a a log4net Log with name after the constructing instance's class.
Typically used as in:</p>
<pre><code>class MessageReceiver
{
protected ILog Log = Util.CreateLog();
... | <p>Normally, <a href="http://msdn.microsoft.com/en-us/library/system.reflection.memberinfo.reflectedtype.aspx" rel="nofollow">MethodBase.ReflectedType</a> would have your info. But, according to MSDN <a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.stackframe.getmethod.aspx" rel="nofollow">StackFrame... |
Why use hashing to create pathnames for large collections of files? <p>I noticed a number of cases where an application or database stored collections of files/blobs using a has to determine the path and filename. I believe the intended outcome is a situation where the path never gets too deep, or the folders ever get ... | <h3>Hash/B:Tree</h3>
<p>A hash has the advantage of being faster to look at when you're only going to use the "=" operator for searchs.</p>
<p>If you're going to use things like "<" or ">" or anything else than "=", you'll want to use a B:Tree because it will be able to do that kind of searchs.</p>
<h3>Directory ... |
Simple protocol for remote process startup/shutdown <p>I'm looking for a simple protocol to control remote processes from one managing application. The remote processes will run on Windows and Linux (x86).</p>
<p>Is there a simple protocol for managing remote processes, for which I could find daemons that run on both ... | <p>I consider ssh to be the "Swiss-army knife" of remote administration. A custom script communicating over ssh can then do the process management. On Windows, I install ssh as part of <a href="http://www.cygwin.com/" rel="nofollow">Cygwin</a>.</p>
|
How to Create a Listener for WCF ServiceHost events when service is hosted under IIS? <p>I have a WCF service which will be hosted under IIS. Now I have some resources(Connections) that I create within service constructor. I need to free up those resources when IIS which is hosting the service shuts down or resets. The... | <p>You can use the IDisposable pattern with finalizer on the class that holds the resources.</p>
<p>On unload of AppDomain, all objects are finalized and if the object that has reference to the resources (such connections) has a finalizer, the finalizer will be called and you can close / dispose the resources at that ... |
What is the Managed C++ equivalent to the C# using statement <p>How would one code the following C# code in Managed C++</p>
<pre><code>void Foo()
{
using (SqlConnection con = new SqlConnection("connectionStringGoesHere"))
{
//do stuff
}
}
</code></pre>
<p><strong>Clarificaton:</strong>
For manage... | <p>Assuming you mean C++/CLI (not the old Managed C++), the following are your options:</p>
<p>(1) Mimic a using-Block with using automatic / stackbased objects:</p>
<pre><code>{
SqlConnection conn(connectionString);
}
</code></pre>
<p>This will call the Destructor of the "conn" Object when the next enclosing blo... |
How do I get rid of .. Replace(Replace(Replace(Replace(Replace( â¦? <p>Iâm selecting data on an old database which has an abused status column. The status column has multiple pieces of information in it. Values are like âNew Contact YYYYâ, âOnline YYYYâ, âUpdated YYYYâ, âWithdrawn YYYYâ, etcâ¦. As... | <p>If you simply want to extract a four digit year from the string, you could use PATINDEX</p>
<pre><code>SELECT SUBSTRING(FieldName, PATINDEX('%[0-9][0-9][0-9][0-9]%', FieldName), 4)
FROM TableName
</code></pre>
|
xsl:for-each loop counter <p>How do I save the iterations that have occurred in an xsl:for-each? (variables in XSL are immutable)</p>
<p>My goal is to find the MAX number of children for any node at a particular level.</p>
<p>For example, I might want to print that there are no more than 2 Response nodes for any Ques... | <p>One doesn't "save the iterations that have occurred in an xsl:for-each" because <a href="http://conferences.idealliance.org/extreme/html/2006/Novatchev01/EML2006Novatchev01.html" rel="nofollow"><strong>XSLT is a functional language</strong></a> and variables are immutable.</p>
<p><strong>The following transformatio... |
How do I render a partial of a different format in Rails? <p>I'm trying to generate a JSON response that includes some HTML. Thus, I have <code>/app/views/foo/bar.json.erb</code>:</p>
<pre><code>{
someKey: 'some value',
someHTML: "<%= h render(:partial => '/foo/baz') -%>"
}
</code></pre>
<p>I want it to... | <p>Beginning with Rails 3.2.3, when calling render :partial use </p>
<pre><code>:formats => [:html]
</code></pre>
<p>instead of</p>
<pre><code>:format => 'html'
</code></pre>
|
Extracting individual digits from a float <p>I have been banging my head on this one all day. The C++ project I am currently working on has a requirement to display an editable value. The currently selected digit displays the incremented value above and decremented value below for said digit. It is useful to be able... | <p>Internal representation of the float point numbers aren't like was you see. You can only cast to a stirng.</p>
<p>To cast, do this:</p>
<pre><code>char string[99];
sprintf(string,"%f",floatValue);
</code></pre>
<p>Or see this : <a href="http://www.parashift.com/c++-faq-lite/misc-technical-issues.html#faq-39.1">ht... |
Unable to commit to Subversion <p>I have a client who had to rebuild his automated build server. He checked out his project folder from my subversion server but is now no longer able to commit - he gets this error:</p>
<pre><code>Error: Commit failed (details follow):
Error: Cannot write to the prototype revision fi... | <p>You can clear this error w/out a reboot:</p>
<ol>
<li><p>Identify (or create) a directory in the root SVN repository that was not a part of the failed commit.</p></li>
<li><p>Create a new file in the directory from step 1.</p></li>
<li><p>Commit the new file (and directory if created in step 1). Because the file is... |
MySQL/PHP - escaping characters that may slow my database down (or make it perform unexpectedly) <p>I run all my integers through a <code>(int)Integer</code> to make them safe to use in my query strings.</p>
<p>I also run my strings through this function code:-</p>
<pre><code>if(!get_magic_quotes_gpc()) {
... | <p>Okay I have several comments:</p>
<ul>
<li><p>The magic quoting feature is <a href="http://php.net/manual/en/security.magicquotes.php" rel="nofollow">deprecated</a>, your PHP environment should never enable magic quotes. So checking for it should be unnecessary, unless you're designing code that may be be deployed... |
How Can I Create Rounded Rectangle Buttons in WM6? <p>Yes, like those pretty buttons on the iPhone. ;)</p>
<p>I've been searching and reading for days now and everytime I find something that will get me close (like CreateRoundRectRgn), it blows up because Windows Mobile 6 GDI+ doesn't support it.</p>
<p>I can do th... | <p>Getting pretty buttons like that is typically done by doing a complete owner-drawn button and drawing an image that a graphic designer created to it rather than letting GDI do any of the control painting. You simply need an image for "up" and an image for "pressed". You can manually draw in the focus or use yet an... |
Yet Another Divs vs Tables issue: Forms <p>[Meta-note:] I was browsing the question page, getting really tired of "DIVS vs Tables" "When to use tables vs DIVS" "Are Divs better than Tables" "Tables versus CSS" and all the questions that ask <em>THE SAME THING OMG PEOPLE</em> but I would like to see all the ways people ... | <p>What I usually do is :</p>
<pre><code><form>
<label for="param_1">Param 1</label>
<input id="param_1" name="param_1"><br />
<label for="param_2">Param 2</label>
<input id="param_2" name="param_2"><br />
</form>
</code></pre>
<p>and in a CSS :</p>
<pr... |
Javascript form validation <p>I'm trying to figure out what would be the simplest way to validate required fields without having to do an if statement for each element's name. Perhaps just with a loop and verify its class.</p>
<p>What I'm trying to accomplish is to check only the ones that have the class name as "requ... | <p>I'm not at all against the libraries suggested by others, but I thought that you may want some samples of how you could do it on your own, I hope it helps.</p>
<p>This should work:</p>
<pre><code>function validate() {
var inputs = document.getElementsByTagName("input");
for (inputName in inputs) {
... |
How can I add sessions to my Perl web app? <p>I want to maintain state in my Perl web app. How can I do this effectively? I looked at CGI::Session but it says that it doesn't work well with UTF-8 pages, which is a requirement. I'd also like to be able to pass some basic information to another Java application runnin... | <p>The basics of sessions are that you need a place to hold the session data (the store) and a way to store and retrieve the session data. While some frameworks call that The State, it really boils down to having a session key (or session ID) and passing it back to your app via either a cookie or a URL parameter.</p>
... |
How do I load arbitrary data from a url PHP? <p>This question is simple. What function would I use in a PHP script to load data from a URL into a string?</p>
| <p>I think you are looking for</p>
<pre><code>$url_data = file_get_contents("http://example.com/examplefile.txt");
</code></pre>
|
HTML over flash without stopping interaction with flash <p>I have a html div layered on top of an interactive flash movie, but when the mouse moves over the div, it can't interact with the flash (the view changes as the mouse moves or is clicked). Is there a way to have the flash recieve the mouse movements and clicks ... | <p>Try something like this:</p>
<pre><code><object>
<param name="wmode" value="transparent" />
<embed src="example.swf" wmode="transparent"></embed>
</object>
</code></pre>
<p>The main things to note are the <code><param /></code> tag with the transparent attribute, and ... |
T-SQL Query Optimization <p>I'm working on some upgrades to an internal web analytics system we provide for our clients (in the absence of a preferred vendor or Google Analytics), and I'm working on the following query:</p>
<pre><code>select
path as EntryPage,
count(Path) as [Count]
from
(
/* Sub-... | <p>For starters,</p>
<pre><code> where pv1.Domain = isnull(@Domain, pv1.Domain)
</code></pre>
<p>won't SARG. You can't optimize a match on a function, as I remember.</p>
|
Does Javascript fire an event for unhandled/uncaught exceptions? <p>I'm looking to log unhandled javascript exceptions. Is there an event that fires when an exception isn't caught? I'm looking to catch the exceptions before they cause javascript errors in the browser, but I'd rather not run my entire application inside... | <p>Check out this Fiddle:</p>
<p><a href="http://jsfiddle.net/xYsRA/1/">http://jsfiddle.net/xYsRA/1/</a></p>
<pre><code>window.onerror = function (msg, url, line) {
console.log("Caught[via window.onerror]: '" + msg + "' from " + url + ":" + line);
return true; // same as preventDefault
};
window.addEventList... |
How do I remove minimize and maximize from a resizable window in WPF? <p>WPF doesn't provide the ability to have a window that allows resize but doesn't have maximize or minimize buttons. I'd like to able to make such a window so I can have resizable dialog boxes.</p>
<p>I'm aware the solution will mean using pinvoke ... | <p>I've stolen some code I found on the MSDN forums and made an extension method on the Window class, like this:</p>
<pre><code>internal static class WindowExtensions
{
// from winuser.h
private const int GWL_STYLE = -16,
WS_MAXIMIZEBOX = 0x10000,
WS_MINIMIZEBOX... |
What is the best approach for applying styles to massive amounts of items? <p>In my LOB apps I usually wind up with containers that contain a bunch of different textblocks and textboxes for users to enter data. Normally I need to apply a certain margin or vertical/horizontal alignment to each control.</p>
<p>Let's say... | <p>You can put a "global" style into the <code>Resources</code> section of the grid, thus confining its impact. To re-use "global" styles in different locations, put them into a non-default resource dictionary and include it as <code>MergedDictionary</code>:</p>
<p>in <code>Styles.xaml</code>:</p>
<pre><code><Reso... |
Looking for an example of using Lucene.net with ASP.NET <p>How do you implement the search capabilities of Lucene.net in asp.net? If possible, please include links or example code.</p>
| <p>There is a excellent blog series here:</p>
<ol>
<li><a href="https://web.archive.org/web/20131229052210/http://www.devatwork.nl/articles/lucenenet" rel="nofollow">Lucene.NET</a></li>
<li><a href="https://web.archive.org/web/20131031102410/http://www.devatwork.nl/articles/lucenenet/introduction-to-lucenenet-lucenene... |
Disadvantages of using void* pointers in C <p>There are many drawbacks to using <code>void *</code> in C (memory related, type related, efficiency wise ...). In spite of them we use them a lot for the flexibility they provide.</p>
<p>List the disadvantages/drawbacks using <code>void *</code> (and preferred solution in... | <p>There are no efficiency issues with void pointers.
The only limitations with void pointers are:</p>
<ul>
<li>you cannot dereference void pointer for obvious reasons</li>
<li><code>sizeof(void)</code> is illegal</li>
<li>you cannot perform pointer arithmetics on void pointers</li>
</ul>
<p>However GCC assumes that ... |
Retrieve the uniqueidentifier key value for a record <p>in context of SQL Server 2005, I have a table for which the primary key is a uniqueidentifier (GUID), with a default value generated by the newid() function. I want to write a stored procedure that inserts a new record into the table. How do I get the record's PK ... | <p><strong>Generating GUID before insertion introduces index fragmentation.</strong></p>
<p>There is no need to declare the GUID prior insertion, </p>
<p>I would recommend:</p>
<ol>
<li><p>Using NEWSEQUENTIALID default constraint to generate contiguous Guids. (this will eliminate index fragmentation - a well known i... |
C# console applications all 16bit? <p>I was reading up about NTVDM.exe as I build a quick test console app and it crashed on a friends machine complaining about this EXE.</p>
<p>As I understand it all DOS cmd windows (C# console apps included) run as 16bit not 32bit.</p>
<p>Is this true? Does this mean all my works ... | <p>Any .NET app that is compiled for x86 will be 32-bit</p>
<p>C# console apps aren't running in "real" dos - they run in a 32-bit or 64-bit environment - depending on your OS and .NET framework.</p>
|
MySQL - how to use index in WHERE x IN (<subquery>) <p>I'm using this query to get all employees of {clients with name starting with lowercase "a"}:</p>
<pre><code>SELECT * FROM employees
WHERE client_id IN (SELECT id FROM clients WHERE name LIKE 'a%')
</code></pre>
<p>Column <code>employees.client_id</code> is an... | <pre><code>SELECT employees.*
FROM employees, clients
WHERE employees.client_id = clients.id
AND clients.name LIKE 'a%';
</code></pre>
<p>Should be more quicker, since the optimiser can choose the most efficient plan. In writing it your way with a sub-query, you're forcing it to do the steps in a certain order ... |
Firefox manipulation of saved form data <p>Is there a Firefox plugin for manipulating and deleting saved form data?
In the browser there is only the option to delete all data.</p>
| <p><a href="https://addons.mozilla.org/en-US/firefox/addon/12021" rel="nofollow">Form History Control</a> does what you want.</p>
|
Make C# algorithm more efficient <p>I have a C# method that projects the value of a number from an interval to a target interval.<br />
<strong>For example:</strong> we have an interval of -1000 and 9000 and a value of 5000; if we want to project this value to an interval of 0..100 we get 60.</p>
<p>Here is the method... | <p>Only thousands of values? Do you really need to optimise this further? I can't imagine it's actually a bottleneck at the moment. Have you profiled the app to check that this is really an issue?</p>
<p>Given that the method is O(1), you're not going to make the most drastic kind of optimisation you normally aim at -... |
What is the best method for formatting email when using System.Net.Mail <p>Hi I'm using <code>System.Net.Mail</code> to send some HTML formatted emails.</p>
<p>What is the correct method for inserting css into the email message?</p>
<p>I know I can apply formatting to each item, but I'ld rather use style sheets..</p>... | <p>I've always found that strictly using <strong>HTML 3.0 compatible tags and formatting</strong> works best for all email readers and providers.</p>
<p>nevertheless here is a <a href="http://www.alistapart.com/articles/cssemail" rel="nofollow"><strong>CSS in Email</strong> article</a> that may answer your question, y... |
Should I use decimal, float or double for this simple math result? <p>I'm doing some really simple math and saving the result to a MS SQL2008 DB.</p>
<p>I'm <em>averaging</em> out the some numbers, which are byte values between 1<->5. I wish to record probably 2 decimal places only. I don't care about rounding for ... | <p>What you need is the DECIMAL datatype:</p>
<pre><code>declare @val decimal(10,2)
select @val = 10.155
select @val
</code></pre>
<p>When you input values, you can either rely on the built in rounding, or explicitly decide which rounding you want:</p>
<pre><code>select val = round(10.155, 2, 0) -- rounded
select va... |
import text file containing line breaks into excel <p>I have a plain text file looking like this:</p>
<pre><code>"some
text
containing
line
breaks"
</code></pre>
<p>I'm trying to talk <code>excel 2004 (Mac, v.11.5)</code> into opening this file correctly. I'd expect to see only one cell (A1) containing al... | <p>Looks like I just found the solution myself. I need to save the initial file as ".csv". Excel honors the line breaks properly with CSV files. Opening those via applescript works as well.</p>
<p>Thanks again to those who responded.</p>
<p>Max</p>
|
Can I create a dojox.data.XmlStore with a url pointing to a different port or server <p>In the following, I want to replace <code>/books.xml</code> with something like <code>http://server:port/books</code>. In essence the XmlStore to be served by some other server or port than the one serving this</p>
<pre><code><d... | <p>The data store is bound by "the same origin" restrictions like all data sources in web applications. You should either proxy the other server using your server, or consider alternative means of data access, e.g., JSONP, or the window-name transport.</p>
|
ASP.NET GridView "Client-Side Confirmation when Deleting" stopped working on ie - how come? <p>A few months ago, I have programmed an ASP.NET GridView with a custom "Delete" LinkButton and Client-Side JavaScript Confirmation according to this msdn article:</p>
<p><a href="http://msdn.microsoft.com/en-us/library/bb4288... | <p>Try this :</p>
<pre><code><asp:LinkButton ID="DeleteButton" runat="server" CausesValidation="False"
CommandName="Delete" Text="Delete"
OnClientClick="return confirm('Delete Id : '<%# (string)Eval('id')%>')" >
</asp:LinkButton>
</code></pre>
|
Is it possible to use GZIP compression on classic ASP pages? <p>We've got a classic ASP application that is putting out some very large reports, where the resulting HTML is several MBs. We've made a lot of progress in trimming this down by reducing extraneous HTML, but I'd like to know if there's any way to enable GZIP... | <p>Sure, that's just a matter of turning on compression in IIS. See this <a href="http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/25d2170b-09c0-45fd-8da4-898cf9a7d568.mspx?mfr=true" rel="nofollow">MSDN</a> page for example.</p>
|
Create empty C# event handlers automatically <p>It is not possible to fire an event in C# that has no handlers attached to it. So before each call it is necessary to check if the event is null.</p>
<pre><code>if ( MyEvent != null ) {
MyEvent( param1, param2 );
}
</code></pre>
<p>I would like to keep my code as clea... | <p>I saw this on another post and have shamelessly stolen it and used it in much of my code ever since:</p>
<pre><code>public delegate void MyClickHandler(object sender, string myValue);
public event MyClickHandler Click = delegate {}; // add empty delegate!
//Let you do this:
public void DoSomething() {
Click(th... |
How to delegate a method call to another thread? <p>I have the following problem: Multithreaded WPF application, Model View Presenter Implementation. Presenters and Views that belong together are created on a separate thread and get a separate Dispatcher. Now someone calls from another thread a method on the Presenter.... | <pre><code>if( presenterDispatcherObject.CheckAccess() )
Doit();
else
presenterDispatcherObject.BeginInvoke( DispatcherPriority.Normal, () => DoIt() );
</code></pre>
|
Java Cipher - AES Padding Problem <p>I am using a AES cipher with a 16 byte block size. </p>
<p>If I try and encrypt a 16 byte string I have no problems, but any other length not a multiple of 16 is throwing an exception. </p>
<p>I know with 3-DES you can specify a padding type as part of the algorithm and it's handl... | <p>It should work exactly the same with AES, i.e. the padding mode has to be specified together with the cipher. Which padding modes are implemented depends on the provider and should be described in its documentation.</p>
<p>According to the JCE documentation:
<a href="http://java.sun.com/j2se/1.5.0/docs/guide/securi... |
Python 3.0 - dict methods return views - why? <blockquote>
<p>dict methods dict.keys(), dict.items()
and dict.values() return âviewsâ
instead of lists.
<a href="http://docs.python.org/dev/3.0/whatsnew//3.0.html">http://docs.python.org/dev/3.0/whatsnew//3.0.html</a></p>
</blockquote>
<p>First of all how is ... | <p>You are effectively getting a list. It's just not a copy of the internal list, but something that acts as if it where a list but only represents the internal state.</p>
<p>That's the same way it's implemented in Java (and probably many other languages/environments as well).</p>
<p>The main reason is that for many ... |
Unit Testing in web applications that use databases <p>I am building a web application that uses the database for Users, Security/roles, and to store content.</p>
<p>It seems a little daunting to me to begin on the road of unit testing because I have to make sure my database has been initialized properly for my tests ... | <p>The solution is Mocking. Mocks "replace" the connection. The unit under test will "connect" to the Mock and executes its statement. The Mock returns normal resultsets o.s.e.</p>
<p>After the test, the mock can give you a list of all methods, that were called by the unit under test. <a href="http://www.easymock.org"... |
Newbie: Visual Studio 2008 Standard Edition: How do I see more than "Reporting" project type? <p>I just bought a VS 2008 Standard license upgrade. (I was using the integrated shell for learning F# and express edition for c#. )</p>
<p>I performed the install, re-booted, and when I click file->new->project ... all I get... | <p>You can install templates or save your project as a template.</p>
|
ASP.NET DropDownList AutoPostback Not Working - What Am I Missing? <p>I am attempting to get a DropDownList to AutoPostBack via an UpdatePanel when the selected item is changed. I'm going a little stir-crazy as to why this isn't working.</p>
<p>Does anyone have any quick ideas?</p>
<p>ASPX page:</p>
<pre><code><a... | <p>I was able to get it to work with what you posted. This is the code I used... Basically what you had but I am throwing an exception.</p>
<pre><code> <asp:ScriptManager ID="smMain" runat="server" />
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Always" ChildrenAsTriggers="true" > ... |
Hide Comments in Code in Unix Environment <p>I work in a Unix environment with the typical Unix tools (emacs, vim, gvim, sunstudio, etc)</p>
<p>My project has huge gross boilerplate comments on every method. It makes the files thousands of lines long, with a couple hundred lines of actual code. I may be exagerrating a... | <p>It all depends on which editor you use. In vim, you can enable folding with :</p>
<pre><code>set foldenable
</code></pre>
<p>Then, you'll be able to use different of folding methods, for mainstream languages, you can set :</p>
<pre><code>set foldmethod=syntax
</code></pre>
<p>which will enable syntax folding.</p... |
How do I fix a .NET Webservice timeout causing a UnsupportedMediaException in a Java client? <p>I currently have a .net SOAP web service with a timeout on the request that I set using</p>
<pre><code>Server.ScriptTimeout = TIME_OUT;
</code></pre>
<p>I then have java client calling said web service. However when the ti... | <p>This is a <a href="https://jax-ws.dev.java.net/issues/show_bug.cgi?id=566" rel="nofollow">known issue</a> with Sun's JAX-WS stack.</p>
<p>For reference, the HTTP 500 code actually means that the server had an Internal Server Error. I'm not sure why .NET sends that rather than HTTP 503 Service Unavailable.</p>
|
PNG image won't show in IE7 or Firefox but works in Opera <p>I got a webservice which creates a PNG-file and returns a link to it.
Then this graphic is used by a website (ASP.NET).</p>
<p>IE7 & Firefox 3 can't show this image but in Opera 9.5 it works fine.</p>
<p>Did anyone run across the same problem before?</p... | <p>In principle, both IE7 and FF can display PNG images. As it seems your PNG is not fully compliant to the rendering engines of these browsers (or to the standard?).</p>
<p>It is hard to tell where the problem lies exactly without knowing how the image was created. Which lib are you using? Do you have sample code?</p... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.