qid int64 4 22.2M | question stringlengths 18 48.3k | answers list | date stringlengths 10 10 | metadata list |
|---|---|---|---|---|
198,240 | <p>I'm looking to use Java to parse an ongoing stream of event drive XML generated by a remote device. Here's a simplified sample of two events:</p>
<pre><code><?xml version="1.0"?>
<Event> DeviceEventMsg
<Param1>SomeParmValue</Param1>
</Event>
<?xml version="1.0"?>
<Event> DeviceEventMsg
<Param1>SomeParmValue</Param1>
</Event>
</code></pre>
<p>It seems like SAX is more suited to this than DOM because it is an ongoing stream, though I'm not as familiar with Sax. Don't yell at me for the structure of the XML - I know it already and can't change it. </p>
<p>And yes the device DOES send the xml directive before every event. My first problem is that the second xml processing instruction is croaking the SAX parser. </p>
<p>Can anyone suggest a way to get around that?</p>
<hr>
<p>The code I'm using so far which is croaking on the second xml processing instruction is:</p>
<pre><code>public class TestMe extends HandlerBase {
public void startDocument () throws SAXException
{
System.out.println("got startDocument");
}
public void endDocument () throws SAXException
{
System.out.println("got endDocument");
}
public void startElement (String name, AttributeList attrs) throws SAXException
{
System.out.println("got startElement");
}
public void endElement (String name) throws SAXException
{
System.out.println("got endElement");
}
public void characters (char buf [], int offset, int len) throws SAXException
{
System.out.println("found characters");
}
public void processingInstruction (String target, String data) throws SAXException
{
System.out.println("got processingInstruction");
}
public static void main(String[] args) {
SAXParserFactory factory = SAXParserFactory.newInstance();
try {
SAXParser saxParser = factory.newSAXParser();
// using a file as test input for now
saxParser.parse( new File("devmodule.xml"), new TestMe() );
} catch (Throwable err) {
err.printStackTrace ();
}
}
}
</code></pre>
| [
{
"answer_id": 199102,
"author": "simon",
"author_id": 6040,
"author_profile": "https://Stackoverflow.com/users/6040",
"pm_score": 0,
"selected": false,
"text": "<?xml version=\"1.0\"?>"
},
{
"answer_id": 199143,
"author": "simon",
"author_id": 6040,
"author_profile":... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198240",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27524/"
] |
198,244 | <p>I have a checkstyle suppression filter setup (e.g. ignore magic numbers in unit test code).</p>
<p>The suppression xml file resides in the same folder as the checkstyle xml file. However, where this file actually is varies:
on my windows dev box it is in d:\dev\shared\checkstyle\config
on the Linux CI server it will be in /root/repo/shared/checkstyle/config
on another developers box it could be anywhere (they check out their svn repo to).</p>
<p>The only "consistent" thing is that the suppression file is always in the same folder as the checkstyle xml file.
I cannot work out how to ensure that this file is always consistently picked up. Also I don't know why checkstyle does not support embedded suppression within the checkstyle xml file.</p>
<p>any help?</p>
| [
{
"answer_id": 199291,
"author": "Greg Mattes",
"author_id": 13940,
"author_profile": "https://Stackoverflow.com/users/13940",
"pm_score": 5,
"selected": true,
"text": "SuppressionFilter"
},
{
"answer_id": 945071,
"author": "gibbss",
"author_id": 116621,
"author_profi... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198244",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27522/"
] |
198,247 | <p>Where I'm at the developers have been updated to Excel 2007, but most of the users haven't. I'm building a spreadsheet template (*.xlt) for a user that's gonna need some vba code included, and I'm wondering what issues I'm likely to run into building this in 2007 instead of 2003? I don't have access to a machine with Excel 2003 for testing, and I'm worried this particular project is headed for disaster.</p>
| [
{
"answer_id": 2221331,
"author": "Chris Spicer",
"author_id": 210566,
"author_profile": "https://Stackoverflow.com/users/210566",
"pm_score": 2,
"selected": false,
"text": "#If USINGRIBBON Then\n Public Sub CallFromRibbon(control As IRibbonControl)\n#Else\n Public Sub CallFromRibb... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198247",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3043/"
] |
198,248 | <p>I’m using the gcc in MinGW that comes with Strawberry Perl, on Windows XP. I’d like to have <a href="http://www.gnu.org/software/ddd/" rel="nofollow noreferrer">ddd</a> (the Data Display Debugger) as well but apparently on Windows the simplest way to get ddd is by running Cygwin. So what's the bare minimum of Cygwin I can install to get ddd up and running? I'd prefer if I could run ddd natively on Win32 but that doesn't seem to be an option. </p>
| [
{
"answer_id": 198335,
"author": "Charles Duffy",
"author_id": 14122,
"author_profile": "https://Stackoverflow.com/users/14122",
"pm_score": 0,
"selected": false,
"text": "xorg-x11-base"
},
{
"answer_id": 8272440,
"author": "Keith Thompson",
"author_id": 827263,
"auth... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198248",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25093/"
] |
198,266 | <p>Can anyone provide and example of downloading a PDF file using Watin? I tried the SaveAsDialogHandler but I couldn't figure it out. Perhaps a MemoryStream could be used?</p>
<p>Thanks,</p>
<p>--jb</p>
| [
{
"answer_id": 201464,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 2,
"selected": false,
"text": "fileDownloadHandler.WaitUntilFileDownloadDialogIsHandled(30);\nfileDownloadHandler.WaitUntilDownloadCompleted(200);\n"
},
... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198266",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
198,272 | <p>Is it possible to read damaged media (cd, hdd, dvd,...) even if windows explorer bombs out?</p>
<p>What I mean to ask is, whether there is a set of APIs or something that can access the disk at a very low level (below explorer?) and read whatever can be retrieved even if it is only partial, especially if you can still see the file is there from explorer, but can't do anything with it because it is damaged somehow (scratch on cd, etc)?</p>
| [
{
"answer_id": 36512022,
"author": "ryenus",
"author_id": 537554,
"author_profile": "https://Stackoverflow.com/users/537554",
"pm_score": 1,
"selected": false,
"text": "ddrescue"
}
] | 2008/10/13 | [
"https://Stackoverflow.com/questions/198272",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
198,279 | <p>I am a complete beginner trying to develop for FCKeditor so please bear with me here. I have been tasked with developing a custom plugin that will allow users to browse a specific set of images that the user uploads. Essentially the user first attaches images, then uses the FCKeditor to insert those images.</p>
<p>So I have my plugin directory:</p>
<ul>
<li>lang </li>
<li>fckplugin.js </li>
<li>img.png (for the toolbar button)</li>
</ul>
<p>I am looking for some help on strategy for the custom file browser (lets call it mybrowser.asp).</p>
<p>1) Should mybrowser.asp be in the plugin directory? It is dynamic and only applies to one specific area of the site.</p>
<p>2) How should I pass the querystring to mybrowser.asp?</p>
<p>3) Any other recommendations for developing FCKeditor plugins? Any sample plugins that might be helpful to me? </p>
<p>EDIT: The querystring passed to the plugin page will be the exact same as the one on the host page. (This is a very specific plugin that will only be used in one place)</p>
| [
{
"answer_id": 198311,
"author": "Patrick McElhaney",
"author_id": 437,
"author_profile": "https://Stackoverflow.com/users/437",
"pm_score": 2,
"selected": true,
"text": "// Register the related command. \n// RegisterCommand takes the following arguments: CommandName, DialogCommand \n// ... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198279",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/285/"
] |
198,285 | <p>I'm using the following code, using the <a href="http://www.sharpziplib.com/" rel="noreferrer">SharpZipLib</a> library, to add files to a .zip file, but each file is being stored with its full path. I need to only store the file, in the 'root' of the .zip file.</p>
<pre><code>string[] files = Directory.GetFiles(folderPath);
using (ZipFile zipFile = ZipFile.Create(zipFilePath))
{
zipFile.BeginUpdate();
foreach (string file in files)
{
zipFile.Add(file);
}
zipFile.CommitUpdate();
}
</code></pre>
<p>I can't find anything about an option for this in the supplied documentation. As this is a very popular library, I hope someone reading this may know something.</p>
| [
{
"answer_id": 198301,
"author": "Tamas Czinege",
"author_id": 8954,
"author_profile": "https://Stackoverflow.com/users/8954",
"pm_score": 4,
"selected": false,
"text": "string[] files = Directory.GetFiles(folderPath);\nusing (ZipFile zipFile = ZipFile.Create(zipFilePath))\n{\n zipFi... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198285",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8741/"
] |
198,295 | <p>I'm setting the cookie expiration using the following code:</p>
<hr>
<pre><code>// remove existing cookies.
request.Cookies.Clear();
response.Cookies.Clear();
// ... serialize and encrypt my data ...
// now set the cookie.
HttpCookie cookie = new HttpCookie(AuthCookieName, encrypted);
cookie.Expires = DateTime.Now.Add(TimeSpan.FromHours(CookieTimeOutHours));
cookie.HttpOnly = true;
response.Cookies.Add(cookie);
// redirect to different page
</code></pre>
<hr>
<p>When I read the cookie timeout in the other page I'm getting 1/1/0001 12:00 AM. If someone can help me figure out the problem, I'll appreciate it. I'm using ASP.NET 3.5</p>
<p>ok. after reading the links from Gulzar, it appears that I cannot check cookie.Expires on the HttpRequest at all? Because the links seem to suggest that cookie.Expires is always set to DateTime.MinValue because the server can never know the actual time on the client machine? So this means I have to store the time inside the cookie myself and check it? Is my understanding correct?</p>
<p>thanks
Shankar</p>
| [
{
"answer_id": 31889776,
"author": "Jeff Nicholson",
"author_id": 1815399,
"author_profile": "https://Stackoverflow.com/users/1815399",
"pm_score": 2,
"selected": false,
"text": " public static void Configuration(IAppBuilder app)\n {\n\n app.UseCookieAuthentication(new Cooki... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198295",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20818/"
] |
198,312 | <p>I'm learning how to make a firefox extension.
I have created a xul and overlay file that makes a sidebar in my browser. I'm trying to put buttons in my sidebar that load different pages within the main browser window. I'm not sure how to access the main browser window and load a new url within it. I have here a simple button and script to show you what I have so far. Any light on this subject would be greatly appreciated! </p>
<pre><code><script type="application/x-javascript">
function loadURL(url) {
// I know this part is wrong. How do I load url into main browser??
window.content.open(url)
}
</script>
<button
id="identifier"
class="dialog"
label="Yahoo"
image="images/image.jpg"
oncommand="loadURL("http://www.yahoo.com);"/>
</code></pre>
| [
{
"answer_id": 3382347,
"author": "esafwan",
"author_id": 363661,
"author_profile": "https://Stackoverflow.com/users/363661",
"pm_score": 0,
"selected": false,
"text": "document.getElementById('1').loadURI('http://tridz.com')\n"
}
] | 2008/10/13 | [
"https://Stackoverflow.com/questions/198312",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27538/"
] |
198,320 | <p>As far as I can understand, when I new up a <em>Linq to SQL class</em>, it is the equivalent of new'ing up a <em>SqlConnection object</em>.</p>
<p>Suppose I have an object with two methods: <code>Delete()</code> and <code>SubmitChanges()</code>. Would it be wise of me to new up the <em>Linq to SQL class</em> in each of the methods, or would a private variable holding the <em>Linq to SQL class</em> - new'ed up by the constructor - be the way to go?</p>
<p>What I'm trying to avoid is a time-out.</p>
<p><strong>UPDATE:</strong></p>
<pre><code>namespace Madtastic
{
public class Comment
{
private Boolean _isDirty = false;
private Int32 _id = 0;
private Int32 _recipeID = 0;
private String _value = "";
private Madtastic.User _user = null;
public Int32 ID
{
get
{
return this._id;
}
}
public String Value
{
get
{
return this._value;
}
set
{
this._isDirty = true;
this._value = value;
}
}
public Madtastic.User Owner
{
get
{
return this._user;
}
}
public Comment()
{
}
public Comment(Int32 commentID)
{
Madtastic.DataContext mdc = new Madtastic.DataContext();
var comment = (from c in mdc.Comments
where c.CommentsID == commentID
select c).FirstOrDefault();
if (comment != null)
{
this._id = comment.CommentsID;
this._recipeID = comment.RecipesID;
this._value = comment.CommentsValue;
this._user = new User(comment.UsersID);
}
mdc.Dispose();
}
public void SubmitChanges()
{
Madtastic.DataContext mdc = new Madtastic.DataContext();
var comment = (from c in mdc.Comments
where c.CommentsID == this._id
select c).FirstOrDefault();
if (comment != null && this._isDirty)
{
comment.CommentsValue = this._value;
}
else
{
Madtastic.Entities.Comment c = new Madtastic.Entities.Comment();
c.RecipesID = this._recipeID;
c.UsersID = this._user.ID;
c.CommentsValue = this._value;
mdc.Comments.InsertOnSubmit(c);
}
mdc.SubmitChanges();
mdc.Dispose();
}
public void Delete()
{
Madtastic.DataContext mdc = new Madtastic.DataContext();
var comment = (from c in mdc.Comments
where c.CommentsID == this._id
select c).FirstOrDefault();
if (comment != null)
{
mdc.Comments.DeleteOnSubmit(comment);
mdc.SubmitChanges();
this._isDirty = false;
this._id = 0;
this._recipeID = 0;
this._value = "";
this._user = null;
}
mdc.Dispose();
}
}
}
</code></pre>
<p><strong>REFACTORED CODE (according to Grank's spec):</strong></p>
<pre><code>namespace Madtastic
{
public sealed class CommentNew : IDisposable
{
private Madtastic.DataContext _mdc;
private Madtastic.Entities.Comment _comment;
private Madtastic.User _user;
public Int32 ID
{
get
{
return this._comment.CommentsID;
}
}
public String Value
{
get
{
return this._comment.CommentsValue;
}
set
{
this._comment.CommentsValue = value;
}
}
public Madtastic.User Owner
{
get
{
return this._user;
}
}
public void Comment(Int32 commentID)
{
this._mdc = new Madtastic.DataContext();
this._comment = (from c in _mdc.Comments
where c.CommentsID == commentID
select c).FirstOrDefault();
if (this._comment == null)
{
this._comment = new Madtastic.Entities.Comment();
this._mdc.Comments.InsertOnSubmit(this._comment);
}
else
{
this._user = new Madtastic.User(this._comment.User.UsersID);
}
}
public void SubmitChanges()
{
this._mdc.SubmitChanges();
}
public void Delete()
{
this._mdc.Comments.DeleteOnSubmit(this._comment);
this.SubmitChanges();
}
void IDisposable.Dispose()
{
this._mdc.Dispose();
}
}
}
</code></pre>
| [
{
"answer_id": 199159,
"author": "Grank",
"author_id": 12975,
"author_profile": "https://Stackoverflow.com/users/12975",
"pm_score": 3,
"selected": true,
"text": "namespace Madtastic\n{\n public class Comment\n {\n private Madtastic.DataContext mdc;\n private Madtasti... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198320",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20946/"
] |
198,322 | <p>Let's say I'm working on a little batch-processing console app in VB.Net. I want to be able to structure the app like this:</p>
<pre class="lang-vb prettyprint-override"><code>Sub WorkerMethod()
'Do some work
Trace.WriteLine("Work progress")
'Do more work
Trace.WriteLine("Another progress update")
'...
End Sub
Sub Main()
'Do any setup, like confirm the user wants to continue or whatever
WorkerMethod()
End Sub
</code></pre>
<p>Note that I'm using <code>Trace</code> rather than <code>Console</code> for my output. This is because the worker method may be called from elsewhere, or even live in a different assembly, and I want to be able to attach different trace listeners to it. So how can I connect the console to the trace? </p>
<p>I can already do it by defining a simple class (shown below) and adding an instance to the Trace's listeners collection, but I'm wondering if there's a more accepted or built in way to accomplish this:</p>
<pre class="lang-vb prettyprint-override"><code>Public Class ConsoleTrace
Inherits Diagnostics.TraceListener
Public Overloads Overrides Sub Write(ByVal message As String)
Console.Write(message)
End Sub
Public Overloads Overrides Sub WriteLine(ByVal message As String)
Console.WriteLine(message)
End Sub
End Class
</code></pre>
| [
{
"answer_id": 198326,
"author": "harpo",
"author_id": 4525,
"author_profile": "https://Stackoverflow.com/users/4525",
"pm_score": 8,
"selected": true,
"text": "<?xml version=\"1.0\"?>\n<configuration>\n <system.diagnostics>\n <trace autoflush=\"true\">\n <listeners>... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198322",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3043/"
] |
198,343 | <p>We're working with a fixed transaction log size on our databases, and I'd like to put together an application to monitor the log sizes so we can see when things are getting too tight and we need to grow the fixed trn log. </p>
<p>Is there any TSQL command that I can run which will tell me the current size of the transaction log, and the fixed limit of the transaction log?</p>
| [
{
"answer_id": 198363,
"author": "Eric Z Beard",
"author_id": 1219,
"author_profile": "https://Stackoverflow.com/users/1219",
"pm_score": 4,
"selected": false,
"text": "DBCC SQLPERF ( LOGSPACE )\n"
},
{
"answer_id": 198427,
"author": "Tom H",
"author_id": 5696608,
"au... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198343",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21973/"
] |
198,346 | <p>I've found a few samples online but I'd like to get feedback from people who use PHP daily as to potential security or performance considerations and their solutions.</p>
<p>Note that I am only interested in uploading a single file at a time.</p>
<p>Ideally no browser plugin would be required (Flash/Java), although it would be interesting to know the benefits of using a plugin.</p>
<p>I would like to know both the best HTML form code and PHP processing code.</p>
| [
{
"answer_id": 198459,
"author": "Drew Noakes",
"author_id": 24874,
"author_profile": "https://Stackoverflow.com/users/24874",
"pm_score": 6,
"selected": true,
"text": "<form enctype=\"multipart/form-data\" action=\"action.php\" method=\"POST\">\n <input type=\"hidden\" name=\"MAX_FILE_... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198346",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24874/"
] |
198,357 | <p>A lot of programming languages and frameworks do/allow/require something that I can't seem to find the name for, even though there probably is one in computer science. What they basically do is bind to a variable/object/class/function by name. </p>
<p><a href="http://www.adobe.com/products/flex/" rel="noreferrer">Flex</a> example ("selectAll()"):</p>
<pre><code><mx:Button click="selectAll()" label="Select All"/>
</code></pre>
<p><a href="http://mate.asfusion.com/" rel="noreferrer">Mate</a> example ("price"):</p>
<pre><code><Injectors target="{QuotePanel}">
<PropertyInjector targetKey="price" source="{QuoteManager}" sourceKey="currentPrice" />
</Injectors>
</code></pre>
<p>Java example ("Foo"):</p>
<pre><code>Class.forName("Foo")
</code></pre>
<p>There are many other examples. You get the idea. What troubles me is that there is virtually no way to verify this at compile-time, and not much the IDE can do to help in terms of code completion, navigation, and refactoring. But that's besides the point.</p>
<p>My question is, what is this called? <strong><em>I don't think it's one of these: <a href="http://en.wikipedia.org/wiki/Dynamic_binding" rel="noreferrer">dynamic binding</a>, <a href="http://en.wikipedia.org/wiki/Name_binding" rel="noreferrer">name binding</a>, <a href="http://en.wikipedia.org/wiki/Reflection_(computer_science)" rel="noreferrer">reflection</a></em></strong></p>
<p><strong>Update</strong>: No, this is not a quiz, sorry if it sounds like one. It's simply a matter of "name that song" for programming.</p>
<p><strong>Update</strong>: Answers that helped:</p>
<ul>
<li>From Tim Lesher: It's called "late binding", "dynamic binding", or "runtime binding". <em>The fact that it binds by a string is just an implementation detail</em>...</li>
<li>From Konrad Rudolph: ...<em>it's simply input for an interpreter</em>.</li>
</ul>
<p><strong>Update</strong>: As people have correctly pointed out, some of the examples are late binding, some are reflection, some are runtime-evaluation (interpretation), etc. However, I conclude there probably is no name that describes them all. It's just a bunch of examples that do have something in common, but not enough to give it a name. I liked the "everything is a string" answer, but even though it's funny, it doesn't fully do it justice either.</p>
| [
{
"answer_id": 198364,
"author": "Konrad Rudolph",
"author_id": 1968,
"author_profile": "https://Stackoverflow.com/users/1968",
"pm_score": 2,
"selected": false,
"text": "Class.forName"
},
{
"answer_id": 198436,
"author": "Konrad Rudolph",
"author_id": 1968,
"author_p... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198357",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13041/"
] |
198,360 | <p>I would like to host a silverlight control in winforms via a winforms browser, but for it to work I need some way for the forms to talk to the silverlight, and also the other way around. Would it be possible to somehow have the two interact with each other using JavaScript as a middleman? I.e., have the form speak to the browser's javascript, and have that speak to the silverlight control? Is there a better way? Or even a way at all? (other than compiling the code as silverlight and wpf)</p>
| [
{
"answer_id": 208920,
"author": "wahrhaft",
"author_id": 17986,
"author_profile": "https://Stackoverflow.com/users/17986",
"pm_score": 5,
"selected": true,
"text": "webBrowser.AllowNavigation = false;\nwebBrowser.AllowWebBrowserDrop = false;\nwebBrowser.IsWebBrowserContextMenuEnabled = ... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198360",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3291/"
] |
198,365 | <p>in Config.groovy I see this:</p>
<pre><code>// set per-environment serverURL stem for creating absolute links
environments {
production {
grails.serverURL = "http://www.changeme.com"
}
}
</code></pre>
<p>what is the correct way to access that at runtime?</p>
| [
{
"answer_id": 198466,
"author": "danb",
"author_id": 2031,
"author_profile": "https://Stackoverflow.com/users/2031",
"pm_score": 4,
"selected": false,
"text": "import org.codehaus.groovy.grails.commons.ConfigurationHolder\nprintln ConfigurationHolder.config.grails.serverURL\n"
},
{
... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198365",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2031/"
] |
198,409 | <p>Is there code in VBA I can wrap a function with that will let me know the time it took to run, so that I can compare the different running times of functions?</p>
| [
{
"answer_id": 198702,
"author": "Mike Woodhouse",
"author_id": 1060,
"author_profile": "https://Stackoverflow.com/users/1060",
"pm_score": 7,
"selected": true,
"text": "QueryPerformanceCounter"
},
{
"answer_id": 199480,
"author": "dbb",
"author_id": 25675,
"author_pr... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198409",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13295/"
] |
198,419 | <p>I'm getting XML like this:</p>
<p><code><Items>
<Row attr1="val"></Row>
<Row attr1="val2"></Row>
</Items></code></p>
<p>This is valid XML, as you know, but another library I'm using is busted and it will only accept XML in this format: </p>
<p><code><Items>
<Row attr1="val"/>
<Row attr1="val2"/>
</Items>
</code></p>
<p>I'm already reading the XML into XmlDocuments, manipulating them, and rewriting them using an XmlWriter(), what's the easiest (and most efficient) way for me to "collapse" these empty tags?</p>
| [
{
"answer_id": 198579,
"author": "FlySwat",
"author_id": 1965,
"author_profile": "https://Stackoverflow.com/users/1965",
"pm_score": 0,
"selected": false,
"text": "XmlElement items = xmlDoc.SelectNodes(\"items\");\nXmlElement row = xmlDoc.CreateElement(\"row\");\nitems[0].appendChild(row... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198419",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12979/"
] |
198,431 | <p>Is there a standard idiom for comparing version numbers? I can't just use a straight String compareTo because I don't know yet what the maximum number of point releases there will be. I need to compare the versions and have the following hold true:</p>
<pre><code>1.0 < 1.1
1.0.1 < 1.1
1.9 < 1.10
</code></pre>
| [
{
"answer_id": 836665,
"author": "Peter Lawrey",
"author_id": 57695,
"author_profile": "https://Stackoverflow.com/users/57695",
"pm_score": 6,
"selected": false,
"text": "import java.util.regex.Pattern;\n\npublic class Main {\n public static void main(String... args) {\n compar... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198431",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1288/"
] |
198,438 | <p>Is there an efficient way of detecting if a jpeg file is corrupted? </p>
<p>Background info:<br>
solutions needs to work from within a php script<br>
the jpeg files are on disk<br>
manual checking is no option (user uploaded data) </p>
<p>I know that <code>imagecreatefromjpeg(string $filename);</code> can do it. But it is quite slow at doing so.</p>
<p>Does anybody know a faster/more efficient solutions?</p>
| [
{
"answer_id": 1622536,
"author": "fireweasel",
"author_id": 26258,
"author_profile": "https://Stackoverflow.com/users/26258",
"pm_score": 3,
"selected": false,
"text": "\nfunction jpeg_file_is_complete($path) {\n if (!is_resource($file = fopen($path, 'rb'))) {\n return FALSE;\... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198438",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22674/"
] |
198,448 | <p>I'm planning on doing my next project in c# rather than c++ (using SlimDX).</p>
<p>All of directX uses floats, however System.Math uses doubles. This means constantly converting between floats and doubles.</p>
<p>So ideally I'd like to write all the code using floats, since I'm not getting any added precision converting to floats from doubles all the time anyways...</p>
<p>However Ive been unable to find a set of maths functions for .net that uses floats. I could of course write my own library in c#, but id rather use an existing library which has been optimised etc...</p>
| [
{
"answer_id": 60558935,
"author": "picolino",
"author_id": 9262535,
"author_profile": "https://Stackoverflow.com/users/9262535",
"pm_score": 1,
"selected": false,
"text": "MathF"
}
] | 2008/10/13 | [
"https://Stackoverflow.com/questions/198448",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6266/"
] |
198,460 | <p>How do I generate a random number between <code>0</code> and <code>n</code>?</p>
| [
{
"answer_id": 198469,
"author": "Mark A. Nicolosi",
"author_id": 1103052,
"author_profile": "https://Stackoverflow.com/users/1103052",
"pm_score": 5,
"selected": false,
"text": "rand(n + 1)\n"
},
{
"answer_id": 198470,
"author": "VonC",
"author_id": 6309,
"author_pro... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198460",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1103052/"
] |
198,462 | <p>When comparing an HTTP GET to an HTTP POST, what are the differences from a security perspective? Is one of the choices inherently more secure than the other? If so, why?</p>
<p>I realize that POST doesn't expose information on the URL, but is there any real value in that or is it just security through obscurity? Is there ever a reason that I should prefer POST when security is a concern?</p>
<p><strong>Edit:</strong><br>
Over HTTPS, POST data is encoded, but could URLs be sniffed by a 3rd party? Additionally, I am dealing with JSP; when using JSP or a similar framework, would it be fair to say the best practice is to avoid placing sensitive data in the POST or GET altogether and using server side code to handle sensitive information instead?</p>
| [
{
"answer_id": 198487,
"author": "Andrew Moore",
"author_id": 26210,
"author_profile": "https://Stackoverflow.com/users/26210",
"pm_score": 5,
"selected": false,
"text": "POST"
},
{
"answer_id": 4725795,
"author": "Incognito",
"author_id": 257493,
"author_profile": "h... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198462",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20774/"
] |
198,465 | <p>Is there any way to access the file object used by a CSV writer/reader object after it has been instantiated? I openned up the csv module, and it appears it's contest are builtin. I also tried setting the file object as a property but I get the following error:</p>
<pre><code>AttributeError: '_csv.writer' object has no attribute 'fileobj'
</code></pre>
| [
{
"answer_id": 198553,
"author": "Dan Lenski",
"author_id": 20789,
"author_profile": "https://Stackoverflow.com/users/20789",
"pm_score": 3,
"selected": true,
"text": "csv.writer"
}
] | 2008/10/13 | [
"https://Stackoverflow.com/questions/198465",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9940/"
] |
198,478 | <p>What are the key differences between Microsoft's SQL Server 2005 and SQL Server 2008? </p>
<p>Are there any compelling reasons for upgrading (any edition, as I have a customer with multiple editions)? Or is there a website with either a chart or bullet point comparison of the two servers?</p>
<p>Also, is there anything noteworthy in the <a href="http://en.wikipedia.org/wiki/SQL_Server_Express" rel="noreferrer">Express</a> editions of either version?</p>
| [
{
"answer_id": 4538108,
"author": "vipin",
"author_id": 554888,
"author_profile": "https://Stackoverflow.com/users/554888",
"pm_score": 2,
"selected": false,
"text": "* DATE: As you can imagine, the DATE data type only stores a date in the format of YYYY-MM-DD. It has a range of 0001-01-... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198478",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13990/"
] |
198,493 | <p>I'm developing a system that needs to execute Intersystems Cache Terminal Scripts.</p>
<p>When I run a routine inside the regular Caché terminal or a telnet terminal, Cache executes the routine until the end with no problems. But when I try to run the same routine, but this time calling the routine within a Caché terminal Script, Caché disconnects the session after a while. There is no mention at all in the documentation of a "timeout" setting or anything realted to the "" messages i'm getting.</p>
<p>The script is run just like this:</p>
<pre><code>Cterm.exe /console=cn_iptcp:192.168.2.13[23] c:\test.s
</code></pre>
<p>1) Does anybody know what may be causing Interystems Caché to disconnected the session in the middle of the run (the session isn't idle either. It regularly outputs status messages to the console)?</p>
<p>2) Any ideas of how to solve it?</p>
<p>Thanks,</p>
<p>Luís Fernando</p>
| [
{
"answer_id": 302330,
"author": "Luis Soeiro",
"author_id": 24165,
"author_profile": "https://Stackoverflow.com/users/24165",
"pm_score": 2,
"selected": false,
"text": " waitfor \"Operation finished\"\nterminate\n"
}
] | 2008/10/13 | [
"https://Stackoverflow.com/questions/198493",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24165/"
] |
198,496 | <p>What’s the difference between the <code>System.Array.CopyTo()</code> and <code>System.Array.Clone()</code>?</p>
| [
{
"answer_id": 198500,
"author": "Patrick Desjardins",
"author_id": 13913,
"author_profile": "https://Stackoverflow.com/users/13913",
"pm_score": 7,
"selected": true,
"text": "1- CopyTo require to have a destination array when Clone return a new array.\n2- CopyTo let you specify an index... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198496",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14441/"
] |
198,526 | <p>How do I determine if the currency symbol is supposed to be on the left or right of a number using CFLocale / CFNumberFormatter in a Mac Carbon project?</p>
<p>I need to interface with a spreadsheet application which requires me to pass a number, currency symbol, currency symbol location and padding instead of a CStringRef created with CFNumberFormatter.</p>
<pre><code>CFLocaleRef currentLocale = CFLocaleCopyCurrent();
CFTypeRef currencySymbol = CFLocaleGetValue (currentLocale, kCFLocaleCurrencySymbol);
</code></pre>
<p>provides me with the currency symbol as a string. But I'm lost on how to determine the position of the currency symbol...</p>
| [
{
"answer_id": 200245,
"author": "Hans Martin Kern",
"author_id": 27559,
"author_profile": "https://Stackoverflow.com/users/27559",
"pm_score": 2,
"selected": false,
"text": " CFNumberFormatterRef numberFormatter = CFNumberFormatterCreate(kCFAllocatorDefault, CFLocaleCopyCurrent(), kC... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198526",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27559/"
] |
198,532 | <p>In <code>.NET</code> (at least in the 2008 version, and maybe in 2005 as well), changing the <code>BackColor</code> property of a <code>DateTimePicker</code> has absolutely no affect on the appearance. How do I change the background color of the text area, not of the drop-down calendar?</p>
<p><strong><em>Edit:</em></strong> I was talking about Windows forms, not ASP.</p>
| [
{
"answer_id": 199278,
"author": "Vivek",
"author_id": 7418,
"author_profile": "https://Stackoverflow.com/users/7418",
"pm_score": 5,
"selected": true,
"text": "BackColor"
},
{
"answer_id": 1202804,
"author": "Gustavo",
"author_id": 2015,
"author_profile": "https://St... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198532",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27302/"
] |
198,535 | <p>I have small page which has label, DropDownList and a submit button.</p>
<pre><code><div>
<asp:label id="Message" runat="server"/>
<br />
Which city do you wish to look at on hotels for?<br /><br />
<asp:dropdownlist id="Dropdownlist1" runat="server" EnableViewState="true">
</asp:dropdownlist>
<br /><br /><br /><br />
<input type="Submit" />
</div>
</code></pre>
<p>On form load I am inserting items into the DropDownList and on the button click I am displaying the count of the items in the DropDownList. Here's the code for that.</p>
<code>
if (Page.IsPostBack)
{
Message.Text = "You have selected " + Dropdownlist1.Items.Count.ToString();
}
else
{
Message.Text = "You have selected " + Dropdownlist1.Items.Count.ToString();
Dropdownlist1.Items.Add("Madrid");
Dropdownlist1.Items.Add("Chennai");
Dropdownlist1.Items.Add("New York");
}
</code>
<p>Here's the funny part. If I run it directly from the IDE, its working perfectly fine. I get the count as 0 the first time and 3 when I press submit button. I need to run this small code on an existing virtual directory. If I run the same aspx page within that virtual directory, I get count 0 for the for the first time it loads. When I click submit, I get count as 0 and I don't see any items in the DropDownList, it is getting cleared. I have set ViewState to true so that I remember what was inserted.</p>
<p>I am not sure what difference is there when I run it from IDE and when I run it from another virtual directory. I am fairly new to Asp.Net so I have exhuasted all my options here so to find out how a DropDownList works. Is there a config I am missing here ?.</p>
<p>BTW just FYI, I am facing the same issue when I put the DropDownList in a Wizard Control. When run from IDE it is working fine but when I run from the virtual directory its not getting the selected value neither is it remembering the items in the DropDownList.</p>
<blockquote>
<p>According to your code the list only gets populated when it is not a PostBack. Therefore when you click the button the list will be empty.If you dynamically populate the list, the items are not remembered. You must added in each Page_load. The view state will only remember which item was selected.</p>
</blockquote>
<p>How it does then remember the items when the page is executed directly from the IDE and not remember when I run from a virtual directory. Is there a view state that I might need to set to get it working. The cache setting also did not do much luck. I enabled Trace info, funny thing again :|, tracing is happening when executed directly from the IDE and not from the virual directory. Question again, the child directory's <code>web.config</code> should override the parent <code>web.config</code> right?</p>
| [
{
"answer_id": 198547,
"author": "tpower",
"author_id": 18107,
"author_profile": "https://Stackoverflow.com/users/18107",
"pm_score": 0,
"selected": false,
"text": "Response.Cache.SetCacheability(HttpCacheability.NoCache)\n"
},
{
"answer_id": 13134015,
"author": "Siddhesh Bon... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198535",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2245/"
] |
198,543 | <p>I have a third-party editor that basically comprises a textbox and a button (the DevExpress ButtonEdit control). I want to make a particular keystroke (<kbd>Alt</kbd> + <kbd>Down</kbd>) emulate clicking the button. In order to avoid writing this over and over, I want to make a generic KeyUp event handler that will raise the ButtonClick event. Unfortunately, there doesn't seem to be a method in the control that raises the ButtonClick event, so...</p>
<p>How do I raise the event from an external function via reflection?</p>
| [
{
"answer_id": 198584,
"author": "torial",
"author_id": 13990,
"author_profile": "https://Stackoverflow.com/users/13990",
"pm_score": 3,
"selected": false,
"text": " public event EventHandler<EventArgs> MyEventToBeFired;\n\n public void FireEvent(Guid instanceId, string handler)\n ... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198543",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/549/"
] |
198,551 | <p>I am interacting with an Oracle DB using SQL over an ODBC connection. Is there an SQL command I can use to get the MAC address of the server, or something that uniquely identifies the server hardware or software installation. This is so I can be sure (or at least fairly sure) that I'm talking to the same database all the time.</p>
| [
{
"answer_id": 198569,
"author": "Node",
"author_id": 7190,
"author_profile": "https://Stackoverflow.com/users/7190",
"pm_score": 0,
"selected": false,
"text": "SELECT * FROM v$instance;\n"
}
] | 2008/10/13 | [
"https://Stackoverflow.com/questions/198551",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12889/"
] |
198,552 | <p>I have a row of data that I need to modify in a database, using a stored procedure. But in order to call that stored procedure, I need to know the name of the each column. How do I determine the name of the columns? (Hardcoding is not an option as we are talking a LOT of columns whose names may change).</p>
<p>EDIT: given the accepted answer, it looks like eviljack wanted the header text of the column and not the name of the bound field</p>
| [
{
"answer_id": 2056245,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": " foreach (TableCell objCell in e.Row.Cells)\n {\n if (objCell is DataControl... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198552",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/750/"
] |
198,561 | <p>I know this won't be a popular question, because a lot of web designers want to assume that their craft is difficult and valuable.</p>
<p><strong>IT IS</strong>. But I do not believe that it is difficult because HTML and CSS are difficult to master, I believe its difficult because being a good creative designer is difficult. Please resist the urge to reflexively disagree with me because I consider the language simple.</p>
<p>I suck as a designer, thankfully its not my job. However I can take a photo shopped comp and create a pure HTML/CSS web page from it with ease.</p>
<p>It is my personal believe that <strong>anyone</strong> can become an effective HTML/CSS guru in a week or two's study. There just isn't that much complexity (and this is someone with years of experience talking).</p>
<p>Crossbrowser coding is not as hard as people make it sound. I develop in Firefox, and tweak for IE, and I'm done, a good CSS reset handles 99% of the issues.</p>
<p>Do you disagree with this? Is HTML and CSS impossible to learn well in a week?</p>
<p>EDIT: This has to do with my heavily downvoted answer here: <a href="https://stackoverflow.com/questions/198337/testing-htmlcssjavascript-skills-when-hiring#198344">Testing HTML/CSS/Javascript skills when hiring</a></p>
| [
{
"answer_id": 198603,
"author": "Kibbee",
"author_id": 1862,
"author_profile": "https://Stackoverflow.com/users/1862",
"pm_score": 0,
"selected": false,
"text": "<font>"
},
{
"answer_id": 198751,
"author": "Steve Perks",
"author_id": 16124,
"author_profile": "https:/... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198561",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1965/"
] |
198,564 | <p>I have apache web server installed as frontend and I have j2ee SAP Netweaver Application Server installed in Intranet server. How can I configure apache to forward requests and response to/from j2ee app server.
for example, external apache server's ip is 9.20.1.1:80.
internal sap server's address is 192.168.0.1/sap/bc/gui/sap/its/webgui?sap_client=200
I want access to my sap app server for example 9.20.1.1/sapserver/sap/bc/gui/sap/its/webgui?sap_client=200</p>
| [
{
"answer_id": 198611,
"author": "Mark Roddy",
"author_id": 9940,
"author_profile": "https://Stackoverflow.com/users/9940",
"pm_score": 1,
"selected": false,
"text": " ProxyRequests Off\n <Location \"/sapserver\">\n ProxyPass http://192.168.0.1\n ProxyPassReverse http:/... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198564",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27563/"
] |
198,568 | <p>What is the simplest way to programmatically export Excel data to Matlab?</p>
| [
{
"answer_id": 35903356,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 2,
"selected": false,
"text": "csvread()"
}
] | 2008/10/13 | [
"https://Stackoverflow.com/questions/198568",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26276/"
] |
198,577 | <p>Is there any real practical difference between "java -server" and "java -client"? </p>
<p>All I can find on Sun's site is a vague </p>
<blockquote>
<p>"-server starts slower but should run faster". </p>
</blockquote>
<p>What are the real differences? (Using JDK 1.6.0_07 currently.)</p>
| [
{
"answer_id": 198651,
"author": "VonC",
"author_id": 6309,
"author_profile": "https://Stackoverflow.com/users/6309",
"pm_score": 10,
"selected": true,
"text": "-client"
},
{
"answer_id": 3775811,
"author": "prule",
"author_id": 20242,
"author_profile": "https://Stack... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198577",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3333/"
] |
198,580 | <p>What are optimal settings for Recycling of Application Pools in IIS7 in a shared environment?</p>
<p><img src="https://i.stack.imgur.com/RNQo8.png" alt="enter image description here"></p>
| [
{
"answer_id": 201812,
"author": "Christopher G. Lewis",
"author_id": 13532,
"author_profile": "https://Stackoverflow.com/users/13532",
"pm_score": 6,
"selected": true,
"text": "retail=\"true\""
}
] | 2008/10/13 | [
"https://Stackoverflow.com/questions/198580",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23280/"
] |
198,606 | <p>I typically use URL rewriting to pass content IDs to my website, so this</p>
<pre><code> Foo.1.aspx
</code></pre>
<p>rewrites to</p>
<pre><code> Foo.aspx?id=1
</code></pre>
<p>For a specific application I need to pass in multiple IDs to a single page, so I've rewritten things to accept this:</p>
<pre><code> Foo.1,2,3,4,5.aspx
</code></pre>
<p>This works fine in Cassini (the built-in ad hoc web server for Visual Studio) but gives me "Internet Explorer cannot display the webpage" when I try it on a live server running IIS. Is this an IIS limitation? Should I just use dashes or underscores instead of commas?</p>
| [
{
"answer_id": 198617,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 1,
"selected": false,
"text": "Foo.aspx?id=1;id=2;id=3;id=4;id=5\n"
},
{
"answer_id": 198850,
"author": "ConroyP",
"author_id": 2287,... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198606",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/239663/"
] |
198,623 | <p>I haven't really done any Windows scripting at all, so I am at a loss on how to pull this one off. Anyway, basically what we want to do is have a script that will take an argument on which IIS AppPool to recycle. I have done some research on Google and haven't had much success on getting things to work.</p>
<p>Here is what I am trying now:</p>
<pre><code>$appPoolName = $args[0]
$appPool = get-wmiobject -namespace "root\MicrosoftIISv2" -class "IIsApplicationPools" Where-Object {$_.Name -eq "W3SVC/APPPOOLS/$appPoolName"}
$appPool.Recycle()
</code></pre>
<p>and the error I get:</p>
<pre><code>Get-WmiObject : A parameter cannot be found that matches parameter name '$_.Name -eq "W3SVC/APPPOOLS/$appPoolName"'.
</code></pre>
<p>Anyway, it would be nice if I also knew how to debug things like this. I already fixed one bug with the original script by doing gwmi -namespace "root\MicrosoftIISv2" -list. Any other tips like that one would be great.</p>
<p>Thanks!</p>
<p><strong>Update</strong>: Here is some more info</p>
<pre><code>$appPool = gwmi -namespace "root\MicrosoftIISv2" -class "IISApplicationPools" | Get-Member
. TypeName: System.Management.ManagementObject#root\MicrosoftIISv2\IIsApplicationPools
Name MemberType Definition
---- ---------- ----------
Caption Property System.String Caption {get;set;}
Description Property System.String Description {get;set;}
InstallDate Property System.String InstallDate {get;set;}
Name Property System.String Name {get;set;}
Status Property System.String Status {get;set;}
__CLASS Property System.String __CLASS {get;set;}
__DERIVATION Property System.String[] __DERIVATION {get;set;}
__DYNASTY Property System.String __DYNASTY {get;set;}
__GENUS Property System.Int32 __GENUS {get;set;}
__NAMESPACE Property System.String __NAMESPACE {get;set;}
__PATH Property System.String __PATH {get;set;}
__PROPERTY_COUNT Property System.Int32 __PROPERTY_COUNT {get;set;}
__RELPATH Property System.String __RELPATH {get;set;}
__SERVER Property System.String __SERVER {get;set;}
__SUPERCLASS Property System.String __SUPERCLASS {get;set;}
ConvertFromDateTime ScriptMethod System.Object ConvertFromDateTime();
ConvertToDateTime ScriptMethod System.Object ConvertToDateTime();
Delete ScriptMethod System.Object Delete();
GetType ScriptMethod System.Object GetType();
Put ScriptMethod System.Object Put();
gwmi -namespace "root\MicrosoftIISv2" -class "IISApplicationPools"
__GENUS : 2
__CLASS : IIsApplicationPools
__SUPERCLASS : CIM_LogicalElement
__DYNASTY : CIM_ManagedSystemElement
__RELPATH : IIsApplicationPools.Name="W3SVC/AppPools"
__PROPERTY_COUNT : 5
__DERIVATION : {CIM_LogicalElement, CIM_ManagedSystemElement}
__SERVER : IRON
__NAMESPACE : root\MicrosoftIISv2
__PATH : \\IRON\root\MicrosoftIISv2:IIsApplicationPools.Name="W3SVC/A
ppPools"
Caption :
Description :
InstallDate :
Name : W3SVC/AppPools
Status :
</code></pre>
| [
{
"answer_id": 198760,
"author": "Scott Saad",
"author_id": 4916,
"author_profile": "https://Stackoverflow.com/users/4916",
"pm_score": 4,
"selected": false,
"text": "$appPoolName = $args[0]\n$appPool = get-wmiobject -namespace \"root\\MicrosoftIISv2\" -class \"IIsApplicationPool\" | Whe... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198623",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12448/"
] |
198,625 | <p>Does anyone know if it is possible to reliably determine (programattically C/C++...) whether or not a firewall or IP filtering software is installed on a Windows PC? I need to detect whether a certain server IP is being blocked in my client software by the host OS.</p>
<p>I don't need to worry about external hardware firewals in this situation as I have full control of this. It is only software firewalls that I am concerned with. My hope was that I could iterate the windows network stack or NDIS interfaces and determine this</p>
| [
{
"answer_id": 200260,
"author": "Jay",
"author_id": 20840,
"author_profile": "https://Stackoverflow.com/users/20840",
"pm_score": 3,
"selected": true,
"text": "Private Sub DumpFirewallInfo()\n\nDim oLocator As WbemScripting.SWbemLocator\nDim oService As WbemScripting.SWbemServices... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198625",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10446/"
] |
198,634 | <p>I have a table which contains 3 nvarchar(255) columns and a combination of these 3 columns must be unique. Normally I would create a Unique constraint, but in this case, I am hitting the 900 byte limit. Since I have to support SQL Server 2000, I can not use Include columns to get around this situation.</p>
| [
{
"answer_id": 198737,
"author": "Tom H",
"author_id": 5696608,
"author_profile": "https://Stackoverflow.com/users/5696608",
"pm_score": 0,
"selected": false,
"text": "CREATE TABLE dbo.Test_Unique_Limit (\n string_1 NVARCHAR(255) NOT NULL,\n string_2 NVARCHAR(255) NOT NUL... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198634",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4441/"
] |
198,650 | <p>In asp.net, you can retrieve MULTIPLE datatables from a single call to the database. Can you do the same thing in php?</p>
<p>Example:</p>
<pre><code>$sql ="select * from t1; select * from t2;";
$result = SomeQueryFunc($sql);
print_r($result[0]); // dump results for t1
print_r($result[1]); // dump results for t2
</code></pre>
<p>Can you do something like this?</p>
| [
{
"answer_id": 198686,
"author": "Kornel",
"author_id": 27009,
"author_profile": "https://Stackoverflow.com/users/27009",
"pm_score": 0,
"selected": false,
"text": "PDOStatement::nextRowset()"
},
{
"answer_id": 8111427,
"author": "genesis",
"author_id": 764846,
"autho... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198650",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27305/"
] |
198,656 | <p>I creating a control for WPF, and I have a question for you WPF gurus out there.</p>
<p>I want my control to be able to expand to fit a resizable window. </p>
<p>In my control, I have a list box that I want to expand with the window. I also have other controls around the list box (buttons, text, etc).</p>
<p>I want to be able to set a minimum size on my control, but I want the window to be able to be sized smaller by creating scroll bars for viewing the control. </p>
<p>This creates nested scroll areas: One for the list box and a ScrollViewer wrapping the whole control. </p>
<p>Now, if the list box is set to auto size, it will never have a scroll bar because it is always drawn full size within the ScrollViewer. </p>
<p>I only want the control to scroll if the content can't get any smaller, otherwise I don't want to scroll the control; instead I want to scroll the list box inside the control.</p>
<p>How can I alter the default behavior of the ScrollViewer class? I tried inheriting from the ScrollViewer class and overriding the MeasureOverride and ArrangeOverride classes, but I couldn't figure out how to measure and arrange the child properly. It appears that the arrange has to affect the ScrollContentPresenter somehow, not the actual content child.</p>
<p>Any help/suggestions would be much appreciated.</p>
| [
{
"answer_id": 198688,
"author": "Bob King",
"author_id": 6897,
"author_profile": "https://Stackoverflow.com/users/6897",
"pm_score": 0,
"selected": false,
"text": "<Window\n xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\" \n xmlns:x=\"http://schemas.microsoft.com/w... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198656",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
198,668 | <p>I have a situation where I need to be able to load assemblies in the GAC based on their partial names. In order to do this I have added the following to my app.config file:</p>
<pre><code><runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<qualifyAssembly partialName="MyAssembly"
fullName= "MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789abcdef"/>
</assemblyBinding>
</runtime>
</code></pre>
<p>This works exactly the way I want it to. However, if I place the same element in my machine.config file, it seems to be ignored, and I get FileNotFoundExceptions when trying to load MyAssembly.</p>
<p>The following is the assembly binding log when the element is in my app.config, and the bind succeeds:</p>
<pre>LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Documents and Settings\jon_scheiding\My Documents\Source\Testing\Test Projects 1\Cmd\bin\Debug\Testers.Cmd.vshost.exe.config
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Partial reference qualified from config file. New reference: MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789abcdef.
LOG: Post-policy reference: MyAssembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=0123456789abcdef
LOG: Found assembly by looking in the GAC.
LOG: Binding succeeds. Returns assembly from C:\WINDOWS\assembly\GAC_MSIL\MyAssembly\1.0.0.0__b20f4683c1030dbd\MyAssembly.dll.
LOG: Assembly is loaded in default load context.</pre>
<p>Contrast that with the log when my configuration is in machine.config, and the bind fails:</p>
<pre>LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Documents and Settings\jon_scheiding\My Documents\Source\Testing\Test Projects 1\Cmd\bin\Debug\Testers.Cmd.vshost.exe.config
LOG: Using machine configuration file from C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Documents and Settings/jon_scheiding/My Documents/Source/Testing/Test Projects 1/Cmd/bin/Debug/MyAssembly.DLL.
LOG: Attempting download of new URL file:///C:/Documents and Settings/jon_scheiding/My Documents/Source/Testing/Test Projects 1/Cmd/bin/Debug/MyAssembly/MyAssembly.DLL.
LOG: Attempting download of new URL file:///C:/Documents and Settings/jon_scheiding/My Documents/Source/Testing/Test Projects 1/Cmd/bin/Debug/MyAssembly.EXE.
LOG: Attempting download of new URL file:///C:/Documents and Settings/jon_scheiding/My Documents/Source/Testing/Test Projects 1/Cmd/bin/Debug/MyAssembly/MyAssembly.EXE.
LOG: All probing URLs attempted and failed.</pre>
<p>The problem seems to be the fourth line, "Policy not being applied to reference at this time." However, I can find very little documentation on what this message means, or how to address it.</p>
<p>How can I get the framework to recognize my <runtime> element?</p>
<p>Thanks in advance!</p>
| [
{
"answer_id": 198688,
"author": "Bob King",
"author_id": 6897,
"author_profile": "https://Stackoverflow.com/users/6897",
"pm_score": 0,
"selected": false,
"text": "<Window\n xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\" \n xmlns:x=\"http://schemas.microsoft.com/w... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198668",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27578/"
] |
198,670 | <p>Thanks for reading. I'm a bit new to jQuery, and am trying to make a script I can include in all my websites to solve a problem that always drives me crazy...</p>
<p>The problem:
Select boxes with long options get cut off in Internet Explorer. For example, these select boxes:
<a href="http://discoverfire.com/test/select.php" rel="noreferrer">http://discoverfire.com/test/select.php</a></p>
<p>In Firefox they are fine, but in IE, the options are cut off to the width of the select when they drop down.</p>
<p>The solution:
What I am looking to do, is create a script that I can include in any page that will do the following:</p>
<ol>
<li><p>Loop through all the selects on the page.</p></li>
<li><p>For each select:
A. Loop through its options.
B. Find the width of the longest option.
C. Bind a function to expand the select to that width on focus (or maybe click...).
D. Bind a function to shrink to it's original width on blur.</p></li>
</ol>
<p>I've managed to do most of step #2 for one select box.</p>
<p>I found that getting the options width was a problem (especially in IE), so I looped through and copied the text of each option to a span, measured the span width, and used the longest one as the width the select will be expanded to. Perhaps somebody has a better idea.</p>
<p>Here is the code</p>
<pre><code><script type='text/javascript'>
$(function() {
/*
This function will:
1. Create a data store for the select called ResizeToWidth.
2. Populate it with the width of the longest option, as approximated by span width.
The data store can then be used
*/
// Make a temporary span to hold the text of the options.
$('body').append("<span id='CurrentOptWidth'></span>");
$("#TheSelect option").each(function(i){
// If this is the first time through, zero out ResizeToWidth (or it will end up NaN).
if ( isNaN( $(this).parent().data('ResizeToWidth') ) ) {
$(this).parent().data( 'OriginalWidth', $(this).parent().width() );
$(this).parent().data('ResizeToWidth', 0);
$('CurrentOptWidth').css('font-family', $(this).css('font-family') );
$('CurrentOptWidth').css('font-size', $(this).css('font-size') );
$('CurrentOptWidth').css('font-weight', $(this).css('font-weight') );
}
// Put the text of the current option into the span.
$('#CurrentOptWidth').text( $(this).text() );
// Set ResizeToWidth to the longer of a) the current opt width, or b) itself.
//So it will hold the width of the longest option when we are done
ResizeToWidth = Math.max( $('#CurrentOptWidth').width() , $(this).parent().data('ResizeToWidth') );
// Update parent ResizeToWidth data.
$(this).parent().data('ResizeToWidth', ResizeToWidth)
});
// Remove the temporary span.
$('#CurrentOptWidth').remove();
$('#TheSelect').focus(function(){
$(this).width( $(this).data('ResizeToWidth') );
});
$('#TheSelect').blur(function(){
$(this).width( $(this).data('OriginalWidth') );
});
alert( $('#TheSelect').data('OriginalWidth') );
alert( $('#TheSelect').data('ResizeToWidth') );
});
</script>
</code></pre>
<p>and the select:</p>
<pre><code><select id='TheSelect' style='width:50px;'>
<option value='1'>One</option>
<option value='2'>Two</option>
<option value='3'>Three</option>
<option value='42,693,748,756'>Forty-two billion, six-hundred and ninety-three million, seven-hundred-forty-some-odd..... </option>
<option value='5'>Five</option>
<option value='6'>Six</option>
<option value='7'>Seven...</option>
</select>
</code></pre>
<p>Hopefully this will run for you if you want to run it, or you can see it in action here: <a href="http://discoverfire.com/test/select.php" rel="noreferrer">http://discoverfire.com/test/select.php</a>.</p>
<p>What I need help with:
This needs a bit of polish, but seems to work ok if you specify the select box.</p>
<p>However, I don't seem to be able to figure out how to apply it to all select boxes on the page with a loop. So far, I have this:</p>
<pre><code>$('select').each(
function(i, select){
// Get the options for the select here... can I use select.each...?
}
);
</code></pre>
<p>Also, is there a better way to get the length of the longest option for each select? The span is close, but not very exact. The problem is that IE returns zero for the option widths of the actual selects.</p>
<p>Any ideas are very welcome, both for the questions asked, and any other improvements to my code.</p>
<p>Thanks!!</p>
| [
{
"answer_id": 198901,
"author": "msmithstubbs",
"author_id": 27606,
"author_profile": "https://Stackoverflow.com/users/27606",
"pm_score": 5,
"selected": true,
"text": "$('select').each(function(){\n\n $('option', this).each(function() {\n // your normalizing script here\n\n })\n\n... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198670",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27580/"
] |
198,679 | <p>Given an <code>InputStream</code> called <code>in</code> which contains audio data in a compressed format (such as MP3 or OGG), I wish to create a <code>byte</code> array containing a WAV conversion of the input data. Unfortunately, if you try to do this, JavaSound hands you the following error:</p>
<pre><code>java.io.IOException: stream length not specified
</code></pre>
<p>I managed to get it to work by writing the wav to a temporary file, then reading it back in, as shown below:</p>
<pre><code>AudioInputStream source = AudioSystem.getAudioInputStream(new BufferedInputStream(in, 1024));
AudioInputStream pcm = AudioSystem.getAudioInputStream(AudioFormat.Encoding.PCM_SIGNED, source);
AudioInputStream ulaw = AudioSystem.getAudioInputStream(AudioFormat.Encoding.ULAW, pcm);
File tempFile = File.createTempFile("wav", "tmp");
AudioSystem.write(ulaw, AudioFileFormat.Type.WAVE, tempFile);
// The fileToByteArray() method reads the file
// into a byte array; omitted for brevity
byte[] bytes = fileToByteArray(tempFile);
tempFile.delete();
return bytes;
</code></pre>
<p>This is obviously less desirable. Is there a better way?</p>
| [
{
"answer_id": 6505115,
"author": "Gábor Dikán",
"author_id": 818978,
"author_profile": "https://Stackoverflow.com/users/818978",
"pm_score": -1,
"selected": false,
"text": "File f = new File(exportFileName+\".tmp\");\nFile f2 = new File(exportFileName);\nlong l = f.length();\nFileInputS... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198679",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4287/"
] |
198,691 | <p>I'm working on a solution that contains multiple projects targeting Windows Mobile 5 and standard Windows applications.</p>
<p>Lately when opening up a form in designer the common UI controls (textbox, button, label, etc etc...) have vanished leaving only the controls defined within the project.</p>
<p>Resetting the toolbox has no effect. A google search suggested deleting the toolbox temp files in the <code>Local Settings\Application Data\Microsoft\VisualStudio\9.0</code>, however this was only successful in bringing back the default controls for Windows Mobile 5. The WinForms controls are still mysteriously missing.</p>
<p>Also, if I right-click and <em>Select All</em> on the toolbox, all of the WinForms controls do in fact come up, however they're all grayed out.</p>
<p>Has anyone else experienced this?</p>
| [
{
"answer_id": 199273,
"author": "justin.m.chase",
"author_id": 12958,
"author_profile": "https://Stackoverflow.com/users/12958",
"pm_score": 1,
"selected": false,
"text": "[ToolboxBitmap(typeof(MyControl), \"MyControlBitmap\")]\n"
},
{
"answer_id": 868765,
"author": "Simon H... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198691",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
198,692 | <p>Any gotchas I should be aware of? Can I store it in a text field, or do I need to use a blob?
(I'm not overly familiar with either pickle or sqlite, so I wanted to make sure I'm barking up the right tree with some of my high-level design ideas.)</p>
| [
{
"answer_id": 199393,
"author": "mhawke",
"author_id": 21945,
"author_profile": "https://Stackoverflow.com/users/21945",
"pm_score": 1,
"selected": false,
"text": "shelve"
},
{
"answer_id": 200143,
"author": "monkut",
"author_id": 24718,
"author_profile": "https://St... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198692",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19074/"
] |
198,705 | <p>In my <a href="http://www.codeplex.com/MEF" rel="nofollow noreferrer">MEF</a> usage, I have a bunch of imports that I want to make available in many other parts of my code. Something like:</p>
<pre><code>[Export (typeof (IBarProvider))]
class MyBarFactory : IBarPovider
{
[Import]
public IFoo1Service IFoo1Service { get; set; }
[Import]
public IFoo2Service IFoo2Service { get; set; }
[Import]
public IFoo3Service IFoo3Service { get; set; }
[Import]
public IFoo4Service IFoo4Service { get; set; }
[Import]
public IFoo5Service IFoo5Service { get; set; }
public IBar CreateBar()
{
return new BarImplementation(/* want to pass the imported services here */);
}
}
class BarImplementation : IBar
{
readonly zib zib;
public BarImplementation(/* ... */)
{
this.zib = new Zib(/* pass services here, too */);
}
}
</code></pre>
<p>I could pass each imported service as an individual parameter, but it's a lot of boring code. There's gotta be something better. Any ideas?</p>
| [
{
"answer_id": 198708,
"author": "Jay Bazuzi",
"author_id": 5314,
"author_profile": "https://Stackoverflow.com/users/5314",
"pm_score": 0,
"selected": false,
"text": "partial class BarImplementation\n{\n public IRequiredServices\n {\n\n public IFoo1Service IFoo1Service { get... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198705",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5314/"
] |
198,707 | <p>As a workaround for a problem, I think I have to handle KeyDown events to get the printable character the user actually typed.</p>
<p>KeyDown supplies me with a KeyEventArgs object with the properities KeyCode, KeyData, KeyValue, Modifiers, Alt, Shift, Control.</p>
<p>My first attempt was just to consider the KeyCode to be the ascii code, but KeyCode on my keyboard is 46, a period ("."), so I end up printing a period when the user types the delete key. So, I know my logic is inadequate.</p>
<p>(For those who are curious, the problem is that I have my own combobox in a DataGridView's control collection and somehow SOME characters I type don't produce the KeyPress and TextChanged ComboBox events. These letters include Q, $, %....</p>
<p>This code will reproduce the problem. Generate a Form App and replace the ctor with this code. Run it, and try typing the letter Q into the two comboxes.</p>
<pre><code>public partial class Form1 : Form
{
ComboBox cmbInGrid;
ComboBox cmbNotInGrid;
DataGridView grid;
public Form1()
{
InitializeComponent();
grid = new DataGridView();
cmbInGrid = new ComboBox();
cmbNotInGrid = new ComboBox();
cmbInGrid.Items.Add("a");
cmbInGrid.Items.Add("b");
cmbNotInGrid.Items.Add("c");
cmbNotInGrid.Items.Add("d");
this.Controls.Add(cmbNotInGrid);
this.Controls.Add(grid);
grid.Location = new Point(0, 100);
this.grid.Controls.Add(cmbInGrid);
}
</code></pre>
| [
{
"answer_id": 198804,
"author": "Aleris",
"author_id": 20417,
"author_profile": "https://Stackoverflow.com/users/20417",
"pm_score": 0,
"selected": false,
"text": "KeysConverter converter = new KeysConverter();\nstring key = converter.ConvertTo(e.KeyCode, typeof(string));\n"
},
{
... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198707",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9328/"
] |
198,716 | <p>I need to pivot one column (Numbers column).
example need this data:</p>
<pre><code>a 1
a 2
b 3
b 4
c 5
d 6
d 7
d 8
d 9
e 10
e 11
e 12
e 13
e 14
</code></pre>
<p>Look like this</p>
<pre><code>a 1 2
b 3 4
c 5
d 6 7 8 9
e 10 11 12 13 14
</code></pre>
<p>any help would be greatly appreciated...</p>
| [
{
"answer_id": 198920,
"author": "Tom H",
"author_id": 5696608,
"author_profile": "https://Stackoverflow.com/users/5696608",
"pm_score": 1,
"selected": false,
"text": "WITH CTE(CTEstring, CTEids, CTElast_id)\nAS\n(\n SELECT string, CAST(id AS VARCHAR(1000)), id\n FROM dbo.Test_Pivo... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198716",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27585/"
] |
198,717 | <p>Ok, so I'm building bread crumbs and depending on the value of the breadcrumb an image will be the seperator. So "HOME" will have one image and "SEARCH" will have another. </p>
<p>I know I can do this programatically (at least I ASSUME) but is there an easier way to do this? Can I link an image to a node based on the value of the node? Can I do it with PathSeparatorTemplate? </p>
<p>Thank you. </p>
| [
{
"answer_id": 198817,
"author": "Aleris",
"author_id": 20417,
"author_profile": "https://Stackoverflow.com/users/20417",
"pm_score": 2,
"selected": false,
"text": "<asp:Image ... />\n"
},
{
"answer_id": 199212,
"author": "Alfred B. Thordarson",
"author_id": 3379,
"au... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198717",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4140/"
] |
198,720 | <p>Is there a ColdFusion analog for the deployment descriptor/web.xml file found in a J2EE web container? I know CF is running on top of JRun and that I could just tweak the JRun dd, but what about an application-specific configuration file? Is there something like this that I'm not aware of or do you just have to roll your own?</p>
| [
{
"answer_id": 13518556,
"author": "James A Mohler",
"author_id": 1845869,
"author_profile": "https://Stackoverflow.com/users/1845869",
"pm_score": 2,
"selected": false,
"text": "application.cfc"
}
] | 2008/10/13 | [
"https://Stackoverflow.com/questions/198720",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2376109/"
] |
198,721 | <p>I have a set of Word documents which I want to publish using a PHP tool I've written. I copy and paste the Word documents into a text box and then save them into MySQL using the PHP program. The problem I Have arises from all the non-standard characters that Word documents have, like curly quotes and ellipses ("..."). What I do at the moment is manually search and replace these kinds of things (and also foreign symbols such as e-acute) with either plain text or HTML entities (&eacute ; etc) Is there a function in PHP I can call that will take the output of a Word document and convert everything that should be entities into entities, and other symbols that don't display properly in Firefox into symbols that do display.</p>
<p>Thanks!</p>
| [
{
"answer_id": 198757,
"author": "eyelidlessness",
"author_id": 17964,
"author_profile": "https://Stackoverflow.com/users/17964",
"pm_score": 3,
"selected": false,
"text": "$str = mb_convert_encoding($str, 'HTML-ENTITIES', 'UTF-8')\n"
},
{
"answer_id": 6561145,
"author": "tyl... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198721",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11522/"
] |
198,726 | <p>I'm responsible for several (rather small) programs, which share a lot of code via different libraries. I'm wondering what the best repository layout is to develop the different prorgrams (and libraries), and keep the libraries in sync across all the programs.</p>
<p>For the sake of argument let's say there are two programs with two libraries:</p>
<ul>
<li>Program1
<ul>
<li>Library1</li>
<li>Library2</li>
</ul></li>
<li>Program2
<ul>
<li>Library1</li>
<li>Library2</li>
</ul></li>
</ul>
<p>Naturally, bug fixes and enhancements for the libraries should (eventually) merge to all programs. Since the libraries are being worked on while working on the different programs, using <a href="http://svnbook.red-bean.com/en/1.5/svn.advanced.externals.html" rel="noreferrer">externals definitions</a> seems out of the question.</p>
<p>So I thought to treat my libraries at all but one place as <a href="http://svnbook.red-bean.com/en/1.5/svn.advanced.vendorbr.html" rel="noreferrer">vendor branches</a> but I'm not sure what the best layout for this would be.</p>
<p>I was thinking something along the lines of:</p>
<ul>
<li>Libraries
<ul>
<li>Library1 (ancestor)</li>
<li>Library2 (ancestor)</li>
</ul></li>
<li>Program1
<ul>
<li>Program1 code</li>
<li>Library1 (vendor branch)</li>
<li>Library2 (vendor branch)</li>
</ul></li>
<li>...</li>
</ul>
<p>Then say when developing Program1 some changes are made for Library2, I merge them back to the Libraries part of the repository, and merge them from there to all other programs when desired. </p>
<p>Merging to the other programs can't always happen immediately, the people working on Program2 could be close to a release and rather finish that first, create a tag, and only then update all libraries.</p>
<p>I'm a bit concerned this will result in many merges and a bit of a maintenance headache after a while but I don't really see a much better solution.</p>
<p>Then again, this seems a rather common use case to me, so I thought I'd just ask the stackoverflow community, what's the best repository layout to achieve this?</p>
| [
{
"answer_id": 198800,
"author": "oz10",
"author_id": 14069,
"author_profile": "https://Stackoverflow.com/users/14069",
"pm_score": 4,
"selected": true,
"text": "svnadmin create /path/library1\nsvnadmin create /path/library2\n...\n"
}
] | 2008/10/13 | [
"https://Stackoverflow.com/questions/198726",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5822/"
] |
198,743 | <p>After many years of using make, I've just started using jam (actually ftjam) for my projects. </p>
<p>In my project workspaces, I have two directories:</p>
<ul>
<li><code>src</code> where I build executables and libraries</li>
<li><code>test</code> where my test programs are</li>
</ul>
<p>I'm trying to set up a dependency on test programs so that each time I compile them, the libraries will be recompiled as well (if they need to).</p>
<p>Any suggestion on how to do it? </p>
| [
{
"answer_id": 201788,
"author": "Remo.D",
"author_id": 16827,
"author_profile": "https://Stackoverflow.com/users/16827",
"pm_score": 2,
"selected": false,
"text": "jmk"
},
{
"answer_id": 18434928,
"author": "wjk",
"author_id": 2059100,
"author_profile": "https://Stac... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198743",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16827/"
] |
198,744 | <p>Yeah, its a bit on this side of pointless, but I was wondering... I've got all these codebehind files cluttering my MVC app. The only reason why I need these files, as far as I can tell, is to tell ASP.NET that my page extends from ViewPage rather than Page. </p>
<p>I've tried a couple different Page directives changes, but nothing I've found will allow me to identify the base class for the page AND let me delete the codebehind files.</p>
<p>Is there a way to do it?</p>
<p><strong>UPDATE</strong>: I'm trying to inherit from a strongly-typed ViewPage! Seems like its possible to inherit from a regular ViewPage...</p>
| [
{
"answer_id": 198797,
"author": "Chris Sutton",
"author_id": 3289,
"author_profile": "https://Stackoverflow.com/users/3289",
"pm_score": 3,
"selected": true,
"text": "<%@ Page Title=\"Title\" Inherits=\"System.Web.Mvc.ViewPage\" Language=\"C#\" MasterPageFile=\"~/Views/Layouts/Site.Mast... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198744",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
198,754 | <p>When using the unmanaged API for the .NET framework to profile a .NET process in-process, is it possible to look up the IL instruction pointer that correlates to the native instruction pointer provided to the StackSnapshotCallback function?</p>
<p>As is probably obvious, I am taking a snapshot of the current stack, and would like to provide file and line number information in the stack dump. The <em>Managed Stack Explorer</em> does this by querying <code>ISymUnmanagedMethod::GetSequencePoints</code>. This is great, but the sequence points are associated to offsets, and I have so far assumed these are offsets from the beginning of the method ( in intermediate language ).</p>
<p>In a follow-up comment to his blog post <a href="https://web.archive.org/web/20190114032244/https://blogs.msdn.microsoft.com/davbr/2005/10/06/profiler-stack-walking-basics-and-beyond" rel="nofollow noreferrer">Profiler stack walking: Basics and beyond</a>, David Broman indicates that this mapping can be achieved using <code>ICorDebugCode::GetILToNativeMapping</code>. However, this is not ideal as getting this interface requires attaching to my process from another, debugger process.</p>
<p>I would like to avoid that step because I would like to continue to be able to run my application from within the visual studio debugger while I am taking these snapshots. It makes it easier to click on the line number in the output window and go to the code in question.</p>
<p>The functionality is possible.... you can spit out a line-numbered stack trace at will inside of managed code, the only question, is it accessible. Also, I don't want to use the <code>System::Diagnostics::StackTrace</code> or <code>System::Environment::StackTrace</code> functionality because, for performance reasons, I need to delay the actual dump of the stack.... so saving the cost for resolution of method names and code location for later is desirable... along with the ability to intermix native and managed frames.</p>
| [
{
"answer_id": 214123,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "Console.WriteLine(\"StackTrace: '{0}'\", Environment.StackTrace);\n"
},
{
"answer_id": 255795,
"author": "Steven",... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198754",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27577/"
] |
198,772 | <p>I know there are tools to get text files to resource files for Visual Studio. But I want to get the text from my resource files to a text file so they can be translated. Or is there a better way to do this? </p>
| [
{
"answer_id": 17493871,
"author": "fireydude",
"author_id": 869290,
"author_profile": "https://Stackoverflow.com/users/869290",
"pm_score": 2,
"selected": false,
"text": "public class Export\n{\n public string Run()\n {\n var resources = new StringBuilder();\n\n var ... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198772",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7024/"
] |
198,777 | <p>I'm trying to configure Windows Powershell to work with Visual Studio. Nothing fancy, just get things set so I can cl & nmake. I think all I need to do is edit the path setting(but I don't know how to set that in WPSH).</p>
| [
{
"answer_id": 199529,
"author": "Paul Nathan",
"author_id": 26227,
"author_profile": "https://Stackoverflow.com/users/26227",
"pm_score": 3,
"selected": true,
"text": "function Get-Batchfile($file) \n{\n $theCmd = \"`\"$file`\" & set\" \n cmd /c $theCmd | Foreach-Object {\n ... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198777",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26227/"
] |
198,781 | <p>Easy question this time.</p>
<p>I'm trying to test whether or not a string does not contain a character using regular expressions. I thought the expression was of the form "[^<em>x</em>]" where <em>x</em> is the character that you don't want to appear, but that doesn't seem to be working.</p>
<p>For example,</p>
<pre><code>Regex.IsMatch("103","[^0]")
</code></pre>
<p>and</p>
<pre><code>Regex.IsMatch("103&","[^&]")
</code></pre>
<p>both return true (I would expect false).</p>
<p>I started using <code>"[^&]"</code> and thought maybe the & needed to be escaped as \&, but it didn't seem to make a difference.</p>
<p>Ideas? I assume it's something small.</p>
<p>Also, I'm using .NET, so keep that in mind.</p>
<p>Edit1:</p>
<p>I found <a href="https://stackoverflow.com/questions/42990/regex-to-match-against-something-that-is-not-a-specific-substring">this</a>, but it doesn't seem to answer the issue I'm having.</p>
<p>Edit2:</p>
<p>I wanted to respond to <a href="https://stackoverflow.com/questions/198781/regex-to-tell-if-a-string-does-not-contain-a-specific-character#198793">Kevin</a> and <a href="https://stackoverflow.com/questions/198781/regex-to-tell-if-a-string-does-not-contain-a-specific-character#198796">Joel</a>'s suggestions. These suggestions would indeed be faster, but they don't accomplish the flexibility I need in this case, so if you found this question through search, definitely look to see if their answers will fit your needs. In my case, the regular expression is getting passed in to a DataTable validation method that loops through each row and verifies that the contents of that row in a specific column matches the RegEx that is getting passed in. Since I'll be reusing this method for several other DataTables that are being validated, I wanted to:</p>
<ol>
<li>Use Regex to enable the widest range of validations, and</li>
<li>Always look for a positive match (i.e. instead of using !Regex.IsMatch(cell, regexvariable), I wanted to rely on always being able to use Regex.IsMatch(cell, regexvariable) since the majority of DataTables invoking this method will be using the positive match instead of the negative.</li>
</ol>
<p>Hopefully that helps.</p>
| [
{
"answer_id": 198790,
"author": "Jorge Ferreira",
"author_id": 6508,
"author_profile": "https://Stackoverflow.com/users/6508",
"pm_score": 7,
"selected": true,
"text": "Regex.IsMatch(\"103\",\"^[^0]*$\")\n"
},
{
"answer_id": 198796,
"author": "Joel Coehoorn",
"author_id"... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198781",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1108/"
] |
198,803 | <p>What is the best practice for storing keys, and or passwords for a website. These keys are for various 3rd party web services. Is it best to have them in the Web.config file, or in the database, or encrypted somehow? </p>
| [
{
"answer_id": 198816,
"author": "defeated",
"author_id": 16997,
"author_profile": "https://Stackoverflow.com/users/16997",
"pm_score": 2,
"selected": false,
"text": "<configSections>\n <section \n name=\"sampleSection\" \n type=\"System.Configuration.SingleTagSectionHandler\... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198803",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13855/"
] |
198,825 | <p>Let's say you've inherited a C# codebase that uses one class with 200 static methods to provide core functionality (such as database lookups). Of the many nightmares in that class, there's copious use of Hungarian notation (the bad kind).</p>
<p>Would you refactor the variable names to remove the Hungarian notation, or would you leave them alone?</p>
<p>If you chose to change all the variables to remove Hungarian notation, what would be your method?</p>
| [
{
"answer_id": 1797887,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "\"\" Hungarian notation conversion helpers\n\"\" get rid of str prefixes and fix caps e.g. strName -> name\nmap ,bs /\\Wstr[A... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198825",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7565/"
] |
198,831 | <p>I'm building an app in Ruby on Rails, and I'm including 3 of my models (and their migration scripts) to show what I'm trying to do, and what isn't working. Here's the rundown: I have users in my application that belong to teams, and each team can have multiple coaches. I want to be able to pull a list of the coaches that are applicable to a user. </p>
<p>For instance, User A could belong to teams T1 and T2. Teams T1 and T2 could have four different coaches each, and one coach in common. I'd like to be able to pull the list of coaches by simply saying: </p>
<pre><code>u = User.find(1)
coaches = u.coaches
</code></pre>
<p>Here are my migration scripts, and the associations in my models. Am I doing something incorrectly in my design? Are my associations correct?</p>
<pre><code>class CreateUsers < ActiveRecord::Migration
def self.up
create_table :users do |t|
t.column :login, :string, :default => nil
t.column :firstname, :string, :default => nil
t.column :lastname, :string, :default => nil
t.column :password, :string, :default => nil
t.column :security_token, :string, :default => nil
t.column :token_expires, :datetime, :default => nil
t.column :legacy_password, :string, :default => nil
end
end
def self.down
drop_table :users
end
end
class CreateTeams < ActiveRecord::Migration
def self.up
create_table :teams do |t|
t.column :name, :string
end
end
def self.down
drop_table :teams
end
end
class TeamsUsers < ActiveRecord::Migration
def self.up
create_table :teams_users, :id => false do |t|
t.column :team_id, :integer
t.column :user_id, :integer
t.column :joined_date, :datetime
end
end
def self.down
drop_table :teams_users
end
end
</code></pre>
<p>Here are the models (not the entire file):</p>
<pre><code>class User < ActiveRecord::Base
has_and_belongs_to_many :teams
has_many :coaches, :through => :teams
class Team < ActiveRecord::Base
has_many :coaches
has_and_belongs_to_many :users
class Coach < ActiveRecord::Base
belongs_to :teams
end
</code></pre>
<p>This is what happens when I try to pull the coaches:</p>
<pre><code>u = User.find(1)
=> #<User id: 1, firstname: "Dan", lastname: "Wolchonok">
>> u.coaches
ActiveRecord::StatementInvalid: Mysql::Error: #42S22Unknown column 'teams.user_id' in 'where clause': SELECT `coaches`.* FROM `coaches` INNER JOIN teams ON coaches.team_id = teams.id WHERE ((`teams`.user_id = 1))
</code></pre>
<p>Here's the error in sql:</p>
<p>Mysql::Error: #42S22Unknown column 'teams.user_id' in 'where clause': SELECT <code>coaches</code>.* FROM <code>coaches</code> INNER JOIN teams ON coaches.team_id = teams.id WHERE ((<code>teams</code>.user_id = 1)) </p>
<p>Am I missing something in my :through clause? Is my design totally off? Can someone point me in the right direction?</p>
| [
{
"answer_id": 198971,
"author": "Matthias Winkelmann",
"author_id": 4494,
"author_profile": "https://Stackoverflow.com/users/4494",
"pm_score": 2,
"selected": false,
"text": "has_many :coaches, :finder_sql => 'SELECT * from coaches, teams_users WHERE \n coaches.team_id=tea... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198831",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/168/"
] |
198,849 | <p>I've just performed a new installation of the very latest (Fall, 2008) version of Fedora 9 Linux and am perplexed that it never set the default route properly and that even traveling the labyrinthine ways of this OS, there's no obvious way.</p>
<p>Of course, it's clear that one can do it on a one-off basis like this:</p>
<pre><code> route add default gw gw1 metric 0 eth0
</code></pre>
<p>or like this:</p>
<pre><code> ip route add to default via 192.168.2.1 protocol static
</code></pre>
<p>However, neither of these survives reboot. In reading through /etc/rc.d/init.d/network, it attempts to find data from a file in /etc/sysconfig/static-routes, but that file never existed. So, I tried to create it and populate it with data. The trouble with that is that the script places a dash (minus sign) in an odd spot that I'm not sure how to deal with.</p>
<p>Of course, one can just edit /etc/rc.d/init.d/network, but that would be non-standard. As it is, my only other recourse seems to be editing rc.local, but that doesn't come early enough in the boot sequence to be there for things like, for example, the network time daemon.</p>
<p>I've done my homework - I've read all the man pages, info entries, tried apropos, and I've even done a fair bit of web searching, all to no avail - my next step, sans answer here, will be to sign up to the Fedora mailing lists and ask there! Or, give up and edit the scripts.</p>
<p>So, how is one supposed to do this?</p>
| [
{
"answer_id": 198899,
"author": "John Nilsson",
"author_id": 24243,
"author_profile": "https://Stackoverflow.com/users/24243",
"pm_score": 0,
"selected": false,
"text": "gnome-network-preferences"
},
{
"answer_id": 198969,
"author": "Paul Tomblin",
"author_id": 3333,
... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198849",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26976/"
] |
198,852 | <p>I am using Visual Studio 2005 to make an install. The application has a dependency on a DLL that was built with MFC 7.1 (from Visual Studio 2003).</p>
<p>Are there merge modules for MFC 7.1 or other redistributables like there are for MFC 8? Where could they be found?</p>
| [
{
"answer_id": 200047,
"author": "bk1e",
"author_id": 8090,
"author_profile": "https://Stackoverflow.com/users/8090",
"pm_score": 0,
"selected": false,
"text": "%ProgramFiles%\\Microsoft Visual Studio .NET 2003\\redist"
},
{
"answer_id": 209093,
"author": "djeidot",
"auth... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198852",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4066/"
] |
198,868 | <p>a while back I ran across a situation where we needed to display message-boxes to the user for notifications but we could not use MessageBox.Show because it blocks the GUI thread (so nothing on the screen gets updated while the dialog is active). Any suggestions on an alternative?</p>
<p>[I coded an alternative at the time but I don't like it. I'll post it as an answer if nothing better appears though]</p>
<p>EDIT: the dialog must float on top of the main window; i don't care if it appears in the taskbar or not. More than one dialog may be active at once in certain circumstances.</p>
<p>ADDENDUM: my solution was a base form that provided OK and CANCEL buttons to emit Completed and Cancelled events; OK called a virtual ValidateData for subclass override. The calling form used properties to avoid recreating the form each time (the form was just hidden instead of closed) and kept a dictionary of active forms to prevent the same form from being activated more than once. This looks like a modal form, supports multiple pop-up forms at once, but does not tie up the main GUI thread.</p>
| [
{
"answer_id": 198938,
"author": "Maurice",
"author_id": 19676,
"author_profile": "https://Stackoverflow.com/users/19676",
"pm_score": -1,
"selected": false,
"text": "ThreadPool.QueueUserWorkItem( (state) =>\n {\n MessageBox.Show(\"Your message\");\n });\n"
}
] | 2008/10/13 | [
"https://Stackoverflow.com/questions/198868",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9345/"
] |
198,873 | <p>What are the minimum OS requirements for each of the .Net frameworks? E.g. for which version is it impossible to run each OS on:</p>
<ul>
<li>Windows 95</li>
<li>Windows 98</li>
<li>Windows 98SE</li>
<li>Windows ME</li>
<li>Windows NT 3.x</li>
<li>Windows NT 4</li>
<li>Windows 2000</li>
</ul>
<p>I believe all .Net frameworks are compatible w/ XP, Vista, Windows Server 2003, and Windows Server 2008 (please correct me on that if wrong).</p>
| [
{
"answer_id": 198886,
"author": "stephenbayer",
"author_id": 18893,
"author_profile": "https://Stackoverflow.com/users/18893",
"pm_score": 2,
"selected": false,
"text": "Windows NT\nWindows Server 2003 (Itanium-based)\n"
}
] | 2008/10/13 | [
"https://Stackoverflow.com/questions/198873",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13990/"
] |
198,892 | <p>I have an img tag in my webapp that uses the onload handler to resize the image:</p>
<pre><code><img onLoad="SizeImage(this);" src="foo" >
</code></pre>
<p>This works fine in Firefox 3, but fails in IE7 because the image object being passed to the <code>SizeImage()</code> function has a width and height of 0 for some reason -- maybe IE calls the function before it finishes loading?. In researching this, I have discovered that other people have had this same problem with IE. I have also discovered that this isn't valid HTML 4. This is our doctype, so I don't know if it's valid or not:</p>
<pre><code><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
</code></pre>
<p>Is there a reasonable solution for resizing an image as it is loaded, preferably one that is standards-compliant? The image is being used for the user to upload a photo of themselves, which can be nearly any size, and we want to display it at a maximum of 150x150. If your solution is to resize the image server-side on upload, I know that is the correct solution, but I am forbidden from implementing it :( It must be done client side, and it must be done on display.</p>
<p>Thanks.</p>
<p><strong>Edit</strong>: Due to the structure of our app, it is impractical (bordering on impossible) to run this script in the document's onload. I can only reasonably edit the image tag and the code near it (for instance I could add a <code><script></code> right below it). Also, we already have Prototype and EXT JS libraries... management would prefer to not have to add another (some answers have suggested jQuery). If this can be solved using those frameworks, that would be great.</p>
<p><strong>Edit 2</strong>: Unfortunately, we must support Firefox 3, IE 6 and IE 7. It is desirable to support all Webkit-based browsers as well, but as our site doesn't currently support them, we can tolerate solutions that only work in the Big 3.</p>
| [
{
"answer_id": 198903,
"author": "Steve Paulo",
"author_id": 9414,
"author_profile": "https://Stackoverflow.com/users/9414",
"pm_score": 4,
"selected": true,
"text": "document.onload(runFunction);"
},
{
"answer_id": 198908,
"author": "Ross",
"author_id": 2025,
"author... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198892",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10861/"
] |
198,910 | <p>I wrote a small WPF app where I like to prepend text into a RichTextBox, so that the newest stuff is on top. I wrote this, and it works: </p>
<pre><code> /// <summary>
/// Prepends the text to the rich textbox
/// </summary>
/// <param name="textoutput">The text representing the character information.</param>
private void PrependSimpleText(string textoutput)
{
Run run = new Run(textoutput);
Paragraph paragraph = new Paragraph(run);
if (this.RichTextBoxOutput.Document.Blocks.Count == 0)
{
this.RichTextBoxOutput.Document.Blocks.Add(paragraph);
}
else
{
this.RichTextBoxOutput.Document.Blocks.InsertBefore(this.RichTextBoxOutput.Document.Blocks.FirstBlock, paragraph);
}
}
</code></pre>
<p>Now I would like to make a new version of that function which can add small images as well. I'm at a loss though - is it possible to add images? </p>
| [
{
"answer_id": 200185,
"author": "rudigrobler",
"author_id": 5147,
"author_profile": "https://Stackoverflow.com/users/5147",
"pm_score": 5,
"selected": true,
"text": "BitmapImage bi = new BitmapImage(new Uri(@\"C:\\SimpleImage.jpg\"));\nImage image = new Image();\nimage.Source = bi;\nInl... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198910",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5948/"
] |
198,928 | <p>Brief:</p>
<pre><code>convert ( -size 585x128 gradient: ) NewImage.png
</code></pre>
<p>How do I change the above ImageMagick command so it takes the width and height from an existing image? I need it to remain a one line command.</p>
<hr>
<p>Details:</p>
<p>I'm trying to programatically create an image reflection using ImageMagick. The effect I am looking for is similar to what you would see when looking at an object on the edge of a pool of water. There is a pretty good thread on what I am trying to do <a href="http://www.imagemagick.org/discourse-server/viewtopic.php?f=1&t=11585" rel="nofollow noreferrer">here</a> but the solution isn't exactly what I am looking for. Since I will be calling ImageMagick from a C#.Net application I want to use one call without any temp files and return the image through stdout. So far I have this...</p>
<pre><code>convert OriginalImage.png ( OriginalImage.png -flip -blur 3x5 \
-crop 100%%x30%%+0+0 -negate -evaluate multiply 0.3 \
-negate ( -size 585x128 gradient: ) +matte -compose copy_opacity -composite )
-append NewImage.png
</code></pre>
<p>This works ok but doesn't give me the exact fade I am looking for. Instead of a nice solid fade from top to bottom it is giving me a fade from top left to bottom right. I added the (-negate -evaluate multiply 0.3 -negate) section in to lighten it up a bit more since I wasn't getting the fade I wanted. I also don't want to have to hard code in the size of the image when creating the gradient ( -size 585x128 gradient: ) I'm also going to want to keep the original image's transparency if possible.</p>
<p>To go to stdout I plan on replacing "NewImage.png" with "-"</p>
| [
{
"answer_id": 205401,
"author": "korro",
"author_id": 22650,
"author_profile": "https://Stackoverflow.com/users/22650",
"pm_score": 1,
"selected": false,
"text": "command = String.Format(\"convert bar %1x%2\",img.Width,img.Height)\n"
},
{
"answer_id": 2701367,
"author": "hac... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198928",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
198,931 | <p>How can I find out if SP1 has been installed on a server which has .NET 3.5?</p>
| [
{
"answer_id": 198959,
"author": "Ray",
"author_id": 233,
"author_profile": "https://Stackoverflow.com/users/233",
"pm_score": 7,
"selected": false,
"text": "HKLM\\SOFTWARE\\Microsoft\\NET Framework Setup\\NDP\\v3.5\\"
},
{
"answer_id": 198998,
"author": "Panos",
"author_... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198931",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1463/"
] |
198,936 | <p>What is the right way to populate the model for the index page in a grails app? There is no IndexController by default, is there some other mechanism for getting lists of this and that into the model?</p>
| [
{
"answer_id": 204537,
"author": "Ed.T",
"author_id": 3014,
"author_profile": "https://Stackoverflow.com/users/3014",
"pm_score": 6,
"selected": true,
"text": "class UrlMappings {\n static mappings = {\n \"/$controller/$action?/$id?\"{\n constraints {\n ... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198936",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2031/"
] |
198,945 | <p>How can you get a <strong>raw</strong> socket in Perl, and then what's the best way to built a packet for use with it?</p>
| [
{
"answer_id": 199031,
"author": "raldi",
"author_id": 7598,
"author_profile": "https://Stackoverflow.com/users/7598",
"pm_score": 3,
"selected": true,
"text": "use Net::RawIP;\n$a = new Net::RawIP;\n$a->set({ip => {saddr => 'my.target.lan',daddr => 'my.target.lan'},\n tcp => {so... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198945",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7598/"
] |
198,952 | <p>I have two users Bob and Alice in Oracle, both created by running the following commands as sysdba from sqlplus:</p>
<pre>
create user $blah identified by $password;
grant resource, connect, create view to $blah;
</pre>
<p>I want Bob to have complete access to Alice's schema (that is, all tables), but I'm not sure what grant to run, and whether to run it as sysdba or as Alice.</p>
<p>Happy to hear about any good pointers to reference material as well -- don't seem to be able to get a good answer to this from either the Internet or "Oracle Database 10g The Complete Reference", which is sitting on my desk.</p>
| [
{
"answer_id": 198962,
"author": "cagcowboy",
"author_id": 19629,
"author_profile": "https://Stackoverflow.com/users/19629",
"pm_score": 5,
"selected": true,
"text": "SELECT 'GRANT ALL ON '||table_name||' TO BOB;'\nFROM ALL_TABLES\nWHERE OWNER = 'ALICE';\n"
},
{
"answer_id": 2... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198952",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25915/"
] |
198,970 | <p>I have a fairly simple const struct in some C code that simply holds a few pointers and would like to initialize it statically if possible. Can I and, if so, how?</p>
| [
{
"answer_id": 198980,
"author": "Lev",
"author_id": 7224,
"author_profile": "https://Stackoverflow.com/users/7224",
"pm_score": 5,
"selected": true,
"text": "// In global scope\nint x, y;\nconst struct {int *px, *py; } s = {&x, &y};\n"
},
{
"answer_id": 198983,
"author": "AS... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198970",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26551/"
] |
198,974 | <p>I have a validation control that has the following expression:</p>
<pre><code>(?=(.*\\d.*){2,})(?=(.*\\w.*){2,})(?=(.*\\W.*){1,}).{8,}
</code></pre>
<p>That's a password with at least <strong>2 digits</strong>, <strong>2 alpha characters</strong>, <strong>1 non-alphanumeric</strong> and <strong>8 character minimum</strong>. Unfortunately this doesn't seem to be cross-browser compliant.</p>
<p>This validation works perfectly in Firefox, but it does not in Internet Explorer.</p>
<p><strong><em>A combination of each of your answers results in:</em></strong></p>
<pre><code>var format = "^(?=.{" + minLength + ",})" +
(minAlpha > 0 ? "(?=(.*[A-Za-z].*){" + minAlpha + ",})" : "") +
(minNum > 0 ? "(?=(.*[0-9].*){" + minNum + ",})" : "") +
(minNonAlpha > 0 ? "(?=(.*\\W.*){" + minNonAlpha + ",})" : "") + ".*$";
EX: "^(?=.{x,})(?=(.*[A-Za-z].*){y,})(?=(.*[0-9].*){z,})(?=(.*\W.*){a,}).*$"
</code></pre>
<p>The important piece is having the (?.{x,}) for the length <strong>first</strong>.</p>
| [
{
"answer_id": 199085,
"author": "Markus Jarderot",
"author_id": 22364,
"author_profile": "https://Stackoverflow.com/users/22364",
"pm_score": 5,
"selected": true,
"text": "(?=(.*\\W.*){0,})"
},
{
"answer_id": 199090,
"author": "sontek",
"author_id": 17176,
"author_pr... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198974",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19753/"
] |
198,975 | <p>I am tring to get the <a href="http://www.herrodius.com/blog/85" rel="nofollow noreferrer">ASDoc Ant task</a> to work:</p>
<pre><code><target name="asdoc" depends="compile">
<mkdir dir="${dist_asdocs}"/>
<asdoc
docSources="${srcdir}"
output="${dist_asdocs}"
executable="${FLEX_HOME}/bin/asdoc.exe" />
</target>
</code></pre>
<p>When I run it I get errors from ASDoc like "Error: Type was not found or was not a compile-time constant: XXX". When I run ASDoc manually I do: "asdoc -source-path src -doc-sources src". If I omit the -source-path value I get the same errors... so how am I supposed to get the Ant task to work?</p>
| [
{
"answer_id": 199586,
"author": "Simon Lehmann",
"author_id": 27011,
"author_profile": "https://Stackoverflow.com/users/27011",
"pm_score": 2,
"selected": false,
"text": "<exec executable=\"${FLEX_HOME}/bin/asdoc\" dir=\"${basedir}\">\n <arg value=\"-source-path\"/>\n <arg path=\"... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198975",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13220/"
] |
198,979 | <p>I'm using Visual Studio 2008 Team System with SP1, and I've noticed an annoying tendency for the IDE to hang for several (10-15) seconds whenever I stop debugging an application. At first I thought this only happened with WPF apps, but I've observed the behavior in Windows Forms apps and ASP.NET sites as well. I've made a series of changes to the Options based on <a href="https://stackoverflow.com/questions/8440/visual-studio-optimizations">this previous post</a> and done exhaustive Google/MSDN searches, but still haven't found a way to stop this. </p>
<p>Anyone have any ideas?</p>
<hr>
<p>@<a href="https://stackoverflow.com/users/25731/korona">korona</a> - Nope, that didn't fix it. Thanks for your suggestion, though.</p>
<p>More research in ProcMon shows this interesting tidbit, not sure if it is related:</p>
<pre><code>8:45:46.6790857 AM WindowsFormsApplication1.vshost.exe 7684 FASTIO_CHECK_IF_POSSIBLE C:\WINXP\Microsoft.NET\Framework\v2.0.50727\CONFIG\enterprisesec.config.cch FAST IO DISALLOWED Operation: Read, Offset: 48, Length: 12
8:45:46.6793569 AM WindowsFormsApplication1.vshost.exe 7684 ReadFile C:\WINXP\Microsoft.NET\Framework\v2.0.50727\CONFIG\enterprisesec.config.cch FAST IO DISALLOWED Offset: 508, Length: 12
</code></pre>
<p>This repeats several times, like hundreds of times, then it switches to a different path:</p>
<pre><code>8:45:46.7470314 AM WindowsFormsApplication1.vshost.exe 7684 FASTIO_CHECK_IF_POSSIBLE D:\documents and settings\myusername\Application Data\Microsoft\CLR Security Config\v2.0.50727.42\security.config.cch FAST IO DISALLOWED Operation: Read, Offset: 48, Length: 12
8:45:46.7472187 AM WindowsFormsApplication1.vshost.exe 7684 ReadFile D:\documents and settings\myusername\Application Data\Microsoft\CLR Security Config\v2.0.50727.42\security.config.cch FAST IO DISALLOWED Offset: 508, Length: 12
</code></pre>
<p>And repeats again many more times, with slight changes in the offset each iteration. Maybe unrelated, but....</p>
| [
{
"answer_id": 199062,
"author": "AJ.",
"author_id": 27457,
"author_profile": "https://Stackoverflow.com/users/27457",
"pm_score": 0,
"selected": false,
"text": "private void button1_Click(object sender, EventArgs e)\n{\n MessageBox.Show(\"I am saying hello.\");\n}\n"
},
{
"an... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198979",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27457/"
] |
198,984 | <p>I have a solution with multiple projects and we need to do some serious global replacements.</p>
<p>Is there a way to do a wildcard replacement where some values remain in after the replace?</p>
<p>So, for instance if I want every <strong>HttpContext.Current.Session[“whatevervalue”]</strong> to become <strong>HttpContext.Current.Session[“whatevervalue”].ToString()</strong> the string value being passed in will be respected? I don’t want to replace “whatevervalue” I just want to append a .ToString() where the pattern matches. </p>
<p>Is this possible in Visual Studio?</p>
| [
{
"answer_id": 199002,
"author": "Gordon Bell",
"author_id": 16473,
"author_profile": "https://Stackoverflow.com/users/16473",
"pm_score": 5,
"selected": true,
"text": "HttpContext\\.Current\\.Session\\[\"{.@}\"\\]\n"
},
{
"answer_id": 199010,
"author": "Amanda Mitchell",
... | 2008/10/13 | [
"https://Stackoverflow.com/questions/198984",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2213/"
] |
198,991 | <p>I'm in need of a lightweight library for 2d & 3d vectors and 3x3 & 4x4 matrices. In basic C.
Just so I don't reinvent the wheel suboptimally.</p>
<p>Any suggestions?</p>
| [
{
"answer_id": 228970,
"author": "Nazgob",
"author_id": 3579,
"author_profile": "https://Stackoverflow.com/users/3579",
"pm_score": 1,
"selected": false,
"text": "#include <D3DX9Math.h>\n"
}
] | 2008/10/13 | [
"https://Stackoverflow.com/questions/198991",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8683/"
] |
199,014 | <p>I have a proxy object generated by Visual Studio (client side) named ServerClient. I am attempting to set ClientCredentials.UserName.UserName/Password before opening up a new connection using this code:</p>
<pre><code>InstanceContext context = new InstanceContext(this);
m_client = new ServerClient(context);
m_client.ClientCredentials.UserName.UserName = "Sample";
</code></pre>
<p>As soon as the code hits the UserName line it fails with an "Object is read-only" error. I know this can happen if the connection is already open or faulted, but at this point I haven't called context.Open() yet. </p>
<p>I have configured the Bindings (which uses netTcpBinding) to use Message as it's security mode, and MessageClientCredentialType is set to UserName.</p>
<p>Any ideas?</p>
| [
{
"answer_id": 201190,
"author": "Paul Mrozowski",
"author_id": 3656,
"author_profile": "https://Stackoverflow.com/users/3656",
"pm_score": 4,
"selected": true,
"text": "base.ClientCredentials.UserName.UserName = \"Sample\";\n"
},
{
"answer_id": 800233,
"author": "Eugene Yoko... | 2008/10/13 | [
"https://Stackoverflow.com/questions/199014",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3656/"
] |
199,016 | <p>I'm trying to use opengl in C#. I have following code which fails with error 2000 ERROR_INVALID_PIXEL_FORMAT<br>
First definitions:</p>
<pre><code>[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true, ExactSpelling = true)]
public static extern IntPtr GetDC(IntPtr hWnd);
[StructLayout(LayoutKind.Sequential)]
public struct PIXELFORMATDESCRIPTOR
{
public void Init()
{
nSize = (ushort) Marshal.SizeOf(typeof (PIXELFORMATDESCRIPTOR));
nVersion = 1;
dwFlags = PFD_FLAGS.PFD_DRAW_TO_WINDOW | PFD_FLAGS.PFD_SUPPORT_OPENGL | PFD_FLAGS.PFD_DOUBLEBUFFER | PFD_FLAGS.PFD_SUPPORT_COMPOSITION;
iPixelType = PFD_PIXEL_TYPE.PFD_TYPE_RGBA;
cColorBits = 24;
cRedBits = cRedShift = cGreenBits = cGreenShift = cBlueBits = cBlueShift = 0;
cAlphaBits = cAlphaShift = 0;
cAccumBits = cAccumRedBits = cAccumGreenBits = cAccumBlueBits = cAccumAlphaBits = 0;
cDepthBits = 32;
cStencilBits = cAuxBuffers = 0;
iLayerType = PFD_LAYER_TYPES.PFD_MAIN_PLANE;
bReserved = 0;
dwLayerMask = dwVisibleMask = dwDamageMask = 0;
}
ushort nSize;
ushort nVersion;
PFD_FLAGS dwFlags;
PFD_PIXEL_TYPE iPixelType;
byte cColorBits;
byte cRedBits;
byte cRedShift;
byte cGreenBits;
byte cGreenShift;
byte cBlueBits;
byte cBlueShift;
byte cAlphaBits;
byte cAlphaShift;
byte cAccumBits;
byte cAccumRedBits;
byte cAccumGreenBits;
byte cAccumBlueBits;
byte cAccumAlphaBits;
byte cDepthBits;
byte cStencilBits;
byte cAuxBuffers;
PFD_LAYER_TYPES iLayerType;
byte bReserved;
uint dwLayerMask;
uint dwVisibleMask;
uint dwDamageMask;
}
[Flags]
public enum PFD_FLAGS : uint
{
PFD_DOUBLEBUFFER = 0x00000001,
PFD_STEREO = 0x00000002,
PFD_DRAW_TO_WINDOW = 0x00000004,
PFD_DRAW_TO_BITMAP = 0x00000008,
PFD_SUPPORT_GDI = 0x00000010,
PFD_SUPPORT_OPENGL = 0x00000020,
PFD_GENERIC_FORMAT = 0x00000040,
PFD_NEED_PALETTE = 0x00000080,
PFD_NEED_SYSTEM_PALETTE = 0x00000100,
PFD_SWAP_EXCHANGE = 0x00000200,
PFD_SWAP_COPY = 0x00000400,
PFD_SWAP_LAYER_BUFFERS = 0x00000800,
PFD_GENERIC_ACCELERATED = 0x00001000,
PFD_SUPPORT_DIRECTDRAW = 0x00002000,
PFD_DIRECT3D_ACCELERATED = 0x00004000,
PFD_SUPPORT_COMPOSITION = 0x00008000,
PFD_DEPTH_DONTCARE = 0x20000000,
PFD_DOUBLEBUFFER_DONTCARE = 0x40000000,
PFD_STEREO_DONTCARE = 0x80000000
}
public enum PFD_LAYER_TYPES : byte
{
PFD_MAIN_PLANE = 0,
PFD_OVERLAY_PLANE = 1,
PFD_UNDERLAY_PLANE = 255
}
public enum PFD_PIXEL_TYPE : byte
{
PFD_TYPE_RGBA = 0,
PFD_TYPE_COLORINDEX = 1
}
[DllImport("gdi32.dll", CharSet = CharSet.Auto, SetLastError = true, ExactSpelling = true)]
public static extern int ChoosePixelFormat(IntPtr hdc, [In] ref PIXELFORMATDESCRIPTOR ppfd);
[DllImport("gdi32.dll", CharSet = CharSet.Auto, SetLastError = true, ExactSpelling = true)]
public static extern bool SetPixelFormat(IntPtr hdc, int iPixelFormat, ref PIXELFORMATDESCRIPTOR ppfd);
[DllImport("opengl32.dll", CharSet = CharSet.Auto, SetLastError = true, ExactSpelling = true)]
public static extern IntPtr wglCreateContext(IntPtr hDC);
</code></pre>
<p>And now the code that fails:</p>
<pre><code>IntPtr dc = Win.GetDC(hwnd);
var pixelformatdescriptor = new GL.PIXELFORMATDESCRIPTOR();
pixelformatdescriptor.Init();
var pixelFormat = GL.ChoosePixelFormat(dc, ref pixelformatdescriptor);
if(!GL.SetPixelFormat(dc, pixelFormat, ref pixelformatdescriptor))
throw new Win32Exception(Marshal.GetLastWin32Error());
IntPtr hglrc;
if((hglrc = GL.wglCreateContext(dc)) == IntPtr.Zero)
throw new Win32Exception(Marshal.GetLastWin32Error()); //<----- here I have exception
</code></pre>
<p>the same code in managed C++ is working</p>
<pre><code>HDC dc = GetDC(hWnd);
PIXELFORMATDESCRIPTOR pf;
pf.nSize = sizeof(PIXELFORMATDESCRIPTOR);
pf.nVersion = 1;
pf.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER | PFD_SUPPORT_COMPOSITION;
pf.cColorBits = 24;
pf.cRedBits = pf.cRedShift = pf.cGreenBits = pf.cGreenShift = pf.cBlueBits = pf.cBlueShift = 0;
pf.cAlphaBits = pf.cAlphaShift = 0;
pf.cAccumBits = pf.cAccumRedBits = pf.cAccumGreenBits = pf.cAccumBlueBits = pf.cAccumAlphaBits = 0;
pf.cDepthBits = 32;
pf.cStencilBits = pf.cAuxBuffers = 0;
pf.iLayerType = PFD_MAIN_PLANE;
pf.bReserved = 0;
pf.dwLayerMask = pf.dwVisibleMask = pf.dwDamageMask = 0;
int ipf = ChoosePixelFormat(dc, &pf);
SetPixelFormat(dc, ipf, &pf);
HGLRC hglrc = wglCreateContext(dc);
</code></pre>
<p>I've tried it on VIsta 64-bit with ATI graphic card and on Windows XP 32-bit with Nvidia with the same result in both cases.<br>
Also I want to mention that I don't want to use any already written framework for it.<br>
<br>
Can anyone show me where is the bug in C# code that is causing the exception?<br>
<br></p>
| [
{
"answer_id": 205675,
"author": "Brian",
"author_id": 17356,
"author_profile": "https://Stackoverflow.com/users/17356",
"pm_score": 0,
"selected": false,
"text": "[StructLayout(LayoutKind.Sequential, Pack=1)]\n"
},
{
"answer_id": 206933,
"author": "SeeR",
"author_id": 22... | 2008/10/13 | [
"https://Stackoverflow.com/questions/199016",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22569/"
] |
199,017 | <p>I'm looking for best practices for performing strict (whitelist) validation/filtering of user-submitted HTML.</p>
<p>Main purpose is to filter out XSS and similar nasties that may be entered via web forms. Secondary purpose is to limit breakage of HTML content entered by non-technical users e.g. via WYSIWYG editor that has an HTML view.</p>
<p>I'm considering using <a href="http://htmlpurifier.org" rel="noreferrer">HTML Purifier</a>, or rolling my own by using an HTML DOM parser to go through a process like HTML(dirty)->DOM(dirty)->filter->DOM(clean)->HTML(clean).</p>
<p>Can you describe successes with these or any easier strategies that are also effective? Any pitfalls to watch out for?</p>
| [
{
"answer_id": 199072,
"author": "Ross",
"author_id": 2025,
"author_profile": "https://Stackoverflow.com/users/2025",
"pm_score": 3,
"selected": false,
"text": "<img src=\"http://www.mysite.com/logout\" />\n"
},
{
"answer_id": 199123,
"author": "Kornel",
"author_id": 2700... | 2008/10/13 | [
"https://Stackoverflow.com/questions/199017",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27304/"
] |
199,035 | <p>Has anyone used <a href="http://pear.php.net/package/Spreadsheet_Excel_Writer/" rel="nofollow noreferrer">Pear: Spreadsheet_Excel_Writer</a>?</p>
<p>The <a href="http://pear.php.net/manual/en/package.fileformats.spreadsheet-excel-writer.intro-format.php" rel="nofollow noreferrer">Formatting Tutorial</a> lists a script similar to what I'm working with: (trimmed down)</p>
<pre><code><?php
require_once 'Spreadsheet/Excel/Writer.php';
$workbook = new Spreadsheet_Excel_Writer();
$worksheet =& $workbook->addWorksheet();
$worksheet->write(0, 0, "Quarterly Profits for Dotcom.Com");
$workbook->send('test.xls');
$workbook->close();
?>
</code></pre>
<p>What I think I understand so far about it...<br>
<code>$workbook->send('test.xls');</code> sets the headers up for Excel file transfer. Now, no errors seem to come up, but the file downloaded is entirely empty (even in a hex editor).</p>
<p>So...<br>
Where (in what class/method) is the <code>$workbook</code> binary supposed to be written? Or, am I misunderstanding it all?</p>
<p><strong>Note</strong>: I honestly don't know what version of Spreadsheet_Excel_Writer is being used; the sources don't include such useful information.<br>
I can tell you the copyright is <strong><em>2002-2003</em></strong>; so, anywhere from version 0.1 to 0.6.</p>
<p>[<strong>Edit</strong>] Sorry, thought I'd mentioned this somewhere.. This is someone else's script that I've been assigned to fix.</p>
| [
{
"answer_id": 199166,
"author": "Till",
"author_id": 2859,
"author_profile": "https://Stackoverflow.com/users/2859",
"pm_score": 3,
"selected": true,
"text": "<?php\nrequire_once 'Spreadsheet/Excel/Writer.php';\n$workbook = new Spreadsheet_Excel_Writer('test.xls');\n$worksheet =& $workb... | 2008/10/13 | [
"https://Stackoverflow.com/questions/199035",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15031/"
] |
199,044 | <p>My rails app is in a svn repository, but several of the plugins are installed through git and later added to the svn repo. How can I update these plugins? I can't seem to get script/plugin update to do anything. I'd really like to update activemerchant to get rid of the Inflector warnings.</p>
| [
{
"answer_id": 200349,
"author": "Greg Borenstein",
"author_id": 10419,
"author_profile": "https://Stackoverflow.com/users/10419",
"pm_score": 0,
"selected": false,
"text": "\ngit pull\n"
},
{
"answer_id": 215380,
"author": "Matt",
"author_id": 29228,
"author_profile"... | 2008/10/13 | [
"https://Stackoverflow.com/questions/199044",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2884/"
] |
199,045 | <p>I'm looking for a library that has functionality similar to Perl's <a href="http://search.cpan.org/dist/WWW-Mechanize/lib/WWW/Mechanize.pm#SYNOPSIS" rel="noreferrer">WWW::Mechanize</a>, but for PHP. Basically, it should allow me to submit HTTP GET and POST requests with a simple syntax, and then parse the resulting page and return in a simple format all forms and their fields, along with all links on the page.</p>
<p>I know about CURL, but it's a little too barebones, and the syntax is pretty ugly (tons of <code>curl_foo($curl_handle, ...)</code> statements</p>
<p><strong>Clarification:</strong></p>
<p>I want something more high-level than the answers so far. For example, in Perl, you could do something like:</p>
<pre><code># navigate to the main page
$mech->get( 'http://www.somesite.com/' );
# follow a link that contains the text 'download this'
$mech->follow_link( text_regex => qr/download this/i );
# submit a POST form, to log into the site
$mech->submit_form(
with_fields => {
username => 'mungo',
password => 'lost-and-alone',
}
);
# save the results as a file
$mech->save_content('somefile.zip');
</code></pre>
<p>To do the same thing using HTTP_Client or wget or CURL would be a lot of work, I'd have to manually parse the pages to find the links, find the form URL, extract all the hidden fields, and so on. The reason I'm asking for a PHP solution is that I have no experience with Perl, and I could probably build what I need with a lot of work, but it would be much quicker if I could do the above in PHP.</p>
| [
{
"answer_id": 199054,
"author": "moo",
"author_id": 23107,
"author_profile": "https://Stackoverflow.com/users/23107",
"pm_score": 1,
"selected": false,
"text": "class curl {\n private $resource;\n\n public function __construct($url) {\n $this->resource = curl_init($url);\n ... | 2008/10/13 | [
"https://Stackoverflow.com/questions/199045",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14569/"
] |
199,059 | <p>I've got a file whose format I'm altering via a python script. I have several camel cased strings in this file where I just want to insert a single space before the capital letter - so "WordWordWord" becomes "Word Word Word".</p>
<p>My limited regex experience just stalled out on me - can someone think of a decent regex to do this, or (better yet) is there a more pythonic way to do this that I'm missing?</p>
| [
{
"answer_id": 199075,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 7,
"selected": true,
"text": ">>> re.sub(r\"(\\w)([A-Z])\", r\"\\1 \\2\", \"WordWordWord\")\n'Word Word Word'\n"
},
{
"answer_id": 199094,
"... | 2008/10/13 | [
"https://Stackoverflow.com/questions/199059",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19074/"
] |
199,065 | <p>I've declared Javascript arrays in such a way that I could then access them by a key, but it was a long time ago, and I've forgotten how I did it.</p>
<p>Basically, I have two fields I want to store, a unique key, and its value. I know there is a way to do it.. something like:</p>
<pre><code>var jsArray = new {key: 'test test', value: 'value value'},
new {key: 'test 2', value: 'value 2'};
</code></pre>
<p>and accessed like:</p>
<pre><code>value = jsArray[key]
</code></pre>
<p>Can someone remind me?</p>
| [
{
"answer_id": 199083,
"author": "Christian C. Salvadó",
"author_id": 5445,
"author_profile": "https://Stackoverflow.com/users/5445",
"pm_score": 4,
"selected": true,
"text": "var a = {'a':0, 'b':1, 'c':2};\n\nvar b = new Array();\nb['a'] = 0;\nb['b'] = 1;\nb['c'] = 2;\n\nvar c = new Obj... | 2008/10/13 | [
"https://Stackoverflow.com/questions/199065",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1965/"
] |
199,068 | <p>Is it possible to play video from data that has been embedded in a swf at compile time (with the <code>[Embed]</code> metatag)?</p>
<p>The "Import Video->Embed" feature provided by Flash CS3 etc. is not acceptable because it has many severe limitations (including sound synchronization issues, a maximum number of frames, and other caveats)</p>
<p>I'm interested in being able to bundle flv video data in a swf (along with other assets), which will be played by an AIR application.</p>
<p>I don't think it can be done. Anyone disagree?</p>
| [
{
"answer_id": 2519192,
"author": "aaaidan",
"author_id": 26331,
"author_profile": "https://Stackoverflow.com/users/26331",
"pm_score": 0,
"selected": false,
"text": "Embed"
},
{
"answer_id": 9887078,
"author": "Thom",
"author_id": 24618,
"author_profile": "https://St... | 2008/10/13 | [
"https://Stackoverflow.com/questions/199068",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26331/"
] |
199,080 | <p>A similar question was asked <a href="https://stackoverflow.com/questions/198931/how-do-i-tell-if-net-35-sp1-is-installed">here</a>, but it was specific to .NET 3.5. Specifically, I'm looking for the following:</p>
<ol>
<li>What is the correct way to determine which .NET Framework versions and service packs are installed?</li>
<li>Is there a list of registry keys that can be used?</li>
<li>Are there any dependencies between Framework versions?</li>
</ol>
| [
{
"answer_id": 199121,
"author": "Franci Penov",
"author_id": 17028,
"author_profile": "https://Stackoverflow.com/users/17028",
"pm_score": 3,
"selected": false,
"text": "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\NET Framework Setup\\NDP"
},
{
"answer_id": 199783,
"author": "S... | 2008/10/13 | [
"https://Stackoverflow.com/questions/199080",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1559/"
] |
199,099 | <p>I'm using <code>$.post()</code> to call a servlet using Ajax and then using the resulting HTML fragment to replace a <code>div</code> element in the user's current page. However, if the session times out, the server sends a redirect directive to send the user to the login page. In this case, jQuery is replacing the <code>div</code> element with the contents of the login page, forcing the user's eyes to witness a rare scene indeed. </p>
<p>How can I manage a redirect directive from an Ajax call with jQuery 1.2.6?</p>
| [
{
"answer_id": 199156,
"author": "Till",
"author_id": 2859,
"author_profile": "https://Stackoverflow.com/users/2859",
"pm_score": 6,
"selected": false,
"text": "$.ajax()"
},
{
"answer_id": 216245,
"author": "Vladimir Prudnikov",
"author_id": 29364,
"author_profile": "... | 2008/10/13 | [
"https://Stackoverflow.com/questions/199099",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2024/"
] |
199,113 | <p>I have a <code>BasePage</code> which inherits from <code>System.Web.UI.Page</code>, and every page that inherits the <code>BasePage</code> will have the same master page.</p>
<p>How do I cast the <code>Page.Master</code> of the <code>BasePage</code> to the specific master page so I can access properties on it?</p>
| [
{
"answer_id": 199116,
"author": "Stephen Wrighton",
"author_id": 7516,
"author_profile": "https://Stackoverflow.com/users/7516",
"pm_score": 0,
"selected": false,
"text": "MasterPageVariable = Ctype(page.MasterPage, MasterPageClass)\n"
},
{
"answer_id": 199122,
"author": "Fl... | 2008/10/13 | [
"https://Stackoverflow.com/questions/199113",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4998/"
] |
199,127 | <p>I have asp.net form that contains fields. When I access this window, my javascript functions can access the fields via the DOM with the getElementById() method and when I postpack to the server I am receiving the updates made by the client.</p>
<p>However, when I launch the form as a child window using Telerik's RadWindow control, the javascript can not access the hidden fields on the child form. Instead I get null. </p>
<p>My questions are:</p>
<ol>
<li>Are hidden fields on a child window
not accessible when the window is
launched from a parent asp.net form?</li>
<li>Has anyone attempted this with Telerik controls and run into issues?</li>
</ol>
<p><strong>EDIT</strong>
Craig pointed out that the id may be different. Two additional questions then:</p>
<ol>
<li>Can you ensure that the id you assign at the server is actually used?</li>
<li>Is using getElementByName() a better mechanism to access DOM elements?</li>
</ol>
| [
{
"answer_id": 199524,
"author": "TonyB",
"author_id": 3543,
"author_profile": "https://Stackoverflow.com/users/3543",
"pm_score": 2,
"selected": true,
"text": "<%= theControl.ClientID %>\n"
},
{
"answer_id": 440701,
"author": "LarryF",
"author_id": 18518,
"author_pro... | 2008/10/13 | [
"https://Stackoverflow.com/questions/199127",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19799/"
] |
199,130 | <p>For my Java apps with very long classpaths, I cannot see the main class specified near the end of the arg list when using ps. I think this stems from my Ubuntu system's size limit on /proc/pid/cmdline. How can I increase this limit?</p>
| [
{
"answer_id": 199199,
"author": "Robert Gamble",
"author_id": 25222,
"author_profile": "https://Stackoverflow.com/users/25222",
"pm_score": 5,
"selected": true,
"text": " 274 int res = 0;\n 275 unsigned int len;\n 276 struct mm_struct *mm = get_task_mm(task);\n 277 ... | 2008/10/13 | [
"https://Stackoverflow.com/questions/199130",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27635/"
] |
199,142 | <p>I'm designing some VB based ASP.NET 2.0, and I am trying to make more use of the various ASP tags that visual studio provides, rather than hand writing everything in the code-behind. I want to pass in an outside variable from the Session to identify who the user is for the query.</p>
<pre><code><asp:sqldatasource id="DataStores" runat="server" connectionstring="<%$ ConnectionStrings:MY_CONNECTION %>"
providername="<%$ ConnectionStrings:MY_CONNECTION.ProviderName %>"
selectcommand="SELECT THING1, THING2 FROM DATA_TABLE WHERE (THING2 IN (SELECT THING2 FROM RELATED_DATA_TABLE WHERE (USERNAME = @user)))"
onselecting="Data_Stores_Selecting">
<SelectParameters>
<asp:parameter name="user" defaultvalue ="" />
</SelectParameters>
</asp:sqldatasource>
</code></pre>
<p>And on my code behind I have:</p>
<pre><code>Protected Sub Data_Stores_Selecting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceSelectingEventArgs) Handles Data_Stores.Selecting
e.Command.Parameters("user").Value = Session("userid")
End Sub
</code></pre>
<p>Oracle squaks at me with ORA-01036, illegal variable name. Am I declaring the variable wrong in the query? </p>
<p>I thought external variables share the same name with a @ prefixed. from what I understand, this should be placing the value I want into the query when it executes the select.</p>
<p>EDIT: Okay, thanks for the advice so far, first error was corrected, I need to use : and not @ for the variable declaration in the query. Now it generates an ORA-01745 invalid host/bind variable name.</p>
<p>EDIT AGAIN: Okay, looks like user was a reserved word. It works now! Thanks for other points of view on this one. I hadn't thought of that approach.</p>
| [
{
"answer_id": 199574,
"author": "tvanfosson",
"author_id": 12950,
"author_profile": "https://Stackoverflow.com/users/12950",
"pm_score": 2,
"selected": false,
"text": "<SelectParameters>\n <SessionParameter Name=\"userID\" SessionField=\"user\" DefaultValue=\"\" />\n</SelectParameters>... | 2008/10/13 | [
"https://Stackoverflow.com/questions/199142",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12545/"
] |
199,151 | <p>I'm trying to link a Qt application with its libraries and the linker (MinGW) spews hundreds of lines like the following, and I am unsure how to proceed.</p>
<pre>
cpp: undefined reference to `_Unwind_SjLj_Register'
c:/qt/lib/libQtCore.a(qcoreapplication_win.o)(.text+0x29d):qcoreapplication_win.
cpp: undefined reference to `_Unwind_SjLj_Unregister'
c:/qt/lib/libQtCore.a(qcoreapplication_win.o)(.text+0x38c):qcoreapplication_win.
cpp: undefined reference to `_Unwind_SjLj_Resume'
c:/qt/lib/libQtCore.a(qcoreapplication_win.o)(.text+0x4ce):qcoreapplication_win.
cpp: undefined reference to `_Unwind_SjLj_Register'
c:/qt/lib/libQtCore.a(qcoreapplication_win.o)(.text+0x53e):qcoreapplication_win.
cpp: undefined reference to `_Unwind_SjLj_Unregister'
c:/qt/lib/libQtCore.a(qcoreapplication_win.o)(.text+0x635):qcoreapplication_win.
cpp: undefined reference to `_Unwind_SjLj_Resume'
</pre>
| [
{
"answer_id": 199372,
"author": "Colin Jensen",
"author_id": 9884,
"author_profile": "https://Stackoverflow.com/users/9884",
"pm_score": 3,
"selected": false,
"text": "CONFIG += exceptions\n"
},
{
"answer_id": 11979569,
"author": "chacham15",
"author_id": 516813,
"au... | 2008/10/13 | [
"https://Stackoverflow.com/questions/199151",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8923/"
] |
199,152 | <p>I have a Java Applet that uses AWT. In some (rare) circumstances, the platform does not refresh the screen properly. I can move or minimize/maximize the window and see that my applet refreshed properly. I am looking for code that will give me the fullest possible applet screen repaint, simulating the behaviour of a minimize/maximize. </p>
<p>I've tried calling various combinations of paint()/repaint()/invalidate()/update() on the parent containers and recursing on various children. However, no combination (that I've found) cleans up the framework bugs that I am encountering. I am looking for techniques to fully refresh the applet, even if they may cause some slight flickering, as I will be invoking this code only on the problematic platform. </p>
<p>In my tests, moving to Swing did not help resolve my problem. </p>
<p>By the way, this is a simplification of my previous (more complicated) post: <a href="https://stackoverflow.com/questions/184491/java-applet-awt-refresh-problem-mac-os-x-104">Java Applet, AWT Refresh problem Mac OS X 10.4</a> </p>
<p>Edit: Investigation in threading did not solve this problem. Marking best answer as the good one. </p>
| [
{
"answer_id": 201067,
"author": "Tom",
"author_id": 20979,
"author_profile": "https://Stackoverflow.com/users/20979",
"pm_score": 0,
"selected": false,
"text": "public class VeryFastPanel extends JPanel {\n\n\n\n /**\n *\n */\n private static final long serialV... | 2008/10/13 | [
"https://Stackoverflow.com/questions/199152",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20893/"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.