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
217,287
<p>I'm a c++ programmer and I'm playing around with java after finding JPA which for a few of my current applications is a god send. I haven't touched java since university and I'm having a problem running out of heap space. I'm using the code below as the main part of a not-very-serious test of jdbc/jpa/lucene but I k...
[ { "answer_id": 217294, "author": "Adam Rosenfield", "author_id": 9530, "author_profile": "https://Stackoverflow.com/users/9530", "pm_score": 2, "selected": false, "text": "<p>I don't see anything obviously out of place. If you're working with a very large database, you could try increas...
2008/10/20
[ "https://Stackoverflow.com/questions/217287", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm a c++ programmer and I'm playing around with java after finding JPA which for a few of my current applications is a god send. I haven't touched java since university and I'm having a problem running out of heap space. I'm using the code below as the main part of a not-very-serious test of jdbc/jpa/lucene but I keep...
I don't see anything obviously out of place. If you're working with a very large database, you could try increasing your heap size by using the `-Xmx n` option in your JVM invocation. This is usually not the best solution - only do with this when you know your working set size is actually bigger than the default heap s...
217,316
<p>I am using pseudo-code here, but this is in JavaScript. With the most efficient algorithm possible I am trying to find the high and low given an array of positive whole numbers. This is what I came up with, but I don't think it is probably best, and was just wondering if anyone has any other suggestions.</p> <pre><...
[ { "answer_id": 217320, "author": "Aaron Maenpaa", "author_id": 2603, "author_profile": "https://Stackoverflow.com/users/2603", "pm_score": -1, "selected": false, "text": "<p>In python:</p>\n\n<pre><code>&gt;&gt;&gt; seq = [1, 2, 3, 4, 5, 6, 7]\n&gt;&gt;&gt; max(seq)\n7\n&gt;&gt;&gt; min(...
2008/10/20
[ "https://Stackoverflow.com/questions/217316", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I am using pseudo-code here, but this is in JavaScript. With the most efficient algorithm possible I am trying to find the high and low given an array of positive whole numbers. This is what I came up with, but I don't think it is probably best, and was just wondering if anyone has any other suggestions. ``` var low =...
initialise the high and low to be the first element. makes a lot more sense than picking an arbitrarily "high" or "low" number. ``` var myArray = [...], low = myArray[0], high = myArray[0] ; // start looping at index 1 for (var i = 1, l = myArray.length; i < l; ++i) { if (myArray[i] > high) { high ...
217,350
<p>I'm building an ASP.Net MVC website. Rather than have everything in one project, I've decided to separate the Web, Model and Controller out into different projects in the same solution, that reference each-other.</p> <p>The referencing goes like this:</p> <blockquote> <p>Web ---[references]---> Controller ---[re...
[ { "answer_id": 217375, "author": "Jon Limjap", "author_id": 372, "author_profile": "https://Stackoverflow.com/users/372", "pm_score": 0, "selected": false, "text": "<p>Are you sure the compiler is set to .NET Framework 3.5? This happened to me when I inadvertently set the compiler to .NE...
2008/10/20
[ "https://Stackoverflow.com/questions/217350", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23341/" ]
I'm building an ASP.Net MVC website. Rather than have everything in one project, I've decided to separate the Web, Model and Controller out into different projects in the same solution, that reference each-other. The referencing goes like this: > > Web ---[references]---> Controller ---[references]---> Model > > >...
Check to make sure that the namespace of your extensions is accessible to our view. You need either this in your view: ``` <%@ Import Namespace="MyRootNamespace.NamespaceForMyHtmlHelperExtensions"%> ``` or this in your web config namespaces section: ``` <add namespace="MyRootNamespace.NamespaceForMyHtmlHelperExtens...
217,353
<p>I've been trying to figure out how to retrieve the text selected by the user in my webbrowser control and have had no luck after digging through msdn and other resources, So I was wondering if there is a way to actually do this. Maybe I simply missed something.</p> <p>I appreciate any help or resources regarding th...
[ { "answer_id": 217419, "author": "Jason Kealey", "author_id": 20893, "author_profile": "https://Stackoverflow.com/users/20893", "pm_score": -1, "selected": false, "text": "<p>I'm assuming you have a WinForms application which includes a control that opens a website. </p>\n\n<p>Check to s...
2008/10/20
[ "https://Stackoverflow.com/questions/217353", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29477/" ]
I've been trying to figure out how to retrieve the text selected by the user in my webbrowser control and have had no luck after digging through msdn and other resources, So I was wondering if there is a way to actually do this. Maybe I simply missed something. I appreciate any help or resources regarding this. Thank...
You need to use the Document.DomDocument property of the WebBrowser control and cast this to the IHtmlDocument2 interface provided in the Microsoft.mshtml interop assembly. This gives you access to the full DOM as is available to Javascript actually running in IE. To do this you first need to add a reference to your p...
217,356
<p>What kind of collection I should use to convert NameValue collection to be bindable to GridView? When doing directly it didn't work.</p> <p><strong>Code in aspx.cs</strong></p> <pre><code> private void BindList(NameValueCollection nvpList) { resultGV.DataSource = list; resultGV.DataBind(); } </code>...
[ { "answer_id": 217361, "author": "tvanfosson", "author_id": 12950, "author_profile": "https://Stackoverflow.com/users/12950", "pm_score": 4, "selected": true, "text": "<p>Can you use Dictionary&lt;string,string&gt; instead of NameValueCollection. Since Dictionary&lt;T,T&gt; implements I...
2008/10/20
[ "https://Stackoverflow.com/questions/217356", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24507/" ]
What kind of collection I should use to convert NameValue collection to be bindable to GridView? When doing directly it didn't work. **Code in aspx.cs** ``` private void BindList(NameValueCollection nvpList) { resultGV.DataSource = list; resultGV.DataBind(); } ``` **Code in aspx** ``` <asp:GridView...
Can you use Dictionary<string,string> instead of NameValueCollection. Since Dictionary<T,T> implements IEnumerable you could use LINQ as so: ``` resultGV.DataSource = from item in nvpDictionary select new { Key = item.Key, Value = item.Value }; resultGV.DataBind(); ``` [EDIT] Actually you may b...
217,357
<p>Is there a way to spawn a new window via javascript in IE7 that hides the statusbar?</p> <p>I've added the intranet app as a trusted site. Not sure what else I can use to try. This is my JS</p> <pre><code>window.open("http:/localhost/start.html", "MyApp", "left=0, top=0, width=" + screen.width + "," + ...
[ { "answer_id": 217387, "author": "Hannes Landeholm", "author_id": 29442, "author_profile": "https://Stackoverflow.com/users/29442", "pm_score": 0, "selected": false, "text": "<p>Your code worked for me, <a href=\"http://img511.imageshack.us/my.php?image=workshq7.png\" rel=\"nofollow nore...
2008/10/20
[ "https://Stackoverflow.com/questions/217357", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17211/" ]
Is there a way to spawn a new window via javascript in IE7 that hides the statusbar? I've added the intranet app as a trusted site. Not sure what else I can use to try. This is my JS ``` window.open("http:/localhost/start.html", "MyApp", "left=0, top=0, width=" + screen.width + "," + "he...
**No.** Microsoft decided that **"in the name of security"** ([IE Blog Link](http://blogs.msdn.com/ie/archive/2006/08/25/719355.aspx)) they would force the status bar to show on popup windows in IE7. (they also force a new minimum width of ~250px instead of the 100px it used to be - this is so they can show the url in ...
217,389
<p>I'm working on a C# program, and right now I have one <code>Form</code> and a couple of classes. I would like to be able to access some of the <code>Form</code> controls (such as a <code>TextBox</code>) from my class. When I try to change the text in the <code>TextBox</code> from my class I get the following error:<...
[ { "answer_id": 217392, "author": "Steven A. Lowe", "author_id": 9345, "author_profile": "https://Stackoverflow.com/users/9345", "pm_score": 3, "selected": false, "text": "<ol>\n<li>you have to have a reference to the form object in order to access its elements</li>\n<li>the elements have...
2008/10/20
[ "https://Stackoverflow.com/questions/217389", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13504/" ]
I'm working on a C# program, and right now I have one `Form` and a couple of classes. I would like to be able to access some of the `Form` controls (such as a `TextBox`) from my class. When I try to change the text in the `TextBox` from my class I get the following error: > > An object reference is required for the n...
You are trying to access the class as opposed to the object. That statement can be confusing to beginners, but you are effectively trying to open your house door by picking up the door on your house plans. If you actually wanted to access the form components directly from a class (which you don't) you would use the va...
217,414
<p>I am a big fan of the Lightbox2 library, and have used it in the past just not on an MVC project. In the past I remember that Lightbox2 was picky about the paths it scripts, css, and images resided in. I remember specifically have to put everything in subdirectories of the page's path, else it wouldn't work.</p> <p...
[ { "answer_id": 217456, "author": "mmacaulay", "author_id": 22152, "author_profile": "https://Stackoverflow.com/users/22152", "pm_score": -1, "selected": false, "text": "<p>Which MVC framework are we talking about here? While I'm not familiar with that particular lightbox library, I'd hig...
2008/10/20
[ "https://Stackoverflow.com/questions/217414", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27860/" ]
I am a big fan of the Lightbox2 library, and have used it in the past just not on an MVC project. In the past I remember that Lightbox2 was picky about the paths it scripts, css, and images resided in. I remember specifically have to put everything in subdirectories of the page's path, else it wouldn't work. In a non-...
I believe Lightbox assumes you have a structure as follows: ``` /images prevlabel.gif nextlabel.gif loading.gif closelabel.gif /css lightbox.css lightbox.js ``` You can just open lightbox.js and find: ``` fileLoadingImage: 'images/loading.gif', fileBottomNavCloseImage: 'images/close...
217,424
<p>I have data in a MySQL database. I am sending the user a URL to get their data out as a CSV file.</p> <p>I have the e-mailing of the link, MySQL query, etc. covered.</p> <p>How can I, when they click the link, have a pop-up to download a CVS with the record from MySQL? </p> <p>I have all the information to get th...
[ { "answer_id": 217432, "author": "Gavin M. Roy", "author_id": 13203, "author_profile": "https://Stackoverflow.com/users/13203", "pm_score": 1, "selected": false, "text": "<p>To have it send it as a CSV and have it give the file name, use header():</p>\n\n<p><a href=\"http://us2.php.net/h...
2008/10/20
[ "https://Stackoverflow.com/questions/217424", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have data in a MySQL database. I am sending the user a URL to get their data out as a CSV file. I have the e-mailing of the link, MySQL query, etc. covered. How can I, when they click the link, have a pop-up to download a CVS with the record from MySQL? I have all the information to get the record already. I just...
Try: ``` header("Content-type: text/csv"); header("Content-Disposition: attachment; filename=file.csv"); header("Pragma: no-cache"); header("Expires: 0"); echo "record1,record2,record3\n"; die; ``` etc Edit: Here's a snippet of code I use to optionally encode CSV fields: ``` function maybeEncodeCSVField($string) ...
217,427
<p><code>mkdir("/people/jason", 0700, TRUE);</code></p> <p>TRUE = Recursive in PHP 5 and the server is running 5.2.5 but I get:</p> <pre><code>Warning: mkdir() expects at most 2 parameters, 3 given in /home/net1003/public_html/admin/_createPage.inc on line 5 </code></pre>
[ { "answer_id": 217444, "author": "Owen", "author_id": 4853, "author_profile": "https://Stackoverflow.com/users/4853", "pm_score": 2, "selected": false, "text": "<p>are you running this particular script through the command line interface instead? it's possible that version of PHP 4, wher...
2008/10/20
[ "https://Stackoverflow.com/questions/217427", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
`mkdir("/people/jason", 0700, TRUE);` TRUE = Recursive in PHP 5 and the server is running 5.2.5 but I get: ``` Warning: mkdir() expects at most 2 parameters, 3 given in /home/net1003/public_html/admin/_createPage.inc on line 5 ```
are you running this particular script through the command line interface instead? it's possible that version of PHP 4, whereas the mod\_php version is 5.
217,463
<p>After reading <a href="https://stackoverflow.com/questions/36127/any-recommended-vc-settings-for-better-pdb-analysis-on-release-builds">this discussion</a> and <a href="https://stackoverflow.com/questions/49224/good-crash-reporting-library-in-c">this discussion</a> about using CrashRpt to generate a crash dump and e...
[ { "answer_id": 217474, "author": "Brian R. Bondy", "author_id": 3153, "author_profile": "https://Stackoverflow.com/users/3153", "pm_score": 3, "selected": true, "text": "<p><strong>What CrashRpt does for emailing:</strong> </p>\n\n<p>The email system simply uses MAPI to send your email. ...
2008/10/20
[ "https://Stackoverflow.com/questions/217463", "https://Stackoverflow.com", "https://Stackoverflow.com/users/191808/" ]
After reading [this discussion](https://stackoverflow.com/questions/36127/any-recommended-vc-settings-for-better-pdb-analysis-on-release-builds) and [this discussion](https://stackoverflow.com/questions/49224/good-crash-reporting-library-in-c) about using CrashRpt to generate a crash dump and email it to the developers...
**What CrashRpt does for emailing:** The email system simply uses MAPI to send your email. Which would try to use your default mail client if you have one, and if it supports MAPI. Take a look at MailMsg.cpp for details. **Personal experience:** In my company's usage of CrashRpt, we modified it a bit though to cal...
217,464
<p>I have a text file of this format: </p> <pre><code>L O A D C A S E 1 O F 2 ... J O I N T D I S P L A C E M E N T S (global) Joint X-dsp Y-dsp Z-dsp X-rot Y-rot Z-rot 1 0.0 0.0 0.0 0.0 0.0 -0....
[ { "answer_id": 217472, "author": "Keith Nicholas", "author_id": 10431, "author_profile": "https://Stackoverflow.com/users/10431", "pm_score": 2, "selected": false, "text": "<p>No.</p>\n\n<p>you could parse it yourself very easily using .NETs string library </p>\n\n<p>eg string.Split</p>...
2008/10/20
[ "https://Stackoverflow.com/questions/217464", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3834/" ]
I have a text file of this format: ``` L O A D C A S E 1 O F 2 ... J O I N T D I S P L A C E M E N T S (global) Joint X-dsp Y-dsp Z-dsp X-rot Y-rot Z-rot 1 0.0 0.0 0.0 0.0 0.0 -0.001712 ...
[Here](http://schotime.net/blog/index.php/2008/03/18/importing-data-files-with-linq/) is a very interesting approach about importing tabulated data using Linq. It's simple and elegant, you only need an Enumerable method that yields the lines from the file: ``` public static IEnumerable<string> ReadLinesFromFile(strin...
217,484
<p>I have developed a VB.NET WCF service that recives and sends back data. When the first client connects it starts the data output that continues also if the client is closed. If a new client connects then a new object is created and the data output starts at the begninning and continues in parallel with the old insta...
[ { "answer_id": 217472, "author": "Keith Nicholas", "author_id": 10431, "author_profile": "https://Stackoverflow.com/users/10431", "pm_score": 2, "selected": false, "text": "<p>No.</p>\n\n<p>you could parse it yourself very easily using .NETs string library </p>\n\n<p>eg string.Split</p>...
2008/10/20
[ "https://Stackoverflow.com/questions/217484", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26754/" ]
I have developed a VB.NET WCF service that recives and sends back data. When the first client connects it starts the data output that continues also if the client is closed. If a new client connects then a new object is created and the data output starts at the begninning and continues in parallel with the old instance...
[Here](http://schotime.net/blog/index.php/2008/03/18/importing-data-files-with-linq/) is a very interesting approach about importing tabulated data using Linq. It's simple and elegant, you only need an Enumerable method that yields the lines from the file: ``` public static IEnumerable<string> ReadLinesFromFile(strin...
217,532
<p>I'm trying to call the OpenThemeData (see msdn <a href="http://msdn.microsoft.com/en-us/library/bb759821%28v=VS.85%29.aspx" rel="noreferrer">OpenThemeData</a>) function but I couldn't determine what are the acceptable Class names to be passed in by the <code>pszClassList</code> parameter.</p> <pre><code>HTHEME Open...
[ { "answer_id": 217584, "author": "Franci Penov", "author_id": 17028, "author_profile": "https://Stackoverflow.com/users/17028", "pm_score": 2, "selected": false, "text": "<p>Class names depend on the theme. For example, as the documentation for <a href=\"http://msdn.microsoft.com/en-us/l...
2008/10/20
[ "https://Stackoverflow.com/questions/217532", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28760/" ]
I'm trying to call the OpenThemeData (see msdn [OpenThemeData](http://msdn.microsoft.com/en-us/library/bb759821%28v=VS.85%29.aspx)) function but I couldn't determine what are the acceptable Class names to be passed in by the `pszClassList` parameter. ``` HTHEME OpenThemeData( HWND hwnd, LPCWSTR pszClassL...
You can look in "AeroStyle.xml" as a previous poster noted, which gives an exact list for Vista/Aero. However, if you want to play safe (and you probably do) the class names should, in general, be Windows class names of Windows common controls. For example, push buttons and check boxes use the class name "Button", the ...
217,549
<p>It is common knowledge that built-in enums in C++ are not typesafe. I was wondering which classes implementing typesafe enums are used out there... I myself use the following "bicycle", but it is somewhat verbose and limited:</p> <p>typesafeenum.h:</p> <pre><code>struct TypesafeEnum { // Construction: public: ...
[ { "answer_id": 217557, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 3, "selected": false, "text": "<p>I don't. Way too much overhead for little benefit. Also, being able to caste enumerations to different data types for seria...
2008/10/20
[ "https://Stackoverflow.com/questions/217549", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22046/" ]
It is common knowledge that built-in enums in C++ are not typesafe. I was wondering which classes implementing typesafe enums are used out there... I myself use the following "bicycle", but it is somewhat verbose and limited: typesafeenum.h: ``` struct TypesafeEnum { // Construction: public: TypesafeEnum(): id (n...
I'm currently playing around with the Boost.Enum proposal from the [Boost Vault](https://github.com/boost-vault/Miscellaneous) (filename `enum_rev4.6.zip`). Although it was never officially submitted for inclusion into Boost, it's useable as-is. (Documentation is lacking but is made up for by clear source code and good...
217,551
<p>My component is handed a long value that I later use as a key into a cache. The key itself is a string representation of the long value as if it were unsigned 64-bit value. That is, when my component is handed -2944827264075010823L, I need to convert that into the string key "15501916809634540793".</p> <p>I have a ...
[ { "answer_id": 217582, "author": "C. K. Young", "author_id": 13, "author_profile": "https://Stackoverflow.com/users/13", "pm_score": 3, "selected": false, "text": "<p>Here's my implementation. I've refactored it to have a function taking a <code>long</code> and returning a string. :-)</p...
2008/10/20
[ "https://Stackoverflow.com/questions/217551", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
My component is handed a long value that I later use as a key into a cache. The key itself is a string representation of the long value as if it were unsigned 64-bit value. That is, when my component is handed -2944827264075010823L, I need to convert that into the string key "15501916809634540793". I have a solution, ...
Here's my implementation. I've refactored it to have a function taking a `long` and returning a string. :-) ``` import java.math.BigInteger; class UInt64Test { public static void main(String[] args) { for (String arg : args) System.out.println(toUnsignedString(Long.parseLong(arg))); } ...
217,555
<p>How fast is <a href="http://php.net/manual/en/function.php-uname.php" rel="nofollow noreferrer">php_uname()</a> say doing <code>php_uname('s n')</code> or <code>php_uname('a')</code>. The reason I ask is because I'd like to use it to determine which server I'm on and therefore the configuration (paths, etc).</p> <p...
[ { "answer_id": 217570, "author": "Adam Pierce", "author_id": 5324, "author_profile": "https://Stackoverflow.com/users/5324", "pm_score": 3, "selected": true, "text": "<p>I just did this:</p>\n\n<pre><code>&lt;?php\n $tstart = microtime(true);\n\n php_uname('a');\n\n print 'it took '. ...
2008/10/20
[ "https://Stackoverflow.com/questions/217555", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5441/" ]
How fast is [php\_uname()](http://php.net/manual/en/function.php-uname.php) say doing `php_uname('s n')` or `php_uname('a')`. The reason I ask is because I'd like to use it to determine which server I'm on and therefore the configuration (paths, etc). This is related to [Is there a PHP function or variable giving the ...
I just did this: ``` <?php $tstart = microtime(true); php_uname('a'); print 'it took '. sprintf("%f",microtime(true) - $tstart) ." seconds\n"; ?> ``` And it produced this: ``` it took 0.000016 seconds ``` That is on a Core2Duo 2.4GHz Debian box. I know it is an empirical test and all but I think that it ...
217,578
<p>I'm trying to create a <em>fast</em> 2D point inside polygon algorithm, for use in hit-testing (e.g. <code>Polygon.contains(p:Point)</code>). Suggestions for effective techniques would be appreciated.</p>
[ { "answer_id": 217588, "author": "shoosh", "author_id": 9611, "author_profile": "https://Stackoverflow.com/users/9611", "pm_score": 3, "selected": false, "text": "<p>The trivial solution would be to divide the polygon to triangles and hit test the triangles as explained <a href=\"http://...
2008/10/20
[ "https://Stackoverflow.com/questions/217578", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11397/" ]
I'm trying to create a *fast* 2D point inside polygon algorithm, for use in hit-testing (e.g. `Polygon.contains(p:Point)`). Suggestions for effective techniques would be appreciated.
For graphics, I'd rather not prefer integers. Many systems use integers for UI painting (pixels are ints after all), but macOS, for example, uses float for everything. macOS only knows points and a point can translate to one pixel, but depending on monitor resolution, it might translate to something else. On retina scr...
217,591
<p>I have several xml files, the names of which are stored in another xml file. </p> <p>I want to use xsl to produce a summary of the combination of the xml files. I remember there was a way to do this with the msxml extensions (I'm using msxml).</p> <p>I know I can get the content of each file using <code>select="do...
[ { "answer_id": 217662, "author": "Tomalak", "author_id": 18771, "author_profile": "https://Stackoverflow.com/users/18771", "pm_score": 0, "selected": false, "text": "<p>Have a look at the <a href=\"http://msdn.microsoft.com/en-us/library/ms256465(VS.85).aspx\" rel=\"nofollow noreferrer\"...
2008/10/20
[ "https://Stackoverflow.com/questions/217591", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24355/" ]
I have several xml files, the names of which are stored in another xml file. I want to use xsl to produce a summary of the combination of the xml files. I remember there was a way to do this with the msxml extensions (I'm using msxml). I know I can get the content of each file using `select="document(filename)"` but...
Here is just a small example of what you **could** do: *file1.xml:* ``` <foo> <bar>Text from file1</bar> </foo> ``` *file2.xml:* ``` <foo> <bar>Text from file2</bar> </foo> ``` *index.xml:* ``` <index> <filename>file1.xml</filename> <filename>file2.xml</filename> ``` *summarize.xsl:* ``` <xsl:stylesheet vers...
217,594
<p>I'm trying to determine the best way of having a PHP script determine which server the script/site is currently running on.</p> <p>At the moment I have a <code>switch()</code> that uses <code>$_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT']</code> to determine which server it's on. It then sets a few paths, ...
[ { "answer_id": 217598, "author": "Adam Pierce", "author_id": 5324, "author_profile": "https://Stackoverflow.com/users/5324", "pm_score": 3, "selected": true, "text": "<p>How about using <strong>$_SERVER['SERVER_ADDR']</strong> and base your identity off the IP address of the server.</p>\...
2008/10/20
[ "https://Stackoverflow.com/questions/217594", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5441/" ]
I'm trying to determine the best way of having a PHP script determine which server the script/site is currently running on. At the moment I have a `switch()` that uses `$_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT']` to determine which server it's on. It then sets a few paths, db connection parameters, SMTP p...
How about using **$\_SERVER['SERVER\_ADDR']** and base your identity off the IP address of the server. UPDATE: In a virtual host situation, you might also like to concatenate the IP with the document root path like so: ``` $id = $_SERVER['SERVER_ADDR'] . $_SERVER['DOCUMENT_ROOT']; ```
217,612
<p>I'm a little confused by some PHP syntax I've come across. Here is an example:</p> <pre><code>$k = $this-&gt;_tbl_key; if( $this-&gt;$k) { $ret = $this-&gt;_db-&gt;updateObject( $this-&gt;_tbl, $this, $this-&gt;_tbl_key, $updateNulls ); } else { $ret = $this-&gt;_db-&gt;insertObject( $this-&gt;_tbl, $this,...
[ { "answer_id": 217616, "author": "John Millikin", "author_id": 3560, "author_profile": "https://Stackoverflow.com/users/3560", "pm_score": 5, "selected": true, "text": "<p>It'll look up whatever the value of \"k\" is, and treat it as a variable name. These two samples are the same:</p>\n...
2008/10/20
[ "https://Stackoverflow.com/questions/217612", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3831/" ]
I'm a little confused by some PHP syntax I've come across. Here is an example: ``` $k = $this->_tbl_key; if( $this->$k) { $ret = $this->_db->updateObject( $this->_tbl, $this, $this->_tbl_key, $updateNulls ); } else { $ret = $this->_db->insertObject( $this->_tbl, $this, $this->_tbl_key ); } ``` My question is...
It'll look up whatever the value of "k" is, and treat it as a variable name. These two samples are the same: ``` echo ($obj->myvar); #### $k = "myvar"; echo ($obj->$k); ```
217,614
<p>In data processing, I frequently need to create a lookup data structure to map one identifier to another. As a concrete example, let's take a structure which holds a 1-to-1 mapping between a country's 2 character code and its full name. In it we would have</p> <pre><code>AD -&gt; Andorra AE -&gt; United Arab Emi...
[ { "answer_id": 217624, "author": "RWendi", "author_id": 15152, "author_profile": "https://Stackoverflow.com/users/15152", "pm_score": 0, "selected": false, "text": "<p>I usually do it this way:</p>\n<p>countryCodeMappingByName</p>\n<p>Or if the mapping is unique, just simply:</p>\n<p>cou...
2008/10/20
[ "https://Stackoverflow.com/questions/217614", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2601671/" ]
In data processing, I frequently need to create a lookup data structure to map one identifier to another. As a concrete example, let's take a structure which holds a 1-to-1 mapping between a country's 2 character code and its full name. In it we would have ``` AD -> Andorra AE -> United Arab Emirates AF -> Afghan...
My vote would be for `codeToName` in this particular case, and I guess that generalizes. That's not to say that it's the name I would have chosen myself in all cases; that depends a lot on scope, further encapsulation, and so on. But it feels like a good name, that should help make your code readable: ``` String count...
217,618
<p>Is there any advantage to using <code>__construct()</code> instead of the class's name for a constructor in PHP?</p> <p>Example (<code>__construct</code>):</p> <pre><code>class Foo { function __construct(){ //do stuff } } </code></pre> <p>Example (named):</p> <pre><code>class Foo { function F...
[ { "answer_id": 217622, "author": "Paolo Bergantino", "author_id": 16417, "author_profile": "https://Stackoverflow.com/users/16417", "pm_score": 4, "selected": false, "text": "<p><code>__construct</code> was introduced in PHP5. It is the way you are supposed to do it now. I am not aware o...
2008/10/20
[ "https://Stackoverflow.com/questions/217618", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29502/" ]
Is there any advantage to using `__construct()` instead of the class's name for a constructor in PHP? Example (`__construct`): ``` class Foo { function __construct(){ //do stuff } } ``` Example (named): ``` class Foo { function Foo(){ //do stuff } } ``` Having the `__construct` me...
I agree with gizmo, the advantage is so you don't have to rename it if you rename your class. DRY. Similarly, if you have a child class you can call ``` parent::__construct() ``` to call the parent constructor. If further down the track you change the class the child class inherits from, you don't have to change t...
217,666
<p>I've written a setup.py script for py2exe, generated an executable for my python GUI application and I have a whole bunch of files in the dist directory, including the app, w9xopen.exe and MSVCR71.dll. When I try to run the application, I get an error message that just says "see the logfile for details". The only pr...
[ { "answer_id": 217670, "author": "Claudiu", "author_id": 15055, "author_profile": "https://Stackoverflow.com/users/15055", "pm_score": 1, "selected": false, "text": "<p>If it literally does everything a <code>List</code> would do, and all the <code>List</code> functions would act on the ...
2008/10/20
[ "https://Stackoverflow.com/questions/217666", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20879/" ]
I've written a setup.py script for py2exe, generated an executable for my python GUI application and I have a whole bunch of files in the dist directory, including the app, w9xopen.exe and MSVCR71.dll. When I try to run the application, I get an error message that just says "see the logfile for details". The only probl...
Contrary to most of the answers here I wouldn't subclass from List in most cases. I found that inheriting from a class to reuse functionality usually causes problems later. I usually just have a property of type List (or IList) that returns a reference to the list. Usually you only need a get property here. You can co...
217,710
<p>What's the best way to format this for readability?</p> <pre><code>if (strpos($file, '.jpg',1) &amp;&amp; file_exists("$thumbsdir/$file") == false || strpos($file, '.gif',1) &amp;&amp; file_exists("$thumbsdir/$file") == false || strpos($file, '.png',1) &amp;&amp; file_exists("$thumbsdir/$file") == false) { create...
[ { "answer_id": 217712, "author": "Fire Lancer", "author_id": 6266, "author_profile": "https://Stackoverflow.com/users/6266", "pm_score": 2, "selected": false, "text": "<pre><code>if ((strpos($file, '.jpg',1) ||\n strpos($file, '.gif',1) ||\n strpos($file, '.png',1))\n &amp;&am...
2008/10/20
[ "https://Stackoverflow.com/questions/217710", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27025/" ]
What's the best way to format this for readability? ``` if (strpos($file, '.jpg',1) && file_exists("$thumbsdir/$file") == false || strpos($file, '.gif',1) && file_exists("$thumbsdir/$file") == false || strpos($file, '.png',1) && file_exists("$thumbsdir/$file") == false) { createThumb("$gallerydir/$file", "$thumbsdir...
I'd extract the "is an image" logic into its own function, which makes the `if` more readable and also allows you to centralize the logic. ``` function is_image($filename) { $image_extensions = array('png', 'gif', 'jpg'); foreach ($image_extensions as $extension) if (strrpos($filename, ".$extension")...
217,713
<p>I have this HTML structure and want to convert it to an accordion.</p> <pre><code>&lt;div class="accor"&gt; &lt;div class="section"&gt; &lt;h3&gt;Sub section&lt;/h3&gt; &lt;p&gt;Sub section text&lt;/p&gt; &lt;/div&gt; &lt;div class="section"&gt; &lt;h3&gt;Sub section&lt;/h3&gt; ...
[ { "answer_id": 217721, "author": "nickf", "author_id": 9021, "author_profile": "https://Stackoverflow.com/users/9021", "pm_score": 2, "selected": true, "text": "<p>Ah, I found the solution.</p>\n\n<p>Using <code>$.each()</code></p>\n\n<pre><code>$headings.each(function(i, el) {\n var ...
2008/10/20
[ "https://Stackoverflow.com/questions/217713", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9021/" ]
I have this HTML structure and want to convert it to an accordion. ``` <div class="accor"> <div class="section"> <h3>Sub section</h3> <p>Sub section text</p> </div> <div class="section"> <h3>Sub section</h3> <p>Sub section text</p> </div> <div class="section"> ...
Ah, I found the solution. Using `$.each()` ``` $headings.each(function(i, el) { var $this = $(el), $p = $this.parent(); $this.insertBefore($p); }); ``` Is there a better solution than this, though? Perhaps just using the vanilla Accordion options?
217,718
<p>I would really like to annotate a method with a reference to a single property in a property file for injection.</p> <pre><code>@Resource("${my.service.url}") private String myServiceUrl; </code></pre> <p>Of course, this syntax does not work ;) Thats why I'm asking here.</p> <p>I am aware that I can inject the fu...
[ { "answer_id": 217778, "author": "Hubert", "author_id": 29525, "author_profile": "https://Stackoverflow.com/users/29525", "pm_score": -1, "selected": false, "text": "<p>You could try injecting value of property \"my.service.url\" to a filed in your bean.</p>\n\n<p>Take a look at: <a href...
2008/10/20
[ "https://Stackoverflow.com/questions/217718", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23691/" ]
I would really like to annotate a method with a reference to a single property in a property file for injection. ``` @Resource("${my.service.url}") private String myServiceUrl; ``` Of course, this syntax does not work ;) Thats why I'm asking here. I am aware that I can inject the full properties file, but that just...
There's a thread about this on the [Spring forum](http://forum.springframework.org/showthread.php?t=50790). The short answer is that there's really no way to inject a single property using annotations. I've heard that the support for using annotations will be improved in Spring 3.0, so it's likely this will be addres...
217,731
<p>I'm in the process of trying to hack together the first bits of a kernel. I currently have the entire kernel compiled down as C code, and I've managed to get it displaying text in the console window and all of that fine goodness. Now, I want to start accepting keyboard input so I can actually make some use of the th...
[ { "answer_id": 217750, "author": "Anders Eurenius", "author_id": 1421, "author_profile": "https://Stackoverflow.com/users/1421", "pm_score": 1, "selected": false, "text": "<p>I've a piece of GeekOS that seems to do</p>\n\n<pre><code>In_Byte(KB_CMD);\n</code></pre>\n\n<p>and then</p>\n\n<...
2008/10/20
[ "https://Stackoverflow.com/questions/217731", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19521/" ]
I'm in the process of trying to hack together the first bits of a kernel. I currently have the entire kernel compiled down as C code, and I've managed to get it displaying text in the console window and all of that fine goodness. Now, I want to start accepting keyboard input so I can actually make some use of the thing...
If you are compiling with gcc, unless you are using the crazy ".code16gcc" trick the linux kernel uses (which I very much doubt), you cannot be in real mode. If you are using the GRUB multiboot specification, GRUB itself is switching to protected mode for you. So, as others pointed out, you will have to talk to the 804...
217,741
<p>I have the following html</p> <pre><code> &lt;div id="menu"&gt; &lt;ul class="horizMenu"&gt; &lt;li id="active"&gt;&lt;a href="#" id="current"&gt;About&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;Archive&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#"&gt;C...
[ { "answer_id": 217744, "author": "Mauro", "author_id": 2208, "author_profile": "https://Stackoverflow.com/users/2208", "pm_score": 2, "selected": false, "text": "<p>Add a width to the list item elements which is bigger than the bolded width of the items, this way they wont be pushed out ...
2008/10/20
[ "https://Stackoverflow.com/questions/217741", "https://Stackoverflow.com", "https://Stackoverflow.com/users/85/" ]
I have the following html ``` <div id="menu"> <ul class="horizMenu"> <li id="active"><a href="#" id="current">About</a></li> <li><a href="#">Archive</a></li> <li><a href="#">Contact</a></li> <li><a href="#">Item four</a></li> <li><a href...
Not sure who -1ed, but Mauro's answer is essentially correct: you can't trivially make an item with automatic width depend on what the width would have been if the font inside weren't bold. However, a 'float: left;' rule will also be necessary as you can't set the width of an inline-display element. And 'em' would pro...
217,761
<p>I would like to know if there is a way to disable automatic loading of child records in nHibernate ( for one:many relationships ).</p> <p>We can easily switch off lazy loading on properties but what I want is to disable any kind of automatic loading ( lazy and non lazy both ). I only want to load data via query ( i...
[ { "answer_id": 217812, "author": "MatthieuGD", "author_id": 3109, "author_profile": "https://Stackoverflow.com/users/3109", "pm_score": -1, "selected": false, "text": "<p>You can have the lazy attribute on the collection. In your example, Department has n employees, if lazy is enabled, t...
2008/10/20
[ "https://Stackoverflow.com/questions/217761", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29443/" ]
I would like to know if there is a way to disable automatic loading of child records in nHibernate ( for one:many relationships ). We can easily switch off lazy loading on properties but what I want is to disable any kind of automatic loading ( lazy and non lazy both ). I only want to load data via query ( i.e. HQL or...
Given your request, you could simply not map from Department to Employees, nor have an Employees property on your department. This would mean you *always* have to make a database hit to find the employees of a database. *Aplogies if these code examples don't work out of the box, I'm not near a compiler at the moment* ...
217,765
<p>I have a query that I use for charting in reporting services that looks something like:</p> <pre> (SELECT Alpha, Beta, Gamma, Delta, Epsilon, Zeta, Eta, Theta, Iota, Kappa, Lambda, Mu,Nu, Xi from tbl WHERE Alpha in (@Alphas) and Beta in (@Betas) and Gamma in (@Gammas) and Delta in (@Deltas) and Epsilon in (@...
[ { "answer_id": 217774, "author": "Vinko Vrsalovic", "author_id": 5190, "author_profile": "https://Stackoverflow.com/users/5190", "pm_score": 1, "selected": false, "text": "<p>I'm not sure what you really want, but if I understood correctly, you can try something like:</p>\n\n<pre><code>(...
2008/10/20
[ "https://Stackoverflow.com/questions/217765", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20879/" ]
I have a query that I use for charting in reporting services that looks something like: ``` (SELECT Alpha, Beta, Gamma, Delta, Epsilon, Zeta, Eta, Theta, Iota, Kappa, Lambda, Mu,Nu, Xi from tbl WHERE Alpha in (@Alphas) and Beta in (@Betas) and Gamma in (@Gammas) and Delta in (@Deltas) and Epsilon in (@Epsilons...
I'm not sure what you really want, but if I understood correctly, you can try something like: ``` (SELECT a,b,c,d FROM k WHERE a in (@a) and b in (@b) and c in (@c)) UNION (SELECT NULL,NULL,NULL,sum(e) FROM k WHERE a in (@a) and b in (@b) and c in (@c) GROUP BY e) ``` NULLs just for being able to perform the union (...
217,769
<p>I am <a href="https://stackoverflow.com/questions/211260/perl-extract-text-then-save&lt;br">searching</a> for HF50(HF$HF) for example in "MyFile.txt" so that the extracted data must save to "save.txt". The data on "save.txt" now extracted again and fill the parameters and output on my table. But when I tried the cod...
[ { "answer_id": 217872, "author": "Corion", "author_id": 11253, "author_profile": "https://Stackoverflow.com/users/11253", "pm_score": 0, "selected": false, "text": "<p>You never close <code>$outfile</code> so it doesn't get flushed. But maybe you want to store the data in an array instea...
2008/10/20
[ "https://Stackoverflow.com/questions/217769", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28607/" ]
I am [searching](https://stackoverflow.com/questions/211260/perl-extract-text-then-save<br) for HF50(HF$HF) for example in "MyFile.txt" so that the extracted data must save to "save.txt". The data on "save.txt" now extracted again and fill the parameters and output on my table. But when I tried the code, I've got no ou...
Are you running this as a CGI script? In that case, you probably don't have permission to open a file for writing. Did you check the error log to see if your message from `die` is in there? You might want to check out [Troubleshooting Perl CGI scripts](http://brian-d-foy.cvs.sourceforge.net/*checkout*/brian-d-foy/CGI_...
217,776
<p>I have a simple page that has some iframe sections (to display RSS links). How can I apply the same CSS format from the main page to the page displayed in the iframe?</p>
[ { "answer_id": 217792, "author": "hangy", "author_id": 11963, "author_profile": "https://Stackoverflow.com/users/11963", "pm_score": 5, "selected": false, "text": "<p>An iframe is universally handled like a different HTML page by most browsers. If you want to apply the same stylesheet to...
2008/10/20
[ "https://Stackoverflow.com/questions/217776", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a simple page that has some iframe sections (to display RSS links). How can I apply the same CSS format from the main page to the page displayed in the iframe?
**Edit:** This does not work cross domain unless the appropriate [CORS header](https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS) is set. There are two different things here: the style of the iframe block and the style of the page embedded in the iframe. You can set the style of the iframe block th...
217,793
<p>Is there a way in Delphi to get the currect application's exe size in one or two lines of code?</p>
[ { "answer_id": 217824, "author": "Daniel Rikowski", "author_id": 23368, "author_profile": "https://Stackoverflow.com/users/23368", "pm_score": 2, "selected": false, "text": "<p>Unfortunatly it is not possible to do that with only one or two lines of code without using some library.</p>\n...
2008/10/20
[ "https://Stackoverflow.com/questions/217793", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3535708/" ]
Is there a way in Delphi to get the currect application's exe size in one or two lines of code?
Just for grins...you can also do this with streams Just slightly more than 2 lines of code. Generally the application filename including path is also stored into Paramstr(0). ``` var fs : tFilestream; begin fs := tFilestream.create(paramstr(0),fmOpenRead or fmShareDenyNone); try result := fs.size; finally ...
217,805
<p>What is the most efficient way to write the old-school:</p> <pre><code>StringBuilder sb = new StringBuilder(); if (strings.Count &gt; 0) { foreach (string s in strings) { sb.Append(s + ", "); } sb.Remove(sb.Length - 2, 2); } return sb.ToString(); </code></pre> <p>...in LINQ?</p>
[ { "answer_id": 122706, "author": "Robert S.", "author_id": 7565, "author_profile": "https://Stackoverflow.com/users/7565", "pm_score": 6, "selected": false, "text": "<p>Have you looked at the Aggregate extension method?</p>\n\n<pre><code>var sa = (new[] { \"yabba\", \"dabba\", \"doo\" })...
2008/10/20
[ "https://Stackoverflow.com/questions/217805", "https://Stackoverflow.com", "https://Stackoverflow.com/users/192/" ]
What is the most efficient way to write the old-school: ``` StringBuilder sb = new StringBuilder(); if (strings.Count > 0) { foreach (string s in strings) { sb.Append(s + ", "); } sb.Remove(sb.Length - 2, 2); } return sb.ToString(); ``` ...in LINQ?
**This answer shows usage of LINQ (`Aggregate`) as requested in the question and is not intended for everyday use. Because this does not use a `StringBuilder` it will have horrible performance for very long sequences. For regular code use `String.Join` as shown in the other [answer](https://stackoverflow.com/a/218419/4...
217,816
<p>I build VBA applications for both Word and Excel, is there any way to access the progress bar that sometimes appears in the Office status bar.</p>
[ { "answer_id": 217840, "author": "Galwegian", "author_id": 3201, "author_profile": "https://Stackoverflow.com/users/3201", "pm_score": 0, "selected": false, "text": "<p>I have not accessed the progress bar, but I have in the past used something like this to place task status text in the ...
2008/10/20
[ "https://Stackoverflow.com/questions/217816", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2665/" ]
I build VBA applications for both Word and Excel, is there any way to access the progress bar that sometimes appears in the Office status bar.
The following will simulate a progress bar in Excel's status bar: ``` Public Sub UpdateStatusBar(percent As Double, Optional Message As String = "") Const maxBars As Long = 20 Const before As String = "[" Const after As String = "]" Dim bar As String Dim notBar As String Dim numBars As Long ...
217,829
<p>A page executes a number of tasks and takes a long time to process. We want to give the user feedback as each task is completed. </p> <p>In ASP.NET webforms we used <code>Response.Flush()</code></p> <p>What way would you a approach this in ASP.NET MVC?</p>
[ { "answer_id": 217867, "author": "mohammedn", "author_id": 29268, "author_profile": "https://Stackoverflow.com/users/29268", "pm_score": 1, "selected": false, "text": "<p>You can make it in client side. In each step, you set some session variable with the current step. Then, You make ano...
2008/10/20
[ "https://Stackoverflow.com/questions/217829", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23393/" ]
A page executes a number of tasks and takes a long time to process. We want to give the user feedback as each task is completed. In ASP.NET webforms we used `Response.Flush()` What way would you a approach this in ASP.NET MVC?
You can still use Response.Write() and Response.Flush() for whatever status you want to send down the wire. Or if you have your progress thingy in a user-control, you could do something like: ``` this.PartialView("Progress").ExecuteResult(this.ControllerContext); this.Response.Flush(); ``` from your controller while...
217,831
<p>Could someone explain to me how Any-related annotations (<code>@Any</code>, <code>@AnyMetaDef</code>, <code>@AnyMetaDefs</code> and <code>@ManyToAny</code>) work in practice. I have a hard time finding any useful documentation (JavaDoc alone isn't very helpful) about these.</p> <p>I have thus far gathered that they...
[ { "answer_id": 217847, "author": "Martin Klinke", "author_id": 1793, "author_profile": "https://Stackoverflow.com/users/1793", "pm_score": 2, "selected": false, "text": "<p>Have you read <a href=\"http://docs.jboss.org/hibernate/orm/5.2/userguide/html_single/Hibernate_User_Guide.html#map...
2008/10/20
[ "https://Stackoverflow.com/questions/217831", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2238/" ]
Could someone explain to me how Any-related annotations (`@Any`, `@AnyMetaDef`, `@AnyMetaDefs` and `@ManyToAny`) work in practice. I have a hard time finding any useful documentation (JavaDoc alone isn't very helpful) about these. I have thus far gathered that they somehow enable referencing to abstract and extended c...
Hope this [article](http://www.jroller.com/eyallupu/entry/hibernate_the_any_annotation) brings some light to the subject: > > Sometimes we need to map an > association property to different > types of entities that don't have a > common ancestor entity - so a plain > polymorphic association doesn't do the > work...
217,834
<p>In history-books you often have timeline, where events and periods are marked on a line in the correct relative distance to each other. How is it possible to create something similar in LaTeX?</p>
[ { "answer_id": 219266, "author": "Zoe Gagnon", "author_id": 26929, "author_profile": "https://Stackoverflow.com/users/26929", "pm_score": 7, "selected": true, "text": "<p>The <a href=\"http://ctan.org/pkg/pgf\" rel=\"noreferrer\">tikz</a> package seems to have what you want.</p>\n\n<pre>...
2008/10/20
[ "https://Stackoverflow.com/questions/217834", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21005/" ]
In history-books you often have timeline, where events and periods are marked on a line in the correct relative distance to each other. How is it possible to create something similar in LaTeX?
The [tikz](http://ctan.org/pkg/pgf) package seems to have what you want. ``` \documentclass{article} \usepackage{tikz} \usetikzlibrary{snakes} \begin{document} \begin{tikzpicture}[snake=zigzag, line before snake = 5mm, line after snake = 5mm] % draw horizontal line \draw (0,0) -- (2,0); \draw[snake]...
217,841
<p>I have a .NET web-service client that has been autogenerated from a wsdl-file using the wsdl.exe tool.</p> <p>When I first instantiate the generated class, it begins to request a bunch of documents from w3.org and others. The first one being <a href="http://www.w3.org/2001/XMLSchema.dtd" rel="nofollow noreferrer">h...
[ { "answer_id": 218105, "author": "tamberg", "author_id": 3588, "author_profile": "https://Stackoverflow.com/users/3588", "pm_score": 2, "selected": false, "text": "<p>if you have access to the XmlReader (or XmlTextReader) you can do the following:</p>\n\n<pre><code>XmlReader r = ...\nr.X...
2008/10/20
[ "https://Stackoverflow.com/questions/217841", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5542/" ]
I have a .NET web-service client that has been autogenerated from a wsdl-file using the wsdl.exe tool. When I first instantiate the generated class, it begins to request a bunch of documents from w3.org and others. The first one being <http://www.w3.org/2001/XMLSchema.dtd> Besides not wanting to cause unnecessary tra...
I needed the XmlResolver, so [tamberg's solution](https://stackoverflow.com/questions/217841/net-autogenerated-web-service-client-how-do-i-avoid-requesting-schemas-from-w3o#218105) did not quite work. I solved it by implementing my own XmlResolver that read the necessary schemas from embedded resources instead of downl...
217,852
<p>I have a 30000x14000 sparse matrix in MATLAB (version 7), which I need to use in another program. Calling save won't write this as ASCII (not supported). Calling <code>full()</code> on this monster results in an <code>Out of Memory</code> error.<br> How do I export it?</p>
[ { "answer_id": 217885, "author": "Veynom", "author_id": 11670, "author_profile": "https://Stackoverflow.com/users/11670", "pm_score": 2, "selected": false, "text": "<p>Did you try partitioning it ?</p>\n\n<p>I mean try calling full() on the 1000 first rows (or 5000) and then repeat the p...
2008/10/20
[ "https://Stackoverflow.com/questions/217852", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9425/" ]
I have a 30000x14000 sparse matrix in MATLAB (version 7), which I need to use in another program. Calling save won't write this as ASCII (not supported). Calling `full()` on this monster results in an `Out of Memory` error. How do I export it?
I saved it as text using Java within MATLAB. MATLAB Code: ``` pw=java.io.PrintWriter(java.io.FileWriter('c:\\retail.txt')); line=num2str(0:size(data,2)-1); pw.println(line); for index=1:length(data) disp(index); line=num2str(full(data(index,:))); pw.println(line); end pw.flush(); pw.close(); ``` Here `...
217,859
<p>When you start a Flex drag action, you pass in a proxy image to be displayed when you drag across the screen. When the drop occurs, I want to be able to grab this proxy but I can't find a way to from the DragEvent object.</p> <p>Is it possible? What I want is to actually drop the dragged image when the mouse button...
[ { "answer_id": 218524, "author": "Christophe Herreman", "author_id": 17255, "author_profile": "https://Stackoverflow.com/users/17255", "pm_score": 2, "selected": false, "text": "<p>The dragProxy is a static getter on the DragManager and is scoped to mx_internal. So to reference it, you'd...
2008/10/20
[ "https://Stackoverflow.com/questions/217859", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13220/" ]
When you start a Flex drag action, you pass in a proxy image to be displayed when you drag across the screen. When the drop occurs, I want to be able to grab this proxy but I can't find a way to from the DragEvent object. Is it possible? What I want is to actually drop the dragged image when the mouse button is releas...
The dragProxy is a static getter on the DragManager and is scoped to mx\_internal. So to reference it, you'd have to do something like this: ``` import mx_internal; ``` And in a drag event handler: ``` var p:* = DragManager.mx_internal::dragProxy; ``` I'm not sure how you could prevent the animation. If I find ou...
217,881
<p>What's the easiest way of me converting the simpler regex format that most users are used to into the correct re python regex string?</p> <p>As an example, I need to convert this:</p> <pre><code>string = "*abc+de?" </code></pre> <p>to this:</p> <pre><code>string = ".*abc.+de.?" </code></pre> <p>Of course I coul...
[ { "answer_id": 217896, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 0, "selected": false, "text": "<p>I'd use <a href=\"http://www.python.org/doc/2.5.2/lib/string-methods.html#l2h-255\" rel=\"nofollow noreferrer\"><c...
2008/10/20
[ "https://Stackoverflow.com/questions/217881", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18909/" ]
What's the easiest way of me converting the simpler regex format that most users are used to into the correct re python regex string? As an example, I need to convert this: ``` string = "*abc+de?" ``` to this: ``` string = ".*abc.+de.?" ``` Of course I could loop through the string and build up another string ch...
Those don't look like regexps you're trying to translate, they look more like unix shell globs. Python has a [module](http://www.python.org/doc/2.5.2/lib/module-fnmatch.html) for doing this already. It doesn't know about the "+" syntax you used, but neither does my shell, and I think the syntax is nonstandard. ``` >>>...
217,892
<p>Suppose I have a hash_map and a code like</p> <pre><code>// i is an iterator i = hash_map.erase(i) </code></pre> <p>But GCC's STL doesn't return iterator in erase, but a void. Now is a code like</p> <pre><code>hash_map.erase(i++) </code></pre> <p>safe (i.e. does not invalidate the iterator or does any other unex...
[ { "answer_id": 217904, "author": "C. K. Young", "author_id": 13, "author_profile": "https://Stackoverflow.com/users/13", "pm_score": 4, "selected": true, "text": "<p>Yes, this is safe, because the value of <code>i</code> will have been set to the next value, before the current value is e...
2008/10/20
[ "https://Stackoverflow.com/questions/217892", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9403/" ]
Suppose I have a hash\_map and a code like ``` // i is an iterator i = hash_map.erase(i) ``` But GCC's STL doesn't return iterator in erase, but a void. Now is a code like ``` hash_map.erase(i++) ``` safe (i.e. does not invalidate the iterator or does any other unexpected or unpleasant things)? Please note this i...
Yes, this is safe, because the value of `i` will have been set to the next value, before the current value is erased. According to the [SGI documentation about hashed containers](http://www.sgi.com/tech/stl/HashedAssociativeContainer.html) invalidation does not occur for non-erased elements, nor even for resizing (the...
217,900
<p>i want to write code for unit test to test my application code. I have different methods and now want to test these methods one by one in python script. but i do not how to i write. can any one give me example of small code for unit testing in python. i am thankful </p>
[ { "answer_id": 217925, "author": "xsl", "author_id": 11387, "author_profile": "https://Stackoverflow.com/users/11387", "pm_score": 3, "selected": false, "text": "<p>Read the <a href=\"http://www.python.org/doc/2.5.2/lib/module-unittest.html\" rel=\"nofollow noreferrer\">unit testing fram...
2008/10/20
[ "https://Stackoverflow.com/questions/217900", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17451/" ]
i want to write code for unit test to test my application code. I have different methods and now want to test these methods one by one in python script. but i do not how to i write. can any one give me example of small code for unit testing in python. i am thankful
Read the [unit testing framework section](http://www.python.org/doc/2.5.2/lib/module-unittest.html) of the [Python Library Reference](http://www.python.org/doc/2.5.2/lib/lib.html). A [basic example](http://www.python.org/doc/2.5.2/lib/minimal-example.html) from the documentation: ``` import random import unittest cl...
217,901
<p>Below are lines from "the c++ programming language"</p> <pre><code>template&lt;class T &gt; T sqrt(T ); template&lt;class T &gt; complex&lt;T&gt; sqrt(complex&lt;T&gt;); double sqrt(double); void f(complex&lt;double&gt; z ) { s q r t (2 ); // sqrt&lt;int&gt;(int) sqrt(2.0) ; // sqrt(double) sqrt(z) ; // sqrt&lt;dou...
[ { "answer_id": 217922, "author": "PierreBdR", "author_id": 7136, "author_profile": "https://Stackoverflow.com/users/7136", "pm_score": 3, "selected": true, "text": "<p>Well, the function used is the one you are talking about <code>sqrt&lt;double&gt;(complex&lt;double&gt;)</code> is an in...
2008/10/20
[ "https://Stackoverflow.com/questions/217901", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22076/" ]
Below are lines from "the c++ programming language" ``` template<class T > T sqrt(T ); template<class T > complex<T> sqrt(complex<T>); double sqrt(double); void f(complex<double> z ) { s q r t (2 ); // sqrt<int>(int) sqrt(2.0) ; // sqrt(double) sqrt(z) ; // sqrt<double>(complex<double>) } ``` I dont understand why s...
Well, the function used is the one you are talking about `sqrt<double>(complex<double>)` is an instance of the template `template <class T> complex<T> sqrt(complex<T>)`. Your misunderstanding was in the signification of the template instance and not in the overloading process.
217,902
<p>Is there any class in the .NET framework that can read/write standard .ini files:</p> <pre><code>[Section] &lt;keyname&gt;=&lt;value&gt; ... </code></pre> <p>Delphi has the <code>TIniFile</code> component and I want to know if there is anything similar for C#? </p>
[ { "answer_id": 217910, "author": "David Arno", "author_id": 7122, "author_profile": "https://Stackoverflow.com/users/7122", "pm_score": 9, "selected": true, "text": "<p>The creators of the .NET framework want you to use XML-based config files, rather than INI files. So no, there is no bu...
2008/10/20
[ "https://Stackoverflow.com/questions/217902", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25732/" ]
Is there any class in the .NET framework that can read/write standard .ini files: ``` [Section] <keyname>=<value> ... ``` Delphi has the `TIniFile` component and I want to know if there is anything similar for C#?
The creators of the .NET framework want you to use XML-based config files, rather than INI files. So no, there is no built-in mechanism for reading them. There are third party solutions available, though. * INI handlers can be obtained as [NuGet packages](https://www.nuget.org/packages?q=ini), such as [INI Parser](ht...
217,911
<p>I am a big fan of letting the compiler do as much work for you as possible. When writing a simple class the compiler can give you the following for 'free':</p> <ul> <li>A default (empty) constructor</li> <li>A copy constructor</li> <li>A destructor</li> <li>An assignment operator (<code>operator=</code>)</li> </ul...
[ { "answer_id": 217931, "author": "graham.reeds", "author_id": 342, "author_profile": "https://Stackoverflow.com/users/342", "pm_score": 0, "selected": false, "text": "<p>I agree, for POD type classes then the compiler could do it for you. However what you might consider simple the compil...
2008/10/20
[ "https://Stackoverflow.com/questions/217911", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9236/" ]
I am a big fan of letting the compiler do as much work for you as possible. When writing a simple class the compiler can give you the following for 'free': * A default (empty) constructor * A copy constructor * A destructor * An assignment operator (`operator=`) But it cannot seem to give you any comparison operators...
The compiler wouldn't know whether you wanted a pointer comparison or a deep (internal) comparison. It's safer to just not implement it and let the programmer do that themselves. Then they can make all the assumptions they like.
217,912
<p>I've got a text box bound to an object's property (in fact several text boxes) on a form. This for is an editor for an object. When i'm editing some objects and modify values in the one of the text boxes i can't exit from the text box (neither by tab nor clicking on another text box). However that's not always the c...
[ { "answer_id": 219141, "author": "orj", "author_id": 20480, "author_profile": "https://Stackoverflow.com/users/20480", "pm_score": 5, "selected": true, "text": "<p>Sounds like a data validation issue. Check if the controls on the form have their CausesValidation properties set to true o...
2008/10/20
[ "https://Stackoverflow.com/questions/217912", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10793/" ]
I've got a text box bound to an object's property (in fact several text boxes) on a form. This for is an editor for an object. When i'm editing some objects and modify values in the one of the text boxes i can't exit from the text box (neither by tab nor clicking on another text box). However that's not always the case...
Sounds like a data validation issue. Check if the controls on the form have their CausesValidation properties set to true or false. Also check the AutoValidate property on the form. It is probably set to EnablePreventFocusChange (which is the default). It may also be the case that the value being supplied in the text...
217,928
<p>I have been trying to read a picture saved in Access DB as a OLE object in a PictureBox in a C# windows Application.</p> <p>The code that does this is presented below:</p> <pre><code> string connString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Rajesh\SampleDB_2003.mdb;"; OleDbConnection oC...
[ { "answer_id": 217954, "author": "David Wengier", "author_id": 489, "author_profile": "https://Stackoverflow.com/users/489", "pm_score": 1, "selected": false, "text": "<p>Unfortunately I have no good answer for you, but I can tell you that when I tried, I got the same results. Sometimes ...
2008/10/20
[ "https://Stackoverflow.com/questions/217928", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21995/" ]
I have been trying to read a picture saved in Access DB as a OLE object in a PictureBox in a C# windows Application. The code that does this is presented below: ``` string connString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Rajesh\SampleDB_2003.mdb;"; OleDbConnection oConn = new OleDbConnec...
Your bytestream is corrupted somehow, becouse I tried the exact method of yours but filled the byte array with PNG data from a file instead. I would suggest creating two streams, one from the database, and one from the file that was the source of the image in the database. Then compare them byte by byte. If there is e...
217,929
<p>I have a problem wih a logging setup in a apring webapp deployed under tomcat 6.</p> <p>The webapp uses the commons-logging api, on runtime log4j should be used. The log file is created but remains empty - no log entries occur.</p> <p>the setup is the following:</p> <p>WEB-INF/web.xml:</p> <pre><code> &lt;contex...
[ { "answer_id": 218448, "author": "Jonas K", "author_id": 26609, "author_profile": "https://Stackoverflow.com/users/26609", "pm_score": 1, "selected": false, "text": "<p>You need to compile the extra component for full commons-logging. By default Tomcat 6 uses a hardcoded implementation o...
2008/10/20
[ "https://Stackoverflow.com/questions/217929", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12890/" ]
I have a problem wih a logging setup in a apring webapp deployed under tomcat 6. The webapp uses the commons-logging api, on runtime log4j should be used. The log file is created but remains empty - no log entries occur. the setup is the following: WEB-INF/web.xml: ``` <context-param> <param-name>log4jConfigLo...
There are numerous documented instances on the web warning people about the use of commons-logging. So much so, that [SLF4J](http://www.slf4j.org/) is gaining a lot of popularity. Considering that you are not interested in using Tomcat with Log4j, you should just use Log4j directly in your application. Particularly if...
217,932
<p>I have had a bug recently that only manifested itself when the library was built as a release build rather than a debug build. The library is a .NET dll with a COM wrapper and I am using CoCreateInstance to create a class from the dll in an unmanaged c++ app. When I finally tracked the bug down it was caused by ac...
[ { "answer_id": 218005, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 4, "selected": true, "text": "<p>Try adding an (empty) static constructor, or initialize the singleton <em>in</em> a static constructor.</p>\n<p>Jon...
2008/10/20
[ "https://Stackoverflow.com/questions/217932", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have had a bug recently that only manifested itself when the library was built as a release build rather than a debug build. The library is a .NET dll with a COM wrapper and I am using CoCreateInstance to create a class from the dll in an unmanaged c++ app. When I finally tracked the bug down it was caused by accessi...
Try adding an (empty) static constructor, or initialize the singleton *in* a static constructor. Jon Skeet has a full discussion of singleton patterns [here](https://csharpindepth.com/articles/Singleton). I'm not sure why it failed, but at a guess it could relate to the `beforefieldinit` flag. See his 4th example, whe...
217,938
<p>I am designing a crawler which will get certain content from a webpage (using either string manipulation or regex).</p> <p>I'm able to get the contents of the webpage as a response stream (using the whole httpwebrequest thing), and then for testing/dev purposes, I write the stream content to a multi-line textbox in...
[ { "answer_id": 217947, "author": "Søren Pedersen", "author_id": 379419, "author_profile": "https://Stackoverflow.com/users/379419", "pm_score": 0, "selected": false, "text": "<p>I do it this way in an project, there may be a better way to do it, but this works :)</p>\n\n<pre><code>string...
2008/10/20
[ "https://Stackoverflow.com/questions/217938", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I am designing a crawler which will get certain content from a webpage (using either string manipulation or regex). I'm able to get the contents of the webpage as a response stream (using the whole httpwebrequest thing), and then for testing/dev purposes, I write the stream content to a multi-line textbox in my ASP.NE...
In my opinion you can split the content of the text in words instead of lines: ``` public int CountOccurences(string searchString) { int i; var words = txtBox.Text.Split(" "); foreach (var s in words) if (s.Contains(searchString)) i++; return i; } ``` No need to preserve linebrea...
217,945
<p>Can I have multiple primary keys in a single table?</p>
[ { "answer_id": 217948, "author": "RB.", "author_id": 15393, "author_profile": "https://Stackoverflow.com/users/15393", "pm_score": 8, "selected": false, "text": "<p>You can only have one primary key, but you can have multiple columns in your primary key.</p>\n\n<p>You can also have Uniqu...
2008/10/20
[ "https://Stackoverflow.com/questions/217945", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Can I have multiple primary keys in a single table?
A Table can have a **Composite Primary Key** which is a primary key made from two or more columns. For example: ``` CREATE TABLE userdata ( userid INT, userdataid INT, info char(200), primary key (userid, userdataid) ); ``` **Update:** [Here is a link](http://weblogs.sqlteam.com/jeffs/archive/2007/08/23/comp...
217,957
<p>How do I print debug messages in the Google Chrome JavaScript Console?</p> <p>Please note that the JavaScript Console is not the same as the JavaScript Debugger; they have different syntaxes AFAIK, so the <strong>print</strong> command in JavaScript Debugger will not work here. In the JavaScript Console, <code>prin...
[ { "answer_id": 217988, "author": "Sergey Ilinsky", "author_id": 23815, "author_profile": "https://Stackoverflow.com/users/23815", "pm_score": 10, "selected": true, "text": "<p>Executing following code from the browser address bar:</p>\n\n<pre>\njavascript: console.log(2);\n</pre>\n\n<p>s...
2008/10/20
[ "https://Stackoverflow.com/questions/217957", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8954/" ]
How do I print debug messages in the Google Chrome JavaScript Console? Please note that the JavaScript Console is not the same as the JavaScript Debugger; they have different syntaxes AFAIK, so the **print** command in JavaScript Debugger will not work here. In the JavaScript Console, `print()` will send the parameter...
Executing following code from the browser address bar: ``` javascript: console.log(2); ``` successfully prints message to the "JavaScript Console" in Google Chrome.
217,960
<p>How do I generate friendly URLs within the ASP.NET MVC Framework? For example, we've got a URL that looks like this:</p> <pre>http://site/catalogue/BrowseByStyleLevel/1</pre> <p>The 1 is Id of the study level (Higher in this case) to browse, but I'l like to reformat the URL in the same way StackOverflow does it.</p>...
[ { "answer_id": 217991, "author": "Moran Helman", "author_id": 1409636, "author_profile": "https://Stackoverflow.com/users/1409636", "pm_score": 1, "selected": false, "text": "<p>you have a route on the global.asax</p>\n\n<pre><code> routes.MapRoute(\n \"Default\", // ...
2008/10/20
[ "https://Stackoverflow.com/questions/217960", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5791/" ]
How do I generate friendly URLs within the ASP.NET MVC Framework? For example, we've got a URL that looks like this: ``` http://site/catalogue/BrowseByStyleLevel/1 ``` The 1 is Id of the study level (Higher in this case) to browse, but I'l like to reformat the URL in the same way StackOverflow does it. For example, ...
There are two steps to solve this problem. First, create a new route or change the default route to accept an additional parameter: ``` routes.MapRoute( "Default", // Route name "{controller}/{action}/{id}/{ignoreThisBit}", new { controller = "Home", ac...
217,968
<p>I am using a satellite assembly to hold all the localization resources in a C# application.</p> <p>What I need to do is create a menu in the GUI with all the available languages that exists for the application. Is there any way to get information dynamically?</p>
[ { "answer_id": 218029, "author": "Gishu", "author_id": 1695, "author_profile": "https://Stackoverflow.com/users/1695", "pm_score": 1, "selected": false, "text": "<p><em>Each satellite assembly for a specific language is named the same but lies in a sub-folder named after the specific cul...
2008/10/20
[ "https://Stackoverflow.com/questions/217968", "https://Stackoverflow.com", "https://Stackoverflow.com/users/66654/" ]
I am using a satellite assembly to hold all the localization resources in a C# application. What I need to do is create a menu in the GUI with all the available languages that exists for the application. Is there any way to get information dynamically?
This function returns an array of all the installed cultures in the App\_GlobalResources folder - change search path according to your needs. For the invariant culture it returns "auto". ``` public static string[] GetInstalledCultures() { List<string> cultures = new List<string>(); foreach (string file in Dire...
217,977
<p>I have an XML reader on this XML string:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt; &lt;story id="1224488641nL21535800" date="20 Oct 2008" time="07:44"&gt; &lt;title&gt;PRESS DIGEST - PORTUGAL - Oct 20&lt;/title&gt; &lt;text&gt; &lt;p&gt; LISBON, Oct 20 (Reuters) - Following are some of the mai...
[ { "answer_id": 218007, "author": "Sani Singh Huttunen", "author_id": 26742, "author_profile": "https://Stackoverflow.com/users/26742", "pm_score": 0, "selected": false, "text": "<p>Looks to me that the XML is incorrect.\nSince you use HTML tags within the text tag the HTML tags are inter...
2008/10/20
[ "https://Stackoverflow.com/questions/217977", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7028/" ]
I have an XML reader on this XML string: ``` <?xml version="1.0" encoding="UTF-8" ?> <story id="1224488641nL21535800" date="20 Oct 2008" time="07:44"> <title>PRESS DIGEST - PORTUGAL - Oct 20</title> <text> <p> LISBON, Oct 20 (Reuters) - Following are some of the main stories in Portuguese newspapers on Monday. Reu...
I found a *very* unsatisfactory solution. Change the class like this (ugh!) ``` // ... [XmlElement("HACK - this should never match anything")] public string text; // ... ``` And change the calling code like this (yuck!) ``` XmlSerializer ser = new XmlSerializer(typeof(story)); string text = string.Empty; ser.Unkno...
218,003
<p>I was wondering if there is a native C++ (or STL/Boost) function which will search a CString for a specified string?</p> <p>e.g.</p> <pre><code>CString strIn = "Test number 1"; CString strQuery = "num"; bool fRet = SomeFn(strIn, StrQuery); if( fRet == true ) { // Ok strQuery was found in strIn ... </code></pr...
[ { "answer_id": 218010, "author": "Reunanen", "author_id": 19254, "author_profile": "https://Stackoverflow.com/users/19254", "pm_score": 2, "selected": false, "text": "<p><a href=\"http://www.cplusplus.com/reference/string/string/find.html\" rel=\"nofollow noreferrer\">string::find</a></p...
2008/10/20
[ "https://Stackoverflow.com/questions/218003", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18664/" ]
I was wondering if there is a native C++ (or STL/Boost) function which will search a CString for a specified string? e.g. ``` CString strIn = "Test number 1"; CString strQuery = "num"; bool fRet = SomeFn(strIn, StrQuery); if( fRet == true ) { // Ok strQuery was found in strIn ... ``` I have found a small numbe...
[CString::Find()](http://msdn.microsoft.com/ja-jp/library/ms928981.aspx) is what you want, one of the overloads does sub-string searching. ``` CString strIn = "test number 1"; int index = strIn.Find("num"); if (index != -1) // ok, found ```
218,023
<p>I have committed, and pushed, several patches: A1-->A2-->A3-->A4 (HEAD)</p> <p>Everyone's pulled these changesets into their local copy.</p> <p>Now we want to "roll back" to A2, and continue developing from there - essentially throwing away A3 and A4. What's the best way to do this?</p>
[ { "answer_id": 218050, "author": "freespace", "author_id": 8297, "author_profile": "https://Stackoverflow.com/users/8297", "pm_score": 3, "selected": false, "text": "<p>You want <code>git-revert</code> <strike>and <code>git-reset</code> depending on how you want to treat A3 and A4. To re...
2008/10/20
[ "https://Stackoverflow.com/questions/218023", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18666/" ]
I have committed, and pushed, several patches: A1-->A2-->A3-->A4 (HEAD) Everyone's pulled these changesets into their local copy. Now we want to "roll back" to A2, and continue developing from there - essentially throwing away A3 and A4. What's the best way to do this?
From the root directory of your working copy just do ``` git checkout A2 -- . git commit -m 'going back to A2' ``` --- Using [`git revert`](http://www.kernel.org/pub/software/scm/git/docs/git-revert.html) for this purpose would be cumbersome, since you want to get rid of a whole series of commits and `revert` und...
218,024
<p>I have a question with fluent interfaces.</p> <p>We have some objects that are used as parameter objects for a SQL interface, here's an example:</p> <pre><code>using (DatabaseCommand cmd = conn.CreateCommand( "SELECT A, B, C FROM tablename WHERE ID = :ID", SqlParameter.Int32(":ID", 1234))) { ... } </co...
[ { "answer_id": 218036, "author": "Mark Cidade", "author_id": 1659, "author_profile": "https://Stackoverflow.com/users/1659", "pm_score": 4, "selected": true, "text": "<p><code>SqlParameterOption's</code> methods can all be instance methods that returns the same object:</p>\n\n<pre><code>...
2008/10/20
[ "https://Stackoverflow.com/questions/218024", "https://Stackoverflow.com", "https://Stackoverflow.com/users/267/" ]
I have a question with fluent interfaces. We have some objects that are used as parameter objects for a SQL interface, here's an example: ``` using (DatabaseCommand cmd = conn.CreateCommand( "SELECT A, B, C FROM tablename WHERE ID = :ID", SqlParameter.Int32(":ID", 1234))) { ... } ``` For some of these p...
`SqlParameterOption's` methods can all be instance methods that returns the same object: ``` class SqlParameterOption { public SqlParameterOption Precision(int p) {/* ... */; return this;} public SqlParameterOption Substitute() {/* ... */; return this;} /* ... */ } /* ... */ SqlParameter.Int32(":...
218,025
<p>I quite often see on the Internet various complaints that other peoples examples of currying are not currying, but are actually just partial application.</p> <p>I've not found a decent explanation of what partial application is, or how it differs from currying. There seems to be a general confusion, with equivalent...
[ { "answer_id": 218054, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 5, "selected": false, "text": "<p>Interesting question. After a bit of searching, <a href=\"https://web.archive.org/web/20161023205431/http://www.uncar...
2008/10/20
[ "https://Stackoverflow.com/questions/218025", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1577190/" ]
I quite often see on the Internet various complaints that other peoples examples of currying are not currying, but are actually just partial application. I've not found a decent explanation of what partial application is, or how it differs from currying. There seems to be a general confusion, with equivalent examples ...
Currying is converting a single function of *n* arguments into *n* functions with a single argument each. Given the following function: ``` function f(x,y,z) { z(x(y));} ``` When curried, becomes: ``` function f(x) { lambda(y) { lambda(z) { z(x(y)); } } } ``` In order to get the full application of f(x,y,z), you ...
218,035
<p>Guys, can someone give me a brief run through of how to change the background colour of a CEdit control at runtime? I want to be able to change the background to red if the field is zero length and the normal white otherwise.</p>
[ { "answer_id": 218052, "author": "gbjbaanb", "author_id": 13744, "author_profile": "https://Stackoverflow.com/users/13744", "pm_score": 4, "selected": true, "text": "<p>You cannot do it with a plain CEdit, you need to override a few bits.</p>\n\n<p>Implement your own ON_WM_CTLCOLOR_REFLE...
2008/10/20
[ "https://Stackoverflow.com/questions/218035", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18664/" ]
Guys, can someone give me a brief run through of how to change the background colour of a CEdit control at runtime? I want to be able to change the background to red if the field is zero length and the normal white otherwise.
You cannot do it with a plain CEdit, you need to override a few bits. Implement your own ON\_WM\_CTLCOLOR\_REFLECT handler, then return your coloured CBrush in the handler: (roughly, you'll need to put the usual resource management in there, rememebr to delete your brush in the destructor) ``` class CColorEdit : pub...
218,043
<p>I'm trying to get the start element and the end element of a selection and the offset of the selection in each, i do this in firefox as follows:</p> <pre><code>var delselection = window.getSelection(); var startOffset = delselection.anchorOffset; var endOffset = delselection.focusOffset; var startNode = delselec...
[ { "answer_id": 218087, "author": "Ash", "author_id": 5023, "author_profile": "https://Stackoverflow.com/users/5023", "pm_score": 1, "selected": false, "text": "<p>You should look at the <a href=\"http://msdn.microsoft.com/en-us/library/ms537447(VS.85).aspx#\" rel=\"nofollow noreferrer\">...
2008/10/20
[ "https://Stackoverflow.com/questions/218043", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11198/" ]
I'm trying to get the start element and the end element of a selection and the offset of the selection in each, i do this in firefox as follows: ``` var delselection = window.getSelection(); var startOffset = delselection.anchorOffset; var endOffset = delselection.focusOffset; var startNode = delselection.anchorNod...
document.selection. However the TextRange object returned by IE does not match Firefox/WebKit/W3's, and determining the exact positions of the start and end points is very frustrating. Depending on what exactly you are doing with the range you may be able to get somewhere with range.parentElement(), range.inRange() or...
218,056
<p>I'm interested in tips and tricks regarding debugging a C/C++ project in Visual Studio's debugger. I recently found out that if you have a pointer to a certain data type, let's say char* ptr, then you can see it as an array in the watch window using a syntax such as:</p> <pre> ptr,10 </pre> <p>This will display th...
[ { "answer_id": 218073, "author": "staffan", "author_id": 988, "author_profile": "https://Stackoverflow.com/users/988", "pm_score": 3, "selected": false, "text": "<p>You can set the names of your threads using a somewhat awkward piece of code. See this <a href=\"http://msdn.microsoft.com/...
2008/10/20
[ "https://Stackoverflow.com/questions/218056", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4528/" ]
I'm interested in tips and tricks regarding debugging a C/C++ project in Visual Studio's debugger. I recently found out that if you have a pointer to a certain data type, let's say char\* ptr, then you can see it as an array in the watch window using a syntax such as: ``` ptr,10 ``` This will display the first 10 e...
I really like the possibility to tweak the Debugger display of types and structures through **AutoExp.dat**. The file is located at > > ..\Microsoft Visual Studio > 9.0\Common7\Packages\Debugger\autoexp.dat > > > and allows to define own templates for the display of data during debugging: > > While debugging,...
218,057
<p>Without routing, <code>HttpContext.Current.Session</code> is there so I know that the <code>StateServer</code> is working. When I route my requests, <code>HttpContext.Current.Session</code> is <code>null</code> in the routed page. I am using .NET 3.5 sp1 on IIS 7.0, without the MVC previews. It appears that <code>Ac...
[ { "answer_id": 218068, "author": "Bogdan Maxim", "author_id": 23795, "author_profile": "https://Stackoverflow.com/users/23795", "pm_score": 0, "selected": false, "text": "<p>It seems that you have forgotten to add your state server address in the <a href=\"http://msdn.microsoft.com/en-us...
2008/10/20
[ "https://Stackoverflow.com/questions/218057", "https://Stackoverflow.com", "https://Stackoverflow.com/users/57936/" ]
Without routing, `HttpContext.Current.Session` is there so I know that the `StateServer` is working. When I route my requests, `HttpContext.Current.Session` is `null` in the routed page. I am using .NET 3.5 sp1 on IIS 7.0, without the MVC previews. It appears that `AcquireRequestState` is never fired when using the rou...
Got it. Quite stupid, actually. It worked after I removed & added the SessionStateModule like so: ``` <configuration> ... <system.webServer> ... <modules> <remove name="Session" /> <add name="Session" type="System.Web.SessionState.SessionStateModule"/> ... </modules> </system.webSer...
218,060
<p>Is there a class in the standard library of .NET that gives me the functionality to create random variables that follow Gaussian distribution? </p>
[ { "answer_id": 218600, "author": "yoyoyoyosef", "author_id": 25571, "author_profile": "https://Stackoverflow.com/users/25571", "pm_score": 9, "selected": true, "text": "<p>Jarrett's suggestion of using a Box-Muller transform is good for a quick-and-dirty solution. A simple implementatio...
2008/10/20
[ "https://Stackoverflow.com/questions/218060", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23681/" ]
Is there a class in the standard library of .NET that gives me the functionality to create random variables that follow Gaussian distribution?
Jarrett's suggestion of using a Box-Muller transform is good for a quick-and-dirty solution. A simple implementation: ``` Random rand = new Random(); //reuse this if you are generating many double u1 = 1.0-rand.NextDouble(); //uniform(0,1] random doubles double u2 = 1.0-rand.NextDouble(); double randStdNormal = Math.S...
218,061
<p>I've recently searched how I could get the application's directory in Java. I've finally found the answer but I've needed surprisingly long because searching for such a generic term isn't easy. I think it would be a good idea to compile a list of how to achieve this in multiple languages.</p> <p>Feel free to up/dow...
[ { "answer_id": 218062, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 2, "selected": false, "text": "<p>In <strong>Java</strong>, there are two ways to find the application's path. One is to employ <code>System.getProp...
2008/10/20
[ "https://Stackoverflow.com/questions/218061", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1968/" ]
I've recently searched how I could get the application's directory in Java. I've finally found the answer but I've needed surprisingly long because searching for such a generic term isn't easy. I think it would be a good idea to compile a list of how to achieve this in multiple languages. Feel free to up/downvote if y...
In **Java** the calls ``` System.getProperty("user.dir") ``` and ``` new java.io.File(".").getAbsolutePath(); ``` return the current working directory. The call to ``` getClass().getProtectionDomain().getCodeSource().getLocation().getPath(); ``` returns the path to the JAR file containing the current class,...
218,065
<p>I have a div with <code>overflow:hidden</code>, inside which I show a phone number as the user types it. The text inside the div is aligned to right and incoming characters are added to right as the text grows to left.</p> <p>But once the text is big enough not to fit in the div, last characters of the number is au...
[ { "answer_id": 218071, "author": "Rob Bell", "author_id": 2179408, "author_profile": "https://Stackoverflow.com/users/2179408", "pm_score": 8, "selected": true, "text": "<p>Have you tried using the following:</p>\n\n<pre><code>direction: rtl;\n</code></pre>\n\n<p>For more information see...
2008/10/20
[ "https://Stackoverflow.com/questions/218065", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31505/" ]
I have a div with `overflow:hidden`, inside which I show a phone number as the user types it. The text inside the div is aligned to right and incoming characters are added to right as the text grows to left. But once the text is big enough not to fit in the div, last characters of the number is automatically cropped a...
Have you tried using the following: ``` direction: rtl; ``` For more information see <http://www.w3schools.com/cssref/pr_text_direction.asp>
218,067
<p>When compiling the following simpleType with the XJC compile (from the JAXB package)...</p> <pre><code>&lt;xs:simpleType name="test"&gt; &lt;xs:annotation&gt; &lt;xs:appinfo&gt; &lt;jaxb:typesafeEnumClass/&gt; &lt;/xs:appinfo&gt; &lt;/xs:annotation&gt; &lt;xs:restriction base...
[ { "answer_id": 244003, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 2, "selected": true, "text": "<p>There's nothing in the JAXB spec that seems to allow this change. I think the only way to do this would be to write a JAXB ...
2008/10/20
[ "https://Stackoverflow.com/questions/218067", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9707/" ]
When compiling the following simpleType with the XJC compile (from the JAXB package)... ``` <xs:simpleType name="test"> <xs:annotation> <xs:appinfo> <jaxb:typesafeEnumClass/> </xs:appinfo> </xs:annotation> <xs:restriction base="xs:string"> <xs:enumeration value="4"> ...
There's nothing in the JAXB spec that seems to allow this change. I think the only way to do this would be to write a JAXB Plugin.
218,096
<p>We are monitoring the progress of a customized app (whose source is not under our control) which writes to a XML Manifest. At times , the application is stuck due to unable to write into the Manifest file. Although we are covering our traces by explicitly closing the file handle using File.Close and also creating th...
[ { "answer_id": 218159, "author": "Gripsoft", "author_id": 17519, "author_profile": "https://Stackoverflow.com/users/17519", "pm_score": 0, "selected": false, "text": "<p>The problem is different because that person is having full control on the file access for all processes while as i me...
2008/10/20
[ "https://Stackoverflow.com/questions/218096", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17519/" ]
We are monitoring the progress of a customized app (whose source is not under our control) which writes to a XML Manifest. At times , the application is stuck due to unable to write into the Manifest file. Although we are covering our traces by explicitly closing the file handle using File.Close and also creating the f...
If you are only reading from the file, then you should be able to pass a flag to specify the sharing mode. I don't know how you specify this in .NET, but in WinAPI you'd pass `FILE_SHARE_READ | FILE_SHARE_WRITE` to `CreateFile()`. I suggest you check your file API documentation to see where it mentions sharing modes.
218,107
<p>Looking at the C# and VB.NET language specs I think it says that the logical Xor/Or/And operations have different precendence in the two languages. Am I reading that right? I was expecting them to have the same precendence.</p> <p>For example in C#</p> <pre><code>100 | 200 ^ 300 &amp; 400 </code></pre> <p>is the ...
[ { "answer_id": 218115, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 3, "selected": true, "text": "<blockquote>\n <p>Am I reading that right?</p>\n</blockquote>\n\n<p>Yes. Simple as that.</p>\n" }, { "answer_...
2008/10/20
[ "https://Stackoverflow.com/questions/218107", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6276/" ]
Looking at the C# and VB.NET language specs I think it says that the logical Xor/Or/And operations have different precendence in the two languages. Am I reading that right? I was expecting them to have the same precendence. For example in C# ``` 100 | 200 ^ 300 & 400 ``` is the same as... ``` 100 | (200 ^ (300 & ...
> > Am I reading that right? > > > Yes. Simple as that.
218,113
<p>One thing that always been a pain is to log SQL (JDBC) errors when you have a PreparedStatement instead of the query itself.</p> <p>You always end up with messages like:</p> <pre><code>2008-10-20 09:19:48,114 ERROR LoggingQueueConsumer-52 [Logger.error:168] Error executing SQL: [INSERT INTO private_rooms_bans (ro...
[ { "answer_id": 1018672, "author": "Kieran Tully", "author_id": 18023, "author_profile": "https://Stackoverflow.com/users/18023", "pm_score": 0, "selected": false, "text": "<ol>\n<li><p>If you are using MySQL, MySQL Connector's PreparedStatement.toString() <a href=\"http://bugs.mysql.com/...
2008/10/20
[ "https://Stackoverflow.com/questions/218113", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14540/" ]
One thing that always been a pain is to log SQL (JDBC) errors when you have a PreparedStatement instead of the query itself. You always end up with messages like: ``` 2008-10-20 09:19:48,114 ERROR LoggingQueueConsumer-52 [Logger.error:168] Error executing SQL: [INSERT INTO private_rooms_bans (room_id, name, user_id,...
I tried [log4jdbc](http://code.google.com/p/log4jdbc/) and it did the job for me. *SECURITY NOTE: As of today August 2011, the logged results of a log4jdbc prepared statement are NOT SAFE to execute. They can be used for analysis, but should NEVER be fed back into a DBMS.* **Example** of log generated by logjdbc: >...
218,117
<p>Today when I was in computer organization class, teacher talked about something interesting to me. When it comes to talk about Why cache memory works, he said that:</p> <pre><code>for (i=0; i&lt;M; i++) for(j=0; j&lt;N; j++) X[i][j] = X[i][j] + K; //X is double(8 bytes) </code></pre> <p>it is not good to ...
[ { "answer_id": 218125, "author": "unwind", "author_id": 28169, "author_profile": "https://Stackoverflow.com/users/28169", "pm_score": 3, "selected": false, "text": "<p>It is like that becauses caches like locality. The same number of memory accessed, but spaced further apart, will hit di...
2008/10/20
[ "https://Stackoverflow.com/questions/218117", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26379/" ]
Today when I was in computer organization class, teacher talked about something interesting to me. When it comes to talk about Why cache memory works, he said that: ``` for (i=0; i<M; i++) for(j=0; j<N; j++) X[i][j] = X[i][j] + K; //X is double(8 bytes) ``` it is not good to change the first line with the s...
Locality of reference. Because the data is stored by rows, for each row the j columns are in adjacent memory addresses. The OS will typically load an entire page from memory into the cache and adjacent address references will likely refer to that same page. If you increment by the row index in the inner loop it is poss...
218,122
<p>When using webforms the appropriate place to assign master pages to a page dynamically seems to be the pages PreInit event: </p> <pre><code>this.Master.MasterPageFile = "~/leaf.Master" </code></pre> <p>If nessasary, master pages in a hierarchy of nested master pages may be set here too:</p> <pre><code>this.Master...
[ { "answer_id": 218351, "author": "Craig Stuntz", "author_id": 7714, "author_profile": "https://Stackoverflow.com/users/7714", "pm_score": 2, "selected": false, "text": "<p>It isn't entirely clear what you mean by \"higher up in the hierarchy,\" but if you mean, \"in one place, rather tha...
2008/10/20
[ "https://Stackoverflow.com/questions/218122", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29547/" ]
When using webforms the appropriate place to assign master pages to a page dynamically seems to be the pages PreInit event: ``` this.Master.MasterPageFile = "~/leaf.Master" ``` If nessasary, master pages in a hierarchy of nested master pages may be set here too: ``` this.Master.MasterPageFile = "~/leaf.Master" thi...
It isn't entirely clear what you mean by "higher up in the hierarchy," but if you mean, "in one place, rather than in every controller I create," I can think of two options: 1. Create an abstract controller supertype and subclass your concrete controllers from that. 2. [Create a controller factory](http://weblogs.asp....
218,133
<p>I want to deserialize an object but don't know the class up front. So, consider the following code...</p> <pre><code>IFormatter formatter = new BinaryFormatter(); Stream stream = new FileStream("MyFile.bin", FileMode.Open, FileAccess.Read, FileShare.Read); MyObject obj = (MyObject)formatter.Deserialize(stream); </...
[ { "answer_id": 218141, "author": "leppie", "author_id": 15541, "author_profile": "https://Stackoverflow.com/users/15541", "pm_score": 4, "selected": true, "text": "<p>Just do:</p>\n\n<pre><code>object result = formatter.Deserialize(stream); \nType t = result.GetType();\n</code></pre>\n" ...
2008/10/20
[ "https://Stackoverflow.com/questions/218133", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3893/" ]
I want to deserialize an object but don't know the class up front. So, consider the following code... ``` IFormatter formatter = new BinaryFormatter(); Stream stream = new FileStream("MyFile.bin", FileMode.Open, FileAccess.Read, FileShare.Read); MyObject obj = (MyObject)formatter.Deserialize(stream); ``` What could ...
Just do: ``` object result = formatter.Deserialize(stream); Type t = result.GetType(); ```
218,144
<p>I'm wrapping up a <code>Javascript</code> widget in a <code>Wicket</code> component. I want to let the JS side talk to the component. What I've got so far:</p> <p>Component in question goes like</p> <pre><code>talker = new GridAjaxBehavior(); this.add(talker); </code></pre> <p>in constructor</p> <p>and the...
[ { "answer_id": 713544, "author": "Eric Ryan Harrison", "author_id": 79033, "author_profile": "https://Stackoverflow.com/users/79033", "pm_score": 0, "selected": false, "text": "<p>I don't really know what Wicket is or what it does, but there is a minor bug in your code (as it appears).</...
2008/10/20
[ "https://Stackoverflow.com/questions/218144", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29574/" ]
I'm wrapping up a `Javascript` widget in a `Wicket` component. I want to let the JS side talk to the component. What I've got so far: Component in question goes like ``` talker = new GridAjaxBehavior(); this.add(talker); ``` in constructor and then, later on, puts something like ``` "var MyGridTalker = new ta...
Spit back some XML for what? Presumably to update the model or the view, yes? The strength of Wicket is that you don't have to worry about the rendered HTML. In Model-View-Controller terms, you set up the Controller to correctly modify the Model, and Wicket takes care of the View. The separation is not *entirely* cle...
218,155
<p>To put it simple, there's a simple java swing app that consists of JFrame with some components in it. One of the components is a JPanel that is meant to be replaced by another JPanel on user action.</p> <p>So, what's the correct way of doing such a thing? I've tried</p> <pre><code>panel = new CustomJPanelWithCompo...
[ { "answer_id": 218259, "author": "Tom Hawtin - tackline", "author_id": 4725, "author_profile": "https://Stackoverflow.com/users/4725", "pm_score": 5, "selected": false, "text": "<pre><code>frame.setContentPane(newContents());\nframe.revalidate(); // frame.pack() if you want to resize.\n<...
2008/10/20
[ "https://Stackoverflow.com/questions/218155", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15187/" ]
To put it simple, there's a simple java swing app that consists of JFrame with some components in it. One of the components is a JPanel that is meant to be replaced by another JPanel on user action. So, what's the correct way of doing such a thing? I've tried ``` panel = new CustomJPanelWithComponentsOnIt(); parentFr...
Your use case, seems perfect for [CardLayout](http://java.sun.com/docs/books/tutorial/uiswing/layout/card.html). In card layout you can add multiple panels in the same place, but then show or hide, one panel at a time.
218,156
<p>The following code</p> <pre><code>number=1 if [[ $number =~ [0-9] ]] then echo matched fi </code></pre> <p>works. If I try to use quotes in the regex, however, it stops:</p> <pre><code>number=1 if [[ $number =~ "[0-9]" ]] then echo matched fi </code></pre> <p>I tried <code>"\[0-9\]"</code>, too. What am I mi...
[ { "answer_id": 218217, "author": "Vinko Vrsalovic", "author_id": 5190, "author_profile": "https://Stackoverflow.com/users/5190", "pm_score": 8, "selected": true, "text": "<p>It was changed <a href=\"http://tiswww.case.edu/php/chet/bash/NEWS\" rel=\"noreferrer\">between 3.1 and 3.2</a>. G...
2008/10/20
[ "https://Stackoverflow.com/questions/218156", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8437/" ]
The following code ``` number=1 if [[ $number =~ [0-9] ]] then echo matched fi ``` works. If I try to use quotes in the regex, however, it stops: ``` number=1 if [[ $number =~ "[0-9]" ]] then echo matched fi ``` I tried `"\[0-9\]"`, too. What am I missing? Funnily enough, [bash advanced scripting guide](http...
It was changed [between 3.1 and 3.2](http://tiswww.case.edu/php/chet/bash/NEWS). Guess the advanced guide needs an update. > > This is a terse description of the new > features added to bash-3.2 since the > release of bash-3.1. As always, the > manual page (doc/bash.1) is the place > to look for complete descript...
218,158
<p>Is there a nicer way of styling a <code>&lt;hr /&gt;</code> tag using CSS, that is cross-browser consistent and doesn't involve wrapping a <code>div</code> around it? I'm struggling to find one.</p> <p>The best way I have found, is as follows:</p> <p><strong>CSS</strong></p> <pre><code>.hr { height:20px; ...
[ { "answer_id": 218165, "author": "vfilby", "author_id": 24279, "author_profile": "https://Stackoverflow.com/users/24279", "pm_score": 1, "selected": false, "text": "<p>If you set display to <code>block</code> it should behave more like a <code>&lt;div&gt;</code>.</p>\n\n<p>Your answer yo...
2008/10/20
[ "https://Stackoverflow.com/questions/218158", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26107/" ]
Is there a nicer way of styling a `<hr />` tag using CSS, that is cross-browser consistent and doesn't involve wrapping a `div` around it? I'm struggling to find one. The best way I have found, is as follows: **CSS** ``` .hr { height:20px; background: #fff url(nice-image.gif) no-repeat scroll center; }...
The classic way of doing this is creating a wrapper around the <hr> and styling that. But I have come up a CSS trick for image replacing the element without the need for extra markup: For non MSIE browsers: ``` hr { border : 0; height : 15px; background : url(hr.gif) 0 0 no-repeat; margin : 1em 0; } ```...
218,174
<p>I have the following arrays in PHP (okay they are a bit bigger but the idea is what counts).</p> <pre><code>$array1 = array(1 =&gt; 'a', 2 =&gt; 'b'); $array2 = array(3 =&gt; 'c', 4 =&gt; 'd'); </code></pre> <p>Essentially I want to combine the two arrays as if it were something like this</p> <pre><code>$array3 =...
[ { "answer_id": 218198, "author": "Stefan Gehrig", "author_id": 11354, "author_profile": "https://Stackoverflow.com/users/11354", "pm_score": 6, "selected": true, "text": "<p>Use</p>\n\n<pre><code>$array3 = $array1 + $array2;\n</code></pre>\n\n<p>See <a href=\"http://de3.php.net/manual/en...
2008/10/20
[ "https://Stackoverflow.com/questions/218174", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1384652/" ]
I have the following arrays in PHP (okay they are a bit bigger but the idea is what counts). ``` $array1 = array(1 => 'a', 2 => 'b'); $array2 = array(3 => 'c', 4 => 'd'); ``` Essentially I want to combine the two arrays as if it were something like this ``` $array3 = array(1 => 'a', 2 => 'b', 3 => 'c', 4 => 'd'); ...
Use ``` $array3 = $array1 + $array2; ``` See [Array Operators](http://de3.php.net/manual/en/language.operators.array.php) By the way: [array\_merge()](http://de3.php.net/array_merge) does something different with the arrays given in the example: ``` $a1=array(1 => 'a', 2 => 'b'); $a2=array(3 => 'c', 4 => 'd'); pri...
218,181
<p>Is there a built-in way to URL encode a string in Excel VBA or do I need to hand roll this functionality? </p>
[ { "answer_id": 218199, "author": "Tomalak", "author_id": 18771, "author_profile": "https://Stackoverflow.com/users/18771", "pm_score": 8, "selected": true, "text": "<p>No, nothing built-in (<em>until Excel 2013 - <a href=\"https://stackoverflow.com/a/24301379/18771\">see this answer</a><...
2008/10/20
[ "https://Stackoverflow.com/questions/218181", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4023/" ]
Is there a built-in way to URL encode a string in Excel VBA or do I need to hand roll this functionality?
No, nothing built-in (*until Excel 2013 - [see this answer](https://stackoverflow.com/a/24301379/18771)*). There are three versions of `URLEncode()` in this answer. * A function with UTF-8 support. **You should probably use this one** (or [the alternative implementation](https://stackoverflow.com/a/3812363/18771) by ...
218,208
<p>I have a Makefile building many C files with long long command lines and we've cleaned up the output by having rules such as:</p> <pre><code>.c${MT}.doj: @echo "Compiling $&lt;";\ $(COMPILER) $(COPTS) -c -o $@ $&lt; </code></pre> <p>Now this is great as the @ suppresses the compilation line being...
[ { "answer_id": 218295, "author": "Rajish", "author_id": 29576, "author_profile": "https://Stackoverflow.com/users/29576", "pm_score": 4, "selected": true, "text": "<p>Tested and it worked (GNU make in Linux):</p>\n\n<pre><code>.c${MT}.doj:\n @echo \"Compiling $&lt;\";\\\n $(...
2008/10/20
[ "https://Stackoverflow.com/questions/218208", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a Makefile building many C files with long long command lines and we've cleaned up the output by having rules such as: ``` .c${MT}.doj: @echo "Compiling $<";\ $(COMPILER) $(COPTS) -c -o $@ $< ``` Now this is great as the @ suppresses the compilation line being emitted. But when we get an err...
Tested and it worked (GNU make in Linux): ``` .c${MT}.doj: @echo "Compiling $<";\ $(COMPILER) $(COPTS) -c -o $@ $< \ || echo "Error in command: $(COMPILER) $(COPTS) -c -o $@ $<" \ && false ```
218,219
<p>I need to change in a text input the character '.' to ',' while typing. In IE I change the keyCode event property in the keypress event, like this</p> <pre><code>document.getElementById('mytext').onkeypress = function (evt) { var e = evt || window.event; if (e.keyCode &amp;&amp; e.keyCode==46) e.keyCode = ...
[ { "answer_id": 218225, "author": "Ates Goral", "author_id": 23501, "author_profile": "https://Stackoverflow.com/users/23501", "pm_score": 3, "selected": false, "text": "<p>Try this. It works on all browsers:</p>\n\n<pre><code>window.onload = function () {\n var input = document.getEle...
2008/10/20
[ "https://Stackoverflow.com/questions/218219", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27789/" ]
I need to change in a text input the character '.' to ',' while typing. In IE I change the keyCode event property in the keypress event, like this ``` document.getElementById('mytext').onkeypress = function (evt) { var e = evt || window.event; if (e.keyCode && e.keyCode==46) e.keyCode = 44; else if (e.which...
Try this. It works on all browsers: ``` window.onload = function () { var input = document.getElementById("mytext"); input.onkeypress = function () { var evt = arguments[0] || event; var char = String.fromCharCode(evt.which || evt.keyCode); // Is it a period? if (char == ".") ...
218,245
<p>Is there support in Ruby for (for lack of a better word) non-escaped (verbatim) strings?</p> <p>Like in C#:</p> <pre><code>@"c:\Program Files\" </code></pre> <p>...or in Tcl:</p> <pre><code>{c:\Program Files\} </code></pre>
[ { "answer_id": 218257, "author": "DevelopingChris", "author_id": 1220, "author_profile": "https://Stackoverflow.com/users/1220", "pm_score": 4, "selected": true, "text": "<p>Yes, you need to prefix your string with <code>%</code> and then a single character delineating its type.</p>\n\n<...
2008/10/20
[ "https://Stackoverflow.com/questions/218245", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11545/" ]
Is there support in Ruby for (for lack of a better word) non-escaped (verbatim) strings? Like in C#: ``` @"c:\Program Files\" ``` ...or in Tcl: ``` {c:\Program Files\} ```
Yes, you need to prefix your string with `%` and then a single character delineating its type. The one you want is `%q{c:\program files\}`. The pickaxe book covers this nicely [here,](http://www.rubycentral.org/pickaxe/language.html) section is General Delimited Input.
218,255
<p>I'm a pretty active command line user and I have shell accounts all over the place. MacBooks, Linux desktop machines, Linux servers, Cygwin on XP, you name it.</p> <p>How can I keep my shell configuration (<code>.bashrc</code>, <code>.vimrc</code> etc.) in sync across all these machines using the limited tools avai...
[ { "answer_id": 218290, "author": "ejgottl", "author_id": 9808, "author_profile": "https://Stackoverflow.com/users/9808", "pm_score": 2, "selected": false, "text": "<p>I've used version control for this in the past (<a href=\"http://subversion.tigris.org/\" rel=\"nofollow noreferrer\">svn...
2008/10/20
[ "https://Stackoverflow.com/questions/218255", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20476/" ]
I'm a pretty active command line user and I have shell accounts all over the place. MacBooks, Linux desktop machines, Linux servers, Cygwin on XP, you name it. How can I keep my shell configuration (`.bashrc`, `.vimrc` etc.) in sync across all these machines using the limited tools available across all platforms? I h...
I have folder on Dropbox with global, per OS, and per machine shell configs: ``` $ ls ~/Dropbox/shell/bash bashbootstrap bashrc bashrc-Darwin bashrc-Darwin-laptopname bashrc-Darwin-mininame bashrc-Linux bashrc-Linux-machineone bashrc-Linux-machinetwo ``` `bashrc` is loaded on every machine, `bashrc-Linux`, `bas...
218,256
<p>I used to be able to do the following in Preview 3</p> <pre><code>&lt;%=Html.BuildUrlFromExpression&lt;AController&gt;(c =&gt; c.AnAction(par1, par2)%&gt; </code></pre> <p>How am I supposed to create urls in a strongly typed way with the MVC Beta? The only thing so far I have found is </p> <pre><code>&lt;%= Html....
[ { "answer_id": 218274, "author": "Sam Mackrill", "author_id": 18349, "author_profile": "https://Stackoverflow.com/users/18349", "pm_score": 4, "selected": true, "text": "<p>You need the ASP.NET MVC Beta Futures, which is a separate download</p>\n\n<p><a href=\"http://www.codeplex.com/asp...
2008/10/20
[ "https://Stackoverflow.com/questions/218256", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11333/" ]
I used to be able to do the following in Preview 3 ``` <%=Html.BuildUrlFromExpression<AController>(c => c.AnAction(par1, par2)%> ``` How am I supposed to create urls in a strongly typed way with the MVC Beta? The only thing so far I have found is ``` <%= Html.ActionLink("aName", "ActionName", "ControllerName")%> ...
You need the ASP.NET MVC Beta Futures, which is a separate download [ASP.NET MVC Beta Futures](http://www.codeplex.com/aspnet/Release/ProjectReleases.aspx?ReleaseId=18459) then your original code will work as before. See this post for getting it working: [SO post on missing extensions](https://stackoverflow.com/ques...
218,284
<p>I'd like to be able to read the mac address from the first active network adapter using VB.net or C# (using .NET 3.5 SP1) for a winform application</p>
[ { "answer_id": 218305, "author": "Lou Franco", "author_id": 3937, "author_profile": "https://Stackoverflow.com/users/3937", "pm_score": 0, "selected": false, "text": "<p>You need to DllImport GetAdaptersInfo -- here's some C# code</p>\n\n<p><a href=\"http://www.codeguru.com/cpp/i-n/netwo...
2008/10/20
[ "https://Stackoverflow.com/questions/218284", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'd like to be able to read the mac address from the first active network adapter using VB.net or C# (using .NET 3.5 SP1) for a winform application
Since .Net 2.0 there's been a NetworkInterface class in the System.Net.NetworkInformation namespace that will give you this information. Try this: ``` foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces()) { if (nic.OperationalStatus == OperationalStatus.Up) ...
218,322
<p>If I have a property:</p> <pre><code>public list&lt;String&gt; names { get; set; } </code></pre> <p>How can I generate and handle a custom Event for arguments sake called 'onNamesChanged' whenever a name gets added to the list?</p>
[ { "answer_id": 218333, "author": "David Mohundro", "author_id": 4570, "author_profile": "https://Stackoverflow.com/users/4570", "pm_score": 4, "selected": true, "text": "<p>You should check out the <a href=\"http://msdn.microsoft.com/en-us/library/ms132680.aspx\" rel=\"nofollow noreferre...
2008/10/20
[ "https://Stackoverflow.com/questions/218322", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1816/" ]
If I have a property: ``` public list<String> names { get; set; } ``` How can I generate and handle a custom Event for arguments sake called 'onNamesChanged' whenever a name gets added to the list?
You should check out the [System.ComponentModel.BindingList](http://msdn.microsoft.com/en-us/library/ms132680.aspx), specifically the [ListChanged event](http://msdn.microsoft.com/en-us/library/ms132742.aspx).
218,337
<p>i'm fairly new to NHibernate and although I'm finding tons of infos on NHibernate mapping on the web, I am too silly to find this piece of information.</p> <p>So the problem is, i've got the following Model:</p> <p><img src="https://i.stack.imgur.com/DihaU.jpg" alt="Datamodel"></p> <p>this is how I'd like it to l...
[ { "answer_id": 218360, "author": "Joachim Kerschbaumer", "author_id": 20227, "author_profile": "https://Stackoverflow.com/users/20227", "pm_score": 0, "selected": false, "text": "<p>you could configure this as two relations. e.g.</p>\n\n<pre><code>&lt;many-to-one name=\"ShippingAddress\...
2008/10/20
[ "https://Stackoverflow.com/questions/218337", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21699/" ]
i'm fairly new to NHibernate and although I'm finding tons of infos on NHibernate mapping on the web, I am too silly to find this piece of information. So the problem is, i've got the following Model: ![Datamodel](https://i.stack.imgur.com/DihaU.jpg) this is how I'd like it to look. One clean person that has two Add...
Ok. I found the solution myself. The key is the construct in the XML configuration and it works rather nicely. Here is how it's done: ``` <component name="Address" class="Address"> <property name="Streetname"></property> <property name="Zip"></property> <property name="City"></property> <property name="Countr...
218,350
<p>Does Java Connection.close rollback into a finally block?.</p> <p>I know .Net SqlConnection.close does it.</p> <p>With this I could make try/finally blocks without catch...</p> <p>Example:</p> <pre><code>try { conn.setAutoCommit(false); ResultSet rs = executeQuery(conn, ...); .... executeNonQuery...
[ { "answer_id": 218495, "author": "Joel", "author_id": 21987, "author_profile": "https://Stackoverflow.com/users/21987", "pm_score": 6, "selected": true, "text": "<p>According to <a href=\"http://java.sun.com/javase/6/docs/api/java/sql/Connection.html#close()\" rel=\"noreferrer\">the java...
2008/10/20
[ "https://Stackoverflow.com/questions/218350", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29600/" ]
Does Java Connection.close rollback into a finally block?. I know .Net SqlConnection.close does it. With this I could make try/finally blocks without catch... Example: ``` try { conn.setAutoCommit(false); ResultSet rs = executeQuery(conn, ...); .... executeNonQuery(conn, ...); .... conn.com...
According to [the javadoc](http://java.sun.com/javase/6/docs/api/java/sql/Connection.html#close()), you should try to either commit or roll back before calling the close method. The results otherwise are implementation-defined.
218,384
<p>What are Null Pointer Exceptions (<code>java.lang.NullPointerException</code>) and what causes them?</p> <p>What methods/tools can be used to determine the cause so that you stop the exception from causing the program to terminate prematurely?</p>
[ { "answer_id": 218390, "author": "Bill the Lizard", "author_id": 1288, "author_profile": "https://Stackoverflow.com/users/1288", "pm_score": 10, "selected": false, "text": "<p><code>NullPointerException</code>s are exceptions that occur when you try to use a reference that points to no l...
2008/10/20
[ "https://Stackoverflow.com/questions/218384", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29182/" ]
What are Null Pointer Exceptions (`java.lang.NullPointerException`) and what causes them? What methods/tools can be used to determine the cause so that you stop the exception from causing the program to terminate prematurely?
There are two overarching types of variables in Java: 1. *Primitives*: variables that contain data. If you want to manipulate the data in a primitive variable you can manipulate that variable directly. By convention primitive types start with a lowercase letter. For example variables of type `int` or `char` are primit...
218,399
<p>What's the advantage of passing data as parameters vs part of the URL in an Ajax GET request?</p> <p>Using parameters:</p> <pre><code>var ajax = new Ajax.Request('server.php',{ parameters: 'store=11200&amp;product=Meat', onSuccess: function(myData){whatever} }); </code></pre> <p>Using URL:</p> <pre><code...
[ { "answer_id": 218417, "author": "Evan DiBiase", "author_id": 2399475, "author_profile": "https://Stackoverflow.com/users/2399475", "pm_score": 5, "selected": true, "text": "<p>One advantage to using the <code>parameters</code> argument is that you can pass it a <code>Hash</code>-like ob...
2008/10/20
[ "https://Stackoverflow.com/questions/218399", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12579/" ]
What's the advantage of passing data as parameters vs part of the URL in an Ajax GET request? Using parameters: ``` var ajax = new Ajax.Request('server.php',{ parameters: 'store=11200&product=Meat', onSuccess: function(myData){whatever} }); ``` Using URL: ``` var ajax = new Ajax.Request('server.php?store=1...
One advantage to using the `parameters` argument is that you can pass it a `Hash`-like object instead of as a string. (If you do this, though, make sure so set the `method` parameter to `"GET"`, as the default method for Prototype Ajax requests is POST; see [the Prototype Introduction to Ajax](http://www.prototypejs.or...
218,405
<p>I've been testing an application using my machine as a server, and everything's going fine with it, but when I try to set it up to run on the test server, I get this error:</p> <blockquote> <p>Retrieving the COM class factory for component with CLSID {XXXX} failed due to the following error: 80040154.</p> </b...
[ { "answer_id": 218423, "author": "ChaosSpeeder", "author_id": 205962, "author_profile": "https://Stackoverflow.com/users/205962", "pm_score": 3, "selected": true, "text": "<p>First: Please check on your test server the registration of your com objects.</p>\n\n<pre><code>HKEY_CLASSES_ROOT...
2008/10/20
[ "https://Stackoverflow.com/questions/218405", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13244/" ]
I've been testing an application using my machine as a server, and everything's going fine with it, but when I try to set it up to run on the test server, I get this error: > > Retrieving the COM class factory for > component with CLSID {XXXX} failed due > to the following error: 80040154. > > > Any ideas? Tha...
First: Please check on your test server the registration of your com objects. ``` HKEY_CLASSES_ROOT\CLSID\{xxxx} ``` Check, if your dll or exe file is on the correct location on the hard drive. Second: This link may help: <http://support.software602.com/kb/view.aspx?articleID=987>
218,439
<p>Suppose we have the following code:</p> <pre><code>ExpressionHelper.GetRouteValuesFromExpression&lt;AccountController&gt;(ax =&gt; ax.MyAction("a", "b")); </code></pre> <p>(from ASP.NET MVC Futures assembly). Method is reasonably fast - it executes 10k iterations in 150ms.</p> <p>Now, we change code to this:</p> ...
[ { "answer_id": 218456, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 1, "selected": false, "text": "<p>Why don't you just cache the value of the expression and its compiled value locally if this is such a bottleneck? ...
2008/10/20
[ "https://Stackoverflow.com/questions/218439", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28912/" ]
Suppose we have the following code: ``` ExpressionHelper.GetRouteValuesFromExpression<AccountController>(ax => ax.MyAction("a", "b")); ``` (from ASP.NET MVC Futures assembly). Method is reasonably fast - it executes 10k iterations in 150ms. Now, we change code to this: ``` string a = "a"; string b = "b"; Expressio...
Why don't you just cache the value of the expression and its compiled value locally if this is such a bottleneck? I imagine a simply Dictionary could do the trick: ``` Dictionary<Expression<Action<T>>, Action<T>> m_Cache = new Dictionary<Expression<Action<T>>, Action<T>>(); public void GetRouteValuesFromExpressio...
218,461
<p>I would like to know what is the difference between initializing a static member inline as in:</p> <pre><code>class Foo { private static Bar bar_ = new Bar(); } </code></pre> <p>or initializing it inside the static constructor as in:</p> <pre><code>class Foo { static Foo() { bar_ = new Bar(); ...
[ { "answer_id": 218477, "author": "Torbjørn", "author_id": 22621, "author_profile": "https://Stackoverflow.com/users/22621", "pm_score": 2, "selected": false, "text": "<p>In this case I don't believe there si any practical difference. If you need some logic in initializing the static vari...
2008/10/20
[ "https://Stackoverflow.com/questions/218461", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10688/" ]
I would like to know what is the difference between initializing a static member inline as in: ``` class Foo { private static Bar bar_ = new Bar(); } ``` or initializing it inside the static constructor as in: ``` class Foo { static Foo() { bar_ = new Bar(); } private static Bar bar_; } ...
If you have a static constructor in your type, it alters type initialization due to the [beforefieldinit](http://pobox.com/~skeet/csharp/beforefieldinit.html) flag no longer being applied. It also affects initialization order - variable initializers are all executed before the static constructor. That's about it as f...
218,466
<p>I'm having a hard time coding understanding the format of the specifier and string functions.</p> <p>My aim is to use <code>%[]</code> to readin all characters and spaces and then use the strcpy function followed by the strcat function.</p> <p>So far i've managed to enter individual characters and print them out, ...
[ { "answer_id": 218482, "author": "Martin Beckett", "author_id": 10897, "author_profile": "https://Stackoverflow.com/users/10897", "pm_score": 0, "selected": false, "text": "<p>words[i] is a single character in the string words and you are trying to store a string 's' in it.<br>\nTo read ...
2008/10/20
[ "https://Stackoverflow.com/questions/218466", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm having a hard time coding understanding the format of the specifier and string functions. My aim is to use `%[]` to readin all characters and spaces and then use the strcpy function followed by the strcat function. So far i've managed to enter individual characters and print them out, excluding spaces. here's th...
I assume you want to read a string with a maximum length of 29 characters from the standard input up to the ENTER key. To do that you can use the following code: ``` char phrase[30]; printf("Enter a phrase: "); scanf("%29[^\n]", phrase); printf("You just entered: '%s'\n", phrase); ``` The `%29[^\n]` says to read at...
218,488
<h2>Problem</h2> <p>I have timestamped data, which I need to search based on the timestamp in order to get the one existing timestamp which matches my input timestamp the closest.<br> Preferably this should be solved with the STL. boost::* or stl::tr1::* (from VS9 with Featurepack) are also possible.<br> Example of ti...
[ { "answer_id": 218569, "author": "Eclipse", "author_id": 8701, "author_profile": "https://Stackoverflow.com/users/8701", "pm_score": 0, "selected": false, "text": "<p>Depending on what your usage is, you could do a simple linear search instead of a sort. Come up with a \"distance\" func...
2008/10/20
[ "https://Stackoverflow.com/questions/218488", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27596/" ]
Problem ------- I have timestamped data, which I need to search based on the timestamp in order to get the one existing timestamp which matches my input timestamp the closest. Preferably this should be solved with the STL. boost::\* or stl::tr1::\* (from VS9 with Featurepack) are also possible. Example of timest...
I would use set::lower\_bound to find the matching or greater value, then decrement the iterator to check the next lower value. You should use std::set rather than std::map since your key is embedded in the object - you'll need to provide a functor that compares the timestamp members. ``` struct TimestampCompare { ...
218,491
<p>Is it possible to configure Windows Servers that reside on the same domain such that when a web service call is made from a web app using an IP address, the request does not go via a proxy server?</p> <p>The web service is running on one of the servers on the domain. </p> <p>I want to configure IP based security o...
[ { "answer_id": 220289, "author": "jezell", "author_id": 27453, "author_profile": "https://Stackoverflow.com/users/27453", "pm_score": 0, "selected": false, "text": "<p>With ASMX the proxy can be set on the Proxy property:</p>\n\n<p><a href=\"http://johnwsaundersiii.spaces.live.com/blog/c...
2008/10/20
[ "https://Stackoverflow.com/questions/218491", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29588/" ]
Is it possible to configure Windows Servers that reside on the same domain such that when a web service call is made from a web app using an IP address, the request does not go via a proxy server? The web service is running on one of the servers on the domain. I want to configure IP based security on the server that...
Proxycfg looked promising, however the following code was what I needed to do it programmatically:- ``` Set xmlhttp = Server.CreateObject("Msxml2.ServerXMLHTTP.4.0") xmlhttp.SetProxy 2,"proxyname:port", "addresses that should bypass the proxy" ``` this allowed me to specify the addresses that should bypass the spe...
218,512
<p>I would like to use the ispell-buffer command in Emacs. It uses the English language by default. Is there an easy way to switch to another dictionary (for example, another language)?</p>
[ { "answer_id": 218576, "author": "Pierre", "author_id": 24449, "author_profile": "https://Stackoverflow.com/users/24449", "pm_score": 5, "selected": false, "text": "<p>From the file ispell.el you may specify some options for the <code>ispell</code> commands. This happens by adding a sect...
2008/10/20
[ "https://Stackoverflow.com/questions/218512", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4900/" ]
I would like to use the ispell-buffer command in Emacs. It uses the English language by default. Is there an easy way to switch to another dictionary (for example, another language)?
The following command proposes a list of installed dictionaries to use: ``` M-x ispell-change-dictionary ``` Usually, `M-x isp-c-d` expands to the above also.