qid int64 4 19.1M | question stringlengths 18 48.3k | answers list | date stringlengths 10 10 | metadata list |
|---|---|---|---|---|
403,048 | <p>In an ASP.NET page I have a user control and I want to perform some action within it using javascript. When that action is complete I want to raise an event (again in javascript) to be picked up by the containing ASP.NET page (again in javascript).</p>
<p>The reason I want to do this is because I have more than one user control on the page and I need the action performed in one user control to instantiate an action in another user control without doing a postback.</p>
<p>Does anyone know how to do this?</p>
<p>Many thanks.</p>
<hr>
<p>Hi and thanks for the response.
What I'm trying to do is create some form of encapsulation. So if the javascript code does something in one user control that user control shouldn't know of the impact else where. It would raise an event in javascript which can be picked up by asp.net page rendered javascript which can in turn call a javascript method in another user control if it needs to.
The idea here is also to eliminate any need for a postback.</p>
<p>Hope this expains it better.</p>
| [
{
"answer_id": 403060,
"author": "Ady",
"author_id": 31395,
"author_profile": "https://Stackoverflow.com/users/31395",
"pm_score": 0,
"selected": false,
"text": " <a href=\"javascript:doSomething();\">Click Me</a>\n var oControls = new Array();\n\ndoSomething = function() {\n for(var i... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403048",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47036/"
] |
403,058 | <p>Say you have these two methods: </p>
<p>Number 1:</p>
<pre><code>void AddPerson(Person person)
{
// Validate person
if(person.Name != null && IsValidDate(person.BirthDate)
DB.AddPersonToDatabase(person);
}
</code></pre>
<p>Number 2:</p>
<pre><code>void AddPerson(string name, DateTime birthDate)
{
Person p = new Person(name, birthDate);
DB.AddPersonToDatabase(person);
}
</code></pre>
<p>Which of the two methods is the best one? I know the first one is more correct OO-wise, but I feel the second is more readable, and you don't have to make sure the object is valid as the parameters make sure of this. I just don't like to having to validate the objects anywhere I pass them as parameters. Are there other approaches?</p>
<p>EDIT:
Thx for all the answers. To clarify, validating in the constructor and a IsValid method is of course a good approach, but in my code the valid state of the person is often dependant of the context and could vary from method to method. This could of course be a sign of bad design.</p>
<p>The code is just a example to describe the problem.</p>
| [
{
"answer_id": 403070,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 4,
"selected": true,
"text": "Person person Person"
},
{
"answer_id": 403071,
"author": "Greg Beech",
"author_id": 13552,
"author_p... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403058",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29519/"
] |
403,088 | <p>Expression trees are a nice feature, but what are its practical uses? Can they be used for some sort of code generation or metaprogramming or some such?</p>
| [
{
"answer_id": 403216,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 6,
"selected": false,
"text": "Delegate.CreateDelegate Expression Reflection.Emit Expression"
},
{
"answer_id": 403233,
"author": "mattr... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403088",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9476/"
] |
403,112 | <p>I have the following example class:</p>
<p>Test.h:</p>
<pre><code>@interface Test : UIButton {
NSString *value;
}
- (id)initWithValue:(NSString *)newValue;
@property(copy) NSString *value;
</code></pre>
<p>Test.m:</p>
<pre><code>@implementation Test
@synthesize value;
- (id)initWithValue:(NSString *)newValue {
[super init];
NSLog(@"before nil value has retain count of %d", [value retainCount]);
value = nil;
NSLog(@"on nil value has retain count of %d", [value retainCount]);
value = newValue;
NSLog(@"after init value has retain count of %d", [value retainCount]);
return self;
}
</code></pre>
<p>Which produces the following output:</p>
<pre><code>2008-12-31 09:31:41.755 Concentration[18604:20b] before nil value has retain count of 0
2008-12-31 09:31:41.756 Concentration[18604:20b] on nil value has retain count of 0
2008-12-31 09:31:41.757 Concentration[18604:20b] after init value has retain count of 2147483647
</code></pre>
<p>I am calling it like:</p>
<pre><code>Test *test = [[Test alloc] initWithValue:@"some text"];
</code></pre>
<p>Shouldn't value have a retain count of 1? What am I missing? </p>
<p>Thanks for your help.</p>
| [
{
"answer_id": 403169,
"author": "Stefan Tannenbaum",
"author_id": 50511,
"author_profile": "https://Stackoverflow.com/users/50511",
"pm_score": 4,
"selected": false,
"text": "NSString* string = [[NSString alloc] initWithString: @\"some text\"];\nTest* test = [[Test alloc] initWithValue:... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403112",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
403,135 | <p>Quick synopsis:</p>
<p>The guys on my team have been working on a production database (sql server 2005). We've added various things such as constraints, added triggers, etc.</p>
<p>Now we've found that someone or something has been rolling back our changes at various times. Problem is we all share a common admin login. (dumb, yeah I know, we're fixing this). Its causing tons of frustration, at this point we just want to find out whodunnit.</p>
<p>How would you go about tracking down the guilty party?</p>
<p>NOTE: I'm NOT looking for a way to fix this, that's already being done. I'm looking for a way to track down the culprit.</p>
| [
{
"answer_id": 403157,
"author": "Mitch Wheat",
"author_id": 16076,
"author_profile": "https://Stackoverflow.com/users/16076",
"pm_score": 2,
"selected": false,
"text": "sys.traces SELECT *\nFROM sys.traces\nWHERE id = 1\n"
}
] | 2008/12/31 | [
"https://Stackoverflow.com/questions/403135",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/750/"
] |
403,165 | <p>For some reason, onreadystatechange call back function is not being called in asynchronous mode. I tested the post in synchronous mode and confirmed that post itself is working fine (commented out testing code I used to check post in synchronous mode). The problem occurs both in safari and firefox latest version. Can someone please tell me what I am doing wrong here? Thank you.</p>
<pre><code> <html>
<head>
<script>
function recordScore(str)
{
if (str.length==0)
{
return;
}
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
{
alert ("Your browser does not support AJAX!");
return;
}
var url="http://hellworld3.appspot.com/findcountry";
var params = "screenname="+document.getElementById("screenname1").value+"&score="+document.getElementById("score1").value;
alert("params: "+params);
xmlHttp.open("POST",url,true);
xmlHttp.onreadystatechange = function()
{
alert("entered call back function. readstate value is: "+xmlHttpreadyState+". Response Text is: "+xmlHttp.responseText);
if (xmlHttp.readyState==4)
{
document.getElementById("message").innerHTML=xmlHttp.responseText;
}
}
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded")
xmlHttp.send(params);
//Testing code for synchronous mode
//alert("Http get status is: "+xmlHttp.status);
//alert("Http ready state value is: "+xmlHttp.readyState);
//alert("Http get response text is: "+xmlHttp.responseText);
//document.getElementById("message").innerHTML=xmlHttp.responseText;
}
function GetXmlHttpObject()
{
var xmlHttp=null;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}
</script>
</head>
<body>
<form name="testform">
Screename:
<input type="text" id="screenname1" name="screenname">
<br/>
Score:
<input type="text" id="score1" name="score" onchange="recordScore(this.value)">
<br/>
<p id="message">test</p>
<input type="submit" value="Submit">
</form>
</body>
</html>
</code></pre>
| [
{
"answer_id": 403231,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "xmlHttp.setRequestHeader(\"Content-type\", \"application/x-www-form-urlencoded\");\nxmlHttp.setRequestHeader('Content-length',... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403165",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/50510/"
] |
403,174 | <p>Is it possible to convert a .pfx (Personal Information Exchange) file to a .cer (Security Certificate) file? Unless I'm mistaken, isn't a .cer somehow embedded inside a .pfx? I'd like some way to extract it, if possible.</p>
| [
{
"answer_id": 405545,
"author": "Berk D. Demir",
"author_id": 49709,
"author_profile": "https://Stackoverflow.com/users/49709",
"pm_score": 8,
"selected": false,
"text": "openssl pkcs12 -in input.pfx -out mycerts.crt -nokeys -clcerts\n openssl x509 -inform pem -in mycerts.crt -outform d... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403174",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47645/"
] |
403,202 | <p>I need to show a screen or something, saying 'Loading' or whatever while long process are working.</p>
<p>I am creating a application with the Windows Media Encoder SDK and it takes awhile to initialize the encoder. I would like for a screen to pop up saying 'Loading' while it is starting the encoder, and then for it to disappear when the encoder is done and they can continue with the application.</p>
<p>Any help would be appreciated. Thanks!</p>
| [
{
"answer_id": 403281,
"author": "Tom Anderson",
"author_id": 13502,
"author_profile": "https://Stackoverflow.com/users/13502",
"pm_score": 0,
"selected": false,
"text": "Application.DoEvents()"
},
{
"answer_id": 403292,
"author": "OwenP",
"author_id": 2547,
"author_p... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403202",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48654/"
] |
403,215 | <p>I have code that looks like:</p>
<pre><code> //System.Data.IDataRecord dr
try
{
Consolidated = Utility.NullConvert.ToBool(dr[Constants.Data.Columns.cConsolidated], false);
}
catch (IndexOutOfRangeException) { } //swallow
</code></pre>
<p>I don't know if the consolidated column will be present in the datareader, so I do that to check. It works fine (is a little hackish, though).</p>
<p>When I attach a debugger though, it breaks on that whenever it throws the exception however. Extremely annoying.</p>
<p>Is there a better way to write that code; or is there some Visual Studio way of telling it to ignore the exception and not break (but only right here; not everywhere).</p>
| [
{
"answer_id": 403251,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 2,
"selected": false,
"text": "GetOrdinal() >=0"
},
{
"answer_id": 834365,
"author": "Kevin Dark",
"author_id": 26151,
"author_p... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403215",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8435/"
] |
403,218 | <hr>
<h2>The Question</h2>
<p>My question is: <strong>Does C# nativly support late-binding IDispatch?</strong></p>
<hr>
<p><em>Pretend</em> i'm trying to automate Office, while being compatible with whatever version the customer has installed. </p>
<p>In the .NET world if you developed with Office 2000 installed, every developer, and every customer, from now until the end of time, is required to have Office 2000.</p>
<p>In the world before .NET, we used <strong>COM</strong> to talk to Office applications. </p>
<p>For example:</p>
<p>1) Use the version independant ProgID</p>
<pre><code>"Excel.Application"
</code></pre>
<p>which resolves to:</p>
<pre><code>clsid = {00024500-0000-0000-C000-000000000046}
</code></pre>
<p>and then using COM, we ask for one of these classes to be instantiated into an object:</p>
<pre><code>IUnknown unk;
CoCreateInstance(
clsid,
null,
CLSCTX_INPROC_SERVER | CLSCTX_LOCAL_SERVER,
IUnknown,
out unk);
</code></pre>
<p>And now we're off to the races - able to use Excel from inside my application. Of course, if <em>really</em> you want to use the object, you have to call have some way of calling methods. </p>
<p>We <em>could</em> get ahold of the various <strong>interface</strong> declarations, translated into our language. This technique is good because we get </p>
<ul>
<li>early binding</li>
<li>code-insight </li>
<li>compile type syntax checking</li>
</ul>
<p>and some example code might be:</p>
<pre><code>Application xl = (IExcelApplication)unk;
ExcelWorkbook workbook = xl.Workbooks.Add(template, lcid);
Worksheet worksheet = workbook.ActiveSheet;
</code></pre>
<hr>
<p>But there is a downside of using interfaces: we have to get ahold of the various interface declarations, transated into our language. And we're stuck using method-based invocations, having to specify all parameters, e.g.:</p>
<pre><code>ExcelWorkbook workbook = xl.Workbooks.Add(template, lcid);
xl.Worksheets.Add(before, after, count, type, lcid);
</code></pre>
<p>This has proved, in the real world, to have such downsides that we would willingly give up:</p>
<ul>
<li>early binding</li>
<li>code-insight</li>
<li>compile time syntax checking</li>
</ul>
<p>and instead use <strong>IDispatch</strong> late binding:</p>
<pre><code>Variant xl = (IDispatch)unk;
Variant newWorksheet = xl.Worksheets.Add();
</code></pre>
<p>Because Excel automation was designed for VB Script, a lot of parameters can be ommitted, even when there is no overload without them.</p>
<p><strong>Note:</strong> Don't confuse my example of Excel with a reason of why i want to use IDispatch. Not every COM object is Excel. Some COM objects have no support other than through IDispatch.</p>
| [
{
"answer_id": 403226,
"author": "configurator",
"author_id": 9536,
"author_profile": "https://Stackoverflow.com/users/9536",
"pm_score": 3,
"selected": false,
"text": "dynamic"
},
{
"answer_id": 489272,
"author": "Ian Boyd",
"author_id": 12597,
"author_profile": "htt... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403218",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12597/"
] |
403,239 | <p>I want to move a file with Ruby. How do I do that?</p>
| [
{
"answer_id": 403246,
"author": "Željko Filipin",
"author_id": 17469,
"author_profile": "https://Stackoverflow.com/users/17469",
"pm_score": 4,
"selected": false,
"text": "require 'fileutils'\nFileUtils.move 'stuff.rb', '/notexist/lib/ruby'\n"
},
{
"answer_id": 403257,
"auth... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403239",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17469/"
] |
403,256 | <p>I'm trying to access an XML file within a jar file, from a separate jar that's running as a desktop application. I can get the URL to the file I need, but when I pass that to a FileReader (as a String) I get a FileNotFoundException saying "The file name, directory name, or volume label syntax is incorrect."</p>
<p>As a point of reference, I have no trouble reading image resources from the same jar, passing the URL to an ImageIcon constructor. This seems to indicate that the method I'm using to get the URL is correct.</p>
<pre><code>URL url = getClass().getResource("/xxx/xxx/xxx/services.xml");
ServicesLoader jsl = new ServicesLoader( url.toString() );
</code></pre>
<p>Inside the ServicesLoader class I have </p>
<pre><code>XMLReader xr = XMLReaderFactory.createXMLReader();
xr.setContentHandler( this );
xr.setErrorHandler( this );
xr.parse( new InputSource( new FileReader( filename )));
</code></pre>
<p>What's wrong with using this technique to read the XML file?</p>
| [
{
"answer_id": 403271,
"author": "duffymo",
"author_id": 37213,
"author_profile": "https://Stackoverflow.com/users/37213",
"pm_score": 3,
"selected": false,
"text": "getResourceAsStream()"
},
{
"answer_id": 403276,
"author": "iny",
"author_id": 27067,
"author_profile"... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403256",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1288/"
] |
403,279 | <p>I am not an experimented user of SCM tools, even though I am convinced of their usefulness, of course.
I used some obscure commercial tool in a former job, Perforce in the current one, and played a bit with TortoiseSVN for my little personal projects, but I disliked having lot of .svn folders all over the place, making searches, backups and such more difficult.
Then I discovered the interest of distributed SCM and I chose to go the apparently simpler (than git) Mercurial way, still for my personal, individual needs. I am in the process of learning to use it properly, having read part of the wiki and being in the middle of the excellent PDF book.</p>
<p>I see often repeated, for example in <a href="http://www.selenic.com/mercurial/wiki/index.cgi/WorkingPractices?highlight=%28practices%29" rel="nofollow noreferrer" title="Mercurial working practices">Mercurial working practices</a>, "<em>don't hesitate to use multiple trees locally. Mercurial makes this fast and light-weight.</em>" and "<em>for each feature you work on, create a new tree.</em>".
These are interesting and sensible advices, but they hurt a bit my little habits with centralized SCM, where we have a "holy" central repository where branches are carefully planned (and handled by administrators), changelists must be checked by (senior) peers and must not break the builds, etc. :-) Starting to work on a new branch takes quite some time...</p>
<p>So I have two questions in the light of above:</p>
<ul>
<li><p>How practical is it to do lot of clones, in the context of IDEs and such? What if the project has configuration/settings files, makefiles or Ant scripts or shell scripts or whatever, needing path updates? (yes, probably a bad idea...) For example, in Eclipse, if I want to compile and run a clone, I have to do yet another project, tweaking the Java build path, the Run/Debug targets, and so on. Unless an Eclipse plugin ease that task. Do I miss some facility here?</p></li>
<li><p>How do that scale? I have read Hg is OK for large code bases, but I am perplex. At my job, we have a Java application (well, several around a big common kernel) of some 2 millions of lines, weighting some 110MB for code alone. Doing a clean compile on my old (2004) Windows workstation takes some 15 minutes to generate the 50MB of class files! I don't see myself cloning the whole project to change 3 files. So what are the practices here?</p></li>
</ul>
<p>I haven't yet seen these questions addressed in my readings, so I hope this will make a useful thread.</p>
| [
{
"answer_id": 407938,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 2,
"selected": false,
"text": "hg clone toto toto-bug-434\n cd toto\nhg branch bug-434\nhg update bug-434\n...\nhg commit\nhg update default\n"
}
] | 2008/12/31 | [
"https://Stackoverflow.com/questions/403279",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15459/"
] |
403,291 | <p>I have a table, with 2 important columns DocEntry, WebId</p>
<p>Sample data is like</p>
<pre><code>DocEntry WebId
1 S001
2 S002
3 S003
4 S005
</code></pre>
<p>Now as we can notice here, in column WebId, S004 is missing. How can we locate such missing numbers, with a query.</p>
<p>Further explanation:</p>
<p>The web id should be in increasing order like, S001, S002, S003, S004, S005 if any number in between is missing, than that is the missing number. I do not have any separate table for the possible entries, as that is not practical. I've to find the missing numbers on a month to month basis, taking the starting and ending value of each month as the boundaries and than finding the missing numbers, if any.</p>
| [
{
"answer_id": 403319,
"author": "Rob",
"author_id": 12413,
"author_profile": "https://Stackoverflow.com/users/12413",
"pm_score": 0,
"selected": false,
"text": "SELECT pe.WebID from PossibleEntries pe \nWHERE pe.WebID Not In (Select WebID from SampleData)\n"
},
{
"answer_id": 40... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403291",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49372/"
] |
403,303 | <p>I have these page <a href="http://www.elseptimoarte.net/" rel="nofollow noreferrer">http://www.elseptimoarte.net/</a>. The page have a search field, If I put for instance "batman" it give me some searchs results with a url of every result:
<a href="http://www.elseptimoarte.net/busquedas.html?cx=003284578463992023034%3Alraatm7pya0&cof=FORID%3A11&ie=ISO-8859-1&oe=ISO-8859-1&q=batman#978" rel="nofollow noreferrer">http://www.elseptimoarte.net/busquedas.html?cx=003284578463992023034%3Alraatm7pya0&cof=FORID%3A11&ie=ISO-8859-1&oe=ISO-8859-1&q=batman#978</a></p>
<p>I would like to parse the html code to get the url for example of the firse link:
Example: www.elseptimoarte.net/peliculas/batman-begins-1266.html</p>
<p>The problem it is that I use curl (in bash) but when I do a curl -L -s <a href="http://www.elseptimoarte.net/busquedas.html?cx=003284578463992023034%3Alraatm7pya0&cof=FORID%3A11&ie=ISO-8859-1&oe=ISO-8859-1&q=batman#978" rel="nofollow noreferrer">http://www.elseptimoarte.net/busquedas.html?cx=003284578463992023034%3Alraatm7pya0&cof=FORID%3A11&ie=ISO-8859-1&oe=ISO-8859-1&q=batman#978</a> it doesn't give the link.</p>
<p>Any help?</p>
<p>Many thanks and sorry for my english!</p>
| [
{
"answer_id": 403391,
"author": "Parker",
"author_id": 42562,
"author_profile": "https://Stackoverflow.com/users/42562",
"pm_score": 1,
"selected": false,
"text": "$ wget -U 'Mozilla/5.0' -O - 'http://www.google.com/search?q=batman+site%3Awww.elseptimoarte.net' | sed 's/</\\\n</g' | sed... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403303",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
403,333 | <p>I was wondering what the general consensus on error messages was. How detailed should they be?</p>
<p>I've worked on projects where there was a different error message for entering a number that was too big, too small, had a decimal, was a string, etc. That was quite nice for the user as they knew exactly where things went wrong, but the error handling code started to rival the actual business logic in size, and started to develop some of its own bugs.</p>
<p>On the other side I've worked on a project where you'd get very generic errors such as </p>
<blockquote>
<p>COMPILE FAILED REASON 3</p>
</blockquote>
<p>Which needless to say was almost entirely useless as reason 3 turned out to mean a link error.</p>
<p>So where is the middle ground? How do I know if I've added descriptive enough error messages? How do I know if the user will be able to understand where they've gone wrong?</p>
| [
{
"answer_id": 403357,
"author": "luiscubal",
"author_id": 32775,
"author_profile": "https://Stackoverflow.com/users/32775",
"pm_score": 2,
"selected": false,
"text": "COMPILE FAILED REASON 3"
},
{
"answer_id": 403371,
"author": "iny",
"author_id": 27067,
"author_prof... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403333",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4218/"
] |
403,336 | <p>I have: "image" 1:Many "imageToTag" Many:1 "tag"</p>
<p>I want to issue a query that will return all images that have <em>at least</em> tags [a, b, c]. It's not clear to me how one can model this in JPQL. I could build the query string dynamically but that's bad for performance and security reasons. Any ideas?</p>
| [
{
"answer_id": 504243,
"author": "Noah",
"author_id": 12113,
"author_profile": "https://Stackoverflow.com/users/12113",
"pm_score": 3,
"selected": true,
"text": "SELECT * FROM IMAGES \n INNER JOIN IMAGETAGS A\n ON IMAGE.ID = A.IMAGEID AND A.TAGID = 'A'\n INNER JOIN IMAGETAGS B\n ... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403336",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14731/"
] |
403,349 | <p>Why does the following code NOT give an error, nor any type of a warning about an implicit conversion?</p>
<pre><code>std::wstring str = L"hi";
if(str[0] == 'h')
cout<<"strange"<<endl;
</code></pre>
<p>The proper normal code is:</p>
<pre><code>std::wstring str = L"hi";
if(str[0] == L'h')
cout<<"strange"<<endl;
</code></pre>
<p>Compiler: visual studio 2005</p>
<p>Warning level: level 4 (highest)</p>
| [
{
"answer_id": 403368,
"author": "ChrisW",
"author_id": 49942,
"author_profile": "https://Stackoverflow.com/users/49942",
"pm_score": 2,
"selected": false,
"text": "if (str[0] == 104) //C++ allows various implicit type conversions\n"
},
{
"answer_id": 406871,
"author": "MSalt... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403349",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3153/"
] |
403,351 | <p>I want to use firebug to debug and help be quickly finish some XSLT layout issues, but I cannot get the following code to perform and display the client side XSLT in Firefox (everything is fine in IE):</p>
<pre><code>$().ready(function() {
var oXMLHTTP
var oXSLT
if ($.browser.mozilla){
oXMLHTTP = document.implementation.createDocument("","",null);
oXSLT = document.implementation.createDocument("","",null);
}else{
oXMLHTTP = new ActiveXObject("Microsoft.XMLDOM");
oXSLT = new ActiveXObject("Microsoft.XMLDOM");
}
oXMLHTTP.async = false;
oXSLT.async = false;
oXSLT.load('Layout.xslt');
var sURL = "somepage"
/**/
$.get(sURL,function(data){
var sTranformedXML = "";
if ($.browser.mozilla){
oXMLHTTP.load(data);
var xsltProcessor = new XSLTProcessor();
xsltProcessor.importStylesheet(oXSLT);
var mDoc = document.implementation.createDocument("","",null);
sTranformedXML = xsltProcessor.transformToFragment(oXMLHTTP,mDoc);
}else{
oXMLHTTP.loadXML(data);
sTranformedXML = oXMLHTTP.transformNode(oXSLT)
}
$("#main").html(sTranformedXML);
$("#tbl_Not Grouped").insertAfter("tbl_Social Sciences");
})// $.get
})
</code></pre>
<p>Is there something that I have overlooked here?</p>
<p>I really only need the Firefox code testing. So, it does not need to be pretty.</p>
| [
{
"answer_id": 403368,
"author": "ChrisW",
"author_id": 49942,
"author_profile": "https://Stackoverflow.com/users/49942",
"pm_score": 2,
"selected": false,
"text": "if (str[0] == 104) //C++ allows various implicit type conversions\n"
},
{
"answer_id": 406871,
"author": "MSalt... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403351",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
403,365 | <p>I am currently stuck in the design of this solution.</p>
<p>The data layer design consists of the following:</p>
<ul>
<li>Recipe (parent high level object)
<ul>
<li>Language Detail (name, description by language) (many)
<ul>
<li>Headers (many)</li>
<li>Steps (many)
<ul>
<li>Ingredients (many)</li>
<li>Quantities (many)</li>
<li>Procedures (many)</li>
</ul></li>
<li>Notes (many)</li>
</ul></li>
</ul></li>
</ul>
<p>The challenge that I am having is how to create a data access design that will add/remove the child objects in the database when the object is populated from a WCF SaveRecipe(recipe) method?</p>
<p>This all stems from the management asking us to add a communications layer in our application, right now our UI is coupled to our business layer, and the BL is directly coupled to the DAL, we basically need the injection of WCF between the BL and DAL.</p>
<p>I have read in <a href="https://stackoverflow.com/questions/135339/linqtosql-and-wcf">this thread</a> that using L2S isn't a good idea over WCF, but since the design isn't new, we have to use this type of methodology, and then move away from it once we can refactor the heavy amounts of UI work.</p>
| [
{
"answer_id": 403392,
"author": "thaBadDawg",
"author_id": 48832,
"author_profile": "https://Stackoverflow.com/users/48832",
"pm_score": 4,
"selected": true,
"text": "[DataContract]\npublic class Recipe {\n\n [DataMember]\n public string Name { get; set; }\n\n [DataMember]\n ... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403365",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13502/"
] |
403,372 | <p>How can I rotate a pdf document using php and linux?</p>
| [
{
"answer_id": 572281,
"author": "hmoyat",
"author_id": 69222,
"author_profile": "https://Stackoverflow.com/users/69222",
"pm_score": 2,
"selected": false,
"text": " $command = \"pdftk in.pdf cat 1-endS output out.pdf\";\n system($command);\n"
}
] | 2008/12/31 | [
"https://Stackoverflow.com/questions/403372",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
403,378 | <p>new to Java. I want to use the org.apache.commons.lang.WordUtils package. Tried importing it. Tried downloading it and adding it to my build path. When I use intellisense for the word <code>WordUtils</code> Eclipse auto puts the import statement at the top of the file.</p>
<p>I get the following error when compiling:</p>
<pre>
ConvertToUrl.java:3: package org.apache.commons.lang
import org.apache.commons.lang.WordUtils;
^
ConvertToUrl.java:36: cannot find symbol
symbol : variable WordUtils
location: class d6.common.ConvertToUrl
url = WordUtils.capitalizeFully(url);
^
2 errors
</pre>
<p>And when I remove the import statement at the top I get:</p>
<pre>
ConvertToUrl.java:34: cannot find symbol
symbol : variable WordUtils
location: class d6.common.ConvertToUrl
url = WordUtils.capitalizeFully(url);
^
1 error
</pre>
<p>Thanks</p>
| [
{
"answer_id": 403461,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 1,
"selected": false,
"text": "import org.apache.commons.lang.WordUtils;\n package d6.common;\n\npublic class ConvertToUrl {\n private static String url;\... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403378",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
403,379 | <p>I want to get an 'event' before tomcat stops my web application.<br>
My application needs to "wrap up" stuff before it is being closed.</p>
| [
{
"answer_id": 404138,
"author": "Yonatan Maman",
"author_id": 20065,
"author_profile": "https://Stackoverflow.com/users/20065",
"pm_score": 3,
"selected": true,
"text": "public void destroy();\n"
},
{
"answer_id": 8955302,
"author": "sourcedelica",
"author_id": 158658,
... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403379",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20065/"
] |
403,394 | <p>First off, I would like to ask if any of you know of an encryption algorithm that uses a key to encrypt the data, but no key to decrypt the data. This seems highly unlikely, if not impossible to me, so sorry if it's a stupid question. </p>
<p>My final question is, say you have access to the plain text data before it is encrypted, the key used to encrypt the plain text data, and the resulting encrypted data, would figuring out which algorithm used to encrypt the data be feasible?</p>
| [
{
"answer_id": 404420,
"author": "Zach Scrivena",
"author_id": 20029,
"author_profile": "https://Stackoverflow.com/users/20029",
"pm_score": 3,
"selected": false,
"text": " -------------------\nplaintext ---> | algorithm & key | ---> ciphertext\n -------------... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403394",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/50530/"
] |
403,398 | <p>I'm trying to connect a C# application (using Visual C# 2008 Express Edition) to a remote MySQL server. I have the drivers for this, but when I followed the tutorials (including adding the pooling and connection reset properties), I get an error that: <em>Object reference not set to an instance of an object.</em> I've included the two lines of code that should be making a connection. The error is thrown on the second line.</p>
<pre><code> MySqlConnection connect = new MySqlConnection("database=d*******;Data Source=mysql.netfirms.com;user id=*******;pwd=*****;pooling=false;connection reset=false");
connect.Open();
</code></pre>
| [
{
"answer_id": 403566,
"author": "Ricardo Villamil",
"author_id": 19314,
"author_profile": "https://Stackoverflow.com/users/19314",
"pm_score": 3,
"selected": true,
"text": "MySqlConnection connect = new MySqlConnection();\n//Do you get the null exception in this next line?\nconnect.Conn... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403398",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23249/"
] |
403,408 | <p>I'm new to unit testing using nunit (and Java development in general). When creating unit tests for private methods on classes, it looks as though the test file must be in the same package as the class being tested. What is the typical way of avoiding exporting the APIs of the unit tests? Can I make the classes/test methods package-protected? Or do developers typically have a separate build for release that excludes unit test files?</p>
| [
{
"answer_id": 405856,
"author": "Limbic System",
"author_id": 1274957,
"author_profile": "https://Stackoverflow.com/users/1274957",
"pm_score": 0,
"selected": false,
"text": "src/main/java/com/example/Foo.java\nsrc/test/java/com/example/FooTest.java\n src/test/**"
}
] | 2008/12/31 | [
"https://Stackoverflow.com/questions/403408",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42562/"
] |
403,411 | <p>When a Delphi 2009 project is closed with ShellTreeView/ShellListView on the mainform in the IDE Index out of bounds(0) exceptions are generated. Is there a fix for ShellTreeView/ShellListView so the exceptions can be eliminated?</p>
| [
{
"answer_id": 403471,
"author": "Roddy",
"author_id": 1737,
"author_profile": "https://Stackoverflow.com/users/1737",
"pm_score": 2,
"selected": false,
"text": "function TCustomShellListView.GetFolder(Index: Integer): TShellFolder;\nbegin\n if Index < FFolders.Count then\n Result :=... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403411",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
403,419 | <p>I have dropdown list control in one of my application and when I add Items in it from database Its displaying the first Item into Dropdown list by default but I want to display someother text into this like "Select Item from the List" Is there any way I can do this .</p>
<p>Also Can you please help me setting the same value from javascript </p>
| [
{
"answer_id": 403447,
"author": "patridge",
"author_id": 48700,
"author_profile": "https://Stackoverflow.com/users/48700",
"pm_score": 4,
"selected": true,
"text": "<asp:DropDownList AppendDataBoundItems=\"true\" ID=\"yourListId\" runat=\"server\">\n <asp:ListItem Text=\"Select somet... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403419",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14299/"
] |
403,421 | <p>I have a list of Python objects that I want to sort by a specific attribute of each object:</p>
<pre><code>>>> ut
[Tag(name="toe", count=10), Tag(name="leg", count=2), ...]
</code></pre>
<p>How do I sort the list by <code>.count</code> in descending order?</p>
| [
{
"answer_id": 403426,
"author": "Kenan Banks",
"author_id": 43089,
"author_profile": "https://Stackoverflow.com/users/43089",
"pm_score": 12,
"selected": true,
"text": "# To sort the list in place...\nut.sort(key=lambda x: x.count, reverse=True)\n\n# To return a new list, use the sorted... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403421",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22468/"
] |
403,433 | <p>I have a small problem with a program that im writing. I have a table - stocks which contains information(products, barcodes etc.) about items stored in a fridge. I then have another table - shop which acts like a shop,containing loads of products and their barcodes.some of the products in the shop table are in the stock table at the moment, and there is a boolenan field called stock which tells us if that product is in the stock table or not, if its equal to 1, it is in the fridge, if it is equal to 0, it is not in the fridge. Two fields in the stocks table are amount and quantity. The amount is what is in the fridge at the moment, the quantity is what has to be in the fridge at all times. When something is taken out of the fridge, that product's amount amount drops by 1. Each barcode in the stocks table has a matching one in the shop table. I need to make a query to the database from a python program which will order products from the shops table when the amount (whats in the fridge) is less than the quantity (whats meant to be in the fridge at all times). So you need to take the barcode of a row in the stocks table where the amount is less than the quantity and match that up to the barcode in the shops table. Then in the row of that matching barcode you need to set stock = 1.</p>
<p>I would be really happy if somebody could help me with this as I really am finding it difficult to write this function. Below is the checkin and checkout functions if that will help.</p>
<p><strong>checkin</strong></p>
<pre><code>def check_in():
db = MySQLdb.connect(host='localhost', user='root', passwd='$$', db='fillmyfridge')
cursor=db.cursor(MySQLdb.cursors.DictCursor)
user_input=raw_input('please enter the product barcode that you wish to checkin to the fridge: \n')
cursor.execute("""update shop set stock = 1 where barcode = %s""", (user_input))
db.commit()
numrows = int(cursor.rowcount)
if numrows >= 1:
row = cursor.fetchone()
print row["product"]
cursor.execute('update stock set amount = amount + 1 where product = %s', row["product"])
db.commit()
cursor.execute('udpate shop set stock = 1 where barcode = user_input')
db.commit()
else:
new_prodname = raw_input('what is the name of the product and press enter: \n')
cursor.execute('insert into shop (product, barcode, category) values (%s, %s, %s)', (new_prodname, user_input, new_prodname))
cursor = db.cursor()
query = ('select * from shop where product = %s', (new_prodname))
cursor.execute(query):
db.commit()
numrows = int(cursor.rowcount)
if numrows<1:
cursor.execute('insert into atock (barcode, quantity, amount, product) values (%s, 1, 1, %s)', (user_input, new_prodname))
db.commit()
cursor.execute('insert into shop (product, barcode, category, stock) values (%s, %s, %s, 1)', (new_prodname, user_input, new_prodname))
print new_prodname
print 'has been added to the fridge stock'
else:
cursor.execute('update atock set amount = amount + 1 where product = %s', (new_prodname))
db.commit()
cursor.execute('insert into shop (product, barcode, category, stock) values (%s, %s, %s, 1)', (new_prodname, user_input, new_prodname))
print new_prodname
print 'has been added to the fridge stock'
</code></pre>
<p><strong>checkout</strong></p>
<pre><code>import MySQLdb
def check_out():
db = MySQLdb.connect(host='localhost', user='root', passwd='$$', db='fillmyfridge')
cursor=db.cursor()
user_input=raw_input('please enter the product barcode you wish to remove from the fridge: \n')
query = cursor.execute('update stock set instock=0, howmanytoorder=howmanytoorder + 1, amount = amount - 1 where barcode = %s', (user_input))
if cursor.execute(query):
db.commit()
print 'the following product has been removed from the fridge nd needs to be ordered'
cursor.execute('update shop set stock = 0 where barcode = %s' (user_input)
db.commit()
else:
return 0
</code></pre>
| [
{
"answer_id": 403493,
"author": "Simon Lehmann",
"author_id": 27011,
"author_profile": "https://Stackoverflow.com/users/27011",
"pm_score": 1,
"selected": false,
"text": "SELECT barcode, ... FROM Stock ST JOIN Shop SH ON ST.barcode = SH.barcode;\n SELECT barcode FROM Stock ST WHERE ST.a... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403433",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47204/"
] |
403,441 | <p>We use EJB2.x entity beans with BMP (bean managed persistence). It appears BMP is not supported in EJB3. We had wanted to stay current and upgrade to EJB3. Does anyone know if there are in fact any BMP options available in 3.0?</p>
<p>From what I can tell, using 3.0, all entity beans have to use JPA and by definition ORM. There are some options to use native SQL but that is still just a way to use JPA to implement ORM.</p>
<p>I wasn't sure if there is another EJB3 approach to achieve the same functionality as with EJB2.x BMP entity beans. We currently use the standard ejbStore method to update the DB through native SQL and the ejbLoad method to lookup all beans and to refresh the bean in the event of a transaction rollback. I thought you might be able to do this with EJB3 session beans but I wasn't sure.</p>
<p>Perhaps instead of migrating to EJB3 beans we should migrate to Spring.</p>
| [
{
"answer_id": 403493,
"author": "Simon Lehmann",
"author_id": 27011,
"author_profile": "https://Stackoverflow.com/users/27011",
"pm_score": 1,
"selected": false,
"text": "SELECT barcode, ... FROM Stock ST JOIN Shop SH ON ST.barcode = SH.barcode;\n SELECT barcode FROM Stock ST WHERE ST.a... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403441",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47281/"
] |
403,443 | <p>I've just setup Database mail within MSSQL 2005. I have been able to send email from an administrator account on the server and through a SQL Server Agent job. But, I unable to send email when I tried to send email via a login that just has access to a database for our web application.</p>
<p>What is the best way to set up access to Database Mail?</p>
<p>I have 2 senerios where I want to send email.</p>
<ol>
<li>Schedule a job through SQL Server Agent to run a Stored Procedure that does some process and then sends an email. (this hasn't been a problem)</li>
<li>Have a stored procedure invoked from a web application that calls another stored procedure which could send an email. (this is were my permissions issue is)</li>
</ol>
<p><strong><em>Possible Solutions</em></strong></p>
<ol>
<li><p>The only way that I have found to grant permission to a login is to map the login to the <strong>msdb</strong> database and grant the <strong>public</strong> and <strong>DatabaseMailUserRole</strong>. This really concerns me as I would assume that this gives to much access to the <strong>msdb</strong> database.</p></li>
<li><p>Store the email I want to send in a table and then have a SQL Server Agent job look at that table every so often to send any queued emails. This way the database login for the web application does not execute the [msdb].[dbo].[sp_ send _dbmail] call and thus does not need any permission to the <strong>msdb</strong> database.</p></li>
</ol>
<p>Are there any other solutions?</p>
| [
{
"answer_id": 403650,
"author": "Gordon Bell",
"author_id": 16473,
"author_profile": "https://Stackoverflow.com/users/16473",
"pm_score": 1,
"selected": false,
"text": "CREATE PROCEDURE [dbo].[sp_SendMail]\n(\n @To nvarchar(1000),\n @Subject nvarchar(100),\n @Body nvarchar(max)... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403443",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/576/"
] |
403,445 | <p>Is there a VB.NET equivalent for C#'s <code>??</code> operator?</p>
| [
{
"answer_id": 403453,
"author": "Firas Assaad",
"author_id": 23153,
"author_profile": "https://Stackoverflow.com/users/23153",
"pm_score": 8,
"selected": true,
"text": "If() ' Variable first is a nullable type.\nDim first? As Integer = 3\nDim second As Integer = 6\n\n' Variable first <>... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403445",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18821/"
] |
403,455 | <p>When using "var" to declare variables in C#, is there boxing/unboxing taking place?</p>
<p><br />
Also is there a chance of a runtime type mis-match when using var to declare variables?</p>
| [
{
"answer_id": 403456,
"author": "configurator",
"author_id": 9536,
"author_profile": "https://Stackoverflow.com/users/9536",
"pm_score": 6,
"selected": true,
"text": "var x = 5;\n int x = 5;\n"
},
{
"answer_id": 403468,
"author": "joshperry",
"author_id": 30587,
"aut... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403455",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1443363/"
] |
403,457 | <p>For the past few years I've focused on back-end development so my javascript & css skills are lacking. I'm volunteering as a webmaster for a site and would like to spruce up the form validation (currently there is none).<br>
My problem:
Basically I have one form with a few name fields, an email address and a phone number. When the form is submitted I validate all fields. If data is invalid I would like to change that field's label color to red (similar to struts validation). What's the easiest way to do this?</p>
<p>Edit: I also have back end PHP validation. I'm looking to make it prettier and more user-friendly on the front-end. The PHP validation is located on a different server. If the validation fails on the back-end it displays a message and the user is forced to use the Back button. I'm hoping to re-direct back to the original page and display the invalid fields.</p>
| [
{
"answer_id": 403547,
"author": "Glazius",
"author_id": 34384,
"author_profile": "https://Stackoverflow.com/users/34384",
"pm_score": 1,
"selected": false,
"text": "<input type=\"text\" name=\"phone_number\" class=\"error_field\">\n 555-121\n</input>\n input.error_field { color: #FFF;... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403457",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33178/"
] |
403,478 | <p>I want to overlay one image with another using CSS. An example of this is the first image (the background if you like) will be a thumbnail link of a product, with the link opening a lightbox / popup showing a larger version of the image. </p>
<p>On top of this linked image I would like an image of a magnifying glass, to show people that the image can be clicked to enlarge it (apparently this isn't obvious without the magnifying glass).</p>
| [
{
"answer_id": 403502,
"author": "Nathan Long",
"author_id": 4376,
"author_profile": "https://Stackoverflow.com/users/4376",
"pm_score": 7,
"selected": false,
"text": "<img style=\"background:url(thumbnail1.jpg)\" src=\"magnifying_glass.png\" />\n"
},
{
"answer_id": 403510,
"... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403478",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1349865/"
] |
403,505 | <p>So I have a SQL Query as Follows</p>
<pre><code>SELECT P.Date, P.CategoryName, P.ProductName, SUM(Quantity) Quantity, SUM(Sales) TotalSales, IsLevelThree
FROM Products P LEFT JOIN LevelThreeTracking LTT
ON P.Date = LTT.Date AND P.CategoryName = P.CategoryName AND P.SecurityID = LTT.SecurityID
WHERE P.Date = '12-31-2007' AND P.CategoryName= 'CategoryName'
GROUP BY P.Date, P.CategoryName, P.ProductName, LTT.IsLevelThree
HAVING SUM(Quantity) <> 0
ORDER BY P.ProductName
</code></pre>
<p>I'm Trying to Convert it to C# LINQ syntax and have the DataContext setup with the 2 tables. I've tried a couple times at it (latest revision below) but the sql that gets generated looks monstrously complex and times out. dtpBeginning is a DateTimePicker.</p>
<pre><code>var results = from p in dbFAS.Products
group p by new {p.Date, p.CategoryName, p.ProductName}
into gp
join ltt in dbFAS.LevelThreeTracking on
new {gp.Key.Date, gp.Key.CategoryName, gp.Key.ProductName} equals
new {ltt.Date, ltt.CategoryName, ltt.ProductName} into everything
from e in everything.DefaultIfEmpty()
where gp.Key.Date == dtpBeginning.Value.Date && gp.Key.CategoryName == "CategoryName" && gp.Sum(p=>p.Quantity) != 0
select new
{
gp.Key.Date,
gp.Key.CategoryName,
gp.Key.ProductName,
Quantity = gp.Sum(hp=>hp.Quantity),
TotalSales = gp.Sum(hp=>hp.Sales),
e.Level3
};
</code></pre>
<p>Is there something simple I'm missing? Any Ideas on how to refactor the LINQ statement to get something better?</p>
| [
{
"answer_id": 403783,
"author": "Noah",
"author_id": 47496,
"author_profile": "https://Stackoverflow.com/users/47496",
"pm_score": 3,
"selected": false,
"text": "from p in dbFAS.Products\nfrom ltt in dbFAS.LevelThreeTracking\nwhere p.CategoryName == \"CategoryName\"\n && (p.Date == l... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403505",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6212/"
] |
403,509 | <p>I have a View class (OrderView.aspx) which shows the details of an order (Account Name, Order Date) as well as a list of order lines via the Repeater control. Each order line is represented by a User Control View (OrderLineView.ascx) which shows the details of the order line (Item Name, Quantity, Price). I have a model object called Order which I use as the data source for all of this, which I pass as the model object for the view.</p>
<p>Each OrderLineView user control has a Save and a Delete button. I have the Save button posting the contents of a form within the OrderLine control to a Save method on the Controller and then RedirectToAction back to the same Order page (this refreshes the whole page, nothing AJAXy about it). I have the Delete button linking to a method on the Controller that tries to delete, and then RedirectToAction back to the same Order page. If the delete fails, however, I want a little error message to show up next to the delete button when the page renders again(remember, there is a delete button for every order line on the page, so I only want the message next to the one I clicked). My questions:</p>
<p>1 - How do I pass this data from my Controller method to the specific User Control? Should I somehow add it in to the model? Seems like a bad idea (since it really isn't part of the model).</p>
<p>2 - Should I have a OrderLineController for the OrderLine operations as well as a OrderController for Order operations? I just want to know if best practice is to have a separate Controller for every view.</p>
<p>3 - I have seen how some people might call RedirectToAction with an anonymous type value like this:</p>
<pre><code>RedirectToAction("ViewOrder", new { Id = 1234, Message = "blabla"});
</code></pre>
<p>but this makes the Message value show up in the URL string. I am OK with that, but would prefer that it doesn't show if possible.</p>
<p>4 - Also, for accessing properties of the Model from within the view, I find myself doing this all of the time:</p>
<pre><code>foo(((someModelType) this.ViewData.Model).SomeProperty);
</code></pre>
<p>I don't like this for a number of reasons, one of which is the fact that I don't want my view to be coupled with the type of my model (which is why I am using ViewPage instead of ViewPage). I would much prefer to be able to have a call like this:</p>
<pre><code>foo(ModelEval("SomeProperty"));
</code></pre>
<p>Is there such a thing? I have written my own, but would like it if I didn't have to.</p>
| [
{
"answer_id": 403579,
"author": "Todd Smith",
"author_id": 31624,
"author_profile": "https://Stackoverflow.com/users/31624",
"pm_score": 1,
"selected": false,
"text": "public ActionResult Delete(int? Id)\n{\n ModelState.AddModelError(\"OrderLine\" + Id.Value, \"Error deleting OrderLi... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403509",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14101/"
] |
403,516 | <p>I have a template I made that sets variables that rarely change, call my headers, calls my banner and sidebar, loads a variable which shows the individual pages, then calls the footer. In one of my headers, I want the URL of the page in the user's address bar. Is there a way to do this?</p>
<p>Currently:</p>
<pre><code><?php
$title = "MySite - Contacts";
include("header.php");
.
.
.
?>
</code></pre>
| [
{
"answer_id": 403532,
"author": "Greg",
"author_id": 24181,
"author_profile": "https://Stackoverflow.com/users/24181",
"pm_score": 0,
"selected": false,
"text": "$_SERVER['REQUEST_URI']"
},
{
"answer_id": 403636,
"author": "stuartloxton",
"author_id": 313002,
"author... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403516",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/50544/"
] |
403,527 | <p>I'm wondering, is it possible to make an sql query that does the same function as
<code>'select products where barcode in table1 = barcode in table2</code>'. I am writing this function in a python program. Once that function is called will the table be joined permanently or just while that function is running?
thanks. </p>
| [
{
"answer_id": 403530,
"author": "Ryan Smith",
"author_id": 10420,
"author_profile": "https://Stackoverflow.com/users/10420",
"pm_score": 1,
"selected": false,
"text": "SELECT * FROM table1 WHERE barcode IN (SELECT barcode FROM table2)\n"
},
{
"answer_id": 403535,
"author": "... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403527",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47204/"
] |
403,539 | <p>What are extension methods in .NET?</p>
<p><br /><br/></p>
<p>EDIT:
I have posted a follow up question at <a href="https://stackoverflow.com/questions/403619/usage-of-extension-methods">Usage of Extension Methods</a>
</p>
| [
{
"answer_id": 403555,
"author": "Tom Anderson",
"author_id": 13502,
"author_profile": "https://Stackoverflow.com/users/13502",
"pm_score": 3,
"selected": false,
"text": "Public Module MyExtensions\n\n <System.Runtime.CompilerServices.Extension()> _\n Public Sub DoSomething(ByVal s... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403539",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1443363/"
] |
403,549 | <p>Can you describe the pros and cons of including an <a href="http://en.wikipedia.org/wiki/Object_identifier" rel="nofollow noreferrer">OID</a> (typically a database row identifier) in a <a href="http://en.wikipedia.org/wiki/Plain_Old_Java_Object" rel="nofollow noreferrer">POJO</a> representing an entity in your model?</p>
<p>In fact I'm not talking about issues related to equals/hashcode and so on, I should have described better my problem (my bad :) )...</p>
<p>We've got some of those entity classes which represent business objects (like Product, Catalog and so on...). Sometime they have a 'business id', for example Product can be found by its unique ProductId (which has 3 fields : id, type, repository).</p>
<p>In our database, the Product table has a surrogate primary key column (OID) in addition to the 3 business columns ( id, type, repository) to facilitate foreign keys references and to have less joins clauses.</p>
<p>The Product/ProductId classes are part of the API that we expose to other applications. So for example they can call :</p>
<pre><code>productManager.findProductById(ProductId productId);
</code></pre>
<p>The question is, should or should not the OID be included in the Product or in the ProductId class knowing that our clients are expected to use the ProductId identifier.</p>
<p><strong>Pros :</strong></p>
<ul>
<li><p>I can use the OID to do another lookup like </p>
<pre><code>Product p = productManager.findProductById(ProductId productId);
Catalog c = productManager.findAllCatalogsContainingProduct(p.getOid());
</code></pre></li>
</ul>
<p>We're used to lookup a lot in the application by ProductId so this saves each time a roundtrip to the database to avoid to find the OID matching a ProductId.</p>
<p><strong>Cons :</strong></p>
<ul>
<li>I've just exposed the OID to a client (let's hope he doesn't use it instead of the business key!!) </li>
</ul>
<p>Can you list other pros and cons?</p>
| [
{
"answer_id": 403571,
"author": "Otávio Décio",
"author_id": 48684,
"author_profile": "https://Stackoverflow.com/users/48684",
"pm_score": 1,
"selected": false,
"text": "SearchCriteria sc = new SearchCriteria();\nsc.AddBinding(\"ProductId\", productId);\nList<Entity> Products = SQL.Read... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403549",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/50114/"
] |
403,560 | <p>I want to store part of an id, and throw out the rest. For example, I have an html element with an id of 'element-12345'. I want to throw out 'element-' and keep '12345'. How can I accomplish this?</p>
<p>I can capture and echo the value, like this:</p>
<pre>| storeAttribute | //pathToMyElement@id | myId |
| echo | ${!-myId-!} | |</pre>
<p>When I run the test, I get something like this:</p>
<pre>| storeAttribute | //pathToMyElement@id | myId |
| echo | ${myId} | element-12345 |</pre>
<p>I'm recording with the Selenium IDE, and copying the test over into Fitnesse, using the Selenium Bridge fixture. The problem is I'm using a clean database each time I run the test, with random ids that I need to capture and use throughout my test.</p>
| [
{
"answer_id": 497700,
"author": "Peter Boughton",
"author_id": 9360,
"author_profile": "https://Stackoverflow.com/users/9360",
"pm_score": 2,
"selected": false,
"text": "| storeAttribute | fn:replace(//pathToMyElement@id,\"^element-\",\"\") | myId |\n"
},
{
"answer_id": 615871,
... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403560",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48523/"
] |
403,569 | <p>Wouldn't it be nice to just do a keystroke and have eclipse organize all imports in all java classes instead of just the one you are looking at? Is this possible? Is there a keystroke for it?</p>
| [
{
"answer_id": 18160610,
"author": "superlinux",
"author_id": 2120194,
"author_profile": "https://Stackoverflow.com/users/2120194",
"pm_score": 0,
"selected": false,
"text": "import com.kwswsuyruzouggmtbzxb.* \n import com.izwevyqazy.*\n"
},
{
"answer_id": 45225241,
"author":... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403569",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30807/"
] |
403,572 | <p>I would like to use RNGCryptoServiceProvider as my source of random numbers. As it only can output them as an array of byte values how can I convert them to 0 to 1 double value while preserving uniformity of results?</p>
| [
{
"answer_id": 403623,
"author": "Brian",
"author_id": 16457,
"author_profile": "https://Stackoverflow.com/users/16457",
"pm_score": -1,
"selected": false,
"text": "byte[] random_bytes = new byte[8]; // BitConverter will expect an 8-byte array\nnew RNGCryptoServiceProvider().GetBytes(ra... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403572",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3515/"
] |
403,583 | <p>I know how package level protection in java works. I <em>read</em> a lot of code (including lots of open source stuff) and no-one seem to be using it. The whole protection level seems slightly faulty to me (I'd have c#'s internal any day of the week). </p>
<p>Are there any legit real-world use-cases that are in common use ?</p>
<p>Edit: A little too late after asking this question I realized I'd forgotten to exclude the "standard" pattern of package protected implementation classes, possibly providing implementations of public interfaces. Everyone uses those, as has been noted several times in the replies. I still think there are a large number of nice replies to this question.</p>
| [
{
"answer_id": 403621,
"author": "Johannes Schaub - litb",
"author_id": 34509,
"author_profile": "https://Stackoverflow.com/users/34509",
"pm_score": 4,
"selected": false,
"text": " User Code using the package User\n------ | -----------------------------|----- package public Inte... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403583",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23691/"
] |
403,619 | <p><li> When does using extension methods make sense?
<li> Does adding extension methods to a type affect performance?</p>
<p>These questions are follow up to the question i asked earlier about <a href="https://stackoverflow.com/questions/403539/what-are-extension-methods">Extension Methods</a>.</p>
| [
{
"answer_id": 403627,
"author": "Andreas Grech",
"author_id": 44084,
"author_profile": "https://Stackoverflow.com/users/44084",
"pm_score": 2,
"selected": false,
"text": "public class extended {\n public int sum() {\n return 7+3+2;\n }\n}\n\npublic static class extending {\... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403619",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1443363/"
] |
403,622 | <p>The xpath of my elements are becoming extremely hard to read.</p>
<p>//div[@id='main_content']/div[2]/div[2]/div[2]/div[4]/table/tbody/tr[2]/td/form/fieldset/p[1]/input</p>
<p>It would be nice if I could store most of that as a variable and use it later like this:</p>
<p>| assertElementPresent | ${myForm} . /fieldset/p[1]/input |</p>
<p>Is something like this possible? It would make my tests so much easier to read!</p>
| [
{
"answer_id": 1170369,
"author": "PeterL",
"author_id": 31028,
"author_profile": "https://Stackoverflow.com/users/31028",
"pm_score": 1,
"selected": false,
"text": "store | //div[@id='main_content']/div[2]/div[2]/div[2]/div[4]/table/tbody/tr[2]/td/form | myForm\nassertElementPresent | x... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403622",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48523/"
] |
403,630 | <p>I need to search across multiple columns from two tables in my database using Full-Text Search. The two tables in question have the relevant columns full-text indexed.</p>
<p>The reason I'm opting for Full-text search:
1. To be able to search accented words easily (cafè)
2. To be able to rank according to word proximity, etc.
3. "Did you mean XXX?" functionality</p>
<p>Here is a <strong>dummy</strong> table structure, to illustrate the challenge:</p>
<pre>
<strong>Table Book</strong>
BookID
Name (Full-text indexed)
Notes (Full-text indexed)
<strong>Table Shelf</strong>
ShelfID
BookID
<strong>Table ShelfAuthor</strong>
AuthorID
ShelfID
<strong>Table Author</strong>
AuthorID
Name (Full-text indexed)
</pre>
<p><strong>I need to search across Book Name, Book Notes and Author Name.</strong> </p>
<p>I know of two ways to accomplish this:</p>
<ol>
<li><p><strong>Using a Full-text Indexed View:</strong> This would have been my preferred method, but I can't do this because for a view to be full-text indexed, it needs to be schemabound, not have any outer joins, have a unique index. The view I will need to get my data does not satisfy these constraints (it contains many other joined tables I need to get data from).</p></li>
<li><p><strong>Using joins in a stored procedure</strong>: The problem with this approach is that I need to have the results sorted by rank. If I am making multiple joins across the tables, SQL Server won't search across multiple fields by default. I can combine two individual CONTAINS queries on the two linked tables, but I don't know of a way to extract the <strong>combined</strong> rank from the two search queries. For example, if I search for 'Arthur', the results of both the Book query and the Author query should be taken into account and weighted accordingly. </p></li>
</ol>
| [
{
"answer_id": 403673,
"author": "Shawn",
"author_id": 26,
"author_profile": "https://Stackoverflow.com/users/26",
"pm_score": 1,
"selected": false,
"text": "Select SearchResults.key, SearchResults.rank From FREETEXTTABLE(myColumn, *, @searchString) as SearchResults Order By SearchResult... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403630",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6939/"
] |
403,643 | <p>In .NET, what type of exception should be thrown if someone passes an illegal value to the <code>set { }</code> part of a property?</p>
<p>Example:</p>
<pre><code>public string Provider
{
get { return _provider; }
set
{
if (String.IsNullOrEmpty(value)) throw new Exception("Provider cannot be null or empty."); //what type of exception should be thrown here instead?
_provider = value;
}
}
</code></pre>
<hr>
<p><strong>Note:</strong></p>
<p>I'm asking this question as it applies to .NET, but it could apply to many other languages as well. So if you have a good answer that applies to something other than the .NET framework, please post!</p>
| [
{
"answer_id": 5063473,
"author": "PMBottas",
"author_id": 580745,
"author_profile": "https://Stackoverflow.com/users/580745",
"pm_score": 1,
"selected": false,
"text": "class MyClass\n{\n string name;\n\n public string Name {\n get {\n return name;\n }\n set {\n if ... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403643",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/357/"
] |
403,660 | <p>I want to invoke outlook from the command line (for various reasons) and wanted to know how I go about discovering the Path to the Outlook.exe file.</p>
<p>I'm pretty sure it's stored in the registry, but was wondering how to go about reading that from Java.</p>
<p>thanks</p>
| [
{
"answer_id": 413857,
"author": "Allain Lalonde",
"author_id": 2443,
"author_profile": "https://Stackoverflow.com/users/2443",
"pm_score": 0,
"selected": false,
"text": "static String getOutlookPath() {\n // Message message = new Message();\n final String classID;\n final String outl... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403660",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2443/"
] |
403,662 | <p>How do I convert a string into an array of integers? Can I use <code>sstream</code>, because <code>atoi</code> doesn't work?!</p>
| [
{
"answer_id": 403680,
"author": "jalf",
"author_id": 33213,
"author_profile": "https://Stackoverflow.com/users/33213",
"pm_score": 2,
"selected": false,
"text": "struct convert {\n int operator()(char c) {\n return static_cast<int>(c);\n }\n};\n\nstd::string str = \"hello world\";\... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403662",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20730/"
] |
403,671 | <p>So I've been seeing people using <code>.build</code>, <code>.create</code>, and <code>.create!</code> within their controllers more and more lately. What's the difference from just using <code>.new</code> and passing the param'd object and then <code>.save</code>? Are there pros and cons? Does using these other methods offer benefits?</p>
| [
{
"answer_id": 403714,
"author": "zenazn",
"author_id": 46848,
"author_profile": "https://Stackoverflow.com/users/46848",
"pm_score": 9,
"selected": true,
"text": ".create .new .save .create! .new .save! .build .new has_many"
},
{
"answer_id": 5547536,
"author": "Vineeth Prad... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403671",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/43043/"
] |
403,687 | <p>This is inspired by the question <a href="https://stackoverflow.com/questions/50335/ok-cancel-or-cancel-ok">OK-Cancel or Cancel-OK?</a>.</p>
<p>I remember reading somewhere about the concept of switching OK-Cancel/Cancel-OK in certain situations to prevent the user from clicking through information popups or dialog boxes without reading their content. As far as I remember, this also included moving the location of the OK button (horizontally, left to right) to prevent the user from just remembering where to click. </p>
<p>Does this really make sense? Is this a good way to force the user to "think/read first, then click"? Are there any other concepts applicable to this kind of situation?</p>
<p>I am particularly thinking of a safety-related application, where thoughtlessly pressing OK out of habit can result in a potentially dangerous situation whereas Cancel would lead to a safe state. </p>
| [
{
"answer_id": 403745,
"author": "Kevin Fairchild",
"author_id": 3743,
"author_profile": "https://Stackoverflow.com/users/3743",
"pm_score": 2,
"selected": false,
"text": "Dim strStart As DateTime = Now\nWhile Now < strStart.AddSeconds(5)\n MessageBox.Show(\"Something just happened\",... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403687",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2386/"
] |
403,689 | <p>While the subject could sound like I'm looking to do something shifty, I'm not; I maintain an internal web site used by several hundred phone operators, and would like to add the following functionality:</p>
<p>I would like to add a control in the header of all of the web pages that would capture an image of the entire desktop and save the image as a file to a shared network drive to assist in troubleshooting production problems. This screen capture app would be called by JavaScript.</p>
<p>I've researched many threads on this site pertaining to capturing screenshots, and all of the offered applications don't meet my need in one of two ways:</p>
<ol>
<li><p>The screen capture application has a GUI that pops up and the user sizes some sort of capture control or interacts with a window to do the capture. The users are not very computer literate, and could not be trusted with using a "pop-up" application correctly-- and it would be impossible to enforce them to save the image file with a common file naming convention. I would like the user to press a single UI control on a web site and have JavaScript make the calls to obtain a screen shot and save the image without any further user interaction.</p></li>
<li><p>Some automated applications save the HTML by re-posting to the site and "re-assembles" the individual HTML elements into an image. This will not work as the input data that the operator has typed in needs to be in the image, the site uses AJAX so the visual "state" of the web page will be different from one re-obtained from a POST, and some applications have had (active directory) security issues when trying to interact with our (secured) web sites.</p></li>
</ol>
<p>If there isn't an application that will meet this need, I'll just roll my own control in C#. But I'd rather obtain a third-party control. so I don't have to support my own control for life. :-)</p>
| [
{
"answer_id": 403745,
"author": "Kevin Fairchild",
"author_id": 3743,
"author_profile": "https://Stackoverflow.com/users/3743",
"pm_score": 2,
"selected": false,
"text": "Dim strStart As DateTime = Now\nWhile Now < strStart.AddSeconds(5)\n MessageBox.Show(\"Something just happened\",... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403689",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26037/"
] |
403,702 | <p>Is there a good way to limit the Auto Width of an element or Grid Column?
I want to limit the Auto Width only, but allow any user changes.</p>
<p>For example, I want to allow GridSplitter to arbitrarily resize the column, but the initial (Auto) Width should not exceed a specific value. Same for the elements -- I want to allow resizing, but limit the Width they have if never resized.</p>
<p>MaxWidth works exactly as opposite -- it does not affect Auto Width of Grid Columns (it might be a bug), but limits the resized width.</p>
<p>Is there any good solution that works for (almost) any element or Grid part?</p>
| [
{
"answer_id": 403749,
"author": "David Schmitt",
"author_id": 4918,
"author_profile": "https://Stackoverflow.com/users/4918",
"pm_score": 1,
"selected": false,
"text": "MaxWidth Width IValueConverter Auto"
}
] | 2008/12/31 | [
"https://Stackoverflow.com/questions/403702",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39068/"
] |
403,703 | <p>I've just deployed a new site using Zend Framework. Due to the popularity of my tutorials I'd like to redirect any request for a tutorial to the relevant page on the new site. So far this is what I've got:</p>
<p>URL before Rewrite: <a href="http://neranjara.org/tutorials/?tid=56" rel="nofollow noreferrer">http://neranjara.org/tutorials/?tid=56</a></p>
<p>URL after Rewrite: <a href="http://neranjara.org/article/id/56" rel="nofollow noreferrer">http://neranjara.org/article/id/56</a></p>
<p>The .htaccess file I'm attempting to use looks like this:</p>
<pre>
$ cat html/.htaccess
RewriteEngine on
RewriteRule tutorials/\?tid=(.*)$ /article/id/$1 [R=301]
RewriteRule !\.(js|ico|gif|jpg|png|css|xml|phps)$ index.php
</pre>
<p>But this rule is not matching any URLs ... :'(</p>
<p>Does any one see a problem here?</p>
| [
{
"answer_id": 403864,
"author": "lpfavreau",
"author_id": 35935,
"author_profile": "https://Stackoverflow.com/users/35935",
"pm_score": 2,
"selected": false,
"text": "$_SERVER['REQUEST_URI'] header(\"Location: http://http://neranjara.org/article/id/$id\");\nexit();\n"
},
{
"answ... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403703",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47440/"
] |
403,731 | <p>Two machines. Both with .NET 3.5 and the VS 2008 VC++ SP1 redistributables</p>
<p>A single exe which uses two signed DLLs, one in C++/CLI and one in C#</p>
<p>The exe loads and runs fine on one machine.</p>
<p>On the other, I get "Strong Name Validation Failed" on the C++ executable (HRESULT 0x8013141A)</p>
<p>Any ideas?</p>
| [
{
"answer_id": 34133383,
"author": "Butsaty",
"author_id": 1041827,
"author_profile": "https://Stackoverflow.com/users/1041827",
"pm_score": 6,
"selected": false,
"text": "reg DELETE \"HKLM\\Software\\Microsoft\\StrongName\\Verification\" /f\nreg ADD \"HKLM\\Software\\Microsoft\\StrongNa... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403731",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
403,736 | <p>I am attempting to center my entire page using only CSS and it is proving more complicated than i first expected. Currently my code works in IE but not in Firefox which makes a change. The page can be seen <a href="http://www.ronnieweb.co.cc/test/index.html" rel="nofollow noreferrer">here</a>. Below is the code portion involved:</p>
<pre><code>#wrap {
width: 960px;
margin: 0 auto;
padding: 6px;
background: #FFFFFF;
}
</code></pre>
<p>The structure of my HTML is:</p>
<pre><code><body>
<div id="wrap">
Gubbins in here.
</div>
</body>
</code></pre>
<p>It seems that in Firefox everything following the wrap div is be created outside of it. This is problem is resolved if i add a 'float: left' to the wrap div but then obviously everything floats left rather than center.</p>
<p>Any help would be greatly appreciated.</p>
| [
{
"answer_id": 403743,
"author": "John Sheehan",
"author_id": 1786,
"author_profile": "https://Stackoverflow.com/users/1786",
"pm_score": 4,
"selected": true,
"text": "<body>\n<div id=\"wrap\">\n Gubbins in here.\n</div>\n</body>\n"
},
{
"answer_id": 403759,
"author": "Joe... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403736",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/50057/"
] |
403,747 | <p>In the current C++ standard (C++03), there are too few specifications about text localization and that makes the C++ developer's life harder than usual when working with localized texts (certainly the C++0x standard will help here later).</p>
<h3>Assuming the following scenario (which is from real PC-Mac game development cases):</h3>
<ol>
<li><strong>responsive (real time) application</strong>: the application has to minimize non-responsive times to "not noticeable", so speed of execution is important.</li>
<li><strong>localized texts</strong>: displayed texts are localized in more than two languages, potentially more - don't expect a fixed number of languages, should be easily extensible.</li>
<li><strong>language defined at runtime</strong>: the texts should not be compiled in the application (nor having one application per language), you get the chosen language information at application launch - which implies some kind of text loading.</li>
<li><strong>cross-platform</strong>: the application is be coded with cross-platform in mind (Windows - Linux/Ubuntu - Mac/OSX) so the localized text system have to be cross platform too.</li>
<li><strong>stand-alone application</strong>: the application provides all that is necessary to run it; it won't use any environment library or require the user to install anything other than the OS (like most games for example).</li>
</ol>
<h2>What are the best practices to manage localized texts in C++ in this kind of application?</h2>
<p>I looked into this last year that and the only things I'm sure of are that you should use <code>std::wstring</code> or <code>std::basic_string<ABigEnoughType></code> to manipulate the texts in the application. I stopped my research because I was working more on the "text display" problem (in the case of real-time 3D), but I guess there are some best practices to manage localized texts in raw C++ beyond just that and "use Unicode".</p>
<p>So, all best-practices, suggestions and information (cross-platform makes it hard I think) are welcome!</p>
| [
{
"answer_id": 403907,
"author": "Aaron",
"author_id": 28950,
"author_profile": "https://Stackoverflow.com/users/28950",
"pm_score": 5,
"selected": true,
"text": "enum integer string printf() printf() %0 %1 printf() %2$s 2$ printf() .h .lang printf()"
}
] | 2008/12/31 | [
"https://Stackoverflow.com/questions/403747",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2368/"
] |
403,748 | <p>I would like to use a custom version of the standard disclosure accessory image in my UITableView. How can I do this? I'm hoping that sub-classing UITableViewCell is not necessary for something this basic.</p>
| [
{
"answer_id": 403796,
"author": "codelogic",
"author_id": 43427,
"author_profile": "https://Stackoverflow.com/users/43427",
"pm_score": 8,
"selected": true,
"text": "accessoryView UITableViewCell myCell.accessoryView = [[ UIImageView alloc ] \n initWithImage:[UIIma... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403748",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35478/"
] |
403,754 | <p>Creating an OS seems like a <strong>massive</strong> project. How would anyone even get started?</p>
<p><strong>For example, when I pop Ubuntu into my drive, how can my computer just <em>run</em> it?</strong>
(This, I guess, is what I'd really like to know.)</p>
<p>Or, looking at it from another angle, what is the least amount of bytes that could be on a disk and still be "run" as an OS?</p>
<p>(I'm sorry if this is vague. I just have <em>no idea</em> about this subject, so I can't be very specific. I pretend to know a fair amount about how computers work, but I'm utterly clueless about this subject.)</p>
| [
{
"answer_id": 41168831,
"author": "np2807",
"author_id": 5360233,
"author_profile": "https://Stackoverflow.com/users/5360233",
"pm_score": 0,
"selected": false,
"text": "bootloader Kernel scheduling time ISR's"
}
] | 2008/12/31 | [
"https://Stackoverflow.com/questions/403754",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1615/"
] |
403,756 | <p>In my quest in trying to learn more about OOP in PHP. I have come across the constructor function a good few times and simply can't ignore it anymore. In my understanding, the constructor is called upon the moment I create an object, is this correct?</p>
<p>But why would I need to create this constructor if I can use "normal" functions or methods as their called?</p>
<p>cheers,
Keith</p>
| [
{
"answer_id": 403766,
"author": "Ólafur Waage",
"author_id": 22459,
"author_profile": "https://Stackoverflow.com/users/22459",
"pm_score": 4,
"selected": true,
"text": "class Bar\n{\n // The variable we will be using within our class\n var $val;\n\n // This function is called w... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403756",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37418/"
] |
403,769 | <p>I'm using .net 2.0 with Visual Studio 2005 and I am trying to add two different toolstrips to the top of the form such that they show up side-by-side. I want it to be like Word 2003, where you can add multiple toolstrips to the same row and have them show up in line with each other, rather than dedicating a row to each toolstrip.</p>
<p>So I added a ToolStripPanel and docked it to the top of the form (I didn't use a ToolStripContainer because I don't need all the extra panels; I just need the one at the top). I added both toolstrips and set their Stretch properties to False. I can get them to show up in the designer window side-by-side, but at runtime the ToolStripPanel separates the toolstrips and gives each toolstrip its own dedicated row. As if to add insult to injury, when i stop debugging and return back to the designer, I am finding that the designer is moving the toolstrips to their own row as well! Am I doing something wrong here? </p>
<p>I have been Googling all day and found some information about a ToolStripPanelRow object, but I don't see an easy way to add toolstrips to it (i.e. it doesn't have a ToolStripPanelRow.Controls.Add method or anything like that), all it has is a Controls() property that returns an Array of control objects, and I haven't had much luck trying to add items to that array. I also found some documentation on the ToolStripPanel.Join method, which sounds like it should do the job, so I tried all 3 overloads but they don't work as advertised. No matter what I do or which options I try, it always adds the new toolstrip to the top of the panel on its own row and pushes everything else down. </p>
<p>In the interests of full disclosure I should warn you that I have the ToolStripPanel and one of the toolstrips added to a baseclass form, and I am trying to add the other toolstrip to a subclass form that inherits from the baseclass form. The ToolStripPanel and ToolStrip in the baseclass form are both declared "Protected Friend", so this should be working. As I mentioned, the subclass form's designer window will allow me to do it (at least, for a time). </p>
<p>If anyone can help me get this working or at least shed some light on why it isn't, I would be extremely grateful. </p>
| [
{
"answer_id": 469868,
"author": "Wyzfen",
"author_id": 15261,
"author_profile": "https://Stackoverflow.com/users/15261",
"pm_score": 4,
"selected": true,
"text": "using System.Drawing;\nusing System.Windows.Forms;\nusing System.Windows.Forms.Layout;\n\nnamespace CustomGUI\n{\n class Cu... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403769",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22392/"
] |
403,794 | <p>Well I was reading this <a href="http://handyfloss.wordpress.com/2008/02/17/summary-of-my-python-optimization-adventures/" rel="noreferrer">post</a> and then I came across a code which was:</p>
<pre><code>jokes=range(1000000)
domain=[(0,(len(jokes)*2)-i-1) for i in range(0,len(jokes)*2)]
</code></pre>
<p>I thought wouldn't it be better to calculate the value of len(jokes) once outside the list comprehension?</p>
<p>Well I tried it and timed three codes</p>
<pre><code>jv@Pioneer:~$ python -m timeit -s 'jokes=range(1000000);domain=[(0,(len(jokes)*2)-i-1) for i in range(0,len(jokes)*2)]'
10000000 loops, best of 3: 0.0352 usec per loop
jv@Pioneer:~$ python -m timeit -s 'jokes=range(1000000);l=len(jokes);domain=[(0,(l*2)-i-1) for i in range(0,l*2)]'
10000000 loops, best of 3: 0.0343 usec per loop
jv@Pioneer:~$ python -m timeit -s 'jokes=range(1000000);l=len(jokes)*2;domain=[(0,l-i-1) for i in range(0,l)]'
10000000 loops, best of 3: 0.0333 usec per loop
</code></pre>
<p>Observing the marginal difference 2.55% between the first and the second made me think - is the first list comprehension </p>
<pre><code>domain=[(0,(len(jokes)*2)-i-1) for i in range(0,len(jokes)*2)]
</code></pre>
<p>optimized internally by python? or is 2.55% a big enough optimization (given that the len(jokes)=1000000)?</p>
<p>If this is - What are the other implicit/internal optimizations in Python ?</p>
<p>What are the <code>developer's rules of thumb for optimization in Python</code>?</p>
<p><strong>Edit1</strong>: Since most of the answers are "don't optimize, do it later if its slow" and I got some tips and links from <code>Triptych</code> and <code>Ali A</code> for the <strong>do's</strong>.
I will change the question a bit and request for <strong>don'ts</strong>. </p>
<p>Can we have some experiences from people who faced the '<strong>slowness</strong>', what was the problem and how it was corrected? </p>
<p><strong>Edit2</strong>: For those who haven't here is an <a href="http://www.python.org/doc/essays/list2str/" rel="noreferrer">interesting read</a></p>
<p><strong>Edit3:</strong> Incorrect usage of <code>timeit</code> in question please see <strong>dF's</strong> answer for correct usage and hence timings for the three codes.</p>
| [
{
"answer_id": 403821,
"author": "dF.",
"author_id": 3002,
"author_profile": "https://Stackoverflow.com/users/3002",
"pm_score": 5,
"selected": true,
"text": "timeit -s $ python -m timeit -s \"jokes=range(1000000)\" \"domain=[(0,(len(jokes)*2)-i-1) for i in range(0, len(jokes)*2)]\"\n10 ... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403794",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33612/"
] |
403,798 | <p>In my view I have an alphabet based selector, to select manufacturers by the first letter of their name. I got that part working. But I have manufacturers whose name starts with a number, for example 3M, or 3DLabs. In the view I have the character "#" to group all those. What should my query/find method look like to retrieve all names that don't start with an alphabet letter.</p>
| [
{
"answer_id": 403814,
"author": "Mitchell Gilman",
"author_id": 43219,
"author_profile": "https://Stackoverflow.com/users/43219",
"pm_score": 2,
"selected": false,
"text": "select *\nfrom myTable\nwhere myField like '[^a-z]%'\n"
},
{
"answer_id": 403874,
"author": "Community... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403798",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
403,815 | <p>I'm writing an application that gets data from URLs, but I want to make it an option whether or not the user uses "clean" urls (ex: <a href="http://example.com/hello/world" rel="nofollow noreferrer">http://example.com/hello/world</a>) or "dirty" urls (ex: <a href="http://example.com/?action=hello&sub=world" rel="nofollow noreferrer">http://example.com/?action=hello&sub=world</a>).</p>
<p>What would be the best way to get variables form both URL schemes?</p>
| [
{
"answer_id": 403854,
"author": "ConroyP",
"author_id": 2287,
"author_profile": "https://Stackoverflow.com/users/2287",
"pm_score": 3,
"selected": true,
"text": "RewriteRule ^hello/world /?action=hello&sub=world [NC,L]\n // Assuming only lowercase letters in action & sub..\nRewriteRule ... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403815",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29291/"
] |
403,820 | <p>I'm trying for the past several hours to figure out how to do this, but with no luck. There are several potential solutions for this when searching Google, but nothing seems to work.</p>
<p>I'm trying to customize the background color of the standard UILabel that goes in a UITableViewCell (since I already customized the background color of the cell itself), but nothing I do seems to work.</p>
<p>I'm creating my own UILabel to customize the colors in -tableView:cellForRowAtIndexPath:</p>
<pre><code>UILabel* label = [[[UILabel alloc] init] autorelease];
label.textColor = [UIColor blueColor];
label.backgroundColor = [UIColor redColor];
label.opaque = YES;
[cell.contentView addSubview:label];
cell.text = @"Sample text here";
</code></pre>
<p>But that doesn't work, and the resulting table view still has a bunch of cells with labels with black text and white background in it.</p>
<p>Any clues on what I am doing wrong here?</p>
<p>UPDATE: If I try to do the following instead:</p>
<pre><code>UILabel* label = [[[UILabel alloc] init] autorelease];
label.textColor = [UIColor blueColor];
label.backgroundColor = [UIColor redColor];
label.opaque = YES;
[cell.contentView addSubview:label];
label.text = @"Sample text here";
</code></pre>
<p>I get a bunch of UITableViewCells with no text at all.</p>
| [
{
"answer_id": 403827,
"author": "codelogic",
"author_id": 43427,
"author_profile": "https://Stackoverflow.com/users/43427",
"pm_score": 2,
"selected": true,
"text": "label.text = @\"Sample text here\";\n label.frame = CGRectMake(10,10, 80, 40);\n label = [[UILabel alloc] initWithFrame:m... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403820",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35478/"
] |
403,822 | <p>I have a file called main.py and a file called classes.py</p>
<p>main.py contains the application and what's happening while class.py contains some classes.</p>
<p>main.py has the following code</p>
<p><strong>main.py</strong></p>
<pre><code>import classes
def addItem(text):
print text
myClass = classes.ExampleClass()
</code></pre>
<p>And then we have classes.py</p>
<p><strong>classes.py</strong></p>
<pre><code>class ExampleClass (object):
def __init__(self):
addItem('bob')
</code></pre>
<p>Surprisingly enough that's not the actual code I am using because I've stripped out anything that'd get in the way of you seeing what I want to do. I want to be able to call a method that's defined in main.py from a class within classes.py. How do I do this?</p>
<p>Thanks in advance</p>
| [
{
"answer_id": 403850,
"author": "codelogic",
"author_id": 43427,
"author_profile": "https://Stackoverflow.com/users/43427",
"pm_score": 1,
"selected": false,
"text": "if __name__ == \"__main__\" if __name__==\"__main__\":\n myClass = classes.ExampleClass()\n"
},
{
"answer_id"... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403822",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1384652/"
] |
403,836 | <p>I have a function that identify coordinates on a page, and I am returning them as a</p>
<pre><code>Dictionary<int, Collection<Rectangle>> GetDocumentCoordinates(int DocumentId)
</code></pre>
<p>However, later I need information about each page - if it was validated, what is the page resolution, color/bw, etc. I could create another function and run through pretty much the same result set as the previous function and get that information. </p>
<pre><code>Dictionary<int, PageInfo> GetDocumentAttributes(int DocumentId)
</code></pre>
<p>Another alternative would be to add a <code>ref</code> parameter so I can get these values back.</p>
<pre><code>Dictionary<int, Collection<Rectangle>> GetCoordinates(int DocumentId, ref Dictionary<int, PageInfo> PageAttributes)
</code></pre>
<p>Yet another alternative is to create an encompassing class that contains the Dictionary and the page information:</p>
<pre><code>class DocumentInfo
{
Dictionary<int, Collection<Rectangle>> Coordinates { get; set;}
Dictionary<int, PageInfo> PageAttributes { get; set; }
}
</code></pre>
<p>and then define:</p>
<pre><code>DocumentInfo GetDocumentInfo(int DocumentId);
</code></pre>
<p>I'm leaning towards the last option, but your insights are very much appreciated.</p>
| [
{
"answer_id": 403862,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 1,
"selected": false,
"text": "Dictionary<,> class DocumentInfo {\n Dictionary<int, Collection<Rectangle>> rectangles = ...\n public Collectio... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403836",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48684/"
] |
403,846 | <p>What would be the best way to loop through all radio buttons on my page and alert the user if one of them is unchecked for a particular question?</p>
<p>Note: there are multiple questions on one page.</p>
<pre><code><li>
<fieldset>
<h3>What music do you listen to?</h3>
<ul class="answerList">
<li>
<input type="radio" id="choice_22" name="answer8" value="1" class=""/>
<label for="choice_22" class="">Heavy Metal </label>
</li>
<li>
<input type="radio" id="choice_23" name="answer8" value="2" class=""/>
<label for="choice_23" class="">Pop music</label>
</li>
<li>
<input type="radio" id="choice_24" name="answer8" value="3" class=""/>
<label for="choice_24" class="">Oh, a mix of stuff </label>
</li>
</ul>
</fieldset>
</li>
</code></pre>
| [
{
"answer_id": 403940,
"author": "patridge",
"author_id": 48700,
"author_profile": "https://Stackoverflow.com/users/48700",
"pm_score": 4,
"selected": false,
"text": "if (undefined === $(\"input[name='answer8']:checked\").val()) {\n // do something\n}\n"
}
] | 2008/12/31 | [
"https://Stackoverflow.com/questions/403846",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48973/"
] |
403,855 | <p>With WCF, how can I determine who is connecting to my server?</p>
<p>Background: I have a set of WCF clients and servers. I suspect one client is pointed to the wrong server, so I want to log all the connections to that server. I don't know which client it is, so I have to check it on the server side.</p>
| [
{
"answer_id": 403884,
"author": "Scott Weinstein",
"author_id": 25201,
"author_profile": "https://Stackoverflow.com/users/25201",
"pm_score": 1,
"selected": false,
"text": "OperationContext opCtx = OperationContext.Current;\nEndpointAddress from = opCtx.IncomingMessageHeaders.From;\n"
... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403855",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5274/"
] |
403,865 | <p>I have a list of numbers and I want to add up all the different combinations.
For example:</p>
<ul>
<li>number as 1,4,7 and 13</li>
<li>the output would be:</li>
</ul>
<p><br></p>
<pre><code>1+4=5
1+7=8
1+13=14
4+7=11
4+13=17
7+13=20
1+4+7=12
1+4+13=18
1+7+13=21
4+7+13=24
1+4+7+13=25
</code></pre>
<p>Is there a formula to calculate this with different numbers?</p>
| [
{
"answer_id": 403883,
"author": "Toon Krijthe",
"author_id": 18061,
"author_profile": "https://Stackoverflow.com/users/18061",
"pm_score": 5,
"selected": false,
"text": "0001 = 13=13\n0010 = 7=7\n0011 = 7+13 = 20\n\n1111 = 1+4+7+13 = 25\n"
},
{
"answer_id": 403908,
"author":... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403865",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/50577/"
] |
403,868 | <p>I am using jQuery for my AJAX calls to an ASP.NET backend using <a href="http://encosia.com/2008/03/27/using-jquery-to-consume-aspnet-json-web-services/" rel="nofollow noreferrer">this approach</a>. I am using .ajaxStart and .ajaxStop to show and hide a progress indicator. When the AJAX request finishes very quickly, the progress indicator "blinks" because it is not displayed long enough. </p>
<p>One possible solution would be to display only after a minimum time (like UpdateProgress.DisplayAfter in MS AJAX). Another would be to make sure the indicator displays for a minimum time. Unfortunately, the jQuery <a href="http://blog.mythin.net/projects/jquery.php" rel="nofollow noreferrer">Pause plug-in</a> doesn't seem to work, and effect delay tricks like <a href="http://www.learningjquery.com/2007/01/effect-delay-trick" rel="nofollow noreferrer">this</a> don't work either. Some sort of solution based on JavaScript setTimeout similar to <a href="https://stackoverflow.com/questions/89051/queuing-actions-not-effects-to-execute-after-an-amount-of-time">this SO answer</a> seems most likely, but the problem is that the Ajax call keeps processing. Thus the result gets displayed while the progress indicator is still visible. </p>
<p>So, can it be done? And if so, how?</p>
| [
{
"answer_id": 403883,
"author": "Toon Krijthe",
"author_id": 18061,
"author_profile": "https://Stackoverflow.com/users/18061",
"pm_score": 5,
"selected": false,
"text": "0001 = 13=13\n0010 = 7=7\n0011 = 7+13 = 20\n\n1111 = 1+4+7+13 = 25\n"
},
{
"answer_id": 403908,
"author":... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403868",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29426/"
] |
403,897 | <p>sorry for my previous question which was very ambiguous, but i think if i get the answer to this question I can work it out.
In the program below i have selected the barcodes of products where the amount is less than the quantity. I want to say, that if the barcodes(in the fridge table) match barcodes in another table(products), set the stock field equal to 0. The problem Im getting is that the program is trying to match all the barcodes that it found in the query against single barcodes in the products table(thats what I think). does anyone know what to do. thanks a million. lincoln.</p>
<pre><code>import MySQLdb
def order():
db = MySQLdb.connect(host='localhost', user='root', passwd='$$', db='fillmyfridge')
cursor = db.cursor()
cursor.execute('select barcode from fridge where amount < quantity')
db.commit()
row = cursor.fetchall()
cursor.execute('update products set stock = 0 where barcode = %s', row)
</code></pre>
| [
{
"answer_id": 403941,
"author": "Adam Peck",
"author_id": 26658,
"author_profile": "https://Stackoverflow.com/users/26658",
"pm_score": 3,
"selected": false,
"text": "UPDATE products SET stock = 0 WHERE barcode IN ( \n SELECT fridge.barcode FROM fridge WHERE fridge.amount < fridge.qu... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403897",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47204/"
] |
403,902 | <p>I have inherited a Java application (servlets) that runs under Tomcat. For historical reasons, the code has different "look and feel" options based on where the application will be deployed (essentially a matter of branding).</p>
<p>There are several constants that control this branding process, which have different functions and should not be compacted into a single constant (i.e. BRAND, MULTI-LANGUAGE, plus the locations of icons and css style sheets, etc.).</p>
<p>Currently the development team must manually change the constants (they are at least localized in one data class and well documented), then recompile the application using ANT.</p>
<p>What is the best way to automate this process assuming at least Ant 1.8 and Java 6.x?</p>
<p>I know that there have not been any good solutions using compiler arguments (like one could do in C or C++), and am leaning to some "best way" to edit either the source file containing the constants, or putting them into another file and swapping them out using the ant build process. I'd like to have a result that would work using something like "ant build brand-x" where changing the brand would change the resulting build.</p>
<p>Thanks,</p>
<p>-Richard</p>
| [
{
"answer_id": 403937,
"author": "Steve B.",
"author_id": 19479,
"author_profile": "https://Stackoverflow.com/users/19479",
"pm_score": 1,
"selected": false,
"text": "<bean id=\"propertyPlaceholder\" class=\"org.springframework.beans.factory.config.PropertyPlaceholderConfigurer\">\n ... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403902",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33977/"
] |
403,914 | <p>I'm using g++ to compile and link a project consisting of about 15 c++ source files and 4 shared object files. Recently the linking time more than doubled, but I don't have the history of the makefile available to me. Is there any way to profile g++ to see what part of the linking is taking a long time?</p>
<p><strong>Edit:</strong> After I noticed that the makefile was using -O3 optimizations all the time, I managed to halve the linking time just by removing that switch. Is there any good way I could have found this without trial and error?</p>
<p><strong>Edit:</strong> I'm not actually interested in profiling how ld works. I'm interested in knowing how I can match increases in linking time to specific command line switches or object files.</p>
| [
{
"answer_id": 403994,
"author": "codelogic",
"author_id": 43427,
"author_profile": "https://Stackoverflow.com/users/43427",
"pm_score": 1,
"selected": false,
"text": "-v"
},
{
"answer_id": 415802,
"author": "Employed Russian",
"author_id": 50617,
"author_profile": "h... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403914",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1084/"
] |
403,924 | <p>I have a coworker looking for this, and I don't recall ever running into anything like that.</p>
<p>Is there a reasonable technique that would let you simulate it?</p>
<pre><code>SELECT PRODUCT(X)
FROM
(
SELECT 3 X FROM DUAL
UNION ALL
SELECT 5 X FROM DUAL
UNION ALL
SELECT 2 X FROM DUAL
)
</code></pre>
<p>would yield 30</p>
| [
{
"answer_id": 403928,
"author": "Amy B",
"author_id": 8155,
"author_profile": "https://Stackoverflow.com/users/8155",
"pm_score": 2,
"selected": false,
"text": "DECLARE @a int\nSET @a = 1\n-- re-assign @a for each row in the result\n-- as what @a was before * the value in the row\nSELEC... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403924",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7734/"
] |
403,929 | <p>Consider the following code:</p>
<pre><code>#include <stdio.h>
namespace Foo {
template <typename T>
void foo(T *, int) { puts("T"); }
template <typename T>
struct foo_fun {
static void fun() { foo((T *)0, 0); };
};
}
namespace Foo {
void foo(int *, int) { puts("int"); }
}
using namespace Foo;
int main() {
foo_fun<int> fun;
fun.fun();
}
</code></pre>
<p>What's the expected output? "T" or int?</p>
<p>One compiler (gcc 4.0.1 from Apple's Xcode 3.1.2) output "int", two other compilers (gcc 4.1.2 and 4.1.3) output "T".</p>
<p>If I move foo(int *, int) declaration/definition before the foo(T *, int) version, all output "int". Is the order of overloading/specialization in this case defined by the current standard?</p>
| [
{
"answer_id": 403958,
"author": "CB Bailey",
"author_id": 19563,
"author_profile": "https://Stackoverflow.com/users/19563",
"pm_score": 4,
"selected": true,
"text": "void foo(... foo_fun::fun T* foo foo((T*)0, 0) Foo foo int namespace Foo {\n template<>\n void foo<int>(int *, int)... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403929",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28888/"
] |
403,943 | <p>I'm not certain where the error is resulting (from silverlight, from wcf, something else...) but, I have a WCF service being called from Silverlight. The method returns a class, with a property that does not have a setter. This throws an error. If I add a setter to the property then it does not give an error.</p>
<p>The error is the usual impenetrable and unhelpful Silverlight error message, but...</p>
<pre><code>[Serializable]
[DataContract]
public SomeClass {
DataMember]
public string PropertyA { get; set; }
public string PropertyB { get { return "Hi There"; } }
}
</code></pre>
<p>Throws an error...</p>
<p>But change it to:</p>
<pre><code>[Serializable]
[DataContract]
public SomeClass {
[DataMember]
public string PropertyA { get; set; }
public string PropertyB { get { return "Hi There"; } set {} }
}
</code></pre>
<p>No error.</p>
<p>Includes the usual ISomeService.svc & SomeService.svc class, references updated in Silverlight calling the client async, etc., etc.</p>
<p>What is the correct way to configure the property (some attribute other than "DataMember" to allow a get-only, or a private-set property) to pass it over the wire?</p>
| [
{
"answer_id": 404713,
"author": "Darin Dimitrov",
"author_id": 29407,
"author_profile": "https://Stackoverflow.com/users/29407",
"pm_score": 2,
"selected": true,
"text": "[DataContract]\npublic class SomeClass\n{ \n public SomeClass()\n {\n _propertyB = \"Hi there\";\n }... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403943",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
403,946 | <p>Whenever I include boost in my project I get a million of these warnings. Does anyone know how I can get rid of the warnings?</p>
<blockquote>
<p>../depends\boost/config/abi_prefix.hpp(19)
: warning C4103:
'depends\boost\config\abi_prefix.hpp'
: alignment changed after including
header, may be due to missing #pragma
pack(pop)</p>
</blockquote>
<p>I know I can do a #pragma to disable the warning, but I'd like to know the reason for these warnings. </p>
| [
{
"answer_id": 410223,
"author": "Brian R. Bondy",
"author_id": 3153,
"author_profile": "https://Stackoverflow.com/users/3153",
"pm_score": 0,
"selected": false,
"text": "#define BOOST_DISABLE_ABI_HEADERS\n"
}
] | 2008/12/31 | [
"https://Stackoverflow.com/questions/403946",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3153/"
] |
403,967 | <p>How can I reference the script element that loaded the javascript that is currently running?</p>
<p>Here's the situation. I have a "master" script being loaded high in the page, first thing under the HEAD tag.</p>
<pre><code><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<script type="text/javascript" src="scripts.js"></script>
</code></pre>
<p>There is a script in "scripts.js" which needs to be able to do on-demand loading of other scripts. The normal method doesn't quite work for me because I need to add new scripts without referencing the HEAD tag, because the HEAD element hasn't finished rendering:</p>
<pre><code>document.getElementsByTagName('head')[0].appendChild(v);
</code></pre>
<p>What I want to do is reference the script element that loaded the current script so that I can then append my new dynamically loaded script tags into the DOM after it.</p>
<pre><code><script type="text/javascript" src="scripts.js"></script>
loaded by scripts.js--><script type="text/javascript" src="new_script1.js"></script>
loaded by scripts.js --><script type="text/javascript" src="new_script2.js"></script>
</code></pre>
| [
{
"answer_id": 403986,
"author": "Greg",
"author_id": 24181,
"author_profile": "https://Stackoverflow.com/users/24181",
"pm_score": 4,
"selected": false,
"text": "id"
},
{
"answer_id": 404036,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackove... | 2008/12/31 | [
"https://Stackoverflow.com/questions/403967",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
404,002 | <p>I'm trying to convert from a System.Drawing.Color to a Silverlight System.Windows.Media.Color. I'm actually trying to pass this color through a service.</p>
<p>The System.Drawing.Color, passed over the wire, does not serialize the argb value independently.</p>
<p>I can convert the argb value to a 32-bit int</p>
<pre><code>[DataMember]
public int MyColor { get { return Color.Red.ToArgb(); } set {} }
</code></pre>
<p>But I don't see any corresponding method in System.Windows.Media.Color to convert that back. </p>
<p>What is the best way to do this? </p>
| [
{
"answer_id": 403986,
"author": "Greg",
"author_id": 24181,
"author_profile": "https://Stackoverflow.com/users/24181",
"pm_score": 4,
"selected": false,
"text": "id"
},
{
"answer_id": 404036,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackove... | 2008/12/31 | [
"https://Stackoverflow.com/questions/404002",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
404,010 | <p>I am writing c# code in .Net 2008 Winforms.</p>
<p>I created a print preview window to create a report. It works fine I can preview the report and then print it. The only problem is it is not as flexible as the Office Print preview. The users cannot chose a printer other that the default printer and they cannot limit the print to certain pages. Perhaps I am missing some prperties I need.</p>
<p>Here is a portion of the code I use: </p>
<pre><code>PrintDocument pd = new PrintDocument();
pd.PrintPage += new PrintPageEventHandler(this.PrintTheGraph);
pd.DefaultPageSettings.Landscape = true;
// Allocate a print preview dialog object.
PrintPreviewDialog dlg = new PrintPreviewDialog();
dlg.Width = 100;
dlg.MinimumSize = new Size(375, 250);
dlg.SetBounds(100, -550, 800, 800);
dlg.Document = pd;
DialogResult result = dlg.ShowDialog();
</code></pre>
<p>Thanks, </p>
<p>Bob</p>
| [
{
"answer_id": 404026,
"author": "Dour High Arch",
"author_id": 22437,
"author_profile": "https://Stackoverflow.com/users/22437",
"pm_score": 3,
"selected": false,
"text": "PrintDialog pDialog = new PrintDialog( );\npDialog.Document = printDocument;\nif (pDialog.ShowDialog( ) == DialogRe... | 2008/12/31 | [
"https://Stackoverflow.com/questions/404010",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/50593/"
] |
404,015 | <p>I am trying to understand the file format of a Visual FoxPro compact index (*.IDX). I am currently referring to <a href="http://msdn.microsoft.com/en-us/library/s8tb8f47(VS.80).aspx" rel="nofollow noreferrer">Microsoft's documentation</a> for guidance.</p>
<p>The index is a B-tree of 512-byte nodes. Each leaf ("exterior") node contains multiple entries. Each entry consists of four pieces of data:</p>
<ul>
<li>Row number [FIXED LENGTH]</li>
<li>Duplicate byte count (documentation doesn't explain this) [FIXED LENGTH]</li>
<li>Trailing byte count (documentation doesn't explain this) [FIXED LENGTH]</li>
<li>Key [VARIABLE LENGTH]</li>
</ul>
<p>The entries (without their keys) are stored at the beginning of the node, immediately after the node's 24-byte header. Their keys are not included at this location because the keys vary in length, while the row number, duplicate byte count and trailing byte counts are fixed in length. The keys are stored at the end of the node and work their way backward. For example:</p>
<ul>
<li>24 byte header</li>
<li>row number, duplicate byte count, trailing byte count (entry #1)</li>
<li>row number, duplicate byte count, trailing byte count (entry #2)</li>
<li>row number, duplicate byte count, trailing byte count (entry #3)</li>
<li>...</li>
<li>key (entry #3)</li>
<li>key (entry #2)</li>
<li>key (entry #1)</li>
</ul>
<p>How do I determine the individual lengths of the keys? The documentation does not appear to specify this. They are perfectly contiguous (no null-byte separators).</p>
<p>I can isolate the keys manually by visual inspection. I suspected that the trailing byte count represented the length of the key. However, it did not correlate to the lengths determined by this inspection.</p>
<p>I believe that the FoxPro file formats are derived from the xBase standard. Perhaps this rings a bell?</p>
| [
{
"answer_id": 406780,
"author": "Adam Paynter",
"author_id": 41619,
"author_profile": "https://Stackoverflow.com/users/41619",
"pm_score": 3,
"selected": true,
"text": "variable_key_length = fixed_key_length - duplicate_byte_count - trailing_byte_count\n"
}
] | 2008/12/31 | [
"https://Stackoverflow.com/questions/404015",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41619/"
] |
404,019 | <p>I have a C# (2008/.NET 3.5) class library assembly that supports WPF (based on <a href="http://dotupdate.wordpress.com/2007/12/05/how-to-add-a-wpf-control-library-template-to-visual-c-express-2008/" rel="noreferrer">this article</a>).<br/> I've created several windows, and am now attempting to create a common style set for them. However, as it's a class library (instead of a WPF app), I don't have an app.xaml (and its contained Application & corresponding Application.Resources) in which to store these styles for global access.</p>
<p><strong>So:</strong> How can I create a top-level set of style definitions that'll be seen by all xaml files in the assembly, <em>given that I do not have app.xaml (see above)</em>? And/or is it possible to <em>add</em> a working app.xaml to a class library?</p>
<p>FYI, I did try creating a ResourceDictionary in a ResourceDictionary.xaml file, and include it in each window within a "Window.Resources" block. That turned out to solve the styling of Buttons, etc... but not for the enclosing Window. I can put <code>Style="{StaticResource MyWindowStyle}"</code> in the Window's opening block, and it compiles and shows up in the VS Design window fine, but during actual runtime I get a parse exception (MyWindowStyle could not be found; I'm guessing Visual Studio sees the dictionary included after the line in question, but the CRL does things more sequentially and therefore hasn't loaded the ResourceDictionary yet).</p>
<hr>
<p>Thanks for the ideas, but still no go... apparently a class library does NOT support the generic.xaml usage implicitly. I added generic.xaml to my class library project and set its Build Action to "Resource". It contains:</p>
<pre><code><ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Style TargetType="{x:Type Window}" x:Key="MyWindow">
<Setter Property="Background" Value="Black"/>
</Style>
</ResourceDictionary>
</code></pre>
<p>The window xaml that I want to have use the theme looks like this:</p>
<pre><code><Window x:Class="MyAssembly.ConfigureGenericButtons"
x:ClassModifier="internal"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Style="{StaticResource MyWindow}"
Title="ConfigureGenericButtons">
...Buttons, etc...
</Window>
</code></pre>
<p>Although the VS Design window doesn't show the window using the MyWindow style (ie black background), it compiles fine and starts up. However, when the app containing this class library makes a call that causes this window to display, I get a XamlParseException:</p>
<blockquote>
<p>Cannot find resource named '{MyWindow}'.</p>
</blockquote>
<p>I also tried leaving out the Style parameter, to see if the window would use the style by default (and I tried that both with the x:Key in generic.xaml included and without). No errors, but anything defined in the generic.xaml didn't show up either.</p>
<p>Am I doing something wrong here, or any other ideas on how one might allow for common custom styles to be used on a Window (ie, not have to define the styles in each Window's xaml) -- with the caveat that this is NOT an application?</p>
| [
{
"answer_id": 404503,
"author": "Cameron MacFarland",
"author_id": 3820,
"author_profile": "https://Stackoverflow.com/users/3820",
"pm_score": 4,
"selected": false,
"text": "/themes/generic.xaml [assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssem... | 2008/12/31 | [
"https://Stackoverflow.com/questions/404019",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/50597/"
] |
404,020 | <p>In my Flex interface, I've got a few List components that are data bound to ArrayCollections. I'm finding that when the ArrayCollections are updated (by Web services) and the data bindings for the Lists update, each List is reset and its selectedIndex is dropped. This is a problem if a user is in the middle of a task and has already selected an item in the List, but hasn't yet submitted the form.</p>
<p>I know how I can kludge together some ActionScript to deal with these cases, but do you know of any way to handle this more naturally using Flex's data binding or general-purpose event utilities?</p>
<p>As always, thanks!</p>
| [
{
"answer_id": 404503,
"author": "Cameron MacFarland",
"author_id": 3820,
"author_profile": "https://Stackoverflow.com/users/3820",
"pm_score": 4,
"selected": false,
"text": "/themes/generic.xaml [assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssem... | 2008/12/31 | [
"https://Stackoverflow.com/questions/404020",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40956/"
] |
404,024 | <p>I'm writing an ItemAdding handler for a SharePoint list, and the list contains multi-user fields. Since the SPItem is not actually available at this point, I think I'm relegated to using the string that comes back from the SPItemEventDataCollection. That string will look something like this when user1, user2, and user3 are present:</p>
<p>1;#MYDOMAIN\user1;#4;#MYDOMAIN\user2;#10;#MYDOMAIN\user3</p>
<p>I'd like to convert this into an array of SPUser objects in order to pass it into another existing method. Is there any SharePoint built-in way to handle these strings, or am I relegated to parsing this string?</p>
<p>Also, assuming I need to deal with this string, it looks like the integer tokens here always correspond to the domain\username that follows. Are there any cases where this will not be true and either the integer or the domain\username are missing or otherwise incorrect? Would it be safe to just use the numbers and use SPWeb's SiteUsers.GetByID(id) method? In a handful of tests I can't get that to fail, but it seems weird that both the numeric and string data would be included if they're totally redundant.</p>
<p>Thanks!</p>
| [
{
"answer_id": 404964,
"author": "Øyvind Skaar",
"author_id": 49194,
"author_profile": "https://Stackoverflow.com/users/49194",
"pm_score": 0,
"selected": false,
"text": "private SPUser getGroup(SPListItem item, string fieldName)\n {\n string fieldValue = item[fieldName... | 2008/12/31 | [
"https://Stackoverflow.com/questions/404024",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/404/"
] |
404,029 | <p>Not a SQL person at all. Have the following code a consultant wrote. </p>
<p>First, it makes sure only an elementary school has been chosen - then, after the BEGIN, if the variable @Term equals a 3 we want to do the stuff under that IF statement. Here's the problem. When @Term is not = 3 we still want to drop down and do the SECOND INSERT INTO @Classes part. FYI - the Term is = 3 when this is being run, but it's not doing both INSERT's - should there be an END IF at the end of that "IF @Term = 3" section instead of just a plain END?</p>
<pre><code>IF @SchoolCategoryCode = 'Elem'
--- We now have determined we are processing an elementary school...
BEGIN
---- Only do the following if the variable @Term equals a 3 - if it does not, skip just this first part
IF @Term = 3
BEGIN
INSERT INTO @Classes
SELECT
XXXXXX
FROM XXXX blah blah blah
END <----(Should this be ENDIF?)
---- **always** "fall thru" to here, no matter what @Term is equal to - always do the following INSERT for all elementary schools
INSERT INTO @Classes
SELECT
XXXXXXXX
FROM XXXXXX (more code)
END
</code></pre>
| [
{
"answer_id": 404035,
"author": "Charles Bretana",
"author_id": 32632,
"author_profile": "https://Stackoverflow.com/users/32632",
"pm_score": 2,
"selected": false,
"text": "If @Term = 3\n INSERT INTO @Classes\n SELECT XXXXXX \n FROM XXXX blah blah blah\n-- ---... | 2008/12/31 | [
"https://Stackoverflow.com/questions/404029",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
404,040 | <p>In a fairly animated discussion in my team I was made to think what most people like as primary keys. We had the following groups-</p>
<ol>
<li>Int/ BigInt which autoincrement are good enough primary keys.</li>
<li>There should be at least 3 columns that make up the primary key.</li>
<li>Id, GUID and human readable row identifiers all should be treated differently.</li>
</ol>
<p>What's the best approach for PKs? It would be awesome if you could justify your opinion. Is there a better approach that the above? </p>
<p>EDIT: Anyone has a simple sample/algorithm to generate human readable identifiers for rows that scales well?</p>
| [
{
"answer_id": 404135,
"author": "Bill Karwin",
"author_id": 20860,
"author_profile": "https://Stackoverflow.com/users/20860",
"pm_score": 5,
"selected": false,
"text": "state char(2) id"
},
{
"answer_id": 404161,
"author": "thursdaysgeek",
"author_id": 22523,
"author... | 2008/12/31 | [
"https://Stackoverflow.com/questions/404040",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37494/"
] |
404,043 | <p>I've done a lot of research on this,but I'm unable to solve this problem. I've got a Div with several Divs within it that I want to hide before switching on a TinyMCE instance.</p>
<p>I'm doing this via jQuery - </p>
<pre><code>$(".drop").hide()
</code></pre>
<p>This works fine, and every browser engine except Trident (IE) hides them. If I inspect the elements in IE, the css indicates "display:none".</p>
<p>I found a few articles and notes about how this is a feature of IE to show those elements, including this one on MSDN: <a href="http://msdn.microsoft.com/en-us/library/aa770023(VS.85).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/aa770023(VS.85).aspx</a></p>
<p>The problem is that I need those to hide. Any ideas?</p>
| [
{
"answer_id": 404211,
"author": "Soviut",
"author_id": 46914,
"author_profile": "https://Stackoverflow.com/users/46914",
"pm_score": 0,
"selected": false,
"text": ".drop\n{\n display: block; // or inline\n}\n"
}
] | 2008/12/31 | [
"https://Stackoverflow.com/questions/404043",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1649/"
] |
404,073 | <p>My client asked me (a JavaScript client-side programmer) to change the order of the options so that their company's option appears at the top of a select box when the page loads.</p>
<p>The following code works in Firefox but fails in Internet Explorer 7 when I try to swap two options:</p>
<pre><code> function load{
var shippingLocation = document.getElementById("location");
var swap = null;
var initiallyFirstItem = shippingLocation.options[0].cloneNode(true);
var lastPos = null;
for(var i = 0; i < shippingLocation.length; i++)
{
if(shippingLocation.options[i].value == "XETEX")
{
swap = shippingLocation.options[i];
lastPos = i;
break;
}
}
console.debug("sl: " + shippingLocation.options[0]);
console.debug("s: " + swap);
shippingLocation.options[0] = swap;
shippingLocation.options[lastPos] = initiallyFirstItem;
shippingLocation.selectedIndex = 0;
}
</code></pre>
<p>I get an error on the next to the third line from the bottom:</p>
<pre><code>shippingLocation.options[0] = swap;
</code></pre>
<p>The error states that "object doesn't support this property or method".</p>
<p>What's Internet Explorer's beef with switching option items?</p>
| [
{
"answer_id": 404211,
"author": "Soviut",
"author_id": 46914,
"author_profile": "https://Stackoverflow.com/users/46914",
"pm_score": 0,
"selected": false,
"text": ".drop\n{\n display: block; // or inline\n}\n"
}
] | 2008/12/31 | [
"https://Stackoverflow.com/questions/404073",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18149/"
] |
404,083 | <p>I read <a href="http://www.codinghorror.com/blog/archives/000621.html" rel="noreferrer">this post</a> last night, and I noticed it was from 2006. I could go either way on the ORM, database thing, but I was just wondering if everything bad Jeff said about ORM still applies even now considering the post is from 2006.</p>
| [
{
"answer_id": 36401511,
"author": "Rob Bygrave",
"author_id": 208581,
"author_profile": "https://Stackoverflow.com/users/208581",
"pm_score": 2,
"selected": false,
"text": "1 + N / batchSize"
},
{
"answer_id": 44118750,
"author": "Choppy The Lumberjack",
"author_id": 100... | 2008/12/31 | [
"https://Stackoverflow.com/questions/404083",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18149/"
] |
404,107 | <p>There are a variety of characters that are not legally encodeable in XML 1.0, e.g. <code>U+0007</code> ('bell') and <code>U+001B</code> ('escape'). Most of the interesting ones are non-whitespace 'control' characters. </p>
<p>It's clear from (e.g.) <a href="https://stackoverflow.com/questions/209193/special-characters-in-xml">this question</a> and others that it's <a href="http://www.sklar.com/blog/archives/96-XML-vs.-Control-Characters.html" rel="noreferrer">the XML spec that's the issue</a> -- but can anyone illuminate me as to <em>why</em> the XML spec forbids these characters? </p>
<p>It seems like it could have been required that they be encoded in escapes, e.g. as <code>&#x0007;</code> and <code>&#x001B;</code> respectively, but perhaps there's a practical reason that the characters were forbidden rather than required to be escaped?</p>
<p>Answerers have suggested that there is some motivation towards avoiding transmission control characters, but Unicode includes many <em>other</em> control-like characters (consider <code>U+200C</code> "zero width non joiner"). I recognize there may be no good reason for this behavior, but I would still like to understand it better.</p>
<p>It's particularly frustrating because when those character values appear in other <strike>encodings</strike> data formats, I end up "double-escaping" new XML documents that need to encode this.</p>
| [
{
"answer_id": 29828028,
"author": "Jirka Hanika",
"author_id": 1235565,
"author_profile": "https://Stackoverflow.com/users/1235565",
"pm_score": 4,
"selected": false,
"text": "U+0000 U+001f U+007F U+0080 U+009F U+0000 U+0009 U+000a U+000D U+0085 U+2028 U+0000 U+001f U+007F U+009F < &"
... | 2008/12/31 | [
"https://Stackoverflow.com/questions/404107",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49890/"
] |
404,109 | <p>Does anyone have a clue what I name this XML document and where to put it now that I have it created?</p>
<p>I would like to provide an OSDD (OpenSearch description document) on my site so that Google Chrome will automatically pick up search capabilities for it. Google tells me that's <a href="http://www.google.com/chrome/intl/en/webmasters-faq.html#osdd" rel="noreferrer">how it is done</a>, but not where it should be hosted. I also couldn't find any reference to the final location on the <a href="http://www.opensearch.org/Documentation/Frequently_asked_questions" rel="noreferrer">OpenSearch</a> site. I've even tried poking around the source of places that do support it to see if it is some sort of META tag to no avail.</p>
<p><strong>EDIT</strong> Well, there is one method of doing it explicitly. Now I just need to see if there is a way for it to happen automatically as it does on a number of sites (none of them have any sort of link tag): bugmenot.com, *.craigslist.org, and any others one might find when they right-click their Chrome address bar and choose "Edit search engines...".</p>
| [
{
"answer_id": 404128,
"author": "Micah",
"author_id": 17744,
"author_profile": "https://Stackoverflow.com/users/17744",
"pm_score": 3,
"selected": false,
"text": "<link rel=\"search\" type=\"application/opensearchdescription+xml\" title=\"Stack Overflow\" href=\"/opensearch.xml\" />\n"
... | 2008/12/31 | [
"https://Stackoverflow.com/questions/404109",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48700/"
] |
404,141 | <p>First, how do I format the XML processing instruction, is it:</p>
<pre><code><?processingInstructionName attribute="value" attribute2="value2"?>
</code></pre>
<p>Using StAX, I then want to read it by handling the <code>XMLStreamConstants.PROCESSING_INSTRUCTION</code> (<a href="http://java.sun.com/javase/6/docs/api/javax/xml/stream/XMLStreamConstants.html#PROCESSING_INSTRUCTION" rel="nofollow noreferrer">javadoc</a>) event, but it only provides two methods to then retrieve information about the processing instruction from the <code>XMLStreamReader</code>:</p>
<pre><code>getPITarget()
getPIData()
</code></pre>
<p>The <a href="http://java.sun.com/javase/6/docs/api/javax/xml/stream/XMLStreamReader.html#getPIData()" rel="nofollow noreferrer">javadoc</a> for these two methods isn't very helpful.</p>
<ol>
<li>Is the XML formatting correct?</li>
<li>Is this the proper way to go about
parsing processing instructions
using the StAX <code>XMLStreamReader</code>
APIs?</li>
<li>How do I use <code>getPITarget()</code> and <code>getPIData()</code> to return multiple arguments?</li>
</ol>
| [
{
"answer_id": 404355,
"author": "Dimitre Novatchev",
"author_id": 36305,
"author_profile": "https://Stackoverflow.com/users/36305",
"pm_score": 3,
"selected": true,
"text": "pseudo-attributes split()"
},
{
"answer_id": 41202788,
"author": "Dave Jarvis",
"author_id": 5908... | 2008/12/31 | [
"https://Stackoverflow.com/questions/404141",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2134/"
] |
404,146 | <p>On Windows,
how can my user-mode program get the driver version number(s) for the video card(s) installed?</p>
<p>Programs like ATI's "Catalyst Control Center" can display this information to the user or include it automatically into bug reports. How do they get it?</p>
<p>I've been looking thru the PSDK documentation, and I can't find anything relevant.</p>
<p>Can a user program walk thru the database that Device Manager displays? <br>
Is there an IOCTL call like getting disk drive geometry? <br>
Is it in a (reliable) registry key?</p>
| [
{
"answer_id": 404372,
"author": "JasonTrue",
"author_id": 13433,
"author_profile": "https://Stackoverflow.com/users/13433",
"pm_score": 4,
"selected": true,
"text": "Get-WmiObject Win32_VideoController | format-table Name, Description,VideoProcessor,DriverVersion\n |where {$_.VideoProce... | 2008/12/31 | [
"https://Stackoverflow.com/questions/404146",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40756/"
] |
404,163 | <pre><code>var y = new w();
var x = y.z;
y.z= function() {
doOneThing();
x();
}
</code></pre>
<p><em>where <code>w</code> does not contain a <code>z</code> object but contains other objects (e.g, <code>a</code>, <code>b</code>, <code>c</code>)</em></p>
<p>What is <code>x();</code> possibly referring too? (Again, this is JavaScript)<br>
Is the function calling itself?</p>
| [
{
"answer_id": 404168,
"author": "Greg",
"author_id": 24181,
"author_profile": "https://Stackoverflow.com/users/24181",
"pm_score": 1,
"selected": false,
"text": "var y = new w();\n\n// Create a global variable x referring to the y.z method\nvar x = y.z;\n\ny.z= function() {\n doO... | 2008/12/31 | [
"https://Stackoverflow.com/questions/404163",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49881/"
] |
404,169 | <p>While browsing the various option switches for my compiler (GNU C++ 3.2.3 is supported by my organization for my given hardware configuration), I ran across this:</p>
<pre><code>-glevel
:
Level 3 includes extra information, such as all the macro definitions
present in the program. Some debuggers support macro expansion when
you use -g3.
</code></pre>
<p>I compiled a test program with a few macros (such as a loop, a if-then-else on an argument), then tried the commercial debugger TotalView, and GDB on the code compiled -g3. I didn't see any difference (macros were not expanded to their original code, I couldn't 'step into' the macros, etc.).</p>
<p>Anyone here had the experience of getting extra debugging 'features' using -g3 on GNU compilers?</p>
| [
{
"answer_id": 404220,
"author": "Norman Ramsey",
"author_id": 41661,
"author_profile": "https://Stackoverflow.com/users/41661",
"pm_score": 2,
"selected": false,
"text": "-g3"
},
{
"answer_id": 415861,
"author": "Employed Russian",
"author_id": 50617,
"author_profile... | 2008/12/31 | [
"https://Stackoverflow.com/questions/404169",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3778/"
] |
404,171 | <p>Is there any way to get XCode to render text in the editor with anti-aliasing enabled? I can't see anything in the preferences dialog that would do it.</p>
| [
{
"answer_id": 404183,
"author": "Adam Peck",
"author_id": 26658,
"author_profile": "https://Stackoverflow.com/users/26658",
"pm_score": 3,
"selected": false,
"text": "defaults write com.apple.xcode AppleAntiAliasingThreshold -int <font-size>\ndefaults write com.apple.xcode AppleSmoothFo... | 2008/12/31 | [
"https://Stackoverflow.com/questions/404171",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47612/"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.