qid int64 4 22.2M | question stringlengths 18 48.3k | answers list | date stringlengths 10 10 | metadata list |
|---|---|---|---|---|
173,884 | <p>When I am adding two textbox values that are <strong>1.001</strong> and <strong>0.001</strong> and then I do a <code>parseFloat</code> I get <strong>1.0019999999</strong>. I want it <strong>1.002</strong> . Can you help me?</p>
| [
{
"answer_id": 174046,
"author": "17 of 26",
"author_id": 2284,
"author_profile": "https://Stackoverflow.com/users/2284",
"pm_score": 5,
"selected": false,
"text": "toFixed()"
},
{
"answer_id": 11399911,
"author": "Lorenzo Polidori",
"author_id": 885464,
"author_profi... | 2008/10/06 | [
"https://Stackoverflow.com/questions/173884",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
173,886 | <p>Please consider this example class:</p>
<pre><code>[Serializable]
public class SomeClass
{
private DateTime _SomeDateTime;
public DateTime SomeDateTime
{
get { return _SomeDateTime; }
set { _SomeDateTime = value; }
}
}
</code></pre>
<p>I would like to alter the serialization of any DateTime declared in the class according to my own rules. The members of this class will change frequently and I don't want to maintain a custom serializer for every change. Also I would like this behaviour to be inherited by subclasses and not code a custom serializer for every one. The serialization is being output by a web service. Thanks for any help!</p>
| [
{
"answer_id": 173894,
"author": "Josh",
"author_id": 11702,
"author_profile": "https://Stackoverflow.com/users/11702",
"pm_score": 2,
"selected": false,
"text": "public DateTime? SomeDateTime {get; set;}\n"
}
] | 2008/10/06 | [
"https://Stackoverflow.com/questions/173886",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6651/"
] |
173,919 | <p>When merging topic branch "B" into "A" using <code>git merge</code>, I get some conflicts. I know all the conflicts can be solved using the version in "B".</p>
<p>I am aware of <code>git merge -s ours</code>. But what I want is something like <code>git merge -s theirs</code>.</p>
<p>Why doesn't it exist? How can I achieve the same result after the conflicting merge with existing <code>git</code> commands? (<code>git checkout</code> every unmerged file from B)</p>
<p>The "solution" of just discarding anything from branch A (the merge commit point to B version of the tree) is not what I am looking for.</p>
| [
{
"answer_id": 173954,
"author": "elmarco",
"author_id": 1277510,
"author_profile": "https://Stackoverflow.com/users/1277510",
"pm_score": 4,
"selected": false,
"text": "git checkout -m old\ngit checkout -b new B\ngit merge -s ours old\n"
},
{
"answer_id": 174283,
"author": "... | 2008/10/06 | [
"https://Stackoverflow.com/questions/173919",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1277510/"
] |
173,934 | <p>I'm trying to create newspaper style columns using a block of text. I would like the text to be evenly spread out across 2 columns which could react to change of length in the text.</p>
<p>Is this possible using just HTML/CSS, if not could javascript be used?</p>
<p>Thanks</p>
| [
{
"answer_id": 174684,
"author": "MusiGenesis",
"author_id": 14606,
"author_profile": "https://Stackoverflow.com/users/14606",
"pm_score": 1,
"selected": false,
"text": "function Newspaperize(elem)\n{\n var halflength = elem.innerText.length / 2; \n var col1 = elem.innerText.substr... | 2008/10/06 | [
"https://Stackoverflow.com/questions/173934",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
173,980 | <p>There are numerous times you have an interface that accepts similar type arguments that have a separate domain logic meaning:</p>
<pre><code>public static class Database
{
public static bool HasAccess(string userId, string documentId) { return true; }
}
</code></pre>
<p>Now it's quite easy to have someone key documentId instead of userId and vice versa. One could prevent that by abstracting the data type of the arguments:</p>
<pre><code>public class UserId
{
public string Value { get; internal set; }
public static implicit operator string(UserId id) { return id.Value; }
}
public class DocumentId
{
public string Value { get; internal set; }
public static implicit operator string(DocumentId id) { return id.Value; }
}
public static class Database
{
public static bool HasAccess(UserId userId, DocumentId documentId) { return true; }
}
</code></pre>
<p>This way you get a nice compiler warning if you type in arguments out of order:</p>
<pre><code>UserId e = new UserId() { Value = "a" };
DocumentId d = new DocumentId() { Value = "b" };
Database.HasAccess(d, e);
</code></pre>
<p>You also get the ability to change abstracted type in without affecting the rest of the system but that's not very likely. Would abstracting type be a good idea to get more type safety?</p>
<p>The question relates to C# solutions but short descriptions in other languages is welcome.</p>
<p>EDIT: Removed the implicit cast from string and pointing finger at the C# tag.</p>
| [
{
"answer_id": 173994,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 2,
"selected": true,
"text": "string user = \"fred\";\nSomeMethodThatWantsADocument(user);\n"
}
] | 2008/10/06 | [
"https://Stackoverflow.com/questions/173980",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23164/"
] |
173,995 | <p>As a function argument I get a <code>vector<double>& vec</code> (an output vector, hence non-const) with unknown length and values. I want to initialise this vector to a specific length n with all zeroes.</p>
<p>This will work </p>
<pre><code>vec.clear();
vec.resize( n, 0.0 );
</code></pre>
<p>And this will work as well:</p>
<pre><code>vec.resize( n );
vec.assign( n, 0.0 );
</code></pre>
<p>Is the second more efficient (because no memory deallocation/allocation is involved)? Is there a more efficient way to do this? </p>
| [
{
"answer_id": 173998,
"author": "C. K. Young",
"author_id": 13,
"author_profile": "https://Stackoverflow.com/users/13",
"pm_score": 3,
"selected": false,
"text": "std::vector<double>(n).swap(vec);\n"
},
{
"answer_id": 174571,
"author": "James Hopkin",
"author_id": 11828,... | 2008/10/06 | [
"https://Stackoverflow.com/questions/173995",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19863/"
] |
174,005 | <p>I have an xml file providing data for a datagrid in Flex 2 that includes an unformatted Price field (ie: it is just a number).
Can anyone tell me how I take that datafield and format it - add a currency symbol, put in thousand separators etc.
Thanks.
S.</p>
| [
{
"answer_id": 174608,
"author": "JustLogic",
"author_id": 21664,
"author_profile": "https://Stackoverflow.com/users/21664",
"pm_score": 2,
"selected": true,
"text": "<mx:DataGridColumn id=\"dgc\" headerText=\"Money\" editable=\"false\">\n <mx:itemRenderer>\n <mx:Component>\n ... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174005",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25463/"
] |
174,013 | <p>My colleagues and I have tried to build a project containing several thousand classes , but we're getting a LNK1102 error ( Linker out of memory ) . I've seen several tips on the internet , such as increasing the virtual memory . We tried but this didn't help . We've also seen some as enabling different warning levels when compiling the code . A guy suggested enabling level 4 for warnings .
How could that be done ? Are there other suggestions ?</p>
| [
{
"answer_id": 8400618,
"author": "Gerrit",
"author_id": 1083582,
"author_profile": "https://Stackoverflow.com/users/1083582",
"pm_score": 3,
"selected": false,
"text": "\"*LINK : fatal error LNK1102: out of memory*\"\n"
},
{
"answer_id": 46573303,
"author": "Pablo H",
"a... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174013",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11234/"
] |
174,024 | <p>Consider the following method signatures:</p>
<pre><code>public fooMethod (Foo[] foos) { /*...*/ }
</code></pre>
<p>and</p>
<pre><code>public fooMethod (Foo... foos) { /*...*/ }
</code></pre>
<p><em>Explanation: The former takes an array of Foo-objects as an argument - <code>fooMethod(new Foo[]{..})</code> - while the latter takes an arbitrary amount of arguments of type Foo, and presents them as an array of Foo:s within the method - <code>fooMethod(fooObject1, fooObject2, etc...</code>).</em></p>
<p>Java throws a fit if both are defined, claiming that they are duplicate methods. I did some detective work, and found out that the first declaration really requires an explicit array of Foo objects, and that's the only way to call that method. The second way actually accepts both an arbitrary amount of Foo arguments AND also accepts an array of Foo objects.</p>
<p>So, the question is, since the latter method seems more flexible, are there any reasons to use the first example, or have I missed anything vital?</p>
| [
{
"answer_id": 174060,
"author": "TToni",
"author_id": 20703,
"author_profile": "https://Stackoverflow.com/users/20703",
"pm_score": 0,
"selected": false,
"text": "string Format(string formatString, object... args)\n"
},
{
"answer_id": 174067,
"author": "skaffman",
"autho... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174024",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2238/"
] |
174,025 | <p>How do you trigger a javascript function using actionscript in flash?</p>
<p>The goal is to trigger jQuery functionality from a flash movie</p>
| [
{
"answer_id": 174034,
"author": "jochil",
"author_id": 23794,
"author_profile": "https://Stackoverflow.com/users/23794",
"pm_score": 5,
"selected": true,
"text": "ExternalInterface.addCallback(\"sendToActionScript\", receivedFromJavaScript);\nExternalInterface.call(\"sendToJavaScript\",... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174025",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2908/"
] |
174,059 | <p>I'm developing a little project plan and I came to a point when I need to decide what local databse system to use.</p>
<p>The input data is going to be stored on webserver (hosting - MySQL DB). The idea is to build a process to download all necessary data (for example at midnight) and process them. However, there are going to be many inputs and stages of processing, so I need to use some kind of local database to store the semi-product of the application</p>
<p>What local database system would you recommend to work with C# (.NET) application?</p>
<p>edit: The final product (information) should be easily being exported back to Hosting MySQL DB.</p>
<p>As Will mentioned in his answer - yes, I'm for a performance AND comfort of use.</p>
| [
{
"answer_id": 174114,
"author": "Goran",
"author_id": 23164,
"author_profile": "https://Stackoverflow.com/users/23164",
"pm_score": 1,
"selected": false,
"text": "IList<Users> list = Persistence.Database.Query<Users>(u => u.Name == \"Admin\");\n"
}
] | 2008/10/06 | [
"https://Stackoverflow.com/questions/174059",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21209/"
] |
174,069 | <p>How can I, in Java or using some other programming language, add a new program group in the applications menu in both KDE and Gnome? </p>
<p>I am testing with Ubuntu and Kubuntu 8. Putting a simple .menu file in ~/.config/menus/applications-merged worked in Kubuntu, but the same procedure does nothing in Ubuntu.</p>
<p>The content of my file is as follows:</p>
<pre><code><!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN" "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd">
<Menu>
<Menu>
<Name>My Program Group</Name>
<Include>
<Filename>shortcut.desktop</Filename>
</Include>
</Menu>
</Menu>
</code></pre>
<p>Note that the .desktop file is correctly placed in ~/.local/share/applications.</p>
<p>Ps: The original question did not specify I wanted a solution in a programmatic way.</p>
| [
{
"answer_id": 174087,
"author": "oliver",
"author_id": 2148773,
"author_profile": "https://Stackoverflow.com/users/2148773",
"pm_score": 2,
"selected": true,
"text": "man xdg-desktop-menu"
},
{
"answer_id": 175169,
"author": "Thiago Chaves",
"author_id": 16873,
"auth... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174069",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16873/"
] |
174,093 | <p>Assuming I have an ArrayList</p>
<pre><code>ArrayList<MyClass> myList;
</code></pre>
<p>And I want to call toArray, is there a performance reason to use</p>
<pre><code>MyClass[] arr = myList.toArray(new MyClass[myList.size()]);
</code></pre>
<p>over</p>
<pre><code>MyClass[] arr = myList.toArray(new MyClass[0]);
</code></pre>
<p>?</p>
<p>I prefer the second style, since it's less verbose, and I assumed that the compiler will make sure the empty array doesn't really get created, but I've been wondering if that's true.</p>
<p>Of course, in 99% of the cases it doesn't make a difference one way or the other, but I'd like to keep a consistent style between my normal code and my optimized inner loops...</p>
| [
{
"answer_id": 174108,
"author": "Panagiotis Korros",
"author_id": 19331,
"author_profile": "https://Stackoverflow.com/users/19331",
"pm_score": 2,
"selected": false,
"text": "MyClass[] arr = myList.toArray(new MyClass[0]);\n"
},
{
"answer_id": 174146,
"author": "Georgi",
... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174093",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7581/"
] |
174,119 | <p>I see this often in the build scripts of projects that use autotools (autoconf, automake). When somebody wants to check the value of a shell variable, they frequently use this idiom:</p>
<pre><code>if test "x$SHELL_VAR" = "xyes"; then
...
</code></pre>
<p>What is the advantage to this over simply checking the value like this:</p>
<pre><code>if test $SHELL_VAR = "yes"; then
...
</code></pre>
<p>I figure there must be some reason that I see this so often, but I can't figure out what it is.</p>
| [
{
"answer_id": 174156,
"author": "Kent Fredric",
"author_id": 15614,
"author_profile": "https://Stackoverflow.com/users/15614",
"pm_score": 2,
"selected": false,
"text": "SHELLVAR=$(true)\nif test $SHELLVAR = \"yes\" ; then echo \"yep\" ; fi \n\n# bash: test: =: unary operator expected\... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174119",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/78437/"
] |
174,143 | <p>In SQL Server 2005, is there a way of deleting rows and being told how many were <strong>actually</strong> deleted? </p>
<p>I could do a <code>select count(*)</code> with the same conditions, but I need this to be utterly trustworthy. </p>
<p>My first guess was to use the <code>@@ROWCOUNT</code> variables - but that isn't set, e.g. </p>
<pre><code>delete
from mytable
where datefield = '5-Oct-2008'
select @@ROWCOUNT
</code></pre>
<p>always returns a 0. </p>
<p>MSDN suggests the <a href="http://msdn.microsoft.com/en-us/library/ms189835.aspx" rel="noreferrer"><code>OUTPUT</code></a> construction, e.g. </p>
<pre><code>delete from mytable
where datefield = '5-Oct-2008'
output datefield into #doomed
select count(*)
from #doomed
</code></pre>
<p>this actually fails with a syntax error. </p>
<p>Any ideas? </p>
| [
{
"answer_id": 174158,
"author": "wcm",
"author_id": 2173,
"author_profile": "https://Stackoverflow.com/users/2173",
"pm_score": 7,
"selected": true,
"text": "SET NOCOUNT OFF"
},
{
"answer_id": 174178,
"author": "Ilya Kochetov",
"author_id": 15329,
"author_profile": "... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174143",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2902/"
] |
174,153 | <p>In C#, does anybody know why the following will compile:</p>
<pre><code>int i = 1;
++i;
i++;
</code></pre>
<p>but this will not compile?</p>
<pre><code>int i = 1;
++i++;
</code></pre>
<p>(Compiler error: The operand of an increment or decrement operator must be a variable, property or indexer.)</p>
| [
{
"answer_id": 174160,
"author": "steffenj",
"author_id": 15328,
"author_profile": "https://Stackoverflow.com/users/15328",
"pm_score": -1,
"selected": false,
"text": "i += 2;\n"
},
{
"answer_id": 174182,
"author": "fluffels",
"author_id": 12828,
"author_profile": "ht... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174153",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1463/"
] |
174,155 | <p>Switch statement fallthrough is one of my personal major reasons for loving <code>switch</code> vs. <code>if/else if</code> constructs. An example is in order here:</p>
<pre><code>static string NumberToWords(int number)
{
string[] numbers = new string[]
{ "", "one", "two", "three", "four", "five",
"six", "seven", "eight", "nine" };
string[] tens = new string[]
{ "", "", "twenty", "thirty", "forty", "fifty",
"sixty", "seventy", "eighty", "ninety" };
string[] teens = new string[]
{ "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen",
"sixteen", "seventeen", "eighteen", "nineteen" };
string ans = "";
switch (number.ToString().Length)
{
case 3:
ans += string.Format("{0} hundred and ", numbers[number / 100]);
case 2:
int t = (number / 10) % 10;
if (t == 1)
{
ans += teens[number % 10];
break;
}
else if (t > 1)
ans += string.Format("{0}-", tens[t]);
case 1:
int o = number % 10;
ans += numbers[o];
break;
default:
throw new ArgumentException("number");
}
return ans;
}
</code></pre>
<p>The smart people are cringing because the <code>string[]</code>s should be declared outside the function: well, they are, this is just an example.</p>
<p>The compiler fails with the following error:</p>
<pre>
Control cannot fall through from one case label ('case 3:') to another
Control cannot fall through from one case label ('case 2:') to another
</pre>
<p>Why? And is there any way to get this sort of behaviour without having three <code>if</code>s?</p>
| [
{
"answer_id": 174183,
"author": "Biri",
"author_id": 968,
"author_profile": "https://Stackoverflow.com/users/968",
"pm_score": 3,
"selected": false,
"text": "switch (whatever)\n{\n case 1:\n case 2:\n case 3: boo; break;\n}\n"
},
{
"answer_id": 174191,
"author": "Co... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174155",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15537/"
] |
174,163 | <p>Is entity framework just a fancy name for another CRUD code generator?</p>
<p>Or is there more to it?</p>
| [
{
"answer_id": 174183,
"author": "Biri",
"author_id": 968,
"author_profile": "https://Stackoverflow.com/users/968",
"pm_score": 3,
"selected": false,
"text": "switch (whatever)\n{\n case 1:\n case 2:\n case 3: boo; break;\n}\n"
},
{
"answer_id": 174191,
"author": "Co... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174163",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
174,170 | <p>py2exe does not work with the standard email module</p>
<p>Hello. I am trying to use py2exe for converting a script into an exe. The build process shows this:</p>
<hr>
<p>The following modules appear to be missing</p>
<h2>['email.Encoders', 'email.Generator', 'email.Iterators', 'email.MIMEBase', 'email.MIMEMultipart', 'email.MIMEText', 'email.Utils', 'email.base64MIME']</h2>
<p>The executable does not work. The referenced modules are not included. I researched this on the Internet and I found out that py2exe has a problem with the Lazy import used in the standard lib email module. Unfortunately I have not succeeded in finding a workaround for this problem. Can anyone help?</p>
<p>Thank you,</p>
<p>P.S.
Imports in the script look like this:</p>
<p>Code: Select all
import string,time,sys,os,smtplib
from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email.MIMEText import MIMEText
from email import Encoders</p>
| [
{
"answer_id": 176305,
"author": "Tony Meyer",
"author_id": 4966,
"author_profile": "https://Stackoverflow.com/users/4966",
"pm_score": 2,
"selected": false,
"text": "import string,time,sys,os,smtplib\nfrom email.mime.multipart import MIMEMultipart\nfrom email.mime.base import MIMEBase\n... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174170",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15539/"
] |
174,174 | <p>Is Oracle Application Express suitable for Intranet client/server application?
If so, what should I do to enable client access to application?</p>
<hr>
<p>Well, I am working as a PowerBuilder/Oracle developer, so I am familiar with client/server architecture. I have recently read an article about APEX so I would like to develop APEX variation of my PowerBuilder/Oracle app, which is pretty much HR app. It should not be Internet accessible app, just a couple of windows boxes in a small network. I have no problem with developing app in PL/SQL and SQL (will have to read and ask a lot, though). I would just like to know is APEX suitable for Intranet app - it should be as it is suitable for Internet app :) - and how should I enable client's browser to access an application since there would be nothing like http:/www.appdomain.com ? I know next to nothing about win networks :)</p>
| [
{
"answer_id": 174420,
"author": "Tony Andrews",
"author_id": 18747,
"author_profile": "https://Stackoverflow.com/users/18747",
"pm_score": 0,
"selected": false,
"text": "http://www.mydomain.com/pls/mydad/f?p=MYAPP\n"
}
] | 2008/10/06 | [
"https://Stackoverflow.com/questions/174174",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4235/"
] |
174,190 | <p>I have a Rails application for project management where there are Project and Task models. A project can have many tasks, but a task can also have many tasks, ad infinitum.</p>
<p>Using nested resources, we can have /projects/1/tasks, /projects/1/tasks/new, /projects/1/tasks/3/edit etc.</p>
<p>However, how do you represent the recursive nature of tasks RESTfully? I don't want go another level deep, so perhaps the following would do:</p>
<pre><code>map.resources :tasks do |t|
t.resources :tasks
end
</code></pre>
<p>That would give me the following urls:</p>
<pre><code>/tasks/3/tasks/new
/tasks/3/tasks/45/edit
</code></pre>
<p>Or perhaps when it comes to an individual task I can just use /tasks/45/edit</p>
<p>Is this a reasonable design?</p>
<p>Cam</p>
| [
{
"answer_id": 175449,
"author": "Steropes",
"author_id": 21872,
"author_profile": "https://Stackoverflow.com/users/21872",
"pm_score": 2,
"selected": false,
"text": "belongs_to :project\nbelongs_to :parent, :class_name => \"Task\"\nhas_many :children, :class_name => \"Task\", :foreign_k... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174190",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25484/"
] |
174,193 | <p>I'm doing some architectural cleanup that involves moving a bunch of classes into different projects and/or namespaces. Currently I'm moving the files by hand, building, and then manually adding <em>using Foo</em> statements as needed to resolve compilation errors. Anyone know of a smarter way of doing this? (We're a CodeRush and Refactor! shop, but I'd be interested to hear if Resharper has support for this)</p>
| [
{
"answer_id": 41238746,
"author": "Gusdor",
"author_id": 286976,
"author_profile": "https://Stackoverflow.com/users/286976",
"pm_score": 3,
"selected": false,
"text": "MyCorp.AppStuff.Api"
}
] | 2008/10/06 | [
"https://Stackoverflow.com/questions/174193",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23632/"
] |
174,198 | <p>With the new approach of having the get/set within the attribut of the class like that :</p>
<pre><code>public string FirstName {
get; set;
}
</code></pre>
<p>Why simply not simply put the attribute FirstName public without accessor?</p>
| [
{
"answer_id": 174221,
"author": "Phil Wright",
"author_id": 6276,
"author_profile": "https://Stackoverflow.com/users/6276",
"pm_score": 0,
"selected": false,
"text": "public string FirstName { }\n"
},
{
"answer_id": 205567,
"author": "Jay Bazuzi",
"author_id": 5314,
... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174198",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21386/"
] |
174,225 | <p>I would like to write a small application that unlocks the workstation. To put the specs of what I need very simple: Have an exe that runs and at a defined time (let's say midnight) unlocks the workstation.
Of course the application knows the user and password of the logged on account.</p>
<p>I know of the LogonUser API and have tried using it but failed.
Does anyone have a solution, code excerpt that actually works for this issue?</p>
<p>I am targeting NT5 OSes.</p>
<hr>
<p>Well, since people started asking what is the reason: I am working on a desktop sharing application and I want to add the feature of unlocking the workstation. Having the very small and simple app to unlock the station at a defined time is in order to separate the problem and to avoid the integration details.</p>
| [
{
"answer_id": 7934209,
"author": "zomf",
"author_id": 175269,
"author_profile": "https://Stackoverflow.com/users/175269",
"pm_score": 0,
"selected": false,
"text": "tscon.exe 0 /dest:console\n"
}
] | 2008/10/06 | [
"https://Stackoverflow.com/questions/174225",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24873/"
] |
174,232 | <p>Basically I'm trying to accomplish the same thing that "mailto:bgates@microsoft.com" does in Internet Explorer Mobile.</p>
<p>But I want to be able to do it from a managed Windows Mobile application. I don't want to send an email pro grammatically in the background.</p>
<p>I want to be able to create the email in Pocket Outlook and then let the user do the rest.</p>
<p>Hopefully that helps you hopefully help me!</p>
| [
{
"answer_id": 174312,
"author": "Petros",
"author_id": 2812,
"author_profile": "https://Stackoverflow.com/users/2812",
"pm_score": 4,
"selected": true,
"text": "ProcessStartInfo psi = \n new ProcessStartInfo(\"mailto:bla@bla.com?subject=MySubject\", \"\");\nProcess.Start(psi);\n"
},
... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174232",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23294/"
] |
174,239 | <p>I have inherited a c# class 'Button' (which I can't change) which clashes with the BCL class 'Windows.Forms.Button'. Normally, Id be very happy to go:</p>
<pre><code>MyPackage.MyClass.Button;
</code></pre>
<p>But there are a large number or references to this class which is a pain to have to re-type.</p>
<p>Is there any way to get the compiler (linker?) to default to using the customised version of Button over the BCL version?</p>
| [
{
"answer_id": 174252,
"author": "Vincent McNabb",
"author_id": 16299,
"author_profile": "https://Stackoverflow.com/users/16299",
"pm_score": 2,
"selected": false,
"text": "using Windows.Forms;"
},
{
"answer_id": 174257,
"author": "Joel Coehoorn",
"author_id": 3043,
"... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174239",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1816/"
] |
174,248 | <p>Our customer would like to know <strong>who</strong> is online and currently using the custom application we wrote for them. I discussed it with them and this does not need to be <strong>exact</strong>, more of a guestimate will work. </p>
<p>So my thought is a 15 minute time interval to determine user activity. Some ideas I have for doing this are as follows:</p>
<ol>
<li><p>Stamp their user record with a date and time of their last activity every time they do something that hits the database, or requests a web page ... this though could be quite database intensive.</p></li>
<li><p>Send out a "who is online request" from our software, looking for responses, this could be done at a scheduled interval, and then stamp the user record with the current date and time for each response I received.</p></li>
</ol>
<p>What are your thoughts? And how would you handle this situation?</p>
<p><strong>Clarification</strong></p>
<p>I would like to use the same architecture for both Windows or the Web if possible. I have a single business logic layer that multiple user interfaces interact with, could be Windows or the Web.</p>
<p>By Windows I would mean client-server.</p>
<p><strong>Clarification</strong></p>
<p>I am using an n-tier architecture so my business objects handle all the interaction with the presentation layer. That presentation layer could be feeding a client-server Windows application, Web application, Web Service and so on. </p>
<p>It is not a high traffic application, as it was developed for a customer of ours, maybe 100 users at most.</p>
| [
{
"answer_id": 174310,
"author": "toolkit",
"author_id": 3295,
"author_profile": "https://Stackoverflow.com/users/3295",
"pm_score": 0,
"selected": false,
"text": "public class ActiveSessionsListener implements HttpSessionListener {\n public void sessionCreated(HttpSessionEvent e) {\n... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174248",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1768/"
] |
174,263 | <p>This may be simple one, but 5 mins of Googling didn't give me the answer.
How do you save and load bitmaps using .Net librabries?</p>
<p>I have an Image object and I need to save it to disk in some format (preferably png) and load back in later.
A C# example would be great.</p>
| [
{
"answer_id": 174279,
"author": "Vincent McNabb",
"author_id": 16299,
"author_profile": "https://Stackoverflow.com/users/16299",
"pm_score": 5,
"selected": true,
"text": "using System.Drawing;\n"
}
] | 2008/10/06 | [
"https://Stackoverflow.com/questions/174263",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1660/"
] |
174,285 | <p>When I open a solution in VS 2008, I don't want it to open all the files that I had open last time. I just want it to open the solution. Can't see a config option for this, is it possible?</p>
| [
{
"answer_id": 174307,
"author": "Bob Dizzle",
"author_id": 9581,
"author_profile": "https://Stackoverflow.com/users/9581",
"pm_score": 1,
"selected": false,
"text": "Private Sub SolutionEvents_BeforeClosing() Handles SolutionEvents.BeforeClosing\n DTE.ExecuteCommand(\"Window.CloseAll... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174285",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
174,292 | <p>The array has lots of data and I need to delete two elements. </p>
<p>Below is the code snippet I am using,</p>
<pre><code>my @array = (1,2,3,4,5,5,6,5,4,9);
my $element_omitted = 5;
@array = grep { $_ != $element_omitted } @array;
</code></pre>
| [
{
"answer_id": 174313,
"author": "SquareCog",
"author_id": 15962,
"author_profile": "https://Stackoverflow.com/users/15962",
"pm_score": 7,
"selected": true,
"text": "my $index = 0;\n$index++ until $arr[$index] eq 'foo';\nsplice(@arr, $index, 1);\n"
},
{
"answer_id": 174860,
... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174292",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21246/"
] |
174,308 | <p>Eclipse is a really great editor, which I prefer to use, but the GUI design tools for Eclipse are lacking. On the other hand, NetBeans works really well for GUI design. </p>
<p>Are there any tips, tricks or pitfalls for using NetBeans for GUI design and Eclipse for everything else on the same project?</p>
<p><strong>EDIT:</strong> I tried Maven, and it does not seem to work (too complex for my needs).</p>
| [
{
"answer_id": 1492065,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 4,
"selected": true,
"text": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<projectDescription>\n <name>MyProject</name>\n <comment></comment>\n <projects>\n... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174308",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17712/"
] |
174,309 | <p>I'm building an interface much like the built-in Weather application's flipside view, or the Alarms view of the Clock application in editing mode. The table view is always in editing mode, so the delete icon appears on the left side of each cell.</p>
<p>When the table view is in editing mode, my delegate doesn't receive <code>didSelectRowAtIndexPath</code> notifications. It receives <code>accessoryButtonTappedForRowWithIndexPath</code> notifications, but that's not what I want to do. I want my rows to stay selectable, even when the table view is in editing mode.</p>
<p>Any ideas on how I can accomplish this?</p>
<p>Thanks,</p>
<p>P.S. Hooray for the lifted NDA. =)</p>
| [
{
"answer_id": 174603,
"author": "millenomi",
"author_id": 6061,
"author_profile": "https://Stackoverflow.com/users/6061",
"pm_score": 8,
"selected": true,
"text": "table.allowsSelectionDuringEditing"
}
] | 2008/10/06 | [
"https://Stackoverflow.com/questions/174309",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2119/"
] |
174,319 | <p>What's the difference between the Enabled and the ReadOnly-properties of an asp:TextBox control?</p>
| [
{
"answer_id": 174328,
"author": "Adam Bellaire",
"author_id": 21632,
"author_profile": "https://Stackoverflow.com/users/21632",
"pm_score": 7,
"selected": true,
"text": "disabled"
},
{
"answer_id": 174338,
"author": "Corey Trager",
"author_id": 9328,
"author_profile"... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174319",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11682/"
] |
174,322 | <p>I would like to know how much disk space a directory is going to consume before I bring it over from the Perforce server. I don't see any way to do this other than getting the files and looking at the size of the directory in a file manager. This, of course, defeats the purpose. </p>
<p>Is there a way to get file size info from Perforce without actually getting the files?</p>
| [
{
"answer_id": 174335,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 2,
"selected": false,
"text": "p4 fstat"
}
] | 2008/10/06 | [
"https://Stackoverflow.com/questions/174322",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4228/"
] |
174,348 | <p>Will content requested over https still be cached by web browsers or do they consider this insecure behaviour? If this is the case is there anyway to tell them it's ok to cache?</p>
| [
{
"answer_id": 174485,
"author": "ConroyP",
"author_id": 2287,
"author_profile": "https://Stackoverflow.com/users/2287",
"pm_score": 8,
"selected": true,
"text": "max-age"
},
{
"answer_id": 174510,
"author": "MarkR",
"author_id": 13724,
"author_profile": "https://Stac... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174348",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21030/"
] |
174,349 | <p>By default, in C++, a single-argument constructor can be used as an implicit conversion operator. This can be suppressed by marking the constructor as explicit.</p>
<p>I'd prefer to make "explicit" be the default, so that the compiler cannot silently use these constructors for conversion.</p>
<p>Is there a way to do this in standard C++? Failing that, is there a pragma (or similar) that'll work in Microsoft C++ to do this? What about g++ (we don't use it, but it might be useful information)?</p>
| [
{
"answer_id": 174450,
"author": "MSalters",
"author_id": 15416,
"author_profile": "https://Stackoverflow.com/users/15416",
"pm_score": 1,
"selected": false,
"text": "<vector>"
}
] | 2008/10/06 | [
"https://Stackoverflow.com/questions/174349",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8446/"
] |
174,352 | <p>I currently have a DetailsView in ASP.NET that gets data from the database based on an ID passed through a QueryString. What I've been trying to do now is to then use that same ID in a new cookie that is created when a user clicks either a ButtonField or a HyperLinkField.</p>
<p>What I have in the .aspx is this:</p>
<pre><code><asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" DataKeyNames="ArtID"
DataSourceID="AccessDataSource1" Height="50px" Width="125px">
<Fields>
<asp:ImageField DataAlternateTextField="Title" DataImageUrlField="FileLocation">
</asp:ImageField>
<asp:BoundField DataField="ArtID" HeaderText="ArtID" InsertVisible="False" ReadOnly="True"
SortExpression="ArtID" />
<asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" />
<asp:BoundField DataField="ArtDate" HeaderText="ArtDate" SortExpression="ArtDate" />
<asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" />
<asp:BoundField DataField="FileLocation" HeaderText="FileLocation" SortExpression="FileLocation" />
<asp:BoundField DataField="Medium" HeaderText="Medium" SortExpression="Medium" />
<asp:BoundField DataField="Location" HeaderText="Location" SortExpression="Location" />
<asp:BoundField DataField="PageViews" HeaderText="PageViews" SortExpression="PageViews" />
<asp:HyperLinkField DataNavigateUrlFields="ArtID" DataNavigateUrlFormatString="Purchase.aspx?ArtID={0}"
NavigateUrl="Purchase.aspx" Text="Add To Cart" />
<asp:ButtonField ButtonType="Button" DataTextField="ArtID" Text="Add to Cart" CommandName="btnAddToCart_Click" />
</Fields>
</asp:DetailsView>
</code></pre>
<p>When using a reguler asp.net button such as:</p>
<pre><code><asp:Button ID="btnAddArt" runat="server" Text="Add To Cart" />
</code></pre>
<p>I would have something like this in the VB:</p>
<pre><code>Protected Sub btnAddArt_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAddArt.Click
Dim CartArtID As New HttpCookie("CartArtID")
CartArtID.Value = ArtID.DataField
CartArtID.Expires = Date.Today.AddDays(0.5)
Response.Cookies.Add(CartArtID)
Response.Redirect("Purchase.aspx")
End Sub
</code></pre>
<p>However, I can't figure out how I go about applying this to the ButtonField instead since the ButtonField does not allow me to give it an ID.</p>
<p>The ID that I need to add to the cookie is the ArtID in the first BoundField.</p>
<p>Any idea's/advice on how I would go about doing this are greatly appreciated!</p>
<p>Alternatively, if I could do it with the HyperLinkField or with the regular button, that would be just as good, but I'm having trouble using a regular button to access the ID within the DetailsView.</p>
<p>Thanks</p>
| [
{
"answer_id": 174957,
"author": "Dillie-O",
"author_id": 71,
"author_profile": "https://Stackoverflow.com/users/71",
"pm_score": 2,
"selected": true,
"text": "<asp:Button ID=\"btnAddArt\" CommandName=\"AddCard\" CommandArgument=\"[ArtID]\" runat=\"server\" Text=\"Add To Cart\" />\n"
}... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174352",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17020/"
] |
174,356 | <p>I'm tidying up some older code that uses 'magic numbers' all over the place to set hardware registers, and I would like to use constants instead of these numbers to make the code somewhat more expressive (in fact they will map to the names/values used to document the registers).</p>
<p>However, I'm concerned that with the volume of changes I might break the magic numbers. Here is a simplified example (the register set is more complex):</p>
<pre><code>const short mode0 = 0;
const short mode1 = 1;
const short mode2 = 2;
const short state0 = 0;
const short state1 = 4;
const short state2 = 8;
</code></pre>
<p>so instead of :</p>
<pre><code>set_register(5);
</code></pre>
<p>we have:</p>
<pre><code>set_register(state1|mode1);
</code></pre>
<p>What I'm looking for is a <strong>build time</strong> version of:</p>
<pre><code>ASSERT(5==(state1|mode1));
</code></pre>
<p><strong>Update</strong></p>
<p>@Christian, thanks for the quick response, I'm interested on a C / non-boost environment answer too because this is driver/kernel code.</p>
| [
{
"answer_id": 174378,
"author": "Alex B",
"author_id": 23643,
"author_profile": "https://Stackoverflow.com/users/23643",
"pm_score": 4,
"selected": false,
"text": "#define STATIC_ASSERT(x) \\\n do { \\\n const static char dummy[(x)?1:-1] = {0};\\\n } while(0)\n"
},
{
... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174356",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4071/"
] |
174,375 | <p>I am using my own db for phpbb3 forum, and I wish to insert some data from the forum into my own tables. Now, I can make my own connection and it runs my query but in trying to use the $db variable(which I think is what you're meant to use??) it gives me an error.</p>
<p>I would like someone to show me the bare bones which i insert my query into to be able to run it.</p>
| [
{
"answer_id": 174395,
"author": "Cetra",
"author_id": 15087,
"author_profile": "https://Stackoverflow.com/users/15087",
"pm_score": 1,
"selected": false,
"text": "include($phpbb_root_path . 'includes/db/mysql.' . $phpEx);\n\n$db = new dbal_mysql();\n// we're using bertie and bertiezilla... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174375",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25491/"
] |
174,380 | <p>Within a spring webflow, i need to implement a navigation bar that will allow to "step back" or resume the flow to one of the previous view.</p>
<p>For example :</p>
<ul>
<li>View 1 = login</li>
<li>View 2 = My informations</li>
<li>View 3 = My messages</li>
<li>View 4 = Close session</li>
</ul>
<p>For this example, i would like to return back to view 2 from the view 4 page.</p>
| [
{
"answer_id": 175279,
"author": "MetroidFan2002",
"author_id": 8026,
"author_profile": "https://Stackoverflow.com/users/8026",
"pm_score": 2,
"selected": false,
"text": "<view-state id=\"loginView\" view=\"login.jsp\">\n <action-state bean=\"someBean\" method=\"login\" />\n <trans... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174380",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25492/"
] |
174,381 | <p>I am trying to match floating-point decimal numbers with a regular expression. There may or may not be a number before the decimal, and the decimal may or may not be present, and if it is present it may or may not have digits after it. (For this application, a leading +/- or a trailing "E123" is not allowed). I have written this regex:</p>
<pre><code>/^([\d]*)(\.([\d]*))?$/
</code></pre>
<p>Which correctly matches the following:</p>
<pre><code>1
1.
1.23
.23
</code></pre>
<p>However, this also matches empty string or a string of just a decimal point, which I do not want.</p>
<p>Currently I am checking after running the regex that $1 or $3 has length greater than 0. If not, it is not valid. Is there a way I can do this directly in the regex?</p>
| [
{
"answer_id": 174392,
"author": "Andru Luvisi",
"author_id": 5922,
"author_profile": "https://Stackoverflow.com/users/5922",
"pm_score": 4,
"selected": true,
"text": "/^\\d+(\\.\\d*)?|\\.\\d+$/\n"
},
{
"answer_id": 174411,
"author": "tvanfosson",
"author_id": 12950,
... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174381",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18511/"
] |
174,387 | <p>I recently encountered an odd problem with <a href="http://msdn.microsoft.com/en-us/library/system.security.cryptography.rsacryptoserviceprovider.verifyhash.aspx" rel="noreferrer"><code>RSACryptoServiceProvider.VerifyHash</code></a>. </p>
<p>I have a web application using it for decryption. When users running the web service were doing so over our VPN it became very very slow. When they had no connection or a internet connection they were fine.</p>
<p>After much digging I found that every time <code>RSACryptoServiceProvider.VerifyHash</code> is called it makes an LDAP request to check <code>MyMachineName\ASPNET</code>.</p>
<p>This doesn't happen with our WebDev (cassini based) servers as they run as the current user, and it is only really slow over the VPN, but it shouldn't happen at all.</p>
<p>This seems wrong for a couple of reasons: </p>
<ul>
<li>Why is it checking the domain controller for a local machine user?</li>
<li>Why does it care? The encryption/decryption works regardless.</li>
</ul>
<p>Does anyone know why this occurs or how best to work around it?</p>
| [
{
"answer_id": 174482,
"author": "Keith",
"author_id": 905,
"author_profile": "https://Stackoverflow.com/users/905",
"pm_score": 1,
"selected": false,
"text": "rsa.VerifyHash( hashedData, CryptoConfig.MapNameToOID( \"SHA1\" ), signature );\n"
}
] | 2008/10/06 | [
"https://Stackoverflow.com/questions/174387",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/905/"
] |
174,393 | <p>This PHP code...</p>
<pre><code>207 if (getenv(HTTP_X_FORWARDED_FOR)) {
208 $ip = getenv('HTTP_X_FORWARD_FOR');
209 $host = gethostbyaddr($ip);
210 } else {
211 $ip = getenv('REMOTE_ADDR');
212 $host = gethostbyaddr($ip);
213 }
</code></pre>
<p>Throws this warning...</p>
<blockquote>
<p><strong>Warning:</strong> gethostbyaddr()
[function.gethostbyaddr]: Address is
not in a.b.c.d form in <strong>C:\inetpub...\filename.php</strong> on line <strong>212</strong></p>
</blockquote>
<p>It seems that <em>$ip</em> is blank.</p>
| [
{
"answer_id": 174422,
"author": "Vinko Vrsalovic",
"author_id": 5190,
"author_profile": "https://Stackoverflow.com/users/5190",
"pm_score": 2,
"selected": false,
"text": "$_SERVER['REMOTE_ADDR'] \n"
},
{
"answer_id": 174425,
"author": "fly.floh",
"author_id": 25442,
... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174393",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/83/"
] |
174,394 | <p>I've got a question concerning fields in databases which are measures that might be displayed in different units but are stored only in one, such as "height", for example.</p>
<p>Where should the "pattern unit" be stated?. Of course, in the documentation, etc... But we all know nobody reads the documentation and that self-documented things are preferable.</p>
<p>From a practical point of view, what do you think of coding it in the database field (such as height_cm for example)?.</p>
<p>I find this weird at a first look, but I find it practical to avoid any mistakes when different people deal with the database directly and the "pattern unit" will never change.</p>
<p>What do you think?</p>
| [
{
"answer_id": 174434,
"author": "Liam",
"author_id": 18333,
"author_profile": "https://Stackoverflow.com/users/18333",
"pm_score": 2,
"selected": false,
"text": "COMMENT ON COLUMN my_table.my_column IS 'cm';\n"
},
{
"answer_id": 174437,
"author": "Galwegian",
"author_id"... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174394",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15546/"
] |
174,403 | <p>In my vb.net program, I am using a webbrowser to show the user an HTML preview. I was previously hitting a server to grab the HTML, then returning on an asynchronous thread and raising an event to populate the WebBrowser.DocumentText with the HTML string I was returning.</p>
<p>Now I set it up to grab all of the information on the client, without ever having to hit the server, and I'm trying to raise the same event. I watch the code go through, and it has the HTML string correct and everything, but when I try to do</p>
<pre><code>browser.DocumentText = _emailHTML
</code></pre>
<p>the contents of DocumentText remain as "<code><HTML></HTML></code>"</p>
<p>I was just wondering why the DocumentText was not being set. Anyone have any suggestions?</p>
| [
{
"answer_id": 174483,
"author": "David Mohundro",
"author_id": 4570,
"author_profile": "https://Stackoverflow.com/users/4570",
"pm_score": 7,
"selected": true,
"text": "browser.Navigate(\"about:blank\");\nHtmlDocument doc = browser.Document;\ndoc.Write(String.Empty);\nbrowser.DocumentTe... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174403",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13244/"
] |
174,412 | <p>I'm having trouble figuring out how to access a cookie from a compiled object. I'm trying to make a compiled (DLL) object that will check the users cookie and then compare that to a database to confirm they have the correct access. </p>
<p>I can pass in the cookie info fine and the component will work, but I'm trying to have the component check the users cookie as well. I'm not even sure what object to use. I've been searching all weekend and I've seen references to httprequest, httpcookie, cookie, and cookiecollection. </p>
<p>I can look up cookie values on the page itself using Request.Cookies("inet")("user_id") but this doesn't work in the component. </p>
| [
{
"answer_id": 174427,
"author": "martin",
"author_id": 8421,
"author_profile": "https://Stackoverflow.com/users/8421",
"pm_score": 3,
"selected": true,
"text": "HttpCookie cookie = HttpContext.Current.Request.Cookies[\"CookieName\"];\n"
}
] | 2008/10/06 | [
"https://Stackoverflow.com/questions/174412",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9581/"
] |
174,418 | <p>I've written a little script to iterate across files in folders to count lines of code.</p>
<p>The heart of the script is this function to count lines of whitespace, comments, and code. (Note that for the moment it is tailored to C# and doesn't know about multi-line comments).</p>
<p>It just doesn't look very nice to me - has anyone got a cleaner version?</p>
<pre><code>// from list of strings return tuple with count of (whitespace, comments, code)
let loc (arr:List<string>) =
let innerloc (whitesp, comment, code) (l:string) =
let s = l.Trim([|' ';'\t'|]) // remove leading whitespace
match s with
| "" -> (whitesp + 1, comment, code) //blank lines
| "{" -> (whitesp + 1, comment, code) //opening blocks
| "}" -> (whitesp + 1, comment, code) //closing blocks
| _ when s.StartsWith("#") -> (whitesp + 1, comment, code) //regions
| _ when s.StartsWith("//") -> (whitesp, comment + 1, code) //comments
| _ -> (whitesp, comment, code + 1)
List.fold_left innerloc (0,0,0) arr
</code></pre>
| [
{
"answer_id": 174928,
"author": "Brian",
"author_id": 19299,
"author_profile": "https://Stackoverflow.com/users/19299",
"pm_score": 3,
"selected": true,
"text": "type Line =\n | Whitespace = 0\n | Comment = 1\n | Code = 2\nlet Classify (l:string) = \n let s = l.TrimS... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174418",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11410/"
] |
174,430 | <p>I decided to use <a href="http://logging.apache.org/log4net/index.html" rel="noreferrer">log4net</a> as a logger for a new webservice project. Everything is working fine, but I get a lot of messages like the one below, for every log4net tag I am using in my <code>web.config</code>:</p>
<blockquote>
<p>Could not find schema information for
the element 'log4net'...</p>
</blockquote>
<p>Below are the relevant parts of my <code>web.config</code>:</p>
<pre class="lang-xml prettyprint-override"><code> <configSections>
<section name="log4net"
type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
<log4net>
<appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="C:\log.txt" />
<appendToFile value="true" />
<rollingStyle value="Size" />
<maxSizeRollBackups value="10" />
<maximumFileSize value="100KB" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level: %message%newline" />
</layout>
</appender>
<logger name="TIMServerLog">
<level value="DEBUG" />
<appender-ref ref="RollingFileAppender" />
</logger>
</log4net>
</code></pre>
<p>Solved:</p>
<ol>
<li>Copy every log4net specific tag to a separate <code>xml</code>-file. Make sure to use <code>.xml</code> as file extension.</li>
<li>Add the following line to <code>AssemblyInfo.cs</code>:</li>
</ol>
<pre class="lang-cs prettyprint-override"><code>[assembly: log4net.Config.XmlConfigurator(ConfigFile = "xmlFile.xml", Watch = true)]
</code></pre>
<p><a href="https://stackoverflow.com/users/20774/nemo">nemo</a> added:</p>
<blockquote>
<p>Just a word of warning to anyone
follow the advice of the answers in
this thread. There is a possible
security risk by having the log4net
configuration in an xml off the root
of the web service, as it will be
accessible to anyone by default. Just
be advised if your configuration
contains sensitive data, you may want
to put it else where.</p>
</blockquote>
<hr>
<p>@wcm: I tried using a separate file. I added the following line to <code>AssemblyInfo.cs</code></p>
<pre class="lang-cs prettyprint-override"><code>[assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config", Watch = true)]
</code></pre>
<p>and put everything dealing with log4net in that file, but I still get the same messages.</p>
| [
{
"answer_id": 176119,
"author": "steve_mtl",
"author_id": 178,
"author_profile": "https://Stackoverflow.com/users/178",
"pm_score": 5,
"selected": true,
"text": "[assembly: log4net.Config.XmlConfigurator(ConfigFile = \"log4net.xml\", Watch = true)]\n"
},
{
"answer_id": 177500,
... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174430",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11387/"
] |
174,438 | <p>I have two tables, <strong>Book</strong> and <strong>Tag</strong>, and books are tagged using the association table <strong>BookTag</strong>. I want to create a report that contains a list of books, and for each book a list of the book's tags. Tag IDs will suffice, tag names are not necessary.</p>
<p>Example:</p>
<pre><code>Book table:
Book ID | Book Name
28 | Dracula
BookTag table:
Book ID | Tag ID
28 | 101
28 | 102
</code></pre>
<p>In my report, I'd like to show that book #28 has the tags 101 and 102:</p>
<pre><code>Book ID | Book Name | Tags
28 | Dracula | 101, 102
</code></pre>
<p>Is there a way to do this in-line, without having to resort to functions or stored procedures? I am using SQL Server 2005.</p>
<p><em>Please note that the same question already has been asked in <a href="https://stackoverflow.com/questions/111341/combine-multiple-results-in-a-subquery-into-a-single-comma-separated-value">Combine multiple results in a subquery into a single comma-separated value</a>, but the solution involves creating a function. I am asking if there is a way to solve this without having to create a function or a stored procedure.</em></p>
| [
{
"answer_id": 174568,
"author": "Darrel Miller",
"author_id": 6819,
"author_profile": "https://Stackoverflow.com/users/6819",
"pm_score": 3,
"selected": true,
"text": "SELECT em.Code,\n (SELECT et.Name + ' ' AS 'data()'\n FROM tblEmployeeTag et\n JOIN tblEmployeeTa... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174438",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6120/"
] |
174,446 | <p>I have about 200 Excel files that are in standard Excel 2003 format. </p>
<p>I need them all to be saved as Excel xml - basically the same as opening each file and choosing <strong>Save As...</strong> and then choosing <strong>Save as type:</strong> <em>XML Spreadsheet</em></p>
<p>Would you know any simple way of automating that task?</p>
| [
{
"answer_id": 174587,
"author": "Duncan Smart",
"author_id": 1278,
"author_profile": "https://Stackoverflow.com/users/1278",
"pm_score": 2,
"selected": false,
"text": "Sub SaveAllAsXml()\n Dim wbk As Workbook\n For Each wbk In Application.Workbooks\n wbk.SaveAs FileFormat:=... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174446",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3241/"
] |
174,449 | <p>Unquestionably, I would choose to use the STL for most C++ programming projects. The question was presented to me recently however, "Are there any cases where you wouldn't use the STL?"...</p>
<p>The more I thought about it, the more I realized that perhaps there SHOULD be cases where I choose not to use the STL... For example, a really large, long term project whose codebase is expected to last years... Perhaps a custom container solution that precisely fits the projects needs is worth the initial overhead? What do you think, are there any cases where you would choose NOT to STL?</p>
| [
{
"answer_id": 44783029,
"author": "Adrian Maire",
"author_id": 903651,
"author_profile": "https://Stackoverflow.com/users/903651",
"pm_score": 2,
"selected": false,
"text": "[] operator"
}
] | 2008/10/06 | [
"https://Stackoverflow.com/questions/174449",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3886/"
] |
174,458 | <p>There is <a href="https://stackoverflow.com/questions/134698/catching-exceptions-as-expected-program-execution-flow-control">an interesting post over here</a> about this, in relation to cross-application flow of control. </p>
<p>Well, recently, I've come across an interesting problem. Generating the nth value in a potentially (practically) endless recursive sequence. This particular algorithm WILL be in atleast 10-15 stack references deep at the point that it succeeds. My first thought was to throw a SuccessException that looked something like this (C#):</p>
<pre><code>class SuccessException : Exception
{
public string Value
{ get; set; }
public SuccessException(string value)
: base()
{
Value = value;
}
}
</code></pre>
<p>Then do something like this:</p>
<pre><code>try
{
Walk_r(tree);
}
catch (SuccessException ex)
{
result = ex.Value;
}
</code></pre>
<p>Then my thoughts wandered back here, where I've heard over and over to never use Exceptions for flow control. Is there ever an excuse? And how would you structure something like this, if you were to implement it?</p>
| [
{
"answer_id": 174513,
"author": "Robin",
"author_id": 21925,
"author_profile": "https://Stackoverflow.com/users/21925",
"pm_score": 1,
"selected": false,
"text": "try\n{\n Walk_r(tree);\n}\ncatch (SuccessException ex)\n{\n result = ex.Value;\n}\n"
}
] | 2008/10/06 | [
"https://Stackoverflow.com/questions/174458",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15537/"
] |
174,472 | <p>I have a bunch of java files from which I want to remove the javadoc lines with the license [am changing it on my code].</p>
<p>The pattern I am looking for is</p>
<p><code>^\* \* ProjectName .* USA\.$</code> </p>
<p>but matched across lines</p>
<p>Is there a way sed [or a commonly used editor in Windows/Linux] can do a search/replace for a multiline pattern?</p>
| [
{
"answer_id": 174541,
"author": "Pete",
"author_id": 13472,
"author_profile": "https://Stackoverflow.com/users/13472",
"pm_score": 0,
"selected": false,
"text": "/\\*(?:.|[\\r\\n])*?\\*/\nperl -0777ne 'print m!/\\*(?:.|[\\r\\n])*?\\*/!g;' <file>\n"
},
{
"answer_id": 26301655,
... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174472",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20386/"
] |
174,502 | <p>Seeing as Java doesn't have nullable types, nor does it have a TryParse(),
how do you handle input validation without throwing an exceptions?</p>
<p>The usual way:</p>
<pre><code>String userdata = /*value from gui*/
int val;
try
{
val = Integer.parseInt(userdata);
}
catch (NumberFormatException nfe)
{
// bad data - set to sentinel
val = Integer.MIN_VALUE;
}
</code></pre>
<p>I could use a regex to check if it's parseable, but that seems like a lot of overhead as well.</p>
<p>What's the best practice for handling this situation?</p>
<p>EDIT: Rationale:
There's been a lot of talk on SO about exception handling, and the general attitude is that exceptions should be used for unexpected scenarios only. However, I think bad user input is EXPECTED, not rare. Yes, it really is an academic point.</p>
<p>Further Edits: </p>
<p>Some of the answers demonstrate exactly what is wrong with SO. You ignore the question being asked, and answer another question that has nothing to do with it. The question isn't asking about transition between layers. The question isn't asking what to return if the number is un-parseable. For all you know, val = Integer.MIN_VALUE; is exactly the right option for the application that this completely context free code snippet was take from.</p>
| [
{
"answer_id": 174558,
"author": "Grant Wagner",
"author_id": 9254,
"author_profile": "https://Stackoverflow.com/users/9254",
"pm_score": 3,
"selected": false,
"text": "Utilities.tryParseInt(String value)"
},
{
"answer_id": 174644,
"author": "mjlee",
"author_id": 2829,
... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174502",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18907/"
] |
174,516 | <p>I have a table that records a sequence of actions with a field that records the sequence order:</p>
<pre><code>user data sequence
1 foo 0
1 bar 1
1 baz 2
2 foo 0
3 bar 0
3 foo 1
</code></pre>
<p>Selecting the first item for each user is easy enough with WHERE sequence = '0' but is there a way to select the last item for each user in SQL?</p>
<p>The result I am after should look like this:</p>
<pre><code>user data sequence
1 baz 2
2 foo 0
3 foo 1
</code></pre>
<p>I'm using MySQL if there are any implementation specific tricksters answering.</p>
| [
{
"answer_id": 174537,
"author": "Keith",
"author_id": 905,
"author_profile": "https://Stackoverflow.com/users/905",
"pm_score": 4,
"selected": true,
"text": "select a.user, a.data, a.sequence\nfrom table as a\n inner join (\n select user, max(sequence) as 'last'\n from ... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174516",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11651/"
] |
174,531 | <p>What is the simplest way (least error-prone, least lines of code, however you want to interpret it) to open a file in C and read its contents into a string (char*, char[], whatever)?</p>
| [
{
"answer_id": 174552,
"author": "Nils Pipenbrinck",
"author_id": 15955,
"author_profile": "https://Stackoverflow.com/users/15955",
"pm_score": 8,
"selected": true,
"text": "char * buffer = 0;\nlong length;\nFILE * f = fopen (filename, \"rb\");\n\nif (f)\n{\n fseek (f, 0, SEEK_END);\n ... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174531",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/422/"
] |
174,532 | <p>I recently inherited a database on which one of the tables has the primary key composed of encoded values (Part1*1000 + Part2).<br>
I normalized that column, but I cannot change the old values.
So now I have</p>
<pre><code>select ID from table order by ID
ID
100001
100002
101001
...
</code></pre>
<p>I want to find the "holes" in the table (more precisely, the first "hole" after 100000) for new rows.<br>
I'm using the following select, but is there a better way to do that?</p>
<pre><code>select /* top 1 */ ID+1 as newID from table
where ID > 100000 and
ID + 1 not in (select ID from table)
order by ID
newID
100003
101029
...
</code></pre>
<p>The database is Microsoft SQL Server 2000. I'm ok with using SQL extensions.</p>
| [
{
"answer_id": 174561,
"author": "Santiago Palladino",
"author_id": 12791,
"author_profile": "https://Stackoverflow.com/users/12791",
"pm_score": 4,
"selected": false,
"text": "SELECT (ID+1) FROM table AS t1\nLEFT JOIN table as t2\nON t1.ID+1 = t2.ID\nWHERE t2.ID IS NULL\n"
},
{
... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174532",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25324/"
] |
174,560 | <p>How can you depend on test code from another module in Maven? </p>
<p>Example, I have 2 modules:</p>
<ul>
<li>Base</li>
<li>Main</li>
</ul>
<p>I would like a test case in Main to extend a base test class in Base. Is this possible?</p>
<p>Update: Found an <a href="https://stackoverflow.com/questions/174560/sharing-test-code-in-maven#174670">acceptable answer</a>, which involves creating a test jar.</p>
| [
{
"answer_id": 174572,
"author": "Steve Moyer",
"author_id": 17008,
"author_profile": "https://Stackoverflow.com/users/17008",
"pm_score": -1,
"selected": false,
"text": "<dependency>\n <groupId>BaseGroup</groupId>\n <artifactId>Base</artifactId>\n <version>0.1.0-SNAPSHOT</versi... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174560",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12880/"
] |
174,570 | <p>I have the following code in one of my aspx pages:</p>
<pre><code><% foreach (Dependency dep in this.Common.GetDependencies(this.Request.QueryString["Name"]))
{ %>
<ctl:DependencyEditor DependencyKey='<%= dep.Key %>' runat="server" />
<% } %>
</code></pre>
<p>When I run it, I get the following error: <pre><strong>Parser Error Message:</strong> Cannot create an object of type 'System.Guid' from its string representation '<%= dep.Key %>' for the 'DependencyKey' property.</pre></p>
<p>Is there any way that I can create a control and pass in a Guid in the aspx page? I'd really hate to have to loop through and create these controls in the code behind just because of that...</p>
<p>NOTE: The Key property on the Dependency object <em>is</em> a Guid.</p>
| [
{
"answer_id": 464127,
"author": "CRice",
"author_id": 55693,
"author_profile": "https://Stackoverflow.com/users/55693",
"pm_score": 0,
"selected": false,
"text": " <ctl:DependencyEditor DependencyKey=\"<%= new Guid(dep.Key) %>\" runat=\"server\" />\n"
}
] | 2008/10/06 | [
"https://Stackoverflow.com/questions/174570",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3226/"
] |
174,582 | <p>If I wish to simply rename a column (not change its type or constraints, just its name) in an SQL database using SQL, how do I do that? Or is it not possible?</p>
<p>This is for any database claiming to support SQL, I'm simply looking for an SQL-specific query that will work regardless of actual database implementation.</p>
| [
{
"answer_id": 174586,
"author": "Galwegian",
"author_id": 3201,
"author_profile": "https://Stackoverflow.com/users/3201",
"pm_score": 7,
"selected": false,
"text": "sp_rename"
},
{
"answer_id": 174632,
"author": "bortzmeyer",
"author_id": 15625,
"author_profile": "ht... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174582",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8026/"
] |
174,595 | <p>What is the difference between <code>ROWNUM</code> and <code>ROW_NUMBER</code> ? </p>
| [
{
"answer_id": 174628,
"author": "Tony Andrews",
"author_id": 18747,
"author_profile": "https://Stackoverflow.com/users/18747",
"pm_score": 6,
"selected": true,
"text": "SQL> select rownum, ename, deptno\n 2 from emp;\n\n ROWNUM ENAME DEPTNO\n---------- ---------- ---------... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174595",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9581/"
] |
174,598 | <p>I am trying to get in place editing working but I am running into this error:</p>
<p>ActionController::InvalidAuthenticityToken (ActionController::InvalidAuthenticityToken)</p>
<p>I understand that rails now wants to protect against forgery and that I need to pass a form authenticity token but I am not clear on how to do this with the in_place_edit plugin.</p>
| [
{
"answer_id": 174754,
"author": "Avdi",
"author_id": 20487,
"author_profile": "https://Stackoverflow.com/users/20487",
"pm_score": 2,
"selected": false,
"text": ":with"
}
] | 2008/10/06 | [
"https://Stackoverflow.com/questions/174598",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6805/"
] |
174,600 | <p>In SQL Server 2005, is there a way for a trigger to find out what object is responsible for firing the trigger? I would like to use this to disable the trigger for one stored procedure.</p>
<p>Is there any other way to disable the trigger only for the current transaction? I could use the following code, but if I'm not mistaken, it would affect concurrent transactions as well - which would be a bad thing.</p>
<pre><code>DISABLE TRIGGER { [ schema_name . ] trigger_name [ ,...n ] | ALL } ON { object_name | DATABASE | ALL SERVER } [ ; ]
ENABLE TRIGGER { [ schema_name . ] trigger_name [ ,...n ] | ALL } ON { object_name | DATABASE | ALL SERVER } [ ; ]
</code></pre>
<p>If possible, I would like to avoid the technique of having a "NoTrigger" field in my table and doing a <code>NoTrigger = null</code>, because I would like to keep the table as small as possible.</p>
<p>The reason I would like to avoid the trigger is because it contains logic that is important for manual updates to the table, but my stored procedure will take care of this logic. Because this will be a highly used procedure, I want it to be fast.</p>
<blockquote>
<p>Triggers impose additional overhead on the server because they initiate an implicit transaction. As soon as a trigger is executed, a new implicit transaction is started, and any data retrieval within a transaction will hold locks on affected tables.</p>
</blockquote>
<p>From: <a href="http://searchsqlserver.techtarget.com/tip/1,289483,sid87_gci1170220,00.html#trigger" rel="nofollow noreferrer">http://searchsqlserver.techtarget.com/tip/1,289483,sid87_gci1170220,00.html#trigger</a></p>
| [
{
"answer_id": 178192,
"author": "Cade Roux",
"author_id": 18255,
"author_profile": "https://Stackoverflow.com/users/18255",
"pm_score": 7,
"selected": true,
"text": "USE AdventureWorks; \nGO \n-- creating the table in AdventureWorks database \nIF OBJECT_ID('dbo.Table1') IS NOT NULL ... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174600",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/357/"
] |
174,612 | <p>On a cross platform c/c++ project (Win32, Linux, OSX), I need to use the *printf functions to print some variables of type size_t. In some environments size_t's are 8 bytes and on others they are 4. On glibc I have %zd, and on Win32 I can use <a href="http://msdn.microsoft.com/en-us/library/tcxf1dw6.aspx" rel="noreferrer">%Id</a>. Is there an elegant way to handle this?</p>
| [
{
"answer_id": 174674,
"author": "tzot",
"author_id": 6899,
"author_profile": "https://Stackoverflow.com/users/6899",
"pm_score": 3,
"selected": false,
"text": "#ifdef __WIN32__ // or whatever\n#define SSIZET_FMT \"%ld\"\n#else\n#define SSIZET_FMT \"%zd\"\n#endif\n"
},
{
"answer_... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174612",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23524/"
] |
174,633 | <p>My regular expression needs to be able to find the strings:</p>
<ol>
<li>Visual Studio 2008</li>
<li>Visual Studio Express 2008</li>
<li>Visual Basic 2008</li>
<li>Visual Basic Express 2008</li>
<li>Visual C++ 2008</li>
<li>Visual C++ Express 2008</li>
</ol>
<p>and a host of other similar variants, to be replaced with this one single string</p>
<blockquote>
<p>Visual Studio 2005</p>
</blockquote>
<p>I tried "Visual (Basic|C++|Studio) (Express)? 2008", but it is not working. Any ideas?</p>
<p><strong><em>Edit</strong>:
Now I have tried "Visual (Basic)|(C++)|(Studio) (Express )?2008", but the replaced line becomes "Visual Studio 2005 Express 2008" for the input "Visual Basic Express 2008".</em> </p>
| [
{
"answer_id": 174660,
"author": "Chris Marasti-Georg",
"author_id": 96,
"author_profile": "https://Stackoverflow.com/users/96",
"pm_score": 2,
"selected": false,
"text": "\"Visual (Basic|C\\+\\+|Studio) (Express )?2008\"\n"
},
{
"answer_id": 174665,
"author": "Matt Price",
... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174633",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3834/"
] |
174,659 | <p>I'm writing a little tile-based game, for which I'd like to support light sources. But my algorithm-fu is too weak, hence I come to you for help.</p>
<p>The situation is like this: There is a tile-based map (held as a 2D array), containing a single light source and several items standing around. I want to calculate which tiles are lit up by the light source, and which are in shadow.</p>
<p>A visual aid of what it would look like, approximately. The L is the light source, the Xs are items blocking the light, the 0s are lit tiles, and the -s are tiles in shadow.</p>
<pre><code>0 0 0 0 0 0 - - 0
0 0 0 0 0 0 - 0 0
0 0 0 0 0 X 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 0 L 0 0 0 0
0 0 0 0 0 0 0 0 0
0 0 0 X X X X 0 0
0 0 0 - - - - - 0
0 0 - - - - - - -
</code></pre>
<p>A fractional system would be even better, of course, where a tile can be in half-shadow due to being partially obscured. The algorithm wouldn't have to be perfect - just not obviously wrong and reasonably fast.</p>
<p>(Of course, there would be multiple light sources, but that's just a loop.)</p>
<p>Any takers?</p>
| [
{
"answer_id": 175004,
"author": "easeout",
"author_id": 10906,
"author_profile": "https://Stackoverflow.com/users/10906",
"pm_score": 2,
"selected": false,
"text": "- - - - -\n- X X X -\n- X X - -\n- X - - -\n- - - - L\n"
},
{
"answer_id": 497739,
"author": "DShook",
"au... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174659",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15255/"
] |
174,662 | <p>I hope this isn't considered a duplicate since it's more pointed than similar questions (I'm curious about a specific weakness in C# to VB.net conversion utilities).</p>
<p>I've been looking at using a tool like this <a href="http://www.developerfusion.com/tools/convert/csharp-to-vb/" rel="nofollow noreferrer">.net code converter</a> to convert a class library to VB since I'm the only one in my group comfortable with C#. The problem I've run into is that it doesn't generate proper VB for automatic properties. It creates empty get/set routines. </p>
<p>So this:</p>
<pre><code>public string TransactionType { get; private set; }
</code></pre>
<p>Becomes this:</p>
<pre><code>Public Property TransactionType() As String
Get
End Get
Private Set(ByVal value As String)
End Set
End Property
</code></pre>
<p>The tools linked <a href="https://stackoverflow.com/questions/102956/c-vbnet-conversion" title="here">here</a> and <a href="https://stackoverflow.com/questions/88359/what-is-the-best-c-to-vbnet-converter">here</a> have similar issues - some create valid properties, but they don't respect the access level of the set routine.</p>
<p>Side question - If you were going to fix the converter on DeveloperFusion, would you have it return something like this?</p>
<pre><code>Private _TransactionType As String
Public Property TransactionType() As String
Get
Return _TransactionType
End Get
Private Set(ByVal value As String)
_TransactionType = value
End Set
End Property
</code></pre>
| [
{
"answer_id": 209425,
"author": "Jaykul",
"author_id": 8718,
"author_profile": "https://Stackoverflow.com/users/8718",
"pm_score": 2,
"selected": false,
"text": "Property TransactionType As String\n Public Get\n Private Set(ByVal value As String)\nEnd Property\n"
}
] | 2008/10/06 | [
"https://Stackoverflow.com/questions/174662",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8513/"
] |
174,664 | <p>I need to evaluate a mathmatical expression that is presented to me as a string in C#. Example noddy but gets the point across that the string as the expression.</p>
<p>I need the evaluate to then populate an int.</p>
<p>There is no Eval() in C# like in others langugaes...</p>
<pre><code>String myString = "3*4";
</code></pre>
<p>Edit:</p>
<p>I am on VS2008 </p>
<p>Tried the Microsoft.JScript. = Its deprecated method (but still complies - warning)</p>
<p>However the Microsoft.JScript dll that I have doens work on </p>
<blockquote>
<p>public object InvokeMember(string
name, BindingFlags invokeAttr, Binder
binder, object target, object[] args);</p>
</blockquote>
<p>Complains that there is a missing ";" go figure...</p>
<p>EDIT 2</p>
<p>Solution - was the codeDom one - it worked for as there are no security issue - only me ever going to be running the code. Many thanks for the replies ...</p>
<p>And the link to the new Dragon Book awesome </p>
<p>EDIT 3</p>
<p>Matt dataTable.Compute() also works - even better for the security conscious. (parameter checking noted)</p>
| [
{
"answer_id": 175262,
"author": "Matt Crouch",
"author_id": 1670022,
"author_profile": "https://Stackoverflow.com/users/1670022",
"pm_score": 5,
"selected": false,
"text": " DataTable dummy = new DataTable();\n Console.WriteLine(dummy.Compute(\"15 / 3\",string.Empty));\n"
... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174664",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
174,702 | <p>After Visual Studio 2005 displays the splash screen it locks up on me. No error, no cpu utilization, just a frozen splash screen. I've tried it in both /safemode and /resetsettings</p>
<p>I'm sure it's one of the services on my machine, just wonder if anyone else has had the problem and can help me with the hunt?</p>
<p>BTW, it's works in a VM in the same machine.</p>
<p>Update: I finally tried something new, I started VS2005 in Windows compatibility 2000 mode, it starts then shuts down immediately. I reset it to not run in compatibility mode and it starts right up. grrrrr</p>
<p>I think it might be a profile issue, but the root cause is still unresolved.</p>
| [
{
"answer_id": 889430,
"author": "sean e",
"author_id": 103912,
"author_profile": "https://Stackoverflow.com/users/103912",
"pm_score": 0,
"selected": false,
"text": "devenv.exe /Log c:\\vs.log\n"
}
] | 2008/10/06 | [
"https://Stackoverflow.com/questions/174702",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4230/"
] |
174,705 | <p>We have TFS 2008 our build set up to checkout all AssemblyInfo.cs files in the project, update them with AssemblyInfoTask, and then either undo the checkout or checkin depending on whether the build passed or not. Unfortunately, when two builds are queued close together this results in a Partially completed build as the AssemblyInfo.cs files seem to be checked out at an earlier version to the previous checkin.</p>
<p>In order to get around this I thought that I could use the "Get" task to force the AssemblyInfo.cs files to the latest version before updating them, but this appears to have no effect. Any ideas?</p>
<pre><code><Target Name="AfterGet" Condition="'$(IsDesktopBuild)'!='true'">
<Message Text="SolutionRoot = $(SolutionRoot)" />
<Message Text="OutDir = $(OutDir)" />
<!-- Set the AssemblyInfoFiles items dynamically -->
<CreateItem Include="$(SolutionRoot)\Main\Source\InputApplicationSln\**\$(AssemblyInfoSpec)">
<Output ItemName="AssemblyInfoFiles" TaskParameter="Include" />
</CreateItem>
<Message Text="$(AssemblyInfoFiles)" />
<!-- When builds are queued up successively, it is possible for the next build to be set up before the AssemblyInfoSpec is checked in so we need to force
the latest these versions of these files to be got before a checkout -->
<Get Condition=" '$(SkipGet)'!='true' " TeamFoundationServerUrl="$(TeamFoundationServerUrl)" Workspace="$(WorkspaceName)" Filespec="$(AssemblyInfoSpec)" Recursive="$(RecursiveGet)" Force="$(ForceGet)" />
<Exec WorkingDirectory="$(SolutionRoot)\Main\Source\InputApplicationSln"
Command="$(TF) checkout /recursive $(AssemblyInfoSpec)"/>
</code></pre>
<p></p>
<p>
</p>
| [
{
"answer_id": 889430,
"author": "sean e",
"author_id": 103912,
"author_profile": "https://Stackoverflow.com/users/103912",
"pm_score": 0,
"selected": false,
"text": "devenv.exe /Log c:\\vs.log\n"
}
] | 2008/10/06 | [
"https://Stackoverflow.com/questions/174705",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12565/"
] |
174,719 | <p>What is the best way to keep your configuration files (e.g httpd.conf, my.cnf, .bashrc ...) under version control?
In adition to the versioning benefit, I want the solution to work as backup as well, so that I can bring a brand new server and checkout (or export) the config files out of SVN directly</p>
<p>A good touch will be to store the config file`s original path as well.</p>
| [
{
"answer_id": 174788,
"author": "Chris R",
"author_id": 23309,
"author_profile": "https://Stackoverflow.com/users/23309",
"pm_score": 0,
"selected": false,
"text": "<root>/common\n /.emacs.d\n /.bash_common\n /scripts # platform-independent binary tools\n\n<root>/linux\n .bashrc\n ... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174719",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7370/"
] |
174,727 | <p>Oracle FAQ defines temp table space as follows:</p>
<blockquote>
<p>Temporary tablespaces are used to
manage space for database sort
operations and for storing global
temporary tables. For example, if you
join two large tables, and Oracle
cannot do the sort in memory, space
will be allocated in a temporary
tablespace for doing the sort
operation.</p>
</blockquote>
<p>That's great, but I need more detail about what exactly is using the space. Due to quirks of the application design most queries do some kind of sorting, so I need to narrow it down to client executable, target table, or SQL statement.</p>
<p>Essentially, I'm looking for clues to tell me more precisely what might be wrong with this (rather large application). Any sort of clue might be useful, so long as it is more precise than "sorting".</p>
| [
{
"answer_id": 174765,
"author": "Michael OShea",
"author_id": 13178,
"author_profile": "https://Stackoverflow.com/users/13178",
"pm_score": 5,
"selected": true,
"text": "SELECT b.TABLESPACE\n , b.segfile#\n , b.segblk#\n , ROUND ( ( ( b.blocks * p.VALUE ) / 1024 / ... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174727",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13935/"
] |
174,730 | <p>Given a credit card number and no additional information, what is the best way in PHP to determine whether or not it is a valid number?</p>
<p>Right now I need something that will work with American Express, Discover, MasterCard, and Visa, but it might be helpful if it will also work with other types.</p>
| [
{
"answer_id": 174747,
"author": "Patrick Desjardins",
"author_id": 13913,
"author_profile": "https://Stackoverflow.com/users/13913",
"pm_score": 3,
"selected": false,
"text": "function validateCC($cc_num, $type) {\n\n if($type == \"American\") {\n $denum = \"American Express\";\n ... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174730",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18986/"
] |
174,748 | <p>I have a table with one field that can point to a foreign key in one of 3 other tables based on what the descriminator value is (Project, TimeKeep, or CostCenter. Usually this is implemented with subclasses, and I am wondering if what I have below will work. <strong>Note the subclass name is the same as the parent class and the noteObject property is mapped to an instance variable of type java.lang.Object</strong> so it should accept either a Project, TimeKeep or CostCenter object as long as we cast to the correct type. Will hibernate allow this? Thanks.</p>
<pre><code><hibernate-mapping package="com.tlr.finance.mappings">
<class name="AdminNotes" table="admin_notes">
<id name="adminNoteId" column="admin_note_id" type="integer">
<generator class="identity" />
</id>
<discriminator column="note_type" type="string" />
<!-- make this property an enumerated type. It is the discriminator -->
<property name="adminNoteType" column="note_type" type="string" not-null="true" />
<property name="adminNote" column="note" type="string" not-null="true" />
<property name="adminNoteAdded" column="note_date" type="timestamp"
not-null="true" />
<subclass name="AdminNotes" discriminator-value="project" >
<many-to-one name="noteObject" column="object_id" class="PsData" /><!-- Project -->
</subclass>
<subclass name="AdminNotes" discriminator-value="user" >
<!-- rename timekeep to user -->
<many-to-one name="noteObject" column="object_id" class="Timekeep" /><!-- user -->
</subclass>
<subclass name="AdminNotes" discriminator-value="costCenter" >
<!-- rename timekeep to user -->
<many-to-one name="noteObject" column="object_id" class="CostCenter" /><!-- cost center -->
</subclass>
</class>
</hibernate-mapping>
</code></pre>
| [
{
"answer_id": 1109321,
"author": "Anton",
"author_id": 110311,
"author_profile": "https://Stackoverflow.com/users/110311",
"pm_score": 0,
"selected": false,
"text": "<hibernate-mapping package=\"com.tlr.finance.mappings\">\n\n <class name=\"AdminNotes\" table=\"admin_notes\" abstract... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174748",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16404/"
] |
174,752 | <p>I've got a lightbox textbox that is displayed using an AJAX call from an ASP.NET UpdatePanel. When the lightbox is displayed, I use the <code>focus()</code> method of a textbox that is in the lightbox to bring focus to the textbox right away.</p>
<p>When in Firefox, the text box gains focus with no problem. In IE, the text box does not gain focus unless I use </p>
<pre><code>setTimeout(function(){txtBx.focus()}, 500);
</code></pre>
<p>to make the focus method fire slightly later, after the DOM element has been loaded I'm assuming.</p>
<p>The problem is, immediately above that line, I'm already checking to see if the element is null/undefined, so the object already should exist if it hits that line, it just won't allow itself to gain focus right away for some reason.</p>
<p>Obviously setting a timer to "fix" this problem isn't the best or most elegant way to solve this. I'd like to be able to do something like the following: </p>
<pre><code>var txtBx = document.getElementById('txtBx');
if (txtPassword != null) {
txtPassword.focus();
while (txtPassword.focus === false) {
txtPassword.focus();
}
}
</code></pre>
<p>Is there any way to tell that a text box has focus so I could do something like above?</p>
<p>Or am I looking at this the wrong way?</p>
<p><strong>Edit</strong><br>
To clarify, I'm not calling the code on page load. The script <strong>is</strong> at the top of the page, however it is inside of a function that is called when ASP.NET's Asynchronous postback is complete, not when the page loads.</p>
<p>Because this is displayed after an Ajax update, the DOM should already be loaded, so I'm assuming that jQuery's <code>$(document).ready()</code> event won't be helpful here.</p>
| [
{
"answer_id": 1109321,
"author": "Anton",
"author_id": 110311,
"author_profile": "https://Stackoverflow.com/users/110311",
"pm_score": 0,
"selected": false,
"text": "<hibernate-mapping package=\"com.tlr.finance.mappings\">\n\n <class name=\"AdminNotes\" table=\"admin_notes\" abstract... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174752",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/392/"
] |
174,762 | <p>I have a form that I would like to style. specifcally I would like to chnage the background color of the form item's label. (the backgorundColor attribute changes both the label and the inputs background color)</p>
<p>i.e.</p>
<pre>
<code>
<mx:Form>
<mx:FormItem label="username:">
<mx:TextInput />
</mx:FormItem>
</mx:Form>
</code>
</pre>
<p>I would like to make the label with 'username:' have a different background color, but have the text input still be the default background color. </p>
<p>is this possible with a FormItem ?</p>
| [
{
"answer_id": 175076,
"author": "Brandon",
"author_id": 23133,
"author_profile": "https://Stackoverflow.com/users/23133",
"pm_score": -1,
"selected": false,
"text": "TextArea {\n backgroundColor: #0000ff;\n}\n"
},
{
"answer_id": 176096,
"author": "JustLogic",
"author_i... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174762",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1638/"
] |
174,764 | <p>I have a collection of ClickOnce packages in a publish folder on a network drive and need to move them all to another server (our DR machine). </p>
<p>After copy/pasting the whole directory and running the setups on the new machine I get an error message stating that it cannot find the old path:</p>
<blockquote>
<p>Activation of
...MyClickOnceApp.application resulted
in exception. Following failure
messages were detected:</p>
<p>+ Downloading file://oldMachine/c$/MyClickOnceApp.application did not succeed.</p>
<p>+ Could not find a part of the path '\\oldMachine\c$\MyClickOnceApp.application'.</p>
</blockquote>
<p>Once I change the installation <a href="http://en.wikipedia.org/wiki/Uniform_Resource_Locator" rel="nofollow noreferrer">URL</a> to point at my new machine, I get another error:</p>
<blockquote>
<p>Manifest XML signature is not valid.</p>
<p>+ The digital signature of the object did not verify.</p>
</blockquote>
<p>I've tried using <a href="http://msdn.microsoft.com/en-us/library/xhctdw55.aspx" rel="nofollow noreferrer">MageUI.exe</a>, to modify the deployment URL, but it asks for a certificate, which I don't have.</p>
<p>What am I doing wrong and how do I successfully move published ClickOnce packages?</p>
| [
{
"answer_id": 177899,
"author": "HAdes",
"author_id": 11989,
"author_profile": "https://Stackoverflow.com/users/11989",
"pm_score": 4,
"selected": true,
"text": "setup.exe"
}
] | 2008/10/06 | [
"https://Stackoverflow.com/questions/174764",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11989/"
] |
174,773 | <p>I have TurtoiseSVN and ankhSVN installed. I created a repository on my computer.. "C:\Documents and Settings\user1\My Documents\Subversion\Repository\"</p>
<p>I am trying to connect to this repository from my co-workers computer. What should this URL be?</p>
<p>Any help would be great. Thanks.</p>
| [
{
"answer_id": 174809,
"author": "Jeffrey L Whitledge",
"author_id": 10174,
"author_profile": "https://Stackoverflow.com/users/10174",
"pm_score": 2,
"selected": false,
"text": "file:///\\\\COMPUTERNAME\\SharedFolderName\\\n"
},
{
"answer_id": 174818,
"author": "iainmcgin",
... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174773",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1316/"
] |
174,774 | <p>I created an <code>ObjectInputSteam</code> and <code>ObjectOutputStream</code> on a blocking <code>SocketChannel</code> and am trying to read and write concurrently. My code is something like this:</p>
<pre><code>socketChannel = SocketChannel.open(destNode);
objectOutputStream = new ObjectOutputStream(Channels.newOutputStream(socketChannel));
objectInputStream = new ObjectInputStream(Channels.newInputStream(socketChannel));
Thread replyThread = new Thread("SendRunnable-ReplyThread") {
@Override
public void run() {
try {
byte reply = objectInputStream.readByte();//(A)
//..process reply
} catch (Throwable e) {
logger.warn("Problem reading receive reply.", e);
}
}
};
replyThread.start();
objectOutputStream.writeObject(someObject);//(B)
//..more writing
</code></pre>
<p>Problem is the write at line (B) blocks until the read at line (A) completes (blocks on the object returned by <code>SelectableChannel#blockingLock()</code> ). But app logic dictates that the read will not complete until all the writes complete, so we have an effective deadlock.</p>
<p><code>SocketChannel</code> javadocs say that concurrent reads and writes are supported.</p>
<p>I experienced no such problem when I tried a regular Socket solution:</p>
<pre><code>Socket socket = new Socket();
socket.connect(destNode);
final OutputStream outputStream = socket.getOutputStream();
objectOutputStream = new ObjectOutputStream(outputStream);
objectInputStream = new ObjectInputStream(socket.getInputStream());
</code></pre>
<p>However, then I cannot take advantage of the performance benefits of <code>FileChannel#transferTo(...)</code></p>
| [
{
"answer_id": 179104,
"author": "Kevin Wong",
"author_id": 4792,
"author_profile": "https://Stackoverflow.com/users/4792",
"pm_score": 3,
"selected": false,
"text": "java.nio.channels.Channels"
},
{
"answer_id": 546419,
"author": "Nick",
"author_id": 21399,
"author_p... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174774",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4792/"
] |
174,800 | <p>I'm scraping a static html site and moving the content into a database-backed CMS. I'd like to use Textile in the CMS. </p>
<p>Is there a tool out there that converts HTML into Textile, so I can scrape the existing site, convert the HTML to Textile, and insert that data into the database?</p>
| [
{
"answer_id": 22592695,
"author": "Simmant",
"author_id": 2450403,
"author_profile": "https://Stackoverflow.com/users/2450403",
"pm_score": -1,
"selected": false,
"text": "import java.net.*;\nimport java.io.*;\n\nclass Crawle\n{\n\npublic static void main(String ar[])throws Exception\n{... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174800",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17076/"
] |
174,806 | <p>I'm a big subversion fan and am just about to take over a big site (200mb approx.) I've trimmed down the main site from an original size of 500MB!!</p>
<p>I'm about to check this site into a new subversion repository. The problem is, my subversion repository is remotely hosted so that another colleague can also work on the site. </p>
<p>I'm concerned about having to check in and out 200MB every time I have to make updates to the site.</p>
<p>Development is quite active so there will be lots of things changing on an ongoing basis. </p>
<p>Assuming I get everything checked in ok, will subversion ensure it's only download new/amended files/folders each time I do a new checkout or will I be waiting for 200MB to download every time?</p>
| [
{
"answer_id": 175051,
"author": "Ken",
"author_id": 20074,
"author_profile": "https://Stackoverflow.com/users/20074",
"pm_score": 3,
"selected": false,
"text": "svn checkout http://server/path/to/repos my_working_copy\ncp -a my_working_copy another_working_copy\nsvn status another_worki... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174806",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22837/"
] |
174,839 | <p><strong>Is there an easy way of cloning entire installed debian/ubuntu system?</strong></p>
<p>I want to have identical installation in terms of installed packages and as much as possible of settings.</p>
<p>I've looked into options of aptitude, apt-get, synaptic but have found nothing. </p>
| [
{
"answer_id": 1800060,
"author": "Patrick S. Roberts",
"author_id": 218950,
"author_profile": "https://Stackoverflow.com/users/218950",
"pm_score": 4,
"selected": false,
"text": "dpkg --get-selections > installed-software\nscp installed-software $targetsystem:.\n"
}
] | 2008/10/06 | [
"https://Stackoverflow.com/questions/174839",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20550/"
] |
174,841 | <p>Why is it that when I use a converter in my binding expression in WPF, the value is not updated when the data is updated.</p>
<p>I have a simple Person data model:</p>
<pre><code>class Person : INotifyPropertyChanged
{
public string FirstName { get; set; }
public string LastName { get; set; }
}
</code></pre>
<p>My binding expression looks like this:</p>
<pre><code><TextBlock Text="{Binding Converter={StaticResource personNameConverter}" />
</code></pre>
<p>My converter looks like this:</p>
<pre><code>class PersonNameConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
Person p = value as Person;
return p.FirstName + " " + p.LastName;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
</code></pre>
<p>If I bind the data without a converter it works great:</p>
<pre><code><TextBlock Text="{Binding Path=FirstName}" />
<TextBlock Text="{Binding Path=LastName}" />
</code></pre>
<p>What am I missing?</p>
<p>EDIT:
Just to clarify a few things, both Joel and Alan are correct regarding the INotifyPropertyChanged interface that needs to be implemented. In reality I do actually implement it but it still doesn't work.</p>
<p>I can't use multiple TextBlock elements because I'm trying to bind the Window Title to the full name, and the Window Title does not take a template.</p>
<p>Finally, it is an option to add a compound property "FullName" and bind to it, but I'm still wondering why updating does not happen when the binding uses a converter. Even when I put a break point in the converter code, the debugger just doesn't get there when an update is done to the underlying data :-(</p>
<p>Thanks,
Uri</p>
| [
{
"answer_id": 175050,
"author": "Joel B Fant",
"author_id": 22211,
"author_profile": "https://Stackoverflow.com/users/22211",
"pm_score": 5,
"selected": true,
"text": "Person"
},
{
"answer_id": 175121,
"author": "Alan Le",
"author_id": 1133,
"author_profile": "https:... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174841",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/373/"
] |
174,849 | <p>I've read <a href="http://chriscavanagh.wordpress.com/2008/03/11/aspnet-routing-goodbye-url-rewriting/" rel="noreferrer">ASP.NET Routing… Goodbye URL rewriting?</a> and <a href="http://haacked.com/archive/2008/03/11/using-routing-with-webforms.aspx" rel="noreferrer">Using Routing With WebForms</a> which are great articles, but limited to simple, illustrative, "hello world"-complexity examples.</p>
<p>Is anyone out there using ASP.NET routing with web forms in a non-trivial way? Any gotchas to be aware of? Performance issues? Further recommended reading I should look at before ploughing into an implementation of my own?</p>
<p><strong>EDIT</strong>
Found these additional useful URLs:</p>
<ul>
<li><a href="http://msdn.microsoft.com/en-us/library/cc668202.aspx" rel="noreferrer">How to: Use Routing with Web Forms (MSDN)</a></li>
<li><a href="http://msdn.microsoft.com/en-us/library/cc668201.aspx" rel="noreferrer">ASP.NET Routing (MSDN)</a> </li>
<li><a href="http://msdn.microsoft.com/en-us/library/cc668176.aspx" rel="noreferrer">How to: Construct a URL from a Route(MSDN)</a></li>
</ul>
| [
{
"answer_id": 47417864,
"author": "fufuz9000",
"author_id": 8980836,
"author_profile": "https://Stackoverflow.com/users/8980836",
"pm_score": 3,
"selected": false,
"text": "protected void Button1_Click(object sender, EventArgs e)\n{\n Response.Redirect(\"Second.aspx\");\n}\n\nprotect... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174849",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20377/"
] |
174,853 | <p>A python script need to spawn multiple sub-processes via fork(). All of those child processes should run simultaneously and the parent process should be waiting for all of them to finish. Having an ability to set some timeout on a "slow" child would be nice.
The parent process goes on processing the rest of the script after all kids are collected.</p>
<p>What is the best way to work it out? Thanks. </p>
| [
{
"answer_id": 174989,
"author": "Dan Lenski",
"author_id": 20789,
"author_profile": "https://Stackoverflow.com/users/20789",
"pm_score": 1,
"selected": false,
"text": "select()"
},
{
"answer_id": 175038,
"author": "ephemient",
"author_id": 20713,
"author_profile": "h... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174853",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/140995/"
] |
174,881 | <p>I'm using jmockit with my tests and with one class I wish to test, uses <code>InitialContext</code> directly. So I have the following:</p>
<pre><code>public class MyClass {
public void myMethod() {
InitialContext ic = new InitialContext();
javax.mail.Session mailSession = ic.lookup("my.mail.session");
// rest of method follows.....
}
</code></pre>
<p>In my test case, I call this to use my "mocked" <code>InitialContext</code> class:</p>
<pre><code>Mockit.redefineMethods(InitialContext.class, MockInitialContext.class);
</code></pre>
<p>What is the best way to mock the <code>InitialContext</code> class with jmockit.</p>
<p>I've already tried a few ways (such as using my own <code>MockInitialContextFactory</code>), but keeping stumbling into the same error:</p>
<pre><code>NoClassDefFoundError: my.class.MockInitialContext
</code></pre>
<p>From what I can see on Google, mocking with JNDI is quite nasty. Please can anyone provide me with some guidance, or point me to a solution? That would be much appreciated. Thank you.</p>
| [
{
"answer_id": 1634106,
"author": "jc.",
"author_id": 197705,
"author_profile": "https://Stackoverflow.com/users/197705",
"pm_score": 2,
"selected": false,
"text": "@Mocked InitialContext mockedInitialContext;\n@Mocked javax.mail.Session mockedSession;\n"
}
] | 2008/10/06 | [
"https://Stackoverflow.com/questions/174881",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
174,885 | <p>I've got this code:</p>
<pre><code>rs1 = getResults(sSQL1)
rs2 = getResults(sSQL2)
</code></pre>
<p>rs1 and rs2 and 2D arrays. The first index represents the number of columns (static) and the second index represents the number of rows (dynamic).</p>
<p>I need to join the two arrays and store them in rs3. I don't know what type rs1 and rs2 are though.</p>
| [
{
"answer_id": 174897,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 1,
"selected": false,
"text": "rs1 = getResults(sSQL1 & \" UNION \" sSQL2)\n"
},
{
"answer_id": 174974,
"author": "ilitirit",
"author... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174885",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9825/"
] |
174,888 | <p>i want to find the mime-type for a given file extension on an IIS ASP.NET web-server from the code-behind file.</p>
<p>i want to search the same list that the server itself uses when serving up a file. This means that any mime types a web-server administrator has added to the <em>Mime Map</em> will be included.</p>
<p>i could blindly use</p>
<pre><code>HKEY_CLASSES_ROOT\MIME\Database\Content Type
</code></pre>
<p>but that isn't documented as being the same list IIS uses, nor is it documented where the <em>Mime Map</em> is stored.</p>
<p>i could blindly call <a href="http://msdn.microsoft.com/en-us/library/ms775107(VS.85).aspx" rel="noreferrer">FindMimeFromData</a>, but that isn't documented as being the same list IIS uses, nor can i guarantee that the IIS <em>Mime Map</em> will also be returned from that call.</p>
| [
{
"answer_id": 174988,
"author": "Kev",
"author_id": 419,
"author_profile": "https://Stackoverflow.com/users/419",
"pm_score": 4,
"selected": true,
"text": "public static string GetMimeTypeFromExtension(string extension)\n{\n using (DirectoryEntry mimeMap = \n new DirectoryE... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174888",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12597/"
] |
174,890 | <p>I've discovered that cElementTree is about 30 times faster than <code>xml.dom.minidom</code> and I'm rewriting my XML encoding/decoding code. However, I need to output XML that contains CDATA sections and there doesn't seem to be a way to do that with ElementTree.</p>
<p>Can it be done?</p>
| [
{
"answer_id": 175101,
"author": "elifiner",
"author_id": 15109,
"author_profile": "https://Stackoverflow.com/users/15109",
"pm_score": 6,
"selected": true,
"text": "def Comment(text=None):\n element = Element(Comment)\n element.text = text\n return element\n"
},
{
"answ... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174890",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15109/"
] |
174,891 | <p>Last week we released Omniture's analytics code onto a large volume of web sites after tinkering and testing for the last week or so.</p>
<p>On almost all of our site templates, it works just fine. In a few scattered, unpredictable situations, there is a <em>crippling, browser-crashing experience</em> that <em>may</em> turn away some users.</p>
<p>We're not able to see a relationship between the crashing templates at this time, and while there <em>are</em> many ways to troubleshoot, the one that's confuddling us is related to event listeners.</p>
<p>The sites crash when any anchor on these templates is clicked. There isn't any inline JS, and while we firebug'ed our way through the attributes of the HTML, we couldn't find a discernable loop or issue that would cause this. (while we troubleshoot, you can experience this for yourself <a href="http://dv1.gatehousemedia.com/dev/omniture/index.html" rel="nofollow noreferrer">here</a> [<strong>warning</strong>! clicking any link in the page will cause your browser to crash!])</p>
<p><strong>How do you determine if an object has a listener or not? How do you determine what will fire when event is triggered?</strong></p>
<blockquote>
<p>FYI, I'd love to set breakpoints, but
<em>between Omnitures miserably obfuscated code and repeated browser
crashes</em>, I'd like to research more
thoroughly how I can approach this.</p>
</blockquote>
| [
{
"answer_id": 175146,
"author": "Victor",
"author_id": 14514,
"author_profile": "https://Stackoverflow.com/users/14514",
"pm_score": 3,
"selected": true,
"text": "alert(document.links[0].onclick)\n"
},
{
"answer_id": 175371,
"author": "Sergey Ilinsky",
"author_id": 23815... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174891",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22491/"
] |
174,912 | <p>I am a bit confused about the uses of these words. I have a table with he following columns: SITE, LAT, LONG, NAME, ......</p>
<p>I want results with unique (or is it distinct) LAT, LONG.
How do I achieve this?</p>
| [
{
"answer_id": 174954,
"author": "Michael OShea",
"author_id": 13178,
"author_profile": "https://Stackoverflow.com/users/13178",
"pm_score": 4,
"selected": false,
"text": "select unique colA, colB from atable\n\nselect distinct colA, colB from atable\n"
}
] | 2008/10/06 | [
"https://Stackoverflow.com/questions/174912",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
174,914 | <p>Is there a recommended way to upgrade Quartz in JBoss 4.2.x?</p>
<p>JBoss bundles quartz 1.5.2, but I have encountered issues (<a href="http://jira.opensymphony.com/browse/QUARTZ-399" rel="nofollow noreferrer">QUARTZ-399</a>, <a href="http://jira.opensymphony.com/browse/QUARTZ-520" rel="nofollow noreferrer">QUARTZ-520</a>) that I want to avoid.</p>
<p>I would not want to patch quartz.jar in JBoss just to resolve the errors, but instead provide a new quartz.jar (plus associated configuration artifacts). The <a href="http://www.opensymphony.com/quartz/wikidocs/Quartz%201.6.0.html#Quartz1.6.0-MigrationNotes" rel="nofollow noreferrer">Quartz 1.6 migration notes</a> only contain information specific to Quartz, and I could not find any additional information during my search.</p>
<p>It does not seem to work to just put the new quartz.jar into the EAR file, because the old version is loaded at the server level (in the server's lib directory).</p>
<p>I am quite sure somebody has already tried that, and hope that this person could share or provide some links.</p>
| [
{
"answer_id": 174954,
"author": "Michael OShea",
"author_id": 13178,
"author_profile": "https://Stackoverflow.com/users/13178",
"pm_score": 4,
"selected": false,
"text": "select unique colA, colB from atable\n\nselect distinct colA, colB from atable\n"
}
] | 2008/10/06 | [
"https://Stackoverflow.com/questions/174914",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12039/"
] |
174,916 | <p>I'm specifying my doctype as xhtml strict, but it's being sent over the wire as a content type of text/html. I'd like to specify that the content type is application/xhtml+xm, but I can't figure out where, or if, I can configure this from within my application</p>
| [
{
"answer_id": 174926,
"author": "Mitchel Sellers",
"author_id": 13279,
"author_profile": "https://Stackoverflow.com/users/13279",
"pm_score": 5,
"selected": true,
"text": "<%@ Page ContentType=\"application/xhtml+xm\" %>\n"
},
{
"answer_id": 174932,
"author": "Dillie-O",
... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174916",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
174,933 | <p>How can I get a single keyboard character from the terminal with Ruby without pressing enter?
I tried <code>Curses::getch</code>, but that didn't really work for me.</p>
| [
{
"answer_id": 174967,
"author": "Jay",
"author_id": 20840,
"author_profile": "https://Stackoverflow.com/users/20840",
"pm_score": 6,
"selected": true,
"text": "#!/usr/bin/ruby\n\nbegin\n system(\"stty raw -echo\")\n str = STDIN.getc\nensure\n system(\"stty -raw echo\")\nend\np str.ch... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174933",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25017/"
] |
174,942 | <p>A colleague once told me that the last option when everything has failed to debug on Linux was to use <a href="http://man7.org/linux/man-pages/man1/strace.1.html" rel="noreferrer">strace</a>.</p>
<p>I tried to learn the science behind this strange tool, but I am not a system admin guru and I didn’t really get results.</p>
<p>So,</p>
<ul>
<li>What is it exactly and what does it do?</li>
<li>How and in which cases should it be used?</li>
<li>How should the output be understood and processed?</li>
</ul>
<p>In brief, <em>in simple words</em>, how does this stuff work?</p>
| [
{
"answer_id": 174991,
"author": "bltxd",
"author_id": 11892,
"author_profile": "https://Stackoverflow.com/users/11892",
"pm_score": 6,
"selected": false,
"text": "strace /usr/local/bin/cough <any required argument for cough here>\n"
},
{
"answer_id": 30034030,
"author": "Jef... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174942",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9951/"
] |
174,968 | <p>Routines can have parameters, that's no news. You can define as many parameters as you may need, but too many of them will make your routine difficult to understand and maintain.</p>
<p>Of course, you could use a structured variable as a workaround: putting all those variables in a single struct and passing it to the routine. In fact, using structures to simplify parameter lists is one of the techniques described by Steve McConnell in <em>Code Complete</em>. But as he says:</p>
<blockquote>
<p><em>Careful programmers avoid bundling data any more than is logically necessary.</em></p>
</blockquote>
<p>So if your routine has too many parameters or you use a struct to disguise a big parameter list, you're probably doing something wrong. That is, you're not keeping coupling loose.</p>
<p>My question is, <strong>when can I consider a parameter list too big?</strong> I think that more than 5 parameters, are too many. What do you think?</p>
| [
{
"answer_id": 175078,
"author": "Kirk Strauser",
"author_id": 32538,
"author_profile": "https://Stackoverflow.com/users/32538",
"pm_score": 3,
"selected": false,
"text": "void *\nmmap(void *addr, size_t len, int prot, int flags, int fildes, off_t offset);\n"
},
{
"answer_id": 17... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174968",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1679/"
] |
174,986 | <p>I create a TextArea in actionscript:</p>
<pre><code>var textArea:TextArea = new TextArea();
</code></pre>
<p>I want it to have a black background. I've tried</p>
<pre><code>textArea.setStyle("backgroundColor", 0x000000);
</code></pre>
<p>and I've tried</p>
<pre><code>textArea.opaqueBackground = 0x000000;
</code></pre>
<p>but the TextArea stays white. What should I do?</p>
| [
{
"answer_id": 175914,
"author": "nerdabilly",
"author_id": 8349,
"author_profile": "https://Stackoverflow.com/users/8349",
"pm_score": 4,
"selected": true,
"text": "var textArea:TextArea = new TextArea()\ntextArea.textField.opaqueBackground = 0x000000;\n"
},
{
"answer_id": 78225... | 2008/10/06 | [
"https://Stackoverflow.com/questions/174986",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15371/"
] |
175,036 | <p>i need to be able to produce a "pretty" printout of an individual list item's values, with the goals being:</p>
<ul>
<li>get rid of all navigation</li>
<li>organize data as it would appear on a typical paper form (a customer requirement)</li>
</ul>
<p>i'm avoiding using InfoPath at this time due to other issues (which i'll post separate questions for...)</p>
<p><strong>for example</strong>, i have an individual list item that normally displays similar to the following <code>DispForm.aspx</code> <em>example</em>:</p>
<p><img src="https://farm4.static.flickr.com/3025/2919055776_bec7d520c9_o_d.png" alt="SharePoint - DispForm.aspx" title="SharePoint - DispForm.aspx"></p>
<p>i need a printed version (<em><code>PrintForm.aspx</code></em>??) that will display similar to the following <em>example</em>:</p>
<p><img src="https://farm4.static.flickr.com/3101/2918303785_ddfb28d32e_o_d.png" alt="SharePoint - PrintForm.aspx" title="SharePoint - PrintForm.aspx"></p>
<p>from what i can tell, i can't do this just by modifying/creating custom CSS.</p>
<p>it also seems that i can't quite do this just by creating my own "print" version of <code>DispForm.aspx</code>.</p>
<p>any suggestions, ideas, links would be very helpful.</p>
| [
{
"answer_id": 175119,
"author": "roryf",
"author_id": 270,
"author_profile": "https://Stackoverflow.com/users/270",
"pm_score": 1,
"selected": false,
"text": "media=\"print\""
},
{
"answer_id": 184494,
"author": "just mike",
"author_id": 12293,
"author_profile": "htt... | 2008/10/06 | [
"https://Stackoverflow.com/questions/175036",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12293/"
] |
175,042 | <p>I have this solution for a single button:</p>
<pre><code>myButton.Attributes.Add("onclick", "this.disabled=true;" + GetPostBackEventReference(myButton).ToString());
</code></pre>
<p>Which works pretty well for one button, any ideas on how to expand this to 2 buttons?</p>
| [
{
"answer_id": 175060,
"author": "FlySwat",
"author_id": 1965,
"author_profile": "https://Stackoverflow.com/users/1965",
"pm_score": 3,
"selected": true,
"text": "myButton.Attributes.Add(\"onclick\", \"this.disabled=true; document.getElementById('\" \n+ button2.ClientID + \"').disabled =... | 2008/10/06 | [
"https://Stackoverflow.com/questions/175042",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3208/"
] |
175,044 | <p>I have done a little Django development, but it has all been in a text editor. I was curious what more advanced development tools others are using in their Django development.</p>
<p>I am used to using Visual Studio for development and really like the <a href="https://en.wikipedia.org/wiki/Intelligent_code_completion#IntelliSense" rel="noreferrer">IntelliSense</a>, code completion, and file organization it provides and would like to find something (or a combination of tools) that would provide some of this in the Django/Python environment.</p>
| [
{
"answer_id": 175263,
"author": "Peter Shinners",
"author_id": 17209,
"author_profile": "https://Stackoverflow.com/users/17209",
"pm_score": 2,
"selected": false,
"text": "manage.py"
}
] | 2008/10/06 | [
"https://Stackoverflow.com/questions/175044",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1405/"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.