qid
int64
4
8.14M
question
stringlengths
20
48.3k
answers
list
date
stringlengths
10
10
metadata
list
input
stringlengths
12
45k
output
stringlengths
2
31.8k
220,188
<p><a href="http://www.w3.org/TR/REC-html40/interact/scripts.html" rel="noreferrer"><strong>According to spec</strong></a>, only the <code>BODY</code> and <code>FRAMESET</code> elements provide an "onload" event to attach to, but I would like to know when a dynamically-created DOM element has been added to the DOM in J...
[ { "answer_id": 220192, "author": "eyelidlessness", "author_id": 17964, "author_profile": "https://Stackoverflow.com/users/17964", "pm_score": 1, "selected": false, "text": "<p>You want the <code>DOMNodeInserted</code> event (or <code>DOMNodeInsertedIntoDocument</code>).</p>\n\n<p>Edit: I...
2008/10/20
[ "https://Stackoverflow.com/questions/220188", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1790/" ]
[**According to spec**](http://www.w3.org/TR/REC-html40/interact/scripts.html), only the `BODY` and `FRAMESET` elements provide an "onload" event to attach to, but I would like to know when a dynamically-created DOM element has been added to the DOM in JavaScript. The super-naive heuristics I am currently using, which...
UPDATE: For anyone interested in it, here is the implementation I finally used: ``` function isInDOMTree(node) { // If the farthest-back ancestor of our node has a "body" // property (that node would be the document itself), // we assume it is in the page's DOM tree. return !!(findUltimateAncestor(node).b...
220,202
<p>The subject doesn't say much cause it is not easy to question in one line. I have to execute a few programs which I read from the registry. I have to read from a field where somebody saves the whole paths and arguments.<br> I've been using System.Diagnostics.ProcessStartInfo setting the name of the program and its a...
[ { "answer_id": 220227, "author": "Michael Madsen", "author_id": 27528, "author_profile": "https://Stackoverflow.com/users/27528", "pm_score": 0, "selected": false, "text": "<p>There are several, in fact.</p>\n\n<ol>\n<li>You can call cmd.exe with /C [your command line] as the arguments. ...
2008/10/20
[ "https://Stackoverflow.com/questions/220202", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23893/" ]
The subject doesn't say much cause it is not easy to question in one line. I have to execute a few programs which I read from the registry. I have to read from a field where somebody saves the whole paths and arguments. I've been using System.Diagnostics.ProcessStartInfo setting the name of the program and its argum...
I have tackled this the same way as the poster above, using cmd.exe with process start info. ``` Process myProcess = New Process; myProcess.StartInfo.FileName = "cmd.exe"; myProcess.StartInfo.Arguments = "/C " + cmd; myProcess.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; myProcess.StartInfo.CreateNoWindow = True...
220,211
<p>I'm creating a web application for work where the user has to enter the name of the person that requested the job. I'd like to create a simple AJAX auto-suggest dropdown so they don't need to type the entire name. On the backend, the database will provide suggestions based on previous entries. The website is buil...
[ { "answer_id": 220238, "author": "yalestar", "author_id": 2177, "author_profile": "https://Stackoverflow.com/users/2177", "pm_score": 2, "selected": false, "text": "<p>I've had great success with <a href=\"http://www.brandspankingnew.net/archive/2007/02/ajax_auto_suggest_v2.html\" rel=\"...
2008/10/20
[ "https://Stackoverflow.com/questions/220211", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5982/" ]
I'm creating a web application for work where the user has to enter the name of the person that requested the job. I'd like to create a simple AJAX auto-suggest dropdown so they don't need to type the entire name. On the backend, the database will provide suggestions based on previous entries. The website is built usin...
Since you are using CakePHP 1.1 I suggest you check out the Manual portion that deals with [Helpers](http://book.cakephp.org/view/316/Helpers) If you go down to 'AJAX', you can see you can do something like this in your controller: ``` function autocomplete () { $this->set('people', $this->Person->findAll("na...
220,231
<p>How do I access a page's HTTP response headers via JavaScript?</p> <p>Related to <a href="https://stackoverflow.com/questions/220149/how-do-i-access-the-http-request-header-fields-via-javascript"><strong>this question</strong></a>, which was modified to ask about accessing two specific HTTP headers.</p> <blockquot...
[ { "answer_id": 220233, "author": "keparo", "author_id": 19468, "author_profile": "https://Stackoverflow.com/users/19468", "pm_score": 9, "selected": true, "text": "<p>Unfortunately, there isn't an API to give you the HTTP response headers for your initial page request. That was the origi...
2008/10/20
[ "https://Stackoverflow.com/questions/220231", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19468/" ]
How do I access a page's HTTP response headers via JavaScript? Related to [**this question**](https://stackoverflow.com/questions/220149/how-do-i-access-the-http-request-header-fields-via-javascript), which was modified to ask about accessing two specific HTTP headers. > > **Related:** > > [How do I access the HT...
Unfortunately, there isn't an API to give you the HTTP response headers for your initial page request. That was the original question posted here. It has been [repeatedly asked](https://stackoverflow.com/questions/12258705/how-can-i-read-the-current-headers-without-making-a-new-request-with-js), too, because some peopl...
220,234
<p>In the <code>IDisposable.Dispose</code> method is there a way to figure out if an exception is being thrown?</p> <pre><code>using (MyWrapper wrapper = new MyWrapper()) { throw new Exception("Bad error."); } </code></pre> <p>If an exception is thrown in the <code>using</code> statement I want to know about it w...
[ { "answer_id": 220249, "author": "tvanfosson", "author_id": 12950, "author_profile": "https://Stackoverflow.com/users/12950", "pm_score": 1, "selected": false, "text": "<p>Instead of the syntactic sugar of the using statement, why not just implement your own logic for this. Something li...
2008/10/20
[ "https://Stackoverflow.com/questions/220234", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11829/" ]
In the `IDisposable.Dispose` method is there a way to figure out if an exception is being thrown? ``` using (MyWrapper wrapper = new MyWrapper()) { throw new Exception("Bad error."); } ``` If an exception is thrown in the `using` statement I want to know about it when the `IDisposable` object is disposed.
**No**, there is no way to do this in the .Net framework, you cannot figure out the current-exception-which-is-being-thrown in a finally clause. See this [post on my blog](http://samsaffron.com/blog/archive/2007/08/06/16.aspx), for a comparison with a similar pattern in Ruby, it highlights the gaps I think exist with...
220,236
<p>I'm trying to figure out a decent solution (especially from the SEO side) for embedding fonts in web pages. So far I have seen <a href="http://web.archive.org/web/20100208164146/http://www.spoono.com/html/tutorials/tutorial.php?id=19" rel="noreferrer">the W3C solution</a>, which doesn't even work on Firefox, and <a ...
[ { "answer_id": 220257, "author": "olliej", "author_id": 784, "author_profile": "https://Stackoverflow.com/users/784", "pm_score": 2, "selected": false, "text": "<p>And it's unlikely too -- EOT is a fairly restrictive format that is supported only by IE. Both Safari 3.1 and Firefox 3.1 (...
2008/10/20
[ "https://Stackoverflow.com/questions/220236", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8047/" ]
I'm trying to figure out a decent solution (especially from the SEO side) for embedding fonts in web pages. So far I have seen [the W3C solution](http://web.archive.org/web/20100208164146/http://www.spoono.com/html/tutorials/tutorial.php?id=19), which doesn't even work on Firefox, and [this pretty cool solution](http:/...
**Things have changed** since this question was originally asked and answered. There's been a large amount of work done on getting cross-browser font embedding for body text to work using @font-face embedding. Paul Irish put together [Bulletproof @font-face syntax](http://paulirish.com/2009/bulletproof-font-face-imple...
220,243
<p>How can I comment a JSP expression like: <code>&lt;%= map.size() %&gt;</code></p> <p>Is there something like <code>&lt;%= // map.size() %&gt;?</code></p>
[ { "answer_id": 220251, "author": "jim", "author_id": 27628, "author_profile": "https://Stackoverflow.com/users/27628", "pm_score": -1, "selected": false, "text": "<p>One of:</p>\n\n<p>In html</p>\n\n<pre><code>&lt;!-- map.size here because --&gt; \n&lt;%= map.size() %&gt;\n</code></pre>\...
2008/10/20
[ "https://Stackoverflow.com/questions/220243", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14015/" ]
How can I comment a JSP expression like: `<%= map.size() %>` Is there something like `<%= // map.size() %>?`
Pure JSP comments look like this: ``` <%-- Comment --%> ``` So if you want to retain the "`=`".you could do something like: ``` <%--= map.size() --%> ``` The key thing is that `<%=` defines the beginning of an expression, in which you can't leave the body empty, but you could do something like this instead if the...
220,250
<p>I am curious as to why an implicit cast fails in...</p> <pre><code>int? someValue = SomeCondition ? ResultOfSomeCalc() : null; </code></pre> <p>and why I have to perform an explicit cast instead</p> <pre><code>int? someValue = SomeCondition ? ResultofSomeCalc() : (int?)null; </code></pre> <p>It seems to me that ...
[ { "answer_id": 220268, "author": "Brian Liang", "author_id": 5853, "author_profile": "https://Stackoverflow.com/users/5853", "pm_score": 6, "selected": true, "text": "<p>The relevant section of the C# 3.0 spec is 7.13, the conditional operator:</p>\n\n<p>The second and third operands of ...
2008/10/20
[ "https://Stackoverflow.com/questions/220250", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10387/" ]
I am curious as to why an implicit cast fails in... ``` int? someValue = SomeCondition ? ResultOfSomeCalc() : null; ``` and why I have to perform an explicit cast instead ``` int? someValue = SomeCondition ? ResultofSomeCalc() : (int?)null; ``` It seems to me that the compiler has all the information it need to m...
The relevant section of the C# 3.0 spec is 7.13, the conditional operator: The second and third operands of the ?: operator control the type of the conditional expression. Let X and Y be the types of the second and third operands. Then, If X and Y are the same type, then this is the type of the conditional Otherwise,...
220,254
<p>I have been using code similar to this</p> <pre><code>MessageDlg('', mtWarning, [mbOK], 0); </code></pre> <p>throughout my project, (thanks to the GExperts Message Dialog tool :) ) and i was wondering if anyone knows of a way do override the call and show my own custom Form.</p> <p>The only way i can think to do ...
[ { "answer_id": 220270, "author": "Fabio Gomes", "author_id": 727, "author_profile": "https://Stackoverflow.com/users/727", "pm_score": 2, "selected": false, "text": "<p>I would recommend you to encapsulate the MessageDlg inside of you own procedures, this way if you change your procedure...
2008/10/20
[ "https://Stackoverflow.com/questions/220254", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11016/" ]
I have been using code similar to this ``` MessageDlg('', mtWarning, [mbOK], 0); ``` throughout my project, (thanks to the GExperts Message Dialog tool :) ) and i was wondering if anyone knows of a way do override the call and show my own custom Form. The only way i can think to do it its make a New Form with somet...
BTW, you want to add it after the **Dialogs** unit in your uses clause. You have three choices in my opinion: 1. Add your own unit after the *Dialogs* unit that has a method called MessageDlg and has the same signature to create your own form. 2. Or create a whole new method, or set of methods, that creates specific...
220,273
<p>Given a template where the HTML cannot be modified because of other requirements, how is it possible to display (rearrange) a <code>div</code> above another <code>div</code> when they are not in that order in the HTML? Both <code>div</code>s contain data that varies in height and width.</p> <pre><code>&lt;div id="w...
[ { "answer_id": 220321, "author": "Bobby Jack", "author_id": 5058, "author_profile": "https://Stackoverflow.com/users/5058", "pm_score": 2, "selected": false, "text": "<p>Well, with a bit of absolute positioning and some dodgy margin setting, I can get close, but it's not perfect or prett...
2008/10/20
[ "https://Stackoverflow.com/questions/220273", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12368/" ]
Given a template where the HTML cannot be modified because of other requirements, how is it possible to display (rearrange) a `div` above another `div` when they are not in that order in the HTML? Both `div`s contain data that varies in height and width. ``` <div id="wrapper"> <div id="firstDiv"> Content t...
[This solution](http://tanalin.com/en/articles/css-block-order/) uses only CSS and works with variable content ```css #wrapper { display: table; } #firstDiv { display: table-footer-group; } #secondDiv { display: table-header-group; } ```
220,323
<p>I have a class with the following member functions:</p> <pre><code> /// caller pid virtual pid_t Pid() const = 0; /// physical memory size in KB virtual uint64_t Size() const = 0; /// resident memory for this process virtual uint64_t Rss() const = 0; /// cpu used by this process virtual double PercentCpu() c...
[ { "answer_id": 220348, "author": "Mark Bessey", "author_id": 17826, "author_profile": "https://Stackoverflow.com/users/17826", "pm_score": 1, "selected": false, "text": "<p>I think most of these values are available in the Mach API, but it's been a while since I've poked around in there....
2008/10/20
[ "https://Stackoverflow.com/questions/220323", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29810/" ]
I have a class with the following member functions: ``` /// caller pid virtual pid_t Pid() const = 0; /// physical memory size in KB virtual uint64_t Size() const = 0; /// resident memory for this process virtual uint64_t Rss() const = 0; /// cpu used by this process virtual double PercentCpu() const = 0; //...
Process info comes from `pidinfo`: ``` cristi:~ diciu$ grep proc_pidinfo /usr/include/libproc.h int proc_pidinfo(int pid, int flavor, uint64_t arg, void *buffer, int buffersize); ``` cpu load comes from `host_statistics`: ``` cristi:~ diciu$ grep -r host_statistics /usr/include/ /usr/include/mach/host_info.h:/* ...
220,340
<p>I want to be able to check the status of a publication and subscription in SQL Server 2008 T-SQL. I want to be able to determine if its okay, when was the last successful, sync, etc.. Is this possible?</p>
[ { "answer_id": 4036445, "author": "Denaem", "author_id": 331461, "author_profile": "https://Stackoverflow.com/users/331461", "pm_score": 5, "selected": false, "text": "<p>I know this is a little late....</p>\n\n<pre><code>SELECT \n(CASE \n WHEN mdh.runstatus = '1' THEN 'Start - '+ca...
2008/10/20
[ "https://Stackoverflow.com/questions/220340", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17222/" ]
I want to be able to check the status of a publication and subscription in SQL Server 2008 T-SQL. I want to be able to determine if its okay, when was the last successful, sync, etc.. Is this possible?
I know this is a little late.... ``` SELECT (CASE WHEN mdh.runstatus = '1' THEN 'Start - '+cast(mdh.runstatus as varchar) WHEN mdh.runstatus = '2' THEN 'Succeed - '+cast(mdh.runstatus as varchar) WHEN mdh.runstatus = '3' THEN 'InProgress - '+cast(mdh.runstatus as varchar) WHEN mdh.runstatus = '4...
220,347
<p>I've got a somewhat primitive framework I've been using for most of my projects, but a general design issue came to mind that I haven't been able to work out yet. For a given application, should I separate the application-specific class structure from the framework's structure, or is building on top of the framework...
[ { "answer_id": 220359, "author": "Rob Booth", "author_id": 16445, "author_profile": "https://Stackoverflow.com/users/16445", "pm_score": 2, "selected": true, "text": "<p>What it really comes down to is what are you going to do when you update Framework\\Control.php in Application XYZ. A...
2008/10/20
[ "https://Stackoverflow.com/questions/220347", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5291/" ]
I've got a somewhat primitive framework I've been using for most of my projects, but a general design issue came to mind that I haven't been able to work out yet. For a given application, should I separate the application-specific class structure from the framework's structure, or is building on top of the framework no...
What it really comes down to is what are you going to do when you update Framework\Control.php in Application XYZ. Are you going to go back to Application ABC and make that same change? What if it's a critical bug? For maintainability of all of your projects I'd go with your second option.
220,392
<p>This is the exception that I'm getting when I'm trying to bind to a System.Type.Name.</p> <p>Here is what I'm doing:</p> <pre><code>this.propertyTypeBindingSource.DataSource = typeof(System.Type); /* snip */ this.nameTextBox1.DataBindings.Add( new System.Windows.Forms.Binding( "Text", this.p...
[ { "answer_id": 220425, "author": "Evgeny", "author_id": 26447, "author_profile": "https://Stackoverflow.com/users/26447", "pm_score": 3, "selected": true, "text": "<p>Found a workaround. Made a class </p>\n\n<pre><code>public class StubPropertyType\n{\n public StubPropertyType(Type ty...
2008/10/21
[ "https://Stackoverflow.com/questions/220392", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26447/" ]
This is the exception that I'm getting when I'm trying to bind to a System.Type.Name. Here is what I'm doing: ``` this.propertyTypeBindingSource.DataSource = typeof(System.Type); /* snip */ this.nameTextBox1.DataBindings.Add( new System.Windows.Forms.Binding( "Text", this.propertyTypeBindingSou...
Found a workaround. Made a class ``` public class StubPropertyType { public StubPropertyType(Type type) { this.StubPropertyTypeName = type.Name; } public string StubPropertyTypeName = string.Empty; } ``` created a binding source ``` this.propertyStubBindingSource.DataSource = typeof(StubPr...
220,401
<p>I'm trying to create an in-process unit test for my service to client interactions using net.pipe binding. Like a good WCF service it uses FaultContractAttribute on service operations to expose possible faults <em>(wrapped exceptions)</em> to metadata. I would like to have the client and service endpoints configur...
[ { "answer_id": 220472, "author": "sebagomez", "author_id": 23893, "author_profile": "https://Stackoverflow.com/users/23893", "pm_score": 0, "selected": false, "text": "<p>I got that same error a few days ago.<br>\nI solved creating my own class (MyFault) and throwing FaultException from ...
2008/10/21
[ "https://Stackoverflow.com/questions/220401", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14439/" ]
I'm trying to create an in-process unit test for my service to client interactions using net.pipe binding. Like a good WCF service it uses FaultContractAttribute on service operations to expose possible faults *(wrapped exceptions)* to metadata. I would like to have the client and service endpoints configured thru XML ...
If the ValidationException class you describe above is the class you are using for faults, it may be the source of your problem. You should derive your fault exceptions from FaultException because it is Serializable. ApplicationException is not. Wagner is right, you need to decorate your operation definition with a Fa...
220,405
<p>I have a web application that I'm writing (C#, MSSQL) and I need to store the timestamp when a record is stored in the system. Normally, I would just do this with SQL and the DATETIME function. However, the server is located in a different time zone than our company is located... AND we may change to another serve...
[ { "answer_id": 220407, "author": "sebagomez", "author_id": 23893, "author_profile": "https://Stackoverflow.com/users/23893", "pm_score": 3, "selected": false, "text": "<p>Save UTC times in your database and localize those times every time you wanna show them to a user</p>\n" }, { ...
2008/10/21
[ "https://Stackoverflow.com/questions/220405", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20848/" ]
I have a web application that I'm writing (C#, MSSQL) and I need to store the timestamp when a record is stored in the system. Normally, I would just do this with SQL and the DATETIME function. However, the server is located in a different time zone than our company is located... AND we may change to another server in ...
***always store DATETIME data in Universal Time Coordinated (UTC aka GMT)*** * this avoids all timezone issues * this avoids daylight-savings-time issues * this allows simple date math to always work * this allows transactions in different time zones to stay in synch * this allows you to move the data to a different s...
220,432
<p>Say I have an array of strings in a php array called $foo with a few hundred entries, and I have a MySQL table 'people' that has a field named 'name' with a few thousand entries. What is an efficient way to find out which strings in $foo aren't a 'name' in an entry in 'people' without submitting a query for every s...
[ { "answer_id": 220441, "author": "Brent", "author_id": 10680, "author_profile": "https://Stackoverflow.com/users/10680", "pm_score": 1, "selected": false, "text": "<p>I'd put your $foo data in another table and do a LEFT OUTER JOIN with your names table. Otherwise, there aren't a lot of ...
2008/10/21
[ "https://Stackoverflow.com/questions/220432", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10393/" ]
Say I have an array of strings in a php array called $foo with a few hundred entries, and I have a MySQL table 'people' that has a field named 'name' with a few thousand entries. What is an efficient way to find out which strings in $foo aren't a 'name' in an entry in 'people' without submitting a query for every strin...
``` CREATE TEMPORARY TABLE PhpArray (name varchar(50)); -- you can probably do this more efficiently INSERT INTO PhpArray VALUES ($foo[0]), ($foo[1]), ...; SELECT People.* FROM People LEFT OUTER JOIN PhpArray USING (name) WHERE PhpArray.name IS NULL; ```
220,437
<p>According to the <a href="http://ca3.php.net/manual/en/function.get-magic-quotes-gpc.php" rel="noreferrer">PHP manual</a>, in order to make code more portable, they recommend using something like the following for escaping data:</p> <pre><code>if (!get_magic_quotes_gpc()) { $lastname = addslashes($_POST['lastna...
[ { "answer_id": 220449, "author": "sk.", "author_id": 16399, "author_profile": "https://Stackoverflow.com/users/16399", "pm_score": 6, "selected": true, "text": "<p>Magic quotes are inherently broken. They were meant to sanitize input to the PHP script, but without knowing how that input ...
2008/10/21
[ "https://Stackoverflow.com/questions/220437", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13281/" ]
According to the [PHP manual](http://ca3.php.net/manual/en/function.get-magic-quotes-gpc.php), in order to make code more portable, they recommend using something like the following for escaping data: ``` if (!get_magic_quotes_gpc()) { $lastname = addslashes($_POST['lastname']); } else { $lastname = $_POST['la...
Magic quotes are inherently broken. They were meant to sanitize input to the PHP script, but without knowing how that input will be used it's impossible to sanitize correctly. If anything, you're better off checking if magic quotes are enabled, then calling stripslashes() on $\_GET/$\_POST/$\_COOKIES/$\_REQUEST, and th...
220,445
<p>How would I be able to programmatically search and replace some text in a large number of PDF files? I would like to remove a URL that has been added to a set of files. I have been able to remove the link using javascript under Batch Processing in Adobe Pro, but the link text remains. I have seen recommendations ...
[ { "answer_id": 220791, "author": "Chris Dolan", "author_id": 14783, "author_profile": "https://Stackoverflow.com/users/14783", "pm_score": 5, "selected": true, "text": "<p>Finding text in a PDF can be inherently hard because of the graphical nature of the document format -- the letters y...
2008/10/21
[ "https://Stackoverflow.com/questions/220445", "https://Stackoverflow.com", "https://Stackoverflow.com/users/363015/" ]
How would I be able to programmatically search and replace some text in a large number of PDF files? I would like to remove a URL that has been added to a set of files. I have been able to remove the link using javascript under Batch Processing in Adobe Pro, but the link text remains. I have seen recommendations to use...
Finding text in a PDF can be inherently hard because of the graphical nature of the document format -- the letters you are searching for may not be contiguous in the file. That said, [CAM::PDF](http://search.cpan.org/dist/CAM-PDF) has some search-replace capabilities and heuristics. Give [changepagestring.pl](http://se...
220,465
<p>I have an application which I have made a 256 x 256 Windows&nbsp;Vista icon for.</p> <p>I was wondering how I would be able to use a 256x256 PNG file in the ico file used as the application icon and show it in a picture box on a form.</p> <p>I am using VB.NET, but answers in C# are fine. I'm thinking I may have to...
[ { "answer_id": 220474, "author": "TheSoftwareJedi", "author_id": 18941, "author_profile": "https://Stackoverflow.com/users/18941", "pm_score": 2, "selected": false, "text": "<p>Found info <a href=\"http://www.geekpedia.com/tutorial219_Extracting-Icons-from-Files.html\" rel=\"nofollow nor...
2008/10/21
[ "https://Stackoverflow.com/questions/220465", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6335/" ]
I have an application which I have made a 256 x 256 Windows Vista icon for. I was wondering how I would be able to use a 256x256 PNG file in the ico file used as the application icon and show it in a picture box on a form. I am using VB.NET, but answers in C# are fine. I'm thinking I may have to use reflection. I am...
Today, I made a very nice function for **extracting the 256x256 Bitmaps from Vista icons**. Like you, Nathan W, I use it to display the large icon as a Bitmap in "About" box. For example, this code gets Vista icon as PNG image, and displays it in a 256x256 PictureBox: ``` picboxAppLogo.Image = ExtractVistaIcon(myIco...
220,470
<p>This works, but is it the proper way to do it???</p> <p>I have a custom server control that has an [input] box on it. I want it to kinda mimic the ASP.NET TextBox, but not completely. When the textbox is rendered i have a javascript that allows users to select values that are then placed in that input box.</p> <...
[ { "answer_id": 220480, "author": "balaweblog", "author_id": 22162, "author_profile": "https://Stackoverflow.com/users/22162", "pm_score": 0, "selected": false, "text": "<p>If you need to maintain state on postback, you must provide your own methods\nof recording what the user has done wi...
2008/10/21
[ "https://Stackoverflow.com/questions/220470", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26685/" ]
This works, but is it the proper way to do it??? I have a custom server control that has an [input] box on it. I want it to kinda mimic the ASP.NET TextBox, but not completely. When the textbox is rendered i have a javascript that allows users to select values that are then placed in that input box. I have a public t...
I find using IStateManager works the best. For example: ``` partial class MyControl : System.Web.UI.UserControl, IStateManager { [Serializable()] protected struct MyControlState { public bool someValue; public string name; } protected MyControlState state; public bool someVa...
220,488
<p>I have an input which at some points happens to have the focus. If the user click in the "background" of the page, the input loses its focus. I was trying to simulate the click on the background with the following code, but this doesn't work (you will notice that the input still has the focus). Any suggestion on how...
[ { "answer_id": 220491, "author": "Paolo Bergantino", "author_id": 16417, "author_profile": "https://Stackoverflow.com/users/16417", "pm_score": 5, "selected": true, "text": "<p>I would imagine using <code>blur()</code> would do the trick:</p>\n\n<pre><code>&lt;script type=\"text/javascri...
2008/10/21
[ "https://Stackoverflow.com/questions/220488", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5295/" ]
I have an input which at some points happens to have the focus. If the user click in the "background" of the page, the input loses its focus. I was trying to simulate the click on the background with the following code, but this doesn't work (you will notice that the input still has the focus). Any suggestion on how to...
I would imagine using `blur()` would do the trick: ``` <script type="text/javascript"> YAHOO.util.Event.onDOMReady(function() { document.getElementById("input").focus(); document.getElementById("input").blur(); }); </script> ```
220,507
<p>I write a large static method that takes a generic as a parameter argument. I call this method, and the framework throws a System.InvalidProgramException. This exception is thrown even before the first line of the method is executed.</p> <p>I can create a static class which takes the generic argument, and then make...
[ { "answer_id": 220491, "author": "Paolo Bergantino", "author_id": 16417, "author_profile": "https://Stackoverflow.com/users/16417", "pm_score": 5, "selected": true, "text": "<p>I would imagine using <code>blur()</code> would do the trick:</p>\n\n<pre><code>&lt;script type=\"text/javascri...
2008/10/21
[ "https://Stackoverflow.com/questions/220507", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28506/" ]
I write a large static method that takes a generic as a parameter argument. I call this method, and the framework throws a System.InvalidProgramException. This exception is thrown even before the first line of the method is executed. I can create a static class which takes the generic argument, and then make this a me...
I would imagine using `blur()` would do the trick: ``` <script type="text/javascript"> YAHOO.util.Event.onDOMReady(function() { document.getElementById("input").focus(); document.getElementById("input").blur(); }); </script> ```
220,547
<p>Does anyone knows how to detect printable characters in java?</p> <p>After a while ( trial/error ) I get to this method:</p> <pre><code> public boolean isPrintableChar( char c ) { Character.UnicodeBlock block = Character.UnicodeBlock.of( c ); return (!Character.isISOControl(c)) &amp;&amp; ...
[ { "answer_id": 221115, "author": "jb.", "author_id": 7918, "author_profile": "https://Stackoverflow.com/users/7918", "pm_score": 4, "selected": false, "text": "<p>I'm not perfectly sure whether I understand your problem. But if you want detect if character can be drawn to Graphics object...
2008/10/21
[ "https://Stackoverflow.com/questions/220547", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20654/" ]
Does anyone knows how to detect printable characters in java? After a while ( trial/error ) I get to this method: ``` public boolean isPrintableChar( char c ) { Character.UnicodeBlock block = Character.UnicodeBlock.of( c ); return (!Character.isISOControl(c)) && c != KeyEvent.CHAR_...
It seems this was the "Font" independent way. ``` public boolean isPrintableChar( char c ) { Character.UnicodeBlock block = Character.UnicodeBlock.of( c ); return (!Character.isISOControl(c)) && c != KeyEvent.CHAR_UNDEFINED && block != null && block != Character.UnicodeBlock...
220,560
<p>I am changing document template macros. The one thing I can't find out how to do is to customize error messages. For example an error message in a document is</p> <p>"Error! No table of figures entries found"</p> <p>I would like to change this to display something else. Is it possible to do this with Word VBA or V...
[ { "answer_id": 220573, "author": "CtrlDot", "author_id": 19487, "author_profile": "https://Stackoverflow.com/users/19487", "pm_score": 0, "selected": false, "text": "<p>If you want to trap a specific error type in VBA, one method is to use On Error Resume Next then test for an error mess...
2008/10/21
[ "https://Stackoverflow.com/questions/220560", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27294/" ]
I am changing document template macros. The one thing I can't find out how to do is to customize error messages. For example an error message in a document is "Error! No table of figures entries found" I would like to change this to display something else. Is it possible to do this with Word VBA or VBScript?
> > Is it possible to put this in some > kind of global error handler? – Craig > > > It is possible. Here is a very rough example. In a standard module: ``` Sub HandleErr(ErrNo As Long) Select Case ErrNo Case vbObjectError + 1024 MsgBox "No table of figures entries found.", vbOKOnly + vbCritical...
220,603
<p>I'm calling a web service that returns an array of objects in JSON. I want to take those objects and populate a div with HTML. Let's say each object contains a url and a name.</p> <p>If I wanted to generate the following HTML for each object:</p> <pre><code>&lt;div&gt;&lt;img src="the url" /&gt;the name&lt;/div&...
[ { "answer_id": 220619, "author": "savetheclocktower", "author_id": 25720, "author_profile": "https://Stackoverflow.com/users/25720", "pm_score": 3, "selected": false, "text": "<p>Either of the first two options is both common and acceptable.</p>\n\n<p>I'll give examples of each one in <a...
2008/10/21
[ "https://Stackoverflow.com/questions/220603", "https://Stackoverflow.com", "https://Stackoverflow.com/users/67719/" ]
I'm calling a web service that returns an array of objects in JSON. I want to take those objects and populate a div with HTML. Let's say each object contains a url and a name. If I wanted to generate the following HTML for each object: ``` <div><img src="the url" />the name</div> ``` Is there a best practice for th...
Options #1 and #2 are going to be your most immediate straight forward options, however, for both options, you're going to feel the performance and maintenance impact by either building strings or creating DOM objects. Templating isn't all that immature, and you're seeing it popup in most of the major Javascript frame...
220,624
<p>How do I write the getDB() function and use it properly?</p> <p>Here is a code snippet of my App Object:</p> <pre><code>public class MyApp extends UiApplication { private static PersistentObject m_oStore; private static MyBigObjectOfStorage m_oDB; static { store = PersistentStore.getPersisten...
[ { "answer_id": 220724, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "<pre><code>public MyBigObjectOfStorage getDB() {\n Object o = store.getContents();\n if ( o instanceof MyBigObjectOfStor...
2008/10/21
[ "https://Stackoverflow.com/questions/220624", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22917/" ]
How do I write the getDB() function and use it properly? Here is a code snippet of my App Object: ``` public class MyApp extends UiApplication { private static PersistentObject m_oStore; private static MyBigObjectOfStorage m_oDB; static { store = PersistentStore.getPersistentObject(0xa1a56927823...
``` public MyBigObjectOfStorage getDB() { return m_oDB; } ``` As you put it is correct. It will return a *copy of the reference*, which is kind of in between a copy and a reference. The actual object instance returned by getDB() is the same object referenced by m\_oDB. However, you can't change the reference retur...
220,638
<p>How can I best set up my PHP (LAMP) development environment so that I have development, staging and production servers. One-"click" deployment to any of those, as well as one-click rollback to any revision. Rollback should also rollback the database schema and data to how it was when that source code was current.<...
[ { "answer_id": 221958, "author": "Andrew Taylor", "author_id": 1776, "author_profile": "https://Stackoverflow.com/users/1776", "pm_score": 1, "selected": false, "text": "<p>I noticed this wasn't getting much exposure. It's also something I'm interested in. Are you aware of <a href=\"htt...
2008/10/21
[ "https://Stackoverflow.com/questions/220638", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29838/" ]
How can I best set up my PHP (LAMP) development environment so that I have development, staging and production servers. One-"click" deployment to any of those, as well as one-click rollback to any revision. Rollback should also rollback the database schema and data to how it was when that source code was current. Righ...
Our production environment includes the following: * 3 frontends who serve our website * 2 database backends (Master-Slave, replication) * 1 mixed which runs httpd and database for adserving Our development environment is a single server running both database and httpd, configuration-wise we have different workspaces...
220,643
<p>In my app I've got a thread which displays for some time "please wait" dialog window, sometimes it is a very tiny amout of time and there is some glitch while drawing UI (I guess).</p> <p>I get the exception "Thread was being aborted" and completly have no idea how get rid of it. I mean Catch that exception in some...
[ { "answer_id": 220729, "author": "Steven A. Lowe", "author_id": 9345, "author_profile": "https://Stackoverflow.com/users/9345", "pm_score": 1, "selected": false, "text": "<p>use <a href=\"http://www.codeproject.com/KB/threads/SafeThread.aspx\" rel=\"nofollow noreferrer\">SafeThread</a> a...
2008/10/21
[ "https://Stackoverflow.com/questions/220643", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24824/" ]
In my app I've got a thread which displays for some time "please wait" dialog window, sometimes it is a very tiny amout of time and there is some glitch while drawing UI (I guess). I get the exception "Thread was being aborted" and completly have no idea how get rid of it. I mean Catch that exception in some way, or i...
Do **not** use Thread.Abort. This method is reserved for when the .NET runtime needs to forcibly kill threads in order to unload your program. You can only "safely" use this if you're about to unload an AppDomain and want to get rid of threads running in it first. To get rid of a thread, write it in cooperative mode....
220,658
<p>Could someone explain? I understand the basic concepts behind them but I often see them used interchangeably and I get confused. </p> <p>And now that we're here, how do they differ from a regular function?</p>
[ { "answer_id": 220691, "author": "Michael Brown", "author_id": 14359, "author_profile": "https://Stackoverflow.com/users/14359", "pm_score": 6, "selected": false, "text": "<p>Not all closures are lambdas and not all lambdas are closures. Both are functions, but not necessarily in the man...
2008/10/21
[ "https://Stackoverflow.com/questions/220658", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9776/" ]
Could someone explain? I understand the basic concepts behind them but I often see them used interchangeably and I get confused. And now that we're here, how do they differ from a regular function?
A **lambda** is just an anonymous function - a function defined with no name. In some languages, such as Scheme, they are equivalent to named functions. In fact, the function definition is re-written as binding a lambda to a variable internally. In other languages, like Python, there are some (rather needless) distinct...
220,718
<p>I am trying to use <code>set.insert (key)</code> as a conditional, where if the key is inserted correctly (meaning that the key does NOT already exist in the set ) then it should go on and perform some kind of code. For example, something like:</p> <pre><code>if (set.insert( key )) { // some kind of code } </co...
[ { "answer_id": 220721, "author": "Don Neufeld", "author_id": 13097, "author_profile": "https://Stackoverflow.com/users/13097", "pm_score": 2, "selected": false, "text": "<p>set::insert returns a pair, try this:</p>\n\n<pre><code>if( set.insert( key ).second ) {\n // some kind of code\...
2008/10/21
[ "https://Stackoverflow.com/questions/220718", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29326/" ]
I am trying to use `set.insert (key)` as a conditional, where if the key is inserted correctly (meaning that the key does NOT already exist in the set ) then it should go on and perform some kind of code. For example, something like: ``` if (set.insert( key )) { // some kind of code } ``` Is this allowed? Becaus...
The version of insert that takes a single key value should return a `std::pair<iterator,bool>`, where the bool indicates whether an insertion was made. A value of true indicates that the value was inserted, and false indicates that the value was already present. So your conditional would look like this: ``` if( set.in...
220,719
<p>I have an application that detects if there is another instance of the app running and exits if one is found. This part seems to work reliably. My app takes a command-line argument that I would like to pass to the already running instance. I have the following code so far:</p> <h2>Project1.dpr</h2> <pre><code>prog...
[ { "answer_id": 220739, "author": "Eduardo", "author_id": 9823, "author_profile": "https://Stackoverflow.com/users/9823", "pm_score": 1, "selected": false, "text": "<p>Why don't you use DDE?\nTake a look at the links returned by this search: <a href=\"http://www.google.com/search?q=delphi...
2008/10/21
[ "https://Stackoverflow.com/questions/220719", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2189521/" ]
I have an application that detects if there is another instance of the app running and exits if one is found. This part seems to work reliably. My app takes a command-line argument that I would like to pass to the already running instance. I have the following code so far: Project1.dpr ------------ ``` program Projec...
You don't need to create a file mapping if you use WM\_COPYDATA. That's the whole point of WM\_COPYDATA - it does all that for you. To send a string ``` procedure IPCSendMessage(target: HWND; const message: string); var cds: TCopyDataStruct; begin cds.dwData := 0; cds.cbData := Length(message) * SizeOf(Char); ...
220,747
<p>I have three related tables "A(id, val)", "B(id, val)", and a link table with a value "AB(aid, bid, val)"</p> <p>I am querying against B to bring back A values, for example:</p> <pre><code>SELECT A.* FROM A INNER JOIN AB ON A.id = AB.aid INNER JOIN B ON AB.bid = B.id WHERE B.val = 'foo'; </code></pre> <p>Every A...
[ { "answer_id": 220798, "author": "Blorgbeard", "author_id": 369, "author_profile": "https://Stackoverflow.com/users/369", "pm_score": 2, "selected": false, "text": "<p>I think you need to do another join to get ab's max val for each a.id first.</p>\n\n<p>Something like this:</p>\n\n<pre>...
2008/10/21
[ "https://Stackoverflow.com/questions/220747", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have three related tables "A(id, val)", "B(id, val)", and a link table with a value "AB(aid, bid, val)" I am querying against B to bring back A values, for example: ``` SELECT A.* FROM A INNER JOIN AB ON A.id = AB.aid INNER JOIN B ON AB.bid = B.id WHERE B.val = 'foo'; ``` Every A has many B's and every B has man...
I think you need to do another join to get ab's max val for each a.id first. Something like this: ``` select a.* from a left join ( select aid, max(val) as val from ab group by aid ) abmax on abmax.aid=a.id inner join ab on ab.aid=abmax.aid and ab.val=abmax.val inner join b on b.id=ab.bid where b.val='f...
220,751
<p>I have a DataTable that has a boolean column called [Invalid]. I need to divide this data up by this Invalid column - valid rows can be edited, invalid rows cannot. My original plan was to use two BindingSources and set the Filter property ([Invalid] = 'false', for instance), which plays right into my hands because ...
[ { "answer_id": 220798, "author": "Blorgbeard", "author_id": 369, "author_profile": "https://Stackoverflow.com/users/369", "pm_score": 2, "selected": false, "text": "<p>I think you need to do another join to get ab's max val for each a.id first.</p>\n\n<p>Something like this:</p>\n\n<pre>...
2008/10/21
[ "https://Stackoverflow.com/questions/220751", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5133/" ]
I have a DataTable that has a boolean column called [Invalid]. I need to divide this data up by this Invalid column - valid rows can be edited, invalid rows cannot. My original plan was to use two BindingSources and set the Filter property ([Invalid] = 'false', for instance), which plays right into my hands because I h...
I think you need to do another join to get ab's max val for each a.id first. Something like this: ``` select a.* from a left join ( select aid, max(val) as val from ab group by aid ) abmax on abmax.aid=a.id inner join ab on ab.aid=abmax.aid and ab.val=abmax.val inner join b on b.id=ab.bid where b.val='f...
220,767
<p>How exactly do you make an auto-refreshing <code>div</code> with JavaScript (specifically, jQuery)?</p> <p>I know about the <code>setTimeout</code> method, but is it really a good practice ? Is there a better method?</p> <pre><code>function update() { $.get("response.php", function(data) { $("#some_div...
[ { "answer_id": 220774, "author": "John Sheehan", "author_id": 1786, "author_profile": "https://Stackoverflow.com/users/1786", "pm_score": 2, "selected": false, "text": "<p><a href=\"http://plugins.jquery.com/project/Timer\" rel=\"nofollow noreferrer\">There's a jQuery Timer plugin</a> yo...
2008/10/21
[ "https://Stackoverflow.com/questions/220767", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26721/" ]
How exactly do you make an auto-refreshing `div` with JavaScript (specifically, jQuery)? I know about the `setTimeout` method, but is it really a good practice ? Is there a better method? ``` function update() { $.get("response.php", function(data) { $("#some_div").html(data); }); window.setTimeou...
Another modification: ``` function update() { $.get("response.php", function(data) { $("#some_div").html(data); window.setTimeout(update, 10000); }); } ``` The difference with this is that it waits 10 seconds AFTER the ajax call is one. So really the time between refreshes is 10 seconds + length of ajax ...
220,772
<p>Before I explain what I'm trying to do, note that I have the good fortune of only having to target Webkit (meaning, I can use lots of neat CSS).</p> <p>So, basically, I want to have a block with a flexible height, position fixed, maximum height being that of the available window height, with some elements at the to...
[ { "answer_id": 220774, "author": "John Sheehan", "author_id": 1786, "author_profile": "https://Stackoverflow.com/users/1786", "pm_score": 2, "selected": false, "text": "<p><a href=\"http://plugins.jquery.com/project/Timer\" rel=\"nofollow noreferrer\">There's a jQuery Timer plugin</a> yo...
2008/10/21
[ "https://Stackoverflow.com/questions/220772", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17964/" ]
Before I explain what I'm trying to do, note that I have the good fortune of only having to target Webkit (meaning, I can use lots of neat CSS). So, basically, I want to have a block with a flexible height, position fixed, maximum height being that of the available window height, with some elements at the top and bott...
Another modification: ``` function update() { $.get("response.php", function(data) { $("#some_div").html(data); window.setTimeout(update, 10000); }); } ``` The difference with this is that it waits 10 seconds AFTER the ajax call is one. So really the time between refreshes is 10 seconds + length of ajax ...
220,777
<p>One of the modules for my app uses functions from a .pyd file. There's an option to exclude dlls (exclude_dlls) but is there one for including them? The build process doesn't seem to be copying the .pyd in my module despite copying the rest of the files (.py). I also need to include a .dll. How do I get py2exe to i...
[ { "answer_id": 220830, "author": "John Millikin", "author_id": 3560, "author_profile": "https://Stackoverflow.com/users/3560", "pm_score": 2, "selected": false, "text": "<p>If they're not being automatically detected, try manually copying them into py2exe's temporary build directory. The...
2008/10/21
[ "https://Stackoverflow.com/questions/220777", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20879/" ]
One of the modules for my app uses functions from a .pyd file. There's an option to exclude dlls (exclude\_dlls) but is there one for including them? The build process doesn't seem to be copying the .pyd in my module despite copying the rest of the files (.py). I also need to include a .dll. How do I get py2exe to incl...
.pyd's and .DLL's are different here, in that a .pyd ought to be automatically found by modulefinder and so included (as long as you have the appropriate "import" statement) without needing to do anything. If one is missed, you do the same thing as if a .py file was missed (they're both just modules): use the "include"...
220,813
<p>I have several branches in TFS (dev, test, stage) and when I merge changes into the test branch I want the automated build and deploy script to find all the updated SQL files and deploy them to the test database.</p> <p>I thought I could do this by finding all the changesets associated with the build since the last...
[ { "answer_id": 229681, "author": "Scott Weinstein", "author_id": 25201, "author_profile": "https://Stackoverflow.com/users/25201", "pm_score": 0, "selected": false, "text": "<p>So I can understand the intuitive appeal of this approach, but I don't think it's the right way to go.</p>\n\n<...
2008/10/21
[ "https://Stackoverflow.com/questions/220813", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6084/" ]
I have several branches in TFS (dev, test, stage) and when I merge changes into the test branch I want the automated build and deploy script to find all the updated SQL files and deploy them to the test database. I thought I could do this by finding all the changesets associated with the build since the last good buil...
Thanks Scott, After a while I found a nice way to manage this. Basically I created a task which gets the current changesets associated with the build (point 1 of my question is not an issue) and then loop through them looking for .sql files. Once I have a list of those I can create a change script or execute them ag...
220,818
<p>How can I detect keyboard event in C language without using third party libraries? Should I use signal handling?</p>
[ { "answer_id": 220820, "author": "JesperE", "author_id": 13051, "author_profile": "https://Stackoverflow.com/users/13051", "pm_score": 2, "selected": false, "text": "<p>Standard C does not have any facilities for detecting keyboard events, unfortunately. You have to rely on platform-spec...
2008/10/21
[ "https://Stackoverflow.com/questions/220818", "https://Stackoverflow.com", "https://Stackoverflow.com/users/130278/" ]
How can I detect keyboard event in C language without using third party libraries? Should I use signal handling?
There's not a standard way, but these should get you started. Windows: ``` getch(); ``` Unix: Use this code from W. Richard Stevens' Unix Programming book to set your terminal in raw mode, and then use read(). ``` static struct termios save_termios; static int term_saved; int tty_raw(int fd) { ...
220,822
<p>Strange performance outcome, I have a LINQ to SQL query which uses several let statements to get various info it looks like this</p> <pre><code> public IQueryable&lt;SystemNews&gt; GetSystemNews() { using (var t = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions { Is...
[ { "answer_id": 220840, "author": "Danny Frencham", "author_id": 29830, "author_profile": "https://Stackoverflow.com/users/29830", "pm_score": 1, "selected": false, "text": "<p>Have you used the SQL profiler to check the differences between the SQL being generated by LINQ, and the SQL you...
2008/10/21
[ "https://Stackoverflow.com/questions/220822", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22093/" ]
Strange performance outcome, I have a LINQ to SQL query which uses several let statements to get various info it looks like this ``` public IQueryable<SystemNews> GetSystemNews() { using (var t = new TransactionScope(TransactionScopeOption.Required, new TransactionOptions { IsolationLevel = Syste...
In general, LINQ-to-SQL will be "about the same", and I'd agree that caching is porbably an issue here. Really you need to look at the generated SQL; the easiest way being: ``` _datacontext.Log = Console.Out; ``` Then try running the TSQL directly in Query Analyzer. SPROCs have some advantages in terms of being able...
220,828
<p>I have an application running on multiple IIS servers that need to parse a CSV file that is placed on a common network drive. If I use the <a href="http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.created.aspx" rel="nofollow noreferrer">System.IO.FileSystemWatcher Created event</a> to be notified...
[ { "answer_id": 220957, "author": "Tomalak", "author_id": 18771, "author_profile": "https://Stackoverflow.com/users/18771", "pm_score": 3, "selected": true, "text": "<p>Key question is: Does something bad happen when all of them try and parse the file at roughly the same time? Multiple re...
2008/10/21
[ "https://Stackoverflow.com/questions/220828", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4555/" ]
I have an application running on multiple IIS servers that need to parse a CSV file that is placed on a common network drive. If I use the [System.IO.FileSystemWatcher Created event](http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.created.aspx) to be notified of the event when the file is available,...
Key question is: Does something bad happen when all of them try and parse the file at roughly the same time? Multiple read access is basically allowed on the file system level, so this fact alone would not necessarily break anything. I would probably try the method of creating a lock file on first file access and make...
220,832
<p>If I have the string <code>.....ZZ..ZZ.....</code> or <code>.Z.1.Z.23Z.4.Z55</code>,</p> <p>Is there an easy way of shifting all <code>Z</code>characters in the string one space right of the current position?</p> <p>Some additional test strings are:</p> <ul> <li><code>.Z</code></li> <li><code>Z.</code></li> <li><...
[ { "answer_id": 220837, "author": "John Millikin", "author_id": 3560, "author_profile": "https://Stackoverflow.com/users/3560", "pm_score": 4, "selected": true, "text": "<p>Just iterate through the text and swap characters:</p>\n\n<pre><code>int main ()\n{\n char text[] = \"...Z.Z.Z......
2008/10/21
[ "https://Stackoverflow.com/questions/220832", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29326/" ]
If I have the string `.....ZZ..ZZ.....` or `.Z.1.Z.23Z.4.Z55`, Is there an easy way of shifting all `Z`characters in the string one space right of the current position? Some additional test strings are: * `.Z` * `Z.` * `ZZ.` * `.ZZ` * `Z` * `ZZ` * `ZZZ` I think a few of the higher voted answers to this question (in...
Just iterate through the text and swap characters: ``` int main () { char text[] = "...Z.Z.Z...", temp; int text_len = strlen (text), i; for (i = text_len - 1; i >= 0; i--) { if (text[i] == 'Z') { temp = text[i+1]; text[i+1] = text[i]; tex...
220,855
<p>By default gcc/g++ prints a warning message with the line number only. I am looking for the option by which g++ or gcc associates the build warning messages with the warning ids, so that the warning messages can be identified easily (without parsing). Also can there be any more option to get a more detailed warning ...
[ { "answer_id": 220868, "author": "Jonathan Leffler", "author_id": 15168, "author_profile": "https://Stackoverflow.com/users/15168", "pm_score": 1, "selected": false, "text": "<p>AFAIK, there is no such option - the messages are self-identifying.</p>\n" }, { "answer_id": 220909, ...
2008/10/21
[ "https://Stackoverflow.com/questions/220855", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29857/" ]
By default gcc/g++ prints a warning message with the line number only. I am looking for the option by which g++ or gcc associates the build warning messages with the warning ids, so that the warning messages can be identified easily (without parsing). Also can there be any more option to get a more detailed warning mes...
In GCC 4.x there is an option "-fdiagnostics-show-option" which displays the option used to switch off the warning: ``` $ gcc -fdiagnostics-show-option foo.c -Wall -o foo foo.c: In function ‘main’: foo.c:3: warning: unused variable ‘x’ [-Wunused-variable] foo.c:4: warning: control reaches end of non-void function ```...
220,867
<p>What is the best way to deal with XML documents, XSD etc in C# 2.0? </p> <p>Which classes to use etc. What are the best practices of parsing and making XML documents etc. </p> <p>EDIT: .Net 3.5 suggestions are also welcome.</p>
[ { "answer_id": 220877, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 5, "selected": false, "text": "<p>It depends on the size; for small to mid size xml, a DOM such as <a href=\"http://msdn.microsoft.com/en-us/library...
2008/10/21
[ "https://Stackoverflow.com/questions/220867", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1688440/" ]
What is the best way to deal with XML documents, XSD etc in C# 2.0? Which classes to use etc. What are the best practices of parsing and making XML documents etc. EDIT: .Net 3.5 suggestions are also welcome.
The primary means of reading and writing in C# 2.0 is done through the **XmlDocument** class. You can load most of your settings directly into the XmlDocument through the XmlReader it accepts. ### Loading XML Directly ``` XmlDocument document = new XmlDocument(); document.LoadXml("<People><Person Name='Nick' /><Perso...
220,872
<p>Just wondering if anyone has seen any usable progress bar for C# .net apps. My app takes about 20-60 secs to load and I would love to show users a progress bar while they wait. I saw <a href="http://www.codeproject.com/KB/aspnet/ASPNETAJAXPageLoader.aspx" rel="nofollow noreferrer">this one</a> but the sample site ...
[ { "answer_id": 220903, "author": "Søren Pedersen", "author_id": 379419, "author_profile": "https://Stackoverflow.com/users/379419", "pm_score": 1, "selected": false, "text": "<p>I would look into this blog post - seems like a good way to do it. I haven't tested it myself...</p>\n\n<p><a ...
2008/10/21
[ "https://Stackoverflow.com/questions/220872", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5234/" ]
Just wondering if anyone has seen any usable progress bar for C# .net apps. My app takes about 20-60 secs to load and I would love to show users a progress bar while they wait. I saw [this one](http://www.codeproject.com/KB/aspnet/ASPNETAJAXPageLoader.aspx) but the sample site doesn't seem to work which doesn't inspire...
You can use the [AJAX UpdateProgress control](http://ajax.net-tutorials.com/controls/updateprogress-control/). ``` <asp:ScriptManager ID="ScriptManager1" runat="server" /> <asp:UpdateProgress runat="server" id="PageUpdateProgress"> <ProgressTemplate> Loading... </ProgressTemplate> ...
220,879
<p>I don't need this, obviously; I'm just curious about what's going on here. Am I missing something simple? Can I rely on this behaviour in all versions of Perl?)</p> <p>Perl v5.8.8:</p> <pre><code>%h = ( 0=&gt;'zero', 1=&gt;'one', 2=&gt;'two' ); while ($k = each %h) { $v = delete $h{$k}; print "deleted $v; ...
[ { "answer_id": 220999, "author": "cjm", "author_id": 8355, "author_profile": "https://Stackoverflow.com/users/8355", "pm_score": 5, "selected": false, "text": "<p>You're calling <code>each</code> in scalar context, so it's not working because of a list return value.</p>\n\n<p>Just like</...
2008/10/21
[ "https://Stackoverflow.com/questions/220879", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I don't need this, obviously; I'm just curious about what's going on here. Am I missing something simple? Can I rely on this behaviour in all versions of Perl?) Perl v5.8.8: ``` %h = ( 0=>'zero', 1=>'one', 2=>'two' ); while ($k = each %h) { $v = delete $h{$k}; print "deleted $v; remaining: @h{0..2}\n"; } ```...
You're calling `each` in scalar context, so it's not working because of a list return value. Just like ``` while ($line = <FILE>) ``` is special-cased to add an implicit `defined`, so is ``` while ($key = each %hash) ``` In 5.8.8, that happens in op.c, lines 3760-3766: ``` case OP_SASSIGN: if (k1->op_type == ...
220,887
<p>In Ruby I have often written a number of small classes, and had a main class organize the little guys to get work done. I do this by writing </p> <pre><code>require "converter.rb" require "screenFixer.rb" . . . </code></pre> <p>at the top of the main class. How do I do this in Java? Is it "import?"</p> <p>Also, c...
[ { "answer_id": 220904, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "<pre><code>\npublic class Example {\n public Example(IConverter converter, IScreenFixer screenFixer) {\n\n }\n}\n\n</code>...
2008/10/21
[ "https://Stackoverflow.com/questions/220887", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29182/" ]
In Ruby I have often written a number of small classes, and had a main class organize the little guys to get work done. I do this by writing ``` require "converter.rb" require "screenFixer.rb" . . . ``` at the top of the main class. How do I do this in Java? Is it "import?" Also, could someone please come up with ...
If you mean that you are going to write some code that will be using another class. Yes you will need to import those classes using an import statement. i.e. ``` package com.boo; import com.foo.Bar; public class StackOverflow { private Bar myBar; } ```
220,891
<p>I have a COM SDK written in C++ and I'd like to create documentation for my product. I understand that most people will probably not use C++ for integration with this COM component, but many will. </p> <p>Which method is best to describe the API, without losing details that a C++ developer would need to know. </p...
[ { "answer_id": 220904, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "<pre><code>\npublic class Example {\n public Example(IConverter converter, IScreenFixer screenFixer) {\n\n }\n}\n\n</code>...
2008/10/21
[ "https://Stackoverflow.com/questions/220891", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3153/" ]
I have a COM SDK written in C++ and I'd like to create documentation for my product. I understand that most people will probably not use C++ for integration with this COM component, but many will. Which method is best to describe the API, without losing details that a C++ developer would need to know.
If you mean that you are going to write some code that will be using another class. Yes you will need to import those classes using an import statement. i.e. ``` package com.boo; import com.foo.Bar; public class StackOverflow { private Bar myBar; } ```
220,902
<p>I'm building a python application from some source code I've found <a href="http://code.google.com/p/enso" rel="nofollow noreferrer">Here</a></p> <p>I've managed to compile and fix some problems by searching the web, but I'm stuck at this point:</p> <p>When running the application this message appears.</p> <p><a ...
[ { "answer_id": 220955, "author": "1800 INFORMATION", "author_id": 3146, "author_profile": "https://Stackoverflow.com/users/3146", "pm_score": 0, "selected": false, "text": "<p>You probably need to install the VC++ runtime redistributables. The links to them are <a href=\"https://stackove...
2008/10/21
[ "https://Stackoverflow.com/questions/220902", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20654/" ]
I'm building a python application from some source code I've found [Here](http://code.google.com/p/enso) I've managed to compile and fix some problems by searching the web, but I'm stuck at this point: When running the application this message appears. [alt text http://img511.imageshack.us/img511/4481/loadfr0.png](h...
I've been able to compile and run Enso by using /LD as a compiler flag. This links dynamically to the MS Visual C++ runtime, and seems to allow you to get away without a manifest. If you're using SCons, see the diff file here: <http://paste2.org/p/69732>
220,966
<p>I have a 2 variable 100x100 data table in excel.</p> <p>I need to have a function that returns all the possible sets of variables that yield a given target value. What I am looking at is some kind of a reursive 2 dimensional lookup function. Can someone point me in the right direction?</p>
[ { "answer_id": 221164, "author": "Fionnuala", "author_id": 2548, "author_profile": "https://Stackoverflow.com/users/2548", "pm_score": 0, "selected": false, "text": "<p>Would the Solver suit?</p>\n\n<p><a href=\"http://office.microsoft.com/en-us/excel/HA011118641033.aspx\" rel=\"nofollow...
2008/10/21
[ "https://Stackoverflow.com/questions/220966", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27795/" ]
I have a 2 variable 100x100 data table in excel. I need to have a function that returns all the possible sets of variables that yield a given target value. What I am looking at is some kind of a reursive 2 dimensional lookup function. Can someone point me in the right direction?
It can be done without VBA, fairly compactly, like so. Suppose your 100x100 table is in B2:CW101, and we put a list of numbers 1 to 100 down the left from A2 to A101, and again 1 to 100 across the top from B1 to CW1 Create a column of cells underneath, starting (say) in B104 ``` B104=MAX(($A$2:$A$101*100+$B$1:$CW$1...
220,975
<p>How to put underline for first letter for access key for ?</p>
[ { "answer_id": 220985, "author": "Tomalak", "author_id": 18771, "author_profile": "https://Stackoverflow.com/users/18771", "pm_score": 0, "selected": false, "text": "<p>Tried the AccessKey attribute?</p>\n\n<pre><code>&lt;asp:button id=\"Button1\" runat=\"server\" Text=\"Print\" AccessKe...
2008/10/21
[ "https://Stackoverflow.com/questions/220975", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29867/" ]
How to put underline for first letter for access key for ?
asp:buttons are output as html "input" tags with a type of "submit". The text displayed on them is output in the "value" attribute of the tag, and so cannot contain any styling or html. If you could get an asp:button to output as an html button then you could try something like: ``` <button id="mybutton" runat="server...
220,982
<p>I have all my entities in a seperate project in my edmx file and I expose them to my client application using a WCF service.</p> <p>That means I don't have to give my client app a direct link to the project that contains the edmx file. That would be bad because it contines the object to query the database with.</p>...
[ { "answer_id": 220992, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 2, "selected": false, "text": "<p>If the WCF service doesn't use it, what would you want it for? A WCF service (itself) is purely for data transport...
2008/10/21
[ "https://Stackoverflow.com/questions/220982", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have all my entities in a seperate project in my edmx file and I expose them to my client application using a WCF service. That means I don't have to give my client app a direct link to the project that contains the edmx file. That would be bad because it contines the object to query the database with. But only the...
If the WCF service doesn't use it, what would you want it for? A WCF service (itself) is purely for data transport - the "mex" approach for metadata doesn't share code, so your MyClass2 would be impotent. If you want, you can use assembly sharing at the client, but I *really* don't recommend this in this case; EF objec...
221,001
<p>I want to convert from char representing a hexadecimal value (in upper or lower case) to byte, like</p> <pre><code>'0'-&gt;0, '1' -&gt; 1, 'A' -&gt; 10, 'a' -&gt; 10, 'f' -&gt; 15 etc... </code></pre> <p>I will be calling this method extremely often, so performance is important. Is there a faster way than to use a...
[ { "answer_id": 221012, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 4, "selected": false, "text": "<p>A hash table would be relatively slow. This is pretty quick:</p>\n\n<pre><code>if (c &gt;= '0' &amp;&amp; c &lt;= '9'...
2008/10/21
[ "https://Stackoverflow.com/questions/221001", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6583/" ]
I want to convert from char representing a hexadecimal value (in upper or lower case) to byte, like ``` '0'->0, '1' -> 1, 'A' -> 10, 'a' -> 10, 'f' -> 15 etc... ``` I will be calling this method extremely often, so performance is important. Is there a faster way than to use a pre-initialized `HashMap<Character,Byte>...
A preinitialised array would be faster than a HashMap. Something like this: ``` int CharValues['f'-'0'+1] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -1, ... -1, 10, 11, 12, ...}; if (c < '0' || c > 'f') { throw new IllegalArgumentException(); } int n = CharValues[c-'0']; if (n < 0) { throw new IllegalArgumentExcept...
221,002
<p>I'm implementing an audit log on a database, so everything has a CreatedAt and a RemovedAt column. Now I want to be able to list all revisions of an object graph but the best way I can think of for this is to use unions. I need to get every unique CreatedAt and RemovedAt id.</p> <p>If I'm getting a list of countrie...
[ { "answer_id": 221114, "author": "Aleris", "author_id": 20417, "author_profile": "https://Stackoverflow.com/users/20417", "pm_score": 1, "selected": false, "text": "<p>An alternative would be to create an audit log that might look like this:</p>\n\n<pre><code>AuditLog table\n EntityNa...
2008/10/21
[ "https://Stackoverflow.com/questions/221002", "https://Stackoverflow.com", "https://Stackoverflow.com/users/407256/" ]
I'm implementing an audit log on a database, so everything has a CreatedAt and a RemovedAt column. Now I want to be able to list all revisions of an object graph but the best way I can think of for this is to use unions. I need to get every unique CreatedAt and RemovedAt id. If I'm getting a list of countries with pro...
You have most likely already implemented your solution, but to address a few issues; I would suggest considering Aleris's solution, or some derivative thereof. - In your tables, you have a "removed at" field -- well, if that field were active (populated), technically the data shouldn't be there -- or perhaps your i...
221,006
<p>So from what little I understand about packaging for Macs, I see that the actual program that launches is the one defined under the CFBundleExecutable key in Info.plist.</p> <pre><code>&lt;key&gt;CFBundleExecutable&lt;/key&gt; &lt;string&gt;JavaApplicationStub&lt;/string&gt; </code></pre> <p>Now, my app doesnt wor...
[ { "answer_id": 221114, "author": "Aleris", "author_id": 20417, "author_profile": "https://Stackoverflow.com/users/20417", "pm_score": 1, "selected": false, "text": "<p>An alternative would be to create an audit log that might look like this:</p>\n\n<pre><code>AuditLog table\n EntityNa...
2008/10/21
[ "https://Stackoverflow.com/questions/221006", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16925/" ]
So from what little I understand about packaging for Macs, I see that the actual program that launches is the one defined under the CFBundleExecutable key in Info.plist. ``` <key>CFBundleExecutable</key> <string>JavaApplicationStub</string> ``` Now, my app doesnt work if /APP/Content/MacOS/JavaApplicationStub is not...
You have most likely already implemented your solution, but to address a few issues; I would suggest considering Aleris's solution, or some derivative thereof. - In your tables, you have a "removed at" field -- well, if that field were active (populated), technically the data shouldn't be there -- or perhaps your i...
221,025
<p>In this sentence:</p> <pre><code>myCommand.ExecuteReader(CommandBehavior.CloseConnection) </code></pre> <p>does it close connection in case of exception?</p>
[ { "answer_id": 221033, "author": "Lasse V. Karlsen", "author_id": 267, "author_profile": "https://Stackoverflow.com/users/267", "pm_score": 3, "selected": true, "text": "<p>There are plenty of ways that the command can go wrong.</p>\n\n<p>Ultimately it is the Close method of the data rea...
2008/10/21
[ "https://Stackoverflow.com/questions/221025", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29600/" ]
In this sentence: ``` myCommand.ExecuteReader(CommandBehavior.CloseConnection) ``` does it close connection in case of exception?
There are plenty of ways that the command can go wrong. Ultimately it is the Close method of the data reader that will close the connection, provided nothing has gone wrong before. If there is an exception that occurs inside ExecuteReader or any of its called methods, before the actual DataReader object is constructe...
221,031
<p>I have a Java service which now will execute in a batch mode. Multi threaded support is added to the service so for every batch request a thread pool will be dedicated to execute the batch. The question is how do I test this? I have functional tests that pass under the threaded version of the service but, somehow, I...
[ { "answer_id": 221057, "author": "Daniel Spiewak", "author_id": 9815, "author_profile": "https://Stackoverflow.com/users/9815", "pm_score": 3, "selected": false, "text": "<p>There really isn't a \"good\" way to do this. The best thing I can suggest would be TestNG, which allows you to a...
2008/10/21
[ "https://Stackoverflow.com/questions/221031", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28501/" ]
I have a Java service which now will execute in a batch mode. Multi threaded support is added to the service so for every batch request a thread pool will be dedicated to execute the batch. The question is how do I test this? I have functional tests that pass under the threaded version of the service but, somehow, I fe...
There really isn't a "good" way to do this. The best thing I can suggest would be TestNG, which allows you to annotate your test methods and cause them to be executed in *n* threads concurrently. For example: ``` @Test(invocationCount=10, threadPool=10) public void testSomethingConcurrently() { ... } ``` My Test...
221,043
<p>I have div containing a list of flash objects. The list is long so I've set the div height to 400 and overflow to auto. </p> <p>This works fine on FF but on IE6 only the first 5 flash objects that are visible work. The rest of the flash objects that are initially outside the viewable area are empty when I scroll do...
[ { "answer_id": 221153, "author": "Jonas Lincoln", "author_id": 17436, "author_profile": "https://Stackoverflow.com/users/17436", "pm_score": 2, "selected": false, "text": "<p>You should probably create a VIEW which limits the records and then apply the proper rights on the view. </p>\n" ...
2008/10/21
[ "https://Stackoverflow.com/questions/221043", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22673/" ]
I have div containing a list of flash objects. The list is long so I've set the div height to 400 and overflow to auto. This works fine on FF but on IE6 only the first 5 flash objects that are visible work. The rest of the flash objects that are initially outside the viewable area are empty when I scroll down. The sw...
You should probably create a VIEW which limits the records and then apply the proper rights on the view.
221,052
<p>Could anyone provide any example of NAnt script for C++ project build automation?</p> <p>Thanks!</p>
[ { "answer_id": 221107, "author": "endian", "author_id": 25462, "author_profile": "https://Stackoverflow.com/users/25462", "pm_score": 0, "selected": false, "text": "<p>If the project is in Visual Studio then you can use the <code>&lt;Solution&gt;</code> task, I think. That's the simples...
2008/10/21
[ "https://Stackoverflow.com/questions/221052", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22996/" ]
Could anyone provide any example of NAnt script for C++ project build automation? Thanks!
If you're talking Microsoft Visual C++ then I think you get the most control by shelling out msbuild.exe from the nant script and passing it your solution file on the command line. This is supported in Visual Studio 2005/.Net Framework 2.0 and above. e.g.: ``` <property name="msbuild.dir" value="C:\WINDOWS\Microsoft.N...
221,063
<p>How can i find out this information?</p> <hr> <p>Ie, </p> <p>I can install boost 1.35 with a command like</p> <pre><code>sudo port install boost </code></pre> <p>only to get boost 1.36 via port i would do something like this? </p> <pre><code>sudo port install boost-1.36 </code></pre> <p>Hope that clears up my...
[ { "answer_id": 221107, "author": "endian", "author_id": 25462, "author_profile": "https://Stackoverflow.com/users/25462", "pm_score": 0, "selected": false, "text": "<p>If the project is in Visual Studio then you can use the <code>&lt;Solution&gt;</code> task, I think. That's the simples...
2008/10/21
[ "https://Stackoverflow.com/questions/221063", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21537/" ]
How can i find out this information? --- Ie, I can install boost 1.35 with a command like ``` sudo port install boost ``` only to get boost 1.36 via port i would do something like this? ``` sudo port install boost-1.36 ``` Hope that clears up my question
If you're talking Microsoft Visual C++ then I think you get the most control by shelling out msbuild.exe from the nant script and passing it your solution file on the command line. This is supported in Visual Studio 2005/.Net Framework 2.0 and above. e.g.: ``` <property name="msbuild.dir" value="C:\WINDOWS\Microsoft.N...
221,079
<p>I'm trying to add a pojo to a collection in another pojo. I'm sure I'm making a really stupid mistake somewhere along the lines but I can't figure out how to solve it.</p> <p>I have a pojo LookupTable which contains a list of Columns:</p> <pre><code>public class LookupTable { private long id; // More propertie...
[ { "answer_id": 221110, "author": "Chris Kimpton", "author_id": 48310, "author_profile": "https://Stackoverflow.com/users/48310", "pm_score": 2, "selected": false, "text": "<p>My guess is that the <code>lookupTableDao.findById</code> call is getting your object in one session, but the <co...
2008/10/21
[ "https://Stackoverflow.com/questions/221079", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26066/" ]
I'm trying to add a pojo to a collection in another pojo. I'm sure I'm making a really stupid mistake somewhere along the lines but I can't figure out how to solve it. I have a pojo LookupTable which contains a list of Columns: ``` public class LookupTable { private long id; // More properties go here... privat...
Turns out I didn't have a transaction at all. I used almost the same transaction configuration in one of my other config files. The pointcut over there was also called "managers", so my advisor here was referencing the pointcut in the other file. *Renaming the pointcut solved my problem.*
221,126
<p>Has anyone managed to get PDFCreator running on an ASP.NET 2.0 website ?</p> <p>On my development machine with Visual Studio webserver, it works just fine after following this procedure :</p> <ul> <li>create a com interop dll with tlbimp</li> <li>reference this dll</li> <li>write some code to use it</li> </ul> <p...
[ { "answer_id": 281122, "author": "Craig Lebakken", "author_id": 33130, "author_profile": "https://Stackoverflow.com/users/33130", "pm_score": 2, "selected": false, "text": "<p>The following Microsoft Knowledgebase article describes the problem and a solution:</p>\n\n<p><a href=\"http://s...
2008/10/21
[ "https://Stackoverflow.com/questions/221126", "https://Stackoverflow.com", "https://Stackoverflow.com/users/971/" ]
Has anyone managed to get PDFCreator running on an ASP.NET 2.0 website ? On my development machine with Visual Studio webserver, it works just fine after following this procedure : * create a com interop dll with tlbimp * reference this dll * write some code to use it However, when I deploy it to our test server, it...
The following Microsoft Knowledgebase article describes the problem and a solution: [COM objects fail to print when called from ASP](http://support.microsoft.com/kb/q184291/)
221,154
<p>The number is bigger than <code>int</code> &amp; <code>long</code> but can be accomodated in <code>Decimal</code>. But the normal <code>ToString</code> or <code>Convert</code> methods don't work on <code>Decimal</code>.</p>
[ { "answer_id": 221158, "author": "James", "author_id": 5625, "author_profile": "https://Stackoverflow.com/users/5625", "pm_score": 2, "selected": false, "text": "<p>Do it manually!</p>\n\n<p><a href=\"http://www.permadi.com/tutorial/numDecToHex/\" rel=\"nofollow noreferrer\">http://www.p...
2008/10/21
[ "https://Stackoverflow.com/questions/221154", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
The number is bigger than `int` & `long` but can be accomodated in `Decimal`. But the normal `ToString` or `Convert` methods don't work on `Decimal`.
I believe this will produce the right results where it returns anything, but may reject valid integers. I dare say that can be worked around with a bit of effort though... (Oh, and it will also fail for negative numbers at the moment.) ``` static string ConvertToHex(decimal d) { int[] bits = decimal.GetBits(d); ...
221,160
<p><code>termios.h</code> defines:</p> <pre><code>#define TIOCM_OUT1 0x2000 #define TIOCM_OUT2 0x4000 </code></pre> <p>But what are the flags good for?</p>
[ { "answer_id": 221158, "author": "James", "author_id": 5625, "author_profile": "https://Stackoverflow.com/users/5625", "pm_score": 2, "selected": false, "text": "<p>Do it manually!</p>\n\n<p><a href=\"http://www.permadi.com/tutorial/numDecToHex/\" rel=\"nofollow noreferrer\">http://www.p...
2008/10/21
[ "https://Stackoverflow.com/questions/221160", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
`termios.h` defines: ``` #define TIOCM_OUT1 0x2000 #define TIOCM_OUT2 0x4000 ``` But what are the flags good for?
I believe this will produce the right results where it returns anything, but may reject valid integers. I dare say that can be worked around with a bit of effort though... (Oh, and it will also fail for negative numbers at the moment.) ``` static string ConvertToHex(decimal d) { int[] bits = decimal.GetBits(d); ...
221,165
<p>I'm building a database that will store information on a range of objects (such as scientific papers, specimens, DNA sequences, etc.) that all have a presence online and can be identified by a URL, or an identifier such as a <a href="http://www.doi.org/" rel="noreferrer" title="DOI">DOI</a>. Using these GUIDs as the...
[ { "answer_id": 221173, "author": "MysticSlayer", "author_id": 28139, "author_profile": "https://Stackoverflow.com/users/28139", "pm_score": 0, "selected": false, "text": "<p>Maybe this document is something you want to read:</p>\n\n<p><a href=\"http://www.hpl.hp.com/techreports/2002/HPL-...
2008/10/21
[ "https://Stackoverflow.com/questions/221165", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9684/" ]
I'm building a database that will store information on a range of objects (such as scientific papers, specimens, DNA sequences, etc.) that all have a presence online and can be identified by a URL, or an identifier such as a [DOI](http://www.doi.org/ "DOI"). Using these GUIDs as the primary key for the object seems a r...
It's perfectly fine. Accidental collision of MD5 is impossible in all practical scenarios (to get a 50% chance of collision you'd have to hash 6 *billion* URLs *per second*, every second, for 100 years). It's such an improbable chance that you're trillion times more likely to get your data messed up due to an undet...
221,170
<p>How do I declare a private function in Fortran?</p>
[ { "answer_id": 221175, "author": "unwind", "author_id": 28169, "author_profile": "https://Stackoverflow.com/users/28169", "pm_score": 2, "selected": false, "text": "<p>I've never written a line of FORTRAN, but <a href=\"http://coding.derkeiler.com/Archive/Fortran/comp.lang.fortran/2004-0...
2008/10/21
[ "https://Stackoverflow.com/questions/221170", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3834/" ]
How do I declare a private function in Fortran?
This will only work with a Fortran 90 module. In your module declaration, you can specify the access limits for a list of variables and routines using the "public" and "private" keywords. I usually find it helpful to use the private keyword by itself initially, which specifies that everything within the module is priva...
221,178
<p>In my Spring MVC based applications i use Freemarker and i like it very much, but it's lacking advantages provided by Composite View pattern. </p> <p>I'm thinking of trying to use Tiles2 together with Freemarker - does anyone know where do i find a simple example of SpringMVC together with Tiles2+Freemarker?</p>
[ { "answer_id": 224746, "author": "miceuz", "author_id": 24443, "author_profile": "https://Stackoverflow.com/users/24443", "pm_score": 2, "selected": false, "text": "<p>nevermind, i've solved it. i just had to specify freemarker templates in tiles definitions file</p>\n\n<pre><code>&lt;de...
2008/10/21
[ "https://Stackoverflow.com/questions/221178", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24443/" ]
In my Spring MVC based applications i use Freemarker and i like it very much, but it's lacking advantages provided by Composite View pattern. I'm thinking of trying to use Tiles2 together with Freemarker - does anyone know where do i find a simple example of SpringMVC together with Tiles2+Freemarker?
nevermind, i've solved it. i just had to specify freemarker templates in tiles definitions file ``` <definition name="template" template="/WEB-INF/ftl/main.ftl"> ``` and add freemarker servlet/maping to web.xml ``` <servlet> <servlet-name>freemarker</servlet-name> <servlet-class>freemarker.ext.servlet.Freem...
221,181
<p>How can I access Ethernet statistics from C/C++ code like <strong>netstat -e</strong>?</p> <pre><code>Interface Statistics Received Sent Bytes 21010071 15425579 Unicast packets 95512 94166 Non-unicast packets 12510 ...
[ { "answer_id": 221223, "author": "Ilya Kochetov", "author_id": 15329, "author_profile": "https://Stackoverflow.com/users/15329", "pm_score": 1, "selected": false, "text": "<p>Szia,</p>\n\n<p>from <a href=\"http://en.wikipedia.org/wiki/Netstat\" rel=\"nofollow noreferrer\">http://en.wikip...
2008/10/21
[ "https://Stackoverflow.com/questions/221181", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17617/" ]
How can I access Ethernet statistics from C/C++ code like **netstat -e**? ``` Interface Statistics Received Sent Bytes 21010071 15425579 Unicast packets 95512 94166 Non-unicast packets 12510 7 Discards ...
A good place to start for network statistics would be the [GetIpStatistics](http://msdn.microsoft.com/en-us/library/aa365959(VS.85).aspx) call in the Windows IPHelper functions. There are a couple of other approaches that are possibly more portable:- * SNMP. Requires SNMP to be enabled on the computer, but can obviou...
221,185
<p>How can I compile/run C or C++ code in a Unix console or a Mac terminal?</p>
[ { "answer_id": 221189, "author": "P-A", "author_id": 4975, "author_profile": "https://Stackoverflow.com/users/4975", "pm_score": 3, "selected": false, "text": "<p>Assuming the current directory is not in the path, the syntax is <code>./[name of the program]</code>.</p>\n\n<p>For example ...
2008/10/21
[ "https://Stackoverflow.com/questions/221185", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4975/" ]
How can I compile/run C or C++ code in a Unix console or a Mac terminal?
If it is a simple single-source program, ```none make foo ``` where the source file is *foo.c*, *foo.cpp*, etc., you don’t even need a makefile. Make has enough built-in rules to build your source file into an executable of the same name, minus the extension. Running the executable just built is the same as running...
221,192
<p>I have a page, with some code in js and jQuery and it works very well. But unfortunately, all my site is very very old, and uses frames. So when I loaded my page inside a frame, <code>$(document).ready()</code> doesn't fire up.</p> <p>My frameset looks like:</p> <pre><code>&lt;frameset rows="79,*" frameBorder="1" ...
[ { "answer_id": 221234, "author": "Aleris", "author_id": 20417, "author_profile": "https://Stackoverflow.com/users/20417", "pm_score": -1, "selected": false, "text": "<p>There is no reason for <code>$(document).ready()</code> not to be called.\nBe sure your page contains an include to <co...
2008/10/21
[ "https://Stackoverflow.com/questions/221192", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29880/" ]
I have a page, with some code in js and jQuery and it works very well. But unfortunately, all my site is very very old, and uses frames. So when I loaded my page inside a frame, `$(document).ready()` doesn't fire up. My frameset looks like: ``` <frameset rows="79,*" frameBorder="1" frameSpacing="1" bordercolor="#5996...
I have tried the method mentioned in another comment: ``` $("#frameName").ready(function() { // Write you frame on load javascript code here } ); ``` and it did not work for me. this did: ``` $("#frameName").load( function() { //code goes here } ); ``` Even though the event does not fire as quickly - i...
221,194
<p>I have table employee like, <br> employee ( emp_id int primary key, emp_name varchar(50), mngr_id int)</p> <p>and here mngr_id would either null or contain valid emp_id. This way it form the hierarchy of employees in the organization.</p> <p>In order to traverse the entire hierarchy I had to write the recursive st...
[ { "answer_id": 221205, "author": "Tomalak", "author_id": 18771, "author_profile": "https://Stackoverflow.com/users/18771", "pm_score": 1, "selected": false, "text": "<p>Regarding the last question: There are a few nice options at <a href=\"https://stackoverflow.com/questions/192220/what-...
2008/10/21
[ "https://Stackoverflow.com/questions/221194", "https://Stackoverflow.com", "https://Stackoverflow.com/users/959/" ]
I have table employee like, employee ( emp\_id int primary key, emp\_name varchar(50), mngr\_id int) and here mngr\_id would either null or contain valid emp\_id. This way it form the hierarchy of employees in the organization. In order to traverse the entire hierarchy I had to write the recursive stored procedure. ...
a fairly simple iterative adjacency list db server side solution: <http://pastie.org/1056977> ``` delimiter ; drop procedure if exists employee_hier; delimiter # create procedure employee_hier ( in p_emp_id smallint unsigned ) begin declare p_done tinyint unsigned default(0); declare p_depth smallint unsigned defa...
221,224
<p>Consider the following code snippet</p> <pre><code>private void ProcessFile(string fullPath) { XmlTextReader rdr = new XmlTextReader("file:\\\\" + fullPath); while (rdr.Read()) { //Do something } return; } </code></pre> <p>Now, this functions fine when passed a path like:</p> <p>"C:\Work F...
[ { "answer_id": 221243, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 3, "selected": true, "text": "<p>Try omitting the <code>file:///</code> protocol prefix. It works for me without one. I believe .NET will truncate a...
2008/10/21
[ "https://Stackoverflow.com/questions/221224", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1389021/" ]
Consider the following code snippet ``` private void ProcessFile(string fullPath) { XmlTextReader rdr = new XmlTextReader("file:\\\\" + fullPath); while (rdr.Read()) { //Do something } return; } ``` Now, this functions fine when passed a path like: "C:\Work Files\Technical Information\Dummy....
Try omitting the `file:///` protocol prefix. It works for me without one. I believe .NET will truncate any part after the `#` if it believes this to be a URL. This is only a guess based on the error message but it seems logical considering that the part after the `#` character isn't processed by the server but rather b...
221,254
<p>In Visual Studio, when you compile foo.idl, MIDL generates the proxy information in foo_p.c.</p> <p>Unfortunately, for Win32 and x64 files, it uses the same filename. For Win32, the file starts with:</p> <pre><code>#if !defined(_M_IA64) &amp;&amp; !defined(_M_AMD64) </code></pre> <p>For x64, the file starts with:...
[ { "answer_id": 221319, "author": "ChrisN", "author_id": 3853, "author_profile": "https://Stackoverflow.com/users/3853", "pm_score": 3, "selected": true, "text": "<p>You could modify the compiler settings for your IDL file to specify a different file name for the output proxy file accordi...
2008/10/21
[ "https://Stackoverflow.com/questions/221254", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8446/" ]
In Visual Studio, when you compile foo.idl, MIDL generates the proxy information in foo\_p.c. Unfortunately, for Win32 and x64 files, it uses the same filename. For Win32, the file starts with: ``` #if !defined(_M_IA64) && !defined(_M_AMD64) ``` For x64, the file starts with: ``` #if defined(_M_AMD64) ``` When y...
You could modify the compiler settings for your IDL file to specify a different file name for the output proxy file according to the target platform. (Select Properties on the IDL file, then Configuration Properties / MIDL / Output). * For Win32 builds, use `foo_p_w32.c` * For x64 builds, use `foo_p_x64.c` Then, in y...
221,267
<p>What is the simplest way of copying symbolic links on the Mac?</p> <p>A python or perl solution would be preferred, but any solution would be a help.</p> <p>I am copying frameworks for an installation package, and need the links to be maintained</p>
[ { "answer_id": 221305, "author": "Florian Bösch", "author_id": 19435, "author_profile": "https://Stackoverflow.com/users/19435", "pm_score": 2, "selected": false, "text": "<p>In python you can use <a href=\"http://docs.python.org/library/os.html#os.readlink\" rel=\"nofollow noreferrer\">...
2008/10/21
[ "https://Stackoverflow.com/questions/221267", "https://Stackoverflow.com", "https://Stackoverflow.com/users/259/" ]
What is the simplest way of copying symbolic links on the Mac? A python or perl solution would be preferred, but any solution would be a help. I am copying frameworks for an installation package, and need the links to be maintained
As David mentioned, OS X is missing the handy -a option that gnu cp has. However, if you use -R to do a recursive copy, then it will copy symlinks by default, so ``` cp -R source destination ``` ought to work.
221,273
<p>I've been given a prototype/mockup of a grid written in html and javascript (via ExtJS) that I now need to implement within an ASP.net web application. Does anyone have any pointers as to how to pass data to the grid (to a GroupingStore, specifically). </p> <p>I'd rather not have a proliferation of web services or ...
[ { "answer_id": 221286, "author": "redsquare", "author_id": 6440, "author_profile": "https://Stackoverflow.com/users/6440", "pm_score": 2, "selected": false, "text": "<p>I believe a service that simply returns json structures for your pages is the best option, nicely abstracted and reusab...
2008/10/21
[ "https://Stackoverflow.com/questions/221273", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7872/" ]
I've been given a prototype/mockup of a grid written in html and javascript (via ExtJS) that I now need to implement within an ASP.net web application. Does anyone have any pointers as to how to pass data to the grid (to a GroupingStore, specifically). I'd rather not have a proliferation of web services or helper pag...
Here's a low tech solution. It doesn't require use of web services or any other additional technologies. **Step 1** Have an ASPX page that takes one paramter, and invoked like this: ``` http://mysite.com/query.aspx?sql=select * from orders where status = 'open' ``` **Step 2** In the code behind, do something like...
221,277
<p>I'm trying to do XHTML DOM parsing with JTidy, and it seems to be rather counterintuitive task. In particular, there's a method to parse HTML:</p> <pre><code>Node Tidy.parse(Reader, Writer) </code></pre> <p>And to get the &lt;body /&gt; of that Node, I assume, I should use</p> <pre><code>Node Node.findBody(TagTab...
[ { "answer_id": 221327, "author": "Jonny Buchanan", "author_id": 6760, "author_profile": "https://Stackoverflow.com/users/6760", "pm_score": 2, "selected": false, "text": "<p>You could use the <code>parseDOM</code> method instead, which would give you a <code>org.w3c.dom.Document</code> b...
2008/10/21
[ "https://Stackoverflow.com/questions/221277", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1764/" ]
I'm trying to do XHTML DOM parsing with JTidy, and it seems to be rather counterintuitive task. In particular, there's a method to parse HTML: ``` Node Tidy.parse(Reader, Writer) ``` And to get the <body /> of that Node, I assume, I should use ``` Node Node.findBody(TagTable) ``` Where should I get an instance of...
I found there's *much* simpler method to extract the body: ``` tidy = new Tidy(); tidy.setXHTML(true); **tidy.setPrintBodyOnly(true);** ``` And then use tidy on the Reader-Writer pair. Simple as it should be.
221,283
<p>I like to keep my shell sessions named with useful titles as I work, this helps me keep track of what I'm using each of the many tabs for.</p> <p>Currently to rename a session I double click its name on the tabbed part of the console - is there any command that I can use to do this from within the shell? It would s...
[ { "answer_id": 221289, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 3, "selected": false, "text": "<p>The article <a href=\"http://www.faqs.org/docs/Linux-mini/Xterm-Title.html\" rel=\"nofollow noreferrer\">How to change...
2008/10/21
[ "https://Stackoverflow.com/questions/221283", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22061/" ]
I like to keep my shell sessions named with useful titles as I work, this helps me keep track of what I'm using each of the many tabs for. Currently to rename a session I double click its name on the tabbed part of the console - is there any command that I can use to do this from within the shell? It would save me a b...
> > Currently to rename a session I double click its name on the tabbed part of the console > > > This sounds like you're using KDE's Konsole. Is this true? If so, in KDE 3: ``` dcop $KONSOLE_DCOP_SESSION renameSession "I am renamed!" ``` In KDE 4, the old DCOP interfaces haven't been ported over to the new D-...
221,294
<p>I want a single number that represents the current date and time, like a <a href="https://en.wikipedia.org/wiki/Unix_time" rel="noreferrer">Unix timestamp</a>.</p>
[ { "answer_id": 221297, "author": "daveb", "author_id": 11858, "author_profile": "https://Stackoverflow.com/users/11858", "pm_score": 13, "selected": true, "text": "<h3>Timestamp in milliseconds</h3>\n<p>To get the number of milliseconds since <a href=\"https://en.wikipedia.org/wiki/Unix_...
2008/10/21
[ "https://Stackoverflow.com/questions/221294", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6068/" ]
I want a single number that represents the current date and time, like a [Unix timestamp](https://en.wikipedia.org/wiki/Unix_time).
### Timestamp in milliseconds To get the number of milliseconds since [Unix epoch](https://en.wikipedia.org/wiki/Unix_time), call [`Date.now`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/now): ``` Date.now() ``` Alternatively, use the unary operator `+` to call [`Date.proto...
221,307
<p>I've been scanning through all the popular js libraries, but I can't find one that has a width function for a DOM element that actually accounts for quirks mode in Internet Explorer. The issue is that padding and borders don't get counted in the the width when quirks mode is engaged. As far as I can tell this happen...
[ { "answer_id": 221405, "author": "Aleris", "author_id": 20417, "author_profile": "https://Stackoverflow.com/users/20417", "pm_score": 1, "selected": false, "text": "<p>The library is probably telling the true. The problem is not that the readings are incorect but that the acutal display ...
2008/10/21
[ "https://Stackoverflow.com/questions/221307", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29899/" ]
I've been scanning through all the popular js libraries, but I can't find one that has a width function for a DOM element that actually accounts for quirks mode in Internet Explorer. The issue is that padding and borders don't get counted in the the width when quirks mode is engaged. As far as I can tell this happens w...
@1 ``` document.compatMode ``` "CSS1Compat" means "*standards mode*" and "BackCompat" means "*quirks mode*". @2 offsetWidth property of a HTML elements gives its width on screen, in pixels. ``` <div id="mydiv" style="width: 250px; padding-left: 1px; border: 2px black solid">hello</div> document.getElementById('m...
221,317
<p>I've created a custom search page with some defined options in my search scope.</p> <p>I have a metadata mapped <code>jobtitle</code>, and added the search option to my custom search.</p> <pre><code>&lt;Property name="JobTitle" ManagedName="title" ProfileURI="urn:schemas-microsoft-com:sharepo...
[ { "answer_id": 223496, "author": "Nat", "author_id": 13813, "author_profile": "https://Stackoverflow.com/users/13813", "pm_score": 0, "selected": false, "text": "<p>Changes to the managed properties will not appear in the search results until the data is re-crawled. I suggest you reset t...
2008/10/21
[ "https://Stackoverflow.com/questions/221317", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28139/" ]
I've created a custom search page with some defined options in my search scope. I have a metadata mapped `jobtitle`, and added the search option to my custom search. ``` <Property name="JobTitle" ManagedName="title" ProfileURI="urn:schemas-microsoft-com:sharepoint:portal:profile:Title"/> ``` I...
It is a little difficult to know exactly what you're problem is since you are using a custom search page. I am assuming you created a new Managed property and mapped it to something. Then you added it to the advanced search webpart via editing the `xsl/xml` (directions [here](http://www.sharepoint-tips.com/2006/07/fou...
221,320
<p>For a file containing the given class, SomeCoolClass, what would be the proper or standard filename?</p> <pre> 1. somecoolclass.rb 2. some_cool_class.rb 3. some-cool-class.rb 4. SomeCoolClass.rb </pre> <p>or some other variation?</p> <p>I noticed in the Ruby stdlib, versions 1, 2 and 3 are used.</p>
[ { "answer_id": 221391, "author": "Daniel Beardsley", "author_id": 13216, "author_profile": "https://Stackoverflow.com/users/13216", "pm_score": 7, "selected": true, "text": "<p>With just <a href=\"http://www.ruby-lang.org\" rel=\"noreferrer\">Ruby</a> (i.e. not Rails), naming is only a c...
2008/10/21
[ "https://Stackoverflow.com/questions/221320", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
For a file containing the given class, SomeCoolClass, what would be the proper or standard filename? ``` 1. somecoolclass.rb 2. some_cool_class.rb 3. some-cool-class.rb 4. SomeCoolClass.rb ``` or some other variation? I noticed in the Ruby stdlib, versions 1, 2 and 3 are used.
With just [Ruby](http://www.ruby-lang.org) (i.e. not Rails), naming is only a convention. In [Rails](http://rubyonrails.org) the [convention](http://itsignals.cascadia.com.au/?p=7) of using underscores is necessary (almost). I think convention #2 `lowercase_and_underscore.rb` is more common and looks pretty good, thou...
221,339
<p><a href="http://github.com/orestis/pysmell/tree/master" rel="noreferrer">PySmell</a> seems like a good starting point.</p> <p>I think it should be possible, PySmell's <code>idehelper.py</code> does a majority of the complex stuff, it should just be a case of giving it the current line, offering up the completions (...
[ { "answer_id": 221609, "author": "mwilliams", "author_id": 23909, "author_profile": "https://Stackoverflow.com/users/23909", "pm_score": 2, "selected": false, "text": "<p>This isn't exactly what you're looking for but it might be able to get you started:</p>\n\n<p><a href=\"http://code.d...
2008/10/21
[ "https://Stackoverflow.com/questions/221339", "https://Stackoverflow.com", "https://Stackoverflow.com/users/745/" ]
[PySmell](http://github.com/orestis/pysmell/tree/master) seems like a good starting point. I think it should be possible, PySmell's `idehelper.py` does a majority of the complex stuff, it should just be a case of giving it the current line, offering up the completions (the bit I am not sure about) and then replacing t...
EDIT: I've actually took your code above and integrated into a command. It will properly show a completion list for you to choose. You can grab it here: <http://github.com/orestis/pysmell/tree/master> (hit download and do python setup.py install). It's rough but it works. - please report any errors on <http://code.goo...
221,345
<p>I am currently writing a system that stores meta data for around 140,000 ish images stored within a legacy image library that are being moved to cloud storage. I am using the following to get the jpg data...</p> <pre><code>System.Drawing.Image image = System.Drawing.Image.FromFile("filePath"); </code></pre> <p>Im ...
[ { "answer_id": 221348, "author": "Ilya Ryzhenkov", "author_id": 18575, "author_profile": "https://Stackoverflow.com/users/18575", "pm_score": 7, "selected": true, "text": "<p>If you get your image directly from file, you can use the following code to get size of original file in bytes. <...
2008/10/21
[ "https://Stackoverflow.com/questions/221345", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12918/" ]
I am currently writing a system that stores meta data for around 140,000 ish images stored within a legacy image library that are being moved to cloud storage. I am using the following to get the jpg data... ``` System.Drawing.Image image = System.Drawing.Image.FromFile("filePath"); ``` Im quite new to image manipul...
If you get your image directly from file, you can use the following code to get size of original file in bytes. ``` var fileLength = new FileInfo(filePath).Length; ``` If you get your image from other source, like getting one bitmap and composing it with other image, like adding watermark you will have to calcula...
221,346
<p>What is the arrow operator (<code>-&gt;</code>) a synonym for?</p>
[ { "answer_id": 221351, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 8, "selected": true, "text": "<p>The following two expressions are equivalent:</p>\n\n<pre><code>a-&gt;b\n\n(*a).b\n</code></pre>\n\n<p>(subject to oper...
2008/10/21
[ "https://Stackoverflow.com/questions/221346", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4975/" ]
What is the arrow operator (`->`) a synonym for?
The following two expressions are equivalent: ``` a->b (*a).b ``` (subject to operator overloading, as Konrad mentions, but that's unusual).
221,365
<p>If I have a folder structure set up like this:</p> <pre><code>~/Projects emacs package1 package1-helpers package2 package2-helpers package2-more-helpers package3 package3-helpers </code></pre> <p>How do I add these folders:</p> <ul> <li>~...
[ { "answer_id": 221449, "author": "Jouni K. Seppänen", "author_id": 26575, "author_profile": "https://Stackoverflow.com/users/26575", "pm_score": 5, "selected": true, "text": "<pre><code>(let ((base \"~/Projects/emacs\"))\n (add-to-list 'load-path base)\n (dolist (f (directory-files bas...
2008/10/21
[ "https://Stackoverflow.com/questions/221365", "https://Stackoverflow.com", "https://Stackoverflow.com/users/712/" ]
If I have a folder structure set up like this: ``` ~/Projects emacs package1 package1-helpers package2 package2-helpers package2-more-helpers package3 package3-helpers ``` How do I add these folders: * ~/Projects/emacs * ~/Projects/emacs/pa...
``` (let ((base "~/Projects/emacs")) (add-to-list 'load-path base) (dolist (f (directory-files base)) (let ((name (concat base "/" f))) (when (and (file-directory-p name) (not (equal f "..")) (not (equal f "."))) (add-to-list 'load-path name))))) ```
221,370
<p>Is there an easy way with LINQ to flatten an XML file?</p> <p>I can see a number of ways with XSLT but wondered what the best option with LINQ would be?</p> <p>I cant put the xml structure up exactly as stackoverflow seems to filter chevron chars. But its something like this </p> <p>nodeA </p> <p>--nodeA1 </p> ...
[ { "answer_id": 221377, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 2, "selected": true, "text": "<p>OK; it depends on the output you want - with XElement you'd need to do a bit of work to remove all the descendent n...
2008/10/21
[ "https://Stackoverflow.com/questions/221370", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23066/" ]
Is there an easy way with LINQ to flatten an XML file? I can see a number of ways with XSLT but wondered what the best option with LINQ would be? I cant put the xml structure up exactly as stackoverflow seems to filter chevron chars. But its something like this nodeA --nodeA1 --nodeA2 NodeB I want to end up...
OK; it depends on the output you want - with XElement you'd need to do a bit of work to remove all the descendent nodes etc. However, it is actually quite simple with XmlDocument: ```cs string xml = @"<xml><nodeA><nodeA1/><nodeA2/></nodeA><NodeB/></xml>"; XmlDocument doc = new XmlDocument(); doc.LoadXml(xml); XmlDoc...
221,376
<p>I need to include a copyright statement at the top of every Python source file I produce:</p> <pre><code># Copyright: © 2008 etc. </code></pre> <p>However, when I then run such a file I get this message:</p> <p>SyntaxError: Non-ASCII character '\xa9' in file MyFile.py on line 3, but no encoding declared; see <a...
[ { "answer_id": 221380, "author": "S.Lott", "author_id": 10661, "author_profile": "https://Stackoverflow.com/users/10661", "pm_score": 6, "selected": true, "text": "<p>The copyright symbol in ASCII is spelled <code>(c)</code> or \"<code>Copyright</code>\".</p>\n\n<p>See circular 61, <a h...
2008/10/21
[ "https://Stackoverflow.com/questions/221376", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11677/" ]
I need to include a copyright statement at the top of every Python source file I produce: ``` # Copyright: © 2008 etc. ``` However, when I then run such a file I get this message: SyntaxError: Non-ASCII character '\xa9' in file MyFile.py on line 3, but no encoding declared; see <http://www.python.org/peps/pep-026...
The copyright symbol in ASCII is spelled `(c)` or "`Copyright`". See circular 61, [Copyright Registration for Computer Programs](http://www.copyright.gov/circs/circ61.pdf). While it's true that the legal formalism (see Circular 1, [Copyright Basics](http://www.copyright.gov/circs/circ01.pdf)) is > > The symbol © ...
221,378
<p>I appreciate that there are now many mechanisms in dotnet to deal with XML in a myriad of ways... </p> <p>Suppose I have a string containing the XML....</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt; &lt;root&gt; &lt;Element1&gt; &lt;Element1_1&gt; SomeData &lt;/Elemen...
[ { "answer_id": 221383, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 4, "selected": true, "text": "<p>Which APIs are you able to use? Can you use .NET 3.5 and LINQ to XML, for instance? If so, <a href=\"http://msdn.micro...
2008/10/21
[ "https://Stackoverflow.com/questions/221378", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11356/" ]
I appreciate that there are now many mechanisms in dotnet to deal with XML in a myriad of ways... Suppose I have a string containing the XML.... ``` <?xml version="1.0" encoding="utf-8" ?> <root> <Element1> <Element1_1> SomeData </Element1_1> </Element1> <Element2> Som...
Which APIs are you able to use? Can you use .NET 3.5 and LINQ to XML, for instance? If so, [XNode.Remove](http://msdn.microsoft.com/en-us/library/system.xml.linq.xnode.remove.aspx) is your friend - just select Element1\_1 (in any of the many ways which are easy with LINQ to XML) and call Remove() on it. Examples of ho...
221,385
<p>Has anyone gotten the jquery plugin <a href="http://www.appelsiini.net/projects/jeditable" rel="nofollow noreferrer">jeditable</a> to run properly in a Rails applications. If so, could you share some hints on how to set it up? I'm having some trouble with creating the "submit-url".</p> <hr> <p>IIRC, you cannot sim...
[ { "answer_id": 259187, "author": "jonnii", "author_id": 4590, "author_profile": "https://Stackoverflow.com/users/4590", "pm_score": 0, "selected": false, "text": "<p>I\"m not sure I entirely understand the problem you're having, but I think you could put something like this in your javas...
2008/10/21
[ "https://Stackoverflow.com/questions/221385", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29909/" ]
Has anyone gotten the jquery plugin [jeditable](http://www.appelsiini.net/projects/jeditable) to run properly in a Rails applications. If so, could you share some hints on how to set it up? I'm having some trouble with creating the "submit-url". --- IIRC, you cannot simply call ruby code from within javascript (pleas...
Excuse me for bringing this up only now, but I just found the time to look into my code again. I think I solved my problem by the following javascript (my application.js within rails): ``` jQuery(document).ready(function($) { $(".edit_textfield").each( function(i) { $(this).editable("update", { type :...
221,386
<p>I would like to trim long sequences of the same value from a binary file in python. A simple way of doing it is simply reading in the file and using re.sub to replace the unwanted sequence. This will of course not work on large binary files. Can it be done in something like numpy?</p>
[ { "answer_id": 221407, "author": "S.Lott", "author_id": 10661, "author_profile": "https://Stackoverflow.com/users/10661", "pm_score": 2, "selected": false, "text": "<p>If two copies fit in memory, then you can easily make a copy. The second copy is the compressed version. Sure, you can...
2008/10/21
[ "https://Stackoverflow.com/questions/221386", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29908/" ]
I would like to trim long sequences of the same value from a binary file in python. A simple way of doing it is simply reading in the file and using re.sub to replace the unwanted sequence. This will of course not work on large binary files. Can it be done in something like numpy?
If you don't have the memory to do `open("big.file").read()`, then numpy wont really help.. It uses the same memory as python variables do (if you have 1GB of RAM, you can only load 1GB of data into numpy) The solution is simple - read the file in chunks.. `f = open("big.file", "rb")`, then do a series of `f.read(500)...
221,387
<p>I need a way to check for Wi-Fi routers/access points on my DS homebrew. I'm using PAlib.</p>
[ { "answer_id": 825415, "author": "PypeBros", "author_id": 15304, "author_profile": "https://Stackoverflow.com/users/15304", "pm_score": 2, "selected": false, "text": "<p>i used the code from ds_wifi_test (which comes with the original dswifi library) when i tried to implement this. Basic...
2008/10/21
[ "https://Stackoverflow.com/questions/221387", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1599/" ]
I need a way to check for Wi-Fi routers/access points on my DS homebrew. I'm using PAlib.
i used the code from ds\_wifi\_test (which comes with the original dswifi library) when i tried to implement this. Basically, access points are scanned internally when you invoke `Wifi_ScanMode()`. You can then have the number of AP identified with `Wifi_GetNumAP()` and retrieve the information for the ith access point...
221,396
<p>Is it possible to call a function from PHP using <code>onsubmit</code> from JavaScript? If so could someone give me an example of how it would be done?</p> <pre><code>function addOrder(){ $con = mysql_connect("localhost", "146687", "password"); if(!$con){ die('Could not connect: ' . mysql_error()) ...
[ { "answer_id": 221406, "author": "Greg", "author_id": 24181, "author_profile": "https://Stackoverflow.com/users/24181", "pm_score": 2, "selected": false, "text": "<p>Sounds like you want <a href=\"http://en.wikipedia.org/wiki/AJAX\" rel=\"nofollow noreferrer\">AJAX</a>.</p>\n\n<p>This is...
2008/10/21
[ "https://Stackoverflow.com/questions/221396", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29912/" ]
Is it possible to call a function from PHP using `onsubmit` from JavaScript? If so could someone give me an example of how it would be done? ``` function addOrder(){ $con = mysql_connect("localhost", "146687", "password"); if(!$con){ die('Could not connect: ' . mysql_error()) } $sql = "INSERT ...
You can not call a PHP function from Javascript... -------------------------------------------------- Javascript is a client language (it's executed on the Web browser, after receiving the web page) while PHP is on the server side (it's executed before the web page is rendered). You have no way to make one call anothe...
221,399
<p>I am using <strong>mysql (5.0.32-Debian_7etch6-log)</strong> and i've got a nightly running bulk load <strong>php (5.2.6)</strong> script <strong>(using Zend_DB (1.5.1)</strong> via PDO) which does the following:</p> <ol> <li>truncating a set of 4 'import' tables</li> <li>bulk inserting data into these 4 'import' t...
[ { "answer_id": 221421, "author": "Greg", "author_id": 24181, "author_profile": "https://Stackoverflow.com/users/24181", "pm_score": 0, "selected": false, "text": "<p>Could some other script be inserting into the database while your import script is running?</p>\n" }, { "answer_id...
2008/10/21
[ "https://Stackoverflow.com/questions/221399", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I am using **mysql (5.0.32-Debian\_7etch6-log)** and i've got a nightly running bulk load **php (5.2.6)** script **(using Zend\_DB (1.5.1)** via PDO) which does the following: 1. truncating a set of 4 'import' tables 2. bulk inserting data into these 4 'import' tables (re-using ids that have previously been in the tab...
Errors like this can occur when a MyISAM table becomes corrupt. Running the repair command on the table in question is usually all that's required to fix it: ``` > repair table mytablename; ``` A better solution is not to use MyISAM for tables where the data is constantly changing - InnoDB is much more bulletproof, ...
221,411
<p>I'm creating window using pure Win32 API (RegisterClass and CreateWindow functions). How can I specify a font for the window instead of system defined one?</p>
[ { "answer_id": 221419, "author": "vividos", "author_id": 23740, "author_profile": "https://Stackoverflow.com/users/23740", "pm_score": 3, "selected": false, "text": "<p>In case you superclass a standard common control that already has its own font handle, use this approach: Just create a...
2008/10/21
[ "https://Stackoverflow.com/questions/221411", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm creating window using pure Win32 API (RegisterClass and CreateWindow functions). How can I specify a font for the window instead of system defined one?
As vividos said just use [CreateFont()/CreateFontIndirect](http://msdn.microsoft.com/en-us/library/ms534214.aspx): ``` HFONT hFont = CreateFont (13, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, ANSI_CHARSET, OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, TEXT("Tahoma")); ...
221,416
<p>I'm using MDaemon as out mail server and the last days I get an error "554 Message does not conform to standards" for emails sent from one of the machines. Any idea what may be causing it? Other machines work fine.</p> <p>More info....this is the log file:</p> <pre> Mon 2008-10-20 16:11:37: Session 7831; child 1; ...
[ { "answer_id": 221571, "author": "ConroyP", "author_id": 2287, "author_profile": "https://Stackoverflow.com/users/2287", "pm_score": 6, "selected": true, "text": "<p>SMTP error 554 is one of the more vague error codes, but is typically caused by the receiving server seeing something in t...
2008/10/21
[ "https://Stackoverflow.com/questions/221416", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24065/" ]
I'm using MDaemon as out mail server and the last days I get an error "554 Message does not conform to standards" for emails sent from one of the machines. Any idea what may be causing it? Other machines work fine. More info....this is the log file: ``` Mon 2008-10-20 16:11:37: Session 7831; child 1; thread 3908 Mon...
SMTP error 554 is one of the more vague error codes, but is typically caused by the receiving server seeing something in the From or To headers that it doesn't like. This can be caused by a spam trap identifying your machine as a relay, or as a machine not trusted to send mail from your domain. We ran into this proble...
221,432
<p>I'm opening a new browser window from my site for some of the members. However, some may later close it, or it might have initially failed to open.</p> <p>Is there a snippet of fairly plain Javascript that can be run on each page to confirm if another browser window is open, and if not, to provide a link to re-open...
[ { "answer_id": 221439, "author": "Greg", "author_id": 24181, "author_profile": "https://Stackoverflow.com/users/24181", "pm_score": 1, "selected": false, "text": "<pre><code>var myWin = window.open(...);\n\nif (myWin.closed)\n{\n myWin = window.open(...);\n}\n</code></pre>\n" }, {...
2008/10/21
[ "https://Stackoverflow.com/questions/221432", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6216/" ]
I'm opening a new browser window from my site for some of the members. However, some may later close it, or it might have initially failed to open. Is there a snippet of fairly plain Javascript that can be run on each page to confirm if another browser window is open, and if not, to provide a link to re-open it? **[c...
This [excellent, comprehensive article](http://www.irt.org/articles/js205/index.htm) *("Almost complete control of pop-up windows")* should answer all your questions about javascript popup windows. *"JavaScript 1.1 also introduced the window **closed** property. Using this property, it is possible to detect if a windo...
221,434
<p>I'm trying to serve dynamically generated xml pages from a web server, and provide a custom, static, xslt from the same web server, that will offload the processing into the client web browser.</p> <p>Until recently, I had this working fine in Firefox 2, 3, IE5, 6 and Chrome. Recently, though, something has changed...
[ { "answer_id": 223998, "author": "ThePants", "author_id": 29260, "author_profile": "https://Stackoverflow.com/users/29260", "pm_score": 0, "selected": false, "text": "<p>try serving it as application/xml instead of text/xml</p>\n" }, { "answer_id": 231522, "author": "ddaa", ...
2008/10/21
[ "https://Stackoverflow.com/questions/221434", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7938/" ]
I'm trying to serve dynamically generated xml pages from a web server, and provide a custom, static, xslt from the same web server, that will offload the processing into the client web browser. Until recently, I had this working fine in Firefox 2, 3, IE5, 6 and Chrome. Recently, though, something has changed, and Fire...
Displaying just the text elements is the behavior you would get out of an empty XSL stylesheet. To me, that suggests that something fishy is going on with your xpath expressions, and that the xsl:template/@match attributes do not match the source document. You do not provide enough information to diagnose further, so...
221,452
<pre><code>Control.TabIndex </code></pre> <p>Only allows me to overide the Tab order of controls in a given container. </p> <p>Is there a way to specify this across all the controls in, for example a UserControl, regardless of the contains used to arrange the controls.</p> <p>Cheers,</p> <p>Jan</p>
[ { "answer_id": 234133, "author": "James Osborn", "author_id": 6686, "author_profile": "https://Stackoverflow.com/users/6686", "pm_score": 1, "selected": false, "text": "<p>I'm not sure that there is a particularly good way of doing what you are asking, but check out <a href=\"http://www....
2008/10/21
[ "https://Stackoverflow.com/questions/221452", "https://Stackoverflow.com", "https://Stackoverflow.com/users/460845/" ]
``` Control.TabIndex ``` Only allows me to overide the Tab order of controls in a given container. Is there a way to specify this across all the controls in, for example a UserControl, regardless of the contains used to arrange the controls. Cheers, Jan
I'm not sure that there is a particularly good way of doing what you are asking, but check out [Changing WPF focus in code](http://www.julmar.com/blog/mark/PermaLink,guid,6e4769e5-a0b3-47b2-a142-6dfefd0c028e.aspx "Changing WPF focus in code"). That uses `KeyboardNavigation.TabNavigation` to set how the various contain...
221,455
<p>My stomach churns when I see this kind of output.</p> <p><a href="http://www.freeimagehosting.net/uploads/e1097a5a10.jpg" rel="nofollow noreferrer">http://www.freeimagehosting.net/uploads/e1097a5a10.jpg</a></p> <p>and this was my command as suggested by <a href="https://stackoverflow.com/questions/75500/best-way-t...
[ { "answer_id": 221504, "author": "danio", "author_id": 12663, "author_profile": "https://Stackoverflow.com/users/12663", "pm_score": 5, "selected": true, "text": "<p>tiffg4 is a black&amp;white output device.\nYou should use tiff24nc or tiff12nc as the output device colour PDFs - see <a ...
2008/10/21
[ "https://Stackoverflow.com/questions/221455", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21537/" ]
My stomach churns when I see this kind of output. <http://www.freeimagehosting.net/uploads/e1097a5a10.jpg> and this was my command as suggested by [Best way to convert pdf files to tiff files](https://stackoverflow.com/questions/75500/best-way-to-convert-pdf-files-to-tiff-files#221341) ``` gswin32c.exe -q -dNOPAUSE ...
tiffg4 is a black&white output device. You should use tiff24nc or tiff12nc as the output device colour PDFs - see [ghostscript output devices](http://pages.cs.wisc.edu/~ghost/doc/AFPL/8.00/Devices.htm#TIFF). These will be uncompressed but you could put the resulting TIFFs through imagemagick or similar to resave as com...
221,467
<p>I'm trying to complete a practice question from a book on generics but the question doesn't make sense to me. Here it goes.</p> <p>Create two classes with identical functionality. Use generics for the first class, and cast the second class to Object types. Create a for loop that uses class and the Object based clas...
[ { "answer_id": 221470, "author": "endian", "author_id": 25462, "author_profile": "https://Stackoverflow.com/users/25462", "pm_score": 4, "selected": true, "text": "<p>I think that the question is asking you to create a collection class, and insert instances of your class into that.</p>\n...
2008/10/21
[ "https://Stackoverflow.com/questions/221467", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17211/" ]
I'm trying to complete a practice question from a book on generics but the question doesn't make sense to me. Here it goes. Create two classes with identical functionality. Use generics for the first class, and cast the second class to Object types. Create a for loop that uses class and the Object based class to deter...
I think that the question is asking you to create a collection class, and insert instances of your class into that. E.g., Generics version: ``` List<Human> myList = new List<Human>(); Human h = new Human(); myList.Add(h); ``` Object version: ``` ArrayList myObjectList = new ArrayList(); Human h = new Human(); my...