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
214,045
<p>A couple of recent questions discuss strategies for naming columns, and I was rather surprised to discover the concept of embedding the notion of foreign and primary keys in column names. That is</p> <pre><code>select t1.col_a, t1.col_b, t2.col_z from t1 inner join t2 on t1.id_foo_pk = t2.id_foo_fk </code></pre> <...
[ { "answer_id": 214055, "author": "Paul Tomblin", "author_id": 3333, "author_profile": "https://Stackoverflow.com/users/3333", "pm_score": 3, "selected": false, "text": "<p>I agree with you. Putting this information in the column name smacks of the crappy Hungarian Notation idiocy of the...
2008/10/17
[ "https://Stackoverflow.com/questions/214045", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18625/" ]
A couple of recent questions discuss strategies for naming columns, and I was rather surprised to discover the concept of embedding the notion of foreign and primary keys in column names. That is ``` select t1.col_a, t1.col_b, t2.col_z from t1 inner join t2 on t1.id_foo_pk = t2.id_foo_fk ``` I have to confess I have...
I agree with you that the foreign key column in a child table should have the same name as the primary key column in the parent table. Note that this permits syntax like the following: ``` SELECT * FROM foo JOIN bar USING (foo_id); ``` The USING keyword assumes that a column exists by the same name in both tables, a...
214,059
<p>I just learned about <a href="http://ngrep.sourceforge.net/" rel="nofollow noreferrer">ngrep</a>, a cool program that lets you easily sniff packets that match a particular string.</p> <p>The only problem is that it can be hard to see the match in the big blob of output. I'd like to write a wrapper script to highlig...
[ { "answer_id": 214149, "author": "Jon Ericson", "author_id": 1438, "author_profile": "https://Stackoverflow.com/users/1438", "pm_score": 1, "selected": false, "text": "<p>It shouldn't be too hard if you have the answer <a href=\"https://stackoverflow.com/questions/213901/in-perl-how-do-i...
2008/10/17
[ "https://Stackoverflow.com/questions/214059", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7598/" ]
I just learned about [ngrep](http://ngrep.sourceforge.net/), a cool program that lets you easily sniff packets that match a particular string. The only problem is that it can be hard to see the match in the big blob of output. I'd like to write a wrapper script to highlight these matches -- it could use ANSI escape se...
Ah, forget it. This is too much of a pain. It was a lot easier to get the source to ngrep and make it print the hash marks to stderr: ``` --- ngrep.c 2006-11-28 05:38:43.000000000 -0800 +++ ngrep.c.new 2008-10-17 16:28:29.000000000 -0700 @@ -687,8 +687,7 @@ } if (quiet < 1) { - printf("#"); - ...
214,065
<p>We're building some software for an in-house Kiosk. The software is a basic .net windows form with an embedded browser. The Kiosk is outfitted with a mat that the user steps on. When the user steps on the mat, it sends a key comination through the keyboard. When the user steps off the mat it sends a different key...
[ { "answer_id": 214101, "author": "Joel B Fant", "author_id": 22211, "author_profile": "https://Stackoverflow.com/users/22211", "pm_score": 1, "selected": false, "text": "<p>I was doing a somewhat similar search just a short while ago regarding USB card readers.</p>\n\n<p>I came across <a...
2008/10/17
[ "https://Stackoverflow.com/questions/214065", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9266/" ]
We're building some software for an in-house Kiosk. The software is a basic .net windows form with an embedded browser. The Kiosk is outfitted with a mat that the user steps on. When the user steps on the mat, it sends a key comination through the keyboard. When the user steps off the mat it sends a different key combi...
If your window is the active window, then you can simply override the forms ProcessCmdKey as such below. ``` protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { const int WM_KEYDOWN = 0x100; const int WM_SYSKEYDOWN = 0x104; if ((msg.Msg == WM_KEYDOWN) || (msg.Msg == WM_SYSKEYDOWN)) ...
214,072
<p>Can anyone reccomend some good tutorials for ext js and adobe air? The ones I have seen seem to start with you knowing a lot or already having a lot of code in place.</p> <p>What I am looking for is a simple step by step guide that takes you through the basics of Ext Js in use with adobe air, in fact i suppose just...
[ { "answer_id": 214101, "author": "Joel B Fant", "author_id": 22211, "author_profile": "https://Stackoverflow.com/users/22211", "pm_score": 1, "selected": false, "text": "<p>I was doing a somewhat similar search just a short while ago regarding USB card readers.</p>\n\n<p>I came across <a...
2008/10/17
[ "https://Stackoverflow.com/questions/214072", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28241/" ]
Can anyone reccomend some good tutorials for ext js and adobe air? The ones I have seen seem to start with you knowing a lot or already having a lot of code in place. What I am looking for is a simple step by step guide that takes you through the basics of Ext Js in use with adobe air, in fact i suppose just a good Ex...
If your window is the active window, then you can simply override the forms ProcessCmdKey as such below. ``` protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { const int WM_KEYDOWN = 0x100; const int WM_SYSKEYDOWN = 0x104; if ((msg.Msg == WM_KEYDOWN) || (msg.Msg == WM_SYSKEYDOWN)) ...
214,077
<p>I was wondering if there is some way to name or rename a property on an Anonymous type to include a space in the property name. For example:</p> <pre><code>var resultSet = from customer in customerList select new { FirstName = customer.firstName; }; </code></pre> <p>In this example I would lik...
[ { "answer_id": 214084, "author": "Christian C. Salvadó", "author_id": 5445, "author_profile": "https://Stackoverflow.com/users/5445", "pm_score": 2, "selected": false, "text": "<p>No, its not possible, spaces are not allowed in the names of members, you can use perhaps underscore or prog...
2008/10/17
[ "https://Stackoverflow.com/questions/214077", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7215/" ]
I was wondering if there is some way to name or rename a property on an Anonymous type to include a space in the property name. For example: ``` var resultSet = from customer in customerList select new { FirstName = customer.firstName; }; ``` In this example I would like FirstName to be "First Na...
What about doing something like this: ``` var resultSet = from customer in customerList select new { Value = customer.firstName, Title = "First Name" }; ``` Then in your user control use Value as the contents and Title as the co...
214,086
<p>If I have a method such as:</p> <pre><code>public void MyMethod(int arg1, string arg2) </code></pre> <p>How would I go about getting the actual names of the arguments? I can't seem to find anything in the MethodInfo which will actually give me the name of the parameter.</p> <p>I would like to write a method which...
[ { "answer_id": 214106, "author": "Tom Anderson", "author_id": 13502, "author_profile": "https://Stackoverflow.com/users/13502", "pm_score": 7, "selected": true, "text": "<pre><code>public static string GetParamName(System.Reflection.MethodInfo method, int index)\n{\n string retVal = s...
2008/10/17
[ "https://Stackoverflow.com/questions/214086", "https://Stackoverflow.com", "https://Stackoverflow.com/users/646/" ]
If I have a method such as: ``` public void MyMethod(int arg1, string arg2) ``` How would I go about getting the actual names of the arguments? I can't seem to find anything in the MethodInfo which will actually give me the name of the parameter. I would like to write a method which looks like this: ``` public sta...
``` public static string GetParamName(System.Reflection.MethodInfo method, int index) { string retVal = string.Empty; if (method != null && method.GetParameters().Length > index) retVal = method.GetParameters()[index].Name; return retVal; } ``` The above sample should do what you need.
214,094
<p>Say you have a standard template with included (parsed) header, body, footer templates.</p> <p>In the body template a variable like $subject is defined and you want that also displayed in the header template.</p> <p>In some other template languages like HTML::Mason(perl based) you would evaluate the body template ...
[ { "answer_id": 243258, "author": "Olly", "author_id": 1174, "author_profile": "https://Stackoverflow.com/users/1174", "pm_score": 2, "selected": false, "text": "<p>You can do this using <a href=\"http://velocity.apache.org/tools/devel/view/layoutservlet.html\" rel=\"nofollow noreferrer\"...
2008/10/17
[ "https://Stackoverflow.com/questions/214094", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Say you have a standard template with included (parsed) header, body, footer templates. In the body template a variable like $subject is defined and you want that also displayed in the header template. In some other template languages like HTML::Mason(perl based) you would evaluate the body template first to pick up ...
Either of the two solutions above would work. The VelocityLayoutServlet solution requires an extra package (also from Velocity) called Velocity Tools. I'm partial to this approach (and variants) myself. A third method is simply to put the #parse within quotes: ``` set ($body="#parse('body.vm')") ``` Within a #set, ...
214,109
<p>I was getting bad data from an application I was writting using C++ in Visual Studio 2k3 so I decided to debug it. Then I found it was throwing an exception but one I can't track down.</p> <p>Then I placed some try/catch blocks and low and behold, when I don't debug there is no exception. That is, I have code that ...
[ { "answer_id": 214120, "author": "Doug T.", "author_id": 8123, "author_profile": "https://Stackoverflow.com/users/8123", "pm_score": 1, "selected": false, "text": "<p>Is the exception an ASSERT? These may get compiled out at compile time or otherwise throw an assertion.</p>\n\n<p>For exa...
2008/10/17
[ "https://Stackoverflow.com/questions/214109", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23829/" ]
I was getting bad data from an application I was writting using C++ in Visual Studio 2k3 so I decided to debug it. Then I found it was throwing an exception but one I can't track down. Then I placed some try/catch blocks and low and behold, when I don't debug there is no exception. That is, I have code that looks like...
You can try placing a ``` DebugBreak(); ``` call in the `catch` clause. If the app is running in the debugger, it should get control. If it's not running in the debugger you should get an opportunity to attach the "Just in Time" debugger (which is usually Visual Studio if you have that installed).
214,124
<p>Anyone know of a good free winforms html editor for .NET. Ideally I would like html and preview modes along with the possibility of exporting to a pdf, word doc or similar. </p> <p>Although the export I could probably create myself from the html output.</p> <p>Another nice feature would be a paste from word that r...
[ { "answer_id": 214152, "author": "Tom Anderson", "author_id": 13502, "author_profile": "https://Stackoverflow.com/users/13502", "pm_score": 6, "selected": true, "text": "<p>You can use the <a href=\"https://learn.microsoft.com/en-us/dotnet/framework/winforms/controls/webbrowser-control-w...
2008/10/17
[ "https://Stackoverflow.com/questions/214124", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16989/" ]
Anyone know of a good free winforms html editor for .NET. Ideally I would like html and preview modes along with the possibility of exporting to a pdf, word doc or similar. Although the export I could probably create myself from the html output. Another nice feature would be a paste from word that removes all the ex...
You can use the [WebBrowser](https://learn.microsoft.com/en-us/dotnet/framework/winforms/controls/webbrowser-control-windows-forms) control in design mode with a second `WebBrowser` control set in view mode. In order to put the `WebBrowser` control in design mode, you can use the following code. This code is a super ...
214,136
<p>With a <code>TreeMap</code> it's trivial to provide a custom <code>Comparator</code>, thus overriding the semantics provided by <code>Comparable</code> objects added to the map. <code>HashMap</code>s however cannot be controlled in this manner; the functions providing hash values and equality checks cannot be 'side-...
[ { "answer_id": 214142, "author": "hazzen", "author_id": 5066, "author_profile": "https://Stackoverflow.com/users/5066", "pm_score": 2, "selected": false, "text": "<p>Note: As noted in all other answers, HashMaps don't have an explicit ordering. They only recognize \"equality\". Getting a...
2008/10/17
[ "https://Stackoverflow.com/questions/214136", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13905/" ]
With a `TreeMap` it's trivial to provide a custom `Comparator`, thus overriding the semantics provided by `Comparable` objects added to the map. `HashMap`s however cannot be controlled in this manner; the functions providing hash values and equality checks cannot be 'side-loaded'. I suspect it would be both easy and u...
[Trove4j](http://trove4j.sourceforge.net/html/overview.html) has the feature I'm after and they call it hashing strategies. Their map has an implementation with different limitations and thus different prerequisites, so this does not implicitly mean that an implementation for Java's "native" HashMap would be feasible.
214,140
<p>I'm working on a table of links within a site using iframes. I'm wondering if there's any way to code a link to go to two simultaneous destinations within two different target frames? I've been reading all afternoon and can't find anything close to what I want to do. Basically I want one link to present a photo in o...
[ { "answer_id": 214153, "author": "davethegr8", "author_id": 12930, "author_profile": "https://Stackoverflow.com/users/12930", "pm_score": 3, "selected": true, "text": "<p>Short answer: No.</p>\n\n<p>Longer answer: With what you describe, using strictly X/HTML, this isn't possible. You co...
2008/10/17
[ "https://Stackoverflow.com/questions/214140", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27171/" ]
I'm working on a table of links within a site using iframes. I'm wondering if there's any way to code a link to go to two simultaneous destinations within two different target frames? I've been reading all afternoon and can't find anything close to what I want to do. Basically I want one link to present a photo in one ...
Short answer: No. Longer answer: With what you describe, using strictly X/HTML, this isn't possible. You could add in javascript to change the iframe src, however. Something like: ``` function click_link(id) { document.getElementById('iframe1').src = "page.ext?id=" + id; document.getElementById('iframe2').src...
214,143
<p>I'm starting to develop a web application in PHP that I hope will become incredibly popular and make me famous and rich. :-)</p> <p>If that time comes, my decision whether to parse the API's data as XML with SimpleXML or to use json_decode could make a difference in the app's scalability.</p> <p>Does anyone know w...
[ { "answer_id": 214151, "author": "Randy", "author_id": 9361, "author_profile": "https://Stackoverflow.com/users/9361", "pm_score": 4, "selected": true, "text": "<p>As the \"lighter\" format, I'd expect JSON to be slightly less stressful on the server, but I doubt it will be the biggest p...
2008/10/17
[ "https://Stackoverflow.com/questions/214143", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11577/" ]
I'm starting to develop a web application in PHP that I hope will become incredibly popular and make me famous and rich. :-) If that time comes, my decision whether to parse the API's data as XML with SimpleXML or to use json\_decode could make a difference in the app's scalability. Does anyone know which of these ap...
As the "lighter" format, I'd expect JSON to be slightly less stressful on the server, but I doubt it will be the biggest performance issue you find yourself dealing with as your site grows in popularity. Use whichever format you're more comfortable with. Alternatively, if you know how you'll be structuring your data,...
214,205
<p>Here's some Ruby code:</p> <pre><code>puts %x{ pstree #{$$} } # never forks puts %x{ pstree '#{$$}' } # forks on amd64 only </code></pre> <p>On 32-bit Ubuntu Dapper, I get this output:</p> <pre><code>t.rb---pstree t.rb---pstree </code></pre> <p>Which makes sense to me. But on 64-bit Ubuntu Hardy, I get this:<...
[ { "answer_id": 214263, "author": "Robert Gamble", "author_id": 25222, "author_profile": "https://Stackoverflow.com/users/25222", "pm_score": 3, "selected": true, "text": "<p>Ruby performs shell expansion when %x is used with a single argument (like you are doing).</p>\n\n<p>Here's my gue...
2008/10/17
[ "https://Stackoverflow.com/questions/214205", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4323/" ]
Here's some Ruby code: ``` puts %x{ pstree #{$$} } # never forks puts %x{ pstree '#{$$}' } # forks on amd64 only ``` On 32-bit Ubuntu Dapper, I get this output: ``` t.rb---pstree t.rb---pstree ``` Which makes sense to me. But on 64-bit Ubuntu Hardy, I get this: ``` t.rb---sh---pstree t.rb---pstree ``` What's...
Ruby performs shell expansion when %x is used with a single argument (like you are doing). Here's my guess as to what is going on: Ruby scans the command to determine if there are any special characters that would result in the need to perform shell expansion, if so it calls the shell to do that. In the second exampl...
214,215
<p>I have several user drawn controls on a form, unfortunately when the form is shown the user drawn controls are showing the previous forms background rather than the current forms background. </p> <p>The OnPaint event is very simple, and the OnBackgroundPaint event is empty... </p> <p>Like this:</p> <pre><code> ...
[ { "answer_id": 214263, "author": "Robert Gamble", "author_id": 25222, "author_profile": "https://Stackoverflow.com/users/25222", "pm_score": 3, "selected": true, "text": "<p>Ruby performs shell expansion when %x is used with a single argument (like you are doing).</p>\n\n<p>Here's my gue...
2008/10/17
[ "https://Stackoverflow.com/questions/214215", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29140/" ]
I have several user drawn controls on a form, unfortunately when the form is shown the user drawn controls are showing the previous forms background rather than the current forms background. The OnPaint event is very simple, and the OnBackgroundPaint event is empty... Like this: ``` protected override void OnP...
Ruby performs shell expansion when %x is used with a single argument (like you are doing). Here's my guess as to what is going on: Ruby scans the command to determine if there are any special characters that would result in the need to perform shell expansion, if so it calls the shell to do that. In the second exampl...
214,262
<p>I have the following snippet of code, changeTextArea is a TextArea object.</p> <pre><code>changeTextArea.addKeyboardListener(new KeyboardListenerAdapter() public void onKeyPress( Widget sender, char keyCode, int modifier){ //do something //I WISH TO STOP THE EVENT THAT MAPS TO THIS KEYPRESS FROM BUBBLING ...
[ { "answer_id": 214633, "author": "rustyshelf", "author_id": 6044, "author_profile": "https://Stackoverflow.com/users/6044", "pm_score": 4, "selected": true, "text": "<p>As far as I know you can't do it via a keyboard listener, but it is possible by adding an event preview using the DOM c...
2008/10/18
[ "https://Stackoverflow.com/questions/214262", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21317/" ]
I have the following snippet of code, changeTextArea is a TextArea object. ``` changeTextArea.addKeyboardListener(new KeyboardListenerAdapter() public void onKeyPress( Widget sender, char keyCode, int modifier){ //do something //I WISH TO STOP THE EVENT THAT MAPS TO THIS KEYPRESS FROM BUBBLING ANY FURTHER ...
As far as I know you can't do it via a keyboard listener, but it is possible by adding an event preview using the DOM class: ``` DOM.addEventPreview(EventPreview preview) ``` Then when you get the event: ``` onEventPreview(Event event) ``` You should return false, to say you want to cancel the event. The Event ...
214,271
<p>In Perl, I can type:</p> <pre><code>$|++; </code></pre> <p>and anything printed to STDOUT will be automatically fflush()ed.</p> <p>Is there an equivalent in C? In other words, is there some way I can tell stdio to automatically fflush stdout after every printf(), the way it automatically flushes stderr?</p>
[ { "answer_id": 214282, "author": "CesarB", "author_id": 28258, "author_profile": "https://Stackoverflow.com/users/28258", "pm_score": 3, "selected": false, "text": "<p>Take a look at setbuf() and setvbuf().</p>\n" }, { "answer_id": 214290, "author": "Harry", "author_id": ...
2008/10/18
[ "https://Stackoverflow.com/questions/214271", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7598/" ]
In Perl, I can type: ``` $|++; ``` and anything printed to STDOUT will be automatically fflush()ed. Is there an equivalent in C? In other words, is there some way I can tell stdio to automatically fflush stdout after every printf(), the way it automatically flushes stderr?
Try `setvbuf(stdout, NULL, _IONBF, 0)`. It changes `stdout` to unbuffered (`_IONBF`) mode.
214,272
<p>I downloaded the Aptana_Studio_Setup_Linux.zip package, unpacked it and run ./AptanaStudio. It starts fine, but reports one problem:</p> <p><em>The embedded browser widget for this editor cannot be created. It is either not available for your operating system or the system needs to be configured in order to support...
[ { "answer_id": 215481, "author": "Oli", "author_id": 12870, "author_profile": "https://Stackoverflow.com/users/12870", "pm_score": -1, "selected": false, "text": "<p>If this is the problem I think you're having, just installing Firefox 2 (alongside FF3) should fix the issue. It happens b...
2008/10/18
[ "https://Stackoverflow.com/questions/214272", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14690/" ]
I downloaded the Aptana\_Studio\_Setup\_Linux.zip package, unpacked it and run ./AptanaStudio. It starts fine, but reports one problem: *The embedded browser widget for this editor cannot be created. It is either not available for your operating system or the system needs to be configured in order to support embedded ...
**Edit:** getting internal browser to work is NOT required in order to get PHP support in Aptana. Just install PHP support from **Help**, **Software updates** menu.
214,304
<p>I would like to set some initial variables (like <code>format compact</code> and the current directory) automatically on each startup of Matlab.<br> How can I do that?</p>
[ { "answer_id": 214354, "author": "Mr Fooz", "author_id": 25050, "author_profile": "https://Stackoverflow.com/users/25050", "pm_score": 1, "selected": false, "text": "<p>Create a <a href=\"http://www.mathworks.com/access/helpdesk/help/techdoc/index.html?/access/helpdesk/help/techdoc/ref/s...
2008/10/18
[ "https://Stackoverflow.com/questions/214304", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1034/" ]
I would like to set some initial variables (like `format compact` and the current directory) automatically on each startup of Matlab. How can I do that?
Create a startup.m script file containing the commands to set up the state that you want. Next, from inside MATLAB, run the command ``` >> userpath ``` This will give you a list of one or more user-specific directories (depending on what OS you are using); put your startup.m in any of those directories and it will b...
214,309
<p>For example, mysql quote table name using </p> <pre><code>SELECT * FROM `table_name`; </code></pre> <p>notice the ` </p> <p>Does other database ever use different char to quote their table name</p>
[ { "answer_id": 214338, "author": "Alexander Kojevnikov", "author_id": 712, "author_profile": "https://Stackoverflow.com/users/712", "pm_score": 2, "selected": false, "text": "<p>SQL Server uses [square brackets] or \"double quotes\" when QUOTED_IDENTIFIER option is ON.</p>\n\n<p>I believ...
2008/10/18
[ "https://Stackoverflow.com/questions/214309", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20907/" ]
For example, mysql quote table name using ``` SELECT * FROM `table_name`; ``` notice the ` Does other database ever use different char to quote their table name
This use of quotes is called delimited identifiers. It's an important part of SQL because otherwise you can't use identifiers (e.g. table names and column names) that: * Include whitespace: "my table" * Include special characters and punctuation: "my-table" * Include international characters: "私のテーブル" * Are case-sensi...
214,346
<p>In C# is there any real difference (other than syntax) under the hood between:</p> <pre><code>myButton.Click += new EventHandler(myMemberMethod); </code></pre> <p>and</p> <pre><code>myButton.Click += myMemberMethod; </code></pre> <p>?</p>
[ { "answer_id": 214353, "author": "Alexander Kojevnikov", "author_id": 712, "author_profile": "https://Stackoverflow.com/users/712", "pm_score": 5, "selected": true, "text": "<p>The second method is a shortcut to the first one, it was introduced in C# 2.0</p>\n\n<p>See also <a href=\"http...
2008/10/18
[ "https://Stackoverflow.com/questions/214346", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29152/" ]
In C# is there any real difference (other than syntax) under the hood between: ``` myButton.Click += new EventHandler(myMemberMethod); ``` and ``` myButton.Click += myMemberMethod; ``` ?
The second method is a shortcut to the first one, it was introduced in C# 2.0 See also [this thread](https://stackoverflow.com/questions/119160/what-is-the-difference-between-events-with-delegate-handlers-and-those-without).
214,348
<p>Does anyone know the bare minimum files required for Ext JS 2.2? I know the ExtJS site has a feature to <a href="http://extjs.com/products/extjs/build/" rel="noreferrer">"build"</a> a small version of ExtJS (ext.js) as a replacement for ext-all.js but that's for minimizing the size of ExtJS on the client. I'm intere...
[ { "answer_id": 214390, "author": "pfeilbr", "author_id": 29148, "author_profile": "https://Stackoverflow.com/users/29148", "pm_score": 4, "selected": true, "text": "<p>This link explains the include order\n<a href=\"http://extjs.com/learn/Ext_Getting_Started#What_is_the_proper_include_or...
2008/10/18
[ "https://Stackoverflow.com/questions/214348", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10708/" ]
Does anyone know the bare minimum files required for Ext JS 2.2? I know the ExtJS site has a feature to ["build"](http://extjs.com/products/extjs/build/) a small version of ExtJS (ext.js) as a replacement for ext-all.js but that's for minimizing the size of ExtJS on the client. I'm interested in minimizing what's on th...
This link explains the include order [What is the proper include order for my JavaScript files?](http://extjs.com/learn/Ext_Getting_Started#What_is_the_proper_include_order_for_my_JavaScript_files.3F) This is the minimum include set ``` <link rel="stylesheet" type="text/css" href="../extjs/resources/css/ext-all.css">...
214,359
<p>What is the most efficient way to do this?</p>
[ { "answer_id": 214365, "author": "Paige Ruten", "author_id": 813, "author_profile": "https://Stackoverflow.com/users/813", "pm_score": 2, "selected": false, "text": "<p>A hex value is just RGB numbers represented in hexadecimal. So you just have to take each pair of hex digits and conver...
2008/10/18
[ "https://Stackoverflow.com/questions/214359", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23107/" ]
What is the most efficient way to do this?
Real answer: Depends on what kind of hexadecimal color value you are looking for (e.g. 565, 555, 888, 8888, etc), the amount of alpha bits, the actual color distribution (rgb vs bgr...) and a ton of other variables. Here's a generic algorithm for most RGB values using C++ templates (straight from ScummVM). ``` templa...
214,363
<p>Using any tools which you would expect to find on a nix system (in fact, if you want, msdos is also fine too), what is the easiest/fastest way to calculate the mean of a set of numbers, assuming you have them one per line in a stream or file?</p>
[ { "answer_id": 214370, "author": "Paul Nathan", "author_id": 26227, "author_profile": "https://Stackoverflow.com/users/26227", "pm_score": 0, "selected": false, "text": "<p>Perl.</p>\n\n<pre><code>@a = &lt;STDIN&gt;;\n\nfor($i = 0; $i &lt; #@a; $i++)\n{\n $sum += $a[i];\n}\n\nprint $a[...
2008/10/18
[ "https://Stackoverflow.com/questions/214363", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18352/" ]
Using any tools which you would expect to find on a nix system (in fact, if you want, msdos is also fine too), what is the easiest/fastest way to calculate the mean of a set of numbers, assuming you have them one per line in a stream or file?
Awk ``` awk '{total += $1; count++ } END {print total/count}' ```
214,419
<pre><code>$query = "SELECT * FROM `table`"; $results = mysql_query($query, $connection); </code></pre> <p>If 'table' has no rows. whats the easiest way to check for this.?</p>
[ { "answer_id": 214421, "author": "Paige Ruten", "author_id": 813, "author_profile": "https://Stackoverflow.com/users/813", "pm_score": 5, "selected": true, "text": "<p>You could use <a href=\"http://php.net/mysql_num_rows\" rel=\"noreferrer\">mysql_num_rows($results)</a> to check if 0 ro...
2008/10/18
[ "https://Stackoverflow.com/questions/214419", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
``` $query = "SELECT * FROM `table`"; $results = mysql_query($query, $connection); ``` If 'table' has no rows. whats the easiest way to check for this.?
You could use [mysql\_num\_rows($results)](http://php.net/mysql_num_rows) to check if 0 rows were returned, or use this faster alternative: ``` $query = "SELECT COUNT(*) AS total FROM table"; $results = mysql_query($query, $connection); $values = mysql_fetch_assoc($results); $num_rows = $values['total']; ```
214,426
<p>I want to check if a given date is more than a month earlier than today's date using LINQ.</p> <p>What is the syntax for this?</p> <p>Thanks in advance.</p>
[ { "answer_id": 214442, "author": "tvanfosson", "author_id": 12950, "author_profile": "https://Stackoverflow.com/users/12950", "pm_score": 6, "selected": true, "text": "<p>I assume that you're talking about in the where clause. It's basically the same way you would compare two DateTime o...
2008/10/18
[ "https://Stackoverflow.com/questions/214426", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8783/" ]
I want to check if a given date is more than a month earlier than today's date using LINQ. What is the syntax for this? Thanks in advance.
I assume that you're talking about in the where clause. It's basically the same way you would compare two DateTime objects elsewhere. ``` using (DataContext context = new DataContext()) { var query = from t in context.table where t.CreateDate.Date < DateTime.Today.AddMonths(-1) select ...
214,427
<p>There are two Databases, Database A has a table A with columns of id, group and flag. Database B has a table B with columns of ID and flag. Table B is essentially a subset of table A <code>where the group == 'B'</code>. </p> <p>They are updated/created in odd ways that are outside my understanding at this time, ...
[ { "answer_id": 214475, "author": "tvanfosson", "author_id": 12950, "author_profile": "https://Stackoverflow.com/users/12950", "pm_score": 1, "selected": false, "text": "<p>Create an update trigger on table A that pushes the necessary changes to B as A is modified.</p>\n\n<p>Basically (s...
2008/10/18
[ "https://Stackoverflow.com/questions/214427", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2130/" ]
There are two Databases, Database A has a table A with columns of id, group and flag. Database B has a table B with columns of ID and flag. Table B is essentially a subset of table A `where the group == 'B'`. They are updated/created in odd ways that are outside my understanding at this time, and are beyond the scope...
Assuming that ID is a unique key, and that you can use linked servers or some such to run a query across servers, this SQL statement should work (it works for two tables on the same server). ``` UPDATE Table_B SET Table_B.Flag = Table_A.Flag FROM Table_A inner join Table_B on Table_A.id = Table_B.id ``` (since Table...
214,431
<p>A few weeks ago I opened up a hole on my shared server and my friend uploaded the following PHP script:</p> <pre><code>&lt;?php if(isset($_REQUEST['cmd'])) { echo "&lt;pre&gt;"; $cmd = ($_REQUEST['cmd']); system($cmd); echo "&lt;/pre&gt;"; die; } ?&gt; &lt;?php if(isset($_REQUEST['upload'])) { ...
[ { "answer_id": 214438, "author": "acrosman", "author_id": 24215, "author_profile": "https://Stackoverflow.com/users/24215", "pm_score": 1, "selected": false, "text": "<p>One, kick off a \"friend\" that chooses to run scripts like this.</p>\n\n<p>Then worry about securing your server. Yo...
2008/10/18
[ "https://Stackoverflow.com/questions/214431", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27025/" ]
A few weeks ago I opened up a hole on my shared server and my friend uploaded the following PHP script: ``` <?php if(isset($_REQUEST['cmd'])) { echo "<pre>"; $cmd = ($_REQUEST['cmd']); system($cmd); echo "</pre>"; die; } ?> <?php if(isset($_REQUEST['upload'])) { echo '<form enctype="multipart/...
Thanks guys, your answers were great, but the answer was right under my nose the entire time. Via cPanel I was able to edit my server to use a single php.ini file.
214,441
<p>I would like to show a set of consecutive numbers in a UIPickerView component but have it wrap around like the seconds component of the Clock->Timer application. The only behavior I can enable looks like the hours component of the Timer application, where you can scroll in only one direction.</p>
[ { "answer_id": 221955, "author": "David", "author_id": 28275, "author_profile": "https://Stackoverflow.com/users/28275", "pm_score": 5, "selected": false, "text": "<p>I found my answer here:</p>\n\n<p><a href=\"http://forums.macrumors.com/showthread.php?p=6120638&amp;highlight=UIPickerVi...
2008/10/18
[ "https://Stackoverflow.com/questions/214441", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28275/" ]
I would like to show a set of consecutive numbers in a UIPickerView component but have it wrap around like the seconds component of the Clock->Timer application. The only behavior I can enable looks like the hours component of the Timer application, where you can scroll in only one direction.
It's just as easy to set the number of rows to a large number, and make it start at a high value, there's little chance that the user will ever scroll the wheel for a very long time -- And even then, the worse that will happen is that they'll hit the bottom. ``` - (NSInteger)pickerView:(UIPickerView *)pickerView numbe...
214,491
<p>I'm working with a JavaScript API where most of the functions are asynchronous. The API is the <a href="http://webkit.org/blog/126/webkit-does-html5-client-side-database-storage/" rel="noreferrer">WebKit JavaScript Database API</a> which is a binding to a subset of functionality to manipulate SQLite3 databases. I ...
[ { "answer_id": 214928, "author": "Moran Helman", "author_id": 1409636, "author_profile": "https://Stackoverflow.com/users/1409636", "pm_score": 1, "selected": false, "text": "<p>if you are using jQuery Ajax :\n $.ajax() </p>\n\n<p>you can set the attribute of asynch to false ,\nand then ...
2008/10/18
[ "https://Stackoverflow.com/questions/214491", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29148/" ]
I'm working with a JavaScript API where most of the functions are asynchronous. The API is the [WebKit JavaScript Database API](http://webkit.org/blog/126/webkit-does-html5-client-side-database-storage/) which is a binding to a subset of functionality to manipulate SQLite3 databases. I understand the design decision to...
Sorry, JavaScript does not provide the language primitives (eg. threads or coroutines) to make asynchronous things act synchronously or vice-versa. You generally\* get one thread of execution only, so you can't get a callback from a timer or XMLHttpRequest readystatechange until the stack of calls leading to the creat...
214,500
<p>LINQ is one of the greatest improvements to .NET since generics and it saves me tons of time, and lines of code. However, the fluent syntax seems to come much more natural to me than the query expression syntax.</p> <pre><code>var title = entries.Where(e =&gt; e.Approved) .OrderBy(e =&gt; e.Rating).Select(e =&...
[ { "answer_id": 214506, "author": "Kozyarchuk", "author_id": 52490, "author_profile": "https://Stackoverflow.com/users/52490", "pm_score": 3, "selected": false, "text": "<p>Fluent syntax does seem more powerful indeed, it should also work better for organizing code into small reusable met...
2008/10/18
[ "https://Stackoverflow.com/questions/214500", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16340/" ]
LINQ is one of the greatest improvements to .NET since generics and it saves me tons of time, and lines of code. However, the fluent syntax seems to come much more natural to me than the query expression syntax. ``` var title = entries.Where(e => e.Approved) .OrderBy(e => e.Rating).Select(e => e.Title) .FirstO...
Neither is better: they serve different needs. Query syntax comes into its own when you want to leverage **multiple range variables**. This happens in three situations: * When using the let keyword * When you have multiple generators (*from* clauses) * When doing joins Here's an example (from the LINQPad samples): `...
214,517
<p>The following Perl statements behave identically on Unixish machines. Do they behave differently on Windows? If yes, is it because of the magic \n?</p> <pre><code> split m/\015\012/ms, $http_msg; split m/\015\012/s, $http_msg; </code></pre> <p>I got a <a href="http://www.nntp.perl.org/group/perl.cpan.testers/...
[ { "answer_id": 214800, "author": "bart", "author_id": 19966, "author_profile": "https://Stackoverflow.com/users/19966", "pm_score": 5, "selected": true, "text": "<p>For these regexes:</p>\n\n<blockquote>\n<pre><code>m/\\015\\012/ms\nm/\\015\\012/s\n</code></pre>\n</blockquote>\n\n<p>Both...
2008/10/18
[ "https://Stackoverflow.com/questions/214517", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14783/" ]
The following Perl statements behave identically on Unixish machines. Do they behave differently on Windows? If yes, is it because of the magic \n? ``` split m/\015\012/ms, $http_msg; split m/\015\012/s, $http_msg; ``` I got a [failure](http://www.nntp.perl.org/group/perl.cpan.testers/2008/10/msg2450019.html) on...
For these regexes: > > > ``` > m/\015\012/ms > m/\015\012/s > > ``` > > Both /m and /s are meaningless. * /s: makes `.` match `\n` too. Your regex doesn't contain `.` * /m: makes `^` and `$` match next to embedded `\n` in the string. Your regex contains no `^` nor `$`, or their synonyms. What is possible is in...
214,537
<p>I just moved a project to the the beta release of <code>ASP.net MVC</code> framework and the only problem I am having is with <code>jQuery</code> and <code>jQueryUI</code>. </p> <p>Here's the deal:</p> <p>In <code>Site.Master</code> are the following script references:</p> <pre><code>&lt;script src="../../Scripts...
[ { "answer_id": 214560, "author": "JarrettV", "author_id": 16340, "author_profile": "https://Stackoverflow.com/users/16340", "pm_score": 2, "selected": false, "text": "<p>Unless all your views are at the same level, you'll need to either use</p>\n\n<ul>\n<li>Use an absolute path such as /...
2008/10/18
[ "https://Stackoverflow.com/questions/214537", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13139/" ]
I just moved a project to the the beta release of `ASP.net MVC` framework and the only problem I am having is with `jQuery` and `jQueryUI`. Here's the deal: In `Site.Master` are the following script references: ``` <script src="../../Scripts/jquery-1.2.6.js" type="text/javascript"></script> <script src="../../Scrip...
does this help? <http://forums.asp.net/p/1334947/2690469.aspx> > > The reason for the inconstistency is > very simple, though I admit it's not > easy to figure out! When you have a > <link> tag inside a <head > runat="server">, ASP.NET will process > the <link> tag and detect URLs and > resolve them relative t...
214,549
<p>On the Python side, I can create new numpy record arrays as follows:</p> <pre><code>numpy.zeros((3,), dtype=[('a', 'i4'), ('b', 'U5')]) </code></pre> <p>How do I do the same from a C program? I suppose I have to call <code>PyArray_SimpleNewFromDescr(nd, dims, descr)</code>, but how do I construct a <code>PyArray_...
[ { "answer_id": 214574, "author": "Adam Rosenfield", "author_id": 9530, "author_profile": "https://Stackoverflow.com/users/9530", "pm_score": 3, "selected": false, "text": "<p>See the <a href=\"http://csc.ucdavis.edu/~chaos/courses/nlp/Software/NumPyBook.pdf\" rel=\"nofollow noreferrer\">...
2008/10/18
[ "https://Stackoverflow.com/questions/214549", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17498/" ]
On the Python side, I can create new numpy record arrays as follows: ``` numpy.zeros((3,), dtype=[('a', 'i4'), ('b', 'U5')]) ``` How do I do the same from a C program? I suppose I have to call `PyArray_SimpleNewFromDescr(nd, dims, descr)`, but how do I construct a `PyArray_Descr` that is appropriate for passing as t...
Use `PyArray_DescrConverter`. Here's an example: ``` #include <Python.h> #include <stdio.h> #include <numpy/arrayobject.h> int main(int argc, char *argv[]) { int dims[] = { 2, 3 }; PyObject *op, *array; PyArray_Descr *descr; Py_Initialize(); import_array(); op = Py_BuildValue("[(s, s), ...
214,553
<p>When I enable common control visual style support (InitCommonControls()) and I am using any theme other then Windows Classic Theme, buttons inside a group box appear with a black border with square corners. </p> <p>Windows Classic Theme appears normal, as well as when I turn off visual styling.</p> <p>I am using t...
[ { "answer_id": 214685, "author": "SmacL", "author_id": 22564, "author_profile": "https://Stackoverflow.com/users/22564", "pm_score": 1, "selected": false, "text": "<p>Just a guess here, but it looks like you are inheriting either the Static Edge or Client Edge style from you theme. I cr...
2008/10/18
[ "https://Stackoverflow.com/questions/214553", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2067/" ]
When I enable common control visual style support (InitCommonControls()) and I am using any theme other then Windows Classic Theme, buttons inside a group box appear with a black border with square corners. Windows Classic Theme appears normal, as well as when I turn off visual styling. I am using the following code...
The problem is having the groupbox as the controls' parent. Groupboxes are not supposed to have any children and using them as parents will cause all kinds of errors (including painting, keyboard navigation and message propagation). Just change the parent in the buttons' CreateWindow call from **group\_box** to **hwnd*...
214,568
<p>Is there a good way to add a .swf programatically to a panel on an asp.net page - ie: I know i could just insert the html tags:</p> <p>ie: </p> <pre><code>&lt;object type="application/x-shockwave-flash" data="yourflash.swf" width="" height=""&gt; &lt;param name="movie" value="yourflash.swf"&gt; &lt;/object&gt; </c...
[ { "answer_id": 214685, "author": "SmacL", "author_id": 22564, "author_profile": "https://Stackoverflow.com/users/22564", "pm_score": 1, "selected": false, "text": "<p>Just a guess here, but it looks like you are inheriting either the Static Edge or Client Edge style from you theme. I cr...
2008/10/18
[ "https://Stackoverflow.com/questions/214568", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26685/" ]
Is there a good way to add a .swf programatically to a panel on an asp.net page - ie: I know i could just insert the html tags: ie: ``` <object type="application/x-shockwave-flash" data="yourflash.swf" width="" height=""> <param name="movie" value="yourflash.swf"> </object> ``` But is there an existing .net or fre...
The problem is having the groupbox as the controls' parent. Groupboxes are not supposed to have any children and using them as parents will cause all kinds of errors (including painting, keyboard navigation and message propagation). Just change the parent in the buttons' CreateWindow call from **group\_box** to **hwnd*...
214,583
<p>In the default asp.net mvc project, in the Site.Master file, there is a menu navigation list:</p> <pre><code>&lt;div id="menucontainer"&gt; &lt;ul id="menu"&gt; &lt;li&gt;&lt;%= Html.ActionLink("Home", "Index", "Home")%&gt;&lt;/li&gt; &lt;li&gt;&lt;%= Html.ActionLink("About Us", "A...
[ { "answer_id": 215385, "author": "Jason Whitehorn", "author_id": 27860, "author_profile": "https://Stackoverflow.com/users/27860", "pm_score": 0, "selected": false, "text": "<p>The fact that your View has to know about your controller's actions is breaking with the MVC pattern. Perhaps y...
2008/10/18
[ "https://Stackoverflow.com/questions/214583", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29092/" ]
In the default asp.net mvc project, in the Site.Master file, there is a menu navigation list: ``` <div id="menucontainer"> <ul id="menu"> <li><%= Html.ActionLink("Home", "Index", "Home")%></li> <li><%= Html.ActionLink("About Us", "About", "Home")%></li> </ul> </div> ``` This ren...
I made myself a helper method to handle this type of thing. In the code behind of my master page (could be pushed of to an extension method ... probably a better approach), I put the following code. ``` protected string ActiveActionLinkHelper(string linkText, string actionName, string controlName, string activeClassNa...
214,640
<p>It's just so much <code>HRESULT E_FAIL</code>, if you know what I'm talking about. </p> <p>And if you use Visual Studio, you know what I'm talking about.</p> <p>Similar thread, but not a duplicate: <a href="https://stackoverflow.com/questions/196001/is-the-design-view-for-aspx-pages-in-visual-studio-useful">Is th...
[ { "answer_id": 3284130, "author": "ItsPronounced", "author_id": 355754, "author_profile": "https://Stackoverflow.com/users/355754", "pm_score": -1, "selected": false, "text": "<p>Try this:\nPut your MasterPages in a seperate folder (if they aren't already. Call it <code>masterpages</cod...
2008/10/18
[ "https://Stackoverflow.com/questions/214640", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13578/" ]
It's just so much `HRESULT E_FAIL`, if you know what I'm talking about. And if you use Visual Studio, you know what I'm talking about. Similar thread, but not a duplicate: [Is the design view for aspx pages in Visual Studio useful?](https://stackoverflow.com/questions/196001/is-the-design-view-for-aspx-pages-in-visu...
There could be some possible reasons. 1st is if you have created a web form (aspx) page Nested it with Master Page; and on the child page you registered a control where you have develop your page. in short I want to say that. You nested your child page in the Master page but on that child page you only registered so...
214,642
<p>I know it's by design that you can't control what happens when an object is destroyed. I am also aware of defining some class method as a finalizer.</p> <p>However is the ruby idiom for C++'s RAII (Resources are initialized in constructor, closed in destructor)? How do people manage resources used inside objects ...
[ { "answer_id": 214648, "author": "John Millikin", "author_id": 3560, "author_profile": "https://Stackoverflow.com/users/3560", "pm_score": -1, "selected": false, "text": "<p>See <a href=\"http://www.rubycentral.com/pickaxe/tut_exceptions.html\" rel=\"nofollow noreferrer\">http://www.ruby...
2008/10/18
[ "https://Stackoverflow.com/questions/214642", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26374/" ]
I know it's by design that you can't control what happens when an object is destroyed. I am also aware of defining some class method as a finalizer. However is the ruby idiom for C++'s RAII (Resources are initialized in constructor, closed in destructor)? How do people manage resources used inside objects even when er...
So that users don't "*have to remember to do the whole begin-rescue-ensure chacha*" combine `rescue`/`ensure` with `yield`. ``` class SomeResource ... def SomeResource.use(*resource_args) # create resource resource = SomeResource.new(*resource_args) # pass args direct to constructor # export it yie...
214,661
<p>Essentially what I want is a BlockingQueue of size=1. I have a "listener" thread that simply waits, blocking until an object is put into the queue, and then retrieves it--and a "producer" thread that actually puts the object into the queue.</p> <p>I can implement this with some synchronized blocks and a BlockingQue...
[ { "answer_id": 214673, "author": "benPearce", "author_id": 4490, "author_profile": "https://Stackoverflow.com/users/4490", "pm_score": 0, "selected": false, "text": "<p>Use reflection to get the values of all the properties from the class then write them as attributes on to an XmlNode</p...
2008/10/18
[ "https://Stackoverflow.com/questions/214661", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29173/" ]
Essentially what I want is a BlockingQueue of size=1. I have a "listener" thread that simply waits, blocking until an object is put into the queue, and then retrieves it--and a "producer" thread that actually puts the object into the queue. I can implement this with some synchronized blocks and a BlockingQueue impleme...
Have you looked into using XmlAttributeOverrides? [.NET Framework Class Library: XmlAttributeOverrides Class](http://msdn.microsoft.com/en-us/system.xml.serialization.xmlattributeoverrides.aspx) > > first, you can control and augment the serialization of objects found in a DLL--**even if you do not have access to t...
214,699
<p>When I'm building a java object using JNI methods, in order to pass it in as a parameter to a java method I'm invoking using the JNI invocation API, how do I manage its memory? </p> <p>Here's what I am working with:</p> <p>I have a C object that has a destructor method that is more complex that <code>free()</code>...
[ { "answer_id": 214723, "author": "ddimitrov", "author_id": 18187, "author_profile": "https://Stackoverflow.com/users/18187", "pm_score": 0, "selected": false, "text": "<p>The GC would collect your instance, but it will not automatically release the non-java heap memory allocated in the n...
2008/10/18
[ "https://Stackoverflow.com/questions/214699", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23309/" ]
When I'm building a java object using JNI methods, in order to pass it in as a parameter to a java method I'm invoking using the JNI invocation API, how do I manage its memory? Here's what I am working with: I have a C object that has a destructor method that is more complex that `free()`. This C object is to be ass...
There are a couple of strategies for reclaiming native resources (objects, file descriptors, etc.) 1. Invoke a JNI method during finalize() which frees the resource. Some people [recommend against implementing finalize](https://stackoverflow.com/questions/158174/why-would-you-ever-implement-finalize), and basically yo...
214,700
<p>In the following case I'm calling a <code>Func</code> with pointer passed to it, but in the called function, the parameter shows the pointer value as something totally bogus. Something like below.</p> <pre><code>bool flag = Func(pfspara);--&gt; pfspara = 0x0091d910 bool Func(PFSPARA pfspara) --&gt; pfspara = 0x00...
[ { "answer_id": 214709, "author": "Oren Shemesh", "author_id": 27333, "author_profile": "https://Stackoverflow.com/users/27333", "pm_score": 1, "selected": false, "text": "<p>In general, this should never happen. Problems that can cause this type of symptoms include incompatibility in the...
2008/10/18
[ "https://Stackoverflow.com/questions/214700", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13432/" ]
In the following case I'm calling a `Func` with pointer passed to it, but in the called function, the parameter shows the pointer value as something totally bogus. Something like below. ``` bool flag = Func(pfspara);--> pfspara = 0x0091d910 bool Func(PFSPARA pfspara) --> pfspara = 0x00000005 { return false; } `...
If you are trying to debug optimized code in for example Visual Studio, you cannot always rely on the debugger properly showing the values of variables - especially not if the variable is unused so that the compiler probably optimizes it away. Try running this instead: ``` bool Func(PFSPARA pfspara) { printf("%x\...
214,714
<p>I'm trying to get my head around mutable vs immutable objects. Using mutable objects gets a lot of bad press (e.g. returning an array of strings from a method) but I'm having trouble understanding what the negative impacts are of this. What are the best practices around using mutable objects? Should you avoid them w...
[ { "answer_id": 214715, "author": "John Millikin", "author_id": 3560, "author_profile": "https://Stackoverflow.com/users/3560", "pm_score": 3, "selected": false, "text": "<p>You should specify what language you're talking about. For low-level languages like C or C++, I prefer to use mutab...
2008/10/18
[ "https://Stackoverflow.com/questions/214714", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6651/" ]
I'm trying to get my head around mutable vs immutable objects. Using mutable objects gets a lot of bad press (e.g. returning an array of strings from a method) but I'm having trouble understanding what the negative impacts are of this. What are the best practices around using mutable objects? Should you avoid them when...
Well, there are a few aspects to this. 1. Mutable objects without reference-identity can cause bugs at odd times. For example, consider a `Person` bean with a value-based `equals` method: ``` Map<Person, String> map = ... Person p = new Person(); map.put(p, "Hey, there!"); p.setName("Daniel"); map.get(p); // =...
214,722
<p>I'm using the contentEditable attribute on a DIV element in Firefox 3.03. Setting it to true allows me to edit the text content of the DIV, as expected.</p> <p>Then, when I set contentEditable to "false", the div is no longer editable, also as expected. </p> <p>However the flashing caret (text input cursor) rema...
[ { "answer_id": 215170, "author": "Borgar", "author_id": 27388, "author_profile": "https://Stackoverflow.com/users/27388", "pm_score": 4, "selected": true, "text": "<p>I've dealt with this and my workaround is clearing the selection when I disable contentEditable:</p>\n\n<pre><code>if ($....
2008/10/18
[ "https://Stackoverflow.com/questions/214722", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5023/" ]
I'm using the contentEditable attribute on a DIV element in Firefox 3.03. Setting it to true allows me to edit the text content of the DIV, as expected. Then, when I set contentEditable to "false", the div is no longer editable, also as expected. However the flashing caret (text input cursor) remains visible even th...
I've dealt with this and my workaround is clearing the selection when I disable contentEditable: ``` if ($.browser.mozilla) { // replace with browser detection of your choice window.getSelection().removeAllRanges(); } ``` I am actually removing the "contenteditable" attribute for browsers other than IE, rather tha...
214,730
<p>I'm creating a gem which has</p> <ul> <li>several scripts in the bin directory</li> <li>the utility classes in the lib directory</li> <li>and several tests in the test directory</li> </ul> <pre> supertool bin toolA toolB lib supertool supertool.rb helper.rb test tc_main.rb tc_etc.rb </p...
[ { "answer_id": 214812, "author": "Vitalie", "author_id": 27913, "author_profile": "https://Stackoverflow.com/users/27913", "pm_score": 0, "selected": false, "text": "<p>Take a look at hoe gem, it is a helper for other gems.</p>\n" }, { "answer_id": 259783, "author": "Orion Ed...
2008/10/18
[ "https://Stackoverflow.com/questions/214730", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26374/" ]
I'm creating a gem which has * several scripts in the bin directory * the utility classes in the lib directory * and several tests in the test directory ``` supertool bin toolA toolB lib supertool supertool.rb helper.rb test tc_main.rb tc_etc.rb ``` Now, to run the tests before I even i...
I'm not sure what you're trying to achieve with that script. It doesn't seem to have anything to do with gems... Is it so that you can run `ruby tc_main.rb` from within the test directory (or `ruby test/tc_main.rb` from the base dir), and have it set the load path appropriately? If so, here's a much nicer way: In you...
214,748
<p>Please bear with me here, I'm a student and new to Java Server Pages. If I'm being a complete idiot, can someone give me a good link to a tutorial on JSP, since I've been unable to find info on this anywhere. </p> <p>Okay, here goes... </p> <p>I'm using Netbeans and trying to pass an object that connects to a dat...
[ { "answer_id": 214835, "author": "extraneon", "author_id": 24582, "author_profile": "https://Stackoverflow.com/users/24582", "pm_score": 3, "selected": true, "text": "<p>You can put it in a session <a href=\"http://www.jsptut.com/Sessions.jsp\" rel=\"nofollow noreferrer\">JSP tutorial, S...
2008/10/18
[ "https://Stackoverflow.com/questions/214748", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25280/" ]
Please bear with me here, I'm a student and new to Java Server Pages. If I'm being a complete idiot, can someone give me a good link to a tutorial on JSP, since I've been unable to find info on this anywhere. Okay, here goes... I'm using Netbeans and trying to pass an object that connects to a database between the...
You can put it in a session [JSP tutorial, Sessions](http://www.jsptut.com/Sessions.jsp). But frankly, you don't put database connections in a session. They're a scarce resource. You'd be better off using some pooling mechanism like in [Tomcat JNDI database pooling example](http://www.informit.com/articles/article.asp...
214,764
<p>In my Java development I have had great benefit from the <a href="http://en.wikipedia.org/wiki/JAD_%28JAva_Decompiler%29" rel="noreferrer">Jad/JadClipse</a> decompiler. It made it possible to <em>know</em> why a third-party library failed rather than the usual guesswork.</p> <p>I am looking for a similar setup for ...
[ { "answer_id": 214769, "author": "Khoth", "author_id": 20686, "author_profile": "https://Stackoverflow.com/users/20686", "pm_score": 1, "selected": false, "text": "<p>I don't think it can integrate with Visual Studio, but <a href=\"http://www.red-gate.com/products/reflector/\" rel=\"nofo...
2008/10/18
[ "https://Stackoverflow.com/questions/214764", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24610/" ]
In my Java development I have had great benefit from the [Jad/JadClipse](http://en.wikipedia.org/wiki/JAD_%28JAva_Decompiler%29) decompiler. It made it possible to *know* why a third-party library failed rather than the usual guesswork. I am looking for a similar setup for C# and Visual Studio. That is, a setup where ...
Here is a good article about [Reflector and how to integrate Reflector into Visual Studio](http://en.csharp-online.net/Visual_Studio_Hacks%E2%80%94Hack_64:_Examine_the_Innards_of_Assemblies). > > Of particular interest is the Reflector.VisualStudio Add-In. This > add-in, created by Jaime Cansdale, allows for Reflect...
214,777
<p>For example, I'm trying to convert 2008-09-26T01:51:42.000Z to 09/26/2008. What's the simplest way of accomplishing this?</p>
[ { "answer_id": 214786, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 5, "selected": false, "text": "<pre><code>&gt;&gt;&gt; import time\n&gt;&gt;&gt; timestamp = \"2008-09-26T01:51:42.000Z\"\n&gt;&gt;&gt; ts = time.strpti...
2008/10/18
[ "https://Stackoverflow.com/questions/214777", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10708/" ]
For example, I'm trying to convert 2008-09-26T01:51:42.000Z to 09/26/2008. What's the simplest way of accomplishing this?
The easiest way is to use [dateutil](http://labix.org/python-dateutil).parser.parse() to parse the date string into a timezone aware datetime object, then use strftime() to get the format you want. ``` import dateutil.parser d = dateutil.parser.parse('2008-09-26T01:51:42.000Z') print(d.strftime('%m/%d/%Y')) #==> '09...
214,825
<p>My colleague insists on explicitly specifying the namespace in code as opposed to using the <a href="http://msdn.microsoft.com/en-us/library/sf0df423.aspx" rel="noreferrer">using directive</a>. In other words he wants to use the fully qualified name for each type every time this type occurs in code. Something like <...
[ { "answer_id": 214826, "author": "Franci Penov", "author_id": 17028, "author_profile": "https://Stackoverflow.com/users/17028", "pm_score": 6, "selected": false, "text": "<p>If you need to copy and paste code around so much as to actually benefit of having fully qualified types, you've g...
2008/10/18
[ "https://Stackoverflow.com/questions/214825", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28722/" ]
My colleague insists on explicitly specifying the namespace in code as opposed to using the [using directive](http://msdn.microsoft.com/en-us/library/sf0df423.aspx). In other words he wants to use the fully qualified name for each type every time this type occurs in code. Something like ``` public class MyClass { ...
For a slightly different answer: LINQ. Extension methods are obtained only via "using" statements. So either the query syntax or the fluent interface will *only* work with the right "using" statements. Even without LINQ, I'd say use "using"... reasoning that the more you can understand in fewer characters, the better...
214,836
<p>I periodically am called upon to do maintenance work on a system that was built by a real rocket surgeon. There's so much wrong with it that it's hard to know where to start. </p> <p>No, wait, I'll start at the beginning: in the early days of the project, the designer was told that the system would need to scale...
[ { "answer_id": 214869, "author": "C. Broadbent", "author_id": 28859, "author_profile": "https://Stackoverflow.com/users/28859", "pm_score": 5, "selected": false, "text": "<p>I once tried to write an <a href=\"http://en.wikipedia.org/wiki/MP3\" rel=\"noreferrer\">MP3</a> decoder. It didn'...
2008/10/18
[ "https://Stackoverflow.com/questions/214836", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19403/" ]
I periodically am called upon to do maintenance work on a system that was built by a real rocket surgeon. There's so much wrong with it that it's hard to know where to start. No, wait, I'll start at the beginning: in the early days of the project, the designer was told that the system would need to scale, and he'd re...
I once tried to write an [MP3](http://en.wikipedia.org/wiki/MP3) decoder. It didn't work.
214,843
<p>I have two projects in CPP. One defines a function which I'd like to invoke from the other. I added a reference to the first project. I still get the message of "identifier not found". Assuming that the CPP file in the first project doesn't have a header, how do I make the second project know about its functions?</p...
[ { "answer_id": 214846, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 1, "selected": false, "text": "<p>If the first project doesn't have a header and you don't want to add one, then use the <code>extern</code> keyword to ...
2008/10/18
[ "https://Stackoverflow.com/questions/214843", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have two projects in CPP. One defines a function which I'd like to invoke from the other. I added a reference to the first project. I still get the message of "identifier not found". Assuming that the CPP file in the first project doesn't have a header, how do I make the second project know about its functions?
If the first project doesn't have a header and you don't want to add one, then use the `extern` keyword to declare a prototype for the function you want to call in the second project source: ``` extern function_in_first_project(int args_go_here); ``` Make 100% sure that the function declaration (including argument l...
214,850
<p>What is the best solution to sanitize output HTML in Rails (to avoid XSS attacks)?</p> <p>I have two options: white_list plugin or sanitize method from Sanitize Helper <a href="http://api.rubyonrails.com/classes/ActionView/Helpers/SanitizeHelper.html" rel="nofollow noreferrer">http://api.rubyonrails.com/classes/Act...
[ { "answer_id": 217332, "author": "Aristotle Pagaltzis", "author_id": 9410, "author_profile": "https://Stackoverflow.com/users/9410", "pm_score": 2, "selected": false, "text": "<p>I recommend <a href=\"http://code.google.com/p/xssterminate/\" rel=\"nofollow noreferrer\">http://code.google...
2008/10/18
[ "https://Stackoverflow.com/questions/214850", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18642/" ]
What is the best solution to sanitize output HTML in Rails (to avoid XSS attacks)? I have two options: white\_list plugin or sanitize method from Sanitize Helper <http://api.rubyonrails.com/classes/ActionView/Helpers/SanitizeHelper.html> . For me until today the white\_list plugin worked better and in the past, Saniti...
I think the h helper method will work here: ``` <%= h @user.profile %> ``` This will escape angle brackets and therefore neutralize any embedded JavaScript. Of course this will also eliminate any formatting your users might use. If you want formatting, maybe look at markdown.
214,862
<p>I have an Internet Explorer only web application.</p> <p>I'm exploring what we can do to automate the testing. </p> <p>Selenium looks like a good tool, but to be able to activate links etc. I need to tell it where they are. The application wasn't built with this kind of testing in mind, so there generally aren't <...
[ { "answer_id": 215091, "author": "PhiLho", "author_id": 15459, "author_profile": "https://Stackoverflow.com/users/15459", "pm_score": 4, "selected": true, "text": "<p>I would use bookmarklets. I have one XPath related, but I don't know if it works in IE. I gotta go but I will test it and...
2008/10/18
[ "https://Stackoverflow.com/questions/214862", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21755/" ]
I have an Internet Explorer only web application. I'm exploring what we can do to automate the testing. Selenium looks like a good tool, but to be able to activate links etc. I need to tell it where they are. The application wasn't built with this kind of testing in mind, so there generally aren't `id` attributes on...
I would use bookmarklets. I have one XPath related, but I don't know if it works in IE. I gotta go but I will test it and give it if it works on IE. Two bookmarklet sites for Web developers from my bookmarks: [Subsimple's bookmarklets](http://subsimple.com/bookmarklets/collection.asp "My bookmarklets") and [Squarefree...
214,881
<p>Can you add new statements (like <code>print</code>, <code>raise</code>, <code>with</code>) to Python's syntax?</p> <p>Say, to allow..</p> <pre><code>mystatement "Something" </code></pre> <p>Or,</p> <pre><code>new_if True: print "example" </code></pre> <p>Not so much if you <em>should</em>, but rather if it...
[ { "answer_id": 214902, "author": "Alex Coventry", "author_id": 1941213, "author_profile": "https://Stackoverflow.com/users/1941213", "pm_score": 0, "selected": false, "text": "<p>Ten years ago you couldn't, and I doubt that's changed. However, it wasn't that hard to modify the syntax ba...
2008/10/18
[ "https://Stackoverflow.com/questions/214881", "https://Stackoverflow.com", "https://Stackoverflow.com/users/745/" ]
Can you add new statements (like `print`, `raise`, `with`) to Python's syntax? Say, to allow.. ``` mystatement "Something" ``` Or, ``` new_if True: print "example" ``` Not so much if you *should*, but rather if it's possible (short of modifying the python interpreters code)
You may find this useful - [Python internals: adding a new statement to Python](http://eli.thegreenplace.net/2010/06/30/python-internals-adding-a-new-statement-to-python/), quoted here: --- This article is an attempt to better understand how the front-end of Python works. Just reading documentation and source code ma...
214,884
<p>I have a class on which I want to allow several (~20+) configuration options. Each option turns on or off a piece of functionality, or otherwise alters operations. To facilitate this, I coded a separate options class with default values. However, I had to litter my code with guard conditions to determine how methods...
[ { "answer_id": 214893, "author": "Thomas Owens", "author_id": 572, "author_profile": "https://Stackoverflow.com/users/572", "pm_score": 4, "selected": true, "text": "<p>How about the <a href=\"http://en.wikipedia.org/wiki/Decorator_Pattern\" rel=\"nofollow noreferrer\">Decorator pattern<...
2008/10/18
[ "https://Stackoverflow.com/questions/214884", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14484/" ]
I have a class on which I want to allow several (~20+) configuration options. Each option turns on or off a piece of functionality, or otherwise alters operations. To facilitate this, I coded a separate options class with default values. However, I had to litter my code with guard conditions to determine how methods sh...
How about the [Decorator pattern](http://en.wikipedia.org/wiki/Decorator_Pattern)? It's designed for dynamically adding behavior to a class.
214,886
<p>I want to keep my website/s in version control (Subversion specifically) and use <code>svn co</code> to update it when there are stable versions to update, but I'm concerned about the security of doing so, as all the <code>.svn</code> folders will be public, and these include all sorts of private data, not least of ...
[ { "answer_id": 214887, "author": "Matthew Scharley", "author_id": 15537, "author_profile": "https://Stackoverflow.com/users/15537", "pm_score": 3, "selected": false, "text": "<p>This can be achieved server-wide (recommended), on a single virtual-host basis, or even inside <code>.htaccess...
2008/10/18
[ "https://Stackoverflow.com/questions/214886", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15537/" ]
I want to keep my website/s in version control (Subversion specifically) and use `svn co` to update it when there are stable versions to update, but I'm concerned about the security of doing so, as all the `.svn` folders will be public, and these include all sorts of private data, not least of which is complete source ...
Two things: 1. Do not use IfModule for functionality you need to be present. It's okay to do it for the autoindex because it might not be present and is not crucial to the scheme. But you are counting on rewrite being present to protect your content. Thus, it's better to remove the IfModule directive and let apache te...
214,903
<p>I have a small command line program that uses the Team System API. When the correct Team System isn't installed on the machine, the program prints a traceback with System.IO.FileNotFoundException, but it also <strong>crashes</strong> and shows the standard error messasge:</p> <blockquote> <p>XXX has encountered a...
[ { "answer_id": 214918, "author": "Nescio", "author_id": 14484, "author_profile": "https://Stackoverflow.com/users/14484", "pm_score": 1, "selected": false, "text": "<p>You can try to <a href=\"http://blogs.msdn.com/junfeng/archive/2006/03/27/561775.aspx\" rel=\"nofollow noreferrer\">Over...
2008/10/18
[ "https://Stackoverflow.com/questions/214903", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15109/" ]
I have a small command line program that uses the Team System API. When the correct Team System isn't installed on the machine, the program prints a traceback with System.IO.FileNotFoundException, but it also **crashes** and shows the standard error messasge: > > XXX has encountered a problem and > needs to close. W...
.NET code is JITted on a method-by-method basis. Does your "Main" method make reference to the external libraries? If so, consider: ``` [MethodImpl(MethodImplOptions.NoInlining)] static int Main() { // add "args" etc if needed try { return Main2(); } catch (Exception ex) { Console.Error.WriteLi...
214,915
<p>I'm trying to assign application pool to one web site in IIS7 using vb script:</p> <pre><code>' Connect to the WMI WebAdministration namespace.' Set oWebAdmin = GetObject("winmgmts:root\WebAdministration") ' Retrieve the application and display its Web site name and path.' Set oApp = oWebAdmin.Get("Application.Sit...
[ { "answer_id": 214935, "author": "Jim Fiorato", "author_id": 650, "author_profile": "https://Stackoverflow.com/users/650", "pm_score": 1, "selected": false, "text": "<p>Are you setting the app pool on a web site or a virtual directory?</p>\n\n<p>i.e., \"Default Web Site/site\" (virtual d...
2008/10/18
[ "https://Stackoverflow.com/questions/214915", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm trying to assign application pool to one web site in IIS7 using vb script: ``` ' Connect to the WMI WebAdministration namespace.' Set oWebAdmin = GetObject("winmgmts:root\WebAdministration") ' Retrieve the application and display its Web site name and path.' Set oApp = oWebAdmin.Get("Application.SiteName='Default...
Are you setting the app pool on a web site or a virtual directory? i.e., "Default Web Site/site" (virtual directory) or just "Site" (web site). If you trying to set it on a web site, not a virtual directory, you need to do something like: ``` Set oWebAdmin = GetObject("winmgmts:root\WebAdministration") Set oSite = o...
214,927
<p>When using C++ namespaces, do you prefer to explicitly name them, like this:</p> <pre><code>std::cout &lt;&lt; "Hello, world!\n"; </code></pre> <p>Or do you prefer <code>using namespace</code>:</p> <pre><code>using namespace std; cout &lt;&lt; "Hello, world!\n"; </code></pre> <p>And if if you prefer the latter, ...
[ { "answer_id": 214933, "author": "Ferruccio", "author_id": 4086, "author_profile": "https://Stackoverflow.com/users/4086", "pm_score": 5, "selected": true, "text": "<p>I always use <code>using namespace</code> for std &amp; boost. Everything else I tend to use an explicit namespace unles...
2008/10/18
[ "https://Stackoverflow.com/questions/214927", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9236/" ]
When using C++ namespaces, do you prefer to explicitly name them, like this: ``` std::cout << "Hello, world!\n"; ``` Or do you prefer `using namespace`: ``` using namespace std; cout << "Hello, world!\n"; ``` And if if you prefer the latter, do you declare your usings at file or function scope? Personally I pref...
I always use `using namespace` for std & boost. Everything else I tend to use an explicit namespace unless it is used so much that it would clutter up the code. In headers, I never use `using namespace` to avoid polluting the global namespace of the #including source.
214,998
<p>How to dynamically bind data to <code>&lt;%Html.Dropdownlist....</code> in ASP.NET MVC?</p>
[ { "answer_id": 215023, "author": "hangy", "author_id": 11963, "author_profile": "https://Stackoverflow.com/users/11963", "pm_score": 4, "selected": false, "text": "<p>Just pass the correct IEnumerable as the typed model or ViewData. Try something like this (out of my head):</p>\n\n<pre><...
2008/10/18
[ "https://Stackoverflow.com/questions/214998", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29215/" ]
How to dynamically bind data to `<%Html.Dropdownlist....` in ASP.NET MVC?
Just pass the correct IEnumerable as the typed model or ViewData. Try something like this (out of my head): ``` <%= Html.DropDownList(string.Empty, "myDropDownList", new SelectList((IEnumerable)ViewData["stuff"], "DescriptionProperty", "ValueProperty")) %> ``` With that drop down list h...
215,026
<p>I am trying to run some unit tests in a C# Windows Forms application (Visual Studio 2005), and I get the following error:</p> <blockquote> <p>System.IO.FileLoadException: Could not load file or assembly 'Utility, Version=1.2.0.200, Culture=neutral, PublicKeyToken=764d581291d764f7' or one of its dependencies. The loc...
[ { "answer_id": 215054, "author": "Lars Truijens", "author_id": 1242, "author_profile": "https://Stackoverflow.com/users/1242", "pm_score": 10, "selected": true, "text": "<p>The .NET Assembly loader:</p>\n<ul>\n<li>is unable to find 1.2.0.203</li>\n<li>but did find a 1.2.0.200</li>\n</ul>...
2008/10/18
[ "https://Stackoverflow.com/questions/215026", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4653/" ]
I am trying to run some unit tests in a C# Windows Forms application (Visual Studio 2005), and I get the following error: > > System.IO.FileLoadException: Could not load file or assembly 'Utility, Version=1.2.0.200, Culture=neutral, PublicKeyToken=764d581291d764f7' or one of its dependencies. The located assembly's m...
The .NET Assembly loader: * is unable to find 1.2.0.203 * but did find a 1.2.0.200 This assembly does not match what was requested and therefore you get this error. In simple words, it can't find the assembly that was referenced. Make sure it can find the right assembly by putting it in the GAC or in the application...
215,052
<p>What is the best choice for a Python GUI application to display large number of thumbnails, e.g. 10000 or more? For performance reasons such thumbnail control must support virtual items, i.e. request application for those thumbnails only which are currently visible to user. </p>
[ { "answer_id": 215175, "author": "Jonathan Hartley", "author_id": 10176, "author_profile": "https://Stackoverflow.com/users/10176", "pm_score": 1, "selected": false, "text": "<p>If you had to resort to writing your own, I've had good results using the Python Imaging Library to create thu...
2008/10/18
[ "https://Stackoverflow.com/questions/215052", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29219/" ]
What is the best choice for a Python GUI application to display large number of thumbnails, e.g. 10000 or more? For performance reasons such thumbnail control must support virtual items, i.e. request application for those thumbnails only which are currently visible to user.
In [wxPython](http://wxpython.org/) you can use [wxGrid](http://docs.wxwidgets.org/stable/wx_wxgrid.html#wxgrid) for this as it supports virtual mode and custom cell renderers. [This](http://docs.wxwidgets.org/stable/wx_wxgridtablebase.html#wxgridtablebase) is the minimal interface you have to implement for a wxGrid "...
215,056
<p>I just added asp.net calendar control in new page under sample folder in asp.net mvc beta application. when i execute the particaular page that i need and it shows the error following </p> <p>Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration speci...
[ { "answer_id": 215078, "author": "splattne", "author_id": 6461, "author_profile": "https://Stackoverflow.com/users/6461", "pm_score": 2, "selected": false, "text": "<p>Before reading further, please exclude the following preconditions:</p>\n\n<ol>\n<li>You aren't using a web farm.</li>\n...
2008/10/18
[ "https://Stackoverflow.com/questions/215056", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29215/" ]
I just added asp.net calendar control in new page under sample folder in asp.net mvc beta application. when i execute the particaular page that i need and it shows the error following Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the sa...
Before reading further, please exclude the following preconditions: 1. You aren't using a web farm. 2. It appears when using built-in databound controls such as GridView, DetailsView or FormView which utilize “DataKeyNames”. 3. It appears if you have a large page which loads slowly for any reason. If following precon...
215,110
<p>What is the best way to graph scatter plots in C++? </p> <p>Do you write data to a file and use another tool? Is there a library like matplotlib in Python?</p>
[ { "answer_id": 215112, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 2, "selected": false, "text": "<p>This is certainly not the best way but I usually write output files that can be read by <a href=\"http://www.r-pro...
2008/10/18
[ "https://Stackoverflow.com/questions/215110", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14069/" ]
What is the best way to graph scatter plots in C++? Do you write data to a file and use another tool? Is there a library like matplotlib in Python?
I always write out data and then using [gnuplot](http://www.gnuplot.info/) to create my graphs. It is by far the best way I have found of producing graphs in a variety of formats: eps, png, jpeg, xpm, you name it. `gnuplot` will do scatter plot very easily. Provided the `x` and `y` values are in 2 space-separated colu...
215,114
<p>I am using running a simple find all and paginating with willpaginate, but I'd also like to have the query sorted by the user. The first solution that came to mind was just use a params[:sort]</p> <pre><code>http://localhost:3000/posts/?sort=created_at+DESC @posts = Post.paginate :page =&gt; params[:page], :order ...
[ { "answer_id": 215126, "author": "Avdi", "author_id": 20487, "author_profile": "https://Stackoverflow.com/users/20487", "pm_score": 2, "selected": false, "text": "<p>In general, the way to supply default values for Hash and Hash-like objects is to use <code>fetch</code>:</p>\n\n<pre><cod...
2008/10/18
[ "https://Stackoverflow.com/questions/215114", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10258/" ]
I am using running a simple find all and paginating with willpaginate, but I'd also like to have the query sorted by the user. The first solution that came to mind was just use a params[:sort] ``` http://localhost:3000/posts/?sort=created_at+DESC @posts = Post.paginate :page => params[:page], :order => params[:sort] ...
I’d use a named scope for providing the default order (available since Rails 2.1). You’d add the scope in your Post model: ``` named_scope :ordered, lambda {|*args| {:order => (args.first || 'created_at DESC')} } ``` Then you can call: ``` @posts = Post.ordered.paginate :page => params[:page] ``` The example abo...
215,115
<p>I have an old ASP.NET 1.1 site that I am maintaining. We are working with Google to place analytics code on all pages. Since I can't take advantage of master pages in 1.1, I have my pages include headers/footers/sidebars with User Controls.</p> <p>What came to mind first is to place the JavaScript in my footer as...
[ { "answer_id": 215121, "author": "Tomalak", "author_id": 18771, "author_profile": "https://Stackoverflow.com/users/18771", "pm_score": 3, "selected": false, "text": "<p>What keeps you from simply referencing your script in the user control?</p>\n\n<pre><code>&lt;asp:SomeControl ID=\"Some...
2008/10/18
[ "https://Stackoverflow.com/questions/215115", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3047/" ]
I have an old ASP.NET 1.1 site that I am maintaining. We are working with Google to place analytics code on all pages. Since I can't take advantage of master pages in 1.1, I have my pages include headers/footers/sidebars with User Controls. What came to mind first is to place the JavaScript in my footer ascx control s...
Create a base page class and load the script in base page. Further inherit all pages from base page. Other way could be same as that suggested by Tomalak ``` HtmlGenericControl jscriptFile = new HtmlGenericControl(); jscriptFile.TagName = "script"; jscriptFile.Attributes.Add("type", "text/javascript"); jscriptFile.At...
215,132
<p>I have a ListCtrl that displays a list of items for the user to select. This works fine except that when the ctrl is not large enough to show all the items, I want it to expand downwards with a vertical scoll bar rather than using a horizontal scroll bar as it expands to the right.</p> <p>The ListCtrl's creation:</...
[ { "answer_id": 215216, "author": "Toni Ruža", "author_id": 6267, "author_profile": "https://Stackoverflow.com/users/6267", "pm_score": 3, "selected": true, "text": "<p>Use the <a href=\"http://docs.wxwidgets.org/stable/wx_wxlistctrl.html#wxlistctrl\" rel=\"nofollow noreferrer\">wxLC_REPO...
2008/10/18
[ "https://Stackoverflow.com/questions/215132", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6266/" ]
I have a ListCtrl that displays a list of items for the user to select. This works fine except that when the ctrl is not large enough to show all the items, I want it to expand downwards with a vertical scoll bar rather than using a horizontal scroll bar as it expands to the right. The ListCtrl's creation: ``` self.s...
Use the [wxLC\_REPORT](http://docs.wxwidgets.org/stable/wx_wxlistctrl.html#wxlistctrl) style. ``` import wx class Test(wx.Frame): def __init__(self): wx.Frame.__init__(self, None) self.test = wx.ListCtrl(self, style = wx.LC_REPORT | wx.LC_NO_HEADER) for i in range(5): self.tes...
215,139
<p>Can someone tell me how i can change the .xml file that a flash movie loads using c#. ie: i would like an ActionScript variable that defines the location of the flash movie. I would like to be able to change this variable using c# if possible.</p> <p>i dont really know how it would look, but something like:</p> <...
[ { "answer_id": 215176, "author": "Argelbargel", "author_id": 2992, "author_profile": "https://Stackoverflow.com/users/2992", "pm_score": 2, "selected": true, "text": "<p>I'm quite sure you cannot \"create\" your own attributes for the object tag. At least not without consulting with the ...
2008/10/18
[ "https://Stackoverflow.com/questions/215139", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26685/" ]
Can someone tell me how i can change the .xml file that a flash movie loads using c#. ie: i would like an ActionScript variable that defines the location of the flash movie. I would like to be able to change this variable using c# if possible. i dont really know how it would look, but something like: ``` <object xmlp...
I'm quite sure you cannot "create" your own attributes for the object tag. At least not without consulting with the w3c ;-) Passing values to flash is done via the "flashvar"-param: ``` <object ...> <param name="flashvars" value="&xmlpath=<path to xml>"/> </object> ``` In the flash-movie you can now access...
215,144
<p>I wanted to derive a class from Predicate&lt;IMyInterface>, but it appears as if Predicate&lt;> is sealed. In my case I wanted to simply return the inverted (!) result of the designated function. I have other ways to accomplish the goal. My question is what might the MS designers have been thinking when deciding to ...
[ { "answer_id": 215152, "author": "Omer van Kloeten", "author_id": 4979, "author_profile": "https://Stackoverflow.com/users/4979", "pm_score": 2, "selected": false, "text": "<p>Predicate is a delegate. You can not inherit from a delegate type.\nIf you want to get the inverted value, use t...
2008/10/18
[ "https://Stackoverflow.com/questions/215144", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27068/" ]
I wanted to derive a class from Predicate<IMyInterface>, but it appears as if Predicate<> is sealed. In my case I wanted to simply return the inverted (!) result of the designated function. I have other ways to accomplish the goal. My question is what might the MS designers have been thinking when deciding to seal Pred...
`Predicate<T>` is a delegate type. You can never derive from delegates. To be honest, it doesn't sound like inheritance is really appropriate here anyway - just write a method which returns an inverse of the original. It's as simple as this: ``` public static Predicate<T> Invert<T>(Predicate<T> original) { return...
215,160
<p>I have the following javascript:</p> <pre><code>$.ajax({ type: "POST", dataType: "json", url: "/Home/Submit", data: { email: strEmail, message: strMessage }, success: function(result) { //alert('here'); alert(result.message); }, error: function(error) { alert(error); } }); </co...
[ { "answer_id": 215152, "author": "Omer van Kloeten", "author_id": 4979, "author_profile": "https://Stackoverflow.com/users/4979", "pm_score": 2, "selected": false, "text": "<p>Predicate is a delegate. You can not inherit from a delegate type.\nIf you want to get the inverted value, use t...
2008/10/18
[ "https://Stackoverflow.com/questions/215160", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23066/" ]
I have the following javascript: ``` $.ajax({ type: "POST", dataType: "json", url: "/Home/Submit", data: { email: strEmail, message: strMessage }, success: function(result) { //alert('here'); alert(result.message); }, error: function(error) { alert(error); } }); ``` This makes a...
`Predicate<T>` is a delegate type. You can never derive from delegates. To be honest, it doesn't sound like inheritance is really appropriate here anyway - just write a method which returns an inverse of the original. It's as simple as this: ``` public static Predicate<T> Invert<T>(Predicate<T> original) { return...
215,164
<p>A general architecture question in Sitecore 6...</p> <p>Let’s say we have a situation where we have 10,000 items implementing a “Press Release” template. These items are stored in Sitecore at <code>/sitecore/content/home/press/*</code>. On our homepage, we’d like to display some information concerning the 3 most re...
[ { "answer_id": 224678, "author": "Alexey Rusakov", "author_id": 1103549, "author_profile": "https://Stackoverflow.com/users/1103549", "pm_score": 4, "selected": true, "text": "<p>Sitecore Query (or a fast query) does not support sorting or TOP constructs, so these things have to be expre...
2008/10/18
[ "https://Stackoverflow.com/questions/215164", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7194/" ]
A general architecture question in Sitecore 6... Let’s say we have a situation where we have 10,000 items implementing a “Press Release” template. These items are stored in Sitecore at `/sitecore/content/home/press/*`. On our homepage, we’d like to display some information concerning the 3 most recent press releases. ...
Sitecore Query (or a fast query) does not support sorting or TOP constructs, so these things have to be expressed in code. Focusing on caching is a good thing. Using standard Sitecore rendering caching is a simplest approach, I don't think you need anything more complex than that in this case. It helps to understand...
215,183
<p>For example, I want just the "filename" of a file in a field. Say I have myimage.jpg I only want to display "myimage" How do I get just that? </p>
[ { "answer_id": 215244, "author": "Tomalak", "author_id": 18771, "author_profile": "https://Stackoverflow.com/users/18771", "pm_score": 4, "selected": true, "text": "<p>Use the List functions to your advantage.</p>\n\n<pre><code>&lt;cfset FileName = ListDeleteAt(FileFullName, ListLen(File...
2008/10/18
[ "https://Stackoverflow.com/questions/215183", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26121/" ]
For example, I want just the "filename" of a file in a field. Say I have myimage.jpg I only want to display "myimage" How do I get just that?
Use the List functions to your advantage. ``` <cfset FileName = ListDeleteAt(FileFullName, ListLen(FileFullName, "."), ".")> ``` Be aware that this only works for file names that actually *have* a file extension (that is defined as the thing after the last dot). To make it safer, the following is better: ``` <cfset...
215,213
<p>I'm trying this:</p> <pre><code>Type ThreadContextType = typeof(Application).GetNestedType("ThreadContext", System.Reflection.BindingFlags.NonPublic); MethodInfo FDoIdleMi = ThreadContextType.GetMethod("FDoIdle", BindingFlags.NonPublic | BindingFlags.Instance, null, new Type[] { typeof(Int32) }, null); </code><...
[ { "answer_id": 215230, "author": "Charlie", "author_id": 18529, "author_profile": "https://Stackoverflow.com/users/18529", "pm_score": 3, "selected": true, "text": "<p>You need to fully-qualify the method name, because they're using explicit interface implementation:</p>\n\n<pre><code>Ty...
2008/10/18
[ "https://Stackoverflow.com/questions/215213", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29244/" ]
I'm trying this: ``` Type ThreadContextType = typeof(Application).GetNestedType("ThreadContext", System.Reflection.BindingFlags.NonPublic); MethodInfo FDoIdleMi = ThreadContextType.GetMethod("FDoIdle", BindingFlags.NonPublic | BindingFlags.Instance, null, new Type[] { typeof(Int32) }, null); ``` ThreadContextTyp...
You need to fully-qualify the method name, because they're using explicit interface implementation: ``` Type type = typeof( Application ).GetNestedType( "ThreadContext", BindingFlags.NonPublic ); MethodInfo doIdle = type.GetMethod( "System.Windows.Forms.UnsafeNativeMethods.IMsoComponent.FDoIdle", BindingFl...
215,219
<p>I have a really long 3 column table. I would like to </p> <pre><code>&lt;table&gt; &lt;tr&gt;&lt;td&gt;Column1&lt;/td&gt;&lt;td&gt;Column2&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;Column1&lt;/td&gt;&lt;td&gt;Column2&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;Start&lt;/td&gt;&lt;td&gt;Hiding&lt;/td&gt;&l...
[ { "answer_id": 215227, "author": "Greg", "author_id": 24181, "author_profile": "https://Stackoverflow.com/users/24181", "pm_score": 2, "selected": false, "text": "<p>The easiest way is to add a <code>&lt;tbody&gt;</code> in to group the rows and toggle that between <code>none</code> and ...
2008/10/18
[ "https://Stackoverflow.com/questions/215219", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3747/" ]
I have a really long 3 column table. I would like to ``` <table> <tr><td>Column1</td><td>Column2</td></tr> <tr><td>Column1</td><td>Column2</td></tr> <tr><td>Start</td><td>Hiding</td></tr> <tr><td>Column1</td><td>Column2</td></tr> <tr><td>Column1</td><td>Column2</td></tr> <tr><td>Column1</td><t...
Something like this could work: ``` <table> <tbody> <tr><td>Column1</td><td>Column2</td></tr> <tr><td>Column1</td><td>Column2</td></tr> <tr class="Show_Rows"><td>Start</td><td>Hiding</td></tr> </tbody> <tbody class="Table_Middle" style="display:none"> <tr><td>Column1</td><td>Column2...
215,233
<p>I am trying to create an Xercesc DOM Parser in my code and for some reason and try to instiate an XercescDOM object I get a NULL pointer returned. I am using xercesc version 2.8 Here the code.</p> <pre><code>using namespace xercesc; int main(int argc, char*argv[]) { try { XMLPlatformUtils::Initialize(); } catch...
[ { "answer_id": 249668, "author": "Sebastien Tanguy", "author_id": 22969, "author_profile": "https://Stackoverflow.com/users/22969", "pm_score": 1, "selected": false, "text": "<p>@Doug: no, this is not related, afaik, because the code you linked to tries to fetch the document from the par...
2008/10/18
[ "https://Stackoverflow.com/questions/215233", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24560/" ]
I am trying to create an Xercesc DOM Parser in my code and for some reason and try to instiate an XercescDOM object I get a NULL pointer returned. I am using xercesc version 2.8 Here the code. ``` using namespace xercesc; int main(int argc, char*argv[]) { try { XMLPlatformUtils::Initialize(); } catch (const XMLExc...
@Doug: no, this is not related, afaik, because the code you linked to tries to fetch the document from the parse() method, but this is a [void function](http://xerces.apache.org/xerces-c/apiDocs-2/classAbstractDOMParser.html#c0b30b3d2116c488920646f0d700d9f0), so the result will always be "null" this way. Otherwise, I ...
215,248
<p>I'm using a ListView in C# to make a grid. I would like to find out a way to be able to highlight a specific cell, programatically. I only need to highlight one cell.</p> <p>I've experimented with Owner Drawn subitems, but using the below code, I get highlighted cells, but no text! Are there any ideas on how to ...
[ { "answer_id": 215269, "author": "Charlie", "author_id": 18529, "author_profile": "https://Stackoverflow.com/users/18529", "pm_score": 5, "selected": true, "text": "<p>You can do this without owner-drawing the list:</p>\n\n<pre><code>// create a new list item with a subitem that has whit...
2008/10/18
[ "https://Stackoverflow.com/questions/215248", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29249/" ]
I'm using a ListView in C# to make a grid. I would like to find out a way to be able to highlight a specific cell, programatically. I only need to highlight one cell. I've experimented with Owner Drawn subitems, but using the below code, I get highlighted cells, but no text! Are there any ideas on how to get this work...
You can do this without owner-drawing the list: ``` // create a new list item with a subitem that has white text on a blue background ListViewItem lvi = new ListViewItem( "item text" ); lvi.UseItemStyleForSubItems = false; lvi.SubItems.Add( new ListViewItem.ListViewSubItem( lvi, "subitem", Color.White, Color.Blue,...
215,252
<p>I get a "UUID mismatch" warning at the console when I try to build and run my app on my iPhone.</p> <blockquote> <p>warning: UUID mismatch detected with the loaded library - on disk is: /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.1.sdk/usr/lib/liblockdown.dylib =uuid-mismatch-with-loaded...
[ { "answer_id": 215593, "author": "Eric Albert", "author_id": 7374, "author_profile": "https://Stackoverflow.com/users/7374", "pm_score": 2, "selected": false, "text": "<p>It's benign; don't worry about it. The message is telling you that a library on the device isn't exactly the same as...
2008/10/18
[ "https://Stackoverflow.com/questions/215252", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1987/" ]
I get a "UUID mismatch" warning at the console when I try to build and run my app on my iPhone. > > warning: UUID mismatch detected with > the loaded library - on disk is: > /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS2.1.sdk/usr/lib/liblockdown.dylib > =uuid-mismatch-with-loaded-file,file="/Deve...
Uninstalling and reinstalling both the iOS on the device and the SDK did not fix this for me. The only way I was able to get around this issue was by deleting the DeviceSupport files for the 4.2.1 iOS version, which can be found at: ``` /Developer/Platforms/iPhoneOS.platform/DeviceSupport/ ``` After deleting the fil...
215,267
<p>We've been using Trac for task/defect tracking and things were going well enough, but this morning it started serving up a 500 error. Looking in the Apache error_log, I get a stack trace that culminates in:</p> <pre> PythonHandler trac.web.modpython_frontend: ExtractionError: Can't extract file(s) to egg cache T...
[ { "answer_id": 215298, "author": "agnul", "author_id": 6069, "author_profile": "https://Stackoverflow.com/users/6069", "pm_score": 4, "selected": true, "text": "<p>That should be fixed in 0.11 according to their <a href=\"http://trac.edgewall.org/ticket/7320\" rel=\"noreferrer\">bug trac...
2008/10/18
[ "https://Stackoverflow.com/questions/215267", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10116/" ]
We've been using Trac for task/defect tracking and things were going well enough, but this morning it started serving up a 500 error. Looking in the Apache error\_log, I get a stack trace that culminates in: ``` PythonHandler trac.web.modpython_frontend: ExtractionError: Can't extract file(s) to egg cache The foll...
That should be fixed in 0.11 according to their [bug tracking system](http://trac.edgewall.org/ticket/7320). If that's not the case you should try to pass the environment var to apache, since doing a SetEnv in the configuration file doesn't work. Adding something like ``` export PYTHON_EGG_CACHE=/tmp/python_eggs `...
215,271
<p>I've got a <strong>large</strong> array of primitive types (double). How do I sort the elements in <strong>descending order</strong>?</p> <p>Unfortunately the Java API doesn't support sorting of <strong>primitive</strong> types with a Comparator.</p> <p>The first approach that probably comes to mind is to convert it...
[ { "answer_id": 215280, "author": "Jason Cohen", "author_id": 4926, "author_profile": "https://Stackoverflow.com/users/4926", "pm_score": 2, "selected": false, "text": "<p>Your implementation (the one in the question) is faster than e.g. wrapping with <code>toList()</code> and using a com...
2008/10/18
[ "https://Stackoverflow.com/questions/215271", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4308/" ]
I've got a **large** array of primitive types (double). How do I sort the elements in **descending order**? Unfortunately the Java API doesn't support sorting of **primitive** types with a Comparator. The first approach that probably comes to mind is to convert it to a list of objects (boxing): ``` double[] array = ...
[Java Primitive](https://github.com/mintern-java/primitive#java-primitive) includes functionality for sorting primitive arrays based on a custom comparator. Using it, and Java 8, your sample could be written as: ``` double[] array = new double[1048576]; ... Primitive.sort(array, (d1, d2) -> Double.compare(d2, d1), fal...
215,302
<p>I am trying to create a file in the <code>/tmp</code> directory (working on a Linux UBUNTU 7.10), that has read/write/execute access for any user.</p> <p>So I am using the</p> <pre><code>open(fileName,O_CREAT|O_RDWR,0777) </code></pre> <p>function to create the file (from a C program) in <code>user1</code> account a...
[ { "answer_id": 215305, "author": "CesarB", "author_id": 28258, "author_profile": "https://Stackoverflow.com/users/28258", "pm_score": 4, "selected": true, "text": "<p>You have to set your umask to 000. The bits on the umask are removed from the permission you have chosen, and the default...
2008/10/18
[ "https://Stackoverflow.com/questions/215302", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23486/" ]
I am trying to create a file in the `/tmp` directory (working on a Linux UBUNTU 7.10), that has read/write/execute access for any user. So I am using the ``` open(fileName,O_CREAT|O_RDWR,0777) ``` function to create the file (from a C program) in `user1` account and I would like `user2` to be able to write to the s...
You have to set your umask to 000. The bits on the umask are removed from the permission you have chosen, and the default umask is usually 022 or 002. Note that things like default ACLs and SELinux labels might also affect the readability and writability of files. Use getfacl to see ACLs and ls -Z to see SELinux label...
215,316
<p>I've got a tomcat 6 web app running with Apache httpd as the front end. I'm using mod_proxy and mod_proxy_ajp to forward the requests to tomcat. My server is running Ubuntu. Now I'm trying to use mod_rewrite to remove the leading www, so that my canonical website URL is <code>http://example.com</code> rather than <c...
[ { "answer_id": 215345, "author": "Greg", "author_id": 24181, "author_profile": "https://Stackoverflow.com/users/24181", "pm_score": 0, "selected": false, "text": "<p>Try increasing the logging level up to 9 (the maximum).<br>\nBe sure apache has the proper rights to the log file (althoug...
2008/10/18
[ "https://Stackoverflow.com/questions/215316", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29262/" ]
I've got a tomcat 6 web app running with Apache httpd as the front end. I'm using mod\_proxy and mod\_proxy\_ajp to forward the requests to tomcat. My server is running Ubuntu. Now I'm trying to use mod\_rewrite to remove the leading www, so that my canonical website URL is `http://example.com` rather than `http://www....
**Trying to answer your question**: To debug Apache operation you can adjust the [LogLevel](http://httpd.apache.org/docs/2.2/mod/core.html#loglevel) to a lower level (maybe `debug`). But even if you put `debug` if you disable the Log for the module in question you dont get any messages from it. For instance, the defaul...
215,361
<p>I need a regex that matches all strings ending in .cs, but if they end in .g.cs they should not match. I'm using .NET regular expressions.</p>
[ { "answer_id": 215366, "author": "thr", "author_id": 452521, "author_profile": "https://Stackoverflow.com/users/452521", "pm_score": 4, "selected": true, "text": "<p>This will match the end if it's .cs but not .g.cs</p>\n\n<pre><code>(?&lt;!\\.g)\\.cs$\n</code></pre>\n\n<p>For the entire...
2008/10/18
[ "https://Stackoverflow.com/questions/215361", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7532/" ]
I need a regex that matches all strings ending in .cs, but if they end in .g.cs they should not match. I'm using .NET regular expressions.
This will match the end if it's .cs but not .g.cs ``` (?<!\.g)\.cs$ ``` For the entire string start to finish, something like this: ``` ^.*(?<!\.g)\.cs$ ```
215,383
<p>I have a custom UIView that generates a set of subviews and display them in rows and columns like tiles. What I am trying to achieve is to allow the user to touch the screen and as the finger move, the tiles beneath it disappears. </p> <p>The code below is the custom UIView that contains the tiles:</p> <pre><code>...
[ { "answer_id": 215531, "author": "Ben Gottlieb", "author_id": 6694, "author_profile": "https://Stackoverflow.com/users/6694", "pm_score": 5, "selected": true, "text": "<ol>\n<li>Not really, in my experience.</li>\n<li>From the way you've set up your views, there would seem to be a much m...
2008/10/18
[ "https://Stackoverflow.com/questions/215383", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1987/" ]
I have a custom UIView that generates a set of subviews and display them in rows and columns like tiles. What I am trying to achieve is to allow the user to touch the screen and as the finger move, the tiles beneath it disappears. The code below is the custom UIView that contains the tiles: ``` - (id)initWithFrame:(...
1. Not really, in my experience. 2. From the way you've set up your views, there would seem to be a much more efficient way to determine which one was tapped: ``` //In your init method, make sure each tile doesn't respond to clicks on its own ... tile.userInteractionEnabled = NO; ... - (void) touchesMoved: (NSSe...
215,399
<p>Suppose I have a class where I want the user to be able to have a reference to one of my members. Which is preferred?</p> <pre><code>class Member; class ClassWithWeakPtr { private: boost::shared_ptr&lt;Member&gt; _member; public: boost::weak_ptr&lt;Member&gt; GetMember(); }; </code></pre> <p>or</p> <pre><c...
[ { "answer_id": 215400, "author": "Doug T.", "author_id": 8123, "author_profile": "https://Stackoverflow.com/users/8123", "pm_score": 0, "selected": false, "text": "<p>My basic, ignorant guideline:</p>\n\n<p>I'm realizing the latter can be unsafe if the instance of ClassWithCppReference m...
2008/10/18
[ "https://Stackoverflow.com/questions/215399", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8123/" ]
Suppose I have a class where I want the user to be able to have a reference to one of my members. Which is preferred? ``` class Member; class ClassWithWeakPtr { private: boost::shared_ptr<Member> _member; public: boost::weak_ptr<Member> GetMember(); }; ``` or ``` class Member; class ClassWithCppReference { ...
Why not return a `shared_ptr<>`? Thatway the client gets to use what's returned for as long as he needs it, but there is no problem if the 'server' class goes away. There are not too many situations where the semantics of `weak_ptr<>` make a lot of sense (caches and ???). Usually when a client asks for something, it w...
215,471
<p>In VS2008 I have written a C# service, an installer, and have created a setup package to install it. The service needs to load an xml file to operate. Where is the best place to put this file in the various filesystem folders offered by the VS setup project, and how do I then refer to these paths from my code?</p> <...
[ { "answer_id": 215538, "author": "mohammedn", "author_id": 29268, "author_profile": "https://Stackoverflow.com/users/29268", "pm_score": 3, "selected": true, "text": "<p>I am not sure which place is better to store the XML file. I don't think it will matter alot. But if you need to get s...
2008/10/18
[ "https://Stackoverflow.com/questions/215471", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14357/" ]
In VS2008 I have written a C# service, an installer, and have created a setup package to install it. The service needs to load an xml file to operate. Where is the best place to put this file in the various filesystem folders offered by the VS setup project, and how do I then refer to these paths from my code? I shoul...
I am not sure which place is better to store the XML file. I don't think it will matter alot. But if you need to get special folder path in the system you can use Environment class to do so. The following line of code get the path of the Program Files: ``` string path = Environment.GetFolderPath(Environment.SpecialFol...
215,515
<p>I have a simple class that essentially just holds some values. I have overridden the <code>ToString()</code> method to return a nice string representation.</p> <p>Now, I want to create a <code>ToXml()</code> method, that will return something like this:</p> <pre><code>&lt;Song&gt; &lt;Artist&gt;Bla&lt;/Artist&...
[ { "answer_id": 215559, "author": "Murph", "author_id": 1070, "author_profile": "https://Stackoverflow.com/users/1070", "pm_score": 2, "selected": false, "text": "<p>You need Linq - System.Xml.Linq to be precise.</p>\n\n<p>You can create XML using XElement from scratch - that should prett...
2008/10/18
[ "https://Stackoverflow.com/questions/215515", "https://Stackoverflow.com", "https://Stackoverflow.com/users/91/" ]
I have a simple class that essentially just holds some values. I have overridden the `ToString()` method to return a nice string representation. Now, I want to create a `ToXml()` method, that will return something like this: ``` <Song> <Artist>Bla</Artist> <Title>Foo</Title> </Song> ``` Of course, I could j...
You may want to look at how you can use the built-in features of .NET to serialize and deserialize an object into XML, rather than creating a `ToXML()` method on every class that is essentially just a Data Transfer Object. I have used these techniques successfully on a couple of projects but don’t have the implementat...
215,524
<p>Some iPhone applications, such as Pandora seem to directly manipulate the hardware volume and respond to physical volume button. How is this done?</p> <p>AudioSessionServices allows you to get the current hardware output volume with the <code>kAudioSessionProperty_CurrentHardwareOutputVolume</code> property, but it...
[ { "answer_id": 215614, "author": "catlan", "author_id": 23028, "author_profile": "https://Stackoverflow.com/users/23028", "pm_score": 4, "selected": true, "text": "<p>They use the MPVolumeView, simple add it and it's makes the rest when the user touch it. Note: Doesn't work in iPhone Sim...
2008/10/18
[ "https://Stackoverflow.com/questions/215524", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4468/" ]
Some iPhone applications, such as Pandora seem to directly manipulate the hardware volume and respond to physical volume button. How is this done? AudioSessionServices allows you to get the current hardware output volume with the `kAudioSessionProperty_CurrentHardwareOutputVolume` property, but it is (allegedly) read-...
They use the MPVolumeView, simple add it and it's makes the rest when the user touch it. Note: Doesn't work in iPhone Simulator. I think the release note also mentioned do not use it direct in Interface Builder. ``` MPVolumeView *volumeView = [[MPVolumeView alloc] initWithFrame:CGRectMake(25, 378, 270, 30)]; [self.vi...
215,537
<p>So am I crazy for considering doing a beta/production release on Glassfish V3 Prelude? Since all of my content is dynamic, I'm not even thinking of bothering to set up apache in front either. Doing so complicates the setup by requiring something like AJP or mod_jk and will not offer us much in terms of capability.<...
[ { "answer_id": 215614, "author": "catlan", "author_id": 23028, "author_profile": "https://Stackoverflow.com/users/23028", "pm_score": 4, "selected": true, "text": "<p>They use the MPVolumeView, simple add it and it's makes the rest when the user touch it. Note: Doesn't work in iPhone Sim...
2008/10/18
[ "https://Stackoverflow.com/questions/215537", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1129162/" ]
So am I crazy for considering doing a beta/production release on Glassfish V3 Prelude? Since all of my content is dynamic, I'm not even thinking of bothering to set up apache in front either. Doing so complicates the setup by requiring something like AJP or mod\_jk and will not offer us much in terms of capability. So...
They use the MPVolumeView, simple add it and it's makes the rest when the user touch it. Note: Doesn't work in iPhone Simulator. I think the release note also mentioned do not use it direct in Interface Builder. ``` MPVolumeView *volumeView = [[MPVolumeView alloc] initWithFrame:CGRectMake(25, 378, 270, 30)]; [self.vi...
215,557
<p>How do I implement a circular list that overwrites the oldest entry when it's full? </p> <p>For a little background, I want to use a circular list within GWT; so using a 3rd party lib is <strong>not</strong> what I want.</p>
[ { "answer_id": 215573, "author": "tvanfosson", "author_id": 12950, "author_profile": "https://Stackoverflow.com/users/12950", "pm_score": 2, "selected": false, "text": "<p>Use a linked list. Maintain separate pointers for the head and tail. Pop from the head of the list, push onto the ...
2008/10/18
[ "https://Stackoverflow.com/questions/215557", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22992/" ]
How do I implement a circular list that overwrites the oldest entry when it's full? For a little background, I want to use a circular list within GWT; so using a 3rd party lib is **not** what I want.
A very simple implementation, expressed in C. Implements a circular buffer style FIFO queue. Could be made more generic by creating a structure containing the queue size, queue data, and queue indexes (in and out), which would be passed in with the data to add or remove from the queue. These same routines could then ha...
215,581
<p>What is the purpose of the colon before a block in Python?</p> <p>Example:</p> <pre><code>if n == 0: print "The end" </code></pre>
[ { "answer_id": 215676, "author": "tzot", "author_id": 6899, "author_profile": "https://Stackoverflow.com/users/6899", "pm_score": 7, "selected": true, "text": "<p>The colon is there to declare the start of an indented block.</p>\n\n<p>Technically, it's not necessary; you could just inden...
2008/10/18
[ "https://Stackoverflow.com/questions/215581", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14732/" ]
What is the purpose of the colon before a block in Python? Example: ``` if n == 0: print "The end" ```
The colon is there to declare the start of an indented block. Technically, it's not necessary; you could just indent and de-indent when the block is done. However, based on the [Python koan](http://www.python.org/dev/peps/pep-0020/) “explicit is better than implicit” (EIBTI), I believe that Guido deliberately made the...
215,584
<p>I am currently a student and trying to design a Visual C++ application to allow me to visually insert an oriented graph in order to create a text file with the graph's matrix. At this point I have created an onClick event to create nodes and have used the form's Paint event to draw the nodes. I have also inserted t...
[ { "answer_id": 215676, "author": "tzot", "author_id": 6899, "author_profile": "https://Stackoverflow.com/users/6899", "pm_score": 7, "selected": true, "text": "<p>The colon is there to declare the start of an indented block.</p>\n\n<p>Technically, it's not necessary; you could just inden...
2008/10/18
[ "https://Stackoverflow.com/questions/215584", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29293/" ]
I am currently a student and trying to design a Visual C++ application to allow me to visually insert an oriented graph in order to create a text file with the graph's matrix. At this point I have created an onClick event to create nodes and have used the form's Paint event to draw the nodes. I have also inserted the c...
The colon is there to declare the start of an indented block. Technically, it's not necessary; you could just indent and de-indent when the block is done. However, based on the [Python koan](http://www.python.org/dev/peps/pep-0020/) “explicit is better than implicit” (EIBTI), I believe that Guido deliberately made the...
215,615
<p>Erlang support to partition its nodes into groups using the <a href="http://erlang.org/doc/man/global_group.html" rel="nofollow noreferrer">global_group</a> module. Further, Erlang supports adding nodes on the fly to the node-network. Are these two features usable with each other?<br> As far as I understand, you hav...
[ { "answer_id": 236226, "author": "Jonke", "author_id": 15638, "author_profile": "https://Stackoverflow.com/users/15638", "pm_score": 2, "selected": false, "text": "<blockquote>\n <p>A node is an executing Erlang runtime\n system which has been given a name,\n using the command line fl...
2008/10/18
[ "https://Stackoverflow.com/questions/215615", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23760/" ]
Erlang support to partition its nodes into groups using the [global\_group](http://erlang.org/doc/man/global_group.html) module. Further, Erlang supports adding nodes on the fly to the node-network. Are these two features usable with each other? As far as I understand, you have to name every node on startup to use t...
Looking at the [global\_group source](http://github.com/erlang/otp/blob/dev/lib/kernel/src/global_group.erl), the list of nodes is part of the config checked by the nodes as they synchronise. There is however an exported function [global\_group:global\_groups\_changed](http://github.com/erlang/otp/blob/dev/lib/kernel/...
215,624
<p>I am trying to use some pinvoke code to call a C function. The function fills a buffer with data.</p> <p>The structure is set up as a DWORD for the length, followed by a string. How do I extract the string from the IntPtr?</p> <pre><code> IntPtr buffer = Marshal.AllocHGlobal(nRequiredSize); PInvokedFunction(buf...
[ { "answer_id": 215627, "author": "Adam Tegen", "author_id": 4066, "author_profile": "https://Stackoverflow.com/users/4066", "pm_score": 0, "selected": false, "text": "<p>The best I could come up with was the following, though the use of the UnmanagedMemoryStream seems a bit of a hack.</p...
2008/10/18
[ "https://Stackoverflow.com/questions/215624", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4066/" ]
I am trying to use some pinvoke code to call a C function. The function fills a buffer with data. The structure is set up as a DWORD for the length, followed by a string. How do I extract the string from the IntPtr? ``` IntPtr buffer = Marshal.AllocHGlobal(nRequiredSize); PInvokedFunction(buffer, nRequiredSize); s...
You should do this: ``` IntPtr sBuffer = new IntPtr( buffer.ToInt64() + 4 ); string s = Marshal.PtrToStringAuto( sBuffer ); ``` So your code is 64bit safe.
215,638
<p>I'm trying to access the message in a jthrowable while handing an exception generated when I fail to find a class. However, I am unable to access the message ID of getMessage() on the jthrowable object, and I don't know why. I've tried changing the signature of getMessage to "()Ljava/lang/String" (without the semi...
[ { "answer_id": 215662, "author": "Chris R", "author_id": 23309, "author_profile": "https://Stackoverflow.com/users/23309", "pm_score": 4, "selected": true, "text": "<p>Okay, so it looks like my problem was that <code>GetObjectClass</code> doesn't act the way you'd expect it to on a jthro...
2008/10/18
[ "https://Stackoverflow.com/questions/215638", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23309/" ]
I'm trying to access the message in a jthrowable while handing an exception generated when I fail to find a class. However, I am unable to access the message ID of getMessage() on the jthrowable object, and I don't know why. I've tried changing the signature of getMessage to "()Ljava/lang/String" (without the semicolon...
Okay, so it looks like my problem was that `GetObjectClass` doesn't act the way you'd expect it to on a jthrowable, or at least the results of it are not useful for the purposes of getting methods. Replacing that portion of the code with this works: ``` java_class = (*jEnv)->FindClass (jEnv, "java/lang/Throwable"); me...
215,667
<p>I am trying to develop a script to pull some data from a large number of html tables. One problem is that the number of rows that contain the information to create the column headings is indeterminate. I have discovered that the last row of the set of header rows has the attribute border-bottom for each cell with ...
[ { "answer_id": 215720, "author": "pantsgolem", "author_id": 9261, "author_profile": "https://Stackoverflow.com/users/9261", "pm_score": 2, "selected": false, "text": "<p>Is there any reason </p>\n\n<blockquote>\n <p><code>borderCells = soup.findAll(\"td\", style=re.compile(\"border-bott...
2008/10/18
[ "https://Stackoverflow.com/questions/215667", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I am trying to develop a script to pull some data from a large number of html tables. One problem is that the number of rows that contain the information to create the column headings is indeterminate. I have discovered that the last row of the set of header rows has the attribute border-bottom for each cell with a val...
Is there any reason > > `borderCells = soup.findAll("td", style=re.compile("border-bottom")})` > > > wouldn't work? It's kind of hard to figure out exactly what you're asking for, since your description of the original tables is pretty ambiguous, and it's not really clear what allCells is supposed to be either. ...
215,672
<p>Does anyone have experience with a query language for the web?</p> <p>I am looking for project, commercial or not, that does a good job at making a webpage queryable and that even follows links on it to aggregate information from a bunch of pages.</p> <p>I would prefere a sql or linq like syntax. I could of course...
[ { "answer_id": 215675, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 0, "selected": false, "text": "<p>I'm not sure whether this is exactly what you're looking for, but <a href=\"http://freebase.com\" rel=\"nofollow noref...
2008/10/18
[ "https://Stackoverflow.com/questions/215672", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25145/" ]
Does anyone have experience with a query language for the web? I am looking for project, commercial or not, that does a good job at making a webpage queryable and that even follows links on it to aggregate information from a bunch of pages. I would prefere a sql or linq like syntax. I could of course download a webpa...
See [hpricot](http://code.whytheluckystiff.net/hpricot/) (a Ruby library). ``` # load the RedHanded home page doc = Hpricot(open("http://redhanded.hobix.com/index.html")) # change the CSS class on links (doc/"span.entryPermalink").set("class", "newLinks") # remove the sidebar (doc/"#sidebar").remove # print the altere...
215,684
<p>I have a std::multimap where key is a custom class. Something like this:</p> <pre><code>Class X { public: std::string s; int x; operator &lt;(const X&amp; other) const { return s &lt; other.s; } }; std::multimap&lt;X, int&gt; mymap; </code></pre> <p>Now, I'd like to use upper_bound and lower_bound to i...
[ { "answer_id": 215688, "author": "gbjbaanb", "author_id": 13744, "author_profile": "https://Stackoverflow.com/users/13744", "pm_score": 0, "selected": false, "text": "<p>you only need to provide an operator == and &lt;.</p>\n\n<p>upper_bound and lower_bound are just like any other find-t...
2008/10/18
[ "https://Stackoverflow.com/questions/215684", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14690/" ]
I have a std::multimap where key is a custom class. Something like this: ``` Class X { public: std::string s; int x; operator <(const X& other) const { return s < other.s; } }; std::multimap<X, int> mymap; ``` Now, I'd like to use upper\_bound and lower\_bound to iterate over all elements with the same v...
Since `class X` is the key for the multimap, the parameter to `upper_bound()`/`lower_bound()` needs to be of that type. If `class X` has an implicit conversion from `std::string` (which is the type of `X::s`) then you can use that as the parameter to `upper_bound()`/`lower_bound()`. The default comparison for multimap...
215,689
<p>I still haven't got my head around decorators in Python.</p> <p>I've already started using a lot of closures to do things like customize functions and classes in my coding.</p> <p>Eg.</p> <pre><code>class Node : def __init__(self,val,children) : self.val = val self.children = children def mak...
[ { "answer_id": 215782, "author": "tzot", "author_id": 6899, "author_profile": "https://Stackoverflow.com/users/6899", "pm_score": 3, "selected": false, "text": "<p>Are your examples real code, or just examples?</p>\n\n<p>If they're real code, I think you overuse decorators, probably beca...
2008/10/18
[ "https://Stackoverflow.com/questions/215689", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8482/" ]
I still haven't got my head around decorators in Python. I've already started using a lot of closures to do things like customize functions and classes in my coding. Eg. ``` class Node : def __init__(self,val,children) : self.val = val self.children = children def makeRunner(f) : def run(nod...
While it is true that syntactically, decorators are just "sugar", that is not the best way to think about them. Decorators allow you to weave functionality into your existing code without actually modifying it. And they allow you to do it in a way that is declarative. This allows you to use decorators to do *aspect-o...
215,718
<p>How do I revert a modified file to its previous revision at a specific commit hash (which I determined via <a href="https://git-scm.com/docs/git-log" rel="noreferrer"><code>git log</code></a> and <a href="https://git-scm.com/docs/git-diff" rel="noreferrer"><code>git diff</code></a>)?</p>
[ { "answer_id": 35288, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 8, "selected": false, "text": "<pre><code>git checkout -- foo\n</code></pre>\n\n<p>That will reset <code>foo</code> to HEAD. You can also:</p>\n\n<pre><c...
2008/10/18
[ "https://Stackoverflow.com/questions/215718", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3410/" ]
How do I revert a modified file to its previous revision at a specific commit hash (which I determined via [`git log`](https://git-scm.com/docs/git-log) and [`git diff`](https://git-scm.com/docs/git-diff))?
Assuming the hash of the commit you want is `c5f567`: ``` git checkout c5f567 -- file1/to/restore file2/to/restore ``` The [git checkout](https://git-scm.com/docs/git-checkout) man page gives more information. If you want to revert to the commit before `c5f567`, append `~1` (where 1 is the number of commits you wan...
215,719
<p>I'm following the <a href="http://www.asp.net/learn/mvc-videos/video-395.aspx" rel="nofollow noreferrer">ASP.Net MVC "TaskList" example video</a> and on clicking Run in Visual Studio (~14:00 min into the video) I'm getting the following error message in the browser:</p> <pre><code>Server Error in '/' Application. ...
[ { "answer_id": 216512, "author": "Nick Berardi", "author_id": 17, "author_profile": "https://Stackoverflow.com/users/17", "pm_score": 0, "selected": false, "text": "<p>It seems to have something to do with your anonymous type on Line 17. Make sure you code looks like</p>\n\n<pre><code>r...
2008/10/18
[ "https://Stackoverflow.com/questions/215719", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5662/" ]
I'm following the [ASP.Net MVC "TaskList" example video](http://www.asp.net/learn/mvc-videos/video-395.aspx) and on clicking Run in Visual Studio (~14:00 min into the video) I'm getting the following error message in the browser: ``` Server Error in '/' Application. Bad IL format. Description: An unhandled exception ...
*D'oh!* Found the problem, it's in the `HomeController.vb`: ``` Public Class HomeController Inherits System.Web.Mvc.Controller ' Display a list of tasks Function Index() Return View() End Function ' Dislpay a form for creating a new task Function Create() As ActionResult Retu...
215,742
<p><em>By Logic Programming I mean the a sub-paradigm of declarative programming languages. Don't confuse this question with "What problems can you solve with if-then-else?"</em></p> <p>A language like Prolog is very fascinating, and it's worth learning for the sake of learning, but I have to wonder what class of rea...
[ { "answer_id": 215877, "author": "Lou Franco", "author_id": 3937, "author_profile": "https://Stackoverflow.com/users/3937", "pm_score": 3, "selected": false, "text": "<p>One of the things Prolog gives you for free is a backtracking search algorithm -- you could implement it yourself, but...
2008/10/18
[ "https://Stackoverflow.com/questions/215742", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18446/" ]
*By Logic Programming I mean the a sub-paradigm of declarative programming languages. Don't confuse this question with "What problems can you solve with if-then-else?"* A language like Prolog is very fascinating, and it's worth learning for the sake of learning, but I have to wonder what class of real-world problems i...
*Prototyping*. Prolog is dynamic and has been for 50 years. The compiler is liberal, the syntax minimalist, and "doing stuff" is easy, fun and efficient. SWI-Prolog has a built-in [tracer (debugger!)](https://www.swi-prolog.org/pldoc/man?section=debugoverview), and even a [graphical tracer](https://www.swi-prolog.org...