qid int64 4 22.2M | question stringlengths 18 48.3k | answers list | date stringlengths 10 10 | metadata list |
|---|---|---|---|---|
253,099 | <p>I want to examine the contents of a <code>std::vector</code> in GDB, how do I do it? Let's say it's a <code>std::vector<int></code> for the sake of simplicity.</p>
| [
{
"answer_id": 253101,
"author": "John Carter",
"author_id": 8331,
"author_profile": "https://Stackoverflow.com/users/8331",
"pm_score": 8,
"selected": false,
"text": "print *(myVector._M_impl._M_start)@myVector.size()\n"
},
{
"answer_id": 2123260,
"author": "Michał Oniszczuk... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253099",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8331/"
] |
253,121 | <p>In CSS, you can specify the spacing between table cells using the border-spacing property of a table.</p>
<p>However, this results in uniform spacing between columns and rows, and I am finding more situations where the designs I am using call for gaps between rows, but not columns, or visa versa.</p>
<p>If I have a solid background, I can simulate spacing using borders the same colour as the background colour.</p>
<p>I could also make a div (for example) the first child of every table cell, and using either padding or margins to get the desired results, but that is a lot of extra markup just to accommodate the style.</p>
<p>Given that that the data I am displaying is tabular data, is there a sensible way to achieve this style using tables?</p>
| [
{
"answer_id": 253126,
"author": "C. K. Young",
"author_id": 13,
"author_profile": "https://Stackoverflow.com/users/13",
"pm_score": 5,
"selected": true,
"text": "border-spacing"
}
] | 2008/10/31 | [
"https://Stackoverflow.com/questions/253121",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1577190/"
] |
253,125 | <p>Does anyone know how I can add a class to the link rendered using the Html.RouteLink helper method in ASP.Net MVC, it has the htmlAttributes object as the last parameter which I assumed I would be able to use, but since class is obviously a reserved word, I cannot supply this as one of the properties on the object.</p>
| [
{
"answer_id": 253180,
"author": "Hrvoje Hudo",
"author_id": 1407,
"author_profile": "https://Stackoverflow.com/users/1407",
"pm_score": 3,
"selected": false,
"text": "<%= Html.RouteLink(\"Default\", \"Default\",null, new { Class=\"css_class\"}) %>\n"
},
{
"answer_id": 253369,
... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253125",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5160/"
] |
253,138 | <p>Having a bit of trouble with the syntax where we want to call a delegate anonymously within a Control.Invoke.</p>
<p>We have tried a number of different approaches, all to no avail.</p>
<p>For example:</p>
<pre><code>myControl.Invoke(delegate() { MyMethod(this, new MyEventArgs(someParameter)); });
</code></pre>
<p>where someParameter is local to this method</p>
<p>The above will result in a compiler error:</p>
<blockquote>
<p>Cannot convert anonymous method to type 'System.Delegate' because it is not a delegate type</p>
</blockquote>
| [
{
"answer_id": 253148,
"author": "François",
"author_id": 32379,
"author_profile": "https://Stackoverflow.com/users/32379",
"pm_score": 4,
"selected": false,
"text": "myControl.Invoke(new MethodInvoker(delegate() {...}))\n"
},
{
"answer_id": 253149,
"author": "Jelon",
"au... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253138",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7140/"
] |
253,142 | <p>I'd like to post some form variables into a classic ASP page. I don't want to have to alter the classic ASP pages, because of the amount of work that would need to be done, and the amount of pages that consume them.</p>
<p>The classic ASP page expects form variables Username and Userpassword to be submitted to them.</p>
<pre><code>username = Request.Form("UserName")
userpassword = Request.Form("Userpassword")
</code></pre>
<p>It then performs various actions and sets up sessions, going into an ASP application.</p>
<p>I want to submit these variables into the page from ASP.NET, but the login control is nested inside usercontrols and templates, so I can't get the form element's names to be "username" and "UserPassword".</p>
<p>Any ideas?</p>
| [
{
"answer_id": 253195,
"author": "digiguru",
"author_id": 5055,
"author_profile": "https://Stackoverflow.com/users/5055",
"pm_score": 0,
"selected": false,
"text": "public class RemotePost{\n private System.Collections.Specialized.NameValueCollection Inputs \n = new System.Col... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253142",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5055/"
] |
253,157 | <p>Is there a way to resize a <code>std::vector</code> to lower capacity when I no longer need previously reserved space?</p>
| [
{
"answer_id": 253173,
"author": "Sébastien RoccaSerra",
"author_id": 2797,
"author_profile": "https://Stackoverflow.com/users/2797",
"pm_score": 7,
"selected": true,
"text": "swap"
},
{
"answer_id": 9525865,
"author": "Alex Korban",
"author_id": 221619,
"author_profi... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253157",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23766/"
] |
253,170 | <p>I'm addicted to Vim, it's now my de facto way of editing text files.</p>
<p>Being that it's mainly a text editor and not an IDE, has anyone got tricks for me to make it easier when developing Java apps?</p>
<p>Some questions I have:</p>
<ul>
<li>How do I invoke a maven task without leaving vi?</li>
<li>Can I get code completion?</li>
<li>How's the syntax highlighting?</li>
</ul>
<p>Anything else (other than "Don't do it!") that I should know about?</p>
| [
{
"answer_id": 257276,
"author": "ngn",
"author_id": 23109,
"author_profile": "https://Stackoverflow.com/users/23109",
"pm_score": 5,
"selected": false,
"text": ":!mvn"
},
{
"answer_id": 836623,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stacko... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253170",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2443/"
] |
253,178 | <p>I'm developing my first Word 2007 addin, and I've added an OfficeRibbon to my project. In a button-click handler, I'd like a reference to either the current <code>Word.Document</code> or <code>Word.Application</code>.</p>
<p>I'm trying to get a reference via the <code>OfficeRibbon.Context</code> property, which the documentation says should refer to the current <code>Application</code> object. However, it is always <code>null</code>.</p>
<p>Does anyone know either</p>
<p>a) if there is something I need to do to make <code>OfficeRibbon.Context</code> appear correctly populated?<br>
b) if there is some other way I can get a reference to the Word Application or active Word Document?</p>
<p>Notes:</p>
<ul>
<li><p>I'm using VS2008 SP1</p></li>
<li><p>The ribbon looks like it has initialized fine: The ribbon renders correctly in Word; I can step the debugger through both the constructor and the OnLoad members; Button click handlers execute correctly. </p></li>
<li><p>Here's <a href="http://msdn.microsoft.com/en-us/library/microsoft.office.tools.ribbon.officeribbon.context.aspx?ppud=4" rel="nofollow noreferrer">the online help for this property</a>; </p></li>
</ul>
<blockquote>
<p><strong>OfficeRibbon.Context Property</strong></p>
<p><code>C#</code><br>
<code>public Object Context { get; internal set; }</code></p>
<p>An Object that represents the Inspector window or application instance that is associated with this OfficeRibbon object. </p>
<p><strong>Remarks</strong></p>
<p>In Outlook, this property refers to the Inspector window in which this OfficeRibbon is displayed.</p>
<p>In Excel, Word, and PowerPoint, this property returns the application instance in which this OfficeRibbon is displayed. </p>
</blockquote>
| [
{
"answer_id": 895455,
"author": "Joseph Sturtevant",
"author_id": 317,
"author_profile": "https://Stackoverflow.com/users/317",
"pm_score": 3,
"selected": true,
"text": "internal static"
},
{
"answer_id": 896622,
"author": "Michael Regan",
"author_id": 1027,
"author_... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253178",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6722/"
] |
253,179 | <p>I am starting new project with SqlServer and Linq to Sql.
What data type would be better for surrogate keys in tables: <code>identity</code> or <code>uniqueidentifier</code> ?</p>
<p>As I understood, <code>identity</code> is automatically generated on insert, while <code>uniqueidentifier</code> should be generated in code (GUID). </p>
<p>Are there any significant performance differences?
e.g. <code>identity</code> value must be read after insert, so there is extra database trip after insert. </p>
<p><strong>Edit:</strong><br>
I found very detailed answer in another question: <a href="https://stackoverflow.com/questions/5600/tables-with-no-primary-key">Tables with no primary keys</a>. Read selected answer.</p>
<p><strong>Edit 2:</strong><br>
<em>Regarding answers about surrogate keys: I like surrogate keys more than natural keys. That decision is done, so please do not suggest to reconsider database design. Also, please, do not discuss pros and cons of natural and surrogate keys.</em></p>
| [
{
"answer_id": 253199,
"author": "James Curran",
"author_id": 12725,
"author_profile": "https://Stackoverflow.com/users/12725",
"pm_score": 0,
"selected": false,
"text": "uniqueidentifier"
}
] | 2008/10/31 | [
"https://Stackoverflow.com/questions/253179",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25732/"
] |
253,198 | <p>What is the best way to send e-mail using outlook express from the command line? It has to be an automated operation with no user interaction. There will be some .jpg files in attachment.
Thanks.</p>
| [
{
"answer_id": 254845,
"author": "PabloG",
"author_id": 394,
"author_profile": "https://Stackoverflow.com/users/394",
"pm_score": 0,
"selected": false,
"text": "; Send a mail vía outlook \"automation\"\n\n$sRcpt = \"test@test.com\"\n$sSubj = \"Test subject\"\n$sBody = \"This is a test\"\... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253198",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3221/"
] |
253,211 | <p>I'm working on a C# library which offloads certain work tasks to the GPU using NVIDIA's CUDA. An example of this is adding two arrays together using extension methods:</p>
<pre><code>float[] a = new float[]{ ... }
float[] b = new float[]{ ... }
float[] c = a.Add(b);
</code></pre>
<p>The work in this code is done on the GPU. However, I would like it to be done asynchronously such that only when the result is needed will the code running on the CPU block (if the result is not finished on the GPU yet). To do this I've created an ExecutionResult class which hides the asynchronous execution. In use this looks as follows:</p>
<pre><code>float[] a = new float[]{ ... }
float[] b = new float[]{ ... }
ExecutionResult res = a.Add(b);
float[] c = res; //Implicit converter
</code></pre>
<p>At the last line the program blocks if the data is done ready yet. I'm not certain of the best way to implement this blocking behavior inside the ExecutionResult class as I'm not very experienced with synchronizing threads and those sorts of things.</p>
<pre><code>public class ExecutionResult<T>
{
private T[] result;
private long computed = 0;
internal ExecutionResult(T[] a, T[] b, Action<T[], T[], Action<T[]>> f)
{
f(a, b, UpdateData); //Asych call - 'UpdateData' is the callback method
}
internal void UpdateData(T[] data)
{
if (Interlocked.Read(ref computed) == 0)
{
result = data;
Interlocked.Exchange(ref computed, 1);
}
}
public static implicit operator T[](ExecutionResult<T> r)
{
//This is obviously a stupid way to do it
while (Interlocked.Read(ref r.computed) == 0)
{
Thread.Sleep(1);
}
return result;
}
}
</code></pre>
<p>The Action passed to the constructor is an asynchronous method which performs the actual work on the GPU. The nested Action is the asynchronous callback method.</p>
<p>My main concern is how to best/most elegantly handle the waiting done in the converter but also if there are more appropriate ways to attack the problem as a whole. Just leave a comment if there is something I need to elaborate or explain further.</p>
| [
{
"answer_id": 253214,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 1,
"selected": false,
"text": "Delegate.BeginInvoke"
},
{
"answer_id": 258281,
"author": "Morten Christiansen",
"author_id": 4055,
... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253211",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4055/"
] |
253,212 | <p>How are assertions done in c++? Example code is appreciated.</p>
| [
{
"answer_id": 253219,
"author": "Pieter",
"author_id": 5822,
"author_profile": "https://Stackoverflow.com/users/5822",
"pm_score": 3,
"selected": false,
"text": "void some_function(int age)\n{\n assert(age > 0);\n}\n"
},
{
"answer_id": 253223,
"author": "andygeers",
... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253212",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22076/"
] |
253,226 | <p>I have an interface - here's a nicely contrived version as an example:</p>
<pre><code>public interface Particle {
enum Charge {
POSITIVE, NEGATIVE
}
Charge getCharge();
double getMass();
etc...
}
</code></pre>
<p>Is there any difference in how implementations of this would behave if I defined the <code>Charge</code> enum as static - i.e. does this have any effect:</p>
<pre><code>public interface Particle {
static enum Charge {
POSITIVE, NEGATIVE
}
Charge getCharge();
double getMass();
etc...
}
</code></pre>
| [
{
"answer_id": 253239,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 5,
"selected": false,
"text": "static"
},
{
"answer_id": 253282,
"author": "idrosid",
"author_id": 17876,
"author_profile": "https:... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253226",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1853/"
] |
253,242 | <p>I have a query where i have a date column (time) which tells about "IN" & "OUT" timing of the people attendance by this single column</p>
<p>My queries are :-</p>
<p>1) How to get the daily attendance of each employee
2) How to come to know if the employee is present less than 5 hours</p>
<p>Please let me know the queries in SQL server.</p>
| [
{
"answer_id": 253249,
"author": "splattne",
"author_id": 6461,
"author_profile": "https://Stackoverflow.com/users/6461",
"pm_score": 0,
"selected": false,
"text": " select \n datediff(minute, TimeFrom, TimeTo) as AttendedTimeInMinutes,\n case when datediff(minute, sTimeFrom,... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253242",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
253,247 | <p>I have an animation that I'm displaying using a UIImageView:</p>
<pre><code>imageView.animationImages = myImages;
imageView.animationDuration = 3;
[imageView startAnimating];
</code></pre>
<p>I know I can stop it using stopAnimating, but what I want is to be able to pause it. The reason is that when you call stop, none of your animation images are displayed, whereas I would like the last one that is up at the time when I hit a button to stay up.</p>
<p>I have tried setting the duration to a much larger number, but that causes all the images to disappear as well. There must be a really basic way to do this?</p>
| [
{
"answer_id": 255109,
"author": "rustyshelf",
"author_id": 6044,
"author_profile": "https://Stackoverflow.com/users/6044",
"pm_score": 4,
"selected": true,
"text": "UIView"
},
{
"answer_id": 624980,
"author": "mazniak",
"author_id": 42523,
"author_profile": "https://... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253247",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6044/"
] |
253,267 | <p>I need to output some JavaScript in a WebControl based on some processing and some properties that the consumer can set, doing it on the load of the page will be to early.</p>
<p>When is the latest I can call RegisterClientScriptBlock and still have it output on the page?</p>
| [
{
"answer_id": 398857,
"author": "sliderhouserules",
"author_id": 31385,
"author_profile": "https://Stackoverflow.com/users/31385",
"pm_score": 3,
"selected": false,
"text": "protected internal override void RenderChildren(HtmlTextWriter writer)\n{\n Page page = this.Page;\n if (pa... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253267",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5791/"
] |
253,284 | <p>I am having dependency troubles. I have two classes: <code>Graphic</code> and <code>Image</code>. Each one has its own .cpp and .h files. I am declaring them as the following: </p>
<p><code>Graphic.h</code>: </p>
<pre><code>
#include "Image.h"
class Image;
class Graphic {
...
};
</code></pre>
<p><code>Image.h</code>:<br>
<pre><code>
#include "Graphic.h"
class Graphic;
class Image : public Graphic {
...
};</code></pre></p>
<p>When I try to compile, I get the following error: </p>
<pre>
Image.h:12: error: expected class-name before ‘{’ token
</pre>
<p>If I remove the forward declaration of <code>Graphic</code> from <code>Image.h</code> I get the following error: </p>
<pre>
Image.h:13: error: invalid use of incomplete type ‘struct Graphic’
Image.h:10: error: forward declaration of ‘struct Graphic’
</pre>
| [
{
"answer_id": 253295,
"author": "Bill the Lizard",
"author_id": 1288,
"author_profile": "https://Stackoverflow.com/users/1288",
"pm_score": 1,
"selected": false,
"text": "Graphic.h"
},
{
"answer_id": 253297,
"author": "activout.se",
"author_id": 20444,
"author_profil... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253284",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3831/"
] |
253,286 | <p>I'm trying to design a model for a application allowing 2 people to bet with each other (I know, sounds stupid...). What I'm wondering about is how to connect the bet with users. The structure is like this</p>
<pre><code>|-------------| |----------|
| Bet | | User |
| BetUser1 | |----------|
| BetUser2 |
| Winner |
| ... |
|-------------|
</code></pre>
<p>So we got 2 people that bet with each other (both are <code>Users</code> from django auth system) and then, after one of them wins, there's a winner. Now all those 3 fields are of type <code>User</code>, but:</p>
<ul>
<li>Should I make BetUser1 and BetUser2 separate fields, or design some many-to-two relationship here? (with many-to-two being a many-to-many and with some external way of ensuring no more then 2 <code>Users</code> can be assigned to each bet?</li>
<li>winner can only be either user 1 or user 2, noone else of course. How should I create this field, yet another <code>ForeignKey(User)</code>, or some else?</li>
</ul>
<p>Just looking for some fresh point of view, as it seems that in such stupid case I'm stuck with the django model system.</p>
| [
{
"answer_id": 253335,
"author": "tghw",
"author_id": 2363,
"author_profile": "https://Stackoverflow.com/users/2363",
"pm_score": 3,
"selected": true,
"text": "USER WAGER BET\n User (FK(User)) Description\n Bet (FK(Bet)) Winner (FK (Wag... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253286",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4172/"
] |
253,289 | <p>I am new to PHP and trying to get the following code to work:</p>
<pre><code><?php
include 'config.php';
include 'opendb.php';
$query = "SELECT name, subject, message FROM contact";
$result = mysql_query($query);
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
echo "Name :{$row['name']} <br>" .
"Subject : {$row['subject']} <br>" .
"Message : {$row['message']} <br><br>";
"ARTICLE_NO :{$row['ARTICLE_NO']} <br>" .
"ARTICLE_NAME :{$row['ARTICLE_NAME']} <br>" .
"SUBTITLE :{$row['SUBTITLE']} <br>" .
"CURRENT_BID :{$row['CURRENT_BID']} <br>" .
"START_PRICE :{$row['START_PRICE']} <br>" .
"BID_COUNT :{$row['BID_COUNT']} <br>" .
"QUANT_TOTAL :{$row['QUANT_TOTAL']} <br>" .
"QUANT_SOLD :{$row['QUANT_SOLD']} <br>" .
"STARTS :{$row['STARTS']} <br>" .
"ENDS :{$row['ENDS']} <br>" .
"ORIGIN_END :{$row['ORIGIN_END']} <br>" .
"SELLER_ID :{$row['SELLER_ID']} <br>" .
"BEST_BIDDER_ID :{$row['BEST_BIDDER_ID']} <br>" .
"FINISHED :{$row['FINISHED']} <br>" .
"WATCH :{$row['WATCH']} <br>" .
"BUYITNOW_PRICE :{$row['BUYITNOW_PRICE']} <br>" .
"PIC_URL :{$row['PIC_URL']} <br>" .
"PRIVATE_AUCTION :{$row['PRIVATE_AUCTION']} <br>" .
"AUCTION_TYPE :{$row['AUCTION_TYPE']} <br>" .
"INSERT_DATE :{$row['INSERT_DATE']} <br>" .
"UPDATE_DATE :{$row['UPDATE_DATE']} <br>" .
"CAT_1_ID :{$row['CAT_1_ID']} <br>" .
"CAT_2_ID :{$row['CAT_2_ID']} <br>" .
"ARTICLE_DESC :{$row['ARTICLE_DESC']} <br>" .
"DESC_TEXTONLY :{$row['DESC_TEXTONLY']} <br>" .
"COUNTRYCODE :{$row['COUNTRYCODE']} <br>" .
"LOCATION :{$row['LOCATION']} <br>" .
"CONDITIONS :{$row['CONDITIONS']} <br>" .
"REVISED :{$row['REVISED']} <br>" .
"PAYPAL_ACCEPT :{$row['PAYPAL_ACCEPT']} <br>" .
"PRE_TERMINATED :{$row['PRE_TERMINATED']} <br>" .
"SHIPPING_TO :{$row['SHIPPING_TO']} <br>" .
"FEE_INSERTION :{$row['FEE_INSERTION']} <br>" .
"FEE_FINAL :{$row['FEE_FINAL']} <br>" .
"FEE_LISTING :{$row['FEE_LISTING']} <br>" .
"PIC_XXL :{$row['PIC_XXL']} <br>" .
"PIC_DIASHOW :{$row['PIC_DIASHOW']} <br>" .
"PIC_COUNT :{$row['PIC_COUNT']} <br>" .
"ITEM_SITE_ID :{$row['ITEM_SITE_ID']};
}
include 'closedb.php';
?>
</code></pre>
<p>However I get this error:</p>
<pre><code>Parse error: syntax error, unexpected $end in C:\Programme\EasyPHP 2.0b1\www\test.php on line 56
</code></pre>
<p>I would also like to know if there is perhaps an easier way to obtain mysql records instead of typing by hand?</p>
<p>edit:</p>
<p>I fixed the semicolon and quote issue, and now get:</p>
<pre><code>Parse error: syntax error, unexpected T_STRING in C:\Programme\EasyPHP 2.0b1\www\test.php on line 51
</code></pre>
<p>I am sorry I don't know how to make colors in the code.</p>
| [
{
"answer_id": 253299,
"author": "Mark Biek",
"author_id": 305,
"author_profile": "https://Stackoverflow.com/users/305",
"pm_score": 4,
"selected": true,
"text": "while($row = mysql_fetch_array($result, MYSQL_ASSOC))\n{\n foreach($row as $field=>$value)\n {\n echo \"$field: {$value}... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253289",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1246613/"
] |
253,312 | <p>Any ideas why this won't validate here:</p>
<p><a href="http://validator.w3.org/#validate_by_input" rel="nofollow noreferrer">http://validator.w3.org/#validate_by_input</a></p>
<p>It seems the form input tags are wrong but reading through the XHTML spec they should validate fine. Any ideas?</p>
<pre><code><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Test</title>
</head>
<body>
<div class="Header">
<table class="HeaderTable">
<tr>
<td>
<div class="Heading">Test <span class="Standard">Test</span>
</div>
</td>
<td>
<div class="Controls">
<form id="ControlForm" method="get" action="Edit.php">
<input type="submit" name="action" id="Edit" value="Edit" />
<input type="submit" name="action" id="New" value="New" />
</form>
</div>
</td>
</tr>
</table>
</div>
</body>
</html>
</code></pre>
| [
{
"answer_id": 253340,
"author": "Rahul",
"author_id": 16308,
"author_profile": "https://Stackoverflow.com/users/16308",
"pm_score": 3,
"selected": false,
"text": "fieldset"
},
{
"answer_id": 253348,
"author": "FOR",
"author_id": 27826,
"author_profile": "https://Stac... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253312",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13227/"
] |
253,314 | <p>Yesterday I was having a heated debate with a coworker on what would be the preferred error reporting method. Mainly we were discussing the usage of exceptions or error codes for reporting errors between application layers or modules.</p>
<p><strong>What rules do you use to decide if you throw exceptions or return error codes for error reporting?</strong></p>
| [
{
"answer_id": 253533,
"author": "sakana",
"author_id": 28921,
"author_profile": "https://Stackoverflow.com/users/28921",
"pm_score": 2,
"selected": false,
"text": "public class DataValidationException extends Exception {\n\n\n private DataValidation error;\n\n /**\n * \n *... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253314",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6508/"
] |
253,324 | <p>I need a smart way to get the data types out of INFORMATION_SCHEMA.COLUMNS in a way that could be used in a CREATE TABLE statement. The problem is the 'extra' fields that need to be understood, such as NUMERIC<code>_</code>PRECISION and NUMERIC<code>_</code>SCALE.</p>
<p>Obviously, I can ignore the columns for INTEGER (precision of 10 and scale of 0), but there are other types I would be interested in, such as NUMERIC. So without writing lots of code to parse the table, any ideas on how to get a sort of field shorthand out of the column definition?</p>
<p>I would like to be able to get something like :
int,
datetime,
money,
numeric**(10,2)**</p>
| [
{
"answer_id": 253330,
"author": "StingyJack",
"author_id": 16391,
"author_profile": "https://Stackoverflow.com/users/16391",
"pm_score": 1,
"selected": false,
"text": "I need a smart way to get the data types out of INFORMATION_SCHEMA.COLUMNS in a way that could be used in a CREATE TABL... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253324",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3893/"
] |
253,351 | <p>I am writing a Java Application for Data Entry using Eclipse and SWT. Naturally it has a great many Text objects. </p>
<p>What I would like to happen is that when user enters something into one field focus automatically changes to the next field.</p>
<p>Thanks in advance</p>
| [
{
"answer_id": 254030,
"author": "Drazen Urch",
"author_id": 33074,
"author_profile": "https://Stackoverflow.com/users/33074",
"pm_score": 2,
"selected": false,
"text": "final Text textBox = new Text(shell, SWT.NONE);\ntextBox.addKeyListener(new KeyAdapter() {\n public void keyPressed... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253351",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33074/"
] |
253,357 | <p>For some reason Eclipse is no longer showing me Java compilation Errors in the Problems View.</p>
<p>It is still showing Warnings.</p>
<p>This has suddenly happened and I cannot think of anything that I have changed which would affect this.</p>
<p>I am using the "Maven Integration for Eclipse" plugin but I have been for some time - not sure if this could have affected it or not.</p>
<p>Any ideas?</p>
| [
{
"answer_id": 941904,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "public enum Foo {\nDummy(new Bar [] {new Bar()});\nstatic {\n for (Foo foo: Foo.values());\n}\nprivate Foo(Bar [] params) {... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253357",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8633/"
] |
253,360 | <p>Whilst trying to get our app working in Firefox (I'm a big proponent of X-Browser support but our lead dev is resisting me saying IE is good enough). So I'm doing a little side project to see how much work it is to convert.</p>
<p>I've hit a problem straight away.</p>
<p>The main.aspx page binds to a webservice using the IE only method of adding behaviour through a htc file, which is auto-generated by VS I beleive.</p>
<p> </p>
<p>Firefox doesn't support this but there is an xml bindings file which can be used to enable htc support (see here: <a href="http://dean.edwards.name/moz-behaviors/overview/" rel="nofollow noreferrer">http://dean.edwards.name/moz-behaviors/overview/</a>). The examples work in FF3 but when I use my webservice.htc as I normally would e.g.:</p>
<pre><code>//Main.aspx
/*SNIP*/
<style type="text/css" media="all">
#webservice
{
behavior:url(webservice.htc);
-moz-binding:url(bindings.xml#webservice.htc);
}
</style>
</head>
<body>
<div id="webservice"></div> <!-- we use this div to load the webservice stuff -->
/*SNIP*/
//Main.js
webservice.useService(url + asmpath + "/WebServiceWrapper.asmx?WSDL","WebServiceWrapper");
</code></pre>
<p>I get webservice is not defined (works fine in IE), I obviously tried</p>
<pre><code>var webservice = document.getElementById("webservice")
</code></pre>
<p>and </p>
<pre><code>$("#webservice").useService(url + asmpath + "/WebServiceWrapper.asmx?WSDL","WebServiceWrapper");
</code></pre>
<p>as well which just gives me "useService is not defined" in Firebug. Which leads me to beleive that the binding is not working. However I can see that webservice.htc is being loaded by Firefox in the Firebug console window.</p>
<p>Anyone got any experience of this?</p>
<p>Am I going to have to rewrite how the webservice is called?</p>
<p>Cheers,
Rob</p>
| [
{
"answer_id": 259631,
"author": "savetheclocktower",
"author_id": 25720,
"author_profile": "https://Stackoverflow.com/users/25720",
"pm_score": 1,
"selected": false,
"text": "useService"
}
] | 2008/10/31 | [
"https://Stackoverflow.com/questions/253360",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4950/"
] |
253,375 | <p>I once did a cursory search and found no good CVS bindings for Python. I wanted to be able to write helper scripts to do some fine-grained manipulation of the repository and projects in it. I had to resort to using <code>popen</code> and checking <code>stdout</code> and <code>stderr</code> and then parsing those. It was messy and error-prone.</p>
<p>Are there any good quality modules for CVS integration for Python? Which module do you prefer and why?</p>
<p>While I am at it, is there a good Subversion integration module for Python? My understanding is that Subversion has a great API for such things.</p>
| [
{
"answer_id": 254092,
"author": "ephemient",
"author_id": 20713,
"author_profile": "https://Stackoverflow.com/users/20713",
"pm_score": 1,
"selected": false,
"text": "cvs"
}
] | 2008/10/31 | [
"https://Stackoverflow.com/questions/253375",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19215/"
] |
253,378 | <p>I am trying the following code:</p>
<pre><code><?php
$link = mysql_connect('localhost', 'root', 'geheim');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
$query = "SELECT * FROM Auctions";
$result = mysql_query($query);
while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
foreach($row as $field=>$value)
{
echo "$field: {$value} <br />";
}
}
mysql_close($link);
?>
</code></pre>
<p>And get this error:</p>
<pre><code>Warning: mysql_fetch_array(): supplied argument is not a
valid MySQL result resource in
C:\Programme\EasyPHP 2.0b1\www\test.php on line 14
</code></pre>
<p>What am I missing?</p>
| [
{
"answer_id": 253386,
"author": "Aron Rotteveel",
"author_id": 11568,
"author_profile": "https://Stackoverflow.com/users/11568",
"pm_score": 2,
"selected": false,
"text": "$query = \"SELECT * FROM Auctions\"; \n$result = mysql_query($query);\n\nif ($result !== false) {\n while ($row ... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253378",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1246613/"
] |
253,380 | <p>In <a href="http://en.wikipedia.org/wiki/Vim_%28text_editor%29" rel="noreferrer">Vim</a>, how do I insert characters at the beginning of each line in a selection?</p>
<p>For instance, I want to comment out a block of code by prepending <code>//</code> at the beginning of each line assuming my language's comment system doesn't allow block commenting like <code>/* */</code>. How would I do this?</p>
| [
{
"answer_id": 253388,
"author": "Tomalak",
"author_id": 18771,
"author_profile": "https://Stackoverflow.com/users/18771",
"pm_score": 8,
"selected": false,
"text": ":%s!^!//!\n"
},
{
"answer_id": 253477,
"author": "Lucas Oman",
"author_id": 6726,
"author_profile": "h... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253380",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20133/"
] |
253,394 | <p>I need to add a row to a spreadsheet using VBScript on a PC that does not have Microsoft Office installed.</p>
<p>I tried [<code>Set objExcel = CreateObject("Excel.Application")</code>]</p>
<p>Since Excel does not exist on the PC I cannot create this object.</p>
<p>Is there a way to modify a spreadsheet without Excel?</p>
| [
{
"answer_id": 254209,
"author": "aphoria",
"author_id": 2441,
"author_profile": "https://Stackoverflow.com/users/2441",
"pm_score": 3,
"selected": false,
"text": "First Last\nJoe Smith\nMary Jones\nSam Nelson\n"
},
{
"answer_id": 254602,
"author": "Community",
... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253394",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
253,399 | <p>Delphi (and probably a lot of other languages) has class helpers. These provide a way to add extra methods to an existing class. Without making a subclass.</p>
<p>So, what are good uses for class helpers?</p>
| [
{
"answer_id": 253400,
"author": "Toon Krijthe",
"author_id": 18061,
"author_profile": "https://Stackoverflow.com/users/18061",
"pm_score": 4,
"selected": false,
"text": "type\n TStringsHelper = class helper for TStrings\n public\n function IsEmpty: Boolean;\n end;\n\nfunction TStr... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253399",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18061/"
] |
253,403 | <p>I am developing a java web app using servlet, in order to prevent user from hitting the back button to see previous users' info, I have the following code :</p>
<pre><code> protected void processRequest(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException
{
HttpSession session=request.getSession(true);
response.setContentType("text/html");
response.setHeader("Cache-Control","no-cache,no-store");
response.setDateHeader("Expires",0);
response.setHeader("Pragma","no-cache");
......
// if (!User_Logged_In)
session.invalidate();
}
</code></pre>
<p>Besides I also have the following code in the file : web/WEB-INF/web.xml</p>
<pre><code><?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
......
<filter>
<filter-name>ResponseHeaderFilter</filter-name>
<filter-class>ResponseHeaderFilter</filter-class>
<init-param>
<param-name>Cache-Control</param-name>
<param-value>private,no-cache,no-store</param-value>
</init-param>
<init-param>
<param-name>Pragma</param-name>
<param-value>no-cache</param-value>
</init-param>
<init-param>
<param-name>Expires</param-name>
<param-value>0</param-value>
</init-param>
</filter>
</web-app>
</code></pre>
<p>And the ResponseHeaderFilter.java looks like this :</p>
<pre><code>import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.util.*;
public class ResponseHeaderFilter implements Filter
{
FilterConfig fc;
public void doFilter(ServletRequest req,ServletResponse res,FilterChain chain) throws IOException,ServletException
{
HttpServletResponse response=(HttpServletResponse)res;
for (Enumeration e=fc.getInitParameterNames();e.hasMoreElements();) // Set the provided HTTP response parameters
{
String headerName=(String)e.nextElement();
response.addHeader(headerName,fc.getInitParameter(headerName));
}
chain.doFilter(req,response); // Pass the request/response on
}
public void init(FilterConfig filterConfig)
{
this.fc=filterConfig;
}
public void destroy()
{
this.fc=null;
}
}
</code></pre>
<p>So far it's still not working correctly. The back button will bring up a warning window saying the data has expired, it asks if the user wants to repost it. If you choose yes, it will still display the previous pages info. What am I doing wrong? What's the fix ?</p>
<p>Frank</p>
<hr>
<p>Yes, I am developing a web app for a PC in public place, if user B hits the back button he might see user A's private info.</p>
<p>I was trying to use session id with servlet, but how to do it, any sample code ?</p>
<p>I also tried the following :</p>
<pre><code><Html>
<Head>...</Head>
<Body onLoad=document.execCommand("ClearAuthenticationCache","false")>
......
<script type="text/javascript">
// Clear current credentials : Requires IE6 SP1 or later
// document.execCommand("ClearAuthenticationCache");
document.execCommand("ClearAuthenticationCache","false");
</script>
......
</Html>
</code></pre>
<p>It works for IE but but Firefox.</p>
| [
{
"answer_id": 253489,
"author": "Brian Matthews",
"author_id": 1969,
"author_profile": "https://Stackoverflow.com/users/1969",
"pm_score": 2,
"selected": false,
"text": "WHERE OWNER=?"
}
] | 2008/10/31 | [
"https://Stackoverflow.com/questions/253403",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32834/"
] |
253,410 | <p>Alright, I know how the <code>fieldset</code>/<code>legend</code> works out in HTML. Say you have a form with some fields:</p>
<pre><code><form>
<fieldset>
<legend>legend</legend>
<input name="input1" />
</fieldset>
</form>
</code></pre>
<p>What should I use the <code>legend</code> for? It's being displayed as a <strong>title</strong>, but isn't a legend semantically an explanation of the contents? In my view, preferably you'd do something like this:</p>
<pre><code><form>
<fieldset>
<legend>* = required</legend>
<label for="input1">input 1 *</label><input id="input1" name="input1" />
</fieldset>
</form>
</code></pre>
<p>But that doesn't really work out with how fieldsets are rendered. Is this just a ambigious naming in HTML, or is it my misunderstanding of the English word 'legend'?</p>
<hr>
<p>Edit: fixed some errors ;-)</p>
| [
{
"answer_id": 253413,
"author": "Gareth",
"author_id": 31582,
"author_profile": "https://Stackoverflow.com/users/31582",
"pm_score": 4,
"selected": true,
"text": "FIELDSET"
},
{
"answer_id": 253419,
"author": "Dan Maharry",
"author_id": 2756,
"author_profile": "https... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253410",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/909/"
] |
253,415 | <p>I'm having trouble getting the right number of elements in the ArrayList <code>alt</code> in the JSP page below. When I view the JSP it shows the size is 1 (<code><%=alt.size()%></code>) when it should be 3; I think I'm adding that method to the array in the generator class, so I don't understand why it's showing 1.</p>
<p>This is my jsp page:</p>
<pre><code><%
ArrayList<Alert> a = AlertGenerator.getAlert();
pageContext.setAttribute("alt", a);
%>
<c:forEach var="alert" items="${alt}" varStatus="status" >
<p>You have <%=alt.size()%> Active Alert(s)</p>
<ul>
<li><a href="#" class="linkthree">${alert.alert1}</a></li>
<li><a href="#" class="linkthree">${alert.alert2}</a></li>
<li><a href="#" class="linkthree">${alert.alert3}</a></li>
</ul>
</c:forEach>
</code></pre>
<p>This is class that generates the alerts:</p>
<pre><code>package com.cg.mock;
import java.util.ArrayList;
public class AlertGenerator {
public static ArrayList<Alert> getAlert() {
ArrayList<Alert> alt = new ArrayList<Alert>();
alt.add(new Alert("alert1","alert2","alert3"));
return alt;
}
}
</code></pre>
<p>This is my bean class:</p>
<pre><code>package com.cg.mock;
public class Alert {
String alert1;
String alert2;
String alert3;
public Alert(String alert1, String alert2,String alert3) {
super();
this.alert1 = alert1;
this.alert2 = alert2;
this.alert3 = alert3;
}
public String getAlert1() {
return alert1;
}
public void setAlert1(String alert1) {
this.alert1 = alert1;
}
public String getAlert2() {
return alert2;
}
public void setAlert2(String alert2) {
this.alert2 = alert2;
}
public String getAlert3() {
return alert3;
}
public void setAlert3(String alert3) {
this.alert3 = alert3;
}
}
</code></pre>
| [
{
"answer_id": 253432,
"author": "Jonny Buchanan",
"author_id": 6760,
"author_profile": "https://Stackoverflow.com/users/6760",
"pm_score": 1,
"selected": false,
"text": "3"
},
{
"answer_id": 253433,
"author": "toolkit",
"author_id": 3295,
"author_profile": "https://S... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253415",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28557/"
] |
253,426 | <p>Working with TCL and I'd like to implement something like the <a href="http://en.wikipedia.org/wiki/Strategy_pattern" rel="nofollow noreferrer">Strategy Pattern</a>. I want to pass in the "strategy" for printing output in a TCL function, so I can easily switch between printing to the screen and printing to a log file. What's the best way to do this in TCL?</p>
| [
{
"answer_id": 254632,
"author": "Jackson",
"author_id": 29061,
"author_profile": "https://Stackoverflow.com/users/29061",
"pm_score": 5,
"selected": true,
"text": "proc A { x } {\n puts $x\n}\n\nset strat A\n$strat Hello\n"
},
{
"answer_id": 255441,
"author": "ramanman",
... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253426",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1541/"
] |
253,431 | <p>I have a WPF control, that has a list of "Investors", and in the right column of the list, a "Delete" button.</p>
<p>I could either waste some time making an image of an "x" in photoshop. Or, I could just use Wingdings font and set the content to "Õ" (which makes a cool looking delete button).</p>
<p>Is this appropriate? My thinking is... while not every font family is on every computer, I'm pretty sure that it's safe to say that if you're running my WPF Windows Forms program, then you have Wingdings.</p>
<p>What do you think? Please try to give statistics (not just feelings) on the matter. Should I worry about font size? etc.</p>
| [
{
"answer_id": 253444,
"author": "Bob King",
"author_id": 6897,
"author_profile": "https://Stackoverflow.com/users/6897",
"pm_score": 5,
"selected": true,
"text": " <Style x:Key=\"DeleteButtonStyle\" TargetType=\"{x:Type Button}\">\n <Setter Property=\"HorizontalAlignment\" Val... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253431",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11917/"
] |
253,435 | <p>I was loading a Bitmap Image from a File. When I tried to save the Image to another file I got the following error "A generic error occurred in GDI+". I believe this is because the file is locked by the image object.</p>
<p>Ok so tried calling the Image.Clone function. This still locks the file.</p>
<p>hmm. Next I try loading a Bitmap Image from a FileStream and load the image into memory so GDI+ doesn't lock the file. This works great except I need to generate thumbnails using Image.GetThumbnailImage method it throws an out of memory exception. Apparently I need to keep the stream open to stop this exception but if I keep the stream open then the file remains locked.</p>
<p>So no good with that method. In the end I created a copy of the file. So now I have 2 versions of the file. 1 I can lock and manipulate in my c# program. This other original file remains unlocked to which I can save modifications to. This has the bonus of allowing me to revert changes even after saving them because I'm manipulating the copy of the file which cant change.</p>
<p>Surely there is a better way of achieving this without having to have 2 versions of the image file. Any ideas?</p>
| [
{
"answer_id": 253493,
"author": "Sciolist",
"author_id": 16045,
"author_profile": "https://Stackoverflow.com/users/16045",
"pm_score": 2,
"selected": false,
"text": "var stream = new FileStream(\"original-image\", FileMode.Open);\nvar bufr = new byte[stream.Length];\nstream.Read(bufr, 0... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253435",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6204/"
] |
253,437 | <p>It appears that Directory.GetFiles() in C# modifies the Last access date of a file.
I've googled for hours and can't seem to find a work around for this issue. Is there anyway to keep all the MAC (Modified, Accessed, Created) attributes of a file?
I'm using Directory.GetDirectories(), Directory.GetFiles(), and FileInfo.</p>
<p>Also, the fi.LastAccessTime is giving strange results -- the date is correct, however, the time is off by 2 minutes, or a few hours.</p>
<pre><code>Time of function execution: 10/31/2008 8:35 AM
Program Shows As Last Access Time
0_PDFIndex.html - 10/31/2008 8:17:24 AM
AdvancedArithmetic.pdf - 10/31/2008 8:31:05 AM
AdvancedControlStructures.pdf - 10/30/2008 1:18:00 PM
AoAIX.pdf - 10/30/2008 1:18:00 PM
AoATOC.pdf - 10/30/2008 12:29:51 PM
AoATOC2.pdf - 10/30/2008 1:18:00 PM
Actual Last Access Time
0_PDFIndex.html - 10/31/2008 8:17 AM
AdvancedArithmetic.pdf - 10/30/2008 12:29 PM
AdvancedControlStructures.pdf - 10/30/2008 12:29 PM
AoAIX.pdf - 10/30/2008 12:29 PM
AoATOC.pdf - 10/30/2008 12:29 PM
AoATOC2.pdf - 10/30/2008 12:29 PM
</code></pre>
<p>Below is the method I'm using. If you require more information, please let me know.</p>
<p>Thanks!</p>
<pre><code>public void PopulateTreeView(string directoryValue, ref TreeNode parentNode)
{
string[] directoryArray = Directory.GetDirectories(directoryValue);
string[] fileArray = Directory.GetFiles(directoryValue, "*.*", SearchOption.AllDirectories);
try
{
#region Directories
if (directoryArray.Length != 0)
{
foreach (string directory in directoryArray)
{
DirectoryInfo di = new DirectoryInfo(directory);
TreeNode dirNode = parentNode.Nodes.Add(di.Name);
FileNode fn = new FileNode();
fn.bIsDir = true;
fn.dir = di;
dirNode.Tag = fn;
PopulateTreeView(directory, ref dirNode);
Application.DoEvents();
}
}
#endregion
#region Files
if (fileArray.Length != 0)
{
foreach (string file in fileArray)
{
FileInfo fi = new FileInfo(file);
TreeNode fileNode = parentNode.Nodes.Add(fi.Name);
FileNode fn = new FileNode();
fn.bIsDir = false;
fn.file = fi;
fileNode.Tag = fn;
fileNode.ImageIndex = 1;
Console.WriteLine(fi.Name + " - " + fi.LastAccessTime);
}
}
#endregion
}
catch (UnauthorizedAccessException)
{
parentNode.Nodes.Add("Access denied");
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
finally
{
Application.DoEvents();
}
}
</code></pre>
<hr>
<p>i know the differences between the attributes. What i need is for the file to remain exactly the same all attributes and meta-data, as if my program never touched the file; this includes the last access date.</p>
| [
{
"answer_id": 253461,
"author": "dbkk",
"author_id": 838,
"author_profile": "https://Stackoverflow.com/users/838",
"pm_score": 4,
"selected": true,
"text": "fsutil behavior set disablelastaccess 1\n"
},
{
"answer_id": 253708,
"author": "Alnitak",
"author_id": 6782,
"... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253437",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33082/"
] |
253,446 | <p>How does one add a comment to an MS Access Query, to provide a description of what it does?</p>
<p>Once added, how can one retrieve such comments programmatically?</p>
| [
{
"answer_id": 253784,
"author": "Patrick Cuff",
"author_id": 7903,
"author_profile": "https://Stackoverflow.com/users/7903",
"pm_score": 5,
"selected": true,
"text": "Dim db As Database\nDim qry As QueryDef\n\nSet db = Application.CurrentDb\nSet qry = db.QueryDefs(\"myQuery\")\n\nDebug.... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253446",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6613/"
] |
253,460 | <p>What is their use if when you call the method, it might not exist?</p>
<p>Does that mean that you would be able to dynamically create a method on a dynamic object?</p>
<p>What are the practical use of this?</p>
| [
{
"answer_id": 253473,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 5,
"selected": true,
"text": "IDynamicMetaObject"
},
{
"answer_id": 463864,
"author": "Adam Ruth",
"author_id": 10262,
"author_prof... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253460",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24975/"
] |
253,468 | <p>For my apps, I store some configuration file in xml along with the assembly(exe), and something other temporary files for proccessing purpose. </p>
<p>I found some quirk with <code>".\\"</code> and <code>Application.StartupPath</code>.</p>
<p>I've been using </p>
<pre><code>String configPath = ".\\config.xml";
</code></pre>
<p>It works fine until I called <code>OpenFIleDialog</code> to open some files in other folders, the statement above failed. Apparently ".\" is referring to "CurrentDirectory", which changes every time when we browse to another folder.</p>
<p>At some point, I was using </p>
<pre><code>String configPath = Path.Combine(Application.StartupPath + "config.xml");
</code></pre>
<p>At some point, when I need to execute this assembly from another folder by using <code>Process.Start()</code>, things start to fall apart. Apparently the working directory is not set properly, and <code>Application.StartupPath</code> is actually referring to working directory instead of the directory of which the assembly is executing, as I've assumed. So I have to resort to using ProcessInfo to setup the working directory to the assembly's directory. I also had problem with this when I was writing VSTO.</p>
<p>So, my question is, what's the best, simplest and most assured way to get the current directory that the assembly is executing, without those quirks(or misunderstanding) that I've just mentioned?</p>
<p>EDIT: I meant to get the directory which the assembly reside</p>
<p>EDIT: According to MSDN on <a href="http://msdn.microsoft.com/en-us/library/system.appdomain.basedirectory.aspx" rel="noreferrer">AppDomain.BaseDirectory</a>, it seems that it can be changes during runtime, which is what I don't want(Just to clarify, not that I don't want to allow changing BaseDirectory, but rather, when I retrieve it without knowing for sure whether it's been changed)</p>
<p>EDIT: I've notice that a related question was posted much earlier. <a href="https://stackoverflow.com/questions/158219/what-would-cause-the-current-directory-of-an-executing-app-to-change">What would cause the current directory of an executing app to change?</a></p>
<p>Thanks guys for the answer.</p>
| [
{
"answer_id": 253486,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 3,
"selected": false,
"text": "Environment.CurrentDirectory"
},
{
"answer_id": 253500,
"author": "tafa",
"author_id": 22186,
"autho... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253468",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20007/"
] |
253,469 | <p>I have a <code>CMFCRibbonStatusBar</code> in my mainframe to which I add a <code>CMFCRibbonButtonsGroup</code> which again has a <code>CMFCRibbonButton</code>. This button has the same ID as a menu entry.</p>
<p>Creating the button is done as follows:</p>
<pre><code>CMFCRibbonButtonsGroup* pBGroup = new CMFCRibbonButtonsGroup();
CMFCToolBarImages images;
images.SetImageSize(CSize(32, 16)); // Non-square bitmaps
if(images.Load(IDB_STATUSBAR_IMAGES))
{
pBGroup->SetImages(&images, NULL, NULL);
}
m_pStatusButton = new CMFCRibbonButton(ID_STATUS_SHOWSTATUS,
_T(""),
IMAGEINDEX_DEFAULTSTATUS);
pBGroup->AddButton(m_pStatusButton);
m_wndStatusBar.AddExtendedElement(pBGroup, _T(""));
</code></pre>
<p>I want to use this button as a status indicator.</p>
<p>I want to display a tool tip in the following two cases:</p>
<ul>
<li>when the status changes and</li>
<li>when the user moves the mouse over the button.</li>
</ul>
<p>I have no idea how to start in the first place. I have looked at the <code>ToolTipDemo</code> and <code>DlgToolTips</code> sample projects but couldn't figure out how to do it since all they do is display tooltips for the toolbar items or dialog buttons (<code>CWnd</code>-derived instead of <code>CMFCRibbonButton</code>).</p>
<p>If you are familiar with the <code>ToolTipDemo</code> sample project: Since there seem to be several ways of doing things, I would prefer the tooltip to look like the "Extended Visual Manager-based" tool tip as <a href="http://img394.imageshack.us/my.php?image=tooltiptm7.png" rel="nofollow noreferrer">shown in this screenshot</a>.</p>
<p>Thanks!</p>
| [
{
"answer_id": 505535,
"author": "demoncodemonkey",
"author_id": 61697,
"author_profile": "https://Stackoverflow.com/users/61697",
"pm_score": 3,
"selected": true,
"text": "SetToolTipText"
},
{
"answer_id": 11353849,
"author": "David Carr",
"author_id": 695807,
"autho... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253469",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27596/"
] |
253,475 | <pre><code>struct elem
{
int i;
char k;
};
elem user; // compile error!
struct elem user; // this is correct
</code></pre>
<p>In the above piece of code we are getting an error for the first declaration. But this error doesn't occur with a C++ compiler. In C++ we don't need to use the keyword struct again and again.
<p>So why doesn't anyone update their C compiler, so that we can use structure without the keyword as in C++ ?
<p>Why doesn't the C compiler developer remove some of the glitches of C, like the one above, and update with some advanced features without damaging the original concept of C?
<p>Why it is the same old compiler not updated from 1970's ?
<p>Look at visual studio etc.. It is frequently updated with new releases and for every new release we have to learn some new function usage (even though it is a problem we can cope up with it). We will also get updated with the new compiler if there is any.
<p>Don't take this as a silly question. Why it is not possible? It could be developed without any incompatibility issues (without affecting the code that was developed on the present / old compiler)
<p>Ok, lets develop the new C language, C+, which is in between C and C++ which removes all glitches of C and adds some advanced features from C++ while keeping it useful for specific applications like system level applications, embedded systems etc.</p>
| [
{
"answer_id": 253501,
"author": "Bill the Lizard",
"author_id": 1288,
"author_profile": "https://Stackoverflow.com/users/1288",
"pm_score": 2,
"selected": false,
"text": "struct elem\n{\n int i;\n char k;\n};\nelem user;\n"
},
{
"answer_id": 253509,
"author": "Ilya",
"au... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253475",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31116/"
] |
253,490 | <p>I have a problem with the <a href="http://freetextbox.com/" rel="nofollow noreferrer">FreeTextBox</a> rich Text Editor in my ASP.NET site. The problem occurs when I access the site with firefox, and I have a freetextbox instance in a hidden div. The hidden div might also be an AJAX Tab Panel. The actual problem is that when the page loads it throws an uncaught exception (firebug shows the StoreHtml() function) and halts the postback!! </p>
<p>Is anywhere of the problem and a solution for it?? </p>
<p>Thanks</p>
| [
{
"answer_id": 258210,
"author": "Vegard Larsen",
"author_id": 1606,
"author_profile": "https://Stackoverflow.com/users/1606",
"pm_score": 3,
"selected": true,
"text": ".hiddentab\n{\n position: absolute;\n left: -99999999999999;\n}\n"
},
{
"answer_id": 268790,
"autho... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253490",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/932/"
] |
253,492 | <p>I was looking at the Java code for <code>LinkedList</code> and noticed that it made use of a static nested class, <code>Entry</code>.</p>
<pre><code>public class LinkedList<E> ... {
...
private static class Entry<E> { ... }
}
</code></pre>
<p>What is the reason for using a static nested class, rather than an normal inner class?</p>
<p>The only reason I could think of, was that Entry doesn't have access to instance variables, so from an OOP point of view it has better encapsulation. </p>
<p>But I thought there might be other reasons, maybe performance. What might it be?</p>
<p>Note. I hope I have got my terms correct, I would have called it a static inner class, but I think this is wrong: <a href="http://java.sun.com/docs/books/tutorial/java/javaOO/nested.html" rel="noreferrer">http://java.sun.com/docs/books/tutorial/java/javaOO/nested.html</a></p>
| [
{
"answer_id": 253521,
"author": "matt b",
"author_id": 4249,
"author_profile": "https://Stackoverflow.com/users/4249",
"pm_score": 9,
"selected": true,
"text": "LinkedList.Entry"
},
{
"answer_id": 253575,
"author": "Vinze",
"author_id": 26859,
"author_profile": "http... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253492",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10171/"
] |
253,517 | <p>I want to create a subclass of TabPage that contains some control, and I want to control the layout and properties of those controls through the designer. However, if I open my subclass in the designer, I can't position them like I could on a UserControl. I don't want to have to create a TabPage with an UserControl instance on it, I want to design the TabPage directly.</p>
<p>How do I do that? I've tried changing the Designer and DesignerCategory attributes, but I haven't found any values that help.</p>
| [
{
"answer_id": 254210,
"author": "Hath",
"author_id": 5186,
"author_profile": "https://Stackoverflow.com/users/5186",
"pm_score": 3,
"selected": false,
"text": "public class UserTabControl<T> : TabPage\n where T : UserControl, new ()\n{\n private T _userControl;\n public T UserC... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253517",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15371/"
] |
253,522 | <p>For example if I have an auto-numbered field, I add new records without specifying this field and let DB engine to pick it for me.<br>
So, will it pick the number of the deleted record? If yes, when?</p>
<p>// SQL Server, MySQL. //</p>
<p>Follow-up question: <a href="https://stackoverflow.com/questions/253616/what-happens-when-db-engine-runs-out-of-numbers-to-use-for-primary-keys">What happens when DB engine runs out of numbers to use for primary keys?</a></p>
| [
{
"answer_id": 253540,
"author": "ConcernedOfTunbridgeWells",
"author_id": 15401,
"author_profile": "https://Stackoverflow.com/users/15401",
"pm_score": 1,
"selected": false,
"text": "set identity_insert on"
},
{
"answer_id": 253580,
"author": "Lucas Oman",
"author_id": 6... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253522",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28098/"
] |
253,544 | <p>I have been reading the post here:</p>
<p><a href="http://encosia.com/2008/10/04/using-jquery-to-enhance-aspnet-ajax-progress-indication/" rel="nofollow noreferrer">http://encosia.com/2008/10/04/using-jquery-to-enhance-aspnet-ajax-progress-indication/</a></p>
<p>But it wants to use the following object:</p>
<pre><code>Sys.WebForms.PageRequestManager.getInstance()
</code></pre>
<p>Which doesn't exist when using the MVC AJAX code. Has anyone tried to hook when the postback ends from MVC AJAX to know when to unblock the UI?</p>
| [
{
"answer_id": 253540,
"author": "ConcernedOfTunbridgeWells",
"author_id": 15401,
"author_profile": "https://Stackoverflow.com/users/15401",
"pm_score": 1,
"selected": false,
"text": "set identity_insert on"
},
{
"answer_id": 253580,
"author": "Lucas Oman",
"author_id": 6... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253544",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24227/"
] |
253,545 | <p>I have been asked to provide information on available techniques for assessing our current, and any future websites for security problems. the request is in the form of</p>
<blockquote>
<p>Do you know of any good free one that examines for security holes?</p>
</blockquote>
<p>I think our data security is probably worth a small amount of upfront spend so any non-free methods would be appreciated too.</p>
<p>Our systems are a mish mash of mySQL, Oracle, SQLServer, PHP, ASP.NET etc etc systems though I guess that that does not matter too much. All the systems are secured in as much as they are patched and the firewalls are set sensibly so outside people cannot get directly to the database boxes etc.</p>
<p>It is XSS and similar attacks that we wish to prevent. </p>
<p>What do YOU use to give you confidence in your systems? ');DROP TABLE answer;</p>
| [
{
"answer_id": 253540,
"author": "ConcernedOfTunbridgeWells",
"author_id": 15401,
"author_profile": "https://Stackoverflow.com/users/15401",
"pm_score": 1,
"selected": false,
"text": "set identity_insert on"
},
{
"answer_id": 253580,
"author": "Lucas Oman",
"author_id": 6... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253545",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5552/"
] |
253,546 | <p>I have a line (actually a cube) going from (x1,y1,z1) to (x2,y2,z2). I would like to rotate it so that it is aligned along another line going from (x3,y3,z3) to (x4,y4,z4). Presently I am using <code>Math::Atan2</code> along with <code>Matrix::RotateYawPitchRoll</code>. Any better ways to do this?</p>
<p>Edit: I think I've worded this post very badly. What I am actually looking for is a Rotation Matrix from two Vectors.</p>
| [
{
"answer_id": 253674,
"author": "timday",
"author_id": 24283,
"author_profile": "https://Stackoverflow.com/users/24283",
"pm_score": 3,
"selected": true,
"text": "(f0x f1x f2x)\n(f0y f1y f2y)\n(f0z f1z f2z)\n"
}
] | 2008/10/31 | [
"https://Stackoverflow.com/questions/253546",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45603/"
] |
253,549 | <p>I have the following code which works just fine when the method is "POST", but changing to "GET" doesn't work:</p>
<pre><code>HttpWebRequest request = null;
request = HttpWebRequest.Create(uri) as HttpWebRequest;
request.ContentType = "application/x-www-form-urlencoded; charset=UTF-8";
request.Method = "POST"; // Doesn't work with "GET"
request.BeginGetRequestStream(this.RequestCallback, null);
</code></pre>
<p>I get a <code>ProtocolViolationException</code> exception with the "GET" method.</p>
<p><strong>Edit:</strong> After having a look using Reflector, it seems there is an explicit check for the "GET" method, if it's set to that it throws the exception.</p>
<p><strong>Edit2:</strong> I've updated my code to the following, but it still throws an exception when I call EndGetResponse()</p>
<pre><code>if (request.Method == "GET")
{
request.BeginGetResponse(this.ResponseCallback, state);
}
else
{
request.BeginGetRequestStream(this.RequestCallback, state);
}
</code></pre>
<p>In my function, ResponseCallback, I have this:</p>
<pre><code>HttpWebResponse response = (HttpWebResponse)request.EndGetResponse(asyncResult);
</code></pre>
<p>Which throws the exception as well.</p>
<p><strong>Answer</strong> </p>
<p>The above code now works, I had forgotten to take out the Content-Type line which was causing the exception to be thrown at the end. +1 to tweakt & answer to Jon.</p>
<p>The working code is now below:</p>
<pre><code>HttpWebRequest request = null;
request = HttpWebRequest.Create(uri) as HttpWebRequest;
request.Method = "GET";// Supports POST too
if (request.Method == "GET")
{
request.BeginGetResponse(this.ResponseCallback, state);
}
else
{
request.BeginGetRequestStream(this.RequestCallback, state);
}
</code></pre>
| [
{
"answer_id": 253619,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 5,
"selected": true,
"text": "BeginGetRequestStream"
}
] | 2008/10/31 | [
"https://Stackoverflow.com/questions/253549",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/986/"
] |
253,574 | <p>I've written some custom model binders (implementing IModelBinder) in our ASP.NET MVC application. I'm wondering what is a good approach to unittest them (binders)?</p>
| [
{
"answer_id": 254447,
"author": "Korbin",
"author_id": 17902,
"author_profile": "https://Stackoverflow.com/users/17902",
"pm_score": 5,
"selected": true,
"text": "var formElements = new NameValueCollection() { {\"FirstName\",\"Bubba\"}, {\"MiddleName\", \"\"}, {\"LastName\", \"Gump\"} }... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253574",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3182/"
] |
253,587 | <p>I've recently started using code coverage tools (particularily Emma and EclEmma), and I really like the view that it gives me as to the completeness of my unit tests - and the ability to see what areas of the code my unit tests aren't hitting at all. I currently work in an organization that doesn't do a lot of unit testing, and I plan on really pushing everyone to take on unit testing and code coverage and TDD and hopefully convert the organization.</p>
<p>One issue that I'm unsure of with this subject is exactly how far I should take my code coverage. For example, if I have a class such as this:</p>
<pre><code>//this class is meant as a pseudo-enum - I'm stuck on Java 1.4 for time being
public final class BillingUnit {
public final static BillingUnit MONTH = new BillingUnit("month");
public final static BillingUnit YEAR = new BillingUnit("year");
private String value;
private BillingUnit(String value) {
this.value = value;
}
public String getValue() {
return this.value;
}
public boolean equals(Object obj) {
return value.equals(((BillingUnit) obj).getValue());
}
public int hashCode() {
return value.hashCode();
}
}
</code></pre>
<p>I wrote some simple unit tests to make sure that <code>equals()</code> works correctly, that <code>getValue()</code> returns what I expected, etc. But thanks to the visual nature of EclEmma, the <code>hashcode()</code> method shows up as bright red for "not tested".</p>
<p>Is it worthwhile to even bother to test <code>hashCode()</code>, in this example, considering how simple the implementation is? I feel like I would be adding a unit test for this method simply to bump the code coverage % up, and get rid of the glaring red highlight that EclEmma adds to these lines.</p>
<p>Maybe I'm being neurotic and OCD-like, but I find that using something like EclEmma that makes it so easy to see what is untested - the plugin highlights the source code in red, and covered code in green - really makes me want to push to get as many classes 100% green as a I can - even when it doesn't add much of a benefit.</p>
| [
{
"answer_id": 253625,
"author": "Chris Marasti-Georg",
"author_id": 96,
"author_profile": "https://Stackoverflow.com/users/96",
"pm_score": 3,
"selected": false,
"text": "if(logger.isDebugEnabled()) {\n logger.debug(\"something\");\n}\n"
},
{
"answer_id": 253627,
"author"... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253587",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4249/"
] |
253,642 | <p>Currently using System.Web.UI.WebControls.FileUpload wrapped in our own control.</p>
<p>We have licenses for Telerik. I wanted to know if anyone had experience with that or could suggest a better one?</p>
<p>Some criteria to be measured by</p>
<ul>
<li>validation</li>
<li>peformance</li>
<li>multiple files</li>
<li>localisation (<a href="https://stackoverflow.com/questions/94316/how-to-change-the-text-of-the-browse-button-in-the-fileupload-control-systemweb">browse</a> is difficult)</li>
<li>security</li>
</ul>
| [
{
"answer_id": 8063388,
"author": "NicoJuicy",
"author_id": 209555,
"author_profile": "https://Stackoverflow.com/users/209555",
"pm_score": 1,
"selected": false,
"text": " <HttpPost()> _\n Public Function Upload(uploadedFile As System.Web.HttpPostedFileBase) As ActionResult\n ... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253642",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30913/"
] |
253,644 | <p>I was using an XSL style sheet to do the sorting but it seems to be very slow. Is there a more efficient way?</p>
<p>It is a flat list of nodes, if I convert the nodes to an object and sort in a GenericList would it help?</p>
<p><strong>EDIT</strong> I don't need the end result to be XML.</p>
| [
{
"answer_id": 8063388,
"author": "NicoJuicy",
"author_id": 209555,
"author_profile": "https://Stackoverflow.com/users/209555",
"pm_score": 1,
"selected": false,
"text": " <HttpPost()> _\n Public Function Upload(uploadedFile As System.Web.HttpPostedFileBase) As ActionResult\n ... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253644",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18107/"
] |
253,664 | <p>We've got products built both with GUI and CHUI. Going forward, we're looking at redesigning a lot of our software and mainly taking the route of going all GUI. My question to the group is, do we need to account for keeping a CHUI around? What are the advantages of CHUI over GUI? Many times in the past people have said that CHUI is faster because you don't need a mouse. I argue that GUI can be just as fast with the right keyboard shortcuts, hotkeys and/or touch screens.</p>
<p>Is CHUI something we should no longer consider if hardware no longer provides a constraint?</p>
<p>Also to clarify, when I speak about CHUI I mean a CHaracter based User Interface, and I'm also mainly concerned with the effective presentation of data to an end user.</p>
<p>There have been some fantastic responses that have highlighted the importance of having a command line based interface for automation and scripting based tasks which I will certainly take to heart when we begin the design!</p>
| [
{
"answer_id": 2001954,
"author": "JeffO",
"author_id": 61339,
"author_profile": "https://Stackoverflow.com/users/61339",
"pm_score": 1,
"selected": false,
"text": "A) - This Menu\nB) - That Menu\nC) - Some other Menu\n"
}
] | 2008/10/31 | [
"https://Stackoverflow.com/questions/253664",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26853/"
] |
253,666 | <p>In Microsoft Oslo SDK CTP 2008 (using Intellipad) the following code compiles fine:</p>
<pre><code>module M {
type T {
Text : Text;
}
}
</code></pre>
<p>while compiling the below code leads to the error "M0197: 'Text' cannot be used in a Type context"</p>
<pre><code>module M {
type T {
Text : Text;
Value : Text; // error
}
}
</code></pre>
<p>I do not see the difference between the examples, as in the first case Text is also used in a Type context.</p>
<p>UPDATE:</p>
<p>To add to the confusion, consider the following example, which also compiles fine:</p>
<pre><code>module M {
type X;
type T {
X : X;
Y : X;
}
}
</code></pre>
<p>The M Language Specification states that:</p>
<blockquote>
<p>Field declarations override lexical scoping to prevent the type of a declaration binding to the declaration itself. The ascribed type of a field declaration must not be the declaration itself; however, the declaration may be used in a constraint. Consider the following example:</p>
<p>type A;
type B {
A : A;
}</p>
<p>The lexically enclosing scope for the type ascription of the field declaration A is the entity declaration B. With no exception, the type ascription A would bind to the field declaration in a circular reference which is an error. The exception allows lexical lookup to skip the field declaration in this case. </p>
</blockquote>
<p>It seems that user defined types and built-in (intrinsic) types are not treated equal.</p>
<p>UPDATE2:</p>
<p>Note that <em>Value</em> in the above example is not a reserved keyword. The same error results if you rename <em>Value</em> to <em>Y</em>.</p>
<p>Any ideas?</p>
<p>Regards, tamberg</p>
| [
{
"answer_id": 2001954,
"author": "JeffO",
"author_id": 61339,
"author_profile": "https://Stackoverflow.com/users/61339",
"pm_score": 1,
"selected": false,
"text": "A) - This Menu\nB) - That Menu\nC) - Some other Menu\n"
}
] | 2008/10/31 | [
"https://Stackoverflow.com/questions/253666",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3588/"
] |
253,673 | <p>What is the slowest (therefore best) hash algorithm for passwords in ASP Classic?</p>
<p>EDIT: For those unaware, when hashing passwords, slower hashes are preferred to faster to help slow rainbow table style attacks. </p>
<p>EDIT2: And yes, of course speed isn't the only valid concern for hash selection. My question assumes that <strong>All other things being equal</strong>, <a href="http://www.securityfocus.com/blogs/262" rel="nofollow noreferrer">the slowest hash method is preferred</a> when hashing a password. Though collision/reverse engineering is of course a concern too, I'm prioritizing speed in this question since it is arguably the most critical factor to consider when comparing popular hash algorithms for use on passwords.</p>
<p>Thanks!</p>
| [
{
"answer_id": 253699,
"author": "chills42",
"author_id": 23855,
"author_profile": "https://Stackoverflow.com/users/23855",
"pm_score": -1,
"selected": false,
"text": "function hashPassword(password)\n sleep for 10 seconds\n return password\nend function\n"
},
{
"answer_id"... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253673",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26180/"
] |
253,689 | <p>I am making an expand/collapse call rates table for the company I work for. I currently have a table with a button under it to expand it, the button says "Expand". It is functional except I need the button to change to "Collapse" when it is clicked and then of course back to "Expand" when it is clicked again. The writing on the button is a background image.</p>
<p>So basically all I need is to change the background image of a div when it is clicked, except sort of like a toggle.</p>
| [
{
"answer_id": 253710,
"author": "Nick",
"author_id": 26161,
"author_profile": "https://Stackoverflow.com/users/26161",
"pm_score": 9,
"selected": false,
"text": "$('#divID').css(\"background-image\", \"url(/myimage.jpg)\"); \n"
},
{
"answer_id": 253717,
"author": "alexp206"... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253689",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26823/"
] |
253,692 | <p>I am trying to start WebLogic within Eclipse</p>
<p>When it starts it complains like this.</p>
<p>Unable to load performance pack. Using Java I/O instead. Please ensure that wlntio.dll is in: 'C:\bea81\jdk142_04\bin;.;C:\WINDOWS\system32;C:\WINDOWS;C:\bea81\jdk142_04\jre\bin;C:\Program Files\Java\jre1.6.0\bin\client;C:\Program Files\Java\jre1.6.0\bin;C:\sybase\JS-12_5\bin;C:\sybase\OCS-12_5\lib3p;C:\sybase\OCS-12_5\dll;C:\sybase\OCS-12_5\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Common Files\Roxio Shared\DLLShared\;C:\Program Files\Common Files\Roxio Shared\DLLShared\;C:\Program Files\Common Files\Roxio Shared\9.0\DLLShared\;C:\Program Files\cvsnt;C:\Program Files\Executive Software\DiskeeperWorkstation\;'</p>
<blockquote>
<p></p>
</blockquote>
| [
{
"answer_id": 1469248,
"author": "Pascal Thivent",
"author_id": 70604,
"author_profile": "https://Stackoverflow.com/users/70604",
"pm_score": 1,
"selected": false,
"text": "$BEA_HOME/server/bin"
}
] | 2008/10/31 | [
"https://Stackoverflow.com/questions/253692",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
253,695 | <p>I have a Silverlight 2 application that validates data OnTabSelectionChanged. Immediately I began wishing that UpdateSourceTrigger allowed more than just LostFocus because if you click the tab without tabbing off of a control the LINQ object is not updated before validation. </p>
<p>I worked around the issue for TextBoxes by setting focus to another control and then back OnTextChanged:</p>
<pre><code>Private Sub OnTextChanged(ByVal sender As Object, ByVal e As TextChangedEventArgs)
txtSetFocus.Focus()
sender.Focus()
End Sub
</code></pre>
<p>Now I am trying to accomplish the same sort of hack within a DataGrid. My DataGrid uses DataTemplates generated at runtime for the CellTemplate and CellEditingTemplate. I tried writing the TextChanged="OnTextChanged" into the TextBox in the DataTemplate, but it is not triggered.</p>
<p>Anyone have any ideas? </p>
| [
{
"answer_id": 3077562,
"author": "Ben Brodie",
"author_id": 371280,
"author_profile": "https://Stackoverflow.com/users/371280",
"pm_score": 0,
"selected": false,
"text": "public class DefaultButtonHub\n{\n ButtonAutomationPeer peer = null;\n\n private void Attach(DependencyObject ... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253695",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33102/"
] |
253,701 | <p>I have a web application that allows a user to search on some criteria, select an object, edit it and then return to the previous search. All the editing takes place on a separate page linked to the datagrid of returned results. I was wondering what is the best way to store the previous search parameters so that when they return to the grid they have the same search they previously used. The best option I came up with is to use a NameValue collection of each of the selected paramters and store that to Session or a cookie when the user presses the search button. Any other ideas as to a better way to approach this?</p>
| [
{
"answer_id": 253845,
"author": "Jason Kealey",
"author_id": 20893,
"author_profile": "https://Stackoverflow.com/users/20893",
"pm_score": 2,
"selected": true,
"text": " public static string GenerateSessionKeyFromPage(Page page)\n {\n return \"__\" + page.Request.Path;\n ... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253701",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30383/"
] |
253,705 | <p>I have a dropdown list that stores name/value pairs. The dropdown appears in each row of a gridview.</p>
<p>The values in the dropdown correspond to a third attribute (data type) not persisted in the dropdown list. I'd like to create a client-side "lookup" table so that when a user chooses a dropdown value, the proper data type populates next to it.</p>
<p>What's the best way to accomplish this in an ASP.NET application? The List of value/attributes could potentially range from 1 to 100 members in a list...</p>
| [
{
"answer_id": 253715,
"author": "Ady",
"author_id": 31395,
"author_profile": "https://Stackoverflow.com/users/31395",
"pm_score": 0,
"selected": false,
"text": "var oVals = new Array('1','2','3','4','5');\n\ndocument.getElementById(\"cell1\").innerHTML = oVals[document.getElementById(\"... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253705",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/335036/"
] |
253,720 | <p>I have a problem with a simple included file.</p>
<p>The file being included is in two MFC programs - one of which is a dll, and it also compiles itself into a non-mfc dll.</p>
<p>Recently I was using the larger dll which wraps around the <em>source</em> of the smaller dll when I wanted access to some of the features of the original code that isn't exposed by the larger dll.</p>
<p>Since this was a test I simply added the source to my project and called the functions. I got this error: <strong>syntax error : missing ')' before ';'</strong></p>
<p>The file is correctly included, and I have both the .cpp and the .h in the source folder, and within the project but it wouldn't compile. </p>
<p>I eventually created a very small test project, main.cpp, spooler.cpp and spooler.h (the spooler is a wrapper around the comms) and tried to compile that. Same issue.</p>
<p>So I ripped out all the dll related stuff just in case there is a weird issue going on with that and it still won't compile.</p>
<p>I can't think of the life of me what is wrong. Does anyone else have any ideas?</p>
<p>p.s. Jeff you really need to add the ability to attach files because the source would fill up too many screens with data.</p>
| [
{
"answer_id": 253750,
"author": "Jasper Bekkers",
"author_id": 31486,
"author_profile": "https://Stackoverflow.com/users/31486",
"pm_score": 3,
"selected": true,
"text": "("
},
{
"answer_id": 253827,
"author": "graham.reeds",
"author_id": 342,
"author_profile": "http... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253720",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/342/"
] |
253,724 | <p>I'm looking for a way to supply an argument to a ruby on rails project at runtime. Essentially, our project uses public key cryptography to encrypt some sensitive client data and we want the ability to supply the password to the private key file at runtime.</p>
| [
{
"answer_id": 254703,
"author": "Jsnydr",
"author_id": 32503,
"author_profile": "https://Stackoverflow.com/users/32503",
"pm_score": 2,
"selected": true,
"text": "module StartupArgs\n @@argHash = {}\n\n def self.setArg(key, value)\n @@argHash[key.to_sym] = value\n end\n\n def self.getA... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253724",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11042/"
] |
253,727 | <p>When building static libraries with VS2005 I keep getting linker warnings that VC80.pdb cant be found with my library.lib. Apparently, as a result, the edit and continue feature of the IDE fails to work any project that incorporates library.lib</p>
<p>What magic is needed to tell VS2005 to produce a static lib with edit and continue debug info that does NOT reference or require vs80.pdb when linked into a project?</p>
<p>--Upon Further Understanding--
So, In order to get edit-and-continue to function with a pre-compiled static lib, we need to place the vs80.pdb and vs80.pdb file into SVN along with the .lib, AND rename the pdb/idb to prevent conflicts when doing this with multiple pre-compiled libs.</p>
| [
{
"answer_id": 254257,
"author": "Steve Steiner",
"author_id": 3892,
"author_profile": "https://Stackoverflow.com/users/3892",
"pm_score": 4,
"selected": true,
"text": "SECTION HEADER #7\n.debug$T name\n 0 physical address\n 0 virtual address\n 48 size of raw data\n ... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253727",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27491/"
] |
253,731 | <p>I have a web page that has a web form for signing up. I want to remove fields. I've tried removing the field code from the .asp file but obviously there are other things that I need to remove along those lines. I have full access to all the code but I need help knowing where things are linked as far as making the form work again. Our programmer bailed. </p>
<p>A step by step guide would be great on this. thanks.</p>
| [
{
"answer_id": 253762,
"author": "John",
"author_id": 30006,
"author_profile": "https://Stackoverflow.com/users/30006",
"pm_score": 2,
"selected": false,
"text": "<asp:TextBox id=\"text1\" runat=\"server\" />\n"
}
] | 2008/10/31 | [
"https://Stackoverflow.com/questions/253731",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
253,735 | <p>I have a report that is used by a windows service and a form application. So, I want to put embed the report in a DLL file that can be used by both.</p>
<p>The problem is that if I try to set the ReportEmbeddedResource property of a ReportViewer control in my windows form app, it will search the windows form app for the resource, not the dll file.</p>
<p>e.g.: Code from the windows form app:</p>
<pre><code>rv.LocalReport.ReportEmbeddedResource = "MyReportInMyDLLFile.rdlc"
</code></pre>
<p>How can I make the above command look for the embedded resource in my DLL file?</p>
| [
{
"answer_id": 261842,
"author": "DrCamel",
"author_id": 4168,
"author_profile": "https://Stackoverflow.com/users/4168",
"pm_score": 4,
"selected": false,
"text": "rv.LocalReport.ReportEmbeddedResource = \"TheApp.Reports.MyReport.rdlc\";\n"
},
{
"answer_id": 358276,
"author":... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253735",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/681/"
] |
253,746 | <p>In Microsoft Oslo SDK CTP 2008 (using Intellipad) the following code compiles fine:</p>
<pre><code>module T {
type A {
Id : Integer32 = AutoNumber();
} where identity Id;
As : A*;
type B {
Id : Integer32 = AutoNumber();
// A : A;
// } where A in As && identity Id;
} where identity Id;
Bs : B*;
type C {
Id : Integer32 = AutoNumber();
B : B;
} where B in Bs && identity Id;
Cs : C*;
}
</code></pre>
<p>and results in the following Reach SQL output:</p>
<pre><code>set xact_abort on;
go
begin transaction;
go
set ansi_nulls on;
go
create schema [T];
go
create table [T].[As]
(
[Id] int not null identity,
constraint [PK_As] primary key clustered ([Id])
);
go
create table [T].[Bs]
(
[Id] int not null identity,
constraint [PK_Bs] primary key clustered ([Id])
);
go
create table [T].[Cs]
(
[Id] int not null identity,
[B] int not null,
constraint [PK_Cs] primary key clustered ([Id]),
constraint [FK_Cs_B_T_Bs] foreign key ([B]) references [T].[Bs] ([Id])
);
go
commit transaction;
go
</code></pre>
<p>But after changing the commented line in module T as follows</p>
<pre><code> A : A;
} where A in As && identity Id;
// } where identity Id;
</code></pre>
<p>the error message "M2037: SQL Generation Internal Error: Missing generator for variable 'A'" is displayed (in Intellipad's Reach SQL Window).</p>
<p>Any Ideas?</p>
<p>Regards, tamberg</p>
| [
{
"answer_id": 254473,
"author": "cfeduke",
"author_id": 5645,
"author_profile": "https://Stackoverflow.com/users/5645",
"pm_score": 2,
"selected": true,
"text": "type A {\n Id : Integer32 = AutoNumber();\n} where identity Id;\n\nAs : A*;\n\ntype B {\n Id : Integer32 = AutoNumber()... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253746",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3588/"
] |
253,747 | <p>I'm using .NET typed datasets on a project, and I often get into situations where I prefetch data from several tables into a dataset and then pass that dataset to several methods for processing. It seems cleaner to let each method decide exactly which data it needs and then load the data itself. However, several of the methods work with the same data, and I want the performance benefit of loading data in the beginning only once.</p>
<p>My problem is that I don't know of a good way or pattern to use for managing dependencies (I want to be sure I load all the data that I'm going to need for each class/method that will use the dataset). Currently, I just end up looking through the code for the various classes that will use the dataset to make sure I'm loading everything appropriately.</p>
<p>What are good approaches or patterns to use in this situation? Am I doing something fundamentally wrong? Although I'm using typed datasets, this seems like it would be a common situation where prefetching data is used.</p>
<p>Thanks!</p>
| [
{
"answer_id": 254473,
"author": "cfeduke",
"author_id": 5645,
"author_profile": "https://Stackoverflow.com/users/5645",
"pm_score": 2,
"selected": true,
"text": "type A {\n Id : Integer32 = AutoNumber();\n} where identity Id;\n\nAs : A*;\n\ntype B {\n Id : Integer32 = AutoNumber()... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253747",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33096/"
] |
253,757 | <p>In following code, I want to extend the behaviour of a class by deriving/subclassing it, and make use of an event of the base class:</p>
<pre><code>public class A
{
public event EventHandler SomeEvent;
public void someMethod()
{
if(SomeEvent != null) SomeEvent(this, someArgs);
}
}
public class B : A
{
public void someOtherMethod()
{
if(SomeEvent != null) SomeEvent(this, someArgs); // << why is this not possible?
//Error: The event 'SomeEvent' can only appear on the left hand side of += or -=
//(except when used from within the type 'A')
}
}
</code></pre>
<p>Why isn't it possible?</p>
<p>And what is the common solution for this kind of situation?</p>
| [
{
"answer_id": 253776,
"author": "Todd White",
"author_id": 30833,
"author_profile": "https://Stackoverflow.com/users/30833",
"pm_score": 6,
"selected": true,
"text": "public class A\n{\n public event EventHandler SomeEvent;\n\n public void someMethod()\n {\n OnSomeEvent(... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253757",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26070/"
] |
253,767 | <p>I'm looking for a KDTree implementation in Java.<br>
I've done a google search and the results seem pretty haphazard. There are actually lots of results, but they're mostly just little one-off implementations, and I'd rather find something with a little more "production value". Something like apache collections or the excellent C5 collection library for .NET. Something where I can see the public bug tracker and check to see when the last SVN commit happened. Also, in an ideal world, I'd find a nice well-designed API for spatial data structures, and the KDTree would be just one class in that library.</p>
<p>For this project, I'll only be working in either 2 or 3 dimensions, and I'm mostly just interested in a good nearest-neighbors implementation.</p>
| [
{
"answer_id": 27467323,
"author": "grepit",
"author_id": 717630,
"author_profile": "https://Stackoverflow.com/users/717630",
"pm_score": 1,
"selected": false,
"text": "private class KDNode {\n KDNode left;\n KDNode right;\n E val;\n int depth;\n private KDNode(E e, int de... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253767",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22979/"
] |
253,807 | <p>We all know to keep it simple, right?</p>
<p>I've seen complexity being measured as the number of interactions between systems, and I guess that's a very good place to start. Aside from gut feel though, what other (preferably more objective) methods can be used to determine the level of complexity of a particular design or piece of software?</p>
<p>What are YOUR favorite rules or heuristics?</p>
| [
{
"answer_id": 253841,
"author": "lfalin",
"author_id": 28106,
"author_profile": "https://Stackoverflow.com/users/28106",
"pm_score": 2,
"selected": false,
"text": "A B\n0 0\n1 0\n0 1\n1 1\n"
}
] | 2008/10/31 | [
"https://Stackoverflow.com/questions/253807",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15310/"
] |
253,810 | <p>Much searching has lead me to find several descriptions of how to create a bootstrapping msi, but these solutions all assume the msi is local or a standard Windows component. Is there a way to make an msi that downloads an installer (which is also an msi) with normal MSI or Wix code rather than by having the bootstrapper execute some non-native program to do so?</p>
| [
{
"answer_id": 257841,
"author": "saschabeaumont",
"author_id": 592,
"author_profile": "https://Stackoverflow.com/users/592",
"pm_score": 0,
"selected": false,
"text": "InstallExecuteSequence"
}
] | 2008/10/31 | [
"https://Stackoverflow.com/questions/253810",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18192/"
] |
253,820 | <p>I've been crossing things out on my TODO list. I've recently picked up Colemak. Next I wanted to learn Vim or Emacs. I was leaning towards Vim, however one of its benefits are sticking to the home row. With Colemak, the home row has been changed. I realize that I could remap the keys, but assigning the functionality to different letters is not extremely appealing to me (if there is any relation between letters and their function. I know movement is not correlated but I'm not sure on all the rest.)</p>
<p>I don't want to start an argumentative post about text editors, but rather receive comments from Colemak (or Dvorak) users about alternative keymappings and these two editors.</p>
<p>Thanks</p>
| [
{
"answer_id": 2190106,
"author": "Graham",
"author_id": 130988,
"author_profile": "https://Stackoverflow.com/users/130988",
"pm_score": 3,
"selected": false,
"text": "noremap h k\nnoremap j h\nnoremap k j\n"
},
{
"answer_id": 5622090,
"author": "c_oreills",
"author_id": ... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253820",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17234/"
] |
253,834 | <p>Has anyone found a good class, or other file that will convert a .doc file into html or something that I can read and turn into html? </p>
<p>I have been looking around for a couple hours now and have only found ones that require msword on the server in order to convert the file. I am pretty sure that is not an option but I have not actually talked to my hosting provider about it.</p>
<p>The goal is for a user to be able to upload the file to my server and the server handle the conversion and then display it as html, much like googles view as html feature.</p>
| [
{
"answer_id": 2968182,
"author": "CronosNull",
"author_id": 356675,
"author_profile": "https://Stackoverflow.com/users/356675",
"pm_score": 3,
"selected": false,
"text": "AbiWord --to=html archivo.doc\n"
},
{
"answer_id": 11334583,
"author": "forever99",
"author_id": 150... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253834",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1925/"
] |
253,843 | <p>What is the best way to refresh a <code>DataGridView</code> when you update an underlying data source?</p>
<p>I'm updating the datasource frequently and wanted to display the outcome to the user as it happens.</p>
<p>I've got something like this (and it works), but setting the <code>DataGridView.DataSource</code> to <code>null</code> doesn't seem like the right way.</p>
<pre><code>List<ItemState> itemStates = new List<ItemState>();
dataGridView1.DataSource = itemStates;
for (int i = 0; i < 10; i++) {
itemStates.Add(new ItemState { Id = i.ToString() });
dataGridView1.DataSource = null;
dataGridView1.DataSource = itemStates;
System.Threading.Thread.Sleep(500);
}
</code></pre>
| [
{
"answer_id": 253863,
"author": "Georg",
"author_id": 30776,
"author_profile": "https://Stackoverflow.com/users/30776",
"pm_score": -1,
"selected": false,
"text": "List itemStates = new List();\n\nfor (int i = 0; i < 10; i++)\n{ \n itemStates.Add(new ItemState { Id = i.ToString() });... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253843",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21180/"
] |
253,849 | <p>Using MSSQL2005, can I truncate a table with a foreign key constraint if I first truncate the child table (the table with the primary key of the FK relationship)?</p>
<p>I know that I can either</p>
<ul>
<li>Use a <code>DELETE</code> without a where clause and then <code>RESEED</code> the identity (or)</li>
<li>Remove the FK, truncate the table, and recreate the FK.</li>
</ul>
<p>I thought that as long as I truncated the child table before the parent, I'd be okay without doing either of the options above, but I'm getting this error:</p>
<blockquote>
<p>Cannot truncate table 'TableName' because it is being referenced by a FOREIGN KEY constraint.</p>
</blockquote>
| [
{
"answer_id": 253931,
"author": "ctrlShiftBryan",
"author_id": 6161,
"author_profile": "https://Stackoverflow.com/users/6161",
"pm_score": 8,
"selected": false,
"text": "TRUNCATE TABLE"
},
{
"answer_id": 3039404,
"author": "denver_citizen",
"author_id": 244053,
"auth... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253849",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6161/"
] |
253,865 | <p>In a WPF app, is there a object I can assign to FileSystemWatcher.SynchronizingObject?</p>
<p>I can make my own, but if there is one available, I would like to use it.</p>
| [
{
"answer_id": 254120,
"author": "Bradley Grainger",
"author_id": 23633,
"author_profile": "https://Stackoverflow.com/users/23633",
"pm_score": 4,
"selected": true,
"text": "ISynchronizeInvoke"
},
{
"answer_id": 1096689,
"author": "Community",
"author_id": -1,
"author... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253865",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14841/"
] |
253,868 | <p>I'm looking at all the CSS Drop shadow tutorials, which are great. Unfortunately, I need to put a shadow on three sides of a block element (left, bottom, right). All the tutorials talk about shifting your block element up and to the left. Anyone have insights into putting a shadow on three or even four sides?</p>
| [
{
"answer_id": 253915,
"author": "Diodeus - James MacFarlane",
"author_id": 12579,
"author_profile": "https://Stackoverflow.com/users/12579",
"pm_score": 1,
"selected": false,
"text": "<div style='position:relative;'>\n <div style='position:absolute;top:10px;left:10px;width:300px;heig... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253868",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1753/"
] |
253,881 | <p>Can't figure out why I'm getting 'SQL Statement ignored' and 'ORA-01775: looping chain of synonyms' on line 52 of this stored procedure. Got any ideas?</p>
<pre><code>CREATE OR REPLACE PACKAGE PURGE_LOG_BY_EVENT_DAYS AS
TYPE dual_cursorType IS REF CURSOR RETURN dual%ROWTYPE;
PROCEDURE log_master_by_event_days (event_id NUMBER, purge_recs_older_than NUMBER, result_cursor OUT dual_cursorType);
END PURGE_LOG_BY_EVENT_DAYS;
/
CREATE OR REPLACE PACKAGE BODY PURGE_LOG_BY_EVENT_DAYS
AS
err_msg VARCHAR2(4000);
PROCEDURE log_master_by_event_days (event_id NUMBER, purge_recs_older_than NUMBER, result_cursor OUT dual_cursorType)
IS
TYPE type_rowid IS TABLE OF ROWID INDEX BY BINARY_INTEGER;
TYPE type_ref_cur IS REF CURSOR;
l_rid type_rowid;
c1 type_ref_cur;
l_sql_stmt VARCHAR2(4000);
proc_start_time DATE := sysdate;
purge_date DATE;
l_bulk_collect_limit NUMBER := 1000;
retry NUMBER := 5;
retry_count NUMBER := 0;
loop_count NUMBER := 0;
err_code VARCHAR2(10);
BEGIN
purge_date := to_date(sysdate - purge_recs_older_than);
l_sql_stmt := '';
l_sql_stmt := l_sql_stmt ||' SELECT rowid FROM LOG_MASTER ';
l_sql_stmt := l_sql_stmt ||' WHERE last_changed_date < :purge_date';
l_sql_stmt := l_sql_stmt ||' AND event_id = :event_id';
-- The following while loop
-- executes the purge code
-- 'retry' number of times in case of ORA-01555
WHILE retry > 0 LOOP
BEGIN
-- START of purge code
OPEN c1 FOR l_sql_stmt USING purge_date, event_id;
LOOP
FETCH c1 BULK COLLECT into l_rid LIMIT l_bulk_collect_limit;
FORALL i IN 1..l_rid.COUNT
DELETE from log_master
WHERE rowid = l_rid(i);
COMMIT;
loop_count := loop_count + 1;
EXIT WHEN c1%NOTFOUND;
END LOOP;
CLOSE c1;
-- End of purge code
-- if processing reached this point
-- Process completed successfuly, set retry = 0 to exit loop
retry := 0;
EXCEPTION
WHEN OTHERS THEN
-- ====================================
-- Get error msg
-- ====================================
ROLLBACK;
err_code := sqlcode;
dbms_output.put_line(err_code);
-- ====================================
-- Check if it is 01555
-- if so retry, else exit loop
-- ====================================
retry := retry - 1;
if err_code = '-1555' and retry > 0 THEN
CLOSE c1;
retry_count := retry_count + 1;
else
err_msg := sqlerrm;
exit;
end if;
END;
END LOOP;
IF err_msg IS NULL THEN
open result_cursor for select '1 - PURGE_LOG_BY_EVENT_DAYS ran successfully (event_id : '||event_id||', loop_count : '||loop_count||', bulk_limit : '||l_bulk_collect_limit||', retries : '||retry_count||') ' from dual;
ELSE
open result_cursor for select '2 - PURGE_LOG_BY_EVENT_DAYS After (event_id : '||event_id||', loop_count : '||loop_count||', bulk_limit : '||l_bulk_collect_limit||', retries : '||retry_count||') with Error: ' || err_msg from dual;
END IF;
END log_master_by_event_days;
END PURGE_LOG_BY_EVENT_DAYS;
</code></pre>
| [
{
"answer_id": 253909,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "SELECT table_owner, table_name, db_link\n FROM dba_synonyms \n WHERE owner = 'PUBLIC' and db_link is not null\n"
},
... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253881",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
253,911 | <p>I have a case that keeps coming up where I'm using a ListView or similar control with a simple array such as string[].</p>
<p>Is there a way to use the DataKeyNames property when you are binding to simple collections?</p>
| [
{
"answer_id": 253939,
"author": "craigmoliver",
"author_id": 12252,
"author_profile": "https://Stackoverflow.com/users/12252",
"pm_score": 0,
"selected": false,
"text": "public class LettersInfo\n{\n public String Letter { get; set; }\n}\n"
},
{
"answer_id": 264452,
"auth... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253911",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10115/"
] |
253,913 | <p>I have a function I've written that was initially supposed to take a string field and populate an excel spreadsheet with the values. Those values continually came up null. I started tracking it back to the recordset and found that despite the query being valid and running properly through the Access query analyzer the recordset was empty or had missing fields.</p>
<p>To test the problem, I created a sub in which I created a query, opened a recordset, and then paged through the values (outputting them to a messagebox). The most perplexing part of the problem seems to revolve around the "WHERE" clause of the query. If I don't put a "WHERE" clause on the query, the recordset always has data and the values for "DESCRIPTION" are normal.</p>
<p>If I put <em>anything</em> in for the WHERE clause the recordset comes back either totally empty (<code>rs.EOF = true</code>) or the Description field is totally blank where the other fields have values. I want to stress again that if I debug.print the query, I can copy/paste it into the query analyzer and get a valid and returned values that I expect.</p>
<p>I'd sure appreciate some help with this. Thank you!</p>
<pre><code>Private Sub NewTest()
' Dimension Variables
'----------------------------------------------------------
Dim rsNewTest As ADODB.Recordset
Dim sqlNewTest As String
Dim Counter As Integer
' Set variables
'----------------------------------------------------------
Set rsNewTest = New ADODB.Recordset
sqlNewTest = "SELECT dbo_partmtl.partnum as [Job/Sub], dbo_partmtl.revisionnum as Rev, " & _
"dbo_part.partdescription as Description, dbo_partmtl.qtyper as [Qty Per] " & _
"FROM dbo_partmtl " & _
"LEFT JOIN dbo_part ON dbo_partmtl.partnum = dbo_part.partnum " & _
"WHERE dbo_partmtl.mtlpartnum=" & Chr(34) & "3C16470" & Chr(34)
' Open recordset
rsNewTest.Open sqlNewTest, CurrentProject.Connection, adOpenDynamic, adLockOptimistic
Do Until rsNewTest.EOF
For Counter = 0 To rsNewTest.Fields.Count - 1
MsgBox rsNewTest.Fields(Counter).Name
Next
MsgBox rsNewTest.Fields("Description")
rsNewTest.MoveNext
Loop
' close the recordset
rsNewTest.Close
Set rsNewTest = Nothing
End Sub
</code></pre>
<p>EDIT: Someone requested that I post the DEBUG.PRINT of the query. Here it is:</p>
<pre><code>SELECT dbo_partmtl.partnum as [Job/Sub], dbo_partmtl.revisionnum as Rev, dbo_part.partdescription as [Description], dbo_partmtl.qtyper as [Qty Per] FROM dbo_partmtl LEFT JOIN dbo_part ON dbo_partmtl.partnum = dbo_part.partnum WHERE dbo_partmtl.mtlpartnum='3C16470'
</code></pre>
<hr>
<p>I have tried double and single quotes using ASCII characters and implicitly.</p>
<p>For example:</p>
<pre><code>"WHERE dbo_partmtl.mtlpartnum='3C16470'"
</code></pre>
<p>I even tried your suggestion with chr(39):</p>
<pre><code>"WHERE dbo_partmtl.mtlpartnum=" & Chr(39) & "3C16470" & Chr(39)
</code></pre>
<p>Both return a null value for description. However, if I debug.print the query and paste it into the Access query analyzer, it displays just fine. Again (as a side note), if I do a LIKE statement in the WHERE clause, it will give me a completely empty recordset. Something is really wonky here.</p>
<hr>
<p>Here is an interesting tidbit. The tables are linked to a <code>SQL Server</code>. If I copy the tables (data and structure) locally, the ADO code above worked flawlessly. If I use DAO it works fine. I've tried this code on <code>Windows XP</code>, <code>Access 2003</code>, and various versions of <code>ADO (2.5, 2.6, 2.8)</code>. <code>ADO</code> will not work if the tables are linked.</p>
<p>There is some flaw in ADO that causes the issue.</p>
<hr>
<p>Absolutely I do. Remember, the <code>DEBUG.PRINT</code> query you see runs perfectly in the query analyzer. It returns the following:</p>
<pre>
Job/Sub Rev Description Qty Per
36511C01 A MAIN ELECTRICAL ENCLOSURE 1
36515C0V A VISION SYSTEM 1
36529C01 A MAIN ELECTRICAL ENCLOSURE 1
</pre>
<p>However, the same query returns empty values for Description (everything else is the same) when run through the recordset (messagebox errors because of "Null" value).</p>
<hr>
<p>I tried renaming the "description" field to "testdep", but it's still empty. The only way to make it display data is to remove the WHERE section of the query. I'm starting to believe this is a problem with ADO. Maybe I'll rewriting it with DAO and seeing what results i get.</p>
<p>EDIT: I also tried compacting and repairing a couple of times. No dice.</p>
| [
{
"answer_id": 254202,
"author": "Mr Furious",
"author_id": 33124,
"author_profile": "https://Stackoverflow.com/users/33124",
"pm_score": 1,
"selected": false,
"text": "Private Sub AltTest()\n\n' Dimension Variables\n'----------------------------------------------------------\nDim rsNew... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253913",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33124/"
] |
253,919 | <p>I want to have CListCtrl.EditLabel() for any column of the list. How can I implement such a feature?</p>
| [
{
"answer_id": 254202,
"author": "Mr Furious",
"author_id": 33124,
"author_profile": "https://Stackoverflow.com/users/33124",
"pm_score": 1,
"selected": false,
"text": "Private Sub AltTest()\n\n' Dimension Variables\n'----------------------------------------------------------\nDim rsNew... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253919",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28161/"
] |
253,925 | <p>I have a Winforms application created in Visual Studio 2005 Pro, it connects to an SQL Server 2005 database using the SqlConnection / SqlCommand / SqlDataAdapter classes to extract data. I have stored procedures in my database to return the data to me.</p>
<p>What is the best way to handle queries that take a "long time" to complete? (i.e long enough that the user starts to think something is wrong). Currently my application locks up until the query is complete, or the query times out. Obviously this is unnacceptable.</p>
<p>I'd at least like a progress meter with a "stop" button on it. The progress meter doesn't even have to do anything useful, being a hint to sit patiently and wait would be enough.</p>
<p>Even better would be a warning that said something like "This will return 140,000 rows of data. Do you want to continue?"</p>
<p>I know this probably requires threads, but how?</p>
| [
{
"answer_id": 253954,
"author": "John",
"author_id": 30006,
"author_profile": "https://Stackoverflow.com/users/30006",
"pm_score": 2,
"selected": false,
"text": " private void Form_Load(object sender, EventArgs e)\n {\n BackgroundWorker bw = new BackgroundWorker();\n ... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253925",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18854/"
] |
253,937 | <p>If I wanted to find checked check boxes on an ASP.NET page I could use the following LINQ query.</p>
<pre><code>var checkBoxes = this.Controls
.OfType<CheckBox>()
.TakeWhile<CheckBox>(cb => cb.Checked);
</code></pre>
<p>That works fine if the checkboxes are nested in the current control collection, but I'd like to know how to extend the search by drilling down into the control collections of the top-level controls.</p>
<p>The question was asked here:</p>
<p><a href="https://stackoverflow.com/questions/28642/finding-controls-that-use-a-certain-interface-in-aspnet">Finding controls that use a certain interface in ASP.NET</a></p>
<p>And received non-LINQ answers, I already have my own version of a recursive control search on type and ID as extension methods, but I just wondered how easy this is to do in LINQ?</p>
| [
{
"answer_id": 253962,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 7,
"selected": true,
"text": "public static IEnumerable<Control> GetAllControls(this Control parent)\n{\n foreach (Control control in parent.Control... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253937",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29294/"
] |
253,938 | <p>I have some complex stored procedures that may return many thousands of rows, and take a long time to complete.</p>
<p>Is there any way to find out how many rows are going to be returned before the query executes and fetches the data?</p>
<p>This is with Visual Studio 2005, a Winforms application and SQL Server 2005.</p>
| [
{
"answer_id": 253965,
"author": "Keltex",
"author_id": 28260,
"author_profile": "https://Stackoverflow.com/users/28260",
"pm_score": 0,
"selected": false,
"text": "select firstname, lastname, email, orderdate from \ncustomer inner join productorder on customer.customerid=productorder.p... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253938",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18854/"
] |
253,971 | <p>I have 2 databases, and <strong>I want to transport an existing table containing a CHAR column from database A to database B.</strong></p>
<p>Database A is Oracle 9i, has encoding WE8ISO8859P1, and contains a table "foo" with at least 1 column of type CHAR(1 char). I can not change the table on database A because it is part of a third party setup.</p>
<p>Database B is my own Oracle 10g database, using encoding AL32UTF8 for all kinds of reasons, and I want to copy foo into this database.</p>
<p>I setup a database link from database B to database A. Then I issue the following command:</p>
<p>*create table bar as select * from #link#.foo;*</p>
<p>The data gets copied over nicely, but when I check the types of the columns, I notice that CHAR(1 char) has been converted into CHAR(3 char), and when querying the data in database B, it is all padded with spaces.</p>
<p>I think somewhere underwater, Oracle confuses it's own bytes and chars. CHAR(1 byte) is different from CHAR(1 char) etc. I've read about all that.</p>
<p><strong>Why does the datatype change into a padded CHAR(3 char) and how do I stop Oracle from doing this?</strong></p>
<p><em>Edit: It seems to have to do with transfering CHAR's between two specific patchlevels of Oracle 9 and 10. It looks like it is really a bug. as soon as I find out I'll post an update. Meanwhile: don't try to move CHAR's between databases like I described. VARCHAR2 works fine (tested).</em></p>
<p><em>Edit 2: <strong>I found the answer and posted it here:</strong> <a href="https://stackoverflow.com/questions/253971/why-does-char1-change-to-char3-when-copying-over-an-oracle-dblink#263467">Why does Char(1) change to Char(3) when copying over an Oracle DBLINK?</a>
Too bad I can not accept my own answer, because my problem is solved.</em></p>
| [
{
"answer_id": 254083,
"author": "Thomas Jones-Low",
"author_id": 23030,
"author_profile": "https://Stackoverflow.com/users/23030",
"pm_score": 2,
"selected": false,
"text": "ALTER SESSION NLS_NCHAR WE8ISO8859P1 \ncreate table bar as select * from #link#.foo;\n"
}
] | 2008/10/31 | [
"https://Stackoverflow.com/questions/253971",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3540161/"
] |
253,982 | <p>Mac's have TextMate as there preferred application for ruby development, but what would be the preferred application for linux? I need something where it's easy to work with multiple files, project structure and setup commands to run my ruby app or if it is one my merb app.Syntax highlighting is also a must.</p>
<p>Now I typically use Vim, but it's not the best for working with multiple files or with a project structure, even with VTreeView plug-in or multiple VIM windows.</p>
<p>So what would you guys suggest?</p>
<p>If you have better plugins to use for VIM feel free to mention them, I'm not ruling out VIM here.</p>
| [
{
"answer_id": 8587899,
"author": "Eki Eqbal",
"author_id": 1080046,
"author_profile": "https://Stackoverflow.com/users/1080046",
"pm_score": 1,
"selected": false,
"text": " ⌘+shift+p → “install” → ENTER → “codeintel” → ENTER → Restart ST2\n"
}
] | 2008/10/31 | [
"https://Stackoverflow.com/questions/253982",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1610/"
] |
253,987 | <p><code>select max(DELIVERY_TIMESTAMP) from DOCUMENTS;</code> will return the time that the latest document was delivered. How do I return <strong>the other columns</strong> for the latest document? For example I want <code>DOC_NAME</code> for the document that was most recently delivered?</p>
<p>I'm not sure how to form the <code>WHERE</code> clause.</p>
| [
{
"answer_id": 253995,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 1,
"selected": false,
"text": "Select Max(DELIVERY_TIMESTAMP), \n Doc_Name\nFrom TableName\nGroup By Doc_Name\n"
},
{
"answer_id": 253996,
... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253987",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18995/"
] |
253,993 | <p>Is there a way in C# to:</p>
<ol>
<li><p>Get all the properties of a class that have attributes on them (versus having to loop through all properties and then check if attribute exists.</p></li>
<li><p>If i want all Public, Internal, and Protected properties but NOT private properties, i can't find a way of doing that. I can only do this: </p>
<p>PropertyInfo[] props = type.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic)</p></li>
</ol>
<p>Is there a way to avoid getting private properties but do get everything else.</p>
| [
{
"answer_id": 254625,
"author": "Tim Robinson",
"author_id": 32133,
"author_profile": "https://Stackoverflow.com/users/32133",
"pm_score": 1,
"selected": false,
"text": "internal"
},
{
"answer_id": 254641,
"author": "Tim Robinson",
"author_id": 32133,
"author_profile... | 2008/10/31 | [
"https://Stackoverflow.com/questions/253993",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4653/"
] |
254,002 | <p>I am looking for an expression for the .hgignore file, to ignore all files beneath a specified folder.</p>
<p>eg: I would like to ignore all files and folders beneath bin</p>
<p>Actually any advice on how the expressions are formed would be great</p>
| [
{
"answer_id": 254049,
"author": "Xian",
"author_id": 4642,
"author_profile": "https://Stackoverflow.com/users/4642",
"pm_score": 2,
"selected": false,
"text": "syntax: regexp\nbin\\\\*\n"
},
{
"answer_id": 255094,
"author": "Ry4an Brase",
"author_id": 8992,
"author_p... | 2008/10/31 | [
"https://Stackoverflow.com/questions/254002",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4642/"
] |
254,004 | <p>I am using the EMMA tool for code coverage yet despite my best efforts, EMMA is refusing to see the original .java files and generate coverage on a line-by-line basis.</p>
<p>We are using ANT to build the code and debug is set to true. I know that EMMA is measuring coverage as the .emma files seem to be generating and merging correctly. The reports are able to present high level method coverage with percentages. </p>
<p>But why won't it see the .java files? All I get is:
[source file 'a/b/c/d/e/f/code.java' not found in sourcepath]</p>
| [
{
"answer_id": 254041,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 3,
"selected": false,
"text": "sourcepath"
},
{
"answer_id": 254067,
"author": "Ken Gentle",
"author_id": 8709,
"author_profile": "https:... | 2008/10/31 | [
"https://Stackoverflow.com/questions/254004",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
254,009 | <p>This probably has a simple answer, but I must not have had enough coffee to figure it out on my own:</p>
<p>If I had a comma delimited string such as:</p>
<pre><code>string list = "Fred,Sam,Mike,Sarah";
</code></pre>
<p>How would get each element and add quotes around it and stick it back in a string like this:</p>
<pre><code>string newList = "'Fred','Sam','Mike','Sarah'";
</code></pre>
<p>I'm assuming iterating over each one would be a start, but I got stumped after that.</p>
<p>One solution that is ugly:</p>
<pre><code>int number = 0;
string newList = "";
foreach (string item in list.Split(new char[] {','}))
{
if (number > 0)
{
newList = newList + "," + "'" + item + "'";
}
else
{
newList = "'" + item + "'";
}
number++;
}
</code></pre>
| [
{
"answer_id": 254012,
"author": "FOR",
"author_id": 27826,
"author_profile": "https://Stackoverflow.com/users/27826",
"pm_score": 8,
"selected": true,
"text": "string s = \"A,B,C\";\nstring replaced = \"'\"+s.Replace(\",\", \"','\")+\"'\";\n"
},
{
"answer_id": 254024,
"autho... | 2008/10/31 | [
"https://Stackoverflow.com/questions/254009",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12999/"
] |
254,047 | <p>Is it possible to send a HTTP response with a permanent redirect from a Stellent (now called Oracle UCM) website? We're using version 7.5.2 with iDoc script.</p>
<p>We can use the iDoc function setHttpHeader() to send the Location HTTP header, but how to send the HTTP response code 301, to signal the permanent redirect to the browser?</p>
| [
{
"answer_id": 34593757,
"author": "Jonathan Hult",
"author_id": 423351,
"author_profile": "https://Stackoverflow.com/users/423351",
"pm_score": 0,
"selected": false,
"text": "<$setRedirectUrl(\"some url\")$>"
}
] | 2008/10/31 | [
"https://Stackoverflow.com/questions/254047",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4167/"
] |
254,054 | <p>We have a Linux server application that is comprised of a number of open-source tools as well as programs we've written ourselves. Ideally we would like to be able to install this application on any common Linux distribution.</p>
<p>In the past, we've written perl scripts to automate installs of this application. Unfortunately, due to idiosyncrasies of different Linux distros, the logic inside these install scripts gets horribly complex, and can change as new versions of each supported distro are released. Maintaining the installer thus becomes one of the most time-intensive parts of the project!</p>
<p>I'm looking for assistance, be it a framework, documentation, code samples, that can make this process less painful. Here are the types of things our installer needs to do:</p>
<ul>
<li><p>Create user/group accounts</p></li>
<li><p>Create directory trees with specific ownership and permissions</p></li>
<li><p>Install open-source applications, potentially compiling them from source during install</p></li>
<li><p>Insert pre-compiled binaries, scripts, config files, and docs into specific directories</p></li>
<li><p>Register init-type startup and shutdown scripts</p></li>
<li><p>Generate encryption keys</p></li>
<li><p>Verify connectivity to a central server</p></li>
</ul>
| [
{
"answer_id": 266143,
"author": "Josh Kelley",
"author_id": 25507,
"author_profile": "https://Stackoverflow.com/users/25507",
"pm_score": 2,
"selected": false,
"text": "adduser"
}
] | 2008/10/31 | [
"https://Stackoverflow.com/questions/254054",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28314/"
] |
254,058 | <p>Where can I set the display name in the Service Control Manager of a c++ app?</p>
| [
{
"answer_id": 12137377,
"author": "Jama A.",
"author_id": 416996,
"author_profile": "https://Stackoverflow.com/users/416996",
"pm_score": 0,
"selected": false,
"text": "sc config <ServiceName> DisplayName= <NewName>\n"
}
] | 2008/10/31 | [
"https://Stackoverflow.com/questions/254058",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
254,060 | <p>I am using the WMD markdown editor in a project for a large number of fields that correspond to a large number of properties in a large number of Entity classes. Some classes may have multiple properties that require the markdown.</p>
<p>I am storing the markdown itself since this makes it easier to edit the fields later. However, I need to convert the properties to HTML for display later on. The question is: is there some pattern that I can use to avoid writing markdown conversion code in all my entity classes?</p>
<p>I created a utility class with a method that accepts a markdown string and returns the HTML. I am using markdownj and this works fine.</p>
<p>The problem is for each property of each class that stores markdown I may need another method that converts to HTML:</p>
<pre><code>public class Course{
private String description;
.
.
.
public String getDescription(){
return description;
}
public String getDescriptionAsHTML(){
return MarkdownUtil.convert(getDescription());
}
.
.
.
}
</code></pre>
<p>The problem there is that if the Course class has 2 more properties Tuition and Prerequisites say, that both need converters then I will have to write getTuitionAsHTML() and getPrerequisiteAsHTML().</p>
<p>I find that a bit ugly and would like a cleaner solution. The classes that require this are not part of a single inheritance hierarchy. </p>
<p>The other option I am considering is doing this in the controller rather than the model. What are your thoughts on this? </p>
<p>Thanks.</p>
<p>[EDIT]: New thoughts (Thanks Jasper). Since the project uses struts2 (I did not say this before) I could create a view component say that will convert the markdown for me. Then I use that wherever I need to display the value as HTML.</p>
| [
{
"answer_id": 254148,
"author": "Chris Cudmore",
"author_id": 18907,
"author_profile": "https://Stackoverflow.com/users/18907",
"pm_score": 1,
"selected": false,
"text": "public String getDescription(MarkDownUtil converter)\n{\n if (converter == null) return description;\n else re... | 2008/10/31 | [
"https://Stackoverflow.com/questions/254060",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27439/"
] |
254,066 | <p>On Windows XP, the following command in a script will prevent any power saving options from being enabled on the PC (monitor sleep, HD sleep, etc.). This is useful for kiosk applications.</p>
<pre><code>powercfg.exe /setactive presentation
</code></pre>
<p>What is the equivalent on Vista?</p>
| [
{
"answer_id": 254131,
"author": "jeremyasnyder",
"author_id": 33143,
"author_profile": "https://Stackoverflow.com/users/33143",
"pm_score": 3,
"selected": true,
"text": "powercfg.exe -list\n"
},
{
"answer_id": 258777,
"author": "Nick",
"author_id": 1490,
"author_prof... | 2008/10/31 | [
"https://Stackoverflow.com/questions/254066",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1490/"
] |
254,071 | <p>I tried to use <code>OPTION (MAXRECURSION 0)</code> in a view to generate a list of dates.
This seems to be unsupported. Is there a workaround for this issue?</p>
<p>EDIT to Explain what I actually want to do:</p>
<p>I have 2 tables.</p>
<p>table1: int weekday, bool available</p>
<p>table2: datetime date, bool available</p>
<p>I want the result:
view1: date (here all days in this year), available(from table2 or from table1 when not in table2).</p>
<p>That means I have to apply a join on a date with a weekday.
I hope this explanation is understandable, because I actually use more tables with more fields in the query.</p>
<p>I found this code to generate the recursion:</p>
<pre><code>WITH Dates AS
(
SELECT cast('2008-01-01' as datetime) Date
UNION ALL
SELECT Date + 1
FROM Dates
WHERE Date + 1 < DATEADD(yy, 1, GETDATE())
)
</code></pre>
| [
{
"answer_id": 13417526,
"author": "Stefan Steiger",
"author_id": 155077,
"author_profile": "https://Stackoverflow.com/users/155077",
"pm_score": 0,
"selected": false,
"text": ";WITH CTE_Stack(IsPartOfRecursion, Depth, MyDate) AS\n(\n SELECT \n 0 AS IsPartOfRecursion\n ... | 2008/10/31 | [
"https://Stackoverflow.com/questions/254071",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13376/"
] |
254,076 | <p>This is the error Dependency Walker gives me on an executable that I am building with VC++ 2005 Express Edition. When trying to run the .exe, I get:</p>
<pre><code>This application has failed to start because the application configuration
is incorrect. Reinstalling the application may fix this problem.
</code></pre>
<p>(I am new to the manifest/SxS/etc. way of doing things post VC++ 2003.)</p>
<p>EDIT:
I am running on the same machine I am building the .exe with. In Event Viewer, I have the unhelpful:</p>
<pre><code>Faulting application blah.exe, version 0.0.0.0, faulting module blah.exe,
version 0.0.0.0, fault address 0x004239b0.
</code></pre>
| [
{
"answer_id": 1093162,
"author": "Ian Kemp",
"author_id": 70345,
"author_profile": "https://Stackoverflow.com/users/70345",
"pm_score": 3,
"selected": false,
"text": "C:\\Program Files\\Microsoft Visual Studio 8\\VC\\redist\\x86\\Microsoft.VC80.CRT\n"
}
] | 2008/10/31 | [
"https://Stackoverflow.com/questions/254076",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2666/"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.