input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Can I ignore delegate parameters with lambda syntax? <p>I am curious why C# allows me to ignore delegate parameters in some cases but not others.</p>
<p>For instance this is permitted:</p>
<pre><code>Action<int> action = delegate { Console.WriteLine("delegate"); };
</code></pre>
<p>but this is not:</p>
<pre><... | <p>I believe that your first sample actually creates an anonymous function that is able to take on many different signatures whose body is the single statement <code>Console.WriteLine...</code>. Because it can match different signatures, it does not cause a problem. In the second sample, the lambda syntax itself defin... |
What do you mean Ruby on Rails is not thread safe? <p>I was just reading up on ROR (haven't dived into it yet), and I hear that it isn't thread safe. Obviously, this doesn't mean that more than one person can't access your site at one time, so what exactly does it mean? Where do threads come into play in ROR? Do they j... | <p>Your information is out of date.
It is thread safe as of <a href="http://guides.rubyonrails.org/2_2_release_notes.html" rel="nofollow">2.2.2</a></p>
<p>Keep in mind <a href="http://en.wikipedia.org/wiki/Ruby_MRI" rel="nofollow">Ruby MRI 1.8.x</a>, the most widely used implementation of Ruby uses <a href="http://en... |
Difference between -Wconversion between gcc and g++ <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/310108/can-i-make-gcc-warn-on-passing-too-wide-types-to-functions">Can I make GCC warn on passing too-wide types to functions?</a> </p>
</blockquote>
<p>Consid... | <p>From <a href="http://gcc.gnu.org/onlinedocs/gcc-4.3.3/gcc/Warning-Options.html" rel="nofollow">the documentation</a> for <code>-Wconversion</code>:</p>
<blockquote>
<p>Warnings about conversions between signed and unsigned integers are disabled by default in C++ unless -Wsign-conversion is explicitly enabled.</p>... |
Asynchronous SQLCommand and CCR <p>I have been playing with the demo code from this msdn article by <a href="http://msdn.microsoft.com/en-au/magazine/cc163556.aspx" rel="nofollow">Jeffrey Richter</a>. </p>
<p>I have added a new function to his ApmToCcrAdapters to handle the SqlCommand.BeginExecuteReader. Only it is ... | <p>The connection must remain open for the Reader to work. I believe closing the connection is your problem. Leave the connection open and call dispose on the reader when done and I think that should clean up the connection.</p>
|
Javascript on page is not executing before AJAX onComplete event is called <p>I have a form that makes an Ajax POST request to insert a widget into my database. In the form, I have a select box where you can select from the widgets. After the db insert is made, I must update the select box. I actually just replace t... | <p>Setting EvalScripts to true must work.</p>
<p>else you can try loading the script using </p>
<pre><code>> <script> function window.onload(){
> alert('I am loaded as the page
> completes loading') } </script>
</code></pre>
<p>if this does not help then you can call function :loading in ajax ca... |
JavaScript 64 bit numeric precision <p>Is there a way to represent a number with higher than 53-bit precision in JavaScript? In other words, is there a way to represent 64-bit precision number?</p>
<p>I am trying to implement some logic in which each bit of a 64-bit number represents something. I lose the lower signif... | <p>Google's Closure library has <a href="http://docs.closure-library.googlecode.com/git/class_goog_math_Long.html" rel="nofollow">goog.math.Long</a> for this purpose.</p>
|
Create history of states in Java <p>I need to save a history of states over a few actions in a Java application, which I can later reload in order to restore the state at a certain action. In other words I have a screen which has a state associated with it and I need to store it as well as any changes in a history so t... | <p>Have you tried looking into the <a href="http://en.wikipedia.org/wiki/Memento_pattern">Memento Design Pattern</a>? It seems particularly well defined for your problem. From Wikipedia:</p>
<blockquote>
<p>The memento pattern is a software
design pattern that provides the
ability to restore an object to its
p... |
DynamicArray throws OutOfBounds exception <p>I know this may sound strange, but yes, it's 2009 and I need to write small application using BCB5 :) </p>
<p>The problem is that DynamicArray throws OutOfBound exception when trying to expand it from within worker thread.</p>
<p>I have global variable, let's say </p>
<pr... | <p>In your <code>Execute</code> method you're modifying the <em>thread's</em> <code>X</code> field, not the global <code>X</code> variable. Although the <code>setX</code> method receives its argument by reference, the member variable is not a reference. It stores a <em>copy</em> of the <code>DynamicArray</code> value, ... |
Excel import returns blank cells <p>I have had this problem forever and never managed to figure it out. </p>
<p>I am importing an excel (.xls) file into an asp recordset. Most of the time this works great. </p>
<p>I have column with the following values</p>
<pre><code>4
4
5,6
3
</code></pre>
<p>Asp reads those valu... | <p>The problem is that ADO scans the first 8 rows and based on the data it finds in each column it sets the column type. So if your first 8 rows contain numbers then it sets that column to numeric and returns null for any other values, for example if the ninth row contains text or a comma. See <a href="http://blog.lab4... |
What are the performance implications of getElementsByTagName("*")? <p>Let me start out by saying that I'm not a JavaScript developer so this question may be rather basic.</p>
<p>When simulating IE's nonstandard <a href="http://msdn.microsoft.com/en-us/library/aa752281(VS.85).aspx" rel="nofollow"><code>all</code></a> ... | <p>For Interest, you may find this lecture by John Resig interesting. Its relevant to new and experienced users alike when using dom methods like you are. </p>
<ul>
<li><a href="http://ejohn.org/blog/the-dom-is-a-mess/" rel="nofollow">http://ejohn.org/blog/the-dom-is-a-mess/</a></li>
</ul>
<p>It discusses many lovely... |
Caching system like memcached but where I need to list what is in the cache <p>What's the best caching system/daemon that supports get, put, delete and list (memcached, I think, doesn't support list)</p>
<p>An example </p>
<p>I would like to use memcached for my caching solution but I'm stuck with the application des... | <p>You can check <a href="http://stackoverflow.com/questions/109480/caching-paginated-results-purging-on-update-how-to-solve">Caching paginated results, purging on update - how to solve?</a></p>
|
selenium-maven-plugin <p>i'm trying to set up the selenium-maven-plugin and having some difficulties i hope somebody can help me. My configuration looks like this:</p>
<pre><code><plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>selenium-maven-plugin</artifactId>
<executi... | <p>It's a bug in selenium, which can be fixed by downloading a new version.</p>
|
How we can show UIViewController and UIView by using Cocos2d? <p>I am trying to build an iPhone app by using Cocos2d.But i have used four types of classes
like bellow-</p>
<pre><code>@interface MenuScene : Scene {}
@end
@interface FlipView : UIImageView
{
CGPoint startTouchPosition;
NSString *dirString;
U... | <p>If you are asking how to attach UIKit views and such to a cocos2d-iphone project, you just have to do it like:</p>
<pre><code>[[[Director sharedDirector] window] addSubview:myView];
</code></pre>
<p>Updated to cocos 0.7 and now this is:</p>
<pre><code>[[[Director sharedDirector] openGLView] addSubview:myView];
</... |
Simulate build provider in ASP.NET Web Application (.Net 2.0) <p>I am working with .Net 2.0 ASP.NET Web Application.</p>
<p>I am programmatically creating an assembly containing namespace and classes specified within xml file in the web application.
I have created a separate library that does that, I get the assembly ... | <p>The class you are looking for is the Assembly class within the System.Reflection namespace.</p>
<h2>Example</h2>
<pre><code>Assembly.Load(AssemblyPath)
</code></pre>
<p>or</p>
<pre><code>Assembly.LoadFrom(AssemblyPath)
</code></pre>
<p>These methods can be used to load a non-referenced assembly into your app-do... |
Object must be locked to be used? <p>I was pondering language features and I was wondering if the following feature had been implemented in any languages.</p>
<p>A way of declaring that an object may only be accessed within a Mutex. SO for example in java you would only be able to access an object if it was in a synch... | <p>There are two ways to do that.</p>
<p>Your program either refuses to <strong>run</strong> a method unless the protecting mutex is locked by the calling thread (that's a <code>runtime check</code>); or it refuses to <strong>compile</strong> (that's a <code>compile time check</code>).</p>
<p>First way is what <code>... |
MySQL sorting the result using a field of a different table <p>I have 3 tables of the following structure</p>
<pre><code> products
{
pid
pname
plocation...
}
services
{
s_id
s_name
s_location...
}
txn
{
tid
pid...
}
</... | <p>First of all, use parameterized queries instead of building a query string like that. It bothers me.</p>
<p>But it looks like all you're really needing to do is to group by the pid column in the txn table.</p>
<p>Define a view like</p>
<pre><code>SELECT pid, COUNT(tid) tid_count
FROM txn
GROUP BY pid
</code></pre... |
Writing standards for unit testing <p>I plan to introduce a set of standards for writing unit tests into my team. But what to include?</p>
<p>These two posts (<a href="http://stackoverflow.com/questions/155436/unit-test-naming-best-practices">Unit test naming best practices</a> and <a href="http://stackoverflow.com/qu... | <p>Have a look at <a href="http://www.artima.com/weblogs/viewpost.jsp?thread=126923" rel="nofollow">Michael Feathers on what is a unit test</a> (or what makes unit tests bad unit tests)</p>
<p>Have a look at the idea of "Arrange, Act, Assert", i.e. the idea that a test does only three things, in a fixed order:</p>
<... |
Publishing my ASP.NET site ruins the Subversion files <p>I've been trying to use SVN to deploy my asp.net site to production. My workflow is:</p>
<p>Setup:
Publish Site to FolderX,
Import FolderX to SVN,
Update web server production folder with the repository for FolderX.</p>
<p>Everyday:
Publish updated site to Fold... | <p>Well, a couple of things:</p>
<p>First, why does it matter if the .svn folders within the website are ruined? Surely you're not committing FROM your production environment back into SVN? I suspect the problem you're having is later updates. You can solve that particular problem by deleting the entire site before yo... |
Message / confirm dialog <p>I have a need for a confirm message box from a button click, but only on some conditions. I am cheking two values on the aspx.page, and if one is higher than another, I need a confirmation from the user. Are there any ( simple) way of doing this ? I have been reading about javascript and ale... | <p>JavaScript provides what you need with the confirm function. This displays a confirmation box allowing the user to 'OK' or 'Cancel'.
An example function based on what you require:</p>
<pre><code>function FormSubmit(){
var value1 = document.getElementById("Textbox1").value;
var value2 = document.getElementBy... |
How do I use a Checkbox on a form to add a record into a subform in Microsoft Office Access? <p>I have a database for a carpet company. I have a form which enables the user to make a quote, including choosing the customer, etc. There is a also subform dealing with the products and extras, with quantities and unit price... | <p>I think the easiest way is to use an append query.</p>
<pre><code>If Me.Fitting Then
strSQL="INSERT INTO [Order Details] (ProductID,OtherTextField) Values ("
& Me.ProductID & ",'" & Me.OtherTextField & "')"
CurrentDB.Execute strSQL, dbFailOnError
Me.[Subform control name here].For... |
The while language <p>For my theory of computing languages class, we got a homework assignment to implement a piece of code in a language that only has while statements for flow control (no if statements). This is mainly to prove that you can write a Turing-complete language with only a while loop.</p>
<p>For those o... | <p>Here's my code:</p>
<pre><code>continue := True
while d = 0 and continue do
x := 1
continue := False
od
while d != 0 and continue do
x := a/d
continue := False
od
</code></pre>
|
Button image too far from top of button; too close to bottom of button <p>I'm working on a Windows Form in VB.NET 2005 and I would like to have some buttons with images (I'm talking about the plain, vanilla System.Windows.Forms.Button). I have everything set up the way I want it but the images are displaying too low o... | <p>I just encountered a similar problem, which I was able to solve by thinking really hard. (Ain't those situations great?)</p>
<p>First it's important to understand that ImageAlign does NOT mean where on the button do you want the image. It means what point (pixel) on the image should be used for positioning. So if y... |
SQL Server 2005 Reporting Services - Pros and Cons <p>I am developing a web application using ASP .NET 2.0, VS 2008 and SQL Server 2005. I would like to Use SSRS 2005 for the various reports I need to build for this web application. I would like to convince the team that we should adopt SSRS as the main reporting platf... | <p>I know you said 2005, but I will put in notes around 2008 as well.</p>
<p>SRS Pros:<br />
- It is free (provided you have the SQL server license)<br />
- Tight data integration with SQL Server, but it handles anything .NET can (Oracle, ODBC etc...) just fine. (<code>2008 has native support for Terradata too</code>)... |
Load Balancing, Spring Security, ConcurrentSessionFilter <p>I have a Spring 2.5.6/Flex application setup and running with Spring Security 2.0.4. Recently a load balancer (A Foundry ServerIron 4g <a href="http://www.foundrynet.com/products/a...ems/si-4g.html" rel="nofollow">http://www.foundrynet.com/products/a...ems/si-... | <p>Concerning your second problem:</p>
<p>If the ConcurrentSessionFilter stopped working (i.e. does not prevent concurrent sessions anymore), that could be due to clustered application containers with sticky sessions.</p>
<p>In such a setup, each of the cluster's nodes works independently and doesn't share state with... |
Does IEnumerable<TSource> Concat<TSource> preserve the order of elements? <p>Assume two lists, A and B so that A = (1,2,3) and B = (4,5,6). Will A.Concat(B) preserve the order so that the result is (1,2,3,4,5,6)? </p>
| <p>Yes. IEnumerable.Concat will simply turn two list into a single list by attaching one to the end of the other. Order within each list will be preserved.</p>
|
How do I get the Localizable property and support in my own design tool? <h3>Overview</h3>
<p>In another question, I asked about <a href="http://stackoverflow.com/questions/205138/globalizing-runtime-generated-assemblies">deploying localizations for some runtime compiled <code>UserControl</code>'s</a>. However, before... | <p>I'm not sure if I understood your question correctly.</p>
<p>Just check for the <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.localizableattribute.aspx" rel="nofollow">System.ComponentModel.LocalizableAttribute</a> on all properties to (de-)serialize if your control is Localizable.</p>
<pr... |
Adding resource file to VC6 dll <p>I have a number of VC 6.0 projects (dsps) which build into dlls which don't have resource files. Any idea how to add resources into an existing project?</p>
<p>The project is due for a major release shortly and I want to add a fileversion to those dlls currently lacking one. The dlls... | <p>Just add a VERSIONINFO block to the resource file for the DLL. </p>
<p>Open the .rc file, and use "Insert/Resource.../Version" and you'll get a new VERSIONINFO resource with a bunch of defaults. If the project does not already have a resource file, you can add one using "File/New.../Resource Script".</p>
<p>If you... |
SharePoint: Back up single page <p>I need to back up a sharepoint web page which containts web parts and other html tweaks. I would like to keep a back up of the page itself with the web parts in the appropriate places, is this possible? Right now I just opened SharePoint designer, opened my page and saved as to my h... | <p>I do the same for small changes and it has worked fine for me up to now. That said the only offical way to do it is use Microsoft's Data Protection Manager software which will let you backup/restore individual pages.</p>
|
Reporting Services - Rendering to Excel in C# WinForm <p>I have a WinForms application that can call for and display a number of reporting services reports. I can call the </p>
<pre><code>LocalReport.Render("Excel", null, out mimeType, out encoding, out filenameExtension, out streamids, out warnings);
</code></pre>
... | <p>Use the following param for the 2nd parameter. </p>
<pre><code><DeviceInfo><Toolbar>False</Toolbar></DeviceInfo>
</code></pre>
<p>And you need to setup the report with something like:</p>
<pre><code>var MyInfo = MyRS.LoadReport("/" + reportPath, null);
var ReportDeviceInfo = @"<DeviceIn... |
Problem with FTPClient class in java <p>I'm using org.apache.commons.net.ftp.FTPClient and seeing behavior that is, well... perplexing.</p>
<p>The method beneath intends to go through an FTPFile list, read them in and then do something with the contents. That's all working. What is not (really) working is that the FT... | <p>According to the API for <a href="http://commons.apache.org/net/api/org/apache/commons/net/ftp/FTPClient.html#retrieveFileStream(java.lang.String)"><code>FTPClient.retrieveFileStream()</code></a>, the method returns <code>null</code> when it cannot open the data connection, in which case you should check the reply c... |
What are the pros and cons of running IIS as 32bit vs 64bit on a 64bit OS? <p>Possibly better suited for "Rack Overflow", but from a developer's point of view, what are the advantages and disadvantages of running IIS (serving both legacy classic ASP and .NET) as a 32bit process instead of a 64bit process on a 64bit win... | <p>The only perf advantage to running IIS on 64bit vevrsus 32-bit is to allow access to a much larger memory address space. </p>
<p>If you are doing normal ASPX page processing, then it's likely you don't need to address more than 4gb from any single process. Suppose you run in 32-bit mode with a web-garden with mul... |
Is it possible to refresh a CSS sheet with an AJAX postback? <p>I have been learning how to create dynamic images and dynamic stylesheets using ASP.NET 3.5. My reasoning behind this is I have a web page that I want to change the header background image (set with css) automatically. Check below for my test script:</p>... | <p>Since you said you're open to suggestions... why are you set on doing this with the AsyncPostBack and CSS? Why not just have a javascript onclick event to dynamically change the image when you click Button2?</p>
<p>edit (in response to post below):</p>
<p>There would be no post back (if that's what you mean by fl... |
MySQL: SELECT from another server <p>I'm afraid that I already know the answer to my question, but I'll ask it anyway:</p>
<p>When there are two MySQL DB servers, can I access data that is stored on the other server? </p>
<p>In other words: Can I somehow do this:</p>
<pre><code>INSERT INTO table (x, y, z)
SELECT ... | <p>You can set up federated tables in MySQL to accomplish what you're trying to do. There are some limitations.</p>
<p><a href="http://dev.mysql.com/doc/refman/en/federated-storage-engine.html" rel="nofollow">http://dev.mysql.com/doc/refman/en/federated-storage-engine.html</a>
<a href="http://dev.mysql.com/doc/refman/... |
What is the shortest way to implement a proxy or decorator class in c#? <p>When you have a class car that implements IVehicle and you want to wrap it in a decorator that forwards all calls to car and counts them, how would you do it?</p>
<p>In Ruby I could just build a decorator without any methods and use method_miss... | <p>For proxying you could look into "RealProxy" if you want to use standard types, it's a little bit of a hassle to use though (and it requires your classes inherit from MarshalByRefObject).</p>
<pre><code>public class TestProxy<T> : RealProxy where T : class
{
public T Instance { get { return (T)GetTranspar... |
ASP.NET MVC RC ajax onsubmit <p>The problem with onsubmit still continues when I even use preventDefault option. My problem is the same with <a href="http://stackoverflow.com/questions/237691/aspnet-mvc-beta-ajax-upgrade-problem">Asp.net mvc beta ajax problem</a></p>
<pre><code><% using (this.Ajax.BeginForm("den2",... | <p>After some research, I found that was an issue with the RC version of MicrosoftAjax.js</p>
<p>It works fine if I use an older version of this file. Not a solution, but it will help temporarly.</p>
|
Delphi 2009 classes / components to read/write file permissions <p>Does anyone have a set of classes / components that will work with Delphi 2009 (Unicode) to read and write NTFS file permissions?</p>
<p>There was a thing called "NTSet" - but they stopped development at Delphi 2006 about 3 years ago :-(</p>
<p>Any ot... | <p><a href="http://sourceforge.net/projects/jcl/" rel="nofollow">JCL</a> has units to deal with file permissions, and they claim D2009 compatibility.</p>
|
C# Large Tree Iteration <p>I have a large result set assembled in a parent/child relationship. I need to walk the tree and display the results to the user. </p>
<p>I've done this before using recursion, but because my result set may be large, I want to avoid the possibility of receiving a StackOverflowException.</p>... | <p>In the current algorithm you are going for the right child first.</p>
<p>Make it left child first. Thats all.</p>
<p>For example, in your code there may be something like:</p>
<pre><code>node = node.rightChild()
</code></pre>
<p>Change it to</p>
<pre><code>node = node.leftChild()
</code></pre>
<p>This is the g... |
quaternion libraries in C/C++ <p>Any good libraries for <em>quaternion</em> calculations in C/C++ ? </p>
<p>Side note: any good tutorials/examples? I've google it and been to the first few pages but maybe you have have some demos/labs from compsci or math courses you could/would share? </p>
<p>Thanks</p>
| <p>I'm a fan of the Irrlicht quaternion class. It is zlib licensed and is fairly easy to extract from Irrlicht:</p>
<ul>
<li><a href="http://irrlicht.sourceforge.net/docu/classirr_1_1core_1_1quaternion.html">Irrlicht Quaternion Documentation</a></li>
<li><a href="https://irrlicht.svn.sourceforge.net/svnroot/irrlicht/... |
Create XML Nodes based on XPath? <p>Does anyone know of an existing means of creating an XML hierarchy programatically from an XPath expression? </p>
<p>For example if I have an XML fragment such as:</p>
<pre><code><feed>
<entry>
<data></data>
<content></content>... | <p>In the example you present the only thing being created is the attribute ... </p>
<pre><code>XmlElement element = (XmlElement)doc.SelectSingleNode("/feed/entry/content");
if (element != null)
element.SetAttribute("source", "");
</code></pre>
<p>If what you really want is to be able to create the hierarchy wher... |
Callback and asp.net gridview <p>I have a following situation. I have a gridview and I need to dynamically add rows to it. All works fine and dandy. However, lately, I have been curious about making this process faster and more usable. I found a Callback feature in asp.net 2.0.</p>
<p>It seems to make sense for a case... | <p>That's correct -- you can't dynamically add rows to a GridView without a postback. You can add rows to the html on the client side, but they won't be recognized after the next postback.</p>
<p>I generally do what you're describing with just a plain HTML table on the client side using jQuery, and making jQuery aja... |
Converting strings to enum in C++? <p><a href="http://stackoverflow.com/questions/16100/converting-a-string-to-an-enumeration-value-in-c">Strings to enum in C#</a>, how do you normally converting strings to enum in C++. Any helper function that you use, is it a good idea to do this.</p>
| <p>I reviewed this approach awhile ago - available via <a href="http://www.codeproject.com/KB/cpp/EnumBinder.aspx" rel="nofollow">Code Project</a></p>
|
Getting started in Unit Testing as a group in these economic times <p>We have a group of a few developers and some business analysts. We as developers would like to start adding unit testing as part of our coding practices so that we can deliver maintainable and extensible code, especially since we will also be the one... | <p>You need to just start doing it, with or without permission. In the end it will make you more productive and increase your code quality. You can start small by including units for something critical and once you've shown the benefits, you're in.</p>
|
Open a file and write contents to a DIV, span, label, some kind of container <p>Iâd like to be able to open a text/html file and write its contents to a container, either an HTML div or an asp label would be fine.
How do I go about doing this in the C# codefile for the page in question?</p>
| <p>You just want to stream in the file and place the text into the Label.text field:</p>
<pre><code>lable1.text= System.IO.File.ReadAllText( path );
</code></pre>
|
How do you manage your time as a team leader? <p>Where I work, my role has been evolving from a pure development role to team leadership. I find that this suits me, and I'm generally enjoying it.</p>
<p>One aspect of the job that continually vexes me, though, is time management. My day used to be pure coding. Now, I s... | <p>I've found that I have to change my perspective on what my job is.</p>
<p>As an individually-contributing developer, my job was to turn my own time in to software that the business could sell for a profit.</p>
<p>As a team lead, my job is to see that <em>the team</em> effectively turns their time in to software th... |
Java equivalent of unsigned long long? <p>In C++, I enjoyed having access to a 64 bit unsigned integer, via <code>unsigned long long int</code>, or via <code>uint64_t</code>. Now, in Java longs are 64 bits, I know. However, they are signed.</p>
<p>Is there an unsigned long (long) available as a Java primitive? How do ... | <p>Starting Java 8, there is support for unsigned long (unsigned 64 bits). The way you can use it is:</p>
<pre><code>Long l1 = Long.parseUnsignedLong("17916881237904312345");
</code></pre>
<p>To print it, you can not simply print l1, but you have to first:</p>
<pre><code>String l1Str = Long.toUnsignedString(l1)
</co... |
Custom authentication at the URL level, use ISAPI still with .NET or is there a new way? <p>Is there a non-IIS way of authenticating users that is not with HTML?</p>
<p>I know I can create my own ISAPI filter for IIS, but I want to achieve the same thing, with .NET code and not integrate it with IIS.</p>
<p>Is there ... | <p>If you want to apply your custom authentication for all contents, an ISAPI extension is required for IIS 5/6/7.</p>
<p>Greg's way only works for ASP.NET content on IIS 5/6. However, if you understand the Integrated Pipeline feature of IIS 7 well, you can configure an ASP.NET HTTP module like Greg's to apply to all ... |
MS CRM Custom Workflow to access Project Server web service <p>I am trying to create a custom workflow in ms crm 4 so that when a task is completed it will take some of the attributes of the task and add an entry in project server on a timesheet. I am able to access the project server web services (PSI) and create a ti... | <p>In my experience, you're either going to have to deploy those DLL's to the Server\bin directory or merge them with your DLL using something like ILMerge and register it all as one big chunk.</p>
|
How to skip some section of text while speaking using SSML <p>Is there some SSML tags etc, to remove a particular line of text from speaking. Yes, I know I can remove this using string functions, before sending it to the speech synthesizer. But my question is, is there any way to mark or tag some text, so that it won't... | <p>There are so many ways, you should clarify what you want to accomplish.</p>
<p>Maybe one of these will help you:</p>
<pre><code> 1. standard XML comment <!-- -->
2. <sub alias=" "> your text </sub>
3. <audio src='short_silence.wav'> your text </audio>
4. <prosody volume=... |
Virtual COM Ports in Windows - Fax emulator <p>I have a Windows application that utilizes a 3rd-party tool (<a href="http://data-tech.com/products/fax.aspx" rel="nofollow">FaxMan</a>) to send faxes via a COM port attached to the PC. In order to stress test my application I want to create some virtual COM ports that pr... | <p>I worked on this problem for several years, developing a LAN fax product. I doubt you can do it well.</p>
<p>Developing a virtual COM driver means developing a kernel driver (unless you can buy one off the shelf): which is doable (I did it) but I'd guess it's far more trouble than it's worth (I'd be surprised if it... |
How to bind nested objects, or master-detail-binding, in code? <p>I have a three nested classes, Show, Season and Episode, where a show has seasons, and seasons has episodes. </p>
<p>I want to bind two listboxes so that the first lists seasons, and the second lists episodes in that season.</p>
<p>How can I do this? I... | <p>Edit: adding a bit more details.</p>
<p>Ok, so let's say you have a Show object. This has a collection of Seasons. Each Season has a collection of Episodes. You can then have the DataContext for the entire control be the Show object.</p>
<ul>
<li>Bind your TextBlock to the show's Name. Text="{Binding Name"}</li>
<... |
Add authentication to subfolders without creating a web application <p>We have an existing publicly accessible web application with user controls, data access libraries, graphics, etc. We want to create a new secure section of the site that accesses some of the already existing resources.</p>
<p>Initially we created t... | <p>In your web.config file in the root of your site, if you add:</p>
<pre><code><location path="relativePathToDir">
<system.web>
<authorization>
<deny users="?"/>
</authorization>
</system.web>
</location>
</code></pre>
<p>This is working for ... |
What is a good pattern for inexact queries in the Google App Engine Datastore? <p>The Google App Engine Datastore querying language (gql) does not offer inexact operators like "LIKE" or even case insensitivity. One can get around the case sensitive issue by storing a lower-case version of a field. But what if I want ... | <p>Quoting from the documentation:</p>
<p>Tip: Query filters do not have an explicit way to match just part of a string value, but you can fake a prefix match using inequality filters:</p>
<pre><code>db.GqlQuery("SELECT * FROM MyModel WHERE prop >= :1 AND prop < :2", "abc", u"abc" + u"\ufffd")
</code></pre>
<p... |
How to clear file path history from the file explorer? <p>Under Microsoft Vista, the windows file explorer keeps paths and occasionally files in its history. This history can be seen by selecting the pull-down from the box at the top that keeps lists the current directory. I'd like to clear out that list, but I don't s... | <p>Well, even though you say you mean the file explorer and not internet explorer, you are almost on the right track there. If you delete your internet explorer history, it will also delete the file history in the explorer. </p>
<p>Bart</p>
|
WCF Self-hosted service, client clean-up on service stop <p>I'm curious to know how I would go about setting up my service to stop cleanly on the server the service will be installed on. For example when I have many clients connecting and doing operations every minute and I want to shut-down the service for maintenanc... | <p>You just have to call Dispose on the ServiceHost instance that you create. Once you do that, you will not accept any more clients and the service will continue to finish the operations for clients that are already connected.</p>
|
Clojure read-line function problem <p>I'm trying to get console input in my Clojure program, but when it gives me this error when it gets to that part of the program.</p>
<pre><code>Exception in thread "main" java.lang.ClassCastException:
clojure.lang.LineNumberingPushbackReader cannot be cast to java.io.BufferedReade... | <p>Hmm, it seems to work for me. What version of Clojure are you using and how are you calling prompt-read? Here's what I'm getting back (here <code>goo</code> is my response):</p>
<pre><code>user=> (defn prompt-read [prompt]
(print (format "%s: " prompt))
(flush )
(read-line))
#'user/prompt-read
user=> (prompt-... |
How do you draw like a Crayon? <p><a href="http://www.crayonphysics.com/">Crayon Physics Deluxe</a> is a commercial game that came out recently. Watch the video on the main link to get an idea of what I'm talking about.</p>
<p>It allows you to draw shapes and have them react with proper physics. The goal is to move ... | <p>I remember reading (a long time ago) a short description of an algorithm to do so:</p>
<ul>
<li><p>for the general form of the line, you split the segment in two at a random point, and move this point slightly away from it's position (the variation depending on the distance of the point to the extremity). Repeat re... |
ASP.NET: Password Recovery link on a LogIn control requires a user to login <p>I'm trying to test this out on my site but it doesn't quite work because I have to be logged in to go to this page.</p>
<p>Is there a configuration setting that I haven't set or set incorrectly? </p>
<p>EDIT: rm's answer led me to this <a... | <p>adding to Arjan's answer, the settings for page permissions are in your web.config file.</p>
<p>you should do something like this:</p>
<pre><code><configuration>
<location path="YourPage.aspx">
<system.web>
<authorization>
<allow users="?"/>
<... |
How do I change the description of input's displayed for an operation defined using a MXBean <p>I'm using a MXBean to instrument a certain feature, and I have a method that takes in 3 input arguments.</p>
<p>By default, on the jconsole, the arguments are displayed as p1, p2, p3 etc. I have @params describing each para... | <p>Are you using Spring? They have a <a href="http://static.springframework.org/spring/docs/2.5.x/reference/jmx.html" rel="nofollow">module</a> that does what you're describing with <em>@ManagedOperation</em> and <em>ManagedOperationParameter</em> annotations. Otherwise, you're on your own to create the appropriate <... |
Can I use a CSV file like a (MSsql or mysql or BDE database) in C++ Builder? <p>I apologise in advance if this question isn't very specific.</p>
<p>Would it be possible to do the following.</p>
<p><strong>when the application loads</strong></p>
<p>read the contents of a CSV file into a dataset. </p>
<p><strong>whil... | <p>You could load the file into a TClientDataset, operate on the dataset and apply the changes back to a file.</p>
|
Multi-line PL/SQL command with .NET OracleCommand <p>I'm using System.Data.OracleClient.OracleCommand to create a table and fill it out with some data. The query I am using runs OK in PS/SQL Developer, however when I'm trying to execute it from within .NET application I'm getting this error:</p>
<pre><code>ORA-06550: ... | <p>I think you need to lose just the '\r' characters.</p>
|
Help me understand this UI jargon <p>From an <a href="http://www.flashmagazine.com/community/detail/balsamiq_mockups_-_a_solid_case_for_air/" rel="nofollow">interview</a> with <a href="http://www.peldi.com/blog/" rel="nofollow">Peldi Guilizzoni</a>, the creator of <a href="http://www.balsamiq.com/" rel="nofollow">Balsa... | <p>He is doing mock-ups. So for him, each UI Component is basically a rectangle (or other shape) that needs to be drawn and react to input. The input can come from different sources (mouse, keyboard, prepared for multi-touch?), so an Input Manager makes sense. In a mock-up, most components will have the same simple beh... |
How to parse NULL value returned using YUI datasource <p>I am using YUI datatable and datasource to render data in one of my projects. The data returned happens to be NULL and YUI datasource is unable to parse it.</p>
<p>Below is the declaration code of datasource and datatable. For readability sake, I am seperating e... | <p>First make sure that you need parser:YAHOO.util.DataSource.parseString for the fields. I haven't seen your JSON structure. So I cannot comment on this.</p>
<p>Other option is to use a custom formatter. Something like the following snippet will work.</p>
<pre><code>var customFormatter = function(elCell, oRecord, oC... |
AJAX command-line interface in browser <p>I'm building a Web app to allow users to view and manipulate data, particularly numeric and geographic data. It's important that the output be clear and professional (data grids, Google Map overlays, etc.). But in terms of the user interface, I'd rather start with the flexibili... | <p><a href="http://www.goosh.org/" rel="nofollow">goosh</a> is a great example of a command line web application. I had nothing to do with it's creation but I have used parts of it's design for something at work.</p>
|
What are valid characters for a DNS Zone file and how can I sanitize user input? <p>I'm working on an interface to allow our clients to update their DNS on their own.</p>
<p>I have 2 questions: </p>
<ol>
<li>What constitutes valid a valid host and target records? (A, CNAME, MX, TXT) i.e. if the user enters ........ f... | <p>Domain name <em>labels</em> can technically contain any octet value, but <em>usually</em> they only contain alphanumerics and the hyphen and underscore characters. </p>
<p>This comes from recommendations in section 2.3.1 of <a href="http://www.ietf.org/rfc/rfc1035.txt" rel="nofollow">RFC 1035</a>:</p>
<blockquote>... |
What data provider for a tclientdataset using a csv file? <p>I have a tclientdataset. It is used to get data to and from a csv file. The csv file may not exist until the application is run. I have the following code in a tbutton...</p>
<pre><code>ClientDataSet1->FileName = "c:\\testdata.csv";
ClientDataSet1->... | <p>No answers so I'll answer and give an update. I have been able to use the clientdata set succesfully. I needed to create it with clientdataset->createdataset().</p>
<p>But it doesn't generate a CSV file. It generates some other type of file.</p>
<p>If I could get it to generate a CSV file that would be ideal bu... |
How can you list the matches of Vim's search? <p>I would like to list the matches, when I hit:</p>
<pre><code>/example
</code></pre>
<p>so that I see where all matches are at once.</p>
| <pre><code>:g//p
</code></pre>
<p>In its longer form:</p>
<pre><code>:global/regular-expression/print
</code></pre>
<p>You can leave out the pattern/regex and Vim will re-use the previous search term.</p>
<p><em>Trivia:</em> The <a href="https://en.wikipedia.org/wiki/Grep">grep</a> tool was named after this command... |
Python quotient vs remainder <p>The python 2.6 docs state that <code>x % y</code> is defined as the remainder of x / y (<a href="http://docs.python.org/library/stdtypes.html#numeric-types-int-float-long-complex" rel="nofollow">http://docs.python.org/library/stdtypes.html#numeric-types-int-float-long-complex</a>). I am ... | <p>Modulo is performed in the integer context, not fractional (remainders are integers). Therefore:</p>
<pre><code>1 % 1 = 0 (1 times 1 plus 0)
1 % 2 = 1 (2 times 0 plus 1)
1 % 3 = 1 (3 times 0 plus 1)
6 % 3 = 0 (3 times 2 plus 0)
7 % 3 = 1 (3 times 2 plus 1)
8 % 3 = 2 (3 times 2 plus 2)
etc
</code></pre>
... |
CGContext - is there a way to reset the current context <p>In my iPhone project, I've got a UIView where I implement the drawRect method:</p>
<pre><code>- (void)drawRect:(CGRect)rect {
CGContextRef context = UIGraphicsGetCurrentContext();
</code></pre>
<p>Inside the method I do a whole bunch of drawing of lines, ... | <p>You might want to check out CGContextSaveGState(context) and CGContextRestoreGState(context). They will let you push and pop the current state of the context.</p>
<p>If your view is getting 'mangled', check your view's contentMode setting.</p>
|
Better Performance on Associations <p>Right now I have a table called Campaigns that has many Hits, if I call say:</p>
<pre>Campaign.find(30).hits</pre>
Which takes 4 seconds, or 4213 ms.
<br /><br />
If I call this instead:
<pre>
campaign = Campaign.find(30)
campaign.hits.count
</pre>
<p>Does it still load all of th... | <p>How about:</p>
<pre><code>Campaign.find(30).hits.count
</code></pre>
<p>You might also consider adding the following in <code>hit.rb</code> (assuming a one-to-many relationship between campaigns and hits).</p>
<pre><code>belongs_to :campaign, :counter_cache => true
</code></pre>
<p>You then need a column in t... |
Testing IO.Stream interaction <p>I have a method in my business logic layer that accepts a stream, which in the GUI comes from a user uploading a file, and I am interested in which is an appropriate way to test that the method appropriately uses this stream to make decisions.</p>
<pre><code>public Sub Initialize(ByVal... | <p>If you just want a way to pass in a "fake" upload, you could construct a <a href="http://msdn.microsoft.com/en-us/library/system.io.memorystream.aspx" rel="nofollow">MemoryStream</a> in your test harness and pass that in.</p>
|
Optimize Hibernate entities saving? <p>Hi
Is there a way to reduce unnecessary/empty fields in SQL inserts and SQL updates?</p>
<p>For example, I have a single hibernate entity class mapped to a table that has 10 columns. The populating of data is actually done in two phases. When the user submit a request, I will ins... | <p>If you add the annotation:</p>
<pre><code>@org.hibernate.annotations.Entity(dynamicUpdate = true)
</code></pre>
<p>to the top of your entity only the fields that have changed will be sent to the database.</p>
|
Which API to use to draw 3D objects in C#? <p>I'd like to do some 3D programming in C# but I'm not sure where to start looking for an API. If I were doing this in C++ I know the options are OpenGL and DirectX, but I'm not sure what the options are for C#. I don't necessarily want to program a whole game, just manipul... | <p>The out of the box option is WPF. Here's a nice series: <a href="http://www.ericsink.com/wpf3d/index.html">http://www.ericsink.com/wpf3d/index.html</a></p>
|
Exchanging of screens between two users <p>We have a web-based application with tech stack -
1. Java Struts based
2. Hibernate
3. DB - Oracle
4. App server - JBoss server</p>
<p>We are facing an issue related to concurrent usage of the application by two or more users. When I am doing an operation and I submit the cha... | <p>Are you using application context instead of session context? Moreover, as Eed3si9n said, beware of Singletons, that might be causing this.</p>
<p>"In addition check for the use of static fields. One app I was brought in to fix used a static string for error message. As soon as any user received an error they all d... |
What is so evil about a Flash based website? <p>I have the feeling that <a href="http://en.wikipedia.org/wiki/Adobe_Flash">Flash</a>-based ( or <a href="http://en.wikipedia.org/wiki/Microsoft_Silverlight">Silverlight</a>-based) websites are generally frowned upon, except when you are creating games or multimedia-conten... | <p>Flash is infamous for its poor accessibility.</p>
<p>Keyboard navigation does not usually work, and Flash (up until recently) did not have search engine support.</p>
<p>Flash applications does not work in mobile phones and other portable devices.</p>
<p>Flash is not there in the iPhone!!!</p>
<p>Flash is control... |
Stubbing property getter prior to method on the same object - Rhino.Mocks 3.5 <p>I have a possible bug scenario for Rhino.Mocks 3.5 here: <a href="http://groups.google.com/group/RhinoMocks/browse_thread/thread/b38d09b276e66ec7" rel="nofollow">http://groups.google.com/group/RhinoMocks/browse_thread/thread/b38d09b276e66e... | <p>It looks like you've been answered on that thread. Did that help you and if so do you want to close this question?</p>
|
dojo: inheritance with default value - the mixin doesn't happen <p>I wish to declare a new dojo class inheriting from an existing dojo class, but with my own choice of default values for the class's properties. (The user can still override those values.)</p>
<p>I am declaring my own version of the <code>dijit.form.Fi... | <p>Oops! I really had things on their head. I found the right way around. The following works:</p>
<pre><code>dojo.provide("my.FilteringSelect");
dojo.require("dijit.form.FilteringSelect");
dojo.require("dojox.data.QueryReadStore");
dojo.declare(
"my.FilteringSelect",
dijit.form.FilteringSelect,
{
has... |
Accessing crystal reports in an ASP.NET application? <p>I need to access a Crystal Report that is deployed on a Crystal Report server.</p>
<p>I want to display this report on my ASP.NET page. However, I don't want to include the report file in my project. I need to use the report file deployed on crystal report server... | <p>Try </p>
<pre><code>ReportDocument.Load(<filePath>, OpenReportMethod.OpenReportByTempCopy)
</code></pre>
|
The difference between the 'Local System' account and the 'Network Service' account? <p>I have written a Windows service that spawns a separate process. This process creates a COM object. If the service runs under the 'Local System' account everything works fine, but if the service runs under the 'Network Service' acco... | <p>Since there is so much confusion about functionality of standard service accounts, I'll try to give a quick run down.</p>
<p>First the actual accounts:</p>
<ul>
<li><p><a href="http://msdn.microsoft.com/en-us/library/windows/desktop/ms684188%28v=vs.85%29.aspx"><strong>LocalService</strong> account</a> (preferred)<... |
Getting the parent name of a URI/URL from absolute name C# <p>Given an absolute URI/URL, I want to get a URI/URL which doesn't contain the leaf portion. For example: given <a href="http://foo.com/bar/baz.html">http://foo.com/bar/baz.html</a>, I should get <a href="http://foo.com/bar/">http://foo.com/bar/</a>.</p>
<p>T... | <p>Did you try this? Seems simple enough.</p>
<pre><code>Uri parent = new Uri(uri, "..");
</code></pre>
|
How to handle incomplete files? Getting exception <p>I need to create a java program which will create thread to search for a file in particular folder(source folder) and pick the file immediately for process work(convert it into csv file format) once it found the file in the source folder. Problem i am facing now is f... | <p>Tha safest way is to download the file to a different location and then move it to the target folder.</p>
<p>Another variation mentioned by Bombe is to change the file name to some other extension after downloading and look only for files with that extension.</p>
|
Getting table metadata in MySQL <p>I'm trying to find out how to get the following constraint information from a table in MySQL 5.0: </p>
<ul>
<li>primary key</li>
<li>foreign keys and table references</li>
<li>unique columns</li>
</ul>
<p>What is the syntax of the query or queries to do so? I have a feeling I'm clos... | <p>The <a href="http://dev.mysql.com/doc/refman/5.0/en/show-columns.html" title="show columns">SHOW COLUMNS</a> command will show you the primary key and unique columns for a table.</p>
<p>As for foreign keys, you <strong>could</strong> use something like the <a href="http://dev.mysql.com/doc/refman/5.0/en/show-create... |
How can I write to the parallel port from the Windows Command line? <p>How can I write to parallel port through Windows XP command line?</p>
| <p>Looking at your reply to Zoredache, your real problem is not output to the parallel port, that's trivial.</p>
<p>Your real problem is how to get a 0xff character on stdout. This is possible with a trivial <code>.com</code> executable which invokes the relevant soft interrupt, but to be honest it's probably easier ... |
Connection pooling in the MySQL .NET Connector <p>I'm creating a website in asp.net and mysql, I noticed that the performance of connection pooling in the mysql .net connector is horrible to say the least! For example sql server is 10x times faster in connection pooling (the sql server .net provider connecting to sql s... | <p>Make sure that you are using the latest version of MySQL .Net Connector. The current version is 5.2.5. </p>
<p>Also, the Connection String has a property Connection Lifetime (default value 0). You can try changing that value. More information can be found <a href="http://dev.mysql.com/doc/refman/5.1/en/connector-ne... |
ASP.NET MVC - Manipulating HTTP Post <p>When a form is posted back to the server, is it possible to manipulate, change, set the values contained in HTTP Post in the controller action? I would like to remove certain textbox values entered by the user so that these values always have to be re-entered (e.g. password field... | <p>You don't need a custom ModelBinder.</p>
<pre><code> [Bind(Exclude="Foo,Bar")]
public ActionResult Insert(T model)
</code></pre>
<p>Now Foo and Bar are null.</p>
<p>This does what you ask, but I'm not actually sure it's what you meant. :)</p>
<p>My guess is that your action does need to see the password (... |
Java JTree expand only level one nodes <p>With a JTree, assuming the root node is level 0 and there may be up to 5 levels below the root, how can I easily expand all the level 1 nodes so that all level 1 & 2 branches and leafs are visible but levels 3 and below aren't?</p>
| <p>Thanks for the quick response guys. However I have now found the simple solution I was looking for. For some reason I just couldn't see DefaultMutableTreeNode.getLevel() in the JavaDocs! FYI what I'm doing now is:</p>
<pre><code> DefaultMutableTreeNode currentNode = treeTop.getNextNode();
do {
if (c... |
Switching between two UITableViewControllers within a single UINavigationController <p>I have a UINavigationController. In its toolbar is a segmented control with two buttons. Each button relates to its own UITableViewController.</p>
<p>What I'm trying to achieve is someway of wiring up the navigation controller so th... | <p>Would it be possible to just switch the dataSource instead of having to deal with two separate table views? Preserving the scrolling position can still just as easily be done, and you end up using less memory (one table view and two data sources instead of two table views and two data sources).</p>
<p>With only 128... |
Real-time Java interoperability <p>I am wondering how it's the interoperability between JRE6 and the JVM from <a href="http://www.rtsj.org" rel="nofollow">rtsj</a>. It seems that I have to use only their implementation (since the code will be interpreted using their JVM), so I cannot use many of the features that Java ... | <p>In order to provide real-time behavior, the JVM needs to be very specifically engineered. This includes integration at the operating system level to get access to real-time scheduling features of the host OS.</p>
<p>The Sun rea-time JVM is compatible with J2SE5, for instance. <a href="http://java.sun.com/javase/tec... |
WebSphere Portal 6.0 Portlet Error Logging <p>Where I can find the error logs from a portlet deployed to WebSphere Portal 6.0 (Linux)</p>
| <p>You will find logs in SystemOut.log and SystemErr.log </p>
<p>In a default Webpshere Portal 6.0 installation logs (SystemOut.log, SystemErr.log) are located under <code><PortalServer></code>\log\ </p>
<p>The best way to find out the location of these file is to check in the Websphere Administration console.... |
IE7 Ext JS problem: Unspecified JS error on window.close() <p>I am using Ext JS to make a popup window, here is the code:</p>
<pre><code>function popupImage(term, imageNumber){
if(currentPopupWindow!=null){
currentPopupWindow.close();
}
currentPopupWindow = new Ext.Window({
layout... | <p>This is the solution, dumb as it is:</p>
<p>Have the same window creation, then instead of the calls to show and anchor to:</p>
<pre><code> currentPopupWindow.render(document.body);
currentPopupWindow.alignTo(diccon, "tl", [40, 80]);
currentPopupWindow.show(false, function() {
v... |
MySQL - Need help to figure out multiple joins <p>I am using the following query to get the transactions from a table made to and from a user. I then want to retrieve the username for the sender_id and for the recipient_id. However I can only seem to get it for the recipient_id or the sender_id. Anyone have any ideas h... | <p>You need to join twice, thus:</p>
<pre><code>SELECT ta.amount, ta.recipient_id, ta.sender_id, ta.timestamp_insert, sender.name as Sender, recipient.name as Recipient
FROM `transactions` AS ta
JOIN users AS recipient
ON ta.recipient_id=recipient.u_id
JOIN users AS sender
ON t... |
Classic ASP: How to list activated sessions? <p>Is there someway to get a list of activated sessions in classic ASP?</p>
<p>I want to limit the number of simultaneus activated sessions.</p>
| <p>Here is a good article which shows a way to do that: <a href="http://www.aspfree.com/c/a/asp-code/active-user-count-without-global-asa-by-josh-painter/" rel="nofollow">Active User Count Without Global.asa by Josh Painter</a> </p>
<p>I guess you have to change some details, but this is the way you could approach the... |
"scheduledTimerWithTimeInterval:" problem in cocos2d? <p>I am trying to developed a iPhone app by using cocos2d. I using "scheduledTimerWithTimeInterval" for calling a method that called a fixed time interval. But now time interval increases in gradually. for this reason the time is slow in gradually.
here is my code: ... | <p>It looks like every 0.5 seconds you are adding a sprite to some list of sprites. Eventually the list is getting very large and all that data causes your method to take longer than 0.5 seconds to execute. This causes the timer to fire fast as it can, which is not all that fast since its always waiting for your meth... |
Is there an STL and UTF-8 friendly C++ Wrapper for ICU, or other powerful Unicode library <p>I need a good Unicode library for C++. I need:</p>
<ol>
<li>Transformations in a Unicode sensitive way. For example sort all strings in a case insensitive way and get their first characters for index. Convert various Unicode s... | <p>This question was asked quite a long time before by myself. There was no such library.</p>
<p>So I had written C++ friendly <a href="http://lists.boost.org/Archives/boost/2010/03/162952.php" rel="nofollow">Boost.Locale</a> library that wraps ICU.</p>
<ul>
<li>Docs: <a href="http://cppcms.sourceforge.net/boost_loca... |
Transparent control backgrounds on a VB.NET gradient filled form? <p>I'm filling the background of some VB.NET 2005 WinForms form with a nice pretty gradient fill (by overriding the OnPaint event). This works fine but the various labels etc on the form show with a solid background even after I set the BackColor to Colo... | <p>Add a new class to your project and paste the code shown below. Build. Drop the new control from the top of your toolbox onto your form.</p>
<pre><code>Public Class TransparentLabel
Inherits Label
Public Sub New()
Me.SetStyle(ControlStyles.Opaque, True)
Me.SetStyle(ControlStyles.Optimized... |
mySQL large text comparisson performance... best practices? <p>I've got a largish (~1.5M records) table that holds text strings of varying length for which I run queries against looking for matches:</p>
<pre><code>CREATE TABLE IF NOT EXISTS `shingles` (
`id` bigint(20) NOT NULL auto_increment,
`TS` timestamp NOT N... | <p>First: your bigint primary key could be killing you here, it's a very expensive type to try to maintain. 1.5 million records is nowhere near the limit for unsigned int (~4.2 billion). </p>
<p>Using a big int for a primary key is even worse in InnoDB as it stores the PK against each entry in every other index, so th... |
Generic types not equal <p>The code segment below prints out "The types ARE NOT the same.". Why? I am aware of the fact that using <code>interfaceOnMyType.GetGenericTypeDefinition()</code> will solve the problem, but why should I have to do that?</p>
<pre><code>class Program
{
static void Main(string[] args)
... | <pre><code>interfaceOnMyType.GetGenericTypeDefinition()
</code></pre>
<p>returns you the closed constructed type of the interface which is different from the type returned from </p>
<pre><code>typeof(IBar<>)
</code></pre>
<p><a href="http://msdn.microsoft.com/en-us/library/system.type.getgenerictypedefinition.... |
How to get ID when you pass my ID <p>I have a function that gets passed the document object like:</p>
<pre><code>toggle( $('username') );
function Toggle(id)
{
/// ??
}
</code></pre>
<p>How can I get the actual name of the object passed i.e. username?</p>
| <p>If I understand you correctly, can't you:</p>
<pre><code>$(id).attr("id");
</code></pre>
<p>or</p>
<pre><code>$(id).attr("name");
</code></pre>
<p>Or am I mistaken?</p>
|
Relative percentage UI control <p>I need the user to set a number of percentage values which should always add up to 100%. What are standard ways to archieve this? I came up with the following:</p>
<p>1) have a standard slider control for each value you need to set. Moving one slider will automatically adjust all the ... | <p>What about vertical sliders? Like a sound mixer. I think it looks a lot better than a list of 10 horizontal sliders.</p>
<p>Or fixed width bar with several sliders on them, a bit like the gradient control of Photoshop if you know it.</p>
|
"SELECT COUNT(*)" is slow, even with where clause <p>I'm trying to figure out how to optimize a very slow query in MySQL (I didn't design this):</p>
<pre><code>SELECT COUNT(*) FROM change_event me WHERE change_event_id > '1212281603783391';
+----------+
| COUNT(*) |
+----------+
| 3224022 |
+----------+
1 row in s... | <p>InnoDB uses clustered primary keys, so the primary key is stored along with the row in the data pages, not in separate index pages. In order to do a range scan you still have to scan through all of the potentially wide rows in data pages; note that this table contains a TEXT column.</p>
<p>Two things I would try:</... |
Testing in ASP.net MVC Beta 1 <p>I'm wring a unit test for a controller and here is my code.</p>
<pre><code>public void DocumentController_IndexMethod_ShouldReturn_Documents()
{
DocumentsController c = new DocumentsController(_repository);
ViewResult result = (ViewResult)c.Index("1");
Doc... | <p>[TestMethod]
public void DocumentController_IndexMethod_ShouldReturn_Documents()
{
DocumentsController c = new DocumentsController(_repository);</p>
<pre><code> ViewResult result = c.Index("1") as ViewResult;
ViewDataDictionary dictionary = result.ViewData;
DocumentsController.Documents... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.