qid int64 4 22.2M | question stringlengths 18 48.3k | answers list | date stringlengths 10 10 | metadata list |
|---|---|---|---|---|
210,097 | <p>I have a table that has an insert trigger on it. If I insert in 6000 records into this table in one insert statement from a stored procedure, will the stored procedure return before the insert trigger completes?</p>
<p>Just to make sure that I'm thinking correctly, the trigger should only be called (i know 'called' isn't the right word) once because there was only 1 insert statement, right?</p>
<p>My main question is: will the sproc finish even if the trigger hasn't completed?</p>
| [
{
"answer_id": 210113,
"author": "tom.dietrich",
"author_id": 15769,
"author_profile": "https://Stackoverflow.com/users/15769",
"pm_score": 6,
"selected": true,
"text": "inserted"
}
] | 2008/10/16 | [
"https://Stackoverflow.com/questions/210097",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21828/"
] |
210,120 | <p>I have a symlink to an important directory. I want to get rid of that symlink, while keeping the directory behind it. </p>
<p>I tried <code>rm</code> and get back <code>rm: cannot remove 'foo'</code>.<br>
I tried <code>rmdir</code> and got back <code>rmdir: failed to remove 'foo': Directory not empty</code><br>
I then progressed through <code>rm -f</code>, <code>rm -rf</code> and <code>sudo rm -rf</code></p>
<p>Then I went to find my back-ups.</p>
<p>Is there a way to get rid of the symlink with out throwing away the baby with the bathwater? </p>
| [
{
"answer_id": 210130,
"author": "Joe Phillips",
"author_id": 20471,
"author_profile": "https://Stackoverflow.com/users/20471",
"pm_score": 10,
"selected": false,
"text": "$ unlink mySymLink\n"
},
{
"answer_id": 210133,
"author": "Matthew Scharley",
"author_id": 15537,
... | 2008/10/16 | [
"https://Stackoverflow.com/questions/210120",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8508/"
] |
210,122 | <p>I recently downloaded the source tarball for a GTK application that I'd like to improve. It uses the standard <code>./configure</code> and <code>make</code> build sequence.</p>
<p>The first time through, <code>configure</code> reported a bunch of unmet build dependencies, such as <code>libgnomeui-2.0</code>. As I usually do, I had to manually go through and find the Debian <code>*-dev</code> package names corresponding to these dependencies... of course the names never match up quite the same, so it gets to be a real hassle.</p>
<p>So what occurred to me is... <strong>are there any helper tools to automatically install the build dependencies listed by the <code>automake</code>/<code>autoconf</code> configuration files???</strong></p>
<p>(I already know about the <code>dpkg-buildpackage</code> tools, but in this case I am interested in building from a raw distribution-independent source tarball, <strong>not</strong> from the Debian package source.)</p>
| [
{
"answer_id": 210126,
"author": "John Millikin",
"author_id": 3560,
"author_profile": "https://Stackoverflow.com/users/3560",
"pm_score": 3,
"selected": false,
"text": "apt-get build-dep <package>"
},
{
"answer_id": 210192,
"author": "ephemient",
"author_id": 20713,
... | 2008/10/16 | [
"https://Stackoverflow.com/questions/210122",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20789/"
] |
210,145 | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/144833/most-useful-attributes-in-c">Most Useful Attributes in C#</a> </p>
</blockquote>
<p>besides:</p>
<pre><code>[DefaultValue(100)]
[Description("Some descriptive field here")]
public int MyProperty{get; set;}
</code></pre>
<p>What other C# Attributes are useful for Properties, after learning these I feel like I'm Missing out.</p>
<p><strong>Related Questions</strong></p>
<p><a href="https://stackoverflow.com/questions/144833/most-useful-attributes-in-c#144929">Most Useful Attributes in C#</a></p>
| [
{
"answer_id": 210154,
"author": "Greg D",
"author_id": 6932,
"author_profile": "https://Stackoverflow.com/users/6932",
"pm_score": 2,
"selected": false,
"text": "[Browsable]\n"
},
{
"answer_id": 210160,
"author": "TheSmurf",
"author_id": 1975282,
"author_profile": "h... | 2008/10/16 | [
"https://Stackoverflow.com/questions/210145",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28717/"
] |
210,169 | <p>What would be the best way to port an existing Drupal site to a Django application?
I have around 500 pages (mostly books module) and around 50 blog posts. I'm not using any 3rd party modules.
I would like to keep the current URLS (for SEO purposes) and migrate database to Django. I will create a simple blog application, so migrating blog posts should be ok. What would be the best way to serve 500+ pages with Django? I would like to use Admin to edit/add new pages.</p>
| [
{
"answer_id": 214984,
"author": "akaihola",
"author_id": 15770,
"author_profile": "https://Stackoverflow.com/users/15770",
"pm_score": 2,
"selected": false,
"text": "manage.py inspectdb"
}
] | 2008/10/16 | [
"https://Stackoverflow.com/questions/210169",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
210,171 | <p>I guess the real question is: </p>
<p>If I don't care about dirty reads, will adding the <strong>with (NOLOCK)</strong> hint to a SELECT statement affect the performance of:</p>
<ol>
<li>the current SELECT statement </li>
<li>other transactions against the given table</li>
</ol>
<p>Example:</p>
<pre><code>Select *
from aTable with (NOLOCK)
</code></pre>
| [
{
"answer_id": 210227,
"author": "tom.dietrich",
"author_id": 15769,
"author_profile": "https://Stackoverflow.com/users/15769",
"pm_score": 9,
"selected": true,
"text": "NOLOCK"
},
{
"answer_id": 35228402,
"author": "WonderWorker",
"author_id": 1271898,
"author_profil... | 2008/10/16 | [
"https://Stackoverflow.com/questions/210171",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12424/"
] |
210,178 | <p>Given the Below Tables. How do I get the Distinct name given the other ID of 76 in LINQ?</p>
<pre><code>**Table S**
SID OtherID
------------------------------
1 77
2 76
**Table Q**
QID SID HighLevelNAme LoweLevelName
---------------------------------------
10 1 Name1 Engine
11 1 Name1 SparkPlus
12 1 Name2 Seat
13 1 Name2 Belt
14 1 Name1 Oil
</code></pre>
<p>I want to return a list of </p>
<p>Name1
Name2</p>
<p>The SQL to do this is </p>
<pre><code>SELECT DISTINCT
Q.HighLevelNAme
FROM S
JOIN Q ON Q.SID = S.SID
WHERE
S.OtherID = 76
</code></pre>
<p>I also have Objects that represents each table.</p>
<p>An answer in VB or C# is acceptable.</p>
| [
{
"answer_id": 210217,
"author": "Troy Howard",
"author_id": 19258,
"author_profile": "https://Stackoverflow.com/users/19258",
"pm_score": 4,
"selected": true,
"text": "var results = (from QItem in dataContext.QItems\n where QItem.SItem.OtherID == 76\n selec... | 2008/10/16 | [
"https://Stackoverflow.com/questions/210178",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2469/"
] |
210,180 | <p>I've noticed for quite a long time that strange domains such like jsev.com, cssxx.com appered in my firefox status bar from time to time, I always wonder why so many web pages contains resources from these strange domains. I googled it, but found nothing. I guess it's some kind of virus which infect the servers and insert the code. Here is a sample taken from page header of <a href="http://www.eflorenzano.com/threadexample/blog/" rel="nofollow noreferrer">http://www.eflorenzano.com/threadexample/blog/</a>:</p>
<pre><code><script language="javascript" src="http://i.jsev.com./base.2032621946.js"> </script>
<body onmousemove="return fz3824();">
<LINK REL="stylesheet" TYPE="text/css" HREF="http://i.cssxx.com./base2032621947.css">
<A HREF = "http://i.html.com./base2032621947.html"></A>
<SCRIPT LANGUAGE="JAVASCRIPT" SRC="http://i.js.com./base2032621947.js"></SCRIPT>
<SCRIPT LANGUAGE="JAVASCRIPT">
function getuseragnt()
{ var agt = navigator.userAgent.toLowerCase();
agt = agt.replace(/ /g, "");
return agt;
}
document.write("<LINK REL='stylesheet' TYPE='text/css' HREF='http://i.css2js.com./base.css" + getuseragnt() + "_2032621947'>")
</SCRIPT>
</code></pre>
<p>edit: I am on a debian box, only on firefox I see this code, I just tried opera, this code doesn't appear in opera, really strange, never heard of firefox having such problems.</p>
| [
{
"answer_id": 210212,
"author": "John Millikin",
"author_id": 3560,
"author_profile": "https://Stackoverflow.com/users/3560",
"pm_score": 2,
"selected": false,
"text": "<head><title>Tutorial 2</title>\n<link rel=\"stylesheet\" type=\"text/css\" href=\"http://yui.yahooapis.com/2.4.1/buil... | 2008/10/16 | [
"https://Stackoverflow.com/questions/210180",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1925263/"
] |
210,201 | <p>Can somebody remember what was the command to create an empty file in MSDOS using BAT file?</p>
| [
{
"answer_id": 210209,
"author": "TheSmurf",
"author_id": 1975282,
"author_profile": "https://Stackoverflow.com/users/1975282",
"pm_score": 9,
"selected": true,
"text": "echo. 2>EmptyFile.txt\n"
},
{
"answer_id": 211045,
"author": "ephemient",
"author_id": 20713,
"aut... | 2008/10/16 | [
"https://Stackoverflow.com/questions/210201",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/446104/"
] |
210,206 | <p>I have this regex I built and tested in regex buddy.</p>
<pre><code>"_ [ 0-9]{10}+ {1}+[ 0-9]{10}+ {2}+[ 0-9]{6}+ {2}[ 0-9]{2}"
</code></pre>
<p>When I use this in .Net C# </p>
<p>I receive the exception</p>
<pre><code>"parsing \"_ [ 0-9]{10}+ +[ 0-9]{10}+ +[ 0-9]{6}+ [ 0-9]{2}\" - Nested quantifier +."
</code></pre>
<p>What does this error mean? Apparently .net doesn't like the expression.</p>
<p>Here is the regex buddy so u can understand my intention with the regex...</p>
<pre><code>_ [ 0-9]{10}+ {1}+[ 0-9]{10}+ {2}+[ 0-9]{6}+ {2}[ 0-9]{2}
Match the characters "_ " literally «_ »
Match a single character present in the list below «[ 0-9]{10}+»
Exactly 10 times «{10}+»
The character " " « »
A character in the range between "0" and "9" «0-9»
Match the character " " literally « {1}+»
Exactly 1 times «{1}+»
Match a single character present in the list below «[ 0-9]{10}+»
Exactly 10 times «{10}+»
The character " " « »
A character in the range between "0" and "9" «0-9»
Match the character " " literally « {2}+»
Exactly 2 times «{2}+»
Match a single character present in the list below «[ 0-9]{6}+»
Exactly 6 times «{6}+»
The character " " « »
A character in the range between "0" and "9" «0-9»
Match the character " " literally « {2}»
Exactly 2 times «{2}»
Match a single character present in the list below «[ 0-9]{2}»
Exactly 2 times «{2}»
The character " " « »
A character in the range between "0" and "9" «0-9»
</code></pre>
<p>In short...</p>
<p>What is a Nested quantifier?</p>
| [
{
"answer_id": 210243,
"author": "Duncan",
"author_id": 25035,
"author_profile": "https://Stackoverflow.com/users/25035",
"pm_score": 5,
"selected": true,
"text": "+"
},
{
"answer_id": 210265,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackove... | 2008/10/16 | [
"https://Stackoverflow.com/questions/210206",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6161/"
] |
210,225 | <p>I made a simple game for the iPhone using OpenGL ES. Everything works fine except for this problem:</p>
<p>I turn the phone completely off, then back on, then launch my app and I get this wierd flickering! Every other frame is correct... the incorrect frames are just the same frame over and over again. If I quit the app, launch it again everything is fine. If I quit and restart 10 times in a row everything is fine every time.</p>
<p>But if I turn the phone off, then back on, then launch the app I get the same flickering the first time I launch the app.</p>
<p>Why is this happening?!</p>
<p>Has anyone else had this problem?</p>
<p>Cheers!</p>
| [
{
"answer_id": 2808695,
"author": "gulchrider",
"author_id": 289447,
"author_profile": "https://Stackoverflow.com/users/289447",
"pm_score": 1,
"selected": false,
"text": "- (void) draw\n{\n [EAGLContext setCurrentContext:context]; \n glBindFramebufferOES(GL_FRAMEBUFFER_OES, defaultF... | 2008/10/16 | [
"https://Stackoverflow.com/questions/210225",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22471/"
] |
210,233 | <p>I imagine there are many of you out there who have developed an application online which automates a lot of processes and saves people at your company time and money.</p>
<p>The question is, what are your experiences with developing that application, having it all set in place, then "spicing" it up with some Ajax, so it makes for a better user experience?</p>
<p>Also, what libraries would you suggest using when adding Ajax to an already-developed web application?</p>
<p>Lastly, what are some common processes you see in web applications that Ajax does well with? For example, auto-populating the search box as you type.</p>
| [
{
"answer_id": 210242,
"author": "IAmCodeMonkey",
"author_id": 27613,
"author_profile": "https://Stackoverflow.com/users/27613",
"pm_score": 0,
"selected": false,
"text": "<asp:ScriptManager\n"
}
] | 2008/10/16 | [
"https://Stackoverflow.com/questions/210233",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26130/"
] |
210,250 | <p>I have an ASP.NET website and when I press F5 it automatically attaches to the ASP.NET Development Server, how do I attach to IIS worker process instead when I press F5?</p>
| [
{
"answer_id": 8438502,
"author": "yoel halb",
"author_id": 640195,
"author_profile": "https://Stackoverflow.com/users/640195",
"pm_score": 4,
"selected": false,
"text": "c:\\%systemroot%\\system32\\inetsrv\\appcmd list wp\n"
}
] | 2008/10/16 | [
"https://Stackoverflow.com/questions/210250",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1100768/"
] |
210,256 | <p>I have an XML document, and contained within one of the nodes, I have <code><li></code> tags. I don't need <code><ul></ul></code> tags for Flash because it only accepts <code><li></code> tags anyway. For example, here's part of the XML doc:</p>
<pre><code><node>
<li>item1</li>
<li>item2</li>
</node>
</code></pre>
<p>I want to put all the data within the <code><node></code> tags, <em>with bullets</em>, into a TextArea component in Flash 8.
Note that my textArea is set to accept HTML, and that</p>
<pre><code>textArea.text = "<li>This is bulleted text</li>";
</code></pre>
<p>works just fine. However, the <code><li></code> tags within the XML document are being interpreted as a completely different node, which I obviously do not want. </p>
<p>I tried using a CDATA tag within the XML, and it inputted everything between the <code><node></code> tags, <em>including</em> the <code><li></code> tags with all their brackets. It does that because <code><li></code>'s brackets are being interpreted with the equivalent "& lt;" and "& gt;" for the left/right brackets.</p>
<p>So now I'm stuck with an unordered list in my XML file that I can't read into Flash. Unless, of course, somebody here can help me out?</p>
| [
{
"answer_id": 8438502,
"author": "yoel halb",
"author_id": 640195,
"author_profile": "https://Stackoverflow.com/users/640195",
"pm_score": 4,
"selected": false,
"text": "c:\\%systemroot%\\system32\\inetsrv\\appcmd list wp\n"
}
] | 2008/10/16 | [
"https://Stackoverflow.com/questions/210256",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/557/"
] |
210,261 | <p>I'm debugging a Cocoa application that can act as a handler to a custom URL protocol. The application works fine when I click on a link after the application has launched, but something is causing the app to crash if it has not launched at the time the link is clicked.</p>
<p>Is there any way that I can start the app in the debugger and "fool" it into thinking that I had just clicked on a link?</p>
| [
{
"answer_id": 221172,
"author": "Ken",
"author_id": 17320,
"author_profile": "https://Stackoverflow.com/users/17320",
"pm_score": 2,
"selected": false,
"text": "gdb --wait myAppName\n"
}
] | 2008/10/16 | [
"https://Stackoverflow.com/questions/210261",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26628/"
] |
210,266 | <p>In the Java code I'm working with we have an interface to define our Data Access Objects(DAO). Most of the methods take a parameter of a Data Transfer Object (DTO). The problem occurs when an implementation of the DAO needs to refer to a specific type of DTO. The method then needs to do a (to me completely unnecessary cast of the DTO to SpecificDTO. Not only that but the compiler can't enforce any type of type checking for specific implementations of the DAO which should only take as parameters their specifc types of DTOs.
My question is: how do I fix this in the smallest possible manner?</p>
| [
{
"answer_id": 210282,
"author": "johnstok",
"author_id": 27929,
"author_profile": "https://Stackoverflow.com/users/27929",
"pm_score": 4,
"selected": false,
"text": "DAO<SpecificDTO> dao = new SpecificDAO();\ndao.save(new SpecificDTO());\netc.\n"
},
{
"answer_id": 212810,
"a... | 2008/10/16 | [
"https://Stackoverflow.com/questions/210266",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
210,296 | <p>I've got a website that has windows authentication enable on it. From a page in the website, the users have the ability to start a service that does some stuff with the database.</p>
<p>It works fine for me to start the service because I'm a local admin on the server. But I just had a user test it and they can't get the service started.</p>
<p>My question is:</p>
<hr>
<p><strong>Does anyone know of a way to get a list of services on a specified computer by name using a different windows account than the one they are currently logged in with?</strong></p>
<hr>
<p>I really don't want to add all the users that need to start the service into a windows group and set them all to a local admin on my IIS server.....</p>
<p>Here's some of the code I've got:</p>
<pre><code>public static ServiceControllerStatus FindService()
{
ServiceControllerStatus status = ServiceControllerStatus.Stopped;
try
{
string machineName = ConfigurationManager.AppSettings["ServiceMachineName"];
ServiceController[] services = ServiceController.GetServices(machineName);
string serviceName = ConfigurationManager.AppSettings["ServiceName"].ToLower();
foreach (ServiceController service in services)
{
if (service.ServiceName.ToLower() == serviceName)
{
status = service.Status;
break;
}
}
}
catch(Exception ex)
{
status = ServiceControllerStatus.Stopped;
SaveError(ex, "Utilities - FindService()");
}
return status;
}
</code></pre>
<p>My exception comes from the second line in the try block. Here's the error:</p>
<blockquote>
<p>System.InvalidOperationException:
Cannot open Service Control Manager on
computer 'server.domain.com'. This
operation might require other
privileges. --->
System.ComponentModel.Win32Exception:
Access is denied --- End of inner
exception stack trace --- at
System.ServiceProcess.ServiceController.GetDataBaseHandleWithAccess(String
machineName, Int32
serviceControlManaqerAccess) at
System.ServiceProcess.ServiceController.GetServicesOfType(String
machineName, Int32 serviceType) at
TelemarketingWebSite.Utilities.StartService()</p>
</blockquote>
<p>Thanks for the help/info</p>
| [
{
"answer_id": 210813,
"author": "Rich",
"author_id": 28442,
"author_profile": "https://Stackoverflow.com/users/28442",
"pm_score": 1,
"selected": false,
"text": " <system.web>\n <identity impersonate=\"true\" userName=\"Username\" password=\"Password\" />\n </system.web\n"
... | 2008/10/16 | [
"https://Stackoverflow.com/questions/210296",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21828/"
] |
210,309 | <p>I am having a problem with FCKeditor reverting html entities entered in the source view back to their original unicode representations.
For example when I enter <code>&euro;</code> into the source view, switch to html and then back to source view, the entity is replaced by an actual € symbol.
The bigger problem, as a result, is that this unicode character is then sent back to the server on submit causing character encoding issues with the underlying database table.
Anyone else come across this?
I have tried many combinations of config settings but all to no avail.</p>
| [
{
"answer_id": 210360,
"author": "Anne Porosoff",
"author_id": 28701,
"author_profile": "https://Stackoverflow.com/users/28701",
"pm_score": 2,
"selected": false,
"text": "€"
},
{
"answer_id": 211521,
"author": "mysomic",
"author_id": 27241,
"author_profile": "ht... | 2008/10/16 | [
"https://Stackoverflow.com/questions/210309",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27241/"
] |
210,321 | <p>What is the best method for determining if a users browser has cookies enabled in ASP.NET</p>
| [
{
"answer_id": 2583101,
"author": "nuwan",
"author_id": 309773,
"author_profile": "https://Stackoverflow.com/users/309773",
"pm_score": -1,
"selected": false,
"text": "function cc()\n{\n /* check for a cookie */\n if (document.cookie == \"\") \n {\n /* if a cookie is not found - ale... | 2008/10/16 | [
"https://Stackoverflow.com/questions/210321",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1375/"
] |
210,342 | <p>I have a html page open on my webbrowser object, I can enter username and password okay, but I'm stuck and don't know how to submit the info. Here is the html code for the username/password submit:</p>
<pre><code><div id="signin">
<h2 class="ir">
<em></em>Sign in</h2>
<form action="/login/" method="post">
<input id="login-url" name="login[url]"
type="hidden" value="/characters/" />
<input id="login-urlError" name="login[urlError]"
type="hidden" value="/account/?error=1" />
<fieldset>
<ul>
<li class="row">
<label for="login-username">
Username <span class="req">*</span>
</label>
<input id="login-username" name="login[username]"
type="text" class="TextBox" value="" />
</li>
<li class="row">
<label for="login-password">
Password <span class="req">*</span>
</label>
<input id="login-password" name="login[password]"
type="password" class="TextBox Password" value="" />
</li>
<li class="but">
<input name="login[submit]" type="image"
class="img" alt="Login &raquo;"
src="/_pub/img/hp/but-login.png" />
</li>
</ul>
</fieldset>
</form>
<p>
<a href="/account/password-reset/">ACCOUNT TROUBLE?</a>
</p>
</div>
</code></pre>
<p>I use the following to enter the username and password:</p>
<pre><code>WebBrowser1.Document.GetElementById("login-username").SetAttribute("Value", Information.txtuser.Text)
WebBrowser1.Document.GetElementById("login-password").SetAttribute("Value", Information.txtpass.Text)
</code></pre>
<p>What should I use to submit the info now? I tried getting the element by name and kept getting index out of range error, index should be -1 or 0, but it was.</p>
<p>Your help would be greatly appriecated!!</p>
| [
{
"answer_id": 281892,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 1,
"selected": false,
"text": "\nPublic Function LoginAsTech(ByVal UserID As String, ByVal Pass As String) As Boolean\n Dim MyDoc As New mshtml.HTMLDo... | 2008/10/16 | [
"https://Stackoverflow.com/questions/210342",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
210,344 | <p>I just installed the first release candidate of Python 3.0 and got this error after typing:</p>
<pre><code>>>> help('modules foo')
</code></pre>
<pre>[...]
LookupError: unknown encoding: uft-8</pre>
<p>Notice that it says <strong>uft</strong>-8 and not <strong>utf</strong>-8</p>
<p>Is this a py3k specific bug or a misconfiguration on my part? I do not have any other versions of Python installed on this French locale Windows XP SP3 machine.</p>
<p><strong>Edit</strong></p>
<p>A <a href="http://bugs.python.org/issue4135?@ok_message=msg%2074871%20created%3Cbr%3Eissue%204135%20created&@template=item" rel="nofollow noreferrer">bug</a> has been filled by <a href="https://stackoverflow.com/users/22899/alex-coventry">Alex Coventry</a> on October 16th.</p>
| [
{
"answer_id": 210395,
"author": "Dan Lenski",
"author_id": 20789,
"author_profile": "https://Stackoverflow.com/users/20789",
"pm_score": 0,
"selected": false,
"text": "__future__"
},
{
"answer_id": 210417,
"author": "Alex Coventry",
"author_id": 1941213,
"author_prof... | 2008/10/16 | [
"https://Stackoverflow.com/questions/210344",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23002/"
] |
210,353 | <p>I have a class that compares 2 instances of the same objects, and generates a list of their differences. This is done by looping through the key collections and filling a set of other collections with a list of what has changed (this may make more sense after viewing the code below). This works, and generates an object that lets me know what exactly has been added and removed between the "old" object and the "new" one.<br>
My question/concern is this...it is really ugly, with tons of loops and conditions. Is there a better way to store/approach this, without having to rely so heavily on endless groups of hard-coded conditions? </p>
<pre><code> public void DiffSteps()
{
try
{
//Confirm that there are 2 populated objects to compare
if (NewStep.Id != Guid.Empty && SavedStep.Id != Guid.Empty)
{
//<TODO> Find a good way to compare quickly if the objects are exactly the same...hash?
//Compare the StepDoc collections:
OldDocs = SavedStep.StepDocs;
NewDocs = NewStep.StepDocs;
Collection<StepDoc> docstoDelete = new Collection<StepDoc>();
foreach (StepDoc oldDoc in OldDocs)
{
bool delete = false;
foreach (StepDoc newDoc in NewDocs)
{
if (newDoc.DocId == oldDoc.DocId)
{
delete = true;
}
}
if (delete)
docstoDelete.Add(oldDoc);
}
foreach (StepDoc doc in docstoDelete)
{
OldDocs.Remove(doc);
NewDocs.Remove(doc);
}
//Same loop(s) for StepUsers...omitted for brevity
//This is a collection of users to delete; it is the collection
//of users that has not changed. So, this collection also needs to be checked
//to see if the permisssions (or any other future properties) have changed.
foreach (StepUser user in userstoDelete)
{
//Compare the two
StepUser oldUser = null;
StepUser newUser = null;
foreach(StepUser oldie in OldUsers)
{
if (user.UserId == oldie.UserId)
oldUser = oldie;
}
foreach (StepUser newie in NewUsers)
{
if (user.UserId == newie.UserId)
newUser = newie;
}
if(oldUser != null && newUser != null)
{
if (oldUser.Role != newUser.Role)
UpdatedRoles.Add(newUser.Name, newUser.Role);
}
OldUsers.Remove(user);
NewUsers.Remove(user);
}
}
}
catch(Exception ex)
{
string errorMessage =
String.Format("Error generating diff between Step objects {0} and {1}", NewStep.Id, SavedStep.Id);
log.Error(errorMessage,ex);
throw;
}
}
</code></pre>
<hr>
<p>The targeted framework is 3.5.</p>
| [
{
"answer_id": 210361,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 3,
"selected": false,
"text": "if (NewStep.Id != Guid.Empty && SavedStep.Id != Guid.Empty)\n{\n // Body\n}\n"
},
{
"answer_id": 210370,
... | 2008/10/16 | [
"https://Stackoverflow.com/questions/210353",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18449/"
] |
210,355 | <p>I changed the folder that my WordPress installation was in.</p>
<p>However, this worked fine, except now all my images are not showing up.</p>
<p>The problem is that each post has the full url of the image in it. (not my doing, this seems to be the default setting)</p>
<p>Is there a tool or a quick fix available for this?</p>
| [
{
"answer_id": 210362,
"author": "Matthew Scharley",
"author_id": 15537,
"author_profile": "https://Stackoverflow.com/users/15537",
"pm_score": 2,
"selected": false,
"text": "'=\"/'"
}
] | 2008/10/16 | [
"https://Stackoverflow.com/questions/210355",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2490/"
] |
210,359 | <p>I have a <code>textbox</code> whose input is being handled by jQuery.</p>
<pre><code>$('input.Search').bind("keyup", updateSearchTextbox);
</code></pre>
<p>When I press <code>Enter</code> in the textbox, I get a postback, which messes everything up. How can I trap that Enter and ignore it?</p>
<p>(Just to preempt one possible suggestion: The textbox has to be an <code><asp:textbox ... /></code> - I can't replace it with an <code><input ... /></code>.)</p>
| [
{
"answer_id": 210366,
"author": "FlySwat",
"author_id": 1965,
"author_profile": "https://Stackoverflow.com/users/1965",
"pm_score": 5,
"selected": true,
"text": "<script language=\"JavaScript\">\n\nfunction disableEnterKey(e)\n{\n var key; \n if(window.event)\n key ... | 2008/10/16 | [
"https://Stackoverflow.com/questions/210359",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/239663/"
] |
210,371 | <p>I've had success with <a href="http://www.tecgraf.puc-rio.br/~diego/professional/luasocket/" rel="nofollow noreferrer">LuaSocket</a>'s TCP facility, but I'm having trouble with its FTP module. I always get a timeout when trying to retrieve a (small) file. I can download the file just fine using Firefox or ftp in passive mode (on Ubuntu Dapper Linux).</p>
<p>I thought it might be that I need LuaSocket to use passive FTP, but then I found that it seems to do that by default. The file I'm trying to retrieve via FTP can be accessed with passive FTP via other programs on my machine, but not via active mode. I found <a href="http://lua-users.org/lists/lua-l/2003-09/msg00217.html" rel="nofollow noreferrer">some talk</a> about "hacking" passive mode support into LuaSocket, and that discussion implies that later versions stopped using passive mode, but my version seems to use passive anyway (I'm using 2.0.1; newest is 2.0.2 and does not appear to have any changes relevant to my use case). I'm a little confused about how that post may relate to my situation, partly because it's very old and LuaSocket's source now bears little resemblance to the code in that discussion).</p>
<p>I've boiled my code down to this:</p>
<pre><code>local ftp = require "socket.ftp"
ftp.TIMEOUT = 10
print(ftp.get("ftp://ftp.us.dell.com/app/dpart.txt"))
</code></pre>
<p>This gives me a timeout. I ran it under <code>strace</code> on Linux (same as <code>ptrace</code> on Solaris). Here's an abridged transcript:</p>
<pre><code>socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 3
fcntl64(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0
recv(3, "230-Welcome to the Dell FTP site."..., 8192, 0) = 971
send(3, "pasv\r\n", 6, 0) = 6
recv(3, 0x8089a58, 8192, 0) = -1 EAGAIN (Resource temporarily unavailable)
select(4, [3], NULL, NULL, {9, 999934}) = 0 (Timeout)
</code></pre>
<p>There's another site I tried connecting to, but it has a password which I can't post here, but in that case the results were slightly different...I got trace like the above but with <code>select()</code> succeeding at the end, then this:</p>
<pre><code>recv(3, "227 Entering Passive Mode (123,456,789,0,12,34)\r\n", 8192, 0) = 49
socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 4
fcntl64(4, F_SETFL, O_RDWR|O_NONBLOCK) = 0
connect(4, {sa_family=AF_INET, sin_port=htons(12345), sin_addr=inet_addr("123.456.789.0")}, 16) = -1 EINPROGRESS (Operation now in progress)
select(5, [4], [4], NULL, {9, 999694}) = 0 (Timeout)
</code></pre>
<p>Compare this to the trace of my "ftp" program in passive mode (which works fine, though note that it does not set the sockets to nonblocking like LuaSocket does):</p>
<pre><code>socket(PF_INET, SOCK_STREAM, IPPROTO_IP) = 6
write(5, "PASV\r\n", 6) = 6
read(3, "227 Entering Passive Mode (123,456,789,0,12,34)\r\n", 1024) = 51
connect(6, {sa_family=AF_INET, sin_port=htons(12345), sin_addr=inet_addr("123.456.789.0")}, 16) = 0
</code></pre>
<p>So I've tried LuaSocket against these two different FTP sites with different but similar failures. I also tried it from another machine where active FTP works, and it didn't have any better luck there (presumably because LuaSocket is always using passive mode, from what I can tell by reading the source in <code>socket/ftp.lua</code>).</p>
<p>So can anyone here make the LuaSocket two-liner at the top work? Note that on my machine, active FTP to Dell's site doesn't work (I can connect but as soon as I do <code>ls</code> it disconnects), so if you get LuaSocket to work please also note whether active FTP to Dell's site from another program works on your machine.</p>
| [
{
"answer_id": 214462,
"author": "Anders Eurenius",
"author_id": 1421,
"author_profile": "https://Stackoverflow.com/users/1421",
"pm_score": 3,
"selected": true,
"text": "path/to/your/project/socket/ftp.lua"
}
] | 2008/10/16 | [
"https://Stackoverflow.com/questions/210371",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4323/"
] |
210,375 | <p>I have been attempting to write some routines to read RSS and ATOM feeds using the new routines available in System.ServiceModel.Syndication, but unfortunately the Rss20FeedFormatter bombs out on about half the feeds I try with the following exception:</p>
<blockquote>
<pre><code>An error was encountered when parsing a DateTime value in the XML.
</code></pre>
</blockquote>
<p>This seems to occur whenever the RSS feed expresses the publish date in the following format:</p>
<blockquote>
<p>Thu, 16 Oct 08 14:23:26 -0700</p>
</blockquote>
<p>If the feed expresses the publish date as GMT, things go fine:</p>
<blockquote>
<p>Thu, 16 Oct 08 21:23:26 GMT</p>
</blockquote>
<p>If there's some way to work around this with XMLReaderSettings, I have not found it. Can anyone assist?</p>
| [
{
"answer_id": 2724742,
"author": "CleverPatrick",
"author_id": 22399,
"author_profile": "https://Stackoverflow.com/users/22399",
"pm_score": 5,
"selected": false,
"text": "WebClient client = new WebClient();\nusing (XmlReader reader = new SyndicationFeedXmlReader(client.OpenRead(feedUrl... | 2008/10/16 | [
"https://Stackoverflow.com/questions/210375",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4253/"
] |
210,377 | <p>What's the best way to get an array of all elements in an html document with a specific CSS class using javascript?</p>
<p>No javascript frameworks like jQuery allowed here right now, and I could loop all the elements and check them manually myself. I'm hoping for something a little more elegant.</p>
| [
{
"answer_id": 210388,
"author": "Quentin",
"author_id": 19068,
"author_profile": "https://Stackoverflow.com/users/19068",
"pm_score": 0,
"selected": false,
"text": "using document.getElementsByTagName('*')"
},
{
"answer_id": 210393,
"author": "Shog9",
"author_id": 811,
... | 2008/10/16 | [
"https://Stackoverflow.com/questions/210377",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3043/"
] |
210,383 | <p>If I have a VB.Net function that returns an Int32, but uses an unsigned int (UInt32) for calculations, etc. How can I convert a variable "MyUintVar32" with a value of say "3392918397 into a standard Int32 in VB.Net? </p>
<p>In c# if I just do a "return (int)(MyUintVar32);", I get -902048899, not an error.</p>
<p>I've tried several different methods. What is the difference in the way c# handles these conversions versus VB.Net?</p>
| [
{
"answer_id": 210401,
"author": "Juanma",
"author_id": 3730,
"author_profile": "https://Stackoverflow.com/users/3730",
"pm_score": 2,
"selected": false,
"text": "Dim myUInt32 As UInt32 = 3392918397\nDim myInt32 As Int32 = BitConverter.ToInt32(BitConverter.GetBytes(myUInt32), 0)\n"
},
... | 2008/10/16 | [
"https://Stackoverflow.com/questions/210383",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
210,428 | <p>Is it possible to somehow mark a <code>System.Array</code> as immutable. When put behind a public-get/private-set they can't be added to, since it requires re-allocation and re-assignment, but a consumer can still set any subscript they wish:</p>
<pre><code>public class Immy
{
public string[] { get; private set; }
}
</code></pre>
<p>I thought the <code>readonly</code> keyword might do the trick, but no such luck.</p>
| [
{
"answer_id": 210441,
"author": "Matt",
"author_id": 2338,
"author_profile": "https://Stackoverflow.com/users/2338",
"pm_score": 2,
"selected": false,
"text": "IList<>"
},
{
"answer_id": 210444,
"author": "Ray Jezek",
"author_id": 28309,
"author_profile": "https://St... | 2008/10/16 | [
"https://Stackoverflow.com/questions/210428",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9642/"
] |
210,446 | <p>The client connects to the server using GenuineChannels (we are considering switching to DotNetRemoting). What I mean by find is obtain the IP and port number of a server to connect to.</p>
<p>It seems like a brute-force approach would be try every IP on the network try the active ports (not even sure if that's possible) but there must be a better way.</p>
| [
{
"answer_id": 210464,
"author": "Jorge Ferreira",
"author_id": 6508,
"author_profile": "https://Stackoverflow.com/users/6508",
"pm_score": 5,
"selected": true,
"text": "using System.Net;\nusing System.Net.Sockets;\n\n[STAThread]\nstatic void Main(string[] args)\n{\n Socket socket = n... | 2008/10/16 | [
"https://Stackoverflow.com/questions/210446",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23822/"
] |
210,455 | <p>What's the best way for a common library to know what context - a.k.a. the calling app - it is in? I'm in a very controlled enterprise environment... is there a better way for the library to know what application it is getting called from than reading a setting in the config file? What do you use for this type of thing?</p>
<p><code>//the rest of the story</code><br />
I work on the Intranet team for a Fortune 500 manufacturing company. I have created a common library that all of our new .Net applications will make use of. It queries a common database for information about the application and a bunch of other things that are irrelevant to the question. As you can imagine, the common library needs to know what application is calling it. I could just force every application to set a property on some static class or something, but instead I wanted to make it a little more behind the scenes. Currently it requires the developer to put a setting in the app.config or web.config with a key of ApplicationName and a value of - you guessed it - the application name (which is a unique non changing id for us). It then uses Currently it uses <code>ConfigurationManager.AppSettings["ApplicationName"]</code> to pull this in.</p>
| [
{
"answer_id": 210550,
"author": "Troy Howard",
"author_id": 19258,
"author_profile": "https://Stackoverflow.com/users/19258",
"pm_score": 0,
"selected": false,
"text": "public interface IIntranetApp\n{\n string GetApplicationName();\n void SetConnectionString(string connectionStri... | 2008/10/16 | [
"https://Stackoverflow.com/questions/210455",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3226/"
] |
210,460 | <p>How can polymorphism be described in an easy-to-understand way?</p>
<p>We can find a lot of information about the subject on the Internet and books, like in <em><a href="http://en.wikipedia.org/wiki/Type_polymorphism" rel="noreferrer">Type polymorphism</a></em>. But let's try to make it as simple as we can.</p>
| [
{
"answer_id": 210472,
"author": "Craig",
"author_id": 27294,
"author_profile": "https://Stackoverflow.com/users/27294",
"pm_score": 0,
"selected": false,
"text": "interface IJobLoader\n"
},
{
"answer_id": 210482,
"author": "Mark A. Nicolosi",
"author_id": 1103052,
"a... | 2008/10/16 | [
"https://Stackoverflow.com/questions/210460",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1409636/"
] |
210,470 | <p>Anyone know a QR decoder that works on mac or that might be online? I just need to decode one single image.</p>
| [
{
"answer_id": 22144524,
"author": "clt60",
"author_id": 632407,
"author_profile": "https://Stackoverflow.com/users/632407",
"pm_score": 4,
"selected": true,
"text": "Image::DecodeQR"
},
{
"answer_id": 47085827,
"author": "The Matt",
"author_id": 8524178,
"author_prof... | 2008/10/16 | [
"https://Stackoverflow.com/questions/210470",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26004/"
] |
210,475 | <p>I saw this question asked about C# I would like an answer for PHP. I have some old code that has 4 pages of foreach loops and conditions which just makes it hard to read and follow. How would I make this more OO? I was thinking of using SPL Functions but don't fully understand whats involved yet.</p>
| [
{
"answer_id": 210505,
"author": "Jonathan Arkell",
"author_id": 11052,
"author_profile": "https://Stackoverflow.com/users/11052",
"pm_score": 0,
"selected": false,
"text": "array_map"
}
] | 2008/10/16 | [
"https://Stackoverflow.com/questions/210475",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25143/"
] |
210,496 | <p>I continue to get this error:</p>
<pre><code>Object '%s' cannot be renamed because the object participates in enforced dependencies
</code></pre>
<p>I need to find a script that will help me to find all the dependencies that there is with this table. I will need to drop them, rename, then bring them back.</p>
<p>SQL Server 2005</p>
| [
{
"answer_id": 210512,
"author": "Craig",
"author_id": 27294,
"author_profile": "https://Stackoverflow.com/users/27294",
"pm_score": 3,
"selected": true,
"text": "sp_msforeachtable \"ALTER TABLE ? NOCHECK CONSTRAINT all\"\ngo\nsp_msforeachtable \"ALTER TABLE ? DISABLE TRIGGER all\"\ngo\... | 2008/10/16 | [
"https://Stackoverflow.com/questions/210496",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7952/"
] |
210,504 | <p>I'm creating an alt-tab replacement for Vista but I have some problems listing all active programs.</p>
<p>I'm using EnumWindows to get a list of Windows, but this list is huge. It contains about 400 items when I only have 10 windows open. It seems to be a hwnd for every single control and a lot of other stuff.</p>
<p>So I have to filter this list somehow, but I can't manage to do it exactly as alt-tab does.</p>
<p>This is the code I use to filter the list right now. It works pretty well, but I get some unwanted windows like detached tool-windows in Visual Studio and I also miss windows like iTunes and Warcraft3.</p>
<pre><code>private bool ShouldWindowBeDisplayed(IntPtr window)
{
uint windowStyles = Win32.GetWindowLong(window, GWL.GWL_STYLE);
if (((uint)WindowStyles.WS_VISIBLE & windowStyles) != (uint)WindowStyles.WS_VISIBLE ||
((uint)WindowExStyles.WS_EX_APPWINDOW & windowStyles) != (uint)WindowExStyles.WS_EX_APPWINDOW)
{
return true;
}
return false;
}
</code></pre>
| [
{
"answer_id": 210519,
"author": "Michael Burr",
"author_id": 12711,
"author_profile": "https://Stackoverflow.com/users/12711",
"pm_score": 5,
"selected": false,
"text": "BOOL IsAltTabWindow(HWND hwnd)\n{\n // Start at the root owner\n HWND hwndWalk = GetAncestor(hwnd, GA_ROOTOWNER);\n\n... | 2008/10/16 | [
"https://Stackoverflow.com/questions/210504",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
210,506 | <p>This may not be possible, but I figured I'd ask...</p>
<p>Is there any way anyone can think of to track whether or not an automatic variable has been deleted without modifying the class of the variable itself? For example, consider this code:</p>
<pre><code>const char* pStringBuffer;
{
std::string sString( "foo" );
pStringBuffer = sString.c_str();
}
</code></pre>
<p>Obviously, after the block, pStringBuffer is a dangling pointer which may or may not be valid. What I would like is a way to have a wrapper class which contains pStringBuffer (with a casting operator for const char*), but asserts that the variable it's referencing is still valid. By changing the type of the referenced variable I can certainly do it (boost shared_ptr/weak_ptr, for example), but I would like to be able to do it without imposing restrictions on the referenced type.</p>
<p>Some thoughts:</p>
<ul>
<li>I'll probably need to change the assignment syntax to include the referenced variable (which is fine)</li>
<li>I might be able to look at the stack pointer to detect if my wrapper class was allocated "later" than the referenced class, but this seems hacky and not standard (C++ doesn't define stack behavior). It could work, though.</li>
</ul>
<p>Thoughts / brilliant solutions?</p>
| [
{
"answer_id": 210593,
"author": "Henk",
"author_id": 4613,
"author_profile": "https://Stackoverflow.com/users/4613",
"pm_score": 0,
"selected": false,
"text": "new"
},
{
"answer_id": 210698,
"author": "John Zwinck",
"author_id": 4323,
"author_profile": "https://Stack... | 2008/10/16 | [
"https://Stackoverflow.com/questions/210506",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26240/"
] |
210,509 | <p>I have a bunch of records in several tables in a database that have a "process number" field, that's basically a number, but I have to store it as a string both because of some legacy data that has stuff like "89a" as a number and some numbering system that requires that process numbers be represented as number/year.</p>
<p>The problem arises when I try to order the processes by number. I get stuff like:</p>
<ul>
<li>1</li>
<li>10</li>
<li>11</li>
<li>12</li>
</ul>
<p>And the other problem is when I need to add a new process. The new process' number should be the biggest existing number incremented by one, and for that I would need a way to order the existing records by number.</p>
<p>Any suggestions?</p>
| [
{
"answer_id": 210521,
"author": "Paolo Bergantino",
"author_id": 16417,
"author_profile": "https://Stackoverflow.com/users/16417",
"pm_score": 1,
"selected": false,
"text": "SELECT process_order FROM your_table ORDER BY process_order + 0 ASC\n"
},
{
"answer_id": 210546,
"aut... | 2008/10/16 | [
"https://Stackoverflow.com/questions/210509",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2841/"
] |
210,515 | <p>Assume a table with the following columns:</p>
<p><code>pri_id</code>, <code>item_id</code>, <code>comment</code>, <code>date</code></p>
<p>What I want to have is a SQL query that will delete any records, for a specific <code>item_id</code> that are older than a given date, BUT only as long as there are more than 15 rows for that <code>item_id</code>.</p>
<p>This will be used to purge out comment records older than 1 year for the items but I still want to keep at least 15 records at any given time. This way if I had one comment for 10 years it would never get deleted but if I had 100 comments over the last 5 days I'd only keep the newest 15 records. These are of course arbitrary record counts and date timeframes for this example.</p>
<p>I'd like to find a very generic way of doing this that would work in mysql, oracle, postgres etc. I'm using phps adodb library for DB abstraction so I'd like it to work well with that if possible.</p>
| [
{
"answer_id": 210532,
"author": "Robert C. Barth",
"author_id": 9209,
"author_profile": "https://Stackoverflow.com/users/9209",
"pm_score": 4,
"selected": true,
"text": "delete\nfrom\n MyTable\nwhere\n item_id in\n (\n select\n item_id\n from\n MyTable\n group by\n... | 2008/10/16 | [
"https://Stackoverflow.com/questions/210515",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14230/"
] |
210,518 | <p>What do I use to search for multiple words in a string? I would like the logical operation to be AND so that all the words are in the string somewhere. I have a bunch of nonsense paragraphs and one plain English paragraph, and I'd like to narrow it down by specifying a couple common words like, "the" and "and", but would like it match all words I specify.</p>
| [
{
"answer_id": 210539,
"author": "brasskazoo",
"author_id": 6340,
"author_profile": "https://Stackoverflow.com/users/6340",
"pm_score": 2,
"selected": false,
"text": "\\b(word1|word2)\\b(\\w+\\b)*(word1|word2)\\b(\\w+\\b)*\\.\n"
},
{
"answer_id": 210565,
"author": "Markus Jar... | 2008/10/16 | [
"https://Stackoverflow.com/questions/210518",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13611/"
] |
210,522 | <p>I'm building a code in which I'd like to be able to generate an event when the user changes the focus of the cursor from an Entry widget to anywhere, for example another entry widget, a button...</p>
<p>So far i only came out with the idea to bind to TAB and mouse click, although if i bind the mouse click to the Entry widget i only get mouse events when inside the Entry widget.</p>
<p>How can I accomplish generate events for when a widget loses cursor focus?</p>
<p>Thanks in advance!</p>
| [
{
"answer_id": 225834,
"author": "Bryan Oakley",
"author_id": 7432,
"author_profile": "https://Stackoverflow.com/users/7432",
"pm_score": 3,
"selected": false,
"text": "from Tkinter import *\n\ndef main():\n global text\n\n root=Tk()\n\n l1=Label(root,text=\"Field 1:\")\n l2=... | 2008/10/16 | [
"https://Stackoverflow.com/questions/210522",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
210,541 | <p>The scenario: 2 user controls (foo.ascx and fum.ascx)</p>
<p>foo has a method that would really like to access a property from fum. They live on the same page, but I can't find a very simple way to accomplish this sort of communication. </p>
<p>Any ideas?</p>
| [
{
"answer_id": 210571,
"author": "Panos",
"author_id": 8049,
"author_profile": "https://Stackoverflow.com/users/8049",
"pm_score": 2,
"selected": false,
"text": "OnMyPropertyValueChanged"
},
{
"answer_id": 210592,
"author": "FlySwat",
"author_id": 1965,
"author_profil... | 2008/10/16 | [
"https://Stackoverflow.com/questions/210541",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
210,564 | <p>Is there a way to get the raw SQL string executed when calling PDOStatement::execute() on a prepared statement? For debugging purposes this would be extremely useful.</p>
| [
{
"answer_id": 210693,
"author": "Bill Karwin",
"author_id": 20860,
"author_profile": "https://Stackoverflow.com/users/20860",
"pm_score": 8,
"selected": true,
"text": "081016 16:51:28 2 Query prepare s1 from 'select * from foo where i = ?'\n 2 Prepare [2] select... | 2008/10/16 | [
"https://Stackoverflow.com/questions/210564",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5291/"
] |
210,567 | <p>Whats the best practice for setting up package structures in a Java Web Application?</p>
<p>How would you setup your src, unit test code, etc?</p>
| [
{
"answer_id": 52802639,
"author": "Raj",
"author_id": 5107365,
"author_profile": "https://Stackoverflow.com/users/5107365",
"pm_score": 3,
"selected": false,
"text": "The way I usually organise is\n- src\n - main\n - java\n - groovy\n ... | 2008/10/16 | [
"https://Stackoverflow.com/questions/210567",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24717/"
] |
210,590 | <p>Why is it that <code>scanf()</code> needs the <code>l</code> in "<code>%lf</code>" when reading a <code>double</code>, when <code>printf()</code> can use "<code>%f</code>" regardless of whether its argument is a <code>double</code> or a <code>float</code>?</p>
<p>Example code:</p>
<pre><code>double d;
scanf("%lf", &d);
printf("%f", d);
</code></pre>
| [
{
"answer_id": 210591,
"author": "MSN",
"author_id": 6210,
"author_profile": "https://Stackoverflow.com/users/6210",
"pm_score": 9,
"selected": true,
"text": "%lf"
},
{
"answer_id": 210595,
"author": "Tanktalus",
"author_id": 23512,
"author_profile": "https://Stackove... | 2008/10/16 | [
"https://Stackoverflow.com/questions/210590",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7598/"
] |
210,601 | <p>In C#, what is the best way to access a property of the derived class when the generic list contains just the base class.</p>
<pre><code>public class ClassA : BaseClass
{
public object PropertyA { get; set; }
}
public class ClassB: BaseClass
{
public object PropertyB { get; set; }
}
public class BaseClass
{
}
public void Main
{
List<BaseClass> MyList = new List<BaseClass>();
ClassA a = new ClassA();
ClassB b = new ClassB();
MyList.Add(a);
MyList.Add(b);
for(int i = 0; i < MyList.Count; i++)
{
//I would like to access PropertyA abd PropertyB from the derived classes
}
}
</code></pre>
| [
{
"answer_id": 210615,
"author": "tvanfosson",
"author_id": 12950,
"author_profile": "https://Stackoverflow.com/users/12950",
"pm_score": 2,
"selected": false,
"text": " BaseClass o = MyList[i];\n if (o is ClassB)\n {\n object k = ((ClassB)o).PropertyB;\n }\n if (o is Clas... | 2008/10/16 | [
"https://Stackoverflow.com/questions/210601",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26327/"
] |
210,606 | <p>Is there a way to invoke an external script or batch file from VC6 (and later) project files?</p>
<p>I have a background process that I need to kill before attempting to build certain projects (DLLS, executables) and haven't found a way to successfully do so from the project itself. I'd like simply to call a batch file with a taskkill command in it.</p>
<p>(Yes, I could run the batch file from a command line before building the projects, but I don't always remember to do so and having it done automatically would be more convenient and less irritating for the whole development team.)</p>
| [
{
"answer_id": 210689,
"author": "Jason Bunting",
"author_id": 1790,
"author_profile": "https://Stackoverflow.com/users/1790",
"pm_score": 0,
"selected": false,
"text": "<!-- To modify your build process, add your task inside one of the targets below and uncomment it. \n Other similar ... | 2008/10/16 | [
"https://Stackoverflow.com/questions/210606",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
210,607 | <p>I would like to know many minutes between 2 dates?</p>
<p>Example : Now - tommorow at the exact time would return me 1440.</p>
| [
{
"answer_id": 210609,
"author": "FlySwat",
"author_id": 1965,
"author_profile": "https://Stackoverflow.com/users/1965",
"pm_score": 3,
"selected": false,
"text": " DateTime date1 = DateTime.Now;\n DateTime date2 = DateTime.Now.AddDays(1);\n\n TimeSpan diff = date2.S... | 2008/10/16 | [
"https://Stackoverflow.com/questions/210607",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14441/"
] |
210,616 | <p>I'm reading this C++ open source code and I came to a constructor but I don't get it ( basically because I don't know C++ :P ) </p>
<p>I understand C and Java very well.</p>
<pre><code> TransparentObject::TransparentObject( int w, int x, int y, int z ) :
_someMethod( 0 ),
_someOtherMethod( 0 ),
_someOtherOtherMethod( 0 ),
_someMethodX( 0 )
{
int bla;
int bla;
}
</code></pre>
<p>As far I can "deduce" The first line only declares the construtor name, the "::" sounds like "belongs to" to me. And the code between {} is the constructor body it self. </p>
<p>I "think" what's after the paremeters and the first "{" are like methods default parameters or something, but I don't find a reasonable explanation on the web. Most of the C++ constructors that I found in the examples are almost identical to those in Java.</p>
<p>I'm I right in my assumptions? "::" is like belongs to, and the list after params and body are like "default args" or something?</p>
<p><strong>UPDATE:</strong>
Thanks for the answers.
May those be called methods? ( I guess no ) and what is the difference of call them within the constructor body</p>
| [
{
"answer_id": 210636,
"author": "dmckee --- ex-moderator kitten",
"author_id": 2509,
"author_profile": "https://Stackoverflow.com/users/2509",
"pm_score": 2,
"selected": false,
"text": "{}"
},
{
"answer_id": 210638,
"author": "Jason Baker",
"author_id": 2147,
"author... | 2008/10/16 | [
"https://Stackoverflow.com/questions/210616",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20654/"
] |
210,620 | <p>I have created HTTP handlers. </p>
<p>How do I create global variables for these handlers like I can with ASP.net web pages in global.asax?</p>
| [
{
"answer_id": 210626,
"author": "Jason Bunting",
"author_id": 1790,
"author_profile": "https://Stackoverflow.com/users/1790",
"pm_score": 4,
"selected": true,
"text": "System.Web.HttpContext.Current.Application[\"MyGlobalVariable\"] = myValue;\n"
}
] | 2008/10/16 | [
"https://Stackoverflow.com/questions/210620",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1100768/"
] |
210,629 | <p>Trying to answer to another post whose solution deals with IP addresses and netmasks, I got stuck with plain bitwise arithmetic.</p>
<p>Is there a standard way, in Python, to carry on bitwise AND, OR, XOR, NOT operations assuming that the inputs are "32 bit" (maybe negative) integers or longs, and that the result must be a long in the range [0, 2**32]?</p>
<p>In other words, I need a working Python counterpart to the C bitwise operations between unsigned longs.</p>
<p>EDIT: the specific issue is this:</p>
<pre><code>>>> m = 0xFFFFFF00 # netmask 255.255.255.0
>>> ~m
-4294967041L # wtf?! I want 255
</code></pre>
| [
{
"answer_id": 210707,
"author": "pixelbeat",
"author_id": 4421,
"author_profile": "https://Stackoverflow.com/users/4421",
"pm_score": 4,
"selected": false,
"text": "from numpy import uint32\n"
},
{
"answer_id": 210740,
"author": "DzinX",
"author_id": 18745,
"author_p... | 2008/10/16 | [
"https://Stackoverflow.com/questions/210629",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18770/"
] |
210,637 | <p>I have been looking at <a href="http://jquery.com/demo/thickbox/" rel="nofollow noreferrer">jQUery thickbox</a> for showing modal dialogs with images, it is great. But now I have the need to display a hidden div of content that contains an iFrame in a similar fashion, with a link to open the content. So I'd have something like this.</p>
<pre><code><a href="">Open window in Modal Dialog</a>
<div id="myContent">
<h1>Look at me!</h1>
<iframe src="http://www.google.com" />
</div>
</code></pre>
<p>And need to show it in the dialog. Is it possible?</p>
| [
{
"answer_id": 210654,
"author": "Craig",
"author_id": 27294,
"author_profile": "https://Stackoverflow.com/users/27294",
"pm_score": 2,
"selected": false,
"text": "<div class=\"jqmWindow\" id=\"modalDialog\"> \n <iframe frameborder=\"0\" id=\"jqmContent\" src=\"\"> \n </iframe> \... | 2008/10/16 | [
"https://Stackoverflow.com/questions/210637",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13279/"
] |
210,643 | <p>I'd like to make a click event fire on an <code><input type="file"></code> tag programmatically.</p>
<p>Just calling click() doesn't seem to do anything or at least it doesn't pop up a file selection dialog.</p>
<p>I've been experimenting with capturing events using listeners and redirecting the event, but I haven't been able to get that to actually perform the event like someone clicked on it.</p>
| [
{
"answer_id": 3030174,
"author": "Romas",
"author_id": 365407,
"author_profile": "https://Stackoverflow.com/users/365407",
"pm_score": 8,
"selected": false,
"text": "<div style=\"display: block; width: 100px; height: 20px; overflow: hidden;\">\n<button style=\"width: 110px; height: 30px... | 2008/10/16 | [
"https://Stackoverflow.com/questions/210643",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28655/"
] |
210,645 | <p>I'm currently creating a website for a client that will basically involve selling various files. This is obviously a really common thing to do, which is making me feel kind of foolish for not thinking of a method for doing it.</p>
<p>Once the purchase has been made the customer should be taken to a page containing the download link, as well as receiving emails that contain a download link and an email with information about an account that will be created for them (they will also be able to download from their account's control panel). What I'm trying to figure out is how I can hide/obscure the file's location on my server so that one person who buys it can't simply copy and paste the direct link to the file elsewhere. Even if I make the request to download a file a link of the format <a href="http://example.com/blah/download/454643" rel="nofollow noreferrer">http://example.com/blah/download/454643</a>, a URL which does not correspond to the actual location of the file, I think it might still be possible to locate the file on the server? I don't really understand too much about how permissions work on my server, which is why I ask. Thanks in advance :)</p>
| [
{
"answer_id": 210672,
"author": "Christian Lescuyer",
"author_id": 341,
"author_profile": "https://Stackoverflow.com/users/341",
"pm_score": 1,
"selected": false,
"text": "// Now send the file with header() magic\n header(\"Expires: Mon, 26 Nov 1962 00:00:00 GMT\");\n header(\"Last-Mo... | 2008/10/16 | [
"https://Stackoverflow.com/questions/210645",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12765/"
] |
210,646 | <p>I'm trying to determine how I can detect when the user changes the Windows Font Size from Normal to Extra Large Fonts, the font size is selected by executing the following steps on a Windows XP machine:</p>
<ol>
<li>Right-click on the desktop and select Properties.</li>
<li>Click on the Appearance Tab.</li>
<li>Select the Font Size: Normal/Large Fonts/Extra Large Fonts</li>
</ol>
<p>My understanding is that the font size change results in a DPI change, so here is what I've tried so far.</p>
<hr>
<h2>My Goal:</h2>
<p>I want to detect when the <strong>Windows Font Size</strong> has changed from Normal to Large or Extra Large Fonts and take some actions based on that font size change. I assume that when the Windows Font Size changes, the DPI will also change (especially when the size is Extra Large Fonts</p>
<hr>
<h2>What I've tried so far:</h2>
<p>I receive several messages including: WM_SETTINGCHANGE, WM_NCCALCSIZE, WM_NCPAINT, etc... but none of these messages are unique to the situation when the font size changes, in other words, when I receive the WM_SETTINGSCHANGE message I want to know what changed.</p>
<p>In theory when I define the OnSettingChange and Windows calls it, the lpszSection should tell me what the changing section is, and that works fine, but then I check the given section by calling SystemParametersInfo and I pass in the action SPI_GETNONCLIENTMETRICS, and I step through the debugger and I make sure that I watch the data in the returned NONCLIENTMETRICS for any font changes, but none occur.</p>
<p>Even if that didn't work, I should still be able to check the DPI when the Settings change. I really wouldn't care about the other details, every time I get the WM_SETTINGCHANGE message, I would just check the DPI and perform the actions I'm interested in performing, but I'm not able to get the system DPI either.</p>
<p>I have tried to get the DPI by invoking the method GetSystemMetrics, also for each DC:</p>
<p>Dekstop DC->GetDeviceCaps LOGPIXELSX/LOGPIXELSY
Window DC->GetDeviceCaps LOGPIXELSX/LOGPIXELSY
Current DC->GetDeviceCaps LOGPIXELSX/LOGPIXELSY</p>
<p>Even if I change the DPI in the Graphic Properties Window these values don't return anything different, they always show 96.</p>
<p>Could anybody help me figure this out please? What should I be looking for? Where should I be looking at?</p>
<pre><code>afx_msg void CMainFrame::OnSettingChange(UINT uFlags, LPCTSTR lpszSection)
{
int windowDPI = 0;
int deviceDPI = 0;
int systemDPI = 0;
int desktopDPI = 0;
int dpi_00_X = 0;
int dpi_01_X = 0;
int dpi_02_X = 0;
int dpi_03_X = 0;
CDC* windowDC = CWnd::GetWindowDC(); // try with window DC
HDC desktop = ::GetDC(NULL); // try with desktop DC
CDC* device = CWnd::GetDC(); // try with current DC
HDC hDC = *device; // try with HDC
if( windowDC )
{
windowDPI = windowDC->GetDeviceCaps(LOGPIXELSY);
// always 96 regardless if I change the Font
// Size to Extra Large Fonts or keep it at Normal
dpi_00_X = windowDC->GetDeviceCaps(LOGPIXELSX); // 96
}
if( desktop )
{
desktopDPI = ::GetDeviceCaps(desktop, LOGPIXELSY); // 96
dpi_01_X = ::GetDeviceCaps(desktop, LOGPIXELSX); // 96
}
if( device )
{
deviceDPI = device->GetDeviceCaps(LOGPIXELSY); // 96
dpi_02_X = device->GetDeviceCaps(LOGPIXELSX); // 96
}
systemDPI = ::GetDeviceCaps(hDC, LOGPIXELSY); // 96
dpi_03_X = ::GetDeviceCaps(hDC, LOGPIXELSX); // 96
CWnd::ReleaseDC(device);
CWnd::ReleaseDC(windowDC);
::ReleaseDC(NULL, desktop);
::ReleaseDC(NULL, hDC);
CWnd::OnWinSettingChange(uFlags, lpszSection);
}
</code></pre>
<p>The DPI always returns 96, but the settings changes DO take effect when I change the font size to Extra Large Fonts or if I change the DPI to 120 (from the graphics properties).</p>
| [
{
"answer_id": 211790,
"author": "Tim Farley",
"author_id": 4425,
"author_profile": "https://Stackoverflow.com/users/4425",
"pm_score": 2,
"selected": false,
"text": "int GetScreenDPI()\n{\n HDC hdcScreen = ::GetDC(NULL);\n int iDPI = -1; // assume failure\n if (hdcScreen) {\n iDPI... | 2008/10/16 | [
"https://Stackoverflow.com/questions/210646",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28760/"
] |
210,650 | <p>I'm loading an image from a file, and I want to know how to validate the image before it is fully read from the file.</p>
<pre><code>string filePath = "image.jpg";
Image newImage = Image.FromFile(filePath);
</code></pre>
<p>The problem occurs when image.jpg isn't really a jpg. For example, if I create an empty text file and rename it to image.jpg, an OutOfMemory Exception will be thrown when image.jpg is loaded.</p>
<p>I'm looking for a function that will validate an image given a stream or a file path of the image.</p>
<p>Example function prototype</p>
<pre><code>bool IsValidImage(string fileName);
bool IsValidImage(Stream imageStream);
</code></pre>
| [
{
"answer_id": 210660,
"author": "Enrico Murru",
"author_id": 68336,
"author_profile": "https://Stackoverflow.com/users/68336",
"pm_score": 0,
"selected": false,
"text": "Image openImage(string filename);\n"
},
{
"answer_id": 210671,
"author": "MusiGenesis",
"author_id": ... | 2008/10/16 | [
"https://Stackoverflow.com/questions/210650",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1994/"
] |
210,657 | <p>I've defined an error-page in my web.xml:</p>
<pre><code> <error-page>
<exception-type>java.lang.Exception</exception-type>
<location>/error.jsp</location>
</error-page>
</code></pre>
<p>In that error page, I have a custom tag that I created. The tag handler for this tag e-mails me the stacktrace of whatever error occurred. For the most part this works great.</p>
<p>Where it doesn't work great is if the output has already begun being sent to the client at the time the error occurs. In that case, we get this:</p>
<pre><code>SEVERE: Exception Processing ErrorPage[exceptionType=java.lang.Exception, location=/error.jsp]
java.lang.IllegalStateException
</code></pre>
<p>I believe this error happens because we can't redirect a request to the error page after output has already started. The work-around I've used is to increase the buffer size on particularly large JSP pages. But I'm trying to write a generic error handler that I can apply to existing applications, and I'm not sure it's feasible to go through hundreds of JSP pages making sure their buffers are big enough.</p>
<p>Is there a way to still allow my stack trace e-mail code to execute in this case, even if I can't actually display the error page to the client?</p>
| [
{
"answer_id": 1833962,
"author": "David Smiley",
"author_id": 92186,
"author_profile": "https://Stackoverflow.com/users/92186",
"pm_score": 2,
"selected": false,
"text": "<script type=\"text/javascript\">\n var pageLoadSuccessful = false;//set to true in footer.jsp\n dojo.... | 2008/10/16 | [
"https://Stackoverflow.com/questions/210657",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2527/"
] |
210,666 | <p>I have a CircleButton class in Actionscript.
I want to know when someone externally has changed the 'on' property.
I try listening to 'onChange' but it never hits that event handler.</p>
<p>I know I can write the 'on' property as a get/setter but I like the simplicity of just using [Bindable]</p>
<p>Can an object not listen to its own events?</p>
<pre><code>public class CircleButton extends UIComponent
{
[Bindable]
public var on:Boolean;
public function CircleButton()
{
this.width = 20;
this.height = 20;
graphics.beginFill(0xff6600, 1);
graphics.drawCircle(width/2, height/2, width/2);
graphics.endFill();
this.addEventListener(MouseEvent.ROLL_OVER, rollover);
this.addEventListener(MouseEvent.ROLL_OUT, rollout);
this.addEventListener('onChange', onOnChange);
}
private function onOnChange(event:PropertyChangeEvent):void {
</code></pre>
| [
{
"answer_id": 215440,
"author": "Laura",
"author_id": 5103,
"author_profile": "https://Stackoverflow.com/users/5103",
"pm_score": 4,
"selected": true,
"text": "this.addEventListener(PropertyChangeEvent.PROPERTY_CHANGE, onOnChange);\n"
}
] | 2008/10/16 | [
"https://Stackoverflow.com/questions/210666",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24727/"
] |
210,682 | <p>our partners sites leverages our iframes in their own websites. I was wondering if there is a way to track the analytics on the iframes. </p>
<p>The problem is, if we also utilize these iframes on our own website, how do i avoid duplicate tracking where a visit is counted on our domain's analytics and also counted again in iframes? is there a way to get around it?</p>
| [
{
"answer_id": 210704,
"author": "stevemegson",
"author_id": 25028,
"author_profile": "https://Stackoverflow.com/users/25028",
"pm_score": 2,
"selected": false,
"text": "if ( location.href.indexOf(\"utm_source=mysite\") < 0 )\n{\n // Google Analytics code here\n}\n"
},
{
"answ... | 2008/10/16 | [
"https://Stackoverflow.com/questions/210682",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
210,692 | <p>We have a proprietry system that we develop scripting code in.
We currently do not have a developer environment (apart from Notepad++) and cannot debug or compile this code. We have to submit it to the vendor to insert the code into the test or live system.
The language is essentially C like and has the same syntax.
Basically we want a tool to be able to simply check the syntax of chunks of code we send to the vendor.
Does a tool exist that will do this for me?</p>
| [
{
"answer_id": 210701,
"author": "Michael Burr",
"author_id": 12711,
"author_profile": "https://Stackoverflow.com/users/12711",
"pm_score": 2,
"selected": false,
"text": "/Zs"
}
] | 2008/10/16 | [
"https://Stackoverflow.com/questions/210692",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
210,711 | <p>In ASP.NET MVC is there an equivalent of the Html.ActionLink helper for Img tags? </p>
<p>I have a controller action that outputs a dynamically generated JPEG and I wanted to use the same Lambda expressions to link to it as I do HREFs using ActionLink.</p>
<p>Alternatively, a helper that just gives the URL to a route (again specified using Lambdas) would also be acceptable. </p>
<p><strong>EDIT</strong>: I had originally specified that I was using Preview 5, however I see that a Beta has been released. So all-in-all the version number was an unneeded piece of info as I may be upgrading soon :-)</p>
| [
{
"answer_id": 309413,
"author": "adamjcooper",
"author_id": 27867,
"author_profile": "https://Stackoverflow.com/users/27867",
"pm_score": 2,
"selected": false,
"text": "<a href=\"<%=Html.BuildUrlFromExpression<MyController>(c => c.MyAction())%>\">\n <%=Html.Image(\"~/Content/MyImage... | 2008/10/17 | [
"https://Stackoverflow.com/questions/210711",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27860/"
] |
210,717 | <p>How do I go about setting a <code><div></code> in the center of the screen using jQuery?</p>
| [
{
"answer_id": 210733,
"author": "Tony L.",
"author_id": 21905,
"author_profile": "https://Stackoverflow.com/users/21905",
"pm_score": 11,
"selected": true,
"text": "jQuery.fn.center = function () {\n this.css(\"position\",\"absolute\");\n this.css(\"top\", Math.max(0, (($(window).... | 2008/10/17 | [
"https://Stackoverflow.com/questions/210717",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27294/"
] |
210,719 | <p>I am using log.properties to configure logging for a Java app. Each class gets its own logger named after itself (e.g. com.company.program.ClassX).</p>
<p>I want to set a custom formatter for just one log, and leave the handler with the SimpleFormatter. Is this possible?</p>
<p>I am not interested in using log4j or another of the other logging suites. I am well aware of them. Nor am I interested in configuring a customer formatter for the logger through code, although if that is the only way to do it, it would be nice to know. Google isn't helping, and I am having problems testing this myself.</p>
| [
{
"answer_id": 212785,
"author": "davetron5000",
"author_id": 3029,
"author_profile": "https://Stackoverflow.com/users/3029",
"pm_score": 0,
"selected": false,
"text": "System.out.println"
}
] | 2008/10/17 | [
"https://Stackoverflow.com/questions/210719",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2204759/"
] |
210,725 | <p>I have a drop down like this on my page:</p>
<pre><code><p>
<%= f.label :episode_id %><br />
<%= f.collection_select(:episode_id, @episodes, :id, :show) %>
</p>
</code></pre>
<p>An episode has an id and <code>belongs_to</code> to a show which has a name. In the dropdown, I'd like to display the show name. <code>:show.name</code> doesn't work to display the name. How do I do this?</p>
| [
{
"answer_id": 210825,
"author": "Michael Sepcot",
"author_id": 6033,
"author_profile": "https://Stackoverflow.com/users/6033",
"pm_score": 2,
"selected": true,
"text": "show_name"
},
{
"answer_id": 210918,
"author": "salt.racer",
"author_id": 757,
"author_profile": "... | 2008/10/17 | [
"https://Stackoverflow.com/questions/210725",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2109/"
] |
210,729 | <p>I need a data structure that can store non-overlapping ranges within a single dimension. The entire range of the dimension need not be completely covered.</p>
<p>An example would be a conference room scheduler. The dimension is time. No two schedules may overlap. The conference room isn't always scheduled. In other words, for a given time there can be at most one schedule.</p>
<p>A quick solution is for a range to store the start and end times.</p>
<pre><code>Range {
Date start
Date end
}
</code></pre>
<p>This is non-normalized and requires the container to enforce no overlapping. For two adjacent ranges, the previous' end will be redundant with the next's start.</p>
<p>Another scheme might involve storing one boundary value with each range. But for a contiguous sequence of ranges, there will always be one more boundary values than ranges. To get around this the sequence could be represented as alternating boundary values and ranges:</p>
<p>B = boundary value, r = range</p>
<blockquote>
<p>B-r-B-r-B</p>
</blockquote>
<p>The data structure might look like:</p>
<pre><code>Boundary {
Date value
Range prev
Range next
}
Range {
Boundary start
Boundary end
}
</code></pre>
<p>In essence it's a doubly linked list with alternating types.</p>
<p>Ultimately, whatever data structure I use will be represented in both memory (application code) and a relational database.</p>
<p>I'm curious what academic or industry tried solutions exists.</p>
| [
{
"answer_id": 210750,
"author": "Sklivvz",
"author_id": 7028,
"author_profile": "https://Stackoverflow.com/users/7028",
"pm_score": 1,
"selected": false,
"text": "(RoomId, StartTime)\n"
},
{
"answer_id": 765420,
"author": "dkretz",
"author_id": 31641,
"author_profile... | 2008/10/17 | [
"https://Stackoverflow.com/questions/210729",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24396/"
] |
210,738 | <p>Could somebody please point me in the right direction for learning how to do networking in C#/.net 3.5? Code samples and explanations are welcome. Basically I am looking for how to do asynchronous/multithreaded server/client models.</p>
<p>I am fairly comfortable with the basics in how to accomplish this in C++ with WinSock but though all of my research cannot seem to grasp this concept in C#.</p>
<p>Thanks for any assistance you can provide :)</p>
| [
{
"answer_id": 210775,
"author": "Scott Weinstein",
"author_id": 25201,
"author_profile": "https://Stackoverflow.com/users/25201",
"pm_score": 0,
"selected": false,
"text": "System.Net.Sockets.Socket"
}
] | 2008/10/17 | [
"https://Stackoverflow.com/questions/210738",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
210,743 | <p>How can I modify the <code>NSDatePickerElementFlags</code> for the <code>NSDatePicker</code> in row templates for <code>NSDate</code> properties returned by <code>[NSPredicateRowEditorTemplate templatesWithAttributeKeyPaths:inEntityDescription:]</code>? I would like the <code>NSDatePicker</code> to show hrs:minutes as well as the date.</p>
<p><strong>Update</strong>
I've added an answer below, gleaned from the cocoa-dev list.</p>
| [
{
"answer_id": 210775,
"author": "Scott Weinstein",
"author_id": 25201,
"author_profile": "https://Stackoverflow.com/users/25201",
"pm_score": 0,
"selected": false,
"text": "System.Net.Sockets.Socket"
}
] | 2008/10/17 | [
"https://Stackoverflow.com/questions/210743",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2140/"
] |
210,761 | <p>Upon page load I want to move the cursor to a particular field. No problem. But I also need to select and highlight the default value that is placed in that text field.</p>
| [
{
"answer_id": 210764,
"author": "John Millikin",
"author_id": 3560,
"author_profile": "https://Stackoverflow.com/users/3560",
"pm_score": 8,
"selected": true,
"text": "var input = document.getElementById('myTextInput');\ninput.focus();\ninput.select();"
},
{
"answer_id": 211199,... | 2008/10/17 | [
"https://Stackoverflow.com/questions/210761",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4444/"
] |
210,787 | <p>I have a xml which is max 3 levels deep. Now by using C# or Xpath what the best method to check the whether all the child nodes under a parent node are empty.</p>
<p>Thanks in Advance.</p>
| [
{
"answer_id": 210822,
"author": "C. K. Young",
"author_id": 13,
"author_profile": "https://Stackoverflow.com/users/13",
"pm_score": 4,
"selected": true,
"text": "<foo>\n <bar>\n <baz/>\n <baz>Hello, world!</baz>\n <baz><qux/></baz>\n </bar>\n</foo>\n"
},
{
"answer_id"... | 2008/10/17 | [
"https://Stackoverflow.com/questions/210787",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28773/"
] |
210,789 | <p>While building a small experimental HTTP server, I need to implement the persistent connection feature of HTTP 1.1 (and the pipelining feature).
How do I test it?
Using a browser like Firefox gives me little or no control, and it's hard to check.
Any ideas?</p>
<p>Thanks</p>
| [
{
"answer_id": 210954,
"author": "Javier",
"author_id": 11649,
"author_profile": "https://Stackoverflow.com/users/11649",
"pm_score": 1,
"selected": false,
"text": "-k"
}
] | 2008/10/17 | [
"https://Stackoverflow.com/questions/210789",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25645/"
] |
210,809 | <p>Essentially my question is, does anyone know of a utility for inspecting the <strong>buffer cache</strong> in linux?</p>
| [
{
"answer_id": 18398941,
"author": "slm",
"author_id": 33204,
"author_profile": "https://Stackoverflow.com/users/33204",
"pm_score": 4,
"selected": true,
"text": "fincore"
},
{
"answer_id": 26860348,
"author": "Highstaker",
"author_id": 2052138,
"author_profile": "htt... | 2008/10/17 | [
"https://Stackoverflow.com/questions/210809",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10747/"
] |
210,820 | <p>I have a webpage that redirects to another webpage like this:</p>
<pre><code>http://www.myOtherServer.com/Sponsor.php?RedirectPage=http://mylink.com/whereIwasgoingtogo.html
</code></pre>
<p>Then the Sponsor.php page displays an ad with a link saying "Continue to your page" that links to the passed in RedirectPage. Are there security/spoofing issues that could come from this? What is the best way to handle this? (note that the user is not logged in to either site)</p>
| [
{
"answer_id": 1089103,
"author": "Tom Ritter",
"author_id": 8435,
"author_profile": "https://Stackoverflow.com/users/8435",
"pm_score": 4,
"selected": true,
"text": " http://cnn.com/sponsor.php?redirectpage=http://bit.ly/jh2l14\n"
}
] | 2008/10/17 | [
"https://Stackoverflow.com/questions/210820",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3291/"
] |
210,821 | <p>I have read the post <a href="http://www.julienlecomte.net/blog/2007/10/28/" rel="noreferrer">here</a> about using setTimeout() during intensive DOM processing (using JavaScript), but how can I integrate this function with the below code? The below code works fine for a small number of options, but when the number of options gets too big my "please wait" animated GIF freezes while the local JavaScript is processing. Thanks!</p>
<pre><code>function appendToSelect() {
$("#mySelect").children().remove() ;
$("#mySelect").html(
'<option selected value="' + obj.data[0].value + '">'
+ obj.data[0].name
+ '</option>'
);
var j = 1 ;
for (var i = 1; i < obj.data.length; i++) {
$("#mySelect").append(
'<option value="' + obj.data[i].value + '">'
+ obj.data[i].name
+ '</option>'
);
}
}
</code></pre>
| [
{
"answer_id": 210968,
"author": "Borgar",
"author_id": 27388,
"author_profile": "https://Stackoverflow.com/users/27388",
"pm_score": 4,
"selected": false,
"text": "function processLoop( actionFunc, numTimes, doneFunc ) {\n var i = 0;\n var f = function () {\n if (i < numTimes) {\n ... | 2008/10/17 | [
"https://Stackoverflow.com/questions/210821",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2755/"
] |
210,826 | <p>I have a mobile .NET solution and decided to sign the assemblies.
Compilation completes without errors but gives the warning</p>
<p><strong>'CompactUI.Business.PocketPC.asmmeta, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is not signed correctly.</strong></p>
<p>The application is working fine but I can't open the designer for forms using this assembly anymore. Again the designer says</p>
<p><strong>'CompactUI.Business.PocketPC.asmmeta, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is not signed correctly.</strong> </p>
<p>with the stack information: </p>
<p>at Microsoft.CompactFramework.Build.AsmmetaBindingService.GetAsmmetaAssembly(String sourceAssemblyPath, Boolean verify)
at Microsoft.CompactFramework.Build.AsmmetaBindingService.LoadAsmMetaAssembly(Assembly sourceAssembly, String hintPath, IDeviceTypeResolutionService resolver)
at Microsoft.CompactFramework.Build.MetadataService.GetAsmmetaType(Type sourceType)
at Microsoft.CompactFramework.Build.MetadataService.GetTypeAttributes(Type desktopType)
at Microsoft.CompactFramework.Design.DeviceCustomTypeDescriptor.GetAttributes()
...</p>
<p>What is causing this? </p>
<p><strong>Edit: Nicholas suggestion is not solving the problem</strong></p>
<p>I've got a Form that contains common properties which is base for every form in the presentation layer</p>
<pre><code>public class CustomForm : Form
{
...
}
</code></pre>
<p>This form is in the business layer that causes the warning. Every form that inherits from this base form causes the problem when viewing in the designer.</p>
| [
{
"answer_id": 224328,
"author": "Marcus Griep",
"author_id": 28645,
"author_profile": "https://Stackoverflow.com/users/28645",
"pm_score": 1,
"selected": false,
"text": "null"
},
{
"answer_id": 225094,
"author": "MysticSlayer",
"author_id": 28139,
"author_profile": "... | 2008/10/17 | [
"https://Stackoverflow.com/questions/210826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14027/"
] |
210,827 | <p>I need to ask for input in console and wait for few sec may be a min after that I need to default to some value. How can basically time our on console input in c# and proceed with default settings? If you have sample code that would be great.</p>
| [
{
"answer_id": 210859,
"author": "Nathan W",
"author_id": 6335,
"author_profile": "https://Stackoverflow.com/users/6335",
"pm_score": 2,
"selected": false,
"text": "static void Main(string[] args)\n {\n System.Timers.Timer timer = new System.Timers.Timer(60000);\n ... | 2008/10/17 | [
"https://Stackoverflow.com/questions/210827",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13432/"
] |
210,829 | <p>What is an NP-complete problem? Why is it such an important topic in computer science?</p>
| [
{
"answer_id": 210892,
"author": "Vincent Ramdhanie",
"author_id": 27439,
"author_profile": "https://Stackoverflow.com/users/27439",
"pm_score": 5,
"selected": false,
"text": "P"
},
{
"answer_id": 210932,
"author": "Kyle Cronin",
"author_id": 658,
"author_profile": "h... | 2008/10/17 | [
"https://Stackoverflow.com/questions/210829",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15055/"
] |
210,835 | <p>What does the term <b>referential transparency</b> mean? I've heard it described as "it means you can replace equals with equals" but this seems like an inadequate explanation.</p>
| [
{
"answer_id": 210871,
"author": "Brian R. Bondy",
"author_id": 3153,
"author_profile": "https://Stackoverflow.com/users/3153",
"pm_score": 7,
"selected": false,
"text": "int plusOne(int x)\n{\n return x+1;\n}\n"
},
{
"answer_id": 35706014,
"author": "Community",
"author... | 2008/10/17 | [
"https://Stackoverflow.com/questions/210835",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15055/"
] |
210,836 | <p>In xp 32bit this line compiles with not problem however in vista 64bit this line:</p>
<pre><code>m_FuncAddr = ::GetProcAddress (somthing);
</code></pre>
<p>gives the following error</p>
<blockquote>
<p>error C2440: '=' : cannot convert from
'FARPROC' to 'int (__cdecl *)(void)'</p>
</blockquote>
<p>GetProcAddress is defined as</p>
<pre><code>WINBASEAPI FARPROC WINAPI GetProcAddress (somthing)
</code></pre>
<p>And m_FuncAddr as</p>
<pre><code>int (WINAPI *m_FuncAddr)();
</code></pre>
<p>From what I understand both are stdcall's.</p>
<p>To avoid the error I had to put</p>
<pre><code>m_FuncAddr = (int (__cdecl *)(void))::GetProcAddress(somthing);
</code></pre>
<p>My Question:</p>
<p>If both m_FuncAddr and GetProcAddress have the stdcall calling convention why do I have to 'recall' it with cdecl ?</p>
<p>Is it possible that the VS project setting 'default calling convention (which is set to cdecl) over-rides the assignemet statment above ?</p>
<p>Thanks in advance!</p>
<p>[Edit]</p>
<p>To clerfiy the question:</p>
<p>On one side of the equation (say side 1) i have </p>
<pre><code>int __stdcall * m_FuncAddr
</code></pre>
<p>On other side (side 2)</p>
<pre><code>INT_PTR far __stdcall GetProcAddress
</code></pre>
<p>So how is it that i have to cast side 2 with cdecl if both are stdcalls ?
Or am I not getting something ?</p>
| [
{
"answer_id": 210857,
"author": "Nick",
"author_id": 26240,
"author_profile": "https://Stackoverflow.com/users/26240",
"pm_score": 2,
"selected": false,
"text": "typedef int (WINAPI *FFuncType)();\nFFuncType m_FuncAddr;\nm_FuncAddr = (FFuncType)::GetProcAddress (somthing);\n"
},
{
... | 2008/10/17 | [
"https://Stackoverflow.com/questions/210836",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14587/"
] |
210,837 | <p>How do I share state amongst TestMethods in MSTest. These tests would be run as Ordered Tests and in sequence.</p>
<pre><code> private TestContext testContext;
public TestContext TestContext
{
get { return this.testContext; }
set { this.testContext = value;}
}
[TestMethod]
public void Subscribe()
{
bool subscribed = true;
TestContext.Properties.Add("subscribed", subscribed);
Assert.IsTrue(subscribed == true, string.Format("Subscribed...{0}", this.GetHashCode()));
}
[TestMethod]
public void GenerateEvent()
{
bool subscribed = (bool)TestContext.Properties["subscribed"];
Assert.IsTrue(subscribed == true, string.Format("Subscribed...{0}", this.GetHashCode()));
}
</code></pre>
<p>Thanks in advance.</p>
| [
{
"answer_id": 403466,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 1,
"selected": false,
"text": "private static List<string> SharedValues = new List<string>();\n\n[TestMethod]\npublic void TestMethod1()\n{\n SharedValues.... | 2008/10/17 | [
"https://Stackoverflow.com/questions/210837",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28413/"
] |
210,881 | <p>I have a KML file overlay on an embedded Google Map using the GGeoXml object. I'd like to be able to access specific placemarks in the KML file from Javascript (for example to highlight a selected polygon on the map in response to user action). </p>
<p>Ideally what I'd like to do is something like this (pseudo-code):</p>
<pre><code> geoXml.getPlacemarkByName('Foo').focus();
</code></pre>
<p>Unforunately the <a href="http://code.google.com/apis/maps/documentation/reference.html#GGeoXml" rel="nofollow noreferrer">Google Maps API</a> doesn't seem to expose the placemarks or any other internals of the KML overlay. Does anyone have any thoughts as to how I might accomplish this? I don't know anything about how the overlays are implemented internally, but it seems like there might be a hack that would let me do this.</p>
<p>I'm also using jQuery FWIW.</p>
| [
{
"answer_id": 375726,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 2,
"selected": false,
"text": "GEvent.addListener(map, 'addoverlay', function(o) {\n kmlmarkers.push(o);\n}\n"
},
{
"answer_id": 422581,
"auth... | 2008/10/17 | [
"https://Stackoverflow.com/questions/210881",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/239663/"
] |
210,882 | <p>I'm being asked to add queryability to a database (Oracle) filled with mostly binary data.
So I need to be able to query binary ranges within a blobs of a few kilobytes. I've never done this before, so I'm wondering what are some good practices and pitfalls to consider when starting a project like this.</p>
<p>Thanks</p>
| [
{
"answer_id": 210963,
"author": "Jamie Love",
"author_id": 27308,
"author_profile": "https://Stackoverflow.com/users/27308",
"pm_score": 2,
"selected": false,
"text": "create or replace function retrieve_data_from_blob (\n b blob\n , tag_code\n)\nas\n lw long raw;\n data var... | 2008/10/17 | [
"https://Stackoverflow.com/questions/210882",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15124/"
] |
210,922 | <p>What control type should I use - <code>Image</code>, <code>MediaElement</code>, etc.?</p>
| [
{
"answer_id": 213786,
"author": "Joel B Fant",
"author_id": 22211,
"author_profile": "https://Stackoverflow.com/users/22211",
"pm_score": 5,
"selected": false,
"text": "PictureBox"
},
{
"answer_id": 1134340,
"author": "Community",
"author_id": -1,
"author_profile": "... | 2008/10/17 | [
"https://Stackoverflow.com/questions/210922",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2522462/"
] |
210,936 | <p>Having an issue with some images using IE7 - work fine in 6 and in all versions of Firefox.</p>
<p>Has anyone run across this before? I know I've had it happen in the past (and I googled a fix, but darned if I can find the fix again... note to self, document things like this for future ;) )</p>
<pre><code><div class="contextBlock">
<p class="cntImg"><a href="files/image.jsp" title="Image"><img src="files/images/image.jpg" alt="Image" width="171" height="96" border="0">Image</a></p>
<p class="cntImg"><a href="files/image2.jsp" title="image2"><img src="files/images/image2.jpg" alt="Image2" width="171" height="96" border="0">Image2 </a></p>
<p class="comment">Click to enlarge</p>
<div class="clr"></div>
</code></pre>
<p></p>
| [
{
"answer_id": 211028,
"author": "Eric Wendelin",
"author_id": 25066,
"author_profile": "https://Stackoverflow.com/users/25066",
"pm_score": 2,
"selected": false,
"text": "<a href=\"files/image.jsp\" title=\"Image\">\n <img src=\"files/images/image.jpg\" alt=\"Image\" width=\"171\" heig... | 2008/10/17 | [
"https://Stackoverflow.com/questions/210936",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
210,939 | <p>I've been developing a GUI library for Windows (as a personal side project, no aspirations of usefulness). For my main window class, I've set up a hierarchy of option classes (using the <a href="http://www.parashift.com/c++-faq-lite/named-parameter-idiom.html" rel="nofollow noreferrer">Named Parameter Idiom</a>), because some options are shared and others are specific to particular types of windows (like dialogs).</p>
<p>The way the Named Parameter Idiom works, the functions of the parameter class have to return the object they're called on. The problem is that, in the hierarchy, each one has to be a <em>different</em> class -- the <code>createWindowOpts</code> class for standard windows, the <code>createDialogOpts</code> class for dialogs, and the like. I've dealt with that by making all the option classes templates. Here's an example:</p>
<pre><code>template <class T>
class _sharedWindowOpts: public detail::_baseCreateWindowOpts {
public: ///////////////////////////////////////////////////////////////
// No required parameters in this case.
_sharedWindowOpts() { };
typedef T optType;
// Commonly used options
optType& at(int x, int y) { mX=x; mY=y; return static_cast<optType&>(*this); }; // Where to put the upper-left corner of the window; if not specified, the system sets it to a default position
optType& at(int x, int y, int width, int height) { mX=x; mY=y; mWidth=width; mHeight=height; return static_cast<optType&>(*this); }; // Sets the position and size of the window in a single call
optType& background(HBRUSH b) { mBackground=b; return static_cast<optType&>(*this); }; // Sets the default background to this brush
optType& background(INT_PTR b) { mBackground=HBRUSH(b+1); return static_cast<optType&>(*this); }; // Sets the default background to one of the COLOR_* colors; defaults to COLOR_WINDOW
optType& cursor(HCURSOR c) { mCursor=c; return static_cast<optType&>(*this); }; // Sets the default mouse cursor for this window; defaults to the standard arrow
optType& hidden() { mStyle&=~WS_VISIBLE; return static_cast<optType&>(*this); }; // Windows are visible by default
optType& icon(HICON iconLarge, HICON iconSmall=0) { mIcon=iconLarge; mSmallIcon=iconSmall; return static_cast<optType&>(*this); }; // Specifies the icon, and optionally a small icon
// ...Many others removed...
};
template <class T>
class _createWindowOpts: public _sharedWindowOpts<T> {
public: ///////////////////////////////////////////////////////////////
_createWindowOpts() { };
// These can't be used with child windows, or aren't needed
optType& menu(HMENU m) { mMenuOrId=m; return static_cast<optType&>(*this); }; // Gives the window a menu
optType& owner(HWND hwnd) { mParentOrOwner=hwnd; return static_cast<optType&>(*this); }; // Sets the optional parent/owner
};
class createWindowOpts: public _createWindowOpts<createWindowOpts> {
public: ///////////////////////////////////////////////////////////////
createWindowOpts() { };
};
</code></pre>
<p>It works, but as you can see, it requires a noticeable amount of extra work: a type-cast on the return type for each function, extra template classes, etcetera.</p>
<p>My question is, is there an easier way to implement the Named Parameter Idiom in this case, one that doesn't require all the extra stuff?</p>
| [
{
"answer_id": 211106,
"author": "Patrick Johnmeyer",
"author_id": 363,
"author_profile": "https://Stackoverflow.com/users/363",
"pm_score": 1,
"selected": false,
"text": "class sharedWindowOpts\n{\npublic:\n\n sharedWindowOpts() {};\n\n // Commonly used options\n template <class optT... | 2008/10/17 | [
"https://Stackoverflow.com/questions/210939",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12193/"
] |
210,945 | <p>I have seen many examples, with many 'no, you missed something' comments. What is the right way to match an e-mail address?</p>
<p>For Sanity sake, only fully-qualified domain names, no @localhost allowed. (or, both ways)</p>
<p>Subdomains must be allowed (issac@deptartment.company.museum)</p>
| [
{
"answer_id": 212008,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": -1,
"selected": false,
"text": "([a-zA-Z0-9_\\-])([a-zA-Z0-9_\\-\\.]*)@(\\[((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}|((([a-zA-Z0-9\\... | 2008/10/17 | [
"https://Stackoverflow.com/questions/210945",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/144/"
] |
210,975 | <p>Looking for an example in linq about how to insert a row of a gridview into datacontext. </p>
| [
{
"answer_id": 212008,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": -1,
"selected": false,
"text": "([a-zA-Z0-9_\\-])([a-zA-Z0-9_\\-\\.]*)@(\\[((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}|((([a-zA-Z0-9\\... | 2008/10/17 | [
"https://Stackoverflow.com/questions/210975",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
210,978 | <p>I have a question about using <code>os.execvp</code> in Python. I have the following bit of code that's used to create a list of arguments:</p>
<pre>
args = [ "java"
, classpath
, "-Djava.library.path=" + lib_path()
, ea
, "-Xmx1000m"
, "-server"
, "code_swarm"
, params
]
</pre>
<p>When I output a string using <code>" ".join(args)</code> and paste that into my shell prompt, the JVM launches fine, and everything works. Everything works if I use <code>os.system(" ".join(args))</code> in my Python script, too.</p>
<p><em>But</em> the following bit of code does not work:</p>
<pre>os.execvp("java", args)</pre>
<p>I get the following error:</p>
<pre>
Unrecognized option: -classpath [and then the classpath I created, which looks okay]
Could not create the Java virtual machine.
</pre>
<p>So what gives? Why does copying/pasting into the shell or using <code>os.system()</code> work, but not <code>os.execvp()</code>?</p>
| [
{
"answer_id": 210982,
"author": "CesarB",
"author_id": 28258,
"author_profile": "https://Stackoverflow.com/users/28258",
"pm_score": 5,
"selected": true,
"text": "#!/usr/bin/python\nimport sys\nprint sys.argv\n"
}
] | 2008/10/17 | [
"https://Stackoverflow.com/questions/210978",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28804/"
] |
210,985 | <p>I'm doing some optimising for my site and am trying to figure out just how big some inline code can be before it can justify having it's own file instead of being written inline.</p>
<p>My guess on how to measure it would be that the amount of code (CSS or JS in this case) would need to be bigger than the HTTP packets sent and received to get a 304 response. </p>
<p>Please ignore the fact that it's a good practice to keep styles and javascript out of the HTML page and think only in terms of browser performance. :)</p>
| [
{
"answer_id": 217491,
"author": "mjallday",
"author_id": 6084,
"author_profile": "https://Stackoverflow.com/users/6084",
"pm_score": 0,
"selected": false,
"text": "HTTP/1.1 304 Not Modified\nCache-Control: max-age=604800, public\nLast-Modified: Tue, 17 Jun 2008 17:20:41 GMT\nDate: Mon, ... | 2008/10/17 | [
"https://Stackoverflow.com/questions/210985",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6084/"
] |
210,986 | <p>Newbie question...</p>
<p>If I have a file that is in the root of the web app. How do I programmaticaly query the path of that file? ie, what directory it is in?</p>
| [
{
"answer_id": 210993,
"author": "harpo",
"author_id": 4525,
"author_profile": "https://Stackoverflow.com/users/4525",
"pm_score": 2,
"selected": false,
"text": "System.Web.HttpServerUtility.MapPath( \"~/filename.ext\" );\n"
},
{
"answer_id": 211119,
"author": "Jason Whitehor... | 2008/10/17 | [
"https://Stackoverflow.com/questions/210986",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10431/"
] |
210,996 | <p>In spring you can initialize a bean by having the applicationContext.xml invoke a constructor, or you can set properties on the bean. What are the trade offs between the two approaches? Is it better to have a constructor (which enforces the contract of having everything it needs in one method) or is it better to have all properties (which gives you flexibility to only inject selectively for example when unit testing.)</p>
<p>What are the trade offs (between writing a bean that uses a constructor to establish it's initial state, or using properties and perhaps an afterProperties() method) ?</p>
| [
{
"answer_id": 211112,
"author": "Dónal",
"author_id": 2648,
"author_profile": "https://Stackoverflow.com/users/2648",
"pm_score": 2,
"selected": false,
"text": "@PostConstruct"
},
{
"answer_id": 211141,
"author": "lycono",
"author_id": 28789,
"author_profile": "https... | 2008/10/17 | [
"https://Stackoverflow.com/questions/210996",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6580/"
] |
210,998 | <p>I am attempting to insert a Canvas3D object inside a Swing JPanel, but the code doesn't seem to be working (i.e. nothing happens):</p>
<pre>
Canvas3D canvas = new Canvas3D(SimpleUniverse.getPreferredConfiguration());
SimpleUniverse universe = new SimpleUniverse(canvas);
BranchGroup root = new BranchGroup();
root.addChild(new ColorCube());
universe.addBranchGraph(root);
universe.getViewingPlatform().setNominalViewingTransform();
canvasPanel.add(canvas);
</pre>
<p>What am I missing? The JPanel was created using NetBean's Visual Editor.</p>
| [
{
"answer_id": 211131,
"author": "Simon Lehmann",
"author_id": 27011,
"author_profile": "https://Stackoverflow.com/users/27011",
"pm_score": 3,
"selected": true,
"text": "canvasPanel.setLayout(new BorderLayout());\n"
}
] | 2008/10/17 | [
"https://Stackoverflow.com/questions/210998",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23845/"
] |
211,001 | <p>In a normal web app w/ login and secure data, what is an easy way to secure that data and prevent it from being seen by using the browser's back button, once a user logs out? </p>
| [
{
"answer_id": 211079,
"author": "Wedge",
"author_id": 332,
"author_profile": "https://Stackoverflow.com/users/332",
"pm_score": 4,
"selected": true,
"text": " Cache-Control: no-cache\n Expires: Fri, 31 Dec 1998 12:00:00 GMT\n"
}
] | 2008/10/17 | [
"https://Stackoverflow.com/questions/211001",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4444/"
] |
211,008 | <p>How can I detect in C# whether two files are absolutely identical (size, content, etc.)?</p>
| [
{
"answer_id": 211042,
"author": "Charlie",
"author_id": 18529,
"author_profile": "https://Stackoverflow.com/users/18529",
"pm_score": 5,
"selected": false,
"text": "static bool FilesAreEqual( string f1, string f2 )\n{\n // get file length and make sure lengths are identical\n long... | 2008/10/17 | [
"https://Stackoverflow.com/questions/211008",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
211,025 | <p>I have been maintaining <a href="http://github.com/Pistos/watir-mirror" rel="noreferrer">the git mirror</a> of <a href="http://wtr.rubyforge.org/" rel="noreferrer">the watir project</a>. Some time a couple weeks ago, we had someone ready to submit their first git-based patch. Unfortunately, we ran into some issues regarding line endings (CRLF vs. LF, etc.) because of the multi-platform nature of the project.</p>
<p>I tried what I could to set <a href="http://git-scm.com/docs/gitattributes" rel="noreferrer">the autocrlf option</a> (to 'input'), and do some --hard resets. However, a few days later, the daily update (git svn rebase) is spewing this error:</p>
<pre><code>Incomplete data: Delta source ended unexpectedly
</code></pre>
<p>I've tried googling around for what to do, but even removing the autocrlf setting in the .git/config hasn't helped. I fear the working copy is corrupt, but I hope it is not unrecoverable.</p>
<p>Obviously, a possible course of action is to just re-import from svn and start a fresh mirror, but I hope we don't have to do that, since the current watir-mirror has already been forked, and people have developed new code in their forks.</p>
<p>Thanks in advance for any help.</p>
| [
{
"answer_id": 4938148,
"author": "Todd Wagner",
"author_id": 608775,
"author_profile": "https://Stackoverflow.com/users/608775",
"pm_score": 4,
"selected": false,
"text": "git svn reset --r XXXXX"
},
{
"answer_id": 16592981,
"author": "Don Branson",
"author_id": 56076,
... | 2008/10/17 | [
"https://Stackoverflow.com/questions/211025",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28558/"
] |
211,034 | <p>I'm working on a small UML editor project, in Java, that I started a couple of months ago. After a few weeks, I got a working copy for a UML class diagram editor.</p>
<p>But now, I'm redesigning it completely to support other types of diagrams, such a sequence, state, class, etc. This is done by implementing a graph construction framework (I'm greatly inspired by Cay Horstmann work on the subject with the Violet UML editor).</p>
<p>Redesign was going smoothly until one of my friends told me that I forgot to add a Do/Undo functionnality to the project, which, in my opinion, is vital.</p>
<p>Remembering object oriented design courses, I immediately thought of Memento and Command pattern.</p>
<p>Here's the deal. I have a abstract class, AbstractDiagram, that contains two ArrayLists : one for storing nodes (called Elements in my project) and the other for storing Edges (called Links in my projects). The diagram will probably keep a stack of commands that can be Undoed/Redoed. Pretty standard.</p>
<p>How can I execute these commands in a efficient way? Say, for example, that I want to move a node (the node will be an interface type named INode, and there will be concrete nodes derived from it (ClassNode, InterfaceNode, NoteNode, etc.)). </p>
<p>The position information is held as an attribute in the node, so by modying that attribute in the node itself, the state is changed. When the display will be refreshed, the node will have moved. This is the Memento part of the pattern (I think), with the difference that the object is the state itself.</p>
<p>Moreover, if I keep a clone of the original node (before it moved), I can get back to its old version. The same technique applies for the information contained in the node (the class or interface name, the text for a note node, the attributes name, and so on).</p>
<p>The thing is, how do I replace, in the diagram, the node with its clone upon undo/redo operation? If I clone the original object that is referenced by the diagram (being in the node list), the clone isn't reference in the diagram, and the only thing that points to is the Command itself! Shoud I include mechanisms in the diagram for finding a node according to an ID (for example) so I can replace, in the diagram, the node by its clone (and vice-versa) ? Is it up to the Memento and Command patterns to do that ? What about links? They should be movable too but I don't want to create a command just for links (and one just for nodes), and I should be able to modify the right list (nodes or links) according to the type of the object the command is referring to.</p>
<p>How would you proceed? In short, I am having trouble representing the state of an object in a command/memento pattern so that it can be efficiently recovered and the original object restored in the diagram list, and depending on the object type (node or link).</p>
<p>Thanks a lot!</p>
<p>Guillaume.</p>
<p>P.S.: if I'm not clear, tell me and I will clarify my message (as always!).</p>
<p><strong>Edit</strong></p>
<p>Here's my actual solution, that I started implementing before posting this question.</p>
<p>First, I have an AbstractCommand class defined as follow :</p>
<pre><code>public abstract class AbstractCommand {
public boolean blnComplete;
public void setComplete(boolean complete) {
this.blnComplete = complete;
}
public boolean isComplete() {
return this.blnComplete;
}
public abstract void execute();
public abstract void unexecute();
}
</code></pre>
<p>Then, each type of command is implemented using a concrete derivation of AbstractCommand.</p>
<p>So I have a command to move an object :</p>
<pre><code>public class MoveCommand extends AbstractCommand {
Moveable movingObject;
Point2D startPos;
Point2D endPos;
public MoveCommand(Point2D start) {
this.startPos = start;
}
public void execute() {
if(this.movingObject != null && this.endPos != null)
this.movingObject.moveTo(this.endPos);
}
public void unexecute() {
if(this.movingObject != null && this.startPos != null)
this.movingObject.moveTo(this.startPos);
}
public void setStart(Point2D start) {
this.startPos = start;
}
public void setEnd(Point2D end) {
this.endPos = end;
}
}
</code></pre>
<p>I also have a MoveRemoveCommand (to... move or remove an object/node). If I use the ID of instanceof method, I don't have to pass the diagram to the actual node or link so that it can remove itself from the diagram (which is a bad idea I think).</p>
<p>AbstractDiagram diagram;
Addable obj;
AddRemoveType type;</p>
<pre><code>@SuppressWarnings("unused")
private AddRemoveCommand() {}
public AddRemoveCommand(AbstractDiagram diagram, Addable obj, AddRemoveType type) {
this.diagram = diagram;
this.obj = obj;
this.type = type;
}
public void execute() {
if(obj != null && diagram != null) {
switch(type) {
case ADD:
this.obj.addToDiagram(diagram);
break;
case REMOVE:
this.obj.removeFromDiagram(diagram);
break;
}
}
}
public void unexecute() {
if(obj != null && diagram != null) {
switch(type) {
case ADD:
this.obj.removeFromDiagram(diagram);
break;
case REMOVE:
this.obj.addToDiagram(diagram);
break;
}
}
}
</code></pre>
<p>Finally, I have a ModificationCommand which is used to modify the info of a node or link (class name, etc.). This may be merged in the future with the MoveCommand. This class is empty for now. I will probably do the ID thing with a mechanism to determine if the modified object is a node or an edge (via instanceof or a special denotion in the ID).</p>
<p>Is this is a good solution?</p>
| [
{
"answer_id": 211105,
"author": "Justin Bozonier",
"author_id": 9401,
"author_profile": "https://Stackoverflow.com/users/9401",
"pm_score": 3,
"selected": true,
"text": "{ width:100, height:50, position:(10,25), content:\"Am I certain?\", edge-connections:null}\n"
},
{
"answer_i... | 2008/10/17 | [
"https://Stackoverflow.com/questions/211034",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10687/"
] |
211,035 | <p>Today is officially my first day with C++ :P</p>
<p>I've downloaded Visual C++ 2005 Express Edition and Microsoft Platform SDK for Windows Server 2003 SP1, because I want to get my hands on the open source <a href="http://code.google.com/p/enso" rel="nofollow noreferrer">Enso Project</a>. </p>
<p>So, after installing scons I went to the console and tried to compile it using scons, but I got this error: </p>
<pre><code>C:\oreyes\apps\enso\enso-read-only\src\platform\win32\Include\WinSdk.h(64) : fatal error C1083: Cannot open include file: 'Windows.h': No such file or directory
scons: *** [src\platform\win32\InputManager\AsyncEventProcessorRegistry.obj] Error 2
scons: building terminated because of errors.
</code></pre>
<p>After checking these links:</p>
<p><a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1135164&SiteID=1" rel="nofollow noreferrer">VS ans PSDK</a></p>
<p><a href="https://stackoverflow.com/questions/160938/fatal-error-c1083-cannot-open-include-file-tiffioh-no-such-file-or-directory-vc#160957">Include tiffi.h</a></p>
<p><a href="https://stackoverflow.com/questions/80788/fatal-error-c1083-cannot-open-include-file-windowsh-no-such-file-or-directory#81226">Wndows.h</a></p>
<p>I've managed to configure my installation like this:</p>
<p><img src="https://i.stack.imgur.com/z41N8.png" alt="alt text"></p>
<p>And even run this script </p>
<p><img src="https://i.stack.imgur.com/1rB1L.png" alt="alt text"></p>
<p>And I managed to compile the file below in the IDE.</p>
<pre><code>// Test.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <Windows.h>
int _tmain(int argc, _TCHAR* argv[])
{
return 0;
}
</code></pre>
<p>But I still get that exception in the console. Does anyone have scons experience?</p>
<p><strong>EDIT</strong></p>
<p>Actually (and I forgot to tell you this) I started the command prompt with the link "Visual Studio 2005 Command Prompt".</p>
<p>I assume this will include the paths in environment variables. Well after printing them I find that it didn't:</p>
<pre><code> echo %INCLUDE%
echo %LIB%
echo %PATH%
</code></pre>
<p>And they were not present, so I created this .bat file:</p>
<pre><code>set PATH=%PATH%;"C:\Program Files\Microsoft Platform SDK\Bin"
set INCLUDE=%INCLUDE%;"C:\ Program Files\Microsoft Platform SDK\Include"
set LIB=%LIB%;"C:\ Program Files\Microsoft Platform SDK\Lib"
</code></pre>
<p>Still, scons seeems not to take the vars... :( </p>
| [
{
"answer_id": 211117,
"author": "Michael Burr",
"author_id": 12711,
"author_profile": "https://Stackoverflow.com/users/12711",
"pm_score": 2,
"selected": false,
"text": "vsvars32.bat"
},
{
"answer_id": 211164,
"author": "jussij",
"author_id": 14738,
"author_profile":... | 2008/10/17 | [
"https://Stackoverflow.com/questions/211035",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20654/"
] |
211,037 | <p>Similar question as <a href="https://stackoverflow.com/questions/56722/automated-processing-of-an-email-in-java">this one</a> but for a Microsoft Environment.</p>
<p>Email --> Exchange Server -->[something]</p>
<p>For the [something] I was using Outlook 2003 & C# but it <em>feels</em> messy (A program is trying to access outlook, this could be a virus etc)</p>
<pre><code>Microsoft.Office.Interop.Outlook.Application objOutlook = new Microsoft.Office.Interop.Outlook.Application();
Microsoft.Office.Interop.Outlook.NameSpace objNS = objOutlook.GetNamespace("MAPI");
objNS.Logon("MAPIProfile", "MAPIPassword", false, true);
</code></pre>
<p>Is this the best way to do it? Is there a better way of retrieving and processing emails in a Microsoft environment???</p>
| [
{
"answer_id": 1808996,
"author": "Pawel Lesnikowski",
"author_id": 80894,
"author_profile": "https://Stackoverflow.com/users/80894",
"pm_score": 1,
"selected": false,
"text": "using(Imap imap = new Imap())\n{\n imap.Connect(\"imap.company.com\");\n imap.UseBestLogin(\"user\", \"pa... | 2008/10/17 | [
"https://Stackoverflow.com/questions/211037",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5188/"
] |
211,041 | <p>Should I be writing Doc Comments for all of my java methods? </p>
| [
{
"answer_id": 211060,
"author": "VonC",
"author_id": 6309,
"author_profile": "https://Stackoverflow.com/users/6309",
"pm_score": 7,
"selected": true,
"text": "/** \n * Get the current value of the foo property.\n * The foo property controls the initial guess used by the bla algorithm in... | 2008/10/17 | [
"https://Stackoverflow.com/questions/211041",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24717/"
] |
211,043 | <p>The IntelliJ IDEA short-cut to reformat source code is <kbd>Ctrl</kbd>+<kbd>Alt</kbd>+<kbd>L</kbd>. This happens to lock the screen in KDE (Gnome too?). How can I disable this so IntelliJ receives the key sequence?</p>
| [
{
"answer_id": 32469733,
"author": "Rodrigo Rodrigues",
"author_id": 3128246,
"author_profile": "https://Stackoverflow.com/users/3128246",
"pm_score": 1,
"selected": false,
"text": "Global Keyboard shortcuts"
},
{
"answer_id": 33958675,
"author": "Andrei C",
"author_id": ... | 2008/10/17 | [
"https://Stackoverflow.com/questions/211043",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
211,046 | <p>What's a good way to generate an icon in-memory in python? Right now I'm forced to use pygame to draw the icon, then I save it to disk as an .ico file, and then I load it from disk as an ICO resource...</p>
<p>Something like this:</p>
<pre><code> if os.path.isfile(self.icon):
icon_flags = win32con.LR_LOADFROMFILE | win32con.LR_DEFAULTSIZE
hicon = win32gui.LoadImage(hinst,
self.icon,
win32con.IMAGE_ICON,
0,
0,
icon_flags)
</code></pre>
<p>...where self.icon is the filename of the icon I created.</p>
<p>Is there any way to do this in memory? EDIT: All I want to do is create an icon with a 2-digit number displayed on it (weather-taskbar style.</p>
| [
{
"answer_id": 211304,
"author": "Toni Ruža",
"author_id": 6267,
"author_profile": "https://Stackoverflow.com/users/6267",
"pm_score": 3,
"selected": true,
"text": "from wx import EmptyIcon\nicon = EmptyIcon()\nicon.CopyFromBitmap(your_wxBitmap)\n"
},
{
"answer_id": 49098381,
... | 2008/10/17 | [
"https://Stackoverflow.com/questions/211046",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15055/"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.