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
489,861
<p>I need to lock a file for writing in Python. It will be accessed from multiple Python processes at once. I have found some solutions online, but most fail for my purposes as they are often only Unix based or Windows based.</p>
[ { "answer_id": 489924, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 2, "selected": false, "text": "<p>Locking a file is usually a platform-specific operation, so you may need to allow for the possibility of running on di...
2009/01/28
[ "https://Stackoverflow.com/questions/489861", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49701/" ]
I need to lock a file for writing in Python. It will be accessed from multiple Python processes at once. I have found some solutions online, but most fail for my purposes as they are often only Unix based or Windows based.
Alright, so I ended up going with the code I wrote [here, on my website](http://www.evanfosmark.com/2009/01/cross-platform-file-locking-support-in-python/) [link is dead, view on archive.org](https://web.archive.org/web/20140531203736/http://www.evanfosmark.com:80/2009/01/cross-platform-file-locking-support-in-python/)...
489,863
<p>i mean the HTTP/1.1 xxx yyyyyyy</p> <p>header i can modify all others with mod_headers but want to be able to return a status 200 for 403 error pages to a particular user-agent that dosn't display the text of my 403 pages {it displays an alternate page} </p> <p>just asking if anyone knows an env-var or header name...
[ { "answer_id": 489893, "author": "Erik Bakker", "author_id": 59174, "author_profile": "https://Stackoverflow.com/users/59174", "pm_score": 1, "selected": true, "text": "<p>You could set up a php script for your 403 error page and modify the header with that script:</p>\n\n<p>Put a line l...
2009/01/28
[ "https://Stackoverflow.com/questions/489863", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59995/" ]
i mean the HTTP/1.1 xxx yyyyyyy header i can modify all others with mod\_headers but want to be able to return a status 200 for 403 error pages to a particular user-agent that dosn't display the text of my 403 pages {it displays an alternate page} just asking if anyone knows an env-var or header name i can alter in ...
You could set up a php script for your 403 error page and modify the header with that script: Put a line like this in your .htaccess or Apache configuration file: `ErrorDocument 403 /path/to/your/error/script.php` And the following in said php file: ``` <?php if($_SERVER['HTTP_USER_AGENT'] == 'FooBot 1.2') { head...
489,874
<p>I have a column of numbers stored as chars. When I do a ORDER BY for this column I get the following: </p> <p>100<br> 131<br> 200<br> 21<br> 30<br> 31000<br> etc.</p> <p>How can I order these chars numerically? Do I need to convert something or is there already an SQL command or function for this? </p> <p>T...
[ { "answer_id": 489879, "author": "Ray Hidayat", "author_id": 49643, "author_profile": "https://Stackoverflow.com/users/49643", "pm_score": 8, "selected": true, "text": "<p>Try this:</p>\n\n<pre><code>ORDER BY CAST(thecolumn AS int)\n</code></pre>\n" }, { "answer_id": 489883, ...
2009/01/28
[ "https://Stackoverflow.com/questions/489874", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52256/" ]
I have a column of numbers stored as chars. When I do a ORDER BY for this column I get the following: 100 131 200 21 30 31000 etc. How can I order these chars numerically? Do I need to convert something or is there already an SQL command or function for this? Thank You.
Try this: ``` ORDER BY CAST(thecolumn AS int) ```
489,886
<p>I'm having the weirdest problem.</p> <p>I have two PlaceHolders in a Master Page; one contains controls for users who are logged-out, and the other for users who are logged-in.</p> <p>They are:</p> <p><code>plhLoggedOut</code></p> <p><code>plhLoggedIn</code></p> <p>During my Page_Load (of the Master Page), I se...
[ { "answer_id": 489905, "author": "slolife", "author_id": 698, "author_profile": "https://Stackoverflow.com/users/698", "pm_score": 2, "selected": false, "text": "<p>Maybe somewhere else in your code you are setting a parent control of those panels to visible, which rips through all child...
2009/01/28
[ "https://Stackoverflow.com/questions/489886", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28118/" ]
I'm having the weirdest problem. I have two PlaceHolders in a Master Page; one contains controls for users who are logged-out, and the other for users who are logged-in. They are: `plhLoggedOut` `plhLoggedIn` During my Page\_Load (of the Master Page), I set their visibility like so: ``` //LOGGED-IN? ...
I just removed the old PlaceHolders and created two new ones with different IDs. Then it started working. I vaguely remember having weird behaviors like that before, where for some reason the code-behind and the markup are disconnected. That might happen because I don't use the visual designer, and write the .NET tags...
489,901
<p>I have geographical data which has 14 variables. The data is in the following format:</p> <blockquote> <p>QUADNAME: rockport_colony_SD RESOLUTION: 10 ULLAT: 43.625<br> ULLON: -97.87527466 LRLAT: 43.5<br> LRLON: -97.75027466 HDATUM: 27<br> ZMIN: 361.58401489 ZMAX: 413.38400269 ...
[ { "answer_id": 490065, "author": "Nikhil", "author_id": 853, "author_profile": "https://Stackoverflow.com/users/853", "pm_score": 2, "selected": false, "text": "<p>Given a <a href=\"http://docs.python.org/library/codecs.html#streamreader-objects\" rel=\"nofollow noreferrer\">StreamReader...
2009/01/28
[ "https://Stackoverflow.com/questions/489901", "https://Stackoverflow.com", "https://Stackoverflow.com/users/54964/" ]
I have geographical data which has 14 variables. The data is in the following format: > > QUADNAME: rockport\_colony\_SD RESOLUTION: 10 ULLAT: 43.625 > > ULLON: -97.87527466 LRLAT: 43.5 > > LRLON: -97.75027466 HDATUM: 27 > > ZMIN: 361.58401489 ZMAX: > 413.38400269 ZMEAN: 396.1293335 ZSIGMA: 12.36359215 P...
Something like this might work if the data is all in a big flat text file: ``` import re data = """ QUADNAME: rockport_colony_SD RESOLUTION: 10 ULLAT: 43.625 ULLON: -97.87527466 LRLAT: 43.5 LRLON: -97.75027466 HDATUM: 27 ZMIN: 361.58401489 ZMAX: 413.38400269 ZMEAN: 396.1293335 ZSIGMA: 12.36359215 PMETHOD: 5 QUADDATE:...
489,904
<p>I need to query this DB to get each row, but also the SUM of one of the column values of the results. I could use php to get the total value, but then I'd need to run two loops, one to get the total (which goes at the top above the results). So I'd prefer the query to catch it and just make a "total" row, but the on...
[ { "answer_id": 489942, "author": "paxdiablo", "author_id": 14860, "author_profile": "https://Stackoverflow.com/users/14860", "pm_score": 2, "selected": false, "text": "<p>The better way is to do this with code. People keep insisting on using SQL, which is a relational algebra, for doing ...
2009/01/28
[ "https://Stackoverflow.com/questions/489904", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49478/" ]
I need to query this DB to get each row, but also the SUM of one of the column values of the results. I could use php to get the total value, but then I'd need to run two loops, one to get the total (which goes at the top above the results). So I'd prefer the query to catch it and just make a "total" row, but the only ...
MySQL supports a special group-by modifier called [ROLLUP](http://dev.mysql.com/doc/refman/5.1/en/group-by-modifiers.html). ``` SELECT CONCAT(u.firstname, ' ', u.lastname ) name, u.id, s.description, s.shiftstart, s.shiftend, SUM( TIME_TO_SEC( TIMEDIFF( shiftend, shiftstart ) ) ) /3600 total FROM shifts s INNER ...
489,913
<p>I have a question about changing the values of variables in methods in Java.</p> <p>This is my code:</p> <pre><code>public class Test { public static void funk(int a, int[] b) { b[0] = b[0] * 2; a = b[0] + 5; } public static void main(String[] args) { int bird = 10; ...
[ { "answer_id": 489921, "author": "Johannes Schaub - litb", "author_id": 34509, "author_profile": "https://Stackoverflow.com/users/34509", "pm_score": 4, "selected": false, "text": "<p>Look at Jon Skeet's article about <a href=\"http://www.yoda.arachsys.com/java/passing.html\" rel=\"noref...
2009/01/28
[ "https://Stackoverflow.com/questions/489913", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42155/" ]
I have a question about changing the values of variables in methods in Java. This is my code: ``` public class Test { public static void funk(int a, int[] b) { b[0] = b[0] * 2; a = b[0] + 5; } public static void main(String[] args) { int bird = 10; int[] tiger = {7}; ...
Look at Jon Skeet's article about [Parameter-Passing in Java](http://www.yoda.arachsys.com/java/passing.html), which explains this. In short (look at his site for a more throughout explanation): Arrays are reference types. If you pass a reference that points to an array, the value of the reference is copied and ass...
489,927
<p>I'm currently beginning to program with Java. I tried to code the sequence in the title as an output in Java, but I'm stuck! I'm experimenting with the for function, any help is welcomed ;)</p>
[ { "answer_id": 489934, "author": "Jonas Elfström", "author_id": 44620, "author_profile": "https://Stackoverflow.com/users/44620", "pm_score": 0, "selected": false, "text": "<p>Or did your teacher ask you to?\nTwo nested for loops will do the trick.</p>\n\n<p>Or in another way in another ...
2009/01/28
[ "https://Stackoverflow.com/questions/489927", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59998/" ]
I'm currently beginning to program with Java. I tried to code the sequence in the title as an output in Java, but I'm stuck! I'm experimenting with the for function, any help is welcomed ;)
``` System.out.println("1 0 1 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0"); ``` But seriously, folks, this is an untested first pass: ``` for(int i=1; i<100; i++){ System.out.print("1 "); for(int j=0; j<i; j++){ System.out.print("0 "); } } ``` If you looking for basic info on how to get started, Google ...
489,933
<p>I am faced with the need to pull out the information in a string of the format "blah.bleh.bloh" in ANSI C. Normally I would use strok() to accomplish this, but since I am getting this string via strtok, and strtok is not thread-safe, I cannot use this option.</p> <p>I have written a function to manually parse the ...
[ { "answer_id": 489954, "author": "Lawrence Dol", "author_id": 8946, "author_profile": "https://Stackoverflow.com/users/8946", "pm_score": 0, "selected": false, "text": "<p>The variable \"theString\" must be a pointer and not an array type.</p>\n" }, { "answer_id": 489956, "au...
2009/01/28
[ "https://Stackoverflow.com/questions/489933", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35767/" ]
I am faced with the need to pull out the information in a string of the format "blah.bleh.bloh" in ANSI C. Normally I would use strok() to accomplish this, but since I am getting this string via strtok, and strtok is not thread-safe, I cannot use this option. I have written a function to manually parse the string. Her...
Under the assumption that you defined theString as an array, try defining it as a pointer. When you declare a char variable as an array, you cannot later change its address. I am assuming you have a declaration similar to ``` char theString[100]; ``` The easiest solution is to leave that declaration alone, and add ...
489,937
<p>Coming from a C background I'm used to defining the size of the buffer in the following way:</p> <pre><code>#define BUFFER_SIZE 1024 uint8_t buffer[BUFFER_SIZE]; </code></pre> <p>How would you do the accomplish the same thing in C#?</p> <p>Also does the all-caps K&amp;R style fit in with normal C# Pascal/Camel c...
[ { "answer_id": 489945, "author": "ctacke", "author_id": 13154, "author_profile": "https://Stackoverflow.com/users/13154", "pm_score": 2, "selected": false, "text": "<pre><code>public static readonly int BUFFER_SIZE = 1024;\n</code></pre>\n\n<p>I prefer this over a const due to the <a hre...
2009/01/28
[ "https://Stackoverflow.com/questions/489937", "https://Stackoverflow.com", "https://Stackoverflow.com/users/609/" ]
Coming from a C background I'm used to defining the size of the buffer in the following way: ``` #define BUFFER_SIZE 1024 uint8_t buffer[BUFFER_SIZE]; ``` How would you do the accomplish the same thing in C#? Also does the all-caps K&R style fit in with normal C# Pascal/Camel case?
``` const int BUFFER_SIZE = 1024; ``` Do not use "static readonly" because it creates a variable. "const" are replaced at build time and do not create variables.
489,966
<p>I am building an iframe that will go into my clients' web pages. I need to figure out if the user's browser supports javascript and serve back the either the javascript or non-javascript version of the page accordingly. </p> <p>What's the best way to determine javascript support in this case? I thought about usi...
[ { "answer_id": 489973, "author": "Hexagon Theory", "author_id": 59107, "author_profile": "https://Stackoverflow.com/users/59107", "pm_score": 4, "selected": true, "text": "<p>Why wouldn't you opt for the &lt;<code>noscript</code>> tag?</p>\n\n<pre><code>&lt;script&gt;\ndocument.write('&l...
2009/01/28
[ "https://Stackoverflow.com/questions/489966", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38339/" ]
I am building an iframe that will go into my clients' web pages. I need to figure out if the user's browser supports javascript and serve back the either the javascript or non-javascript version of the page accordingly. What's the best way to determine javascript support in this case? I thought about using javascript...
Why wouldn't you opt for the <`noscript`> tag? ``` <script> document.write('<iframe src="javascript_enabled_page.html"></iframe>'); </script> <noscript> <iframe src="javascript_disabled_page.html"></iframe>; </noscript> ```
489,974
<p>I am having problems with my image spacing when I switched to XHTML Strict DOCTYPE.</p> <p>The following code - which uses Yahoo's reset stylesheet to kill off all default browser padding - leaves a gap of about 4 pixels between the two images below but ONLY when I use the strict doctype. Why is this?</p> <p>It is...
[ { "answer_id": 490002, "author": "Allain Lalonde", "author_id": 2443, "author_profile": "https://Stackoverflow.com/users/2443", "pm_score": 0, "selected": false, "text": "<p>Trying to rule out common errors, I made the code pass validation by fixing no less than 8 validation errors. </p...
2009/01/29
[ "https://Stackoverflow.com/questions/489974", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16940/" ]
I am having problems with my image spacing when I switched to XHTML Strict DOCTYPE. The following code - which uses Yahoo's reset stylesheet to kill off all default browser padding - leaves a gap of about 4 pixels between the two images below but ONLY when I use the strict doctype. Why is this? It is only a problem i...
Using Peter's answer as a start the following fixes the problem: ``` img { vertical-align: bottom } ``` The reason this works is that the default for `vertical-align` is `baseline`, which equates to the part of the text "above the line" where the dangly bits hang down (lower case g, q, etc all hang below this baseli...
489,979
<p>What is the syntax for reading until the end of file in SSIS VBScript?</p> <pre><code>Dim readFile As FileInfo = New FileInfo(logHourlyName) If readFile.Exists() Then Dim textStream As StreamReader = readFile.OpenText() Dim strLine As String Do While Not EOF &lt;--- what goes here? curLine = text...
[ { "answer_id": 490002, "author": "Allain Lalonde", "author_id": 2443, "author_profile": "https://Stackoverflow.com/users/2443", "pm_score": 0, "selected": false, "text": "<p>Trying to rule out common errors, I made the code pass validation by fixing no less than 8 validation errors. </p...
2009/01/29
[ "https://Stackoverflow.com/questions/489979", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22523/" ]
What is the syntax for reading until the end of file in SSIS VBScript? ``` Dim readFile As FileInfo = New FileInfo(logHourlyName) If readFile.Exists() Then Dim textStream As StreamReader = readFile.OpenText() Dim strLine As String Do While Not EOF <--- what goes here? curLine = textStream.ReadLine()...
Using Peter's answer as a start the following fixes the problem: ``` img { vertical-align: bottom } ``` The reason this works is that the default for `vertical-align` is `baseline`, which equates to the part of the text "above the line" where the dangly bits hang down (lower case g, q, etc all hang below this baseli...
489,994
<p>In ruby I want to do roughly the following and have it print out "changed":</p> <pre><code>class Whatever def change_foo @foo="changed" end end @foo = "original" o = Whatever.new o.change_foo puts "it changed" if @foo == "changed" puts "it did not change" if @foo == "original" </code></pre> <p>The problem...
[ { "answer_id": 490009, "author": "Sophie Alpert", "author_id": 49485, "author_profile": "https://Stackoverflow.com/users/49485", "pm_score": 1, "selected": false, "text": "<p>I know this is the answer you don't want, but from your description, you should really should be using a class va...
2009/01/29
[ "https://Stackoverflow.com/questions/489994", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7432/" ]
In ruby I want to do roughly the following and have it print out "changed": ``` class Whatever def change_foo @foo="changed" end end @foo = "original" o = Whatever.new o.change_foo puts "it changed" if @foo == "changed" puts "it did not change" if @foo == "original" ``` The problem is, of course, that insid...
Late to the party, but you can pass the current context to the method, and then eval the operations on the instance variable in that specific context: ``` class Whatever def changeFoo(context) eval %q( @foo="changed" ), context end end @foo = "original" o = Whatever.new() o.changeFoo(binding) puts "it changed"...
489,997
<p>I've got a flash mp3 player on one of my web pages, streaming external audio. Check this site out as an example (no affiliation, just an example):</p> <p><a href="http://www.1pixelout.net/code/audio-player-wordpress-plugin/" rel="nofollow noreferrer">http://www.1pixelout.net/code/audio-player-wordpress-plugin/</a><...
[ { "answer_id": 490009, "author": "Sophie Alpert", "author_id": 49485, "author_profile": "https://Stackoverflow.com/users/49485", "pm_score": 1, "selected": false, "text": "<p>I know this is the answer you don't want, but from your description, you should really should be using a class va...
2009/01/29
[ "https://Stackoverflow.com/questions/489997", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38241/" ]
I've got a flash mp3 player on one of my web pages, streaming external audio. Check this site out as an example (no affiliation, just an example): <http://www.1pixelout.net/code/audio-player-wordpress-plugin/> When it's a decent sized mp3, once I start playing the file, it takes a little time to buffer. While it's bu...
Late to the party, but you can pass the current context to the method, and then eval the operations on the instance variable in that specific context: ``` class Whatever def changeFoo(context) eval %q( @foo="changed" ), context end end @foo = "original" o = Whatever.new() o.changeFoo(binding) puts "it changed"...
489,999
<p>I have a list of integers that I would like to convert to one number like:</p> <pre><code>numList = [1, 2, 3] num = magic(numList) print num, type(num) &gt;&gt;&gt; 123, &lt;type 'int'&gt; </code></pre> <p>What is the best way to implement the <em>magic</em> function?</p> <p><strong>EDIT</strong> <br> I did find...
[ { "answer_id": 490020, "author": "Kenan Banks", "author_id": 43089, "author_profile": "https://Stackoverflow.com/users/43089", "pm_score": 8, "selected": true, "text": "<pre><code># Over-explaining a bit:\ndef magic(numList): # [1,2,3]\n s = map(str, numList) # ['1','2','3']...
2009/01/29
[ "https://Stackoverflow.com/questions/489999", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41718/" ]
I have a list of integers that I would like to convert to one number like: ``` numList = [1, 2, 3] num = magic(numList) print num, type(num) >>> 123, <type 'int'> ``` What is the best way to implement the *magic* function? **EDIT** I did find [this](http://bytes.com/groups/python/722951-int-str-list-elements),...
``` # Over-explaining a bit: def magic(numList): # [1,2,3] s = map(str, numList) # ['1','2','3'] s = ''.join(s) # '123' s = int(s) # 123 return s # How I'd probably write it: def magic(numList): s = ''.join(map(str, numList)) return int(s) # As a one-liner num...
490,004
<p>In <a href="http://encosia.com/2008/06/26/use-jquery-and-aspnet-ajax-to-build-a-client-side-repeater/" rel="nofollow noreferrer">this article</a>, Dave Ward describes how to use the jQuery plugin <a href="http://plugins.jquery.com/project/jTemplates" rel="nofollow noreferrer">jTemplate</a> to create what he calls a ...
[ { "answer_id": 491250, "author": "Lewis", "author_id": 60147, "author_profile": "https://Stackoverflow.com/users/60147", "pm_score": 0, "selected": false, "text": "<p>I think, you could just ignore the route, and link to your template file like you've suggested:</p>\n\n<p>Check out this ...
2009/01/29
[ "https://Stackoverflow.com/questions/490004", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38055/" ]
In [this article](http://encosia.com/2008/06/26/use-jquery-and-aspnet-ajax-to-build-a-client-side-repeater/), Dave Ward describes how to use the jQuery plugin [jTemplate](http://plugins.jquery.com/project/jTemplates) to create what he calls a "client side repeater", that parses JSON data into a template on the client s...
I'd suggest using .htm instead. That comes through okay in a default MVC app. It turns out that using .tpl is a bad idea anyway, due to some versions of IIS blocking it as an unknown file type unless you explicitly add it. I need to update my post.
490,005
<p>I have a list of files (stored as c style strings) that I will be performing a search on and I will remove those files that do not match my parameters. What is the best container to use for this purpose? I'm thinking Set as of now. Note the list of files will never be larger than when it is initialized. I'll only be...
[ { "answer_id": 490018, "author": "Daniel A. White", "author_id": 23528, "author_profile": "https://Stackoverflow.com/users/23528", "pm_score": 0, "selected": false, "text": "<p>I will start by tossing out vector since it is a sequential container. Set, I believe is close to being sequent...
2009/01/29
[ "https://Stackoverflow.com/questions/490005", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13069/" ]
I have a list of files (stored as c style strings) that I will be performing a search on and I will remove those files that do not match my parameters. What is the best container to use for this purpose? I'm thinking Set as of now. Note the list of files will never be larger than when it is initialized. I'll only be de...
I would definitely not use a set - you don't need to sort it so no point in using a set. Set is implemented as a self-balancing tree usually, and the self-balancing algorithm is unnecessary in your case. If you're going to be doing this operation once, I would use a std::vector with remove\_if (from <algorithm>), foll...
490,015
<p>I have following problems with layout settings in the FieldEditorPreferencePage.<br> My code is something like this: </p> <pre><code>public void createFieldEditors () { Group pv = new group(getfieldEditorParent(), SWT.SHADOW_OUT); Group of = new group(getfieldEditorParent(), SWT.SHADOW_OUT); pv.setText(“pv”);...
[ { "answer_id": 701208, "author": "Martin Lazar", "author_id": 82569, "author_profile": "https://Stackoverflow.com/users/82569", "pm_score": 3, "selected": false, "text": "<p>The problem is that when you are using <code>FieldEditorPreferencePage</code>, you can use only <code>FieldEditor<...
2009/01/29
[ "https://Stackoverflow.com/questions/490015", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have following problems with layout settings in the FieldEditorPreferencePage. My code is something like this: ``` public void createFieldEditors () { Group pv = new group(getfieldEditorParent(), SWT.SHADOW_OUT); Group of = new group(getfieldEditorParent(), SWT.SHADOW_OUT); pv.setText(“pv”); of.setText(“...
The problem is that when you are using `FieldEditorPreferencePage`, you can use only `FieldEditor` subclasses as components. Here's a snippet from a documentation: > > FieldEditorPreferencePage implements a > page that uses these field editors to > display and store the preference > values on the page. Instead of ...
490,040
<p>I'm mapping a ProductCategory tree using Fluent NHibernate and everything was going fine until I tried to walk the tree that is returned from the database to ensure it's saving and retreiving appropriately.</p> <p>Here's how I'm testing:</p> <ol> <li>Instantiate 4 categories: Beverages, Beer, Light Beer, and Dark ...
[ { "answer_id": 490283, "author": "Sean Carpenter", "author_id": 729, "author_profile": "https://Stackoverflow.com/users/729", "pm_score": 0, "selected": false, "text": "<p>From a testing perspective, you are better off closing the initial session that was used to create the objects and c...
2009/01/29
[ "https://Stackoverflow.com/questions/490040", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16947/" ]
I'm mapping a ProductCategory tree using Fluent NHibernate and everything was going fine until I tried to walk the tree that is returned from the database to ensure it's saving and retreiving appropriately. Here's how I'm testing: 1. Instantiate 4 categories: Beverages, Beer, Light Beer, and Dark Beer 2. Add Beer to ...
Just figured it out, turns out it was a copy&paste bug. Heh, PEBKAC. I added 4 assertions that verify that the objects are not in the session: ``` Assert.That(Session.Contains(_beveragesCategory), Is.False); Assert.That(Session.Contains(_beerCategory), Is.False); Assert.That(Session.Contains(_darkBeerCategory), Is.F...
490,053
<p>You have one table against which you wish to count the number of items in two different tables. In this example I used buildings, men and women</p> <pre><code>DROP TABLE IF EXISTS building; DROP TABLE IF EXISTS men; DROP TABLE IF EXISTS women; CREATE TABLE building(name VARCHAR(255)); CREATE TABLE men(building VARC...
[ { "answer_id": 490171, "author": "Ray Hidayat", "author_id": 49643, "author_profile": "https://Stackoverflow.com/users/49643", "pm_score": 2, "selected": true, "text": "<p><a href=\"http://en.wikipedia.org/wiki/Speech_Application_Programming_Interface#SAPI_5_API_family\" rel=\"nofollow n...
2009/01/29
[ "https://Stackoverflow.com/questions/490053", "https://Stackoverflow.com", "https://Stackoverflow.com/users/53722/" ]
You have one table against which you wish to count the number of items in two different tables. In this example I used buildings, men and women ``` DROP TABLE IF EXISTS building; DROP TABLE IF EXISTS men; DROP TABLE IF EXISTS women; CREATE TABLE building(name VARCHAR(255)); CREATE TABLE men(building VARCHAR(255), name...
[Wikipedia tells me](http://en.wikipedia.org/wiki/Speech_Application_Programming_Interface#SAPI_5_API_family) that SAPI 5.3 was included in the Windows SDK, so go download that. SAPI 5.3 looks like it was included as part of Windows Vista, so I don't think you can use it in any other version of windows. The library is ...
490,054
<p>I have created two identical tables which list all the exceptions with regards to certain rules of products in the data base. table one is for week 1 table two is for week two the exception are just view on a weekly basis and no correction is made in the data base. week twos data includes the exceptions in week one ...
[ { "answer_id": 490057, "author": "Leonidas", "author_id": 57510, "author_profile": "https://Stackoverflow.com/users/57510", "pm_score": 1, "selected": false, "text": "<p>I suggest you add a timestamp to the tables and select/filter on this timestamp.</p>\n\n<p>This way you also can put <...
2009/01/29
[ "https://Stackoverflow.com/questions/490054", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have created two identical tables which list all the exceptions with regards to certain rules of products in the data base. table one is for week 1 table two is for week two the exception are just view on a weekly basis and no correction is made in the data base. week twos data includes the exceptions in week one i w...
I suggest you add a timestamp to the tables and select/filter on this timestamp. This way you also can put *all* exceptions into one table and just define two views. I'm no good with PL/SQL, but maybe you can adapt my MySQL-sample: ``` CREATE DATABASE timetest; CONNECT timetest; CREATE TABLE errorlog ( stamp TIME...
490,059
<p>I have an XMLA query which returns the State and Last Processed date of an Analysis Services cube as XML, like so:</p> <p>Query:</p> <pre><code>&lt;Discover xmlns="urn:schemas-microsoft-com:xml-analysis"&gt; &lt;RequestType&gt;DISCOVER_XML_METADATA&lt;/RequestType&gt; &lt;Restrictions &gt; &lt;RestrictionL...
[ { "answer_id": 493271, "author": "Mitch Schroeter", "author_id": 38799, "author_profile": "https://Stackoverflow.com/users/38799", "pm_score": 3, "selected": true, "text": "<p>While you can run \"regular\" MDX/XMLA through various mechanisms in SSIS, including via the Execute SQL task, i...
2009/01/29
[ "https://Stackoverflow.com/questions/490059", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46239/" ]
I have an XMLA query which returns the State and Last Processed date of an Analysis Services cube as XML, like so: Query: ``` <Discover xmlns="urn:schemas-microsoft-com:xml-analysis"> <RequestType>DISCOVER_XML_METADATA</RequestType> <Restrictions > <RestrictionList xmlns="urn:schemas-microsoft-com:xml-analysi...
While you can run "regular" MDX/XMLA through various mechanisms in SSIS, including via the Execute SQL task, it will always wrap it inside . is a top-level method just like and cannot be wrapped inside , hence the problem. You've got two possible solutions: 1. Wrap your XMLA inside an Execute SQL task using an OPENQU...
490,061
<p>I currently have the code below, to replace a characters in a string but I now need to replace characters within the first X (in this case 3) characters and leave the rest of the string. In my example below I have 51115 but I need to replace any 5 within the first 3 characters and I should end up with 61115.</p> <p...
[ { "answer_id": 490077, "author": "jcelgin", "author_id": 26582, "author_profile": "https://Stackoverflow.com/users/26582", "pm_score": 3, "selected": true, "text": "<p>Not particularly fancy, but only give regex the data it should be replacing; only send in the range of characters that s...
2009/01/29
[ "https://Stackoverflow.com/questions/490061", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I currently have the code below, to replace a characters in a string but I now need to replace characters within the first X (in this case 3) characters and leave the rest of the string. In my example below I have 51115 but I need to replace any 5 within the first 3 characters and I should end up with 61115. My curren...
Not particularly fancy, but only give regex the data it should be replacing; only send in the range of characters that should potentially be replaced. ``` result = Regex.Replace(value.ToString().Substring(0, x), oldString, newString, RegexOptions.IgnoreCase); ```
490,074
<p>how do i go about reading data being sent almost constantly to my server. the protocol is udp. if i try to read in a while(1) loop, i dont get anything. it seems like the read will only echo once all the reading is done. so it waits till the loop is done reading which it will never be. i want the socket_read to echo...
[ { "answer_id": 490072, "author": "Sophie Alpert", "author_id": 49485, "author_profile": "https://Stackoverflow.com/users/49485", "pm_score": 0, "selected": false, "text": "<p>I'm pretty sure that because GWT code compiles to pure JavaScript, there isn't a way without requiring some third...
2009/01/29
[ "https://Stackoverflow.com/questions/490074", "https://Stackoverflow.com", "https://Stackoverflow.com/users/60020/" ]
how do i go about reading data being sent almost constantly to my server. the protocol is udp. if i try to read in a while(1) loop, i dont get anything. it seems like the read will only echo once all the reading is done. so it waits till the loop is done reading which it will never be. i want the socket\_read to echo i...
No it is not possible. The manipulation of the file is done by the browser, not the HTML code. Think about it, GWT is 100% javascript. And javascript has no access whatsoever of the file in your computer. That would be an pretty big security risk! GWT "wraps" the file input box so it can be displayed inside the GWT pa...
490,078
<p>I'm hopelessly trying to write a method to manipulate an array in ruby. I'm trying to generate all in-order permutations of an array where each item is in turn replaced by an outside item. An example...</p> <p>Given input:</p> <pre><code>arr = ["a", "b", "c"] </code></pre> <p>Desired output:</p> <pre><code>new...
[ { "answer_id": 490205, "author": "oylenshpeegul", "author_id": 10627, "author_profile": "https://Stackoverflow.com/users/10627", "pm_score": 2, "selected": false, "text": "<p>I'm not sure permutation is the right word. If you count in binary, then you are replacing the things if there is...
2009/01/29
[ "https://Stackoverflow.com/questions/490078", "https://Stackoverflow.com", "https://Stackoverflow.com/users/60021/" ]
I'm hopelessly trying to write a method to manipulate an array in ruby. I'm trying to generate all in-order permutations of an array where each item is in turn replaced by an outside item. An example... Given input: ``` arr = ["a", "b", "c"] ``` Desired output: ``` newArr = [ ["a", "b", "c"], ["a", "b", "*"], ["a"...
I don't understand your example order, either, but ignoring that, here's a solution in one line: ``` (0...(2**a.size)).map {|x| (0...a.size).map {|y| x & 2**y == 0 ? a[y] : val}} ```
490,091
<p>Can someone explained, as detailed as possible, the differences between the following types?</p> <pre><code>List List&lt;Object&gt; List&lt;?&gt; </code></pre> <p>Let me make this more specific. When would I want to use</p> <pre><code>// 1 public void CanYouGiveMeAnAnswer(List l) { } // 2 public void CanYouGive...
[ { "answer_id": 490103, "author": "Rob", "author_id": 3542, "author_profile": "https://Stackoverflow.com/users/3542", "pm_score": 4, "selected": false, "text": "<p>I refer you to the excellent <a href=\"http://java.sun.com/docs/books/tutorial/java/generics/index.html\" rel=\"noreferrer\">...
2009/01/29
[ "https://Stackoverflow.com/questions/490091", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48728/" ]
Can someone explained, as detailed as possible, the differences between the following types? ``` List List<Object> List<?> ``` Let me make this more specific. When would I want to use ``` // 1 public void CanYouGiveMeAnAnswer(List l) { } // 2 public void CanYouGiveMeAnAnswer(List<Object> l) { } // 3 public void ...
As the other posts have noted, you are asking about a Java feature called generics. In C++, this is called templates. This feature in Java is usually easier to work with than the that found in C++. Let me answer your questions functionally (if that's not a naughty word for OO discussions). Before generics, there were...
490,124
<p>I have an enterprise application written in JAVA with JSF (using RichFaces 3.3). Currently my URL looks like this:</p> <p><strong><a href="http://localhost/WebApplication/faces/folder1/page.jsp" rel="nofollow noreferrer">http://localhost/WebApplication/faces/folder1/page.jsp</a></strong></p> <p>Question is how do ...
[ { "answer_id": 490755, "author": "Peter Hilton", "author_id": 2670, "author_profile": "https://Stackoverflow.com/users/2670", "pm_score": 2, "selected": true, "text": "<p>For rewriting URLs within your application you can use <a href=\"http://tuckey.org/urlrewrite/\" rel=\"nofollow noref...
2009/01/29
[ "https://Stackoverflow.com/questions/490124", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51230/" ]
I have an enterprise application written in JAVA with JSF (using RichFaces 3.3). Currently my URL looks like this: **<http://localhost/WebApplication/faces/folder1/page.jsp>** Question is how do I mask my url to make it like this: **<http://localhost/folder1/page.jps>** Basically i want to hide "Application/faces/"...
For rewriting URLs within your application you can use [UrlRewrite](http://tuckey.org/urlrewrite/). However, in this case it looks like you want to remove your web application's context path, in which case you have two options: 1. deploy your application to the context path `/` (how is application server-specific) 2. ...
490,134
<p>I am creating a set of widgets in Java that decodes and displays messages received at a serial interface.</p> <p>The message type is defined by a unique identifier. Each widget is only interested in a particular identifier. </p> <p>How to I program the application in a way to distribute the messages correctly to t...
[ { "answer_id": 490142, "author": "duffymo", "author_id": 37213, "author_profile": "https://Stackoverflow.com/users/37213", "pm_score": 1, "selected": false, "text": "<p>sounds like a jms topic/subscription. why reinvent the wheel?</p>\n" }, { "answer_id": 490174, "author": "...
2009/01/29
[ "https://Stackoverflow.com/questions/490134", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I am creating a set of widgets in Java that decodes and displays messages received at a serial interface. The message type is defined by a unique identifier. Each widget is only interested in a particular identifier. How to I program the application in a way to distribute the messages correctly to the relevant widge...
If this is for a single app (i.e. a main and couple of threads), JMS is overkill. The basics of this is a simple queue (of which Java has several good ones, BlockingQueue waving its hand in the back over there). The serial port reads its data, formats a some relevant message object, and dumps it on a central Message ...
490,141
<p>Say I have the following:</p> <pre class="lang-css prettyprint-override"><code>tr { background: #fff; } tr.even { background: #eee } tr.highlight { background: #fec; } </code></pre> <p>Is it possible to specify a 4th background (<code>#fea</code>) instead of having <code>highlight</code> simply overw...
[ { "answer_id": 490149, "author": "dylanfm", "author_id": 38795, "author_profile": "https://Stackoverflow.com/users/38795", "pm_score": 5, "selected": true, "text": "<p>You can do this:</p>\n\n<pre><code>tr.even.highlight { ... }\n</code></pre>\n\n<p>Not known by IE6 though.</p>\n" }, ...
2009/01/29
[ "https://Stackoverflow.com/questions/490141", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15031/" ]
Say I have the following: ```css tr { background: #fff; } tr.even { background: #eee } tr.highlight { background: #fec; } ``` Is it possible to specify a 4th background (`#fea`) instead of having `highlight` simply overwrite `even`? ``` <tr class="even highlight"> <!-- ... --> </tr> ``` --- Once ...
You can do this: ``` tr.even.highlight { ... } ``` Not known by IE6 though.
490,147
<p>I have two <a href="http://www.conexant.com/products/entry.jsp?id=6" rel="nofollow noreferrer">Conexant fax modems</a>, and a C# app with two serialPort objects setup to listen for incoming data on both comm ports.</p> <p>Here is how I initialize each modem:</p> <pre><code>m_SerialPort = new SerialPort("COM3", 240...
[ { "answer_id": 490247, "author": "rbrayb", "author_id": 9922, "author_profile": "https://Stackoverflow.com/users/9922", "pm_score": 1, "selected": false, "text": "<p>Have you checked under \"Device Manager\" that both ports are configured, enabled and working?</p>\n\n<p>Have you tried so...
2009/01/29
[ "https://Stackoverflow.com/questions/490147", "https://Stackoverflow.com", "https://Stackoverflow.com/users/609/" ]
I have two [Conexant fax modems](http://www.conexant.com/products/entry.jsp?id=6), and a C# app with two serialPort objects setup to listen for incoming data on both comm ports. Here is how I initialize each modem: ``` m_SerialPort = new SerialPort("COM3", 2400); m_SerialPort.DataReceived += new SerialDataReceivedEve...
Have you checked under "Device Manager" that both ports are configured, enabled and working? Have you tried something like SysInternals PortMon to monitor the ports? Have you tried something like Hyperterm to try and send data to the ports?
490,148
<p>I'd like to test some code with OCMock. </p> <p>The innards of the code are calling <code>[NSObject isKindOfClass]</code> on the mock object I'm providing to the code, like so:</p> <pre><code>if ([object isKindOfClass:[FancyClass class]]) { ...} </code></pre> <p>However, when I provide an OCMockObject-based mock ...
[ { "answer_id": 490282, "author": "Peter Hosey", "author_id": 30461, "author_profile": "https://Stackoverflow.com/users/30461", "pm_score": 3, "selected": false, "text": "<p>The general rule is that if you're calling <code>isKindOfClass:</code> and you're not passing one of the plist clas...
2009/01/29
[ "https://Stackoverflow.com/questions/490148", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'd like to test some code with OCMock. The innards of the code are calling `[NSObject isKindOfClass]` on the mock object I'm providing to the code, like so: ``` if ([object isKindOfClass:[FancyClass class]]) { ...} ``` However, when I provide an OCMockObject-based mock created like this: ``` mock = [OCMockObject...
The general rule is that if you're calling `isKindOfClass:` and you're not passing one of the plist classes (e.g., NSString or NSNumber), You're Doing It Wrong. If the method does two or more different things depending on which class its argument is, rend it into multiple methods, and test each method separately. If ...
490,177
<p>My use case is this, I want to call out to a webservice and if I am behind a proxy server that requires authentication I want to just use the default credentials...</p> <pre><code> WebRequest.DefaultWebProxy.Credentials = CredentialCache.DefaultCredentials; </code></pre> <p>Otherwise I'll just simply make the cal...
[ { "answer_id": 490491, "author": "Sean Bright", "author_id": 21926, "author_profile": "https://Stackoverflow.com/users/21926", "pm_score": 3, "selected": true, "text": "<p><code>System.Net.WebProxy</code> has a property called <code>UseDefaultCredentials</code> that <em>may</em> be what ...
2009/01/29
[ "https://Stackoverflow.com/questions/490177", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10387/" ]
My use case is this, I want to call out to a webservice and if I am behind a proxy server that requires authentication I want to just use the default credentials... ``` WebRequest.DefaultWebProxy.Credentials = CredentialCache.DefaultCredentials; ``` Otherwise I'll just simply make the call, It would be very nice t...
`System.Net.WebProxy` has a property called `UseDefaultCredentials` that *may* be what you want (but I have to admit a bit of ignorance here). The link to the relevant documentation is [here](http://msdn.microsoft.com/en-us/library/system.net.webproxy_properties.aspx).
490,184
<p>I'm pretty accustomed to clearing my floats by using <code>&lt;br style="clear:both"/&gt;</code> but stuff keeps on changing and I am not sure if this is the best practice. </p> <p>There is a <a href="http://www.positioniseverything.net/easyclearing.html" rel="noreferrer">CSS hack</a> (from positioneverything) avai...
[ { "answer_id": 490201, "author": "Mike", "author_id": 60021, "author_profile": "https://Stackoverflow.com/users/60021", "pm_score": 5, "selected": false, "text": "<p>I've found that most often (myself included), this method is used in the html:</p>\n\n<pre><code>&lt;div class=\"clear\"&g...
2009/01/29
[ "https://Stackoverflow.com/questions/490184", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17174/" ]
I'm pretty accustomed to clearing my floats by using `<br style="clear:both"/>` but stuff keeps on changing and I am not sure if this is the best practice. There is a [CSS hack](http://www.positioniseverything.net/easyclearing.html) (from positioneverything) available that lets you achieve the same result without the...
**Update**: In 2014, you should use a clearfix technique that utilized pseudo-elements, like the one mentioned by @RodrigoManguinho. This is the modern way of clearing floats. For an even more up to date method, see Nicholas Gallagher's micro clearfix: ``` /** * For modern browsers * 1. The space content is one way ...
490,195
<p>I would like to take a multi-page pdf file and create separate pdf files per page.</p> <p>I have downloaded <a href="http://www.reportlab.org/index.html" rel="noreferrer">reportlab</a> and have browsed the documentation, but it seems aimed at pdf generation. I haven't yet seen anything about processing PDF files th...
[ { "answer_id": 490203, "author": "user26294", "author_id": 26294, "author_profile": "https://Stackoverflow.com/users/26294", "pm_score": 9, "selected": true, "text": "<pre><code>from PyPDF2 import PdfFileWriter, PdfFileReader\n\ninputpdf = PdfFileReader(open(\"document.pdf\", \"rb\"))\n\...
2009/01/29
[ "https://Stackoverflow.com/questions/490195", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24718/" ]
I would like to take a multi-page pdf file and create separate pdf files per page. I have downloaded [reportlab](http://www.reportlab.org/index.html) and have browsed the documentation, but it seems aimed at pdf generation. I haven't yet seen anything about processing PDF files themselves. Is there an easy way to do ...
``` from PyPDF2 import PdfFileWriter, PdfFileReader inputpdf = PdfFileReader(open("document.pdf", "rb")) for i in range(inputpdf.numPages): output = PdfFileWriter() output.addPage(inputpdf.getPage(i)) with open("document-page%s.pdf" % i, "wb") as outputStream: output.write(outputStream) ``` etc.
490,196
<p>I'm currently developing a tutorial site for teaching the fundamentals of Web development (HTML, CSS, and JavaScript, for starters). I'd like a setup where I could give in-depth coverage of all sorts of topics and then provide a basic sandbox environment where the user could write code which solves the question aske...
[ { "answer_id": 490203, "author": "user26294", "author_id": 26294, "author_profile": "https://Stackoverflow.com/users/26294", "pm_score": 9, "selected": true, "text": "<pre><code>from PyPDF2 import PdfFileWriter, PdfFileReader\n\ninputpdf = PdfFileReader(open(\"document.pdf\", \"rb\"))\n\...
2009/01/29
[ "https://Stackoverflow.com/questions/490196", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59107/" ]
I'm currently developing a tutorial site for teaching the fundamentals of Web development (HTML, CSS, and JavaScript, for starters). I'd like a setup where I could give in-depth coverage of all sorts of topics and then provide a basic sandbox environment where the user could write code which solves the question asked a...
``` from PyPDF2 import PdfFileWriter, PdfFileReader inputpdf = PdfFileReader(open("document.pdf", "rb")) for i in range(inputpdf.numPages): output = PdfFileWriter() output.addPage(inputpdf.getPage(i)) with open("document-page%s.pdf" % i, "wb") as outputStream: output.write(outputStream) ``` etc.
490,235
<p><code>getaddrinfo()</code> does not translate a hostname into an IP address and consequently does not <code>connect()</code> to the server. Is something wrong with my implementation - compiles with no warning messages?</p> <p>Is this function call to <code>connect</code> correct?</p> <pre><code>connect(client, res...
[ { "answer_id": 490272, "author": "arul", "author_id": 15409, "author_profile": "https://Stackoverflow.com/users/15409", "pm_score": 1, "selected": false, "text": "<p>Try setting the <code>hint.ai_family</code> to <code>AF_UNSPEC</code> instead of <code>AF_INET</code>, I believe that when...
2009/01/29
[ "https://Stackoverflow.com/questions/490235", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51078/" ]
`getaddrinfo()` does not translate a hostname into an IP address and consequently does not `connect()` to the server. Is something wrong with my implementation - compiles with no warning messages? Is this function call to `connect` correct? ``` connect(client, result->ai_addr, result->ai_addrlen) ``` Full implement...
`getaddrinfo` may be giving you an IPv6 address, or perhaps the machine has more than one IP address and you're trying to connect to the wrong one. Also, if your server is listening on 127.0.0.1 and you try to connect to the real IP address, the connection will fail. Similarly, if the server is listening on the real I...
490,241
<p>In Flex 3, </p> <pre><code>var anInstance : MyClass = new MyClass(); with (anInstance) { property1 = "fred"; property2 = 5; propert3 = 7; } </code></pre> <p>does NOT flag "propert" as a non-existent property name. I thought this was a remainder of the evil JavaScript object behavior (referring to a pro...
[ { "answer_id": 490330, "author": "dkretz", "author_id": 31641, "author_profile": "https://Stackoverflow.com/users/31641", "pm_score": 3, "selected": true, "text": "<p>From reading the <a href=\"http://livedocs.adobe.com/flex/3/langref/index.html\" rel=\"nofollow noreferrer\">documentatio...
2009/01/29
[ "https://Stackoverflow.com/questions/490241", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29420/" ]
In Flex 3, ``` var anInstance : MyClass = new MyClass(); with (anInstance) { property1 = "fred"; property2 = 5; propert3 = 7; } ``` does NOT flag "propert" as a non-existent property name. I thought this was a remainder of the evil JavaScript object behavior (referring to a property name of an object im...
From reading the [documentation](http://livedocs.adobe.com/flex/3/langref/index.html): Actionscript apparently bubbles out for scope resolution on embedded variables (not surprising, since the syntax doesn't require an explicit dereference symbol like "." or "->" to indicate which variable names should be "withed".) S...
490,242
<p>I have a problem in my C# ASP.NET application, where the id and name tags are modified at runtime with a prefix "MainView_" and "MainView$" respectively. So my code:</p> <pre><code>&lt;asp:Button ID="OKToContinueCheckInButton" runat="server" CausesValidation="False" Visibility="false" Style="display: none" OnClick...
[ { "answer_id": 490249, "author": "Cyril Gupta", "author_id": 33052, "author_profile": "https://Stackoverflow.com/users/33052", "pm_score": 4, "selected": true, "text": "<p>I think this would help you...</p>\n\n<pre><code>&lt;script type=\"text/javascript\"&gt;\n&lt;!--\n var answer = ...
2009/01/29
[ "https://Stackoverflow.com/questions/490242", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9836/" ]
I have a problem in my C# ASP.NET application, where the id and name tags are modified at runtime with a prefix "MainView\_" and "MainView$" respectively. So my code: ``` <asp:Button ID="OKToContinueCheckInButton" runat="server" CausesValidation="False" Visibility="false" Style="display: none" OnClick="btnOKToContinue...
I think this would help you... ``` <script type="text/javascript"> <!-- var answer = confirm("Some Warning"); if (answer) document.getElementById('<%= OKToContinueCheckInButton.ClientID %>').click(); // --> </script> ``` This is the part that does the trick ``` <%= OKToContinueCheckInButton.ClientID...
490,276
<p>I need to find a way to monitor the status of a list of Windows services over HTTP, preferably without any third party program).</p> <p>All I really need to be able to do is display the service name and its status ('Started' / 'Stopped').</p> <p>I'm not an ASP programmer so this is a little outside my realm. I've...
[ { "answer_id": 490291, "author": "Oscar Cabrero", "author_id": 14440, "author_profile": "https://Stackoverflow.com/users/14440", "pm_score": 3, "selected": true, "text": "<pre><code>using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Web;\nusing System.Web....
2009/01/29
[ "https://Stackoverflow.com/questions/490276", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47472/" ]
I need to find a way to monitor the status of a list of Windows services over HTTP, preferably without any third party program). All I really need to be able to do is display the service name and its status ('Started' / 'Stopped'). I'm not an ASP programmer so this is a little outside my realm. I've searched and have...
``` using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.ServiceProcess; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { ServiceController[] se...
490,324
<p>How do I tell if gcc (more specifically, g++) is optimizing tail recursion <em>in a particular function</em>? (Because it's come up a few times: I don't want to test if gcc can optimize tail recursion in general. I want to know if it optimizes <strong>my</strong> tail recursive function.)</p> <p>If your answer is...
[ { "answer_id": 490334, "author": "PolyThinker", "author_id": 47707, "author_profile": "https://Stackoverflow.com/users/47707", "pm_score": 1, "selected": false, "text": "<p>A simple method: Build a simple tail recursion program, compile it, and dissemble it to see if it is optimized. </p...
2009/01/29
[ "https://Stackoverflow.com/questions/490324", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3508/" ]
How do I tell if gcc (more specifically, g++) is optimizing tail recursion *in a particular function*? (Because it's come up a few times: I don't want to test if gcc can optimize tail recursion in general. I want to know if it optimizes **my** tail recursive function.) If your answer is "look at the generated assemble...
Let's use [the example code from the other question](https://stackoverflow.com/questions/34125/which-if-any-c-compilers-do-tail-recursion-optimization#220660). Compile it, but tell gcc not to assemble: ``` gcc -std=c99 -S -O2 test.c ``` Now let's look at the `_atoi` function in the resultant *test.s* file (gcc 4.0....
490,352
<p>I would really like use the <a href="http://plugins.jquery.com/project/validate" rel="nofollow noreferrer">jQuery Validation plugin </a> in my ASP.NET Web Forms application (not MVC).</p> <p>I value jQuery validation for the Richer UI experience I can provide the end user and I have some requirements to highlight t...
[ { "answer_id": 490375, "author": "cbp", "author_id": 21966, "author_profile": "https://Stackoverflow.com/users/21966", "pm_score": 2, "selected": false, "text": "<p>If you are serious about validation, I would look into something like Peter Blum's validators (<a href=\"http://www.peterbl...
2009/01/29
[ "https://Stackoverflow.com/questions/490352", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48175/" ]
I would really like use the [jQuery Validation plugin](http://plugins.jquery.com/project/validate) in my ASP.NET Web Forms application (not MVC). I value jQuery validation for the Richer UI experience I can provide the end user and I have some requirements to highlight the invalid fields using a red border (css). I ...
This might help! <http://www.delphicsage.com/home/blog.aspx?d=205>
490,355
<p>I have mocks working where I test that methods on my mocked object are called with the correct parameters, and return the right result.</p> <p>Now I want to check another condition. In this case, NO methods should be run on the mocked object. How can I express this in a unit test? </p>
[ { "answer_id": 490362, "author": "Hamish Smith", "author_id": 15572, "author_profile": "https://Stackoverflow.com/users/15572", "pm_score": 2, "selected": false, "text": "<p>The two most straightforward way would be to use MockBehaviour.Strict: </p>\n\n<pre><code>var moqFoo = new Mock&lt...
2009/01/29
[ "https://Stackoverflow.com/questions/490355", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30183/" ]
I have mocks working where I test that methods on my mocked object are called with the correct parameters, and return the right result. Now I want to check another condition. In this case, NO methods should be run on the mocked object. How can I express this in a unit test?
You could create your mock as strict. That way only the methods you Setup (or Expect, depending on which version of Moq you're playing with) are allowed to be run. ``` var foo = new Mock<IFoo>(MockBehavior.Strict); foo.Expect(f => f.Bar()); ``` Any time a method is called on foo other than Bar(), an exception will b...
490,360
<p>I am using Spring MVC to build my web application, and I have a question about validating parameters I receive in the URL. <strong>What is the best way to detect invalid parameters and display errors to the user?</strong></p> <p>Suppose I have a "View User Profile" page. The profile that is displayed is based on a ...
[ { "answer_id": 490408, "author": "yawmark", "author_id": 45204, "author_profile": "https://Stackoverflow.com/users/45204", "pm_score": 4, "selected": true, "text": "<p>If the DAO returns null, simply return a ModelAndView for an error page. </p>\n\n<p>Example:</p>\n\n<pre><code>UserProfi...
2009/01/29
[ "https://Stackoverflow.com/questions/490360", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2405/" ]
I am using Spring MVC to build my web application, and I have a question about validating parameters I receive in the URL. **What is the best way to detect invalid parameters and display errors to the user?** Suppose I have a "View User Profile" page. The profile that is displayed is based on a user ID parameter speci...
If the DAO returns null, simply return a ModelAndView for an error page. Example: ``` UserProfile profile = userProfileDao.findUserProfileById(userId); if (profile == null) { return new ModelAndView("Error", "message", "Invalid user ID"); } else { // process accordingly. } ``` In the Spring 2.5 distributio...
490,365
<p>My language is PHP, but the algorithm should be fairly universal.</p> <p>I have an associative array of (let's say) ratings and number of times that rating has been given.</p> <pre><code>$ratings = array( 1 =&gt; 1, 2 =&gt; 3, 3 =&gt; 6, 4 =&gt; 3, 5 =&gt; 3 ); </code></pre> <p>This is the equ...
[ { "answer_id": 490370, "author": "Ray Hidayat", "author_id": 49643, "author_profile": "https://Stackoverflow.com/users/49643", "pm_score": 5, "selected": true, "text": "<p>Try this:</p>\n\n<pre><code>$total = 0;\n$count = 0;\nforeach($ratings as $number=&gt;$frequency) {\n $total += $nu...
2009/01/29
[ "https://Stackoverflow.com/questions/490365", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9021/" ]
My language is PHP, but the algorithm should be fairly universal. I have an associative array of (let's say) ratings and number of times that rating has been given. ``` $ratings = array( 1 => 1, 2 => 3, 3 => 6, 4 => 3, 5 => 3 ); ``` This is the equivalent of: `[1, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4...
Try this: ``` $total = 0; $count = 0; foreach($ratings as $number=>$frequency) { $total += $number * $frequency; $count += $frequency; } return $total / $count; ```
490,366
<p>I have a beta version of my app developed, and I'm looking to put it on a few friend's iPhones for testing purposes. I've gone through the Ad Hoc deployment steps at the Developer Portal, and I've also followed the instructions here: <a href="http://www.talentgrouplabs.com/blog/archive/2008/11/10/iphone-sdk-mobile-...
[ { "answer_id": 490606, "author": "Tom Harrington", "author_id": 43832, "author_profile": "https://Stackoverflow.com/users/43832", "pm_score": 5, "selected": true, "text": "<p>That's essentially an internal error in Xcode's ability to talk to your phone. It doesn't mean you've done anyth...
2009/01/29
[ "https://Stackoverflow.com/questions/490366", "https://Stackoverflow.com", "https://Stackoverflow.com/users/58153/" ]
I have a beta version of my app developed, and I'm looking to put it on a few friend's iPhones for testing purposes. I've gone through the Ad Hoc deployment steps at the Developer Portal, and I've also followed the instructions here: <http://www.talentgrouplabs.com/blog/archive/2008/11/10/iphone-sdk-mobile-provisioning...
That's essentially an internal error in Xcode's ability to talk to your phone. It doesn't mean you've done anything wrong, it's a bug in the development system. It'll go away after quitting and restarting Xcode, and possibly after restarting your Mac. I haven't seen the error in a while-- it's possible that other voodo...
490,390
<p>Coming from a background in Django, I often use "template inheritance", where multiple templates inherit from a common base. Is there an easy way to do this in JSP? If not, is there an alternative to JSP that does this (besides Django on Jython that is :)</p> <h2>base template</h2> <pre><code>&lt;html&gt; &lt;bo...
[ { "answer_id": 490394, "author": "geowa4", "author_id": 50214, "author_profile": "https://Stackoverflow.com/users/50214", "pm_score": 4, "selected": true, "text": "<p>You'll probably want to look into <a href=\"http://tiles.apache.org/index.html\" rel=\"noreferrer\">Tiles</a>.</p>\n\n<p>...
2009/01/29
[ "https://Stackoverflow.com/questions/490390", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8819/" ]
Coming from a background in Django, I often use "template inheritance", where multiple templates inherit from a common base. Is there an easy way to do this in JSP? If not, is there an alternative to JSP that does this (besides Django on Jython that is :) base template ------------- ``` <html> <body> {% block c...
You'll probably want to look into [Tiles](http://tiles.apache.org/index.html). EDIT: On a related note to tiles, you might want to look into [Struts](http://struts.apache.org/). It's not what you're looking for (that's tiles), but it is useful for someone coming from Django.
490,397
<p>I have a dictionary that I am using to define the ratings of copper cable. I want to use these values to calculate how many cables it will take to meet a certain connections rating. The size of the connection, the cable type, and system type are selected by two ComboBoxs named cb_amperage, cb_cable_size and, cb_syst...
[ { "answer_id": 490394, "author": "geowa4", "author_id": 50214, "author_profile": "https://Stackoverflow.com/users/50214", "pm_score": 4, "selected": true, "text": "<p>You'll probably want to look into <a href=\"http://tiles.apache.org/index.html\" rel=\"noreferrer\">Tiles</a>.</p>\n\n<p>...
2009/01/29
[ "https://Stackoverflow.com/questions/490397", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45151/" ]
I have a dictionary that I am using to define the ratings of copper cable. I want to use these values to calculate how many cables it will take to meet a certain connections rating. The size of the connection, the cable type, and system type are selected by two ComboBoxs named cb\_amperage, cb\_cable\_size and, cb\_sys...
You'll probably want to look into [Tiles](http://tiles.apache.org/index.html). EDIT: On a related note to tiles, you might want to look into [Struts](http://struts.apache.org/). It's not what you're looking for (that's tiles), but it is useful for someone coming from Django.
490,420
<p>If you had to choose your <strong>Favorite</strong> (clever) techniques for defensive coding, what would they be? Although my current languages are Java and Objective-C (with a background in C++), feel free to answer in any language. Emphasis here would be on <em>clever</em> defensive techniques other than those t...
[ { "answer_id": 490448, "author": "Matt Briggs", "author_id": 10771, "author_profile": "https://Stackoverflow.com/users/10771", "pm_score": 3, "selected": false, "text": "<p>In C#, use the <code>as</code> keyword to cast.</p>\n\n<pre><code>string a = (string)obj\n</code></pre>\n\n<p>will ...
2009/01/29
[ "https://Stackoverflow.com/questions/490420", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9931/" ]
If you had to choose your **Favorite** (clever) techniques for defensive coding, what would they be? Although my current languages are Java and Objective-C (with a background in C++), feel free to answer in any language. Emphasis here would be on *clever* defensive techniques other than those that 70%+ of us here alrea...
In c++, I once liked redefining new so that it provided some extra memory to catch fence-post errors. Currently, I prefer avoiding defensive programming in favor of [Test Driven Development](http://en.wikipedia.org/wiki/Test-driven_development). If you catch errors quickly and externally, you don't need to muddy-up y...
490,424
<p>I wanted to write a function that would take an object and convert it to an array that contains that object as a single element. It occurred to me that I could maybe do this with generics and variable arguments to essentially do this automatically, without the need to write a function for each object type I wished ...
[ { "answer_id": 490431, "author": "yawmark", "author_id": 45204, "author_profile": "https://Stackoverflow.com/users/45204", "pm_score": 4, "selected": false, "text": "<p>Why not simply: </p>\n\n<pre><code>Object o = new Object();\nObject[] array = { o }; // no method call required!\n</cod...
2009/01/29
[ "https://Stackoverflow.com/questions/490424", "https://Stackoverflow.com", "https://Stackoverflow.com/users/60006/" ]
I wanted to write a function that would take an object and convert it to an array that contains that object as a single element. It occurred to me that I could maybe do this with generics and variable arguments to essentially do this automatically, without the need to write a function for each object type I wished to u...
It works but it seems like: ``` Object o = new Object(); someMethod(new Object[] { o } ); ``` is a little more straightforward then: ``` Object o = new Object(); someMethod(convert_to_array(o)); ``` In cases where sometimes I want to pass a single object, but other times I want to pass an array, usually I just ...
490,429
<p>I'm using a Python API that expects me to pass it a function. However, for various reasons, I want to pass it a method, because I want the function to behave different depending on the instance it belongs to. If I pass it a method, the API will not call it with the correct 'self' argument, so I'm wondering how to t...
[ { "answer_id": 490437, "author": "Ryan", "author_id": 8819, "author_profile": "https://Stackoverflow.com/users/8819", "pm_score": 4, "selected": true, "text": "<p>Will passing in the method bound to a instance work? If so, you don't have to do anything special.</p>\n\n<pre><code>In [2]: ...
2009/01/29
[ "https://Stackoverflow.com/questions/490429", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5222/" ]
I'm using a Python API that expects me to pass it a function. However, for various reasons, I want to pass it a method, because I want the function to behave different depending on the instance it belongs to. If I pass it a method, the API will not call it with the correct 'self' argument, so I'm wondering how to turn ...
Will passing in the method bound to a instance work? If so, you don't have to do anything special. ``` In [2]: class C(object): ...: def method(self, a, b, c): ...: print a, b, c ...: ...: In [3]: def api_function(a_func): ...: a_func("One Fish", "Two Fish", "Blue Fish") ...: ...:...
490,430
<p>I have recently integrated the .NET NLog logging component into one of our applications which developed purely in unmanaged code (C++ and VB6 components compiled in Visual Studio 6). We have a bunch of C++ application talking to NLog via a COM interface.</p> <p>Everything is working fine at the moment but I do noti...
[ { "answer_id": 490518, "author": "JaredPar", "author_id": 23283, "author_profile": "https://Stackoverflow.com/users/23283", "pm_score": 4, "selected": true, "text": "<p>It is most definitely not safe to ignore this message. If you hit this message, you've almost certainly created a rea...
2009/01/29
[ "https://Stackoverflow.com/questions/490430", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4368/" ]
I have recently integrated the .NET NLog logging component into one of our applications which developed purely in unmanaged code (C++ and VB6 components compiled in Visual Studio 6). We have a bunch of C++ application talking to NLog via a COM interface. Everything is working fine at the moment but I do notice that th...
It is most definitely not safe to ignore this message. If you hit this message, you've almost certainly created a real loader lock policy violation. This is a very serious error and can cause unpredictable behavior in a program (including deadlock). The best way to avoid this is to not access any other .Net Objects/F...
490,440
<p>Session variables are apparently not working for me. I don't know what I'm doing wrong. This is the code that I'm using to check for a valid password:</p> <pre><code>if ($input_password_hash == $password_hash) { session_start(); $_SESSION['is_user'] = 1; header("Location: ../new_look"); //or Location: index....
[ { "answer_id": 490445, "author": "Ray Hidayat", "author_id": 49643, "author_profile": "https://Stackoverflow.com/users/49643", "pm_score": 4, "selected": true, "text": "<p>You know that you've got to write <code>session_start()</code> before you use the <code>$_SESSION</code> variable in...
2009/01/29
[ "https://Stackoverflow.com/questions/490440", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59351/" ]
Session variables are apparently not working for me. I don't know what I'm doing wrong. This is the code that I'm using to check for a valid password: ``` if ($input_password_hash == $password_hash) { session_start(); $_SESSION['is_user'] = 1; header("Location: ../new_look"); //or Location: index.php } else ec...
You know that you've got to write `session_start()` before you use the `$_SESSION` variable in any request, right? It looks like you haven't put it in index.php anywhere.
490,450
<p>I'm sending some data over AJAX to a PHP file. It's about filter options. Anyway, I am sending it like this:</p> <pre><code>filter[0][data][type] string filter[0][data][value] automobiles filter[0][field] product filter[1][data][type] numeric filter[1][data][value] 6000 filter[1][field] price </code></pre> <p>T...
[ { "answer_id": 490467, "author": "Juan", "author_id": 550, "author_profile": "https://Stackoverflow.com/users/550", "pm_score": 0, "selected": false, "text": "<p>I'd send the data over as JSON object, and transform it on php back to an array just like the one you were using before.</p>\n...
2009/01/29
[ "https://Stackoverflow.com/questions/490450", "https://Stackoverflow.com", "https://Stackoverflow.com/users/56409/" ]
I'm sending some data over AJAX to a PHP file. It's about filter options. Anyway, I am sending it like this: ``` filter[0][data][type] string filter[0][data][value] automobiles filter[0][field] product filter[1][data][type] numeric filter[1][data][value] 6000 filter[1][field] price ``` This above is taken from Fi...
[parse\_str](http://www.php.net/parse_str)($queryString); and then do everything as normal. That method will process the query string and import the variables to the global namespace (which could be dangerous), so maybe use its second form (listed on the manual page): ``` $result = array(); parse_str($queryString, $re...
490,455
<p>Using my tool (vb.net) I am able to count Activex controls present in a access DB Form. Is it possible to bifurcate the controls? i.e. I want to count activex controls separately.</p> <p>e.g. If there are total 10 Activex Controls, out of which 5 are calender control and 5 are check boxes. Then I need to count sepa...
[ { "answer_id": 490467, "author": "Juan", "author_id": 550, "author_profile": "https://Stackoverflow.com/users/550", "pm_score": 0, "selected": false, "text": "<p>I'd send the data over as JSON object, and transform it on php back to an array just like the one you were using before.</p>\n...
2009/01/29
[ "https://Stackoverflow.com/questions/490455", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45255/" ]
Using my tool (vb.net) I am able to count Activex controls present in a access DB Form. Is it possible to bifurcate the controls? i.e. I want to count activex controls separately. e.g. If there are total 10 Activex Controls, out of which 5 are calender control and 5 are check boxes. Then I need to count separately. I...
[parse\_str](http://www.php.net/parse_str)($queryString); and then do everything as normal. That method will process the query string and import the variables to the global namespace (which could be dangerous), so maybe use its second form (listed on the manual page): ``` $result = array(); parse_str($queryString, $re...
490,464
<p>I'm trying to get my head round this mind boggling stuff they call Database Design without much success, so I'll try to illustrate my problem with an example.</p> <p>I am using MySQL and here is my question:</p> <p>Say I want to create a database to hold my DVD collection. I have the following information that I w...
[ { "answer_id": 490470, "author": "Dean Rather", "author_id": 14966, "author_profile": "https://Stackoverflow.com/users/14966", "pm_score": 1, "selected": false, "text": "<p>You don't really need a YearTable, and all you need is a genre_id, director_id, and actor_id columns in your films ...
2009/01/29
[ "https://Stackoverflow.com/questions/490464", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37418/" ]
I'm trying to get my head round this mind boggling stuff they call Database Design without much success, so I'll try to illustrate my problem with an example. I am using MySQL and here is my question: Say I want to create a database to hold my DVD collection. I have the following information that I want to include: ...
You have to make a distinction between attributes and entities. An entity is a thing - usually a noun. An attribute is more like a piece of describing information. In database jargon, entity = table, attribute = field/column. Having a separate table for certain things, let's use director, as an example, is called norm...
490,487
<pre><code>#include "iostream" #include "vector" class ABC { }; class VecTest { std::vector&lt;ABC&gt; vec; public: std::vector&lt;ABC&gt; &amp; getVec() const { //Here it errors out return vec; } }; </code></pre> <p>Removing the const fixes it , is it not the case that getVec is a constant method...
[ { "answer_id": 490495, "author": "Henk", "author_id": 4613, "author_profile": "https://Stackoverflow.com/users/4613", "pm_score": 2, "selected": false, "text": "<p>The return type of <code>getVec()</code> needs to be <code>const std::vector&lt;ABC&gt;&amp;</code>.</p>\n" }, { "an...
2009/01/29
[ "https://Stackoverflow.com/questions/490487", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43756/" ]
``` #include "iostream" #include "vector" class ABC { }; class VecTest { std::vector<ABC> vec; public: std::vector<ABC> & getVec() const { //Here it errors out return vec; } }; ``` Removing the const fixes it , is it not the case that getVec is a constant method. So why is this not allowed?
What you should probably be doing is returning a const reference. const std::vector& getVec() const { return vec; } It's not allowed because you've said getVec is a const method, meaning the method should not change the **this** object in any way. Returning a non-const reference would possibly allow its object to be ...
490,501
<p>I have an <code>input[type="radio"]</code> element inside a block container of fixed width. The supporting text for the <code>&lt;input/&gt;</code> element does not fit in a single line, and falls over to two or more lines. For example:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true...
[ { "answer_id": 490509, "author": "nickf", "author_id": 9021, "author_profile": "https://Stackoverflow.com/users/9021", "pm_score": 4, "selected": true, "text": "<p>The container could use positive left <code>padding</code>, and a negative <code>text-indent</code>.</p>\n\n<pre class=\"lan...
2009/01/29
[ "https://Stackoverflow.com/questions/490501", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23191/" ]
I have an `input[type="radio"]` element inside a block container of fixed width. The supporting text for the `<input/>` element does not fit in a single line, and falls over to two or more lines. For example: ```css div.leftBlock { position: relative; float: left; width: 275px; } ``` ```html <div class="lef...
The container could use positive left `padding`, and a negative `text-indent`. ```css .leftBlock { padding-left: 20px; text-indent: -20px; } .leftBlock input { width: 20px; } ``` [Here's an example](http://jsbin.com/edota)
490,507
<p>I have some data in my development database that I would like to utilize as fixtures in my test environment. What is the best way in Rails 2.x to export a database table to a YAML fixture?</p>
[ { "answer_id": 490523, "author": "Geekygecko", "author_id": 6009, "author_profile": "https://Stackoverflow.com/users/6009", "pm_score": 4, "selected": false, "text": "<p>I have been using YamlDb to save the state of my database.</p>\n\n<p>Install it with the following command:</p>\n\n<pr...
2009/01/29
[ "https://Stackoverflow.com/questions/490507", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14787/" ]
I have some data in my development database that I would like to utilize as fixtures in my test environment. What is the best way in Rails 2.x to export a database table to a YAML fixture?
There is a rake task for this. You can specify RAILS\_ENV if needed; the default is the development environment: ``` rake db:fixtures:dump # Create YAML test fixtures from data in an existing database. ```
490,508
<p>I just want a very handy way to extract the numbers out of a string in Javascript and I am thinking about using jQuery, but I prefer the method that proves to be the simplest. I have requested the "left" attribute of a css block using jQuery like this:</p> <pre><code>var stuff = $('#block').css("left") </code></pre...
[ { "answer_id": 490512, "author": "Sean Bright", "author_id": 21926, "author_profile": "https://Stackoverflow.com/users/21926", "pm_score": 6, "selected": true, "text": "<p>Just do a <code>parseInt(\"1008px\", 10)</code>, it will ignore the 'px' for you.</p>\n" }, { "answer_id": 4...
2009/01/29
[ "https://Stackoverflow.com/questions/490508", "https://Stackoverflow.com", "https://Stackoverflow.com/users/55563/" ]
I just want a very handy way to extract the numbers out of a string in Javascript and I am thinking about using jQuery, but I prefer the method that proves to be the simplest. I have requested the "left" attribute of a css block using jQuery like this: ``` var stuff = $('#block').css("left") ``` The result of "stuff...
Just do a `parseInt("1008px", 10)`, it will ignore the 'px' for you.
490,515
<p>Hi I am using mysql 5.0.x </p> <p>How do I rename a schema? </p>
[ { "answer_id": 490524, "author": "Grant Limberg", "author_id": 27314, "author_profile": "https://Stackoverflow.com/users/27314", "pm_score": -1, "selected": false, "text": "<p>Under 5.0, you need to dump the database and reload it into a new database with a new name. If you upgrade to 5...
2009/01/29
[ "https://Stackoverflow.com/questions/490515", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17560/" ]
Hi I am using mysql 5.0.x How do I rename a schema?
Don't use RENAME DATABASE!!! Early 5.1 versions had this command but it's been removed since it can corrupt data ([reference](http://dev.mysql.com/doc/refman/5.1/en/rename-database.html)). The only way at present is ``` mysqladmin create new_db_name mysqldump db_name | mysql new_db_name ``` as referred to [here](...
490,522
<p>I deleted a file from a repo and now want to put it back. The best I can figure out is to:</p> <ul> <li>update to the revision before the delete</li> <li>copy the files elsewhere</li> <li>update to head</li> <li>copy the files back</li> <li>add them</li> <li>commit</li> </ul> <p>That just smells bad and it looses ...
[ { "answer_id": 490528, "author": "Sean Bright", "author_id": 21926, "author_profile": "https://Stackoverflow.com/users/21926", "pm_score": 7, "selected": true, "text": "<p>Use svn merge:</p>\n\n<pre><code>svn merge -c -[rev num that deleted the file] http://&lt;path to repository&gt;\n</...
2009/01/29
[ "https://Stackoverflow.com/questions/490522", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1343/" ]
I deleted a file from a repo and now want to put it back. The best I can figure out is to: * update to the revision before the delete * copy the files elsewhere * update to head * copy the files back * add them * commit That just smells bad and it looses all history to boot. There has got to be a better way to do thi...
Use svn merge: ``` svn merge -c -[rev num that deleted the file] http://<path to repository> ``` So an example: ``` svn merge -c -12345 https://svn.mysite.com/svn/repo/project/trunk ^ The negative is important ``` For TortoiseSVN (I think...) * Right click in Explorer, go to TortoiseSVN -> Merge... ...
490,570
<p>Steve Yegge describes the <strong>Properties Pattern</strong> in a <a href="http://steve-yegge.blogspot.com/2008/10/universal-design-pattern.html#Property" rel="noreferrer">blog post</a> of his.</p> <p>For someone using a static language like C# or Java, what are the advantages and disadvantages of this approach? I...
[ { "answer_id": 490581, "author": "Steen", "author_id": 1448983, "author_profile": "https://Stackoverflow.com/users/1448983", "pm_score": 2, "selected": false, "text": "<p>The properties pattern is especially useful (or, it has been for me), when your want to make prototypes of objects or...
2009/01/29
[ "https://Stackoverflow.com/questions/490570", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12971/" ]
Steve Yegge describes the **Properties Pattern** in a [blog post](http://steve-yegge.blogspot.com/2008/10/universal-design-pattern.html#Property) of his. For someone using a static language like C# or Java, what are the advantages and disadvantages of this approach? In what kind of projects would you want to use the P...
I've been digging into this pattern quite a bit myself lately, and I can tell you that finding information on it is pretty tough. Yegge calls it prototype or properties, but both of those are pretty heavily overused, and well known as two other, different patterns. Some people refer to systems like the one Yegge propos...
490,580
<p>Our project is a medium size web application developed using RAD 7.0 on WAS 6.1/hibernate/struts which moved to production. Currently we have hardcoded the ip address of the production system in the property file and database schema details in the hibernate config file. </p> <p>Our client wants us to come up with t...
[ { "answer_id": 490734, "author": "kgiannakakis", "author_id": 24054, "author_profile": "https://Stackoverflow.com/users/24054", "pm_score": 3, "selected": false, "text": "<p>You can use JNDI for this. You should create the appropriate entries and in your code read them like this:</p>\n\n...
2009/01/29
[ "https://Stackoverflow.com/questions/490580", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Our project is a medium size web application developed using RAD 7.0 on WAS 6.1/hibernate/struts which moved to production. Currently we have hardcoded the ip address of the production system in the property file and database schema details in the hibernate config file. Our client wants us to come up with the solutio...
You can use JNDI for this. You should create the appropriate entries and in your code read them like this: ``` Context initialContext = new InitialContext(); URL ip = (URL) initialContext.lookup("java:comp/env/myip"); ``` See [this](http://www.developer.com/open/article.php/3559931) article on how to use a JNDI Data...
490,589
<p>Please solve my following confusions about validation in Struts2 -</p> <p>1) Can we do client side and server side validation through JavaScript ? 2) Can we do client side and server side validation through AJAX ?</p> <p>If possible then which one is beneficial for client side validation and which one for server s...
[ { "answer_id": 490734, "author": "kgiannakakis", "author_id": 24054, "author_profile": "https://Stackoverflow.com/users/24054", "pm_score": 3, "selected": false, "text": "<p>You can use JNDI for this. You should create the appropriate entries and in your code read them like this:</p>\n\n...
2009/01/29
[ "https://Stackoverflow.com/questions/490589", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Please solve my following confusions about validation in Struts2 - 1) Can we do client side and server side validation through JavaScript ? 2) Can we do client side and server side validation through AJAX ? If possible then which one is beneficial for client side validation and which one for server side ?
You can use JNDI for this. You should create the appropriate entries and in your code read them like this: ``` Context initialContext = new InitialContext(); URL ip = (URL) initialContext.lookup("java:comp/env/myip"); ``` See [this](http://www.developer.com/open/article.php/3559931) article on how to use a JNDI Data...
490,592
<p>I am writing an Objective-C program that utilizes the garbage collector.</p> <p>I am getting <em>EXC_BAD_ACCESS</em> in some situations, the classic example of an object being "over freed". Using some of the debugging tips <a href="http://developer.apple.com/technotes/tn2004/tn2124.html" rel="nofollow noreferrer">i...
[ { "answer_id": 490734, "author": "kgiannakakis", "author_id": 24054, "author_profile": "https://Stackoverflow.com/users/24054", "pm_score": 3, "selected": false, "text": "<p>You can use JNDI for this. You should create the appropriate entries and in your code read them like this:</p>\n\n...
2009/01/29
[ "https://Stackoverflow.com/questions/490592", "https://Stackoverflow.com", "https://Stackoverflow.com/users/53615/" ]
I am writing an Objective-C program that utilizes the garbage collector. I am getting *EXC\_BAD\_ACCESS* in some situations, the classic example of an object being "over freed". Using some of the debugging tips [in this technote](http://developer.apple.com/technotes/tn2004/tn2124.html), namely *MallocScribble* and *AU...
You can use JNDI for this. You should create the appropriate entries and in your code read them like this: ``` Context initialContext = new InitialContext(); URL ip = (URL) initialContext.lookup("java:comp/env/myip"); ``` See [this](http://www.developer.com/open/article.php/3559931) article on how to use a JNDI Data...
490,597
<p>Any time I want to replace a piece of text that is part of a larger piece of text, I always have to do something like:</p> <pre><code>"(?P&lt;start&gt;some_pattern)(?P&lt;replace&gt;foo)(?P&lt;end&gt;end)" </code></pre> <p>And then concatenate the <code>start</code> group with the new data for <code>replace</code>...
[ { "answer_id": 490609, "author": "zenazn", "author_id": 46848, "author_profile": "https://Stackoverflow.com/users/46848", "pm_score": 5, "selected": true, "text": "<p>Look in the Python <a href=\"http://docs.python.org/library/re.html\" rel=\"nofollow noreferrer\">re documentation</a> fo...
2009/01/29
[ "https://Stackoverflow.com/questions/490597", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49701/" ]
Any time I want to replace a piece of text that is part of a larger piece of text, I always have to do something like: ``` "(?P<start>some_pattern)(?P<replace>foo)(?P<end>end)" ``` And then concatenate the `start` group with the new data for `replace` and then the `end` group. Is there a better method for this?
Look in the Python [re documentation](http://docs.python.org/library/re.html) for lookaheads `(?=...)` and lookbehinds `(?<=...)` -- I'm pretty sure they're what you want. They match strings, but do not "consume" the bits of the strings they match.
490,618
<p>I have about 7 Javascript files now (thanks to various jQuery plugins) and 4-5 CSS files. I'm curious as to what's the best practice for dealing with these including where in the document they should be loaded? YSlow tells me that Javascript files should be--where possible--included at the end. The end of the bod...
[ { "answer_id": 490624, "author": "Hexagon Theory", "author_id": 59107, "author_profile": "https://Stackoverflow.com/users/59107", "pm_score": 2, "selected": false, "text": "<p>You haven't explicitly said that you've got access to a server-side solution, but assuming you do, I've always g...
2009/01/29
[ "https://Stackoverflow.com/questions/490618", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18393/" ]
I have about 7 Javascript files now (thanks to various jQuery plugins) and 4-5 CSS files. I'm curious as to what's the best practice for dealing with these including where in the document they should be loaded? YSlow tells me that Javascript files should be--where possible--included at the end. The end of the body? It ...
I would suggest using [PHP Minify](http://code.google.com/p/minify/ "Google Code: Minify"), which lets you create a single HTTP request for a group of JS or CSS files. Minify also handles GZipping, Compression, and HTTP Headers for client side caching. Edit: Minify will also allow you to setup the request so that for ...
490,622
<p>I am using the Moq and can't seem to get my unit test to pass on what appears to be a simple mocking scenario. </p> <pre><code>Product p = new Product(); var rep = new Mock&lt;IProductRepository&gt;(); rep.Expect(x =&gt; x.GetProductById(1)).Returns(p); p = rep.Object.GetProductById(1); Assert.AreEqual(1, p.Produc...
[ { "answer_id": 490638, "author": "Gishu", "author_id": 1695, "author_profile": "https://Stackoverflow.com/users/1695", "pm_score": 0, "selected": false, "text": "<p>You're using the Product instance p once as 'the expected value' while you are setting up the expect - Returns (p)\nand the...
2009/01/29
[ "https://Stackoverflow.com/questions/490622", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I am using the Moq and can't seem to get my unit test to pass on what appears to be a simple mocking scenario. ``` Product p = new Product(); var rep = new Mock<IProductRepository>(); rep.Expect(x => x.GetProductById(1)).Returns(p); p = rep.Object.GetProductById(1); Assert.AreEqual(1, p.ProductId); //Assert.AreEqual...
You are creating an object, setting that object as the return value for a method, and then checking if the mock is altering the object, something that the mock is not intended to do You are basically doing this: ``` Product getProductById(Product p) { return p; } ... Product p = new Product(); Assert.AreEqual(1, getPr...
490,650
<p>I have a PHP script which reads a large CSV and performs certain actions, but only if the "username" field is unique. The CSV is used in more than one script, so changing the input from the CSV to only contain unique usernames is not an option.</p> <p>The very basic program flow (which I'm wondering about) goes lik...
[ { "answer_id": 490676, "author": "Steen", "author_id": 1448983, "author_profile": "https://Stackoverflow.com/users/1448983", "pm_score": 1, "selected": false, "text": "<p>The array type in php is an ordered map (<a href=\"http://php.net/manual/en/language.types.array.php\" rel=\"nofollow...
2009/01/29
[ "https://Stackoverflow.com/questions/490650", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9021/" ]
I have a PHP script which reads a large CSV and performs certain actions, but only if the "username" field is unique. The CSV is used in more than one script, so changing the input from the CSV to only contain unique usernames is not an option. The very basic program flow (which I'm wondering about) goes like this: `...
Not keeping the array in order, but how about this kind of optimization? I'm guessing `isset()` for an array key should be faster than `in_array()` search. ``` $allUsernames = array(); while($row = fgetcsv($fp)) { $username = $row[0]; if (isset($allUsernames[$username])) { continue; } else { $allUsernam...
490,661
<p>I'm currently modifying a class that has 9 different constructors. Now overall I believe this class is very poorly designed... so I'm wondering if it is poor design for a class to have so many constructors.</p> <p>A problem has arisen because I recently added two constructors to this class in an attempt to refactor...
[ { "answer_id": 490668, "author": "sh1mmer", "author_id": 53569, "author_profile": "https://Stackoverflow.com/users/53569", "pm_score": 5, "selected": true, "text": "<p>A class should do one thing and one thing only. If it has so many constructors it seems to be a tell tale sign that it's...
2009/01/29
[ "https://Stackoverflow.com/questions/490661", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39532/" ]
I'm currently modifying a class that has 9 different constructors. Now overall I believe this class is very poorly designed... so I'm wondering if it is poor design for a class to have so many constructors. A problem has arisen because I recently added two constructors to this class in an attempt to refactor and redes...
A class should do one thing and one thing only. If it has so many constructors it seems to be a tell tale sign that it's doing too many things. Using multiple constructors to force the correct creation of instances of the object in a variety of circumstances but 9 seems like a lot. I would suspect there is an interfac...
490,682
<p>I have placed a treeView in One Update Panel and Each View in one update Panel something like this</p> <pre> <code> &lt;UpdatePanel id="UP1"&gt; &lt;ContentTemplate&gt; &lt;TreeView/&gt; &lt;/ContentTemplate&gt; &lt;/UpdatePanel&gt; &lt;MultiView&gt; &lt;UpdatePanel id="UP2"&gt; ...
[ { "answer_id": 490714, "author": "Igor Zelaya", "author_id": 22769, "author_profile": "https://Stackoverflow.com/users/22769", "pm_score": 1, "selected": false, "text": "<p>Add an AsyncPostBackTrigger to the second updatePanel, so it gets updated when the TreeView Click event is fired.</...
2009/01/29
[ "https://Stackoverflow.com/questions/490682", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have placed a treeView in One Update Panel and Each View in one update Panel something like this ``` <UpdatePanel id="UP1"> <ContentTemplate> <TreeView/> </ContentTemplate> </UpdatePanel> <MultiView> <UpdatePanel id="UP2"> <View1/> </UpdatePanel> ``` Now I want to know ho...
Another way of approaching it would be to call UP2.Update() from the codebehind if you have code for the click event of the Treeview. Remember, UP2 needs to have its RenderMode set to Conditional for this to work. Hope it helps
490,716
<p>Ok, I've rolled my own theme, I've made a custom jQuery UI pack (progress bar, date picker, slider) and installed it all. Seems to (mostly) work except for two things:</p> <ol> <li>When my page first loads the datepicker div is visible; and</li> <li>The text "Next" and "Prev" are visible in large font underneath m...
[ { "answer_id": 490742, "author": "jacobangel", "author_id": 31318, "author_profile": "https://Stackoverflow.com/users/31318", "pm_score": 1, "selected": false, "text": "<p>Knowing nothing else about your problem, I believe it may be other css on your page conflicting with the picker. </p...
2009/01/29
[ "https://Stackoverflow.com/questions/490716", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18393/" ]
Ok, I've rolled my own theme, I've made a custom jQuery UI pack (progress bar, date picker, slider) and installed it all. Seems to (mostly) work except for two things: 1. When my page first loads the datepicker div is visible; and 2. The text "Next" and "Prev" are visible in large font underneath my icons. None of the...
I fixed it using #ui-datepicker-div { display: none; }
490,720
<p>Ok first off, I am linking to boost_system and boost_filesystem.</p> <p>My compiler is a <a href="http://nuwen.net/mingw.html" rel="nofollow noreferrer">custom build of MinGW with GCC 4.3.2</a></p> <p>So when I include:</p> <pre><code>#include "boost/filesystem.hpp" </code></pre> <p>I get linking errors such as:...
[ { "answer_id": 490731, "author": "Ray Hidayat", "author_id": 49643, "author_profile": "https://Stackoverflow.com/users/49643", "pm_score": 0, "selected": false, "text": "<p>Windows binaries: www.boost.org - see the \"Getting Started\" page - but if you're using g++ on MingGW you don't wa...
2009/01/29
[ "https://Stackoverflow.com/questions/490720", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1366/" ]
Ok first off, I am linking to boost\_system and boost\_filesystem. My compiler is a [custom build of MinGW with GCC 4.3.2](http://nuwen.net/mingw.html) So when I include: ``` #include "boost/filesystem.hpp" ``` I get linking errors such as: ``` ..\..\libraries\boost\libs\libboost_system.a(error_code.o):error_code...
Ok, I found the problem. It's a bit convoluted. GCC is gradually becoming more IS 14882 compliant in the 4.x branch. As they go on, they are removing deprecated non-standards complaint features. While 4.1.x seem to only have them deprecated and not removed, 4.3.x seems to actually have them removed. What this means i...
490,762
<p>I want to reduce the number of patterns I have to write by using a regex that picks up any or all of the pattern when it appears in a string.</p> <p>Is this possible with Regex?</p> <pre><code>E.g. Pattern is: "the cat sat on the mat" I would like pattern to match on following strings: "the" "the cat" "the cat sa...
[ { "answer_id": 490767, "author": "Ray Hidayat", "author_id": 49643, "author_profile": "https://Stackoverflow.com/users/49643", "pm_score": 1, "selected": false, "text": "<p>If you know the match always begins at the first character, it would be much faster to match the characters directl...
2009/01/29
[ "https://Stackoverflow.com/questions/490762", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I want to reduce the number of patterns I have to write by using a regex that picks up any or all of the pattern when it appears in a string. Is this possible with Regex? ``` E.g. Pattern is: "the cat sat on the mat" I would like pattern to match on following strings: "the" "the cat" "the cat sat" ... "the cat sat o...
This: ``` the( cat( sat( on( the( mat)?)?)?)?)? ``` would answer your question. Remove "optional group" parens "(...)?" for parts that are not optional, add additional groups for things that must match together. ``` the // complete match the cat // complete match the cat sat ...
490,784
<p>I would like to put my ScrollViewer in such a way that it overlaps/sits on top of the content it scrolls. I would set the Opacity of the ScrollViewer so that the content is visible underneath.</p> <p>As far as I understand the default ScrollViewer, this doesn't seem to be possible out of the box since the content i...
[ { "answer_id": 490849, "author": "Daniel Paull", "author_id": 43066, "author_profile": "https://Stackoverflow.com/users/43066", "pm_score": 0, "selected": false, "text": "<p>The idea is that the ScrollViewer is a decorator for the thing that it scrolls and clips. The thing being scrolle...
2009/01/29
[ "https://Stackoverflow.com/questions/490784", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10779/" ]
I would like to put my ScrollViewer in such a way that it overlaps/sits on top of the content it scrolls. I would set the Opacity of the ScrollViewer so that the content is visible underneath. As far as I understand the default ScrollViewer, this doesn't seem to be possible out of the box since the content is nested i...
I think I now understand what you mean by "on top" - one way to do it is to use a control template that makes the ScrollContentPresenter span two rows and columns of a grid while the ScrollBars are in the 2nd rows and columns. The ScrollBars are set to be semi-transparent. The content will now draw under the scrollbars...
490,795
<p>I am using the <code>text-indent</code> technique to replace my <code>&lt;h1/&gt;</code> tag with my website's image as so:</p> <pre><code>&lt;h1 title="Homepage"&gt;My logo&lt;/h1&gt; </code></pre> <p>CSS:</p> <pre class="lang-css prettyprint-override"><code>#header h1 { float: left; background: transpar...
[ { "answer_id": 490802, "author": "Patrik Hägne", "author_id": 46187, "author_profile": "https://Stackoverflow.com/users/46187", "pm_score": 0, "selected": false, "text": "<p>What you can do is remove the indent. And use a span to hide instead:</p>\n\n<pre><code>&lt;h1 title=\"Homepage\"&...
2009/01/29
[ "https://Stackoverflow.com/questions/490795", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49887/" ]
I am using the `text-indent` technique to replace my `<h1/>` tag with my website's image as so: ``` <h1 title="Homepage">My logo</h1> ``` CSS: ```css #header h1 { float: left; background: transparent url('../images/logo.png'); width: 214px; height: 64px; text-indent: -9999px; } ``` The only pr...
There are many ways to do this, this is the way that I prefer, it works well, and is easy to implement. ``` <div id="header"> <h1><a href="/" title="Homepage">Homepage</a></h1> </div> ``` Then i do this css, this is also know as the "Leafy/Langridge image replacement" method ```css #header h1 a { display: b...
490,803
<p>In a new project I am working on I have the following dir structure:</p> <pre><code>Project_base |---- src |---- bin |---- h | Makefile </code></pre> <p>And in my source files I have includes that look like so:</p> <pre><code>#include "../h/SomeHeaderFile.h" </code></pre> <p>instead of the more correct form:</p>...
[ { "answer_id": 490816, "author": "codelogic", "author_id": 43427, "author_profile": "https://Stackoverflow.com/users/43427", "pm_score": 2, "selected": false, "text": "<p>Add a flag to your CFLAGS so that the root of the headers is part of the headers search path:</p>\n\n<pre><code>-IPro...
2009/01/29
[ "https://Stackoverflow.com/questions/490803", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24545/" ]
In a new project I am working on I have the following dir structure: ``` Project_base |---- src |---- bin |---- h | Makefile ``` And in my source files I have includes that look like so: ``` #include "../h/SomeHeaderFile.h" ``` instead of the more correct form: ``` #include "SomeHeaderFile.h" ``` What do I nee...
You need to add `-I../h` in the list of parameters you pass to gcc.
490,806
<p>I'm trying to request a HTTP resource that requires basic authorization headers from within an Adobe AIR application. I've tried manually adding the headers to the request, as well as using the setRemoteCredentials() method to set them, to no avail.</p> <p>Here's the code:</p> <pre><code>&lt;mx:Script&gt; &lt;...
[ { "answer_id": 490954, "author": "Richard Szalay", "author_id": 3603, "author_profile": "https://Stackoverflow.com/users/3603", "pm_score": 0, "selected": false, "text": "<p>Try using setCredentials rather than setRemoteCredentials and failing that, using Fiddler/Charles to find out what...
2009/01/29
[ "https://Stackoverflow.com/questions/490806", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1384/" ]
I'm trying to request a HTTP resource that requires basic authorization headers from within an Adobe AIR application. I've tried manually adding the headers to the request, as well as using the setRemoteCredentials() method to set them, to no avail. Here's the code: ``` <mx:Script> <![CDATA[ import mx.rpc...
Finally received some attention from Adobe and got an answer on this. The problem with long HTTP Authentication headers is that, by default, the Base64Encoder class will inject newline characters every 72 characters. Obviously that causes a chunk of the base-64 encoded string to be interpreted as a new header attribute...
490,819
<p>Can I dynamically create a function and invoke it (passing values into it) in one line of code?</p> <p>Clarification: I was looking for some way that could allow me to create an anonymous function and then calling it directly. Sort of:</p> <pre><code>delegate(string aa){ MessageBox.show(aa); }("Hello World!"); </c...
[ { "answer_id": 490828, "author": "Gerrie Schenck", "author_id": 57036, "author_profile": "https://Stackoverflow.com/users/57036", "pm_score": 2, "selected": false, "text": "<p>Check out <a href=\"http://msdn.microsoft.com/en-us/library/0yw3tz5k(VS.80).aspx\" rel=\"nofollow noreferrer\">a...
2009/01/29
[ "https://Stackoverflow.com/questions/490819", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31728/" ]
Can I dynamically create a function and invoke it (passing values into it) in one line of code? Clarification: I was looking for some way that could allow me to create an anonymous function and then calling it directly. Sort of: ``` delegate(string aa){ MessageBox.show(aa); }("Hello World!"); ``` or something like ...
``` new Action<int>(x => Console.WriteLine(x))(3); ``` it's not so readable but answering your question, you definitely can. EDIT: just noticed you tagged it as c# 2.0, the answer above is for 3.5, for 2.0 it would be ``` new Action<int>(delegate(int x) { Console.WriteLine(x); })(3); ```
490,821
<p>How do I create and display an image in j2me application?</p> <p>And in which folder can I put that image in my application?</p>
[ { "answer_id": 491947, "author": "Fostah", "author_id": 16524, "author_profile": "https://Stackoverflow.com/users/16524", "pm_score": 3, "selected": false, "text": "<p><a href=\"http://www.java2s.com/Code/Java/J2ME/ImageMIDlet.htm\" rel=\"nofollow noreferrer\">This link</a> has exactly w...
2009/01/29
[ "https://Stackoverflow.com/questions/490821", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
How do I create and display an image in j2me application? And in which folder can I put that image in my application?
[This link](http://www.java2s.com/Code/Java/J2ME/ImageMIDlet.htm) has exactly what you are looking for to get started. Basically, to create the image, you call upon Image.createImage(); ``` Image img = Image.createImage("/imageName.png"); ``` If it is in a sub-folder in the Jar: ``` Image img = Image.createImage("...
490,829
<p>We have an application in which admin members can add content for their subordinates to view. Their requirement is that it should be able to display Word, Excel, PowerPoint and PDF documents in a non-editable manner.</p> <p>The one option that I found for doing this is to have the content loaded into a web browser...
[ { "answer_id": 490856, "author": "Filip Ekberg", "author_id": 39106, "author_profile": "https://Stackoverflow.com/users/39106", "pm_score": 0, "selected": false, "text": "<p>Have you looked at Microsoft Word 9.0 object library ? It might not be possible to just display the data as it was...
2009/01/29
[ "https://Stackoverflow.com/questions/490829", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6389/" ]
We have an application in which admin members can add content for their subordinates to view. Their requirement is that it should be able to display Word, Excel, PowerPoint and PDF documents in a non-editable manner. The one option that I found for doing this is to have the content loaded into a web browser component....
Possibly interesting as well: Save the documents to XPS using Microsoft Office 2007 (or print them to an XPS printer). You can display the read-only XPS document either using the XPS viewer component or render page by page into a PNG or JPEG image. This rendering can be achieved quite easily using .NET 3.5 / WPF. `...
490,835
<p>I followed the steps in <em><a href="https://web.archive.org/web/20111129115318/http://fruitstandsoftware.com/blog/2008/08/finding-memory-leaks-with-the-llvmclang-static-analyzer/" rel="nofollow noreferrer">Finding memory leaks with the LLVM/Clang Static Analyzer</a></em> but I was unable to run static analyzer on m...
[ { "answer_id": 490911, "author": "codelogic", "author_id": 43427, "author_profile": "https://Stackoverflow.com/users/43427", "pm_score": 0, "selected": false, "text": "<p>I haven't used the tool in question but the issue you're seeing appears to be a bothced xcodebuild command. Ensure th...
2009/01/29
[ "https://Stackoverflow.com/questions/490835", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49739/" ]
I followed the steps in *[Finding memory leaks with the LLVM/Clang Static Analyzer](https://web.archive.org/web/20111129115318/http://fruitstandsoftware.com/blog/2008/08/finding-memory-leaks-with-the-llvmclang-static-analyzer/)* but I was unable to run static analyzer on my project. When I try to run `xcodebuild` on m...
I'm the author of the blog post that you reference in your question. If codelogic's comments are not enough to point you in the right direction you can wait until a bit later today and I will update the blog post with some more information about running xcodebuild against iPhone projects. -- Michael -- Alright, I've...
490,850
<pre><code>Public Class A Public Class B : Inherits A Dim DictA As Dictionary(Of Integer, A) Dim DictB As New Dictionary(Of Integer, B) DictA = DictB </code></pre> <p>This doesn't work, as the type can't be converted. Is this somehow possible?</p>
[ { "answer_id": 490871, "author": "ShuggyCoUk", "author_id": 12748, "author_profile": "https://Stackoverflow.com/users/12748", "pm_score": 0, "selected": false, "text": "<p>This is a interesting, and quite complex aspect of Static type systems.\nThe terms you are looking for is Covariance...
2009/01/29
[ "https://Stackoverflow.com/questions/490850", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
``` Public Class A Public Class B : Inherits A Dim DictA As Dictionary(Of Integer, A) Dim DictB As New Dictionary(Of Integer, B) DictA = DictB ``` This doesn't work, as the type can't be converted. Is this somehow possible?
No. You're running into the problem of generic variance, which isn't supported in .NET except in a few very particular ways. Here's the reason: after your last line, you've got a single dictionary with two "views" onto it, effectively. Now imagine you wrote: ``` DictA.Add(1, New A()) ``` (Apologies if my VB is slig...
490,851
<p>I am trying to do an example from the <a href="http://insecure.org/stf/smashstack.html" rel="noreferrer">Smashing the Stack for Fun and Profit</a> in C, but am kind of stuck at a point, following is the code (I have a 64-bit machine with Ubuntu 64-bit):</p> <pre><code>int main() { int x; x = 0; func(1,...
[ { "answer_id": 490868, "author": "Chris Bunch", "author_id": 422, "author_profile": "https://Stackoverflow.com/users/422", "pm_score": 2, "selected": false, "text": "<p>With a lot of this stack smashing stuff, your best friend is <a href=\"http://www.gnu.org/software/gdb/\" rel=\"nofollo...
2009/01/29
[ "https://Stackoverflow.com/questions/490851", "https://Stackoverflow.com", "https://Stackoverflow.com/users/60103/" ]
I am trying to do an example from the [Smashing the Stack for Fun and Profit](http://insecure.org/stf/smashstack.html) in C, but am kind of stuck at a point, following is the code (I have a 64-bit machine with Ubuntu 64-bit): ``` int main() { int x; x = 0; func(1,2,3); x = 1; printf("x is : %d\n",...
'char' on every architecture I've used is 8 bits wide irrespective of whether it's an 8 bit micro, a 16 bit micro, a 32 bit PC, or a 64 bit new PC. Int, on the other hand, tends to be the word size. The order which the locals are put on the stack can be implementation specific. My guess is that your compiler is puttin...
490,881
<p>Hope someone can help me on this matter. I'm looking for a way of enabling message level security on my WCF service other than using certificates. Problem is that the application is used on clients that connect via a VPN with multiple sites that each have their own domain controller and the domains does not trust ea...
[ { "answer_id": 491515, "author": "Pavel Nikolov", "author_id": 11792, "author_profile": "https://Stackoverflow.com/users/11792", "pm_score": 4, "selected": false, "text": "<p>Actually certificates are really the way to go! I strongly advice you to use certificates! It's not that difficul...
2009/01/29
[ "https://Stackoverflow.com/questions/490881", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Hope someone can help me on this matter. I'm looking for a way of enabling message level security on my WCF service other than using certificates. Problem is that the application is used on clients that connect via a VPN with multiple sites that each have their own domain controller and the domains does not trust each ...
Actually certificates are really the way to go! I strongly advice you to use certificates! It's not that difficult. Actually this is your problem: "the domains does not trust each other". With certificates you will achieve domains that trust each other. Here is step by step instruction how to do this: 1) You must c...
490,897
<p>The above code works fine if the batch file is present in local machine.<br> I need to run the batch file that is present in the remote machine from the above code. </p> <pre><code>class Visuals { public static void main(String arg[]) { try { String command = "cmd /C start C:/Visuals/Visua...
[ { "answer_id": 490916, "author": "David Grant", "author_id": 40581, "author_profile": "https://Stackoverflow.com/users/40581", "pm_score": 0, "selected": false, "text": "<p>One possible solution might be to export your Visuals class to an RMI server, and then invoke the method that execu...
2009/01/29
[ "https://Stackoverflow.com/questions/490897", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
The above code works fine if the batch file is present in local machine. I need to run the batch file that is present in the remote machine from the above code. ``` class Visuals { public static void main(String arg[]) { try { String command = "cmd /C start C:/Visuals/VisualTimeSeries08130...
If you make the Folder containing the batch file as a Public Share and then use that address of the batch file like "\ComputerName\ShareName\BatchFile", you can access the batch file. Hope this helps.
490,902
<p>I want to create two threads in my game. One thread is for timer and other for touch events. Because when I am running my game on iPhone, timer conflicts with touch events and touch events are not reported. It works smooth in simulator but on iPhone or on iPod Touch it's becomes very slow. So I'm using separate thre...
[ { "answer_id": 490921, "author": "rpetrich", "author_id": 4007, "author_profile": "https://Stackoverflow.com/users/4007", "pm_score": 1, "selected": false, "text": "<p>If you are trying to create a timer, you should probably just use <code>NSTimer</code>, because that's simpler and more ...
2009/01/29
[ "https://Stackoverflow.com/questions/490902", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I want to create two threads in my game. One thread is for timer and other for touch events. Because when I am running my game on iPhone, timer conflicts with touch events and touch events are not reported. It works smooth in simulator but on iPhone or on iPod Touch it's becomes very slow. So I'm using separate threads...
If you are trying to create a timer, you should probably just use `NSTimer`, because that's simpler and more efficient than creating a thread just to send a "go" event every so often. edit: As is, you aren't creating a second you are merely stalling the main thread by calling [NSThread sleepForTimeInterval:0.01] in a ...
490,910
<p>If I set a CSS value on a specific element using:</p> <pre><code>$('#element').css('background-color', '#ccc'); </code></pre> <p>I want to be able to unset that element-specific value and use the cascaded value, along the lines of:</p> <pre><code>$('#element').css('background-color', null); </code></pre> <p>But ...
[ { "answer_id": 490928, "author": "HectorMac", "author_id": 1400, "author_profile": "https://Stackoverflow.com/users/1400", "pm_score": 2, "selected": false, "text": "<p>Try this:</p>\n\n<pre><code>$('#element').css('background-color', 'inherit');\n</code></pre>\n" }, { "answer_id...
2009/01/29
[ "https://Stackoverflow.com/questions/490910", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3594/" ]
If I set a CSS value on a specific element using: ``` $('#element').css('background-color', '#ccc'); ``` I want to be able to unset that element-specific value and use the cascaded value, along the lines of: ``` $('#element').css('background-color', null); ``` But that syntax doesn't seem to work – is this possib...
From the [jQuery docs](http://api.jquery.com/css/): > > Setting the value of a style property to an empty string — e.g. `$('#mydiv').css('color', '')` — removes that property from an element if it has already been directly applied, whether in the HTML style attribute, through jQuery's `.css()` method, or through dir...
490,920
<p>I have a new website I'm working on that the client wants to keep a secret, but at the same time, I want to put an under construction page with some info on it. I would like to have everything except index.html require a user/password--index.html would be available to everyone.</p> <p>I have the following, but I'm ...
[ { "answer_id": 490972, "author": "heeen", "author_id": 38893, "author_profile": "https://Stackoverflow.com/users/38893", "pm_score": 0, "selected": false, "text": "<p>have you tried reversing the order to first allow, then deny?\nFor further reading: <a href=\"http://httpd.apache.org/doc...
2009/01/29
[ "https://Stackoverflow.com/questions/490920", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5441/" ]
I have a new website I'm working on that the client wants to keep a secret, but at the same time, I want to put an under construction page with some info on it. I would like to have everything except index.html require a user/password--index.html would be available to everyone. I have the following, but I'm not sure w...
``` AuthName "Restricted Area" AuthType Basic AuthUserFile /path/to/file/.htpasswd AuthGroupFile /dev/null <Files "*"> Require valid-user </Files> <Files "index.html"> Allow from all Satisfy any </Files> ```
490,929
<p>I have plans to create a simple bot for a game I run and have it sit on MSN and answer queries. I want to use Python to do this and googled around and found <a href="http://msnp.sourceforge.net/" rel="nofollow noreferrer">MSNP</a>. I thought "great" and "how awesome" but it appears that it's about 5 years old and od...
[ { "answer_id": 490972, "author": "heeen", "author_id": 38893, "author_profile": "https://Stackoverflow.com/users/38893", "pm_score": 0, "selected": false, "text": "<p>have you tried reversing the order to first allow, then deny?\nFor further reading: <a href=\"http://httpd.apache.org/doc...
2009/01/29
[ "https://Stackoverflow.com/questions/490929", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1384652/" ]
I have plans to create a simple bot for a game I run and have it sit on MSN and answer queries. I want to use Python to do this and googled around and found [MSNP](http://msnp.sourceforge.net/). I thought "great" and "how awesome" but it appears that it's about 5 years old and oddly enough doesn't connect to MSN as the...
``` AuthName "Restricted Area" AuthType Basic AuthUserFile /path/to/file/.htpasswd AuthGroupFile /dev/null <Files "*"> Require valid-user </Files> <Files "index.html"> Allow from all Satisfy any </Files> ```
490,957
<p>I know AdvancedDataGrid has a styleFunction callback, but I don't want to change the style; I want the itemRenderer to get the global style that everything else (including normal columns) uses.</p> <p>My in-line item renderers use the default style, but not the ones I created as separate MXML classes (they extend C...
[ { "answer_id": 498013, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 1, "selected": false, "text": "<p>I don't think you can propagate. Seems like styleFunction is for something completly different. But you can access any CSS ...
2009/01/29
[ "https://Stackoverflow.com/questions/490957", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29420/" ]
I know AdvancedDataGrid has a styleFunction callback, but I don't want to change the style; I want the itemRenderer to get the global style that everything else (including normal columns) uses. My in-line item renderers use the default style, but not the ones I created as separate MXML classes (they extend Canvas). A...
I don't think you can propagate. Seems like styleFunction is for something completly different. But you can access any CSS property ``` var styleDecl:CSSStyleDeclaration = StyleManager.getStyleDeclaration("YourTagOrClassName"); ``` and then: ``` styleDecl.getStyle(property); ``` If you want to get style declarat...
490,958
<p>To keep my integration tests independent I remove all old data and insert new test data before each test. Is there a better way of doing this than simply querying for all entities and deleting them one by one?</p> <p>I have considered writing a stored proc that runs "delete from <em>tablename</em>;" for each table ...
[ { "answer_id": 490975, "author": "Frederik Gheysels", "author_id": 55774, "author_profile": "https://Stackoverflow.com/users/55774", "pm_score": 6, "selected": true, "text": "<p>In the TearDown of my UnitTests, I mostly do this:</p>\n\n<pre><code>using( ISession s = ... )\n{\n s.Delete...
2009/01/29
[ "https://Stackoverflow.com/questions/490958", "https://Stackoverflow.com", "https://Stackoverflow.com/users/276/" ]
To keep my integration tests independent I remove all old data and insert new test data before each test. Is there a better way of doing this than simply querying for all entities and deleting them one by one? I have considered writing a stored proc that runs "delete from *tablename*;" for each table that is to be cle...
In the TearDown of my UnitTests, I mostly do this: ``` using( ISession s = ... ) { s.Delete ("from Object o"); s.Flush(); } ``` This should delete all entities. If you want to delete all instances of one specific entity, you can do this: ``` using( ISession s = .... ) { s.Delete ("from MyEntityName e"); ...
490,963
<p>I'd like to have a routing rule that accepted part of my domain name as a parameter. For example:</p> <pre><code>{name}.mydomain.com/photos/{id} </code></pre> <p>Is this even possible?</p>
[ { "answer_id": 490975, "author": "Frederik Gheysels", "author_id": 55774, "author_profile": "https://Stackoverflow.com/users/55774", "pm_score": 6, "selected": true, "text": "<p>In the TearDown of my UnitTests, I mostly do this:</p>\n\n<pre><code>using( ISession s = ... )\n{\n s.Delete...
2009/01/29
[ "https://Stackoverflow.com/questions/490963", "https://Stackoverflow.com", "https://Stackoverflow.com/users/60117/" ]
I'd like to have a routing rule that accepted part of my domain name as a parameter. For example: ``` {name}.mydomain.com/photos/{id} ``` Is this even possible?
In the TearDown of my UnitTests, I mostly do this: ``` using( ISession s = ... ) { s.Delete ("from Object o"); s.Flush(); } ``` This should delete all entities. If you want to delete all instances of one specific entity, you can do this: ``` using( ISession s = .... ) { s.Delete ("from MyEntityName e"); ...
491,000
<p>In C++, I have a class A which is friend with a class B.</p> <p>I looks like inherited classes of B are not friend of class A.</p> <p>I this a limitation of C++ or my mistake ?</p> <p>Here is an example. When compiling, I get an error on line "return new Memento":</p> <p>Memento::Memento : impossible to access p...
[ { "answer_id": 491033, "author": "sth", "author_id": 56338, "author_profile": "https://Stackoverflow.com/users/56338", "pm_score": 3, "selected": false, "text": "<p>Friendship is not inherited, you have to explicitly declare every friend relationship. (See also \"<a href=\"http://www.par...
2009/01/29
[ "https://Stackoverflow.com/questions/491000", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2796/" ]
In C++, I have a class A which is friend with a class B. I looks like inherited classes of B are not friend of class A. I this a limitation of C++ or my mistake ? Here is an example. When compiling, I get an error on line "return new Memento": Memento::Memento : impossible to access private member declared in Memen...
See: [Friend scope in C++](https://stackoverflow.com/questions/437250/friend-scope-in-c/437507) Voted exact duplicate. ``` I looks like inherited classes of B are not friend of class A. ``` Correct ``` I this a limitation of C++ or my mistake ? ``` It is the way C++ works. I don't see it as a limitation.
491,005
<p>I have a JTable created from Vector. How can the JTable be refreshed to display new data that is added to the Vector?</p>
[ { "answer_id": 491028, "author": "tddmonkey", "author_id": 51577, "author_profile": "https://Stackoverflow.com/users/51577", "pm_score": 4, "selected": false, "text": "<p>Your JTable should update automatically when a change to the TableModel happens. I'm taking a leap here but I'm gues...
2009/01/29
[ "https://Stackoverflow.com/questions/491005", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a JTable created from Vector. How can the JTable be refreshed to display new data that is added to the Vector?
Your JTable should update automatically when a change to the TableModel happens. I'm taking a leap here but I'm guessing that you're not using your own TableModel and just called the JTable constructor with your Vector. In this case you can get a hook on the TableModel and cast it to a DefaultTableModel and then call o...
491,007
<p>I am currently developing an EJB 3.0 based application on the JBoss AS 5.0.0.GA and just recently the following warning showed up in the server log:</p> <pre> 09:50:19,735 WARN [InterceptorsFactory] EJBTHREE-1246: Do not use InterceptorsFactory with a ManagedObjectAdvisor, InterceptorRegistry should be used via th...
[ { "answer_id": 896603, "author": "Richard Kettelerij", "author_id": 99795, "author_profile": "https://Stackoverflow.com/users/99795", "pm_score": 3, "selected": false, "text": "<p>Even the JBoss EJB3 tutorial/documentation says you can safely ignore these warnings. Well if everyone can i...
2009/01/29
[ "https://Stackoverflow.com/questions/491007", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27011/" ]
I am currently developing an EJB 3.0 based application on the JBoss AS 5.0.0.GA and just recently the following warning showed up in the server log: ``` 09:50:19,735 WARN [InterceptorsFactory] EJBTHREE-1246: Do not use InterceptorsFactory with a ManagedObjectAdvisor, InterceptorRegistry should be used via the bean c...
As far as I understand all the available sources on this warning, it is nothing a user of JBoss 5 can do anything about and is essentially just a reminder for the developers of JBoss that they use their own classes wrong. Following the advice from the developers, I am now ignoring it by changing my logging configurati...
491,023
<p>I'm working on maintenance of a .NET project, and I'm having some troubles which I'll gladly share with you guys =)</p> <p>The problem code:</p> <pre><code>if( evilDict.Count &lt; 1 ) { foreach (Item item in GetAnotherDict()) if (!evilDict.containsKey(item.name.ToLower().Trim())) evilDict.a...
[ { "answer_id": 491034, "author": "Sani Singh Huttunen", "author_id": 26742, "author_profile": "https://Stackoverflow.com/users/26742", "pm_score": 1, "selected": false, "text": "<p>Shouldn't </p>\n\n<pre><code>if (!evilDict.contains(item.name.ToLower().Trim()))\n</code></pre>\n\n<p>be ...
2009/01/29
[ "https://Stackoverflow.com/questions/491023", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18673/" ]
I'm working on maintenance of a .NET project, and I'm having some troubles which I'll gladly share with you guys =) The problem code: ``` if( evilDict.Count < 1 ) { foreach (Item item in GetAnotherDict()) if (!evilDict.containsKey(item.name.ToLower().Trim())) evilDict.add(item.name.ToLower().T...
If you suspect you have concurrency problems accessing the dictionary then your fix won't be of any use. It will solve the specific problem you are experiencing, however if you have concurrent access to the dictionary you are going to have more problems in the future. Consider locking the access to the dictionary when...
491,026
<p>I have a project which has as maven dependency a jar file which includes a xml file where I stored my rules for checkstyle. I thought it would be ok to just use this configuration:</p> <pre><code>&lt;configLocation&gt;mycheckstyle.xml&lt;/configLocation&gt; </code></pre> <p>My understanding is that the file should b...
[ { "answer_id": 491068, "author": "Romain Linsolas", "author_id": 26457, "author_profile": "https://Stackoverflow.com/users/26457", "pm_score": 0, "selected": false, "text": "<p>As explained in the <a href=\"http://maven.apache.org/plugins/maven-checkstyle-plugin/checkstyle-mojo.html#conf...
2009/01/29
[ "https://Stackoverflow.com/questions/491026", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48402/" ]
I have a project which has as maven dependency a jar file which includes a xml file where I stored my rules for checkstyle. I thought it would be ok to just use this configuration: ``` <configLocation>mycheckstyle.xml</configLocation> ``` My understanding is that the file should be searched on the classpath and my j...
Try adding a dependencies section to your plugin configuration. E.g., ``` <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId> <dependencies> <dependency> <groupId>com.example.whizbang</groupId> <artifactId>build-tools</artifactId> ...
491,046
<p>I get the following error message trying to run my page</p> <pre><code>Compiler Error Message: CS0433: The type 'usercontrols_BirthDetails' exists in both 'c:\windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\5c377e82\1f883022\App_Web_ub0hcxgl.dll' and 'c:\windows\Microsoft.NET\Framework\v2.0....
[ { "answer_id": 491202, "author": "tsimon", "author_id": 1685, "author_profile": "https://Stackoverflow.com/users/1685", "pm_score": 2, "selected": false, "text": "<p>I've had this happen on my dev machine a number of times, but I've never known it to happen on a server. And, I'm a coder,...
2009/01/29
[ "https://Stackoverflow.com/questions/491046", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33052/" ]
I get the following error message trying to run my page ``` Compiler Error Message: CS0433: The type 'usercontrols_BirthDetails' exists in both 'c:\windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\5c377e82\1f883022\App_Web_ub0hcxgl.dll' and 'c:\windows\Microsoft.NET\Framework\v2.0.50727\Temporar...
Well, I did solve the problem, but the root cause was something else... Apparently it had something to do with declaring a variable of my usercontrol's type. For some reason this wasn't agreeing with ASP.Net on the server (though it was well-digested on my own machine)... I don't have any idea why exactly this was happ...