input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Do you lose functionality when hosting ASP.NET MVC on IIS 6? If so, what? <p>As a dev team, we're looking to switch to asp.net MVC and I've heard rumors about IIS 6 not being able to support all of the MVC functionality. Is this true? Is there any official set of functionality supported in IIS 7 vs IIS 6? Should we ... | <p>You do not loose any functionality of ASP.Net MVC; however, you have one of two options. You can either define an extension on your URL's which will allow you to set up mapping. So for example:</p>
<blockquote>
<p>www.example.com/books/computer/list</p>
</blockquote>
<p>might become:</p>
<blockquote>
<p>www.e... |
How to connect to HTTPS server using Common Access Card <p>I need to write a java program to connect to a HTTPS server (DoD website). The website requires CAC (DoD common access card) authentication. If you access this site via browser, you insert your CAC first, and then enter a PIN.</p>
<p>I need to accomplish the a... | <p>First, you need to install PKCS #11 support. This is some native code that probably came with your card reader that provides a .dll (or .so) that provides a PKCS #11 interface. Other software on the system, like Mozilla products and Sun's PKCS #11 provider, uses this library. (Microsoft products often use a differen... |
Freeing memory in C <p>I'm having problem with this small program:</p>
<p><strong><em>UPDATED (As per some requests, I've included everything here so to make clear what I'm doing. Sorry for it being too long):</em></strong>
<strong>Student.h file:</strong></p>
<pre><code>typedef struct Student {
char *name;
int a... | <p>The question is what do you do when you are finished with a <code>Student</code> or a <code>StudentList</code> and don't need it any more. That's the point where you should call <code>free()</code> for all the allocated things in that structure.</p>
<p>Probably you would want a <code>freeStudents</code> function th... |
localhost and 127.0.0.1 not the same? <p>I have a socket app that passes data between 2 processes. It works fine on a number of computers with the 2 processes running on the same computer. A person in my office visited a government office where they made some unknown changes to her laptop so she could get on their ne... | <p>Check the Hosts file, located here: C:\WINDOWS\system32\drivers\etc</p>
<p>This file is what translates localhost to 127.0.0.1</p>
|
Visual Studio and MySQL <p>I have been using Microsoft Visual Web Developer 2008 Express Edition. Originally, I made a website with a MySQL back-end. Then I discovered the .Net web authentication, and moved to MS Access as I could, with some modification, make the web authentication work (but not all the features). ... | <p><a href="http://www.mysql.com/products/connector/net/" rel="nofollow">You could try MySQL's .NET connector, though it's only a development version</a></p>
|
What to look out for when moving from Visual Studio 2005 to 2008? <p>We're planning on updating our developers from Visual Studio 2005 to 2008. Are there any common "gotchas" to look out for during this move? </p>
<p>My major concern at the moment is that we use WSE 3.0 quite a bit (mostly to consume external .asmx ... | <p>I think the main issue you have to watch out for is upgrading teams. Once you upgrade to a new version of Visual Studio, you will be forced to upgrade your project files as well. Once the upgrade is complete the file will no longer be compatible with previous versions of Visual Studio. This means that you will br... |
How can my C# app test whether the user has "Read" access to a network share? <p>I work on a thick-client app that often runs into "issues" accessing network shares. Before doing any IO with the server, my app tests whether the share (usually of the form \\server\share$) exists. This works fine for detecting those scen... | <p>The easiest way is to just do it (i.e. try to read a file, for example). As Jared mentioned, there is no way to make sure that you will be able to read in the future (network failure, change of permissions, etc).</p>
<p>As far as code goes, you could use the <a href="http://msdn.microsoft.com/en-us/library/system.i... |
ADO.NET Entity Framework, Northwind, and Employee.Orders > 0 <p>So I'm trying to work on a sample app. Trying to dig into ADO.NET Entity Framework. I get an employee back using a method with LINQ like this:</p>
<pre><code> public IList<Employee> FindByLastName(string lastName)
{
IList<Employee&... | <p>Use the <a href="http://msdn.microsoft.com/en-us/library/bb738708.aspx" rel="nofollow">Include</a> method, and you may be better writing the query less linq like:</p>
<pre><code>public IList<Employee> FindByLastName(string lastName)
{
return _ctx.Employees
.Include("Orders")
.Where(emp... |
How do I determine if two convex polygons intersect? <p>Suppose there are a number of convex polygons on a plane, perhaps a map. These polygons can bump up against each other and share an edge, but cannot overlap.</p>
<p><img src="http://i44.tinypic.com/pumpw.jpg" alt="alt text" /></p>
<p>To test if two polygons <st... | <p>You could use <a href="http://web.archive.org/web/20141127210836/http://content.gpwiki.org/index.php/Polygon_Collision" rel="nofollow">this collision algorithm</a>:</p>
<blockquote>
<p>To be able to decide whether two convex polygons are intersecting (touching each other) we can use the Separating Axis Theorem. E... |
Programmatically generate video or animated GIF in Python? <p>I have a series of images that I want to create a video from. Ideally I could specify a frame duration for each frame but a fixed frame rate would be fine too. I'm doing this in wxPython, so I can render to a wxDC or I can save the images to files, like PN... | <p>As of June 2009 the originally cited blog post has a method to create animated GIFs <a href="http://www.somethinkodd.com/oddthinking/2005/12/06/python-imaging-library-pil-and-animated-gifs/#comment-197921" rel="nofollow">in the comments</a>. Download the script <a href="https://pypi.python.org/pypi/images2gif" rel=... |
how to catch error in JQuery's load() method <p>i'm using Jquery's load() method for reterive some data when user click on button.
Then show the result in . It is ok.</p>
<p>But the problem is i don't know how to catch error in load() when error occure while data reteriving.</p>
<p>Please help me. </p>
<p>Thanks</p>... | <p><a href="http://docs.jquery.com/Ajax/load">load() documentation.</a></p>
<p>Just a little background on how a load error happens...</p>
<pre><code>$("body").load("/someotherpath/feedsx.pxhp", {limit: 25},
function (responseText, textStatus, req) {
if (textStatus == "error") {
return "oh noes... |
Should network packet payload data be aligned on proper boundries? <p>If you have the following class as a network packet payload:</p>
<p>class Payload
{
char field0;
int field1;
char field2;
int field3;
};</p>
<p>Does using a class like Payload leave the recipient of the data susceptible to alignment ... | <p>Correct, blindly ignoring alignment can cause problems. Even on the same operating system if 2 components were compiled with different compilers or different compiler versions. </p>
<p>It is better to...<br />
1) Pass your data through some sort of serialization process.<br />
2) Or pass each of your primitives in... |
best practices with code or lookup tables <p>[UPDATE] Chosen approach is below, as a response to this question</p>
<p>Hi, </p>
<p>I' ve been looking around in this subject but I can't really find what I'm looking for...</p>
<p>With Code tables I mean: stuff like 'maritial status', gender, specific legal or social st... | <p>Using database driven code tables can very useful. You can do things like define the life of the data (using begin and end dates), add data to the table in real time so you don't have to deploy code, and you can allow users (with the right privileges of course) add data through admin screens.</p>
<p>I would recomm... |
How to convert UTM coordinates to Latitude and Longitude? <h3>Duplicates:</h3>
<ul>
<li><a href="http://stackoverflow.com/questions/609379/">How do I convert coordinates to a Latitude & Longitude?</a></li>
<li><a href="http://stackoverflow.com/questions/343865/">How to convert from UTM to LatLng in python or Javas... | <p>You need a map projection library to do this.</p>
<p>There are many libraries available that are open source. One of the most complete is <a href="http://trac.osgeo.org/proj/" rel="nofollow">PROJ.4</a>.</p>
<p>It is wrapped and used internally by many simpler libraries, such as <a href="http://gdal.org/" rel="nof... |
Disable ECO In Delphi <p>How i can disable ECO in delphi .Net?</p>
| <p>Export these two registry branches to a text file so you can reenable ECO later if required.</p>
<pre><code>HKCU\Software\Borland\BDS\4.0\Known IDE Packages\DelphiDotNet
HKCU\Software\Borland\BDS\4.0\Known IDE Packages\CSharp
</code></pre>
<p>Inside those two branches you'll find keys called</p>
<pre><code>$(BD... |
Inheritance and Overriding __init__ in python <p>I was reading 'Dive Into Python' and in the chapter on classes it gives this example:</p>
<pre><code>class FileInfo(UserDict):
"store file metadata"
def __init__(self, filename=None):
UserDict.__init__(self)
self["name"] = filename
</code></pre>
... | <p>The book is a bit dated with respect to subclass-superclass calling. It's also a little dated with respect to subclass built-in classes.</p>
<p>It looks like this nowadays.</p>
<pre><code>class FileInfo(dict):
"""store file metadata"""
def __init__(self, filename=None):
super( FileInfo, self ).__i... |
Why can't my Perl script load a module when run by cron? <p>I have a bunch of Perl scripts that all run fine, yet need to have <code>use Plibdata;</code> up top.</p>
<p>I set up a cron job that runs (I get the confirmation email from root) and it spits back the following error message:</p>
<pre><code>Can't locate Pli... | <p>You don't say what Plibdata is. You also don't state if this works at your command prompt. I assume that it does.</p>
<p>Try this:</p>
<pre><code>perl -MPlibdata -e 1
</code></pre>
<p>Assuming that doesn't spit the same error, try this:</p>
<pre><code>perl -MPlibdata -le 'print $INC{"Plibdata.pm"}'
</code></pr... |
Is there a way to determine if a user is using broadband or dial-up <p>We have a requirement from a customer to provide a "lite" version for dial-up and all the bells-and-whistles for a broadband user.</p>
<p>The solution will use Flex / Flash / Java EJB and some jsp.</p>
<p>Is there a way for the web server to disti... | <p>You don't care about the user's connection type, you care about the download <em>speed</em>.</p>
<p>Have a tiny flash app that downloads the rest the of the flash, and times how long it takes. Or an HTML page that times how long an Ajax download takes.</p>
<p>If the download of the rich-featured app takes too long... |
Microsoft AJAX partial post back, is using webservice best pracitce? <p>i am really confused here, as i read many places, Update panel makes a full post back, and i have somehow understood that web serivces are much much better for performance, so if i am developing my site should i user web services or normal function... | <p>web services get you around the whole viewstate mess for one.<br />
But yes, I consider using web services as a best practice for getting the most bang for your buck in the web world.</p>
<p>Avoid Post back/Call back whenever you can.</p>
<p>Pitfalls: when creating a web service, you have to pass all of the data y... |
iPhone app developed by me and submitted by client? <p>I am finishing an app for my client.
He wants to submit it to Apple himself.</p>
<p>What must I do ?</p>
<p>Should I give him the app unsigned ?
Should I ask him a provisioning profile ?
Should I be added to his team and to his Distribution Profile ?</p>
<p>Than... | <p>Have your client sign up for the iPhone Developer Program so that way when your client submits the app to the App Store it will be under the client's company name. You can still manage all the code signing and provisioning for your client if they do not know how to do this stuff. The client can simply give u acces... |
How do I control the order of appearance in PHP? <p>I currently have a page setup like this:</p>
<pre><code>PHP Variable Declarations
HTML header, then a form to submit GET query
The PHP that processes some stuff based on the GET data
a bit of JavaScript that makes a pretty graph from the retrieved, processed data
</c... | <p>I'd personally use php for this (but I'm rubbish at JS...so I'm biased...=) )</p>
<pre><code><?php
$formSubmitted = $_POST['formSubmitted'];
if (!isset($formSubmitted)) { ?>
<form method="post" enctype="form/multipart" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<input name="fo... |
3d Camera Position given some points <p>Heyo,</p>
<p>I'm currently working on a project where I need to place the camera such that the full motion of a character would be viewable without moving the camera. I have the position where the character starts, as well as the maximum distance that the character will travel i... | <p>If you make a bounding sphere of the points, all you need to do is keep the camera at a distance greater than or equal to the radius of the bounding sphere / sin(FOV/2).</p>
<p>For example, if you have a bounding sphere with radius Radius, and a specified Field of View FOV, your camera just needs to be at a point "... |
Ensuring thread synchronization in SQL possible? <p>If I have several SPs</p>
<pre>
SP1
SP2
some_inline_queries
</pre>
<p>how do I ensure that they are all run at once without interruption from other threads?
Is it possible to do this from SQL Server level?</p>
<p>edit:</p>
<p>Let's say we have a main script with ... | <p>are you running them inside a transaction? Not sure what you mean by "interruption" but they would be safe assuming that they are within a:</p>
<pre><code>Begin Transaction MyTranNameHere
exec sp1
exec sp2
some statement
Commit Transaction MyTranNameHere
</code></pre>
|
Jquery and frames <p>I am currently working on a web application that has been created using a magnitude of frames that stretch down up to 5 times, The issue is that i need to preform some jquery magic throughout the website.</p>
<p>What would be the best way to go about this (other than rewriting it which i have cons... | <p>This is what you want:</p>
<p><a href="http://ideamill.synaptrixgroup.com/?p=6" rel="nofollow">$.frameReady()</a></p>
<blockquote>
<p>frameReady lets you run jQuery
commands in a target frame as if it
were in the local document. It works
much like the $(document).ready()
function, waiting until the DOM i... |
Python: Read a file (from an external server) <p>Can you tell me how to code a Python script which reads a file from an external server? I look for something similar to PHP's file_get_contents() or file() function.</p>
<p>It would be great if someone could post the entire code for such a script.</p>
<p>Thanks in adva... | <p>The entire script is:</p>
<pre><code>import urllib
content = urllib.urlopen('http://www.google.com/').read()
</code></pre>
|
Help with Google App Engine query and datetime <p>I use the following data:</p>
<pre><code>date latitude route name longitude
2009-04-11 00:50:31.640000 40.80708 White Loop 86 -77.85891
2009-04-11 00:50:27.718000 40.80708 White Loop 86 -77.85891
2009-04-11 00:50:01.562000 40.80708 W... | <p>In SQL you could do all sorts of fancy things, but Google API is rather limited.</p>
<p>Given that you want all records to be no more than 1 minute old, I'd just ask the database for all records less than 1 minute old, and then have python collate the results and reject the duplicate rows.</p>
<p>From the data you... |
Is there a way to require that an argument provided to a method is not null? <p>Is there a better way to require that an argument is not null in a method? I keep checking if any of the arguments that my method requires are null, as show below. But I'm wondering if there is a better way.</p>
<pre><code>public void MyMe... | <p>There is no other better way. This is the way a ton of Microsoft libraries handle the situation.</p>
<p>You can always use an extension method to make it a little clearer.</p>
<pre><code>static IsNullArgument(this Object o, string arg)
{
if (o == null)
throw ArgumentNullException(arg);
}
</code></pre>
|
Entity Framework - Default Child Objects <p>Is there a way to set default child entities for a new entity without having to query all of them using ObjectQueries?</p>
| <p>Sort of. You can set the EntityKey directly. This means you will not be able to access the value of the child entity, but sometimes you don't need to do that. There is information about doing this in <a href="http://blogs.msdn.com/alexj/archive/2009/03/25/tip-7-faking-foreign-key-properties-in-net-3-5-sp1.aspx" rel=... |
How/where to store enterprise configuration settings? <p>My company has a large customer that has many regions/sites/offices. Each location can have its own set of servers with its own data. The users of the system are centrally administered thru a domain. The computers in this network are locked down with only http ac... | <p>If your customer uses active directory already, then you can use a logon script to download the master configuration files they might need.</p>
<p>This would only occur when they login while connected to the domain so your connectivity requirement is met, and since it'd only be downloaded at that time all your clie... |
Loop through list in a thread continually as it receives new elements <p>I'm really not sure how to approach this, but I am subscribing to events fired within a custom class and ideally I wish to queue them and handle them first in first out as they come in. I am aware of <code>Queue<T></code> and I think I shou... | <p>This is a classic producer/consumer problem. A quick web search reveals <a href="http://msdn.microsoft.com/en-us/library/yy12yx1f%28VS.80,loband%29.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/yy12yx1f(VS.80,loband).aspx</a>, which covers this exactly.</p>
<p>You don't want to do a while(true) loop... |
Storing references to DOM elements <p>In a particular script I'm writing, I have a number of objects which are linked to some DOM Elements. Given that each element has a unique id, should each object keep just the element's id (and use document.getElementById each time), or store the element in a property?</p>
<p>Here... | <p>I would store the element; it tends to make code clearer when you're not calling document.getElementById all the time, and though in your case you may not need to change IDs or allow elements without IDs, it's pretty common to want to do so.</p>
<p>(Unlike apphacker I wouldn't expect <em>huge</em> efficiency improv... |
List top 5(most collected) species <p>List top 5 species(spID, common_name, number_collected) found at 'Karkato'(this is a location_name)</p>
<p>The following tables are given:<pre>
species(<strong>spID</strong>, genus, species, common_name)
Field_location(<strong>locID</strong>, location_name, latitude, type)
specime... | <pre><code>select distinct species.spID
,species.common_name
,count(specimen.spID) as number_collected
from species
,field_location
,specimen
where species.spID = specimen.spID
and field_location.locID = specimen.locID
and field_location.location_name = 'Karkato'
order by number_collected desc
limit 5
</code></pr... |
What is the actual differences between I18n/L10n/G11n and specifically what does each mean for development? <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/506743/localization-and-internationalization-whats-the-difference">Localization and internationalization, w... | <p>Here's an article from the W3C: <a href="http://www.w3.org/International/questions/qa-i18n">Localization vs. Internationalization</a></p>
<p>The short answer from them seems to be: </p>
<blockquote>
<p>Localization refers to the <strong>adaptation</strong>
of a product, application or document
content to mee... |
Finding and displaying duplicates <p>I have a table. I'd like to search within this table for duplicate titles.<br />
Lets say my data is as follows: </p>
<blockquote>
<p>title1, title2, title3, title1, title4, title2, title9</p>
</blockquote>
<p>I'd like for my query to search this table and output only the dupl... | <p>Here's one way to do it with a subquery. It might make sense to load the subquery into a temp table first. (This would work in SQL server, not sure what the exact MySql syntax would be.)</p>
<pre><code>select id, title, artist_id
from sm019_songs
where title in
(
SELECT title
FROM sm019_songs
GROUP BY... |
Sifr and Javascript changing stylesheets (without a page refresh) <p>I'm currently playing around with Sifr on my site. Basically I have some coloured blocks at the top of my page, which will change the stylesheets through javascript, depending on the colours you chose. I would like to know how I can get the Sifr h1/h2... | <p>Given sIFR 3, it is possible to change some of the CSS used to render the text.</p>
<p>I'm assuming you have two replacements, for <code>h1</code> and <code>h2</code>, and we're only changing their color:</p>
<pre><code>function changeColor(hexValue) {
var css = '.sIFR-root { color: ' + hexValue + '; }';
for (... |
How to generate random password, or temporary URL, for resetting password in Zend Framework? <p>I have a basic authentication process that uses <code>Zend_Auth_Adapter_DbTable</code>. I have login and logout actions on my Authentication Controller. Now I want to create a function to reset forgotten passwords by automat... | <p>Zend Framework does not have a password-generating class. Here's an article on how to use the PEAR module <code>Text_Password</code> to generate a password:
<a href="https://web.archive.org/web/1/http://blogs.techrepublic%2ecom%2ecom/howdoi/?p=118" rel="nofollow">https://web.archive.org/web/1/http://blogs.techrepub... |
Serialization in C# with a derived class <p>I'm building a notification framework and for that I'm serializing and deserializing a basic class, from which all the classes I want to send will derive.</p>
<p>The problem is that the code compiles, but when I actually try to serialize this basic class I get an error sayin... | <p>put [Serializable] at the top of the class. Serializable isn't necessarily inherited either AFAIK. meaning even if the base class has [Serializable], you still need it on the descendent class.</p>
|
Prepending and animating text loaded via AJAX with jQuery <p>Old hand with Prototype, new to jQuery, and writing a simple app to get a feel for the framework (and because I want to use it). I've got an HTML fragment that I load via AJAX, and I want to stick this at the top of a <code>div</code>, with a slide-in transi... | <p>Try something like this...</p>
<pre><code>$('#div').load('file.html').fadeIn("slow");
</code></pre>
<p>The load function is better suited to your needs, as it's main purpose is to load HTML from a remote file and inject it into the DOM. </p>
<p>Using the "post" function is better for loading a remote page using a... |
What is the purpose of the sub-interpreter API in CPython? <p>I'm unclear on why the sub-interpreter API exists and why it's used in modules such as the mod_wsgi apache module. Is it mainly used for creating a security sandbox for different applications running within the same process, or is it a way to allow concurre... | <p>I imagine the purpose is to create separate python execution environments. For instance, <a href="https://code.google.com/p/modwsgi/">mod_wsgi</a> (Apache Python module) hosts a single python interpreter and then hosts multiple applications within sub-interpreters (in the default configuration).</p>
<p>Some key poi... |
Controller ModelState with ModelStateWrappper <p>HI, to all, i am use Structure Map to implement dependency-injection. I created ModelStateWrapper class to send Model state in service layer, which in constructor get reference to ModelState of controller. In bootswrapper i registered my type:</p>
<pre><code>ForRequeste... | <p>You need to provide more information, but this is my best guess as to what you have:</p>
<pre><code>public class ModelStateWrapper : IValidationDictionary
{
...
private readonly ModelState _modelState;
public ModelStateWrapper(ModelState modelState)
{
_modelState = modelState;
}
... |
How do I detect that an object is a generic collection, and what types it contains? <p>I have a string serialization utility that takes a variable of (almost) any type and converts it into a string. Thus, for example, according to my convention, an integer value of 123 would be serialized as "i:3:123" (i=integer; 3=le... | <p>Use the Type to gather the required information.</p>
<p>For generic objects, call GetType() to get their type and then check <code>IsGenericType</code> to find out if it is generic at all. If it is, you can get the generic type definition, which can be compared for instance like this: <code>typeof(List<>)==yo... |
How to share image data between applications? <p>I already have an application called "old" which renders an image in which the image data is stored in form of session, and I need to read that data from this existing "old" application to an application called "new".</p>
<p>How do I pass this data? Do I need to get the... | <p>You have quite a few options to communicating between two processes</p>
<ul>
<li>Save the data to a file and read if from the other application</li>
<li>Use a <a href="http://msdn.microsoft.com/en-us/library/aa365590%28VS.85%29.aspx" rel="nofollow">named pipe</a> to establish a connection</li>
<li>Use a <a href="ht... |
Convert from Datetime.ToFileTime() to DateTime object <p>How to convert from <code>DateTime.ToFileTime()</code> back to a <code>DateTime</code> object?</p>
| <p>I guess DateTime.FromFileTime()</p>
|
Cakephp Tagging - Auto Save new Tags and Tag Relations <p>I read a lot about tagging in CakePHP but I can't find a "clean" way to save a Post and the Tags to this post. I have all which is necessary the Post Table, Model and Controller, the Tag table, Model and Controller and the posts_tags table. I created the HABTM A... | <p>I find it very hard to believe that you didn't find a "proper" way to handle HABTM. There are many, many articles about it. I believe that Cake <em>will</em> save your tags if you set your data array properly. A quick search on The Bakery:</p>
<p><a href="http://bakery.cakephp.org/articles/search/3/HABTM" rel="nofo... |
JasperReports plugin for Grails: Getting "No such report spec" Exception <p>I am testing the jaspergrails plugin for Grails.
I am following the tutorial for this plugin. I've created a trivial
jasper report and I've put it under web-app\plugins\jasper-0.9.5\reports\all-races.jasper</p>
<p>I am getting an exception</p>... | <p>Try to put the .jasper file under <code>web-app/reports/</code> instead.</p>
|
Customizing UISlider look <p>To customize the visual look of a UISlider you can set the thumb and track images. Part of the track images gets stretched to the appropriate with. From the documentation:</p>
<blockquote>
<p>A stretchable region sits between two
end cap regions. The end caps define
the portions of t... | <p>Just use transparent images as track images, and put a UIImageView below :) </p>
|
Enterprise, Systems and Application Architecture (Best Practise?) <p>I am currently tasked with creating a documented, consistent Architecture guide for software development. We have a lot of smart people doing the right things, but just not consistently and repeatably.</p>
<p>We are using Microsoftâs Application Ar... | <p>I submitted the question a couple of days ago, but by continued research and after reading <a href="http://stackoverflow.com/users/962/littlegeek">littlegeek</a>'s reponse, I think I have found an interesting white paper that I found very informative and interesting. </p>
<p>Read: <a href="http://msdn.microsoft.com... |
Best practice in CakePHP for saving data, using models in component <p>I'm writing a Cake component and it seems to make sense that I use it for saving data rather than doing so in a controller. In the manual it says using models in a component is discouraged, but the other way of doing it would mean I'd be repeating c... | <p>If the component <em>analyses a load of data from various sources</em>, it can probably be written as a behaviour.</p>
<p>If not, and you have no other choice but to use a model in your component, be sure to do it properly:</p>
<pre><code>$this->ModelName = ClassRegistry::init('ModelName');
</code></pre>
<p>I ... |
GC.COllect() doesnt seem to work in debug mode <p>I am running the code below and the result is totally different when it runs in Release mode. While in Debug mode, it never collects the object of class A and in Reaelse mode it immediately collects the object of class A.</p>
<p>Can someone explain why.</p>
<pre><code... | <p>In Debug mode, the compiler does not optimize the local variables. Therefore, the reference to A still exists. In Release mode, the compiler optimized the usage so that the reference is thrown away and the object can be collected.</p>
|
RequiredFieldvalidator <p>how to use required field validator for dropdownlist?.</p>
<p>my dropdown list having</p>
<p>-Day-</p>
<p>item1</p>
<p>item2</p>
| <p>Use InitialValue property as the default item that you don't want to be selected : </p>
<pre><code><asp:DropDownList ID="ddlItems" runat="server">
<asp:ListItem Text="-Day-" Value="-Day-"></asp:ListItem>
<asp:ListItem Text="Item 1" Value="Item 1"></asp:ListItem>
<asp:Lis... |
Restrictions on Table Names <p>Are there any restrictions on the names of tables, or issues with certain names when working with SubSonic?
I have table called 'Activity' and SubSonic doesn't seem to recognise it. When it was called 'Activities' it worked fine.</p>
<p>Basically I am wanting to go with singular table na... | <p>Generally, reserved words in C# are not allowed as table names. I'm not sure why Activity would be a problem though. The first thing to check when a table is not generated is that the table has a primary key.</p>
|
Hebrew chars in email sent with JavaMail appears as question marks <p>What can be done?</p>
| <p>Are you setting the character encoding correctly?</p>
<p>try this: </p>
<pre><code>mimemessage.setText(s6,"utf-8");
</code></pre>
<p>you may need utf-16, cant remember what char set hebrew is on off the top of my head.</p>
<p>try here <a href="http://www.i18nguy.com/unicode/codepages.html" rel="nofollow">http://... |
capturing webform event for workflow on asp.net site <p>The basic idea is that I have a website and a workflow. I need to capture button clicks from aspx pages in my workflow. </p>
<p>I have a solution with a worflow project and a website project, and the web.config and global.asax have been set up to work with WF. Pe... | <p>I presume you are running a workflow per user session. If so you need to store the workflow instanceiId somewhere you can get to it. So either put it in a cookie or in the Session object. I prefer the cookie because it works even when the session times out or the AppDomain is recycled by IIS.</p>
<p>Next you need t... |
Are Delphi strings immutable? <p>As far as I know, strings are immutable in Delphi. I kind of understand that means if you do:</p>
<pre><code>string1 := 'Hello';
string1 := string1 + " World";
</code></pre>
<p>first string is destroyed and you get a reference to a new string "Hello World".</p>
<p>But what happens if... | <p>Delphi strings are copy on write. If you modify a string (without using pointer tricks or similar techniques to fool the compiler), no other references to the same string will be affected.</p>
<p>Delphi strings are not interned. If you create the same string from two separate sections of code, they will not share t... |
Load DataTable Using Linq - Convert C# to VB.Net <p>I found the following example on <a href="http://www.erictobia.com/2009/02/21/LoadADataTableWithLINQ.aspx" rel="nofollow">http://www.erictobia.com/2009/02/21/LoadADataTableWithLINQ.aspx
</a> Unfortunately, I need it in VB and it's using some constructs that neither I... | <p>Looks to me to be case of using LINQ for the sake of using LINQ.</p>
<p>Just for each context.Persons </p>
<pre><code>For Each p As Person In context.Persons
ds.Person.AddPersonRow(p.Id, p.FirstName, p.LastName)
Next
</code></pre>
|
How to retrieve field names from temporary table (SQL Server 2008) <p>I'm using SQL Server 2008. Say I create a temporary table like this one:</p>
<pre><code>create table #MyTempTable (col1 int,col2 varchar(10))
</code></pre>
<p>How can I retrieve the list of fields dynamically? I would like to see something like thi... | <pre><code>select * from tempdb.sys.columns where object_id =
object_id('tempdb..#mytemptable');
</code></pre>
|
Ant (or NAnt) in Lisp <p>In his article <a href="http://www.defmacro.org/ramblings/lisp.html" rel="nofollow" title="The Nature of Lisp">The Nature of Lisp</a>, Slava Akhmechet introduces people to lisp by using Ant/NAnt as an example. Is there an implementation of Ant/NAnt in lisp? Where you can use actual lisp code,... | <p><strong>Ant</strong> is a program that interprets commands written in some XML language. You can, as justinhj mentioned in his answer use some XML parser (like the mentioned XMLisp) and convert the XML description in some kind of Lisp data and then write additional code in Lisp. You need to reimplement also some of ... |
pylint warning on 'except Exception:' <p>For a block like this:</p>
<pre><code>try:
#some stuff
except Exception:
pass
</code></pre>
<p>pylint raises warning W0703 'Catch "Exception"'. Why?</p>
| <p>It's considered good practice to not normally catch the root Exception object, but instead to catch more specific ones - for example IOException.</p>
<p>Consider if an out of memory exception occurred - simply using "pass" isn't going to leave your programme in a good state.</p>
<p>Pretty much the only time you sh... |
Calling a modal popup with TargetControl in another UpdatePanel in ASP.NET <p>I'm trying to call a Modal Popup, but the TargetControl is in a different UpdatePanel than where the ModalPopupExtender resides.</p>
<p>Here's the code:</p>
<pre><code><asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditi... | <p>Move the extender to the first update panel:</p>
<pre><code> <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:LinkButton ID="LinkButton1" runat="server">LinkButton</asp:LinkButton>
<ajaxToolkit:ModalPopupExte... |
T-SQL procedure giving a boolean result <p>I'm struggling with a T-SQL procedure and I am hoping you can help.</p>
<p>I need to know if </p>
<ol>
<li>A row exists in a table for a given ID</li>
<li>If one (or more) does exist then the latest one has another ID set to 5.</li>
</ol>
<p>So the first table we need to ge... | <p>I think this query will do what you are looking for; Note that your existing query has a bug in that if more than one case exists it will only check if whatever case happened to be selected by the initial query is closed (of course that is only true if it is possible to have more than one Case assigned to a particul... |
Procedure pointers in RPGLE (PROCPTR) <p>Can anyone provide any interesting usage examples of these?</p>
| <p>jjujuma,</p>
<p>For a trivial example you could use this to implement some Object Oriented style procedure like Draw. You'd call a Circle_Draw procedure for a Circle or a Square_Draw procedure for a Square by assigning the appropriate %PADDR of the Circle_Draw or Square_Draw to your Draw procedure pointer. When ... |
Striped table rows in ASP.NET MVC (without using jQuery or equivalent) <p>When using an ASP.NET WebForms <a href="http://msdn.microsoft.com/en-us/library/bb398790.aspx">ListView control</a> to display data in an HTML table I use the following technique in to "stripe" the table rows:</p>
<pre><code><ItemTemplate>... | <p>Another option that doesn't involve lambdas and is a bit cleaner than what you got working might be this...</p>
<pre><code><% int i=0; foreach (var item in Model) { %>
<tr class="<%= i++ % 2 == 0 ? "alternate" : "" %>">
<td>
<%= Html.Encode(item.Title) %>
... |
Storing multiple employee IDs in one column of data <p>Web app is being written in classic ASP with a MSSQL backend. On this particular page, the admin can select 1 or any/all of the employees to assign the project to. I'm trying to figure out a simple way to store the employee IDs of the people assigned to it in one c... | <p><strong>Don't store multiple ID's in one column!</strong> Create another table with the primary key of your existing table and a single ID that you want to store. You can then insert multiple rows into this new table, creating a 1:m (one to many) relationship. For example, let's look at an order table:</p>
<pre><co... |
ColdFusion auto select option <p>What is the best way to automatically set a selected item for a select/option element on post-back? Here's the way we're currently doing it:</p>
<pre><code><select id="grade" name="grade">
<option value="A"<cfif form.grade = 'A'> selected="selected"</cfif>>A&l... | <p>In my opinion, one of the best ways to go is to use a CFSelect:</p>
<pre><code><cfquery name="getGrades" datasource="#application.dsn#">
select gradeLetter from Grades
</cfquery>
<cfselect
name="grade"
query="getGrades"
display="gradeLetter"
value="gradeLetter"
selected="#form.grade#" /&... |
How do I convert a decimal fraction to binary in Java? <p>I need to convert 0.5 in base 10 to base 2 (0.1).
I have tried using </p>
<pre><code>Double.doubleToRawLongBits(0.5)
</code></pre>
<p>and it returns <code>4602678819172646912</code> which I guess is in hex, but it does not make sense to me.</p>
| <p>No. 4602678819172646912 is in dec, hex is 0x3fe0000000000000. To dismantle that:</p>
<pre><code> 3 | F | E | 0 ...
0 0 1 1 1 1 1 1 1 1 1 0 0 ...
s| exponent | mantissa
</code></pre>
<p>s is the sign bit, exponent is the exponent shifted by 2^9 (hence this exponent means -1), mantissa is the ... |
How, with jQuery do I tell if a website visitor has been to the site before? <p>I want create a div container with a message for first time visitors to my site. Visitors will read it and click a 'Hide' button to dissapear it forever.</p>
<p>How is this done?</p>
| <p>What about using the <a href="http://plugins.jquery.com/project/Cookie" rel="nofollow">Cookie plugin</a> for jQuery?</p>
<pre><code>$.cookie('the_cookie', 'the_value'); // Create a session cookie ("the_cookie") and set its value to "the_value"
$.cookie('chocolate_chip_cookie', 'the_value', { // create a cookie with... |
Adding a column efficently in SQL Server <p>I want to add an integer column to a table with a large number of rows and many indexes (Its a data warehouse Fact Table).</p>
<p>To keep the row width as narrow as possible all the columns in this table are defined as not null. So I want the new column to be not null with a... | <p>It will require updating the clustered index, yes - this <strong>IS</strong> the table data, after all.</p>
<p>But I don't see why any of the non-clustered indices would have to updated - your new column won't be member of any of the non-clustered indices.</p>
<p>Also, I don't see how dropping and recreating the i... |
How to display a list of nodes and details of a single node in Drupal <p>I would like a page that displays a list of nodes (I can do this part with the Views module) and then also displays the details of a single node below the list. Ideally the details will update via Ajax when a node in the list is clicked, but reloa... | <p>The canonical solution for this is to use a block in the "content top region" and the full node in content region.</p>
<p>The most basic way of achieving this is to simply display the node page normally and, with a theme having the content top region (Garland doesn't, Zen classic does), create a Views block contain... |
Multiple Tuple to Two-Pair Tuple in Python? <p>What is the nicest way of splitting this:</p>
<pre><code>tuple = ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h')
</code></pre>
<p>into this:</p>
<pre><code>tuples = [('a', 'b'), ('c', 'd'), ('e', 'f'), ('g', 'h')]
</code></pre>
<p>Assuming that the input always has an even nu... | <p><code>zip()</code> is your friend:</p>
<pre><code>t = ('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h')
zip(t[::2], t[1::2])
</code></pre>
|
How do you use Binary conversion in Python/Bash/AWK? <p>I am new in binary conversion.
I use Python, Bash and AWK daily.</p>
<p>I would like to see binary conversion's applications in these languages.
For example, I am interested in problems which you solve by it at your work.</p>
<p><strong>Where do you use binary c... | <p>Conversion of strings of binary digits to a number using Python on the commandline:</p>
<pre><code>binary=00001111
DECIMAL=$(python -c "print int('$BINARY', 2)")
echo $decimal
</code></pre>
<p>See the docs for the <a href="http://docs.python.org/library/functions.html#int" rel="nofollow">int function</a>.</p>
<p>... |
Converting the Text into Number <p>Morning All,</p>
<p>Today i came up with the new assignment of Converting the Text into number automatically by VBA Codes. For Example '1233 need to converted to 1233 and (1234) need to converted to -1234 without any human interference. Some Advice is very helpful.</p>
<p>Regards,
A... | <p>Use the <a href="http://office.microsoft.com/en-us/excel/HP100625831033.aspx" rel="nofollow">VALUE()</a> function.</p>
<p>Also, from <a href="http://www.contextures.com/xlDataEntry03.html" rel="nofollow">here</a>:</p>
<pre><code>Sub ConvertToNumbers()
Cells.SpecialCells(xlCellTypeLastCell) _
.Offset(1, 1).C... |
Overriding Controls Collection on WebControl <p>I am trying to override the Controls collection of a control that inheirts from WebControl so that when a user adds controls to the webcontrol I can put buttons before and after it and kind of put it in its own wrapper. Something like this:</p>
<pre><code>protected over... | <p>The ViewState is an object graph which is built in parallel to the control tree, so these kinds of changes tend to have the side effects you're describing. It could be argued you are essentially hijacking the Controls object and giving it a different meaning, which is not really the intention of override. Rather, ov... |
How do I parse this Amazon error report with a regular expression? <p>When you submit a feed of products to Amazon it will return a error report that will contain suggestions for products that were not matched, like so:</p>
<pre>
18 998 8042 Error "SKU '998'ASIN B0001FSZ6K 'item_name' Merchant value: 'Promax Nutriti... | <p>The references I've been able to find on the web for this sort of Amazon error message show the format as follows:</p>
<h2>Definition:</h2>
<pre><code><@foreach ASIN><ASIN> <@foreach attribute that differs><ATTRIBUTE> Merchant value: â<merch val>â Amazon catalog value: â<Amaz... |
Java PriorityQueue removal of arbitrary elements performance <p>Say I have a java PriorityQueue (which java implements as a heap) that I iterate over to remove elements based on some criteria:</p>
<pre><code>PriorityQueue q = new PriorityQueue();
...
Iterator it = q.iterator();
while(it.hasNext()){
if( someCriteri... | <p><strike>If you're using the Sun implementation, it's <code>O(log(n))</code>.</strike> From the <a href="http://java.sun.com/javase/6/docs/api/java/util/PriorityQueue.html">Javadocs</a>:</p>
<blockquote>
<p>Implementation note: this implementation provides
O(log(n)) time for the enqueing and dequeing methods
... |
Regarding Google Safe Browsing API <p>Does anyone know how to use the Google safe browsing API.</p>
<p>I downloaded the entire the malware and phish update from the google safe browsing using the API key and tried comparing the hash of the suspicious site (md5_file method in php) but it did not work. I also tried comp... | <p>You need to use a canonical version of the site url. Some examples are on <a href="https://developers.google.com/safe-browsing/developers_guide_v3#Canonicalization" rel="nofollow">this Google page</a>. Also, I think using the suffix or prefix of the url may be necessary depending on what you are doing with the url... |
Variable in child window does not receive value from parent <p>From within an html page, I create a child window to perform some filtering (choosing the printer, and what parts to print on the report). In order to show the part selection on the child window, I need to call a GetParts function from the parent window and... | <p>Try This<br>
Child Window</p>
<pre><code>
Set oParts = window.opener.GetParts(oParts)
</code></pre>
<p>Parent Window</p>
<pre><code>
Set GetParts = oParts
</code></pre>
|
Security Requirements for Medical Applications <p>I'm doing research on coding requirements for medical applications but I can't find anything useful/structured. Basically I'm looking for structured (if possible XML file) document with the list of security requirement. For example what kind of encryption they should us... | <p>For the US, you can check out the <a href="http://www.hipaaguide.net/">HIPAA guide</a> for web programmers.</p>
|
Integrating Nhibernate.Search with Nhibernate 2 <p>I have just spent all day attempting to get NHibernate.Search working alongside NHibernate 2.0 and am sorry to say that I have still not managed it. I ran into the problem posted <a href="http://stackoverflow.com/questions/426151/nhibrnate-search-with-nhibernate-v2">he... | <p>In order to setup EventListeners, you need to add this code when initializing NHibernate:</p>
<pre><code>NHibernate.Cfg.Configuration cfg = new NHibernate.Cfg.Configuration();
//Load configuration
//Add NHibernate.Search listeners
cfg.SetListener(NHibernate.Event.ListenerType.PostUpdate, new FullTextIndexEventList... |
Using VBA to parse text in an MS Word document <p>I was hoping someone could help with a MS Word Macro.</p>
<p>Basically, I have a MS Word document which lists out several text files and specific pages of interest in each file. </p>
<p>The file format is similar to:</p>
<pre>
textdocument1.txt P. 6, 12 ... | <p>The following code should get you started:</p>
<pre><code>Public Sub ParseLines()
Dim singleLine As Paragraph
Dim lineText As String
For Each singleLine In ActiveDocument.Paragraphs
lineText = singleLine.Range.Text
'// parse the text here...
Next singleLine
End Sub
</code></pre>
... |
A project with output type of class library cannot be started directly - with a startup exe <p>Firstly I'm completely aware of this message and why it happens normally. It's not that I'm just trying to run a dll (like <a href="http://stackoverflow.com/questions/618622/framework-give-me-error-about-cannot-started-direct... | <p>Another colleague suggested it's because after clicking Debug > Start new instance, while I'm waiting for it to start up, I click on a different project. I don't do it for any reason, just randomly selecting things as I wait for the project to start up. Maybe Visual Studio looks at the selected project sometime afte... |
How do I send large amounts of data from a forked process? <p>I have a ctypes wrapper for a library. Unfortunately, this library is not 100% reliable (occasional segfaults, etc.). Because of how it's used, I want the wrapper to be reasonably resilient to the library crashing.</p>
<p>The best way to do this seems to be... | <p>Probably you are trying to write more data than can fit into the pipe, so it is blocking until someone comes along and reads some of that info out of there. That will never happen, because the only reader is the parent process, which you appear to have written to wait until the child terminates before it reads anyth... |
How to test asp.net membership, profile, roles with VS Test Framework? <p>We're getting some errors, if we try to test something with the asp.net membership framework. It seems that it can't instantiate the asp.net membership environment and so, it can't access all the profiles, users and so on.</p>
<p>Has anybody see... | <p>If you are depending on external resources such as your database and the configuration files (used when using the ASP.NET membership) you aren't writing very effective unit tests. You will have to keep everything in sync including the data in the database. This because a maintenance nightmare.</p>
<p>If you want to... |
Is there a way to caching mechanism for Class::DBI? <p>I have a set of rather complex ORM modules that inherit from <a href="http://search.cpan.org/dist/Class-DBI" rel="nofollow">Class::DBI</a>. Since the data changes quite infrequently, I am considering using a Caching/Memoization layer on top of this to speed things ... | <p>I too have rolled my own ORM plenty of times I hate to say! Caching/Memoization is pretty easy if all your fetches happen through a single api (or subclasses thereof).</p>
<p>For any fetch based on a unique key you can just cache based on a concatenation of the keys. A naive approach might be:</p>
<pre><code>my %_... |
Grouping log4net errors by similarity <p>We use log4net for logging application exceptions for a variety of web applications. At present we use the <code>RollingLogFileAppender</code> with a threshold of <code>Info</code> and <code>SmtpAppender</code> with a threshold of <code>Warn</code>.</p>
<p>The problem is that w... | <p>Just log your lines as XML (other formatting will work too of course).</p>
<p>This is how we do it:</p>
<pre><code><USERID>GUID</USERID><ERRORCODE>INVALID_XML</ERRORCODE><DESCRIPTION>File x is not in correct xml format</DESCRIPTION>
</code></pre>
<p>Then we parse the log files ... |
How to persist iframe location even across top page reloads <p>I'm using an iframe to integrate two of our customer's apps. I'd like the iframe's location to persist even when the top level window is refreshed.</p>
<p>Example: </p>
<ul>
<li>user loads <a href="http://myserver/main.page?target=" rel="nofollow">http:... | <p>You can also add a 'load' event handler to this frame. Every time this event occurs, you would store the framed documents' location in a cookie.</p>
<p>IIRC, when the content of an iframe changes, the SRC attribute doesn't change. IMO, you have to read the location of the document.</p>
|
Is the State and Notification Broker API available in Windows CE 6.0 <p>The MSDN <a href="http://msdn.microsoft.com/en-us/library/bb154480.aspx" rel="nofollow">documentation</a> indicates that this API is not limited to Windows Mobile, but is available in CE 6.0. The documentation says that I should link against aygshe... | <p>This requires setting SYSGEN_STATE_NOTIFICATIONS=1.</p>
|
Is making a function template specialization virtual legal? <p>In C++, a function template specialization is supposed to act exactly like a normal function. Does that mean that I can make one virtual?</p>
<p>For example:</p>
<pre><code>struct A
{
template <class T> void f();
template <> virtual vo... | <p>Nice compiler error. For this type of checks I always fallback to the <a href="http://www.comeaucomputing.com/tryitout" rel="nofollow">Comeau</a> compiler before going back to the standard and checking.</p>
<blockquote>
<p>Comeau C/C++ 4.3.10.1 (Oct 6 2008
11:28:09) for ONLINE_EVALUATION_BETA2
Copyright 1988... |
How can i create a new instance of a class? <p>i have a list of class instances of various kinds. i need to be able to create a new instance of a class without knowing for sure what to create. all the objects involved have the same ancestor. the actual copying of the object's member variables is easy...it's the crea... | <p>If all classes have a common ancestor, you can do something like this:</p>
<pre><code>type
TAncestor = class;
TAncestorClass = class of TAncestor;
TAncestor = class
public
constructor Create; virtual;
class function CreateClass(const AId: string): TAncestor;
class procedure RegisterClass(const... |
Programatically calculate memory occupied by a Java Object including objects it references <p>I need to programmatically find out exactly how much memory a given Java Object is occupying including the memory occupied by the objects that it is referencing.</p>
<p>I can generate a memory heap dump and analyse the result... | <p>You will need to use <strong>reflection</strong> for that. The resulting piece of code is too complicated for me to post here (although it will soon be available as part of a GPL toolkit I am building), but the main idea is:</p>
<ul>
<li>An object header uses 8 bytes (for class pointer and reference count)</li>
<li... |
Copy to Output Directory doesn't seem to copy XLS files to my web bin <p>I've got a website setup which references another DLL project in my solution. In that project I have two extra files - a .LIC file and a .XLS file. Both of them are set to "Always Copy to Output Directory".</p>
<p>When I build the DLL project, th... | <p>I was having the same issue with a console application in VS 2010. I would hit F5 it would not copy the xslt file to the output directory, however, if I just compiled (without debugging) it would copy the file.</p>
|
How are named parameters passed to a batch file? <p>One of the first lines in a batch file I have is this:</p>
<pre><code>IF "%FirstServer2%" == "No" goto :SkipSolution
</code></pre>
<p>The variable %FirstServer2% is not declared anywhere, so it must be passed to the batch file somehow. So, how can I pass in the val... | <pre><code>set FirstServer2=No
MyBatchFile.cmd
</code></pre>
<p>Simply set the environment variable beforehand and start your batch afterwards.</p>
<p>Named parameters are a bit misleading in this case, as <code>FirstServer2</code> is just a normal environment variable.</p>
<p>I have used a similar technique in a ba... |
actionscript + javascript <p>I'd like to call a javascript function from an embedded .swf file. Specifically, I'd like to call a function in one of my externally linked javascript files from within:</p>
<pre><code>function loadTrack(){
//Radio Mode feature by nosferathoo, more info in: https://sourceforge.net/track... | <p>Let's compile those answers together for AS2 and AS3 using JS injection AND the ExternalInterface (both ways work in BOTH languages)</p>
<p>AS2:</p>
<pre><code>
// to use javascript injection in a url request
getURL("javascript:displayPost(" + postId + "," + feedId +");", "_self");
// to use the external interfac... |
What is the scope of window.name in IE? <p>We have a product that has both a winforms and a web client, and are providing the users a way to launch into another company asset (a web application). We need to make sure that the user only ever has one instance of the other web application open in a browser (or at least th... | <p>Have you tried window.createPopup? Dunno if it would work any better, but if you don't need the "chrome" it might be worth a shot. For more info check out the MSDN:
<a href="http://msdn.microsoft.com/en-us/library/ms537638" rel="nofollow">http://msdn.microsoft.com/en-us/library/ms537638</a>(VS.85).aspx</p>
|
Linq to Entities Vs. Table Adapters (.Net Windows Forms) <p>I'm starting on a small windows forms project that makes extensive use of editable grids. I want to use Linq to Entities, but while it's trivial to bind a grid to the Linq query it's read-only. I couldn't figure out a good way to have an editable grid that a... | <p>You can just bind an entity collection returned by a query to an control and this will allow editing the bound entities. May be you should insert a <code>BindingSource</code> between collection and control, but that depends. If you call <code>SaveChanges()</code> on the object context the changes are persisted to th... |
Limiting a script from sending alerts <p>I've got a bash script which detects a failed system component running on a unix box. The script sends out an email on failure. The script runs via run every minute (via cron). What's the easiest way to throttle sending the alerts to something like every 15 minutes?</p>
<p>Coul... | <p>Something like this might work:</p>
<pre><code>stamp=/tmp/mystamp
# create stamp file, if we haven't yet
[ ! -f $stmp ] && touch $stamp
tmp=$(tempfile)
# see if 15 minutes has passed...
diff=$(echo $(date -d "15 minutes ago" +%y%d%m%H%M) - $(date -d "$(stat $tmp |grep Change |cut -d: -f2-)" +%y%d%m%H%M) ... |
Disable Save button in WPF if validation fails <p>I've adopted what appears to be the standard way of validating textboxes in WPF using the IDataErrorInfo interface and styles as shown below. However, how can I disable the Save button when the page becomes invalid? Is this done somehow through triggers?</p>
<pre><code... | <p>A couple of things:</p>
<p>First, I would recommend using the RoutedCommand <code>ApplicationCommands.Save</code> for implementing the handling of the save button.</p>
<p>If you haven't checked out the WPF Command model, you can get the scoop <a href="http://msdn.microsoft.com/es-es/library/ms752308%28VS.85%29.asp... |
What is the mechanism that keeps various sections on page from being repositioned when browser resizes <p>In this web site when you shrink the browser window the white space on the left and right disappear first, following by the shrinking of the right panel, followed by the main container panel. I have recently starte... | <p>One of the great things about web development is that most often, when you see a site and think "How did they do that", it's very easy to look at the code and find out, and also to test it out - tools like <a href="http://getfirebug.com" rel="nofollow">Firebug</a> for Firefox, the Developer Tools in IE 8 (F12) and C... |
Is there a command line option like devenv.exe /Edit for Sql Server Management Studio <p>I'm using visual studio's external tools to open .sql scripts in Sql Server Management Studio (SSMS). The problem is, each time I use the external tools command to open a .sql file from visual studio, it opens a new instance of SS... | <p>Choose to open the file with Explorer[1] instead of SSMS. That way the system will search for any existing instances of SSMS first.</p>
<p>[1] %windir%\explorer.exe</p>
|
Why are Font Handles not being disposed? <p>I am using <a href="http://www.nirsoft.net/utils/gdi%5Fhandles.html" rel="nofollow">GDIView</a> to try to track down the source of a few lingering GDI handles, and the source seems to be Fonts used in a menu on the form. The only way I've found to make sure the font handles ... | <p>Even though it is best practice to call <code>IDisposable.Dispose()</code> yourself either by calling it directly or leveraging the using keyword. Some GDI+ objects are exception to this rule.</p>
<p>GDI+ contains predefined brushes and pens in Brushes and Pens classes. You should not call <code>Dispose()</code> on... |
Odd Bibtex behaviour in a Latex document <p>I added a line "\cite{test}" as a test to my working Latex document. When I compiled the bibtex "!bibtex name_of_my_file, I got the expected error:</p>
<blockquote>
<p>Warning--I didn't find a database entry for "test"</p>
</blockquote>
<p>Then, I removed the line and com... | <p>I think you are tripping over the multi-pass nature of LaTex plus Bibtex. If you look at <a href="http://www.math.uiuc.edu/~hildebr/tex/bibliographies.html">Step 3 in this discussion</a>, you'll see the following:</p>
<blockquote>
<p>The first run (through latex)
generates an auxiliary file,
paper.aux, conta... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.