input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
ActionScript 3.0 Preloader Issues <p>First off, I greatly appreciate any help, as always....</p>
<p>I have created a preloader from <a href="http://www.portentinteractive.com/blog/advanced-actionscript-3-preloa.htm" rel="nofollow">Jarrod's Advanced AS3 Preloader Tutorail</a>. I searched elsewhere and this seemed like... | <p>in the preloader main, you istantiate the program like this</p>
<pre><code>var program:Sprite = new programClass() as Sprite;
</code></pre>
<p>I think you should do:</p>
<pre><code>var program:Sprite = new Program();
</code></pre>
<p>Note that you don't need to cast Program as a Sprite, since it is already a Spr... |
How to tell user events from synthetic events? <p>I have a JFace editor that is mostly made up of a <code>TreeViewer</code>. This is hooked up to a <code>ContentOutlinePage</code> to bring the Outline view to life.</p>
<p>When either one receives a <code>SelectionChangedEvent</code> they call the others <code>setSelec... | <p>Generally, you would check a flag in the beginning of the routine to check to see if you are in the middle of the event handler. If the flag is set, then you exit without processing.</p>
<p>If the flag is not set, you set the flag, process, then set the flag back.</p>
|
Changing checkboxes using Javascript <p>I have a series of checkboxes on an HTML page and I would like to check the checkboxes based on corresponding HTML query string params.</p>
<p>e.g.</p>
<pre><code>...path/page.html?i=1&j=1&x=0
</code></pre>
<p>would cause a page with three checkboxes to check 1 and 2 o... | <p>Partially from <a href="http://www.w3schools.com/JS/tryit.asp?filename=try_dom_input_checked" rel="nofollow">W3Schools</a>. This file will crate a single checkbox and check it depending on the <a href="http://example.com/index.html?j=" rel="nofollow">http://example.com/index.html?j=</a><strong>?</strong> URL</p>
<p... |
c# compare two generic values <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/390900/cant-operator-be-applied-to-generic-types-in-c">Canât operator == be applied to generic types in C#?</a> </p>
</blockquote>
<p>I've coded something like this:</p>
<pre><co... | <p>You cannot use operators on generic types (except for foo == null which is special cased) unless you add where T : class to indicate it is a reference type (then foo == bar is legal)</p>
<p>Use <code>EqualityComparer<T></code>.Default to do it for you. This will <strong>not</strong> work on types which only s... |
Can I change the owner of the file saved through IIS (with ASP.NET) <p>Is there a way to change owner of saved file using IIS on Windows Server. The easier the better. It doesn't matter either this will have to be done during saving or changing file owner after file is already saved to disc. An example in ASP.NET is hi... | <p>In theory it should be fairly straight forward. You <em>should</em> be able to do something like this to change the ownership of an existing file:</p>
<pre><code>string domain = "domain";
string user = "username";
FileInfo info = new FileInfo(@"c:\test.txt");
FileSecurity security = info.GetAccessControl();
Syst... |
Is it possible to insert a multi-line code snippet relative to the cursor position in Visual Studio? <p>When using code snippets in Visual Studio that contain multiple lines the following lines will preserve the whitespace that was set in the .snippet file instead of positioning the code relative to the original cursor... | <p>The code portion of a snippet file is contained in a CDATA which preserves whitespace. The best thing I can tell you is to go into the file and edit it to suit your needs. Your only other option is to do a quick <kbd>Ctrl+K</kbd> and <kbd>Ctrl+D</kbd> after you use the snippet to auto-format the code which will fi... |
How does IE7's "View Source" button interact with javascript? <p>I'm debugging someone else's code for a web page that is made with ASP.NET with some javascript effects. It's a form that we are pre-populating with edit-able data, and one of the text boxes is getting populated with an incorrect value. </p>
<p>I know th... | <p>What you see with "view source" is the raw HTML that has been fetched. The HTML doesn't include any changes that were done via DHTML/JavaScript.</p>
<p><hr /></p>
<h2>Update</h2>
<p>Inspired by Manik's comment, here's a cross-browser<sup>1</sup> bookmarklet to display what's <strong>rendered</strong> inside <code... |
How can I request the database product name with ADO.NET? <p>I develop a product with a custom database configuration. I use ADO.NET with System.Data.Odbc.OdbcConnection for it. To make some differences between the databases is there a simple solution to detect the current DBMS of a connection.</p>
| <p>I think that the OdbcConnection.Driver property may be more appropriate in the OP's context, since ServerVersion should return only the version number.</p>
<p>The Driver property will return the name of the DLL, such as "Sqlsrv32.dll" in case of SQL server. Then the OP can apply case based logic.</p>
|
Wix major upgrade <p>How do I use WIX to prevent overwriting a config file during a 'Major Upgrade'?</p>
<p>I want the file to be installed on the initial install, removed on uninstall, and left unchanged on a 'Major Upgrade'.</p>
<p>Thanks</p>
| <p>The most straight forward way would be to schedule your RemoveExistingProducts after InstallExecute or InstallFinalize. That way the config file is not removed and then installed again (like if you schedule before InstallInitialize). Of course, scheduling RemoveExistingProduct so late means you need to be very caref... |
calculate exponential moving average in python <p>I have a range of dates and a measurement on each of those dates. I'd like to calculate an exponential moving average for each of the dates. Does anybody know how to do this?</p>
<p>I'm new to python. It doesn't appear that averages are built into the standard pytho... | <p>EDIT:
It seems that <a href="http://www.scipy.org/scipy/scikits/browser/trunk/timeseries/scikits/timeseries/lib/moving_funcs.py"><code>mov_average_expw()</code></a> function from <a href="http://pytseries.sourceforge.net/lib/moving_funcs.html">scikits.timeseries.lib.moving_funcs</a> submodule from <a href="http://sc... |
<ol> with numbers another color <pre><code><ol>
<li>test</li>
<li>test</li>
</ol>
</code></pre>
<p>will show as:</p>
<ol>
<li>test</li>
<li>test</li>
</ol>
<p>I want to have numbers coloured and text black!</p>
<p>I can edit the css, but I do not have access t... | <p>The <a href="http://www.w3.org/TR/CSS2/generate.html#counters">CSS spec</a> gives an example of doing just this. Unfortunately, while it works on Firefox 3, it doesn't appear to work on IE7:</p>
<pre><code><html>
<head>
<style>
ol { counter-reset: item; }
ol li { display: block... |
OOP approach for inventory system <p>We're developing a system to track inventory at our field offices.</p>
<p>At its core, the system will have a list of "Assets" - things like Bikes, Computers, Tents. Each Asset goes through states like "Active", "Lost", "Checked Out", "Inventoried". Some states have additional info... | <p>You sort of answered your own question. Check out the <a href="http://www.dofactory.com/Patterns/PatternState.aspx" rel="nofollow">State</a> pattern.</p>
|
Reporting Services: Tablix RepeatColumnHeaders doesn't work on some reports <p>So I've got various reports that consist of a DataSet rendered in a Tablix... pretty garden variety stuff. There is a property for the Tablix control named <em>RepeatColumnHeaders</em>, which I have set to <strong>True</strong> for each repo... | <p>It's a bit wonky from what I've managed to dig up. In your grouping pane, select advanced mode, then select your outermost static row. You should then see the "RepeatOnNewPage" property.</p>
<p><strong>Update: finding Advanced Mode</strong>:<br>
The comment by @HCL links to the <a href="http://stackoverflow.com/que... |
Which Java MVC frameworks integrate easily with StringTemplate? <p>It's hard to see how <em>StringTemplate</em> integrates easily (or not) with <em>popular</em> Java web MVC frameworks.</p>
<p><strong>Which Java MVC frameworks integrate easily with StringTemplate?</strong></p>
<p>A good answer:</p>
<ul>
<li>mentions... | <p>I've gotten StringTemplate to work with Spring. Basically, all it took was a custom view.</p>
<p>But first, a disclaimer: This is an experimental hack. I've never used this in production code, and it could use some improvement before that happens. I think it is adequate to answer your question about how easily S... |
SQL Logical AND operator for bit fields <p>I have 2 tables that have a many to many relationship; An Individual can belong to many Groups. A Group can have many Individuals. </p>
<p>Individuals basically just have their Primary Key ID</p>
<p>Groups have a Primary Key ID, IndividualID (same as the ID in the Individu... | <p>Don't know your data...but....that LEFT JOIN is an INNER JOIN</p>
<p>what happens when you change the WHERE to AND</p>
<pre><code>SELECT * FROM Individual i
LEFT JOIN Group g ON g.IndividualID = i.ID
AND g.IsPrimaryGroup = 0
</code></pre>
<p>Here try running this....untested of course since you didn't provide a... |
Context agnostic JavaScript Testing Framework <p>I'm looking for a JavaScript Testing Framework that I can easily use in whatever context, be it browser, console, XUL, etc.</p>
<p>Is there such a framework, or a way to easily retrofit an existing framework so its context agnostic?</p>
<p>Edit: The testing framework s... | <p>OK, here's something I just brewed based on some earlier work. I hope this would meet your needs.</p>
<h2><a href="http://jsunity.com/" rel="nofollow">jsUnity</a></h2>
<p>Lightweight Universal JavaScript Testing Framework </p>
<blockquote>
<p><strong>jsUnity</strong> is a lightweight universal JavaScript testin... |
Text Box vs Labels <p>I am developing a winForm App in C# and I have come across something that has always bothered me.</p>
<p><strong>Is it better practice to use a Label or a TextBox when displaying data to the user?</strong></p>
<p>Things like Name, Phone #, etc. My gut says to use a TextBox and just set it to r... | <p>One useful thing to consider is that text in a textbox is selectable so it's easier for your users to copy/paste the content. </p>
<p>Premature optimizations like using labels because they are more light weight should take a backseat to defensive programming that, as you suspect, could save you time in the future. ... |
CSS in sharepoint <p>I need to apply a CSS to a Sharepoint site (WSS3.0) based on the theme applied to a site.
The CSS would be saved at root site in 'Document Library'.
How do I apply the CSS programmatically on the page? </p>
<p>Thanks!</p>
| <p>Put in the page layout or master page.
E.g.</p>
<pre><code><SharePointWebControls:CssRegistration ID="CssRegistrationMyCSS" name="<% $SPUrl:~sitecollection/Style Library/~language/Core Styles/myCSS.css %>" runat="server"/>
</code></pre>
<p>Programatically changing it requires you to modify the control ... |
Caching and Session state management using Microsoft Velocity and Memcached <p>I was looking at Microsoft Velocity and memcached to find a solution for some session management issues -</p>
<p>What is the difference between caching that is provided by Microsoft Velocity, memcached and session state management? I mean m... | <p>The difference between caching an session state management is that caching is at the application level(caches data for all sessions). Also cache can timeout many times during a session. Use cache for holding frequently used information(i.e information from a lookup table). This way your application wont have to a... |
Vertically align text next to an image? <p>Why won't <code>vertical-align: middle</code> work? And yet, <code>vertical-align: top</code> <em>does</em> work.</p>
<pre><code><div>
<img style="width:30px;height:30px">
<span style="vertical-align:middle">Doesn't work.</span>
</div>
</c... | <p>Actually, in this case it's quite simple: apply the vertical align to the image. Since it's all in one line, it's really the image you want aligned, not the text.</p>
<p><div class="snippet" data-lang="js" data-hide="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override">... |
HQL - row identifier for pagination <p>Does anyone know if HQL has a keyword to identify rows such as ROWID or ROWNUM?</p>
<p>I would like to implement pagination with HQL but I am not able to use .setMaxResult() or .setFirstResult() because I don't work with the session object directly and therefore don't use the Que... | <p>this is one situation where hibernate shines:</p>
<p>typical solution with hql query.</p>
<pre><code>int elementsPerBlock = 10;
int page = 2;
return getSession().createQuery("from SomeItems order by id asc")
.setFirstResult(elementsPerBlock * (page-1) + 1 )
.setMaxResults(elementsPerBlock... |
How would you write this query? <p>I'm looking to refactor the below query to something more readable and modifiable. The first half is identical to the second, with the exception of the database queried from (table names are the same though.)</p>
<pre><code> SELECT
Column 1 AS c1,
...
Column N AS cN
F... | <p>I'm going to go out on a limb here, and say, based on the information you've given us; </p>
<p><strong>That's as good as it's going to get</strong> </p>
|
Does ActionScript 3 require an error event handler for XML? <p>In a Flash game I am developing, there are some settings that are set by an external XML file. When I run the SWF file through the Flash IDE, it loads fine. If I run the same file as a projector (.exe) or the independent SWF file, it does not load the XML... | <p>On the first addEventListener you're telling it to use weak references (that last argument to the call). Your loadXML function is defined within your getSettings() method. Once you leave the getSettings() scope loadXML goes out of scope. The only thing left referencing loadXML is the event listener, but since you... |
import csv file/excel into sql database asp.net <p>I am starting a project with asp.net visual studio 2008 / SQL 2000 (2005 in future) using c#.</p>
<p>The tricky part for me is that the existing DB schema changes often and the import files columns will all have to be matched up with the existing db schema since they ... | <p>Check out the excellent FileHelpers library - there an <a href="http://www.codeproject.com/KB/database/filehelpers.aspx" rel="nofollow">article on CodeProject</a> about it, and it's hosted <a href="http://www.filehelpers.com/" rel="nofollow">here</a>.</p>
<p>It's pure C#, and it can import just about any flat-file,... |
Do Real Values sort different than floats in SQL Server queries? <p>Can anyone think of a reason to do this:</p>
<p>SELECT * FROM TableA
ORDER BY cast(cast(RealColumnA as nvarchar(50))as float)
--where RealColumnA is defined as real in the table</p>
<p>A former developer of mine insisted this was necessary to get rea... | <p>Remove it. ORDER BY is what you expect it to be. And it certainly would be a performance killer.</p>
<p>Rule #1 about SQL. Question (and test) all your (and other peoples') assumptions. (Especially weird ones like this.)</p>
|
What are some common uses for Python decorators? <p>While I like to think of myself as a reasonably competent Python coder, one aspect of the language I've never been able to grok is decorators.</p>
<p>I know what they are (superficially), I've read tutorials, examples, questions on Stack Overflow, and I understand th... | <p>I use decorators mainly for timing purposes</p>
<pre><code>def time_dec(func):
def wrapper(*arg):
t = time.clock()
res = func(*arg)
print func.func_name, time.clock()-t
return res
return wrapper
@time_dec
def myFunction(n):
...
</code></pre>
|
Code Dependency documentation software <p>I am looking for a tool to document legacy source code for an embedded C project I work with. I had it in my mind that there was a tool that would create charts of the various C and .h files, but I can't recall what it is called. Does anyone know of such a tool?</p>
| <p><a href="http://www.cppdepend.com">CppDepend</a> The NDepend like for C\C++</p>
|
Can I indicate to clients that SPNEGO is supported but NTLM is not for HTTP requests? <p>The two WWW-Authenticate additions Microsoft makes use of that I am currently aware of are</p>
<ul>
<li>NTLM</li>
<li>Negotiate</li>
</ul>
<p>If Negotiate is sent down from the server, based on a set of conditions Kerberos will b... | <p>Yes you can. Take a look at the <a href="http://spnego.sourceforge.net/reference%5Fdocs.html" rel="nofollow">reference docs</a> of the SPNEGO HTTP Servlet Filter project.</p>
|
NHibernate not evicting objects from a session <p>I'm mapping a ProductCategory tree using Fluent NHibernate and everything was going fine until I tried to walk the tree that is returned from the database to ensure it's saving and retreiving appropriately.</p>
<p>Here's how I'm testing:</p>
<ol>
<li>Instantiate 4 cat... | <p>Just figured it out, turns out it was a copy&paste bug. Heh, PEBKAC.</p>
<p>I added 4 assertions that verify that the objects are not in the session:</p>
<pre><code>Assert.That(Session.Contains(_beveragesCategory), Is.False);
Assert.That(Session.Contains(_beerCategory), Is.False);
Assert.That(Session.Contains... |
QScintilla scrollbar <p>When I add a QsciScintilla object to my main window the horizontal scrollbar is active and super wide (tons of apparent white space). Easy fix?</p>
| <p>Easy fix:</p>
<pre><code>sc.SendScintilla(sc.SCI_SETHSCROLLBAR, 0)
</code></pre>
|
Best way to validate URL parameters in Spring MVC website? <p>I am using Spring MVC to build my web application, and I have a question about validating parameters I receive in the URL. <strong>What is the best way to detect invalid parameters and display errors to the user?</strong></p>
<p>Suppose I have a "View User ... | <p>If the DAO returns null, simply return a ModelAndView for an error page. </p>
<p>Example:</p>
<pre><code>UserProfile profile = userProfileDao.findUserProfileById(userId);
if (profile == null) {
return new ModelAndView("Error", "message", "Invalid user ID");
} else {
// process accordingly.
}
</code></pre>
... |
JSP template inheritance <p>Coming from a background in Django, I often use "template inheritance", where multiple templates inherit from a common base. Is there an easy way to do this in JSP? If not, is there an alternative to JSP that does this (besides Django on Jython that is :)</p>
<h2>base template</h2>
<pre><c... | <p>You can do similar things using JSP tag files. Create your own <code>page.tag</code> that contains the page structure. Then use a <code><jsp:body/></code> tag to insert the contents.</p>
|
Favorite (Clever) Defensive Programming Best Practices <p>If you had to choose your <strong>Favorite</strong> (clever) techniques for defensive coding, what would they be? Although my current languages are Java and Objective-C (with a background in C++), feel free to answer in any language. Emphasis here would be on ... | <p>In c++, I once liked redefining new so that it provided some extra memory to catch fence-post errors. </p>
<p>Currently, I prefer avoiding defensive programming in favor of <a href="http://en.wikipedia.org/wiki/Test-driven_development">Test Driven Development</a>. If you catch errors quickly and externally, you don... |
LoaderLock error on program termination <p>I have recently integrated the .NET NLog logging component into one of our applications which developed purely in unmanaged code (C++ and VB6 components compiled in Visual Studio 6). We have a bunch of C++ application talking to NLog via a COM interface.</p>
<p>Everything is ... | <p>It is most definitely not safe to ignore this message. If you hit this message, you've almost certainly created a real loader lock policy violation. This is a very serious error and can cause unpredictable behavior in a program (including deadlock). </p>
<p>The best way to avoid this is to not access any other ... |
PHP session seemingly not working <p>Session variables are apparently not working for me. I don't know what I'm doing wrong. This is the code that I'm using to check for a valid password:</p>
<pre><code>if ($input_password_hash == $password_hash)
{
session_start();
$_SESSION['is_user'] = 1;
header("Location: ..... | <p>You know that you've got to write <code>session_start()</code> before you use the <code>$_SESSION</code> variable in any request, right? It looks like you haven't put it in index.php anywhere.</p>
|
PHP array problem <p>I'm sending some data over AJAX to a PHP file. It's about filter options. Anyway, I am sending it like this:</p>
<pre><code>filter[0][data][type] string
filter[0][data][value] automobiles
filter[0][field] product
filter[1][data][type] numeric
filter[1][data][value] 6000
filter[1][field] price
<... | <p><a href="http://www.php.net/parse_str" rel="nofollow">parse_str</a>($queryString); and then do everything as normal. That method will process the query string and import the variables to the global namespace (which could be dangerous), so maybe use its second form (listed on the manual page):</p>
<pre><code>$result... |
How to add NHibernate configuration file to use NHibernate.Search? <p>I try to use NHibernate.Search that I built from trunk and use with NHibernate 2.0.1. When I add some NHibernate.Search properties config into configuaration file:</p>
<pre><code><property name="hibernate.search.default.directory_provider">NHi... | <p>Make sure that the NHibernate.Search properties you define are included in the nhs-configuration block and not in the standard NHibernate configuration block.
Your web.config should look like this:</p>
<pre><code><section name="hibernate-configuration" type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate... |
Virtual address space in 64 bit systems running in compatibility mode <p>I saw that on a 64 bit windows OS the user virtual address space available is 8 terra bytes. But if the program we are executing on this is running in 32 bit compatibility mode is this much of user space still available ? or does it behave like a ... | <p>Microsoft has a chart showing the various limits: <a href="http://msdn.microsoft.com/en-us/library/aa366778.aspx">Memory Limits for Windows Releases</a></p>
<p>To summarize just the user-mode virtual address space:</p>
<ul>
<li>32-bit Windows:
<ul>
<li>32-bit process: 2 GB by default; 3 GB with <code>/LARGEADDRESS... |
Add Colors in Combo box in .NET Windows application <p>How to add 'Colors' (not color name, color itself ) as an item in combo box in C#?</p>
| <p>You'll have to use an owner drawn combobox. <a href="http://www.codeproject.com/KB/combobox/ownerdrawncombobox.aspx" rel="nofollow">This article</a> on <a href="http://www.codeproject.com/" rel="nofollow">CodeProject</a> is a good reference.</p>
|
What are the advantages and disadvantages of the Properties Pattern? <p>Steve Yegge describes the <strong>Properties Pattern</strong> in a <a href="http://steve-yegge.blogspot.com/2008/10/universal-design-pattern.html#Property">blog post</a> of his.</p>
<p>For someone using a static language like C# or Java, what are ... | <p>I've been digging into this pattern quite a bit myself lately, and I can tell you that finding information on it is pretty tough. Yegge calls it prototype or properties, but both of those are pretty heavily overused, and well known as two other, different patterns. Some people refer to systems like the one Yegge pr... |
How to move the environment details outside the EAR <p>Our project is a medium size web application developed using RAD 7.0 on WAS 6.1/hibernate/struts which moved to production. Currently we have hardcoded the ip address of the production system in the property file and database schema details in the hibernate config ... | <p>You can use JNDI for this. You should create the appropriate entries and in your code read them like this:</p>
<pre><code>Context initialContext = new InitialContext();
URL ip = (URL) initialContext.lookup("java:comp/env/myip");
</code></pre>
<p>See <a href="http://www.developer.com/open/article.php/3559931">this<... |
Keeping an array sorted in PHP <p>I have a PHP script which reads a large CSV and performs certain actions, but only if the "username" field is unique. The CSV is used in more than one script, so changing the input from the CSV to only contain unique usernames is not an option.</p>
<p>The very basic program flow (whic... | <p>Not keeping the array in order, but how about this kind of optimization? I'm guessing <code>isset()</code> for an array key should be faster than <code>in_array()</code> search.</p>
<pre><code>$allUsernames = array();
while($row = fgetcsv($fp)) {
$username = $row[0];
if (isset($allUsernames[$username])) {
... |
Notifying the user after a long Ajax task when they might be on a different page <p>I have an Ajax request to a web service that typically takes 30-60 seconds to complete. In some cases it could take as long as a few minutes. During this time the user can continue working on other tasks, which means they will probably ... | <p>You could add another method to your web service that allows you to check the status of a previous request. Then you can use ajax to poll the web service every 30 seconds or so. You can store the request id or whatever in Session so your ajax call knows what request ID to poll no matter what page you're on.</p>
|
Including boost::filesystem produces linking errors <p>Ok first off, I am linking to boost_system and boost_filesystem.</p>
<p>My compiler is a <a href="http://nuwen.net/mingw.html" rel="nofollow">custom build of MinGW with GCC 4.3.2</a></p>
<p>So when I include:</p>
<pre><code>#include "boost/filesystem.hpp"
</code... | <p>Ok, I found the problem. It's a bit convoluted.</p>
<p>GCC is gradually becoming more IS 14882 compliant in the 4.x branch. As they go on, they are removing deprecated non-standards complaint features.</p>
<p>While 4.1.x seem to only have them deprecated and not removed, 4.3.x seems to actually have them removed. ... |
F# Units of measure, problems with genericity 2 <p>Following on from <a href="http://stackoverflow.com/questions/460766/f-units-of-measure-problems-with-genericity">this</a> question, I still seem to be battling at the frontiers of what is possible, though I don't think that I'm doing anything particularly bleeding edg... | <pre><code>type Vector2d<[<Measure>]'u> = { X: float<'u>; Y: float<'u> }
</code></pre>
<p>should do the trick</p>
<p>Note: This is correct as of the 1.9.6.2 CTP release but this api is not currently viewed as stable</p>
|
Converting Value Type of a Dictionary in VB.net <pre><code>Public Class A
Public Class B : Inherits A
Dim DictA As Dictionary(Of Integer, A)
Dim DictB As New Dictionary(Of Integer, B)
DictA = DictB
</code></pre>
<p>This doesn't work, as the type can't be converted. Is this somehow possible?</p>
| <p>No. You're running into the problem of generic variance, which isn't supported in .NET except in a few very particular ways.</p>
<p>Here's the reason: after your last line, you've got a single dictionary with two "views" onto it, effectively. Now imagine you wrote:</p>
<pre><code>DictA.Add(1, New A())
</code></pre... |
Does modified Open Source code HAS-TO-BE open-sourced? <p>We have taken an open-source application, released under GPL ver1.09 and have modified some parts of its source and have made some customisations/enhancements as per our requirement.</p>
<p>We are using this application for non-commercial, internal purposes onl... | <p>If you're not going to distribute it, you can do what you want with it.</p>
<p>See <a href="http://www.gnu.org/licenses/gpl-faq.html#GPLRequireSourcePostedPublic" rel="nofollow">this entry in the GPL FAQ</a>.</p>
|
How do I unset an element's CSS attribute using jQuery? <p>If I set a CSS value on a specific element using:</p>
<pre><code>$('#element').css('background-color', '#ccc');
</code></pre>
<p>I want to be able to unset that element-specific value and use the cascaded value, along the lines of:</p>
<pre><code>$('#element... | <p>From the <a href="http://api.jquery.com/css/">jQuery docs</a>: </p>
<blockquote>
<p>Setting the value of a style property to an empty string â e.g. <code>$('#mydiv').css('color', '')</code> â removes that property from an element if it has already been directly applied, whether in the HTML style attribute, th... |
How would I require a password for all files except one using .htaccess? <p>I have a new website I'm working on that the client wants to keep a secret, but at the same time, I want to put an under construction page with some info on it. I would like to have everything except index.html require a user/password--index.ht... | <pre><code>AuthName "Restricted Area"
AuthType Basic
AuthUserFile /path/to/file/.htpasswd
AuthGroupFile /dev/null
<Files "*">
Require valid-user
</Files>
<Files "index.html">
Allow from all
Satisfy any
</Files>
</code></pre>
|
run a web project developed in Java run on both windows and Linux platform <p>I have a web project developed in java. I am using the Windows platform and accessing the project from the Windows machine itself. How can I make the project run on a Linux machine? I am using jboss server and deploying the project.</p>
<p>R... | <p>Java is Cross-Platform, MySQL also. You can have your application server running on one server and the database on another. You can even have your Appserver on Linux and your database on Windows and your client on MacOS.</p>
<p>If you run into any specific problem, please let us know, but everything should be trans... |
Should I still learn C if I already know Assembly? <p>Often one of the main reasons given for learning C is that it brings you closer to programming at a low level which gives you insights into how things really work in higher level languages.</p>
<p>I've been programming in various Assembly flavors for awhile and you... | <blockquote>
<p>Often one of the main reasons given for learning C is that it brings you closer to programming at a low level </p>
</blockquote>
<p>Well, scratch that one off, look at the others and decide for yourself. If you want to:</p>
<ul>
<li>remain close to low level but gain portability</li>
<li>be able to ... |
friend class : inherited classes are not friend as well? <p>In C++, I have a class A which is friend with a class B.</p>
<p>I looks like inherited classes of B are not friend of class A.</p>
<p>I this a limitation of C++ or my mistake ?</p>
<p>Here is an example. When compiling, I get an error on line "return new Me... | <p>Friendship is not inherited, you have to explicitly declare every friend relationship. (See also "<a href="http://www.parashift.com/c++-faq-lite/friends.html#faq-14.4" rel="nofollow">friendship isn't inherited, transitive, or reciprocal</a>")</p>
|
System information as desktop wall-paper on Remote Desktop <p>When opening Remote Desktop to different Windows servers, it is easy to confuse two remote desktops.</p>
<p>How do I get each remote server to automatically display some system information as desktop wallpaper, ie. Computer Name, Operating System, IP Addres... | <p>I've used <a href="http://technet.microsoft.com/en-us/sysinternals/bb897557.aspx">BGInfo</a> from the SysInternals guys to do this in the past.</p>
|
How to convert standard IP address format string to hex and long? <p>Does anyone know how to get the IP address in decimal or hex from standard IP address format string ("xxx.xxx.xxx.xxx")?</p>
<p>I've tried to use the inet_addr() function but didn't get the right result.</p>
<p>I tested it on "84.52.184.224"</p>
<p... | <p>You have just got the bytes reversed from what you expected - they are in <a href="https://en.wikipedia.org/wiki/Endianness#Networking" rel="nofollow">network byte order</a></p>
<pre><code>3770168404 = 0xE0 B8 34 54 network byte order
| |
\ /
\ /... |
Maximum lookup fields in a list <p>In SharePoint 2007, is there a limit to the number of lookup-fields that you can have in a list?</p>
| <p>No, however you might want to bear in mind the 'rule of 2000'.</p>
<p>Microsoft states the following:</p>
<p>2,000 columns per document library and 4,096 per list</p>
<p>But these are not hard limits they are prformace guidelines. You can see a full <a href="http://technet.microsoft.com/en-us/library/cc262787.as... |
Is Dynamic SQL more vulnerable to SQL Injection/hacking? <p>Is Dynamic SQL more vulnerable to SQL Injection/hacking?
If yes, how to prevent?</p>
| <p>If you use parameters instead of string concatenation to specify your filter-criteria, then it should not be vulnerable for Sql injection.</p>
<p>For instance:</p>
<p>do this:</p>
<pre><code>string sqlQuery = "SELECT * FROM Persons WHERE Persons.Name LIKE @name";
SqlCommand cmd = new SqlCommand ( sqlQuery );
...... |
Anybody know any good silverlight tutorials? <p>As the title says :)</p>
<p>I've been waiting for Wrox to release "Professional silverlight 2.0" for ages but it's been delayed by nearly a year and I want to have a Play with silverlight.</p>
<p>Ignoring the silverlight.net site, does anyone know of any good beginners ... | <p>I'm currently running through this <a href="http://weblogs.asp.net/scottgu/pages/silverlight-2-end-to-end-tutorial-building-a-digg-search-client.aspx" rel="nofollow">set of tutorials</a>. Have been quite useful as a very basic primer into the world of Silverlight.</p>
|
Creating an isset if function using php to avoid and update if the input is empty for a MYSQL update <p>Hi I am newish to php and I have created an update page for Content Management System. I have a file upload in this case a picture. I have other inputs that contain text and I can get them to populate my form and tha... | <p>You have to use the <a href="http://docs.php.net/manual/en/reserved.variables.files.php" rel="nofollow"><code>$_FILES</code> variable</a> for uploaded files. For further information, see <a href="http://docs.php.net/manual/en/features.file-upload.php" rel="nofollow">Handling file uploads</a> in the PHP manual.</p>
|
ASP.NET MVC Framework 'REST-like' API <p>I have developed a 'REST-like' XML API that I wish to expose for consumption by third-party web applications. I'm now looking to implement a security model for the exchange of data between a third-party application and the 'REST-like' XML API. I would appreciate suggestions for ... | <p>If you want encryption why not just use SSL to encrypt the connection rather than encrypting the response data? If 128-bit SSL isn't sufficient, then you'll either need to integrate some existing PKI infrastructure using an external, trusted authority or develop a key distribution/sharing infrastructure yourself an... |
Is there a KDE systray epplet for Enlightment? <p>Enlightenment DR16 is packaged with openSUSE 11.1 but it's a bit painful to use with KDE apps as there's no obvious (on the Enlightenment site, google etc.) way to provide a systray for KDE apps that require one (e.g., ktorrent).</p>
<p>Anyone know of a way around this... | <p><a href="http://packages.debian.org/unstable/x11/trayer" rel="nofollow">trayer</a> is a standalone system tray. It should work regardless of what environment you're in, including e16.</p>
|
Should I use Perl or Python for network monitoring? <p>I want to have some work done on the Network front, pinging numerous computers on a LAN and retrieving data about the response time. Which would be the most useful and productive to work with: Perl or Python?</p>
| <p>I agree that it is pretty subjective which programming language you use - essentially I would rather get the job done as quickly and efficiently as possible which making it supportable - so that depends on your infrastructure...</p>
<p>Can I suggest that you look at <a href="http://www.nagios.org/">Nagios</a> rathe... |
How can I stop cl.exe from terminating when a user logs out? <p>We have an automated build server that produces builds using Visual Studio 2005 and <a href="http://ccnet.thoughtworks.com/" rel="nofollow">CruiseControl.NET</a> (on Windows XP x64). Normally nobody is logged into the system, but occasionally we have to l... | <p>Did you try to run ccnet service under some other, non-admin, account.</p>
|
" NSRangeException " problem <p>I am trying to build an iPhone app. But at the time of compiling there is a message showing that </p>
<pre><code>[Session started at 2009-01-29 18:25:40 +0600.]
2009-01-29 18:25:44.238 SimpleGame[3691:20b] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[... | <p>It seems like you're trying to access outside the bounds of an empty array.</p>
|
How to use jQuery in Firefox Extension <p>I want to use jQuery inside a firefox extension,
I imported the library in the xul file like this:</p>
<pre><code><script type="application/x-javascript" src="chrome://myExtension/content/jquery.js"> </script>
</code></pre>
<p>but the $() function is not recognize... | <p>I use the following <code>example.xul</code>:</p>
<pre><code><?xml version="1.0"?>
<overlay id="example" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<head></head>
<script type="application/x-javascript" src="jquery.js"></script>
<script type="applica... |
How can I get the CPU core number from within a user-space app (Linux, C)? <p>Presumably there is a library or simple asm blob that can get me the number of the current CPU that I am executing on. </p>
| <p>Use <code>sched_getcpu</code> to determine the CPU on which the calling thread is running. See <code>man getcpu</code> (the system call) and <code>man sched_getcpu</code> (a library wrapper). However, note what it says:</p>
<blockquote>
<p>The information placed in cpu is only guaranteed to be current at the time... |
How do you remove a self-installed DLL? <p>I have a DLL on a server that has somehow been registered as self installed instead of a Component Service it is under Microsoft/COM3/SelfReg/CLSID with the ID and information for this DLL stored there - this component needs to be replaced or removed for updating how do you re... | <p>One of the reasons people claim self-registration is evil is that there is no guarantee that rollback will work. If regsvr32 refuses to unregister it and there's nothing in add/remove programs (which there could be if someone manually added the registry entries as part of a component), then deleting the registry en... |
Hide authorized menu item in asp.net web.sitemap <p>I have a web.sitemap with security trimming enabled, however I need to hide a menu item based on a role to a page that has no access rules in the web.config.</p>
<p>i.e I have a Campaign page that is used to view existing campaigns as well as to add new campaigns, bu... | <p>If this is just a special case for anonymous users, you could create a second SiteMap.</p>
<p>Create a new file WebAnon.sitemap.<br />
Create a new sitemap provider in the web.config </p>
<pre><code><add name="anonProvider" type="System.Web.XmlSiteMapProvider" siteMapFile="WebAnon.sitemap" securityTrimmingEnab... |
Toolbar with VLC ActiveX in VB.NET <p>I've used the <strong>VideoLAN <a href="http://wiki.videolan.org/ActiveX" rel="nofollow">VLC ActiveX</a> Plugin 2</strong> (available in the <a href="http://www.videolan.org/vlc/download-windows.html" rel="nofollow">VLC 0.9.4 installation</a>) in my VB.NET App.</p>
<p>I've noticed... | <p>the toolbar is not implemented on Windows VLC ActiveX control</p>
|
Concatenating Lambda Functions in C# <p>Using C# 3.5 I wanted to build up a predicate to send to a where clause piece by piece. I have created a very simple Console Application to illustrate the solution that I arrived at. This works perfectly. Absolutely perfectly. But I have NO idea how or why.</p>
<pre><code> ... | <p>"delegate += method" is operator for multicast delegate to combine method to delegate.
In the other hand "delegate -= method" is operator to remove method from delegate.
It is useful for Action.</p>
<pre><code>Action action = Method1;
action += Method2;
action += Method3;
action -= Method2;
action();
</code></pre>
... |
Risk of using contentEditable in IE <p>We have to add a basic HTML editor to our product. As we only support IE at present (most customers are still on IE 6), I have been told to use the Internet Explorer built-in XHTML editing capabilities â e.g. <code><div contentEditable="true"></code> as explained at "<a h... | <p>The contentEditable property works in Safari, Firefox 3, and Opera 9. </p>
<p>Since manipulation will undoubtably be through selections, your biggest problem will be getting the selection/ranges working across browsers (<a href="http://stackoverflow.com/questions/361130/get-selected-text-and-selected-nodes-on-a-pag... |
How Many Tables Should be Placed on the Same Partition Scheme? <p>My company just provided me with SQL Server 2005 Enterprise Edition and I wanted to partition some tables with large(r) amounts of data. I have about about 5 or 6 tables which would be a good fit to partition by datetime.</p>
<p>There will be some queri... | <p>You should define your partition by what makes sense for your domain. i.e. if you deal primarily in year quarters, create 5 partitions (4 quarters + 1 overspill). </p>
<p>You should also take into account physical file placement. From the MSDN article:</p>
<blockquote>
<p>The first step in partitioning tables
... |
AJAX/JQUERY/PHP issue <p>I am trying to use an ajax 'POST' call through the jquery $.ajax function to send data to a php file. For some reason the callback is a success but the data is not getting to the php file. Here is an example of the code:</p>
<pre><code>
In JS file:
$.ajax({ type: "POST",
url: "setDat... | <p>Try this and see if you get any info.</p>
<pre><code>$.post("setData.php", { myPOSTvar: "myData" },
function(data){
alert("Data saved");
});
</code></pre>
|
How can I edit a registry key with VB.NET or VB6? <p>I need to edit a registry key and set the data value to "4"</p>
<p>I know how to do it through the command prompt but am trying to find some Visual Basic code to do it.</p>
<p>If it helps, this is the key:</p>
<blockquote>
<p>HKEY_LOCAL_MACHINE\SYSTEM\CurrentCon... | <p>Here's how'd you do it in Visual Basic .NET</p>
<pre><code> Dim key As RegistryKey = Registry.LocalMachine
Dim subkey As RegistryKey
subkey = key.OpenSubKey("SYSTEM\CurrentControlSet\Services\USBSTOR", True)
subkey.SetValue("Start", 4)
</code></pre>
<p>You'll need to make sure to add </p>
<pre><... |
T4 vs CodeDom vs Oslo <p>In an application scaffolding project on which I'm working, I'm trying to decide whether to use <a href="http://msdn.microsoft.com/en-us/oslo/default.aspx">Oslo</a>, <a href="http://www.olegsych.com/2007/12/text-template-transformation-toolkit/">T4</a> or <a href="http://msdn.microsoft.com/en-u... | <p>Go with T4 - easy decision. </p>
<ul>
<li>Oslo is too new and the tools are too raw to be anything than an eval-only technology</li>
<li>CodeDOM is powerfull, if you need to generate CLR classes at run-time, and are willing to sacrifice easy modification to your generated output.</li>
<li>T4 (with the T4 toolkit) i... |
Distributing applications where the configuration settings are encrypted using Entrerprise library <p>I have a thought about this but could not come with a good solution. </p>
<p>I have a windows application. I use enterprise library (3.1) Data Access Application Block. Now I use the DataProtectionConfigurationProvide... | <p>You should use the RsaProtectedConfigurationProvider as this allows the exporting of your key container for installation on another machine. This is not supported in the DataProtectionConfigurationProvider .</p>
<p>See this link for more details:</p>
<p><a href="http://msdn.microsoft.com/en-us/library/yxw286t2%28V... |
Drag window from a grid <p>I have created a custom window set to windowStyle="none", (no title or maximize - minimize buttons) and i am trying to implement a DragMove operation when the user clicks and drags on a grid. (this is wired up by calling DragMove on a MouseLeftButtonDown Handler) </p>
<p>First weird issue th... | <p>OK, I found the answer.. </p>
<p>I used a border to wrap the grid and then caught the Border1_MouseLeftButtonDown event. </p>
<p>I also had to set the borders Background to "Transparent", and now everything works like a charm. </p>
<pre><code>Private Sub Border1_MouseLeftButtonDown(ByVal sender As System.Object, ... |
Hibernate and IDs <p>Is it possible in hibernate to have an entity where some IDs are assigned and some are generated?</p>
<p>For instance:</p>
<p>Some objects have an ID between 1-10000 that are generated outside of the database; while some entities come in with no ID and need an ID generated by the database.</p>
| <p>I would avoid this and simply have an auxiliary column for the information about the source of the object and a column for the external identifier (assuming the external identifier was an important value you wanted to keep track of).</p>
<p>It's generally a bad idea to use columns for mixed purposes - in this case ... |
Blocking and waiting for an event <p>It sometimes want to block my thread while waiting for a event to occur.</p>
<p>I usually do it something like this:</p>
<pre><code>private AutoResetEvent _autoResetEvent = new AutoResetEvent(false);
private void OnEvent(object sender, EventArgs e){
_autoResetEvent.Set();
}
//... | <p>Don't pass the event, pass a delegate that matches the event handler signature. This actually sounds hacky to me, so be aware of potential dead lock issues.</p>
|
How do I extract all {} tokens from a string using .Net's RegEx? <p>I need to extract tokens that are marked with curly brackets from a given string.</p>
<p>I have tried using Expresso to construct something that will parse...</p>
<pre><code>-------------------------------------------------------------
"{Token1}asdas... | <p>Try</p>
<pre><code>\{(.*?)\}
</code></pre>
<pre>
The \{ will escape the "{" (which has meaning in a RegEx).
The \} likewise escapes the closing } backet.
The .*? will take minimal data, instead of just .*
which is "greedy" and takes everything it can.
</pre>
<pre>
If you have assurance that your tokens will (or ... |
Least used delimiter character in normal text < ASCII 128 <p>For coding reasons which would horrify you (I'm too embarrassed to say), I need to store a number of text items in a single string.</p>
<p>I will delimit them using a character.</p>
<p>Which character is best to use for this, i.e. which character is the lea... | <p>Assuming for some embarrassing reason you can't use CSV I'd say go with the data. Take some sample data, and do a simple character count for each value 0-127. Choose one of the ones which doesn't occur. If there is too much choice get a bigger data set. It won't take much time to write, and you'll get the answer bes... |
How to display an image in flex with Content-Type: image/jpeg? <p>I have an .aspx page that generates thumbnails. It takes an ID and returns an image with response Content-Type: image/jpeg.</p>
<p>How do I display this image in Flex? </p>
| <p>I believe this should work:</p>
<pre>
<code>
<mx:Image source="http://localhost/webform.aspx?ID=1"/>
</code>
</pre>
<p>You can obviously set the source in ActionScript or make the URL a bindable string so that you can pass in the ID.</p>
|
Audio file tagging (read/write) library? <p>TagLib seems like a good choice, but I don't use C++ and bindings for other languages are limited. Currently I use the ATL library, but it hasn't been maintained since 2005 and I'm having a hard time doing this myself. So I'm looking for another open source alternative that i... | <p>Do you mean id3 tags? The Jedi project has components to do that:
<a href="http://sourceforge.net/project/showfiles.php?group_id=45786" rel="nofollow">http://sourceforge.net/project/showfiles.php?group_id=45786</a>
Look for JvID3v1 and JvID3v2.</p>
|
SQL Server 2008 Backup Compression Standard Edition <p>I'm trying to backup a database in SQL Server 2008 and have the database compressed using the new compression feature. However, when I run the following code, I get a weird error message:</p>
<pre><code>Backup Database <Database> To Disk 'C:\Backup' With Com... | <p>Backup Compression is not supported on SQL 2008 Express, Workgroup, or Standard editions, only on Enterprise. There is no way to turn this on without upgrading your version to Enterprise.</p>
<p>Although you can't backup with compression on those versions, you can RESTORE from compressed backups.</p>
<p>See <a hr... |
How to execute COM+ libraries from Java using a free method <p>I have a COM+ component developed with VB6.</p>
<p>After registering it with the component services manager COM+ application, I can use it from ASP like this</p>
<pre><code>Set Comando = Server.CreateObject("JuiciosComando.clsComando")
ComandoExecute = Co... | <p>As Eddie mentioned, you have two main methods of using COM via java: using C++ and writing a JNI wrapper or using a third party JAR to wrap the COM object.</p>
<p>I've attempted to use C++ to wrap a COM object in the past - it's not for the faint hearted - it is not easy to do and its very easy to leak resources.... |
Making your javascript maintainable <p>I am in the process of converting an internal application to use more Ajax via jQuery. I am moving away from the standard code behind of the current ASP.NET application and incorporating JavaScript methods that are going to run client side. My concern is what is the best method fo... | <p>I've found that build scripts are the key to success in maintainable Javascript. Essentially in order to have something fast and concise on the final page you need a script to make that maintainable in development.</p>
<p>If you use a build process you can break your JS into files based on the functionality. You ca... |
What are the security implications of not closing connection to the database after you are done with it? <p>What security issues can arise from not closing the database connection after using it? Doesn't PHP automatically close it once a new page loads?</p>
| <p>As the <a href="http://uk.php.net/mysql_close"><code>mysql_close()</code></a> documentation says:</p>
<blockquote>
<p>Using mysql_close() isn't usually
necessary, as non-persistent open
links are automatically closed at the
end of the script's execution. See
also freeing resources.</p>
</blockquote>
<p>S... |
How to display a windows/X window system window in 3d space on texture? <p>I'm wondering, how can I catch a window and display it on texture in 3D space. And how can I redirect mouse and keyboard input from 3D application to application running in background? I mean full 3D desktop.</p>
| <p>This can be a bit complex, and a "full" answer might not be suitable for this forum. Here's an idea/outline, though:</p>
<p>One way of doing it is through <a href="http://www.realvnc.com/" rel="nofollow">VNC</a>. Run a separate, invisible "virtual" desktop in a VNC server, then start the desired apps with it as the... |
Which .NET data structure should I use? <p>Here is the structure of the data my object will need to expose (the data is NOT really stored in XML, it was just the easiest way to illustrate the layout):</p>
<pre><code><Department id="Accounting">
<Employee id="1234">Joe Jones</Employee>
<Employe... | <pre><code>Class Department
Public Id As Integer
Public Employees As List(Of Employee)
End Class
Class Employee
Public Id As Integer
Public Name As String
End Class
</code></pre>
<p>Something like that (can't remember my VB syntax). Be sure to use Properties versus Public members...</p>
|
Interacting With Java Applet <p>Does anyone know if it is possible to interact with a java applet via .net?</p>
<p>Edit: I was able to use the UI Automation framework to locate the java applet, and from there use OCR to read data and simulate mouse/keyboard input into the applet.</p>
| <p>You may well be able to do it using accessibility APIs, which are designed to let screen-readers and so on interact with programs. Have a look at:</p>
<p><a href="http://en.wikipedia.org/wiki/Microsoft_UI_Automation" rel="nofollow">http://en.wikipedia.org/wiki/Microsoft_UI_Automation</a></p>
|
jQuery and closure <p>I have a multiple menu's on my page which all use the same mouseover and click events, so I decided to get it into a function. However vars seem to always be assigned to the last of the arguments for the hover(function, function) function.</p>
<pre><code>$(document).ready( function() {
menuMouseO... | <p>JavaScript doesn't have block scope, so those variables you declare in the for loop have their values changed each iteration and all those functions reference the same variables. The trick is to create a new function scope within the for loop so that the variables you declare are bound during that iteration.</p>
<p... |
How can I get the values of the parameters of a calling method? <h2>Question</h2>
<p>I'm writing some code that needs to be able to get the <strong>values</strong> of the parameters from the method that called into the class. I know how to get all the way to the ParameterInfo[] array, but I don't know how to then get ... | <p>You cannot do it without introspecting the stack yourself (and this is fragile since many optimizations may mean the stack frame is not what you expect, or even that the parameter passed is not in fact what the method signature would suggest (it is perfectly possible for an optimizing JIT compiler to spot that you a... |
How to split a string while preserving line endings? <p>I have a block of text and I want to get its lines <strong>without</strong> losing the \r and \n at the end. Right now, I have the following (suboptimal code):</p>
<pre><code>string[] lines = tbIn.Text.Split('\n')
.Select(t => t.Replace("\... | <p>The following seems to do the job:</p>
<pre><code>string[] lines = Regex.Split(tbIn.Text, @"(?<=\r\n)(?!$)");
</code></pre>
<p>(?<=\r\n) uses 'positive lookbehind' to match after \r\n without consuming it.</p>
<p>(?!$) uses negative lookahead to prevent matching at the end of the input and so avoids a fin... |
jquery $.ajax function call is slow first time <p>I am using $.ajax to update some values in the database. when the page makes the ajax call for the first time, it is slow. it is taking like 5 or 6 seconds to return the result. after the first request, it is fast. I am not sure if there is a way to make the first call ... | <p>My suspicion would be that the database is doing some caching and subsequent requests are filled from the cache. If this were only happening on the first request of the data, regardless of the data involved, then I would suspect that the web service that you're connecting to needs to be loaded into memory on the fi... |
jQuery vs MicrosoftAjax in ASP.NET MVC <p>Under what circumstances would you use MicrosoftAjax over jQuery in an ASP.NET MVC application?</p>
<p>According to Scott Cate in this podcast <a href="http://www.hanselminutes.com/default.aspx?showID=146">Object Oriented AJAX with Scott Cate</a> MicrosoftAjax is good for send... | <p>Go with jQuery - even Microsoft has seen the error of their ways. The next version of Visual Studio will include jQuery and support it with intellisense. You're also entirely correct regarding the simple plugin. MS Ajax, while sometimes easier to work with initially, is slow and bloated. </p>
|
python: restarting a loop <p>i have:</p>
<pre><code>for i in range(2,n):
if(something):
do something
else:
do something else
i = 2 **restart the loop
</code></pre>
<p>But that doesn't seem to work. Is there a way to restart that loop? </p>
<p>Thanks</p>
| <p>You may want to consider using a different type of loop where that logic is applicable, because it is the most obvious answer.</p>
<p>perhaps a:</p>
<pre><code>i=2
while i < n:
if something:
do something
i += 1
else:
do something else
i = 2 #restart the loop
</code></pre>
|
SQL Server: Server-side blob cursor? <p>i'd like to read binary data from a blob, using the Stream interface around it.</p>
<p>But i don't want the blob to have to be loaded entirely client side and stored in memory, or in a file. </p>
<p>i want the code that uses the blob to be able to seek and read, and only as muc... | <p>With newer versions of SQL Server you can just use plain SQL with the SUBSTRING() function on binary data types as well as text.
See <a href="http://msdn.microsoft.com/en-us/library/ms187748.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ms187748.aspx</a></p>
<p>To get the size of the image:</p>
<pre... |
How to PRINT a message from SQL CLR function? <p>Is there an equivalent of</p>
<pre><code>PRINT 'hello world'
</code></pre>
<p>which can be called from CLR (C#) code?</p>
<p>I'm trying to output some debug information in my function. I can't run the VS debugger because this is a remote server.</p>
<p>Thanks!</p>
| <p>Serguei,</p>
<p>The answer is that you cannot do the equivalent of</p>
<p><code>PRINT 'Hello World'</code></p>
<p>from inside a <code>[SqlFunction()]</code>. You can do it however from a <code>[SqlProcedure()]</code> using</p>
<p><code>SqlContext.Pipe.Send("hello world")</code></p>
<p>This is consistent with T-... |
How do I configure Subversion 1.5 support in Xcode? <p>According to the release notes for the iPhone 2.2.1, SDK Xcode now officially supports Subversion 1.5. I've converted my working copy to use the new 1.5 format; however, Xcode now will no longer track changes. I'm guessing there is somewhere in Xcode that I have t... | <p>Google is your friend:</p>
<p><a href="http://www.lemonteam.com/blog/2008/12/setting-up-subversion-15-on-xcode/" rel="nofollow">http://www.lemonteam.com/blog/2008/12/setting-up-subversion-15-on-xcode/</a></p>
<p>Please note the errors and caveats in the comments before you go blindly running the code in the tutori... |
Regex to strip lat/long from a string <p>Anyone have a regex to strip lat/long from a string? such as:</p>
<p>ID: 39.825 -86.88333</p>
| <p>To match one value</p>
<pre><code>-?\d+\.\d+
</code></pre>
<p>For both values:</p>
<pre><code>(-?\d+\.\d+)\ (-?\d+\.\d+)
</code></pre>
<p>And if the string always has this form:</p>
<pre><code>"ID: 39.825 -86.88333".match(/^ID:\ (-?\d+\.\d+)\ (-?\d+\.\d+)$/)
</code></pre>
|
Domain Model - Identifier Relationships vs. Hierarchal Objects <p>While fleshing out a hypothetical domain model, I have found myself wondering whether the better approach in relating domain objects would be to have a parent domain object contain a pointer (the identifier of the child) or if it would be a better approa... | <p>I use both on my POCOs. I generate them with a list of children on the parent class and one parent instance on the child class.</p>
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.