qid int64 4 19.1M | question stringlengths 18 48.3k | answers list | date stringlengths 10 10 | metadata list |
|---|---|---|---|---|
413,626 | <p>I use Django for my website and I want to know whether there is a work around for testing secure pages in Development server. As a temporary workaround, I wont use HTTP to check the webpages in dev server, which I think is not a correct way? What do you think?</p>
| [
{
"answer_id": 415773,
"author": "Jeff Bauer",
"author_id": 41759,
"author_profile": "https://Stackoverflow.com/users/41759",
"pm_score": 2,
"selected": false,
"text": "mod_wsgi mod_wsgi"
}
] | 2009/01/05 | [
"https://Stackoverflow.com/questions/413626",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45629/"
] |
413,655 | <p>How can I write the following code quickly in emacs?</p>
<pre><code>\newcommand{\cA}{\mathcal A}
\newcommand{\cB}{\mathcal B}
\newcommand{\cC}{\mathcal C}
...
...
\newcommand{\cY}{\mathcal Y}
\newcommand{\cZ}{\mathcal Z}
</code></pre>
<p>Is there a way faster than writing </p>
<pre><code>A
B
C
D
.
.
.
Y
Z
</code></pre>
<p>and then doing macro on each line? (changing A to \newcommand{\cA}{\mathcal A})</p>
| [
{
"answer_id": 413791,
"author": "HD.",
"author_id": 6525,
"author_profile": "https://Stackoverflow.com/users/6525",
"pm_score": 3,
"selected": false,
"text": "(loop \n for n from (string-to-char \"A\") to (string-to-char \"Z\")\n for c = (char-to-string n)\n do (insert (c... | 2009/01/05 | [
"https://Stackoverflow.com/questions/413655",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37664/"
] |
413,656 | <p>How can I create a Popup balloon like you would see from Windows Messenger or AVG or Norton or whomever?</p>
<p>I want it to show the information, and then slide away after a few seconds.</p>
<p><b>Edit: It needs to be blocking like Form.ShowDialog()</b> because the program exits after displaying the notification</p>
| [
{
"answer_id": 413702,
"author": "BFree",
"author_id": 15861,
"author_profile": "https://Stackoverflow.com/users/15861",
"pm_score": 5,
"selected": true,
"text": "private void button1_Click(object sender, EventArgs e)\n {\n this.notifyIcon1.BalloonTipText = \"Whatever\"... | 2009/01/05 | [
"https://Stackoverflow.com/questions/413656",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12243/"
] |
413,659 | <p>I'm getting this error when I'm trying to connect to a mysql database. The problem is that the application works for weeks, and then randomly I get this message. When I get this error message the application is not able to reconnect to the database until I restart it.</p>
<p>I'm using a configuration file to connect to the database, and the adapter is specified...the database configuration is not generated at runtime.</p>
<p>Do you have any idea on what is going on?</p>
| [
{
"answer_id": 413885,
"author": "Ricardo Acras",
"author_id": 19224,
"author_profile": "https://Stackoverflow.com/users/19224",
"pm_score": 1,
"selected": false,
"text": "gem install mysql\n"
},
{
"answer_id": 413886,
"author": "Martin Carpenter",
"author_id": 39443,
... | 2009/01/05 | [
"https://Stackoverflow.com/questions/413659",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22083/"
] |
413,675 | <p>I would like several textboxes to react to changes of an underlying string. So if I were to change the content of the string, all those textboxes would change their content too.</p>
<p>Now, I can't use the String type for that as it is immutable. So I went with StringBuilder. But the Text property of a TextBox object only takes String.</p>
<p>Is there an easy way to "bind" the StringBuilder object to the Text property of a TextBox?</p>
<p>Many thanks!</p>
<p>PS: The TextBox is currently WPF. But I might switch to Windows Forms because of Mono.</p>
| [
{
"answer_id": 413686,
"author": "Ray Booysen",
"author_id": 42124,
"author_profile": "https://Stackoverflow.com/users/42124",
"pm_score": 5,
"selected": true,
"text": "private StringBuilder _myStringBuilder;\n\npublic string MyText\n{\n get { return _myStringBuilder.ToString(); }\n}\n"... | 2009/01/05 | [
"https://Stackoverflow.com/questions/413675",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51710/"
] |
413,677 | <p>I'm trying to find out current user name for my sharepoint application. There are more that one way how to do this. However the sharepoint way returns misleading value. </p>
<pre><code>System.Security.Principal.WindowsIdentity.GetCurrent().Name // returns MY_COMPUTER\\my_user
HttpContext.Current.User.Identity.Name // returns MY_COMPUTER\\my_user
HttpContext.Current.Request.ServerVariables["AUTH_USER"] // returns MY_COMPUTER\\my_user
Microsoft.SharePoint.SPContext.Current.Web.CurrentUser.LoginName // returns SHAREPOINT\\system
</code></pre>
<p>What is the cause of this behavior? Will I encounter problems if I'll use non-sharepoint way?</p>
| [
{
"answer_id": 3578205,
"author": "user432195",
"author_id": 432195,
"author_profile": "https://Stackoverflow.com/users/432195",
"pm_score": 2,
"selected": false,
"text": "SPWeb site = SPContext.Current.Web;\nSPSecurity.RunWithElevatedPrivileges(delegate()\n{\n using (SPSite Elevateds... | 2009/01/05 | [
"https://Stackoverflow.com/questions/413677",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2361/"
] |
413,700 | <p>I want to initialize a static collection within my C# class - something like this:</p>
<pre><code>public class Foo {
private static readonly ICollection<string> g_collection = ???
}
</code></pre>
<p>I'm not sure of the right way to do this; in Java I might do something like:</p>
<pre><code>private static final Collection<String> g_collection = Arrays.asList("A", "B");
</code></pre>
<p>is there a similar construct in C# 2.0? </p>
<p>I know in later versions of C#/.NET you can do collection initializers (<a href="http://msdn.microsoft.com/en-us/library/bb384062.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/bb384062.aspx</a>), but migration isn't an option for our system at the moment.</p>
<p>To clarify my original question - I'm looking for a way to succinctly declare a simple static collection, such as a simple constant collection of strings. The static-initializer-style way is also really good to know for collections of more complex objects.</p>
<p>Thanks!</p>
| [
{
"answer_id": 413711,
"author": "ChrisW",
"author_id": 49942,
"author_profile": "https://Stackoverflow.com/users/49942",
"pm_score": 3,
"selected": false,
"text": "public class Foo\n{\n private static readonly ICollection<string> g_collection = initializeCollection();\n\n private ... | 2009/01/05 | [
"https://Stackoverflow.com/questions/413700",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51705/"
] |
413,713 | <p>I'm the sole developer for an academic consortium headquartered at a university in the northeast. All of my development work involves internal tools, mostly in Java, so nothing that is released to the public. Right now, I feel like my development workflow is very "hobbyist" and is nothing like you would see at an experienced software development firm. I would be inclined to say that it doesn't really matter since I'm the only developer anyway, but it can't hurt to make some changes, if for no other reason than to make my job a little easier and get a few more technologies on my resume. Right now my workflow is something like this:</p>
<ul>
<li><p>I do most of my development work in Eclipse on my laptop. Everything is saved locally on my laptop, and I don't use a VCS, nor do I really backup my code (except for occasionally emailing it to myself so I can see it on a different computer - yeah, I told you my development environment needs work). </p></li>
<li><p>When I'm done with a project and want to deploy it or if I just want to test it, I use the built-in Jar tool in Eclipse to make an executable .jar of my project. If I use external .jar libraries, I use the Fat-Jar plugin to include those .jars in my executable .jar. </p></li>
<li><p>After I create the .jar, I manually upload it to the server via SFTP and test it with something like <code>java -jar MyProject.jar</code>.</p></li>
</ul>
<p>Oh yeah, did I mention that I don't unit test? </p>
<p>The most glaringly obvious problem that I'd like to fix first is my lack of source control. I like git because of it's distributed nature, but it doesn't seem to integrate with Eclipse well and I've heard that it doesn't work very well on Windows, which is my primary development OS. So, I'm leaning toward SVN, which I do have some experience with. I do have my own personal server, and I think I'll use that for my source control, because I'd rather be my own admin than have to deal with university bureaucracy. I had some trouble setting up SVN once before, but I'll give it another shot. Maybe I'll also install something like Trac or Redmine for bug-tracking, todo list, etc?</p>
<p>What about building and deployment? There has to be a better way than using Fat-Jar and manually uploading my jar to the server. I've heard about tools like Ant and Maven - do these apply to what I want to do? How can I get started using those? </p>
<p>I suppose I'd eventually like to integrate unit testing with JUnit too. Even though it probably should be, that is not my primary concern right now, because so far my applications aren't terribly complex. I'd really like to work on simplifying and streamlining my workflow right now, and then I'll ease into unit testing. </p>
<p>Sorry for the long question. I guess my question boils down to, for a sole developer, what tools and methodologies can/should I be using to not only make my job easier, but also just to expose myself to some technologies that would be expected requisite knowledge at a dedicated development house?</p>
<hr>
<p>edit: Thanks for the great answers so far. I didn't mean to suggest that I wanted to make my workflow "enterprisey" just for the sake of doing it, but to make my job simpler and to get a few technologies under my belt that are typically used in enterprise development environments. That's all I meant by that.</p>
| [
{
"answer_id": 413844,
"author": "slim",
"author_id": 7512,
"author_profile": "https://Stackoverflow.com/users/7512",
"pm_score": 0,
"selected": false,
"text": "public void testSalaryCalc() {\n Employee emp = new Employee(\"John Doe\");\n emp.setAnnualSalary(12000);\n assertEqua... | 2009/01/05 | [
"https://Stackoverflow.com/questions/413713",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42891/"
] |
413,736 | <p>I'm playing with the <a href="http://www.erlang.org/doc/getting_started/conc_prog.html#3.4" rel="noreferrer">distributed programming tutorial</a> from the 5.4 documentation, and have run into a problem with node names.</p>
<p>My MacBook's default name (<code>jamess-macbook</code>) does not play well with Erlang's node-naming scheme, due to the dash:</p>
<pre><code>(salt@jamess-macbook)4> {my_process, pepper@jamess-macbook} ! start
** exception error: bad argument in an arithmetic expression
in operator -/2
called as pepper@jamess - macbook
</code></pre>
<p>I'm sure there's an easy way to get around this, short of renaming all the machines I want to run Erlang on, but I can't see it in the documentation.</p>
<p>Any suggestions?</p>
| [
{
"answer_id": 413773,
"author": "mipadi",
"author_id": 28804,
"author_profile": "https://Stackoverflow.com/users/28804",
"pm_score": 3,
"selected": false,
"text": "$ erl -sname node_name\n node_name"
},
{
"answer_id": 414050,
"author": "archaelus",
"author_id": 9040,
... | 2009/01/05 | [
"https://Stackoverflow.com/questions/413736",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29903/"
] |
413,740 | <p>I remember reading once that the order of the members of an evaluation is important.
Such as</p>
<pre><code>if (null == myClass)
</code></pre>
<p>is better (faster?) then</p>
<pre><code>if (myClass == null)
</code></pre>
<p>is this the case?
If so could someone explain how and why?
If the answer requires a language then aim towards c#.<br/>
Thanks</p>
| [
{
"answer_id": 413760,
"author": "driAn",
"author_id": 50430,
"author_profile": "https://Stackoverflow.com/users/50430",
"pm_score": 6,
"selected": true,
"text": "if(myClass = null) /* accident, sets myClass to null instead of comparing */\n if(null = myClass) /* throws an error at compi... | 2009/01/05 | [
"https://Stackoverflow.com/questions/413740",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17540/"
] |
413,764 | <p>I have a select statement with calculated columns and I would like to use the value of one calculated column in another. Is this possible? Here is a contrived example to show what I am trying to do.</p>
<pre><code>SELECT [calcval1] = CASE Statement, [calcval2] = [calcval1] * .25
</code></pre>
| [
{
"answer_id": 413784,
"author": "Michael Haren",
"author_id": 29,
"author_profile": "https://Stackoverflow.com/users/29",
"pm_score": 5,
"selected": true,
"text": "-- assume that 'Calc' is a computed column equal to Salaray*.25\nSELECT Calc, Salary*.25 Calc2 FROM YourTable\n persisted"
... | 2009/01/05 | [
"https://Stackoverflow.com/questions/413764",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1203/"
] |
413,777 | <p>How can I get a fully recursive svn blame report for all non-binary files in a branch, where the output is in a single file in xml format and includes revision, date, author, filename & path, and the text of the line of the file itself? The entire output needs to be in a single file. It will be executed as part of the build via a CCNet instance.</p>
<p>Available tools are the latest stable release of nant and nantcontrib, msbuild, and latest command line svn.</p>
<p>Here's some of the issues I have run into: Command line svn blame command does not support directory recursion. Blame's --xml option does not include the actual text of each line, though it does have everything else. By default nantcontrib is passing the --quiet parameter (contrary to the task reference), which is not supported on the blame command. Nantcontrib svn task may not accept the --xml parameter.</p>
| [
{
"answer_id": 414552,
"author": "Adam Bellaire",
"author_id": 21632,
"author_profile": "https://Stackoverflow.com/users/21632",
"pm_score": 3,
"selected": true,
"text": "svn find blame"
},
{
"answer_id": 446112,
"author": "Critical Skill ",
"author_id": 55291,
"autho... | 2009/01/05 | [
"https://Stackoverflow.com/questions/413777",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/947/"
] |
413,799 | <p>In Spring 2.0, is there a quick way to have a list of the current servlet context's mapped URLs from inside a Controller method?</p>
<p>I'm writing a method called <code>getMappedUrls()</code>, and the purpose of this method is to show what urls are mapped in the current servlet context.</p>
<p>This method is to be used to generate an small online doc of available services.</p>
<p>Thanks!</p>
<p>[Edit]</p>
<p>Kent Lai's answer works for me:</p>
<pre><code>final Map<Object, AbstractUrlHandlerMapping> beans =
getApplicationContext().getBeansOfType(AbstractUrlHandlerMapping.class);
for (final AbstractUrlHandlerMapping bean : beans.values())
{
final Map<String, Object> mapping = bean.getHandlerMap();
for(final String url : mapping.keySet())
urls.add(url);
}
</code></pre>
| [
{
"answer_id": 415445,
"author": "Kent Lai",
"author_id": 2085392,
"author_profile": "https://Stackoverflow.com/users/2085392",
"pm_score": 4,
"selected": true,
"text": "org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping org.springframework.web.servlet.handler... | 2009/01/05 | [
"https://Stackoverflow.com/questions/413799",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2797/"
] |
413,807 | <p>It's very annoying to have this limitation on my development box, when there won't ever be any users other than me.</p>
<p>I'm aware of <a href="http://www.debian-administration.org/articles/386" rel="noreferrer">the standard workarounds</a>, but none of them do exactly what I want:</p>
<ol>
<li><a href="http://en.wikipedia.org/wiki/Authbind" rel="noreferrer">authbind</a> (The version in Debian testing, 1.0, only supports IPv4)</li>
<li><a href="http://www.frozentux.net/iptables-tutorial/iptables-tutorial.html#REDIRECTTARGET" rel="noreferrer">Using the iptables REDIRECT target to redirect a low port to a high port</a> (the "nat" table is not yet implemented for ip6tables, the IPv6 version of iptables)</li>
<li>sudo (Running as root is what I'm trying to avoid)</li>
<li>SELinux (or similar). (This is just my dev box, I don't want to introduce a lot of extra complexity.)</li>
</ol>
<p>Is there some simple <code>sysctl</code> variable to allow non-root processes to bind to "privileged" ports (ports less than 1024) on Linux, or am I just out of luck?</p>
<p>EDIT: In some cases, you can <a href="https://stackoverflow.com/questions/413807/is-there-a-way-for-non-root-processes-to-bind-to-privileged-ports-1024-on-linux#414258">use capabilities</a> to do this.</p>
| [
{
"answer_id": 413877,
"author": "Joshua",
"author_id": 14768,
"author_profile": "https://Stackoverflow.com/users/14768",
"pm_score": 5,
"selected": false,
"text": "net/ipv4/af_inet.c if (snum && snum < PROT_SOCK && !capable(CAP_NET_BIND_SERVICE))\n goto out;\n"
},
... | 2009/01/05 | [
"https://Stackoverflow.com/questions/413807",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51717/"
] |
413,809 | <p>I installed SQL Server 2008 Express with Advanced Services, but when I try to create a new database, the option Full-Text indexing is greyed out, I believe the full-text indexing has been installed, because I did a query as below:
<br></p>
<pre><code>use [mydbname]
select fulltextserviceproperty('isfulltextinstalled')
</code></pre>
<p>This query returns 1, so I think it has been successfully installed.</p>
<p>Full-text indexing is supported in MSSQL Express with Advanced Services edition, which I have installed. Page for reference:<br />
<a href="http://www.microsoft.com/downloads/details.aspx?familyid=B5D1B8C3-FDA5-4508-B0D0-1311D670E336&displaylang=en" rel="noreferrer">http://www.microsoft.com/downloads/details.aspx?familyid=B5D1B8C3-FDA5-4508-B0D0-1311D670E336&displaylang=en</a></p>
| [
{
"answer_id": 413858,
"author": "Steven Robbins",
"author_id": 26507,
"author_profile": "https://Stackoverflow.com/users/26507",
"pm_score": 3,
"selected": false,
"text": "use MyDatabaseName\ngo\nEXEC sp_fulltext_database 'enable'\ngo\nCREATE FULLTEXT CATALOG MyFullTextCatalog\n CREATE ... | 2009/01/05 | [
"https://Stackoverflow.com/questions/413809",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
413,819 | <p>Is there any RDBMS that implements something like <code>SELECT * EXCEPT</code>? What I'm after is getting all of the fields except a specific TEXT/BLOB field, and I'd like to just select everything else.</p>
<p>Almost daily I complain to my coworkers that someone should implement this... It's terribly annoying that it doesn't exist.</p>
<p><strong>Edit:</strong> I understand everyone's concern for <code>SELECT *</code>. I know the risks associated with <code>SELECT *</code>. However, this, at least in my situation, would not be used for any Production level code, or even Development level code; strictly for debugging, when I need to see all of the values easily.</p>
<p>As I've stated in some of the comments, where I work is strictly a commandline shop, doing everything over ssh. This makes it difficult to use any gui tools (external connections to the database aren't allowed), etc etc.</p>
<p>Thanks for the suggestions though.</p>
| [
{
"answer_id": 413892,
"author": "Jasmine",
"author_id": 5255,
"author_profile": "https://Stackoverflow.com/users/5255",
"pm_score": 6,
"selected": true,
"text": "declare @sql varchar(8000),\n @table_id int,\n @col_id int\n\nset @sql = 'select '\n\nselect @table_id = id from sysobj... | 2009/01/05 | [
"https://Stackoverflow.com/questions/413819",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16645/"
] |
413,825 | <p>In C#, I'm marking some classes' properties with attributes and I'm using reflection to find these properties in order to perform gets and sets on them. I've found, however, that getting/setting with reflection in this manner is approximately 10x as slow as POCO gets/sets. Besides dropping the fundamental scenario described above to use alternate techniques, are there any documented tricks to make this significantly performant, such as caching techniques of some sort?</p>
| [
{
"answer_id": 413864,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 4,
"selected": true,
"text": "Func<T> Action<T>"
}
] | 2009/01/05 | [
"https://Stackoverflow.com/questions/413825",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11398/"
] |
413,856 | <p>I’ve just created a WCF service/client and it all works fine when running on the same machine. But can’t figure out how to configure it to run on different machines. Do you know how?</p>
<p>At the moment the URI is set to <a href="http://localHost:8000" rel="nofollow noreferrer">http://localHost:8000</a>......</p>
<p>But I think I want something like net.tcp://MyServer:8000…..</p>
<p>Any ideas would be great.
Thanks.</p>
| [
{
"answer_id": 413966,
"author": "Agent_9191",
"author_id": 6504,
"author_profile": "https://Stackoverflow.com/users/6504",
"pm_score": 2,
"selected": true,
"text": "<configuration>\n <system.serviceModel>\n <services>\n <service name=\"YourService\">\n ... | 2009/01/05 | [
"https://Stackoverflow.com/questions/413856",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11989/"
] |
413,863 | <p>The application I'm working on (it's a game, actually) uses XML for some of its configuration. Since I'm using CEGUI for the GUI, and it has its own XML parsing objects, I converted my code to use that instead of my own hand-rolled parser class. If the document is missing attributes on certain tags, it throws an exception, which is what I want. However, the exception does not propagate through the C calls on the stack; instead, terminate() is called. </p>
<p>For those of you unfamiliar with CEGUI, it uses a plugin-based system for XML parsing. There are currently plugins for tinyxml, expat, libxml, and xerces. No particular plugin is guaranteed to be present in a specific binary distribution of CEGUI; the only requirement is that at least one is available. So my problem cannot be solved by requiring the use of a C++ parser (tinyxml or xerces).</p>
<p>Does anyone know of a good way to get around this problem that doesn't require me to distribute the source for CEGUI and its XML parser plugin dependencies with my game source?</p>
<p>I should also note that this problem only occurs on OS X; it works fine on GNU/Linux.</p>
<p>Here's some simple example code that demonstrates the issue:</p>
<p>EDIT: Minor code correction
<a href="http://pastebin.com/m23ba5577" rel="nofollow noreferrer">http://pastebin.com/m23ba5577</a></p>
<p>Thanks,
Rob </p>
| [
{
"answer_id": 418327,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 2,
"selected": false,
"text": "g++ -c test.c gcc -c test.c"
}
] | 2009/01/05 | [
"https://Stackoverflow.com/questions/413863",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
413,876 | <h3>Boring introduction:</h3>
<p>In my workplace, we have a very old WinForms product (in market since 1994, and still running on VB3). It has three very different versions, each of them goes to one client. The clients pass it on to their users, some of which are shared. The versions can live side-by-side.</p>
<p>Five years ago, we rewrote one of those versions in C#.Net. Two years later, another version (let's call it version M) was rewritten, and two years after that, it was time for the last remaining version (let's call it version C) to be converted. We've been working for one year, and are going to production this week.</p>
<p>During the conversions, it has been decided not to convert anything that was sold as an external module; these were built in VB6, and they used several controls from <a href="http://www.becubed.com/index.htm" rel="nofollow noreferrer">BeCubed</a> and <a href="http://www.fpoint.com/" rel="nofollow noreferrer">FarPoint</a>. There are two such modules in version M, and three modules in version C.
Each module has it's own MSI installer, which is run quietly by the main product's installer.</p>
<h3>The bug</h3>
<p>During production, we found a bug: when version C in installed on a fresh computer, then version M is installed, we get a message as soon as an external module is opened in version C:</p>
<p><img src="https://lh3.ggpht.com/_L2AGN2rr3tM/SWJBoWNPcVI/AAAAAAAACaA/pPNTMywh4Gw/BeCubed.PNG" alt="BeCubed error"></p>
<p>After clicking Ok, the module works. Also, this doesn't happen when they are installed in any other order and both modules in version M work perfectly.</p>
<h3>Other details</h3>
<ul>
<li>All OCX and DLL files have been compared through all the module setups; the files are identical. </li>
<li>All modules work when only one version M or C is installed, or when M is installed first. </li>
<li>We have licenses for all the software we use, including BeCubed.</li>
</ul>
<hr>
<p>Does anyone know what could cause such an error, what could be a possible solution?</p>
| [
{
"answer_id": 418327,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 2,
"selected": false,
"text": "g++ -c test.c gcc -c test.c"
}
] | 2009/01/05 | [
"https://Stackoverflow.com/questions/413876",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9536/"
] |
413,890 | <p>How is it possible to programmatically select an item in a WPF <code>TreeView</code>? The <code>ItemsControl</code> model seems to prevent it.</p>
| [
{
"answer_id": 413900,
"author": "Steven Robbins",
"author_id": 26507,
"author_profile": "https://Stackoverflow.com/users/26507",
"pm_score": 6,
"selected": true,
"text": "// selectedItemObject is not a TreeViewItem, but an item from the collection that \n// populated the TreeView.\n\n... | 2009/01/05 | [
"https://Stackoverflow.com/questions/413890",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15985/"
] |
413,898 | <p>To be specific, I was trying this code:</p>
<pre><code>package hello;
public class Hello {
Clock clock = new Clock();
public static void main(String args[]) {
clock.sayTime();
}
}
</code></pre>
<p>But it gave the error </p>
<blockquote>
<p>Cannot access non-static field in static method main</p>
</blockquote>
<p>So I changed the declaration of <code>clock</code> to this:</p>
<pre><code>static Clock clock = new Clock();
</code></pre>
<p>And it worked. What does it mean to put that keyword before the declaration? What exactly will it do and/or restrict in terms of what can be done to that object?</p>
| [
{
"answer_id": 413904,
"author": "mmx",
"author_id": 33708,
"author_profile": "https://Stackoverflow.com/users/33708",
"pm_score": 10,
"selected": true,
"text": "static static static main Hello Clock static static static static public class Example {\n private static boolean staticFie... | 2009/01/05 | [
"https://Stackoverflow.com/questions/413898",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49153/"
] |
413,912 | <p>I have created an iframe code that I want people to use as a widget on their website. This iframe will load a webpage which has a button and a counter. In the accessed page I've got a graphic.</p>
<p>But the iframe is rendered in the browser with a white empty area around it. Why is this happening? Here's my code: -</p>
<p>At the client side:</p>
<pre><code><script type="text/javascript">
window.onload = function() {
document.all.myframe.src = "blogup.aspx?url=" + window.location.href;
}
</script>
<iframe id="myframe" height="75" width="235" scrolling="no" frameborder="0">
</iframe>
</code></pre>
<p>The page that should be displayed</p>
<pre><code><%@ Page Language="C#" AutoEventWireup="true" CodeFile="blogup.aspx.cs" Inherits="blogup" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<form id="form1" runat="server">
<img style="float: left" src="images/blogup1.jpg" alt="Blogvani.com - Indian blogs aggregator" />
<div style="font-family: Verdana; font-size: 16px; margin:0;padding:0;font-weight: bold; background: url('images/blogup2.jpg') no-repeat;
height: 50; width: 44; padding: 22px 5px 5px 5px; text-align: center">
<a href="javascript:voteup('<%= PostURL %>')" id="votecount" style="text-decoration: none;
color: #026A88">115</a></div>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<asp:ScriptManager ID="ScriptManager1" EnablePageMethods="true" runat="server">
<Services>
<asp:ServiceReference Path="~/Services.asmx"
</Services>
</asp:ScriptManager>
</form>
</body>
</html>
</code></pre>
<p>Note: I am using inline css. Margin and padding are set to 0, yet the images are being displayed a little offset from top and left.</p>
<p>Any ideas?</p>
| [
{
"answer_id": 413918,
"author": "Greg",
"author_id": 24181,
"author_profile": "https://Stackoverflow.com/users/24181",
"pm_score": 5,
"selected": true,
"text": "<body>"
},
{
"answer_id": 7093462,
"author": "Nick",
"author_id": 898691,
"author_profile": "https://Stack... | 2009/01/05 | [
"https://Stackoverflow.com/questions/413912",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33052/"
] |
413,919 | <p>I want to display and rotate a single 3D model, preferably textured, on the iPhone. Doesn't have to zoom in and out, or have a background, or anything. </p>
<p>I have the following:</p>
<ul>
<li>an iPhone</li>
<li>a MacBook</li>
<li>the iPhone SDK</li>
<li>Blender</li>
</ul>
<p>My knowledge base:</p>
<ul>
<li>I can make 3D models in various 3D programs (I'm most comfortable with 3D Studio Max, which I once took a course on, but I've used others)</li>
<li>General knowledge of procedural programming from years ago (QuickBasic - I'm old!)</li>
<li>Beginner's knowledge of object-oriented programming from going through simple Java and C# tutorials (Head Start C# book and my wife's intro to OOP course that used Java)</li>
<li>I have managed to display a 3D textured model and spin it using a tutorial in C# I got off the net (I didn't just copy and paste, I understand basically how it works) and the XNA game development library, using Visual Studio on Windows.</li>
</ul>
<p>What I do not know:</p>
<ul>
<li>Much about Objective C</li>
<li>Anything about OpenGL or OpenGL ES, which the iPhone apparently uses</li>
<li>Anything about XCode</li>
</ul>
<p>My main problem is that I don't know where to start! All the iPhone books I found seem to be about creating GUI applications, not OpenGL apps. I found an OpenGL book but I don't know how much, if any, applies to iPhone development. And I find the Objective C syntax somewhat confusing, with the weird nested method naming, things like "id" that don't make sense, and the scary thought that I have to do manual memory management.</p>
<p>Where is the best place to start? I couldn't find any tutorials for this sort of thing, but maybe my Google-Fu is weak. Or maybe I should start with learning Objective C? I know of books like Aaron Hillgrass', but I've also read that they are outdated and much of the sample code doesn't work on the iPhone SDK, plus it seems geared towards the Model-View-Controller paradigm which doesn't seem that suited for 3D apps.</p>
<p>Basically I'm confused about what my first steps should be. </p>
| [
{
"answer_id": 18053562,
"author": "Krishnabhadra",
"author_id": 640731,
"author_profile": "https://Stackoverflow.com/users/640731",
"pm_score": 3,
"selected": false,
"text": "bpy.utils.script_paths(\"addons\") [self addContentFromPODFile: @\"YourPODFileName.pod\"];\n"
}
] | 2009/01/05 | [
"https://Stackoverflow.com/questions/413919",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5262/"
] |
413,924 | <p>I'm missing a few important commits after my computer lost power in the middle of a "git svn dcommit" operation, and I'm unsure of how to get them back. "git log" doesn't show the commits, any ideas?</p>
| [
{
"answer_id": 414041,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 3,
"selected": false,
"text": "git reflog"
}
] | 2009/01/05 | [
"https://Stackoverflow.com/questions/413924",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
413,927 | <p>I have created a new solution with a minimal amount of code that represents the issue I am having. This is the simplest I could get it down to.</p>
<pre><code>namespace EntServ.BusinessObjects
{
/// <summary>
/// Summary description for EntServSession
/// </summary>
public class EntServSession
{
public EntServSession()
{
}
public static EntServSession Login(string username, string password)
{
EntServSession ret = null;
if (username == "test" && password == "pass")
ret = new EntServSession();
return ret;
}
}
}
</code></pre>
<p>I started with a new solution, and created one class in the App_Code folder with one static method similar to one of the methods I was having an issue with. I right-clicked on the classname, and click "Create Unit Tests...". It offered to create a new Test project for me, I accepted the defaults and clicked okay. It generated the following file:</p>
<pre><code>using EntServ.BusinessObjects;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.VisualStudio.TestTools.UnitTesting.Web;
using System.Data;
namespace EntServObjectTests
{
/// <summary>
///This is a test class for EntServSessionTest and is intended
///to contain all EntServSessionTest Unit Tests
///</summary>
[TestClass()]
public class EntServSessionTest
{
private TestContext testContextInstance;
/// <summary>
///Gets or sets the test context which provides
///information about and functionality for the current test run.
///</summary>
public TestContext TestContext
{
get
{
return testContextInstance;
}
set
{
testContextInstance = value;
}
}
#region Additional test attributes
//
//You can use the following additional attributes as you write your tests:
//
//Use ClassInitialize to run code before running the first test in the class
//[ClassInitialize()]
//public static void MyClassInitialize(TestContext testContext)
//{
//}
//
//Use ClassCleanup to run code after all tests in a class have run
//[ClassCleanup()]
//public static void MyClassCleanup()
//{
//}
//
//Use TestInitialize to run code before running each test
//[TestInitialize()]
//public void MyTestInitialize()
//{
//}
//
//Use TestCleanup to run code after each test has run
//[TestCleanup()]
//public void MyTestCleanup()
//{
//}
//
#endregion
/// <summary>
///A test for Login
///</summary>
// TODO: Ensure that the UrlToTest attribute specifies a URL to an ASP.NET page (for example,
// http://.../Default.aspx). This is necessary for the unit test to be executed on the web server,
// whether you are testing a page, web service, or a WCF service.
[TestMethod()]
[HostType("ASP.NET")]
[AspNetDevelopmentServerHost("%PathToWebRoot%\\EntServ2-ASP.NET\\trunk\\WWW", "/WWW")]
[UrlToTest("http://localhost/WWW")]
public void LoginTest()
{
string username = string.Empty; // TODO: Initialize to an appropriate value
string password = string.Empty; // TODO: Initialize to an appropriate value
EntServSession expected = null;
EntServSession actual = EntServSession_Accessor.Login(username, password);
Assert.AreEqual(expected, actual);
Assert.Inconclusive("Verify the correctness of this test method.");
}
}
}
</code></pre>
<p>I tried running the test and it tries to compile and I get the build error:</p>
<pre><code>Error 1
The type or namespace name 'EntServSession' could not be found
(are you missing a using directive or an assembly reference?) C:\Projects\EntServ-ASP.NET\trunk\Tests\EntServObjectTests\EntServSessionTest.cs
82
13
EntServObjectTests
</code></pre>
<p>I publish the web site and put a reference to the App_code.dll in the test project and I no longer get a build error. I instead get the following exception error. I put break points on every line of the class, and the debugger does not stop on any line .</p>
<pre><code>Error Message
Test method EntServObjectTests.EntServSessionTest.LoginTest threw exception: System.InvalidCastException: Unable to cast object of type 'EntServ2.BusinessObjects.EntServSession' to type 'EntServ2.BusinessObjects.EntServSession'..
Stack Trace
EntServ2.BusinessObjects.EntServSession_Accessor.Login(String username, String password)
EntServObjectTests.EntServSessionTest.LoginTest() in C:\Projects\EntServ2-ASP.NET\trunk\Tests\EntServObjectTests\EntServSessionTest.cs: line 83
</code></pre>
| [
{
"answer_id": 414700,
"author": "Odd",
"author_id": 11908,
"author_profile": "https://Stackoverflow.com/users/11908",
"pm_score": 0,
"selected": false,
"text": "[TestMethod()]\n[HostType(\"ASP.NET\")]\n[AspNetDevelopmentServerHost(\"%PathToWebRoot%\\\\EntServ2-ASP.NET\\\\trunk\\\\WWW\",... | 2009/01/05 | [
"https://Stackoverflow.com/questions/413927",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18893/"
] |
413,928 | <p>Is there any advantage to writing a PHP conditional like this:</p>
<pre><code>if ($variable != NULL) {
</code></pre>
<p>versus</p>
<pre><code>if (!empty($variable)) {
</code></pre>
<p>versus</p>
<pre><code>if ($variable) {
</code></pre>
<p>Aren't they all same thing? It seems like the last is always the simplest if you are just trying to tell whether the variable exists or not. Thanks for helping me understand the difference here. I missed the first day of PHP 101.</p>
| [
{
"answer_id": 414046,
"author": "Ross",
"author_id": 2025,
"author_profile": "https://Stackoverflow.com/users/2025",
"pm_score": 3,
"selected": true,
"text": "if ($variable != NULL) {\n $variable NULL isset if (!empty($variable)) {\n $variable (string) $variable strlen true false $varia... | 2009/01/05 | [
"https://Stackoverflow.com/questions/413928",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45838/"
] |
413,929 | <p>It seems like my code works to check for null if I do</p>
<pre><code>if ($tx)
</code></pre>
<p>or </p>
<pre><code>if (isset($tx))
</code></pre>
<p>why would I do the second one when it's harder to write?</p>
| [
{
"answer_id": 413936,
"author": "Kenan Banks",
"author_id": 43089,
"author_profile": "https://Stackoverflow.com/users/43089",
"pm_score": 2,
"selected": false,
"text": "isset() ini_set('display_errors', 1);\nerror_reporting(E_ALL);\n"
},
{
"answer_id": 413952,
"author": "jos... | 2009/01/05 | [
"https://Stackoverflow.com/questions/413929",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8047/"
] |
413,930 | <p>When I have some function of type like</p>
<pre><code>f :: (Ord a) => a -> a -> Bool
f a b = a > b
</code></pre>
<p>I should like make function which wrap this function with not.</p>
<p>e.g. make function like this</p>
<pre><code>g :: (Ord a) => a -> a -> Bool
g a b = not $ f a b
</code></pre>
<p>I can make combinator like</p>
<pre><code>n f = (\a -> \b -> not $ f a b)
</code></pre>
<p>But I don't know how.</p>
<pre><code>*Main> let n f = (\a -> \b -> not $ f a b)
n :: (t -> t1 -> Bool) -> t -> t1 -> Bool
Main> :t n f
n f :: (Ord t) => t -> t -> Bool
*Main> let g = n f
g :: () -> () -> Bool
</code></pre>
<p>What am I doing wrong?</p>
<p>And bonus question how I can do this for function with more and lest parameters e.g.</p>
<pre><code>t -> Bool
t -> t1 -> Bool
t -> t1 -> t2 -> Bool
t -> t1 -> t2 -> t3 -> Bool
</code></pre>
| [
{
"answer_id": 414057,
"author": "Apocalisp",
"author_id": 3434,
"author_profile": "https://Stackoverflow.com/users/3434",
"pm_score": 4,
"selected": false,
"text": "n = ((not .) .)\n lift2 = (.).(.)\nlift3 = (.).(.).(.)\nlift4 = (.).(.).(.).(.)\nlift5 = (.).(.).(.).(.).(.)\n"
},
{
... | 2009/01/05 | [
"https://Stackoverflow.com/questions/413930",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49197/"
] |
413,940 | <p>I am receiving a value out of range: underflow error from pgsql, in a query that uses the EXP(x) function. What values of x trigger this? How do I prevent or detect it?</p>
| [
{
"answer_id": 492003,
"author": "Noah",
"author_id": 12113,
"author_profile": "https://Stackoverflow.com/users/12113",
"pm_score": 3,
"selected": true,
"text": "exp(700) = 1.01423205 × 10^304\nexp(-700) = 9.85967654 × 10^-305\n"
},
{
"answer_id": 17533673,
"author": "Spen",
... | 2009/01/05 | [
"https://Stackoverflow.com/questions/413940",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/525/"
] |
413,954 | <p>I want to find a way to produce drop caps (large initial letters several lines high) in pdfLaTeX. I know that there is a <code>dropping</code> package which works well when used with <code>latex</code> + <code>dvips</code>. However, when used with <code>pdflatex</code> the result looks ugly.</p>
<p>My source file is:</p>
<pre><code>\documentclass[12pt]{article}
% for pdflatex file.tex # dropping is ugly
% \usepackage[pdftex]{graphicx}
% \usepackage[pdftex]{dropping}
% for latex file.tex ; dvips -T 12cm,8cm file.dvi # dropping is OK
\usepackage[dvips]{graphicx}
\usepackage{dropping}
\usepackage[papersize={12cm,8cm},
left=0.5cm,right=0.5cm,
top=0.5cm,bottom=0.5cm]{geometry}
\begin{document}
\dropping[-3pt]{3}{W}ith a drop cap, the initial sits within the margins and
runs several lines deep into the paragraph, pushing some normal-sized text off
these lines. This keeps the left and top margins of the paragraph flush.
In~modern browsers, this can be done with a combination of HTML and CSS
by~using the float: left; setting.
\end{document}
</code></pre>
<p>When I compile it as</p>
<pre><code>latex drop.tex && dvips -T 12cm,8cm drop.dvi
</code></pre>
<p>the result is OK:</p>
<p><a href="https://i.stack.imgur.com/oSIvg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oSIvg.png" alt="dropping-latex-dvips" /></a></p>
<p>When I uncomment <code>[pdftex]</code> lines and compile it as</p>
<pre><code>pdflatex drop.tex
</code></pre>
<p>the results is:</p>
<p><a href="https://i.stack.imgur.com/kZsKc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kZsKc.png" alt="dropping-pdflatex" /></a></p>
<p>Can anyone suggest a better way to produce drop caps with <code>pdflatex</code>?</p>
| [
{
"answer_id": 414091,
"author": "sastanin",
"author_id": 25450,
"author_profile": "https://Stackoverflow.com/users/25450",
"pm_score": 5,
"selected": true,
"text": "lettrine.sty lettrine.sty lettrine.sty \\usepackage{type1cm} \\documentclass[12pt]{article}\n\n% works with pdfLaTeX\n\\us... | 2009/01/05 | [
"https://Stackoverflow.com/questions/413954",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25450/"
] |
413,955 | <p>I'm developing a Linux driver loadable module and I have to use another device in my driver.(kind of driver stacked on another driver)</p>
<p>How do I call/use another driver in my driver? I think they are both in the kernel so there might be a way that can use another driver directly.</p>
| [
{
"answer_id": 414123,
"author": "Martin Carpenter",
"author_id": 39443,
"author_profile": "https://Stackoverflow.com/users/39443",
"pm_score": 5,
"selected": true,
"text": "EXPORT_SYMBOL EXPORT_SYMBOL_GPL /* mod1.c */\n#include <linux/module.h>\n#include <linux/kernel.h>\n#include \"mod... | 2009/01/05 | [
"https://Stackoverflow.com/questions/413955",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41803/"
] |
413,962 | <p>Here's a snippet of code from a shell script I have written:</p>
<pre><code>for src in $(find . -type f -maxdepth 1 \! -name ${deploy} \! -name gvimrc)
do
src=$(basename ${src})
dest="~/.${src}"
copy="${src} -> ${dest}"
cp $src $dest && echo -e "${ok} ${copy}" || echo -e "${fail} ${copy}"
done
</code></pre>
<p>For some reason, <code>cp</code> fails to execute. For example, in the case in which <code>$src='bashrc'</code>, I get this error:</p>
<pre><code>cp: ~/.bashrc: No such file or directory
</code></pre>
<p>I don't understand why this happens, though, because obviously, <code>~/.bashrc</code> is the <em>destination</em>, not the source, so <code>cp</code> shouldn't care whether it exists or not. What exactly is going wrong?</p>
| [
{
"answer_id": 413973,
"author": "iny",
"author_id": 27067,
"author_profile": "https://Stackoverflow.com/users/27067",
"pm_score": 4,
"selected": true,
"text": "dest=~/\".${src}\"\n"
},
{
"answer_id": 413974,
"author": "matpie",
"author_id": 51021,
"author_profile": "... | 2009/01/05 | [
"https://Stackoverflow.com/questions/413962",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28804/"
] |
413,985 | <p>What is the proper place to explain error handling in a try-catch statement? It seems like you could put explanatory comments at either the beginning of the try block or the catch block. </p>
<pre><code>// Possible comment location 1
try
{
// real code
}
// Possible comment location 2
catch
{
// Possible comment location 3
// Error handling code
}
</code></pre>
| [
{
"answer_id": 414000,
"author": "Bill the Lizard",
"author_id": 1288,
"author_profile": "https://Stackoverflow.com/users/1288",
"pm_score": 5,
"selected": true,
"text": "try\n{ \n real code // throws SomeException\n real code // throws SomeOtherException\n}\ncatch(SomeException ... | 2009/01/05 | [
"https://Stackoverflow.com/questions/413985",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18891/"
] |
413,987 | <p>I was wondering if anyone knows of a way to use the JQuery find method or inArray method to find an item in an array. I can't seem to find anything in the docs.</p>
<p>for example:</p>
<pre><code>var items = [{id:1, name:'bob'}, {id:2, name:'joe'}, {id:3, name:'ben'}];
var found = $(items).find("[name='ben']");
</code></pre>
<p>or</p>
<pre><code>var items = [{id:1, name:'bob'}, {id:2, name:'joe'}, {id:3, name:'ben'}];
var found = $.inArray("[name='ben']", items);
</code></pre>
| [
{
"answer_id": 414014,
"author": "Sarat",
"author_id": 18937,
"author_profile": "https://Stackoverflow.com/users/18937",
"pm_score": 3,
"selected": true,
"text": "$.RichArray.filter()\n"
},
{
"answer_id": 414021,
"author": "EndangeredMassa",
"author_id": 106,
"author_... | 2009/01/05 | [
"https://Stackoverflow.com/questions/413987",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37881/"
] |
413,989 | <p>Lets say I have the following:</p>
<pre><code>public class MyObject
{
[Bindable]
public var foo:int = 3;
}
...
[Bindable]
var _obj:MyObject = null;
</code></pre>
<p>What's the best way to bind foo so that this binding is updated when _obj is set to a new instance?</p>
<p>I've tried: </p>
<pre><code><mx:Label text="{_obj&amp;&amp;_obj.foo}"/>
</code></pre>
<p>But it isn't pretty. Can I express this somehow using
<p>What do the SO::Flex community think?</p>
| [
{
"answer_id": 414094,
"author": "Brandon",
"author_id": 23133,
"author_profile": "https://Stackoverflow.com/users/23133",
"pm_score": 1,
"selected": false,
"text": "[Bindable]\npublic class MyObject\n{\n [Bindable]\n public var foo:int = 3;\n}\n <mx:Label text=\"{_obj.foo}\"/>\n"
... | 2009/01/05 | [
"https://Stackoverflow.com/questions/413989",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40939/"
] |
413,993 | <p>I am able to design custom UITableViewCells and load them just fine using the technique described in the thread found at <a href="http://forums.macrumors.com/showthread.php?t=545061" rel="noreferrer">http://forums.macrumors.com/showthread.php?t=545061</a>. However, using that method no longer allows you to init the cell with a reuseIdentifier which means you have to create whole new instances of each cell at every call. Has anyone figured out a good way to still cache particular cell types for reuses, but still be able to design them in Interface Builder?</p>
| [
{
"answer_id": 414032,
"author": "Louis Gerbarg",
"author_id": 30506,
"author_profile": "https://Stackoverflow.com/users/30506",
"pm_score": 7,
"selected": true,
"text": "- (NSString *) reuseIdentifier {\n return @\"myIdentifier\";\n}\n"
},
{
"answer_id": 532168,
"author": "... | 2009/01/05 | [
"https://Stackoverflow.com/questions/413993",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/50808/"
] |
414,001 | <p>In PHP, we (at least the good programmers) always start general variable names with a lower-case letter, but class variables/objects with an upper-case letter to distinguish them. In the same way we start general file names with a lower case letter, but files containing Classes with an upper case letter.</p>
<p>E.g.:</p>
<pre class="lang-php prettyprint-override"><code><?php
$number = 123;
$string = "a string";
$colors_array = array('red', 'blue', 'red');
$Cat = New Cat();
?>
</code></pre>
<p>Are the conventions the same in Java, i.e., objects starting with upper-case, but the rest with lower case, or does everything start with lower case as I've read in other places?</p>
| [
{
"answer_id": 414029,
"author": "Richard Campbell",
"author_id": 12254,
"author_profile": "https://Stackoverflow.com/users/12254",
"pm_score": 6,
"selected": true,
"text": "int count = 32;\ndouble conversionFactor = 1.5d;\n public static final double KILOGRAM_TO_POUND = 2.20462262;\n HT... | 2009/01/05 | [
"https://Stackoverflow.com/questions/414001",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49153/"
] |
414,012 | <p>Is there a way to make a paragraph in a Microsoft Word 2003 document readonly using VBA?</p>
| [
{
"answer_id": 414118,
"author": "adilei",
"author_id": 50291,
"author_profile": "https://Stackoverflow.com/users/50291",
"pm_score": 1,
"selected": false,
"text": "Selection.MoveLeft Unit:=wdCharacter, Count:=11, Extend:=wdExtend \nSelection.Editors.Add wdEditorEveryone\nActiveDocument.... | 2009/01/05 | [
"https://Stackoverflow.com/questions/414012",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5653/"
] |
414,034 | <p>I'm aware of the risks of rolling your own user authentication scripts, but I'm also wary of using packages that don't seem to be actively maintained: the <a href="http://pear.php.net/package/LiveUser/download/" rel="noreferrer">current version of PEAR LiveUser</a> is almost a year old.</p>
<p>Please recommend (and argue the case for) an actively-maintained user-authentication library which can be integrated into an existing web project. It should ideally support various roles - anonymous users, registered users and administrators at various levels. </p>
| [
{
"answer_id": 414054,
"author": "Ross",
"author_id": 2025,
"author_profile": "https://Stackoverflow.com/users/2025",
"pm_score": 3,
"selected": false,
"text": "Zend_Auth Zend_Acl"
}
] | 2009/01/05 | [
"https://Stackoverflow.com/questions/414034",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20074/"
] |
414,074 | <p>I've been trying to see if there is an easy/clever way to implement binding to ListBox.SelectedItems. If you have tried yourself, you will know, that markup binding using BindingExtension will not work - the property doesn't support it. So you are left with wiring up a handler for SelectionChanged and trying that route. The closest I've gotten is this post:</p>
<p><strike><a href="http://alexshed.spaces.live.com/blog/cns!71C72270309CE838!149.entry" rel="nofollow noreferrer">http://alexshed.spaces.live.com/blog/cns!71C72270309CE838!149.entry</a></strike></p>
<p><em>Update: the above mentioned blog is no longer available, that author's current blog <a href="http://blogs.ugidotnet.org/SoaringCode/Default.aspx" rel="nofollow noreferrer">is here</a> and the closest I could find to the referenced blog post is <a href="https://stackoverflow.com/a/1584718/109702">this StackOverflow answer</a>.</em></p>
<p>Which implements all the necessary C# in a handy attached property. But it implements the "binding" as a One-Way, Target to Source. I'd like Two-Way binding.</p>
<p>Any ideas?</p>
| [
{
"answer_id": 25694034,
"author": "user4013241",
"author_id": 4013241,
"author_profile": "https://Stackoverflow.com/users/4013241",
"pm_score": 0,
"selected": false,
"text": "using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.Specialize... | 2009/01/05 | [
"https://Stackoverflow.com/questions/414074",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49465/"
] |
414,098 | <p>Is there a way for an .NET library to detect whether or not it is being run as a service? </p>
<p>My library can be run either way. But when its run as a service, developers need to call an additional method indicating that fact or certain features won't work correctly. I want my library, which handles logging, to write a warning if it is used in a service without that method being called.</p>
| [
{
"answer_id": 414159,
"author": "Pierre Arnaud",
"author_id": 4597,
"author_profile": "https://Stackoverflow.com/users/4597",
"pm_score": 2,
"selected": false,
"text": "WTSRegisterSessionNotification [DllImport(\"kernel32.dll\")]\n private static extern int WTSGetActiveConsoleSession... | 2009/01/05 | [
"https://Stackoverflow.com/questions/414098",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5274/"
] |
414,106 | <p>Here’s an interesting question. Suppose we have related tables in the database, for example, Instrument and Currency. Instrument table has a currency_id field that is mapped to entry in Currency table. In Linq land what’s the better way:</p>
<p>a) Create Instrument and Currency entities in the DataContext and then create association or simply use join in Linq queries or</p>
<p>b) Create a view in the database that joins Instrument and Currency (thus resolving currency_id to currency code) and use that as an entity in Linq context?</p>
| [
{
"answer_id": 416788,
"author": "Amy B",
"author_id": 8155,
"author_profile": "https://Stackoverflow.com/users/8155",
"pm_score": 0,
"selected": false,
"text": "DataLoadOptions dlo = new DataLoadOptions();\ndlo.LoadWith<Instrument>(i => i.Currencies)\nmyDataContext.LoadOptions = dlo;\n"... | 2009/01/05 | [
"https://Stackoverflow.com/questions/414106",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2246271/"
] |
414,109 | <p>If I have, say, 100 items that'll be stored in a dictionary, should I initialise it thus?</p>
<pre><code>var myDictionary = new Dictionary<Key, Value>(100);
</code></pre>
<p>My understanding is that the .NET dictionary internally resizes itself when it reaches a given loading, and that the loading threshold is defined as a ratio of the capacity.</p>
<p>That would suggest that if 100 items were added to the above dictionary, then it would resize itself when one of the items was added. Resizing a dictionary is something I'd like to avoid as it has a performance hit and is wasteful of memory.</p>
<p>The probability of hashing collisions is proportional to the loading in a dictionary. Therefore, even if the dictionary does not resize itself (and uses all of its slots) then the performance must degrade due to these collisions. </p>
<p>How should one best decide what capacity to initialise the dictionary to, assuming you know how many items will be inside the dictionary?</p>
| [
{
"answer_id": 414145,
"author": "mmx",
"author_id": 33708,
"author_profile": "https://Stackoverflow.com/users/33708",
"pm_score": 1,
"selected": false,
"text": "HashTable Dictionary HashTable count * (1/fillfactor)"
},
{
"answer_id": 414148,
"author": "Jorge Ferreira",
"... | 2009/01/05 | [
"https://Stackoverflow.com/questions/414109",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24874/"
] |
414,137 | <p>I'm a bit confused with this one.</p>
<p>I have a Dataset with a BackupDate and a BackupTime as well as a BackupType. The BackupDate is comprised of 12 characters from the left of a datetime string within a table. The BackupTime is comprised of 8 characters from the right of that same datetime string. So for example: BackupDate would be 'December 12 2008' and the BackupTime would be '12:53PM.'</p>
<p>I have added an XY-scatter chart to the report. I've added a 'series' value for the BackupType (so one can distinguish between a Full/Incr/Log backup). I've added a category value of BackupDate and set the Scale for the X-axis from the Min of BackupDate to the Max of BackupDate. I've then added an item to the Values with the Y variable set to BackupTime and the X variable set to BackupDate. The interval for the Y-axis is 12:00AM to 11:59PM and the formatting for the labels is 'hh:mmtt'.</p>
<p>The BackupTime matches the format of the Y-axis. The BackupDate matches the format of the X-axis. 10 entries are retrieved by my Dataset and the Legend is properly populated by the BackupType field.</p>
<p>No points are being plotted on the graph and no markers/pointers are shown if they are enabled. There should be a point on the graph for every point in time of each day there is a backup of a specific type.</p>
<p>Am I missing something? Does anyone know of a good tutorial dealing specifically with XY-scatter graphs and using them in a way I intend?</p>
<p>I am using the 2005 version of SSRS rather than the 2008 version.</p>
<p>Screenshot of what my chart currently looks like:</p>
<p><img src="https://img.photobucket.com/albums/v376/MythOpus/chart.jpg" /></p>
<p>In case it could be dataset related:</p>
<pre><code>SELECT TOP (10) backup_type, LTRIM(RTRIM(LEFT(backup_finish_date,
12))) AS BackupDate, LTRIM(RTRIM(RIGHT(backup_finish_date, 8))) AS BackupTime
FROM DBARepository.Backup_History
</code></pre>
<p>As requested, here are the results of this query. There is a Where clause to constrain the results to a specific database of a specific server that was not included in the above SQL Query.</p>
<pre>Log Dec 26 2008 12:00PM
Log Dec 27 2008 4:00AM
Log Dec 27 2008 8:00AM
Log Dec 27 2008 12:00PM
Log Dec 27 2008 4:00PM
Log Dec 27 2008 8:00PM
Database Dec 27 2008 10:01PM
Log Dec 28 2008 12:00AM
Log Dec 28 2008 4:00AM
Log Dec 28 2008 8:00AM</pre>
| [
{
"answer_id": 414145,
"author": "mmx",
"author_id": 33708,
"author_profile": "https://Stackoverflow.com/users/33708",
"pm_score": 1,
"selected": false,
"text": "HashTable Dictionary HashTable count * (1/fillfactor)"
},
{
"answer_id": 414148,
"author": "Jorge Ferreira",
"... | 2009/01/05 | [
"https://Stackoverflow.com/questions/414137",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
414,138 | <p>I need to filter result sets from sql server based on selections from a multi-select list box. I've been through the idea of doing an instring to determine if the row value exists in the selected filter values, but that's prone to partial matches (e.g. Car matches Carpet). </p>
<p>I also went through splitting the string into a table and joining/matching based on that, but I have reservations about how that is going to perform. </p>
<p>Seeing as this is a seemingly common task, I'm looking to the Stack Overflow community for some feedback and maybe a couple suggestions on the most commonly utilized approach to solving this problem.</p>
| [
{
"answer_id": 414212,
"author": "Tom H",
"author_id": 5696608,
"author_profile": "https://Stackoverflow.com/users/5696608",
"pm_score": 3,
"selected": true,
"text": "SELECT\n my_column\nFROM\n My_Table\nWHERE\n @my_string LIKE '%|' + my_column + '|%'\n /*\n Name: Ge... | 2009/01/05 | [
"https://Stackoverflow.com/questions/414138",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28926/"
] |
414,164 | <p>I have a directory with about 2000 files. How can I select a random sample of <code>N</code> files through using either a bash script or a list of piped commands?</p>
| [
{
"answer_id": 414316,
"author": "Josh Lee",
"author_id": 19750,
"author_profile": "https://Stackoverflow.com/users/19750",
"pm_score": 9,
"selected": true,
"text": "ls |sort -R |tail -$N |while read file; do\n # Something involving $file, or you can leave\n # off the while to just... | 2009/01/05 | [
"https://Stackoverflow.com/questions/414164",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8330/"
] |
414,166 | <p>I was taking a look at <a href="http://www.zenfolio.com/zf/features.aspx" rel="nofollow noreferrer">http://www.zenfolio.com/zf/features.aspx</a> and I can't figure out how they are doing the accordion style expand and collapse when you click on the orange links. I have been using the Web Developer Toolbar add-on for firefox, but I have not been able to find anything in the source of the page like JavaScript that would be doing the following. If anyone knows how they are doing it, that would be very helpful.</p>
<p>This is actually unrelated, but if all you answers are good, who do I give the answer too?</p>
| [
{
"answer_id": 414192,
"author": "EdgarVerona",
"author_id": 3068,
"author_profile": "https://Stackoverflow.com/users/3068",
"pm_score": 3,
"selected": true,
"text": "//... (bunch of junk)\n zf_Features.prototype._entry_onclick = function(e, index) \n{\n var cellNode = this.dom().getE... | 2009/01/05 | [
"https://Stackoverflow.com/questions/414166",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33690/"
] |
414,176 | <p>One advantage of lambda expressions is that you have to evaluate a function only when you need its result.</p>
<p>In the following (simple) example, the text function is only evaluated when a writer is present:</p>
<pre><code>public static void PrintLine(Func<string> text, TextWriter writer)
{
if (writer != null)
{
writer.WriteLine(text());
}
}
</code></pre>
<p>Unfortunately, this makes using the code a little bit ugly. You cannot call it with a constant or variable like</p>
<pre><code>PrintLine("Some text", Console.Out);
</code></pre>
<p>and have to call it this way:</p>
<pre><code>PrintLine(() => "Some text", Console.Out);
</code></pre>
<p>The compiler is not able to "infer" a parameterless function from the passed constant. Are there any plans to improve this in future versions of C# or am I missing something?</p>
<p>UPDATE:</p>
<p>I just found a dirty hack myself:</p>
<pre><code> public class F<T>
{
private readonly T value;
private readonly Func<T> func;
public F(T value) { this.value = value; }
public F(Func<T> func) {this.func = func; }
public static implicit operator F<T>(T value)
{
return new F<T>(value);
}
public static implicit operator F<T>(Func<T> func)
{
return new F<T>(func);
}
public T Eval()
{
return this.func != null ? this.func() : this.value;
}
}
</code></pre>
<p>Now i can just define the function as:</p>
<pre><code>public static void PrintLine(F<string> text, TextWriter writer)
{
if (writer != null)
{
writer.WriteLine(text.Eval());
}
}
</code></pre>
<p>and call it both with a function or a value.</p>
| [
{
"answer_id": 414185,
"author": "Yuliy",
"author_id": 47527,
"author_profile": "https://Stackoverflow.com/users/47527",
"pm_score": 1,
"selected": false,
"text": "() => \"SomeText\" //this is a function\n\n\"SomeText\" //this is a string\n"
},
{
"answer_id": 414187,
"author"... | 2009/01/05 | [
"https://Stackoverflow.com/questions/414176",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48722/"
] |
414,179 | <p>Not sure this is a programming question, but we use LaTeX for all our API documentation and user documentation, so I hope it will go through.</p>
<p>Can someone please explain what are the relative merits of using <code>pdflatex</code> as opposed to the "classic" technique of</p>
<pre><code>latex foo
dvips -Ppdf foo
ps2pdf foo.ps
</code></pre>
<p>From time to time I run into people who have difficulty because things don't work in <code>pdflatex</code>, and I know that using <code>pdflatex</code> gives up two things I have grown to value:</p>
<ul>
<li>Can't use the very speedy <code>xdvi</code> viewer</li>
<li>Can't use the PStricks package</li>
</ul>
<p>I should add that I typically get PDF with hyperlinks by using something on the order of</p>
<pre><code>\usepackage[ps2pdf,colorlinks=true]{hyperref}
</code></pre>
<p>so it's not necessary to use <code>pdflatex</code> to get good PDF.</p>
<p>So</p>
<ol>
<li>What are the advantages of <code>pdflatex</code> that I don't know about?</li>
<li>What are the disadvantages of the old tools that I've overlooked?</li>
</ol>
| [
{
"answer_id": 758371,
"author": "Jon Ericson",
"author_id": 1438,
"author_profile": "https://Stackoverflow.com/users/1438",
"pm_score": 3,
"selected": false,
"text": "pdflatex xdvi xpdf TeX pdflatex"
}
] | 2009/01/05 | [
"https://Stackoverflow.com/questions/414179",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41661/"
] |
414,180 | <p>I was trying to add Ant libraries to a project in eclipse, and I used the ones that were part of eclipse's plugins folder. When I tried to associate them with Javadocs, I couldn't locate them in the plugin folder. I searched for them online, and I found <a href="http://ant.apache.org/manual/api/index.html" rel="nofollow noreferrer">this page</a>, in which they say the docs are not provided online because they are part of every distribution. So where can I find the docs in the distribution that came bundled in Eclipse?</p>
| [
{
"answer_id": 758371,
"author": "Jon Ericson",
"author_id": 1438,
"author_profile": "https://Stackoverflow.com/users/1438",
"pm_score": 3,
"selected": false,
"text": "pdflatex xdvi xpdf TeX pdflatex"
}
] | 2009/01/05 | [
"https://Stackoverflow.com/questions/414180",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41283/"
] |
414,191 | <p>Most things I've wanted to do in LaTeX have either been straight-forward, or easily found on the web, but this one has been stumping me.</p>
<p>I have a macro 'solution': to apply some common formatting to each solution:</p>
<pre><code>\newcommand\solution[1]{{\\ \\* \bf Solution.}#1\qed \newpage}
</code></pre>
<p>Which has worked nicely so far, but now I wanted to include a drawing which I've done quickly using 'ASCII Art' so I'd like to use \verbatim. But it doesn't work, it produces the following errors:</p>
<blockquote>
<pre><code>Runaway argument?
...
! File ended while scanning use of \@xverbatim.
</code></pre>
</blockquote>
<p>From what I read in the "Not So Short introduction to LaTeX", \verbatim can't be used this way. I assume there is a better way to do what I'm trying to do?</p>
| [
{
"answer_id": 429984,
"author": "jtxx000",
"author_id": 50129,
"author_profile": "https://Stackoverflow.com/users/50129",
"pm_score": 3,
"selected": true,
"text": "\\newcommand \\newenvironment \\begin{solution}\n \\begin{verbatim}\n [ascii art here]\n \\end{verbatim}\n\\end{soluti... | 2009/01/05 | [
"https://Stackoverflow.com/questions/414191",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24700/"
] |
414,207 | <p>I'm wondering what would be the best prectice regarding mainataining connections to the database in .Net application (ADO.NET but I guess the practice should be the same for any data layer). Should I create a database connection and propagate it throughout my application, or would it be better to just pass connection strings/factories and create a connection ad-hoc, when it is needed. </p>
<p>As I understand perfomance hit is not signifcant with pooling and it allows me to recover from broken connections quite easily (just a new connection will be created) but then again a connection object is a nice, relatively high-level abstraction and creating a new connection for every operation (not SQL command, but application operation) generates additional, duplicated code and feels like a waste of time/resources(?).</p>
<p>What do you think about these 2 cases, what are their cons/pros and which approach are you using in your real-life applications?</p>
<p>Thanks</p>
| [
{
"answer_id": 414216,
"author": "mmx",
"author_id": 33708,
"author_profile": "https://Stackoverflow.com/users/33708",
"pm_score": 2,
"selected": false,
"text": "MinPoolSize MaxPoolSize"
},
{
"answer_id": 414330,
"author": "Keith Sirmons",
"author_id": 1048,
"author_p... | 2009/01/05 | [
"https://Stackoverflow.com/questions/414207",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51765/"
] |
414,222 | <p>If I have a table that (among other columns) has two DATETIME columns, how would I select the <strong>most recent</strong> date from those two columns.</p>
<p>Example:</p>
<pre><code>ID Date1 Date2
1 1/1/2008 2/1/2008
2 2/1/2008 1/1/2008
3 1/10/2008 1/10/2008
</code></pre>
<p>If I wanted my results to look like </p>
<pre><code>ID MostRecentDate
1 2/1/2008
2 2/1/2008
3 1/10/2008
</code></pre>
<p>Is there a simple way of doing this that I am obviously overlooking? I know I can do subqueries and case statements or even write a function in sql server to handle it, but I had it in my head that there was a max-compare type function already built in that I am just forgetting about.</p>
| [
{
"answer_id": 414232,
"author": "Rockcoder",
"author_id": 5290,
"author_profile": "https://Stackoverflow.com/users/5290",
"pm_score": 7,
"selected": true,
"text": "SELECT ID,\n CASE WHEN Date1 > Date2 THEN Date1\n ELSE Date2\n END AS MostRecentDate\nFROM Table\n C... | 2009/01/05 | [
"https://Stackoverflow.com/questions/414222",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22164/"
] |
414,225 | <p>I have a file that I can get to with the UNC \mypath\myfile. I retrieve the path with c# and assign it to a link. The browser opens the file inside itself (ie display in the browser) without problem. But, when I try and save to \mypath\myfile I am prompted to save it locally. If I view the file outside of the browser (IE 7) I can edit and save as expected, again, via the UNC.</p>
<p>What I trying to do is use iframe to display the file from my UNC (file:///\mypath\myfile), which does work, but now I can't edit it. Outside the browser I can.</p>
<p>Is there anyway to save a PDF when displaying it inside the browser? I also tried a button to use the save method on the pdf, but it did not work.</p>
<p>Thank you.</p>
<p>I am using IE 7 and Adobe Professional 7.1.0.</p>
| [
{
"answer_id": 414278,
"author": "Shawn",
"author_id": 26,
"author_profile": "https://Stackoverflow.com/users/26",
"pm_score": 0,
"selected": false,
"text": "<body>\n <div style=\"height:80px\">\n <p><a href=\"downloadpdf.aspx\" target=\"_blank\">Save</a>\n </div>\n <div>... | 2009/01/05 | [
"https://Stackoverflow.com/questions/414225",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28045/"
] |
414,230 | <p>I wrote this tiny Python snippet that scrapes a feed and prints it out. When I run the code, something in the feed triggers the error message you see here as my question. Here's the complete console output on error:</p>
<pre><code>> Traceback (most recent call last):
> File "/home/vijay/ffour/ffour5.py",
> line 20, in <module>
> myfeed() File "/home/vijay/ffour/ffour5.py", line
> 15, in myfeed
> sys.stdout.write(entry["title"]).encode('utf-8')
> AttributeError: 'NoneType' object has
> no attribute 'encode'
</code></pre>
| [
{
"answer_id": 414239,
"author": "Konrad Rudolph",
"author_id": 1968,
"author_profile": "https://Stackoverflow.com/users/1968",
"pm_score": 4,
"selected": false,
"text": "> sys.stdout.write(entry[\"title\"]).encode('utf-8')\n sys.stdout.write(entry[\"title\"].encode('utf-8'))\n"
},
{... | 2009/01/05 | [
"https://Stackoverflow.com/questions/414230",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
414,243 | <p>C++ does not have native support for lazy evaluation (as Haskell does).</p>
<p>I'm wondering if it is possible to implement lazy evaluation in C++ in a reasonable manner. If yes, how would you do it?</p>
<p>EDIT: I like Konrad Rudolph's answer.</p>
<p>I'm wondering if it's possible to implement it in a more generic fashion, for example by using a parametrized class lazy that essentially works for T the way matrix_add works for matrix.</p>
<p>Any operation on T would return lazy instead. The only problem is to store the arguments and operation code inside lazy itself. Can anyone see how to improve this?</p>
| [
{
"answer_id": 414250,
"author": "Martin York",
"author_id": 14065,
"author_profile": "https://Stackoverflow.com/users/14065",
"pm_score": 2,
"selected": false,
"text": "class X\n{\n public: static X& getObjectA()\n {\n static X instanceA;\n\n return instanceA;\... | 2009/01/05 | [
"https://Stackoverflow.com/questions/414243",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51568/"
] |
414,264 | <p>Suppose I have a method </p>
<pre><code>public Patient(int id)
{
----
}
</code></pre>
<p>that returns Patient object given an id.. I could define contract in 2 ways</p>
<ol>
<li>Method would return null if patient does not exist</li>
<li>Method would throw an exception if patient does not exist. In this case I would also define a query method that returns true if the Patient exist in the database or false otherwise...</li>
</ol>
<p>Which contract should I use? Any other suggestions?</p>
<p>Update: Please comment on this case too...
If it is not an database assigned Id and it is something a user enter in UI.. like SSN .. then which one is better..</p>
<p>Comment about Null pattern from Steve that I think is valid:
probably not a good idea here, as it would be really useful to know immediately when an ID did not exist.</p>
<p>And I also think Null pattern here would be somewhat heavy weight</p>
<p>Comment from Rob Wells on throwing exception because its bad Id:
i don't think a typo in a patient's name is an exceptional circumstance" IMHO </p>
| [
{
"answer_id": 414285,
"author": "Adam Bellaire",
"author_id": 21632,
"author_profile": "https://Stackoverflow.com/users/21632",
"pm_score": 2,
"selected": false,
"text": "id null"
},
{
"answer_id": 414322,
"author": "Bevan",
"author_id": 30280,
"author_profile": "htt... | 2009/01/05 | [
"https://Stackoverflow.com/questions/414264",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30917/"
] |
414,267 | <p>Where would you place the SaveSettings method in your project when the user is done editing any settings on the Settings dialog in your program?</p>
<p>Should it be in the return like:</p>
<pre><code> using (frmSettings frmSettings = new frmSettings())
{
if (frmSettings.ShowDialog() == DialogResult.OK)
{
// clicked OK, should I call SaveSettings() here?
}
else
{
// clicked cancel.
}
}
</code></pre>
<p>Or where should I place it?</p>
| [
{
"answer_id": 414271,
"author": "EdgarVerona",
"author_id": 3068,
"author_profile": "https://Stackoverflow.com/users/3068",
"pm_score": 3,
"selected": true,
"text": "// clicked OK, should I call SaveSettings() here? \n"
},
{
"answer_id": 414308,
"author": "David Basarab",
... | 2009/01/05 | [
"https://Stackoverflow.com/questions/414267",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
414,276 | <p>I want to limit a report to return records from Date A through Date B. This is what I have been doing:</p>
<pre><code>declare @startDate varchar(20)
declare @endDate varchar(20)
set @startDate = '01/01/2008'
set @endDate = '04/01/2008'
-- test what are the start and end dates
select min(date),max(date) from view_Inspections
where date between @startDate and @endDate
</code></pre>
<p>... which I was told returned records from 12 am Jan 1st through 11:59 pm March 31st (that midnight is the default when no time is indicated). But I noticed a discrepancy, which is if a record has a time of 00:00:00 that it will be part of this set.</p>
<p>Is there a more exact way of doing this so it will return exactly the date range I want?*</p>
<p>I tried using time:</p>
<pre><code>declare @startDate varchar(20)
declare @endDate varchar(20)
set @startDate = '01/01/2008 00:00:00'
set @endDate = '04/01/2008 11:59:59'
-- test what are the start and end dates
select min(date),max(date) from view_Inspections
where date between @startDate and @endDate
</code></pre>
<p>... but I noticed something wonky: SQL Server will ROUND the hundreth-second up by half. So I get that April 1st record (ha! April Fool's record! grr) if I use any time later than 11:59:29. Why is that?</p>
<ul>
<li>(I feel sure there is. I'm new at this. Thanks for your help!)</li>
</ul>
| [
{
"answer_id": 414286,
"author": "Rowland Shaw",
"author_id": 50447,
"author_profile": "https://Stackoverflow.com/users/50447",
"pm_score": 4,
"selected": true,
"text": "declare @startDate varchar(20)\ndeclare @endDate varchar(20)\nset @startDate = '01/01/2008'\nset @endDate = '04/01/200... | 2009/01/05 | [
"https://Stackoverflow.com/questions/414276",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26198/"
] |
414,283 | <p>I have a stored procedure that returns two int Values. The first can not be null but the second can actually return a null value. When I try to execute my stored procedure using LINQ to SQL it fails with the statement:</p>
<blockquote>
<p>The null value cannot be assigned to a member with type System.Int32 which is a non-nullable value type.</p>
</blockquote>
<p>I tried to change my designer file in my DBML and add in: <code>CanBeNull= true</code> to the Column mapping of the Stored Procedures Result.</p>
<p>I'm can seem to figure out the correct way to handle this, not sure if I can change my LINQ/C# code to account for the null (which would be preferable) or if I will have to update my Stored Procedure in some fashion.</p>
| [
{
"answer_id": 414304,
"author": "Perry Neal",
"author_id": 44633,
"author_profile": "https://Stackoverflow.com/users/44633",
"pm_score": 2,
"selected": false,
"text": "int? myInt;\n"
},
{
"answer_id": 414314,
"author": "Micah",
"author_id": 17744,
"author_profile": "... | 2009/01/05 | [
"https://Stackoverflow.com/questions/414283",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20748/"
] |
414,290 | <p>How do I do sorting when generating anonymous types in linq to sql?</p>
<p>Ex:</p>
<pre><code>from e in linq0
order by User descending /* ??? */
select new
{
Id = e.Id,
CommentText = e.CommentText,
UserId = e.UserId,
User = (e.User.FirstName + " " + e.User.LastName).Trim()),
Date = string.Format("{0:d}", e.Date)
}
</code></pre>
| [
{
"answer_id": 414297,
"author": "mmx",
"author_id": 33708,
"author_profile": "https://Stackoverflow.com/users/33708",
"pm_score": 3,
"selected": false,
"text": "from e in linq0\norder by (e.User.FirstName + \" \" + e.User.LastName).Trim()) descending \nselect new\n{\n Id = e.Id,\n C... | 2009/01/05 | [
"https://Stackoverflow.com/questions/414290",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40939/"
] |
414,307 | <p>I currently working with a larger wikipedia-dump derived PostgreSQL database; it contains about 40 GB of data. The database is running on an HP Proliant ML370 G5 server with Suse Linux Enterprise Server 10; I am querying it from my laptop over a private network managed by a simple D-Link router. I assigned static DHCP (private) IPs to both laptop and server.</p>
<p>Anyway, from my laptop, using pgAdmin III, I send off some SQL commands/queries; some of these are CREATE INDEX, DROP INDEX, DELETE, SELECT, etc. Sometimes I send a command (like CREATE INDEX), it returns, telling me that the query was executed perfectly, etc. However, the postmaster process assigned to such a command seems to remain sleeping on the server. Now, I do not really mind this, for I say to myself that PostgreSQL maintains a pool of postmasters ready to process queries. Yet, if this process eats up 6 GB of it 9.4 GB assigned RAM, I worry (and it does so for the moment). Now maybe this is a cache of data that is kept in [shared] memory in case another query happens to need to use that same data, but I do not know.</p>
<p>Another thing is bothering me. </p>
<p>I have 2 tables. One is the <em>page</em> table; I have an index on its <em>page_id</em> column. The other is the <em>pagelinks</em> tables which has the <em>pl_from</em> column that references either nothing or a variable in the <em>page.page_id</em> column; unlike the <em>page_id</em> column, the <em>pl_from</em> has no index (yet). To give you an idea of the scale of the tables and the necessity for me to find a viable solution, <em>page</em> table has 13.4 million rows (after I deleted those I do not need) while the <em>pagelinks</em> table has 293 million.</p>
<p>I need to execute the following command to clean the <em>pagelinks</em> table of some of its useless rows:</p>
<pre><code>DELETE FROM pagelinks USING page WHERE pl_from NOT IN (page_id);
</code></pre>
<p>So basically, I wish to rid the <em>pagelinks</em> table of all links coming from a page not in the <em>page</em> table. Even after disabling the nested loops and/or sequential scans, the query optimizer always gives me the following "solution":</p>
<pre><code>Nested Loop (cost=494640.60..112115531252189.59 rows=3953377028232000 width=6)
Join Filter: ("outer".pl_from <> "inner".page_id)"
-> Seq Scan on pagelinks (cost=0.00..5889791.00 rows=293392800 width=17)
-> Materialize (cost=494640.60..708341.51 rows=13474691 width=11)
-> Seq Scan on page (cost=0.00..402211.91 rows=13474691 width=11)
</code></pre>
<p>It seems that such a task would take more than weeks to complete; obviously, this is unacceptable. It seems to me that I would much rather it use the <em>page_id</em> index to do its thing...but it is a stubborn optimizer and I might be wrong. </p>
| [
{
"answer_id": 415069,
"author": "Nicholas Leonard",
"author_id": 49985,
"author_profile": "https://Stackoverflow.com/users/49985",
"pm_score": 2,
"selected": true,
"text": "CREATE TABLE temp_to_delete AS(\n (SELECT DISTINCT pl_from FROM pagelinks) \n EXCEPT \n (SELECT page_... | 2009/01/05 | [
"https://Stackoverflow.com/questions/414307",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49985/"
] |
414,309 | <p>I've got alot of projects and I don't have a master solution with everything in it. The reason I want one is for refactoring.</p>
<p>So I was wondering if anybody knew an automatic way to build a solution file. Manually adding all the projects just isn't feasible.</p>
| [
{
"answer_id": 414364,
"author": "rodbv",
"author_id": 79101,
"author_profile": "https://Stackoverflow.com/users/79101",
"pm_score": 2,
"selected": false,
"text": "Imports EnvDTE\nImports EnvDTE80\n-----------------------------------------------------------------------------------\n P... | 2009/01/05 | [
"https://Stackoverflow.com/questions/414309",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45005/"
] |
414,310 | <p>I've got two WPF Toolkit <code>DataGrids</code>, I'd like so that when the user resizes the first column in the first grid, it resizes the first column in the second grid. I've tried binding the width of the <code>DataGridColumn</code> in the second grid to the appropriate column in the first grid, but it doesn't work. I'd prefer to use all xaml, but I'm fine with using code behind as well.</p>
<pre><code><tk:DataGrid Width="100" Height="100">
<tk:DataGrid.Columns>
<tk:DataGridTextColumn x:Name="Column1" Width="50"/>
</tk:DataGrid.Columns>
</tk:DataGrid>
<tk:DataGrid Width="100" Height="100">
<tk:DataGrid.Columns>
<tk:DataGridTextColumn x:Name="Column1Copy" Width="{Binding Path=ActualWidth, ElementName=Column1}"/>
</tk:DataGrid.Columns>
</tk:DataGrid>
</code></pre>
<p>I also tried binding to <code>Width</code> instead of <code>ActualWidth</code>, but neither works.</p>
<p>Any help is greatly appreciated.</p>
| [
{
"answer_id": 414884,
"author": "Ray Booysen",
"author_id": 42124,
"author_profile": "https://Stackoverflow.com/users/42124",
"pm_score": 1,
"selected": false,
"text": "<tk:DataGrid Width=\"100\" Height=\"100\" x:Name=\"Grid1\" Grid.Column=\"0\">\n <tk:DataGrid.Columns>\n <tk:Dat... | 2009/01/05 | [
"https://Stackoverflow.com/questions/414310",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4572/"
] |
414,328 | <p>In C# should you have code like:</p>
<pre><code>public static string importantRegex = "magic!";
public void F1(){
//code
if(Regex.IsMatch(importantRegex)){
//codez in here.
}
//more code
}
public void main(){
F1();
/*
some stuff happens......
*/
F1();
}
</code></pre>
<p>or should you persist an instance of a Regex containing the important pattern? What is the cost of using Regex.IsMatch? I imagine there is an NFA created in each Regex intance. From what I understand this NFA creation is non trivial. </p>
| [
{
"answer_id": 414335,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 5,
"selected": false,
"text": "RegexOptions.Compiled"
},
{
"answer_id": 414356,
"author": "Andrew Hare",
"author_id": 34211,
"autho... | 2009/01/05 | [
"https://Stackoverflow.com/questions/414328",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1455/"
] |
414,336 | <p>I know this has something to do with parameter sniffing, but I'm just perplexed at how something like the following example is even possible with a piece of technology that does so many complex things well.</p>
<p>Many of us have run into stored procedures that intermittently run several of orders of magnitude slower than usual, and then if you copy out the sql from the procedure and use the same parameter values in a separate query window, it runs as fast as usual.</p>
<p>I just fixed a procedure like that by converting this:</p>
<pre><code>alter procedure p_MyProc
(
@param1 int
) as -- do a complex query with @param1
</code></pre>
<p>to this:</p>
<pre><code>alter procedure p_MyProc
(
@param1 int
)
as
declare @param1Copy int;
set @param1Copy = @param1;
-- Do the query using @param1Copy
</code></pre>
<p>It went from running in over a minute back down to under one second, like it usually runs. This behavior seems totally random. For 9 out of 10 @param1 inputs, the query is fast, regardless of how much data it ends up needing to crunch, or how big the result set it. But for that 1 out of 10, it just gets lost. And the fix is to replace an int with the same int in the query?</p>
<p>It makes no sense.</p>
<p>[Edit]</p>
<p>@gbn linked to this question, which details a similar problem:</p>
<p><a href="https://stackoverflow.com/questions/379007/known-issue-sql-server-2005-stored-procedure-fails-to-complete-with-a-parameter">Known issue?: SQL Server 2005 stored procedure fails to complete with a parameter</a></p>
<p>I hesitate to cry "Bug!" because that's so often a cop-out, but this really does seem like a bug to me. When I run the two versions of my stored procedure with the same input, I see identical query plans. The only difference is that the original takes more than a minute to run, and the version with the goofy parameter copying runs instantly.</p>
| [
{
"answer_id": 414360,
"author": "mmx",
"author_id": 33708,
"author_profile": "https://Stackoverflow.com/users/33708",
"pm_score": 2,
"selected": false,
"text": "WITH RECOMPILE EXECUTE MyProcedure [parameters] WITH RECOMPILE\n WITH RECOMPILE"
},
{
"answer_id": 414368,
"author... | 2009/01/05 | [
"https://Stackoverflow.com/questions/414336",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1219/"
] |
414,339 | <p>My team has a fairly rich set of formatting rules and save actions and these rules are evolving. We're looking for a mechanism to define the centrally and propagate them automatically. We don't want to reformat the code base, but we expect the formatting to improve incrementally over time. We're using Subversion for source control, though we'd like to limit the stored configuration to the rules and actions.</p>
| [
{
"answer_id": 414398,
"author": "matt b",
"author_id": 4249,
"author_profile": "https://Stackoverflow.com/users/4249",
"pm_score": -1,
"selected": false,
"text": "File --> Export --> Preferences Window --> Preferences --> Java --> Code Style --> Formatter --> Edit button --> Export butt... | 2009/01/05 | [
"https://Stackoverflow.com/questions/414339",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4893/"
] |
414,369 | <p>I wrote a script that compiles LaTeX code through <code>pdftex</code>. The trouble is that <code>pdftex</code> only runs on linux.</p>
<p>I am accomplishing this task with the use of <code>shell_exec()</code>.</p>
<p>I don’t really have the ability to set up a linux box as a web server. I have my client computer, but it is behind a firewall that I do not control. I do have control of my work server which is running SBS 2003 with a Windows 2000 virtual machine running apache and php. To my knowledge, you can’t install <code>pdftex</code> in Windows, and if you could it wouldn’t work with <code>shell_exec()</code>.</p>
<p>Is there way to work around this with cygwin? I could install pdftex in cygwin, and then configure php to run <code>shell_exec()</code> commands inside of cygwin. If this is possible, could somebody point me in the right direction?</p>
<p>Also, I wonder if there is another course of action. I wouldn’t mind buying hosting, but any shared hosting plan isn’t going to support the app. It would have to be a virtual or dedicated hosting plan; something I can’t afford.</p>
| [
{
"answer_id": 1416705,
"author": "phirschybar",
"author_id": 146602,
"author_profile": "https://Stackoverflow.com/users/146602",
"pm_score": 2,
"selected": false,
"text": "shell_exec() $result = shell_exec(\"C:\\cygwin\\bin\\bash.exe --login -c '/cygdrive/c/cygwin/bin/convert.exe --ve... | 2009/01/05 | [
"https://Stackoverflow.com/questions/414369",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27763/"
] |
414,408 | <p>Specifically, with a <code>SortedMap<Vector<String>, int></code> I get "dimensions expected after this (<code>int</code>) token." Help!</p>
| [
{
"answer_id": 414413,
"author": "Konrad Rudolph",
"author_id": 1968,
"author_profile": "https://Stackoverflow.com/users/1968",
"pm_score": 6,
"selected": true,
"text": "Integer int Integer"
}
] | 2009/01/05 | [
"https://Stackoverflow.com/questions/414408",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51792/"
] |
414,427 | <p>I have this object graph, I want to map:</p>
<ul>
<li>abstract Account (username, password, ...)
<ul>
<li>abstract Customer (shoppingcart, orders, roles)
<ul>
<li>IndividualCustomer (user data)</li>
<li>CorporateCustomer (different user data, company data)</li>
</ul></li>
<li>Administrator (adminroles)</li>
</ul></li>
</ul>
<p>How can this be mapped against one table? (I know how to do this with an entity hierarchy that is only 1 level deep, just like in the docs, but this is different).</p>
<p>Anybody has an idea?
I asked the same in
<a href="http://groups.google.com/group/nhusers/browse_frm/thread/7a85cba0048c18d8?hl=en" rel="nofollow noreferrer">http://groups.google.com/group/nhusers/browse_frm/thread/7a85cba0048c18d8?hl=en</a>, but so far have not received a useful answer.</p>
| [
{
"answer_id": 414413,
"author": "Konrad Rudolph",
"author_id": 1968,
"author_profile": "https://Stackoverflow.com/users/1968",
"pm_score": 6,
"selected": true,
"text": "Integer int Integer"
}
] | 2009/01/05 | [
"https://Stackoverflow.com/questions/414427",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51795/"
] |
414,428 | <p>So I have these vehicles, many different types of them. Every type has its own table, with many attributes. Then I have a "vehicles" table, which holds the ids and types of all the vehicles in every table. Vehicles can have photos, so I have a "photos" table, with a vehicle_id, linking the photo to the vehicle it belongs to.</p>
<p>Now every vehicle also has a list of equipment it has, which I store as a JSON array in a single "equipment" column.</p>
<p>Something like this: <a href="http://pastie.org/353195" rel="nofollow noreferrer">http://pastie.org/353195</a></p>
<p>How could I do this better, especially with the equipment column?</p>
| [
{
"answer_id": 414468,
"author": "Svante Svenson",
"author_id": 19707,
"author_profile": "https://Stackoverflow.com/users/19707",
"pm_score": 2,
"selected": false,
"text": "vehicles:\nid | type\n---------\n1 | tank\n2 | car\n3 | boat\n4 | car\n\nequipment:\nid | name\n---------\n1 |... | 2009/01/05 | [
"https://Stackoverflow.com/questions/414428",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51796/"
] |
414,431 | <p>I read about using the CASE expression inside the WHERE clause here:</p>
<p><a href="http://scottelkin.com/sql/using-a-case-statement-in-a-sql-where-clause/" rel="nofollow noreferrer">http://scottelkin.com/sql/using-a-case-statement-in-a-sql-where-clause/</a></p>
<p>I'm trying to use this to filter results from my select statement, based on a contract number which will be passed in by the user's application. My code currently throws an error of 'Invalid parameter' no matter what is passed in. I verified SELECT/FROM are working fine, as where as a WHERE clause without a CASE expression. Here is my code.</p>
<pre><code>WHERE (CASE WHEN @ContractNo = 0 THEN @ContractNo ELSE @ContractNo END =
tblContracts.ContractNo)
</code></pre>
<p>The redundancy of the code is for troubleshooting purposes, I'm planning on using wildcard filtering on the CASE later. I'm focusing on getting the syntax down right now. I believe this should return all records for which the parameter matches the contract number stored in the table. Any help or advice would be greatly appreciated.</p>
| [
{
"answer_id": 414446,
"author": "BenAlabaster",
"author_id": 40650,
"author_profile": "https://Stackoverflow.com/users/40650",
"pm_score": 1,
"selected": false,
"text": "WHERE (CASE WHEN @ContractNo = 0 THEN @ContractNo ELSE @ContractNo END)=tblContracts.ContractNo\n Select...\n ... | 2009/01/05 | [
"https://Stackoverflow.com/questions/414431",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
414,449 | <p>For example:</p>
<pre><code>using System;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Web.Script.Serialization;
using System.Web.Script.Services;
using System.Web.Security;
using System.Data;
using System.IO;
using System.Net;
using System.Text;
using System.Xml;
using System.Xml.XPath;
using System.Web.Configuration;
using System.Collections.Generic;
</code></pre>
<p>I have something like that in a class that I have inherited. I could remove each namespace one by one to see if the class builds, BUT does it matter?</p>
<p>If I am not sure if System.Xml is needed, should I remove it? </p>
| [
{
"answer_id": 414481,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 5,
"selected": true,
"text": "Foo.SomeType Bar.SomeType using Foo; using Bar; SomeType using"
}
] | 2009/01/05 | [
"https://Stackoverflow.com/questions/414449",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32372/"
] |
414,477 | <p>I am looking at globalizing an application that I have developed in asp.net mvc.</p>
<p>I am currently using resource files to store messages that I present to the user (i.e., when I save something to the database, and the user is shown the message "The whatever was correctly saved", that text is stored in a resource file so that I can easily localize the message for another language.</p>
<p>The question I have is how to do this in a view as a whole? Right now, I've got some views that are mostly HTML with some small amount of presentation logic.</p>
<p>What is the best practice for localizing a view? I've taken a look here:</p>
<ul>
<li><a href="http://damieng.com/blog/2008/04/27/localizing-mvc-for-aspnet-views-and-master-pages" rel="nofollow noreferrer">http://damieng.com/blog/2008/04/27/localizing-mvc-for-aspnet-views-and-master-pages</a> </li>
</ul>
<p>The approach in that post seems like an interesting way to go, but I wonder how easy it will be to maintain separate views for every language.</p>
<p>NOTE: I have not done much globalization or localization in asp.net generally, so there may be some best practices from the non-mvc world that I am missing.</p>
| [
{
"answer_id": 416562,
"author": "ccook",
"author_id": 51275,
"author_profile": "https://Stackoverflow.com/users/51275",
"pm_score": 0,
"selected": false,
"text": " RouteTable.Routes.MapRoute(\n \"Globalization\",\n \"{localization}/{controller}/{action}/{id}\",\n ... | 2009/01/05 | [
"https://Stackoverflow.com/questions/414477",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29092/"
] |
414,494 | <p>I'm building a site that's sort of a cross between StackOverflow and Digg (only a different genre). Typically in the past I would have just built it using ASP.Net web forms. However I want to use this project as a way to learn new technologies. I'm using ASP.Net Mvc which is really great, but I need to learn/use some kind of javascript libraries. </p>
<p>For instance, when someone votes on a post I want it to be updated with the vote count immediately, or if someone types in text into the "tags" textbox, I want it to give a drop-down of currently used tags etc. Basically I want to provide a lot of the AJAXy stuff for my site. </p>
<p>So my question is where to I begin? I feel bombarded with so many options and I'm not sure where to start or even what they are. Can someone straighten me out and provide some explanation and direction?</p>
<ul>
<li>JSON</li>
<li>JQuery</li>
<li>MS-AJAX</li>
</ul>
<p>I'm sure there are bunch of others I can recall at the moment. </p>
| [
{
"answer_id": 414555,
"author": "William Brendel",
"author_id": 2405,
"author_profile": "https://Stackoverflow.com/users/2405",
"pm_score": 6,
"selected": true,
"text": "{ 'firstname':'Robert', 'lastname':'Smith' } document.write('Hello ' + result.firstname + ' ' + result.lastname)"
}... | 2009/01/05 | [
"https://Stackoverflow.com/questions/414494",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17744/"
] |
414,527 | <p>I'm looking at using the Dojo Objective Harness (DOH) for testing some custom JavaScript code. To that end I've read the following article:</p>
<p><a href="http://www.ibm.com/developerworks/web/library/wa-aj-doh/index.html" rel="noreferrer">http://www.ibm.com/developerworks/web/library/wa-aj-doh/index.html</a></p>
<p>and I have a question about the test case structure. The example shows that your test case modules in the same parent directory as dojo. This is a bit of a problem for us as we'd like to use DOH in multiple projects without having to include dojo in each and every one.</p>
<p>Does anyone know of a way to setup DOH to use the following structure:</p>
<ul>
<li>dojotoolkit
<ul>
<li>dojo</li>
<li>dijit</li>
<li>dojox</li>
<li>util</li>
</ul></li>
<li>project1
<ul>
<li>src</li>
<li>test</li>
</ul></li>
<li>project2
<ul>
<li>src</li>
<li>test</li>
</ul></li>
</ul>
<p>Thanks...</p>
<p>Simon</p>
| [
{
"answer_id": 415742,
"author": "Eugene Lazutkin",
"author_id": 26394,
"author_profile": "https://Stackoverflow.com/users/26394",
"pm_score": 3,
"selected": true,
"text": "dojo.require()"
}
] | 2009/01/05 | [
"https://Stackoverflow.com/questions/414527",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41679/"
] |
414,529 | <p>I am having some difficulty accessing the value of the selected radio button in a radiogroup. I've attempted a number of different approaches based upon discussion in other posts on the forum and around the web. Unfortunately haven't been lucky (or skilled) enough to get it working. Based on the following FormPanel config I was hoping someone could show me how to get the value of the selected radio in the group 'mainPhone'.</p>
<p>Thanks!</p>
<p><strong>Wanted to update to indicate that I was able to get a response from stackoverflow while the EXT-JS forums didn't provide me with any help. Way to go stackoverflow!</strong></p>
<p>Matt</p>
<pre><code>function createForm(elem) {
var myForm2 = new Ext.form.FormPanel({
renderTo:elem,
width:425,
frame:true,
style:"margin: 10px auto 10px auto;",
items: [{xtype:'fieldset',
title: 'Contact Info',
autoHeight:true,
items :[new Ext.form.RadioGroup({
fieldLabel: 'Main Phone',
vertical: false,
id:"mainPhone",
items: [
{boxLabel: 'Home', name: 'id-1', inputValue: 'H', checked:true},
{boxLabel: 'Work', name: 'id-1', inputValue: 'W'},
{boxLabel: 'Other', name: 'id-1', inputValue: 'O'}
]
}),
new Ext.form.TextField({
id:"frm_CreateCustomerHomePhone",
fieldLabel:"Home Phone",
width:275,
allowBlank:true
}),
new Ext.form.TextField({
id:"frm_CreateCustomerWorkPhone",
fieldLabel:"Work Phone",
width:275,
allowBlank:true
})
new Ext.form.TextField({
id:"frm_CreateCustomerOtherPhone",
fieldLabel:"Other Phone",
width:275,
allowBlank:true
})
]}]});
}
</code></pre>
| [
{
"answer_id": 414668,
"author": "Adam Bellaire",
"author_id": 21632,
"author_profile": "https://Stackoverflow.com/users/21632",
"pm_score": 4,
"selected": true,
"text": "myForm2.getForm().getValues()['id-1'];\n"
},
{
"answer_id": 414674,
"author": "Community",
"author_id... | 2009/01/05 | [
"https://Stackoverflow.com/questions/414529",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26241/"
] |
414,541 | <p>In Oracle's PL/SQL I can create a session based global variable with the package definition. With Postgresql's PLpg/SQL, it doesn't seem possible since there are no packages, only independent procedures and functions.</p>
<p>Here is the syntax for PL/SQL to declare g_spool_key as a global...</p>
<pre><code>CREATE OR REPLACE PACKAGE tox IS
g_spool_key spool.key%TYPE := NULL;
TYPE t_spool IS REF CURSOR RETURN spool%ROWTYPE;
PROCEDURE begin_spool;
PROCEDURE into_spool
(
in_txt IN spool.txt%TYPE
);
PROCEDURE reset_spool;
FUNCTION end_spool
RETURN t_spool;
FUNCTION timestamp
RETURN VARCHAR2;
END tox;
</code></pre>
<p>How would I implement a session based global variable with PLpg/SQL?</p>
| [
{
"answer_id": 417318,
"author": "Patryk Kordylewski",
"author_id": 30927,
"author_profile": "https://Stackoverflow.com/users/30927",
"pm_score": 3,
"selected": false,
"text": "imos=> set imos.testvar to 'foobar';\nSET\nTime: 0.379 ms\nimos=> show imos.testvar;\n imos.testvar\n----------... | 2009/01/05 | [
"https://Stackoverflow.com/questions/414541",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13930/"
] |
414,543 | <p>I have a Django model (schedule) with the class of entity, that is the parent of <code>Activity</code>, that is the parent of <code>Event</code>.</p>
<pre><code>class Entity(models.Model):
<...>
class Activity(models.Model):
<...>
team_entity = models.ForeignKey(Entity)
<...>
class Event(models.Model):
<...>
activity = models.ForeignKey(Activity)
<...>
</code></pre>
<p>How do I serialize and get both the child object and grand children as part of the JSON file?</p>
| [
{
"answer_id": 415421,
"author": "gsiegman",
"author_id": 10825,
"author_profile": "https://Stackoverflow.com/users/10825",
"pm_score": 3,
"selected": false,
"text": "class Entity(models.Model):\n name = models.CharField(...)\n\nclass Activity(models.Model):\n name = models.CharFie... | 2009/01/05 | [
"https://Stackoverflow.com/questions/414543",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51799/"
] |
414,575 | <p>I don't know if this is the right way to phrase the question or not. Here is a typically databinding example: </p>
<pre><code><UserControl x:Name="root">
<ListView ItemsSource="{Binding MyItemsSource, ElementName=root}" />
</UserControl>
</code></pre>
<p>But this is what I want to be able to do:</p>
<pre><code><UserControl DataContext="{Binding SelectedItem, ElementName=lstMyItems}">
<ListView ItemsSource="{Binding MyItemsSource, ElementName=root}">
</UserControl>
</code></pre>
<p>(Notice that what I'm doing here is setting the DataContext of the UserControl to the currently SelectedItem on the ListView).</p>
<p>Any clean way of doing this without events or using code-behind?</p>
| [
{
"answer_id": 414592,
"author": "Kent Boogaart",
"author_id": 5380,
"author_profile": "https://Stackoverflow.com/users/5380",
"pm_score": 0,
"selected": false,
"text": "UserControl <UserControl DataContext=\"{Binding SelectedItem, ElementName=lstMyItems}\">\n <Grid x:Name=\"_grid\">\n... | 2009/01/05 | [
"https://Stackoverflow.com/questions/414575",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17744/"
] |
414,583 | <p>Is there a CRUD generator utility in Java like Scaffolding in Rails? Can be in any framework or even plain servlets. Must generate controllers + views in jsp, not just DAO code...</p>
| [
{
"answer_id": 13256960,
"author": "jacktrades",
"author_id": 1341526,
"author_profile": "https://Stackoverflow.com/users/1341526",
"pm_score": 3,
"selected": false,
"text": "Java EE"
},
{
"answer_id": 16651858,
"author": "Gary",
"author_id": 396747,
"author_profile":... | 2009/01/05 | [
"https://Stackoverflow.com/questions/414583",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51402/"
] |
414,604 | <p>I am trying to create an ActiveRecord object via a JSON request. However the controller fails to set the variables passed in the parameters in the newly created object. As an example, a person object has two fields: firstname and lastname.</p>
<p>The JSON generated by the JSON.stringify function of the JSON.org library produces:</p>
<pre><code>{"firstname" : "Joe" , "lastname" : "Bloggs"}
</code></pre>
<p>However the controller expects the JSON to be in the form:</p>
<pre><code>{ "Person" : {"firstname" : "Joe" , "lastname" : "Bloggs"} }
</code></pre>
<p>I am aware that in the normal course of events (for HTTP requests) the
parameters for the request are nested under the class name of the model
being created. </p>
<p>The create action in the controller is:</p>
<pre><code>def create
@person = Person.new(params[:person])
respond_to do |format|
if @person.save
flash[:notice] = 'Person was successfully created.'
format.html { redirect_to(@person) }
format.xml { render :xml => @person, :status => :created, :location => @person }
format.json { render :json => @person, :status => :created, :location => @person }
else
format.html { render :action => "new" }
format.xml { render :xml => @person.errors, :status => :unprocessable_entity }
format.json { render :json => @person.errors, :status => :unprocessable_entity }
end
end
end
</code></pre>
<p>What would be the neatest way for the controller to process the JSON
requests as generated? Or alternatively how do you generate "correct"
JSON from Javascript objects for passing to your controllers?</p>
<p>TIA,
Adam</p>
| [
{
"answer_id": 414634,
"author": "Zach Langley",
"author_id": 45230,
"author_profile": "https://Stackoverflow.com/users/45230",
"pm_score": 3,
"selected": true,
"text": "@person = Person.new(params)"
},
{
"answer_id": 414832,
"author": "Orion Edwards",
"author_id": 234,
... | 2009/01/05 | [
"https://Stackoverflow.com/questions/414604",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51812/"
] |
414,605 | <p>Rendering HTML with the HtmlTextWriter isn't incredibly intuitive in my opinion, but if you're implementing web controls in web forms it's what you have to work with. I thought that it might be possible to create a fluent interface for this that reads a bit more like the HTML it outputs. I would like to know what people think of the syntax that I've come up with so far.</p>
<pre><code> public void Render(HtmlTextWriter writer)
{
writer
.Tag(HtmlTextWriterTag.Div, e => e[HtmlTextWriterAttribute.Id, "id"][HtmlTextWriterAttribute.Name,"name"][HtmlTextWriterAttribute.Class,"class"])
.Tag(HtmlTextWriterTag.Span)
.Text("Lorem")
.EndTag()
.Tag(HtmlTextWriterTag.Span)
.Text("ipsum")
.EndTag()
.EndTag();
}
</code></pre>
<p>"Tag", "Text" and "EndTag" are extension methods for the HtmlTextWriter class that returns the instance it takes in so that calls can be chained. The argument passed to the lambda used in the overload used by the first call to "Tag" is a "HtmlAttributeManager", which is simple class that wraps an HtmlTextWriter to provide an indexer that takes an HtmlTextWriterAttribute and a string value and returns the instance so that calls can be chained. I also have methods on this class for the most common attributes, such as "Name", "Class" and "Id" so that you could write the first call above as follows:</p>
<pre><code>.Tag(HtmlTextWriterTag.Div, e => e.Id("id").Name("name").Class("class"))
</code></pre>
<p>A little longer example:</p>
<pre><code>public void Render(HtmlTextWriter writer)
{
writer
.Tag(HtmlTextWriterTag.Div, a => a.Class("someClass", "someOtherClass"))
.Tag(HtmlTextWriterTag.H1).Text("Lorem").EndTag()
.Tag(HtmlTextWriterTag.Select, t => t.Id("fooSelect").Name("fooSelect").Class("selectClass"))
.Tag(HtmlTextWriterTag.Option, t => t[HtmlTextWriterAttribute.Value, "1"][HtmlTextWriterAttribute.Title, "Selects the number 1."])
.Text("1")
.EndTag(HtmlTextWriterTag.Option)
.Tag(HtmlTextWriterTag.Option, t => t[HtmlTextWriterAttribute.Value, "2"][HtmlTextWriterAttribute.Title, "Selects the number 2."])
.Text("2")
.EndTag(HtmlTextWriterTag.Option)
.Tag(HtmlTextWriterTag.Option, t => t[HtmlTextWriterAttribute.Value, "3"][HtmlTextWriterAttribute.Title, "Selects the number 3."])
.Text("3")
.EndTag(HtmlTextWriterTag.Option)
.EndTag(HtmlTextWriterTag.Select)
.EndTag(HtmlTextWriterTag.Div);
}
</code></pre>
<p>Hopefully you'll be able to "decipher" what HTML this snippet outputs, at least that's the idea.</p>
<p>Please give me any thoughts on how the syntax can be improved upon, maybe better method names, maybe some other approach all together.</p>
<p>Edit:
I thought it might be interesting to see what the same snippet would look like without the use of the fluent interface, for comparison:</p>
<pre><code>public void RenderUsingHtmlTextWriterStandardMethods(HtmlTextWriter writer)
{
writer.AddAttribute(HtmlTextWriterAttribute.Class, "someClass someOtherClass");
writer.RenderBeginTag(HtmlTextWriterTag.Div);
writer.RenderBeginTag(HtmlTextWriterTag.H1);
writer.Write("Lorem");
writer.RenderEndTag();
writer.AddAttribute(HtmlTextWriterAttribute.Id, "fooSelect");
writer.AddAttribute(HtmlTextWriterAttribute.Name, "fooSelect");
writer.AddAttribute(HtmlTextWriterAttribute.Class, "selectClass");
writer.RenderBeginTag(HtmlTextWriterTag.Select);
writer.AddAttribute(HtmlTextWriterAttribute.Value, "1");
writer.AddAttribute(HtmlTextWriterAttribute.Title, "Selects the number 1.");
writer.RenderBeginTag(HtmlTextWriterTag.Option);
writer.Write("1");
writer.RenderEndTag();
writer.AddAttribute(HtmlTextWriterAttribute.Value, "2");
writer.AddAttribute(HtmlTextWriterAttribute.Title, "Selects the number 2.");
writer.RenderBeginTag(HtmlTextWriterTag.Option);
writer.Write("2");
writer.RenderEndTag();
writer.AddAttribute(HtmlTextWriterAttribute.Value, "3");
writer.AddAttribute(HtmlTextWriterAttribute.Title, "Selects the number 3.");
writer.RenderBeginTag(HtmlTextWriterTag.Option);
writer.Write("3");
writer.RenderEndTag();
writer.RenderEndTag();
writer.RenderEndTag();
}
</code></pre>
<p>EDIT:
I should probably be a little more explicit in that one of the goals with this is that it should incur as little overhead as possible, this is why I've limited the use of lambdas. Also at first I used a class that represented a tag so that something similar to a DOM-tree was built by the syntax before the rendering, the syntax was very similar though. I abandoned this solution for the slight memory overhead it incurs. There are still some of this present in the use of the HtmlAttributeManager class, I have been thinking about using extension methods for the appending of attributes also, but the I can't use the indexer-syntax, also it bloats the interface of the HtmlTextWriter even more.</p>
| [
{
"answer_id": 414698,
"author": "Konrad Rudolph",
"author_id": 1968,
"author_profile": "https://Stackoverflow.com/users/1968",
"pm_score": 2,
"selected": false,
"text": "Tag(Tagname, …) writer.Write(body => new Tag[] {\n new Tag(h1 => \"Hello, world!\"),\n new Tag(p => \"Indeed. W... | 2009/01/05 | [
"https://Stackoverflow.com/questions/414605",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46187/"
] |
414,616 | <p>You can initialize an array like this:</p>
<pre><code>int [ ] arr = { 1, 2, 3, 4, 5 };
</code></pre>
<p>but <code>List<T></code> doesn't allow this:</p>
<pre><code>List<int> list = { 1, 2, 3, 4, 5 };
</code></pre>
<p>What's the reason behind this?</p>
<p>After all both allow this:</p>
<pre><code>int [ ] arr = new int [ ] { 1, 2, 3, 4, 5 };
List<int> list = new List<int> { 1, 2, 3, 4, 5 };
</code></pre>
<p>Also why it's not possible to do this with a <code>LinkedList<T></code>?:</p>
<pre><code>LinkedList<int> ll = new LinkedList<int>() { 1, 2, 3 };
</code></pre>
<p><strong>Update</strong></p>
<p>Thanks guys. Just saw the replies. I wanted to pick several answers but it didn't let me so.</p>
<p>Why does the LinkedList has an Add method though explicit implementation? Will this likely be fixed? Because problems like this will just snowball into bigger ones when they are overlooked, right?</p>
| [
{
"answer_id": 414638,
"author": "tvanfosson",
"author_id": 12950,
"author_profile": "https://Stackoverflow.com/users/12950",
"pm_score": 5,
"selected": true,
"text": "public class LinkedListWithInit<T> : LinkedList<T>\n{\n public void Add( T item )\n {\n ((ICollection<T>)th... | 2009/01/05 | [
"https://Stackoverflow.com/questions/414616",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51816/"
] |
414,626 | <p>The only SET parameter that I have found specific guidance for is SET TRANSACTION ISOLATION LEVEL:</p>
<blockquote>
<p>If you issue SET TRANSACTION ISOLATION
LEVEL in a stored procedure or
trigger, when the object returns
control the isolation level is reset
to the level in effect when the object
was invoked. For example, if you set
REPEATABLE READ in a batch, and the
batch then calls a stored procedure
that sets the isolation level to
SERIALIZABLE, the isolation level
setting reverts to REPEATABLE READ
when the stored procedure returns
control to the batch.</p>
</blockquote>
<p>What about other SET parameters, like <code>SET XACT_ABORT</code> or <code>SET DEADLOCK_PRIORITY</code>? If you set those during a stored procedure (or a batch submitted from C#), will they go back to their previous values the next time the connection gets used?</p>
| [
{
"answer_id": 415153,
"author": "technophile",
"author_id": 23029,
"author_profile": "https://Stackoverflow.com/users/23029",
"pm_score": 3,
"selected": true,
"text": "sp_reset_connection"
}
] | 2009/01/05 | [
"https://Stackoverflow.com/questions/414626",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1219/"
] |
414,630 | <p>I have a web service that needs different settings for different environments (debug, test, prod). What's the easiest way to setup separate config files for these different environments? Everything I find on the web tells me how to use configuration manager to retrieve settings, but not how to find particular settings based on the current build configuration.</p>
| [
{
"answer_id": 414635,
"author": "Tom Anderson",
"author_id": 13502,
"author_profile": "https://Stackoverflow.com/users/13502",
"pm_score": 0,
"selected": false,
"text": " System.Configuration.ExeConfigurationFileMap fileMap = new System.Configuration.ExeConfigurationFileMap();\n\... | 2009/01/05 | [
"https://Stackoverflow.com/questions/414630",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51819/"
] |
414,631 | <p>How does one tell the XML parser to honor leading and trailing whitespace?</p>
<pre><code>Dim xml: Set xml = CreateObject("MSXML2.DOMDocument")
xml.async = False
xml.loadxml "<xml>1 2</xml>"
wscript.echo len(xml.documentelement.text)
</code></pre>
<p>Above prints out 3.</p>
<pre><code>Dim xml: Set xml = CreateObject("MSXML2.DOMDocument")
xml.async = False
xml.loadxml "<xml> 2</xml>"
wscript.echo len(xml.documentelement.text)
</code></pre>
<p>Above prints out 1. (I'd like it to print 2).</p>
<p>Is there something special I can put in the xml document itself to tell the parser to keep leading and trailing whitespace in the document?</p>
<p><strong>CLARIFICATION 1</strong>: Is there an attribute that can be specificed ONCE at the beginning of the document to apply to all elements?</p>
<p><strong>CLARIFICATION 2</strong>: Because the contents of the entities may have unicode data, but the xml file needs to be plain ascii, all entities are encoded -- meaning CDATA's unfortunately are not available.</p>
| [
{
"answer_id": 415506,
"author": "Dimitre Novatchev",
"author_id": 36305,
"author_profile": "https://Stackoverflow.com/users/36305",
"pm_score": 4,
"selected": true,
"text": "xml:space=\"preserve\" xml:space <xml> 2</xml>\n Dim xml As MSXML2.DOMDocument\nPrivate Sub Form_Load()\nSet xml ... | 2009/01/05 | [
"https://Stackoverflow.com/questions/414631",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/245/"
] |
414,639 | <p>So I've finally got my WCF service setup and talking to browser via ASP.NET AJAX. But I have found that when I populate a html table with my data... the datetime format looks like this:</p>
<p>Fri Jan 02 2009 15:27:12 GMT-0500 (Eastern Standard Time)</p>
<p>On the server I am using the .NET DateTime format. Should I use something else and do the work on the server? or is there any easy way via JavaScript (ASP.NET AJAX or jQuery) to fix this on the client? </p>
<p>I like just the 'Jan 02 2009 15:27:12' part. I guess I could use substring(), but am I missing something?</p>
<p><strong>MORE INFO:</strong>
I figured out that the data coming back to the browser was a valid JavaScript Date object.<br>
So you can use any of the native JavaScript Date functions to deal with the value or...
You can use .toString().substring() and trim off what you don't want.</p>
| [
{
"answer_id": 414655,
"author": "Richard L",
"author_id": 51017,
"author_profile": "https://Stackoverflow.com/users/51017",
"pm_score": 1,
"selected": false,
"text": "return yourDatetimeVaiable.Tostring(cultureinfo);"
},
{
"answer_id": 452936,
"author": "markt",
"author_... | 2009/01/05 | [
"https://Stackoverflow.com/questions/414639",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36590/"
] |
414,642 | <p>How do I allow only one instance of a WPF application to run?</p>
<p>Thanks.</p>
| [
{
"answer_id": 18916883,
"author": "VoteCoffee",
"author_id": 848419,
"author_profile": "https://Stackoverflow.com/users/848419",
"pm_score": 2,
"selected": false,
"text": " Public Sub ForceSingleInstanceApplication()\n 'Get a reference to the current process\n Dim MyPro... | 2009/01/05 | [
"https://Stackoverflow.com/questions/414642",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22451/"
] |
414,653 | <p>Is there a managed API to retrieve an application's install date using the Product GUID?</p>
<p>Thanks.
Scott</p>
| [
{
"answer_id": 414743,
"author": "Dirk Vollmar",
"author_id": 40347,
"author_profile": "https://Stackoverflow.com/users/40347",
"pm_score": 1,
"selected": false,
"text": "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{product-id}\n InstallDate = 20081004... | 2009/01/05 | [
"https://Stackoverflow.com/questions/414653",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38309/"
] |
414,660 | <p>Does anyone know of a Javascript based <a href="http://haml.hamptoncatlin.com/" rel="nofollow noreferrer">HAML</a> editor out there? I'm looking for for something like <a href="http://tinymce.moxiecode.com/" rel="nofollow noreferrer">TinyMCE</a> that just understands HAML (so it does indenting and highlighting correctly)</p>
<p>I'm thinking of using an editor like this for a dynamic website I'm building.</p>
<p><strong>Clarification</strong>
The site I am building allows the users to define layouts(in the rails sense) and css. So finer grain control than textile and markdown is required, I know I can include raw html in markdown but haml is so much prettier. </p>
| [
{
"answer_id": 421506,
"author": "gabriel",
"author_id": 5447,
"author_profile": "https://Stackoverflow.com/users/5447",
"pm_score": 2,
"selected": false,
"text": "#content\n :markdown\n @post.body\n"
}
] | 2009/01/05 | [
"https://Stackoverflow.com/questions/414660",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17174/"
] |
414,664 | <p>I have a big list of hexadecimal numbers I'd like to insert into a PostgresQL table. I tried something like this:</p>
<pre><code>INSERT INTO foo (i)
VALUES (0x1234);
</code></pre>
<p>...but that didn't work. Is this possible?</p>
| [
{
"answer_id": 414708,
"author": "mike",
"author_id": 91385,
"author_profile": "https://Stackoverflow.com/users/91385",
"pm_score": 3,
"selected": false,
"text": " CAST(X'3e000000' AS INT)\n"
},
{
"answer_id": 414729,
"author": "Rob Kennedy",
"author_id": 33732,
"auth... | 2009/01/05 | [
"https://Stackoverflow.com/questions/414664",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/91385/"
] |
414,676 | <p>In an Intranet environment, I have an FTP server set up for publishing files to websites. A user connected to the production FTP server (allowed) to publish files (allowed) then navigated to a folder that was not hers (allowed) then wrote files there (allowed by FTP, but not by NTFS.)</p>
<p>Only Administrators and System have rights to Write to that folder, and she's not an adminstrator through any group. </p>
<p>Does FTP ignore NTFS securities? How did she write to a site to which she only has read access?</p>
<p>Thanks. </p>
| [
{
"answer_id": 414708,
"author": "mike",
"author_id": 91385,
"author_profile": "https://Stackoverflow.com/users/91385",
"pm_score": 3,
"selected": false,
"text": " CAST(X'3e000000' AS INT)\n"
},
{
"answer_id": 414729,
"author": "Rob Kennedy",
"author_id": 33732,
"auth... | 2009/01/05 | [
"https://Stackoverflow.com/questions/414676",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14127/"
] |
414,679 | <p>I need some way to add a class attribute to the output of the <code>label_tag()</code> method for a forms field.</p>
<p>I see that there is the ability to pass in an <code>attrs</code> dictionary and I have tested it in the shell and I can do something like:</p>
<pre><code>for field in form:
print field.label_tag(attrs{'class':'Foo'})
</code></pre>
<p>I will see the <code>class='Foo'</code> in my output, but I don't see a way to add an <code>attrs</code> argument from the template - in fact, templates are designed specifically against that, no?</p>
<p>Is there a way in my form definition to define the class to be displayed in the label?</p>
<p>In the form, I can do the following to give the inputs a class</p>
<pre><code>self.fields['some_field'].widget.attrs['class'] = 'Foo'
</code></pre>
<p>I just need to have it output the class for the <code><label /></code> as well.</p>
| [
{
"answer_id": 415770,
"author": "muhuk",
"author_id": 42188,
"author_profile": "https://Stackoverflow.com/users/42188",
"pm_score": 4,
"selected": true,
"text": "{{ form.as_table_with_label_classes }}\n encapsulating_selector label {\n some-attr: some-value;\n}\n"
},
{
"answe... | 2009/01/05 | [
"https://Stackoverflow.com/questions/414679",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22306/"
] |
414,714 | <p>Quick question: what is the compiler flag to allow g++ to spawn multiple instances of itself in order to compile large projects quicker (for example 4 source files at a time for a multi-core CPU)?</p>
| [
{
"answer_id": 414719,
"author": "rmeador",
"author_id": 10861,
"author_profile": "https://Stackoverflow.com/users/10861",
"pm_score": 4,
"selected": false,
"text": "make -j -l g++"
},
{
"answer_id": 414725,
"author": "frankodwyer",
"author_id": 42404,
"author_profile... | 2009/01/05 | [
"https://Stackoverflow.com/questions/414714",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51827/"
] |
414,715 | <p>I am looking for some examples of a .bat OR .wsh script that can do the following:</p>
<ul>
<li>Recursively read file names in a directory with a user-provided extension (.dll, .exe, etc)</li>
<li>Search a user-provided directory for the above file names</li>
<li>Generate a txt or xls report of the findings, like: x.txt was found in "C:\temp", "C:\blah"</li>
</ul>
<p>TIA.</p>
<p>EDIT:</p>
<p>Oops, I should clarify: there are two directories and two searches here.</p>
<p>Search 1:</p>
<ul>
<li>Search a user provided directory "Dir 1" for all *.dll's.</li>
</ul>
<p>Search 2:</p>
<ul>
<li>Search a different user provided directory "Dir 2" for the file names generated in Search 1. This search also needs to be recursive.</li>
</ul>
<p>So, if Search 1 finds foo.dll, foo2.dll and foo3.dll in Dir 1, Search 2 should look in Dir 2 for foo.dll, foo2.dll and foo3.dll, and provide a report (simple listing) of each found file.</p>
| [
{
"answer_id": 414727,
"author": "Tom Ritter",
"author_id": 8435,
"author_profile": "https://Stackoverflow.com/users/8435",
"pm_score": 4,
"selected": false,
"text": "dir /S *.dll\n dir /S C:\\*.dll\n dir /S C:\\*.dll > report.txt\n"
},
{
"answer_id": 415222,
"author": "Patri... | 2009/01/05 | [
"https://Stackoverflow.com/questions/414715",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51826/"
] |
414,726 | <p>I am totally confused on how to do ajax stuffs with jQuery and it seems the more I try the more confused I get. At this point all I want to do is get data to my controller using jQuery ajax. Some code for my jquery ajax call is.</p>
<pre><code>$(function() {
$('#buttonAddLink').click(function() {
var AjaxLink = {
title: $("#linkTitle").val(),
url: $("#linkUrl").val()
};
$.ajax({
url: '/User/AddLink',
type: 'POST',
data: AjaxLink,
dataType: 'json',
success: function(result){
$('.added').html(result.Result).show();
}
});
});
});
</code></pre>
<p>Here is my controller and Action I am using. From trying to look at several tutorials it "should" work to the best of my knowledge, but apparently I don't get it like I thought I did.</p>
<pre><code>public ActionResult AddLink(string title, string url)
{
return Json(new { Result = string.Format(title + " " + url)});
}
</code></pre>
<p>All I am basically trying to do with that is do the Ajax call and return it to display just to make sure data was sent to the controller.</p>
| [
{
"answer_id": 414873,
"author": "foxxtrot",
"author_id": 10369,
"author_profile": "https://Stackoverflow.com/users/10369",
"pm_score": 2,
"selected": false,
"text": "/User/AddLink/{Title}/{URL}\n public ActionResult AddLink()\n{\n return Json(new { Result = string.Format(Request.Form... | 2009/01/05 | [
"https://Stackoverflow.com/questions/414726",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23571/"
] |
414,731 | <p>I have a directory of files that I would like to scan on a regular basis and execute with the default application they are associated with. They are not executable so system("file.torrent"); does not work. How are you able to run files with there associated applications in Perl?</p>
| [
{
"answer_id": 414810,
"author": "Brett",
"author_id": 43778,
"author_profile": "https://Stackoverflow.com/users/43778",
"pm_score": 2,
"selected": false,
"text": "system('start \"dummy title\" \"some file.doc\"'); # opens the document in word\n"
},
{
"answer_id": 415646,
"au... | 2009/01/05 | [
"https://Stackoverflow.com/questions/414731",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14744/"
] |
414,733 | <p>How could I get the current h/m/s AM time into a string? And maybe also the date in numeric form (01/02/09) into another one?</p>
| [
{
"answer_id": 414739,
"author": "Tom Ritter",
"author_id": 8435,
"author_profile": "https://Stackoverflow.com/users/8435",
"pm_score": 4,
"selected": false,
"text": "DateTime.Now.ToString(\"h:mm tt\")\nDateTime.Now.ToString(\"MM/dd/yyyy\")\n"
},
{
"answer_id": 414744,
"autho... | 2009/01/05 | [
"https://Stackoverflow.com/questions/414733",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.