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
323,704
<p>Does anyone know of a definitive list of LINQ to SQL query limitations that are not trapped at compile time, along with (where possible) workarounds for the limitations?</p> <p>The list we have so far is:</p> <ul> <li>Calling methods such as <code>.Date</code> on <code>DateTime</code> <ul> <li>no workaround found...
[ { "answer_id": 482956, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 5, "selected": true, "text": "<p>Basically, that list is huge... it is everything outside of the relatively <a href=\"http://msdn.microsoft.com/en-u...
2008/11/27
[ "https://Stackoverflow.com/questions/323704", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39709/" ]
Does anyone know of a definitive list of LINQ to SQL query limitations that are not trapped at compile time, along with (where possible) workarounds for the limitations? The list we have so far is: * Calling methods such as `.Date` on `DateTime` + no workaround found * `string.IsNullOrEmpty` + simple, just use `== ...
Basically, that list is huge... it is everything outside of the relatively [small set of things that **are** handled](http://msdn.microsoft.com/en-us/library/bb386970.aspx). Unfortunately, the [Law Of Leaky Abstractions](http://www.joelonsoftware.com/articles/LeakyAbstractions.html) kicks in, and each provider has diff...
323,711
<p>This SQL query was generated by Microsoft Access 2003, and works fine when run, but fails when trying to run from a Macro. Is there any obvious error within the query, or any reason it would not work?</p> <pre><code>SELECT tblAuction.article_no, tblAuction.article_name, tblAuction.subtitle, tblAuction.current_bid, ...
[ { "answer_id": 323719, "author": "Chris Simpson", "author_id": 28896, "author_profile": "https://Stackoverflow.com/users/28896", "pm_score": 2, "selected": false, "text": "<p>If you're deploying files to the bin folder or the web.config, this will automatically reset the site for very go...
2008/11/27
[ "https://Stackoverflow.com/questions/323711", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1246613/" ]
This SQL query was generated by Microsoft Access 2003, and works fine when run, but fails when trying to run from a Macro. Is there any obvious error within the query, or any reason it would not work? ``` SELECT tblAuction.article_no, tblAuction.article_name, tblAuction.subtitle, tblAuction.current_bid, tblAuction.sta...
You could store your session in a [SQL database](http://msdn.microsoft.com/en-us/library/ms229862(VS.80).aspx), thus the application restart would not lose your sessions. Having precompiled non updatable code to deploy would make your xcopy faster alright but app pool would still be restarted. UPDATE: @configurator, ...
323,741
<p>I have an existing ASP.NET 2.0 website, stored in Team Foundation Server 2005. Some of the pages/controls are encoded as ANSI (according to Notepad++) and the Content-Type header is set to:</p> <pre><code>&lt;meta http-equiv="Content-Type" content="text/html; charset=windows-1252"/&gt; </code></pre> <p>I would lik...
[ { "answer_id": 323757, "author": "Barry Kelly", "author_id": 3712, "author_profile": "https://Stackoverflow.com/users/3712", "pm_score": 3, "selected": true, "text": "<p>It depends on how much of the text in your codebase is using characters outside the ASCII range of 0..127.</p>\n\n<p>Y...
2008/11/27
[ "https://Stackoverflow.com/questions/323741", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12124/" ]
I have an existing ASP.NET 2.0 website, stored in Team Foundation Server 2005. Some of the pages/controls are encoded as ANSI (according to Notepad++) and the Content-Type header is set to: ``` <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"/> ``` I would like to change all pages to UTF-8, ...
It depends on how much of the text in your codebase is using characters outside the ASCII range of 0..127. You might want to scan for those first, to see how much impact it will have. If your codebase is primarily in English, then you probably don't have much to worry about.
323,742
<p>Which one would you use to draw stuff on a winform? Format32bppRgb or Format24bppRgb or something else?</p> <p><a href="http://msdn.microsoft.com/en-us/library/system.drawing.imaging.pixelformat.aspx" rel="nofollow noreferrer">in any .net version</a></p> <pre><code>Format24bppRgb Specifies that the format is 24 bi...
[ { "answer_id": 323757, "author": "Barry Kelly", "author_id": 3712, "author_profile": "https://Stackoverflow.com/users/3712", "pm_score": 3, "selected": true, "text": "<p>It depends on how much of the text in your codebase is using characters outside the ASCII range of 0..127.</p>\n\n<p>Y...
2008/11/27
[ "https://Stackoverflow.com/questions/323742", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40868/" ]
Which one would you use to draw stuff on a winform? Format32bppRgb or Format24bppRgb or something else? [in any .net version](http://msdn.microsoft.com/en-us/library/system.drawing.imaging.pixelformat.aspx) ``` Format24bppRgb Specifies that the format is 24 bits per pixel; 8 bits each are used for the red, green, and...
It depends on how much of the text in your codebase is using characters outside the ASCII range of 0..127. You might want to scan for those first, to see how much impact it will have. If your codebase is primarily in English, then you probably don't have much to worry about.
323,750
<p>Is there a way to access a <code>list</code>'s (or <code>tuple</code>'s, or other iterable's) next or previous element while looping through it with a <code>for</code> loop?</p> <pre><code>l = [1, 2, 3] for item in l: if item == 2: get_previous(l, item) </code></pre>
[ { "answer_id": 323798, "author": "chirag", "author_id": 40596, "author_profile": "https://Stackoverflow.com/users/40596", "pm_score": 0, "selected": false, "text": "<p>Iterators only have the next() method so you cannot look forwards or backwards, you can only get the next item.</p>\n\n<...
2008/11/27
[ "https://Stackoverflow.com/questions/323750", "https://Stackoverflow.com", "https://Stackoverflow.com/users/985/" ]
Is there a way to access a `list`'s (or `tuple`'s, or other iterable's) next or previous element while looping through it with a `for` loop? ``` l = [1, 2, 3] for item in l: if item == 2: get_previous(l, item) ```
Expressed as a generator function: ``` def neighborhood(iterable): iterator = iter(iterable) prev_item = None current_item = next(iterator) # throws StopIteration if empty. for next_item in iterator: yield (prev_item, current_item, next_item) prev_item = current_item current_it...
323,763
<p>I'm wondering if it's possible to define a foreign key in a models.py file in Django that is a reference to a table in another app?</p> <p>In other words, I have two apps, called cf and profiles, and in cf/models.py I have (amongst other things):</p> <pre><code>class Movie(models.Model): title = models.CharFie...
[ { "answer_id": 323900, "author": "Ben", "author_id": 11522, "author_profile": "https://Stackoverflow.com/users/11522", "pm_score": 3, "selected": false, "text": "<p>OK - I've figured it out. You can do it, you just have to use the right <code>import</code> syntax. The correct syntax is:<...
2008/11/27
[ "https://Stackoverflow.com/questions/323763", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11522/" ]
I'm wondering if it's possible to define a foreign key in a models.py file in Django that is a reference to a table in another app? In other words, I have two apps, called cf and profiles, and in cf/models.py I have (amongst other things): ``` class Movie(models.Model): title = models.CharField(max_length=255) `...
According to the docs, your second attempt should work: > > To refer to models defined in another application, you must instead explicitly specify the application label. For example, if the Manufacturer model above is defined in another application called production, you'd need to use: > > > ``` class Car(models....
323,782
<p>It' possible to use Junitperf with junit4? I've a simplet Junit4 test class with several tests and I want to do a TimedTest on single test of that class. How can I do that?</p> <p>To be more clear my Junit4 class is something like:</p> <pre><code>public class TestCitta { @Test public void test1 {} ...
[ { "answer_id": 2555055, "author": "Volker", "author_id": 306235, "author_profile": "https://Stackoverflow.com/users/306235", "pm_score": 3, "selected": false, "text": "<p>I had the same problem but was not lucky trying to make it run in different build environments. So I used the @Rule f...
2008/11/27
[ "https://Stackoverflow.com/questions/323782", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
It' possible to use Junitperf with junit4? I've a simplet Junit4 test class with several tests and I want to do a TimedTest on single test of that class. How can I do that? To be more clear my Junit4 class is something like: ``` public class TestCitta { @Test public void test1 {} @Test public vo...
I had the same problem but was not lucky trying to make it run in different build environments. So I used the @Rule feature available since JUnit 4 to inject performance test invocation and requirements checking using annotations. It turned out to become a small library which replaced JUnitPerf in this project and I pu...
323,790
<p>I have a project with several sources directories : </p> <pre><code>src/A /B /C </code></pre> <p>In each, the Makefile.am contains </p> <pre><code>AM_CXXFLAGS = -fPIC -Wall -Wextra </code></pre> <p>How can avoid repeating this in each source folder ? </p> <p>I tried to modifiy src/Makefile.am and the conf...
[ { "answer_id": 325436, "author": "adl", "author_id": 27835, "author_profile": "https://Stackoverflow.com/users/27835", "pm_score": 6, "selected": true, "text": "<p>You can do several things:</p>\n\n<p>(1) One solution is to include a common makefile fragment on all your <code>Makefile.am...
2008/11/27
[ "https://Stackoverflow.com/questions/323790", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20986/" ]
I have a project with several sources directories : ``` src/A /B /C ``` In each, the Makefile.am contains ``` AM_CXXFLAGS = -fPIC -Wall -Wextra ``` How can avoid repeating this in each source folder ? I tried to modifiy src/Makefile.am and the configure.in, but without success. I thought I could use AC\...
You can do several things: (1) One solution is to include a common makefile fragment on all your `Makefile.am`s: ``` include $(top_srcdir)/common.mk ... bin_PROGRAMS = foo foo_SOURCES = ... ``` in that case you would write ``` AM_CXXFLAGS = -fpic -Wall -Wextra ``` to `common.mk` and in the future it will be easi...
323,816
<blockquote> <p>Write a class ListNode which has the following properties:</p> <ul> <li>int value;</li> <li>ListNode *next;</li> </ul> <p>Provide the following functions:</p> <ul> <li>ListNode(int v, ListNode *l)</li> <li>int getValue();</li> <li>ListNode* getNext();</li> <li>void insert(int i);</li> <li>bool listconta...
[ { "answer_id": 323820, "author": "unwind", "author_id": 28169, "author_profile": "https://Stackoverflow.com/users/28169", "pm_score": 2, "selected": false, "text": "<p>I think you're over-engineering the list node modelling. The class ListNode <strong><a href=\"http://en.wikipedia.org/wi...
2008/11/27
[ "https://Stackoverflow.com/questions/323816", "https://Stackoverflow.com", "https://Stackoverflow.com/users/135/" ]
> > Write a class ListNode which has the following properties: > > > * int value; > * ListNode \*next; > > > Provide the following functions: > > > * ListNode(int v, ListNode \*l) > * int getValue(); > * ListNode\* getNext(); > * void insert(int i); > * bool listcontains(int j); > > > Write a program which ask...
What unwind and ckarmann say. Here is a hint, i implement listcontains for you to give you the idea how the assignment could be meant: ``` class ListNode { private: int value; ListNode * next; public: bool listcontains(int v) { // does this node contain the value? if(value == v) return tr...
323,817
<p>I query all security groups in a specific domain using </p> <pre><code>PrincipalSearchResult&lt;Principal&gt; results = ps.FindAll(); </code></pre> <p>where ps is a PrincipalSearcher.</p> <p>I then need to iterate the result (casting it to a GroupPrincipal first ) and locate the ones that contains a specific stri...
[ { "answer_id": 789407, "author": "Kasper", "author_id": 23499, "author_profile": "https://Stackoverflow.com/users/23499", "pm_score": 2, "selected": true, "text": "<p>I have been returning to this challange over and over again, but now I have finally given up. It sure looks like that pro...
2008/11/27
[ "https://Stackoverflow.com/questions/323817", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23499/" ]
I query all security groups in a specific domain using ``` PrincipalSearchResult<Principal> results = ps.FindAll(); ``` where ps is a PrincipalSearcher. I then need to iterate the result (casting it to a GroupPrincipal first ) and locate the ones that contains a specific string in the notes field. But the Notes f...
I have been returning to this challange over and over again, but now I have finally given up. It sure looks like that property is inaccessible.
323,829
<p>This code</p> <pre><code>select.select([sys.stdin], [], [], 1.0) </code></pre> <p>does exactly what I want on Linux, but not in Windows.</p> <p>I've used <code>kbhit()</code> in <code>msvcrt</code> before to see if data is available on stdin for reading, but in this case it always returns <code>0</code>. Additio...
[ { "answer_id": 323902, "author": "S.Lott", "author_id": 10661, "author_profile": "https://Stackoverflow.com/users/10661", "pm_score": 2, "selected": false, "text": "<p>In some rare situations, you might care what stdin is connected to. Mostly, you don't care -- you just read stdin.</p>\...
2008/11/27
[ "https://Stackoverflow.com/questions/323829", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22847/" ]
This code ``` select.select([sys.stdin], [], [], 1.0) ``` does exactly what I want on Linux, but not in Windows. I've used `kbhit()` in `msvcrt` before to see if data is available on stdin for reading, but in this case it always returns `0`. Additionally `msvcrt.getch()` returns `'\xff'` whereas `sys.stdin.read(1)`...
In some rare situations, you might care what stdin is connected to. Mostly, you don't care -- you just read stdin. In `someprocess | python myprogram.py`, stdin is connected to a pipe; in this case, the stdout of the previous process. You simply read from `sys.stdin` and you're reading from the other process. [Note th...
323,837
<p>I've been working a little with DevExpress CodeRush and Refactor! Pro this week, and I picked up a commentor plug-in that will automatically generate comments as you type code.</p> <p>I don't want to go into how good a job it does of picking out basic meaning (pretty good, actually) but it's default implementation ...
[ { "answer_id": 323843, "author": "LeppyR64", "author_id": 16592, "author_profile": "https://Stackoverflow.com/users/16592", "pm_score": 5, "selected": true, "text": "<p>I think comments like that are useless, unless of course the code is awful. With proper formatting of code it's not di...
2008/11/27
[ "https://Stackoverflow.com/questions/323837", "https://Stackoverflow.com", "https://Stackoverflow.com/users/377/" ]
I've been working a little with DevExpress CodeRush and Refactor! Pro this week, and I picked up a commentor plug-in that will automatically generate comments as you type code. I don't want to go into how good a job it does of picking out basic meaning (pretty good, actually) but it's default implementation does raise...
I think comments like that are useless, unless of course the code is awful. With proper formatting of code it's not difficult to see where a block starts and where a block ends because usually those blocks are indented. Edit: If a procedure is so big that is not readily apparent what block of code is being closed by a...
323,857
<p>I'm having trouble trying to optimize the following query for sql server 2005. Does anyone know how could I improve it. Each one of the tables used there have about 40 million rows each. I've tried my best trying to optimize it but I manage to do the exact opposite.</p> <p>Thanks</p> <pre><code>SELECT cos ...
[ { "answer_id": 323882, "author": "Dave Markle", "author_id": 24995, "author_profile": "https://Stackoverflow.com/users/24995", "pm_score": 1, "selected": false, "text": "<p>Put a composite index on cos and sin on each of the tables. That's as good as you're going to get without restruct...
2008/11/27
[ "https://Stackoverflow.com/questions/323857", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16316/" ]
I'm having trouble trying to optimize the following query for sql server 2005. Does anyone know how could I improve it. Each one of the tables used there have about 40 million rows each. I've tried my best trying to optimize it but I manage to do the exact opposite. Thanks ``` SELECT cos , SIN FROM ...
It seems that the query is just combining the separated history tables into a single result set containing all the data. In that case the query is already optimal.
323,907
<p>I have this code, which works fine, but I would like to be able to make it so when an image appears the text layer disapears, and there would be a link to bring the xt back and remove the image. How would I do this..., something to do with changing isibility and overlaying?</p> <pre><code>&lt;html&gt; &lt;script ...
[ { "answer_id": 323924, "author": "rajesh pillai", "author_id": 34644, "author_profile": "https://Stackoverflow.com/users/34644", "pm_score": 3, "selected": true, "text": "<p>I haven't tried this but the \"Dupli Find\" available at <a href=\"http://www.rlvision.com/dupli/about.asp\" rel=\...
2008/11/27
[ "https://Stackoverflow.com/questions/323907", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1246613/" ]
I have this code, which works fine, but I would like to be able to make it so when an image appears the text layer disapears, and there would be a link to bring the xt back and remove the image. How would I do this..., something to do with changing isibility and overlaying? ``` <html> <script type="text/javascript">...
I haven't tried this but the "Dupli Find" available at <http://www.rlvision.com/dupli/about.asp> may be of help to you. The windows powershell script outlined in <http://secretgeek.net/ps_duplicates.asp> also helps you write a custom tool. There is also a scripting solution at <http://www.microsoft.com/technet/scrip...
323,922
<p>I want to create maintainable code, but this inheritance situation is causing me problems.</p> <p>The issue is with my 2nd database helper class named <b>InitUserExtension</b>.</p> <p>Since UserExtension inherits from User, I have to make sure that I <b>mirror</b> any changes in my InitUser helper to InitUserExten...
[ { "answer_id": 323947, "author": "vfilby", "author_id": 24279, "author_profile": "https://Stackoverflow.com/users/24279", "pm_score": 1, "selected": false, "text": "<p>Why don't you call <code>InitUser</code> from the <code>InitUserExtension</code> method. Let the base initialization ha...
2008/11/27
[ "https://Stackoverflow.com/questions/323922", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39677/" ]
I want to create maintainable code, but this inheritance situation is causing me problems. The issue is with my 2nd database helper class named **InitUserExtension**. Since UserExtension inherits from User, I have to make sure that I **mirror** any changes in my InitUser helper to InitUserExtension. I really don't l...
How about moving the processing of Name etc into a method (accepting either a User or a T : User), and call that from both? ``` private static void InitUser(User user, SqlDataReader dr) { // could also use an interface here, or generics with T : User user.Name = Convert.ToString(dr["name"]); user.Age ... } public...
323,928
<p>There are two pictureboxes with two different images.</p> <p>If I click on one picture box, the image in it should be cleared.</p> <p>To make the matters worse, both of the picture boxes have only one common event handler. How can I know which picturebox generated the event? I would appreciate source code in C++-C...
[ { "answer_id": 323959, "author": "kgiannakakis", "author_id": 24054, "author_profile": "https://Stackoverflow.com/users/24054", "pm_score": 0, "selected": false, "text": "<p>You can use the sender object. Cast it to a picture box control and compare it with the two available picture boxe...
2008/11/27
[ "https://Stackoverflow.com/questions/323928", "https://Stackoverflow.com", "https://Stackoverflow.com/users/184/" ]
There are two pictureboxes with two different images. If I click on one picture box, the image in it should be cleared. To make the matters worse, both of the picture boxes have only one common event handler. How can I know which picturebox generated the event? I would appreciate source code in C++-CLI I need to kno...
How are you doing the cast? In most cases like this I would use: ``` PictureBox ^pb = safe_cast<PictureBox^>(sender); if(pb != null) { // logic goes here } ``` (Note that I've corrected the above code after Josh pointed out my reference flaw. Thanks!) the dynamic cast will give you the right object type if it c...
323,955
<p>How do you combine two jQuery search results? eg:</p> <pre><code>var $allFoos = $('.foo'), $allBars = $('.bar') $allFoosAndBars = $allFoos + $allBars; </code></pre> <p>Obviously, I just made up that last line, but I hope it makes it sorta clear what I mean. To be clear, the example is greatly simplified, a...
[ { "answer_id": 323969, "author": "Simon", "author_id": 33036, "author_profile": "https://Stackoverflow.com/users/33036", "pm_score": 9, "selected": true, "text": "<p>You can use <a href=\"https://api.jquery.com/add/\" rel=\"noreferrer\">add()</a>;</p>\n\n<pre><code>var $foos = $('.foo');...
2008/11/27
[ "https://Stackoverflow.com/questions/323955", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9021/" ]
How do you combine two jQuery search results? eg: ``` var $allFoos = $('.foo'), $allBars = $('.bar') $allFoosAndBars = $allFoos + $allBars; ``` Obviously, I just made up that last line, but I hope it makes it sorta clear what I mean. To be clear, the example is greatly simplified, and it could be any arbitra...
You can use [add()](https://api.jquery.com/add/); ``` var $foos = $('.foo'); var $foosAndBars = $foos.add('.bar'); ``` or ``` var $allFoosAndBars = $allFoos.add($allBars); ```
323,957
<p>I need to edit <code>/etc/sudoers</code> from a script to add/remove stuff from white lists.</p> <p>Assuming I have a command that would work on a normal file, how could I apply it to <code>/etc/sudoers</code>?</p> <p>Can I copy and modify it, then have <code>visudo</code> replace the original with the modified co...
[ { "answer_id": 324009, "author": "Brian C. Lane", "author_id": 27461, "author_profile": "https://Stackoverflow.com/users/27461", "pm_score": 5, "selected": false, "text": "<p>You should make your edits to a temporary file, then use visudo -c -f sudoers.temp to confirm that the changes ar...
2008/11/27
[ "https://Stackoverflow.com/questions/323957", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23420/" ]
I need to edit `/etc/sudoers` from a script to add/remove stuff from white lists. Assuming I have a command that would work on a normal file, how could I apply it to `/etc/sudoers`? Can I copy and modify it, then have `visudo` replace the original with the modified copy? By providing my own script in `$EDITOR`? Or c...
Old thread, but what about: ``` echo 'foobar ALL=(ALL:ALL) ALL' | sudo EDITOR='tee -a' visudo ```
323,972
<p>Is it possible to terminate a running thread without setting/checking any flags/semaphores/etc.?</p>
[ { "answer_id": 323981, "author": "Lasse V. Karlsen", "author_id": 267, "author_profile": "https://Stackoverflow.com/users/267", "pm_score": 5, "selected": false, "text": "<p>You should never forcibly kill a thread without cooperating with it.</p>\n\n<p>Killing a thread removes any guaran...
2008/11/27
[ "https://Stackoverflow.com/questions/323972", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28121/" ]
Is it possible to terminate a running thread without setting/checking any flags/semaphores/etc.?
It is generally a bad pattern to kill a thread abruptly, in Python, and in any language. Think of the following cases: * the thread is holding a critical resource that must be closed properly * the thread has created several other threads that must be killed as well. The nice way of handling this, if you can afford i...
323,973
<p>I'm using .NET Regular Expressions to strip HTML code.</p> <p>Using something like:</p> <pre><code>&lt;title&gt;(?&lt;Title&gt;[\w\W]+?)&lt;/title&gt;[\w\W]+?&lt;div class="article"&gt;(?&lt;Text&gt;[\w\W]+?)&lt;/div&gt; </code></pre> <p>This works for 99% of the time, but sometimes, when parsing...</p> <pre><co...
[ { "answer_id": 323996, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 2, "selected": false, "text": "<p>With some effort, you can make regex work on html - however, have you looked at the <a href=\"http://www.codeplex....
2008/11/27
[ "https://Stackoverflow.com/questions/323973", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41385/" ]
I'm using .NET Regular Expressions to strip HTML code. Using something like: ``` <title>(?<Title>[\w\W]+?)</title>[\w\W]+?<div class="article">(?<Text>[\w\W]+?)</div> ``` This works for 99% of the time, but sometimes, when parsing... ``` Regex.IsMatch(HTML, Pattern) ``` The parser just blocks and it will continu...
Your regex will work just fine when your HTML string actually contains HTML that fits the pattern. But when your HTML does not fit the pattern, e.g. if the last tag is missing, your regex will exhibit what I call "[catastrophic backtracking](http://www.regular-expressions.info/catastrophic.html)". Click that link and s...
323,977
<p>i'm trying to use the GeoKit plugin to calculate the distance between 2 points. So the idea is, i do a search for an article, and the results i want to order by distance. So i have a form where I enter the article (that im looking for) and my address. Then rails must find all articles that match with my query and or...
[ { "answer_id": 324067, "author": "Stein G. Strindhaug", "author_id": 26115, "author_profile": "https://Stackoverflow.com/users/26115", "pm_score": 3, "selected": true, "text": "<p>I'm not really an SQL expert, and I find joins very hard to wrap my head around (even more than figuring out...
2008/11/27
[ "https://Stackoverflow.com/questions/323977", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18642/" ]
i'm trying to use the GeoKit plugin to calculate the distance between 2 points. So the idea is, i do a search for an article, and the results i want to order by distance. So i have a form where I enter the article (that im looking for) and my address. Then rails must find all articles that match with my query and order...
I'm not really an SQL expert, and I find joins very hard to wrap my head around (even more than figuring out multiple NOT's like `if(!(foo != !bar & (!baz)))` ) but I do feel that either the `:joins` line or the `:include` line is redundant, or even wrong. (I cleaned up your query so I could understand it, please do t...
324,041
<p>I have a folder with these files:</p> <pre><code>alongfilename1.txt &lt;--- created first alongfilename3.txt &lt;--- created second </code></pre> <p>When I run <strong>DIR /x</strong> in command prompt, I see these short names assigned:</p> <pre><code>ALONGF~1.TXT alongfilename1.txt ALONGF~2.TXT alongfilename3.tx...
[ { "answer_id": 324064, "author": "Piskvor left the building", "author_id": 19746, "author_profile": "https://Stackoverflow.com/users/19746", "pm_score": 4, "selected": true, "text": "<p>The short filename is created with the file. The algorithm works like this (usually, but see <a href=\...
2008/11/27
[ "https://Stackoverflow.com/questions/324041", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21263/" ]
I have a folder with these files: ``` alongfilename1.txt <--- created first alongfilename3.txt <--- created second ``` When I run **DIR /x** in command prompt, I see these short names assigned: ``` ALONGF~1.TXT alongfilename1.txt ALONGF~2.TXT alongfilename3.txt ``` Now, if I add another file: ``` alongfilename1....
The short filename is created with the file. The algorithm works like this (usually, but see [moocha's reply](https://stackoverflow.com/questions/324041/how-does-windows-determinehandle-the-dos-short-name-of-any-given-file#324087)): ``` counter = 1 stripped_filename = strip_dots(strip_non_ascii_characters(filename)) s...
324,045
<p>Using the .net framework you have the option to create temporary files with</p> <pre><code>Path.GetTempFileName(); </code></pre> <p>The MSDN doesn't tell us what happens to temporary files. I remember reading somewhere that they are deleted by the OS when it gets a restart. Is this true?</p> <p>If the files aren...
[ { "answer_id": 324050, "author": "Mihai Limbășan", "author_id": 14444, "author_profile": "https://Stackoverflow.com/users/14444", "pm_score": 1, "selected": false, "text": "<p>No, this is not true. Basically, your app is responsible for cleaning up its own mess. If you don't, temporary f...
2008/11/27
[ "https://Stackoverflow.com/questions/324045", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21634/" ]
Using the .net framework you have the option to create temporary files with ``` Path.GetTempFileName(); ``` The MSDN doesn't tell us what happens to temporary files. I remember reading somewhere that they are deleted by the OS when it gets a restart. Is this true? If the files aren't deleted by the OS, why are the...
The short answer: they don't get deleted. The long answer: The managed [`Path.GetTempFileName()`](http://msdn.microsoft.com/en-us/library/system.io.path.gettempfilename.aspx) method calls the native Win32API [`GetTempFileName()`](http://msdn.microsoft.com/en-us/library/aa364991.aspx) method, like this: ``` //actual...
324,066
<p>I have a BasePage class which all other pages derive from:</p> <pre><code>public class BasePage </code></pre> <p>This BasePage has a constructor which contains code which must always run:</p> <pre><code>public BasePage() { // Important code here } </code></pre> <p>I want to force derived classes to call the ...
[ { "answer_id": 324071, "author": "Johannes Schaub - litb", "author_id": 34509, "author_profile": "https://Stackoverflow.com/users/34509", "pm_score": 4, "selected": false, "text": "<p>The base class constructor taking no arguments is automatically run if you don't call any other base cla...
2008/11/27
[ "https://Stackoverflow.com/questions/324066", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12124/" ]
I have a BasePage class which all other pages derive from: ``` public class BasePage ``` This BasePage has a constructor which contains code which must always run: ``` public BasePage() { // Important code here } ``` I want to force derived classes to call the base constructor, like so: ``` public MyPage ...
The base constructor will always be called at some point. If you call `this(...)` instead of `base(...)` then that calls into another constructor in the same class - which again will have to either call yet another sibling constructor or a parent constructor. Sooner or later you will always get to a constructor which e...
324,080
<p>I'm extending the functionality of a class with a subclass, and I'm doing some dirty stuff that make superclass methods dangerous (app will hang in a loop) in the context of the subclass. I know it's not a genius idea, but I'm going for the low-hanging fruit, right now it's gonna save me some time. Oh it's a dirty j...
[ { "answer_id": 324094, "author": "Kibbee", "author_id": 1862, "author_profile": "https://Stackoverflow.com/users/1862", "pm_score": -1, "selected": false, "text": "<p>If you create the methods in your superclass as \"private\" then the subclass has no possible way of calling them. I'm n...
2008/11/27
[ "https://Stackoverflow.com/questions/324080", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36182/" ]
I'm extending the functionality of a class with a subclass, and I'm doing some dirty stuff that make superclass methods dangerous (app will hang in a loop) in the context of the subclass. I know it's not a genius idea, but I'm going for the low-hanging fruit, right now it's gonna save me some time. Oh it's a dirty job,...
Just re-implement the unsafe method in your subclass and have it do nothing or throw an exception or re-implement it as safe, just as long as the new implementation doesn't call the unsafe superclass method. For the C++ crew in here: Objective C doesn't let you mark methods as private. You can use its category system ...
324,085
<p>I want to know how to set a Publishing page content through the code (MOSS 2007).<br> This is how I've created the page:</p> <pre><code>PublishingPage page = publishingWeb.GetPublishingPages().Add("MyPage.aspx", pageLayout); SPFile pageFile = page.ListItem.File; page.Title = "My Page"; page.Upda...
[ { "answer_id": 324313, "author": "Pedrin", "author_id": 36183, "author_profile": "https://Stackoverflow.com/users/36183", "pm_score": 3, "selected": false, "text": "<p>I don't know if it's <strong>ok</strong> to answer my own question, but after reflecting Sharepoint's codebehind I was a...
2008/11/27
[ "https://Stackoverflow.com/questions/324085", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36183/" ]
I want to know how to set a Publishing page content through the code (MOSS 2007). This is how I've created the page: ``` PublishingPage page = publishingWeb.GetPublishingPages().Add("MyPage.aspx", pageLayout); SPFile pageFile = page.ListItem.File; page.Title = "My Page"; page.Update(); ``` But...
I don't know if it's **ok** to answer my own question, but after reflecting Sharepoint's codebehind I was able to find a way to set the page's content: ``` string content = "Welcome to <strong>My Page</strong>"; page.ListItem[FieldId.PublishingPageContent] = content; ```
324,102
<p>I'm building a full-screen demo where I need to simulate a YouTube video. I dragged a video that plays an external .flv file.</p> <p>It works fine if the stage isn't set to full-screen. But I need to set the stage to full-screen like this:</p> <pre><code>stage.displayState = StageDisplayState.FULL_SCREEN; stage.sc...
[ { "answer_id": 324164, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "<p>Try setting the \"scaleMode\" parameter to \"noScale\" in the component's parameters?</p>\n" }, { "answer_id": 4167...
2008/11/27
[ "https://Stackoverflow.com/questions/324102", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm building a full-screen demo where I need to simulate a YouTube video. I dragged a video that plays an external .flv file. It works fine if the stage isn't set to full-screen. But I need to set the stage to full-screen like this: ``` stage.displayState = StageDisplayState.FULL_SCREEN; stage.scaleMode = StageScaleM...
The glitch seems to be caused by having an `flvPlayback` component on the stage, but not on the first frame of a timeline. The easiest solution is to either have the compnent on the first frame. Alternatively if that's impractical, then simply putting the component on the first frame of a movie clip seems to work. ...
324,105
<p>Can anyone point me out, how can I parse/evaluate HQL and get map where key is table alias and value - full qualified class name.</p> <p>E.g. for HQL</p> <blockquote> <p>SELECT a.id from Foo a INNER JOIN a.test b</p> </blockquote> <p>I wish to have pairs:</p> <p>a, package1.Foo</p> <p>b. package2.TestClassNam...
[ { "answer_id": 381210, "author": "Rolf Rander", "author_id": 47402, "author_profile": "https://Stackoverflow.com/users/47402", "pm_score": 3, "selected": true, "text": "<p>Hardly a good way of doing it, but it seems you can get the AST through some internal interfaces and traverse this:<...
2008/11/27
[ "https://Stackoverflow.com/questions/324105", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19347/" ]
Can anyone point me out, how can I parse/evaluate HQL and get map where key is table alias and value - full qualified class name. E.g. for HQL > > SELECT a.id from Foo a INNER JOIN a.test b > > > I wish to have pairs: a, package1.Foo b. package2.TestClassName It's relatively easy to do for result set > > >...
Hardly a good way of doing it, but it seems you can get the AST through some internal interfaces and traverse this: ``` QueryTranslator[] translators = hqlPlan.getTranslators(); AST ast = (AST)((QueryTranslatorImpl)translators[0]).getSqlAST(); new NodeTraverser(new NodeTraverser.VisitationStrategy() { public v...
324,132
<p>Imagine I have the following:</p> <pre><code>inFile = "/adda/adas/sdas/hello.txt" # that instruction give me hello.txt Name = inFile.name.split("/") [-1] # that one give me the name I want - just hello Name1 = Name.split(".") [0] </code></pre> <p>Is there any chance to simplify that doing the same job in just on...
[ { "answer_id": 324139, "author": "Vinko Vrsalovic", "author_id": 5190, "author_profile": "https://Stackoverflow.com/users/5190", "pm_score": 1, "selected": false, "text": "<pre><code>&gt;&gt;&gt; inFile = \"/adda/adas/sdas/hello.txt\"\n&gt;&gt;&gt; inFile.split('/')[-1]\n'hello.txt'\n&gt...
2008/11/27
[ "https://Stackoverflow.com/questions/324132", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Imagine I have the following: ``` inFile = "/adda/adas/sdas/hello.txt" # that instruction give me hello.txt Name = inFile.name.split("/") [-1] # that one give me the name I want - just hello Name1 = Name.split(".") [0] ``` Is there any chance to simplify that doing the same job in just one expression?
You can get what you want platform independently by using [os.path.basename](http://docs.python.org/library/os.path.html#os.path.basename) to get the last part of a path and then use [os.path.splitext](http://docs.python.org/library/os.path.html#os.path.splitext) to get the filename without extension. ``` from os.path...
324,167
<p>Assuming a variable contains spaces, newlines, and tabs followed by some text, why does this:</p> <pre><code>${var#"${var%%[![:space:]]*}"} # strip var of everything # but whitespace # then remove what's left # (i.e. ...
[ { "answer_id": 324216, "author": "Barry Kelly", "author_id": 3712, "author_profile": "https://Stackoverflow.com/users/3712", "pm_score": 2, "selected": false, "text": "<p>[:space:] is a character class. It's only valid if it is nested inside another set of [ ].</p>\n" }, { "answe...
2008/11/27
[ "https://Stackoverflow.com/questions/324167", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1094969/" ]
Assuming a variable contains spaces, newlines, and tabs followed by some text, why does this: ``` ${var#"${var%%[![:space:]]*}"} # strip var of everything # but whitespace # then remove what's left # (i.e. the whitespace...
If I set `var=" This is a test "`, both your suggestions do not work; just the leading stuff is removed. Why not use the replace functionality that removes all occurrences of whitespace and not just the first: ``` ${var//[[:space:]]} ```
324,168
<p>All,</p> <p>this is my code</p> <pre><code>//declare string pointer BSTR markup; //initialize markup to some well formed XML &lt;- //declare and initialize XML Document MSXML2::IXMLDOMDocument2Ptr pXMLDoc; HRESULT hr; hr = pXMLDoc.CreateInstance(__uuidof(MSXML2::DOMDocument40)); pXMLDoc-&gt;async = VARIANT_FALSE...
[ { "answer_id": 324343, "author": "Roddy", "author_id": 1737, "author_profile": "https://Stackoverflow.com/users/1737", "pm_score": 3, "selected": true, "text": "<p>Try replacing</p>\n\n<pre><code> BSTR Markup;\n</code></pre>\n\n<p>with </p>\n\n<pre><code> bstr_t Markup;\n</code></pre>\n\...
2008/11/27
[ "https://Stackoverflow.com/questions/324168", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1311500/" ]
All, this is my code ``` //declare string pointer BSTR markup; //initialize markup to some well formed XML <- //declare and initialize XML Document MSXML2::IXMLDOMDocument2Ptr pXMLDoc; HRESULT hr; hr = pXMLDoc.CreateInstance(__uuidof(MSXML2::DOMDocument40)); pXMLDoc->async = VARIANT_FALSE; pXMLDoc->validateOnParse ...
Try replacing ``` BSTR Markup; ``` with ``` bstr_t Markup; ``` BSTR is pretty much a dumb pointer, and I think that the return result of GetXML() is being converted to a temporary which is then destroyed by the time you get to see it. bstr\_t wraps that with some smart-pointer goodness... Note: Your "SuperMar...
324,171
<p>trying to mount an smb share on OS X so that the 'www' user can read files from there.</p> <p>the SMB share is accessible via an Active Directory account. I can mount the share through the Finder (cmd-k ...)</p> <p>my basic approach is</p> <pre><code># 1) create mountpoint sudo mkdir /Volumes/www_mdisk # 2) per...
[ { "answer_id": 325413, "author": "captnswing", "author_id": 41404, "author_profile": "https://Stackoverflow.com/users/41404", "pm_score": 2, "selected": false, "text": "<p>ok, I can do this now on Mac OS X 10.4</p>\n\n<pre><code># 4) mount the SMB share using the Active Directory user 'a...
2008/11/27
[ "https://Stackoverflow.com/questions/324171", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41404/" ]
trying to mount an smb share on OS X so that the 'www' user can read files from there. the SMB share is accessible via an Active Directory account. I can mount the share through the Finder (cmd-k ...) my basic approach is ``` # 1) create mountpoint sudo mkdir /Volumes/www_mdisk # 2) permissions for mountpoint sudo...
Sorry this answer is two years late, but I had a similar problem and was able to solve it using your steps, more or less. I followed steps 1-3, and then for step 4, I sudo'd as \_www instead of using the -O option (since it doesn't exist any longer.) ``` sudo -u _www mount_smbfs //User:Password@Host/Share /mount/point...
324,178
<p>We are looking at various options in porting our persistence layer from Oracle to another database and one that we are looking at is MS SQL. However we use Oracle sequences throughout the code and because of this it seems moving will be a headache. I understand about @identity but that would be a massive overhaul of...
[ { "answer_id": 324202, "author": "devio", "author_id": 21336, "author_profile": "https://Stackoverflow.com/users/21336", "pm_score": 2, "selected": true, "text": "<p>That depends on your current use of sequences in Oracle. Typically a sequence is read in the Insert trigger.</p>\n\n<p>Fro...
2008/11/27
[ "https://Stackoverflow.com/questions/324178", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11802/" ]
We are looking at various options in porting our persistence layer from Oracle to another database and one that we are looking at is MS SQL. However we use Oracle sequences throughout the code and because of this it seems moving will be a headache. I understand about @identity but that would be a massive overhaul of th...
That depends on your current use of sequences in Oracle. Typically a sequence is read in the Insert trigger. From your question I guess that it is the persistence layer that generates the sequence before inserting into the database (including the new pk) In MSSQL, you can combine SQL statements with ';', so to retrie...
324,181
<p>I'm now to this point of my project that I need to design my database (Oracle). Usually for the status and countries tables I don’t use a numeric primary key, for example</p> <pre><code>STATUS (max 6) AC --&gt; Active DE --&gt; Deleted COUNTRIES (total 30) UK --&gt; United Kingdom IT --&gt; Italy GR --&gt; Greece ...
[ { "answer_id": 324196, "author": "philistyne", "author_id": 16597, "author_profile": "https://Stackoverflow.com/users/16597", "pm_score": 0, "selected": false, "text": "<p>If 'status' is (and will always be?) a binary active/deleted field why bother with the table at all. It seems like n...
2008/11/27
[ "https://Stackoverflow.com/questions/324181", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm now to this point of my project that I need to design my database (Oracle). Usually for the status and countries tables I don’t use a numeric primary key, for example ``` STATUS (max 6) AC --> Active DE --> Deleted COUNTRIES (total 30) UK --> United Kingdom IT --> Italy GR --> Greece ``` These tables are static...
Both the status and country tables are so small that they are going to be memory resident in practice, whether formally stated as such or not. Indeed, except that a foreign key normally requires an index on the referenced primary key field, you might be tempted not to bother with any indexes on the tables. The perform...
324,188
<p>what is the easiest way to remove the "T" from the result?</p> <p>I want the result to be "YYYY/MM/DD HH/MM/SS"</p> <p>the vb.net code is really straight forward</p> <pre><code> xmlDoc = New Xml.XmlDataDocument(data_set) xslTran = New Xml.Xsl.XslCompiledTransform xslTran.Load(strXslFile) ...
[ { "answer_id": 324196, "author": "philistyne", "author_id": 16597, "author_profile": "https://Stackoverflow.com/users/16597", "pm_score": 0, "selected": false, "text": "<p>If 'status' is (and will always be?) a binary active/deleted field why bother with the table at all. It seems like n...
2008/11/27
[ "https://Stackoverflow.com/questions/324188", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40868/" ]
what is the easiest way to remove the "T" from the result? I want the result to be "YYYY/MM/DD HH/MM/SS" the vb.net code is really straight forward ``` xmlDoc = New Xml.XmlDataDocument(data_set) xslTran = New Xml.Xsl.XslCompiledTransform xslTran.Load(strXslFile) writer = New Xml.XmlTe...
Both the status and country tables are so small that they are going to be memory resident in practice, whether formally stated as such or not. Indeed, except that a foreign key normally requires an index on the referenced primary key field, you might be tempted not to bother with any indexes on the tables. The perform...
324,214
<p>I am currently running the following code based on Chapter 12.5 of the Python Cookbook:</p> <pre><code>from xml.parsers import expat class Element(object): def __init__(self, name, attributes): self.name = name self.attributes = attributes self.cdata = '' self.children = [] ...
[ { "answer_id": 324236, "author": "Aaron Digulla", "author_id": 34088, "author_profile": "https://Stackoverflow.com/users/34088", "pm_score": 3, "selected": false, "text": "<p>Registering callbacks slows down the parsing tremendously. [EDIT]This is because the (fast) C code has to invoke ...
2008/11/27
[ "https://Stackoverflow.com/questions/324214", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7743/" ]
I am currently running the following code based on Chapter 12.5 of the Python Cookbook: ``` from xml.parsers import expat class Element(object): def __init__(self, name, attributes): self.name = name self.attributes = attributes self.cdata = '' self.children = [] def addChild(s...
I looks to me as if you do not need any DOM capabilities from your program. I would second the use of the (c)ElementTree library. If you use the iterparse function of the cElementTree module, you can work your way through the xml and deal with the events as they occur. Note however, Fredriks advice on using cElementTr...
324,222
<p>I have got a simple page with a HtmlInputHidden field. I use Javascript to update that value and, when posting back the page, I want to read the value of that HtmlInputHidden field. The Value property of that HtmlInputHidden field is on postback the default value (the value it had when the page was created, not the ...
[ { "answer_id": 324226, "author": "Fredou", "author_id": 40868, "author_profile": "https://Stackoverflow.com/users/40868", "pm_score": 2, "selected": false, "text": "<p>found in the first result on google for me</p>\n\n<p>To execute a program you can create a script to run it and use grou...
2008/11/27
[ "https://Stackoverflow.com/questions/324222", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have got a simple page with a HtmlInputHidden field. I use Javascript to update that value and, when posting back the page, I want to read the value of that HtmlInputHidden field. The Value property of that HtmlInputHidden field is on postback the default value (the value it had when the page was created, not the val...
To run this only for the current user, you can use WMI to get an information when a shutdown/logout occurs. Either you write a small C# (or any other language that can use WMI) application or vbs script to listen on the *Win32\_ComputerShutdownEvent* WMI event. An example C# app can be found here in this question: [G...
324,231
<p>Here's the issue:</p> <p>I have a hook in IE that reacts on <code>WebBrowser.OnNavigateComplete2</code> event to parse the content of the document for some precise info.</p> <p>That document contains frames, so I look into the <code>HTMLDocument.frames</code>. For each one, I look into the document.body.outerHTML ...
[ { "answer_id": 324297, "author": "Gonzalo Quero", "author_id": 40996, "author_profile": "https://Stackoverflow.com/users/40996", "pm_score": 0, "selected": false, "text": "<p>Are you using some kind of threading? Running the browser in a separate thread really messes up things. Try to ex...
2008/11/27
[ "https://Stackoverflow.com/questions/324231", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29568/" ]
Here's the issue: I have a hook in IE that reacts on `WebBrowser.OnNavigateComplete2` event to parse the content of the document for some precise info. That document contains frames, so I look into the `HTMLDocument.frames`. For each one, I look into the document.body.outerHTML property to check for the content. Pr...
Do you know the name/id of the frame you are looking for content? If so, in your navigateComplete2 event, can you get a reference to the frame like ``` iFrame frm = document.frames(<your frame id>); int readyState=0; while(frm.readystate !=4){ // do nothing. be careful to not create an endless loop } if(frm.readyS...
324,245
<p>I have a asp.net web application which has a number of versions deployed on different customer servers inside their networks. One practice that we have is to have clients email screenshots when they have issues.</p> <p>In the old asp.net 1.1 days, we could grab details of the build DLL, using reflection, and show ...
[ { "answer_id": 324275, "author": "Christian C. Salvadó", "author_id": 5445, "author_profile": "https://Stackoverflow.com/users/5445", "pm_score": 3, "selected": false, "text": "<p>You can get the Assembly Build date through reflection, check this examples:</p>\n\n<ul>\n<li><a href=\"http...
2008/11/27
[ "https://Stackoverflow.com/questions/324245", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24126/" ]
I have a asp.net web application which has a number of versions deployed on different customer servers inside their networks. One practice that we have is to have clients email screenshots when they have issues. In the old asp.net 1.1 days, we could grab details of the build DLL, using reflection, and show info about ...
We are using .Net 2.0 and pull the version information out of the assembly. Perhaps not ideal, but we use the description to store the build date. ``` Assembly assembly = Assembly.GetExecutingAssembly(); string version = assembly.GetName().Version.ToString(); string buildDate = ((AssemblyDescriptionAttribute)Attribute...
324,261
<p>I'm compiling a vc8 C++ project in a WinXp VmWare session. It's a hell of a lot slower than gcc3.2 in a RedHat VmWare session, so I'm looking at Task Manager. It's saying a very large percentage of my compile process is spent in the kernel. That doesn't sounds right to me.</p> <p>Is there an equivalent of strace...
[ { "answer_id": 324298, "author": "Barry Kelly", "author_id": 3712, "author_profile": "https://Stackoverflow.com/users/3712", "pm_score": 2, "selected": false, "text": "<p>Not exactly strace, but there is a way of getting visibility into the kernel call stack, and by sampling it at times ...
2008/11/27
[ "https://Stackoverflow.com/questions/324261", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23434/" ]
I'm compiling a vc8 C++ project in a WinXp VmWare session. It's a hell of a lot slower than gcc3.2 in a RedHat VmWare session, so I'm looking at Task Manager. It's saying a very large percentage of my compile process is spent in the kernel. That doesn't sounds right to me. Is there an equivalent of strace for Win32? A...
Not exactly strace, but there is a way of getting visibility into the kernel call stack, and by sampling it at times of high CPU usage, you can usually estimate what's using up all the time. Install [Process Explorer](http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx) and make sure you configure it with sy...
324,267
<p>How do I create a batch file to delete files older than a specified date?</p> <p>This does not seem to work;</p> <pre><code>:: --------DELOLD.BAT---------- @echo off SET OLDERTHAN=%1 IF NOT DEFINED OLDERTHAN GOTO SYNTAX for /f "tokens=2" %%i in ('date /t') do set thedate=%%i type %1 pause set mm=%thedate:~0,2% se...
[ { "answer_id": 324333, "author": "Vilx-", "author_id": 41360, "author_profile": "https://Stackoverflow.com/users/41360", "pm_score": -1, "selected": false, "text": "<p>I don't know if you can do that with .BAT files and what few tools Windows comes with, but you sure can with .js (JScrip...
2008/11/27
[ "https://Stackoverflow.com/questions/324267", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
How do I create a batch file to delete files older than a specified date? This does not seem to work; ``` :: --------DELOLD.BAT---------- @echo off SET OLDERTHAN=%1 IF NOT DEFINED OLDERTHAN GOTO SYNTAX for /f "tokens=2" %%i in ('date /t') do set thedate=%%i type %1 pause set mm=%thedate:~0,2% set dd=%thedate:~3,2% s...
**Edit:** I figured it out. To delete all files older than a given date: ``` REM del_old.bat REM usage: del_old MM-DD-YYY for /f "tokens=*" %%a IN ('xcopy *.* /d:%1 /L /I null') do if exist %%~nxa echo %%~nxa >> FILES_TO_KEEP.TXT for /f "tokens=*" %%a IN ('xcopy *.* /L /I /EXCLUDE:FILES_TO_KEEP.TXT null') do if exist...
324,284
<p>What's the best way to throw an exception in objective-c/cocoa?</p>
[ { "answer_id": 324301, "author": "e.James", "author_id": 33686, "author_profile": "https://Stackoverflow.com/users/33686", "pm_score": 10, "selected": true, "text": "<p>I use <code>[NSException raise:format:]</code> as follows:</p>\n\n<pre><code>[NSException raise:@\"Invalid foo value\" ...
2008/11/27
[ "https://Stackoverflow.com/questions/324284", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36182/" ]
What's the best way to throw an exception in objective-c/cocoa?
I use `[NSException raise:format:]` as follows: ``` [NSException raise:@"Invalid foo value" format:@"foo of %d is invalid", foo]; ```
324,289
<p>If I have several <code>Section</code> elements in an XML document, what XQuery do I use to get a list of all the <code>name</code> values?</p> <pre><code>&lt;Section name="New Clients" filePath="XNEWCUST.TXT" skipSection="False"&gt; </code></pre>
[ { "answer_id": 324299, "author": "James Curran", "author_id": 12725, "author_profile": "https://Stackoverflow.com/users/12725", "pm_score": 0, "selected": false, "text": "<pre><code> /Section/@name\n</code></pre>\n" }, { "answer_id": 324339, "author": "Dimitre Novatchev", ...
2008/11/27
[ "https://Stackoverflow.com/questions/324289", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8741/" ]
If I have several `Section` elements in an XML document, what XQuery do I use to get a list of all the `name` values? ``` <Section name="New Clients" filePath="XNEWCUST.TXT" skipSection="False"> ```
In XPath 2.0 (which is a subset of XQuery) one would use the following expression to get a sequence of all string values of the "name" attributes of the "Section" elements: ```xquery for $attr in //Section/@name return string($attr) ``` Do note that using the "//" abbreviation is typically a bad practice as this ma...
324,303
<p>I have html code that looks roughly like this:</p> <pre><code>&lt;div id="id1"&gt; &lt;div id="id2"&gt; &lt;p&gt;some html&lt;/p&gt; &lt;span&gt;maybe some more&lt;/span&gt; &lt;/div&gt; &lt;div id="id3"&gt; &lt;p&gt;different text here&lt;/p&gt; &lt;input type="text"&gt; &lt;span&gt;maybe...
[ { "answer_id": 324308, "author": "Greg", "author_id": 24181, "author_profile": "https://Stackoverflow.com/users/24181", "pm_score": 7, "selected": true, "text": "<p>In this case, <code>document.getElementById('id1').appendChild(document.getElementById('id2'));</code> should do the trick....
2008/11/27
[ "https://Stackoverflow.com/questions/324303", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41435/" ]
I have html code that looks roughly like this: ``` <div id="id1"> <div id="id2"> <p>some html</p> <span>maybe some more</span> </div> <div id="id3"> <p>different text here</p> <input type="text"> <span>maybe even a form item</span> </div> </div> ``` Obviously there's more to it than that,...
In this case, `document.getElementById('id1').appendChild(document.getElementById('id2'));` should do the trick. More generally you can use [`insertBefore()`](https://developer.mozilla.org/en-US/docs/Web/API/Node/insertBefore).
324,311
<p>How can I give a general rule that includes all the expressions below? E.g one expression, another one for sub and one for mult. I need to use recursion but i got confused...</p> <pre><code>simplify :: Expr-&gt;Expr simplify (Mult (Const 0)(Var"x")) = Const 0 simplify (Mult (Var "x") (Const 0)) = Const 0 simpli...
[ { "answer_id": 324354, "author": "Andru Luvisi", "author_id": 5922, "author_profile": "https://Stackoverflow.com/users/5922", "pm_score": 0, "selected": false, "text": "<p>The recursion comes in when you need to deal with nested expressions. For instance, how do you simply (Plus (Plus 2...
2008/11/27
[ "https://Stackoverflow.com/questions/324311", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41000/" ]
How can I give a general rule that includes all the expressions below? E.g one expression, another one for sub and one for mult. I need to use recursion but i got confused... ``` simplify :: Expr->Expr simplify (Mult (Const 0)(Var"x")) = Const 0 simplify (Mult (Var "x") (Const 0)) = Const 0 simplify (Plus (Const 0...
First up: I know reasonably little about Haskell, and my total time spent programming the language is no more than 8 hours spread over 5 years or so, though I have read plenty about the language. Thus, forgive my no doubt horrible style. I tackled this problem since it looked like an easy way to get into a little bit ...
324,315
<p>I have a degrafa surface into a canvas container. I want to link both width and height. When i use binding like it works as expected:</p> <pre><code>// binding BindingUtils.bindProperty(rect,"height",this,"height"); BindingUtils.bindProperty(rect,"width",this,"width"); </code></pre> <p>Now, someone told me...
[ { "answer_id": 324551, "author": "coulix", "author_id": 32032, "author_profile": "https://Stackoverflow.com/users/32032", "pm_score": 0, "selected": false, "text": "<p>Just in case,</p>\n\n<p>some more code</p>\n\n<pre><code>public class RectangleShape extends BaseShape \n{\npublic funct...
2008/11/27
[ "https://Stackoverflow.com/questions/324315", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32032/" ]
I have a degrafa surface into a canvas container. I want to link both width and height. When i use binding like it works as expected: ``` // binding BindingUtils.bindProperty(rect,"height",this,"height"); BindingUtils.bindProperty(rect,"width",this,"width"); ``` Now, someone told me that i should do it on va...
Somewhere in your updateDisplayList you should call: ``` super.updateDisplayList(unscaledWidth, unscaledHeight); ```
324,341
<p>I may be going about this backwards... I have a class which is like a document and another class which is like a template. They both inherit from the same base class and I have a method to create a new document from a template (or from another document, the method it is in the base class). So, if I want to create a...
[ { "answer_id": 324356, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 4, "selected": true, "text": "<p>If you want to be able to do anything other than create a new object just from the code in the constructor, don't use ...
2008/11/27
[ "https://Stackoverflow.com/questions/324341", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11534/" ]
I may be going about this backwards... I have a class which is like a document and another class which is like a template. They both inherit from the same base class and I have a method to create a new document from a template (or from another document, the method it is in the base class). So, if I want to create a ne...
If you want to be able to do anything other than create a new object just from the code in the constructor, don't use a constructor in the first place. Do you really need an Instance constructor taking an int? Why not turn it into a static factory method: ``` public static Instance CreateInstance(int id) { MyTemp...
324,344
<p>I'm a bit flabbergasted at this, so I'm wondering if any SOers have encountered it before.</p> <p>I have an essentially flat page with a number of input=text seeded in the markup with default values of say A,B,C,D,E in order. The markup looks like this in view source:</p> <pre><code>&lt;td class="action invoice"&g...
[ { "answer_id": 324384, "author": "ysth", "author_id": 17389, "author_profile": "https://Stackoverflow.com/users/17389", "pm_score": 0, "selected": false, "text": "<p>Did you mean C,A,B,D,E? My bet is that an unquoted or mismatched \" in an attribute is messing up the parsing of the td ...
2008/11/27
[ "https://Stackoverflow.com/questions/324344", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13018/" ]
I'm a bit flabbergasted at this, so I'm wondering if any SOers have encountered it before. I have an essentially flat page with a number of input=text seeded in the markup with default values of say A,B,C,D,E in order. The markup looks like this in view source: ``` <td class="action invoice"> <a href="#foo">Toggle ...
I would wager that it's related to the mapped url not having a file extension and so the content type isn't being properly deduced by firefox. Try explicitly setting the content type to "text/html" in the ASP code and see if that fixes it.
324,353
<p>Why are the split lists always empty in this program? (It is derived from the code on the <a href="http://en.wikipedia.org/wiki/Linked_List#Language_support" rel="nofollow noreferrer">Wikipedia</a> page on Linked Lists.)</p> <pre><code>/* Example program from wikipedia linked list article Modified to find...
[ { "answer_id": 324380, "author": "Rob Walker", "author_id": 3631, "author_profile": "https://Stackoverflow.com/users/3631", "pm_score": 3, "selected": false, "text": "<pre><code> temp = list_nth(current, ind);\n\n while (current != NULL) {\n count = count+step;\n temp-&gt;n...
2008/11/27
[ "https://Stackoverflow.com/questions/324353", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Why are the split lists always empty in this program? (It is derived from the code on the [Wikipedia](http://en.wikipedia.org/wiki/Linked_List#Language_support) page on Linked Lists.) ``` /* Example program from wikipedia linked list article Modified to find nth node and to split the list */ #include <stdio....
``` temp = list_nth(current, ind); while (current != NULL) { count = count+step; temp->next = list_nth(head, count); current = current->next; } ``` You are finding the correct item to begin the split at, but look at what happens to temp from then on ... you only ever assign to temp->nex...
324,358
<p>I need to cast single figures (1 to 9) to (01 to 09). I can think of a way but its big and ugly and cumbersome. I'm sure there must be some concise way. Any Suggestions</p>
[ { "answer_id": 324368, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 8, "selected": false, "text": "<p>First of all, your description is misleading. <code>Double</code> is a floating point data type. You presumably wa...
2008/11/27
[ "https://Stackoverflow.com/questions/324358", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I need to cast single figures (1 to 9) to (01 to 09). I can think of a way but its big and ugly and cumbersome. I'm sure there must be some concise way. Any Suggestions
First of all, your description is misleading. `Double` is a floating point data type. You presumably want to pad your digits with leading zeros in a string. The following code does that: ``` $s = sprintf('%02d', $digit); ``` For more information, refer to the documentation of [`sprintf`](http://php.net/sprintf).
324,373
<p>I have written an ASP.NET composite control which includes some Javascript which communicates with a web service.</p> <p>I have packaged the classes for the control and the service into a DLL to make it nice and easy for people to use it in other projects.</p> <p>The problem I'm having is that as well as referenci...
[ { "answer_id": 324455, "author": "Chris", "author_id": 34942, "author_profile": "https://Stackoverflow.com/users/34942", "pm_score": -1, "selected": false, "text": "<p>Short answer is no. The ASMX is the entry point for any web service. There are alternatives if you use WCF, but that's n...
2008/11/27
[ "https://Stackoverflow.com/questions/324373", "https://Stackoverflow.com", "https://Stackoverflow.com/users/475/" ]
I have written an ASP.NET composite control which includes some Javascript which communicates with a web service. I have packaged the classes for the control and the service into a DLL to make it nice and easy for people to use it in other projects. The problem I'm having is that as well as referencing the DLL in the...
Try something like this. I don't know if it will work though. I got this idea from ELMAH, which creates a handler for a page that doesn't physically exist and then serves it up from the assembly. ``` <configuration> <system.web> <httpHandlers> <add verb="*" path="*WebService.asmx" type="MyHandler.Web...
324,381
<p>This is a multi-site problem. I have a lot of sites with .htaccess files with multiple line similar to:</p> <pre><code>rewriterule ^(page-one|page-two|page-three)/?$ /index.php?page=$1 [L] </code></pre> <p>This means that both www.domain.com/page-one and www.domain.com/page-one/ will both load www.domain.com/inde...
[ { "answer_id": 324390, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 1, "selected": false, "text": "<p><em>Untested</em>, but can't you just do this?</p>\n\n<pre><code>RewriteRule ^(.*[^/])$ $1/\nRewriteRule ^(page-on...
2008/11/27
[ "https://Stackoverflow.com/questions/324381", "https://Stackoverflow.com", "https://Stackoverflow.com/users/428190/" ]
This is a multi-site problem. I have a lot of sites with .htaccess files with multiple line similar to: ``` rewriterule ^(page-one|page-two|page-three)/?$ /index.php?page=$1 [L] ``` This means that both www.domain.com/page-one and www.domain.com/page-one/ will both load www.domain.com/index.php?page=page-one Howeve...
Here's a snippet to force everything to end with a slash ``` rewritecond %{REQUEST_FILENAME} !-f rewritecond %{REQUEST_URI} !(.*)/$ rewriterule ^(.*)$ http://%{HTTP_HOST}/$1/ [L,R=301] ```
324,400
<p>I have an existing htaccess that works fine:</p> <pre><code>RewriteEngine On RewriteCond %{SCRIPT_FILENAME} !-f RewriteCond %{SCRIPT_FILENAME} !-d RewriteRule (.*) /default.php DirectoryIndex index.php /default.php </code></pre> <p>I wish to modify this so that all urls that start with /test/ go to /test/default...
[ { "answer_id": 324410, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 2, "selected": false, "text": "<p>Basically, just put <code>/test/</code> in front of your expression. Also, the parentheses are unnecessary here:</...
2008/11/27
[ "https://Stackoverflow.com/questions/324400", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have an existing htaccess that works fine: ``` RewriteEngine On RewriteCond %{SCRIPT_FILENAME} !-f RewriteCond %{SCRIPT_FILENAME} !-d RewriteRule (.*) /default.php DirectoryIndex index.php /default.php ``` I wish to modify this so that all urls that start with /test/ go to /test/default.php. Example: <http://ww...
Basically, just put `/test/` in front of your expression. Also, the parentheses are unnecessary here: ``` RewriteRule ^/test/ /test/default.php ```
324,428
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/324311/symbolic-simplification-in-haskell-using-recursion">Symbolic simplification in Haskell (using recursion?)</a> </p> </blockquote> <p>The simplifications I have in mind are</p> <pre><code>0*e = e*0 = 0 1*...
[ { "answer_id": 324440, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 2, "selected": false, "text": "<p>Well, can't you apply pattern matching to the individual cases?</p>\n\n<pre><code>simplify (Plus (Const 0) (Expr x...
2008/11/27
[ "https://Stackoverflow.com/questions/324428", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41000/" ]
> > **Possible Duplicate:** > > [Symbolic simplification in Haskell (using recursion?)](https://stackoverflow.com/questions/324311/symbolic-simplification-in-haskell-using-recursion) > > > The simplifications I have in mind are ``` 0*e = e*0 = 0 1*e = e*1 = 0+e = e+0 = e-0 = e ``` and simplifying constant s...
Well, can't you apply pattern matching to the individual cases? ``` simplify (Plus (Const 0) (Expr x)) = simplify (Expr x) simplify (Plus (Expr x) (Const 0)) = simplify (Expr x) simplify (Mult (Const 0) _) = Const 0 simplify (Mult _ (Const 0)) = Const 0 – … and so on ``` EDIT: Yes, of course … recursion added.
324,436
<p>There's this program, pdftotext, that can convert a pdf file to a text file. To use it directly on the linux console:</p> <pre><code>pdftotext file.pdf </code></pre> <p>That will generate a file.txt on the same directory as the pdf file. I was looking for a way to do it from inside a php program, and after some go...
[ { "answer_id": 324444, "author": "Pim Jager", "author_id": 35197, "author_profile": "https://Stackoverflow.com/users/35197", "pm_score": 0, "selected": false, "text": "<p>PHP has a build in PDF function library, that should be able to give you what you need:<br>\n<a href=\"http://nl3.php...
2008/11/27
[ "https://Stackoverflow.com/questions/324436", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27090/" ]
There's this program, pdftotext, that can convert a pdf file to a text file. To use it directly on the linux console: ``` pdftotext file.pdf ``` That will generate a file.txt on the same directory as the pdf file. I was looking for a way to do it from inside a php program, and after some googling I ended with two co...
It's probably a permissions issue, but try this instead: ``` <?php system('pdftotext file.pdf 2>&1'); ?> ``` The `2>&1` redirects stderr to stdout, so any error messages will be printed. It should be pretty easy to fix from then on.
324,457
<p>I've been looking into adopting Carbon Emacs for use on my Mac, and the only stumbling block I've run into is the annoying scroll beep when you try to scroll past the end of the document. I've looked online but I can't seem to find what I should add to my .emacs that will stop it from beeping when scrolling. I don't...
[ { "answer_id": 324501, "author": "Svante", "author_id": 31615, "author_profile": "https://Stackoverflow.com/users/31615", "pm_score": 2, "selected": false, "text": "<p>You will have to customize the <code>ring-bell-function</code>.</p>\n\n<p>This page may provide hints:</p>\n\n<p><a href...
2008/11/27
[ "https://Stackoverflow.com/questions/324457", "https://Stackoverflow.com", "https://Stackoverflow.com/users/658/" ]
I've been looking into adopting Carbon Emacs for use on my Mac, and the only stumbling block I've run into is the annoying scroll beep when you try to scroll past the end of the document. I've looked online but I can't seem to find what I should add to my .emacs that will stop it from beeping when scrolling. I don't wa...
``` (setq visible-bell t) ``` This makes emacs flash instead of beep.
324,463
<p>How can I display something over all other application. I want to to display something over all form of my program and all other programs open on my desktop (not mine).</p> <p><strong>*Top Most doesn't work I have tested and my browser can go OVER my application :S</strong></p> <p>Here is an image of when I use To...
[ { "answer_id": 324464, "author": "Patrick Desjardins", "author_id": 13913, "author_profile": "https://Stackoverflow.com/users/13913", "pm_score": 5, "selected": true, "text": "<p>You can use the form instance and set the property <strong>TopMost</strong> to True. </p>\n\n<p><hr/>\nIf you...
2008/11/27
[ "https://Stackoverflow.com/questions/324463", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21386/" ]
How can I display something over all other application. I want to to display something over all form of my program and all other programs open on my desktop (not mine). **\*Top Most doesn't work I have tested and my browser can go OVER my application :S** Here is an image of when I use TopMost to TRUE. You can see my...
You can use the form instance and set the property **TopMost** to True. --- If you want to be over all Windows, there are another way with **Win32 Api** calls. Here is what you could do: In your form class add : ``` [System.Runtime.InteropServices.DllImport("user32.dll")] public static extern bool SetForegroundWi...
324,470
<p>A custom HTTP header is being passed to a Servlet application for authentication purposes. The header value must be able to contain accents and other non-ASCII characters, so must be in a certain encoding (ideally UTF-8).</p> <p>I am provided with this piece of Java code by the developers who control the authentica...
[ { "answer_id": 324558, "author": "superfell", "author_id": 41455, "author_profile": "https://Stackoverflow.com/users/41455", "pm_score": 2, "selected": false, "text": "<p>See the <a href=\"http://www.w3.org/Protocols/rfc2616/rfc2616-sec2.html#sec2\" rel=\"nofollow noreferrer\">HTTP spec<...
2008/11/27
[ "https://Stackoverflow.com/questions/324470", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5144/" ]
A custom HTTP header is being passed to a Servlet application for authentication purposes. The header value must be able to contain accents and other non-ASCII characters, so must be in a certain encoding (ideally UTF-8). I am provided with this piece of Java code by the developers who control the authentication envir...
As mentioned already the first look should always go to the [HTTP 1.1 spec](http://www.greenbytes.de/tech/webdav/rfc2616.html) (RFC 2616). [It says](http://www.greenbytes.de/tech/webdav/rfc2616.html#basic.rules) that text in header values must use the MIME encoding as defined [RFC 2047](https://www.rfc-editor.org/rfc/r...
324,477
<p>In a Django form, how do I make a field read-only (or disabled)?</p> <p>When the form is being used to create a new entry, all fields should be enabled - but when the record is in update mode some fields need to be read-only.</p> <p>For example, when creating a new <code>Item</code> model, all fields must be edita...
[ { "answer_id": 325038, "author": "Daniel Naab", "author_id": 32638, "author_profile": "https://Stackoverflow.com/users/32638", "pm_score": 10, "selected": true, "text": "<p>As pointed out in <a href=\"https://stackoverflow.com/questions/324477/in-a-django-form-how-do-i-make-a-field-reado...
2008/11/27
[ "https://Stackoverflow.com/questions/324477", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11452/" ]
In a Django form, how do I make a field read-only (or disabled)? When the form is being used to create a new entry, all fields should be enabled - but when the record is in update mode some fields need to be read-only. For example, when creating a new `Item` model, all fields must be editable, but while updating the ...
As pointed out in [this answer](https://stackoverflow.com/questions/324477/in-a-django-form-how-do-i-make-a-field-readonly-or-disabled-so-that-it-cannot/34538169#34538169), Django 1.9 added the [Field.disabled](https://docs.djangoproject.com/en/stable/ref/forms/fields/#disabled) attribute: > > The disabled boolean ar...
324,486
<p>I would like to return a string with all of the contents of a CSS rule, like the format you'd see in an inline style. I'd like to be able to do this without knowing what is contained in a particular rule, so I can't just pull them out by style name (like <code>.style.width</code> etc.) </p> <p>The CSS:</p> <pre><c...
[ { "answer_id": 324527, "author": "scunliffe", "author_id": 6144, "author_profile": "https://Stackoverflow.com/users/6144", "pm_score": 0, "selected": false, "text": "<p>//works in IE, not sure about other browsers...</p>\n\n<pre><code>alert(classes[x].style.cssText);\n</code></pre>\n" ...
2008/11/27
[ "https://Stackoverflow.com/questions/324486", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12579/" ]
I would like to return a string with all of the contents of a CSS rule, like the format you'd see in an inline style. I'd like to be able to do this without knowing what is contained in a particular rule, so I can't just pull them out by style name (like `.style.width` etc.) The CSS: ``` .test { width:80px; ...
Adapted from [here](http://www.javascriptkit.com/domref/cssrule.shtml), building on scunliffe's answer: ``` function getStyle(className) { var cssText = ""; var classes = document.styleSheets[0].rules || document.styleSheets[0].cssRules; for (var x = 0; x < classes.length; x++) { if (classe...
324,492
<p>Im trying to generate views in unit tests but i can't get around the missing VirtualPathProvider. Most viewengines use the VirtualPathProviderViewEngine base class that gets the provider from the current HostingEnvironment.</p> <pre><code>protected VirtualPathProvider VirtualPathProvider { get { if (_vp...
[ { "answer_id": 327001, "author": "Matthew", "author_id": 20162, "author_profile": "https://Stackoverflow.com/users/20162", "pm_score": 0, "selected": false, "text": "<p>I tried to do this as well. Unfortunately, it is not just the VirtualPathProvider (VPP) that is the problem. The VPP ...
2008/11/27
[ "https://Stackoverflow.com/questions/324492", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40357/" ]
Im trying to generate views in unit tests but i can't get around the missing VirtualPathProvider. Most viewengines use the VirtualPathProviderViewEngine base class that gets the provider from the current HostingEnvironment. ``` protected VirtualPathProvider VirtualPathProvider { get { if (_vpp == null) { ...
There are features coming in VS Team System 2010 for the Acceptance Testing which would be appropriate for what you are trying to do. As mentioned by Gregory A Beamer Unit tests for MVC are done to the controller. You can also test the Model depending on how you implement your model. This is where there is a lot of c...
324,498
<p>Given:</p> <pre><code>my @mylist1; push(@mylist1,"A"); push(@mylist1,"B"); push(@mylist1,"C"); my @mylist2; push(@mylist2,"A"); push(@mylist2,"D"); push(@mylist2,"E"); </code></pre> <p>What's the quickest way in Perl to insert in mylist2 all elements that are in mylist1 and not already in mylist2 (ABCDE). </p>
[ { "answer_id": 324522, "author": "Alnitak", "author_id": 6782, "author_profile": "https://Stackoverflow.com/users/6782", "pm_score": 5, "selected": true, "text": "<pre><code>my %k;\nmap { $k{$_} = 1 } @mylist1;\nmap { $k{$_} = 1 } @mylist2;\n@mylist2 = keys %k;\n</code></pre>\n\n<p>Alter...
2008/11/27
[ "https://Stackoverflow.com/questions/324498", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5195/" ]
Given: ``` my @mylist1; push(@mylist1,"A"); push(@mylist1,"B"); push(@mylist1,"C"); my @mylist2; push(@mylist2,"A"); push(@mylist2,"D"); push(@mylist2,"E"); ``` What's the quickest way in Perl to insert in mylist2 all elements that are in mylist1 and not already in mylist2 (ABCDE).
``` my %k; map { $k{$_} = 1 } @mylist1; map { $k{$_} = 1 } @mylist2; @mylist2 = keys %k; ``` Alternatively: ``` my %k; map { $k{$_} = 1 } @mylist2; push(@mylist2, grep { !exists $k{$_} } @mylist1); ``` Actually - these might be wrong because they don't account for whether duplicates might exist in either of the or...
324,499
<p>I am running JVM 1.5.0 (Mac OS X Default), and I am monitoring my Java program in the Activity Monitor. I have the following:</p> <pre><code>import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Date; public class MemoryTest { pu...
[ { "answer_id": 324505, "author": "erickson", "author_id": 3474, "author_profile": "https://Stackoverflow.com/users/3474", "pm_score": 5, "selected": true, "text": "<p>Many JVMs never return memory to the operating system. Whether it does so or not is implementation-specific. For those th...
2008/11/27
[ "https://Stackoverflow.com/questions/324499", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10675/" ]
I am running JVM 1.5.0 (Mac OS X Default), and I am monitoring my Java program in the Activity Monitor. I have the following: ``` import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.Date; public class MemoryTest { public static voi...
Many JVMs never return memory to the operating system. Whether it does so or not is implementation-specific. For those that don't, the memory limits specified at startup, usually through the -Xmx flag, are the primary means to reserve memory for other applications. I am having a hard time finding documentation on this...
324,506
<p>I have the following problem:</p> <pre><code> # line is a line from a file that contains ["baa","beee","0"] line = TcsLine.split(",") NumPFCs = eval(line[2]) if NumPFCs==0: print line </code></pre> <p>I want to print all the lines from the file if the second position of the list has a value == 0.</p> ...
[ { "answer_id": 324524, "author": "Dustin", "author_id": 39975, "author_profile": "https://Stackoverflow.com/users/39975", "pm_score": 0, "selected": false, "text": "<p>Your question is kind of hard to read, but using eval there is definitely not a good idea. Either just do a direct stri...
2008/11/27
[ "https://Stackoverflow.com/questions/324506", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have the following problem: ``` # line is a line from a file that contains ["baa","beee","0"] line = TcsLine.split(",") NumPFCs = eval(line[2]) if NumPFCs==0: print line ``` I want to print all the lines from the file if the second position of the list has a value == 0. I print the lines but after th...
Let me explain a little what you do here. If you write: ``` NumPFCs = eval(line[2]) ``` the order of evaluation is: * take the second character of the string line, i.e. a quote '"' * eval this quote as a python expression, which is an error. If you write it instead as: ``` NumPFCs = eval(line)[2] ``` then the ...
324,518
<p>How do you look up a user in Active Directory?</p> <p>Some example usernames are:</p> <ul> <li>avatopia\ian</li> <li>avatar\ian</li> <li>ian@avatopia.com</li> <li>ian@avatopia.local</li> <li>avatopia.com\ian</li> </ul> <p>It's important to note that i don't know the name of the domain, <a href="https://stackoverf...
[ { "answer_id": 324585, "author": "Ian G", "author_id": 31765, "author_profile": "https://Stackoverflow.com/users/31765", "pm_score": 4, "selected": true, "text": "<p>This works for me.</p>\n<p>You should be able to differentiate between different users on different domain controllers (ie...
2008/11/27
[ "https://Stackoverflow.com/questions/324518", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12597/" ]
How do you look up a user in Active Directory? Some example usernames are: * avatopia\ian * avatar\ian * ian@avatopia.com * ian@avatopia.local * avatopia.com\ian It's important to note that i don't know the name of the domain, [and i shouldn't be hard-coding it](https://stackoverflow.com/questions/192366/how-to-grab...
This works for me. You should be able to differentiate between different users on different domain controllers (ie domain/username) because the ldappaths will be different. And according to you, you don't care because you are [not specifying an ldappath](https://stackoverflow.com/questions/192366/how-to-grab-ad-creden...
324,539
<p>For the moment my batch file look like this:</p> <pre><code>myprogram.exe param1 </code></pre> <p>The program starts but the DOS Window remains open. How can I close it?</p>
[ { "answer_id": 324540, "author": "Patrick Desjardins", "author_id": 13913, "author_profile": "https://Stackoverflow.com/users/13913", "pm_score": 8, "selected": true, "text": "<p>You can use the exit keyword. Here is an example from one of my batch files:</p>\n\n<pre><code>start myProgra...
2008/11/27
[ "https://Stackoverflow.com/questions/324539", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14441/" ]
For the moment my batch file look like this: ``` myprogram.exe param1 ``` The program starts but the DOS Window remains open. How can I close it?
You can use the exit keyword. Here is an example from one of my batch files: ``` start myProgram.exe param1 exit ```
324,572
<p>I am trying to set one bindable variable to be bound to another. Essentially I want to create an alias. I would give up, but this seems like something that would be good to know.</p> <p>essentially, I want changes in model.configView to be reflected in view, so that things bound to view.... behave the same as thi...
[ { "answer_id": 324577, "author": "Simon", "author_id": 24039, "author_profile": "https://Stackoverflow.com/users/24039", "pm_score": 1, "selected": false, "text": "<p>Not quite enough code here to really say what's going on, however you have made <code>view</code> bindable and that does ...
2008/11/27
[ "https://Stackoverflow.com/questions/324572", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40397/" ]
I am trying to set one bindable variable to be bound to another. Essentially I want to create an alias. I would give up, but this seems like something that would be good to know. essentially, I want changes in model.configView to be reflected in view, so that things bound to view.... behave the same as things bound to...
Not quite enough code here to really say what's going on, however you have made `view` bindable and that does not automatically mean that all of `view`'s children are bindable. You'll have to go into `view` and make `lblThisLabel` bindable too. Also it is hard for the rest of us to know how it works in your head. Perh...
324,604
<p>Greetings!</p> <p>If I have XML such as this:</p> <pre><code>&lt;Root&gt; &lt;AlphaSection&gt; . . . &lt;/AlphaSection&gt; &lt;BetaSection&gt; &lt;Choices&gt; &lt;SetA&gt; &lt;Choice id="choice1"&gt;Choice One&lt;/Choice&gt; &lt;Choice i...
[ { "answer_id": 324616, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 4, "selected": true, "text": "<p>You don't need the where clause at all - you just need to change the Elements call to be Descendants:</p>\n\n<pre><cod...
2008/11/27
[ "https://Stackoverflow.com/questions/324604", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27870/" ]
Greetings! If I have XML such as this: ``` <Root> <AlphaSection> . . . </AlphaSection> <BetaSection> <Choices> <SetA> <Choice id="choice1">Choice One</Choice> <Choice id="choice2">Choice Two</Choice> </SetA> <SetB> ...
You don't need the where clause at all - you just need to change the Elements call to be Descendants: ``` var choiceList = myXDoc.Root .Element("BetaSection") .Descendants("Choice") .Select(element => new { ...
324,605
<p>I have a trigger in which I want to have a variable that holds an INT I get from a <code>SELECT</code>, so I can use it in two IF statements instead of calling the <code>SELECT</code> twice. How do you declare/use variables in MySQL triggers?</p>
[ { "answer_id": 324715, "author": "IgorS", "author_id": 1476181, "author_profile": "https://Stackoverflow.com/users/1476181", "pm_score": 3, "selected": false, "text": "<pre><code>`CREATE TRIGGER `category_before_ins_tr` BEFORE INSERT ON `category`\n FOR EACH ROW\nBEGIN\n **SET @table...
2008/11/27
[ "https://Stackoverflow.com/questions/324605", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a trigger in which I want to have a variable that holds an INT I get from a `SELECT`, so I can use it in two IF statements instead of calling the `SELECT` twice. How do you declare/use variables in MySQL triggers?
You can declare local variables in MySQL triggers, with the `DECLARE` syntax. Here's an example: ``` DROP TABLE IF EXISTS foo; CREATE TABLE FOO ( i SERIAL PRIMARY KEY ); DELIMITER // DROP TRIGGER IF EXISTS bar // CREATE TRIGGER bar AFTER INSERT ON foo FOR EACH ROW BEGIN DECLARE x INT; SET x = NEW.i; SET @a ...
324,612
<p>The comments on <a href="http://steve-yegge.blogspot.com/" rel="nofollow noreferrer">Steve Yegge</a>'s <a href="http://steve-yegge.blogspot.com/2008/06/rhinos-and-tigers.html" rel="nofollow noreferrer">post</a> about <a href="http://www.mozilla.org/rhino/" rel="nofollow noreferrer">server-side Javascript</a> started...
[ { "answer_id": 324635, "author": "Barry Kelly", "author_id": 3712, "author_profile": "https://Stackoverflow.com/users/3712", "pm_score": 4, "selected": true, "text": "<p>I'd take Yegge's (and Ola Bini's) opinions on static typing with a grain of salt. If you appreciate what static typing...
2008/11/27
[ "https://Stackoverflow.com/questions/324612", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3366/" ]
The comments on [Steve Yegge](http://steve-yegge.blogspot.com/)'s [post](http://steve-yegge.blogspot.com/2008/06/rhinos-and-tigers.html) about [server-side Javascript](http://www.mozilla.org/rhino/) started discussing the merits of type systems in languages and this [comment](http://steve-yegge.blogspot.com/2008/06/rhi...
I'd take Yegge's (and Ola Bini's) opinions on static typing with a grain of salt. If you appreciate what static typing gives you, you'll learn how the type system of the programming language you choose works. IIRC, ML uses the '\*' syntax for tuples. <type> \* <type> is a tuple type with two elements. So, (1, 2) would...
324,641
<p>I have a border element with rounded corners containing a 3x3 grid. The corners of the grid are sticking out of the border. How can I fix that? I tried using ClipToBounds but didn't get anywhere. Thanks for your help</p>
[ { "answer_id": 324650, "author": "Vilx-", "author_id": 41360, "author_profile": "https://Stackoverflow.com/users/41360", "pm_score": 0, "selected": false, "text": "<p>Make the grid smaller or the border larger. So that the border element completely contains the grid.</p>\n\n<p>Alternativ...
2008/11/27
[ "https://Stackoverflow.com/questions/324641", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28029/" ]
I have a border element with rounded corners containing a 3x3 grid. The corners of the grid are sticking out of the border. How can I fix that? I tried using ClipToBounds but didn't get anywhere. Thanks for your help
Here are the highlights of this [thread](https://stackoverflow.com/questions/324641/how-to-make-the-contents-of-a-round-cornered-border-be-also-round-cornered#325003) mentioned by [Jobi](https://stackoverflow.com/users/8091/jobi-joy) * None of the decorators (i.e. Border) or layout panels (i.e. Stackpanel) come with t...
324,643
<p>In C++ often do something like this:</p> <pre><code>typedef map&lt;int, vector&lt;int&gt; &gt; MyIndexType; </code></pre> <p>Where I then use it like this:</p> <pre><code>MyIndexType myIndex; for( ... some loop ...) { myIndex[someId].push_back(someVal); } </code></pre> <p>If there was no entry in the map the c...
[ { "answer_id": 324648, "author": "Alastair", "author_id": 31038, "author_profile": "https://Stackoverflow.com/users/31038", "pm_score": 3, "selected": false, "text": "<p>Something like this perhaps:</p>\n\n<pre><code>myIndex = {}\nfor (someId,someVal) in collection:\n myIndex.setdefau...
2008/11/27
[ "https://Stackoverflow.com/questions/324643", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7743/" ]
In C++ often do something like this: ``` typedef map<int, vector<int> > MyIndexType; ``` Where I then use it like this: ``` MyIndexType myIndex; for( ... some loop ...) { myIndex[someId].push_back(someVal); } ``` If there was no entry in the map the code will insert a new empty vector and then append to it. In...
You want to use: ``` from collections import defaultdict myIndex = defaultdict(list) myIndex[someId].append(someVal) ``` Standard Library [`defaultdict` objects](http://docs.python.org/library/collections.html#id3). Example usage from the Python documentation: ``` >>> s = [('yellow', 1), ('blue', 2), ('yellow', 3)...
324,649
<p>Some examples I found that apparently worked with older versions of mvc suggest that there was a length parameter of sorts:</p> <pre><code>&lt;%=Html.TextBox("test", 50)%&gt; </code></pre> <p>But that may have been mistakenly setting the value.</p> <p>How do this work in the current release? Passing in the style ...
[ { "answer_id": 324751, "author": "Tim Scott", "author_id": 29493, "author_profile": "https://Stackoverflow.com/users/29493", "pm_score": 3, "selected": false, "text": "<p>Something like this should work:</p>\n\n<pre><code>&lt;%=Html.TextBox(\"test\", new { style=\"width:50px\" })%&gt;\n<...
2008/11/27
[ "https://Stackoverflow.com/questions/324649", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9913/" ]
Some examples I found that apparently worked with older versions of mvc suggest that there was a length parameter of sorts: ``` <%=Html.TextBox("test", 50)%> ``` But that may have been mistakenly setting the value. How do this work in the current release? Passing in the style doesn't appear to have any effect.
The original answer is no longer working as written: ``` <%=Html.TextBox("test", new { style="width:50px" })%> ``` will get you a text box with "{ style="width:50px" }" as its text content. To adjust this for the current release of MVC 1.0, use the following script (note the addition of the second parameter - I ha...
324,665
<p>Is it faster to do the following:</p> <pre><code> if ($var != 'test1' &amp;&amp; $var != 'test2' &amp;&amp; $var != 'test3' &amp;&amp; $var != 'test4') { ... } </code></pre> <p>Or:</p> <pre><code> if (!in_array($var, array('test1', 'test2', 'test3', 'test4') { ... } </code></pre> <p>Is there a number of values a...
[ { "answer_id": 324669, "author": "Owen", "author_id": 4853, "author_profile": "https://Stackoverflow.com/users/4853", "pm_score": 5, "selected": true, "text": "<p>i'd strongly suggest just using <code>in_array()</code>, any speed difference would be negligible, but the readability of tes...
2008/11/27
[ "https://Stackoverflow.com/questions/324665", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5441/" ]
Is it faster to do the following: ``` if ($var != 'test1' && $var != 'test2' && $var != 'test3' && $var != 'test4') { ... } ``` Or: ``` if (!in_array($var, array('test1', 'test2', 'test3', 'test4') { ... } ``` Is there a number of values at which point it's faster to do one or the other? (In this case, the arr...
i'd strongly suggest just using `in_array()`, any speed difference would be negligible, but the readability of testing each variable separately is horrible. just for fun here's a test i ran: ``` $array = array('test1', 'test2', 'test3', 'test4'); $var = 'test'; $iterations = 1000000; $start = microtime(true); for($i...
324,666
<p>When implementing an +initialize or +load method in one of your Objective-C classes, should you <em>always</em> start with this kind of guard?:</p> <pre><code>@implementation MyClass + (void)initialize { if (self == [MyClass class]) { ... } } ... @end </code></pre> <p>Seems like code in +load and...
[ { "answer_id": 324719, "author": "Matt Gallagher", "author_id": 36103, "author_profile": "https://Stackoverflow.com/users/36103", "pm_score": 3, "selected": true, "text": "<p>Yes, you should do this in your intialize and load methods if you are initializing globals that should only be in...
2008/11/27
[ "https://Stackoverflow.com/questions/324666", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34934/" ]
When implementing an +initialize or +load method in one of your Objective-C classes, should you *always* start with this kind of guard?: ``` @implementation MyClass + (void)initialize { if (self == [MyClass class]) { ... } } ... @end ``` Seems like code in +load and +initialize usually only wants t...
Yes, you should do this in your intialize and load methods if you are initializing globals that should only be initialized once. That said, there are a number of cases where you may avoid it... You shouldn't wrap with this conditional if the work needs to be performed on every inheritant of every class: * For exampl...
324,668
<p>I am extending Alfresco Web Client and in one page while expanding panels I get this error. I do not get it always.</p> <pre><code>JSF : java.lang.IllegalStateException: Client-id : _idJsp35 is duplicated in the faces tree in Alfresco Web Client </code></pre> <p>I tried to give every component possible unique id, ...
[ { "answer_id": 975599, "author": "Grassdog", "author_id": 62023, "author_profile": "https://Stackoverflow.com/users/62023", "pm_score": 2, "selected": false, "text": "<p>Whenever I have seen this it has been due to duplicate ids in your JSP.</p>\n" }, { "answer_id": 7770954, ...
2008/11/27
[ "https://Stackoverflow.com/questions/324668", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33093/" ]
I am extending Alfresco Web Client and in one page while expanding panels I get this error. I do not get it always. ``` JSF : java.lang.IllegalStateException: Client-id : _idJsp35 is duplicated in the faces tree in Alfresco Web Client ``` I tried to give every component possible unique id, but error still shows up. ...
Whenever I have seen this it has been due to duplicate ids in your JSP.
324,670
<p>We perform updates of large text files by writing new records to a temp file, then replacing the old file with the temp file. A heavily abbreviated version:</p> <pre><code>var tpath = Path.GetTempFileName(); try { using (var sf = new StreamReader(sourcepath)) using (var tf = new StreamWriter(tpath)) { ...
[ { "answer_id": 324696, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 3, "selected": false, "text": "<p>The normal way of avoiding the \"delete then move fails problem\" is:</p>\n\n<ul>\n<li>Write to file.new</li>\n<li>Mo...
2008/11/27
[ "https://Stackoverflow.com/questions/324670", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22437/" ]
We perform updates of large text files by writing new records to a temp file, then replacing the old file with the temp file. A heavily abbreviated version: ``` var tpath = Path.GetTempFileName(); try { using (var sf = new StreamReader(sourcepath)) using (var tf = new StreamWriter(tpath)) { string ...
Lots of good suggestions. I was able to solve the problems with: ``` var sInfo = new FileInfo(sourcePath); if (sInfo.IsReadOnly) throw new IOException("File '" + sInfo.FullName + "' is read-only."); var tPath = Path.GetTempFileName(); try { // This throws if sourcePath does not exist, is opened, or is not rea...
324,677
<p>I have clustered applications that requires one of the nodes to be designated as the master. The cluster nodes are tracked in a table with <strong>nodeID</strong>, <strong>isMaster</strong>, <strong>lastTimestamp</strong> columns.</p> <p>Each node in the cluster will try to become a master every <strong>X</strong> ...
[ { "answer_id": 324696, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 3, "selected": false, "text": "<p>The normal way of avoiding the \"delete then move fails problem\" is:</p>\n\n<ul>\n<li>Write to file.new</li>\n<li>Mo...
2008/11/27
[ "https://Stackoverflow.com/questions/324677", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41465/" ]
I have clustered applications that requires one of the nodes to be designated as the master. The cluster nodes are tracked in a table with **nodeID**, **isMaster**, **lastTimestamp** columns. Each node in the cluster will try to become a master every **X** seconds. Node can only become a master if either * there is n...
Lots of good suggestions. I was able to solve the problems with: ``` var sInfo = new FileInfo(sourcePath); if (sInfo.IsReadOnly) throw new IOException("File '" + sInfo.FullName + "' is read-only."); var tPath = Path.GetTempFileName(); try { // This throws if sourcePath does not exist, is opened, or is not rea...
324,682
<p>I'm trying to add HyperLinkColumns dynamically to my GridView. I have the following code:</p> <pre><code>HyperLinkColumn objHC = new HyperLinkColumn(); objHC.DataNavigateUrlField = "title"; objHC.DataTextField = "Link text"; objHC.DataNavigateUrlFormatString = "id, title"; objHC.DataTextFormatString = "{2}"; GridV...
[ { "answer_id": 324692, "author": "shahkalpesh", "author_id": 23574, "author_profile": "https://Stackoverflow.com/users/23574", "pm_score": -1, "selected": false, "text": "<p>It seems you have got things mixed up. I don't know - how that code compiles?</p>\n\n<p>GridView's column collecti...
2008/11/27
[ "https://Stackoverflow.com/questions/324682", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm trying to add HyperLinkColumns dynamically to my GridView. I have the following code: ``` HyperLinkColumn objHC = new HyperLinkColumn(); objHC.DataNavigateUrlField = "title"; objHC.DataTextField = "Link text"; objHC.DataNavigateUrlFormatString = "id, title"; objHC.DataTextFormatString = "{2}"; GridView1.Columns.A...
You might want to add it when the row is binded: ``` protected void yourGrid_RowDataBound(object sender, GridViewRowEventArgs e) { HyperLink hlControl = new HyperLink(); hlControl.Text = e.Row.Cells[2].Text; //Take back the text (let say you want it in cell of index 2) hlControl.NavigateUrl = "...
324,697
<p>Is there a way to use XMLHttpRequest in combination with other domains?</p> <p>I would like to parse some xml from Google without having to use a server so it is minimalistically complex to run.</p> <pre><code>var req = getXmlHttpRequestObject(); ... req.open('GET', 'http://www.google.de/ig/api?weather=Braunschwei...
[ { "answer_id": 324703, "author": "Brian Gianforcaro", "author_id": 3415, "author_profile": "https://Stackoverflow.com/users/3415", "pm_score": 4, "selected": false, "text": "<p>Nope, not right now. I believe I read that plans/design's are in the works by standards groups for the future, ...
2008/11/27
[ "https://Stackoverflow.com/questions/324697", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19929/" ]
Is there a way to use XMLHttpRequest in combination with other domains? I would like to parse some xml from Google without having to use a server so it is minimalistically complex to run. ``` var req = getXmlHttpRequestObject(); ... req.open('GET', 'http://www.google.de/ig/api?weather=Braunschweig', true); re...
Nope, not right now. I believe I read that plans/design's are in the works by standards groups for the future, so we can securely do this. Cross site scripting vulnerabilities would be rampant other wise. [JSONP](http://www.west-wind.com/Weblog/posts/107136.aspx) is a possible solution if the other sites API suppor...
324,711
<p>I'm currently using <code>std::ofstream</code> as follows:</p> <pre><code>std::ofstream outFile; outFile.open(output_file); </code></pre> <p>Then I attempt to pass a <code>std::stringstream</code> object to <code>outFile</code> as follows:</p> <pre><code>GetHolesResults(..., std::ofstream &amp;outFile){ float x...
[ { "answer_id": 324975, "author": "Johannes Schaub - litb", "author_id": 34509, "author_profile": "https://Stackoverflow.com/users/34509", "pm_score": 8, "selected": true, "text": "<p>You can do this, which doesn't need to create the string. It makes the output stream read out the content...
2008/11/27
[ "https://Stackoverflow.com/questions/324711", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6367/" ]
I'm currently using `std::ofstream` as follows: ``` std::ofstream outFile; outFile.open(output_file); ``` Then I attempt to pass a `std::stringstream` object to `outFile` as follows: ``` GetHolesResults(..., std::ofstream &outFile){ float x = 1234; std::stringstream ss; ss << x << std::endl; outFile << ss; ...
You can do this, which doesn't need to create the string. It makes the output stream read out the contents of the stream on the right side (usable with any streams). ```cpp outFile << ss.rdbuf(); ```
324,726
<p>I want to execute a php-script from php that will use different constants and different versions of classes that are already defined.</p> <p>Is there a sandbox php_module where i could just:</p> <pre><code>sandbox('script.php'); // run in a new php environment </code></pre> <p>instead of </p> <pre><code>include(...
[ { "answer_id": 324746, "author": "troelskn", "author_id": 18180, "author_profile": "https://Stackoverflow.com/users/18180", "pm_score": 4, "selected": true, "text": "<p>There is <a href=\"http://www.php.net/runkit\" rel=\"noreferrer\">runkit</a>, but you may find it simpler to just call ...
2008/11/27
[ "https://Stackoverflow.com/questions/324726", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19165/" ]
I want to execute a php-script from php that will use different constants and different versions of classes that are already defined. Is there a sandbox php\_module where i could just: ``` sandbox('script.php'); // run in a new php environment ``` instead of ``` include('script.php'); // run in the same environme...
There is [runkit](http://www.php.net/runkit), but you may find it simpler to just call the script over the command line (Use [shell\_exec](http://www.php.net/shell_exec)), if you don't need any interaction between the master and child processes.
324,748
<p>I'm developing class to represent special kind of matrix:</p> <pre><code>type DifRecord = record Field: String; Number: Byte; Value: smallint; end; type TData = array of array of MainModule.DataRecord; type TDifference = array of DifRecord; type TFogelMatrix = class private M: Byte; ...
[ { "answer_id": 324753, "author": "Lasse V. Karlsen", "author_id": 267, "author_profile": "https://Stackoverflow.com/users/267", "pm_score": 4, "selected": true, "text": "<p>Since you're using dynamic arrays, <code>array of</code>, then you should use SetLength to specify the length of th...
2008/11/27
[ "https://Stackoverflow.com/questions/324748", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28298/" ]
I'm developing class to represent special kind of matrix: ``` type DifRecord = record Field: String; Number: Byte; Value: smallint; end; type TData = array of array of MainModule.DataRecord; type TDifference = array of DifRecord; type TFogelMatrix = class private M: Byte; N: Byte; ...
Since you're using dynamic arrays, `array of`, then you should use SetLength to specify the length of the array, which can be done dynamically. ie. like this: ``` SetLength(Data, 100); ``` This will not reserve 100 bytes, but will reserve enough space to hold 100 elements of whatever type the array holds. Change y...
324,776
<p>I want to pass some parameters to a Crystal Report like this:</p> <pre><code>ReportDocument.DataDefinition.FormulaFields[parameterName].Text = 'Text'; </code></pre> <p>This workes fine unless I want to pass a multiline textbox from ASPX (containing \n and \r chars.)</p> <p>The reportviewer reports that "The ma...
[ { "answer_id": 330615, "author": "sindre j", "author_id": 37119, "author_profile": "https://Stackoverflow.com/users/37119", "pm_score": 2, "selected": false, "text": "<p>You have to replace the \\r\\n pair with something obscure before passing it to the report, then make a crystal formul...
2008/11/27
[ "https://Stackoverflow.com/questions/324776", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I want to pass some parameters to a Crystal Report like this: ``` ReportDocument.DataDefinition.FormulaFields[parameterName].Text = 'Text'; ``` This workes fine unless I want to pass a multiline textbox from ASPX (containing \n and \r chars.) The reportviewer reports that "The matching ' for this string is missi...
You have to replace the \r\n pair with something obscure before passing it to the report, then make a crystal formula that converts it back to cr-lf pair in the report. Example with converting cr-lf to three underscores C# ReportDocument.DataDefinition.FormulaFields[somefield].Text = textWithCrLf.Replace("\r\n","\_\...
324,779
<p>One of my API calls can result in updates to a large number of objects (Django models). I'm running into performance issues with this since I'm updating each item individually, saving, and moving on to the next:</p> <pre><code>for item in Something.objects.filter(x='y'): item.a="something" item.save() </cod...
[ { "answer_id": 324954, "author": "Loki", "author_id": 39057, "author_profile": "https://Stackoverflow.com/users/39057", "pm_score": 1, "selected": false, "text": "<p>You need to use transactions or create the sql statement by hand. You could also try using SQLAlchemy which supports a few...
2008/11/27
[ "https://Stackoverflow.com/questions/324779", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13055/" ]
One of my API calls can result in updates to a large number of objects (Django models). I'm running into performance issues with this since I'm updating each item individually, saving, and moving on to the next: ``` for item in Something.objects.filter(x='y'): item.a="something" item.save() ``` Sometimes my ...
The ticket you linked to is for bulk creation - if you're not relying on an overridden `save` method or pre/post save signals to do bits of work on save, [`QuerySet` has an `update` method](http://docs.djangoproject.com/en/dev/topics/db/queries/#updating-multiple-objects-at-once) which you can use to perform an `UPDATE...
324,822
<p>I have something like this:</p> <pre><code>&lt;node TEXT=" txt A "/&gt; &lt;node TEXT=" txt X "/&gt; &lt;node&gt; &lt;html&gt; &lt;p&gt; txt Y &lt;/p&gt; &lt;/html&gt; &lt;/node&gt; &lt;node TEXT="txt B"/&gt; </code></pre> <p>and i want to use XSLT to get this:</p> <pre><cod...
[ { "answer_id": 324869, "author": "Vincent Ramdhanie", "author_id": 27439, "author_profile": "https://Stackoverflow.com/users/27439", "pm_score": 0, "selected": false, "text": "<p>You probably want</p>\n\n<pre><code> &lt;xsl:strip-space elements=\"node\"/&gt;\n</code></pre>\n\n<p>explaine...
2008/11/27
[ "https://Stackoverflow.com/questions/324822", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8986/" ]
I have something like this: ``` <node TEXT=" txt A "/> <node TEXT=" txt X "/> <node> <html> <p> txt Y </p> </html> </node> <node TEXT="txt B"/> ``` and i want to use XSLT to get this: ``` txt A txt X txt Y txt B ``` I want to strip all useless whitespaces and linebreaks of @...
The following transformation: ``` <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="text"/> <xsl:template match="*"> <xsl:apply-templates select="@TEXT | node()"/> </xsl:template> <xsl:template match="node/@TEXT | text()"> <xsl:if test="normalize-space(.)"> <...
324,831
<p>If I have a for loop which is nested within another, how can I efficiently come out of both loops (inner and outer) in the quickest possible way?</p> <p>I don't want to have to use a boolean and then have to say go to another method, but rather just to execute the first line of code after the outer loop.</p> <p>Wh...
[ { "answer_id": 324834, "author": "Thomas Hansen", "author_id": 29746, "author_profile": "https://Stackoverflow.com/users/29746", "pm_score": -1, "selected": false, "text": "<p>I think unless you want to do the \"boolean thing\" the only solution is actually to throw. Which you obviously ...
2008/11/27
[ "https://Stackoverflow.com/questions/324831", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32484/" ]
If I have a for loop which is nested within another, how can I efficiently come out of both loops (inner and outer) in the quickest possible way? I don't want to have to use a boolean and then have to say go to another method, but rather just to execute the first line of code after the outer loop. What is a quick and...
Well, `goto`, but that is ugly, and not always possible. You can also place the loops into a method (or an anon-method) and use `return` to exit back to the main code. ``` // goto for (int i = 0; i < 100; i++) { for (int j = 0; j < 100; j++) { goto Foo; // yeuck! } }...
324,860
<p>I'm using a custom <code>tintColor</code> on my <code>UINavigationController</code>'s navigation bar, and because the color is so light I need to use dark colored text. It's relatively easy to swap out the title view, and the custom buttons I've added on the right hand side, but I can't seem to get a custom view to ...
[ { "answer_id": 325780, "author": "Ben Gottlieb", "author_id": 6694, "author_profile": "https://Stackoverflow.com/users/6694", "pm_score": 4, "selected": true, "text": "<p>There's no official way to do this. The two methods that I could think of are:</p>\n\n<ul>\n<li><p>navigate the view ...
2008/11/28
[ "https://Stackoverflow.com/questions/324860", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41497/" ]
I'm using a custom `tintColor` on my `UINavigationController`'s navigation bar, and because the color is so light I need to use dark colored text. It's relatively easy to swap out the title view, and the custom buttons I've added on the right hand side, but I can't seem to get a custom view to stick on the back button....
There's no official way to do this. The two methods that I could think of are: * navigate the view tree to find the existing Back button, and set its text color manually. This is probably not a good idea, as it's fragile, and the button may not even have a configurable textColor property. * create your own back button...
324,867
<p>Kind of a basic question but I'm having troubles thinking of a solution so I need a push in the right direction.</p> <p>I have an input file that I'm pulling in, and I have to put it into one string variable. The problem is I need to split this string up into different things. There will be 3 strings and 1 int. ...
[ { "answer_id": 324873, "author": "SoapBox", "author_id": 36384, "author_profile": "https://Stackoverflow.com/users/36384", "pm_score": 2, "selected": true, "text": "<p>With C-style strings you can use <a href=\"http://linux.die.net/man/3/strtok\" rel=\"nofollow noreferrer\">strtok()</a> ...
2008/11/28
[ "https://Stackoverflow.com/questions/324867", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28392/" ]
Kind of a basic question but I'm having troubles thinking of a solution so I need a push in the right direction. I have an input file that I'm pulling in, and I have to put it into one string variable. The problem is I need to split this string up into different things. There will be 3 strings and 1 int. They are sepa...
With C-style strings you can use [strtok()](http://linux.die.net/man/3/strtok) to do this. You could also use [sscanf()](http://linux.die.net/man/3/sscanf) But since you're dealing with C++, you probably want to stick with built in std::string functions. As such you can use find(). Find has a form which takes a second...
324,904
<p>I added the following to my web.config to redirect the user to the login page if they aren't authenticated, but going to the URL does cause a redirect?</p> <pre><code> &lt;location path="user/add"&gt; &lt;system.web&gt; &lt;authorization&gt; &lt;deny users="?" /&gt; &lt;/authorization&gt; ...
[ { "answer_id": 324914, "author": "Mark Glorie", "author_id": 952, "author_profile": "https://Stackoverflow.com/users/952", "pm_score": 0, "selected": false, "text": "<p>For one of my applications I have the following in the same node as <code>&lt;authentication&gt;</code>: </p>\n\n<pre>...
2008/11/28
[ "https://Stackoverflow.com/questions/324904", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I added the following to my web.config to redirect the user to the login page if they aren't authenticated, but going to the URL does cause a redirect? ``` <location path="user/add"> <system.web> <authorization> <deny users="?" /> </authorization> </system.web> </location> ``` I have s...
Do you have the "Authorize" attribute on that Action or Controller?
324,905
<p>Using Microsoft's AntiXssLibrary, how do you handle input that needs to be edited later?</p> <p>For example:</p> <p>User enters: <code>&lt;i&gt;title&lt;/i&gt;</code></p> <p>Saved to the database as: <code>&lt;i&gt;title&lt;/i&gt;</code></p> <p>On an edit page, in a text box it displays something like: ...
[ { "answer_id": 324918, "author": "Stepan Mazurov", "author_id": 40786, "author_profile": "https://Stackoverflow.com/users/40786", "pm_score": -1, "selected": false, "text": "<p>Yes, the code inside input boxes is safe from scripting attacks and does not need to be encoded. </p>\n" }, ...
2008/11/28
[ "https://Stackoverflow.com/questions/324905", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32892/" ]
Using Microsoft's AntiXssLibrary, how do you handle input that needs to be edited later? For example: User enters: `<i>title</i>` Saved to the database as: `<i>title</i>` On an edit page, in a text box it displays something like: `&lt;i&gt;title&lt;/i&gt;` because I've encoded it before displaying in the text b...
Looks like you're encoding it more than once. In ASP.NET, using Microsoft's AntiXss Library you can use the HtmlAttributeEncode method to encode untrusted input: ``` <input type="text" value="<%= AntiXss.HtmlAttributeEncode("<i>title</i>") %>" /> ``` This results in ``` <input type="text" value="&#60;i&#62;title&#60...
324,923
<p>I'm trying to gauge the possibility of a patch to WebKit which would allow all rendered graphics to be rendered onto a fully transparent background.</p> <p>The desired effect is to render web content without any background at all, it should appear to float over the desktop (or whatever is displayed behind the brows...
[ { "answer_id": 790813, "author": "ewanm89", "author_id": 96194, "author_profile": "https://Stackoverflow.com/users/96194", "pm_score": 1, "selected": false, "text": "<p>Basically you want to be setting the ARGB colour space to be sending to the window manager. Obviously only window manag...
2008/11/28
[ "https://Stackoverflow.com/questions/324923", "https://Stackoverflow.com", "https://Stackoverflow.com/users/758/" ]
I'm trying to gauge the possibility of a patch to WebKit which would allow all rendered graphics to be rendered onto a fully transparent background. The desired effect is to render web content without any background at all, it should appear to float over the desktop (or whatever is displayed behind the browser window)...
**Solved!** Through ongoing research, scouring forums and source code repositories, I peiced together the necessary steps to accomplish this using only libwebkit and a standard compiz desktop (any Xorg desktop with compositing should do). For a current libwebkit (1.1.10-SVN), there is an Ubuntu PPA: ``` deb http://p...
324,935
<p>I'm trying to use MySQL to create a view with the "WITH" clause</p> <pre><code>WITH authorRating(aname, rating) AS SELECT aname, AVG(quantity) FROM book GROUP BY aname </code></pre> <p>But it doesn't seem like MySQL supports this.</p> <p>I thought this was pretty standard and I'm sure Oracle supports thi...
[ { "answer_id": 324964, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 4, "selected": false, "text": "<p>Oracle does support WITH.</p>\n\n<p>It would look like this.</p>\n\n<pre><code>WITH emps as (SELECT * FROM Employees)\nSELE...
2008/11/28
[ "https://Stackoverflow.com/questions/324935", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm trying to use MySQL to create a view with the "WITH" clause ``` WITH authorRating(aname, rating) AS SELECT aname, AVG(quantity) FROM book GROUP BY aname ``` But it doesn't seem like MySQL supports this. I thought this was pretty standard and I'm sure Oracle supports this. Is there anyway to force MySQL...
Update: MySQL 8.0 is finally getting the feature of common table expressions, including recursive CTEs. Here's a blog announcing it: <http://mysqlserverteam.com/mysql-8-0-labs-recursive-common-table-expressions-in-mysql-ctes/> Below is my earlier answer, which I originally wrote in 2008. --- MySQL 5.x does not supp...
324,949
<p>I'm working on a social networking system that will have comments coming from several different locations. One could be friends, one could be events, one could be groups--much like Facebook. What I'm wondering is, from a practical standpoint, what would be the simplest way to write a comments table? Should I do i...
[ { "answer_id": 324968, "author": "Oddthinking", "author_id": 8014, "author_profile": "https://Stackoverflow.com/users/8014", "pm_score": 0, "selected": false, "text": "<p>This is an equivalent question to <a href=\"https://stackoverflow.com/questions/307748/news-feed-database-design-as-i...
2008/11/28
[ "https://Stackoverflow.com/questions/324949", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm working on a social networking system that will have comments coming from several different locations. One could be friends, one could be events, one could be groups--much like Facebook. What I'm wondering is, from a practical standpoint, what would be the simplest way to write a comments table? Should I do it all ...
A single comments table is the more elegant design, I think. Rather than multiple FKs though, consider an intermediate table - CommentedItem. So Friend, Event, Group, etc all have FKs to CommentedItem, and you create a CommentedItem row for each new row in each of those tables. Now Comments only needs one FK, to Commen...
324,957
<p>We have a legacy ASP.net powered site running on a IIS server, the site was developed by a central team and is used by multiple customers. Each customer however has their own copy of the site's aspx files plus a web.config file. This is causing problems as changes made by well meaning support engineers to the copie...
[ { "answer_id": 324960, "author": "Brody", "author_id": 17131, "author_profile": "https://Stackoverflow.com/users/17131", "pm_score": 1, "selected": false, "text": "<p>Use an external source control application and keep rolling out updates as required.</p>\n\n<p>It isn't really a good ide...
2008/11/28
[ "https://Stackoverflow.com/questions/324957", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39040/" ]
We have a legacy ASP.net powered site running on a IIS server, the site was developed by a central team and is used by multiple customers. Each customer however has their own copy of the site's aspx files plus a web.config file. This is causing problems as changes made by well meaning support engineers to the copies of...
If you're dead-set on the single app instance, you can accomplish what you're after using a custom ConfigurationSection in your single web.config. For the basics, see: * <http://haacked.com/archive/2007/03/12/custom-configuration-sections-in-3-easy-steps.aspx> * <http://msdn.microsoft.com/en-us/library/2tw134k3.aspx> ...
324,959
<p>Is it possible to pass a query string to Namescape's <a href="http://www.namescape.com/Products/rDirectory/Default.aspx" rel="nofollow noreferrer">rDirectory</a>? I'd like to build a web-app that can do a search and display the results in rDirectory, rather than first launching rDirectory and doing said search.</p>
[ { "answer_id": 324960, "author": "Brody", "author_id": 17131, "author_profile": "https://Stackoverflow.com/users/17131", "pm_score": 1, "selected": false, "text": "<p>Use an external source control application and keep rolling out updates as required.</p>\n\n<p>It isn't really a good ide...
2008/11/28
[ "https://Stackoverflow.com/questions/324959", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5473/" ]
Is it possible to pass a query string to Namescape's [rDirectory](http://www.namescape.com/Products/rDirectory/Default.aspx)? I'd like to build a web-app that can do a search and display the results in rDirectory, rather than first launching rDirectory and doing said search.
If you're dead-set on the single app instance, you can accomplish what you're after using a custom ConfigurationSection in your single web.config. For the basics, see: * <http://haacked.com/archive/2007/03/12/custom-configuration-sections-in-3-easy-steps.aspx> * <http://msdn.microsoft.com/en-us/library/2tw134k3.aspx> ...
324,961
<p>I am looking for a regex pattern that would match several different combinations of zeros such as 00-00-0000 or 0 or 0.0 or 00000 </p> <p>Please help</p> <p>Thanks!</p> <p>EDIT:</p> <p>Well, I have web service that returns me a result set, based on what it returns me I can decide if the result is worth displayi...
[ { "answer_id": 324963, "author": "SoapBox", "author_id": 36384, "author_profile": "https://Stackoverflow.com/users/36384", "pm_score": 3, "selected": false, "text": "<p>You need to better define what is valid to appear between the zeros. Going from your question, I'll assume you're look...
2008/11/28
[ "https://Stackoverflow.com/questions/324961", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41508/" ]
I am looking for a regex pattern that would match several different combinations of zeros such as 00-00-0000 or 0 or 0.0 or 00000 Please help Thanks! EDIT: Well, I have web service that returns me a result set, based on what it returns me I can decide if the result is worth displaying on the page. So if I get eit...
``` [^123456789]+ ``` or ``` [^1-9]+ ``` I believe this is what you are searching for...
324,974
<p>When I connect my digital camera with my computer, a dialog box containing all the registered programs can be used to get images from the camera will appear. Now I want to add my own program in the list, so that when I click the item of my program, I can use my own program to get images from the digital camera.</p> ...
[ { "answer_id": 464980, "author": "chrisd", "author_id": 9591, "author_profile": "https://Stackoverflow.com/users/9591", "pm_score": 0, "selected": false, "text": "<p>You need to use the WIA (Windows Image Acquisition) interface. IWiaDevMgr provides three methods to do this: RegisterEvent...
2008/11/28
[ "https://Stackoverflow.com/questions/324974", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26404/" ]
When I connect my digital camera with my computer, a dialog box containing all the registered programs can be used to get images from the camera will appear. Now I want to add my own program in the list, so that when I click the item of my program, I can use my own program to get images from the digital camera. Thank ...
WIA has a Device Manager object that provides an interface that allows for programs to register for event notifications. Contacting the Device Manager ----------------------------- You use the `IWiaDevMgr` interface to interact with the device manager. You get a pointer to that interface with a call to `CoCreateInsta...
324,980
<p>I am having difficulty determining if the body of a text email message is base64 encoded. if it is then use this line of code; making use of jython 2.2.1</p> <pre><code>dirty=base64.decodebytes(dirty) </code></pre> <p>else continue as normal.</p> <p>This is the code I have atm. What line of code will allow me to ...
[ { "answer_id": 324989, "author": "Harley Holcombe", "author_id": 1057, "author_profile": "https://Stackoverflow.com/users/1057", "pm_score": 4, "selected": true, "text": "<p>Try:</p>\n\n<pre><code>enc = msg['Content-Transfer-Encoding']\n</code></pre>\n\n<p>It's a header so you won't be a...
2008/11/28
[ "https://Stackoverflow.com/questions/324980", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21537/" ]
I am having difficulty determining if the body of a text email message is base64 encoded. if it is then use this line of code; making use of jython 2.2.1 ``` dirty=base64.decodebytes(dirty) ``` else continue as normal. This is the code I have atm. What line of code will allow me to extract this from the email: "C...
Try: ``` enc = msg['Content-Transfer-Encoding'] ``` It's a header so you won't be able to get it looking at the body. You should be able to get at the same place you find out the Subject.
325,001
<p>I have my WCF service defined as follows [ServiceContract] public interface IService1 { [OperationContract] IList GetMyTable();</p> <pre><code> [OperationContract] void SendMyTable(List&lt;RatePositions&gt; ratePositions); [OperationContract] void SendString(string value);...
[ { "answer_id": 325022, "author": "Timothy Khouri", "author_id": 11917, "author_profile": "https://Stackoverflow.com/users/11917", "pm_score": 0, "selected": false, "text": "<p>Because Silverlight doesn't like \"List\", but rather it will convert that (on the client) to \"ObservableCollec...
2008/11/28
[ "https://Stackoverflow.com/questions/325001", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have my WCF service defined as follows [ServiceContract] public interface IService1 { [OperationContract] IList GetMyTable(); ``` [OperationContract] void SendMyTable(List<RatePositions> ratePositions); [OperationContract] void SendString(string value); } ``` When I call GetMyTable() from my ...
The problem may be the message size problem with WCF. Look at both the clientconfig file that is created in your silverlight project as well as the web.config in your server project to make sure the size of the data you're returning is not too large. The 404 error is a catch all for any WCF failure. Can you debug the...