qid int64 4 19.1M | question stringlengths 18 48.3k | answers list | date stringlengths 10 10 | metadata list |
|---|---|---|---|---|
26,020 | <p>I've done this before in C++ by including sqlite.h but is there a similarly easy way in C#?</p>
| [
{
"answer_id": 26035,
"author": "Espo",
"author_id": 2257,
"author_profile": "https://Stackoverflow.com/users/2257",
"pm_score": 7,
"selected": true,
"text": "using (var connection = new SqliteConnection(\"Data Source=hello.db\"))\n{\n connection.Open();\n\n var command = connectio... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26020",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2674/"
] |
26,025 | <p>I'm about to deploy a mediumsized site powered by Django. I have a dedicated Ubuntu Server. </p>
<p>I'm really confused over which serversoftware to use. So i thought to myself: why not ask stackoverflow.</p>
<p>What i'm looking for is:</p>
<ul>
<li>Easy to set up</li>
<li>Fast and easy on resources</li>
<li>Can serve mediafiles</li>
<li>Able to serve multiple djangosites on same server</li>
<li>I would rather not install PHP or anything else that sucks resources, and for which I have no use for.</li>
</ul>
<p>I have heard of mod_wsgi and mod_python on Apache, nginx and lighty. Which are the pros and cons of these and have i missed someone?</p>
<p><strong>@Barry</strong>: Somehow i feel like Apache is to bloated for me. What about the alternatives?</p>
<p><strong>@BrianLy</strong>: Ok I'll check out mod_wsgi some more. But why do i need Apache if i serve static files with lighty? I have also managed to serve the django app itself with lighty. Is that bad in anyway? Sorry for beeing so stupid :-)</p>
<p><strong>UPDATE</strong>: What about lighty and nginx - which are the uses-cases when these are the perfect choice?</p>
| [
{
"answer_id": 126698,
"author": "Roman Odaisky",
"author_id": 21055,
"author_profile": "https://Stackoverflow.com/users/21055",
"pm_score": 2,
"selected": false,
"text": "mod_wsgi SCRIPT_NAME error_page 404 = @django"
},
{
"answer_id": 353517,
"author": "Oli",
"author_id... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26025",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2639/"
] |
26,094 | <p>When doing calculations on very large numbers where integral data types such as double or int64 falls short, a separate class to handle such large numbers may be needed. </p>
<p>Does anyone care to offer an efficient algorithm on how best to do this?</p>
| [
{
"answer_id": 26116,
"author": "jjnguy",
"author_id": 2598,
"author_profile": "https://Stackoverflow.com/users/2598",
"pm_score": 2,
"selected": false,
"text": "BigInteger BigDecimal integer"
}
] | 2008/08/25 | [
"https://Stackoverflow.com/questions/26094",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/224/"
] |
26,098 | <p>I'm writing a C/C++ DLL and want to export certain functions which I've done before using a .def file like this</p>
<pre><code>LIBRARY "MyLib"
EXPORTS
Foo
Bar
</code></pre>
<p>with the code defined as this, for example:</p>
<pre><code>int Foo(int a);
void Bar(int foo);
</code></pre>
<p>However, what if I want to declare an overloaded method of Foo() like:</p>
<pre><code>int Foo(int a, int b);
</code></pre>
<p>As the def file only has the function name and not the full prototype I can't see how it would handle the overloaded functions. Do you just use the one entry and then specify which overloaded version you want when passing in the properly prototyped function pointer to LoadLibrary() ?</p>
<p>Edit: To be clear, this is on Windows using Visual Studio 2005</p>
<p>Edit: Marked the non-def (__declspec) method as the answer...I know this doesn't actually solve the problem using def files as I wanted, but it seems that there is likely no (official) solution using def files. Will leave the question open, however, in case someone knows something we don't have overloaded functions and def files.</p>
| [
{
"answer_id": 26121,
"author": "Graeme Perrow",
"author_id": 1821,
"author_profile": "https://Stackoverflow.com/users/1821",
"pm_score": 4,
"selected": true,
"text": "#define DllExport __declspec(dllexport)\n\nint DllExport Foo( int a ) {\n // implementation\n}\nint DllExport Foo( int... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26098",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/194/"
] |
26,113 | <p>I'm not talking about tools that let one view a page in combinations of operating systems and browsers like crossbrowsertesting.com but in creating or figuring out the actual CSS.</p>
| [
{
"answer_id": 26131,
"author": "Ross",
"author_id": 2025,
"author_profile": "https://Stackoverflow.com/users/2025",
"pm_score": 0,
"selected": false,
"text": "/* All browsers read: */\nhtml body {\n margin: 10px;\n}\n\n/* FF, IE7, Op etc. read: */\nhtml > body {\n margin: 0;\n}\n"... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26113",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2702/"
] |
26,123 | <p>I want to use Powershell to write some utilities, leveraging our own .NET components to handle the actual work. This is in place of writing a small console app to tie the calls together. My question is where I would find a good source of documentation or tutorial material to help me fast track this?</p>
| [
{
"answer_id": 26135,
"author": "Steven Murawski",
"author_id": 1233,
"author_profile": "https://Stackoverflow.com/users/1233",
"pm_score": 5,
"selected": true,
"text": "[void][System.Reflection.Assembly]::LoadFrom(PathToYourAssembly)\n"
},
{
"answer_id": 40611548,
"author": ... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26123",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1535/"
] |
26,137 | <p>I have a couple of questions regarding VBScript and ASP Classic:</p>
<ol>
<li><p>What is the preferred way to access an MS SQL Server database in VBScript/ASP?</p></li>
<li><p>What are best practices in regards to separating model from view from controller?</p></li>
<li><p>Any other things I should know about either VBScript or ASP?</p></li>
</ol>
<p>If you haven't noticed, I'm new at VBScript coding. I realize numbers 2 & 3 are kind of giant "black hole" questions that are overly general, so don't think that I'm expecting to learn everything there is to know about those two questions from here.</p>
| [
{
"answer_id": 26181,
"author": "Michael Pryor",
"author_id": 245,
"author_profile": "https://Stackoverflow.com/users/245",
"pm_score": 5,
"selected": true,
"text": "Dim db: Set db = Server.CreateObject(\"ADODB.Connection\")\ndb.Open \"yourconnectionstring -> see connectionstrings.com\"\... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26137",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2147/"
] |
26,145 | <p>I'm making a simple extra java app launcher for Eclipse 3.2 (JBuilder 2007-8) for internal use.</p>
<p>So I looked up all the documentations related, including this one <a href="http://www.eclipse.org/articles/Article-Launch-Framework/launch.html" rel="nofollow noreferrer" title="The Launching Framework">The Launching Framework from eclipse.org</a> and have managed to make everything else working with the exception of the launch shortcut. </p>
<p><img src="https://i.stack.imgur.com/8I8zw.jpg" alt="alt text"></p>
<p>This is the part of my plugin.xml. </p>
<pre><code> <extension
point="org.eclipse.debug.ui.launchShortcuts">
<shortcut
category="mycompany.javalaunchext.launchConfig"
class="mycompany.javalaunchext.LaunchShortcut"
description="launchshortcutsdescription"
icon="icons/k2mountain.png"
id="mycompany.javalaunchext.launchShortcut"
label="Java Application Ext."
modes="run, debug">
<perspective
id="org.eclipse.jdt.ui.JavaPerspective">
</perspective>
<perspective
id="org.eclipse.jdt.ui.JavaHierarchyPerspective">
</perspective>
<perspective
id="org.eclipse.jdt.ui.JavaBrowsingPerspective">
</perspective>
<perspective
id="org.eclipse.debug.ui.DebugPerspective">
</perspective>
</shortcut>
</code></pre>
<p></p>
<p>The configuration name in the category section is correct and the class in the class section, i believe, is correctly implemented. (basically copied from org.eclipse.jdt.debug.ui.launchConfigurations.JavaApplicationLaunchShortcut)</p>
<hr>
<p>I'm really not sure if I'm supposed to write a follow-up here but let me clarify my question more.
I've extended org.eclipse.jdt.debug.ui.launchConfigurations.JavaLaunchShortcut.
Plus, I've added my own logger to constructors and methods, but the class seems like it's never even instantiating.</p>
| [
{
"answer_id": 40209,
"author": "wbkang",
"author_id": 2710,
"author_profile": "https://Stackoverflow.com/users/2710",
"pm_score": 3,
"selected": true,
"text": "contextualLaunch org.eclipse.debug.ui.launchShortcuts org.eclipse.ui.commands"
}
] | 2008/08/25 | [
"https://Stackoverflow.com/questions/26145",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2710/"
] |
26,151 | <p>C++ 0x has template aliases (sometimes referred to as template typedefs). See <a href="http://en.wikipedia.org/wiki/C%2B%2B0x#Alias_templates" rel="noreferrer">here</a>. Current spec of C++ does not. </p>
<p>What do you like to use as work around ? Container objects or Macros ?
Do you feel its worth it ?</p>
| [
{
"answer_id": 26162,
"author": "Konrad Rudolph",
"author_id": 1968,
"author_profile": "https://Stackoverflow.com/users/1968",
"pm_score": 8,
"selected": true,
"text": "template <typename T>\nstruct my_string_map {\n typedef std::map<std::string, T> type;\n};\n\n// Invoke:\n\nmy_strin... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26151",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2759/"
] |
26,158 | <p>How does a stack overflow occur and what are the best ways to make sure it doesn't happen, or ways to prevent one, particularly on web servers, but other examples would be interesting as well?</p>
| [
{
"answer_id": 26169,
"author": "Matt Dillard",
"author_id": 863,
"author_profile": "https://Stackoverflow.com/users/863",
"pm_score": 3,
"selected": false,
"text": "char hugeArray[100000000];\n"
},
{
"answer_id": 16691034,
"author": "the_mandrill",
"author_id": 188414,
... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26158",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1935/"
] |
26,173 | <p>I am looking for some JavaScript based component to be used as a course scheduler which would be a cross between Google Calendar and the login time. I do not know if the right term for this is <i>Course Scheduler</i> but I shall describe this in more detail here.</p>
<p><b>Course Scheduler</b><br>
The widget would be used to enter date and times of a course, as an example if I run a programming course 3 days a week on Mon, Tue and Wed every 7:00 am to 9:00am, 2 hours every day from 1st September to 30th November. I could answer various questions and the course data would be displayed in the calendar. It would also allow for non pattern based timings where each week is different from the other week etc. </p>
<p><b>Question</b><br>
So would I end up creating something from scratch? Would it be sensible to use Google Calendar API for this? I did a Google search for some widgets, but I believe I need better keywords, as I could not find anything close to what I am looking for. Any tips? Commercial libraries would also work for me. Thanks.</p>
| [
{
"answer_id": 5494743,
"author": "bobo",
"author_id": 684997,
"author_profile": "https://Stackoverflow.com/users/684997",
"pm_score": 3,
"selected": false,
"text": "* Day/week/month view provided.\n* create/update/remove events by drag & drop.\n* Easy way to integrate with database.\n* ... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26173",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/370899/"
] |
26,195 | <p>I've always wanted to be able to get a reasonably elegant way of getting vimdiff to work with a CVS controlled file. I've found numerous (somewhat hacky) scripts around the internet (best example <a href="http://www.vim.org/tips/tip.php?tip_id=390" rel="noreferrer">here</a>) that basically check out the file you are editing from CVS to a temp file, and vimdiff the two. None of these take into account branches, and always assume you're working from MAIN, which for me is completely useless. </p>
<p>So, my question is this: has anyone out there found a decent solution for this that does more than this script?</p>
<p>Or failing that, does anyone have any ideas of how they would implement this, or suggestions for what features you would consider vital for something that does this? My intention is that, if no one can suggest an already built solution to either use or build from, we start building one from here. </p>
| [
{
"answer_id": 26649,
"author": "Peter Stuifzand",
"author_id": 1633,
"author_profile": "https://Stackoverflow.com/users/1633",
"pm_score": 0,
"selected": false,
"text": "cvs"
},
{
"answer_id": 28889,
"author": "sanmiguel",
"author_id": 24,
"author_profile": "https://... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26195",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24/"
] |
26,196 | <p>I am looking for a very fast way to filter down a collection in C#. I am currently using generic <code>List<object></code> collections, but am open to using other structures if they perform better.</p>
<p>Currently, I am just creating a new <code>List<object></code> and looping thru the original list. If the filtering criteria matches, I put a copy into the new list.</p>
<p>Is there a better way to do this? Is there a way to filter in place so there is no temporary list required?</p>
| [
{
"answer_id": 26203,
"author": "Jorge Córdoba",
"author_id": 2695,
"author_profile": "https://Stackoverflow.com/users/2695",
"pm_score": 9,
"selected": true,
"text": "List<int> myList = GetListOfIntsFromSomewhere();\n\n// This will filter ints that are not > 7 out of the list; Where ret... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26196",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2470/"
] |
26,230 | <p>Over the last few months/years, I have shared a folder or two with numerous people on my domain. How do I easily revoke those shares to keep access to my system nice and tidy?</p>
| [
{
"answer_id": 26235,
"author": "Michael Haren",
"author_id": 29,
"author_profile": "https://Stackoverflow.com/users/29",
"pm_score": 1,
"selected": false,
"text": "Administrative Tools > Computer Management > System Tools > Shared Folders > Shares\n"
}
] | 2008/08/25 | [
"https://Stackoverflow.com/questions/26230",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29/"
] |
26,233 | <p>Given a URL, what would be the most efficient code to download the contents of that web page? I am only considering the HTML, not associated images, JS and CSS.</p>
| [
{
"answer_id": 26237,
"author": "Chris",
"author_id": 2134,
"author_profile": "https://Stackoverflow.com/users/2134",
"pm_score": 5,
"selected": false,
"text": "using System;\nusing System.Net;\nusing System.IO;\n\npublic class Test\n{\n public static void Main (string[] args)\n {\... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26233",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2141/"
] |
26,255 | <p>What JavaScript keywords (function names, variables, etc) are reserved?</p>
| [
{
"answer_id": 147776,
"author": "Joseph Holsten",
"author_id": 16981,
"author_profile": "https://Stackoverflow.com/users/16981",
"pm_score": 6,
"selected": false,
"text": "break do instanceof typeof\ncase else new var\ncatch finally return void\n... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26255",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/399/"
] |
26,301 | <p>What algorithm taught you the most about programming or a specific language feature?</p>
<p>We have all had those moments where all of a sudden we know, just know, we have learned an important lesson for the future based on finally understanding an algorithm written by a programmer a couple of steps up the evolutionary ladder. Whose ideas and code had the magic touch on you?</p>
| [
{
"answer_id": 26342,
"author": "Jason Z",
"author_id": 2470,
"author_profile": "https://Stackoverflow.com/users/2470",
"pm_score": 2,
"selected": false,
"text": "void InPlaceSwap (int& a, int &b) {\n a ^= b;\n b ^= a;\n a ^= b;\n}\n"
},
{
"answer_id": 26374,
"aut... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26301",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/269/"
] |
26,305 | <p>I want to be able to play sound files in my program. Where should I look?</p>
| [
{
"answer_id": 26311,
"author": "Greg Hurlman",
"author_id": 35,
"author_profile": "https://Stackoverflow.com/users/35",
"pm_score": 4,
"selected": false,
"text": "import sun.audio.*; //import the sun.audio package\nimport java.io.*;\n\n//** add this into your application code as ap... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26305",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2644/"
] |
26,323 | <p>C#: What is a good Regex to parse hyperlinks and their description?</p>
<p>Please consider case insensitivity, white-space and use of single quotes (instead of double quotes) around the HREF tag.</p>
<p>Please also consider obtaining hyperlinks which have other tags within the <code><a></code> tags such as <code><b></code> and <code><i></code>.
</p>
| [
{
"answer_id": 26328,
"author": "Teifion",
"author_id": 1384652,
"author_profile": "https://Stackoverflow.com/users/1384652",
"pm_score": 1,
"selected": false,
"text": "<a href=\"pages/index.php\" title=\"the title\">Text</a>\n\narray(3) { [0]=> string(52) \"Text\" [1]=> string(15) \"pag... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26323",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2141/"
] |
26,354 | <p>Does anyone know how to print a barcode to the Intermec PB20 bluetooth printer from a Windows Compact Framework application? We are currently using the Intermec LinePrinter API but have been unable to find a way to print a barcode.
</p>
| [
{
"answer_id": 28168,
"author": "Steve",
"author_id": 620435,
"author_profile": "https://Stackoverflow.com/users/620435",
"pm_score": 2,
"selected": true,
"text": "Intermec.Print.LinePrinter lp;\n\nint escapeCharacter = int.Parse(\"1b\", NumberStyles.HexNumber);\nchar[] toEzPrintMode = n... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26354",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/620435/"
] |
26,362 | <p>Has anyone managed to use <code>ItemizedOverlays</code> in Android Beta 0.9? I can't get it to work, but I'm not sure if I've done something wrong or if this functionality isn't yet available. </p>
<p>I've been trying to use the <code>ItemizedOverlay</code> and <code>OverlayItem</code> classes. Their intended purpose is to simulate map markers (as seen in Google Maps Mashups) but I've had problems getting them to appear on the map.</p>
<p>I can add my own custom overlays using a similar technique, it's just the <code>ItemizedOverlays</code> that don't work.</p>
<p>Once I've implemented my own <code>ItemizedOverlay</code> (and overridden <code>createItem</code>), creating a new instance of my class seems to work (I can extract <code>OverlayItems</code> from it) but adding it to a map's <code>Overlay</code> list doesn't make it appear as it should.</p>
<p>This is the code I use to add the <code>ItemizedOverlay</code> class as an <code>Overlay</code> on to my <code>MapView</code>.</p>
<pre><code>// Add the ItemizedOverlay to the Map
private void addItemizedOverlay() {
Resources r = getResources();
MapView mapView = (MapView)findViewById(R.id.mymapview);
List<Overlay> overlays = mapView.getOverlays();
MyItemizedOverlay markers = new MyItemizedOverlay(r.getDrawable(R.drawable.icon));
overlays.add(markers);
OverlayItem oi = markers.getItem(0);
markers.setFocus(oi);
mapView.postInvalidate();
}
</code></pre>
<p>Where <code>MyItemizedOverlay</code> is defined as:</p>
<pre><code>public class MyItemizedOverlay extends ItemizedOverlay<OverlayItem> {
public MyItemizedOverlay(Drawable defaultMarker) {
super(defaultMarker);
populate();
}
@Override
protected OverlayItem createItem(int index) {
Double lat = (index+37.422006)*1E6;
Double lng = -122.084095*1E6;
GeoPoint point = new GeoPoint(lat.intValue(), lng.intValue());
OverlayItem oi = new OverlayItem(point, "Marker", "Marker Text");
return oi;
}
@Override
public int size() {
return 5;
}
}
</code></pre>
| [
{
"answer_id": 46766,
"author": "eon",
"author_id": 2000,
"author_profile": "https://Stackoverflow.com/users/2000",
"pm_score": 7,
"selected": true,
"text": "Drawable defaultMarker = r.getDrawable(R.drawable.icon);\n\n// You HAVE to specify the bounds! It seems like the markers are drawn... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26362",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/822/"
] |
26,366 | <p>For the past 10 years or so there have been a smattering of articles and papers referencing Christopher Alexander's newer work "The Nature of Order" and how it can be applied to software.</p>
<p>Unfortunately, the only works I can find are from James Coplien and Richard Gabriel; there is nothing beyond that, at least from my attempts to find such things through google.</p>
<p>Is this kind of discussion happening anywhere?</p>
<p>MSN</p>
<hr>
<p>@Georgia</p>
<p>My question isn't about design patterns or pattern languages; it's about trying to see if more of Christopher Alexander's work can be applied to software (which it probably can, since it has even less physical constraints than architecture and building).</p>
<p>Design patterns and pattern languages seem to have embraced the structure of Alexander's design patterns, but not many capture the essence. The essence being something beyond solving a problem in a particular context.</p>
<p>It's difficult to explain without using some of Alexander's later works as a reference point.</p>
<p>Edit: No, I take that back.</p>
<p>For example, there's an architectural design pattern that is called Alcoves. The pattern has a context that isn't just rooted in the circumstances of the situation but also rooted in fundamentals about the purpose of buildings: that they are structures to be lived in and must promote living in them. In the case of the Alcove pattern, the context is that you want an area that allows for multiple people to be in the same area doing different things, because it is important for family members to be physically together as well as to be able to do things that tend to distract other family members.</p>
<p>Most software design patterns describe a problem in a context, but they make no deeper statement about why the problem is important, or why the problem is something that is fundamental to software. It makes it very easy to apply design patterns inappropriately or blithely, which is the exact opposite of the intent of design patterns to began with.</p>
<p>MSN
</p>
| [
{
"answer_id": 46766,
"author": "eon",
"author_id": 2000,
"author_profile": "https://Stackoverflow.com/users/2000",
"pm_score": 7,
"selected": true,
"text": "Drawable defaultMarker = r.getDrawable(R.drawable.icon);\n\n// You HAVE to specify the bounds! It seems like the markers are drawn... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26366",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1799/"
] |
26,369 | <p>I have a .NET 2.0 Windows Forms application. Where is the best place the store user settings (considering Windows guidelines)?</p>
<p>Some people pointed to <code>Application.LocalUserAppDataPath</code>. However, that creates a folder structure like:</p>
<blockquote>
<p>C:\Documents and Settings\user_name\Local Settings\Application
Data\company_name\product_name\product_version\</p>
</blockquote>
<p>If I release version 1 of my application and store an XML file there, then release version 2, that would change to a different folder, right? I'd prefer to have a single folder, per user, to store settings, regardless of the application version.
</p>
| [
{
"answer_id": 26394,
"author": "Ryan Farley",
"author_id": 1627,
"author_profile": "https://Stackoverflow.com/users/1627",
"pm_score": 7,
"selected": true,
"text": "// read setting\nstring setting1 = (string)Settings.Default[\"MySetting1\"];\n// save setting\nSettings.Default[\"MySettin... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26369",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2868/"
] |
26,393 | <p>I've seen news of <a href="http://github.com/jeresig/sizzle/tree/master" rel="noreferrer">John Resig's fast new selector engine named Sizzle</a> pop up in quite a few places, but I don't know what a selector engine is, nor have any of the articles given an explanation of what it is. I know Resig is the creator of jQuery, and that Sizzle is something in Javascript, but beyond that I don't know what it is. So, what is a selector engine?</p>
<p>Thanks!</p>
| [
{
"answer_id": 26411,
"author": "Dave Ward",
"author_id": 60,
"author_profile": "https://Stackoverflow.com/users/60",
"pm_score": 7,
"selected": true,
"text": "$('div')\n"
},
{
"answer_id": 26418,
"author": "dguaraglia",
"author_id": 2384,
"author_profile": "https://S... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26393",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1266/"
] |
26,433 | <p>Say I have three files (template_*.txt):</p>
<ul>
<li>template_x.txt</li>
<li>template_y.txt</li>
<li>template_z.txt</li>
</ul>
<p>I want to copy them to three new files (foo_*.txt). </p>
<ul>
<li>foo_x.txt </li>
<li>foo_y.txt </li>
<li>foo_z.txt</li>
</ul>
<p>Is there some simple way to do that with one command, e.g. </p>
<p><code>cp --enableAwesomeness template_*.txt foo_*.txt</code></p>
| [
{
"answer_id": 26439,
"author": "Blair Conrad",
"author_id": 1199,
"author_profile": "https://Stackoverflow.com/users/1199",
"pm_score": 1,
"selected": false,
"text": "($op = shift) || die \"Usage: rename perlexpr [filenames]\\n\";\n\nfor (@ARGV) {\n $was = $_;\n eval $op;\n die... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26433",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/437/"
] |
26,450 | <p>Is there any way to save an object using Hibernate if there is already an object using that identifier loaded into the session?</p>
<ul>
<li>Doing <code>session.contains(obj)</code> seems to only return true if the session contains that exact object, not another object with the same ID.</li>
<li>Using <code>merge(obj)</code> throws an exception if the object is new</li>
</ul>
| [
{
"answer_id": 26468,
"author": "Quibblesome",
"author_id": 1143,
"author_profile": "https://Stackoverflow.com/users/1143",
"pm_score": 2,
"selected": false,
"text": "IPersistable entity = Whatever(); // This is the object we're trying to update\n// (IPersistable has an id field)\nsessio... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26450",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2875/"
] |
26,455 | <p>Do you use Design by Contract professionally? Is it something you have to do from the beginning of a project, or can you change gears and start to incorporate it into your software development lifecycle? What have you found to be the pros/cons of the design approach?</p>
<p>I came across the <a href="http://en.wikipedia.org/wiki/Design_by_contract" rel="noreferrer">Design by Contract</a> approach in a grad school course. In the academic setting, it seemed to be a pretty useful technique. But I don't currently use Design by Contract professionally, and I don't know any other developers that are using it. It would be good to hear about its actual usage from the SO crowd.</p>
| [
{
"answer_id": 26484,
"author": "James A. Rosen",
"author_id": 1190,
"author_profile": "https://Stackoverflow.com/users/1190",
"pm_score": 5,
"selected": true,
"text": "// @returns null iff x = 0\npublic foo(int x) {\n ...\n}\n public test_foo_returns_null_iff_x_equals_0() {\n assertNu... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26455",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
26,458 | <p>Is there any IDE that simplifies creating Swing applications (ideally something along the lines of Visual Studio)</p>
| [
{
"answer_id": 10298568,
"author": "komputisto",
"author_id": 629033,
"author_profile": "https://Stackoverflow.com/users/629033",
"pm_score": 3,
"selected": false,
"text": "JFrame"
}
] | 2008/08/25 | [
"https://Stackoverflow.com/questions/26458",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2875/"
] |
26,478 | <p>I'm having trouble getting the following to work in SQL Server 2k, but it works in 2k5:</p>
<pre><code>--works in 2k5, not in 2k
create view foo as
SELECT usertable.legacyCSVVarcharCol as testvar
FROM usertable
WHERE rsrcID in
( select val
from
dbo.fnSplitStringToInt(usertable.legacyCSVVarcharCol, default)
)
--error message:
Msg 170, Level 15, State 1, Procedure foo, Line 4
Line 25: Incorrect syntax near '.'.
</code></pre>
<p>So, legacyCSVVarcharCol is a column containing comma-separated lists of INTs. I realize that this is a huge WTF, but this is legacy code, and there's nothing that can be done about the schema right now. Passing "testvar" as the argument to the function doesn't work in 2k either. In fact, it results in a slightly different (and even weirder error):</p>
<pre><code>Msg 155, Level 15, State 1, Line 8
'testvar' is not a recognized OPTIMIZER LOCK HINTS option.
</code></pre>
<p>Passing a hard-coded string as the argument to fnSplitStringToInt works in both 2k and 2k5.</p>
<p>Does anyone know why this doesn't work in 2k? Is this perhaps a known bug in the query planner? Any suggestions for how to make it work? Again, I realize that the real answer is "don't store CSV lists in your DB!", but alas, that's beyond my control.</p>
<p>Some sample data, if it helps:</p>
<pre><code>INSERT INTO usertable (legacyCSVVarcharCol) values ('1,2,3');
INSERT INTO usertable (legacyCSVVarcharCol) values ('11,13,42');
</code></pre>
<p>Note that the data in the table does not seem to matter since this is a syntax error, and it occurs even if usertable is completely empty.</p>
<p>EDIT: Realizing that perhaps the initial example was unclear, here are two examples, one of which works and one of which does not, which should highlight the problem that's occurring:</p>
<pre><code>--fails in sql2000, works in 2005
SELECT t1.*
FROM usertable t1
WHERE 1 in
(Select val
from
fnSplitStringToInt(t1.legacyCSVVarcharCol, ',')
)
--works everywhere:
SELECT t1.*
FROM usertable t1
WHERE 1 in
( Select val
from
fnSplitStringToInt('1,4,543,56578', ',')
)
</code></pre>
<p>Note that the only difference is the first argument to fnSplitStringToInt is a column in the case that fails in 2k and a literal string in the case that succeeds in both.</p>
| [
{
"answer_id": 26577,
"author": "wcm",
"author_id": 2173,
"author_profile": "https://Stackoverflow.com/users/2173",
"pm_score": 0,
"selected": false,
"text": "select val \nfrom dbo.fnSplitStringToInt('1,2,3', default)\n"
},
{
"answer_id": 49638,
"author": "MobyDX",
"a... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26478",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2327/"
] |
26,512 | <p>I have a ComboBox that I bind to a standard HTTPService, I would like to add an event listener so that I can run some code after the ComboBox is populated from the data provider.</p>
<p>How can I do this?</p>
| [
{
"answer_id": 26553,
"author": "Theo",
"author_id": 1109,
"author_profile": "https://Stackoverflow.com/users/1109",
"pm_score": 0,
"selected": false,
"text": "BindingUtils dataProvider BindingUtils.bindSetter(comboBoxDataProviderChanged, comboBox, \"dataProvider\");\n BindingUtils mx.bi... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26512",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1638/"
] |
26,515 | <p>I have a habit of keeping my variable usage to a bare minimum. So I'm wondering if there is any advantage to be gained by the following:</p>
<pre><code>$query = $mysqli->query('SELECT * FROM `people` ORDER BY `name` ASC LIMIT 0,30');
// Example 1
$query = $query->fetch_assoc();
// Example 2
$query_r = $query->fetch_assoc();
$query->free();
</code></pre>
<p>Now if I'm right Example 1 should be more efficient as <code>$query</code> is <code>unset</code> when I reassign it which should free any memory associated with it. However there is a method (<code>MySQLi_Result::free()</code>) which frees associated memory - is this the same thing?</p>
<p>If I don't call <code>::free()</code> to free any memory associated with the result but <code>unset</code> it by reassigning the variable am I doing the same thing? I don't know how to log this sort of thing - does anyone have some ideas?</p>
| [
{
"answer_id": 26537,
"author": "Brian Warshaw",
"author_id": 1344,
"author_profile": "https://Stackoverflow.com/users/1344",
"pm_score": 4,
"selected": true,
"text": "free() free() free()"
}
] | 2008/08/25 | [
"https://Stackoverflow.com/questions/26515",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2025/"
] |
26,522 | <p>Let's say I have a .NET Array of n number of dimensions. I would like to foreach through the elements and print out something like:</p>
<pre><code>[0, 0, 0] = 2
[0, 0, 1] = 32
</code></pre>
<p>And so on. I could write a loop using some the Rank and dimension functions to come up with the indices. Is there a built in function instead?</p>
| [
{
"answer_id": 26582,
"author": "Jake Pearson",
"author_id": 632,
"author_profile": "https://Stackoverflow.com/users/632",
"pm_score": 3,
"selected": true,
"text": "public static string Format(Array array)\n{\n var builder = new StringBuilder();\n builder.AppendLine(\"Count: \" + a... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26522",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/632/"
] |
26,536 | <p>My coworker and I have encountered a nasty situation where we have to use an active X control to manipulate a web camera on a page. </p>
<p>Is it possible to assign a javascript event handler to a button in the active x control so that it would fire an action on the page when clicked, or do we have to create a button on the html page itself that manipulates the Active X Control and then can fire any necessary actions on the page?</p>
| [
{
"answer_id": 26679,
"author": "Jared Updike",
"author_id": 2543,
"author_profile": "https://Stackoverflow.com/users/2543",
"pm_score": 2,
"selected": false,
"text": "function Uploader::MyUpdate()\n{\n // ... code to fetch the current state of various\n // properties from the Uplo... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26536",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1942/"
] |
26,547 | <p>Let's say that you want to create a dead simple BlogEditor and, one of your ideas, is to do what Live Writer does and ask only the URL of the persons Blog. How can you detect what type of blog is it?</p>
<p>Basic detection can be done with the URL itself, such as “<a href="http://myblog.blogger.com" rel="nofollow noreferrer">http://myblog.blogger.com</a>” etc. But what if it's self hosted?</p>
<p>I'm mostly interested on how to do this in Java, but this question could be also used as a reference for any other language.</p>
| [
{
"answer_id": 26579,
"author": "Ross",
"author_id": 2025,
"author_profile": "https://Stackoverflow.com/users/2025",
"pm_score": 1,
"selected": false,
"text": "<meta content='blogger' name='generator'/>\n"
},
{
"answer_id": 26589,
"author": "Ryan Farley",
"author_id": 162... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26547",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2644/"
] |
26,551 | <p>I need to pass an ID and a password to a batch file at the time of running rather than hardcoding them into the file.</p>
<p>Here's what the command line looks like:</p>
<pre><code>test.cmd admin P@55w0rd > test-log.txt
</code></pre>
| [
{
"answer_id": 26556,
"author": "Frank Krueger",
"author_id": 338,
"author_profile": "https://Stackoverflow.com/users/338",
"pm_score": 6,
"selected": false,
"text": "%%1 if for %"
},
{
"answer_id": 26702,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": ... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26551",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/730/"
] |
26,552 | <p>What are the advantages and disadvantages of turning <strong><code>NOCOUNT</code></strong> off in SQL server queries?
</p>
| [
{
"answer_id": 26588,
"author": "jerhinesmith",
"author_id": 1108,
"author_profile": "https://Stackoverflow.com/users/1108",
"pm_score": 0,
"selected": false,
"text": "Print"
}
] | 2008/08/25 | [
"https://Stackoverflow.com/questions/26552",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2141/"
] |
26,559 | <p>I know there are a lot of positive things mod-rewrite accomplishes. But are there any negative? Obviously if you have poorly written rules your going to have problems. But what if you have a high volume site and your constantly using mod-rewrite, is it going to have a significant impact on performance? I did a quick search for some benchmarks on Google and didn't find much. </p>
| [
{
"answer_id": 26597,
"author": "Ryan Doherty",
"author_id": 956,
"author_profile": "https://Stackoverflow.com/users/956",
"pm_score": 6,
"selected": true,
"text": ".htaccess .htaccess .htaccess"
},
{
"answer_id": 26770,
"author": "ConroyP",
"author_id": 2287,
"author... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26559",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2687/"
] |
26,567 | <p>I have a report with many fields that I'm trying to get down to 1 page horizontally (I don't care whether it's 2 or 200 pages vertically... just don't want to have to deal with 2 pages wide by x pages long train-wreck). That said, it deals with contact information.</p>
<p>My idea was to do:</p>
<pre><code>Name: Address: City: State: ...
Jon Doe Addr1 ThisTown XX ...
Addr2
Addr3
-----------------------------------------------
Jane Doe Addr1 ThisTown XX ...
Addr2
Addr3
-----------------------------------------------
</code></pre>
<p>Is there some way to set a <code>textbox</code> to be multi-line (or the SQL result)? Have I missed something bloody obvious?</p>
<hr>
<p>The CanGrow Property is on by default, and I've double checked that this is true. My problem is that I don't know how to force a line-break. I get the 3 address fields that just fills a line, then wraps to another. I've tried <code>/n</code>, <code>\n</code> (since I can never remember which is the correct slash to put), <code><br></code>, <code><br /></code> (since the report will be viewed in a ReportViewer control in an ASP.NET website). I can't think of any other ways to wrap the text. </p>
<p>Is there some way to get the results from the database as 3 lines of text/characters?
</p>
| [
{
"answer_id": 30409,
"author": "Pulsehead",
"author_id": 2156,
"author_profile": "https://Stackoverflow.com/users/2156",
"pm_score": 6,
"selected": true,
"text": "= Fields!Addr1.Value + VbCrLf + \n Fields!Addr2.Value + VbCrLf + \n Fields!Addr3.Value\n"
},
{
"answer_id": 358284... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26567",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2156/"
] |
26,570 | <p>I'm looking for a way to get the size of an instance of a reference type. sizeof is only for value types. Is this possible?</p>
| [
{
"answer_id": 6580593,
"author": "serhio",
"author_id": 185593,
"author_profile": "https://Stackoverflow.com/users/185593",
"pm_score": 1,
"selected": false,
"text": "Dim myObjectSize As Long\n\nDim ms As New IO.MemoryStream\nDim bf As New Runtime.Serialization.Formatters.Binary.BinaryF... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26570",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1786/"
] |
26,594 | <p>What libraries/methods do you know of that can do some basic HTML representation in Swing? Can you comment on your experience?</p>
| [
{
"answer_id": 24264560,
"author": "Paolo Fulgoni",
"author_id": 323447,
"author_profile": "https://Stackoverflow.com/users/323447",
"pm_score": 1,
"selected": false,
"text": "BrowserPane JEditorPane JScrollPane BrowserPane browserPane = new BrowserPane();\nJScrollPane scrollPane = new J... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26594",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2644/"
] |
26,595 | <p>Is there any difference between:</p>
<pre><code>if foo is None: pass
</code></pre>
<p>and</p>
<pre><code>if foo == None: pass
</code></pre>
<p>The convention that I've seen in most Python code (and the code I myself write) is the former, but I recently came across code which uses the latter. None is an instance (and the only instance, IIRC) of NoneType, so it shouldn't matter, right? Are there any circumstances in which it might?</p>
| [
{
"answer_id": 26611,
"author": "Brendan",
"author_id": 199,
"author_profile": "https://Stackoverflow.com/users/199",
"pm_score": 9,
"selected": true,
"text": "is True == __eq__() \n>>> class Foo(object):\n def __eq__(self, other):\n return True\n\n>>> f = Foo()\n>>> f ==... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26595",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/156/"
] |
26,620 | <p>In my web app, I submit some form fields with jQuery's <code>$.getJSON()</code> method. I am having some problems with the encoding. The character-set of my app is <code>charset=ISO-8859-1</code>, but I think these fields are submitted with <code>UTF-8</code>. </p>
<p>How I can set encoding used in <code>$.getJSON</code> calls? </p>
| [
{
"answer_id": 26681,
"author": "travis",
"author_id": 1414,
"author_profile": "https://Stackoverflow.com/users/1414",
"pm_score": 6,
"selected": true,
"text": "$.ajax() contentType success error <div id=\"success\"></div> <div id=\"error\"></div> $.ajax({\n type: \"POST\",\n url: ... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26620",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2138/"
] |
26,652 | <p>Is there a way to make a TSQL variable constant?</p>
| [
{
"answer_id": 26655,
"author": "Greg Hurlman",
"author_id": 35,
"author_profile": "https://Stackoverflow.com/users/35",
"pm_score": 0,
"selected": false,
"text": "DECLARE @two INT\nSET @two = 2\n"
},
{
"answer_id": 26656,
"author": "SQLMenace",
"author_id": 740,
"aut... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26652",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1874/"
] |
26,663 | <p>So far, I've only used Rational Quantify. I've heard great things about Intel's VTune, but have never tried it!</p>
<p>Edit: I'm mostly looking for software that will instrument the code, as I guess that's about the only way to get very fine results.</p>
<hr />
<h3>See also:</h3>
<p><a href="https://stackoverflow.com/questions/153559/what-are-some-good-profilers-for-native-c-on-windows">What are some good profilers for native C++ on Windows?</a></p>
| [
{
"answer_id": 4233209,
"author": "Moberg",
"author_id": 393010,
"author_profile": "https://Stackoverflow.com/users/393010",
"pm_score": 3,
"selected": false,
"text": "ProfilingTimer::ProfilingTimer(std::string name)\n : mLocalName(name)\n{\n sNestedName += mLocalName;\n sNestedName += \... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26663",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2638/"
] |
26,719 | <p>I have a set of multiple assemblies (one assembly is to be used as an API and it depends on other assemblies). I would like to merge all assemblies into one single assembly but prevent all assemblies except the API one to be visible from the outside.</p>
<p>I will then obfuscate this assembly with Xenocode. From what I have seen, it is impossible to internalize assembly with Xenocode.</p>
<p>I have seen ILMerge from Microsoft, but was unable to figure if it can do what I want.
<a href="http://research.microsoft.com/~mbarnett/ILMerge.aspx" rel="nofollow noreferrer">http://research.microsoft.com/~mbarnett/ILMerge.aspx</a></p>
| [
{
"answer_id": 177982,
"author": "Ant",
"author_id": 11529,
"author_profile": "https://Stackoverflow.com/users/11529",
"pm_score": 1,
"selected": false,
"text": "InternalsVisibleTo internal public"
}
] | 2008/08/25 | [
"https://Stackoverflow.com/questions/26719",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1508/"
] |
26,721 | <p>When creating scrollable user controls with .NET and WinForms I have repeatedly encountered situations where, for example, a vertical scrollbar pops up, overlapping the control's content, causing a horizontal scrollbar to also be needed. Ideally the content would shrink just a bit to make room for the vertical scrollbar.</p>
<p>My current solution has been to just keep my controls out of the far right 40 pixels or so that the vertical scroll-bar will be taking up. Since this is still effectively client space for the control, the horizontal scroll-bar still comes up when it gets covered by the vertical scroll-bar, even though no controls are being hidden at all. But then at least the user doesn't actually need to <strong>use</strong> the horizontal scrollbar that comes up.</p>
<p>Is there a better way to make this all work? Some way to keep the unneeded and unwanted scrollbars from showing up at all?</p>
| [
{
"answer_id": 26782,
"author": "Bryan Roth",
"author_id": 299,
"author_profile": "https://Stackoverflow.com/users/299",
"pm_score": 0,
"selected": false,
"text": "myPanel.AutoScroll = False\n"
},
{
"answer_id": 27032,
"author": "Community",
"author_id": -1,
"author_p... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26721",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2729/"
] |
26,732 | <pre><code><servlet>
<servlet-name>myservlet</servlet-name>
<servlet-class>workflow.WDispatcher</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>myservlet</servlet-name>
<url-pattern>*NEXTEVENT*</url-pattern>
</servlet-mapping>
</code></pre>
<p>Above is the snippet from Tomcat's <code>web.xml</code>. The URL pattern <code>*NEXTEVENT*</code> on start up throws</p>
<blockquote>
<p>java.lang.IllegalArgumentException: Invalid <url-pattern> in servlet mapping</p>
</blockquote>
<p>It will be greatly appreciated if someone can hint at the error.
</p>
| [
{
"answer_id": 26744,
"author": "McDowell",
"author_id": 304,
"author_profile": "https://Stackoverflow.com/users/304",
"pm_score": 8,
"selected": true,
"text": "<url-pattern>*NEXTEVENT*</url-pattern>\n"
}
] | 2008/08/25 | [
"https://Stackoverflow.com/questions/26732",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
26,733 | <p>Using reflection, how can I get all types that implement an interface with C# 3.0/.NET 3.5 with the least code, and minimizing iterations?</p>
<p>This is what I want to re-write:</p>
<pre><code>foreach (Type t in this.GetType().Assembly.GetTypes())
if (t is IMyInterface)
; //do stuff
</code></pre>
| [
{
"answer_id": 26745,
"author": "Lasse V. Karlsen",
"author_id": 267,
"author_profile": "https://Stackoverflow.com/users/267",
"pm_score": 4,
"selected": false,
"text": "Type ti = typeof(IYourInterface);\nforeach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies()) {\n foreach (T... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26733",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1782/"
] |
26,743 | <p>I use .NET XML technologies quite extensively on my work. One of the things the I like very much is the XSLT engine, more precisely the extensibility of it. However there one little piece which keeps being a source of annoyance. Nothing major or something we can't live with but it is preventing us from producing the beautiful XML we would like to produce. </p>
<p>One of the things we do is transform nodes inline and importing nodes from one XML document to another. </p>
<p>Sadly , when you save nodes to an <code>XmlTextWriter</code> (actually whatever <code>XmlWriter.Create(Stream)</code> returns), the namespace definitions get all thrown in there, regardless of it is necessary (previously defined) or not. You get kind of the following xml:</p>
<pre><code><root xmlns:abx="http://bladibla">
<abx:child id="A">
<grandchild id="B">
<abx:grandgrandchild xmlns:abx="http://bladibla" />
</grandchild>
</abx:child>
</root>
</code></pre>
<p>Does anyone have a suggestion as to how to convince .NET to be efficient about its namespace definitions?</p>
<p>PS. As an added bonus I would like to override the default namespace, changing it as I write a node.</p>
| [
{
"answer_id": 6421794,
"author": "Simon Mourier",
"author_id": 403671,
"author_profile": "https://Stackoverflow.com/users/403671",
"pm_score": 1,
"selected": false,
"text": "myWriter.WriteAttributeString(\"xmlns\", \"abx\", null, \"http://bladibla\");\n"
},
{
"answer_id": 648273... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26743",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2892/"
] |
26,760 | <p>I have some strings of xxh:yym format where xx is hours and yy is minutes like "05h:30m". What is an elegant way to convert a string of this type to TimeSpan?</p>
| [
{
"answer_id": 26769,
"author": "Lars Mæhlum",
"author_id": 960,
"author_profile": "https://Stackoverflow.com/users/960",
"pm_score": 6,
"selected": true,
"text": "TimeSpan span;\n\n\nif (TimeSpan.TryParse(\"05h:30m\".Replace(\"m\",\"\").Replace(\"h\",\"\"), out span))\n Messa... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26760",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31505/"
] |
26,762 | <p>Our dev shop currently uses Visual SourceSafe. We all know how that could end up (badly), so we're investigating other systems. First up is Perforce. Does anyone have experience with using it and its integration into Visual Studio (2003/2005/2008)? Is it as good as any other, or is it pretty solid with good features, comparatively?</p>
| [
{
"answer_id": 96192,
"author": "MP24",
"author_id": 6206,
"author_profile": "https://Stackoverflow.com/users/6206",
"pm_score": 0,
"selected": false,
"text": "p4 edit"
}
] | 2008/08/25 | [
"https://Stackoverflow.com/questions/26762",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1212/"
] |
26,795 | <p>I have an extender (IExtenderProvider) which extends certain types of
controls with additional properties. For one of these properties, I have
written a UITypeEditor. So far, all works just fine.</p>
<p>The extender also has a couple of properties itself, which I am trying to
use as a sort of default for the UITypeEditor. What I want to do is to be
able to set a property on the extender itself (not the extended controls),
and when I open up the UITypeEditor for one of the additional properties on
an extended control, I want to set a value in the UITypeEditor to the value
of the property on the extender.</p>
<p>A simple example: The ExtenderProvider has a property DefaultExtendedValue. On the form I set the value of this property to "My Value". Extended controls have, through the provider, a property ExtendedValue with a UITypeEditor. When I open the editor for the property ExtendedValue the default (initial) value should be set to "My Value".</p>
<p>It seems to me that the best place to do this would be
UITypeEditor.EditValue, just before calling
IWindowsFormsEditorService.DropDownControl or .ShowDialog.</p>
<p>The only problem is that I can't (or I haven't discovered how to) get hold
of the extender provider itself in EditValue, to read the value of the property in question and set it in the UITypeEditor. Context gives me the extended
control, but that is of no use to me in this case.</p>
<p>Is there any way to achieve what I'm trying? Any help appreciated!</p>
<p>Thanks
Tom</p>
<hr>
<p>@samjudson: That's not a bad idea, but unfortunately it doesn't quite get me there. I'd really like to be able to set this default value individually for each instance of the extender provider. (I might have more than one on a single form with different values for different groups of extended controls.)</p>
| [
{
"answer_id": 187256,
"author": "Keith",
"author_id": 905,
"author_profile": "https://Stackoverflow.com/users/905",
"pm_score": 2,
"selected": false,
"text": "DefaultValueAttribute att = context.\n PropertyDescriptor.Attributes.\n OfType<DefaultValueAttribute>().\n FirstOrDefau... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26795",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2899/"
] |
26,796 | <p>What is the best way to use ResolveUrl() in a Shared/static function in Asp.Net? My current solution for VB.Net is:</p>
<pre><code>Dim x As New System.Web.UI.Control
x.ResolveUrl("~/someUrl")
</code></pre>
<p>Or C#:</p>
<pre><code>System.Web.UI.Control x = new System.Web.UI.Control();
x.ResolveUrl("~/someUrl");
</code></pre>
<p>But I realize that isn't the best way of calling it.</p>
| [
{
"answer_id": 528198,
"author": "jdw",
"author_id": 64181,
"author_profile": "https://Stackoverflow.com/users/64181",
"pm_score": 5,
"selected": false,
"text": "public static string GetUrl(int id)\n{\n string path = VirtualPathUtility.ToAbsolute(\"~/SomePage.aspx\");\n return stri... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26796",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1414/"
] |
26,800 | <p>I'm using XPath in .NET to parse an XML document, along the lines of:</p>
<pre class="lang-cs prettyprint-override"><code>XmlNodeList lotsOStuff = doc.SelectNodes("//stuff");
foreach (XmlNode stuff in lotsOStuff) {
XmlNode stuffChild = stuff.SelectSingleNode("//stuffChild");
// ... etc
}
</code></pre>
<p>The issue is that the XPath Query for <code>stuffChild</code> is always returning the child of the first <code>stuff</code> element, never the rest. Can XPath not be used to query against an individual <code>XMLElement</code>?</p>
| [
{
"answer_id": 26805,
"author": "Chris Marasti-Georg",
"author_id": 96,
"author_profile": "https://Stackoverflow.com/users/96",
"pm_score": 4,
"selected": true,
"text": "// XmlNode stuffChild = stuff.SelectSingleNode(\".//stuffChild\");\n xmlNode stuffChild = stuff.SelectSingleNode(\"sel... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26800",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1965/"
] |
26,809 | <p>I frequently have problems dealing with <code>DataRows</code> returned from <code>SqlDataAdapters</code>. When I try to fill in an object using code like this:</p>
<pre><code>DataRow row = ds.Tables[0].Rows[0];
string value = (string)row;
</code></pre>
<p>What is the best way to deal with <code>DBNull's</code> in this type of situation.</p>
| [
{
"answer_id": 26832,
"author": "Dan Herbert",
"author_id": 392,
"author_profile": "https://Stackoverflow.com/users/392",
"pm_score": 6,
"selected": true,
"text": "int? value = 5;\n as as null DBNull as DataRow row = ds.Tables[0].Rows[0];\nstring value = row as string;\n row DBNull value... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26809",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2191/"
] |
26,816 | <p>is there a way to abort threads created with QueueUserWorkItem?</p>
<p>Or maybe I don't need to? What happens if the main application exits? Are all thread created from it aborted automatically?</p>
| [
{
"answer_id": 896492,
"author": "Lukas Šalkauskas",
"author_id": 5369,
"author_profile": "https://Stackoverflow.com/users/5369",
"pm_score": 0,
"selected": false,
"text": "bool stop = false;\nvoid doDownloadWork(object s) \n{\n if (!stop)\n {\n DownloadLink((String)s, location... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26816",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1782/"
] |
26,825 | <p>I have a CollapsiblePanelExtender that will not collapse. I have "collapsed" set to true and all the ControlID set correctly. I try to collapse and it goes through the animation but then expands almost instantly. This is in an User Control with the following structure.</p>
<pre><code><asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataSourceID="odsPartners" Width="450px" BorderWidth="0"
ShowHeader="false" ShowFooter="false" AllowSorting="true"
onrowdatabound="GridView1_RowDataBound">
<Columns>
<asp:TemplateField HeaderText="Contract Partners" SortExpression="Name">
<ItemTemplate>
<asp:Panel id="pnlRow" runat="server">
<table>
...Stuff...
</table>
</asp:Panel>
<ajaxToolkit:CollapsiblePanelExtender runat="server" ID="DDE"
Collapsed="true" ImageControlID="btnExpander" ExpandedImage="../Images/collapse.jpg" CollapsedImage="../Images/expand.jpg"
TargetControlID="DropPanel" CollapseControlID="btnExpander" ExpandControlID="btnExpander" />
<asp:Panel ID="DropPanel" runat="server" CssClass="CollapsedPanel">
<asp:Table ID="tblContracts" runat="server">
<asp:TableRow ID="row" runat="server">
<asp:TableCell ID="spacer" runat="server" Width="30">&nbsp;</asp:TableCell>
<asp:TableCell ID="cellData" runat="server" Width="400">
<uc1:ContractList ID="ContractList1" runat="server" PartnerID='<%# Bind("ID") %>' />
</asp:TableCell>
</asp:TableRow>
</asp:Table>
</asp:Panel>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="tbFilter" EventName="TextChanged" />
</Triggers>
</asp:UpdatePanel>
</code></pre>
| [
{
"answer_id": 26918,
"author": "Dillie-O",
"author_id": 71,
"author_profile": "https://Stackoverflow.com/users/71",
"pm_score": 0,
"selected": false,
"text": "AutoExpand=\"False\"\n"
},
{
"answer_id": 27026,
"author": "Craig",
"author_id": 2894,
"author_profile": "ht... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26825",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2894/"
] |
26,834 | <p>I have an application, built using MVC, that produces a view which delivers summary information across a number of models. Further to that, some calculations are performed across the different sets of data.</p>
<p>There's no clear single model (that maps to a table at least) that seems to make sense as the starting point for this, so the various summaries are pulled from the contributing models in the controller, passed into the view and the calculations are performed there.</p>
<p>But that seems, well, <em>dirty</em>. But controllers are supposed to be lightweight, aren't they? And business logic shouldn't be in views, as I have it as present.</p>
<p>So where should this information be assembled? A new model, that doesn't map to a table? A library function/module? Or something else?</p>
<p>(Although I see this as mostly of an architectural/pattern question, I'm working in Rails, FWIW.)</p>
<p><strong>Edit</strong>: Good answers all round, and a lot of consensus, which is reassuring. I "accepted" the answer I did to keep the link to Railscasts at the top. I'm behind in my Railscast viewing - something I shall make strenuous attempts to rectify!</p>
| [
{
"answer_id": 26848,
"author": "Brian Warshaw",
"author_id": 1344,
"author_profile": "https://Stackoverflow.com/users/1344",
"pm_score": 1,
"selected": false,
"text": "ActiveRecord::Base"
}
] | 2008/08/25 | [
"https://Stackoverflow.com/questions/26834",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1060/"
] |
26,842 | <p>I'm attempting to use an existing CAS server to authenticate login for a Perl CGI web script and am using the <a href="http://search.cpan.org/dist/AuthCAS" rel="nofollow noreferrer">AuthCAS</a> Perl module (v 1.3.1). I can connect to the CAS server to get the service ticket but when I try to connect to validate the ticket my script returns with the following error from the <a href="http://search.cpan.org/dist/IO-Socket-SSL" rel="nofollow noreferrer">IO::Socket::SSL</a> module:</p>
<pre><code> 500 Can't connect to [CAS Server]:443 (Bad hostname '[CAS Server]')
([CAS Server] substituted for real server name)
</code></pre>
<p>Symptoms/Tests:</p>
<ol>
<li>If I type the generated URL for the authentication into the web browser's location bar it returns just fine with the expected XML snippet. So it is not a bad host name.</li>
<li>If I generate a script without using the AuthCAS module but using the IO::Socket::SSL module directly to query the CAS server for validation on the generated service ticket the Perl script will run fine from the command line but not in the browser.</li>
<li>If I add the AuthCAS module into the script in item 2, the script no longer works on the command line and still doesn't work in the browser.</li>
</ol>
<p>Here is the bare-bones script that produces the error:</p>
<pre><code>#!/usr/bin/perl
use strict;
use warnings;
use CGI;
use AuthCAS;
use CGI::Carp qw( fatalsToBrowser );
my $id = $ENV{QUERY_STRING};
my $q = new CGI;
my $target = "http://localhost/cgi-bin/testCAS.cgi";
my $cas = new AuthCAS(casUrl => 'https://cas_server/cas');
if ($id eq ""){
my $login_url = $cas->getServerLoginURL($target);
printf "Location: $login_url\n\n";
exit 0;
} else {
print $q->header();
print "CAS TEST<br>\n";
## When coming back from the CAS server a ticket is provided in the QUERY_STRING
print "QUERY_STRING = " . $id . "</br>\n";
## $ST should contain the received Service Ticket
my $ST = $q->param('ticket');
my $user = $cas->validateST($target, $ST); #### This is what fails
printf "Error: %s\n", &AuthCAS::get_errors() unless (defined $user);
}
</code></pre>
<p>Any ideas on where the conflict might be?</p>
<hr>
<p>The error is coming from the line directly above the snippet Cebjyre quoted namely</p>
<pre><code>$ssl_socket = new IO::Socket::SSL(%ssl_options);
</code></pre>
<p>namely the socket creation. All of the input parameters are correct. I had edited the module to put in debug statements and print out all the parameters just before that call and they are all fine. Looks like I'm going to have to dive deeper into the IO::Socket::SSL module.</p>
| [
{
"answer_id": 27602,
"author": "Cebjyre",
"author_id": 1612,
"author_profile": "https://Stackoverflow.com/users/1612",
"pm_score": -1,
"selected": false,
"text": "[...]\nunless ($ssl_socket) {\n $errors = sprintf \"error %s unable to connect https://%s:%s/\\n\",&IO::Socket::SSL::errs... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26842",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/171/"
] |
26,845 | <p>I'd like to hear from people who are using distributed version control (aka distributed revision control, decentralized version control) and how they are finding it. What are you using, Mercurial, Darcs, Git, Bazaar? Are you still using it? If you've used client/server rcs in the past, are you finding it better, worse or just different? What could you tell me that would get me to jump on the bandwagon? Or jump off for that matter, I'd be interested to hear from people with negative experiences as well. </p>
<p>I'm currently looking at replacing our current source control system (Subversion) which is the impetus for this question.</p>
<p>I'd be especially interested in anyone who's used it with co-workers in other countries, where your machines may not be on at the same time, and your connection is very slow.</p>
<p>If you're not sure what distributed version control is, here are a couple articles:</p>
<p><a href="http://betterexplained.com/articles/intro-to-distributed-version-control-illustrated/" rel="nofollow noreferrer">Intro to Distributed Version Control</a></p>
<p><a href="http://en.wikipedia.org/wiki/Distributed_revision_control" rel="nofollow noreferrer">Wikipedia Entry</a></p>
| [
{
"answer_id": 30657,
"author": "Ben Collins",
"author_id": 3279,
"author_profile": "https://Stackoverflow.com/users/3279",
"pm_score": 2,
"selected": false,
"text": ". git-sh-setup"
},
{
"answer_id": 738292,
"author": "David Thornley",
"author_id": 14148,
"author_pro... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26845",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1329401/"
] |
26,855 | <p>I'm currently using the module <code>URI::URL</code> to generate a full URL from a relative URL; however, it isn't running as fast as I'd like it to be. Does anyone know another way to do this that may be faster?</p>
| [
{
"answer_id": 26894,
"author": "Brendan",
"author_id": 199,
"author_profile": "https://Stackoverflow.com/users/199",
"pm_score": 0,
"selected": false,
"text": "$full_url = $base_url . $relative_url"
},
{
"answer_id": 26960,
"author": "Peter Stuifzand",
"author_id": 1633,... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26855",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2901/"
] |
26,857 | <p>Using C# and ASP.NET I want to programmatically fill in some values (4 text boxes) on a web page (form) and then 'POST' those values. How do I do this?</p>
<p>Edit: Clarification: There is a service (www.stopforumspam.com) where you can submit ip, username and email address on their 'add' page. I want to be able to create a link/button on my site's page that will fill in those values and submit the info without having to copy/paste them across and click the submit button.</p>
<p>Further clarification: How do automated spam bots fill out forms and click the submit button if they were written in C#?</p>
| [
{
"answer_id": 26881,
"author": "Ryan Farley",
"author_id": 1627,
"author_profile": "https://Stackoverflow.com/users/1627",
"pm_score": 7,
"selected": true,
"text": "WebRequest req = WebRequest.Create(\"http://mysite/myform.aspx\");\nstring postData = \"item1=11111&item2=22222&Item3=3333... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26857",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1463/"
] |
26,860 | <p>I'm a web developer, and I want to make the web sites I develop more accessible to those using screen readers. What limitations do screen readers have that I should be most aware of, and what can I do to avoid hitting these limitations.</p>
<p>This question was sparked by reading another question about <a href="https://stackoverflow.com/questions/8472/best-non-image-based-captcha">non-image based captchas</a>. In there, a commenter said that honey pot form fields (form fields hidden with CSS that only a bot would fill in), are a bad idea, because screen readers would still pick them up. </p>
<p>Are screen readers really so primitive that they would read text that isn't even displayed on the screen? Ideally, couldn't you make a screen reader that waited until the page was finished loading, applied all css, and even ran Javascript onload functions before it figured out what was actually displayed, and then read that off to the user? You could probably even identify parts of the page that are menus or table of contents, and give some sort of easy way for those parts to be read exclusively or skipped over. I would think that the programming community could come up with a better solution to this problem. </p>
| [
{
"answer_id": 26917,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 1,
"selected": false,
"text": "<label for=\"Requestor\" accesskey=\"9\"><span class=\"required\"> Requestor * </span><span class=\"hidden\">req... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26860",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1862/"
] |
26,863 | <p>I had a plugin installed in Visual Studio 2008, and it created some extra dockable windows. I have uninstalled it, and I can't get rid of the windows it created - I close them, but they always come back. They're just empty windows now, since the plugin is no longer present, but nothing I've tried gets rid of them. I've tried:</p>
<ul>
<li>Window -> Reset Window Layout</li>
<li>Deleting the .suo files in my project directories</li>
<li>Deleting the Visual Studio 9.0 folder in my Application Settings directory</li>
</ul>
<p>Any ideas?</p>
| [
{
"answer_id": 26945,
"author": "Vin",
"author_id": 1747,
"author_profile": "https://Stackoverflow.com/users/1747",
"pm_score": 4,
"selected": false,
"text": "Devenv.exe /ResetSettings\n Devenv.exe /ResetSettings \"C:\\My Files\\MySettings.vssettings\"\n"
},
{
"answer_id": 334518... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26863",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2348/"
] |
26,877 | <p>In C#, what is the difference (if any) between these two lines of code?</p>
<pre><code>tmrMain.Elapsed += new ElapsedEventHandler(tmrMain_Tick);
</code></pre>
<p>and</p>
<pre><code>tmrMain.Elapsed += tmrMain_Tick;
</code></pre>
<p>Both appear to work exactly the same. Does C# just assume you mean the former when you type the latter?</p>
| [
{
"answer_id": 26884,
"author": "Orion Edwards",
"author_id": 234,
"author_profile": "https://Stackoverflow.com/users/234",
"pm_score": 6,
"selected": true,
"text": "static void Hook1()\n{\n someEvent += new EventHandler( Program_someEvent );\n}\n\nstatic void Hook2()\n{\n someEven... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26877",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/369/"
] |
26,879 | <p>I have a website that is perfectely centered aligned. The CSS code works fine. The problem doesn't really have to do with CSS. I have headers for each page that perfectely match eachother.</p>
<p>However, when the content gets larger, Opera and FireFox show a scrollbar at the left so you can scroll to the content not on the screen. This makes my site jump a few pixels to the left. Thus the headers are not perfectely aligned anymore.</p>
<p>IE always has a scrollbar, so the site never jumps around in IE. </p>
<p>Does anyone know a JavaScript/CSS/HTML solution for this problem?</p>
| [
{
"answer_id": 26907,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": " #middle \n { \nposition: relative;\nmargin: 0px auto 0px auto; \nwidth: 1000px; \nmax-width: 1000px;\n}\n"
... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26879",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
26,882 | <p>My asp.net page will render different controls based on which report a user has selected e.g. some reports require 5 drop downs, some two checkboxes and 6 dropdowns).</p>
<p>They can select a report using two methods. With <code>SelectedReport=MyReport</code> in the query string, or by selecting it from a dropdown. And it's a common case for them to come to the page with SelectedReport in the query string, and then change the report selected in the drop down.</p>
<p>My question is, is there anyway of making the dropdown modify the query string when it's selected. So I'd want <code>SelectedReport=MyNewReport</code> in the query string and the page to post back.</p>
<p>At the moment it's just doing a normal postback, which leaves the <code>SelectedReport=MyReport</code> in the query string, even if it's not the currently selected report.</p>
<p><strong>Edit:</strong> And I also need to preserve ViewState.</p>
<p>I've tried doing <code>Server.Transfer(Request.Path + "?SelectedReport=" + SelectedReport, true)</code> in the event handler for the Dropdown, and this works function wise, unfortunately because it's a Server.Transfer (to preserve ViewState) instead of a Response.Redirect the URL lags behind what's shown.</p>
<p>Maybe I'm asking the impossible or going about it completely the wrong way. </p>
<p><strong>@Craig</strong> The QueryString collection is read-only and cannot be modified.<br>
<strong>@Jason</strong> That would be great, except I'd lose the ViewState wouldn't I? (Sorry I added that after seeing your response).</p>
| [
{
"answer_id": 26943,
"author": "Jason Bunting",
"author_id": 1790,
"author_profile": "https://Stackoverflow.com/users/1790",
"pm_score": 2,
"selected": false,
"text": "<script>\n function changeReport(dropDownList) {\n var selectedReport = dropDownList.options[dropDownList.sel... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26882",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/233/"
] |
26,903 | <p>Is there a way?</p>
<p>I need all types that implement a specific interface to have a parameterless constructor, can it be done?</p>
<p>I am developing the base code for other developers in my company to use in a specific project.</p>
<p>There's a proccess which will create instances of types (in different threads) that perform certain tasks, and I need those types to follow a specific contract (ergo, the interface).</p>
<p>The interface will be internal to the assembly</p>
<p>If you have a suggestion for this scenario without interfaces, I'll gladly take it into consideration...</p>
| [
{
"answer_id": 27047,
"author": "aku",
"author_id": 1196,
"author_profile": "https://Stackoverflow.com/users/1196",
"pm_score": 3,
"selected": false,
"text": "interface ITest<T> where T: new()\n{\n //...\n}\n\nclass Test: ITest<Test>\n{\n //...\n}\n"
},
{
"answer_id": 27049... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26903",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1782/"
] |
26,904 | <p>I have a large exiting C++ project involving:</p>
<ul>
<li>4 applications</li>
<li>50+ libraries</li>
<li>20+ third party libraries</li>
</ul>
<p>The project uses QMake (part of Trolltech's Qt) to build the production version on Linux, but I've been playing around at building it on MacOS.</p>
<p>I can build in on MacOS using QMake just fine but I'm having trouble producing the final .app. It needs collecting all the third party frameworks and dynamic libraries, all the project's dynamic libraries and making sure the application finds them.</p>
<p>I've read online about using install_name_tool but was wondering if there's a process to automate it.</p>
<p>(Maybe the answer is to use XCode, see related question, but it would have issues with building uic and moc)</p>
<p>Thanks </p>
| [
{
"answer_id": 82054,
"author": "mxcl",
"author_id": 6444,
"author_profile": "https://Stackoverflow.com/users/6444",
"pm_score": 2,
"selected": false,
"text": " macx*:!macx-xcode:release {\n system( QT=\\'$$QT\\' QMAKE_LIBDIR_QT=\\'$$QMAKE_LIBDIR_QT\\' $$ROOT_DIR/common/dist/mac/Make... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26904",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2711/"
] |
26,925 | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/8127/pre-build-task-deleting-the-working-copy-in-cruisecontrol-net">Pre-build task - deleting the working copy in CruiseControl.NET</a> </p>
</blockquote>
<p>I would like to delete my working directory during the cruisecontrol build process...I'm sure this is easy, but I have been unable to find an example of it...</p>
<p>If you know how to create a directory, that would be useful as well.</p>
<p>Thanks.</p>
| [
{
"answer_id": 26968,
"author": "Ian Patrick Hughes",
"author_id": 2213,
"author_profile": "https://Stackoverflow.com/users/2213",
"pm_score": 0,
"selected": false,
"text": "\nstatic void Main(string[] args) \n\n{\n for (int n = 0; n < args.Length; n++)\n {\n if ... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26925",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1638/"
] |
26,947 | <p>What built-in PHP functions are useful for web scraping? What are some good resources (web or print) for getting up to speed on web scraping with PHP?</p>
| [
{
"answer_id": 26955,
"author": "Brian Warshaw",
"author_id": 1344,
"author_profile": "https://Stackoverflow.com/users/1344",
"pm_score": 0,
"selected": false,
"text": "file_get_contents()"
},
{
"answer_id": 103554,
"author": "tyshock",
"author_id": 16448,
"author_pro... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26947",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2052/"
] |
26,971 | <p>As someone who hasn't used either technology on real-world projects I wonder if anyone knows how these two complement each other and how much their functionalities overlap?</p>
| [
{
"answer_id": 8580564,
"author": "Ali Adravi",
"author_id": 586227,
"author_profile": "https://Stackoverflow.com/users/586227",
"pm_score": 0,
"selected": false,
"text": "MyDataContext db = new MyDataContext();\nList<CUSTOMER_ORDER_LINEITEMResult> records = db.CUSTOMER_ORDER_LINEITEM(pr... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26971",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2133/"
] |
26,984 | <p>I have been in both situations: </p>
<ul>
<li>Creating too many custom Exceptions</li>
<li>Using too many general Exception class</li>
</ul>
<p>In both cases the project started OK but soon became an overhead to maintain (and refactor).</p>
<p>So what is the best practice regarding the creation of your own Exception classes?</p>
| [
{
"answer_id": 27000,
"author": "Konrad Rudolph",
"author_id": 1968,
"author_profile": "https://Stackoverflow.com/users/1968",
"pm_score": 2,
"selected": false,
"text": "NullPointerException IndexOutofBoundsException"
},
{
"answer_id": 27041,
"author": "Landon Kuhn",
"aut... | 2008/08/25 | [
"https://Stackoverflow.com/questions/26984",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2644/"
] |
27,009 | <p>What are some of the strategies that are used when implementing FxCop / static analysis on existing code bases with existing violations? How can one most effectively reduce the static analysis violations?</p>
| [
{
"answer_id": 378439,
"author": "Patrick from NDepend team",
"author_id": 27194,
"author_profile": "https://Stackoverflow.com/users/27194",
"pm_score": -1,
"selected": false,
"text": "warnif count > 0 \nfrom m in Methods\nwhere m.CyclomaticComplexity > 20 &&\n m.WasAdded() || m.Cod... | 2008/08/25 | [
"https://Stackoverflow.com/questions/27009",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2822/"
] |
27,018 | <p>When applying the Single Responsibility Principle and looking at a class's reason to change, how do you determine whether that reason too change is too granular, or not granular enough?</p>
| [
{
"answer_id": 378439,
"author": "Patrick from NDepend team",
"author_id": 27194,
"author_profile": "https://Stackoverflow.com/users/27194",
"pm_score": -1,
"selected": false,
"text": "warnif count > 0 \nfrom m in Methods\nwhere m.CyclomaticComplexity > 20 &&\n m.WasAdded() || m.Cod... | 2008/08/25 | [
"https://Stackoverflow.com/questions/27018",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2822/"
] |
27,020 | <p>I have an Excel Spreadsheet like this</p>
<pre>
id | data for id
| more data for id
id | data for id
id | data for id
| more data for id
| even more data for id
id | data for id
| more data for id
id | data for id
id | data for id
| more data for id
</pre>
<p>Now I want to group the data of one id by alternating the background color of the rows</p>
<pre>
var color = white
for each row
if the first cell is not empty and color is white
set color to green
if the first cell is not empty and color is green
set color to white
set background of row to color
</pre>
<p>Can anyone help me with a macro or some VBA code</p>
<p>Thanks</p>
| [
{
"answer_id": 27139,
"author": "Jason Z",
"author_id": 2470,
"author_profile": "https://Stackoverflow.com/users/2470",
"pm_score": 3,
"selected": true,
"text": "Public Sub HighLightRows()\n Dim i As Integer\n i = 1\n Dim c As Integer\n c = 3 'red\n\n Do While (Cells... | 2008/08/25 | [
"https://Stackoverflow.com/questions/27020",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2798/"
] |
27,027 | <p>So you know a lot of Mac apps use "bundles": It looks like a single file to your application, but it's actually a folder with many files inside.</p>
<p>For a version control system to handle this, it needs to:</p>
<ul>
<li>check out all the files in a directory, so the app can modify them as necessary</li>
<li>at checkin,
<ul>
<li>commit files which have been modified</li>
<li>add new files which the application has created</li>
<li>mark as deleted files which are no longer there (since the app deleted them)</li>
<li>manage this as one atomic change</li>
</ul></li>
</ul>
<p>Any ideas on the best way to handle this with existing version control systems? Are any of the versioning systems more adept in this area? </p>
| [
{
"answer_id": 19727594,
"author": "akauppi",
"author_id": 14455,
"author_profile": "https://Stackoverflow.com/users/14455",
"pm_score": 1,
"selected": false,
"text": "hg addremove $ hg help addremove\nhg addremove [OPTION]... [FILE]...\n\nadd all new files, delete all missing files\n"
... | 2008/08/25 | [
"https://Stackoverflow.com/questions/27027",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/116/"
] |
27,030 | <p>I want to compare 2 arrays of objects in JavaScript code. The objects have 8 total properties, but each object will not have a value for each, and the arrays are never going to be any larger than 8 items each, so maybe the brute force method of traversing each and then looking at the values of the 8 properties is the easiest way to do what I want to do, but before implementing, I wanted to see if anyone had a more elegant solution. Any thoughts?</p>
| [
{
"answer_id": 27212,
"author": "Jason Bunting",
"author_id": 1790,
"author_profile": "https://Stackoverflow.com/users/1790",
"pm_score": 7,
"selected": true,
"text": "function objectsAreSame(x, y) {\n var objectsAreSame = true;\n for(var propertyName in x) {\n if(x[propertyName... | 2008/08/25 | [
"https://Stackoverflow.com/questions/27030",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2176/"
] |
27,034 | <p>My JavaScript is pretty nominal, so when I saw this construction, I was kind of baffled:</p>
<pre><code>var shareProxiesPref = document.getElementById("network.proxy.share_proxy_settings");
shareProxiesPref.disabled = proxyTypePref.value != 1;
</code></pre>
<p>Isn't it better to do an if on <code>proxyTypePref.value</code>, and then declare the var inside the result, only if you need it?</p>
<p>(Incidentally, I also found this form very hard to read in comparison to the normal usage. There were a set of two or three of these conditionals, instead of doing a single if with a block of statements in the result.)</p>
<hr>
<p><strong>UPDATE:</strong></p>
<p>The responses were very helpful and asked for more context. The code fragment is from Firefox 3, so you can see the code here:</p>
<p><a href="http://mxr.mozilla.org/firefox/source/browser/components/preferences/connection.js" rel="nofollow noreferrer">http://mxr.mozilla.org/firefox/source/browser/components/preferences/connection.js</a></p>
<p>Basically, when you look at the <strong>Connect</strong> preferences window in Firefox, clicking the proxy <strong>modes</strong> (radio buttons), causes various form elements to enable|disable.</p>
| [
{
"answer_id": 27039,
"author": "Konrad Rudolph",
"author_id": 1968,
"author_profile": "https://Stackoverflow.com/users/1968",
"pm_score": 2,
"selected": false,
"text": "sharedProxiesPref.disabled"
},
{
"answer_id": 27319,
"author": "17 of 26",
"author_id": 2284,
"aut... | 2008/08/25 | [
"https://Stackoverflow.com/questions/27034",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
27,044 | <p>I'm accessing an Ubuntu machine using PuTTY, and using gcc.</p>
<p>The default <code>LANG</code> environment variable on this machine is set to <code>en_NZ.UTF-8</code>, which causes GCC to think PuTTY is capable of displaying UTF-8 text, which it doesn't seem to be.
Maybe it's my font, I don't know - it does this:</p>
<pre><code>foo.c:1: error: expected â=â, â,â, â;â, âasmâ or â__attribute__â at end of input
</code></pre>
<p>If I set it with <code>export LANG=en_NZ</code>, then this causes GCC to behave correctly, I get:</p>
<pre><code>foo.c:1: error: expected '=', ',', ';', 'asm' or '__attribute__' at end of input
</code></pre>
<p>but this then causes everything else to go wrong. For example</p>
<pre><code>man foo
man: can't set the locale; make sure $LC_* and $LANG are correct
</code></pre>
<p>I've trawled Google and I can't for the life of me find out what I have to put in there for it to just use ASCII. <code>en_NZ.ASCII</code> doesn't work, nor do any of the other things I can find.</p>
<p>Thanks</p>
| [
{
"answer_id": 27051,
"author": "C. K. Young",
"author_id": 13,
"author_profile": "https://Stackoverflow.com/users/13",
"pm_score": 3,
"selected": true,
"text": "LANG=en_NZ en_NZ /var/lib/locales/supported.d/local en_NZ ISO-8859-1 /usr/sbin/locale-gen locale-gen en_NZ"
},
{
"answ... | 2008/08/25 | [
"https://Stackoverflow.com/questions/27044",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/234/"
] |
27,065 | <p>Do any of you know of a tool that will search for .class files and then display their compiled versions?</p>
<p>I know you can look at them individually in a hex editor but I have a lot of class files to look over (something in my giant application is compiling to Java6 for some reason).</p>
| [
{
"answer_id": 27123,
"author": "McDowell",
"author_id": 304,
"author_profile": "https://Stackoverflow.com/users/304",
"pm_score": 6,
"selected": false,
"text": "ClassFile {\n u4 magic;\n u2 minor_version;\n u2 major_version;\n CA FE BA BE 00 00 00 33\n import java.io.*;\n\npubl... | 2008/08/25 | [
"https://Stackoverflow.com/questions/27065",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1666/"
] |
27,071 | <p>I have an old C library with a function that takes a void**:</p>
<pre><code>oldFunction(void** pStuff);
</code></pre>
<p>I'm trying to call this function from managed C++ (m_pStuff is a member of the parent ref class of type void*):</p>
<pre><code>oldFunction( static_cast<sqlite3**>( &m_pStuff ) );
</code></pre>
<p>This gives me the following error from Visual Studio:</p>
<blockquote>
<p>error C2440: 'static_cast' : cannot convert from 'cli::interior_ptr' to 'void **'</p>
</blockquote>
<p>I'm guessing the compiler is converting the void* member pointer to a cli::interior_ptr behind my back.</p>
<p>Any advice on how to do this?</p>
| [
{
"answer_id": 27326,
"author": "Ben Childs",
"author_id": 2925,
"author_profile": "https://Stackoverflow.com/users/2925",
"pm_score": 2,
"selected": true,
"text": "#pragma unmanaged\n\nvoid* m_pStuff\n\n#pragma managed\n // TestSol.cpp : main project file.\n\n#include \"stdafx.h\"\n\nus... | 2008/08/25 | [
"https://Stackoverflow.com/questions/27071",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39040/"
] |
27,077 | <p>When I do:</p>
<pre><code>$ find /
</code></pre>
<p>It searches the entire system.<br>
How do I prevent that?</p>
<p>(This question comes from an "<a href="https://stackoverflow.com/questions/18836/why-doesnt-find-find-anything#26182">answer</a>" to another question.)</p>
| [
{
"answer_id": 27084,
"author": "Jon Ericson",
"author_id": 1438,
"author_profile": "https://Stackoverflow.com/users/1438",
"pm_score": 2,
"selected": false,
"text": "$ ls *.ksh\n"
},
{
"answer_id": 27089,
"author": "dmckee --- ex-moderator kitten",
"author_id": 2509,
... | 2008/08/25 | [
"https://Stackoverflow.com/questions/27077",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1438/"
] |
27,078 | <p>I am debugging my ASP.NET application on my Windows XP box with a virtual directory set up in IIS (5.1).</p>
<p>I am also running <strong>VirtualPC</strong> with XP and IE6 for testing purposes. When I connect to my real machine from the virtual machine, I enter the URL: <a href="http://machinename/projectname" rel="nofollow noreferrer">http://machinename/projectname</a>.</p>
<p>I get a security popup to connect to my machine (which I expect), but the User name field is disabled. I cannot change it from machinename\Guest to machinename\username in order to connect.</p>
<p>How do I get this to enable so I can enter the correct credentials.</p>
| [
{
"answer_id": 27084,
"author": "Jon Ericson",
"author_id": 1438,
"author_profile": "https://Stackoverflow.com/users/1438",
"pm_score": 2,
"selected": false,
"text": "$ ls *.ksh\n"
},
{
"answer_id": 27089,
"author": "dmckee --- ex-moderator kitten",
"author_id": 2509,
... | 2008/08/25 | [
"https://Stackoverflow.com/questions/27078",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/417/"
] |
27,095 | <p>I did this Just for kicks (so, not exactly a question, i can see the downmodding happening already) but, in lieu of Google's newfound <a href="http://www.google.com/search?hl=en&q=1999999999999999-1999999999999995&btnG=Search" rel="nofollow noreferrer">inability</a> to do <a href="http://www.google.com/search?hl=en&q=400000000000002-400000000000001&btnG=Search" rel="nofollow noreferrer">math</a> <a href="http://www.google.com/search?hl=en&q=10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001-10000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&btnG=Search" rel="nofollow noreferrer">correctly</a> (check it! according to google 500,000,000,000,002 - 500,000,000,000,001 = 0), i figured i'd try the following in C to run a little theory.</p>
<pre><code>int main()
{
char* a = "399999999999999";
char* b = "399999999999998";
float da = atof(a);
float db = atof(b);
printf("%s - %s = %f\n", a, b, da-db);
a = "500000000000002";
b = "500000000000001";
da = atof(a);
db = atof(b);
printf("%s - %s = %f\n", a, b, da-db);
}
</code></pre>
<p>When you run this program, you get the following</p>
<pre><code> 399999999999999 - 399999999999998 = 0.000000
500000000000002 - 500000000000001 = 0.000000
</code></pre>
<p>It would seem like Google is using simple 32 bit floating precision (the error here), if you switch float for double in the above code, you fix the issue! Could this be it?</p>
<p>/mp</p>
| [
{
"answer_id": 28443,
"author": "Derek Park",
"author_id": 872,
"author_profile": "https://Stackoverflow.com/users/872",
"pm_score": 1,
"selected": false,
"text": "Double.MaxValue Double.MaxValue Double.PositiveInfinity"
}
] | 2008/08/25 | [
"https://Stackoverflow.com/questions/27095",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/547/"
] |
27,148 | <p>I want to merge multiple rss feeds into a single feed, removing any duplicates. Specifically, I'm interested in merging the feeds for the <a href="https://stackoverflow.com/tags">tags</a> I'm interested in.</p>
<p>[A quick <a href="http://www.google.com/search?q=rss+merge+reader" rel="nofollow noreferrer">search</a> turned up some promising links, which I don't have time to visit at the moment]</p>
<hr />
<p>Broadly speaking, the ideal would be a reader that would list all the available tags on the site and toggle them on and off, allowing me to explore what's available, keep track of questions I've visited, new answers on interesting feeds, etc, etc . . . though I don't suppose such a things exists right now.</p>
<p>As I randomly explore the site and see questions I think are interesting, I inevitably find "oh yes, that one looked interesting a couple days ago when I read it the first time, and hasn't been updated since". It would be much nicer if my machine would keep track of such deails for me :)</p>
<hr />
<p><strong>Update:</strong> You can now use "and", "or", and "not" to combine multiple tags into a single feed: <a href="https://blog.stackoverflow.com/2008/10/tags-and-tags-or-tags/">Tags AND Tags OR Tags</a></p>
<hr />
<p><strong>Update:</strong> You can now use <a href="https://stackexchange.com/filters">Filters</a> to watch tags across one or multiple sites: <a href="https://blog.stackoverflow.com/2011/04/improved-tag-sets/">Improved Tag Stes</a></p>
| [
{
"answer_id": 36441,
"author": "Emperor XLII",
"author_id": 2495,
"author_profile": "https://Stackoverflow.com/users/2495",
"pm_score": 2,
"selected": false,
"text": "'#' '+' '+' http://pipes.yahoo.com/pipes/pipe.run?_id=uP22vN923RG_c71O1ZzWFw&_render=rss&tags=.net+c%23+powershell\n"
... | 2008/08/26 | [
"https://Stackoverflow.com/questions/27148",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2495/"
] |
27,219 | <p>Given a select with multiple option's in jQuery. </p>
<pre><code>$select = $("<select></select>");
$select.append("<option>Jason</option>") //Key = 1
.append("<option>John</option>") //Key = 32
.append("<option>Paul</option>") //Key = 423
</code></pre>
<p>How should the key be stored and retrieved?</p>
<p>The ID may be an OK place but would not be guaranteed unique if I had multiple select's sharing values (and other scenarios).</p>
<p>Thanks</p>
<p>and in the spirit of TMTOWTDI.</p>
<pre><code>$option = $("<option></option>");
$select = $("<select></select>");
$select.addOption = function(value,text){
$(this).append($("<option/>").val(value).text(text));
};
$select.append($option.val(1).text("Jason").clone())
.append("<option value=32>John</option>")
.append($("<option/>").val(423).text("Paul"))
.addOption("321","Lenny");
</code></pre>
| [
{
"answer_id": 27231,
"author": "Lucas Wilson-Richter",
"author_id": 1157,
"author_profile": "https://Stackoverflow.com/users/1157",
"pm_score": 3,
"selected": false,
"text": "<option> <option value=1>Jason</option>\n"
},
{
"answer_id": 27259,
"author": "Juan",
"author_id... | 2008/08/26 | [
"https://Stackoverflow.com/questions/27219",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1293/"
] |
27,220 | <p>I'm looking for a method, or a code snippet for converting std::string to LPCWSTR</p>
| [
{
"answer_id": 27291,
"author": "17 of 26",
"author_id": 2284,
"author_profile": "https://Stackoverflow.com/users/2284",
"pm_score": 4,
"selected": false,
"text": "#include <atlbase.h>\n#include <atlconv.h>\n\n. . .\n\nstring myStr(\"My string\");\nCA2W unicodeStr(myStr);\n"
},
{
... | 2008/08/26 | [
"https://Stackoverflow.com/questions/27220",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2701/"
] |
27,222 | <p>I am looking for good methods of manipulating HTML in PHP. For example, the problem I currently have is dealing with malformed HTML.</p>
<p>I am getting input that looks something like this:</p>
<pre><code><div>This is some <b>text
</code></pre>
<p>As you noticed, the HTML is missing closing tags. I could use regex or an XML Parser to solve this problem. However, it is likely that I will have to do other DOM manipulation in the future. I wonder if there are any good PHP libraries that handle DOM manipulation similar to how Javascript deals with DOM manipulation.</p>
| [
{
"answer_id": 4303405,
"author": "Decko",
"author_id": 320702,
"author_profile": "https://Stackoverflow.com/users/320702",
"pm_score": 2,
"selected": false,
"text": "$d = new DOMDocument;\n$d->loadHTML('<div>This is some <b>text');\n$d->saveHTML();\n <!DOCTYPE html PUBLIC \"-//W3C//DTD ... | 2008/08/26 | [
"https://Stackoverflow.com/questions/27222",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/889/"
] |
27,240 | <p>In Java 5 and above you have the foreach loop, which works magically on anything that implements <code>Iterable</code>:</p>
<pre><code>for (Object o : list) {
doStuff(o);
}
</code></pre>
<p>However, <code>Enumerable</code> still does not implement <code>Iterable</code>, meaning that to iterate over an <code>Enumeration</code> you must do the following:</p>
<pre><code>for(; e.hasMoreElements() ;) {
doStuff(e.nextElement());
}
</code></pre>
<p>Does anyone know if there is a reason why <code>Enumeration</code> still does not implement <code>Iterable</code>?</p>
<p><strong>Edit:</strong> As a clarification, I'm not talking about the language concept of an <a href="http://en.wikipedia.org/wiki/Enumerated_type" rel="noreferrer">enum</a>, I'm talking a Java-specific class in the Java API called '<a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Enumeration.html" rel="noreferrer">Enumeration</a>'. </p>
| [
{
"answer_id": 38518,
"author": "erickson",
"author_id": 3474,
"author_profile": "https://Stackoverflow.com/users/3474",
"pm_score": 6,
"selected": false,
"text": "Enumeration Iterable Iterable Iterator Enumeration Iterator Enumeration Iterable Iterable iterator() Iterator Enumeration En... | 2008/08/26 | [
"https://Stackoverflow.com/questions/27240",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1666/"
] |
27,242 | <p>I've had a lot of good experiences learning about web development on <a href="http://www.w3schools.com/" rel="nofollow noreferrer">w3schools.com</a>. It's hit or miss, I know, but the PHP and CSS sections specifically have proven very useful for reference.</p>
<p>Anyway, I was wondering if there was a similar site for <a href="http://en.wikipedia.org/wiki/JQuery" rel="nofollow noreferrer">jQuery</a>. I'm interested in learning, but I need it to be online/searchable, so I can refer back to it easily when I need the information in the future.</p>
<p>Also, as a brief aside, is jQuery worth learning? Or should I look at different JavaScript libraries? I know Jeff uses jQuery on Stack Overflow and it seems to be working well.</p>
<p>Thanks!</p>
<p><strong>Edit</strong>: jQuery's website has a <a href="http://docs.jquery.com/Tutorials" rel="nofollow noreferrer">pretty big list of tutorials</a>, and a seemingly comprehensive <a href="http://docs.jquery.com/Main_Page" rel="nofollow noreferrer">documentation page</a>. I haven't had time to go through it all yet, has anyone else had experience with it?</p>
<p><strong>Edit 2</strong>: It seems Google is now hosting the jQuery libraries. That should give jQuery a pretty big advantage in terms of publicity. </p>
<p>Also, if everyone uses a single unified aQuery library hosted at the same place, it should get cached for most Internet users early on and therefore not impact the download footprint of your site should you decide to use it.</p>
<h2>2 Months Later...</h2>
<p><strong>Edit 3</strong>: I started using jQuery on a project at work recently and it is great to work with! Just wanted to let everyone know that I have concluded it is <strong><em>ABSOLUTELY</em></strong> worth it to learn and use jQuery.</p>
<p>Also, I learned almost entirely from the Official jQuery <a href="http://docs.jquery.com/Main_Page" rel="nofollow noreferrer">documentation</a> and <a href="http://docs.jquery.com/Tutorials" rel="nofollow noreferrer">tutorials</a>. It's very straightforward.</p>
<h2>10 Months Later...</h2>
<p>jQuery is a part of just about every web app I've made since I initially wrote this post. It makes progressive enhancement a breeze, and helps make the code maintainable.</p>
<p>Also, all the jQuery plug-ins are an invaluable resource!</p>
<h2>3 Years Later...</h2>
<p>Still using jQuery just about every day. I now author jQuery plug-ins and consult full time. I'm primarily a Djangonaut but I've done several javascript only contracts with jQuery. It's a life saver.</p>
<p>From one jQuery user to another... You should look at <a href="http://api.jquery.com/category/plugins/templates/" rel="nofollow noreferrer">templating with jQuery</a> (or underscore -- see below).</p>
<p>Other things I've found valuable in addition to jQuery (with estimated portion of projects I use it on):</p>
<ul>
<li><a href="http://jquery.malsup.com/form/" rel="nofollow noreferrer">jQuery Form Plugin</a> (95%)</li>
<li><a href="http://mudge.github.com/jquery_example/" rel="nofollow noreferrer">jQuery Form Example Plugin</a> (75%)</li>
<li><a href="http://jqueryui.com/" rel="nofollow noreferrer">jQuery UI</a> (70%)</li>
<li><a href="http://documentcloud.github.com/underscore/" rel="nofollow noreferrer">Underscore.js</a> (80%)</li>
<li><a href="http://jashkenas.github.com/coffee-script/" rel="nofollow noreferrer">CoffeeScript</a> (30%)</li>
<li><a href="http://documentcloud.github.com/backbone/" rel="nofollow noreferrer">Backbone.js</a> (10%)</li>
</ul>
| [
{
"answer_id": 926131,
"author": "egyamado",
"author_id": 66493,
"author_profile": "https://Stackoverflow.com/users/66493",
"pm_score": 2,
"selected": false,
"text": "<script language=\"javascript\" type=\"text/javascript\">\n $(function() {\n $('a').click(function() {\n ... | 2008/08/26 | [
"https://Stackoverflow.com/questions/27242",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2908/"
] |
27,247 | <p>I need to know about Epoll On linux System.</p>
<p>Could you recommend manual or guides about epoll library?</p>
<p>need more detailed guides. it's better to have some examples.</p>
<p>help me. and Thank you for reading.</p>
| [
{
"answer_id": 6150841,
"author": "Viswesn",
"author_id": 527813,
"author_profile": "https://Stackoverflow.com/users/527813",
"pm_score": 4,
"selected": false,
"text": "#include <stdio.h>\n#include <stdlib.h>\n#include <string.h>\n#include <unistd.h>\n#include <sys/types.h>\n#include <sy... | 2008/08/26 | [
"https://Stackoverflow.com/questions/27247",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2370764/"
] |
27,258 | <p>I'm about to start a fairly Ajax heavy feature in my company's application. What I need to do is make an Ajax callback every few minutes a user has been on the page. </p>
<ul>
<li>I don't need to do any DOM updates before, after, or during the callbacks. </li>
<li>I don't need any information from the page, just from a site cookie which should always be sent with requests anyway, and an ID value.</li>
</ul>
<p>What I'm curious to find out, is if there is any clean and simple way to make a JavaScript Ajax callback to an ASP.NET page without posting back the rest of the information on the page. I'd like to not have to do this if it is possible.</p>
<p>I really just want to be able to call a single method on the page, nothing else.</p>
<p>Also, I'm restricted to ASP.NET 2.0 so I can't use any of the new 3.5 framework ASP AJAX features, although I can use the ASP AJAX extensions for the 2.0 framework.</p>
<p><strong>UPDATE</strong><br>
I've decided to accept <a href="https://stackoverflow.com/questions/27258/aspnet-javascript-callbacks-without-full-postbacks#27270">DanP</a>'s answer as it seems to be exactly what I'm looking for. Our site already uses jQuery for some things so I'll probably use jQuery for making requests since in my experience it seems to perform much better than ASP's AJAX framework does. </p>
<p>What do you think would be the best method of transferring data to the IHttpHandler? Should I add variables to the query string or POST the data I need to send?</p>
<p>The only thing I think I have to send is a single ID, but I can't decide what the best method is to send the ID and have the IHttpHandler handle it. I'd like to come up with a solution that would prevent a person with basic computer skills from accidentally or intentionally accessing the page directly or repeating requests. Is this possible?</p>
| [
{
"answer_id": 27270,
"author": "Daniel Pollard",
"author_id": 2758,
"author_profile": "https://Stackoverflow.com/users/2758",
"pm_score": 4,
"selected": true,
"text": "public class RSSHandler : IHttpHandler\n {\n public void ProcessRequest (HttpContext context)\n { \n... | 2008/08/26 | [
"https://Stackoverflow.com/questions/27258",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/392/"
] |
27,266 | <p>I heard that if you use port 443 (the port usually used for https) for ssh, the encrypted packets look the same to your isp.</p>
<p>Could this be a way to avoid traffic shaping/throttling?</p>
| [
{
"answer_id": 27463,
"author": "tghw",
"author_id": 2363,
"author_profile": "https://Stackoverflow.com/users/2363",
"pm_score": 2,
"selected": false,
"text": "SecureSocket"
}
] | 2008/08/26 | [
"https://Stackoverflow.com/questions/27266",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2908/"
] |
27,267 | <p>I've been interacting with Amazon S3 through <a href="https://addons.mozilla.org/en-US/firefox/addon/3247" rel="noreferrer">S3Fox</a> and I can't seem to delete my buckets. I select a bucket, hit delete, confirm the delete in a popup, and... nothing happens. Is there another tool that I should use?</p>
| [
{
"answer_id": 1179190,
"author": "MattLor",
"author_id": 144148,
"author_profile": "https://Stackoverflow.com/users/144148",
"pm_score": 5,
"selected": false,
"text": "./s3cmd.rb deleteall <your bucket name>\n require 'aws/s3'\n\nAWS::S3::Base.establish_connection!(\n:access_key_id => '... | 2008/08/26 | [
"https://Stackoverflow.com/questions/27267",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/658/"
] |
27,288 | <p>I know that this should be easy but how do I export/save a DataGridView to excel?</p>
| [
{
"answer_id": 27306,
"author": "brendan",
"author_id": 225,
"author_profile": "https://Stackoverflow.com/users/225",
"pm_score": -1,
"selected": false,
"text": "\n Public Overloads Shared Function BuildExcel(ByVal gView As System.Web.UI.WebControls.GridView) As String\n\n Pr... | 2008/08/26 | [
"https://Stackoverflow.com/questions/27288",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/359/"
] |
27,294 | <p>I'm working on an internal project for my company, and part of the project is to be able to parse various "Tasks" from an XML file into a collection of tasks to be ran later.</p>
<p>Because each type of Task has a multitude of different associated fields, I decided it would be best to represent each type of Task with a seperate class.</p>
<p>To do this, I constructed an abstract base class:</p>
<pre><code>public abstract class Task
{
public enum TaskType
{
// Types of Tasks
}
public abstract TaskType Type
{
get;
}
public abstract LoadFromXml(XmlElement task);
public abstract XmlElement CreateXml(XmlDocument currentDoc);
}
</code></pre>
<p>Each task inherited from this base class, and included the code necessary to create itself from the passed in XmlElement, as well as serialize itself back out to an XmlElement.</p>
<p>A basic example:</p>
<pre><code>public class MergeTask : Task
{
public override TaskType Type
{
get { return TaskType.Merge; }
}
// Lots of Properties / Methods for this Task
public MergeTask (XmlElement elem)
{
this.LoadFromXml(elem);
}
public override LoadFromXml(XmlElement task)
{
// Populates this Task from the Xml.
}
public override XmlElement CreateXml(XmlDocument currentDoc)
{
// Serializes this class back to xml.
}
}
</code></pre>
<p>The parser would then use code similar to this to create a task collection:</p>
<pre><code>XmlNode taskNode = parent.SelectNode("tasks");
TaskFactory tf = new TaskFactory();
foreach (XmlNode task in taskNode.ChildNodes)
{
// Since XmlComments etc will show up
if (task is XmlElement)
{
tasks.Add(tf.CreateTask(task as XmlElement));
}
}
</code></pre>
<p>All of this works wonderfully, and allows me to pass tasks around using the base class, while retaining the structure of having individual classes for each task.</p>
<p>However, I am not happy with my code for TaskFactory.CreateTask. This method accepts an XmlElement, and then returns an instance of the appropriate Task class:</p>
<pre><code>public Task CreateTask(XmlElement elem)
{
if (elem != null)
{
switch(elem.Name)
{
case "merge":
return new MergeTask(elem);
default:
throw new ArgumentException("Invalid Task");
}
}
}
</code></pre>
<p>Because I have to parse the XMLElement, I'm using a huge (10-15 cases in the real code) switch to pick which child class to instantiate. I'm hoping there is some sort of polymorphic trick I can do here to clean up this method.</p>
<p>Any advice?</p>
| [
{
"answer_id": 27310,
"author": "DevelopingChris",
"author_id": 1220,
"author_profile": "https://Stackoverflow.com/users/1220",
"pm_score": 5,
"selected": true,
"text": "public Task CreateTask(XmlElement elem)\n{\n if (elem != null)\n { \n try\n {\n Assembly ... | 2008/08/26 | [
"https://Stackoverflow.com/questions/27294",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1965/"
] |
27,303 | <p>Anyone know if it's possible to databind the ScaleX and ScaleY of a render transform in Silverlight 2 Beta 2? Binding transforms is possible in WPF - But I'm getting an error when setting up my binding in Silverlight through XAML. Perhaps it's possible to do it through code?</p>
<pre><code><Image Height="60" HorizontalAlignment="Right"
Margin="0,122,11,0" VerticalAlignment="Top" Width="60"
Source="Images/Fish128x128.png" Stretch="Fill"
RenderTransformOrigin="0.5,0.5" x:Name="fishImage">
<Image.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX="1" ScaleY="1"/>
<SkewTransform/>
<RotateTransform/>
<TranslateTransform/>
</TransformGroup>
</Image.RenderTransform>
</Image>
</code></pre>
<p>I want to bind the ScaleX and ScaleY of the ScaleTransform element.</p>
<p>I'm getting a runtime error when I try to bind against a double property on my data context: </p>
<pre><code>Message="AG_E_PARSER_BAD_PROPERTY_VALUE [Line: 1570 Position: 108]"
</code></pre>
<p>My binding looks like this:</p>
<pre><code><ScaleTransform ScaleX="{Binding Path=SelectedDive.Visibility}"
ScaleY="{Binding Path=SelectedDive.Visibility}"/>
</code></pre>
<p>I have triple verified that the binding path is correct - I'm binding a slidebar against the same value and that works just fine...</p>
<p>Visibility is of type double and is a number between 0.0 and 30.0. I have a value converter that scales that number down to 0.5 and 1 - I want to scale the size of the fish depending on the clarity of the water. So I don't think it's a problem with the type I'm binding against...</p>
| [
{
"answer_id": 27309,
"author": "Matt Hamilton",
"author_id": 615,
"author_profile": "https://Stackoverflow.com/users/615",
"pm_score": 1,
"selected": false,
"text": "<ScaleTransform ScaleX=\"{Binding Foo}\" ScaleY=\"{Binding Bar}\" />\n"
},
{
"answer_id": 27401,
"author": "M... | 2008/08/26 | [
"https://Stackoverflow.com/questions/27303",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1199387/"
] |
27,359 | <p>I want to setup a cron job to rsync a remote system to a backup partition, something like:</p>
<pre><code>bash -c 'rsync -avz --delete --exclude=proc --exclude=sys root@remote1:/ /mnt/remote1/'
</code></pre>
<p>I would like to be able to "set it and forget it" but what if <code>/mnt/remote1</code> becomes unmounted? (After a reboot or something) I'd like to error out if <code>/mnt/remote1</code> isn't mounted, rather than filling up the local filesystem.</p>
<p><strong>Edit:</strong><br />
Here is what I came up with for a script, cleanup improvements appreciated (especially for the empty then ... else, I couldn't leave them empty or bash errors)</p>
<pre><code>#!/bin/bash
DATA=data
ERROR="0"
if cut -d' ' -f2 /proc/mounts | grep -q "^/mnt/$1\$"; then
ERROR=0
else
if mount /dev/vg/$1 /mnt/$1; then
ERROR=0
else
ERROR=$?
echo "Can't backup $1, /mnt/$1 could not be mounted: $ERROR"
fi
fi
if [ "$ERROR" = "0" ]; then
if cut -d' ' -f2 /proc/mounts | grep -q "^/mnt/$1/$DATA\$"; then
ERROR=0
else
if mount /dev/vg/$1$DATA /mnt/$1/data; then
ERROR=0
else
ERROR=$?
echo "Can't backup $1, /mnt/$1/data could not be mounted."
fi
fi
fi
if [ "$ERROR" = "0" ]; then
rsync -aqz --delete --numeric-ids --exclude=proc --exclude=sys \
root@$1.domain:/ /mnt/$1/
RETVAL=$?
echo "Backup of $1 completed, return value of rsync: $RETVAL"
fi
</code></pre>
| [
{
"answer_id": 27370,
"author": "Harley Holcombe",
"author_id": 1057,
"author_profile": "https://Stackoverflow.com/users/1057",
"pm_score": 2,
"selected": false,
"text": "if df |grep -q '/mnt/mountpoint$'\n then\n echo \"Found mount point, running task\"\n # Do some stuf... | 2008/08/26 | [
"https://Stackoverflow.com/questions/27359",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/163/"
] |
27,381 | <p>I'm asking this question purely from a usability <code>standpoint</code>!</p>
<p>Should a website <code>expand/stretch</code> to fill the viewing area when you resize a browser window?</p>
<p>I know for sure there are the obvious cons:</p>
<ul>
<li>Wide columns of text are hard to read.</li>
<li>Writing html/css using percents can be a pain.</li>
<li>It makes you vulnerable to having your design stretched past it's limits if an image is too wide, or a block of text is added that is too long. <strong>(see it's a pain to code the html/css</strong>).</li>
</ul>
<p>The only Pro I can think of is that users who use the font-resizing that is built into their browser won't have to deal with columns that are only a few words long, with a body of <code>white-space</code> on either side.</p>
<p>However, I think that may be a browser problem more than anything else (Firefox 3 allows you to zoom <strong>everything</strong> instead of just the text, which comes in handy all the time)</p>
<p><strong>edit</strong>: I noticed stack overflow is fixed width, but coding horror resizes. It seems Jeff doesn't have a strong preference either way.</p>
| [
{
"answer_id": 132102,
"author": "paperhorse",
"author_id": 4498,
"author_profile": "https://Stackoverflow.com/users/4498",
"pm_score": 0,
"selected": false,
"text": "max-width window width fixed width"
},
{
"answer_id": 216295,
"author": "Kornel",
"author_id": 27009,
... | 2008/08/26 | [
"https://Stackoverflow.com/questions/27381",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2908/"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.