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
454,274
<p>I am creating a matching game for Android, and when the user gets a match, a dialog box should pop up saying "Match!" I cannot figure out how to do this though. If I use Thread.currentthread().sleep, the dialog never appears. </p> <pre><code>android.app.AlertDialog a = new android.app.AlertDialog.Builder(match.this...
[ { "answer_id": 454806, "author": "Mariano Kamp", "author_id": 45867, "author_profile": "https://Stackoverflow.com/users/45867", "pm_score": 5, "selected": true, "text": "<p>You're trying to show a text message in a popup for a short period of time on the screen?</p>\n\n<p>For these kind ...
2009/01/17
[ "https://Stackoverflow.com/questions/454274", "https://Stackoverflow.com", "https://Stackoverflow.com/users/764272/" ]
I am creating a matching game for Android, and when the user gets a match, a dialog box should pop up saying "Match!" I cannot figure out how to do this though. If I use Thread.currentthread().sleep, the dialog never appears. ``` android.app.AlertDialog a = new android.app.AlertDialog.Builder(match.this).setTitle("Ma...
You're trying to show a text message in a popup for a short period of time on the screen? For these kind of alerts toasts are great: ``` Toast.makeText(this, "Match!", Toast.LENGTH_LONG).show(); ``` Is that what you are looking for? [Here is the Java Doc.](http://code.google.com/android/reference/android/widget/Toa...
454,277
<p>Is there a way to set the EnableSSL from the web.config?</p> <p>I could set this property in code, but that wouldn't work for the Simple Mail Web Event and other classes that uses the default Smtp Server. Any ideas?</p>
[ { "answer_id": 649790, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "<p>I have searched almost everywhere for this.</p>\n\n<p>But it seems there is no way we can configure EnableSsl Property in w...
2009/01/17
[ "https://Stackoverflow.com/questions/454277", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49671/" ]
Is there a way to set the EnableSSL from the web.config? I could set this property in code, but that wouldn't work for the Simple Mail Web Event and other classes that uses the default Smtp Server. Any ideas?
For .NET 3 and earlier: You can't. You have to manage it by hand. For more information you can see <https://blogs.msdn.microsoft.com/vikas/2008/04/29/bug-asp-net-2-0-passwordrecovery-web-control-cannot-send-emails-to-ssl-enabled-smtp-servers/>. For .NET 4: You can. See <http://theoldsewingfactory.com/2011/01/06/ena...
454,294
<p>Prevayler guarantees that all the writes ( through its transactions) are synchronized. But what about reads? </p> <p>Is it right that dirty reads are possible if no explicit synchronizing is used (in user code)?</p> <p>Are they possible if a business object is read as:</p> <pre><code>// get the 3rd account Accon...
[ { "answer_id": 475629, "author": "Lawrence Dol", "author_id": 8946, "author_profile": "https://Stackoverflow.com/users/8946", "pm_score": 1, "selected": false, "text": "<p>It's been a really long time since I looked at Prevayler (I used it in a POC project about 6 or 7 years ago). I am...
2009/01/17
[ "https://Stackoverflow.com/questions/454294", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29363/" ]
Prevayler guarantees that all the writes ( through its transactions) are synchronized. But what about reads? Is it right that dirty reads are possible if no explicit synchronizing is used (in user code)? Are they possible if a business object is read as: ``` // get the 3rd account Accont account = (Bank)prevayler.p...
The recommended way is to use JMatch Query and Prevayler.execute(Query). Either directly or by using subclassing. The returned results must be either primitive values or immutable objects. If you plan to return mutable objects you should subclass JMatch Query to do these deep copies. This way you get a system that loc...
454,315
<p>How to format correctly according to the device configuration date and time when having a year, month, day, hour and minute?</p>
[ { "answer_id": 456941, "author": "JamieH", "author_id": 55845, "author_profile": "https://Stackoverflow.com/users/55845", "pm_score": 9, "selected": true, "text": "<p>Use the standard Java DateFormat class.</p>\n\n<p>For example to display the current date and time do the following:</p>\...
2009/01/17
[ "https://Stackoverflow.com/questions/454315", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6068/" ]
How to format correctly according to the device configuration date and time when having a year, month, day, hour and minute?
Use the standard Java DateFormat class. For example to display the current date and time do the following: ``` Date date = new Date(location.getTime()); DateFormat dateFormat = android.text.format.DateFormat.getDateFormat(getApplicationContext()); mTimeText.setText("Time: " + dateFormat.format(date)); ``` You can i...
454,316
<p>Without:</p> <ul> <li>ATL</li> <li>MFC</li> </ul> <p><b>Note:</b></p> <ul> <li>Client is executing in a <b>different</b> thread to that of the server</li> </ul> <p><b>Question:</b></p> <ul> <li>How do I <b>control</b> the <b>behaviour</b> of the client, once an <b>event notification</b> is received from the <b>...
[ { "answer_id": 454392, "author": "Aidan Ryan", "author_id": 1042, "author_profile": "https://Stackoverflow.com/users/1042", "pm_score": 0, "selected": false, "text": "<p>If I'm understanding the question right, seems like the client needs to be running a waitloop, something like</p>\n\n<...
2009/01/17
[ "https://Stackoverflow.com/questions/454316", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51078/" ]
Without: * ATL * MFC **Note:** * Client is executing in a **different** thread to that of the server **Question:** * How do I **control** the **behaviour** of the client, once an **event notification** is received from the **COM object** (Server)? * How to implement an event interface from client? Illustration be...
The client implements the event interface (`IS8SimulationEvents`) This can be in a separate component, or on the client component itself. The implementation is called when the component fires an event. After `FindConnectionPoint`, the client calls `pConnection->Advise`, passing the `IS8SimulationEvents` and receiving ...
454,337
<p>I have been using python with RDBMS' (MySQL and PostgreSQL), and I have noticed that I really do not understand how to use a cursor.</p> <p>Usually, one have his script connect to the DB via a client DB-API (like psycopg2 or MySQLdb):</p> <pre><code>connection = psycopg2.connect(host='otherhost', etc) </code></pre...
[ { "answer_id": 454350, "author": "kquinn", "author_id": 54486, "author_profile": "https://Stackoverflow.com/users/54486", "pm_score": 2, "selected": false, "text": "<p>Assuming you're using PostgreSQL, the cursors probably are just implemented using the database's native cursor API. You ...
2009/01/17
[ "https://Stackoverflow.com/questions/454337", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49985/" ]
I have been using python with RDBMS' (MySQL and PostgreSQL), and I have noticed that I really do not understand how to use a cursor. Usually, one have his script connect to the DB via a client DB-API (like psycopg2 or MySQLdb): ``` connection = psycopg2.connect(host='otherhost', etc) ``` And then one creates a curs...
ya, i know it's months old :P DB-API's cursor appears to be closely modeled after SQL cursors. AFA resource(rows) management is concerned, *DB-API does not specify whether the client must retrieve all the rows or DECLARE an actual SQL cursor*. As long as the fetchXXX interfaces do what they're supposed to, DB-API is h...
454,343
<p>Is it possible to set an .ashx file as the starting (or default) page for a web application? If so, how is it done?</p> <p><strong>Edit</strong> - Some good suggestions. I have added "Default.ashx" to the IIS Default Documents and "Enabled Default Document" on the website, however, it only displays a directory li...
[ { "answer_id": 454394, "author": "Diego Magalhães", "author_id": 55921, "author_profile": "https://Stackoverflow.com/users/55921", "pm_score": 0, "selected": false, "text": "<p>Just set it on the default application server like IIS, if your point is to create a handler to ashx youu could...
2009/01/18
[ "https://Stackoverflow.com/questions/454343", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50612/" ]
Is it possible to set an .ashx file as the starting (or default) page for a web application? If so, how is it done? **Edit** - Some good suggestions. I have added "Default.ashx" to the IIS Default Documents and "Enabled Default Document" on the website, however, it only displays a directory listing even though I have ...
Add your ASHX page and make sure you move it to the top of the list. And in IIS7, you can specify it in web.config: ``` <system.webServer> <defaultDocument> <files> <clear /> <add value="my_default_page.ASHX" /> </files> </defaultDocument> </system.webServer> ``` ...
454,358
<p>I'm poking around with jQuery and the fadeIn &amp; fadeOut effects. I have the following code to display and to hide a div with a message.</p> <p>` </p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function() { $("button").click(function() { $("#upd").fadeIn(3000); ...
[ { "answer_id": 454365, "author": "Sampson", "author_id": 54680, "author_profile": "https://Stackoverflow.com/users/54680", "pm_score": 4, "selected": true, "text": "<p>Try <a href=\"http://docs.jquery.com/Effects/fadeOut#speedcallback\" rel=\"noreferrer\">fadeOut</a> from the callback of...
2009/01/18
[ "https://Stackoverflow.com/questions/454358", "https://Stackoverflow.com", "https://Stackoverflow.com/users/53797/" ]
I'm poking around with jQuery and the fadeIn & fadeOut effects. I have the following code to display and to hide a div with a message. ` ``` <script type="text/javascript"> $(document).ready(function() { $("button").click(function() { $("#upd").fadeIn(3000); $("#upd").fadeOut(200...
Try [fadeOut](http://docs.jquery.com/Effects/fadeOut#speedcallback) from the callback of [fadeIn](http://docs.jquery.com/Effects/fadeIn#speedcallback). This will ensure that the latter effect is ran once the first is completed, and not during: ``` $(document).ready(function(){ $("button").click(function(){ $("#u...
454,368
<p>I can find all sorts of stuff on how to program for DCOM, but practically nothing on how to set/check the security programmatically.</p> <p>I'm not trying to recreate dcomcnfg, but if I knew how to reproduce all the functionality of dcomcnfg in C# (preferred, or VB.net) then my goal is in sight.</p> <p>I can't see...
[ { "answer_id": 455903, "author": "Dror", "author_id": 48317, "author_profile": "https://Stackoverflow.com/users/48317", "pm_score": 2, "selected": false, "text": "<p>I couldn't find any .NET way of doing this - you can use the MS command line utility <a href=\"http://msdn.microsoft.com/e...
2009/01/18
[ "https://Stackoverflow.com/questions/454368", "https://Stackoverflow.com", "https://Stackoverflow.com/users/56316/" ]
I can find all sorts of stuff on how to program for DCOM, but practically nothing on how to set/check the security programmatically. I'm not trying to recreate dcomcnfg, but if I knew how to reproduce all the functionality of dcomcnfg in C# (preferred, or VB.net) then my goal is in sight. I can't seem to be able to f...
The answer posted by Daniel was HUGELY helpful. Thank you so much, Daniel! An issue with [Microsoft's documentation](http://msdn.microsoft.com/en-us/library/windows/desktop/ms678417%28v=vs.85%29.aspx) is that they indicate that the registry values contain an ACL in binary form. So, for instance, if you were trying to ...
454,388
<p>I'm getting </p> <pre><code>Validation (): Attribute 'Factory' is not a valid attribute of element 'ServiceHost'. </code></pre> <p>from VS2008 in an empty WCF Service Application after I add Factory="System.ServiceModel.Activation.WebServiceHostFactory" to the @Service directive in the .svc file. I've added Syste...
[ { "answer_id": 454559, "author": "Tad Donaghe", "author_id": 1572436, "author_profile": "https://Stackoverflow.com/users/1572436", "pm_score": 1, "selected": false, "text": "<p>Make sure you have a reference to System.ServiceModel in the code behind. Unless you have an explicit factory ...
2009/01/18
[ "https://Stackoverflow.com/questions/454388", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52115/" ]
I'm getting ``` Validation (): Attribute 'Factory' is not a valid attribute of element 'ServiceHost'. ``` from VS2008 in an empty WCF Service Application after I add Factory="System.ServiceModel.Activation.WebServiceHostFactory" to the @Service directive in the .svc file. I've added System.ServiceModel.Web referenc...
I had .NET 3.5 installed but I didn't have SP1 installed for Studio 2008. Ugh.
454,414
<p>I am hopeless with regex (c#) so I would appreciate some help:</p> <p>Basicaly I need to parse a text and I need to find the following information inside the text:</p> <p>Sample text:</p> <p><strong>KeywordB:***TextToFind* the rest is not relevant but **KeywordB:</strong> <em>Text ToFindB</em> and then some more ...
[ { "answer_id": 454423, "author": "Tiago", "author_id": 55283, "author_profile": "https://Stackoverflow.com/users/55283", "pm_score": 0, "selected": false, "text": "<pre><code>/KeywordB\\: (\\w)/\n</code></pre>\n\n<p>This matches any word that comes after your keyword. As you didn´t menti...
2009/01/18
[ "https://Stackoverflow.com/questions/454414", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36509/" ]
I am hopeless with regex (c#) so I would appreciate some help: Basicaly I need to parse a text and I need to find the following information inside the text: Sample text: **KeywordB:\*\*\*TextToFind\* the rest is not relevant but \*\*KeywordB:** *Text ToFindB* and then some more text. I need to find the word(s) afte...
Let me know if I should delete the old post, but perhaps someone wants to read it. The way to do a "words to look for" inside the regex is like this: ``` regex = @"(Key1|Key2|Key3|LastName|FirstName|Etc):" ``` What you are doing probably isn't worth the effort in a regex, though it can *probably* be done the way y...
454,427
<p>I'm trying to find a way to determine the difference between two strings in my script. I could easily do this with diff or comm, but I'm not dealing with files and I'd prefer not to output them to files, do the compare and read it back.</p> <p>I see that comm, diff, cmp all allow to pass either two files OR a file ...
[ { "answer_id": 454485, "author": "VonC", "author_id": 6309, "author_profile": "https://Stackoverflow.com/users/6309", "pm_score": 5, "selected": false, "text": "<p>Reminds me of this question: <a href=\"https://stackoverflow.com/questions/345505\">How can you diff two pipelines in Bash?<...
2009/01/18
[ "https://Stackoverflow.com/questions/454427", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm trying to find a way to determine the difference between two strings in my script. I could easily do this with diff or comm, but I'm not dealing with files and I'd prefer not to output them to files, do the compare and read it back. I see that comm, diff, cmp all allow to pass either two files OR a file and standa...
Using `diff` or `com` or whatever you want: ``` diff <(echo "$string1" ) <(echo "$string2") ``` Greg's Bash FAQ: [Process Substitution](http://mywiki.wooledge.org/ProcessSubstitution) or with a named pipe ``` mkfifo ./p diff - p <<< "$string1" & echo "$string2" > p ``` Greg's Bash FAQ: [Working with Named Pipes...
454,436
<p>I have model Foo which has field bar. The bar field should be unique, but allow nulls in it, meaning I want to allow more than one record if bar field is <code>null</code>, but if it is not <code>null</code> the values must be unique.</p> <p>Here is my model:</p> <pre><code>class Foo(models.Model): name = mode...
[ { "answer_id": 454610, "author": "James Bennett", "author_id": 28070, "author_profile": "https://Stackoverflow.com/users/28070", "pm_score": 0, "selected": false, "text": "<p>For better or worse, Django considers <code>NULL</code> to be equivalent to <code>NULL</code> for purposes of uni...
2009/01/18
[ "https://Stackoverflow.com/questions/454436", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26592/" ]
I have model Foo which has field bar. The bar field should be unique, but allow nulls in it, meaning I want to allow more than one record if bar field is `null`, but if it is not `null` the values must be unique. Here is my model: ``` class Foo(models.Model): name = models.CharField(max_length=40) bar = model...
Django has not considered `NULL` to be equal to `NULL` for the purpose of uniqueness checks since ticket #9039 was fixed, see: <http://code.djangoproject.com/ticket/9039> The issue here is that the normalized "blank" value for a form `CharField` is an empty string, not `None`. So if you leave the field blank, you get...
454,456
<p>I want to be able to run a regular expression on an entire file, but I'd like to be able to not have to read the whole file into memory at once as I may be working with rather large files in the future. Is there a way to do this? Thanks!</p> <p><strong>Clarification:</strong> I cannot read line-by-line because it c...
[ { "answer_id": 454468, "author": "Andrew Hare", "author_id": 34211, "author_profile": "https://Stackoverflow.com/users/34211", "pm_score": 3, "selected": false, "text": "<p>This depends on the file and the regex. The best thing you could do would be to read the file in line by line but ...
2009/01/18
[ "https://Stackoverflow.com/questions/454456", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49701/" ]
I want to be able to run a regular expression on an entire file, but I'd like to be able to not have to read the whole file into memory at once as I may be working with rather large files in the future. Is there a way to do this? Thanks! **Clarification:** I cannot read line-by-line because it can span multiple lines.
You can use mmap to map the file to memory. The file contents can then be accessed like a normal string: ``` import re, mmap with open('/var/log/error.log', 'r+') as f: data = mmap.mmap(f.fileno(), 0) mo = re.search('error: (.*)', data) if mo: print "found error", mo.group(1) ``` This also works for big f...
454,457
<p>Using jQuery, how can I enable the live insertion of <a href="http://en.wikipedia.org/wiki/Quotation_mark_glyphs" rel="nofollow noreferrer">smart quotes</a> while editing text boxes?</p>
[ { "answer_id": 454491, "author": "Kent Fredric", "author_id": 15614, "author_profile": "https://Stackoverflow.com/users/15614", "pm_score": 3, "selected": false, "text": "<p>One option is to use the little known of 'q' element. </p>\n\n<pre><code>foo bar&lt;q&gt;quoted area&lt;/q&gt;foo ...
2009/01/18
[ "https://Stackoverflow.com/questions/454457", "https://Stackoverflow.com", "https://Stackoverflow.com/users/53589/" ]
Using jQuery, how can I enable the live insertion of [smart quotes](http://en.wikipedia.org/wiki/Quotation_mark_glyphs) while editing text boxes?
Assuming you're talking about trying to replace " and ' with smart quotes automatically: it's not necessarily a good idea. Algorithms to choose the right way for the quotes to face are fragile and can easily be fooled. There is a common formula to do with looking at the character before the quote, which is used by prog...
454,462
<p>I'd like to get a list of random products from the same category as the current product for displaying within the product view - so far all I've dug up is</p> <p><a href="https://stackoverflow.com/questions/272818/magento-products-by-categories">Magento products by categories</a></p> <p>Does anyone know how to do ...
[ { "answer_id": 860926, "author": "Dan Klassen", "author_id": 80210, "author_profile": "https://Stackoverflow.com/users/80210", "pm_score": 3, "selected": false, "text": "<p>what I ended up doing is in app/design/frontend/default/theme_name/template/catalog/product/list_random.phtml</p>\n...
2009/01/18
[ "https://Stackoverflow.com/questions/454462", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'd like to get a list of random products from the same category as the current product for displaying within the product view - so far all I've dug up is [Magento products by categories](https://stackoverflow.com/questions/272818/magento-products-by-categories) Does anyone know how to do this?
You basically load up the category, get the Product Collection and then filter appropriately. ``` $products = Mage::getModel('catalog/category')->load($category_id) ->getProductCollection() ->addAttributeToSelect('*') ->addAttributeToFilter('status', 1) ->addAttributeToFilter('visibility', 4) ->addAttributeToFilt...
454,477
<p>I am trying to create a utility keystroke app so i can do things like kill a preprogrammed process or launch something. I am thinking I should hold cmd in any app, then type in a 4 digit command key so I can launch or kill anything quickly while programming, debugging watching a video, etc.</p> <p>I figured out how...
[ { "answer_id": 454492, "author": "Jim Nelson", "author_id": 32168, "author_profile": "https://Stackoverflow.com/users/32168", "pm_score": 1, "selected": false, "text": "<p>Re-read the introduction to hooks in the Win32 guide. (A good place to start is <a href=\"http://msdn.microsoft.com...
2009/01/18
[ "https://Stackoverflow.com/questions/454477", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I am trying to create a utility keystroke app so i can do things like kill a preprogrammed process or launch something. I am thinking I should hold cmd in any app, then type in a 4 digit command key so I can launch or kill anything quickly while programming, debugging watching a video, etc. I figured out how to get th...
In order for your keyboard hook to be accessible from all processes, it has to be placed in a DLL which will then be loaded into each process' address space. One important thing to keep in mind is that since each instance of the DLL is loaded in a separate process, each will have its own copy of any global variables in...
454,517
<p>I am having problems with my JScript code. I am trying to loop through all of the rows in a table and add an <code>onclick</code> event. I can get the <code>onclick</code> event to add but have a couple of problems.</p> <p>The first problem is that all rows end up getting set up with the wrong parameter for the <c...
[ { "answer_id": 454552, "author": "Element", "author_id": 50970, "author_profile": "https://Stackoverflow.com/users/50970", "pm_score": 2, "selected": false, "text": "<p>Why not attach the event handler to the table and grab the rowindex of the cell that fired the click event inside the c...
2009/01/18
[ "https://Stackoverflow.com/questions/454517", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1107247/" ]
I am having problems with my JScript code. I am trying to loop through all of the rows in a table and add an `onclick` event. I can get the `onclick` event to add but have a couple of problems. The first problem is that all rows end up getting set up with the wrong parameter for the `onclick` event. The second proble...
When a function is called in javascript, the first thing that happens is that the interpreter sets the scope chain to the state it was in when the function was defined. In your case the scope chain looks like: ``` GLOBAL | CAll addTableEvents | CALL onclick ``` So when the variable *orderID* is stumbl...
454,533
<p>I received a MySQL data dump and am trying to insert the data into a set of temporary tables. The creation statement for the first table is shown below. When I run this I receive the error: "<code>You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right synta...
[ { "answer_id": 454553, "author": "Sampson", "author_id": 54680, "author_profile": "https://Stackoverflow.com/users/54680", "pm_score": 2, "selected": false, "text": "<p>I've ALWAYS had issues with CREATE TABLE. Not sure why. Takes some trial-and-error.</p>\n\n<p>Try this:</p>\n\n<pre><co...
2009/01/18
[ "https://Stackoverflow.com/questions/454533", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23249/" ]
I received a MySQL data dump and am trying to insert the data into a set of temporary tables. The creation statement for the first table is shown below. When I run this I receive the error: "`You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use...
You shouldn't put single-quotes on your identifiers. If you're going to quote them use the "back tick" character (“`”). You can also use double-quotes but you have to specify that mode: ``` SET sql_mode='ANSI_QUOTES'; ``` <http://dev.mysql.com/doc/refman/5.0/en/identifiers.html>
454,534
<p>Is there a way to include a javascript-loaded advertisement last on the page, but have it positioned in the content? The primary purpose is to keep the javascript ad from slowing down the page load, so if there are other methods to achieve this please do share.</p>
[ { "answer_id": 454540, "author": "chakrit", "author_id": 3055, "author_profile": "https://Stackoverflow.com/users/3055", "pm_score": 4, "selected": true, "text": "<p>There is the <strong><a href=\"http://www.websiteoptimization.com/speed/tweak/defer/\" rel=\"noreferrer\"><code>defer</cod...
2009/01/18
[ "https://Stackoverflow.com/questions/454534", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48992/" ]
Is there a way to include a javascript-loaded advertisement last on the page, but have it positioned in the content? The primary purpose is to keep the javascript ad from slowing down the page load, so if there are other methods to achieve this please do share.
There is the **[`defer` attribute](http://www.websiteoptimization.com/speed/tweak/defer/)** you could put on script blocks to defer its execution until the page completes loading. ``` <script src="myscript.js" type="text/javascript" defer> // blah blah </script> ``` I am not sure about the general recommendation abo...
454,561
<p>The example program below compiles two in-memory assemblies. The first compilation works fine. The second one fails because it needs access to a class from the first assembly and the type isn't available.</p> <p>Specifically: The ReferencedAssemblies member of the CompilerParameters class is a string collection a...
[ { "answer_id": 454599, "author": "Andrew Kennan", "author_id": 22506, "author_profile": "https://Stackoverflow.com/users/22506", "pm_score": 1, "selected": false, "text": "<p>Define interfaces in a normal assembly and have classes in each generated assembly implement those interfaces. Th...
2009/01/18
[ "https://Stackoverflow.com/questions/454561", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37263/" ]
The example program below compiles two in-memory assemblies. The first compilation works fine. The second one fails because it needs access to a class from the first assembly and the type isn't available. Specifically: The ReferencedAssemblies member of the CompilerParameters class is a string collection and it is use...
Based on documentation found on [MSDN](http://msdn.microsoft.com/en-us/library/system.codedom.compiler.compilerparameters%28VS.80%29.aspx) and on the code in reflector that I looked at (for the compiler classes) it is not possible to do what you want. The reason is that underneath, the code compiler classes that you ar...
454,566
<p>I am not sure, whether I should use for -loop. Perhaps, like </p> <pre><code>for i in range(145): by 6: //mistake here? print i </code></pre>
[ { "answer_id": 454569, "author": "Federico A. Ramponi", "author_id": 18770, "author_profile": "https://Stackoverflow.com/users/18770", "pm_score": 3, "selected": false, "text": "<p>I would prefer:</p>\n\n<pre><code>for i in xrange(25): # from 0 to 24\n print 6*i\n</code></pre>\n\n<...
2009/01/18
[ "https://Stackoverflow.com/questions/454566", "https://Stackoverflow.com", "https://Stackoverflow.com/users/54964/" ]
I am not sure, whether I should use for -loop. Perhaps, like ``` for i in range(145): by 6: //mistake here? print i ```
``` for i in range(0,150,6): print i ``` if you are stepping by a constant
454,582
<p>I am generating a data template in C#. With the help of the good people on this wonderful site, I've managed to take care of almost every issue. This should be the last problem. Because it's a template I'm working on, I want every field in the table, including nulls. I was helped on how to update nulls by adding (ob...
[ { "answer_id": 454569, "author": "Federico A. Ramponi", "author_id": 18770, "author_profile": "https://Stackoverflow.com/users/18770", "pm_score": 3, "selected": false, "text": "<p>I would prefer:</p>\n\n<pre><code>for i in xrange(25): # from 0 to 24\n print 6*i\n</code></pre>\n\n<...
2009/01/18
[ "https://Stackoverflow.com/questions/454582", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45429/" ]
I am generating a data template in C#. With the help of the good people on this wonderful site, I've managed to take care of almost every issue. This should be the last problem. Because it's a template I'm working on, I want every field in the table, including nulls. I was helped on how to update nulls by adding (objec...
``` for i in range(0,150,6): print i ``` if you are stepping by a constant
454,600
<p>I've written explorer bars (band object) before and <strong>AFAIK vertical explorer bars can only be on the left side</strong>. However, I was amazed when I saw this explorer bar by HP that is docked on the right hand side instead:</p> <p><img src="https://farm4.static.flickr.com/3493/3204746881_58eb9706fc.jpg" alt...
[ { "answer_id": 485387, "author": "Michael", "author_id": 56751, "author_profile": "https://Stackoverflow.com/users/56751", "pm_score": 0, "selected": false, "text": "<p>without actually creating one.. I can only assume HP queries up the food chain for IDockingWindow, sometime after setsi...
2009/01/18
[ "https://Stackoverflow.com/questions/454600", "https://Stackoverflow.com", "https://Stackoverflow.com/users/53735/" ]
I've written explorer bars (band object) before and **AFAIK vertical explorer bars can only be on the left side**. However, I was amazed when I saw this explorer bar by HP that is docked on the right hand side instead: ![A vertical explorer bar on the right hand side](https://farm4.static.flickr.com/3493/3204746881_58...
I've just been digging into how [Kutano](http://www.kutano.com/)'s right-side bar works as I'd like to do the same. This doesn't directly help your question as I don't have an answer yet, but here's what I know: Kutano doesn't appear to be a normal Explorer Bar, as there's no entry for it in `HKCR\Software\Microsoft\I...
454,601
<p>I have a list of items</p> <ul> <li>John ID</li> <li>Matt ID</li> <li>John ID</li> <li>Scott ID</li> <li>Matt ID</li> <li>John ID</li> <li>Lucas ID</li> </ul> <p>I want to shove them back into a list like so which also means I want to sort by the highest number of duplicates.</p> <ul> <li>John ID 3</li> <li>Matt ...
[ { "answer_id": 454621, "author": "aku", "author_id": 1196, "author_profile": "https://Stackoverflow.com/users/1196", "pm_score": 8, "selected": true, "text": "<p>You can use \"group by\" + \"orderby\". See <a href=\"http://msdn.microsoft.com/en-us/vcsharp/aa336746.aspx\" rel=\"noreferrer...
2009/01/18
[ "https://Stackoverflow.com/questions/454601", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7644/" ]
I have a list of items * John ID * Matt ID * John ID * Scott ID * Matt ID * John ID * Lucas ID I want to shove them back into a list like so which also means I want to sort by the highest number of duplicates. * John ID 3 * Matt ID 2 * Scott ID 1 * Lucas ID 1 Let me know how I can do this with LINQ and C#. Thanks ...
You can use "group by" + "orderby". See [LINQ 101](http://msdn.microsoft.com/en-us/vcsharp/aa336746.aspx) for details ``` var list = new List<string> {"a", "b", "a", "c", "a", "b"}; var q = from x in list group x by x into g let count = g.Count() orderby count descending select new {Val...
454,605
<p>I'm using Ant 1.7.1 to tar up the contents of a directory, that contains a .git subdirectory. My current task is</p> <pre><code>&lt;tar destfile="sali-src-${version}.tgz" basedir="${basedir}" compression="gzip" excludes=".git, .gitignore, *.ipr, *.iws, *.iml"&gt; &lt;/tar&gt; </code></pre> <p>But t...
[ { "answer_id": 454621, "author": "aku", "author_id": 1196, "author_profile": "https://Stackoverflow.com/users/1196", "pm_score": 8, "selected": true, "text": "<p>You can use \"group by\" + \"orderby\". See <a href=\"http://msdn.microsoft.com/en-us/vcsharp/aa336746.aspx\" rel=\"noreferrer...
2009/01/18
[ "https://Stackoverflow.com/questions/454605", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm using Ant 1.7.1 to tar up the contents of a directory, that contains a .git subdirectory. My current task is ``` <tar destfile="sali-src-${version}.tgz" basedir="${basedir}" compression="gzip" excludes=".git, .gitignore, *.ipr, *.iws, *.iml"> </tar> ``` But the resultant tarball contains the .git...
You can use "group by" + "orderby". See [LINQ 101](http://msdn.microsoft.com/en-us/vcsharp/aa336746.aspx) for details ``` var list = new List<string> {"a", "b", "a", "c", "a", "b"}; var q = from x in list group x by x into g let count = g.Count() orderby count descending select new {Val...
454,606
<p>I tried this unsuccessfully:</p> <pre><code>find_fit(data, quadratic_residues) </code></pre> <p>I am trying to find the best-fit for data about water flow rates: <a href="http://dl.getdropbox.com/u/175564/rate.png" rel="nofollow noreferrer">http://dl.getdropbox.com/u/175564/rate.png</a></p> <p>---edit after the c...
[ { "answer_id": 454717, "author": "Steven Noble", "author_id": 10393, "author_profile": "https://Stackoverflow.com/users/10393", "pm_score": 2, "selected": false, "text": "<p>I think your problem is that quadratic_residues probably doesn't mean what you think it means. If you are attempt...
2009/01/18
[ "https://Stackoverflow.com/questions/454606", "https://Stackoverflow.com", "https://Stackoverflow.com/users/54964/" ]
I tried this unsuccessfully: ``` find_fit(data, quadratic_residues) ``` I am trying to find the best-fit for data about water flow rates: <http://dl.getdropbox.com/u/175564/rate.png> ---edit after the comment--- The new code: ``` var('x') model(x) = x**2 find_fit((xlist, reqlist), model) ``` The error message: ...
``` mydata = [[1,3],[2,7],[3,13],[4,24]] var('a,b,c') mymodel(x) = a*x^2 + b*x + c myfit = find_fit(mydata,mymodel,solution_dict=True) points(mydata,color='purple') + plot( mymodel( a=myfit[a], b=myfit[b], c=myfit[c] ), (x,0,4,), color='red' ) ```
454,616
<p>I have an asp.net website that uses forms authentication. There are a few things I keep in sessions like username, userID, email, etc.</p> <p>I allow the user to stay logged into the website by setting a long expiration date on the authentication cookie. So it's very common for the session to expire while the user ...
[ { "answer_id": 454639, "author": "ScottS", "author_id": 51851, "author_profile": "https://Stackoverflow.com/users/51851", "pm_score": 5, "selected": true, "text": "<p>Avoid using session as much as you can, if you can get away without seesion it makes multi-server deployments qutie a bit...
2009/01/18
[ "https://Stackoverflow.com/questions/454616", "https://Stackoverflow.com", "https://Stackoverflow.com/users/56302/" ]
I have an asp.net website that uses forms authentication. There are a few things I keep in sessions like username, userID, email, etc. I allow the user to stay logged into the website by setting a long expiration date on the authentication cookie. So it's very common for the session to expire while the user is still a...
Avoid using session as much as you can, if you can get away without seesion it makes multi-server deployments qutie a bit easier. Probably, Name and email are easy candidates for cookies. It's easy to fake a cookie, so userID may not be a good idea depending on your security needs. The forms authentication cookies are...
454,635
<p>Are <code>$_SESSION</code> variables stored on the client or the server?</p>
[ { "answer_id": 454638, "author": "Brian Fisher", "author_id": 43816, "author_profile": "https://Stackoverflow.com/users/43816", "pm_score": 3, "selected": false, "text": "<p>As Mr. Taylor pointed out this is usually set in php.ini. Usually they are stored as files in a specific director...
2009/01/18
[ "https://Stackoverflow.com/questions/454635", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29291/" ]
Are `$_SESSION` variables stored on the client or the server?
The location of the `$_SESSION` variable storage is determined by PHP's `session.save_path` configuration. Usually this is `/tmp` on a Linux/Unix system. Use the `phpinfo()` function to view your particular settings if not 100% sure by creating a file with this content in the `DocumentRoot` of your domain: ``` <?php ...
454,648
<p>I've been working on an alternative compiler front-end for Python where all syntax is parsed via macros. I'm finally to the point with its development that I can start work on a superset of the Python language where macros are an integral component.</p> <p>My problem is that I can't come up with a pythonic macro d...
[ { "answer_id": 460594, "author": "Serafina Brocious", "author_id": 4977, "author_profile": "https://Stackoverflow.com/users/4977", "pm_score": 0, "selected": false, "text": "<p>This is the current mechanism for defining syntax by use of a standard Python class.</p>\n\n<p>Print macro:</p>...
2009/01/18
[ "https://Stackoverflow.com/questions/454648", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4977/" ]
I've been working on an alternative compiler front-end for Python where all syntax is parsed via macros. I'm finally to the point with its development that I can start work on a superset of the Python language where macros are an integral component. My problem is that I can't come up with a pythonic macro definition s...
After thinking about it a while a few days ago, and coming up with nothing worth posting, I came back to it now and came up with some syntax I rather like, because it nearly looks like python: ``` macro PrintMacro: syntax: "print", OneOrMore(Var(), name='vars') return Printnl(vars, None) ``` * Make all the ...
454,670
<p>I am currently looking for a way to take a variable in batch and only parse out the filename.</p> <p>For example, I pass my batch file a -s parameter from another application which is subsequently set to my source variable. The source file variable typically contains something like: C:\Program Files\myapp\Instance....
[ { "answer_id": 454678, "author": "Dave Ray", "author_id": 40310, "author_profile": "https://Stackoverflow.com/users/40310", "pm_score": 4, "selected": true, "text": "<p>If its coming in as an argument to the script, i.e. %1, %2, etc, you can extract just the filename and extension into a...
2009/01/18
[ "https://Stackoverflow.com/questions/454670", "https://Stackoverflow.com", "https://Stackoverflow.com/users/56353/" ]
I am currently looking for a way to take a variable in batch and only parse out the filename. For example, I pass my batch file a -s parameter from another application which is subsequently set to my source variable. The source file variable typically contains something like: C:\Program Files\myapp\Instance.1\Data\fil...
If its coming in as an argument to the script, i.e. %1, %2, etc, you can extract just the filename and extension into a variable like this: ``` set FILENAME=%~nxN ``` where N is the index of the argument. For example, this script will echo just the filename of the first argument: ``` @echo off set FILENAME=%~nx1 ec...
454,681
<p>I'm starting out in Visual C++ and I'd like to know how to keep the console window.</p> <p>For instance this would be a typical "hello world" application: </p> <pre><code>int _tmain(int argc, _TCHAR* argv[]) { cout &lt;&lt; "Hello World"; return 0; } </code></pre> <p>What's the line I'm missing?</p>
[ { "answer_id": 454684, "author": "Gordon Wilson", "author_id": 23071, "author_profile": "https://Stackoverflow.com/users/23071", "pm_score": 5, "selected": false, "text": "<p>The standard way is <code>cin.get()</code> before your return statement.</p>\n\n<pre><code>int _tmain(int argc, _...
2009/01/18
[ "https://Stackoverflow.com/questions/454681", "https://Stackoverflow.com", "https://Stackoverflow.com/users/53797/" ]
I'm starting out in Visual C++ and I'd like to know how to keep the console window. For instance this would be a typical "hello world" application: ``` int _tmain(int argc, _TCHAR* argv[]) { cout << "Hello World"; return 0; } ``` What's the line I'm missing?
Start the project with `Ctrl`+`F5` instead of just `F5`. The console window will now stay open with the `Press any key to continue . . .` message after the program exits. Note that this requires the `Console (/SUBSYSTEM:CONSOLE)` linker option, which you can enable as follows: 1. Open up your project, and go to the ...
454,689
<p>In Spring annotation-based controller, is it possible to map different query strings using <code>@RequestMapping</code> to different methods?</p> <p>For example</p> <pre><code>@RequestMapping("/test.html?day=monday") public void writeMonday() { } @RequestMapping("/test.html?day=tuesday") public void writeTuesday...
[ { "answer_id": 454694, "author": "Hilton Campbell", "author_id": 50175, "author_profile": "https://Stackoverflow.com/users/50175", "pm_score": 6, "selected": false, "text": "<p>Yes, you can use the <a href=\"http://static.springframework.org/spring/docs/2.5.x/api/org/springframework/web/...
2009/01/18
[ "https://Stackoverflow.com/questions/454689", "https://Stackoverflow.com", "https://Stackoverflow.com/users/56355/" ]
In Spring annotation-based controller, is it possible to map different query strings using `@RequestMapping` to different methods? For example ``` @RequestMapping("/test.html?day=monday") public void writeMonday() { } @RequestMapping("/test.html?day=tuesday") public void writeTuesday() { } ```
Yes, you can use the [params](http://static.springframework.org/spring/docs/2.5.x/api/org/springframework/web/bind/annotation/RequestMapping.html#params()) element: ``` @RequestMapping("/test.html", params = "day=monday") public void writeMonday() { } @RequestMapping("/test.html", params = "day=tuesday") public void ...
454,691
<p>I'm developing a python framework that would have "addons" written as separate packages. I.e.:</p> <pre><code>import myframework from myframework.addons import foo, bar </code></pre> <p>Now, what I'm trying to arrange is so that these addons can be distributed separately from core framework and injected into <code...
[ { "answer_id": 455033, "author": "Dan", "author_id": 18909, "author_profile": "https://Stackoverflow.com/users/18909", "pm_score": 0, "selected": false, "text": "<p>It sounds like what you're after can be accomplished quite neatly with import hooks.</p>\n\n<p>This is a way of writing cus...
2009/01/18
[ "https://Stackoverflow.com/questions/454691", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39167/" ]
I'm developing a python framework that would have "addons" written as separate packages. I.e.: ``` import myframework from myframework.addons import foo, bar ``` Now, what I'm trying to arrange is so that these addons can be distributed separately from core framework and injected into `myframework.addons` namespace....
> > Is there a better way to accomplish this or perhaps a different approach to the above distribution problem altogether? > > > Possibly. Python's module/package setup is generally tricky to tamper with dynamically like this, but its object/class system is open and extensible in a well-defined way. When modules a...
454,726
<p>I have a class of type <code>ISimpleCache&lt;IBrokeredDataObject&gt;</code> that I want to add as a type alias (then a type) in the App.Config file</p> <p>the line</p> <pre><code>&lt;typeAlias alias="ISimpleCacheOfIBrokeredDataObject" type="MyApplication.ISimpleCache&lt;IBrokeredDataObject&gt;, MyApplication" /&gt...
[ { "answer_id": 454758, "author": "Hosam Aly", "author_id": 41283, "author_profile": "https://Stackoverflow.com/users/41283", "pm_score": 6, "selected": true, "text": "<p>Check out <a href=\"http://blogs.microsoft.co.il/blogs/gilf/archive/2008/07/25/working-with-generic-types-in-unity-con...
2009/01/18
[ "https://Stackoverflow.com/questions/454726", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5302/" ]
I have a class of type `ISimpleCache<IBrokeredDataObject>` that I want to add as a type alias (then a type) in the App.Config file the line ``` <typeAlias alias="ISimpleCacheOfIBrokeredDataObject" type="MyApplication.ISimpleCache<IBrokeredDataObject>, MyApplication" /> ``` is obviously wrong due to the <>, however ...
Check out [this](http://blogs.microsoft.co.il/blogs/gilf/archive/2008/07/25/working-with-generic-types-in-unity-configuration-section.aspx) blog post: > > In order to write a generic type, use the ``` sign followed by the number of generic types that the interface/class receives. > > > And a comment in the same p...
454,734
<p>The answers to <a href="https://stackoverflow.com/questions/179123/how-do-i-edit-an-incorrect-commit-message-in-git">How to modify existing, unpushed commits?</a> describe a way to amend previous commit messages that haven't yet been pushed upstream. The new messages inherit the timestamps of the original commits. ...
[ { "answer_id": 454750, "author": "Dustin", "author_id": 39975, "author_profile": "https://Stackoverflow.com/users/39975", "pm_score": 10, "selected": true, "text": "<p>Use <code>git filter-branch</code> with an env filter that sets <code>GIT_AUTHOR_DATE</code> and <code>GIT_COMMITTER_DAT...
2009/01/18
[ "https://Stackoverflow.com/questions/454734", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14468/" ]
The answers to [How to modify existing, unpushed commits?](https://stackoverflow.com/questions/179123/how-do-i-edit-an-incorrect-commit-message-in-git) describe a way to amend previous commit messages that haven't yet been pushed upstream. The new messages inherit the timestamps of the original commits. This seems logi...
Use `git filter-branch` with an env filter that sets `GIT_AUTHOR_DATE` and `GIT_COMMITTER_DATE` for the specific hash of the commit you're looking to fix. This will invalidate that and all future hashes. **Example:** If you wanted to change the [dates](https://www.kernel.org/pub/software/scm/git/docs/git-commit.html...
454,769
<p>I created a database in PostgreSQL with "encoding = 'UTF8'", and loaded some UTF8 data in it. Selecting works fine, but when I try to do a "WHERE UPPER(name) = 'FOO'" in a query, I get an error</p> <pre><code>ERROR: invalid multibyte character for locale </code></pre> <p>My research seems to indicate that this i...
[ { "answer_id": 454774, "author": "Crashworks", "author_id": 53543, "author_profile": "https://Stackoverflow.com/users/53543", "pm_score": 5, "selected": false, "text": "<p>Maps are usually implemented as binary search trees, and walking a binary tree always comes with a little overhead (...
2009/01/18
[ "https://Stackoverflow.com/questions/454769", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3333/" ]
I created a database in PostgreSQL with "encoding = 'UTF8'", and loaded some UTF8 data in it. Selecting works fine, but when I try to do a "WHERE UPPER(name) = 'FOO'" in a query, I get an error ``` ERROR: invalid multibyte character for locale ``` My research seems to indicate that this is because the PostgreSQL in...
I presume you're comparing `map<A, B>` with `vector<pair<A, B> >`. Firstly, finding an item in a very small vector can easily be faster than the same thing in a map, because all the memory in a vector is always contiguous (and so plays more nicely with computers' caches and such things), and the number of comparisons ...
454,771
<p>I have a Silverlight application that communications with an ASP.NET backend through WCF. I have a set of DataContract objects that I defined that (for the most part) match my LINQ to SQL generated types that my ASP.NET backend works with. My WCF code generates instances of my DataContract objects from LINQ to SQL g...
[ { "answer_id": 454777, "author": "Chad Okere", "author_id": 48839, "author_profile": "https://Stackoverflow.com/users/48839", "pm_score": 2, "selected": false, "text": "<p>One thing that would help would be to have some kind of authorization in place so that you keep track of what client...
2009/01/18
[ "https://Stackoverflow.com/questions/454771", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18505/" ]
I have a Silverlight application that communications with an ASP.NET backend through WCF. I have a set of DataContract objects that I defined that (for the most part) match my LINQ to SQL generated types that my ASP.NET backend works with. My WCF code generates instances of my DataContract objects from LINQ to SQL gene...
<https://stackoverflow.com/questions/>**454771**/is-it-safe-to-expose-database-indices-to-silverlight-clients It is standard practice to use primary keys in URLs and such. What you have to be careful about is to make sure the client is permitted to view the resource before sending it back. :)
454,793
<p>Solution to original problem (below) may have been discovered. I commented out</p> <pre><code>&lt;identity&gt; ... &lt;/identity&gt; </code></pre> <p>tag in the app.config file for the client. But I'm not sure if this is going to cause other problems, if it does, could someone let me know?</p> <hr> <p>I've ...
[ { "answer_id": 454796, "author": "SqlRyan", "author_id": 8114, "author_profile": "https://Stackoverflow.com/users/8114", "pm_score": 3, "selected": true, "text": "<p>SSPI failing is a Kerberos-related security negotiation failure. Are you on a domain, and you might have trouble communica...
2009/01/18
[ "https://Stackoverflow.com/questions/454793", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13713/" ]
Solution to original problem (below) may have been discovered. I commented out ``` <identity> ... </identity> ``` tag in the app.config file for the client. But I'm not sure if this is going to cause other problems, if it does, could someone let me know? --- I've been following the [Getting Started tutorial](...
SSPI failing is a Kerberos-related security negotiation failure. Are you on a domain, and you might have trouble communicating with the domain controller right now? Or is there another reason that you'd be unable to authenticate at the moment?
454,804
<p>Let's say trying to use django.views.generic.create_update.create_object to allow the user to a blog entry instance. On the Entry model, there is a required field for the user, that I don't want to show up as an editable field on the blog entry form. So, I would include it into the EntryForm.Meta.exclude tuple. <...
[ { "answer_id": 455052, "author": "sykora", "author_id": 53850, "author_profile": "https://Stackoverflow.com/users/53850", "pm_score": 3, "selected": true, "text": "<p>I don't think you can accomplish this with generic views, they don't have much in the way of post-processing data. Thankf...
2009/01/18
[ "https://Stackoverflow.com/questions/454804", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4883/" ]
Let's say trying to use django.views.generic.create\_update.create\_object to allow the user to a blog entry instance. On the Entry model, there is a required field for the user, that I don't want to show up as an editable field on the blog entry form. So, I would include it into the EntryForm.Meta.exclude tuple. Whe...
I don't think you can accomplish this with generic views, they don't have much in the way of post-processing data. Thankfully, it isn't hard to write your own view to do the same thing. (Adapted from <http://www.djangobook.com/en/1.0/chapter07/>) ``` from yourmodel.forms import EntryForm def create_entry(request): ...
454,811
<p>I know this is a darn simple question, but I'm very used to using Borland and wrappers, so this is a bit of a new approach for me. Can someone simply tell me how I Can open an OpenDialog that only gets .obj files from a visual studio c++ console app? </p> <p>It's very much appreciated!</p>
[ { "answer_id": 454826, "author": "Filip Frącz", "author_id": 21704, "author_profile": "https://Stackoverflow.com/users/21704", "pm_score": 0, "selected": false, "text": "<p>In Visual Studio one usually relies on <a href=\"http://msdn.microsoft.com/en-us/library/dk77e5e7(VS.80).aspx\" rel...
2009/01/18
[ "https://Stackoverflow.com/questions/454811", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48957/" ]
I know this is a darn simple question, but I'm very used to using Borland and wrappers, so this is a bit of a new approach for me. Can someone simply tell me how I Can open an OpenDialog that only gets .obj files from a visual studio c++ console app? It's very much appreciated!
There isn't really any difference between a console application and a GUI application, except for entry point (WinMain in a 'GUI' app), and a console app will have a console window opened during startup if not started from a console. All of the Win32 API is available, so you need to use the [GetOpenFileName](http://ms...
454,833
<p>I'm trying to use the code below to send messages via <code>System.Net.Mail</code> and am <strong>sometimes</strong> getting subjects like <code>'=?utf-8?B?W3AxM25dIEZpbGV...'</code> (trimmed). This is the code that's called:</p> <pre><code>MailMessage message = new MailMessage() { From = new MailAddress("someo...
[ { "answer_id": 454847, "author": "Rowland Shaw", "author_id": 50447, "author_profile": "https://Stackoverflow.com/users/50447", "pm_score": 2, "selected": false, "text": "<p>The answer might be in the rest of the trimmed subject -- the section you provided decodes as \"[p13n] File\", but...
2009/01/18
[ "https://Stackoverflow.com/questions/454833", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4979/" ]
I'm trying to use the code below to send messages via `System.Net.Mail` and am **sometimes** getting subjects like `'=?utf-8?B?W3AxM25dIEZpbGV...'` (trimmed). This is the code that's called: ``` MailMessage message = new MailMessage() { From = new MailAddress("someone@somewhere.com", "Service"), BodyEncoding =...
When your subject contains characters outside the ASCII range, then the mailing software must encode them (RFC2822 mail does not permit non-ASCII characters in headers). There are two ways to do this: * **Quoted Printable** (subject starts with `"=?utf-8?Q"`) * **Base64** (subject starts with `"=?utf-8?B"`) It appear...
454,835
<p>A WCF service exposing multiple elements in DataContract as DataMember</p> <pre><code>[DataMember(IsRequired = true, EmitDefaultValue = false)] public string Source; [DataMember(IsRequired = true, EmitDefaultValue = false)] public string Target; </code></pre> <p>In generated proxy (through add service reference i...
[ { "answer_id": 454841, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 2, "selected": true, "text": "<p>Well, both null (xsi:nil) and an empty string <em>are</em> values - they just aren't values you want.</p>\n\n<p>Dur...
2009/01/18
[ "https://Stackoverflow.com/questions/454835", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7722/" ]
A WCF service exposing multiple elements in DataContract as DataMember ``` [DataMember(IsRequired = true, EmitDefaultValue = false)] public string Source; [DataMember(IsRequired = true, EmitDefaultValue = false)] public string Target; ``` In generated proxy (through add service reference in VS 2008) at client, the ...
Well, both null (xsi:nil) and an empty string *are* values - they just aren't values you want. During deserialization (at client or server): You could try putting some code in the setter to throw an exception for invalid values? Alternatively (for more complex cases), I believe that data-contracts support deserializ...
454,836
<p>Anyone knows how to get sum of number?</p> <p>For example i have mysql column name package.</p> <pre><code>Package 3 4 1 3 4 </code></pre> <p>If package 3, the value should be usd 5, if package 4, value should be usd 10, if package 1, value should be usd 1 and so on.</p> <p>So the total value above should be => ...
[ { "answer_id": 454846, "author": "Richard Harrison", "author_id": 19624, "author_profile": "https://Stackoverflow.com/users/19624", "pm_score": 4, "selected": true, "text": "<p>Get the database to do the work: </p>\n\n<pre><code>select sum(CASE WHEN package = 3 THEN 5 ELSE 0 END)\n ...
2009/01/18
[ "https://Stackoverflow.com/questions/454836", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Anyone knows how to get sum of number? For example i have mysql column name package. ``` Package 3 4 1 3 4 ``` If package 3, the value should be usd 5, if package 4, value should be usd 10, if package 1, value should be usd 1 and so on. So the total value above should be => 5 + 10 + 1 + 5 + 10 = 31 So how do i ge...
Get the database to do the work: ``` select sum(CASE WHEN package = 3 THEN 5 ELSE 0 END) + sum(CASE WHEN package = 4 THEN 10 ELSE 0 END) + sum(CASE WHEN package = 1 THEN 1 ELSE 0 END) AS total from table_name ``` The right way of doing it, if you've got more than a few values be to modify the table to...
454,868
<p>In the MVVM pattern for WPF, handling dialogs is one of the more complex operations. As your view model does not know anything about the view, dialog communication can be interesting. I can expose an <code>ICommand</code> that when the view invokes it, a dialog can appear.</p> <p>Does anyone know of a good way to...
[ { "answer_id": 454882, "author": "Cameron MacFarland", "author_id": 3820, "author_profile": "https://Stackoverflow.com/users/3820", "pm_score": 2, "selected": false, "text": "<p>I think that the handling of a dialog should be the responsibility of the view, and the view needs to have cod...
2009/01/18
[ "https://Stackoverflow.com/questions/454868", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42124/" ]
In the MVVM pattern for WPF, handling dialogs is one of the more complex operations. As your view model does not know anything about the view, dialog communication can be interesting. I can expose an `ICommand` that when the view invokes it, a dialog can appear. Does anyone know of a good way to handle results from di...
I suggest forgoing the 1990's modal dialogs and instead implementing a control as an overlay (canvas+absolute positioning) with visibility tied to a boolean back in the VM. Closer to an ajax type control. This is very useful: ``` <BooleanToVisibilityConverter x:Key="booltoVis" /> ``` as in: ``` <my:ErrorControl Vi...
454,875
<p>How should browser detection be done now that jQuery 1.3 has deprecated (and I'm assuming removed in a future version) <code>$.browser.msie</code> and similar?</p> <p>I have used this a lot for determining which browser we are in for CSS fixes for pretty much every browser, such as:</p> <pre><code>$.browser.opera ...
[ { "answer_id": 454878, "author": "cletus", "author_id": 18393, "author_profile": "https://Stackoverflow.com/users/18393", "pm_score": 1, "selected": false, "text": "<p><a href=\"http://www.ajax-blog.com/jquery-13-beta-sizzling-and-feature-testing.html\" rel=\"nofollow noreferrer\">jQuery...
2009/01/18
[ "https://Stackoverflow.com/questions/454875", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5441/" ]
How should browser detection be done now that jQuery 1.3 has deprecated (and I'm assuming removed in a future version) `$.browser.msie` and similar? I have used this a lot for determining which browser we are in for CSS fixes for pretty much every browser, such as: ``` $.browser.opera $.browser.safari $.browser.mozil...
I was facing something similar, there's no $.support.png (p.ej.), so I need to use the $.browser.version yet, maybe we can just keep asking for more $.support.XXXX properties, as much as needed.
454,880
<p>I have "a" element which servers as button. It has no href attribute.</p> <p>I'm using jQuery to achieve very simple thing: on click start ajax request and prevent further clicks. After ajax completes, enable clicking. I don't use form or input button.</p> <pre><code>var contact= { send: function() { $...
[ { "answer_id": 454893, "author": "cletus", "author_id": 18393, "author_profile": "https://Stackoverflow.com/users/18393", "pm_score": 0, "selected": false, "text": "<p>Use <a href=\"http://www.designateonline.com/discussions/comments.php?DiscussionID=4681&amp;page=1\" rel=\"nofollow nore...
2009/01/18
[ "https://Stackoverflow.com/questions/454880", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have "a" element which servers as button. It has no href attribute. I'm using jQuery to achieve very simple thing: on click start ajax request and prevent further clicks. After ajax completes, enable clicking. I don't use form or input button. ``` var contact= { send: function() { $.ajax({ t...
You could use something like this: ``` var contact = { inprogress: false, send: function() { if (contact.inprogress) return; contact.inprogress = true; $.ajax({ ... complete: function() { $("#send").text("Send"); contact.inprogress = false; } }); ...
454,891
<p>I've got a simple procedure to strip a string of all characters illegal in XML:</p> <pre><code>string SanitizeXml(string xml) { return string.Concat (xml.ToCharArray().Where(c =&gt; IsLegalXmlChar(c)).ToArray()); } </code></pre> <p>It's nice and terse. But I'm concerned about its performance. The same ...
[ { "answer_id": 454894, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 0, "selected": false, "text": "<p>Personally, I wouldn't use LINQ / extension methods in this scenario; LINQ is a powerful tool, but it shouldn't be...
2009/01/18
[ "https://Stackoverflow.com/questions/454891", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11574/" ]
I've got a simple procedure to strip a string of all characters illegal in XML: ``` string SanitizeXml(string xml) { return string.Concat (xml.ToCharArray().Where(c => IsLegalXmlChar(c)).ToArray()); } ``` It's nice and terse. But I'm concerned about its performance. The same thing could easily be accompl...
Well, you don't need the first call to `ToCharArray()` to start with - string implements `IEnumerable<char>`. However, I agree that a StringBuilder and a loop would probably be more appropriate in this case. I'm not sure what string.Concat(char[]) does offhand, btw - why aren't you just using the string constructor wh...
454,899
<p>I have some old images of old Linux filesystems in flat file format. they can be used by <a href="http://bochs.sourceforge.net/" rel="noreferrer">Bochs</a>, but I need to run them with <a href="https://www.virtualbox.org/" rel="noreferrer">Virtual Box</a>. Virtual Box cannot use images in this format, so I need to c...
[ { "answer_id": 454914, "author": "krosenvold", "author_id": 23691, "author_profile": "https://Stackoverflow.com/users/23691", "pm_score": 8, "selected": true, "text": "<p>First, install QEMU. On Debian-based distributions like Ubuntu, run:</p>\n<pre class=\"lang-sh prettyprint-override\"...
2009/01/18
[ "https://Stackoverflow.com/questions/454899", "https://Stackoverflow.com", "https://Stackoverflow.com/users/53481/" ]
I have some old images of old Linux filesystems in flat file format. they can be used by [Bochs](http://bochs.sourceforge.net/), but I need to run them with [Virtual Box](https://www.virtualbox.org/). Virtual Box cannot use images in this format, so I need to convert these images from flat file to .vmdk file format. Is...
First, install QEMU. On Debian-based distributions like Ubuntu, run: ```sh $ apt-get install qemu ``` Then run the following command: ```sh $ qemu-img convert -O vmdk imagefile.dd vmdkname.vmdk ``` I’m assuming a flat disk image is a `dd`-style image. The convert operation also handles numerous other formats. Fo...
454,907
<p>I'm wondering which is best for speed:</p> <p>Option 1: Loading separate CSS for each browser (separate JS file included through a <code>&lt;script/&gt;</code>):</p> <pre><code>// for internet explorer 6 &amp; 7 if ($.browser.msie) { document.write('&lt;link rel="stylesheet" type="text/css" href="/css/styles-i...
[ { "answer_id": 454949, "author": "eelco", "author_id": 8293, "author_profile": "https://Stackoverflow.com/users/8293", "pm_score": 4, "selected": true, "text": "<p>I like <a href=\"http://www.quirksmode.org/css/condcom.html\" rel=\"nofollow noreferrer\">conditional comments</a> best, and...
2009/01/18
[ "https://Stackoverflow.com/questions/454907", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5441/" ]
I'm wondering which is best for speed: Option 1: Loading separate CSS for each browser (separate JS file included through a `<script/>`): ``` // for internet explorer 6 & 7 if ($.browser.msie) { document.write('<link rel="stylesheet" type="text/css" href="/css/styles-ie.css" />'); } // for opera if ($.browser.op...
I like [conditional comments](http://www.quirksmode.org/css/condcom.html) best, and while I didn't really test it, I expect it to be the fastest option as well, since no DOM manipulation is involved. There's also a [great article](http://dev.opera.com/articles/view/supporting-ie-with-conditional-comments/) about suppor...
454,908
<p>I'm trying to split text in a <code>JTextArea</code> using a regex to split the String by <code>\n</code> However, this does not work and I also tried by <code>\r\n|\r|n</code> and many other combination of regexes. Code:</p> <pre><code>public void insertUpdate(DocumentEvent e) { String split[], docStr = null; ...
[ { "answer_id": 454913, "author": "cletus", "author_id": 18393, "author_profile": "https://Stackoverflow.com/users/18393", "pm_score": 11, "selected": true, "text": "<p>This should cover you:</p>\n\n<pre><code>String lines[] = string.split(\"\\\\r?\\\\n\");\n</code></pre>\n\n<p>There's on...
2009/01/18
[ "https://Stackoverflow.com/questions/454908", "https://Stackoverflow.com", "https://Stackoverflow.com/users/54466/" ]
I'm trying to split text in a `JTextArea` using a regex to split the String by `\n` However, this does not work and I also tried by `\r\n|\r|n` and many other combination of regexes. Code: ``` public void insertUpdate(DocumentEvent e) { String split[], docStr = null; Document textAreaDoc = (Document)e.getDocum...
This should cover you: ``` String lines[] = string.split("\\r?\\n"); ``` There's only really two newlines (UNIX and Windows) that you need to worry about.
454,916
<p>Say you need to have a list/array of integers which you need iterate frequently, and I mean extremely often. The reasons may vary, but say it's in the heart of the inner most loop of a high volume processing.</p> <p>In general, one would opt for using Lists (List) due to their flexibility in size. On top of that, m...
[ { "answer_id": 454923, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 9, "selected": true, "text": "<p>Very easy to measure...</p>\n\n<p>In a small number of tight-loop processing code <strong>where I know the length i...
2009/01/18
[ "https://Stackoverflow.com/questions/454916", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2892/" ]
Say you need to have a list/array of integers which you need iterate frequently, and I mean extremely often. The reasons may vary, but say it's in the heart of the inner most loop of a high volume processing. In general, one would opt for using Lists (List) due to their flexibility in size. On top of that, msdn docume...
Very easy to measure... In a small number of tight-loop processing code **where I know the length is fixed** I use arrays for that extra tiny bit of micro-optimisation; arrays can be **marginally** faster **if** you use the indexer / for form - but IIRC believe it depends on the type of data in the array. But unless y...
454,931
<p>I'm writing a system that allows python scripts to be executed within a C++ application. </p> <p>The python scripts are used to modify values within arrays of data (typically 2048x2048x4 arrays of floats)</p> <p>I'm currently using numpy arrays created using the array API and registered with Python. </p> <p>In th...
[ { "answer_id": 454983, "author": "John Montgomery", "author_id": 5868, "author_profile": "https://Stackoverflow.com/users/5868", "pm_score": 0, "selected": false, "text": "<p>You should probably see if you can set several values in the array in one step rather than in four (or more) step...
2009/01/18
[ "https://Stackoverflow.com/questions/454931", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm writing a system that allows python scripts to be executed within a C++ application. The python scripts are used to modify values within arrays of data (typically 2048x2048x4 arrays of floats) I'm currently using numpy arrays created using the array API and registered with Python. In the python scripts I'm acc...
You might want to have a look at [Boost.Python](http://www.boost.org/doc/libs/1_37_0/libs/python/doc/index.html). It focuses on making C++ code available in Python, but it also provides [exec and eval functions](http://www.boost.org/doc/libs/1_37_0/libs/python/doc/v2/exec.html) that should allow you to efficiently inte...
454,945
<p>Given a table-valued function such as <code>dbo.Split()</code> from <a href="https://stackoverflow.com/questions/314824/t-sql-opposite-to-string-concatenation-how-to-split-string-into-multiple-recor">"T-SQL: Opposite to string concatenation - how to split string into multiple records"</a>, how do I pass multiple row...
[ { "answer_id": 454975, "author": "cmsjr", "author_id": 23114, "author_profile": "https://Stackoverflow.com/users/23114", "pm_score": 0, "selected": false, "text": "<p>You could use the COALESCE concatenation behavior</p>\n\n<pre><code>declare @split varchar(max) \nset @split = ''\n\nsele...
2009/01/18
[ "https://Stackoverflow.com/questions/454945", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1600/" ]
Given a table-valued function such as `dbo.Split()` from ["T-SQL: Opposite to string concatenation - how to split string into multiple records"](https://stackoverflow.com/questions/314824/t-sql-opposite-to-string-concatenation-how-to-split-string-into-multiple-recor), how do I pass multiple rows as arguments? This wor...
`OUTER APPLY`: ``` SELECT Stuff.id ,Results.pn ,Results.s FROM stackoverflow_454945 AS Stuff OUTER APPLY dbo.Split(',', Stuff.myColumn) AS Results WHERE ISNULL(Results.s,'') <> '' ```
454,962
<p>I have the TabControl on which I am setting the ContextMenu.</p> <p>All ContextMenu elements have commands set.</p> <pre><code>&lt;ContextMenu x:Key="tabMenu"&gt; &lt;MenuItem Command="{x:Static tabs:TabCommands.Close}" /&gt; &lt;MenuItem Command="{x:Static tabs:TabCommands.CloseAllButThis}" /&gt; &lt;MenuIt...
[ { "answer_id": 454981, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 0, "selected": false, "text": "<p>For parsing the xml - how about using <code>XmlSerializer</code> to deserialize an object graph?</p>\n\n<p>Does it...
2009/01/18
[ "https://Stackoverflow.com/questions/454962", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39068/" ]
I have the TabControl on which I am setting the ContextMenu. All ContextMenu elements have commands set. ``` <ContextMenu x:Key="tabMenu"> <MenuItem Command="{x:Static tabs:TabCommands.Close}" /> <MenuItem Command="{x:Static tabs:TabCommands.CloseAllButThis}" /> <MenuItem Command="{x:Static tabs:TabCommands.Clo...
Decided to run with XDocument(Linq-to-XML); with the PasteXmlAsXLinq Visual Studio addin taking the pain out of it! I'll leave the ORM until Asp.net mvc rtm. By then should have a better idea (Entity/ Linq & Viewengine) on most suitable route for full MVC 'conversion'.
454,991
<p>Can you return IQueryable which is composed of two or more different subclasses ? Here's my attempt to show what I mean. It throws the error:</p> <p><strong>System.NotSupportedException: Types in Union or Concat have members assigned in different order..</strong></p> <pre><code>var a = from oi in db.OrderItems ...
[ { "answer_id": 455015, "author": "chakrit", "author_id": 3055, "author_profile": "https://Stackoverflow.com/users/3055", "pm_score": 2, "selected": false, "text": "<p>My guess is that this is because you are using LINQ in an LINQ-to-SQL context.</p>\n\n<p>So using Concat means that LINQ2...
2009/01/18
[ "https://Stackoverflow.com/questions/454991", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1725/" ]
Can you return IQueryable which is composed of two or more different subclasses ? Here's my attempt to show what I mean. It throws the error: **System.NotSupportedException: Types in Union or Concat have members assigned in different order..** ``` var a = from oi in db.OrderItems where oi.OrderID == ID ...
Try doing the concat on IEnumerable instead of IQueryable: ``` return a.AsEnumerable().Concat(b.AsEnumerable()); ``` If you need an IQueryable result you could do this: ``` return a.AsEnumerable().Concat(b.AsEnumerable()).AsQueryable(); ``` Doing this **will** force the concat to happen in-memory instead of in SQ...
455,008
<p>I have found a way to select random rows from a table in <a href="https://stackoverflow.com/questions/19412/how-to-request-a-random-row-in-sql">this post</a>. A suggestion is to use the following query:</p> <pre><code>SELECT * FROM employee ORDER BY RAND() LIMIT 1 </code></pre> <p>But when I run this query in MS S...
[ { "answer_id": 455012, "author": "Frederik Gheysels", "author_id": 55774, "author_profile": "https://Stackoverflow.com/users/55774", "pm_score": 6, "selected": false, "text": "<p>If you take a look at the SELECT statement in SQL Server Books Online, then you'll see that you can limit the...
2009/01/18
[ "https://Stackoverflow.com/questions/455008", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11445/" ]
I have found a way to select random rows from a table in [this post](https://stackoverflow.com/questions/19412/how-to-request-a-random-row-in-sql). A suggestion is to use the following query: ``` SELECT * FROM employee ORDER BY RAND() LIMIT 1 ``` But when I run this query in MS SQL 2005, I get the following error me...
If you take a look at the SELECT statement in SQL Server Books Online, then you'll see that you can limit the resultset by using the TOP keyword. ``` SELECT TOP 1 * FROM employee ```
455,046
<p>Most established languages have solid test coverage tools available for them, but the depth of functionality differs significantly from one to another.</p> <p>Also, all the various VMs and compilers have such heterogeneous structure that writing a code coverage tool must be a very different job in C than in Lisp, f...
[ { "answer_id": 455088, "author": "Romain Verdier", "author_id": 4687, "author_profile": "https://Stackoverflow.com/users/4687", "pm_score": -1, "selected": false, "text": "<p>In .NET, the preferred way is to use the <a href=\"http://www.blong.com/Conferences/DCon2003/Internals/Profiling....
2009/01/18
[ "https://Stackoverflow.com/questions/455046", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29903/" ]
Most established languages have solid test coverage tools available for them, but the depth of functionality differs significantly from one to another. Also, all the various VMs and compilers have such heterogeneous structure that writing a code coverage tool must be a very different job in C than in Lisp, for example...
Essentially all code coverage tools instrument the code in order to check which parts of the code were executed. As defined in the link you provided, C0 and C1 are pretty similar from the point of view of the person writing the instrumentation. The only difference is where you place the code. I'll go further to specul...
455,050
<p>I have built myself a generic collection class which is defined like this. </p> <pre><code>public class StatisticItemHits&lt;T&gt;{...} </code></pre> <p>This class can be used with <code>int</code> and <code>string</code> values only. However this</p> <pre><code>public class StatisticItemHits&lt;T&gt; where T : s...
[ { "answer_id": 455055, "author": "tuinstoel", "author_id": 43901, "author_profile": "https://Stackoverflow.com/users/43901", "pm_score": 1, "selected": false, "text": "<p>Not possible to do this with 'where'. You can't do an 'or'. </p>\n" }, { "answer_id": 455056, "author": "...
2009/01/18
[ "https://Stackoverflow.com/questions/455050", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16440/" ]
I have built myself a generic collection class which is defined like this. ``` public class StatisticItemHits<T>{...} ``` This class can be used with `int` and `string` values only. However this ``` public class StatisticItemHits<T> where T : string, int {...} ``` won't compile. What am I doing wrong?
The type restriction is meant to be used with Interfaces. Your sample suggests that you want to allow classes that **inherit from int and string**, which is kinda nonsense. I suggest you design an interface that contains the methods you'll be using in your generic class StatisticItemHits, and use that interface as rest...
455,059
<p>I don't know why this doesn't work:</p> <p>I'm using the <a href="http://dev.pocoo.org/hg/sandbox/raw-file/tip/odict.py" rel="noreferrer">odict</a> class from <a href="http://www.python.org/dev/peps/pep-0372/" rel="noreferrer">PEP 372</a>, but I want to use it as a <code>__dict__</code> member, i.e.:</p> <pre><cod...
[ { "answer_id": 455087, "author": "sykora", "author_id": 53850, "author_profile": "https://Stackoverflow.com/users/53850", "pm_score": 4, "selected": true, "text": "<p>The closest answer to your question that I can find is at <a href=\"http://mail.python.org/pipermail/python-bugs-list/200...
2009/01/18
[ "https://Stackoverflow.com/questions/455059", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7581/" ]
I don't know why this doesn't work: I'm using the [odict](http://dev.pocoo.org/hg/sandbox/raw-file/tip/odict.py) class from [PEP 372](http://www.python.org/dev/peps/pep-0372/), but I want to use it as a `__dict__` member, i.e.: ``` class Bag(object): def __init__(self): self.__dict__ = odict() ``` But f...
The closest answer to your question that I can find is at <http://mail.python.org/pipermail/python-bugs-list/2006-April/033155.html>. Basically, if `__dict__` is not an actual `dict()`, then it is ignored, and attribute lookup fails. The alternative for this is to use the odict as a member, and override the getitem a...
455,061
<p>I have moved a web site from one server to another and I copied the files using SCP </p> <p>I now wish to check that all the files have been copied OK.</p> <p>How do I compare the sites?</p> <p>Count files for a folder?</p> <p>Get the total files size for folder tree?</p> <p>or is there a better way to compare ...
[ { "answer_id": 455063, "author": "schnaader", "author_id": 34065, "author_profile": "https://Stackoverflow.com/users/34065", "pm_score": 0, "selected": false, "text": "<p>Make checksums for all files, for example using <a href=\"http://linux.about.com/library/cmd/blcmdl1_md5sum.htm\" rel...
2009/01/18
[ "https://Stackoverflow.com/questions/455061", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3582/" ]
I have moved a web site from one server to another and I copied the files using SCP I now wish to check that all the files have been copied OK. How do I compare the sites? Count files for a folder? Get the total files size for folder tree? or is there a better way to compare the sites? Paul
If you were using scp, you could probably have used [rsync](http://samba.anu.edu.au/rsync/). rsync won't transfer files that are already up to date, so you can use it to verify a copy is current by simply running rsync again. If you were doing something like this on the old host: ``` scp -r from/my/dir newhost:/to/...
455,077
<p>Notepad++ automatically adds a shell shortcut so that when you're in Windows Explorer, you can right-click on a file and select "edit with Notepad++". How can I do the same with emacs? I am using GNU Emacs 22.3 for Windows.</p>
[ { "answer_id": 455135, "author": "Michael Haren", "author_id": 29, "author_profile": "https://Stackoverflow.com/users/29", "pm_score": 2, "selected": false, "text": "<p><a href=\"http://www.mydigitallife.info/2007/05/07/add-notepad2-to-windows-vista-or-xp-right-click-context-menu/\" rel=...
2009/01/18
[ "https://Stackoverflow.com/questions/455077", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34596/" ]
Notepad++ automatically adds a shell shortcut so that when you're in Windows Explorer, you can right-click on a file and select "edit with Notepad++". How can I do the same with emacs? I am using GNU Emacs 22.3 for Windows.
Here's what I have - similar to some other answer. Create a new text file somewhere called emacs-conextmenu.reg (or anything-you-want.reg) and paste the following in: ``` Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\*\shell] [HKEY_CLASSES_ROOT\*\shell\openwemacs] @="&Edit with Emacs" [HKEY_CLASSES_ROOT\*\s...
455,084
<p>What are <strong>some concrete examples</strong> of applications that need to be multi-threaded, or don't need to be, but are much better that way?</p> <p>Answers would be best if in the form of one application per post that way the most applicable will float to the top.</p>
[ { "answer_id": 455090, "author": "thaBadDawg", "author_id": 48832, "author_profile": "https://Stackoverflow.com/users/48832", "pm_score": 1, "selected": false, "text": "<p>The kind of applications that <strong><em>need</em></strong> to be threaded are the ones where you want to do more t...
2009/01/18
[ "https://Stackoverflow.com/questions/455084", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47630/" ]
What are **some concrete examples** of applications that need to be multi-threaded, or don't need to be, but are much better that way? Answers would be best if in the form of one application per post that way the most applicable will float to the top.
There is no hard and fast answer, but most of the time you will not see any advantage for systems where the workflow/calculation is sequential. If however the problem can be broken down into tasks that can be run in parallel (or the problem itself is massively parallel [as some mathematics or analytical problems are]),...
455,092
<p>I tried this experiment on my Linux desktop:</p> <pre><code>int main() { while(1) fork(); return 0; } </code></pre> <p>I ran this program as normal user(not root), i was surprised to find that it brought down my system, it has become unresponsive. I had hoped that due to resource limit exhaustion my proce...
[ { "answer_id": 455102, "author": "Jörg W Mittag", "author_id": 2988, "author_profile": "https://Stackoverflow.com/users/2988", "pm_score": 1, "selected": false, "text": "<p>Most likely, your system administrator didn't set up the user limits. If no user limits are set, then they can't pr...
2009/01/18
[ "https://Stackoverflow.com/questions/455092", "https://Stackoverflow.com", "https://Stackoverflow.com/users/56411/" ]
I tried this experiment on my Linux desktop: ``` int main() { while(1) fork(); return 0; } ``` I ran this program as normal user(not root), i was surprised to find that it brought down my system, it has become unresponsive. I had hoped that due to resource limit exhaustion my process would have been killed,...
You've re-invented a [fork bomb](http://en.wikipedia.org/wiki/Fork_bomb). I think most Linux distributions don't set per-user resource limits by default. You can configure them of course, but you probably haven't. The machine will be fine after a reboot - unless the CPU usage has caused over-heating problems. To pre...
455,109
<p>I am using a PHP class for login purposes. The MySQL database that the login process checks for the user is defined like this:</p> <pre><code> class flexibleAccess{ var $dbName = 'mydatabase'; </code></pre> <p>However, as I install the application for different people, this $dbName needs constant changes. I ...
[ { "answer_id": 455114, "author": "Paul Dixon", "author_id": 6521, "author_profile": "https://Stackoverflow.com/users/6521", "pm_score": 3, "selected": true, "text": "<p>Do it in a <a href=\"http://uk.php.net/manual/en/language.oop5.decon.php\" rel=\"nofollow noreferrer\">constructor</a> ...
2009/01/18
[ "https://Stackoverflow.com/questions/455109", "https://Stackoverflow.com", "https://Stackoverflow.com/users/56409/" ]
I am using a PHP class for login purposes. The MySQL database that the login process checks for the user is defined like this: ``` class flexibleAccess{ var $dbName = 'mydatabase'; ``` However, as I install the application for different people, this $dbName needs constant changes. I have decided to make a con...
Do it in a [constructor](http://uk.php.net/manual/en/language.oop5.decon.php) (I'm assuming php5 here...) ``` class flexibleAccess{ private $dbName; function __construct() { $this->dbName = $_SESSION['mydatabase']; } } ``` For php4, replace \_\_construct with the name of the class instead.
455,184
<p>Trying to do exercise 1.16 (iterative version of fast-exp) in "Structure and Interpretation of Computer Programs" with Clojure I came up with this:</p> <pre><code>(defn fast-it-exp [base exp res] (cond (= exp 0) res (odd? exp) fast-it-exp base (- exp 1) (* base res) :else fast-it-exp base (/ exp 2) (* base ba...
[ { "answer_id": 455202, "author": "Phil Calçado", "author_id": 56424, "author_profile": "https://Stackoverflow.com/users/56424", "pm_score": 5, "selected": true, "text": "<p>Try this:</p>\n\n<pre><code> (defn fast-it-exp [base exp res]\n (cond (= exp 0) res\n (odd? exp) (fast-it-e...
2009/01/18
[ "https://Stackoverflow.com/questions/455184", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15627/" ]
Trying to do exercise 1.16 (iterative version of fast-exp) in "Structure and Interpretation of Computer Programs" with Clojure I came up with this: ``` (defn fast-it-exp [base exp res] (cond (= exp 0) res (odd? exp) fast-it-exp base (- exp 1) (* base res) :else fast-it-exp base (/ exp 2) (* base base res))) ```...
Try this: ``` (defn fast-it-exp [base exp res] (cond (= exp 0) res (odd? exp) (fast-it-exp base (- exp 1) (* base res)) :else (fast-it-exp base (/ exp 2) (* base base res)))) ``` I have no REPL handy but is looks like what you want.
455,203
<p>I want to replace some HTML tags that I have in a CDATA element, but I struggle with getting the syntax in XSLT right. I am getting this error message:</p> <pre><code>net.sf.saxon.trans.XPathException: Error at character 9 in regular expression "&lt;img(\s+(?![^&lt;&gt;]*alt=["\'])[^&lt;...": expected ()) (line 51...
[ { "answer_id": 455466, "author": "Tomalak", "author_id": 18771, "author_profile": "https://Stackoverflow.com/users/18771", "pm_score": 3, "selected": true, "text": "<p>I don't think that the escaped <code>&lt;&gt;</code> brackets are the source of the problem.</p>\n\n<p>Looking at the er...
2009/01/18
[ "https://Stackoverflow.com/questions/455203", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I want to replace some HTML tags that I have in a CDATA element, but I struggle with getting the syntax in XSLT right. I am getting this error message: ``` net.sf.saxon.trans.XPathException: Error at character 9 in regular expression "<img(\s+(?![^<>]*alt=["\'])[^<...": expected ()) (line 51) ``` I guess it does no...
I don't think that the escaped `<>` brackets are the source of the problem. Looking at the error message, the error is at char 9, where a closing parentheses `")"` is expected: ``` <img(\s+(?![^<>]*alt=["\'])[^<... --------^ ``` As you can see, the `"&lt;&gt;"` comes out just fine. I suspect that the regex engine d...
455,210
<p>I'm developing an editor plugin for eclipse. It works fine on files within eclipse projects, but when an external file is opened via the "File -> Open File" menu (which works file with, e.g. Java files), I get a page displaying nothing but a horizontal blue line and the word "ERROR". The Error Log of eclipse is empt...
[ { "answer_id": 455596, "author": "Reji", "author_id": 50388, "author_profile": "https://Stackoverflow.com/users/50388", "pm_score": 0, "selected": false, "text": "<p>Did you try creating a JAVA file using the editor, outside the workspace?</p>\n\n<p>When calling the editor with the file ...
2009/01/18
[ "https://Stackoverflow.com/questions/455210", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16883/" ]
I'm developing an editor plugin for eclipse. It works fine on files within eclipse projects, but when an external file is opened via the "File -> Open File" menu (which works file with, e.g. Java files), I get a page displaying nothing but a horizontal blue line and the word "ERROR". The Error Log of eclipse is empty, ...
I had the same probleam and finally found solution working for me. You have to provide 2 different document providers - first extending **FileDocumentProvider** for files inside your workbench, and second extending **TextFileDocumentProvider** for other resources outside your workspace. Then you register the right prov...
455,237
<p>I've got a string array in C# and I want to pop the top element off the array (ie. remove the first element, and move all the others up one). Is there a simple way to do this in C#? I can't find an Array.Pop method.</p> <p>Would I need to use something like an ArrayList? The order of the items in my array is import...
[ { "answer_id": 455241, "author": "driAn", "author_id": 50430, "author_profile": "https://Stackoverflow.com/users/50430", "pm_score": 6, "selected": true, "text": "<p>Use a <a href=\"http://msdn.microsoft.com/en-us/library/6sh2ey19.aspx\" rel=\"noreferrer\">List</a>, <a href=\"http://msdn...
2009/01/18
[ "https://Stackoverflow.com/questions/455237", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1912/" ]
I've got a string array in C# and I want to pop the top element off the array (ie. remove the first element, and move all the others up one). Is there a simple way to do this in C#? I can't find an Array.Pop method. Would I need to use something like an ArrayList? The order of the items in my array is important.
Use a [List](http://msdn.microsoft.com/en-us/library/6sh2ey19.aspx), [Queue](http://msdn.microsoft.com/en-us/library/7977ey2c.aspx) or [Stack](http://msdn.microsoft.com/en-us/library/3278tedw.aspx) instead.. ``` List<String> Queue<String> Stack<String> ```
455,247
<p>I'm using the datepicker control for jquery and all is well except that I cannot get it to highlight the currently selected input value (or the current date for that matter). Even though I have s valid date value in my text input and can get the datepicker to return the correct month / year, I cannot get it to highl...
[ { "answer_id": 455570, "author": "Russ Cam", "author_id": 1831, "author_profile": "https://Stackoverflow.com/users/1831", "pm_score": 5, "selected": true, "text": "<p>First of all, which browser(s) are you viewing the datepicker in? I have noticed that some colouring of dates/sections wi...
2009/01/18
[ "https://Stackoverflow.com/questions/455247", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29538/" ]
I'm using the datepicker control for jquery and all is well except that I cannot get it to highlight the currently selected input value (or the current date for that matter). Even though I have s valid date value in my text input and can get the datepicker to return the correct month / year, I cannot get it to highligh...
First of all, which browser(s) are you viewing the datepicker in? I have noticed that some colouring of dates/sections within the datepicker look different in **IE6** compared to later browsers (**Firefox 3, Chrome, IE7**). For example, IE6 appears to ignore the background colour for weekend days. The background col...
455,251
<p>I'm looking for a C++ container class, that's a lot like a multimap, but slightly different. The container would store pairs of strings. But when I retrieve items from the container using key K, I want to find all the items where K begins with the item's own key.</p> <p>E.G. If I use key "abcde" I want to find ite...
[ { "answer_id": 455257, "author": "Brian R. Bondy", "author_id": 3153, "author_profile": "https://Stackoverflow.com/users/3153", "pm_score": 5, "selected": true, "text": "<p>I would suggest using a <a href=\"http://en.wikipedia.org/wiki/Trie\" rel=\"nofollow noreferrer\">trie</a>.</p>\n\n...
2009/01/18
[ "https://Stackoverflow.com/questions/455251", "https://Stackoverflow.com", "https://Stackoverflow.com/users/55934/" ]
I'm looking for a C++ container class, that's a lot like a multimap, but slightly different. The container would store pairs of strings. But when I retrieve items from the container using key K, I want to find all the items where K begins with the item's own key. E.G. If I use key "abcde" I want to find items with key...
I would suggest using a [trie](http://en.wikipedia.org/wiki/Trie). Basically you have a tree with 1 node per unique character. Your algorithm would be O(m) for both lookups and insertion, where m is the length of a string. So following your example with: ``` "abcde", "hello" "abc", "Hi" "abcqz", "goodbye" ``` ...
455,261
<p>If I do SELECT a AS b and b is not a column in the table, would query create the "virtual" column?</p> <p>in fact, I need to incorporate some virtual column into the query and process some information into the query so I can use it with each item later on.</p>
[ { "answer_id": 455266, "author": "Gabriel Sosa", "author_id": 31039, "author_profile": "https://Stackoverflow.com/users/31039", "pm_score": 8, "selected": true, "text": "<p>Something like:</p>\n\n<pre><code>SELECT id, email, IF(active = 1, 'enabled', 'disabled') AS account_status FROM us...
2009/01/18
[ "https://Stackoverflow.com/questions/455261", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21209/" ]
If I do SELECT a AS b and b is not a column in the table, would query create the "virtual" column? in fact, I need to incorporate some virtual column into the query and process some information into the query so I can use it with each item later on.
Something like: ``` SELECT id, email, IF(active = 1, 'enabled', 'disabled') AS account_status FROM users ``` This allows you to make operations and show it as columns. EDIT: you can also use joins and show operations as columns: ``` SELECT u.id, e.email, IF(c.id IS NULL, 'no selected', c.name) AS country FROM use...
455,284
<p>I've developed some data based Winforms Application this last two years and all works fine. This application are built on layers (DataAccess, Business Logic and UI). For the Business Logic, all my objects inherit from a base class called BaseEntity with the following definition (there are some custom objects and int...
[ { "answer_id": 455775, "author": "Valentin V", "author_id": 430254, "author_profile": "https://Stackoverflow.com/users/430254", "pm_score": 5, "selected": true, "text": "<p>Claber,</p>\n\n<p>I would keep the BindingList, because BindingList supports more interfaces and more feature rich ...
2009/01/18
[ "https://Stackoverflow.com/questions/455284", "https://Stackoverflow.com", "https://Stackoverflow.com/users/56426/" ]
I've developed some data based Winforms Application this last two years and all works fine. This application are built on layers (DataAccess, Business Logic and UI). For the Business Logic, all my objects inherit from a base class called BaseEntity with the following definition (there are some custom objects and interf...
Claber, I would keep the BindingList, because BindingList supports more interfaces and more feature rich than ObservableCollection. For example: 1. BindingList implements IList of T, whereas ObservableCollection does not. 2. BindingList implements ICancelAddNew interface that data binding mechanisms uses for cancelli...
455,290
<p>I often run into the situation where I want to disable some code while debugging without actually changing the code.</p> <p>What I end up doing is having a break-point (usually conditional) and then when the break-point fires I perform a <em>Set Next Statement</em>. This can be very labor intensive when the code is...
[ { "answer_id": 455308, "author": "lc.", "author_id": 44853, "author_profile": "https://Stackoverflow.com/users/44853", "pm_score": 0, "selected": false, "text": "<p>It doesn't get around the changing code bit, but how about a local boolean? Wrap the code you want to conditionally skip wi...
2009/01/18
[ "https://Stackoverflow.com/questions/455290", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3848/" ]
I often run into the situation where I want to disable some code while debugging without actually changing the code. What I end up doing is having a break-point (usually conditional) and then when the break-point fires I perform a *Set Next Statement*. This can be very labor intensive when the code is reached many tim...
DTE.ExecuteCommand("Debug.SetNextStatement")
455,292
<p>BACKGROUND: </p> <ul> <li><p>Firefox 3 includes <a href="http://sqlite.org" rel="noreferrer">SQLite</a> version 3.5.9. Firefox also allows extensions, which are written in javascript and can call the embedded SQLite engine.</p></li> <li><p>As expected, executing the following SQL statement 'SELECT "TEXT" REGEXP "T...
[ { "answer_id": 459278, "author": "Noah", "author_id": 12113, "author_profile": "https://Stackoverflow.com/users/12113", "pm_score": 4, "selected": true, "text": "<p>Yes. It is possible to call javascript functions</p>\n\n<pre><code>//(thanks to Mirnal Kant, SQLManager)\n//Version 2 -- Pr...
2009/01/18
[ "https://Stackoverflow.com/questions/455292", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12113/" ]
BACKGROUND: * Firefox 3 includes [SQLite](http://sqlite.org) version 3.5.9. Firefox also allows extensions, which are written in javascript and can call the embedded SQLite engine. * As expected, executing the following SQL statement 'SELECT "TEXT" REGEXP "T\*";' gives an error, since there is no REGEXP function nati...
Yes. It is possible to call javascript functions ``` //(thanks to Mirnal Kant, SQLManager) //Version 2 -- Prevent Firefox crashing // -- Suspect a problem with continual creation of Regex objects var g_RegExpString = null; var g_RegExp = null; //functions to be created for the db var smDbFunctions = { /...
455,326
<p>I use Excel via COM automation (in c#), but it seems that the problem has no control over what version of excel is started on the box - we use both Excel 9 and Excel 11 and one specific set of spreadsheets requires excel 9 else they wont work.</p> <p>I included the excel 9 com references but on another persons mach...
[ { "answer_id": 455935, "author": "barrowc", "author_id": 2127508, "author_profile": "https://Stackoverflow.com/users/2127508", "pm_score": 0, "selected": false, "text": "<p>This article may be of use:</p>\n\n<p><a href=\"http://forums.devx.com/showthread.php?p=457900#post457900\" rel=\"n...
2009/01/18
[ "https://Stackoverflow.com/questions/455326", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31387/" ]
I use Excel via COM automation (in c#), but it seems that the problem has no control over what version of excel is started on the box - we use both Excel 9 and Excel 11 and one specific set of spreadsheets requires excel 9 else they wont work. I included the excel 9 com references but on another persons machine excel ...
I'm unsure of the ProgId's (friendly names on CLSID Guids) used for Excel, but a quick look leads me to 'Excel.Application', as the type you might activate. Take a look under HKEY\_CLASSES\_ROOT, on my machine I see "Excel.Application" and "Excel.Application.12", i suspect that you are activating "Excel.Application",...
455,338
<p>Which is the right thing to do?</p> <pre><code>if (myObj['key'] == undefined) </code></pre> <p>or</p> <pre><code>if (myObj['key'] == null) </code></pre> <p>or</p> <pre><code>if (myObj['key']) </code></pre>
[ { "answer_id": 455340, "author": "typeoneerror", "author_id": 53653, "author_profile": "https://Stackoverflow.com/users/53653", "pm_score": 10, "selected": false, "text": "<p>You should use <a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/...
2009/01/18
[ "https://Stackoverflow.com/questions/455338", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Which is the right thing to do? ``` if (myObj['key'] == undefined) ``` or ``` if (myObj['key'] == null) ``` or ``` if (myObj['key']) ```
Try the [JavaScript **in** operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/in). ``` if ('key' in myObj) ``` And the inverse. ``` if (!('key' in myObj)) ``` **Be careful!** The `in` operator matches all object keys, including those in the object's prototype chain. Use `myObj....
455,342
<p>I need to select a large number of rows from an even larger table which is keyed on an autoincrement identity column. I have the primary key values for each of the rows that I'm trying to select, but it could be very large.</p> <p>Often, but not always, the rows that are being selected are contiguous, so I impleme...
[ { "answer_id": 455347, "author": "Otávio Décio", "author_id": 48684, "author_profile": "https://Stackoverflow.com/users/48684", "pm_score": 3, "selected": false, "text": "<p>Create a Temp table with the values you want to select and perform a join from your main table to the temp table. ...
2009/01/18
[ "https://Stackoverflow.com/questions/455342", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I need to select a large number of rows from an even larger table which is keyed on an autoincrement identity column. I have the primary key values for each of the rows that I'm trying to select, but it could be very large. Often, but not always, the rows that are being selected are contiguous, so I implemented a mech...
Create a Temp table with the values you want to select and perform a join from your main table to the temp table. This way you have practically no limit.
455,345
<p>I use shell-command a lots (default binded to M-!), but often I'm doing stuff to the buffer I'm currently editing. Instead of typing the buffer name (and no filename completion is available in shell-command, alas!), it'd be nice to have a shortcut key, say f3, to insert that name for me whenever I press the key.</p>...
[ { "answer_id": 455368, "author": "huaiyuan", "author_id": 16240, "author_profile": "https://Stackoverflow.com/users/16240", "pm_score": 5, "selected": true, "text": "<pre><code>(define-key minibuffer-local-map\n [f3] (lambda () (interactive) (insert (buffer-name))))\n</code></pre>\n\n<h...
2009/01/18
[ "https://Stackoverflow.com/questions/455345", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45383/" ]
I use shell-command a lots (default binded to M-!), but often I'm doing stuff to the buffer I'm currently editing. Instead of typing the buffer name (and no filename completion is available in shell-command, alas!), it'd be nice to have a shortcut key, say f3, to insert that name for me whenever I press the key. The p...
``` (define-key minibuffer-local-map [f3] (lambda () (interactive) (insert (buffer-name)))) ``` ### Edit: As pointed out in the comment section and elsewhere, the above code snippet doesn't work. (Sorry, I should have tested it before posting. :) Some fixes have been posted; here is another: ``` (define-key minib...
455,346
<pre><code>$ cat t.cpp int sign(int i) { if(i &gt; 0) return 1; if(i == 0) return 0; if(i &lt; 0) return -1; } $ g++ -c t.cpp -Wall t.cpp: In function ‘int sign(int)’: t.cpp:5: warning: control reaches end of non-void function $ </code></pre> <p>What do I do about this?</p> <p>Stop using -Wall as it's cle...
[ { "answer_id": 455356, "author": "Eric", "author_id": 4540, "author_profile": "https://Stackoverflow.com/users/4540", "pm_score": 5, "selected": true, "text": "<p>If you don't want to add \"else\" clauses because they would make the code longer, then perhaps you would like to remove the ...
2009/01/18
[ "https://Stackoverflow.com/questions/455346", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
``` $ cat t.cpp int sign(int i) { if(i > 0) return 1; if(i == 0) return 0; if(i < 0) return -1; } $ g++ -c t.cpp -Wall t.cpp: In function ‘int sign(int)’: t.cpp:5: warning: control reaches end of non-void function $ ``` What do I do about this? Stop using -Wall as it's clearly wrong? Add a bogus return 0...
If you don't want to add "else" clauses because they would make the code longer, then perhaps you would like to remove the final "if" and make the code shorter: ``` int sign(int i) { if(i > 0) return 1; if(i == 0) return 0; return -1; // i<0 } ``` Or if you're really computing "sign" yourself and thi...
455,365
<p>If I add a simple Sql Server table data connection to an Excel worksheet, can it lock that table if the connection is never closed?</p>
[ { "answer_id": 455356, "author": "Eric", "author_id": 4540, "author_profile": "https://Stackoverflow.com/users/4540", "pm_score": 5, "selected": true, "text": "<p>If you don't want to add \"else\" clauses because they would make the code longer, then perhaps you would like to remove the ...
2009/01/18
[ "https://Stackoverflow.com/questions/455365", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19956/" ]
If I add a simple Sql Server table data connection to an Excel worksheet, can it lock that table if the connection is never closed?
If you don't want to add "else" clauses because they would make the code longer, then perhaps you would like to remove the final "if" and make the code shorter: ``` int sign(int i) { if(i > 0) return 1; if(i == 0) return 0; return -1; // i<0 } ``` Or if you're really computing "sign" yourself and thi...
455,369
<p>I have a page written in Perl by someone else. I don't know Perl, so I wrote a PHP file that right now just links from the Perl page. What I'd like to do is embed the PHP file in the Perl file if the perl page has been passed a certain variable. If I were using PHP for both I could just do</p> <pre><code>if ($_GET[...
[ { "answer_id": 455377, "author": "Leon Timmermans", "author_id": 4727, "author_profile": "https://Stackoverflow.com/users/4727", "pm_score": 4, "selected": false, "text": "<p>There are the <a href=\"http://search.cpan.org/perldoc?PHP\" rel=\"noreferrer\">PHP</a> and <a href=\"http://sear...
2009/01/18
[ "https://Stackoverflow.com/questions/455369", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46102/" ]
I have a page written in Perl by someone else. I don't know Perl, so I wrote a PHP file that right now just links from the Perl page. What I'd like to do is embed the PHP file in the Perl file if the perl page has been passed a certain variable. If I were using PHP for both I could just do ``` if ($_GET['sidebar']) in...
If you simply want to include the resulting output (HTML, etc.) of the PHP script into the perl-generated page you can use backticks to call either the PHP script via php-cli, like this: First, the test.pl script: ``` [root@www1 cgi-bin]# cat test.pl #!/usr/bin/perl print "This is a perl script\n"; my $output = `php ...
455,376
<p>I have a object in a presenter connected to a view. Inside my XAMTL I have the following:</p> <pre><code>&lt;Label Content="{Binding ElementName=PSV, Path=Presenter.Portfolio.Name}"/&gt; </code></pre> <p>Now when the control is created, Portfolio is null, then i run another method which sets Portfolio. I've implem...
[ { "answer_id": 455414, "author": "Sebastian", "author_id": 56440, "author_profile": "https://Stackoverflow.com/users/56440", "pm_score": 1, "selected": false, "text": "<p>Maybe\n<a href=\"http://msdn.microsoft.com/en-us/library/system.windows.data.bindingoperations.getbindingexpression.a...
2009/01/18
[ "https://Stackoverflow.com/questions/455376", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31387/" ]
I have a object in a presenter connected to a view. Inside my XAMTL I have the following: ``` <Label Content="{Binding ElementName=PSV, Path=Presenter.Portfolio.Name}"/> ``` Now when the control is created, Portfolio is null, then i run another method which sets Portfolio. I've implemented INotifyPropertyChanged but...
Binding always works with the DataContext you would need to set your Presenter into the local DataContext. For example you could do this in the constructor of your Window or UserControl: ``` this.DataContext = new Presenter(); ``` Your binding would then change to: ``` <Label Content="{Binding ElementName=PSV, Path...
455,412
<p>I am running into the </p> <pre><code>DBD::mysql::st execute failed: Got a packet bigger than 'max_allowed_packet' bytes </code></pre> <p>error when trying to make a large insert using Perl &amp; MySQL. I know that increasing the <code>max_allowed_packet</code> setting in my.cnf could fix this, but is it possible...
[ { "answer_id": 455474, "author": "Leon Timmermans", "author_id": 4727, "author_profile": "https://Stackoverflow.com/users/4727", "pm_score": 3, "selected": true, "text": "<p>Try adding something like <code>\";max_allowed_packet=1MB\"</code> to the fist argument of DBI->connect.</p>\n\n<p...
2009/01/18
[ "https://Stackoverflow.com/questions/455412", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4257/" ]
I am running into the ``` DBD::mysql::st execute failed: Got a packet bigger than 'max_allowed_packet' bytes ``` error when trying to make a large insert using Perl & MySQL. I know that increasing the `max_allowed_packet` setting in my.cnf could fix this, but is it possible to tell DBI (or DBD::mysql, since my app ...
Try adding something like `";max_allowed_packet=1MB"` to the fist argument of DBI->connect. If that doesn't work, you could use a `";mysql_read_default_file=/somewhere/my.cnf"` option pointing to a my.cnf file that has the proper configuration.
455,420
<p>I'm preparing to go to a computer science contest by completing problems from past contests. Most of them are pretty easy, but this one is bugging me...it seems simple but I'm just not being able to do it.</p> <p>If you have a string of ones and zeros:</p> <pre><code>100111010001111100101010 </code></pre> <p>What...
[ { "answer_id": 455430, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 2, "selected": false, "text": "<p>Just as a thought: why would you bother with the number on the right? It will always alternate between 1 and 0 won't ...
2009/01/18
[ "https://Stackoverflow.com/questions/455420", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50548/" ]
I'm preparing to go to a computer science contest by completing problems from past contests. Most of them are pretty easy, but this one is bugging me...it seems simple but I'm just not being able to do it. If you have a string of ones and zeros: ``` 100111010001111100101010 ``` What would be the code to take that a...
This is called Run-Length-Encoding (RLE) and is used in a number of things (such as the Windows Bitmap file-format) to provide very basic compression (especially if the original includes lots of repeated values (like a bitmap or fax) containing a long run of the same colour). ``` int[] array = { ........ }; // your va...
455,423
<p>I want to return the results of <code>select Column from Table</code> into a comma separated string using SQL Server.</p> <p>The column in question is rather large (<code>nvarchar(2000)</code>) so the solution has to be able to handle very large result values.</p>
[ { "answer_id": 455433, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 6, "selected": true, "text": "<pre><code>DECLARE @result nvarchar(max)\nSET @result = ''\n\nSELECT @result = @result + [Column] + N','\nFROM [TABLE]...
2009/01/18
[ "https://Stackoverflow.com/questions/455423", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34133/" ]
I want to return the results of `select Column from Table` into a comma separated string using SQL Server. The column in question is rather large (`nvarchar(2000)`) so the solution has to be able to handle very large result values.
``` DECLARE @result nvarchar(max) SET @result = '' SELECT @result = @result + [Column] + N',' FROM [TABLE] --TODO: trim last ',' if you require PRINT @result ``` If `Column` can be null, then either exclude it first, or use `ISNULL`/`COALESCE` - otherwise a single `NULL` will break the entire sequence. It is more ...
455,434
<p><strong>Without</strong>:</p> <ul> <li>MFC</li> <li>ATL</li> </ul> <p>How can I use <a href="http://msdn.microsoft.com/en-us/library/ms679351.aspx" rel="noreferrer"><code>FormatMessage()</code></a> to get the error text for a <code>HRESULT</code>?</p> <pre><code> HRESULT hresult = application.CreateInstance("Exce...
[ { "answer_id": 455458, "author": "David Hanak", "author_id": 42136, "author_profile": "https://Stackoverflow.com/users/42136", "pm_score": 4, "selected": false, "text": "<p>Try this:</p>\n\n<pre><code>void PrintLastError (const char *msg /* = \"Error occurred\" */) {\n DWORD errCo...
2009/01/18
[ "https://Stackoverflow.com/questions/455434", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51078/" ]
**Without**: * MFC * ATL How can I use [`FormatMessage()`](http://msdn.microsoft.com/en-us/library/ms679351.aspx) to get the error text for a `HRESULT`? ``` HRESULT hresult = application.CreateInstance("Excel.Application"); if (FAILED(hresult)) { // what should i put here to obtain a human-readable // ...
Here's the proper way to get an error message back from the system for an `HRESULT` (named hresult in this case, or you can replace it with `GetLastError()`): ``` LPTSTR errorText = NULL; FormatMessage( // use system message tables to retrieve error text FORMAT_MESSAGE_FROM_SYSTEM // allocate buffer on local...
455,483
<p>I've this sample program of a step that I want to implement on my application. I want to push_back the int elements on the string separately, into a vector. How can I? </p> <pre><code>#include &lt;iostream&gt; #include &lt;sstream&gt; #include &lt;vector&gt; using namespace std; int main(){ string line = "1...
[ { "answer_id": 455487, "author": "mmx", "author_id": 33708, "author_profile": "https://Stackoverflow.com/users/33708", "pm_score": 5, "selected": true, "text": "<pre><code>int num;\nwhile (lineStream &gt;&gt; num) numbers.push_back(num);\n</code></pre>\n" }, { "answer_id": 455510...
2009/01/18
[ "https://Stackoverflow.com/questions/455483", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45963/" ]
I've this sample program of a step that I want to implement on my application. I want to push\_back the int elements on the string separately, into a vector. How can I? ``` #include <iostream> #include <sstream> #include <vector> using namespace std; int main(){ string line = "1 2 3 4 5"; //includes spaces ...
``` int num; while (lineStream >> num) numbers.push_back(num); ```
455,518
<p>As a novice C++ programmer there are some constructs that look still very obscure to me, one of these is <code>const</code>. You can use it in so many places and with so many different effects that is nearly impossible for a beginner to come out alive. Will some C++ guru explain once forever the various uses and whe...
[ { "answer_id": 455535, "author": "Johannes Schaub - litb", "author_id": 34509, "author_profile": "https://Stackoverflow.com/users/34509", "pm_score": 8, "selected": true, "text": "<p>Trying to collect some uses:</p>\n\n<p><strong>Binding some temporary to reference-to-const, to lengthen ...
2009/01/18
[ "https://Stackoverflow.com/questions/455518", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25418/" ]
As a novice C++ programmer there are some constructs that look still very obscure to me, one of these is `const`. You can use it in so many places and with so many different effects that is nearly impossible for a beginner to come out alive. Will some C++ guru explain once forever the various uses and whether and/or wh...
Trying to collect some uses: **Binding some temporary to reference-to-const, to lengthen its lifetime.** The reference can be a base - and the destructor of it doesn't need to be virtual - the right destructor is still called: ``` ScopeGuard const& guard = MakeGuard(&cleanUpFunction); ``` *Explanation*, using code:...
455,544
<blockquote> <p>I have a program that takes input from stdin and also takes some parameters from command line. It looks like this:</p> <pre><code>cat input.txt &gt; myprogram -path "/home/user/work" </code></pre> <p>I try to debug the code with gdb inside emacs, by M-x gdb, I try to load the program wit...
[ { "answer_id": 455588, "author": "Alnitak", "author_id": 6782, "author_profile": "https://Stackoverflow.com/users/6782", "pm_score": 8, "selected": true, "text": "<p>If you were doing it from a shell you'd do it like this:</p>\n\n<pre><code>% gdb myprogram\ngdb&gt; run params ... &lt; in...
2009/01/18
[ "https://Stackoverflow.com/questions/455544", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45620/" ]
> > I have a program that takes input from > stdin and also takes some parameters > from command line. It looks like this: > > > > ``` > cat input.txt > myprogram -path "/home/user/work" > > ``` > > I try to debug the code with gdb > inside emacs, by M-x gdb, I try to > load the program with the command: > >...
If you were doing it from a shell you'd do it like this: ``` % gdb myprogram gdb> run params ... < input.txt ``` This seems to work within emacs too.
455,551
<p>I'm still fumbling my way around WPF at the moment, and can not figure out why this context menu item is disabled:</p> <pre><code>&lt;Window x:Class="DisabledMenuItemProblem.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xa...
[ { "answer_id": 456645, "author": "Muad'Dib", "author_id": 49910, "author_profile": "https://Stackoverflow.com/users/49910", "pm_score": 5, "selected": true, "text": "<p>here is the general pattern that I use....</p>\n\n<p>first, keep your commands in thier own static class, this promotes...
2009/01/18
[ "https://Stackoverflow.com/questions/455551", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26759/" ]
I'm still fumbling my way around WPF at the moment, and can not figure out why this context menu item is disabled: ``` <Window x:Class="DisabledMenuItemProblem.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns...
here is the general pattern that I use.... first, keep your commands in thier own static class, this promotes reuse,etc.... ``` public static class MyCommands { public static RoutedUICommand CmdFoo = new RoutedUICommand("CmdFoo", "CmdFoo", ...
455,553
<p>In my question "<a href="https://stackoverflow.com/questions/419222/how-do-i-get-nsstring-sizewithfontforwidthlinebreakmode-to-work">How do I get <code>-[NSString sizeWithFont:forWidth:lineBreakMode:]</code> to work?</a>", I learned that <code>-[NSString sizeWithFont:constrainedToSize:lineBreakMode:]</code> was actu...
[ { "answer_id": 455599, "author": "Marc Charbonneau", "author_id": 35136, "author_profile": "https://Stackoverflow.com/users/35136", "pm_score": 2, "selected": false, "text": "<p>It sounds like it would be good for single line labels. For example, if you're drawing a string that may be tr...
2009/01/18
[ "https://Stackoverflow.com/questions/455553", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4766/" ]
In my question "[How do I get `-[NSString sizeWithFont:forWidth:lineBreakMode:]` to work?](https://stackoverflow.com/questions/419222/how-do-i-get-nsstring-sizewithfontforwidthlinebreakmode-to-work)", I learned that `-[NSString sizeWithFont:constrainedToSize:lineBreakMode:]` was actually what I needed. The documentati...
It works great for multi line strings as well. Basically its a function that lets you see how big a string is going to be when rendered with a font and line break mode. I use it in a few spots in my application when I have variable length text I want to display in a certain area. By default a UILabel will center the...
455,554
<p>Is there anyone sitting on a PHP function to convert a date of format 0000-00-00 00:00:00(datetimesql) to unix timestamp?</p>
[ { "answer_id": 455561, "author": "Alnitak", "author_id": 6782, "author_profile": "https://Stackoverflow.com/users/6782", "pm_score": 3, "selected": false, "text": "<p>Use <code>strptime()</code> to parse the time and turn it into a structured array.</p>\n\n<p>Then pass the results of tha...
2009/01/18
[ "https://Stackoverflow.com/questions/455554", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Is there anyone sitting on a PHP function to convert a date of format 0000-00-00 00:00:00(datetimesql) to unix timestamp?
Another option as you have tagged this question with SQL: the MySQL functions `FROM_UNIXTIME` and `UNIX_TIMESTAMP` -> [MySQL manual](http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html) ``` SELECT UNIX_TIMESTAMP(datetime_column) FROM table ``` This usually is faster than a PHP function call.
455,563
<p>Can i get some good tutorials on XPand.. i need to get info on commands like LET. It would better if some one could post some samples on it.</p> <p>The problem i am facing is like.. i run a "for" loop and after checking some condition i need to increment a counter . but i am unable to do so. when i increment the co...
[ { "answer_id": 463600, "author": "jamesh", "author_id": 4737, "author_profile": "https://Stackoverflow.com/users/4737", "pm_score": 2, "selected": true, "text": "<p>There is a <a href=\"http://www.peterfriese.de/using-xpand-in-your-eclipse-wizards/\" rel=\"nofollow noreferrer\">worked ex...
2009/01/18
[ "https://Stackoverflow.com/questions/455563", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50388/" ]
Can i get some good tutorials on XPand.. i need to get info on commands like LET. It would better if some one could post some samples on it. The problem i am facing is like.. i run a "for" loop and after checking some condition i need to increment a counter . but i am unable to do so. when i increment the counter, it ...
There is a [worked example](http://www.peterfriese.de/using-xpand-in-your-eclipse-wizards/) which templates Ant scripts. The same article is republished on DZone. More specifically, [this paper](http://www.bar54.de/benjamin.klatt-Xpand.pdf) presents this example on the `LET` operator: ``` <<LET packageName + "." + cl...
455,571
<p>I've just noticed F# allows me to use let bindings with literals and other patterns as follows:</p> <pre><code>let fib 0 = 1 let exists item [] = false let car (hd :: tl) = hd let cdr (hd :: tl) = tl </code></pre> <p>F# correctly interprets these functions as a kind of pattern matching, because gives me the follow...
[ { "answer_id": 455638, "author": "JaredPar", "author_id": 23283, "author_profile": "https://Stackoverflow.com/users/23283", "pm_score": 4, "selected": false, "text": "<p>AFAIK, there is no way in F# to declare multiple let bindings with the same name and different pattern matching signat...
2009/01/18
[ "https://Stackoverflow.com/questions/455571", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40516/" ]
I've just noticed F# allows me to use let bindings with literals and other patterns as follows: ``` let fib 0 = 1 let exists item [] = false let car (hd :: tl) = hd let cdr (hd :: tl) = tl ``` F# correctly interprets these functions as a kind of pattern matching, because gives me the following warnings: > > Warnin...
JaredPar is right, F# doesn't have the syntactic form that Haskell does here. The F# form is mostly useful for breaking open single-case discriminated unions or for defining functions with incomplete matches (like your 'car' example that fails on the empty list). It's simply a consequence of the fact that practically ...
455,580
<p>I want to send a datetime.datetime object in serialized form from Python using <a href="http://en.wikipedia.org/wiki/JSON" rel="noreferrer">JSON</a> and de-serialize in JavaScript using JSON. What is the best way to do this?</p>
[ { "answer_id": 455863, "author": "Kenan Banks", "author_id": 43089, "author_profile": "https://Stackoverflow.com/users/43089", "pm_score": 5, "selected": false, "text": "<p>If you're certain that only Javascript will be consuming the JSON, I prefer to pass Javascript <code>Date</code> ob...
2009/01/18
[ "https://Stackoverflow.com/questions/455580", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I want to send a datetime.datetime object in serialized form from Python using [JSON](http://en.wikipedia.org/wiki/JSON) and de-serialize in JavaScript using JSON. What is the best way to do this?
You can add the 'default' parameter to json.dumps to handle this: ``` date_handler = lambda obj: ( obj.isoformat() if isinstance(obj, (datetime.datetime, datetime.date)) else None ) json.dumps(datetime.datetime.now(), default=date_handler) '"2010-04-20T20:08:21.634121"' ``` Which is [ISO 8601](http://en....
455,606
<p>On a Mac, I have a txt file with two columns, one being an autoincrement in an sqlite table:</p> <pre><code>, "mytext1" , "mytext2" , "mytext3" </code></pre> <p>When I try to import this file, I get a datatype mismatch error:</p> <pre><code>.separator "," .import mytextfile.txt mytable </code></pre> <p>How shoul...
[ { "answer_id": 476749, "author": "alexandroid", "author_id": 49678, "author_profile": "https://Stackoverflow.com/users/49678", "pm_score": 4, "selected": true, "text": "<p>I was looking on the same problem. Looks like I've found an <a href=\"http://www.nabble.com/Re%3A-import-operation--...
2009/01/18
[ "https://Stackoverflow.com/questions/455606", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40106/" ]
On a Mac, I have a txt file with two columns, one being an autoincrement in an sqlite table: ``` , "mytext1" , "mytext2" , "mytext3" ``` When I try to import this file, I get a datatype mismatch error: ``` .separator "," .import mytextfile.txt mytable ``` How should the txt file be structured so that it uses the ...
I was looking on the same problem. Looks like I've found an [answer](http://www.nabble.com/Re%3A-import-operation---primary-key-need-to-be-automatically-generated-by-SQLite-(not-from-csv-file)-p9352607.html) on the first part of your question — about importing a file into a table with ID field. So yes, create a tempor...
455,612
<p>I want <code>a</code> to be rounded to <em>13.95</em>. I tried using <a href="https://docs.python.org/2/library/functions.html#round" rel="noreferrer"><code>round</code></a>, but I get:</p> <pre><code>&gt;&gt;&gt; a 13.949999999999999 &gt;&gt;&gt; round(a, 2) 13.949999999999999 </code></pre> <hr /> <p><sub>For the a...
[ { "answer_id": 455634, "author": "Rex Logan", "author_id": 32958, "author_profile": "https://Stackoverflow.com/users/32958", "pm_score": 11, "selected": false, "text": "<p>You are running into the <a href=\"https://en.wikipedia.org/wiki/IEEE_754\" rel=\"noreferrer\">old problem</a> with ...
2009/01/18
[ "https://Stackoverflow.com/questions/455612", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I want `a` to be rounded to *13.95*. I tried using [`round`](https://docs.python.org/2/library/functions.html#round), but I get: ``` >>> a 13.949999999999999 >>> round(a, 2) 13.949999999999999 ``` --- For the analogous issue with the standard library Decimal class, see [How can I format a decimal to always show 2 d...
You are running into the [old problem](https://en.wikipedia.org/wiki/IEEE_754) with floating point numbers that not all numbers can be represented exactly. The command line is just showing you the full floating point form from memory. With floating point representation, your rounded version is the same number. Since c...
455,656
<p><strong>Update: somehow this works when running flash in browser, but doesn't work if you run from IDE. You might want to try running in browser if you have the same problem.</strong></p> <p>I am making a chat application that repeatedly reads a text file from my server using Flash &amp; Actionscript 3.0. I am open...
[ { "answer_id": 456041, "author": "David Hanak", "author_id": 42136, "author_profile": "https://Stackoverflow.com/users/42136", "pm_score": 1, "selected": false, "text": "<p>I'm just guessing here, but perhaps the Flash Engine is blocked by the various parallel <code>URLLoader</code>s (if...
2009/01/18
[ "https://Stackoverflow.com/questions/455656", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8005/" ]
**Update: somehow this works when running flash in browser, but doesn't work if you run from IDE. You might want to try running in browser if you have the same problem.** I am making a chat application that repeatedly reads a text file from my server using Flash & Actionscript 3.0. I am opening the file with URLLoader...
For this scenario, best practice dictates using a single instance of URLLoader; chances are you're getting blocked somewhere by competing calls. As well, you might try using a simple flag to detect whether your loader's busy on an existing call before making another one; here's a working example using a single loader m...
455,657
<p>As an example:</p> <pre><code>SELECT name, address, phone FROM USER; </code></pre> <p>Generates the table</p> <pre><code>name | address | phone ... | ... | ... </code></pre> <p>How can i use this table generated to make another query to it?</p> <p>For example:</p> <pre><code>SELECT count(address) FROM (...
[ { "answer_id": 455673, "author": "cmsjr", "author_id": 23114, "author_profile": "https://Stackoverflow.com/users/23114", "pm_score": 4, "selected": true, "text": "<p>Use the same syntax but give your derived table an alias</p>\n\n<pre><code>SELECT count(subadd.address) \nFROM (SELECT nam...
2009/01/18
[ "https://Stackoverflow.com/questions/455657", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26004/" ]
As an example: ``` SELECT name, address, phone FROM USER; ``` Generates the table ``` name | address | phone ... | ... | ... ``` How can i use this table generated to make another query to it? For example: ``` SELECT count(address) FROM (SELECT name, address, phone, from user); ``` I know it's not the ...
Use the same syntax but give your derived table an alias ``` SELECT count(subadd.address) FROM (SELECT name, address, phone, from user) as subadd; ```