qid int64 4 22.2M | question stringlengths 18 48.3k | answers list | date stringlengths 10 10 | metadata list |
|---|---|---|---|---|
290,227 | <p>What is the equivalent of Java's <code>System.currentTimeMillis()</code> in C#?</p>
| [
{
"answer_id": 290265,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 7,
"selected": false,
"text": "private static readonly DateTime Jan1st1970 = new DateTime\n (1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);\n\npublic stati... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290227",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
290,238 | <p>I'm trying to do something that gets a cs file in runtime from user make it meaningful to assembly get its properties, methods etc. </p>
<p>Is there a way to do this by reflection in C#?</p>
| [
{
"answer_id": 290269,
"author": "edosoft",
"author_id": 6399,
"author_profile": "https://Stackoverflow.com/users/6399",
"pm_score": 4,
"selected": true,
"text": "CodeDomProvider codeProvider = new CSharpCodeProvider();\nICodeCompiler compiler = codeProvider.CreateCompiler();\n\n// add c... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290238",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4215/"
] |
290,254 | <p>Lets say I have a web app which has a page that may contain 4 script blocks - the script I write may be found in one of those blocks, but I do not know which one, that is handled by the controller. </p>
<p>I bind some <code>onclick</code> events to a button, but I find that they sometimes execute in an order I did not expect. </p>
<p>Is there a way to ensure order, or how have you handled this problem in the past?</p>
| [
{
"answer_id": 290294,
"author": "dowski",
"author_id": 21712,
"author_profile": "https://Stackoverflow.com/users/21712",
"pm_score": 7,
"selected": false,
"text": "$('#mydiv').click(function(e) {\n // maniplate #mydiv ...\n $('#mydiv').trigger('mydiv-manipulated');\n});\n\n$('#myd... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290254",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26188/"
] |
290,285 | <p>I have a module that sends an email to a specified email address but I want to default the email recipient to the portal administrator. How can I retrieve this information?</p>
| [
{
"answer_id": 290416,
"author": "Douglas Anderson",
"author_id": 5678,
"author_profile": "https://Stackoverflow.com/users/5678",
"pm_score": 2,
"selected": false,
"text": "' get the current portal\nDim portSettings As PortalSettings = PortalController.GetCurrentPortalSettings\n\n' get e... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290285",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35165/"
] |
290,287 | <p>I need to determine which pages of a Word document that a keyword occurs on. I have some tools that can get me the text of the document, but nothing that tells me which pages the text occurs on. Does anyone have a good starting place for me? I'm using .NET</p>
<p>Thanks!</p>
<p>edit: Additional constraint: I can't use any of the Interop stuff.</p>
<p>edit2: If anybody knows of stable libraries that can do this, that'd also be helpful. I use Aspose, but as far as I know that doesn't have anything.</p>
| [
{
"answer_id": 290357,
"author": "Douglas Anderson",
"author_id": 5678,
"author_profile": "https://Stackoverflow.com/users/5678",
"pm_score": 3,
"selected": true,
"text": "Microsoft.Office.Interop.Word.Application wordApplication = new Microsoft.Office.Interop.Word.Application();\nobject... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290287",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37685/"
] |
290,296 | <p>I'm working on a website that uses lots of png24 files, for transparency.</p>
<p>I need to replace them with png8 files, as all the png fix style javascript workarounds for png24 cause IE6 to lock up randomly. </p>
<p>See this link to get an idea of the symptoms IE6 displays - <a href="http://blogs.cozi.com/tech/2008/03/transparent-pngs-can-deadlock-ie6.html" rel="noreferrer">http://blogs.cozi.com/tech/2008/03/transparent-pngs-can-deadlock-ie6.html</a></p>
<p>Does anybody know an easy way of targeting existing png24 files, to replace them with the png8s?</p>
<p>I'm using a OS X, and file browsers like Adobe bridge don't show this, nor can I find the info on the commandline, or the finder.</p>
<p>Help!</p>
| [
{
"answer_id": 290365,
"author": "Alnitak",
"author_id": 6782,
"author_profile": "https://Stackoverflow.com/users/6782",
"pm_score": 4,
"selected": true,
"text": "file"
},
{
"answer_id": 8547143,
"author": "Kornel",
"author_id": 27009,
"author_profile": "https://Stack... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290296",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15479/"
] |
290,304 | <p>After reading <a href="http://www.onlamp.com/pub/a/apache/2005/02/10/database_logs.html" rel="noreferrer">an article about the subject from O'Reilly</a>, I wanted to ask Stack Overflow for their thoughts on the matter.</p>
| [
{
"answer_id": 23537177,
"author": "Piotr Perak",
"author_id": 679340,
"author_profile": "https://Stackoverflow.com/users/679340",
"pm_score": 2,
"selected": false,
"text": "select * from logs\nwhere log_name = 'wcf' and log_level = 'error'\n"
}
] | 2008/11/14 | [
"https://Stackoverflow.com/questions/290304",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/572/"
] |
290,305 | <p>I have a problem trying to model a many-to-one relationship in NHibernate, where the object on the 'one' side has a unique constraint on a column. The problem is as follows:</p>
<p>I have two tables, 'Person' and 'Country'. Each Person has one and only one Country associated with it. A Country can have many Persons (really! :)) and a Countries' Name is unique. The following is the mapping on the Person side:</p>
<pre><code><many-to-one Name="Country">
<column Name="CountryId"/>
</many-to-one>
</code></pre>
<p>On the Country side:</p>
<pre><code><property name="Name" unique="true">
<column name="Name" length="50">
</property>
</code></pre>
<p>Now in the database I have added a unique constraint on the Name column in the Country table. If I call Save() on a Person instance NHibernate just tries to do INSERTS, whereas I would expect it to check if a Country Name exists and use its ID in the CountryID column in the Person table. Instead, an exception is thrown that results from violation of the unique constraint in the database. </p>
<p>It seems to me Nibernate should have enough mapping metadata to do the right thing (or does the unique attribute on the property not ensure this?). Does anyone know how to do this or have a workaround?</p>
<p>Thanks, </p>
<p>Martijn </p>
| [
{
"answer_id": 291533,
"author": "Sean Carpenter",
"author_id": 729,
"author_profile": "https://Stackoverflow.com/users/729",
"pm_score": 3,
"selected": false,
"text": "Person p = new Person();\np.Country = session.Load<Country>(countryId);\nsession.Save(p);\n"
}
] | 2008/11/14 | [
"https://Stackoverflow.com/questions/290305",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
290,309 | <p>I have SSRS Report being accessed from a Report Server. Is there any way I can give an error message of my own, if my report fails to open there? </p>
| [
{
"answer_id": 291533,
"author": "Sean Carpenter",
"author_id": 729,
"author_profile": "https://Stackoverflow.com/users/729",
"pm_score": 3,
"selected": false,
"text": "Person p = new Person();\np.Country = session.Load<Country>(countryId);\nsession.Save(p);\n"
}
] | 2008/11/14 | [
"https://Stackoverflow.com/questions/290309",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
290,320 | <p>I have a web server on port 80 and port 81. IE can connect to the server on either port. This worked fine until I installed an application with a file type (.TPJ) that had a MIME type of text/xml on the client PC. At that point IE no longer opened the web site, but offered to download a file <em>serverName.TPJ</em>. The file contained the correct information from the web site.</p>
<p>I changed the installer for the application so it didn't register the MIME type. Now IE on the client PC offers to download a file with unknown file type. Note that the application has never been installed on the server PC.</p>
<p>The problem occurs with IE7. It doesn't occur with Firefox, Safari, or Chrome.</p>
<p>Does anyone know how to work around this?</p>
| [
{
"answer_id": 290681,
"author": "Wayne Johnston",
"author_id": 37691,
"author_profile": "https://Stackoverflow.com/users/37691",
"pm_score": 2,
"selected": false,
"text": "regsvr32 msxml3.dll\n"
}
] | 2008/11/14 | [
"https://Stackoverflow.com/questions/290320",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37691/"
] |
290,322 | <p>I'm trying to hide the "Title" field in a list.
This doesn't seem to work:</p>
<pre><code>SPList myList;
...
SPField titleField = myList.Fields.GetField("Title");
//titleField.PushChangesToLists = true; <-- doesn't seem to make a difference
titleField.ShowInEditForm = false;
titleField.ShowInDisplayForm = false;
titleField.ShowInNewForm = false;
titleField.Update();
//myList.Update(); <-- make no difference
</code></pre>
<p>What am I doing wrong?</p>
| [
{
"answer_id": 290350,
"author": "Brian Liang",
"author_id": 5853,
"author_profile": "https://Stackoverflow.com/users/5853",
"pm_score": 0,
"selected": false,
"text": "using (SPSite site = new SPSite(webUrl))\n{\n using (SPWeb web = site.OpenWeb())\n {\n try\n {\n ... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290322",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1287/"
] |
290,326 | <p>Is it possible using StAX (specifically woodstox) to format the output xml with newlines and tabs, i.e. in the form:</p>
<pre>
<element1>
<element2>
someData
</element2>
</element1>
</pre>
<p>instead of:</p>
<pre><element1><element2>someData</element2></element1></pre>
<p>If this is not possible in woodstox, is there any other lightweight libs that can do this?</p>
| [
{
"answer_id": 290507,
"author": "Josh",
"author_id": 2204759,
"author_profile": "https://Stackoverflow.com/users/2204759",
"pm_score": 4,
"selected": true,
"text": "transformer.setOutputProperty(OutputKeys.INDENT, \"yes\");"
},
{
"answer_id": 485126,
"author": "StaxMan",
... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290326",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/142/"
] |
290,330 | <p>How is the guest account in SQL Server (2000, 2005, 2008) supposed to be used? What is it good for? I've tried enabling the account but I still can't get certain users to be able to refresh Excel 2007 PivotTables attached to views which I have given SELECT rights to GUEST.</p>
<p>What am I missing? </p>
| [
{
"answer_id": 290507,
"author": "Josh",
"author_id": 2204759,
"author_profile": "https://Stackoverflow.com/users/2204759",
"pm_score": 4,
"selected": true,
"text": "transformer.setOutputProperty(OutputKeys.INDENT, \"yes\");"
},
{
"answer_id": 485126,
"author": "StaxMan",
... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290330",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36590/"
] |
290,335 | <p>I have a table cell, and I want a div within it to always be at the bottom left corner. The following works fine in IE and Safari, but Firefox is positioning the <code>div</code> absolutely on the page, not within the cell (code based on the solution solution <a href="https://stackoverflow.com/questions/104953/position-an-html-element-relative-to-its-container-using-css">here</a>). I have tested both with and without the DTD, which put Firefox in Quirks mode and Standards mode, and neither worked properly. I'm stuck - any ideas?</p>
<pre><code><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Test</title>
<style type="text/css">
table { width:500px; }
th, td { vertical-align: top; border:1px solid black; position:relative; }
th { width:100px; }
.manage { text-align:right; position:absolute; bottom:0; right:0; }
</style>
</head>
<body >
<table>
<tr>
<th>Some info about the following thing and this is actually going to span a few lines</th>
<td><p>A short blurb</p><div class="manage">Edit | Delete</div></td>
</tr>
<tr>
<th>Some info about the following thing and this is actually going to span a few lines</th>
<td><p>A short blurb</p><div class="manage">Edit | Delete</div></td>
</tr>
</table>
</body>
</html>
</code></pre>
| [
{
"answer_id": 290371,
"author": "Boris Smirnov",
"author_id": 35513,
"author_profile": "https://Stackoverflow.com/users/35513",
"pm_score": 1,
"selected": false,
"text": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290335",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/96/"
] |
290,347 | <p>I need to use sendmail from Macs in an office. At the moment, I can get it to work on the two development Macs (which I think is due to MAMP being installed and working), but getting it to go on the others seems to be a problem...</p>
<p>I assume it's down to some config issue, and hope there's someway to fix it (without resorting to installing MAMP on each machine !).</p>
<p>I think it may be down to the 'local' nature of the from, but not sure. Here's a dump of /var/log/mail.log if that's any help: </p>
<pre><code>Nov 14 14:37:06 claire-g5 postfix/master[5339]: daemon started -- version 2.4.3, configuration /etc/postfix
Nov 14 14:37:06 claire-g5 postfix/qmgr[5341]: 2B625250BDB: from=<claire@claire-g5.local>, size=1131, nrcpt=1 (queue active)
Nov 14 14:37:06 claire-g5 postfix/qmgr[5341]: D5D19250D5A: from=<claire@claire-g5.local>, size=1191, nrcpt=1 (queue active)
Nov 14 14:37:06 claire-g5 postfix/smtp[5344]: 2B625250BDB: host mx01.xxx.uk[212.x.x.134] said: 451 cannot relay now to <xx@xx.com>, please try again later (in reply to RCPT TO command)
Nov 14 14:37:06 claire-g5 postfix/smtp[5346]: D5D19250D5A: host mx01.xxx.uk[212.x.x.186] said: 451 cannot relay now to <xx@xx.com>, please try again later (in reply to RCPT TO command)
Nov 14 14:37:07 claire-g5 postfix/smtp[5346]: D5D19250D5A: to=<xx@xx.com>, relay=mx01.xxx.uk[212.x.x.134]:25, delay=2350, delays=2349/0.08/0.7/0.12, dsn=4.0.0, status=deferred (host mx01.xxx.uk[212.x.x.134] said: 451 cannot
Nov 14 14:37:07 claire-g5 postfix/pickup[5340]: 1A2EC2511D1: uid=501 from=<claire
</code></pre>
| [
{
"answer_id": 290400,
"author": "Dycey",
"author_id": 35961,
"author_profile": "https://Stackoverflow.com/users/35961",
"pm_score": 0,
"selected": false,
"text": "### MAMP Postfix Configuration - Start ###\n\nmyorigin = example.com\nmyhostname = mailer.$myorigin\nsmtpd_sender_restrictio... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290347",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35961/"
] |
290,368 | <p>How can I go through all external links in a div with javascript, adding (or appending) a class and alt-text?</p>
<p>I guess I need to fetch all objects inside the div element, then check if each object is a , and check if the href attributen starts with http(s):// (should then be an external link), then add content to the alt and class attribute (if they don't exist create them, if they do exists; append the wanted values).</p>
<p>But, how do I do this in code?</p>
| [
{
"answer_id": 290445,
"author": "Josh",
"author_id": 2204759,
"author_profile": "https://Stackoverflow.com/users/2204759",
"pm_score": 0,
"selected": false,
"text": "$(\"div a[href^='http']\").each(function() {\n $(this).attr(\"alt\",altText);\n var oldClassAttributeValue = $(this).at... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290368",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
290,382 | <p>I'm sure it's just simple html/css but I don't know what to call the bar (googling horizontal bar html always results in a horizontal rule).</p>
<p><a href="http://jquery.com/" rel="nofollow noreferrer">http://jquery.com/</a> has one - the grayish bar the runs across the top separating the menu from the content of the page. I'd love to make one of my own.</p>
| [
{
"answer_id": 290435,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 1,
"selected": false,
"text": "body {\n background: #2a3139 url(../images/bg_home_tile_sml.jpg) repeat-x 50% 0;\n}\n"
},
{
"answer_id": 290451,
... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290382",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
290,386 | <p>Has anyone seen this type of IE display problem?</p>
<p><a href="http://xs133.xs.to/xs133/08465/ie_problem910.jpg.xs.jpg" rel="nofollow noreferrer">Example http://xs133.xs.to/xs133/08465/ie_problem910.jpg.xs.jpg</a></p>
<p>Note that it is doing some sort of word-wrap/duplication when it renders.</p>
<p>The code for the brown box and the text that should be in it is:<br/></p>
<pre><code><div class='span-23'>
<div class='span-7'>
<div class='info_box' style='height: 30px; padding-top: 10px'>
<div class='span-4'><b>Vehicle Full Term Premium:</b></div>
<div class='span-2' id='veh_ft_prem' style='text-align: right;'></div>
<div class='span-4'><b>Vehicle Written Premium:</b></div>
<div class='span-2' id='veh_writ_prem' style='text-align: right;'></div>
</div>
</div>
</div>
</code></pre>
<p>I'm using BlueprintCSS and the info_box CSS class is:</p>
<pre><code>.info_box {
background: #fbe6a0;
color: #222222;
border-color: #222222;
padding:.8em;
padding-right: 0;
margin-bottom:1em;
border:2px solid #222222;}
</code></pre>
| [
{
"answer_id": 290435,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 1,
"selected": false,
"text": "body {\n background: #2a3139 url(../images/bg_home_tile_sml.jpg) repeat-x 50% 0;\n}\n"
},
{
"answer_id": 290451,
... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290386",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16437/"
] |
290,392 | <p>I've got a somewhat dated Java EE application running on Sun Application Server 8.1 (aka SJSAS, precursor to Glassfish). With 500+ simultaneous users the application becomes unacceptably slow and I'm trying to assist in identifying where most of the execution time is spent and what can be done to speed it up. So far, we've been experimenting and measuring with LoadRunner, the app server logs, Oracle statpack, snoop, adjusting the app server acceptor and session (worker) threads, adjusting Hibernate batch size and join fetch use, etc but after some initial gains we're struggling to improve matters more.</p>
<p>Ok, with that introduction to the problem, here's the real question: If you had a slow Java EE application running on a box whose CPU and memory use never went above 20% and while running with 500+ users you showed two things: 1) that requesting even static files within the same app server JVM process was exceedingly slow, and 2) that requesting a static file outside of the app server JVM process but on the same box was fast, what would you investigate?</p>
<p>My thoughts initially jumped to the application server threads, both acceptor and session threads, thinking that even requests for static files were being queued, waiting for an available thread, and if the CPU/memory weren't really taxed then more threads were in order. But then we upped both the acceptor and session threads substantially and there was no improvement. </p>
<p>Clarification Edits: </p>
<p>1) Static files should be served by a web server rather than an app server. I am using the fact that in our case this (unfortunately) is not the configuration so that I can see the app server performance for files that it doesn't execute -- therefore excluding any database performance costs, etc. </p>
<p>2) I don't think there is a proxy between the requesters and the app server but even if there was it doesn't seem to be overloaded because static files requested from the same application server machine but outside of the application's JVM instance return immediately.</p>
<p>3) The JVM heap size (Xmx) is set to 1GB.</p>
<p>Thanks for any help!</p>
| [
{
"answer_id": 290435,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 1,
"selected": false,
"text": "body {\n background: #2a3139 url(../images/bg_home_tile_sml.jpg) repeat-x 50% 0;\n}\n"
},
{
"answer_id": 290451,
... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290392",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30642/"
] |
290,397 | <p>I have a list of articles, and each article belongs to a section.</p>
<pre><code>class Section(models.Model):
name = models.CharField(max_length=200)
def __unicode__(self):
return self.name
class Article(models.Model):
section = models.ForeignKey(Section)
headline = models.CharField(max_length=200)
# ...
</code></pre>
<p>I want to display the articles, grouped by section.</p>
<pre>
Sponsorships, Advertising & Marketing
1. Nike To Outfit All 18 Univ. Of Memphis Athletic Teams
2. Phil Jackson Questions Harrah's Signage At New Orleans Arena
3. Puma Hires N.Y.-Based Ad Agency Droga5 To Lead Global Account
4. Pizza Patrón To Replace Pizza Hut As AAC Exclusive Provider
5. Marketplace Roundup
Sports Media
6. Many Patriots Fans In New England Will Not See Tonight's Game
7. ESPN Ombudsman Says Net Should Have Clarified Holtz Situation
8. EA Sports To Debut Fitness Title For Nintendo Wii In Spring '09
9. Blog Hound: Rockets-Suns Scuffle Today's No.1 Topic
10. Media Notes
Leagues & Governing Bodies
11. DEI, Chip Ganassi Racing To Merge Into Four-Car Sprint Cup Team
12. NASCAR Roundtable Part II: New Strategies, Cutbacks Discussed
13. Average Ticket Price For NFL Playoff Games To Drop By 10%
</pre>
<p>I figured out how to do most of it with Django's template system.</p>
<pre><code>{% regroup articles by section as articles_by_section %}
{% for article in articles_by_section %}
<h4>{{ article.grouper }}</h4>
<ul>
{% for item in article.list %}
<li>{{ forloop.counter }}. {{ item.headline }}</li>
{% endfor %}
</ul>
{% endfor %}
</code></pre>
<p>I just can't figure out how to do the numbers. The code above numbers the articles in Sports Media 1-5 instead of 6-10. Any suggestions?</p>
| [
{
"answer_id": 291005,
"author": "Daniel Naab",
"author_id": 32638,
"author_profile": "https://Stackoverflow.com/users/32638",
"pm_score": -1,
"selected": false,
"text": "{% regroup articles by section as articles_by_section %}\n\n<ol>\n{% for article in articles_by_section %} \n ... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290397",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/437/"
] |
290,402 | <p>Out of curiosity, anyone knows the particulars of the internal implementation of </p>
<pre><code>ListControl.SelectedIndex = (int) <new valueIndex>
</code></pre>
<p>VS </p>
<pre><code>ListControl.SelectedValue = <new value>.ToString()
</code></pre>
<p>I'm having difficulties with a custom validation object we've built here to process all validation in one sweep. I suspect using <code><SelectedValue = ></code> will raise a <code>SelectedIndexChanged</code> event, even though both the value and index remain the same, both before and after the operation.</p>
<p>(The ListControl's values are populated declaratively....)</p>
<p>As ever, thank you for your time!</p>
| [
{
"answer_id": 291005,
"author": "Daniel Naab",
"author_id": 32638,
"author_profile": "https://Stackoverflow.com/users/32638",
"pm_score": -1,
"selected": false,
"text": "{% regroup articles by section as articles_by_section %}\n\n<ol>\n{% for article in articles_by_section %} \n ... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290402",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3403/"
] |
290,405 | <p>If you use a GUID as a password for a publicly facing application as a means to gain access to a service, is this security through obscurity?</p>
<p>I think the obvious answer is yes, but the level of security seems very high to me since the chances of guessing a GUID is very very low correct?</p>
<p><b>Update</b></p>
<p>The GUID will be stored in a device, when plugged in, will send over the GUID via SSL connection.</p>
<p>Maybe I could generate a GUID, then do a AES 128 bit encrption on the GUID and store that value on the device?</p>
| [
{
"answer_id": 290463,
"author": "Treb",
"author_id": 22114,
"author_profile": "https://Stackoverflow.com/users/22114",
"pm_score": 4,
"selected": false,
"text": "'{'"
}
] | 2008/11/14 | [
"https://Stackoverflow.com/questions/290405",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
290,424 | <p>I would want to do something like:</p>
<pre><code>>>> lst = [1, 2, 3, 4, 5]
>>> lst.find(lambda x: x % 2 == 0)
2
>>> lst.findall(lambda x: x % 2 == 0)
[2, 4]
</code></pre>
<p>Is there anything nearing such behavior in Python's standard libraries?</p>
<p>I know it's very easy to roll-your-own here, but I'm looking for a more standard way.</p>
| [
{
"answer_id": 290440,
"author": "John Montgomery",
"author_id": 5868,
"author_profile": "https://Stackoverflow.com/users/5868",
"pm_score": 8,
"selected": true,
"text": ">>> lst = [1, 2, 3, 4, 5]\n>>> filter(lambda x: x % 2 == 0, lst)\n[2, 4]\n"
},
{
"answer_id": 64464243,
"... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290424",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8206/"
] |
290,436 | <p>Presently I have a some legacy code, which generates the op code. If the code has more number of macros then the code generation takes so much of time (In terms of hours!!).
I have gone through the logic, they are handling the macro by searching for it and doing a replace of each variable in it some thing like inlining.<br>
Is there a way that I can optimize it without manipulating the string?</p>
| [
{
"answer_id": 290512,
"author": "Vinay",
"author_id": 28641,
"author_profile": "https://Stackoverflow.com/users/28641",
"pm_score": 0,
"selected": false,
"text": "int c = a + b\n"
},
{
"answer_id": 318750,
"author": "Chris",
"author_id": 8415,
"author_profile": "http... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290436",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28641/"
] |
290,449 | <p>Hello I was writing a Regular Expression (first time in my life I might add) but I just can't figure out how to do what I want. So far, so good since I already allow only Letters and spaces (as long as it's not the first character) now what I'm missing is that I don't want to allow any numbers in between the characters...could anybody help me please?</p>
<pre><code>/^[^\s][\sa-zA-Z]+[^\d\W]/
</code></pre>
| [
{
"answer_id": 290472,
"author": "Graeme Perrow",
"author_id": 1821,
"author_profile": "https://Stackoverflow.com/users/1821",
"pm_score": 1,
"selected": false,
"text": "/^[a-zA-Z][\\sa-zA-Z]*$/\n"
},
{
"answer_id": 290479,
"author": "Alnitak",
"author_id": 6782,
"aut... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290449",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28586/"
] |
290,454 | <p>I am new to RESTful stuff. But, I want to use it in my rails app. When I add this to my routes.rb <code>map.resources :notes</code> I get routes to these methods created:</p>
<ul>
<li>index</li>
<li>create</li>
<li>new</li>
<li>edit</li>
<li>show</li>
<li>update</li>
<li>destroy</li>
</ul>
<p>What I am wondering is what is the difference between edit/update and create/new? Is there any standard definitions of how these method pairs vary and what each one does?</p>
| [
{
"answer_id": 290538,
"author": "Owen",
"author_id": 2109,
"author_profile": "https://Stackoverflow.com/users/2109",
"pm_score": 4,
"selected": true,
"text": "create"
}
] | 2008/11/14 | [
"https://Stackoverflow.com/questions/290454",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5004/"
] |
290,456 | <p>This is a follow-up to <a href="https://stackoverflow.com/questions/269417/which-language-should-i-use">two</a> <a href="https://stackoverflow.com/questions/271488/linking-languages">questions</a> I asked a week or so back. The upshot of those was that I was building a prototype of an AI-based application for the web, and I wondered what language(s) to use. The conclusion seemed to be that I should go for something like python and then convert any critical bits into something faster like Java or C/C++.</p>
<p>That sounds fine to me, but I'm wondering now whether python is really the right language to use for building a web application. Most web applications I've worked on in the past were C/C++ CGI and then php. The php I found much easier to work with as it made linking the user interface to the back-end so much easier, and also it made more logical sense to me. </p>
<p>I've not used python before, but what I'm basically wondering is how easy is CGI programming in python? Will I have to go back to the tedious way of doing it in C/C++ where you have to store HTML code in templates and have the CGI read them in and replace special codes with appropriate values or is it possible to have the templates <em>be</em> the code as with php?</p>
<p>I'm probably asking a deeply ignorant question here, for which I apologise, but hopefully someone will know what I'm getting at! My overall question is: is writing web applications in python a good idea, and is it as easy as it is with php?</p>
| [
{
"answer_id": 290650,
"author": "S.Lott",
"author_id": 10661,
"author_profile": "https://Stackoverflow.com/users/10661",
"pm_score": 4,
"selected": true,
"text": "django-admin.py startproject"
}
] | 2008/11/14 | [
"https://Stackoverflow.com/questions/290456",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11522/"
] |
290,459 | <p>I am reworking some ui in an application written by freelance .Net developers from another country. </p>
<p>I am not going to go into how bad the code is and entangled the code with structure content and presentation are... </p>
<p>But one of the things I notice is that menu for accessing the parts of the app is made with Button controls that post to the server and return a different page. I would like to change the buttons to LinkControls are there any reasons that people might have done this ? </p>
<p>I notice that when I do change to to LinkButtons there is actually javascript that seems to trigger the post action. Any reasons or ways to avoid this ?</p>
| [
{
"answer_id": 290517,
"author": "Phil Jenkins",
"author_id": 35496,
"author_profile": "https://Stackoverflow.com/users/35496",
"pm_score": 3,
"selected": true,
"text": ".linkButton\n{\n background-color: transparent;\n border-style: none;\n color: /* Something nice */\n cursor: ... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290459",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35513/"
] |
290,465 | <p>Does anyone know of a way to paste over a visually selected area without having the selection placed in the default register?</p>
<p>I know I can solve the problem by always pasting from an explicit register. But it's a pain in the neck to type <kbd>"</kbd><kbd>x</kbd><kbd>p</kbd> instead of just <kbd>p</kbd></p>
| [
{
"answer_id": 290543,
"author": "Gowri",
"author_id": 3253,
"author_profile": "https://Stackoverflow.com/users/3253",
"pm_score": -1,
"selected": false,
"text": ":set guioptions-=a\n:set guioptions-=A\n"
},
{
"answer_id": 290723,
"author": "Luc Hermitte",
"author_id": 15... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290465",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37708/"
] |
290,475 | <p>We have a major VB6 trading application which uses MS Access (Don't ask!) It is always blasting trades into an MS Access database.</p>
<p>The rest of the infrastructure here has moved on considerably and I want to read this Access database periodically and copy any new trades into a SQL server database.</p>
<p>The SQL and C# needed to do this is trivially easy.</p>
<p>BUT I want to make sure I do it in such a way that does not lock the Access database or cause problems for the VB6 app. In other words when populating my DataTable from Access I do NOT want to lock the database and prevent the VB6 app writing to it. I seem to remember from old ADO there were share modes you could use for this purpose.</p>
<p>What sort of connection string should I use from .NET to accomplish this?</p>
| [
{
"answer_id": 290561,
"author": "Mat Nadrofsky",
"author_id": 26853,
"author_profile": "https://Stackoverflow.com/users/26853",
"pm_score": 0,
"selected": false,
"text": "\"Data Source=C:\\IronSpeed\\TestAccessDB\\TestTypes.mdb;\nJet OLEDB:Database Locking Mode=1;\nMode=Read\"\n"
}
] | 2008/11/14 | [
"https://Stackoverflow.com/questions/290475",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35055/"
] |
290,484 | <p>I am writing a silly little app in C++ to test one of my libraries. I would like the app to display a list of commands to the user, allow the user to type a command, and then execute the action associated with that command. Sounds simple enough.
In C# I would end up writing a list/map of commands like so:</p>
<pre><code> class MenuItem
{
public MenuItem(string cmd, string desc, Action action)
{
Command = cmd;
Description = desc;
Action = action;
}
public string Command { get; private set; }
public string Description { get; private set; }
public Action Action { get; private set; }
}
static void Main(string[] args)
{
var items = new List<MenuItem>();
items.Add(new MenuItem(
"add",
"Adds 1 and 2",
()=> Console.WriteLine(1+2)));
}
</code></pre>
<p>Any suggestions on how to achieve this in C++? I don't really want to define separate classes/functions for each command. I can use Boost, but not TR1.</p>
| [
{
"answer_id": 290516,
"author": "Johannes Schaub - litb",
"author_id": 34509,
"author_profile": "https://Stackoverflow.com/users/34509",
"pm_score": 4,
"selected": true,
"text": "void exit_me(); /* exits the program */\nvoid help(); /* displays help */\n\nstd::map< std::string, boost::f... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290484",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21704/"
] |
290,488 | <p>This isn't my code; I am trying to figure out what exactly this does. This is a part of a big, ancient system written in C (actually it was written 4 years ago, but most likely written by a late 80s programmer mentality). Part of the code:</p>
<pre><code>char DestFile[256];
char DestFile2[256];
//This part is just to show an example
strcpy(DestFile, "/foo/boo/goo.gz")
strcpy ( DestFile2, DestFile );
Ptr = strrchr ( DestFile2, '.' );
if ( Ptr != 0 ) {
if ( ( strcmp ( Ptr, ".gz" ) == 0 ) ||
( strcmp ( Ptr, ".Z" ) == 0 ) ) {
*Ptr = 0;
rename ( DestFile, DestFile2 );
}
}
</code></pre>
<p>DestFile2 is not set anywhere else in the function. I compiled the code above, and printing out the DestFile shows nothing has changed. The only thing i can think of that this does is removing the file extension (*Ptr=0) but my knowledge of C is very limited...</p>
<p>Any ideas? It looks like every time it gets a file with .gz or .z it renames the file to the same name.</p>
| [
{
"answer_id": 290521,
"author": "Soraz",
"author_id": 24610,
"author_profile": "https://Stackoverflow.com/users/24610",
"pm_score": 5,
"selected": true,
"text": " |- Ptr\n v \n M y f i l e . g z \\0\n"
}
] | 2008/11/14 | [
"https://Stackoverflow.com/questions/290488",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34395/"
] |
290,503 | <p>Let's say you got a file containing texts (from 1 to N) separated by a $
How can a slit the file so the end result is N files? </p>
<blockquote>
<p>text1 with newlines $<br>
text2 $etc... $<br>
textN</p>
</blockquote>
<p>I'm thinking something with awk or sed but is there any available unix app that already perform that kind of task?</p>
| [
{
"answer_id": 290519,
"author": "Bill Karwin",
"author_id": 20860,
"author_profile": "https://Stackoverflow.com/users/20860",
"pm_score": 3,
"selected": true,
"text": "split -p"
},
{
"answer_id": 290665,
"author": "Powerlord",
"author_id": 15880,
"author_profile": "h... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290503",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23051/"
] |
290,513 | <p>I need an regular expression pattern to only accept positive whole numbers. It can also accept a single zero.</p>
<p>I do not want to accept decimals, negative number and numbers with leading zeros.</p>
<p>Any suggestions?</p>
| [
{
"answer_id": 290530,
"author": "3Doubloons",
"author_id": 25818,
"author_profile": "https://Stackoverflow.com/users/25818",
"pm_score": 3,
"selected": false,
"text": "/([1-9][0-9]*)|0/\n"
},
{
"answer_id": 290531,
"author": "Robert Gamble",
"author_id": 25222,
"auth... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290513",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26327/"
] |
290,523 | <p>What im wondering how to do is when someone edits a list item and it goes through my event code that is fired when a change is made and save is hit, i dont want anyone to be able to edit that list item itself while its still processnig that request. So i was wondering if while in that event i can disable the individual item from being edited by someone else untill it is done doing what it is doing.</p>
| [
{
"answer_id": 293109,
"author": "Bjørn Furuknap",
"author_id": 28382,
"author_profile": "https://Stackoverflow.com/users/28382",
"pm_score": 3,
"selected": true,
"text": " public override void ItemAdding(SPItemEventProperties properties)\n {\n if (properties.ListItem[\"upda... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290523",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18431/"
] |
290,527 | <p>Similar to <a href="https://stackoverflow.com/questions/288794/does-c-optimize-the-concatenation-of-string-literals">this</a> question, but for VB.NET since I learned this is a language thing.</p>
<p>For instance, would the compiler know to translate</p>
<blockquote>
<p>Dim s As String = "test " + "this " +
"function"</p>
</blockquote>
<p>to</p>
<pre><code>Dim s As String = "test this function"
</code></pre>
<p>and thus avoid the performance hit with the string concatenation?</p>
| [
{
"answer_id": 297257,
"author": "Jason Hernandez",
"author_id": 34863,
"author_profile": "https://Stackoverflow.com/users/34863",
"pm_score": 5,
"selected": true,
"text": "Public Class Class1\n\n\n Dim s As String = \"test \" + \"this \" + \"function\"\n\n Public Function test() A... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290527",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/337/"
] |
290,535 | <p>Using jQuery, what's the best way to find the next form element on the page, starting from an arbitrary element? When I say form element I mean <code><input></code>, <code><select></code>, <code><button></code> or <code><textarea></code>.</p>
<p>In the following examples, the element with the id "this" is the arbitrary starting point, and the element with the id "next" is the one I want to find. The same answer should work for all examples.</p>
<p>Example 1:</p>
<pre><code><ul>
<li><input type="text" /></li>
<li><input id="this" type="text" /></li>
</ul>
<ul>
<li><input id="next" type="text" /></li>
</ul>
<button></button>
</code></pre>
<p>Example 2:</p>
<pre><code><ul>
<li><input id="this" type="text" /></li>
</ul>
<button id="next"></button>
</code></pre>
<p>Example 3:</p>
<pre><code><input id="this" type="text" />
<input id="next" type="text" />
</code></pre>
<p>Example 4:</p>
<pre><code><div>
<input id="this" type="text" />
<input type="hidden" />
<div>
<table>
<tr><td></td><td><input id="next" type="text" /></td></tr>
</table>
</div>
<button></button>
</div>
</code></pre>
<p>EDIT: The two answers provided so far both require writing a sequence number to all input elements on the page. As I mentioned in the comments of one of them, this is kind of what I'm already doing and I would much prefer have a read-only solution since this will be happening inside a plugin.</p>
| [
{
"answer_id": 290604,
"author": "jckeyes",
"author_id": 17881,
"author_profile": "https://Stackoverflow.com/users/17881",
"pm_score": 2,
"selected": false,
"text": "<div>\n <input id=\"FormElement_0\" type=\"text\" />\n <input id=\"FormElement_1\" type=\"text\" />\n<div>\n"
},
... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290535",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
290,537 | <p>I have a solution with many projects. There is actually a Core project and a few plugins. I changed OutputPath for all plugins so all binaries end up in the Core bin\debug folder. (this is necessary as the Core do not have a reference on plugins, hence it does not "include" plugins binaries when it is compiled.)</p>
<p>So basically my folder structure is as follow:</p>
<pre>
Solution
MySolution.sln
Plugin1\
Plugin2\
Core\bin\debug
</pre>
<p>Each plugin OutputPath is "..\Core\bin\debug". When I open the solution Visual Studio creates a folder "Core\bin\debug" in Solution's folder parent as if the relative path starts from .sln file. However when I build the solution the binaries are output to the correct path ("Solution\Core\bin\debug"). </p>
Core\bin\debug
<p>It looks like a Visual Studio bug to me, but maybe I overlooked some option somewhere. Any ideas how to resolve this problem ?</p>
<p>PS: I know this not a critical issue as everything build and works fine, however I dislike the idea of meaningless folder hanging around</p>
| [
{
"answer_id": 290568,
"author": "Jeromy Irvine",
"author_id": 8223,
"author_profile": "https://Stackoverflow.com/users/8223",
"pm_score": 2,
"selected": false,
"text": "copy \"$(TargetPath)\" \"$(SolutionDir)Core\\$(OutDir)\"\n"
}
] | 2008/11/14 | [
"https://Stackoverflow.com/questions/290537",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37706/"
] |
290,545 | <p>I am adapting a little rmi client-server application. I have written several things :</p>
<pre><code>HelloInterface -> A Hello World interface for RMI
Server -> The server app'
Client -> The client app'
</code></pre>
<p>Nothing special, but... I have put my hands in a new RMISecurityManager, which calls a JNI method and checks the permission for a separate user:</p>
<pre><code>package rmi;
import java.rmi.RMISecurityManager;
import java.io.*;
public class NativeRMISecurityManager extends RMISecurityManager
{
private boolean unix;
protected static ThreadLocal user = new ThreadLocal();
/*
* On interdit l'utilisation du constructeur par defaut
* pour obliger l'utilisation du constructeur avec user.
*/
private NativeRMISecurityManager()
{
super();
}
public NativeRMISecurityManager (final String user)
{
super();
String OS = System.getProperty("os.name").toLowerCase();
unix = (OS.compareTo("windows") != 0); /* Assume that if not
* windows, then "UNIX/POSIX"
*/
/*
* ThreadLocal's user : Each thread is considered
* to have different access rights to the machine
*/
NativeRMISecurityManager.user.set(user);
if (!unix)
{
System.out.println("Systeme : "+OS);
}
}
public void checkRead(String file)
{
super.checkRead(file);
/*
* If we are on a **IX platform we want to check that
* the _user_ has access rights.
*/
if (unix)
{
String str_user = (String)NativeRMISecurityManager.user.get();
if (file == null)
{
throw new SecurityException("file = NULL !!!");
}
if (str_user == null)
{
throw new SecurityException("user = NULL in the ThreadLocal!!!");
}
int ret = c_checkRead(
file,
str_user
);
if (ret != 0)
{
throw new SecurityException("Access error: " + file);
}
}
}
public native int c_checkRead(String file, String user);
}
</code></pre>
<p>In the Server class I'm doing that : </p>
<pre><code>String user = "my_user";
System.setSecurityManager(new NativeRMISecurityManager(user));
</code></pre>
<p>This class seems to work in the Server's main thread. Now the problem is when I try and connect to that Server class and lookup the Registry.
I get that exception : </p>
<pre><code>Exception in thread "RMI TCP Connection(1)-192.168.42.207" java.lang.ExceptionInInitializerError
at sun.rmi.transport.StreamRemoteCall.getInputStream(StreamRemoteCall.java:111)
at sun.rmi.transport.Transport.serviceCall(Transport.java:118)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.SecurityException: user = NULL dans le ThreadLocal!!!
at rmi.NativeRMISecurityManager.checkRead(NativeRMISecurityManager.java:62)
at java.io.File.exists(File.java:700)
at java.lang.ClassLoader$3.run(ClassLoader.java:1689)
at java.security.AccessController.doPrivileged(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1686)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1668)
at java.lang.Runtime.loadLibrary0(Runtime.java:822)
at java.lang.System.loadLibrary(System.java:993)
at sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:50)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.server.MarshalInputStream.<clinit>(MarshalInputStream.java:97)
... 5 more
</code></pre>
<p>IMHO the meaning of this is that a thread is (implicitly) created and gets the NativeRMISecurityManager as its default SecurityManager.</p>
<p>Would somebody have any advice concerning that ?</p>
| [
{
"answer_id": 291993,
"author": "Greg Case",
"author_id": 462,
"author_profile": "https://Stackoverflow.com/users/462",
"pm_score": 3,
"selected": true,
"text": "public class NativeRMISecurityManager extends RMISecurityManager {\n\n private static final boolean UNIX;\n\n static {\... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290545",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26465/"
] |
290,548 | <p>How can I validate a username and password against Active Directory? I simply want to check if a username and password are correct.</p>
| [
{
"answer_id": 290558,
"author": "stephbu",
"author_id": 12702,
"author_profile": "https://Stackoverflow.com/users/12702",
"pm_score": 5,
"selected": false,
"text": "LOGON32_LOGON_NETWORK (3)\n"
},
{
"answer_id": 290571,
"author": "Charles Bretana",
"author_id": 32632,
... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290548",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
290,559 | <p>I want to write a script that will stop a scheduled task on a remote computer, do some stuff, and then start the schedule task back up.</p>
<p>How can I do it?</p>
| [
{
"answer_id": 291347,
"author": "Ben Noland",
"author_id": 32899,
"author_profile": "https://Stackoverflow.com/users/32899",
"pm_score": 8,
"selected": true,
"text": "schtasks /end /s <machine name> /tn <task name>\n"
},
{
"answer_id": 26151891,
"author": "Oleks",
"autho... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290559",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32899/"
] |
290,583 | <p>Vista SP1
Visual Studio 2008 SP1
.NET 3.5 SP1
C#</p>
<p>I have a winforms app I'm playing with that uses a SerialPort object as a private variable. When the application is compiled and executed, it works great. It also works running in debug mode wihtout any breakpoints. 90% of the time when I stop at a breakpoint and try to step through code I get an 'unhandled exception ocurred' dialog with these details:</p>
<p>System.ObjectDisposedException was unhandled
Message="Safe handle has been closed"
Source="mscorlib"
ObjectName=""
StackTrace:
at Microsoft.Win32.Win32Native.SetEvent(SafeWaitHandle handle)
at System.Threading.EventWaitHandle.Set()
at System.IO.Ports.SerialStream.AsyncFSCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOverlapped)
at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
InnerException:</p>
<p>The frustrating thing is, I do not have to be stepping over serial-related code! I just have to have done <em>something</em> with the port. So I might read a string, manipulate the string, add two numbers together, whatever, and then BANG.</p>
<p>Again, this works just fine when NOT debugging, or when debugging wihtout any breakpoints. There seems to be something about stopping at a breakpoint that makes the CLR dispose the SerialStream on a different thread.</p>
<p>There is a lot of chatter online about problems with renoving USB devices causing this. But I'm using the build-in motherboard port on COM1.</p>
<p>I don't think I had this issue in .NET 2.0 so I may have to go back to that...</p>
<p>I need to simplify the application quite a bit before I can post code - but has anyone seen behavior like this in the debugger before?</p>
<p>Thanks so much!</p>
| [
{
"answer_id": 44070189,
"author": "Berend Visser",
"author_id": 8036699,
"author_profile": "https://Stackoverflow.com/users/8036699",
"pm_score": 0,
"selected": false,
"text": "serialPortLock = Monitor.TryEnter(serialPort, 3000);\nThread.Sleep(5);\nserialPort.Write(msg, 0, msg.Length);\... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290583",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37710/"
] |
290,590 | <p>For both .NET Winforms and Windows Presentation Foundation, if I have a text box that the user has just entered text into, and a button, if the user clicks the button the "LostFocus" event fires before the button click event fires. However if the user uses a keyboard shortcut for the button (e.g. Button's text is "&Button" or "_Button" and user performs Alt+B), then the "LostFocus" event fires after the button click event, which is less useful.</p>
<p>Do you know of reasonable workarounds? We have various things that we want to occur in LostFocus before ButtonClick.</p>
| [
{
"answer_id": 290661,
"author": "Quibblesome",
"author_id": 1143,
"author_profile": "https://Stackoverflow.com/users/1143",
"pm_score": 1,
"selected": false,
"text": "Button b = (Button) sender;\nb.Focus();\n"
},
{
"answer_id": 290937,
"author": "Jason Down",
"author_id"... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290590",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
290,596 | <p>Sql server complaining about this IF NOT EXISTS statement, saying that there is 'incorrect syntax near the keyword 'OR'.</p>
<p>My query:</p>
<pre><code>IF NOT EXISTS (
(SELECT * FROM Users where userID = 1)
OR
(SELECT * FROM sales WHERE saleID = 1)
)
BEGIN
// blah blah blah
END
</code></pre>
| [
{
"answer_id": 290618,
"author": "Steven A. Lowe",
"author_id": 9345,
"author_profile": "https://Stackoverflow.com/users/9345",
"pm_score": 3,
"selected": false,
"text": "IF \n NOT EXISTS (SELECT 1 FROM Users where userID = 1) \nAND \n NOT EXISTS (SELECT 1 FROM sales WHERE saleID ... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290596",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
290,598 | <p>I'm doing some text rendering in Cocoa using NSAttributedString, and setting the font and underline properties, etc. However, I can't figure out how I can change the text's tracking. Any suggestions?</p>
| [
{
"answer_id": 292563,
"author": "cms",
"author_id": 28532,
"author_profile": "https://Stackoverflow.com/users/28532",
"pm_score": 1,
"selected": false,
"text": "NSLayoutManager"
}
] | 2008/11/14 | [
"https://Stackoverflow.com/questions/290598",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3830/"
] |
290,610 | <p>I have a table which has a field <code>sort_id</code>. In this field there are numbers from 1 to n, that define the order of the data sets.
Now I want to delete some elements and afterwards I want to reorder the table. Therefore I need a query that "finds" the gaps and changes the <code>sort_id</code> field according to the modifications.</p>
<p>Sure, I could do something like this:</p>
<pre><code>SELECT sort_id FROM table WHERE id = 5
</code></pre>
<p>Then save the sort_id and afterwards:</p>
<pre><code>DELETE FROM table WHERE id = 5
UPDATE table SET sort_id = sort_id - 1 WHERE sort_id > {id from above}
</code></pre>
<p>But I'd like to do the reordering process in one step.</p>
| [
{
"answer_id": 290641,
"author": "Mladen Prajdic",
"author_id": 31345,
"author_profile": "https://Stackoverflow.com/users/31345",
"pm_score": 0,
"selected": false,
"text": "SELECT row_number() over(order by sort_id) as RN\nFROM table\n"
},
{
"answer_id": 290856,
"author": "Ar... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290610",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35903/"
] |
290,617 | <p>I feel like I'm re-inventing the wheel here, but I need to find a way of taking a URL from a catchall,and redirecting that to another route.</p>
<p>The reason for this is because I need to do some things like adding session cookies for certain urls, and then pass them on to their relevant action.</p>
<p>What's the best way of implementing this?</p>
<p>Thanks in advance for any help!</p>
| [
{
"answer_id": 292050,
"author": "anonymous",
"author_id": 36602,
"author_profile": "https://Stackoverflow.com/users/36602",
"pm_score": 0,
"selected": false,
"text": "routes.MapRoute(\n \"Partner\",\n \"partners/{partner}/{*wildcard}\",\n new { controller = \"Partners\", action... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31532/"
] |
290,632 | <p><strong>Original Question</strong></p>
<p>I am writting a logging class where the goal is to be able to do this:</p>
<pre><code>// thread one
Logger() << "Some string" << std::ios::hex << 45;
// thread two
Logger() << L"Some wide string" << std::endl;
</code></pre>
<p>Currently my Logger header looks something like this:</p>
<pre><code>#pragma once;
#include <ostream>
class Logger
{
public:
Logger();
~Logger();
std::ostream* out_stream;
};
template <typename T>
Logger& operator<< (Logger& logger, T thing) {
*logger.out_stream << thing;
return logger;
}
</code></pre>
<p>Some notes about this class:</p>
<ol>
<li>Cross platform compatibility is not an issue.</li>
<li>Inside of Logger.cpp there is a singleton class that takes care of creating the "real" ostream.</li>
<li>The Logger constructor and deconstructor perform the necessary locking of the singleton.</li>
</ol>
<p>I have three problems:</p>
<ul>
<li>How do I make the operator<< function a friend or member so I can set out_stream as private? </li>
<li>How do I make the operator<< function work for manipulators?</li>
<li>How can I add a specialization so that if T is a WCHAR* or std::wstring that it will convert it to char* or std::string before passing it to out_stream? (I can do the conversion. Losing high unicode characters isn't a problem in my case.)</li>
</ul>
<p><strong>Summary of things learned in answers:</strong></p>
<ul>
<li>Put template BEFORE friend instead of after.</li>
<li>std::ios::hex is not a manipulator. std::hex is a manipulator.</li>
</ul>
<p><strong>End Result</strong></p>
<pre><code>#pragma once
#include <ostream>
#include <string>
std::string ConvertWstringToString(std::wstring wstr);
class Logger
{
public:
Logger();
~Logger();
template <typename T>
Logger& operator<< (T data) {
*out << data;
return *this;
}
Logger& operator<< (std::wstring data) {
return *this << ConvertWstringToString(data);
}
Logger& operator<< (const wchar_t* data) {
std::wstring str(data);
return *this << str;
}
private:
std::ostream* out;
};
</code></pre>
| [
{
"answer_id": 290644,
"author": "Lodle",
"author_id": 23339,
"author_profile": "https://Stackoverflow.com/users/23339",
"pm_score": 0,
"selected": false,
"text": "Logger(\"This is my log msg %0X\", 45);\n"
},
{
"answer_id": 290658,
"author": "Johannes Schaub - litb",
"au... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290632",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19476/"
] |
290,635 | <p>I'm trying to write a quick little java application to read the contents of a pcap file (from Wireshark) and play the data back on the network on a linux box. The file will only contain UDP broadcast packets, so my application only really needs the timestamp, port number, and data from the packet to do what I need. My problem is that the application that I'm trying to test with this code is listening for IPv4 UDP broadcasts on Windows. My test application keeps opening an IPv6 socket to send the data out.</p>
<p>I'm using <code>netstat -a -u -p</code> to determine that the socket is a udp6 socket. On windows I know it isn't.</p>
<p>What is the easiest or best way to force the test app on linux in java to open a udp or udp4 socket instead? I don't want to be forced in to providing the ipv4 network address each time. I want to be able to move this code to another machine without having to remember that their is some configuration that needs to be changed.</p>
| [
{
"answer_id": 4322157,
"author": "Urizev",
"author_id": 435855,
"author_profile": "https://Stackoverflow.com/users/435855",
"pm_score": 2,
"selected": false,
"text": " # echo 0 > /proc/sys/net/ipv6/bindv6only\n"
}
] | 2008/11/14 | [
"https://Stackoverflow.com/questions/290635",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5074/"
] |
290,636 | <p>I am working on modifying an existing spell check plugin for TinyMCE. </p>
<p>This is what is supposed to happen:
1. User hits "space" and the spell check runs.
2. If the word is spelled wrong the word gets wrapped with a span and gets a red underline</p>
<p>what I find happening is that when the user hits space bar the word does get spell checked but the cursor pops back to the end of the word just typed (instead of to where the space is) (you can see this in action at <a href="http://mail.solidhouse.com/webmail2/test.html" rel="nofollow noreferrer">http://mail.solidhouse.com/webmail2/test.html</a>)</p>
<p>here is my pseudcode:
var b = this.editor.selection.getBookmark();
//for each node
node.nodeValue.replace(r5, '$1$2');
this.editor.selection.moveToBookmark(b);</p>
<p>what I am suspecting is that moveToBookmark keeps the cursor within the element but I have no idea what to do to remedy this.</p>
<p>(I have tried incrementing b.start and b.end but that did not work)</p>
<p>I know this is hard to explain. Any thoughts on this are greatly appreciated. </p>
| [
{
"answer_id": 293465,
"author": "Jon Smock",
"author_id": 25538,
"author_profile": "https://Stackoverflow.com/users/25538",
"pm_score": 0,
"selected": false,
"text": "this.parentNode.moveToBookmark(b);\n"
}
] | 2008/11/14 | [
"https://Stackoverflow.com/questions/290636",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37723/"
] |
290,652 | <p>My stored procedure has an output parameter:</p>
<pre><code>@ID INT OUT
</code></pre>
<p>How can I retrieve this using ado.net?</p>
<pre><code>using (SqlConnection conn = new SqlConnection(...))
{
SqlCommand cmd = new SqlCommand("sproc", conn);
cmd.CommandType = CommandType.StoredProcedure;
// add parameters
conn.Open();
// *** read output parameter here, how?
conn.Close();
}
</code></pre>
| [
{
"answer_id": 290676,
"author": "WACM161",
"author_id": 12255,
"author_profile": "https://Stackoverflow.com/users/12255",
"pm_score": 5,
"selected": false,
"text": "using System; \nusing System.Data; \nusing System.Data.SqlClient; \n\n\nclass OutputParams \n{ \n [STAThread] \n sta... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290652",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
290,662 | <p>Where can I setup custom errors for directories in my application such as App_Code, App_Browsers, etc.? I already have customErrors configured in the web.config and that works as expected. For example,</p>
<p><a href="http://www.mysite.com/bla.aspx" rel="nofollow noreferrer">http://www.mysite.com/bla.aspx</a> > redirects to 404 page</p>
<p>but</p>
<p><a href="http://www.mysite.com/App_Code/" rel="nofollow noreferrer">http://www.mysite.com/App_Code/</a> > displays "The system cannot find the file specified."</p>
<p>There's no physical App_Code directory for my site. Is this something that I can change in IIS?</p>
| [
{
"answer_id": 291374,
"author": "flesh",
"author_id": 27805,
"author_profile": "https://Stackoverflow.com/users/27805",
"pm_score": 0,
"selected": false,
"text": " void Application_Error(object sender, EventArgs e) \n{\n //uncomment this to narrow down 'helpful' microsoft messages\n ... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290662",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2034/"
] |
290,667 | <p>Are there limits or performance penalties on the amount of code inside of my <code>home.cs</code> form?</p>
<p>I am writing a database application front-end in C# in Visual Studio 2008. The way things are lining up, I am using a tab-page way of changing the info shown to the end users, instead of using new forms. </p>
<p>Coming from VBA/MS Access, I remember that if you go over a certain number of lines of code, it would produce an error and not compile. Will C# do this in Visual Studio 2008, or will I suffer a performance hit? I know code readability could be a problem because everything would be in one place, but I can also see that as an advantage in some situations.</p>
| [
{
"answer_id": 290724,
"author": "Chris Marasti-Georg",
"author_id": 96,
"author_profile": "https://Stackoverflow.com/users/96",
"pm_score": 2,
"selected": false,
"text": "Dock = DockStyle.Fill"
}
] | 2008/11/14 | [
"https://Stackoverflow.com/questions/290667",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19802/"
] |
290,668 | <p>If I simply wrap my query with:</p>
<pre><code>BEGIN TRANSACTION
COMMIT TRANSACTION
</code></pre>
<p>If anything fails inside of that, will it automatically rollback?</p>
<p>From looking at other code, they seem to check for an error, if there is an error then they do a GOTO statement which then calls ROLLBACK TRANSACTION</p>
<p>But that seems like allot of work, to have to check for IF( @@ERROR <> 0) after every insert/update.</p>
| [
{
"answer_id": 290696,
"author": "Mladen Prajdic",
"author_id": 31345,
"author_profile": "https://Stackoverflow.com/users/31345",
"pm_score": 2,
"selected": false,
"text": "SET XACT_ABORT ON\n\nBEGIN TRANSACTION\n-- CODE HERE\nCOMMIT TRANSACTION\n"
},
{
"answer_id": 290704,
"... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290668",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
290,679 | <p>Over the years, I think I have seen and tried every conceivable way of generating stub data structures (fake data) for complex object graphs. It always gets hairy in java.</p>
<pre><code> * * * *
A---B----C----D----E
</code></pre>
<p>(Pardon cheap UML) </p>
<p>The key issue is that there are certain relationships between the values, so a certain instance of C may imply given values for E. </p>
<p>Any attempt I have seen at applying a single pattern or group of pattens to solve this problem in java ultimately end up being messy.</p>
<p>I am considering if groovy or any of the dynamic vm languages can do a better job. It should be possible to do things significantly simpler with closures. </p>
<p>Anyone have any references/examples of this problem solved nicely with (preferably) groovy or scala ?</p>
<p>Edit:
I did not know "Object Mother" was the name of the pattern, but it's the one I'm having troubles with: When the object structure to be generated by the Object Mother is sufficiently complex, you'll always end up with a fairly complex internal structure inside the Object Mother itself (or by composing multiple Object Mothers). Given a sufficiently large target structure (Say 30 classes), finding structured ways to implement the object mother(s) is really hard. Now that I know the name of the pattern i can google it better though ;) </p>
| [
{
"answer_id": 2611252,
"author": "Javid Jamae",
"author_id": 254046,
"author_profile": "https://Stackoverflow.com/users/254046",
"pm_score": 1,
"selected": false,
"text": "public class ItineraryObjectMother\n{\n Status status;\n private long departureTime;\n\n public ItineraryO... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290679",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23691/"
] |
290,697 | <p>how do i insert items into an html listbox from a database?
im using asp c#. i cant make the listbox run at server because the application wont work if i do that. so i have to insert values from a database into an html listbox. I just need to display 1 column of data. cheers..</p>
| [
{
"answer_id": 290732,
"author": "Adam Lassek",
"author_id": 1249,
"author_profile": "https://Stackoverflow.com/users/1249",
"pm_score": 0,
"selected": false,
"text": "<asp:Placeholder />"
}
] | 2008/11/14 | [
"https://Stackoverflow.com/questions/290697",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23491/"
] |
290,699 | <p>I need to have a set of overloaded functions in my code but I get convertion wanrings.
Here is a test code:</p>
<pre><code>#include windows.h
void f(DWORD arg){...}
//void f(SIZE_T arg){}
void main(void)
{
DWORD dword=0;
SIZE_T size_t=dword;
f(size_t);
}
</code></pre>
<p>The compiler gives warning:</p>
<pre><code>test.cpp(11) : warning C4244: 'argument' : conversion from 'SIZE_T' to 'DWORD', possible loss of data
</code></pre>
<p>If I uncomment void f(SIZE_T arg) I get</p>
<pre><code>test.cpp(5) : error C2084: function 'void f(DWORD)' already has a body
</code></pre>
<p>How can I avoid having this warning or error? </p>
| [
{
"answer_id": 290712,
"author": "Adam Rosenfield",
"author_id": 9530,
"author_profile": "https://Stackoverflow.com/users/9530",
"pm_score": 4,
"selected": false,
"text": "size_t"
},
{
"answer_id": 291912,
"author": "Max Lybbert",
"author_id": 10593,
"author_profile":... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290699",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
290,700 | <p>Suppose that you have two huge files (several GB) that you want to concatenate together, but that you have very little spare disk space (let's say a couple hundred MB). That is, given <code>file1</code> and <code>file2</code>, you want to end up with a single file which is the result of concatenating <code>file1</code> and <code>file2</code> together byte-for-byte, and delete the original files.</p>
<p>You can't do the obvious <code>cat file2 >> file1; rm file2</code>, since in between the two operations, you'd run out of disk space.</p>
<p>Solutions on any and all platforms with free or non-free tools are welcome; this is a hypothetical problem I thought up while I was downloading a Linux ISO the other day, and the download got interrupted partway through due to a wireless hiccup.</p>
| [
{
"answer_id": 290721,
"author": "Douglas Leeder",
"author_id": 3978,
"author_profile": "https://Stackoverflow.com/users/3978",
"pm_score": 4,
"selected": true,
"text": "dd"
},
{
"answer_id": 291479,
"author": "luke",
"author_id": 25920,
"author_profile": "https://Sta... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290700",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9530/"
] |
290,709 | <p>Is there a way to do this almost out-of-the-box?</p>
<p>I could go and write a big method that would use the collected tokens to figure out which leaves should be put in which branches and in the end populate a TreeNode object, but since gppg already handled everything by using supplied regular expressions, I was wondering if there's an easier way? Even if not, any pointers as to how best to approach the problem of creating an AST would be appreciated.</p>
<p>Apologies if I said anything silly, I'm only just beginning to play the compiler game. :)</p>
| [
{
"answer_id": 2777685,
"author": "Vadym Chekan",
"author_id": 158913,
"author_profile": "https://Stackoverflow.com/users/158913",
"pm_score": 1,
"selected": false,
"text": "{%\npublic BatchNode Batch;\npublic ErrorHandler yyhldr;\nprivate TransformationContext _txContext = Transformatio... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290709",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
290,734 | <p>I have a repository which contains some unversioned directories and files. The server running svn was recently changed and since the checkout was done using the url svn://OLD-IP, I relocated my svn working copy, this time to the url svn://NEW-DOMAIN-NAME. </p>
<p>Now since there are some unversioned resources, the switch did not happen properly and the working copy got locked. A cleanup operation did not work either because of these unversioned resources. </p>
<p>I looked up in the net and found about svn ignore and tried that but to no use. I am unable to release all locks. Any ideas on solving the problem? Once I release the locks, I believe I can use svn ignore and carry on the relocate operation.</p>
| [
{
"answer_id": 290793,
"author": "CesarB",
"author_id": 28258,
"author_profile": "https://Stackoverflow.com/users/28258",
"pm_score": 3,
"selected": false,
"text": "svn status"
},
{
"answer_id": 11985707,
"author": "KT..",
"author_id": 1603020,
"author_profile": "http... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290734",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27474/"
] |
290,739 | <p>I have a form that sits behind ASP.NET forms authentication. So far, the implementation follows a typical "out of the box" type configuration.</p>
<p>One page allows users to post messages. If the user sits on that page for a long time to compose the message, it may run past the auth session expiration. In that case, the post does not get recorded... they are just redirected to the login page.</p>
<p>What approach should I take to prevent the frustrating event of a long message being lost? </p>
<p>Obviously I could just make the auth session really long, but there are other factors in the system which discourage that approach. <strong>Is there a way I could make an exception for this particular page so that it will never redirect to the Login so long as its a postback?</strong></p>
| [
{
"answer_id": 291038,
"author": "Mark Brackett",
"author_id": 2199,
"author_profile": "https://Stackoverflow.com/users/2199",
"pm_score": 1,
"selected": false,
"text": "// Global.asax\nvoid FormsAuthentication_OnAuthenticate(object sender, FormsAuthenticationEventArgs e) {\n // check ... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290739",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/337/"
] |
290,743 | <p>I am invoking a C library via JNI that prints to stdout. How can I redirect this output to System.out?</p>
| [
{
"answer_id": 290749,
"author": "Alnitak",
"author_id": 6782,
"author_profile": "https://Stackoverflow.com/users/6782",
"pm_score": 3,
"selected": false,
"text": "System.out"
}
] | 2008/11/14 | [
"https://Stackoverflow.com/questions/290743",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
290,774 | <p>How can I get rid of: </p>
<pre><code><input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="..."/>
</code></pre>
<p>Completely !</p>
| [
{
"answer_id": 290811,
"author": "Julio César",
"author_id": 2148,
"author_profile": "https://Stackoverflow.com/users/2148",
"pm_score": 5,
"selected": true,
"text": "<%@ Page Language=\"C#\" AutoEventWireup=\"true\"\nCodebehind=\"Default.aspx.cs\" Inherits=\"Sample._Default\"\nEnableVie... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290774",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35513/"
] |
290,778 | <p>I'm having a problem with a administrative app I'm working on. I'm build an interface for stopping, starting and querying various services across 40 or so servers. </p>
<p>I'm looking at service.controller and have been successful in stopping and starting various services with button events but now I'm trying to figure out a way to return the service status to a text box and query for service status every 10 seconds or so and I feel like I'm hitting a brick wall. </p>
<p>Does anyone have any tips or insight?</p>
<p>Thanks!!</p>
| [
{
"answer_id": 290907,
"author": "Dan R",
"author_id": 24222,
"author_profile": "https://Stackoverflow.com/users/24222",
"pm_score": 3,
"selected": true,
"text": " private void t_Elapsed(object sender, ElapsedEventArgs e)\n {\n // Check service statuses\n }\n"
},
{
... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290778",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35760/"
] |
290,779 | <p>My teams evolution of TDD includes what appear to be departures from traditional oop.</p>
<ol>
<li><p>Moving away from classes that are self sufficient
We still encapsulate data where appropriate. But in order to mock any helper classes, we usually create some way to externally set them via constructor or mutator.</p></li>
<li><p>We don't use private methods, ever.
In order to take advantage of our mocking framework (RhinoMocks) the methods can't be private. This has been the biggest one to "sell" to our traditional devs. And to some degree I see their point. I just value testing more.</p></li>
</ol>
<p>What are your thoughts?</p>
| [
{
"answer_id": 290872,
"author": "labilbe",
"author_id": 1195872,
"author_profile": "https://Stackoverflow.com/users/1195872",
"pm_score": 1,
"selected": false,
"text": "[assembly: InternalsVisibleTo(\"MyAssembly.Tests\")]"
},
{
"answer_id": 291091,
"author": "Brian",
"au... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290779",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34895/"
] |
290,786 | <p>Do you know what's the format of the DepartureWindow parameter for sabre web-services' OTA_AirLowFareSearch call? Whatever I pass, it shows me an error.</p>
<p>This is the entire documentation for those parameters (I kid you not):</p>
<pre><code><!--"DepartureDateTime" represents the date and time of departure.-->
<DepartureDateTime>2004-11-22T15:00:00</DepartureDateTime>
<!--"DepartureWindow" represents a window of time to search prior and post departure.-->
<!--Example: JR.DFW/S-OYLAS22NOV1500‡ZRD09001700-->
<DepartureWindow>09001700</DepartureWindow>
</code></pre>
<p>I've already tryied passing the number of seconds since DepartureDateTime and a unix timestamp without success. The error message it's:</p>
<pre><code>Error response received. The error was: INVALID TIME WINDOW IN Z FIELDS
</code></pre>
<p>Thanks</p>
| [
{
"answer_id": 347440,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 2,
"selected": false,
"text": " <ns1:DepartureDateTime>2009-01-03T15:00:00</ns1:DepartureDateTime>\n <ns1:DepartureWindow>11001559</ns1:DepartureWindow>\n"
... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290786",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
290,799 | <p>I'm programming in FORTRAN and C on an SGI running Irix 6.5, but this should be applicable to all Unix-like systems. How do I find which library I need to link to my program when I get an "unresolved text symbol" link error? Here's an example of what I'm seeing from the linker:</p>
<pre><code>ld32: ERROR 33 Unresolved text symbol "ortho2_" -- first referenced by ./libfoo.a
</code></pre>
<p>Do I just have to know which libraries are required, or is there some tool or command that can help me figure this out?</p>
| [
{
"answer_id": 290815,
"author": "Robert Gamble",
"author_id": 25222,
"author_profile": "https://Stackoverflow.com/users/25222",
"pm_score": 4,
"selected": true,
"text": "nm"
},
{
"answer_id": 290873,
"author": "Tim Whitcomb",
"author_id": 24895,
"author_profile": "ht... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290799",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6688/"
] |
290,806 | <p>I might be one anal programmer, but I like code that looks good from a distance. I just found myself lining up a CSS style so that instead of this:</p>
<pre><code>#divPreview {
text-align: center;
vertical-align: middle;
border: #779 1px solid;
overflow: auto;
width: 210px;
height: 128px;
background-color: #fff"
}
</code></pre>
<p>it now looks like:</p>
<pre><code>#divPreview {
width: 210px;
height: 128px;
overflow: auto;
text-align: center;
vertical-align: middle;
border: #779 1px solid;
background-color: #fff";
}
</code></pre>
<p>I will almost always write numerical comparisons in order of size like</p>
<pre><code>if (0 < n && n < 10)
</code></pre>
<p>instead of</p>
<pre><code>if (0 < n && 10 > n)
</code></pre>
<p>and finally I will tend to arrange if-then-else code so that the THEN part is smaller than the ELSE part (cause the heavier stuff goes to the bottom, right?)</p>
<pre><code>if (afflicted == true) {
GetSome();
HelpRight();
}
else {
NowPlease();
}
</code></pre>
<p>ugh!</p>
<pre><code>if (afflicted == false) {
HowMuchTrouble();
}
else {
IsItToDo();
ThisReally();
}
</code></pre>
<p>aahhh</p>
<p>I could go on and on with more examples, but you get the idea...</p>
<p>Question: Am I alone in my neurosis here? What's your coding kink?</p>
| [
{
"answer_id": 290812,
"author": "Steve",
"author_id": 22712,
"author_profile": "https://Stackoverflow.com/users/22712",
"pm_score": 3,
"selected": false,
"text": "#divPreview {\n width : 210px;\n height : 128px;\n overflow : auto;\n ... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290806",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11397/"
] |
290,819 | <p>Are delegates the same thing as callbacks? Or are they related somehow?</p>
| [
{
"answer_id": 290854,
"author": "Wolf5",
"author_id": 37643,
"author_profile": "https://Stackoverflow.com/users/37643",
"pm_score": 3,
"selected": false,
"text": "delegate void MyDelegate(string Text);\n"
}
] | 2008/11/14 | [
"https://Stackoverflow.com/questions/290819",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
290,840 | <p>Let's say I have a table:</p>
<pre>
i j
---
a 1
a 2
a 3
a 4
b 5
b 6
b 7
b 8
b 9
</pre>
<p>Obvoiusly <code>SELECT a, GROUP_CONCAT(b SEPARATOR ',') GROUP BY a</code> would give me</p>
<pre>
a 1,2,3,4
b 5,6,7,8,9
</pre>
<p>But what if I want to get only a LIMITED number of results, like 2, for example:</p>
<pre>
a 1,2
b 5,6
</pre>
<p>Any ideas?</p>
| [
{
"answer_id": 293327,
"author": "Bill Karwin",
"author_id": 20860,
"author_profile": "https://Stackoverflow.com/users/20860",
"pm_score": 0,
"selected": false,
"text": "SELECT t.i, GROUP_CONCAT(t.j)\nFROM\n (SELECT t1.i, t1.j\n FROM mytable AS t1\n LEFT JOIN mytable AS t2\n ... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290840",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37141/"
] |
290,851 | <p>The basics have already been answered <a href="https://stackoverflow.com/questions/257125/human-language-of-a-document">here</a>. But is there a pre-built PHP lib doing the same as Lingua::Identify from CPAN?</p>
| [
{
"answer_id": 290864,
"author": "chroder",
"author_id": 18802,
"author_profile": "https://Stackoverflow.com/users/18802",
"pm_score": 3,
"selected": true,
"text": "Text_LanguageDetect"
}
] | 2008/11/14 | [
"https://Stackoverflow.com/questions/290851",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35189/"
] |
290,860 | <p>I'm attempting to get my first ASP.NET web page working on windows using <a href="http://www.mono-project.com/Main_Page" rel="nofollow noreferrer">Mono</a> and the XSP web server.</p>
<p>I'm following this chaps <a href="http://www.codeproject.com/KB/cross-platform/introtomono2.aspx" rel="nofollow noreferrer">example</a>. The <a href="http://www.codeproject.com/KB/cross-platform/introtomono1.aspx" rel="nofollow noreferrer">first part</a> of his example works very well with the latest version of mono. however the web part seems to fall over with the following error</p>
<blockquote>
<p>'{Path Name}\Index.aspx.cs' is not a
valid virtual path.</p>
</blockquote>
<p>Here's the full Stack Trace:</p>
<pre><code>System.Web.HttpException: 'C:\Projects\Mono\ASPExample\simpleapp\index.aspx.cs' is not a valid virtual path.
at System.Web.HttpRequest.MapPath (System.String virtualPath, System.String baseVirtualDir, Boolean allowCrossAppMapping) [0x00000]
at System.Web.HttpRequest.MapPath (System.String virtualPath) [0x00000]
at System.Web.Compilation.BuildManager.AddToCache (System.String virtualPath, System.Web.Compilation.BuildProvider bp) [0x00000]
at System.Web.Compilation.BuildManager.BuildAssembly (System.Web.VirtualPath virtualPath) [0x00000]
at System.Web.Compilation.BuildManager.GetCompiledType (System.String virtualPath) [0x00000]
at System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath (System.String virtualPath, System.Type requiredBaseType) [0x00000]
at System.Web.UI.PageParser.GetCompiledPageInstance (System.String virtualPath, System.String inputFile, System.Web.HttpContext context) [0x00000]
at System.Web.UI.PageHandlerFactory.GetHandler (System.Web.HttpContext context, System.String requestType, System.String url, System.String path) [0x00000]
at System.Web.HttpApplication.GetHandler (System.Web.HttpContext context, System.String url, Boolean ignoreContextHandler) [0x00000]
at System.Web.HttpApplication.GetHandler (System.Web.HttpContext context, System.String url) [0x00000]
at System.Web.HttpApplication+<Pipeline>c__Iterator5.MoveNext () [0x00000]
</code></pre>
<p>I was wondering if anyone knew what this error meant. I guess i'm looking for a mono expert, who's tried out the windows version.</p>
| [
{
"answer_id": 295310,
"author": "CraftyFella",
"author_id": 30317,
"author_profile": "https://Stackoverflow.com/users/30317",
"pm_score": 0,
"selected": false,
"text": "@echo off\ncall C:\\PROGRA~1\\MONO-2~1.1\\bin\\setmonopath.bat\nxsp --root . --port 8088 --applications /:.\n"
},
... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290860",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30317/"
] |
290,867 | <p>How do I serialize a 'Type'?</p>
<p>I want to serialize to XML an object that has a property that is a type of an object. The idea is that when it is deserialized I can create an object of that type.</p>
<pre><code>public class NewObject
{
}
[XmlRoot]
public class XmlData
{
private Type t;
public Type T
{
get { return t; }
set { t = value; }
}
}
static void Main(string[] args)
{
XmlData data = new XmlData();
data.T = typeof(NewObject);
try
{
XmlSerializer serializer = new XmlSerializer(typeof(XmlData));
try
{
using (FileStream fs = new FileStream("test.xml", FileMode.Create))
{
serializer.Serialize(fs, data);
}
}
catch (Exception ex)
{
}
}
catch (Exception ex)
{
}
}
</code></pre>
<p>I get this exception:
"The type ConsoleApplication1.NewObject was not expected. Use the XmlInclude or SoapInclude attribute to specify types that are not known statically."</p>
<p>Where do I put the [XmlInclude]? Is this even possible?</p>
| [
{
"answer_id": 290916,
"author": "Filip Frącz",
"author_id": 21704,
"author_profile": "https://Stackoverflow.com/users/21704",
"pm_score": 2,
"selected": false,
"text": "IXmlSerializable"
},
{
"answer_id": 4780020,
"author": "Mikael",
"author_id": 587222,
"author_prof... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290867",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9516/"
] |
290,875 | <p><rant-mode>
Have you ever seen a programming language that does not allow to add comments to the code? Welcome to the world of RTML (may it burn in hell)!
</rant-mode></p>
<h2>Question</h2>
<blockquote>
<p>What is the best technique (if any) you've adopted to comment your RTML code?</p>
</blockquote>
<p>Thank you!</p>
| [
{
"answer_id": 4424981,
"author": "bmarti44",
"author_id": 451238,
"author_profile": "https://Stackoverflow.com/users/451238",
"pm_score": 3,
"selected": true,
"text": "New"
},
{
"answer_id": 5464816,
"author": "Scherbius.com",
"author_id": 675937,
"author_profile": "... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290875",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31415/"
] |
290,884 | <p>The very common beginner mistake is when you try to use a class property "statically" without making an instance of that class. It leaves you with the mentioned error message:</p>
<blockquote>
<p>You can either make the non static method static or make an instance of that class to use its properties.</p>
</blockquote>
<p><strong>What the reason behind this? Am not concern with the solution, rather the reason.</strong></p>
<pre><code>private java.util.List<String> someMethod(){
/* Some Code */
return someList;
}
public static void main(String[] strArgs){
// The following statement causes the error.
java.util.List<String> someList = someMethod();
}
</code></pre>
| [
{
"answer_id": 290895,
"author": "Steven A. Lowe",
"author_id": 9345,
"author_profile": "https://Stackoverflow.com/users/9345",
"pm_score": 7,
"selected": false,
"text": "static"
},
{
"answer_id": 292263,
"author": "Ande Turner",
"author_id": 4857,
"author_profile": "... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290884",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37740/"
] |
290,896 | <p>Say I have this simple form:</p>
<pre><code>class ContactForm(forms.Form):
first_name = forms.CharField(required=True)
last_name = forms.CharField(required=True)
</code></pre>
<p>And I have a default value for one field but not the other. So I set it up like this:</p>
<pre><code>default_data = {'first_name','greg'}
form1=ContactForm(default_data)
</code></pre>
<p>However now when I go to display it, Django shows a validation error saying last_name is required:</p>
<pre><code>print form1.as_table()
</code></pre>
<p>What is the correct way to do this? Since this isn't data the user has submitted, just data I want to prefill.</p>
<p><strong>Note:</strong> required=False will not work because I do want it required when the user submits the data. Just when I'm first showing the form on the page, I won't have a default value.</p>
| [
{
"answer_id": 290910,
"author": "Jack M.",
"author_id": 3421,
"author_profile": "https://Stackoverflow.com/users/3421",
"pm_score": 1,
"selected": false,
"text": "from django import forms\nclass ContactForm(forms.Form):\n subject = forms.CharField(max_length=100)\n message = forms... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290896",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13009/"
] |
290,898 | <p>Without getting into the details of <em>why</em>, I'm looking for a clean (as possible) way to replace kernel functions and system calls from a loadable module. My initial idea was to write some code to override some functions, which would take the original function (perhaps, if possible, <em>call</em> the function), and then add some of my own code. The key is that the function that I write has to have the name of the original function, so other code, upon trying to access it, will access mine instead.</p>
<p>I can easily (comparatively) do this directly in the kernel by just throwing my code into the appropriate functions, but I was wondering if anyone knew a little C magic that isn't <em>necessarily</em> horrible kernel (or C) coding practice that could achieve the same result.</p>
<p>Thoughts of #defines and typedefs come to mind, but I can't quite hack it out in my head.</p>
<p>In short: does anyone know a way to effectively override functions in the Linux kernel (from a module)?</p>
<p>EDIT: Since it's been asked, I essentially want to log certain functions (creating/deleting directories, etc.) <em>from within the kernel</em>, but for sanity's sake, a loadable module seems to make sense, rather than having to write a big patch to the kernel code and recompile on every change. A minimal amount of added code to the kernel is okay, but I want to offload most of the work to a module.</p>
| [
{
"answer_id": 296704,
"author": "Phillip Whelan",
"author_id": 25305,
"author_profile": "https://Stackoverflow.com/users/25305",
"pm_score": 1,
"selected": false,
"text": "* IN_ACCESS - read of the file\n* IN_MODIFY - last modification\n* IN_ATTRIB - attributes of file change\n* IN_OPEN... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290898",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34426/"
] |
290,899 | <p>How exactly using VB6 can I can call any Windows shell command as you would from the command-line?</p>
<p>For example, something as trivial as:</p>
<pre><code>echo foo
</code></pre>
| [
{
"answer_id": 290906,
"author": "Ed Guiness",
"author_id": 4200,
"author_profile": "https://Stackoverflow.com/users/4200",
"pm_score": 3,
"selected": false,
"text": "Dim RetVal\nRetVal = Shell(\"C:\\WINDOWS\\CALC.EXE\", 1) ' Run Calculator.\n"
},
{
"answer_id": 290912,
"au... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290899",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4872/"
] |
290,913 | <p>In C++, is it possible to have a base plus derived class implement a single interface?</p>
<p>For example:</p>
<pre><code>class Interface
{
public:
virtual void BaseFunction() = 0;
virtual void DerivedFunction() = 0;
};
class Base
{
public:
virtual void BaseFunction(){}
};
class Derived : public Base, public Interface
{
public:
void DerivedFunction(){}
};
void main()
{
Derived derived;
}
</code></pre>
<p>This fails because Derived can not be instantiated. As far as the compiler is concerned Interface::BaseFunction is never defined.</p>
<p>So far the only solution I've found would be to declare a pass through function in Derived</p>
<pre><code>class Derived : public Base, public Interface
{
public:
void DerivedFunction(){}
void BaseFunction(){ Base::BaseFunction(); }
};
</code></pre>
<p>Is there any better solution?</p>
<hr>
<p><strong>EDIT:</strong> If it matters, here is a real world problem I had using MFC dialogs. </p>
<p>I have a dialog class (MyDialog lets say) that derives from CDialog. Due to dependency issues, I need to create an abstract interface (MyDialogInterface). The class that uses MyDialogInterface needs to use the methods specific to MyDialog, but also needs to call CDialog::SetParent. I just solved it by creating MyDialog::SetParent and having it pass through to CDialog::SetParent, but was wondering if there was a better way.</p>
| [
{
"answer_id": 290921,
"author": "Johannes Schaub - litb",
"author_id": 34509,
"author_profile": "https://Stackoverflow.com/users/34509",
"pm_score": 5,
"selected": true,
"text": "BaseFunction"
},
{
"answer_id": 290926,
"author": "Torlack",
"author_id": 5243,
"author_... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290913",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12567/"
] |
290,923 | <p>I have a file in cvs that has Sticky Options set to <code>-kk</code>. This replaces all cvs keywords with just the keyword name to facilitate diffs. For example, <code>$Author: Alex B$</code> becomes <code>$Author$</code>. </p>
<p>How do I disable the <code>-kk</code> behavior and get back to "normal" cvs where keywords are substituted in? I've tried <code>rm</code>'ing the file and updating, I've tried <code>cvs update -A</code> and neither changes the flag.</p>
| [
{
"answer_id": 290945,
"author": "Ken Gentle",
"author_id": 8709,
"author_profile": "https://Stackoverflow.com/users/8709",
"pm_score": 3,
"selected": true,
"text": "cvs update -kkv <filename>\n"
},
{
"answer_id": 3710512,
"author": "Iain",
"author_id": 447523,
"autho... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290923",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6180/"
] |
290,927 | <p>Is it expensive?</p>
<p>I am developing an HtmlHelper that renders directly to Response.Output in order to save unnecesary string creation and I need to choose between: </p>
<pre><code><% Validator.RenderClient(Response.Output); %>
</code></pre>
<p>and</p>
<pre><code><% Validator.RenderClient(); %>
</code></pre>
<p>and get the textWriter from HttpContext.Current.Response</p>
| [
{
"answer_id": 290949,
"author": "oglester",
"author_id": 2017,
"author_profile": "https://Stackoverflow.com/users/2017",
"pm_score": 2,
"selected": false,
"text": "public static HttpContext get_Current()\n{\n return (ContextBase.Current as HttpContext);\n}\n"
},
{
"answer_id"... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290927",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4264/"
] |
290,952 | <p>Suppose I have #define foo in various header files. It may expand to some different things. I would like to know (when compiling a .cc file) when a #define is encountered, to what it will expand, it which file it is and where it got included from.</p>
<p>Is it possible? If not, are there any partial solutions that may help?</p>
<p>Feel free to add comments with clarification requests.</p>
<p><strong>Edit: current answers seem to concentrate on the case when there is one #define and I just want to jump to definition or know what the definition is. That's the simple case and yes, your solutions work. But when I have the same #define in different files, and want to know which one kicks in first, none of these techniques is useful. Okay, I actually used #warning carefully to find the right place. But this requires much work.</strong></p>
| [
{
"answer_id": 291001,
"author": "Johannes Schaub - litb",
"author_id": 34509,
"author_profile": "https://Stackoverflow.com/users/34509",
"pm_score": 5,
"selected": true,
"text": "# shows preprocessed source with cpp internals removed\ng++ -E -P file.cc\n# shows preprocessed source kept ... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290952",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9403/"
] |
290,980 | <p>I have a Windows forms project (VS 2005, .net 2.0). The solution has references to 9 projects. Everything works and compiles fine on one of my computers. When I move it to a second computer, 8 out of the 9 project compile with no problem. When I try to compile the 9th project (the main project for the application - produces the .exe file to execute the application), I get the following error: </p>
<pre><code>'Error 3: A strongly-named assembly is required. (Exception from HRESULT: 0x80131044)'
</code></pre>
<p>The file location for the error is is listed as "C:\PATH-TO-APP\LC". </p>
<p>I have checked in the project properties and all of the projects are set to build in Debug mode, none of them are supposed to be signed. In the project that is failing, the only assembly that it references that is not in any of the other projects is Microsoft.VisualBasic (a .net 2.0 assembly). So I am at a loss to find what ids causing this error (the file referenced above in the error message - "LC" - does not exist. </p>
<p>Anyone know how I can force the project to accept all unsigned assemblies, or to determine which assembly is the culprit?</p>
<p>The only meaningful difference between the dev environments between the dev environment where this worked and the current one is that the first was XP and this is Vista64. However, a colleague of mine who is using XP is getting the same error.</p>
<p><strong>Third-party assemblies being used:</strong></p>
<ul>
<li>ComponentFactory.Krypton.Toolkit</li>
<li>ComponentFactory.Krypton.Navigator</li>
<li>VistaDB.NET20</li>
</ul>
<p>All of these are referenced in other projects in the solution which build with no problems, so it doesn't look like these are the problem.</p>
<p>So far I have tried deleting the suo file, Rebuild All, unloading and reloading projects from the solution, removing and readding referenced assemblies. Nothing has worked.<code></code></p>
| [
{
"answer_id": 291204,
"author": "Charles Bretana",
"author_id": 32632,
"author_profile": "https://Stackoverflow.com/users/32632",
"pm_score": 2,
"selected": false,
"text": "Public Key or Token: ab 1a 81 37 f9 79 0c 88 \n"
},
{
"answer_id": 64827702,
"author": "user160357",
... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290980",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51/"
] |
290,982 | <p>I have a block of code that works and I wanted to ask what exactly is happening here?</p>
<pre><code>Class<?> normalFormClass = null;
</code></pre>
<p>---added---</p>
<p>The wildcard "<code><?></code>" is the part that is confusing for me. Why would this be used rather than not using it (generics)?</p>
| [
{
"answer_id": 290995,
"author": "Vinko Vrsalovic",
"author_id": 5190,
"author_profile": "https://Stackoverflow.com/users/5190",
"pm_score": 5,
"selected": true,
"text": "Integer normalForm = new Integer();\nnormalFormClass = normalForm.getClass();\n"
},
{
"answer_id": 291260,
... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290982",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34475/"
] |
290,996 | <p>How do I get the HTTP status code (eg 200 or 500) after calling curl_easy_perform? </p>
| [
{
"answer_id": 291006,
"author": "Vinko Vrsalovic",
"author_id": 5190,
"author_profile": "https://Stackoverflow.com/users/5190",
"pm_score": 8,
"selected": true,
"text": "curl_code = curl_easy_perform (session);\nlong http_code = 0;\ncurl_easy_getinfo (session, CURLINFO_RESPONSE_CODE, &h... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290996",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23524/"
] |
290,997 | <p>We have the TAncestor class which has a virtual method GetFile.<br>
We will have some TDescendant = class(TAncestor) which may override GetFile.<br>
We want to insure that in such a case those overriden methods do not call inherited in their implementation.<br>
But if they don't implement GetFile and just use the one from TAncestor, it's fine.<br>
Is there a (simple) way to do this? </p>
<p>to make it clearer:<br>
- yes, doc clearly says 'do not use inherited in your descendant class'<br>
- I have no control of what others will code when overriding and don't rely on them reading the doc<br>
- I cannot restrict the execution to the exact class TAncestor as it is legit for descendant to use it if they don't provide their own implementation<br>
- I cannot make it abstract because it needs to have a default implementation<br>
- I want to enforce this with a way of detecting in the base class that the code is called through a descendant overridden implementation<br>
- Looking at the stack seems overkill but is my 1st idea so far</p>
| [
{
"answer_id": 291046,
"author": "Steve",
"author_id": 22712,
"author_profile": "https://Stackoverflow.com/users/22712",
"pm_score": 1,
"selected": false,
"text": "procedure TDescentdent.GetFile;\nbegin\n //do not call inherited\n //Do something new\nend;\n"
},
{
"answer_id": 2... | 2008/11/14 | [
"https://Stackoverflow.com/questions/290997",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9842/"
] |
291,000 | <p>I'm looking for a library in PHP that can create a tree structure from a database (or array of values) with left and right ids. For the result when getting values I am only looking for an array so I can create any type of view. For adding and removing, it would be nice if the library did it all. Even if the library is within another library, I don't mind as I'll probably pull it out and integrate it with my own libraries.</p>
<p>Anyone know of anything?</p>
<p>I'm using PHP & MySQL, so it'd be helpful if it used atleast PHP. If it's a different database I can probably convert it, although maybe the same with PHP if it doesn't use too much language specific functionality.</p>
| [
{
"answer_id": 4358306,
"author": "sirin k",
"author_id": 447880,
"author_profile": "https://Stackoverflow.com/users/447880",
"pm_score": 0,
"selected": false,
"text": " <?php\nclass Node\n{\n public $data;\n public $leftChild;\n public $rightChild;\n\n public function __construct($data... | 2008/11/14 | [
"https://Stackoverflow.com/questions/291000",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5441/"
] |
291,003 | <p>The JUnit framework contains 2 <code>Assert</code> classes (in different packages, obviously) and the methods on each appear to be very similar. Can anybody explain why this is?</p>
<p>The classes I'm referring to are: <a href="http://junit.org/junit/javadoc/4.5/junit/framework/Assert.html" rel="noreferrer"><code>junit.framework.Assert</code></a> and <a href="http://junit.org/junit/javadoc/4.5/org/junit/Assert.html" rel="noreferrer"><code>org.junit.Assert</code></a>.</p>
| [
{
"answer_id": 291032,
"author": "sblundy",
"author_id": 4893,
"author_profile": "https://Stackoverflow.com/users/4893",
"pm_score": 3,
"selected": false,
"text": "junit.framework"
},
{
"answer_id": 291045,
"author": "Mnementh",
"author_id": 21005,
"author_profile": "... | 2008/11/14 | [
"https://Stackoverflow.com/questions/291003",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2648/"
] |
291,012 | <p>I need to connect to Outlook through ASP.NET web application using user credentials. What are my options? </p>
<p>FYI: User logs into the web site by using Windows Authentication. I'm working with Outlook 2003. </p>
| [
{
"answer_id": 291282,
"author": "FlySwat",
"author_id": 1965,
"author_profile": "https://Stackoverflow.com/users/1965",
"pm_score": 0,
"selected": false,
"text": "outlook.Application outlookApp = new outlook.ApplicationClass();\noutlook.NameSpace olNameSpace = outlookApp.GetNamespace(\"... | 2008/11/14 | [
"https://Stackoverflow.com/questions/291012",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37759/"
] |
291,019 | <p>I ask this because at work I am supposed to develop a web-application that is used in an intranet, by two people. It's an application that should keep some states in a workflow. So I have to keep data in a session and have to care about concurrency. It would be so much easier to develop a normal desktop-application. But the client was clear on this (I wished everything in the spec would be so clear): he wants a web application.</p>
<p>I know that many people don't want to install applications, but here are two users, and I'm able to install it on the computers of them.</p>
<p>So I want to know: What are the reasons, why webapps are so popular these days? Is it a hype and in two years the clients will demand more desktop-applications? Or is there something about webapps that makes them especially sexy/appealing?</p>
| [
{
"answer_id": 291056,
"author": "Charles Bretana",
"author_id": 32632,
"author_profile": "https://Stackoverflow.com/users/32632",
"pm_score": 1,
"selected": false,
"text": " 1. They required no installation or deployment on client machines\n 2. They could not break other apps on the c... | 2008/11/14 | [
"https://Stackoverflow.com/questions/291019",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21005/"
] |
291,031 | <p>Writing a JSP page, what exactly does the <code><c:out></code> do? I've noticed that the following both has the same result:</p>
<pre><code><p>The person's name is <c:out value="${person.name}" /></p>
<p>The person's name is ${person.name}</p>
</code></pre>
| [
{
"answer_id": 291047,
"author": "krosenvold",
"author_id": 23691,
"author_profile": "https://Stackoverflow.com/users/23691",
"pm_score": 8,
"selected": true,
"text": "c:out"
},
{
"answer_id": 291081,
"author": "Chris Serra",
"author_id": 13435,
"author_profile": "htt... | 2008/11/14 | [
"https://Stackoverflow.com/questions/291031",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24396/"
] |
291,033 | <p>I have just started to study computer sciences at my university where they teach us programming in Scheme.</p>
<p>Since I have learned C++ for the last 6 years, Scheme appears a little odd to me. My instructors tell me you can write any program you can write in C or Java with it. </p>
<p>Is anybody really using this language?</p>
| [
{
"answer_id": 291246,
"author": "Max Lybbert",
"author_id": 10593,
"author_profile": "https://Stackoverflow.com/users/10593",
"pm_score": 1,
"selected": false,
"text": "call/cc"
}
] | 2008/11/14 | [
"https://Stackoverflow.com/questions/291033",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37758/"
] |
291,037 | <p>What is the easiest way to set the contents of an <code><asp:ContentPlaceHolder></code> programmatically? I imagine ill have to do a <code>Master.FindControl</code> call?</p>
| [
{
"answer_id": 292133,
"author": "tvanfosson",
"author_id": 12950,
"author_profile": "https://Stackoverflow.com/users/12950",
"pm_score": 2,
"selected": false,
"text": "<asp:Content runat=\"server\" ID=\"myContent\" ContentPlaceHolderID=\"masterContent\">\n</asp:Content>\n"
},
{
... | 2008/11/14 | [
"https://Stackoverflow.com/questions/291037",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25515/"
] |
291,057 | <p>I am new to C#. I wanted to do a simple program with some type of loops.
I wanted my program to loop through the numbers that the user enters and if it is less than a number then write keep guessing,but once they enter the number 25 i wanted it to say Merry Christmas.. Please Help</p>
<pre><code>int number;
do
{
Console.WriteLine("Guess a number between 20 through 25");
number = int.Parse(Console.ReadLine());
} while (number < 25);
</code></pre>
<p>C# Beginner</p>
| [
{
"answer_id": 291072,
"author": "Gavin Miller",
"author_id": 33226,
"author_profile": "https://Stackoverflow.com/users/33226",
"pm_score": 1,
"selected": false,
"text": "int number;\n\ndo\n{\n Console.WriteLine(\"Guess a number between 20 through 25\");\n number = int.Parse(Consol... | 2008/11/14 | [
"https://Stackoverflow.com/questions/291057",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
291,059 | <p>I'm creating an asp.net app with just some lite data access from xml files. However, I need to be able to authenticate administrative users (via forms) to manage that data. I don't want to stand up a sql db just for authentication purposes. I'd like to use xml, but not sure about security with that. Any suggestions? Custom role provider? MyOpenID?</p>
| [
{
"answer_id": 291072,
"author": "Gavin Miller",
"author_id": 33226,
"author_profile": "https://Stackoverflow.com/users/33226",
"pm_score": 1,
"selected": false,
"text": "int number;\n\ndo\n{\n Console.WriteLine(\"Guess a number between 20 through 25\");\n number = int.Parse(Consol... | 2008/11/14 | [
"https://Stackoverflow.com/questions/291059",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10693/"
] |
291,102 | <p>I've decided to attempt using the <a href="https://blog.codinghorror.com/preventing-csrf-and-xsrf-attacks/" rel="nofollow noreferrer">double submitted cookies</a> technique to attempt to prevent XSRF attacks on the site I'm working on. So the way I have it written down here is, all actions that actually DO something other than GET information, will be posts. Gets will be...uh...GETs. Secondly, every form that posts will have the key/cookie combo.</p>
<p>My question is, what would be the easiest way to implement this in an ASP.NET MVC web application?</p>
<p>Not to answer my own question, but here are my initial thoughts:</p>
<p>Right now my controllers all inherit from a base controller, so my first thought was to override the OnActionExecuted method to check for the existence of the required form field, and from there if it finds it, verify it against the cookie and either allow the post to continue or kick it to some error page.</p>
<p>For the form portion I was thinking of generating my own html extension methods like... Html.BeginSecureForm() that overloads all of the same methods as BeginForm (In case I need them) but auto generates the Pseudorandom key and cookie and places the cookie and the form field inside the form (IF ITS A POST!) automagically.</p>
<p>Sorry, if this is kind of jumbled up, I have notes scattered throughout these pages and I'm trying to organize them. Part of that is to figure out my design for this XSRF security thing.</p>
| [
{
"answer_id": 819384,
"author": "Jeff Atwood",
"author_id": 1,
"author_profile": "https://Stackoverflow.com/users/1",
"pm_score": 0,
"selected": false,
"text": "Html.AntiForgeryToken()"
}
] | 2008/11/14 | [
"https://Stackoverflow.com/questions/291102",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33910/"
] |
291,115 | <p>I'm using JScrollPane to allow scrolling in a JFrame that has a text component that's serving as a text editor. What I want to do, after setting the text in this editor, is have it scroll back up to the top, so you can see what's at the beginning of the file.</p>
<p>Does anyone know how to do this?</p>
| [
{
"answer_id": 291748,
"author": "Vincent Ramdhanie",
"author_id": 27439,
"author_profile": "https://Stackoverflow.com/users/27439",
"pm_score": 3,
"selected": false,
"text": " scrollPane.getViewport().setViewPosition(new Point(0,0));\n"
},
{
"answer_id": 3548638,
"author": "... | 2008/11/14 | [
"https://Stackoverflow.com/questions/291115",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
291,117 | <p>So I've got a program that needs to be multilingual. The only difference between what I'm needing and what I've found on the web is that all the computers my program will run on are set to the localization of EN.</p>
<p>We have spanish speaking employees that will use the program just like the english speaking employees. So I won't be able to set something up based on the localization of the computer, it'll all have to be done in code.</p>
<p>I was thinking of trying to create an XML file (really just a dataset) for every form that I have and having each data table be a selectable language. In each table, it would have the information (control name, property, and text) to set the labels/checkboxes/etc that it needs to. I'll have to create a new form control so that I can have a generic function to go through and rename all of these controls if possible.</p>
<pre><code><DataSet>
<English>
<ControlName>labelHello</ControlName>
<ControlProperty>Text</ControlProperty>
<Text>Hello</Text>
</English>
<English>
<ControlName>labelBye</ControlName>
<ControlProperty>Text</ControlProperty>
<Text>Bye</Text>
</English>
<Spanish>
<ControlName>labelHello</ControlName>
<ControlProperty>Text</ControlProperty>
<Text>Hola</Text>
</Spanish>
</DataSet>
</code></pre>
<p>Also I didn't know much about the strings in the resources file for each form. Could I do it from there and use .Net functions to achieve this?</p>
<p>So I'm up for lots of suggestions because I really don't want to go back into the program I just wrote and put this in, I hate going back and adding more functionality once I've already spent so much time with this sucker...</p>
<p>Thanks</p>
| [
{
"answer_id": 291133,
"author": "Joe",
"author_id": 13087,
"author_profile": "https://Stackoverflow.com/users/13087",
"pm_score": 3,
"selected": true,
"text": "Thread.CurrentThread.CurrentUICulture = new CultureInfo(\"es-ES\");\n"
},
{
"answer_id": 294801,
"author": "GregUze... | 2008/11/14 | [
"https://Stackoverflow.com/questions/291117",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21828/"
] |
291,132 | <p>Are there any things to be careful about when defining the <code>method_missing</code> method in Ruby? I'm wondering whether there are some not-so-obvious interactions from inheritance, exception throwing, performance, or anything else.</p>
| [
{
"answer_id": 291718,
"author": "James A. Rosen",
"author_id": 1190,
"author_profile": "https://Stackoverflow.com/users/1190",
"pm_score": 7,
"selected": true,
"text": "respond_to?"
},
{
"answer_id": 292838,
"author": "Pistos",
"author_id": 28558,
"author_profile": "... | 2008/11/14 | [
"https://Stackoverflow.com/questions/291132",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4883/"
] |
291,135 | <pre><code> ArrayList filters = new ArrayList();
filters.Add(new string[] { "Name", "Equals", "John" });
ObjectDataSource1.SelectParameters.Add("AppliedFilters",
string.Join(",",(string[])filters.ToArray(typeof(string))));
</code></pre>
<p>Am trying to add a parameter to my object data source which is bound to my select method which should accept a string[]. But as the SelectParameters.Add takes in (string,string) or the other 3 overloads which do not seem to function for me correctly. </p>
<p>The select method accepts a string param though i prefer it accept a string[] or arraylist, but for now I can live with accepting a string which i should convert back to string[]</p>
<p>Resolution:
followed this article <a href="https://stackoverflow.com/questions/235166/how-do-i-set-up-objectdatasource-select-parameters-at-runtime">link text</a></p>
<p><strong>Closed</strong> as duplicate of the question referenced above.</p>
| [
{
"answer_id": 291718,
"author": "James A. Rosen",
"author_id": 1190,
"author_profile": "https://Stackoverflow.com/users/1190",
"pm_score": 7,
"selected": true,
"text": "respond_to?"
},
{
"answer_id": 292838,
"author": "Pistos",
"author_id": 28558,
"author_profile": "... | 2008/11/14 | [
"https://Stackoverflow.com/questions/291135",
"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.