qid int64 4 22.2M | question stringlengths 18 48.3k | answers list | date stringlengths 10 10 | metadata list |
|---|---|---|---|---|
359,359 | <p>I am in need of a case insensitive string enumeration type in my XML schema (.xsd) file. I can get case insensitive by doing the following.</p>
<pre><code><xs:simpleType name="setDigitalPointType">
<xs:restriction base="xs:string">
<xs:pattern value="[Oo][Nn]" />
<xs:pattern value="[Oo][Ff][Ff]" />
</xs:restriction>
</xs:simpleType>
</code></pre>
<p>The only problem is that I get no enumeration values. I will not get the nice intellesense when using Visual Studio to write my XML. The following will give me enumerations but it is case sensitive.</p>
<pre><code><xs:simpleType name="setDigitalPointType">
<xs:restriction base="xs:string">
<xs:enumeration value="on" />
<xs:enumeration value="off" />
</xs:restriction>
</xs:simpleType>
</code></pre>
<p>This will give me my enumerations but if I ever receive a value of "On", "ON", or "oN" it will fail verification.</p>
<p>I want enumeration of "on", "off" and allow entry of case insensitive versions.</p>
| [
{
"answer_id": 15445351,
"author": "Orvid King",
"author_id": 776797,
"author_profile": "https://Stackoverflow.com/users/776797",
"pm_score": 4,
"selected": false,
"text": "<xs:simpleType name=\"setDigitalPointType\">\n <xs:union>\n <xs:simpleType>\n <xs:restriction ... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359359",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/43976/"
] |
359,381 | <p>I'm preparing to send mass email to customers which is in html + images.
What are general rules to do make it display correctly in most popular mail clients?</p>
<p>EDIT:</p>
<p>Well it's for my customers - about few k clients.</p>
<p>My question is - how to code this email that it will display correctly in customer mailclient(thunderbird, outlook, gmail). What css tags can I use?</p>
| [
{
"answer_id": 359399,
"author": "Greg",
"author_id": 24181,
"author_profile": "https://Stackoverflow.com/users/24181",
"pm_score": 2,
"selected": false,
"text": "<style>"
}
] | 2008/12/11 | [
"https://Stackoverflow.com/questions/359381",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33093/"
] |
359,393 | <p>I've got a list of links which have a click event attached to them, I need to get the ID from the child A link. So in the example below if I clicked the first list element I'd need google retuned. </p>
<p>I've tried <code>'$this a'</code> but can't quite work out the syntax.</p>
<pre><code>$("ul li").click(function(event){
$("input").val($(this).html());
});
</code></pre>
<pre><code><ul>
<li><a href="http://www.google.com" id="google">Google</a>
</ul>
</code></pre>
| [
{
"answer_id": 359407,
"author": "smoothdeveloper",
"author_id": 17049,
"author_profile": "https://Stackoverflow.com/users/17049",
"pm_score": 7,
"selected": true,
"text": "$(this).find('a:first').attr('id')\n"
},
{
"answer_id": 359500,
"author": "mbillard",
"author_id": ... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359393",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45350/"
] |
359,400 | <p>I want to get the path name and arguments of running processes using java code. Is there any solution?</p>
| [
{
"answer_id": 359437,
"author": "VonC",
"author_id": 6309,
"author_profile": "https://Stackoverflow.com/users/6309",
"pm_score": 2,
"selected": false,
"text": "TASKLIST.EXE"
}
] | 2008/12/11 | [
"https://Stackoverflow.com/questions/359400",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
359,422 | <p>I have an ASP.Net web user control that contains a TextBox and a calendar from the Ajax Control Toolkit.</p>
<p>When I include this user control on my page I would like it to participate in input validation (there is a required filed validator set on the TextBox inside the UC), ie. when the page is validated the content of the UC should also be validated. So I had my UC implement the IValidator interface, which worked well except that I could not set the validation group on the user control. Apparently I'm supposed to inherit from BaseValidator to do that, but I can't since I'm already inheriting UserControl.</p>
<p>There's got to be a way to deal with this common scenario.</p>
| [
{
"answer_id": 359455,
"author": "Scott Ivey",
"author_id": 36297,
"author_profile": "https://Stackoverflow.com/users/36297",
"pm_score": 5,
"selected": true,
"text": "public string ValidationGroup\n{\n get\n {\n return MyRequiredFieldValidator.ValidationGroup;\n }\n set\n ... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359422",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/77004/"
] |
359,424 | <p>I have a <a href="http://en.wikipedia.org/wiki/Git_%28software%29" rel="noreferrer">Git</a> repository which contains a number of subdirectories. Now I have found that one of the subdirectories is unrelated to the other and should be detached to a separate repository.</p>
<p>How can I do this while keeping the history of the files within the subdirectory?</p>
<p>I guess I could make a clone and remove the unwanted parts of each clone, but I suppose this would give me the complete tree when checking out an older revision etc. This might be acceptable, but I would prefer to be able to pretend that the two repositories doesn't have a shared history.</p>
<p>Just to make it clear, I have the following structure:</p>
<pre><code>XYZ/
.git/
XY1/
ABC/
XY2/
</code></pre>
<p>But I would like this instead:</p>
<pre><code>XYZ/
.git/
XY1/
XY2/
ABC/
.git/
ABC/
</code></pre>
| [
{
"answer_id": 359759,
"author": "Paul",
"author_id": 23356,
"author_profile": "https://Stackoverflow.com/users/23356",
"pm_score": 11,
"selected": true,
"text": "git subtree"
},
{
"answer_id": 955793,
"author": "pgs",
"author_id": 103421,
"author_profile": "https://S... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359424",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23896/"
] |
359,426 | <p>Does anyone know a simple load balance algorithm (formula) that relates users connected, cpu load, network load and memory usage?
This will be used to compare various servers and assign to a new user the best at the moment.
Thank You.</p>
| [
{
"answer_id": 359581,
"author": "kgiannakakis",
"author_id": 24054,
"author_profile": "https://Stackoverflow.com/users/24054",
"pm_score": 2,
"selected": false,
"text": "mod_proxy"
}
] | 2008/12/11 | [
"https://Stackoverflow.com/questions/359426",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
359,434 | <p>I am training in web developement and am learning about <strong>JSP</strong> & <strong>Servlets</strong>. I have some knowledge of <code>HttpSession</code> - I have used it in some of my sample projects.</p>
<p>In browsers I have seen the option to "delete cookies". If I delete the cookies it deletes the <code>HttpSession</code> also.</p>
<p>Are cookies and session the same? What are the differences between them?</p>
| [
{
"answer_id": 359482,
"author": "Chris Cudmore",
"author_id": 18907,
"author_profile": "https://Stackoverflow.com/users/18907",
"pm_score": 8,
"selected": false,
"text": "name=bob; password=asdfas"
},
{
"answer_id": 29387911,
"author": "Elangovan",
"author_id": 2614459,
... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359434",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44848/"
] |
359,436 | <p>Should be simple and quick: I want a C# equivalent to the following Java code:</p>
<pre><code>orig: for(String a : foo) {
for (String b : bar) {
if (b.equals("buzz")) {
continue orig;
}
}
// other code comes here...
}
</code></pre>
<hr>
<p><strong><em>Edit</em></strong>:
OK it seems there is no such equivalent (hey - Jon Skeet himself said there isn't, that settles it ;)). So the "solution" for me (in its Java equivalent) is:</p>
<pre><code>for(String a : foo) {
bool foundBuzz = false;
for (String b : bar) {
if (b.equals("buzz")) {
foundBuzz = true;
break;
}
}
if (foundBuzz) {
continue;
}
// other code comes here...
}
</code></pre>
| [
{
"answer_id": 359449,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 6,
"selected": true,
"text": "using System;\n\npublic class Test\n{\n static void Main()\n {\n for (int i=0; i < 5; i++)\n {\n ... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359436",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6583/"
] |
359,438 | <p>Does anyone know of any optimization packages out there for R (similar to NUOPT for S+)?</p>
| [
{
"answer_id": 1190707,
"author": "gappy",
"author_id": 143813,
"author_profile": "https://Stackoverflow.com/users/143813",
"pm_score": 4,
"selected": false,
"text": "optim()"
},
{
"answer_id": 14179446,
"author": "dwstu",
"author_id": 1764155,
"author_profile": "http... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359438",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2173/"
] |
359,439 | <p>I want to use HTTP GET and POST commands to retrieve URLs from a website and parse the HTML. How do I do this?</p>
| [
{
"answer_id": 360291,
"author": "Rob Hruska",
"author_id": 29995,
"author_profile": "https://Stackoverflow.com/users/29995",
"pm_score": 5,
"selected": true,
"text": "URL url = new URL(\"http://example.com\");\nHttpURLConnection connection = (HttpURLConnection)url.openConnection();\ncon... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359439",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16616/"
] |
359,459 | <p>Given the schema:</p>
<pre>
MACHINE_TYPE { machine_type }
MACHINE { machine, machine_type }
SORT_PLAN { sort_plan, machine_type }
SCHEDULE { day_of_week, machine, sort_plan }
</pre>
<p>and the business rule:</p>
<blockquote>
<p>A sort plan can be assigned to any
machine of the same machine_type.</p>
</blockquote>
<p>How do I enforce that, in SCHEDULE, the tuples referenced by <em>machine</em> and <em>sort_plan</em> have the same <em>machine_type</em>?</p>
<p>The schema can be changed, if necessary.</p>
| [
{
"answer_id": 359508,
"author": "Charles Bretana",
"author_id": 32632,
"author_profile": "https://Stackoverflow.com/users/32632",
"pm_score": 2,
"selected": true,
"text": "MACHINE_TYPE { machine_type }\nMACHINE { machine, machine_type }\nSORT_PLAN { sort_plan}\nMACHINE_SORTPLAN {machine... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359459",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21294/"
] |
359,467 | <p>I have a question similar to the one here: <a href="https://stackoverflow.com/questions/341723/event-handlers-inside-a-javascript-loop-need-a-closure#341759">Event handlers inside a Javascript loop - need a closure?</a> but I'm using jQuery and the solution given seems to fire the event when it's bound rather than on click.</p>
<p>Here's my code:</p>
<pre><code>for(var i in DisplayGlobals.Indicators)
{
var div = d.createElement("div");
div.style.width = "100%";
td.appendChild(div);
for(var j = 0;j<3;j++)
{
var test = j;
if(DisplayGlobals.Indicators[i][j].length > 0)
{
var img = d.createElement("img");
jQuery(img).attr({
src : DisplayGlobals.Indicators[i][j],
alt : i,
className: "IndicatorImage"
}).click(
function(indGroup,indValue){
jQuery(".IndicatorImage").removeClass("active");
_this.Indicator.TrueImage = DisplayGlobals.Indicators[indGroup][indValue];
_this.Indicator.FalseImage = DisplayGlobals.IndicatorsSpecial["BlankSmall"];
jQuery(this).addClass("active");
}(i,j)
);
div.appendChild(img);
}
}
}
</code></pre>
<p>I've tried a couple of different ways without success...</p>
<p>The original problem was that _this.Indicator.TrueImage was always the last value because I was using the loop counters rather than parameters to choose the right image.</p>
| [
{
"answer_id": 359505,
"author": "Greg",
"author_id": 24181,
"author_profile": "https://Stackoverflow.com/users/24181",
"pm_score": 5,
"selected": true,
"text": ".click(\n function(indGroup,indValue)\n {\n return function()\n {\n jQuery(\".IndicatorImage\")... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359467",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4950/"
] |
359,472 | <p><strong>How can I verify a Google authentication access token?</strong></p>
<p><strong>I need to somehow query Google and ask: Is [given access token] valid for the [example@example.com] Google account?</strong></p>
<h2>Short version</h2>
<p>It's clear how an access token supplied through the <a href="https://code.google.com/apis/accounts/docs/OAuth.html" rel="noreferrer">Google Authentication Api :: OAuth Authentication for Web Applications</a> can be used to then request data from a range of Google services. It is not clear how to check if a given access token is valid for a given Google account. I'd like to know how.</p>
<h2>Long version</h2>
<p>I'm developing an API that uses token-based authentication. A token will be returned upon provision of a valid username+password or upon provision of a third-party token from any one of <i>N</i> verifiable services.</p>
<p>One of the third-party services will be Google, allowing a user to authenticate against my service using their Google account. This will later be extended to include Yahoo accounts, trusted OpenID providers and so on.</p>
<p><strong>Schematic example of Google-based access:</strong></p>
<p><img src="https://webignition.net/images/figures/auth_figure002.png" alt="alt text" /></p>
<p>The 'API' entity is under my full control. The 'public interface' entity is any web- or desktop-based app. Some public interfaces are under my control, others will not be and others still I may never even know about.</p>
<p>Therefore I cannot trust the token supplied to the API in step 3. This will be supplied along with the corresponding Google account email address.</p>
<p>I need to somehow query Google and ask: <em>Is this access token valid for example@example.com</em>?</p>
<p>In this case, example@example.com is the Google account unique identifier - the email address someone uses to log in to their Google account. This cannot be assumed to be a Gmail address - someone can have a Google account without having a Gmail account.</p>
<p>The Google documentation clearly states how, with an access token, data can be retrieved from a number of Google services. Nothing seems to state how you can check if a given access token is valid in the first place.</p>
<p><strong>Update</strong>
The token is valid for N Google services. I can't try a token against a Google service as means of verifying it as I won't know which subset of all Google's services a given user actually uses.</p>
<p>Furthermore, I'll never be using the Google authentication access token to access any Google services, merely as a means of verifying a supposed Google user actually is who they say they are. If there is another way of doing this I'm happy to try.</p>
| [
{
"answer_id": 10498732,
"author": "ahmed",
"author_id": 855406,
"author_profile": "https://Stackoverflow.com/users/855406",
"pm_score": 4,
"selected": false,
"text": "function authenticate_google_OAuthtoken($user_id)\n{\n $access_token = google_get_user_token($user_id); // get exis... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359472",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5343/"
] |
359,492 | <p>Well I am querying my DB, a table called bookBilling, to get a value under the column of billingID. </p>
<p>In my first query I get the customer ID from a table based on what value the cookie holds.
In my second query I take that custID value and am looking to get the billingID associated with it.</p>
<pre><code>query = "SELECT custID FROM bookSession WHERE session='"&theCookie&"'"
'--Connect to DB'
Set objConn = ConnectDB()
'--Query to DB'
Set objRS = objConn.Execute(query)
custID = objRS.Fields("custID")
query = "SELECT billingID FROM bookBilling WHERE custID="&custID&""
objConn.Execute(query)
</code></pre>
<p>Here is where it becomes an issue. I tried using this to obtain the value:</p>
<pre><code>billingID = objRS.Fields("billingID")
</code></pre>
<p>When that didn't work I printed the query to my browser to make sure it worked and it came back good, I checked it in SQL Server Management Studio to make sure. After that I decided to play with it a bit and found that using "0" as the reference works since it is the first item in my table. </p>
<pre><code>billingID = objRS.Fields(0)
</code></pre>
<p>So that worked, I know my table column header is correct I have looked at it and used it in other queries before. Does anyone know why this might happen? Is it a result of not clearing my connection or closing it afterward?</p>
<p>Thanks</p>
| [
{
"answer_id": 359537,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 2,
"selected": false,
"text": "SELECT billingID\nFROM bookBilling bb\nINNER JOIN bookSession bs ON bs.custID=bb.custID\nWHERE bs.session= @theCookie\... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359492",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27620/"
] |
359,494 | <p>I'm using <a href="http://en.wikipedia.org/wiki/JSLint" rel="noreferrer">JSLint</a> to go through JavaScript, and it's returning many suggestions to replace <code>==</code> (two equals signs) with <code>===</code> (three equals signs) when doing things like comparing <code>idSele_UNVEHtype.value.length == 0</code> inside of an <code>if</code> statement.</p>
<p>Is there a performance benefit to replacing <code>==</code> with <code>===</code>? </p>
<p>Any performance improvement would be welcomed as many comparison operators exist.</p>
<p>If no type conversion takes place, would there be a performance gain over <code>==</code>?</p>
| [
{
"answer_id": 359509,
"author": "Bill the Lizard",
"author_id": 1288,
"author_profile": "https://Stackoverflow.com/users/1288",
"pm_score": 14,
"selected": true,
"text": "==="
},
{
"answer_id": 359547,
"author": "Andreas Grech",
"author_id": 44084,
"author_profile": ... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359494",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44990/"
] |
359,495 | <p>Why are the lists <code>list1Instance</code> and <code>p</code> in the <code>Main</code> method of the below code pointing to the same collection? </p>
<pre><code>class Person
{
public string FirstName = string.Empty;
public string LastName = string.Empty;
public Person(string firstName, string lastName) {
this.FirstName = firstName;
this.LastName = lastName;
}
}
class List1
{
public List<Person> l1 = new List<Person>();
public List1()
{
l1.Add(new Person("f1","l1"));
l1.Add(new Person("f2", "l2"));
l1.Add(new Person("f3", "l3"));
l1.Add(new Person("f4", "l4"));
l1.Add(new Person("f5", "l5"));
}
public IEnumerable<Person> Get()
{
foreach (Person p in l1)
{
yield return p;
}
//return l1.AsReadOnly();
}
}
class Program
{
static void Main(string[] args)
{
List1 list1Instance = new List1();
List<Person> p = new List<Person>(list1Instance.Get());
UpdatePersons(p);
bool sameFirstName = (list1Instance.l1[0].FirstName == p[0].FirstName);
}
private static void UpdatePersons(List<Person> list)
{
list[0].FirstName = "uf1";
}
}
</code></pre>
<p>Can we change this behavior with out changing the return type of <code>List1.Get()</code>? </p>
<p>Thanks</p>
| [
{
"answer_id": 359507,
"author": "mmx",
"author_id": 33708,
"author_profile": "https://Stackoverflow.com/users/33708",
"pm_score": 6,
"selected": true,
"text": "IEnumerable<T>"
},
{
"answer_id": 359515,
"author": "Szymon Rozga",
"author_id": 7583,
"author_profile": "h... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359495",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26036/"
] |
359,497 | <p>I have seen a few suggestions on making emacs portable (on Windows). I have this in my site-start.el:</p>
<pre><code>(defvar program-dir (substring data-directory 0 -4))
(setq inhibit-startup-message t)
(setenv "HOME" program-dir)
</code></pre>
<p>I changed the HOME variable so that not only my .emacs init files (and other init files) are read, but everything generated by emacs will stay in the program directory, not needing me to specify the path for everything one by one. </p>
<p>Well this works well but the emacs server is not working; I get error message "no connection could be made because target machine actively refused it." If I don't change my HOME var then emacs server works. Is there way to fix this?</p>
| [
{
"answer_id": 359554,
"author": "ShreevatsaR",
"author_id": 4958,
"author_profile": "https://Stackoverflow.com/users/4958",
"pm_score": 3,
"selected": false,
"text": "emacsclient"
}
] | 2008/12/11 | [
"https://Stackoverflow.com/questions/359497",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
359,498 | <p>I'm using ctypes to load a DLL in Python. This works great.</p>
<p>Now we'd like to be able to reload that DLL at runtime. </p>
<p>The straightforward approach would seem to be:
1. Unload DLL
2. Load DLL</p>
<p>Unfortunately I'm not sure what the correct way to unload the DLL is.</p>
<p>_ctypes.FreeLibrary is available, but private.</p>
<p>Is there some other way to unload the DLL?</p>
| [
{
"answer_id": 359570,
"author": "Piotr Lesnicki",
"author_id": 38796,
"author_profile": "https://Stackoverflow.com/users/38796",
"pm_score": 5,
"selected": true,
"text": "mydll = ctypes.CDLL('...')\ndel mydll\nmydll = ctypes.CDLL('...')\n"
},
{
"answer_id": 28610285,
"author... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359498",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6839/"
] |
359,516 | <p>Id like to be able to write a function that reads an external news site and returns the source code of the target page. Any ideas and/or information to get me started?</p>
| [
{
"answer_id": 359522,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 4,
"selected": true,
"text": "string GetOtherPage(System.Uri url)\n{\n return new System.Net.WebClient().DownloadString(url);\n}\n"
}
] | 2008/12/11 | [
"https://Stackoverflow.com/questions/359516",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25515/"
] |
359,528 | <p>I have Visual Studio 2008 Professional and I am having issues with expanding and collapsing method code blocks in ASP.Net Generic Handler pages (.ashx)</p>
<p>I would have thought you could do the same thing like in the code behind of .aspx web pages.</p>
<p>I have this same issue on other boxes even with VS 2008 Standard and VS 2005 Professional. All boxes have been fully patched (OS and Visual Studio.)</p>
<p>Does anybody have any suggestions as to enabling this feature?</p>
| [
{
"answer_id": 5741158,
"author": "bigEsmurf",
"author_id": 718525,
"author_profile": "https://Stackoverflow.com/users/718525",
"pm_score": 4,
"selected": false,
"text": "App_Code"
},
{
"answer_id": 6829083,
"author": "Kaspars",
"author_id": 863309,
"author_profile": ... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359528",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24522/"
] |
359,541 | <p>I have a small C library in a DLL and I need to call a handful of its methods.</p>
<p>It uses pointers and a few structs but is otherwise quite simple. Problem is I'm not terribly knowledgable on .NET's interop with the unmanaged world and my attempts so far keep hitting memory access violation exceptions (presumably due to me not getting the pointers quite right).</p>
<p>Could anyone give me some pointers (ooh a pun!) on the best way to approach this?</p>
<p>Thank you</p>
<pre><code>extern vconfig_t *Pobsopen(Ppoly_t ** obstacles, int n_obstacles);
extern int Pobspath(vconfig_t * config, Ppoint_t p0, int poly0,
Ppoint_t p1, int poly1,
Ppolyline_t * output_route);
extern void Pobsclose(vconfig_t * config);
struct vconfig_t {
int Npoly;
int N;
Ppoint_t *P;
int *start;
int *next;
int *prev;
};
typedef struct Ppoly_t {
Ppoint_t *ps;
int pn;
} Ppoly_t;
typedef Ppoly_t Ppolyline_t;
typedef struct Pxy_t {
double x, y;
} Pxy_t;
typedef struct Pxy_t Ppoint_t;
typedef struct Pxy_t Pvector_t;
</code></pre>
| [
{
"answer_id": 359843,
"author": "mherle",
"author_id": 42913,
"author_profile": "https://Stackoverflow.com/users/42913",
"pm_score": 3,
"selected": false,
"text": "[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]\npublic struct... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359541",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41475/"
] |
359,553 | <p>While debugging a Linux app, I found a pointer with the suspicious value 0x7c7c7c7c. Does that particular value indicate anything?</p>
<p>(I ask because I know from my MSVC days that in a debug build, values like 0xcdcdcdcd or 0xdddddddd would be stored into heap blocks that were uninitialized, freed, or otherwise invalid. Some people use magic values like 0xdeadbeef or 0xcafebabe in uninitialized memory. I'm guessing something in libc or elsewhere uses 0x7c7c7c7c as a magic value, but I can't find it documented.)</p>
| [
{
"answer_id": 359574,
"author": "Adam Rosenfield",
"author_id": 9530,
"author_profile": "https://Stackoverflow.com/users/9530",
"pm_score": 2,
"selected": false,
"text": "memset()"
},
{
"answer_id": 359792,
"author": "oliver",
"author_id": 2148773,
"author_profile": ... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359553",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1175/"
] |
359,582 | <p>A client has installed Sql server 2005 reporting services. When we go to the web bit at <code>http://servername/reports/</code> we just see a blank screen like:
<img src="https://i.stack.imgur.com/nGQXH.jpg" alt="http://img91.imageshack.us/img91/3787/rsblankqx4.jpg"></p>
<p>We are using windows authentication and I think it has authenticated us as the "site settings" button is appearing and we can alter site security, add to roles etc. </p>
<p>I have had this before and cant remember how I fixed it. </p>
<p>Any ideas?</p>
<p>Thanks,</p>
<p>Alex</p>
| [
{
"answer_id": 359574,
"author": "Adam Rosenfield",
"author_id": 9530,
"author_profile": "https://Stackoverflow.com/users/9530",
"pm_score": 2,
"selected": false,
"text": "memset()"
},
{
"answer_id": 359792,
"author": "oliver",
"author_id": 2148773,
"author_profile": ... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359582",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23066/"
] |
359,590 | <p>How do I get the reference to a folder for storing per-user-per-application settings when writing an Objective-C Cocoa app in Xcode?</p>
<p>In .NET I would use the <code>Environment.SpecialFolder</code> enumeration:</p>
<pre><code>Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
</code></pre>
<p>What's the Cocoa equivalent?</p>
| [
{
"answer_id": 359819,
"author": "Marc Charbonneau",
"author_id": 35136,
"author_profile": "https://Stackoverflow.com/users/35136",
"pm_score": 5,
"selected": true,
"text": "~/Library/Preferences/"
}
] | 2008/12/11 | [
"https://Stackoverflow.com/questions/359590",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6408/"
] |
359,596 | <p>In a .NET application, how can I identify which network interface is used to communicate to a given IP address?</p>
<p>I am running on workstations with multiple network interfaces, IPv4 and v6, and I need to get the address of the "correct" interface used for traffic to my given database server.</p>
| [
{
"answer_id": 359640,
"author": "Paul Nearney",
"author_id": 24071,
"author_profile": "https://Stackoverflow.com/users/24071",
"pm_score": 2,
"selected": false,
"text": "using System.Management;\nstring query = \"SELECT * FROM Win32_NetworkAdapterConfiguration\";\nManagementObjectSearch... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359596",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38567/"
] |
359,601 | <p>I'm looking for a single line regex which does the following:</p>
<p>Given a HTML tag with the "name" attribute, I want to replace it with my own attribute. If that tag lacks the name attribute, I want to implant my own attribute. The result should look like this:</p>
<pre><code><IMG name="img1" ...> => <IMG name="myImg1" ...>
<IMG ...> => <IMG name="myImg1" ...>
</code></pre>
<p>Can this be done with a single line regex?</p>
| [
{
"answer_id": 359724,
"author": "Tim Pietzcker",
"author_id": 20670,
"author_profile": "https://Stackoverflow.com/users/20670",
"pm_score": 0,
"selected": false,
"text": "<(?!/)(/w+)\\s+(name=\"[^\"]+\")?"
},
{
"answer_id": 359773,
"author": "Sean",
"author_id": 45364,
... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359601",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9941/"
] |
359,612 | <p>How can I convert a RGB Color to HSV using C#?<br/>
I've searched for a fast method without using any external library.</p>
| [
{
"answer_id": 637025,
"author": "georged",
"author_id": 70347,
"author_profile": "https://Stackoverflow.com/users/70347",
"pm_score": 6,
"selected": true,
"text": "System.Drawing.Color color = System.Drawing.Color.FromArgb(red, green, blue);\nfloat hue = color.GetHue();\nfloat saturatio... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359612",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38940/"
] |
359,620 | <p>Can you use a Spring-WS WebserviceTemplate for calling a webservice and avoid that it generates a SOAP-envelope? That is, the message already contains an SOAP-Envelope and I don't want that the WebserviceTemplate wraps another one around it. :-)</p>
<p>The reason I want this is that I'd like to call a webservice that uses ws-security and do not want to put the ws-security stuff into the WebserviceTemplate, but just want to feed it a message with pre-generated ws-security information in the SOAP-envelope. I tried calling the method <a href="http://static.springsource.org/spring-ws/sites/1.5/apidocs/org/springframework/ws/client/core/WebServiceTemplate.html#sendSourceAndReceiveToResult(java.lang.String,%20javax.xml.transform.Source,%20javax.xml.transform.Result)" rel="nofollow noreferrer">sendSourceAndReceiveToResult</a> with a Source already contains a Soap-Envelope with the WS-Security stuff and the webservice template wraps around another Soap-Envelope and thus destroys the message.</p>
| [
{
"answer_id": 415769,
"author": "Domchi",
"author_id": 29192,
"author_profile": "https://Stackoverflow.com/users/29192",
"pm_score": 3,
"selected": true,
"text": "<bean id=\"webServiceTemplate\" class=\"org.springframework.ws.client.core.WebServiceTemplate\">\n <property name=\"messa... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359620",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21499/"
] |
359,625 | <p>Is there a better, more elegant (and/or possibly faster) way than</p>
<pre><code>boolean isNumber = false;
try{
Double.valueOf(myNumber);
isNumber = true;
} catch (NumberFormatException e) {
}
</code></pre>
<p>...?</p>
<hr>
<p><strong>Edit</strong>:
Since I can't pick two answers I'm going with the regex one because a) it's elegant and b) saying "Jon Skeet solved the problem" is a tautology because Jon Skeet himself is the solution to all problems.</p>
| [
{
"answer_id": 359632,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 3,
"selected": false,
"text": "String.matches(\"^[\\\\d\\\\-\\\\.]+$\");"
},
{
"answer_id": 359634,
"author": "Jon Skeet",
"author_id": 22656... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359625",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6583/"
] |
359,633 | <p>Is it best practice to wrap a web service method/call into a try/catch block?</p>
<p>I don't web service requests tend to be the reason why the .NET desktop applications crash? So I was thinking all calls should be wrapped in try/catch to prevent this.</p>
<p>Good idea?</p>
<p>Also, should it throw an exception or just have an empty catch?</p>
| [
{
"answer_id": 359710,
"author": "Maghis",
"author_id": 45355,
"author_profile": "https://Stackoverflow.com/users/45355",
"pm_score": 2,
"selected": false,
"text": "#if !DEBUG\ncatch (Exception ex)\n{\n // show messagebox, log, etc\n}\n#endif\n"
},
{
"answer_id": 4593824,
... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359633",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39677/"
] |
359,635 | <p>What's the best way to implement a classic curry function in actionscript with a nice syntax?</p>
<p>I've tried:</p>
<pre><code>Function.prototype.curry = function()
{
return "helloWorld";
}
trace((function():void {}).curry());
</code></pre>
<p>...approach but that didn't work. </p>
<p>I guess I'm stuck with a ugly approach such as:</p>
<pre><code>FunctionUtils.curry(fp, ... args)
</code></pre>
<p>???</p>
| [
{
"answer_id": 359774,
"author": "Niels Bosma",
"author_id": 40939,
"author_profile": "https://Stackoverflow.com/users/40939",
"pm_score": 1,
"selected": false,
"text": "public static function curry(func:Function, ... args:Array):*\n{\n var arity:int = func.length;\n var currying:F... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359635",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40939/"
] |
359,656 | <p>We are trying to develop an application to view and annotate PDF files in ASP.net. </p>
<p>The function involves capturing x,y coordinates from a click and placing the annotation on that specific location.</p>
<p>Are there available components to do this?</p>
<p>Thanks in advance.</p>
| [
{
"answer_id": 359774,
"author": "Niels Bosma",
"author_id": 40939,
"author_profile": "https://Stackoverflow.com/users/40939",
"pm_score": 1,
"selected": false,
"text": "public static function curry(func:Function, ... args:Array):*\n{\n var arity:int = func.length;\n var currying:F... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359656",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
359,657 | <p>I've use Moq to mock my <a href="http://martinfowler.com/eaaCatalog/repository.html" rel="nofollow noreferrer">repositories</a>. However, someone recently said that they prefer to create hard-coded test implementations of their repository interfaces.</p>
<p>What are the pros and cons of each approach?</p>
<p><strong>Edit:</strong> clarified meaning of repository with link to Fowler.</p>
| [
{
"answer_id": 359692,
"author": "matt b",
"author_id": 4249,
"author_profile": "https://Stackoverflow.com/users/4249",
"pm_score": 0,
"selected": false,
"text": "public interface UserDao {\n User getUser(int userid);\n User getUser(String login);\n}\n\npublic class InMemoryUserDao... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359657",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/43649/"
] |
359,660 | <p>I have an xml string </p>
<pre><code><grandparent>
<parent>
<child>dave</child>
<child>laurie</child>
<child>gabrielle</child>
</parent>
</grandparrent>
</code></pre>
<p>What I want to get is the data raw xml that's inside the parent.
I'm using MSXML </p>
<pre><code>iXMLElm->get_xml(&bStr);
</code></pre>
<p>is returning</p>
<pre><code><parent>
<child>dave</child>
<child>laurie</child>
<child>gabrielle</child>
</parent>
</code></pre>
<p>.</p>
<pre><code>iXMLElm->get_text(&bStr);
</code></pre>
<p>returns
davelauriegabrielle</p>
<p><strong>What function do I use if I want to get?</strong> </p>
<pre><code><child>dave</child>
<child>laurie</child>
<child>gabrielle</child>
</code></pre>
<p>Is anyone aware of some good documentation on these functions? Everything I've seen is a linked nightmare. </p>
| [
{
"answer_id": 361142,
"author": "Jeff Yates",
"author_id": 23234,
"author_profile": "https://Stackoverflow.com/users/23234",
"pm_score": 0,
"selected": false,
"text": "iXMLElm"
},
{
"answer_id": 6261202,
"author": "psp",
"author_id": 724917,
"author_profile": "https:... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359660",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31325/"
] |
359,672 | <p>Is there a way other than looping through the Files in a SPFolder to determine if a give filename (string) exists?</p>
| [
{
"answer_id": 363869,
"author": "Lars Fastrup",
"author_id": 27393,
"author_profile": "https://Stackoverflow.com/users/27393",
"pm_score": 6,
"selected": true,
"text": "using (SPSite site = new SPSite(\"http://server/site\"))\nusing (SPWeb web = site.OpenWeb())\n{\n SPFile file = web.G... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359672",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7001/"
] |
359,675 | <h2>Goal</h2>
<p>Java client for Yahoo's HotJobs <a href="http://developer.yahoo.com/hotjobs/resume_search_user_guide/index.html" rel="nofollow noreferrer">Resumé Search REST API</a>. </p>
<h2>Background</h2>
<p>I'm used to writing web-service clients for SOAP APIs, where <a href="https://jax-ws.dev.java.net/jax-ws-ea3/docs/wsimport.html" rel="nofollow noreferrer">wsimport</a> generates proxy stubs and you're off and running. But this is a REST API, which is new to me.</p>
<h2>Details</h2>
<ul>
<li><a href="http://en.wikipedia.org/wiki/Representational_State_Transfer" rel="nofollow noreferrer">REST</a> API</li>
<li>No <a href="http://en.wikipedia.org/wiki/Web_Application_Description_Language" rel="nofollow noreferrer">WADL</a></li>
<li>No formal XML schema (XSD or DTD files). There are <a href="http://developer.yahoo.com/hotjobs/resume_search_user_guide/auth.html" rel="nofollow noreferrer">example XML request/response pairs</a>.</li>
<li>No example code provided</li>
</ul>
<h2>Progress</h2>
<p>I looked at question <a href="https://stackoverflow.com/questions/221442/rest-clients-for-java">Rest clients for Java?</a>, but the automated solutions there assume you are providing both the server and the client, with JAXB invoked on POJOs to generate a schema and a REST API.</p>
<p>Using <a href="http://jersey.java.net/" rel="nofollow noreferrer">Jersey</a> (a <a href="http://jcp.org/en/jsr/detail?id=311" rel="nofollow noreferrer">JAX-RS</a> implementation), I have been able to make a manual HTTP request:</p>
<pre><code>import com.sun.jersey.api.client.*;
...
ClientConfig clientConfig = new DefaultClientConfig();
Client client = Client.create(clientConfig);
WebResource webResource = client.resource("https://hj.yahooapis.com/v1/HJAuthTokens");
webResource.accept("application/xml");
// body is a hard-coded string, with replacements for the variable bits
String response = webResource.post(String.class, body);
// parse response into a org.w3c.dom.Document
// interface with Document via XPATH, or write my own POJO mappings
</code></pre>
<p>The response can look like:</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<Response>
<ResponseCode>0</ResponseCode>
<ResponseMessage>Login successful</ResponseMessage>
<Token>NTlEMTdFNjk3Qjg4NUJBNDA3MkJFOTI3NzJEMTdDNDU7bG9jYWxob3N0LmVnbGJwLmNvcnAueWFob28uY29tO0pVNWpzRGRhN3VhSS4yQVRqRi4wWE5jTWl0RHVVYzQyX3luYWd1TjIxaGx6U0lhTXN3LS07NjY2MzM1OzIzNDY3NTsxMjA5MDE2OTE5OzZCM1RBMVNudHdLbl9VdFFKMFEydWctLQ==</Token>
</Response>
</code></pre>
<p>Or, it can look like:</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<yahoo:error xmlns:yahoo="http://www.yahooapis.com/v1/base.rng" xml:lang="en-US">
<yahoo:description>description</yahoo:description>
<yahoo:detail>
<ErrorCode>errorCode</ErrorCode>
</yahoo:detail>
</yahoo:error>
</code></pre>
<h2>Questions</h2>
<ul>
<li>Is there a way to auto-generate <a href="http://en.wikipedia.org/wiki/POJO" rel="nofollow noreferrer">POJOs</a> which can be marshalled/unmarshalled without a formal schema? </li>
<li>Should I attempt to generate those POJOs by hand, with <a href="http://jaxb.java.net/" rel="nofollow noreferrer">JAXB</a> annotations?</li>
<li><strong><em>Is there some tool I should be leveraging so I don't have to do all this manually?</em></strong></li>
</ul>
| [
{
"answer_id": 597248,
"author": "StaxMan",
"author_id": 59501,
"author_profile": "https://Stackoverflow.com/users/59501",
"pm_score": 2,
"selected": false,
"text": "@XmlRootElement(\"Response\")\nclass Response {\n public int responseCode;\n public String responseMessage;\n public St... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359675",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7679/"
] |
359,699 | <p>I want to pass an enum value as command parameter in WPF, using something like this:</p>
<pre><code><Button
x:Name="uxSearchButton"
Command="{Binding Path=SearchMembersCommand}"
CommandParameter="SearchPageType.First"
Content="Search">
</Button>
</code></pre>
<p><code>SearchPageType</code> is an enum and this is to know from which button search command is invoked.</p>
<p>Is this possible in WPF, or how can you pass an enum value as command parameter?</p>
| [
{
"answer_id": 360076,
"author": "Jobi Joy",
"author_id": 8091,
"author_profile": "https://Stackoverflow.com/users/8091",
"pm_score": 9,
"selected": true,
"text": "<Button CommandParameter=\"{x:Static local:SearchPageType.First}\" .../>\n"
},
{
"answer_id": 360639,
"author": ... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359699",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45382/"
] |
359,706 | <p>I'm using PIL (Python Imaging Library). I'd like to draw transparent polygons. It seems that specifying a fill color that includes alpha level does not work. Are their workarounds?</p>
<p>If it can't be done using PIL I'm willing to use something else.</p>
<p>If there is more than one solution, then performance should be factored in. The drawing needs to be as fast as possible.</p>
| [
{
"answer_id": 433638,
"author": "akdom",
"author_id": 145,
"author_profile": "https://Stackoverflow.com/users/145",
"pm_score": 3,
"selected": false,
"text": "color_layer = Image.new('RGBA', base_layer.size, fill_rgb)\nalpha_mask = Image.new('L', base_layer.size, 0)\nalpha_mask_draw = I... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359706",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20498/"
] |
359,707 | <p>I've done most of my work on VisualStudio and don't have much experience with gcc or g++. When I tried to compile a (ex. aprogram.cpp) this morning on my pc using cygwin, I got (aprogram.exe) when I tried to compile the same thing on my Ubuntu box I got (aprogram) w/o any extension. I am just wondering if someone be kind enough to tell me why. This question is just out of curiosity. :)</p>
<p>Thanks in advance!</p>
<p>EDIT:
(from Jimmy's comment)
g++ under Cygwin defaults to .exe </p>
| [
{
"answer_id": 359714,
"author": "Charlie Martin",
"author_id": 35092,
"author_profile": "https://Stackoverflow.com/users/35092",
"pm_score": 4,
"selected": false,
"text": "-o"
},
{
"answer_id": 359726,
"author": "helloandre",
"author_id": 50,
"author_profile": "https... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359707",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41104/"
] |
359,722 | <p>I own a website and I wonder if there is a script that get files for me from other links on the net a load it to my server.</p>
<p>Suppose I found a file with a size of 400 mb, I want to host it on my server. The normal way I used is to download the file to my pc then upload it to my server but is there a script or a way to transfer and host the file directly without downloading it.</p>
| [
{
"answer_id": 359749,
"author": "UnkwnTech",
"author_id": 115,
"author_profile": "https://Stackoverflow.com/users/115",
"pm_score": 2,
"selected": true,
"text": "<?php\n$remotefh = fopen('http://domain.tld/path/to/file.ext', 'r'); \n$localfh = fopen('local/file.ext', 'w');\nwhile(!feof(... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359722",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
359,727 | <p>I've run into strange problem in my Flex/Flashcom application. If client application unexpectedly disconnects from server latter does not call application.onDisconnect handler function. In witch direction should I look? Thank you.</p>
<p><strong>Update</strong> I'm not using server components, but I do host this thing on Linux.</p>
| [
{
"answer_id": 486543,
"author": "VonC",
"author_id": 6309,
"author_profile": "https://Stackoverflow.com/users/6309",
"pm_score": 3,
"selected": true,
"text": "onConnectAccept"
},
{
"answer_id": 501826,
"author": "Willem",
"author_id": 15447,
"author_profile": "https:... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359727",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2313/"
] |
359,732 | <p>Why does everyone tell me writing code like this is a bad practice?</p>
<pre><code>if (foo)
Bar();
//or
for(int i = 0 i < count; i++)
Bar(i);
</code></pre>
<p>My biggest argument for omitting the curly braces is that it can sometimes be twice as many lines with them. For example, here is some code to paint a glow effect for a label in C#.</p>
<pre><code>using (Brush br = new SolidBrush(Color.FromArgb(15, GlowColor)))
{
for (int x = 0; x <= GlowAmount; x++)
{
for (int y = 0; y <= GlowAmount; y++)
{
g.DrawString(Text, this.Font, br, new Point(IconOffset + x, y));
}
}
}
//versus
using (Brush br = new SolidBrush(Color.FromArgb(15, GlowColor)))
for (int x = 0; x <= GlowAmount; x++)
for (int y = 0; y <= GlowAmount; y++)
g.DrawString(Text, this.Font, br, new Point(IconOffset + x, y));
</code></pre>
<p>You can also get the added benefit of chaining <code>usings</code> together without having to indent a million times.</p>
<pre><code>using (Graphics g = Graphics.FromImage(bmp))
{
using (Brush brush = new SolidBrush(backgroundColor))
{
using (Pen pen = new Pen(Color.FromArgb(penColor)))
{
//do lots of work
}
}
}
//versus
using (Graphics g = Graphics.FromImage(bmp))
using (Brush brush = new SolidBrush(backgroundColor))
using (Pen pen = new Pen(Color.FromArgb(penColor)))
{
//do lots of work
}
</code></pre>
<hr>
<p>The most common argument for curly braces revolves around maintance programming, and the problems that would ensue by inserting code between the original if statement and its intended result:</p>
<pre><code>if (foo)
Bar();
Biz();
</code></pre>
<hr>
<h3>Questions:</h3>
<ol>
<li>Is it wrong to want to use the more compact syntax which the language offers? The people that design these languages are smart, I can't imagine they would put a feature which is always bad to use.</li>
<li>Should we or Shouldn't we write code so the lowest common denominator can understand and have no problems working with it? </li>
<li>Is there another argument that I'm missing?</li>
</ol>
| [
{
"answer_id": 359747,
"author": "Elie",
"author_id": 23249,
"author_profile": "https://Stackoverflow.com/users/23249",
"pm_score": 3,
"selected": false,
"text": "if (foo)\n bar();\n"
},
{
"answer_id": 359750,
"author": "George Stocker",
"author_id": 16587,
"author... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359732",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45/"
] |
359,733 | <p>I recently learnt that oracle has a feature which was pretty useful to me - as the designer/implementator didn't care much about data history - I can query the historical state of a record if it's available yet in the oracle cache, like this:</p>
<pre><code>select *
from ( select *
from sometable where some_condition )
as of timestamp sysdate-1
</code></pre>
<p>But now I need to check the historical data within a range. Is it possible anyhow, using the cache?</p>
| [
{
"answer_id": 359810,
"author": "Dave Costa",
"author_id": 6568,
"author_profile": "https://Stackoverflow.com/users/6568",
"pm_score": 0,
"selected": false,
"text": "SELECT *\n FROM sometable\n VERSIONS BETWEEN TIMESTAMP systimestamp - 1 AND systimestamp\n"
},
{
"answer_id": 3... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359733",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11621/"
] |
359,742 | <p>I have a windows application that I want to run as a windows service - how can I do this ?</p>
| [
{
"answer_id": 359818,
"author": "Patrick Desjardins",
"author_id": 13913,
"author_profile": "https://Stackoverflow.com/users/13913",
"pm_score": 1,
"selected": false,
"text": "static class Program\n{\n static void Main()\n {\n ServiceBase[] ServicesToRun;\n ServicesT... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359742",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26809/"
] |
359,745 | <p>I have a microcontroller that must download a large file from a PC serial port (115200 baud) and write it to serial flash memory over SPI (~2 MHz). The flash writes must be in 256 byte blocks preceded by a write command and page address. The total RAM available on the system is 1 kB with an 80 byte stack size.</p>
<p>This is currently working by filling a 256 byte buffer from the UART and then ping-ponging to a another 256 byte buffer being filled by an interrupt on the RX buffer ready signal while the flash is written to with busy writes. The buffer swapping is repeated until the operation is complete.</p>
<p>I would prefer to setup TX/RX interrupt handlers for both the SPI and UART ports that operate on seperate circular buffers. So, instead of polling for new bytes and waiting for operations to complete I can simply fill the TX buffers and enable the interrupt or check the buffers for incoming data. This would give a lot more clock cycles for real work instead of waiting on peripherals.</p>
<p>After implementing the IRQ's with 128 byte circular buffers, I poll the UART RX buffer for data and immediately place it in the SPI TX buffer to do the file transfer. The problem I am having with this approach is that I don't have sufficient RAM for the buffers and the PC receive buffer is filling up faster than I get the data over to the flash transmit buffer. Obviously, transmission speed is not the problem (115.2 kHz in and 2 MHz out), but there is a write cycle wait after each 256-byte page is transmitted.</p>
<hr>
<p>It appears the frequent SPI interrupts were blocking some of the UART interrupts and causing bytes to be missed. The solution I chose was to use a ring buffer for the UART receive interrupt and feed the data into a 256 byte page buffer that is sent to the serial flash by polling for byte transfers and write completion. A 128 ring buffer is big enough to prevent overflows during the SPI write.</p>
| [
{
"answer_id": 359955,
"author": "joshperry",
"author_id": 30587,
"author_profile": "https://Stackoverflow.com/users/30587",
"pm_score": 3,
"selected": true,
"text": "typedef struct data_buffer {\n char flags;\n char[128] data;\n}\n"
}
] | 2008/12/11 | [
"https://Stackoverflow.com/questions/359745",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1491/"
] |
359,758 | <p>How do I set tab ordering in WPF? I have an ItemsControl with some items expanded and some collapsed and would like to skip the collapsed ones when I'm tabbing.</p>
<p>Any ideas?</p>
| [
{
"answer_id": 360585,
"author": "Jab",
"author_id": 29676,
"author_profile": "https://Stackoverflow.com/users/29676",
"pm_score": 7,
"selected": true,
"text": "KeyboardNavigation.IsTabStop=\"False\"\n"
},
{
"answer_id": 591668,
"author": "Drew Noakes",
"author_id": 24874... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359758",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41304/"
] |
359,763 | <h2>Short version</h2>
<p>How do i use an API call when i cannot guarantee that the window
handle will remain valid? </p>
<p>i can guarantee that i'm holding a reference to my form (so the form is not being disposed). That doesn't guarantee that the form's <strong>handle</strong> will stay valid all that time. </p>
<p><em>How can a form's window handle become invalid even though the form is not diposed</em>? </p>
<p>Because the form's underlying Windows window was destroyed and recreated. </p>
<h2>Long Version</h2>
<p>i want to P/Invoke an API that requires a hwnd (a handle to a window). Some examples of API calls that requie an hWnd are:</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms787175(VS.85).aspx" rel="nofollow noreferrer">IVMRWindowlessControl::SetVideoClippingWindow</a></p>
<pre><code> HRESULT SetVideoClippingWindow(
HWND hwnd
);
</code></pre>
<p><a href="http://msdn.microsoft.com/en-us/library/ms644950.aspx" rel="nofollow noreferrer">SendMessage</a></p>
<pre><code>SendMessage(
HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam
);
</code></pre>
<p><a href="http://msdn.microsoft.com/en-us/library/ms649052.aspx" rel="nofollow noreferrer">SetClipboardViewer</a></p>
<pre><code>HWND SetClipboardViewer(
HWND hWndNewViewer
);
</code></pre>
<p><a href="http://msdn.microsoft.com/en-us/library/ms644906.aspx" rel="nofollow noreferrer">SetTimer</a></p>
<pre><code>UINT_PTR SetTimer(
HWND hWnd,
UINT_PTR nIDEvent,
UINT uElapse,
TIMERPROC lpTimerFunc
);
</code></pre>
<p><a href="http://msdn.microsoft.com/en-us/library/bb775262(VS.85).aspx" rel="nofollow noreferrer">IProgressDialog::StartProgressDialog</a></p>
<pre><code>HRESULT StartProgressDialog(
HWND hwndParent,
IUnknown *punkEnableModless,
DWORD dwFlags,
LPCVOID pvReserved
);
</code></pre>
<p><a href="http://msdn.microsoft.com/en-us/library/bb762159(VS.85).aspx" rel="nofollow noreferrer">Shell_NotifyIcon</a></p>
<pre><code>BOOL Shell_NotifyIcon(
DWORD dwMessage,
PNOTIFYICONDATA lpdata //<--hWnd in there
);
</code></pre>
<p><a href="http://msdn.microsoft.com/en-us/library/ms632669.aspx" rel="nofollow noreferrer">AnimateWindow</a></p>
<pre><code>BOOL AnimateWindow(
HWND hwnd,
DWORD dwTime,
DWORD dwFlags
);
</code></pre>
<p><strong>Note:</strong> Some of these API calls have managed equivalents, some do not - but that fact is irrelavent for my question.</p>
<h2>Explanation</h2>
<p>i can call one of these API functions, which requires long term window handle, e.g.:</p>
<pre><code>private void TellTheGuyToDoTheThing()
{
SendMessage(this.Handle,
WM_MyCustomMessage,
paramOneForTheThing,
paramTwoForTheThing);
}
</code></pre>
<p>It has been suggested that the above call to SendMessage is dangerous because of the unmanaged use of a window handle. They suggest that you wrap the hwnd in a HandleRef object:</p>
<pre><code>private void TellTheGuyToDoTheThing()
{
SendMessage(new HandleRef(this, this.Handle),
WM_MyCustomMessage,
paramOneForTheThing, paramTwoForTheThing);
</code></pre>
<p>This way: the window handle is guaranteed to stay valid during the call to SendMessage. But it doesn't always work out that way. The following API call requires long-term access to a window handle:</p>
<pre><code>private void RegisterWithTheThing()
{
this.nextClipboardViewerInChain = SetClipboardViewer(
new HandleRef(this, this.Handle));
}
</code></pre>
<p>Even though i wrapped the handle in a HandleRef, it is still possible (in the subsequest seconds, minutes, hours, days, weeks, months, or years) for the form's window handle to become invalid. This happens when the form's underlying Windows window is destroyed and a new one created. This, despite the fact that i protected the form's handle in a HandleRef.</p>
<p>i can name <em>one</em> way in which a form's handle becomes invalid:</p>
<pre><code>this.RightToLeft = RightToLeft.Yes;
</code></pre>
<p>The form's window is re-created and old hwnd is now invalid.</p>
<p>So the question is: How to use an API call that requires a window handle?</p>
<h2>Cannot be done?</h2>
<p>i anticipate the answer: <em>you cannot do this. There is nothing that can be done to protect the form's handle to ensure it is valid as long as you need to keep the handle.</em></p>
<p>This then means that i need to know when the handle is being destroyed, so i can tell Windows to let it go, e.g.:</p>
<pre><code>protected override void TheHandleIsAboutToBeDestroyed()
{
ChangeClipboardChain(this.Handle, this.nextClipboardViewerInChain);
}
</code></pre>
<p>and then be told when the new handle is created:</p>
<pre><code>protected override void TheHandleWasJustCreated()
{
RegisterTheThing();
}
</code></pre>
<p>Except no such ancestor methods exist.</p>
<p><strong>Alternate question:</strong> Are there methods i can override so i know when a window's handle is about to be destroyed, and when it has just been creatd?</p>
<p>Having to break the .NET WinForms encapsulation of re-creating handles is ugly, but is it the only way?</p>
<hr>
<h2>Update One</h2>
<p>Handling the <strong>Close</strong>/<strong>OnClose</strong> event of a form is insufficient, the same goes for</p>
<ul>
<li>handling IDisposable</li>
<li>GC pinning the form</li>
</ul>
<p>since i can make the form's underlying window handle invalid without closing or disposing form. e.g:</p>
<pre><code>private void InvalidThisFormsWindowHandleForFun()
{
this.RightToLeft = RightToLeft.Yes;
}
</code></pre>
<p><strong>Note:</strong> You <em>destroy</em> a Windows window handle, you don't dispose of it. Objects in .NET are the things that get disposed of; which, if it's a Form object, will most likely involve <em>destroying</em> the Windows window handle.</p>
<p>Windows is a product by Microsoft.</p>
<p>A window is a thing with a message loop and can sometimes show stuff on screen.</p>
<hr>
<h2>Update Two</h2>
<p><a href="https://stackoverflow.com/questions/359763/net-winforms-how-to-use-an-api-call-that-requires-a-window-handle#360023">me.yahoo.com/a/BrYwg</a> had a good suggestion for the use of a <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.nativewindow.aspx" rel="nofollow noreferrer">NativeWindow</a> object to act as a listener for items that require an hWnd which are used to listen for messages. This can be used to solve some issues, like:</p>
<ul>
<li>SetClipboardViewer</li>
<li>SetTimer</li>
<li>IProgressDialgo::StartProgressDialog</li>
<li>Shell_NotifyIcon</li>
</ul>
<p>but doesn't work for</p>
<ul>
<li>AnimateWindow</li>
<li>SendMessage</li>
<li>IVMRWindowlessControl::SetVideoClippingWindow</li>
</ul>
| [
{
"answer_id": 1980367,
"author": "Serghei Gorodetki",
"author_id": 240925,
"author_profile": "https://Stackoverflow.com/users/240925",
"pm_score": 0,
"selected": false,
"text": "this.RightToLeft = RightToLeft.Yes;\n"
}
] | 2008/12/11 | [
"https://Stackoverflow.com/questions/359763",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12597/"
] |
359,775 | <p>If I want to display an underlined value in a TextBlock, I have to use a Run element. (If there's a better/easier way, I'd love to hear about it.)</p>
<pre><code><TextBlock>
<Run TextDecorations="Underline" Text="MyText" />
</TextBlock>
</code></pre>
<p>Ideally, to implement this within a DataTemplate, it would look something like this:</p>
<pre><code><DataTemplate x:Key="underlineTemplate">
<TextBlock>
<Run TextDecorations="Underline" Text="{Binding Value}" />
</TextBlock>
</DataTemplate>
</code></pre>
<p>This won't work, however, because the Run's Text property isn't a DependencyProperty, so you can't databind to it. Does anyone know how I can accomplish this?</p>
| [
{
"answer_id": 359833,
"author": "Sacha Bruttin",
"author_id": 20761,
"author_profile": "https://Stackoverflow.com/users/20761",
"pm_score": 0,
"selected": false,
"text": "<TextBlock Text=\"MyText\" TextDecorations=\"Underline\" />\n"
},
{
"answer_id": 359854,
"author": "josh... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359775",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30095/"
] |
359,782 | <p>I have a mysql table that relies on the unix epoch time stamp equivalent of the date of the entry to sort and filter in various parts of the website. I'm trying to implement a date picker that will enter the date into the form field in the mm/dd/yyyy format. I've been struggling with converting that date into the unix epoch format to add that entry in the row field. All the attempts I've made have resulted in generating the current day epoch time stamp. Does anyone have any idea how I can take that date format and convert in the it's equivalent epoch time stamp?</p>
<p>Thanks in advance.</p>
<p><strong>Additional information:</strong></p>
<p>I have been trying mktime, and all I get is todays epoch. Apologies, I should have added some code earlier to better explain:</p>
<p>The form id is "date" The database field is "epoch"</p>
<p>Here's what I'm trying (unsuccessfully) when I post the for date:</p>
<pre><code>$epochhold = ($_POST['date']);
$epoch = mktime(0,0,0,$epochhold);
</code></pre>
<p>I understand from a previous post that this would still submit the value as mm/dd/yyyy and not mm, dd, yyyy as mktime expects, however the post didn't offer and resolution on how to do that. I tried a str_replace to change the "/" to "," and that yeilded the same result - getting today's epoch date regardless of the date entered.</p>
<p>Here's that code example - again this didn't work, but I add it to help illustrate what I've tried</p>
<pre><code>$epochhold = ($_POST['date']);
$epochold2 = str_replace('/', ', ', $epochhold)
$epoch = mktime(0,0,0,$epochhold2);
</code></pre>
<p>Thanks for the previous response as well, I didn't want the quick reply to go unnoticed!</p>
<p><strong>Thanks everyone!</strong></p>
<p>Thanks to everyone for the replies - strtotime seems to be working best on the initial tests and may be the way to go as this format is consistent throughout the site. But all the suggestions helped with this a few other things all well so thank you all again!</p>
| [
{
"answer_id": 359914,
"author": "Matt",
"author_id": 42135,
"author_profile": "https://Stackoverflow.com/users/42135",
"pm_score": 5,
"selected": true,
"text": "strtotime($_POST['app_date']);\n"
},
{
"answer_id": 359943,
"author": "Community",
"author_id": -1,
"autho... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359782",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45389/"
] |
359,788 | <p>I have the name of a function in JavaScript as a string. How do I convert that into a function pointer so I can call it later?</p>
<p>Depending on the circumstances, I may need to pass various arguments into the method too.</p>
<p>Some of the functions may take the form of <code>namespace.namespace.function(args[...])</code>.</p>
| [
{
"answer_id": 359799,
"author": "Eli Courtwright",
"author_id": 1694,
"author_profile": "https://Stackoverflow.com/users/1694",
"pm_score": 6,
"selected": false,
"text": "window[\"foo\"](arg1, arg2);\n"
},
{
"answer_id": 359842,
"author": "annakata",
"author_id": 13018,
... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359788",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5791/"
] |
359,816 | <p>I am very new to grails.I am doing one sample project for image uploading and displaying.Right now my project uploads the images and stores into the images directory.Now i want to display all the images stored in the "image" directory.
I dont know how to write the gsp code for display all images.</p>
<p>For displaying the images I wrote the following code in list.gsp page.</p>
<p>My gsp code is: </p>
<pre><code><g:each in="${imageList}" var="image">
<img src="${createLinkTo(dir: 'images', file: '1.jpg')}" alt="Grails"/>
</g:each>
</code></pre>
<p>imageList has filenames of images in the image directory.</p>
<p>In the second line i want put filename instead of "1.jpg". </p>
<p>Can any one tell me how to display the images.</p>
<p>thanks</p>
| [
{
"answer_id": 359844,
"author": "mat",
"author_id": 42083,
"author_profile": "https://Stackoverflow.com/users/42083",
"pm_score": 2,
"selected": false,
"text": "<g:each in=\"${imageList}\" var=\"image\">\n<img src=\"${createLinkTo(dir: 'images', file: image.filename)}\" alt=\"Grails\"/>... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359816",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40945/"
] |
359,821 | <p>I want to style the last TD in a table without using a CSS class on the particular TD.</p>
<pre><code><table>
<tbody>
<tr>
<td>One</td>
<td>Two</td>
<td>Three</td>
<td>Four</td>
<td>Five</td>
</tr>
</tbody>
</table>
table td
{
border: 1px solid black;
}
</code></pre>
<p>I want the TD containing the text "Five" to not have a border but again, I do not want to use a class.</p>
| [
{
"answer_id": 359838,
"author": "sblundy",
"author_id": 4893,
"author_profile": "https://Stackoverflow.com/users/4893",
"pm_score": 6,
"selected": true,
"text": "table td + td + td + td + td {\n border: none;\n}\n"
},
{
"answer_id": 359849,
"author": "yoavf",
"author_id... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359821",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
359,824 | <p>I have a chunk of <a href="http://en.wikipedia.org/wiki/MultiDimensional_eXpressions" rel="nofollow noreferrer">MDX</a> that I'd like to throw into an ASP.NET form. Hopefully just binding the results to a gridview. Are there any good links or snippets? I'm using VB.NET, but I am able to port from C# if no Visual Basic code is available.</p>
| [
{
"answer_id": 359838,
"author": "sblundy",
"author_id": 4893,
"author_profile": "https://Stackoverflow.com/users/4893",
"pm_score": 6,
"selected": true,
"text": "table td + td + td + td + td {\n border: none;\n}\n"
},
{
"answer_id": 359849,
"author": "yoavf",
"author_id... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359824",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13954/"
] |
359,827 | <p>I need to compare 2 strings in C# and treat accented letters the same as non-accented letters. For example:</p>
<pre><code>string s1 = "hello";
string s2 = "héllo";
s1.Equals(s2, StringComparison.InvariantCultureIgnoreCase);
s1.Equals(s2, StringComparison.OrdinalIgnoreCase);
</code></pre>
<p>These 2 strings need to be the same (as far as my application is concerned), but both of these statements evaluate to false. Is there a way in C# to do this?</p>
| [
{
"answer_id": 359874,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": -1,
"selected": false,
"text": "using System;\nusing System.Globalization;\n\nclass Sample {\n public static void Main() {\n String str1 = \"change\";\... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359827",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/343/"
] |
359,829 | <p>As our PHP5 OO application grew (in both size and traffic), we decided to revisit the __autoload() strategy.</p>
<p>We always name the file by the class definition it contains, so class Customer would be contained within Customer.php. We used to list the directories in which a file can potentially exist, until the right .php file was found.</p>
<p>This is quite inefficient, because you're potentially going through a number of directories which you don't need to, and doing so on every request (thus, making loads of stat() calls).</p>
<p>Solutions that come to my mind...</p>
<p>-use a naming convention that dictates the directory name (similar to PEAR). Disadvantages: doesn't scale too great, resulting in horrible class names.</p>
<p>-come up with some kind of pre-built array of the locations (propel does this for its __autoload). Disadvantage: requires a rebuild before any deploy of new code.</p>
<p>-build the array "on the fly" and cache it. This seems to be the best solution, as it allows for any class names and directory structure you want, and is fully flexible in that new files just get added to the list. The concerns are: where to store it and what about deleted/moved files. For storage we chose APC, as it doesn't have the disk I/O overhead. With regards to file deletes, it doesn't matter, as you probably don't wanna require them anywhere anyway. As to moves... that's unresolved (we ignore it as historically it didn't happen very often for us).</p>
<p>Any other solutions?</p>
| [
{
"answer_id": 359906,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "\n load_class($class_name, $instansiate);\n"
},
{
"answer_id": 359965,
"author": "Rob Hruska",
"author_id": 29... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359829",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8437/"
] |
359,831 | <p>I'm new to RhinoMock's just been doing state unit testing up till now.</p>
<p>How do you test void functions?</p>
<p>Getting the following complie error when setting up expectation,</p>
<p><em>Expression does not produce a value</em></p>
<p>Basically I want to test that a certain mock's method is called a certain amount of times.</p>
<p>Cheers</p>
| [
{
"answer_id": 555675,
"author": "Judah Gabriel Himango",
"author_id": 536,
"author_profile": "https://Stackoverflow.com/users/536",
"pm_score": 0,
"selected": false,
"text": "Expect.Call(() => someVoidFunction());\n"
}
] | 2008/12/11 | [
"https://Stackoverflow.com/questions/359831",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31766/"
] |
359,836 | <p>I'm trying to determine if any changes were made to a particular entity object. Essentially, I want to know if SubmitChanges() will actually change anything. I would prefer to be able to determine this after SubmitChanges() has been called, but it doesn't really matter.</p>
<p>Anyone know how I would do this?</p>
| [
{
"answer_id": 361185,
"author": "Jeremy Cantrell",
"author_id": 18866,
"author_profile": "https://Stackoverflow.com/users/18866",
"pm_score": 2,
"selected": true,
"text": "Public Function HasChanges(ByVal obj As Object) As Boolean\n Dim cs = GetChangeSet()\n If cs.Updates.Contains... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359836",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18866/"
] |
359,851 | <p>how can I debug a dll that is not loaded by the java application.</p>
<p>The scenario is this: my java app is loading the jni.dll that is using another dll and that dll is using another dll.</p>
<p>java<->jni.dll<->dll<->dll </p>
<p>I have the source code for all modules</p>
<p>I am using visual studio express when debugging the jni.dll but what should I do to be able to debug the other dlls?</p>
| [
{
"answer_id": 359950,
"author": "Martin Cowie",
"author_id": 42429,
"author_profile": "https://Stackoverflow.com/users/42429",
"pm_score": 0,
"selected": false,
"text": "_asm int 3;"
},
{
"answer_id": 2211768,
"author": "cx0der",
"author_id": 95768,
"author_profile":... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359851",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
359,870 | <p>I am working in a .NET environment where the system occasionally generates log entries for a customer. Messages are then appended to a customer log which can be reviewed at a later time.</p>
<p>For example, if a customer is subscribing to a new service, or a customer has a failed payment attempt, these messages gets appended to the customer log.</p>
<p>At the moment, all messages are hardcoded into the code, e.g "Customer failed to finish payment of XX".</p>
<p>The problem is now that these messages need to be localized in a smart way, such that when a English user reviews the customer log, he gets the messages in English, and when a foreign user reviews the log, he gets them in his language.</p>
<p>What would be the best way to handle this scenario?</p>
| [
{
"answer_id": 360130,
"author": "Treb",
"author_id": 22114,
"author_profile": "https://Stackoverflow.com/users/22114",
"pm_score": 1,
"selected": false,
"text": "enum LogMessages\n{\n OutOfDiskSpace = 1;\n OutOfMemory = 2;\n OutOfCoffee = 3;\n}\n"
}
] | 2008/12/11 | [
"https://Stackoverflow.com/questions/359870",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42272/"
] |
359,880 | <p>I have been tasked with creating a new frontend for a legacy website.</p>
<p>It is written in php (pre-oo), and uses a MySQL database. The hosting provides a .Net package, but does not offer Ms Sql Server. </p>
<p>This is fine, as the database is working fine, but I really want to use Asp.net for the pages. However, most tutorials I've seen on connecting to MySQL from C# require installing an ODBC Driver specifically for MySQL. Not controlling the hosting env, I doubt I'll be able to do just that :)</p>
<p>Have you got any insight to share on this issue?</p>
| [
{
"answer_id": 359892,
"author": "Patrick Desjardins",
"author_id": 13913,
"author_profile": "https://Stackoverflow.com/users/13913",
"pm_score": 3,
"selected": false,
"text": "string MyConString = \"SERVER=localhost;\" +\n \"DATABASE=mydatabase;\" +\n \"UID=testuser;\" +\n \"PA... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359880",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21124/"
] |
359,881 | <p>What is the most efficient way of setting values in C# multi-dimensional arrays using a linear index? For example given an array...</p>
<pre><code>int[,,] arr2 = { {{0,1,2}, {3,4,5}, {6,7,8}}
, {{9,10,11}, {12,13,14}, {15,16,17}}
, {{18,19,20}, {21,22,23}, {24,25,26}}
};
</code></pre>
<p>How do I set all the elements to 30 using a linear index ...</p>
<pre><code>//This code does not work
for (int i = 0; i < arr.Length; i++)
{
arr.SetValue(30, i);
}
</code></pre>
<p>Apparently the SetValue() above does not work with multidimensional arrays.</p>
<p>Here is the best solution that I could come up with...</p>
<p>EDIT: Added some clarifications to the code...</p>
<pre><code>static class Program
{
static void Main(string[] args)
{
//Sample input.
int[,,] arr2 = { {{0,1,2}, {3,4,5}, {6,7,8}}
, {{9,10,11}, {12,13,14}, {15,16,17}}
, {{18,19,20}, {21,22,23}, {24,25,26}}
};
int[] arr1 = { 1, 2, 3, 4 };
setElementsTo30(arr2);
setElementsTo30(arr1);
}
//Must be able to process int arrays of arbitrary dimensions and content
private static void setElementsTo30(Array arr)
{
IList<int> cumulativeLength = getCumulativeLengths(arr);
for (int i = 0; i < arr.Length; i++)
{
SetValue(arr, i, 30, cumulativeLength);
}
}
public static void SetValue(this Array arr, int index, object value, IList<int> cumulativeLength)
{
int[] arrayIndex = new int[arr.Rank];
for (int dim = arr.Rank-1; dim >= 0; dim--)
{
arrayIndex[dim] = index / cumulativeLength[dim] % arr.GetLength(dim);
}
arr.SetValue(value, arrayIndex);
}
private static IList<int> getCumulativeLengths(Array arr)
{
List<int> lengths = new List<int>(arr.Rank);
for (int dim = 0; dim < arr.Rank; dim++)
{
int prod = 1;
for (int i = dim + 1; i < arr.Rank; i++)
{
prod *= arr.GetLength(i);
}
lengths.Add(prod);
}
return (IList<int>)lengths;
}
}
</code></pre>
<p>Is there a way to do the same more efficiently and possibly using something provided by the framework itself (i.e. something which can be used without much hassle.)</p>
<p>Thanks,<br>
SDX2000.</p>
| [
{
"answer_id": 359924,
"author": "Nicholas Mancuso",
"author_id": 8945,
"author_profile": "https://Stackoverflow.com/users/8945",
"pm_score": 0,
"selected": false,
"text": "SetValue()"
},
{
"answer_id": 360022,
"author": "JB King",
"author_id": 8745,
"author_profile":... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359881",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39648/"
] |
359,885 | <p>My application has just started exhibiting strange behaviour.</p>
<p>I can boot it through the Carbide Debugger (using TRK) and it works fine with no visible errors and is left installed on the device.</p>
<p>Any further attempts to launch the application fail, even after a restart. Uninstalling and downloading the .sisx file manually also doesn't work.</p>
<p>Has anyone had any experience like this? Could it be some resource file that is missing, or is there any other way I can find out what is happening?</p>
| [
{
"answer_id": 359924,
"author": "Nicholas Mancuso",
"author_id": 8945,
"author_profile": "https://Stackoverflow.com/users/8945",
"pm_score": 0,
"selected": false,
"text": "SetValue()"
},
{
"answer_id": 360022,
"author": "JB King",
"author_id": 8745,
"author_profile":... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359885",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33604/"
] |
359,887 | <p>I am building a search box (input field) which should make a server call to filter a grid with the text being inserted on it but I need to make this in an smart way, I need to fire the server call only if the user has stopped.
Right now I'm trying to implement it, but if someone knows how to do it I'll be very pleased.
Anyway, if I do it first I'll post the answer here...
Best Regards,
Jaime.</p>
| [
{
"answer_id": 359908,
"author": "nickf",
"author_id": 9021,
"author_profile": "https://Stackoverflow.com/users/9021",
"pm_score": 6,
"selected": true,
"text": "var searchTimeout;\ndocument.getElementById('searchBox').onkeypress = function () {\n if (searchTimeout != undefined) clearT... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359887",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33205/"
] |
359,891 | <p>I've hit upon a problem with WSADuplicateSocket, which I'm using to duplicate a socket for use by a different process. It works find when both processes are running under the same Windows user, but fails with error code 10022 (WSAEINVAL) when they are running under different users.</p>
<p>Specifically, the process calling WSADuplicateSocket is running under an admin user account and the target process is running under the System account.</p>
<p>Searching the web, I've found other references to the issue, but no solutions. Does anyone know of a way to resolve this?</p>
<p>Here's the current code:</p>
<pre><code>bool Duplicate(
SOCKET s,
WSAPROTOCOL_INFO* pSocketInfo,
int targetProcessID,
int& errorNum
)
{
memset(pSocketInfo, 0, sizeof(WSAPROTOCOL_INFO));
if (::WSADuplicateSocket(s, targetProcessID, pSocketInfo)
== SOCKET_ERROR)
{
errorNum = ::WSAGetLastError();
return false;
}
return true;
}
</code></pre>
| [
{
"answer_id": 359908,
"author": "nickf",
"author_id": 9021,
"author_profile": "https://Stackoverflow.com/users/9021",
"pm_score": 6,
"selected": true,
"text": "var searchTimeout;\ndocument.getElementById('searchBox').onkeypress = function () {\n if (searchTimeout != undefined) clearT... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359891",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35090/"
] |
359,894 | <p>I'm using an image component that has a FromBinary method. Wondering how do I convert my input stream into a byte array</p>
<pre><code>HttpPostedFile file = context.Request.Files[0];
byte[] buffer = new byte[file.ContentLength];
file.InputStream.Read(buffer, 0, file.ContentLength);
ImageElement image = ImageElement.FromBinary(byteArray);
</code></pre>
| [
{
"answer_id": 359984,
"author": "Wolfwyrd",
"author_id": 15570,
"author_profile": "https://Stackoverflow.com/users/15570",
"pm_score": 9,
"selected": true,
"text": "byte[] fileData = null;\nusing (var binaryReader = new BinaryReader(Request.Files[0].InputStream))\n{\n fileData = bina... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359894",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/461880/"
] |
359,895 | <p>I'm seeing a lot of Javascript errors in IE8 on pages which worked fine in IE7 (and Firefox, Chrome, and Safari). I know that IE made some changes to things like Javascript security. Some of these don't give clear error messages - things like cross-domain violations can end up throwing very vague exceptions.</p>
<p>Let's make a checklist of top offenders when we're troubleshooting IE8 Javascript errors. Please list <strong>one</strong> change to the way IE8 Javascript that would cause a Javascript error.</p>
| [
{
"answer_id": 363092,
"author": "scunliffe",
"author_id": 6144,
"author_profile": "https://Stackoverflow.com/users/6144",
"pm_score": 5,
"selected": true,
"text": "1.) document.getElementById( id ); //now only returns the CORRECT matches!\n"
}
] | 2008/12/11 | [
"https://Stackoverflow.com/questions/359895",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5/"
] |
359,903 | <p>Kind of a weird question, but. I need to have a list of strings i need to make sure that every string in that list is the same.</p>
<p>E.g:</p>
<pre><code>a = ['foo', 'foo', 'boo'] #not valid
b = ['foo', 'foo', 'foo'] #valid
</code></pre>
<p>Whats the best way to go about doing that?</p>
<p>FYI, i don't know how many strings are going to be in the list. Also this is a super easy question, but i am just too tired to think straight.</p>
| [
{
"answer_id": 359945,
"author": "Jordan Parmer",
"author_id": 20133,
"author_profile": "https://Stackoverflow.com/users/20133",
"pm_score": 4,
"selected": true,
"text": "if a.count( \"foo\" ) != len(a)\n"
},
{
"answer_id": 359952,
"author": "Andrew Cox",
"author_id": 279... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359903",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34395/"
] |
359,905 | <p>I have a UserControl Library solution which has the following </p>
<p>UserControl
---UserControl project</p>
<pre><code> ---UserControl Test Project
</code></pre>
<p>IN my test project, I am able to add my usercontrol to the tool box. When i drag it and drop it in my forms, it fails. I put in logging and found out that my usercontrol reads a config file. The config file is marked to copy always and exists in the obj\debug and the bin\debug directory/.</p>
<p>However when i drag the usercontrol to a form on my test project, it is trying to get a file from </p>
<p>C:\Documents and Settings\jondoe\Local Settings\Application Data\Microsoft\VisualStudio\8.0\ProjectAssemblies\vqjlihdl01</p>
<p>The above is a result of this</p>
<pre><code>string pluginAssemblyPath = Assembly.GetExecutingAssembly().Location;
DirectoryInfo dirInfo = new DirectoryInfo(pluginAssemblyPath);
pluginAssemblyPath = pluginAssemblyPath.Replace(dirInfo.Name.ToString(),"");
string configFilePath = pluginAssemblyPath + "FileConfig.xml";
</code></pre>
<p>I would have assumed that if i compile in debug mode, the file should be under obj\debug and that should be my assembly path. what gives or is there some setting that i need to do to get it to run correctly so that it can find my config file in the right location?</p>
| [
{
"answer_id": 359940,
"author": "Joe",
"author_id": 13087,
"author_profile": "https://Stackoverflow.com/users/13087",
"pm_score": 0,
"selected": false,
"text": "if (this.Site != null && this.Site.DesignMode)\n{\n ... design time behavior\n}\nelse\n{\n ... runtime behavior (read co... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359905",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38230/"
] |
359,921 | <p>I've got a test class in a module that extends another test class in one of its dependency modules. How can I import the dependency's test code into the test scope of the dependent module?</p>
<p>To illiterate, I've got two modules, "module-one" being a dependency of "module-two". <code>SubTestCase</code> is a subclass of <code>TestCase</code>.</p>
<pre>
module-one
\src\test\java\com\example\TestCase.java
module-two
\src\test\java\com\example\SubTestCase.java
</pre>
<p>But the build is failing because the test code of "module-one" is not being imported into "module-two", just the main code. </p>
| [
{
"answer_id": 1206760,
"author": "Rich Seller",
"author_id": 123582,
"author_profile": "https://Stackoverflow.com/users/123582",
"pm_score": 5,
"selected": false,
"text": " <plugin>\n <groupId>org.apache.maven.plugins</groupId>\n <artifactId>maven-jar-plugin</artifactId>\n <ex... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359921",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4893/"
] |
359,928 | <p>I want to use a signals/slots library in a project that doesn't use QT. I have pretty basic requirements: </p>
<ol>
<li>Connect two functions with any number of parameters.</li>
<li>Signals can be connected to multiple slots.</li>
<li>Manual disconnection of signal/slot connection.</li>
<li>Decent performance - the application is frame-based (i.e. not event-based) and I want to use the connections in each frame.</li>
</ol>
<p>I've read a <a href="https://web.archive.org/web/20130626010123/http://www.3sinc.com/opensource/boost.bind-vs-sigc2.html" rel="noreferrer">comparison between libsigc++ and Boost.Signals</a>. I've also read that Boost.Signals suffers from poor performance. However, I know there are other libraries and I'm still not sure which library should I choose.</p>
<p>Are there any recommendations for a signals/slots library?</p>
| [
{
"answer_id": 4561541,
"author": "Rodrigo Lopez",
"author_id": 36295,
"author_profile": "https://Stackoverflow.com/users/36295",
"pm_score": 2,
"selected": false,
"text": "COREEXTERN template class COREIMPEXP has_slots<SIGSLOT_DEFAULT_MT_POLICY>;\n"
},
{
"answer_id": 25554107,
... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359928",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33982/"
] |
359,931 | <p>EDIT: I found out that I can get it to compile if I cast the IMetadataType object to the TMetadata type. Why do I need to do this?</p>
<p>EDIT #2: The "Values" property is a .NET dictionary of type <TMetadata, TData>.</p>
<p>I have this generic method:</p>
<pre><code>private void FillMetadata<TMetadata, TData>
(Metadata<TMetadata, TData> oMetadata) where TMetadata : IMetadataType
{
IMetadataType o;
oMetadata.Values.Add(o, (TData)(object)GetValue());
}
</code></pre>
<p>I have stripped the implementation to simplify it (I actually use a real object, not the IMetadataType declared here).</p>
<p>My question is, why doesn't this compile? The compile error is on the Add() method: "cannot convert from 'IMetadataType' to 'TMetadata'." Isn't that what the "where" clause on the method is for?</p>
<p>What am I missing?</p>
| [
{
"answer_id": 4561541,
"author": "Rodrigo Lopez",
"author_id": 36295,
"author_profile": "https://Stackoverflow.com/users/36295",
"pm_score": 2,
"selected": false,
"text": "COREEXTERN template class COREIMPEXP has_slots<SIGSLOT_DEFAULT_MT_POLICY>;\n"
},
{
"answer_id": 25554107,
... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359931",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44626/"
] |
359,933 | <p>Since IronPython doesn't support attributes I am wondering if there is another way to decorate IronPython classes with attributes, perhaps with reflection?</p>
| [
{
"answer_id": 4561541,
"author": "Rodrigo Lopez",
"author_id": 36295,
"author_profile": "https://Stackoverflow.com/users/36295",
"pm_score": 2,
"selected": false,
"text": "COREEXTERN template class COREIMPEXP has_slots<SIGSLOT_DEFAULT_MT_POLICY>;\n"
},
{
"answer_id": 25554107,
... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359933",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1740/"
] |
359,957 | <p>I'm trying to find out the last time a computer came out of standby/hibernate. I know I could get this by watching Win32_PowerManagementEvent, but that doesn't work in this instance as I need something I can poll - any ideas? It doesn't have to be WMI, I'm just assuming that's the place it would be.</p>
<p>Thanks!</p>
| [
{
"answer_id": 360157,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 2,
"selected": false,
"text": "Register-WmiEvent -query \"Select * From Win32_PowerManagementEvent where EventType=7\" -messagedata \"Power Management Resume... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359957",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
359,959 | <p>When parsing HTML for certain web pages (most notably, any windows live page) I encounter a lot of URL’s in the following format.</p>
<p>http\x3a\x2f\x2fjs.wlxrs.com\x2fjt6xQREgnzkhGufPqwcJjg\x2fempty.htm</p>
<p>These appear to be partially UTF8 escaped strings (\x2f = /, \x3a=:, etc …). Is there a .Net API that can be used to transform these strings into a System.Uri? Seems easy enough to parse but I’m trying to avoid building a new wheel today. </p>
| [
{
"answer_id": 1421687,
"author": "Timwi",
"author_id": 33225,
"author_profile": "https://Stackoverflow.com/users/33225",
"pm_score": 3,
"selected": true,
"text": "HttpUtility.UrlDecode()"
},
{
"answer_id": 14286569,
"author": "Royi Namir",
"author_id": 859154,
"autho... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359959",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23283/"
] |
359,978 | <p>I have written a C# Windows Forms application to merge the files and folders from a remote folder on one machine ("source" folder is a mapped drive - "Z:\folder") with another remote folder on a different machine ("destination" folder is a UNC path to a shared folder - "\\computername\sharedfolder"). I have Full permissions to both folders. When I run the program on my local machine, it works fine, but when I try to run it from from within the source folder it fails with a security exception.</p>
<p>The failure occurs when calling the DirectoryInfo constructor for the destination folder (i.e., DirectoryInfo(@"\\computername\sharedfolder"). I assume the problem is because I am running the program from a mapped drive. Any workarounds?</p>
<hr>
<p>The specific exception is:
Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.</p>
<hr>
<p><strong>UPDATE</strong></p>
<p>okay, I got my application into Visual Studio 2008 (it was previously coded in 2005), targeted the .NET 3.5 framework, compiled and tried again.</p>
<p>I got the exact same error.</p>
<hr>
<p><strong>UPDATE - RESOLUTION</strong></p>
<p>I tried it with .NET 3.5, and it didn't work, then I noticed that you said 3.5 SP1. The service pack is definately needed.</p>
<p>Problem solved. Thank you.</p>
| [
{
"answer_id": 360025,
"author": "Rob Prouse",
"author_id": 30827,
"author_profile": "https://Stackoverflow.com/users/30827",
"pm_score": 3,
"selected": false,
"text": "@ECHO OFF\nSET CASPOL=%windir%\\Microsoft.NET\\Framework\\v2.0.50727\\CasPol.exe\nCLS\n\n%CASPOL% -pp off\n%CASPOL% -m ... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359978",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45405/"
] |
359,986 | <p>I have a multilingual ASP.NET site; one of the languages is Arabic (ar-SA). To switch between cultures, I use this code: </p>
<pre><code>Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(Name)
Thread.CurrentThread.CurrentUICulture = New CultureInfo(Name)
</code></pre>
<p>When displaying the date of an article, for example, I just do this, and the localization API takes care of everything:</p>
<pre><code><%#Eval("DatelineDate","{0:d MMMM yyyy}")%>
</code></pre>
<p>The problem is that this displays dates using the Hijiri (Islamic) calendar (e.g. the year 2008 is rendered as 1429). The client wants to display the dates using the Gregorian calendar (still rendering the month names and everything else in Arabic, of course). How can I do this?</p>
| [
{
"answer_id": 360170,
"author": "Herb Caudill",
"author_id": 239663,
"author_profile": "https://Stackoverflow.com/users/239663",
"pm_score": 5,
"selected": true,
"text": "ar-AE 11 ديسمبر 2008 \nar-BH 11 ديسمبر 2008 \nar-DZ 11 ديسمبر 2008 \nar-EG 11 ديسمبر 2008 \nar-IQ 11 كانون الأول 200... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359986",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/239663/"
] |
359,992 | <p>In my Symbian S60 application, my Options menu works as expected. But the Exit button does nothing.</p>
<p>I am developing with Carbide and have used the UI Designer to add items to the options menu.</p>
<p>Does anyone know how to enable the exit button, or why else it might not work?</p>
<p>Thanks!</p>
| [
{
"answer_id": 360032,
"author": "Kasprzol",
"author_id": 5957,
"author_profile": "https://Stackoverflow.com/users/5957",
"pm_score": 3,
"selected": true,
"text": "appui::HandleCommandL"
},
{
"answer_id": 360044,
"author": "ayaz",
"author_id": 23191,
"author_profile":... | 2008/12/11 | [
"https://Stackoverflow.com/questions/359992",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33604/"
] |
360,007 | <p>I'm trying to deploy <a href="http://code.google.com/p/elmah/" rel="nofollow noreferrer">elmah</a>. For inexplicable reasons, I'm getting an error: .axd files are explicitly forbidden. I've already fixed what I can control (my web.config) and solutions requiring collaboration from the system admin are <em>not</em> available (such as editing machine web.config or updating IIS mappings). I also verified that it works fine on several other machines with ordinary configurations.</p>
<p>Ashx is supposed to be like axd, so are there any differences between axd and ashx I should take into consideration when converting from one to the other?</p>
<p>UPDATE: I think I answered my own question. I change the web.config to read</p>
<pre><code> <add verb="POST,GET,HEAD" path="elmah.ashx" type="Elmah.ErrorLogPageFactory, Elmah" />
</code></pre>
<p>It seems to work. The source code for elmah doesn't even have the string axd in it.</p>
| [
{
"answer_id": 424939,
"author": "MatthewMartin",
"author_id": 33264,
"author_profile": "https://Stackoverflow.com/users/33264",
"pm_score": 3,
"selected": true,
"text": "<add verb=\"POST,GET,HEAD\" path=\"elmah.ashx\" type=\"Elmah.ErrorLogPageFactory, Elmah\" />\n"
}
] | 2008/12/11 | [
"https://Stackoverflow.com/questions/360007",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33264/"
] |
360,013 | <p>I'm curious if it's possible to intercept the default methods of 'Edit' mode on a UITableView. Typically you get a free 'delete' button if you side swipe a UITableViewCell that has delegate methods associated with it. I'd like to change the delete to some other, arbitrary selector. Instead of deleting the cell, I'd just like to run a hello world alert dialogue. Is something to this extent possible? </p>
| [
{
"answer_id": 365099,
"author": "Lily Ballard",
"author_id": 582,
"author_profile": "https://Stackoverflow.com/users/582",
"pm_score": 2,
"selected": false,
"text": "editAction"
},
{
"answer_id": 1249754,
"author": "Adam Prall",
"author_id": 1822483,
"author_profile"... | 2008/12/11 | [
"https://Stackoverflow.com/questions/360013",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40882/"
] |
360,016 | <p>Today our virtual W2003 server storing our SVN repository (too) became very-very busy. It turned out that it had only 88KB free space left on the C: drive. Not that good. Due to access problems, the only way we could reboot it by killing the busy processes from task manager (McAffee, SqlServer, services.exe) and then gracefully reboot. We freed up some space, the machine is happy again, but our SVN repository is not available anymore.</p>
<p>If I connect from the client, it gives the message "<em>No repository found in 'svn://[mymachine]/repos/[myapp]'</em> "
However, from the server I can see the content using "<em>svnlook tree [rootFolder]</em>" command.</p>
<p>If I navigate to the root folder using Windows Explorer, the following folders are empty (I have no clue if that is normal):</p>
<ul>
<li><em>[rootFolder]/trunk</em> </li>
<li><em>[rootFolder]/tags</em></li>
<li><em>[rootFolder]/branches</em></li>
</ul>
<p>However, the <em>[rootFolder]/db</em> contains many files with the corresponding revision name. The size of the head should be around 600MB but we have also a number of branches. The total size of the [rootFolder] is now ~600MB. Did we loose the branches? Tomorrow we will also know if our backup system worked well. Anyway, does anyone has any idea?</p>
<p><em>[Update after solution found]</em></p>
<p>Thanx for all who submitted answers, they were very useful in resolving the trouble.
During the crash, the SVN service got corrupted, while the data remained intact. Reinstallation of the service has solved the problem.</p>
| [
{
"answer_id": 365099,
"author": "Lily Ballard",
"author_id": 582,
"author_profile": "https://Stackoverflow.com/users/582",
"pm_score": 2,
"selected": false,
"text": "editAction"
},
{
"answer_id": 1249754,
"author": "Adam Prall",
"author_id": 1822483,
"author_profile"... | 2008/12/11 | [
"https://Stackoverflow.com/questions/360016",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24451/"
] |
360,024 | <p>I'd like to set a connection string programmatically, with absolutely no change to any config files / registry keys.</p>
<p>I have this piece of code, but unfortunately it throws an exception with "the configuration is read only".</p>
<pre><code>ConfigurationManager.ConnectionStrings.Clear();
string connectionString = "Server=myserver;Port=8080;Database=my_db;...";
ConnectionStringSettings connectionStringSettings =
new ConnectionStringSettings("MyConnectionStringKey", connectionString);
ConfigurationManager.ConnectionStrings.Add(connectionStringSettings);
</code></pre>
<p><strong>Edit:</strong>
The problem is that I have existing code that reads the connection string from the configuration. So setting the config string manually, or through a resource, don't seem like valid options. What I really need is a way to modify the configuration programmatically.</p>
| [
{
"answer_id": 360052,
"author": "Robert S.",
"author_id": 7565,
"author_profile": "https://Stackoverflow.com/users/7565",
"pm_score": 1,
"selected": false,
"text": "Resources.Default.ConnectionString = \"Server=myserver;\" // etc"
},
{
"answer_id": 377573,
"author": "David G... | 2008/12/11 | [
"https://Stackoverflow.com/questions/360024",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11236/"
] |
360,028 | <p>Moments ago <a href="http://twitter.com/codinghorror/status/1051535711" rel="nofollow noreferrer">Jeff Atwood said the following on twitter</a>:</p>
<blockquote>
<p>Look, I love rapid new software releases, but the frequency of WordPress releases is just ridiculous.</p>
</blockquote>
<p>Which makes me think, <strong>how often should you release software updates?</strong></p>
<ul>
<li>Daily?</li>
<li>Weekly?</li>
<li>Monthly?</li>
<li>Yearly?</li>
</ul>
<p>Whats the best release strategy?</p>
| [
{
"answer_id": 360091,
"author": "chills42",
"author_id": 23855,
"author_profile": "https://Stackoverflow.com/users/23855",
"pm_score": 3,
"selected": false,
"text": "releaseDelta = updateTime/((1/365)*(60*60*8))\n"
}
] | 2008/12/11 | [
"https://Stackoverflow.com/questions/360028",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/383/"
] |
360,030 | <p>I have a Java method which returns an array of doubles. I would then like to store these values in individual variables in the calling function. Is there an elegant way of doing this in Java.</p>
<p>I could write it as this:</p>
<pre><code>double[] returnValues = calculateSomeDoubles();
double firstVar = returnValues[0];
double secondVar = returnValues[1];
</code></pre>
<p>I was just wondering if there was some way of compressing this down to a single line? Something like:</p>
<pre><code>(firstVar, secondVar) = calculateSomeDoubles();
</code></pre>
<p>This type of thing is quite easy when scripting, but the stronger typing of Java means it probably isn't possible.</p>
| [
{
"answer_id": 360060,
"author": "OscarRyz",
"author_id": 20654,
"author_profile": "https://Stackoverflow.com/users/20654",
"pm_score": 1,
"selected": false,
"text": " SomeUtility.fill( myObject , withDoublesFromMethod() );\n"
},
{
"answer_id": 360117,
"author": "Nick Holt",
... | 2008/12/11 | [
"https://Stackoverflow.com/questions/360030",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/277/"
] |
360,036 | <p>Is there any way to split a long string of HTML after N words? Obviously I could use:</p>
<pre><code>' '.join(foo.split(' ')[:n])
</code></pre>
<p>to get the first n words of a plain text string, but that might split in the middle of an html tag, and won't produce valid html because it won't close the tags that have been opened.</p>
<p>I need to do this in a zope / plone site - if there is something as standard in those products that can do it, that would be ideal.</p>
<p>For example, say I have the text:</p>
<pre><code><p>This is some text with a
<a href="http://www.example.com/" title="Example link">
bit of linked text in it
</a>.
</p>
</code></pre>
<p>And I ask it to split after 5 words, it should return:</p>
<pre><code><p>This is some text with</p>
</code></pre>
<p>7 words:</p>
<pre><code><p>This is some text with a
<a href="http://www.example.com/" title="Example link">
bit
</a>
</p>
</code></pre>
| [
{
"answer_id": 360356,
"author": "JV.",
"author_id": 33612,
"author_profile": "https://Stackoverflow.com/users/33612",
"pm_score": 0,
"selected": false,
"text": "import re\nfrom BeautifulSoup import BeautifulSoup\nimport tidy\n\ndef remove_html_tags(data):\n p = re.compile(r'<.*?>')\n... | 2008/12/11 | [
"https://Stackoverflow.com/questions/360036",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3408/"
] |
360,040 | <p>When given a static set of objects (static in the sense that once loaded it seldom if ever changes) into which repeated concurrent lookups are needed with optimal performance, which is better, a <code>HashMap</code> or an array with a binary search using some custom comparator?</p>
<p>Is the answer a function of object or struct type? Hash and/or Equal function performance? Hash uniqueness? List size? <code>Hashset</code> size/set size?</p>
<p>The size of the set that I'm looking at can be anywhere from 500k to 10m - incase that information is useful.</p>
<p>While I'm looking for a C# answer, I think the true mathematical answer lies not in the language, so I'm not including that tag. However, if there are C# specific things to be aware of, that information is desired.</p>
| [
{
"answer_id": 360059,
"author": "Bill the Lizard",
"author_id": 1288,
"author_profile": "https://Stackoverflow.com/users/1288",
"pm_score": 6,
"selected": false,
"text": "hashCode()\n{\n return 0;\n}\n"
},
{
"answer_id": 360138,
"author": "Jimmy",
"author_id": 4435,
... | 2008/12/11 | [
"https://Stackoverflow.com/questions/360040",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18941/"
] |
360,063 | <p>I often run into code that has to perform lots of checks and ends up being indented at least five or six levels before really doing anything. I am wondering what alternatives exist.</p>
<p>Below I've posted an example of what I'm talking about (which isn't actual production code, just something I came up with off the top of my head).</p>
<pre><code>public String myFunc(SomeClass input)
{
Object output = null;
if(input != null)
{
SomeClass2 obj2 = input.getSomeClass2();
if(obj2 != null)
{
SomeClass3 obj3 = obj2.getSomeClass3();
if(obj3 != null && !BAD_OBJECT.equals(obj3.getSomeProperty()))
{
SomeClass4 = obj3.getSomeClass4();
if(obj4 != null)
{
int myVal = obj4.getSomeValue();
if(BAD_VALUE != myVal)
{
String message = this.getMessage(myVal);
if(MIN_VALUE <= message.length() &&
message.length() <= MAX_VALUE)
{
//now actually do stuff!
message = result_of_stuff_actually_done;
}
}
}
}
}
}
return output;
}
</code></pre>
| [
{
"answer_id": 360071,
"author": "ieure",
"author_id": 45224,
"author_profile": "https://Stackoverflow.com/users/45224",
"pm_score": 3,
"selected": false,
"text": "if (input == null) {\n return output;\n}\n"
},
{
"answer_id": 360072,
"author": "Bill the Lizard",
"autho... | 2008/12/11 | [
"https://Stackoverflow.com/questions/360063",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18511/"
] |
360,088 | <p>I am planning a fresh installation of <strong>SQL Server 2005</strong> on a new machine, which I have to order. I know that <strong>tempdb tuning</strong> is very important to the overall <strong>performance</strong> of the SQL Server instance.</p>
<p>I've read that it's best practice to create as many tempdb files as you have CPU's (or cores?). Is that correct? Are there any other recommendations, e.g. for harddisk/RAID setup configuration I should pay attention to?</p>
<p><em>Thanks!</em></p>
| [
{
"answer_id": 362636,
"author": "splattne",
"author_id": 6461,
"author_profile": "https://Stackoverflow.com/users/6461",
"pm_score": 5,
"selected": false,
"text": "ALTER DATABASE"
}
] | 2008/12/11 | [
"https://Stackoverflow.com/questions/360088",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6461/"
] |
360,111 | <p>I have an array of different type objects and I use a BinaryWriter to convert each item to its binary equivalent so I can send the structure over the network.</p>
<p>I currently do something like </p>
<pre><code>for ( i=0;i<tmpArrayList.Count;i++)
{
object x=tmpArrayList[i];
if (x.GetType() == typeof(byte))
{
wrt.Write((byte)x);
}
........
</code></pre>
<p>The problem is that if miss a type them my code might break in the future.</p>
<p>I would like to do something like.</p>
<pre><code>object x=tmpArrayList[i];
wrt.Write(x);
</code></pre>
<p>but it doesn't work unless I do each cast. </p>
<p>Edit:</p>
<p>After consulting the answers this is what I came up with for the function. For testing this function sends the array to syslog.</p>
<pre><code> private void TxMsg(ArrayList TxArray,IPAddress ipaddress)
{
Byte[] txbuf=new Byte[0];
int sz=0;
// caculate size of txbuf
foreach (Object o in TxArray)
{
if ( o is String )
{
sz+=((String)(o)).Length;
}
else if ( o is Byte[] )
{
sz+=((Byte[])(o)).Length;
}
else if ( o is Char[] )
{
sz+=((Char[])(o)).Length;
}
else // take care of non arrays
{
sz+=Marshal.SizeOf(o);
}
}
txbuf = new Byte[sz];
System.IO.MemoryStream stm_w = new System.IO.MemoryStream( txbuf, 0,txbuf.Length);
System.IO.BinaryWriter wrt = new System.IO.BinaryWriter( stm_w );
foreach (Object o in TxArray)
{
bool otypefound=false;
if (o is String) // strings need to be sent one byte per char
{
otypefound=true;
String st=(String)o;
for(int i=0;i<st.Length;i++)
{
wrt.Write((byte)st[i]);
}
}
else
{
foreach (MethodInfo mi in typeof(BinaryWriter).GetMethods())
{
if (mi.Name == "Write")
{
ParameterInfo[] pi = mi.GetParameters();
if ((pi.Length == 1)&&(pi[0].ParameterType==o.GetType()))
{
otypefound=true;
mi.Invoke(wrt, new Object[] { o });
}
}
}
}
if(otypefound==false)
{
throw new InvalidOperationException("Cannot write data of type " + o.GetType().FullName);
}
}
IPEndPoint endpoint = new IPEndPoint(ipaddress, 514); //syslog port
UdpClient udpClient_txmsg = new UdpClient();
udpClient_txmsg.Send(txbuf, txbuf.Length,endpoint); // send udp packet to syslog
}
</code></pre>
| [
{
"answer_id": 360121,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 3,
"selected": false,
"text": "if (x.GetType() == typeof(byte))\n"
},
{
"answer_id": 360150,
"author": "Jay Bazuzi",
"author_id": 5314,... | 2008/12/11 | [
"https://Stackoverflow.com/questions/360111",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32958/"
] |
360,116 | <p><strong>Update 1:</strong><br>
Cannot reproduce this on a co-worker's computer (same setup as mine) so I assume this is a problem with my workstation and not a general one. </p>
<p>I'd appreciate it if someone would close this question as I don't have enough reputation to do it myself. </p>
<p>@MatthewMartin. Thanks for your comments :-)</p>
<hr>
<p><strong>Update 2:</strong><br>
Unlike my coworker, I have <strong>VS90sp1-KB945140-ENU.exe (SP1)</strong> and <strong>VS90SP1-KB957912-x86.exe</strong> (JS Intellisense hotfix) installed on my machine. That <em>appears</em> to be the only difference between our setups. I removed both of them, but that didn't solve my problem.</p>
<hr>
<p>In my asp.net (C#) page is a little bit of Javascript to resize an object when the user resizes the window.</p>
<p>When I access the page using IE6 on my DEV server (IIS), it <strong>works</strong>.<br>
When I access the page using IE6 via VS2008 using F5 or CTRL-F5 (both of which start the ASP.NET Development Server) it <strong>fails</strong>. It seems to enter an infinite loop of resizing where the <code>adjSpreadsheetSize</code> function fires the window.resize event, which invokes <code>adjSpreadsheetSize</code> ... Repeat ad infinitum</p>
<p>I see quite a few people out there complaining that IE6 can't properly handle onresize events, but nobody seems to be having this precise problem.</p>
<p><strong>Any idea why this code works on IIS but not on ASP.NET Development Server?</strong></p>
<p>Here's the relevant part of the code:</p>
<pre><code>[snip]
<head>
[snip]
<script language="javascript" type="text/javascript">
window.onresize = adjSpreadsheetSize;
window.onload = pageSetup;
//Change spreadsheet size to fill the window (viewport) below the entry form
function adjSpreadsheetSize() {
var objSS = document.getElementById("OWC_data");
var winWidth = document.documentElement.clientWidth;
var winHeight = document.documentElement.clientHeight;
winHeight -= document.getElementById('form_body').offsetHeight;
objSS.height = winHeight;
objSS.width = winWidth;
return false;
}
function pageSetup() {
adjSpreadsheetSize();
}
</script>
[snip]
</head>
<body>
<form id="form1" runat="server" action="rawdata.aspx" method="get">
<div id="form_body">
[snip]
</div>
</form>
<div id="OWC_container">
<object id="OWC_data" classid="clsid:0002E559-0000-0000-C000-000000000046">
</object>
</div>
</code></pre>
<p>
</p>
<p>My setup:</p>
<ul>
<li>WinXP Pro SP2</li>
<li>Microsoft Visual Studio 2008 Version 9.0.21022.8 RTM
<ul>
<li>Installed Edition: Professional</li>
<li>Microsoft Visual Basic 2008</li>
<li>Microsoft Visual C# 2008</li>
<li>Microsoft Visual C++ 2008</li>
<li>Microsoft Visual Studio 2008 Tools for Office</li>
<li>Microsoft Visual Web Developer 2008</li>
<li>Crystal Reports Basic for Visual Studio 2008</li>
</ul></li>
<li>Microsoft .NET Framework Version 3.5 SP1</li>
<li>The Website project lives on the DEV server (mapped as a local drive)</li>
</ul>
| [
{
"answer_id": 360121,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 3,
"selected": false,
"text": "if (x.GetType() == typeof(byte))\n"
},
{
"answer_id": 360150,
"author": "Jay Bazuzi",
"author_id": 5314,... | 2008/12/11 | [
"https://Stackoverflow.com/questions/360116",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41089/"
] |
360,134 | <p>I am using master page on some pages. And that master page is loading the user control. So I want to disable or enable user control on some page load which has master page. </p>
<hr>
<p>Is there anyway can I disable User control on master page Page_load()</p>
<hr>
<pre><code><div class="ucTabCtrl" >
<uc1:TLTabControl ID="ctrlname" runat="server" Visible="False" />
</div>
Master Page_load()
{
// checking some condition if true
ctrlname.visible = true;
}
</code></pre>
<p>but the problem is I'm not able to get the instance of user ctrl, in short ctrlname is null all the time.</p>
| [
{
"answer_id": 360149,
"author": "Steven Behnke",
"author_id": 42588,
"author_profile": "https://Stackoverflow.com/users/42588",
"pm_score": 0,
"selected": false,
"text": "if (null != this.Master)\n{\n userControl.Enabled = false;\n}\n"
},
{
"answer_id": 360557,
"author": ... | 2008/12/11 | [
"https://Stackoverflow.com/questions/360134",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21918/"
] |
360,141 | <p>I just installed SQL Server 2008 Express on my Vista SP1 machine. I previously had 2005 on here and used it just fine with the old SQL Server Management Studio Express. I was able to connect with no problems to my PC-NAME\SQLEXPRESS instance (no, PC-NAME is not my computer name ;-).</p>
<p>I uninstalled 2005 and SQL Server Management Studio Express. I then installed SQL Server 2008 Express on my machine and elected to have it install SQL Server Management Studio Basic.</p>
<p>Now, when I try to connect to PC-NAME\SQLEXPRESS (with Windows Authentication, like I always did), I get the following message:</p>
<p><em>Cannot connect to PC-NAME\SQLEXPRESS.
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) (Microsoft SQL Server, Error: -1)
For help, click: <a href="http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=-1&LinkId=20476" rel="noreferrer">http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=-1&LinkId=20476</a></em></p>
<p>When I installed SQL Server 2008, I had it use SQLEXPRESS as the local instance name. As far as I can tell, through SQL Server Configuration Manager, SQL Server is configured to allow remote connections.</p>
<p>When I went to the help link it mentions, the help page suggests the following:</p>
<ul>
<li>Make sure that the SQL Server Browser service is started on the server.</li>
<li>Use the SQL Server Surface Area Configuration tool to enable SQL Server to accept remote connections. For more information about the SQL Server Surface Area Configuration Tool, see Surface Area Configuration for Services and Connections.</li>
</ul>
<p>Well, as far as I can tell, there is no SQL Server Browser service on my system (looked in MMC for one, couldn't find one).</p>
<p>And the SQL Server Surface Area Configuration tool doesn't exist in SQL Server 2008. So good job there with your help documentation, Microsoft ;-).</p>
<p>I'm at a loss for what to do right now. I had a lot of work I was hoping to get done today after upgrading to 2008 (the person I'm working with got it up and running with no problem and told me it would be easy - he's also far better with database stuff that I am). Does anyone have any idea what might be wrong? I'd really appreciate it. If I can't get this working in a few hours, I'm going back to SQL Server 2005 (if that will even work, gah...).</p>
<p>Edit: I have tried turning Windows Firewall off, and that did not help. Also, I noticed that I do not have a "Data" directory under my SQL Server 2008 install directory tree - could I have possibly set something up wrong when I installed it?</p>
| [
{
"answer_id": 3461900,
"author": "Govardhana Reddy",
"author_id": 417640,
"author_profile": "https://Stackoverflow.com/users/417640",
"pm_score": 8,
"selected": false,
"text": "\\SQLEXPRESS"
},
{
"answer_id": 5015707,
"author": "SQLSERV",
"author_id": 619515,
"author... | 2008/12/11 | [
"https://Stackoverflow.com/questions/360141",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18505/"
] |
360,148 | <p>I'm trying to create a Comments section in my wiki. There's one solution on the Web involving the creation of a "column," but that seemed to just create a second text block under the main article block. This is impractical, because subsequent edits don't create new comments - they seem to just edit the existing comment. There are a few others asking this question out there. Has anyone done anything like this before?</p>
| [
{
"answer_id": 3461900,
"author": "Govardhana Reddy",
"author_id": 417640,
"author_profile": "https://Stackoverflow.com/users/417640",
"pm_score": 8,
"selected": false,
"text": "\\SQLEXPRESS"
},
{
"answer_id": 5015707,
"author": "SQLSERV",
"author_id": 619515,
"author... | 2008/12/11 | [
"https://Stackoverflow.com/questions/360148",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44831/"
] |
360,158 | <p>I'm using VBA in Excel 2003 to apply validation to apply validation to a given range of cells from a named list. The user can then select from a dropdown list of values.</p>
<p>Edit: Here's how I'm setting the validation, given a named range called 'MyLookupList'</p>
<pre><code> With validatedRange.Validation
.Delete
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, _
Operator:=xlBetween, Formula1:="=MyLookupList"
.ErrorMessage = "Invalid value. Select one from the dropdown list."
.InCellDropdown = True
End With
</code></pre>
<p>All that works fine, but the problem is that when validation is applied from a named list, it is case-insensitive. I.e. if a dropdown choice is "John Smith", then the user can type in "john smith" or "john SmiTh" into the validated cell and Excel will still treat it as a valid entry.</p>
<p>I know that manually creating a list via Tools-->Validation... will make the lookup validation case sensitive, but for my case this is just not feasible - I have to populate the named lists and assign validation programmatically.</p>
<p>Does anyone know of a way to ensure that Excel validation based on named lists is case-sensitive?</p>
<p>Thanks.</p>
| [
{
"answer_id": 360750,
"author": "DJ.",
"author_id": 10492,
"author_profile": "https://Stackoverflow.com/users/10492",
"pm_score": 2,
"selected": false,
"text": "Dim sValidationList As String\nDim iRow As Integer\n\n 'build comma-delimited list based on validation range\n With oValidat... | 2008/12/11 | [
"https://Stackoverflow.com/questions/360158",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1354/"
] |
360,161 | <p>Im trying to get a completly data copy from a gridview, itryed clone(), tryed cast DataView from DataSouce, but always get nulls or cant get the data, please exists a way to copy data from gridview, modified it and then reload it? or modifyng directly some rows in the gridview?
thanks in advance!</p>
| [
{
"answer_id": 360317,
"author": "dragonjujo",
"author_id": 37344,
"author_profile": "https://Stackoverflow.com/users/37344",
"pm_score": 2,
"selected": true,
"text": "protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)\n{\n if (e.Row.RowType == DataControlRow... | 2008/12/11 | [
"https://Stackoverflow.com/questions/360161",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1388553/"
] |
360,167 | <p>I'd like to host custom items in a ToolBar in an ItemsControl. However, the buttons I add are rendered below the toolbar and as regular buttons rather than in the ToolBar with the ToolBar look and feel.</p>
<p>This can be reproduced with a few lines of Xaml (I've excluded the default content). The custom ItemsControl:</p>
<pre><code><ToolBar ItemsSource="{Binding Items}" />
</code></pre>
<p>The example window:</p>
<pre><code><StackPanel Orientation="Vertical">
<local:UserControl1>
<Button>control button</Button>
</local:UserControl1>
<Button>standard button</Button>
<ToolBar>
<Button>window toolbar button</Button>
</ToolBar>
</code></pre>
<p>I would expect that the "control button" would render similarly to the "window toolbar button", rather it renders like the "standard button" below an empty ToolBar.</p>
<p>Any guidance will be appreciated.</p>
| [
{
"answer_id": 360371,
"author": "Micah",
"author_id": 17744,
"author_profile": "https://Stackoverflow.com/users/17744",
"pm_score": 2,
"selected": false,
"text": "Style=\"{DynamicResource {x:Static ToolBar.ButtonStyleKey}}\"\n"
}
] | 2008/12/11 | [
"https://Stackoverflow.com/questions/360167",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1807/"
] |
360,195 | <p>I'm trying to run a c++ 2d array (pretty simple file) and it works but an error (at least I think it's an error) appears on the end.</p>
<p>The code for the array is;</p>
<pre><code>int myArray[10][10];
for (int i = 0; i <= 9; ++i){
for (int t = 0; t <=9; ++t){
myArray[i][t] = i+t; //This will give each element a value
}
}
for (int i = 0; i <= 9; ++i){
for (int t = 0; t <=9; ++t){
cout << myArray[i][t] << "\n";
}
</code></pre>
<p>this prints the array properly but adds</p>
<p>"0x22fbb0"</p>
<p>on the end. What is this and why does it happen?</p>
| [
{
"answer_id": 360228,
"author": "Johannes Schaub - litb",
"author_id": 34509,
"author_profile": "https://Stackoverflow.com/users/34509",
"pm_score": 3,
"selected": false,
"text": "if(cout) { ... }"
}
] | 2008/12/11 | [
"https://Stackoverflow.com/questions/360195",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33061/"
] |
360,201 | <p>I am looking for a way to clean up the mess when my top-level script exits.</p>
<p>Especially if I want to use <code>set -e</code>, I wish the background process would die when the script exits.</p>
| [
{
"answer_id": 360249,
"author": "Oli",
"author_id": 12870,
"author_profile": "https://Stackoverflow.com/users/12870",
"pm_score": -1,
"selected": false,
"text": "killall"
},
{
"answer_id": 360275,
"author": "Johannes Schaub - litb",
"author_id": 34509,
"author_profil... | 2008/12/11 | [
"https://Stackoverflow.com/questions/360201",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1277510/"
] |
360,216 | <p>I would like to display certain meta data fields in the edit form based on the value of a fields. </p>
<p>Example: Users upload a document to the Doclib to be approved by there manager. They are allowed to change the meta data Name,Case No, Location until the item is approved by the manager. Once the item is approved I would like to set Name and Case Number to read only.</p>
<p>What is the best way to meet this requirement?</p>
<p>If approved = yes
set Name and Case No = Read only
Else
do nothing.</p>
<hr>
<p>I have tried this method for about 5 hours. I believed this may be different for ModerationStatus. Might require something special</p>
<pre><code>print("<xsl:choose>
<xsl:when test="@_ModerationStatus != '0;#approved'">
<SharePoint:FormField runat="server" id="ff12{$Pos}" ControlMode="Edit" FieldName="Test_x0020_Session" __designer:bind="{ddwrt:DataBind('u',concat('ff12',$Pos),'Value','ValueChanged','ID',ddwrt:EscapeDelims(string(@ID)),'@Test_x0020_Session')}"/>
<SharePoint:FieldDescription runat="server" id="ff12description{$Pos}" FieldName="Test_x0020_Session" ControlMode="Edit"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@Test_x0020_Session"></xsl:value-of>
</xsl:otherwise>
</code></pre>
<p>");</p>
<p>I can get it to work with the other fields but not ModerationStatus. I have also tried changing it to !='0' and !='Approved' and '0;#Approved'. Is there something I am doing wrong?</p>
<p>Seems like its stuck on 0;#Approved</p>
| [
{
"answer_id": 366929,
"author": "Toni Frankola",
"author_id": 15626,
"author_profile": "https://Stackoverflow.com/users/15626",
"pm_score": 2,
"selected": true,
"text": "<xsl:choose>\n <xsl:when test=\"@Status != 'Closed'\">\n <SharePoint:FormField runat=\"server\" id=\"ff1{$P... | 2008/12/11 | [
"https://Stackoverflow.com/questions/360216",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2282/"
] |
360,219 | <p>I want to skip to the first line that contains "include".</p>
<pre><code><> until /include/;
</code></pre>
<p>Why does this not work?</p>
| [
{
"answer_id": 360243,
"author": "Robert Gamble",
"author_id": 25222,
"author_profile": "https://Stackoverflow.com/users/25222",
"pm_score": 4,
"selected": true,
"text": "$_"
},
{
"answer_id": 360261,
"author": "Hudson",
"author_id": 14105,
"author_profile": "https://... | 2008/12/11 | [
"https://Stackoverflow.com/questions/360219",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44511/"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.