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
495,644
<p>I am new to JavaScript. My requirement is that T want to pop up a message on particular days (like Sunday, Monday...) all through when a date is selected.</p> <p>I tried <code>getday()</code> function but it didn't work. Please suggest how to do this.</p>
[ { "answer_id": 495659, "author": "Kieron", "author_id": 588, "author_profile": "https://Stackoverflow.com/users/588", "pm_score": 4, "selected": false, "text": "<pre><code>var date = new Date();\nvar day = date.getDay();\n</code></pre>\n\n<p><code>day</code> now holds a number from zero ...
2009/01/30
[ "https://Stackoverflow.com/questions/495644", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I am new to JavaScript. My requirement is that T want to pop up a message on particular days (like Sunday, Monday...) all through when a date is selected. I tried `getday()` function but it didn't work. Please suggest how to do this.
``` var date = new Date(); var day = date.getDay(); ``` `day` now holds a number from zero to six; zero is Sunday, one is Monday, and so on. So all that remains is to translate that number into the English (or whatever other language) string for the day name: ``` var name = ["Sunday","Monday","Tuesday","Wednesday",...
495,647
<p>Expanding upon my <a href="https://stackoverflow.com/questions/489173/writing-xml-with-c">earlier problem</a>, I've decided to (de)serialize my config file class which worked great. </p> <p>I now want to store an associative array of drive letters to map (key is the drive letter, value is the network path) and have...
[ { "answer_id": 495679, "author": "David Schmitt", "author_id": 4918, "author_profile": "https://Stackoverflow.com/users/4918", "pm_score": 3, "selected": false, "text": "<p>Dictionaries and Hashtables are not serializable with <code>XmlSerializer</code>. Therefore you cannot use them dir...
2009/01/30
[ "https://Stackoverflow.com/questions/495647", "https://Stackoverflow.com", "https://Stackoverflow.com/users/204/" ]
Expanding upon my [earlier problem](https://stackoverflow.com/questions/489173/writing-xml-with-c), I've decided to (de)serialize my config file class which worked great. I now want to store an associative array of drive letters to map (key is the drive letter, value is the network path) and have tried using `Diction...
You can't serialize a class that implements IDictionary. Check out this [link](http://msdn.microsoft.com/en-us/library/ms950721.aspx). > > Q: Why can't I serialize hashtables? > > > A: The XmlSerializer cannot process > classes implementing the IDictionary > interface. This was partly due to > schedule constrain...
495,662
<p>I have a huge set of arbitrary natural language strings. For my tool to analyze them I need to convert each string to unique color value (RGB or other). I need color contrast to depend on string similarity (the more string is different from other, the more their respective colors should be different). Would be perfe...
[ { "answer_id": 495693, "author": "Yngve Sneen Lindal", "author_id": 59943, "author_profile": "https://Stackoverflow.com/users/59943", "pm_score": 0, "selected": false, "text": "<p>I would maybe define some delta between two strings. I don't know what you define as the difference (or \"un...
2009/01/30
[ "https://Stackoverflow.com/questions/495662", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6236/" ]
I have a huge set of arbitrary natural language strings. For my tool to analyze them I need to convert each string to unique color value (RGB or other). I need color contrast to depend on string similarity (the more string is different from other, the more their respective colors should be different). Would be perfect ...
You need to elaborate more on what you mean by "similar strings" in order to come up with an appropriate conversion function. Are the strings ``` "I am going to the store" and "We are going to the store" ``` considered similar? What about the strings ``` "I am going to the store" and "J bn hpjoh up uif tupsf...
495,666
<p>I have a winform with a listbox and a treeview. </p> <p>Once my listbox is filled with items, I want to drag them (multiple or single) from the listbox and drop them in a node in the treeview. </p> <p>If somebody has a good example in C# that would be great.</p>
[ { "answer_id": 495715, "author": "arul", "author_id": 15409, "author_profile": "https://Stackoverflow.com/users/15409", "pm_score": 2, "selected": false, "text": "<p>You want to use the GetItemAt(Point point) function to translate X,Y location to the listview item.</p>\n\n<p>Here's quite...
2009/01/30
[ "https://Stackoverflow.com/questions/495666", "https://Stackoverflow.com", "https://Stackoverflow.com/users/60572/" ]
I have a winform with a listbox and a treeview. Once my listbox is filled with items, I want to drag them (multiple or single) from the listbox and drop them in a node in the treeview. If somebody has a good example in C# that would be great.
It's been a while since I've messed with Drag/Drop so I figured I'll write a quick sample. Basically, I have a form, with a listbox on the left, and a treeview on the right. Then I put a button on top. When the button is clicked, it just puts the date of the next ten days into the list box. It also populates the TreeV...
495,674
<p>I have a snippet of code that prints text from a file to a JTextArea called textArea.</p> <p>Unfortunately the method I'm using goes line by line (not ideal) and so I have to append each line with a \n</p> <p>This is fine for now but a new line is created at the end.</p> <p>The code I have is as follows:</p> <pr...
[ { "answer_id": 495685, "author": "Shawn", "author_id": 26, "author_profile": "https://Stackoverflow.com/users/26", "pm_score": 1, "selected": false, "text": "<p>How about </p>\n\n<pre><code>if (textArea.length &gt; 0) textArea.Text = textArea.Text.Substring(0 ,textArea.Text.Length - 1)\n...
2009/01/30
[ "https://Stackoverflow.com/questions/495674", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a snippet of code that prints text from a file to a JTextArea called textArea. Unfortunately the method I'm using goes line by line (not ideal) and so I have to append each line with a \n This is fine for now but a new line is created at the end. The code I have is as follows: ``` class menuOpen implements A...
how about: ``` text.substring(0,text.lastIndexOf('\n')); ```
495,700
<p>I want to check if SQL Server(2000/05/08) has the ability to write a nested stored procedure, what I meant is - WRITING a Sub Function/procedure inside another stored procedure. NOT calling another SP. </p> <p>Why I was thinking about it is- One of my SP is having a repeated lines of code and that is specific to on...
[ { "answer_id": 495707, "author": "andynormancx", "author_id": 46354, "author_profile": "https://Stackoverflow.com/users/46354", "pm_score": 2, "selected": false, "text": "<p>It does not have that feature. It is hard to see what real benefit such a feature would provide, apart from stoppi...
2009/01/30
[ "https://Stackoverflow.com/questions/495700", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I want to check if SQL Server(2000/05/08) has the ability to write a nested stored procedure, what I meant is - WRITING a Sub Function/procedure inside another stored procedure. NOT calling another SP. Why I was thinking about it is- One of my SP is having a repeated lines of code and that is specific to only this SP...
I don't recommend doing this as each time it is created a new execution plan must be calculated, but YES, it definitely can be done (Everything is possible, but not always recommended). Here is an example: ``` CREATE PROC [dbo].[sp_helloworld] AS BEGIN SELECT 'Hello World' DECLARE @sSQL VARCHAR(1000) SET ...
495,704
<p>I'm getting into dynamic data sites (remarkably powerful), and enjoying it. However, I have a requirement that I can't seem to meet. I have a self-joined category table (Id, Name, ParentId) to create a hierarchical category structure (e.g. the categories with null ids are top level, usual sort of thing). I then have...
[ { "answer_id": 495707, "author": "andynormancx", "author_id": 46354, "author_profile": "https://Stackoverflow.com/users/46354", "pm_score": 2, "selected": false, "text": "<p>It does not have that feature. It is hard to see what real benefit such a feature would provide, apart from stoppi...
2009/01/30
[ "https://Stackoverflow.com/questions/495704", "https://Stackoverflow.com", "https://Stackoverflow.com/users/58982/" ]
I'm getting into dynamic data sites (remarkably powerful), and enjoying it. However, I have a requirement that I can't seem to meet. I have a self-joined category table (Id, Name, ParentId) to create a hierarchical category structure (e.g. the categories with null ids are top level, usual sort of thing). I then have a ...
I don't recommend doing this as each time it is created a new execution plan must be calculated, but YES, it definitely can be done (Everything is possible, but not always recommended). Here is an example: ``` CREATE PROC [dbo].[sp_helloworld] AS BEGIN SELECT 'Hello World' DECLARE @sSQL VARCHAR(1000) SET ...
495,719
<p>I added a linked server, which is showing in the linked server list, but when I query it, it throws an error with the db server name. </p> <pre><code>EXEC sp_helpserver EXEC sp_addlinkedserver 'aa-db-dev01' Select * from openquery('aa-db-dev01','Select * from TestDB.dbo.users') </code></pre> <blockquote> <p>Msg ...
[ { "answer_id": 495742, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 6, "selected": false, "text": "<pre><code>SELECT * FROM [server].[database].[schema].[table]\n</code></pre>\n\n<p>This works for me. SSMS intellisense may st...
2009/01/30
[ "https://Stackoverflow.com/questions/495719", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I added a linked server, which is showing in the linked server list, but when I query it, it throws an error with the db server name. ``` EXEC sp_helpserver EXEC sp_addlinkedserver 'aa-db-dev01' Select * from openquery('aa-db-dev01','Select * from TestDB.dbo.users') ``` > > Msg 102, Level 15, State 1, Line 1 > ...
``` SELECT * FROM [server].[database].[schema].[table] ``` This works for me. SSMS intellisense may still underline this as a syntax error, but it should work if your linked server is configured and your query is otherwise correct.
495,741
<p>I'm writing some Scala code which uses the <a href="http://en.wikipedia.org/wiki/Apache_POI" rel="noreferrer">Apache POI</a> API. I would like to iterate over the rows contained in the <code>java.util.Iterator</code> that I get from the Sheet class. I would like to use the iterator in a <code>for each</code> style l...
[ { "answer_id": 495974, "author": "Daniel Spiewak", "author_id": 9815, "author_profile": "https://Stackoverflow.com/users/9815", "pm_score": 4, "selected": false, "text": "<p>The correct answer here is to define an implicit conversion from Java's <code>Iterator</code> to some custom type....
2009/01/30
[ "https://Stackoverflow.com/questions/495741", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16744/" ]
I'm writing some Scala code which uses the [Apache POI](http://en.wikipedia.org/wiki/Apache_POI) API. I would like to iterate over the rows contained in the `java.util.Iterator` that I get from the Sheet class. I would like to use the iterator in a `for each` style loop, so I have been trying to convert it to a native ...
There is a wrapper class (`scala.collection.jcl.MutableIterator.Wrapper`). So if you define ``` implicit def javaIteratorToScalaIterator[A](it : java.util.Iterator[A]) = new Wrapper(it) ``` then it will act as a sub class of the Scala iterator so you can do `foreach`.
495,744
<p>I would like to import a time-series where the first field indicates a period:</p> <pre><code>08:00-08:15 08:15-08:30 08:30-08:45 </code></pre> <p>Does R have any features to do this neatly?</p> <p>Thanks!</p> <hr> <p><strong>Update:</strong></p> <p>The most promising solution I found, as suggested by Godeke w...
[ { "answer_id": 495862, "author": "Godeke", "author_id": 28006, "author_profile": "https://Stackoverflow.com/users/28006", "pm_score": 2, "selected": false, "text": "<p>CRAN shows a package that is actively updated called \"chron\" that handles dates. You might want to check that and some...
2009/01/30
[ "https://Stackoverflow.com/questions/495744", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12677/" ]
I would like to import a time-series where the first field indicates a period: ``` 08:00-08:15 08:15-08:30 08:30-08:45 ``` Does R have any features to do this neatly? Thanks! --- **Update:** The most promising solution I found, as suggested by Godeke was the cron package and using substring() to extract the star...
So you're given a character vector like `c("08:00-08:15",08:15-08:30)` and you want to convert to an internal R data type for consistency? Check out the help files for POSIXt and strftime. How about a function like this: ``` importTimes <- function(t){ t <- strsplit(t,"-") return(lapply(t,strptime,format="%...
495,761
<p>This is one of the most used Regex functions</p> <pre><code>Regex.IsMatch("Test text for regex test.", "(test)", RegexOptions.IgnoreCase | RegexOptions.Multiline); </code></pre> <p>Can you explain how Regex.IsMatch method works ? I mean how it handles bitwise OR RegexOptions parameters ? How it defines method par...
[ { "answer_id": 495778, "author": "Sean Bright", "author_id": 21926, "author_profile": "https://Stackoverflow.com/users/21926", "pm_score": 4, "selected": true, "text": "<p><code>RegexOptions</code> is an enumeration with the <code>[Flags]</code> attribute applied to it. This allows bitw...
2009/01/30
[ "https://Stackoverflow.com/questions/495761", "https://Stackoverflow.com", "https://Stackoverflow.com/users/55351/" ]
This is one of the most used Regex functions ``` Regex.IsMatch("Test text for regex test.", "(test)", RegexOptions.IgnoreCase | RegexOptions.Multiline); ``` Can you explain how Regex.IsMatch method works ? I mean how it handles bitwise OR RegexOptions parameters ? How it defines method parameters ? Thanks for repl...
`RegexOptions` is an enumeration with the `[Flags]` attribute applied to it. This allows bitwise operations to be applied to the various values. You can also do something similar: ``` [Flags] enum MyOptions { UpperCase = 1, Reverse = 2, Trim = 4 } public static void DoTransform(MyOptions options) { ...
495,762
<p>I am relatively new to arena of emails. Just drilling out tutorial by tutorial about email internals. My requirement is I need to send emails and receive emails from my webhost. For this to happen, I need an smtp server(daemon) running right? I recently studied about MTAs, which are responsible for transferring emai...
[ { "answer_id": 495778, "author": "Sean Bright", "author_id": 21926, "author_profile": "https://Stackoverflow.com/users/21926", "pm_score": 4, "selected": true, "text": "<p><code>RegexOptions</code> is an enumeration with the <code>[Flags]</code> attribute applied to it. This allows bitw...
2009/01/30
[ "https://Stackoverflow.com/questions/495762", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45629/" ]
I am relatively new to arena of emails. Just drilling out tutorial by tutorial about email internals. My requirement is I need to send emails and receive emails from my webhost. For this to happen, I need an smtp server(daemon) running right? I recently studied about MTAs, which are responsible for transferring emails ...
`RegexOptions` is an enumeration with the `[Flags]` attribute applied to it. This allows bitwise operations to be applied to the various values. You can also do something similar: ``` [Flags] enum MyOptions { UpperCase = 1, Reverse = 2, Trim = 4 } public static void DoTransform(MyOptions options) { ...
495,764
<p>I have an array:</p> <pre><code>data.Dealer.car[0] data.Dealer.car[1] data.Dealer.car[2] </code></pre> <p>If I do this:</p> <pre><code>alert(data.Dealer.car.length); delete data.Dealer.car[1]; alert(data.Dealer.car.length); </code></pre> <p>It gives me the same count each time. Does the removed element still exi...
[ { "answer_id": 495780, "author": "Ray Hidayat", "author_id": 49643, "author_profile": "https://Stackoverflow.com/users/49643", "pm_score": 5, "selected": true, "text": "<p>JavaScript arrays aren't sparse, if you have a 0 and a 2, then element 1 must exist. Meaning the <code>length</code>...
2009/01/30
[ "https://Stackoverflow.com/questions/495764", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51582/" ]
I have an array: ``` data.Dealer.car[0] data.Dealer.car[1] data.Dealer.car[2] ``` If I do this: ``` alert(data.Dealer.car.length); delete data.Dealer.car[1]; alert(data.Dealer.car.length); ``` It gives me the same count each time. Does the removed element still exist?
JavaScript arrays aren't sparse, if you have a 0 and a 2, then element 1 must exist. Meaning the `length` is going to be 3.
495,767
<p>I have no idea why this is happening. I have some very straightforward code, replicated below, which works fine in all browsers except for IE 7 &amp; 8. In those browsers, trying to expand the list of options in the select triggers the built-in Pop-up blocker bar. </p> <p>What gives?</p> <pre><code>&lt;!DOCTYPE...
[ { "answer_id": 500867, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "<p>Hm... Strange. Seems to be a problem inside your browser/popup blocker...\nWhat about selects on other websites? Do they wo...
2009/01/30
[ "https://Stackoverflow.com/questions/495767", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32154/" ]
I have no idea why this is happening. I have some very straightforward code, replicated below, which works fine in all browsers except for IE 7 & 8. In those browsers, trying to expand the list of options in the select triggers the built-in Pop-up blocker bar. What gives? ``` <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML...
You said "I am using TredoSoft MultipleIEs " I am having the EXACT same problem, and I am using Internet Explorer Collection to run multiple versions on one pc. Therefore, I conclude the problem is with Multiple IEs on a single machine!! Hope this helps people, for your response helped me.
495,776
<p>We are localising the user-interface text for a web application that runs on Java 5, and have a dilemma about how we output messages that are defined in properties files - the kind used by <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Properties.html" rel="noreferrer">java.util.Properties</a>.</p> <p>S...
[ { "answer_id": 495829, "author": "Boris Pavlović", "author_id": 32090, "author_profile": "https://Stackoverflow.com/users/32090", "pm_score": 3, "selected": true, "text": "<p>Just write your own implementation of MessageFormat without this annoying feature. You may look at the code of <a...
2009/01/30
[ "https://Stackoverflow.com/questions/495776", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2670/" ]
We are localising the user-interface text for a web application that runs on Java 5, and have a dilemma about how we output messages that are defined in properties files - the kind used by [java.util.Properties](http://java.sun.com/j2se/1.5.0/docs/api/java/util/Properties.html). Some messages include a placeholder tha...
Just write your own implementation of MessageFormat without this annoying feature. You may look at the code of [SLF4J Logger](http://www.slf4j.org/api/org/slf4j/Logger.html). They have their own version of message formatter which can be used as followed: ``` logger.debug("Temperature set to {}. Old temperature was {}...
495,798
<p>How can I allow the users of my program to type in a value and have it auto-complete, however, I also what to prevent them from entering new data because it would cause the data to be unfindable (unless you had direct access to the database).</p> <p>Does anyone know how to do this?</p> <p>The reasoning behind not ...
[ { "answer_id": 495950, "author": "BFree", "author_id": 15861, "author_profile": "https://Stackoverflow.com/users/15861", "pm_score": 1, "selected": false, "text": "<p>OK, here's what I came up with. Hack? Maybe, but hey, it works. I just filled the combobox with the days of the week (hey...
2009/01/30
[ "https://Stackoverflow.com/questions/495798", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12243/" ]
How can I allow the users of my program to type in a value and have it auto-complete, however, I also what to prevent them from entering new data because it would cause the data to be unfindable (unless you had direct access to the database). Does anyone know how to do this? The reasoning behind not using just a drop...
Kudos to BFree for the help, but this is the solution I was looking for. The ComboBox is using a DataSet as it's source so it's not a custom source. ``` protected virtual void comboBoxAutoComplete_KeyPress(object sender, KeyPressEventArgs e) { if (Char.IsControl(e.KeyChar)) { //let it go if it'...
495,814
<p>I need to produce a SQL report showing the number of times a particular event happened in each hourly period during the day. My table has a date/time column on it containing the time the event occurred.</p> <p>How do I do a count of the number of rows that fall within each each hourly period during the day?</p> <p...
[ { "answer_id": 495821, "author": "Sean Bright", "author_id": 21926, "author_profile": "https://Stackoverflow.com/users/21926", "pm_score": 3, "selected": true, "text": "<pre><code>SELECT DATEPART(hh, DateTimeColumn), COUNT(*)\nFROM\n TableName\nGROUP BY\n DATEPART(hh, DateTimeColum...
2009/01/30
[ "https://Stackoverflow.com/questions/495814", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1127460/" ]
I need to produce a SQL report showing the number of times a particular event happened in each hourly period during the day. My table has a date/time column on it containing the time the event occurred. How do I do a count of the number of rows that fall within each each hourly period during the day? So I need to see...
``` SELECT DATEPART(hh, DateTimeColumn), COUNT(*) FROM TableName GROUP BY DATEPART(hh, DateTimeColumn) ORDER BY DATEPART(hh, DateTimeColumn) ```
495,841
<p>I edited the question after David Hanak's answer (thanks btw!). He helped with the syntax, but it appears that I wasn't using the right function to begin with.</p> <p>Basically what I want is to let the compiler ignore multiple definitions of a certain label and just use the first. In order to do that, I thought I'...
[ { "answer_id": 495872, "author": "David Hanak", "author_id": 42136, "author_profile": "https://Stackoverflow.com/users/42136", "pm_score": 4, "selected": true, "text": "<p><code>@</code> is a special character in LaTeX. To make your declaration syntactically correct, you'll have to add ...
2009/01/30
[ "https://Stackoverflow.com/questions/495841", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48648/" ]
I edited the question after David Hanak's answer (thanks btw!). He helped with the syntax, but it appears that I wasn't using the right function to begin with. Basically what I want is to let the compiler ignore multiple definitions of a certain label and just use the first. In order to do that, I thought I'd just do ...
`@` is a special character in LaTeX. To make your declaration syntactically correct, you'll have to add two more lines: ``` \makeatletter \newcommand{\mylabel}[1]{ \@ifundefined{#1}{\label{#1}}{X} } \makeatother ``` The first line turns `@` into a normal letter, the last line reverses its effect. **Update:** Yo...
495,852
<p>Why does (string)int32 always throw: Cannot convert type 'int' to 'string'</p> <pre><code>public class Foo { private int FooID; public Foo() { FooID = 4; string s = (string)FooID; //throws compile error string sss = FooID.ToString(); //no compile er...
[ { "answer_id": 495856, "author": "mqp", "author_id": 55943, "author_profile": "https://Stackoverflow.com/users/55943", "pm_score": 5, "selected": false, "text": "<p>Because there is no type conversion defined from Int32 to string. That's what the ToString method is for.</p>\n" }, { ...
2009/01/30
[ "https://Stackoverflow.com/questions/495852", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45809/" ]
Why does (string)int32 always throw: Cannot convert type 'int' to 'string' ``` public class Foo { private int FooID; public Foo() { FooID = 4; string s = (string)FooID; //throws compile error string sss = FooID.ToString(); //no compile error } ...
Because there is no type conversion defined from Int32 to string. That's what the ToString method is for.
495,853
<p>Say I have a method like this (stolen from a previous SO answer by Jon Skeet):</p> <pre><code>public static IEnumerable&lt;TSource&gt; DuplicatesBy&lt;TSource, TKey&gt; (this IEnumerable&lt;TSource&gt; source, Func&lt;TSource, TKey&gt; keySelector) { HashSet&lt;TKey&gt; seenKeys = new HashSet&lt;TKey&gt;();...
[ { "answer_id": 495887, "author": "mqp", "author_id": 55943, "author_profile": "https://Stackoverflow.com/users/55943", "pm_score": 1, "selected": false, "text": "<p>Well, garbage collection doesn't collect it <em>right away</em>. It can't, obviously.</p>\n\n<p>Internally, when you do so...
2009/01/30
[ "https://Stackoverflow.com/questions/495853", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42124/" ]
Say I have a method like this (stolen from a previous SO answer by Jon Skeet): ``` public static IEnumerable<TSource> DuplicatesBy<TSource, TKey> (this IEnumerable<TSource> source, Func<TSource, TKey> keySelector) { HashSet<TKey> seenKeys = new HashSet<TKey>(); foreach (TSource element in source) { ...
The compiler generates a hidden class to implement this code. It has a super-secret name: "d\_\_0`2". Your seenKeys and source variables become fields of that class, ensuring that they can't get garbage collected unless the class object is collected. The class implements the IEnumerator<> interface, the client code th...
495,864
<p>When databinding my xaml to some data I often use the "get" part of a property to do some logic. Like giving to sum of totals of a list or a check if something is positive.</p> <p>For example:</p> <pre><code>public List&lt;SomeClass&gt; ListOfSomeClass{get;set;} public double SumOfSomeClass { get { return...
[ { "answer_id": 495870, "author": "Sergio", "author_id": 32037, "author_profile": "https://Stackoverflow.com/users/32037", "pm_score": 1, "selected": false, "text": "<p>I say yes, but try to store on a private variable de results of ListOfSomeClass.Sum(s => s.Totals). Specially if you us...
2009/01/30
[ "https://Stackoverflow.com/questions/495864", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31722/" ]
When databinding my xaml to some data I often use the "get" part of a property to do some logic. Like giving to sum of totals of a list or a check if something is positive. For example: ``` public List<SomeClass> ListOfSomeClass{get;set;} public double SumOfSomeClass { get { return ListOfSomeClass.Sum(s => s...
Property getters are expected to be fast and idempotent (i.e. no destructive actions should be performed there). Though it's perfectly fine to iterate over an in-memory collection of objects, I wouldn't recomment doing any kind of heavy lifting in either *get* or *set* parts. And speaking of iterating, I'd still cache ...
495,867
<pre><code> using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication3Generics { class Program { static void Main(string[] args) { ScheduleSelectedItems sitems = new ScheduleSelectedItems("Yusuf"); ScheduleSelectedItemsList slist = n...
[ { "answer_id": 495873, "author": "BFree", "author_id": 15861, "author_profile": "https://Stackoverflow.com/users/15861", "pm_score": 4, "selected": false, "text": "<pre><code>public class ScheduleSelectedItems\n {\n private string Ad;\n\n public ScheduleSelectedItems(str...
2009/01/30
[ "https://Stackoverflow.com/questions/495867", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52420/" ]
``` using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication3Generics { class Program { static void Main(string[] args) { ScheduleSelectedItems sitems = new ScheduleSelectedItems("Yusuf"); ScheduleSelectedItemsList slist = new Sche...
``` public class ScheduleSelectedItems { private string Ad; public ScheduleSelectedItems(string ad) { Ad = ad; } public override string ToString() { return this.Ad; } } ```
495,893
<p><strong>Note</strong> I'm running windows, the path just looks like it's linus because I typed it manually and thats how I think of paths.</p> <p>I'm trying to run a java class That I have built to diagnose my connection to a databse, it references the oracle jdbc adaptor.</p> <p>When I just run it without a class...
[ { "answer_id": 495911, "author": "Boris Pavlović", "author_id": 32090, "author_profile": "https://Stackoverflow.com/users/32090", "pm_score": 1, "selected": false, "text": "<p>is there a typo:</p>\n\n<pre><code>%&gt; java -classpath .:ojdbc6.jar DBDiagnostics &lt;connectionString&gt;\n</...
2009/01/30
[ "https://Stackoverflow.com/questions/495893", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20400/" ]
**Note** I'm running windows, the path just looks like it's linus because I typed it manually and thats how I think of paths. I'm trying to run a java class That I have built to diagnose my connection to a databse, it references the oracle jdbc adaptor. When I just run it without a class path: ``` %> java DBDiagnost...
Replace the colon with a semicolon: ``` java -classpath .;ojdbc6.jar DBDiagnostics <connectionString> ```
495,955
<p>is there any way to get the ASP.NET validation summary control to just display the HeaderText when there is a validation error?</p> <p>Basically what I want is for just a simple message like "Please complete all fields marked *" to appear next to the submit button. As I'm using "*" for the error message on the vali...
[ { "answer_id": 495998, "author": "Phaedrus", "author_id": 46072, "author_profile": "https://Stackoverflow.com/users/46072", "pm_score": 0, "selected": false, "text": "<p>You could use a CustomValidator and set the ClientValidationFunction property to execute a JavaScript function that wo...
2009/01/30
[ "https://Stackoverflow.com/questions/495955", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
is there any way to get the ASP.NET validation summary control to just display the HeaderText when there is a validation error? Basically what I want is for just a simple message like "Please complete all fields marked \*" to appear next to the submit button. As I'm using "\*" for the error message on the validators I...
Set each validators **Text** to "\*" and **ErrorMessage** to an empty string. ``` <form id="form2" runat="server"> Name:<br /> <asp:TextBox ID="NameTextBox" runat="server" /> <asp:RequiredFieldValidator ID="NameTextBoxRequiredValidator" ControlToValidate="NameTextBox" ErrorMessage="" Text="*" r...
495,979
<p>Is it possible to explicitly set the id of a domain object in Grails' Bootstrap.groovy (or anywhere, for that matter)?</p> <p>I've tried the following:</p> <pre><code>new Foo(id: 1234, name: "My Foo").save() </code></pre> <p>and:</p> <pre><code>def foo = new Foo() foo.id = 1234 foo.name = "My Foo" foo.save() </c...
[ { "answer_id": 498145, "author": "chanwit", "author_id": 60903, "author_profile": "https://Stackoverflow.com/users/60903", "pm_score": 4, "selected": true, "text": "<p>Yes, with manually GORM mapping:</p>\n\n<pre><code>class Foo {\n String name\n static mapping = {\n id generator:'a...
2009/01/30
[ "https://Stackoverflow.com/questions/495979", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29995/" ]
Is it possible to explicitly set the id of a domain object in Grails' Bootstrap.groovy (or anywhere, for that matter)? I've tried the following: ``` new Foo(id: 1234, name: "My Foo").save() ``` and: ``` def foo = new Foo() foo.id = 1234 foo.name = "My Foo" foo.save() ``` But in both cases, when I print out the r...
Yes, with manually GORM mapping: ``` class Foo { String name static mapping = { id generator:'assigned' } } ``` and your second snippet (not the first one) will do the job (Id won't be assigned when passing it through constructor).
495,988
<p>I've got a query that returns the cost of wages for a given member of staff</p> <pre><code>SELECT totalhours * staffbaserate AS TotalCost FROM newrotaRaw WHERE staffref = @staffref </code></pre> <p>However I need to do an additional bit of maths if the returned value is > 105. The bit of maths I ne...
[ { "answer_id": 496001, "author": "Quassnoi", "author_id": 55159, "author_profile": "https://Stackoverflow.com/users/55159", "pm_score": 1, "selected": false, "text": "<pre><code>SELECT totalhours * staffbaserate * (CASE WHEN (totalhours * staffbaserate) &lt; 105 THEN 1 ELSE 1.128 END)...
2009/01/30
[ "https://Stackoverflow.com/questions/495988", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26126/" ]
I've got a query that returns the cost of wages for a given member of staff ``` SELECT totalhours * staffbaserate AS TotalCost FROM newrotaRaw WHERE staffref = @staffref ``` However I need to do an additional bit of maths if the returned value is > 105. The bit of maths I need to do is that if the va...
Try something like this. ``` SELECT TotalCost = CASE WHEN (totalhours * staffbaserate) < 105 THEN (totalhours * staffbaserate) ELSE (totalhours * staffbaserate) * 1.128 END FROM newrotaRaw WHERE staffref = @staffref ```
496,026
<p>A while back I was trying to bruteforce a remote control which sent a 12 bit binary 'key'.</p> <p>The device I made worked, but was very slow as it was trying every combination at about 50 bits per second (4096 codes = 49152 bits = ~16 minutes)</p> <p>I opened the receiver and found it was using a shift register t...
[ { "answer_id": 496061, "author": "Chochos", "author_id": 10165, "author_profile": "https://Stackoverflow.com/users/10165", "pm_score": 0, "selected": false, "text": "<p>Off the top of my head, I suppose flipping one bit in each 12-bit sequence would take care of another 13 combinations, ...
2009/01/30
[ "https://Stackoverflow.com/questions/496026", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59754/" ]
A while back I was trying to bruteforce a remote control which sent a 12 bit binary 'key'. The device I made worked, but was very slow as it was trying every combination at about 50 bits per second (4096 codes = 49152 bits = ~16 minutes) I opened the receiver and found it was using a shift register to check the codes...
What you're talking about is a [de Bruijn sequence](http://en.wikipedia.org/wiki/De_Bruijn_sequence). If you don't care about how it works, you just want the result, [here it is](http://www.hakank.org/comb/debruijn.cgi?k=2&n=12&submit=Ok).
496,052
<p>I have a select control, and in a javascript variable I have a text string.</p> <p>Using jQuery I want to set the selected element of the select control to be the item with the text description I have (as opposed to the value, which I don't have).</p> <p>I know setting it by value is pretty trivial. e.g.</p> <pre...
[ { "answer_id": 496107, "author": "spoulson", "author_id": 3347, "author_profile": "https://Stackoverflow.com/users/3347", "pm_score": 7, "selected": false, "text": "<p>I haven't tested this, but this might work for you.</p>\n\n<pre><code>$(\"select#my-select option\")\n .each(function(...
2009/01/30
[ "https://Stackoverflow.com/questions/496052", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43965/" ]
I have a select control, and in a javascript variable I have a text string. Using jQuery I want to set the selected element of the select control to be the item with the text description I have (as opposed to the value, which I don't have). I know setting it by value is pretty trivial. e.g. ``` $("#my-select").val(m...
Select by description for jQuery v1.6+ -------------------------------------- ```js var text1 = 'Two'; $("select option").filter(function() { //may want to use $.trim in here return $(this).text() == text1; }).prop('selected', true); ``` ```html <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1...
496,053
<p>I've got an application that uses DirectShow/DirectSound which plays videos and extracts the video/sound. Running it on a server without a soundcard means the audio cannot be grabbed, is there a way around this? I look briefly at Virtual Audio Cable 4 but that doesn't seem to emulate a soundcard over a terminal sess...
[ { "answer_id": 496107, "author": "spoulson", "author_id": 3347, "author_profile": "https://Stackoverflow.com/users/3347", "pm_score": 7, "selected": false, "text": "<p>I haven't tested this, but this might work for you.</p>\n\n<pre><code>$(\"select#my-select option\")\n .each(function(...
2009/01/30
[ "https://Stackoverflow.com/questions/496053", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21299/" ]
I've got an application that uses DirectShow/DirectSound which plays videos and extracts the video/sound. Running it on a server without a soundcard means the audio cannot be grabbed, is there a way around this? I look briefly at Virtual Audio Cable 4 but that doesn't seem to emulate a soundcard over a terminal session...
Select by description for jQuery v1.6+ -------------------------------------- ```js var text1 = 'Two'; $("select option").filter(function() { //may want to use $.trim in here return $(this).text() == text1; }).prop('selected', true); ``` ```html <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1...
496,057
<p>I have an winform application that creates 5 threads to connect to and retrieve information from a database on a very slow connection (90 seconds for some queries).Each thread has it's own instance of a class for performing sql queries. When the queried data has been retrieved the main thread is notified by an event...
[ { "answer_id": 496129, "author": "TheSmurf", "author_id": 1975282, "author_profile": "https://Stackoverflow.com/users/1975282", "pm_score": 1, "selected": false, "text": "<p>Without knowing specifics, this leaves a bad taste in my mouth, too. I'm sure that it works. Whether it's dangerou...
2009/01/30
[ "https://Stackoverflow.com/questions/496057", "https://Stackoverflow.com", "https://Stackoverflow.com/users/54009/" ]
I have an winform application that creates 5 threads to connect to and retrieve information from a database on a very slow connection (90 seconds for some queries).Each thread has it's own instance of a class for performing sql queries. When the queried data has been retrieved the main thread is notified by an event fi...
Instead of spinning up your own threads you should take a look as the asynchronous methods for executing queries i.e. <http://msdn.microsoft.com/en-ca/library/system.data.sqlclient.sqlcommand.beginexecutereader.aspx> You mentioned that your connection is slow, is it a low bandwidth connection or a high latency connect...
496,065
<p>I had the following piece of code in a web app running on ASP.NET MVC Beta:</p> <pre><code>&lt;%= Html.DropDownList("Instances", new { style="width:270px;", onchange = "UpdateReport(this)" }) %&gt; </code></pre> <p>where "Instances" is a SelectList stored in ViewData, like so:</p> <pre><code>ViewData["Instances"]...
[ { "answer_id": 496140, "author": "Craig Quillen", "author_id": 18456, "author_profile": "https://Stackoverflow.com/users/18456", "pm_score": 1, "selected": false, "text": "<p>The Html.DropDownList signature has changed a bit in the RC. The 2nd parameter is now the SelectList object, not...
2009/01/30
[ "https://Stackoverflow.com/questions/496065", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23585/" ]
I had the following piece of code in a web app running on ASP.NET MVC Beta: ``` <%= Html.DropDownList("Instances", new { style="width:270px;", onchange = "UpdateReport(this)" }) %> ``` where "Instances" is a SelectList stored in ViewData, like so: ``` ViewData["Instances"] = new SelectList(instanceList, "Id", "Clie...
try this: ``` <%= Html.DropDownList("Instances", (SelectList)ViewData["Instances"], new { style="width:270px;", onchange = "UpdateReport(this)" }) %> ```
496,068
<p>I have problem with Login page.If i dont enter the Username or password it should say that"please enter a Username or password" instead its going to destination page i mean without entering anything in Login field if i hit submit button its going to welcome page actually which should not happen.</p> <p>Here is my c...
[ { "answer_id": 496100, "author": "Daniel Schaffer", "author_id": 2596, "author_profile": "https://Stackoverflow.com/users/2596", "pm_score": 3, "selected": false, "text": "<p>All of this functionality is already built in to ASP.NET.</p>\n\n<p>Check out <a href=\"http://msdn.microsoft.com...
2009/01/30
[ "https://Stackoverflow.com/questions/496068", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59637/" ]
I have problem with Login page.If i dont enter the Username or password it should say that"please enter a Username or password" instead its going to destination page i mean without entering anything in Login field if i hit submit button its going to welcome page actually which should not happen. Here is my code please...
All of this functionality is already built in to ASP.NET. Check out [RequiredFieldValidator](http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.requiredfieldvalidator.aspx) to validate your fields, or use [Login Controls](http://msdn.microsoft.com/en-us/library/ms178329.aspx) to handle all the form func...
496,070
<p>Example Query:</p> <pre><code>select * from A join B on A.ID = B.SOMEVALUE where A.VALUE="something" and B.ID = (select ID from B where SOMEVALUE = A.ID and THISDATE = (select max(SOMEDATE) from B where ...)) </code></pre> <p>so, if you can read SQL you should see that I am doing a couple c...
[ { "answer_id": 496094, "author": "brettkelly", "author_id": 60664, "author_profile": "https://Stackoverflow.com/users/60664", "pm_score": 0, "selected": false, "text": "<p>Why not use <code>LIMIT 1</code> at the end of your sub-select?</p>\n" }, { "answer_id": 496095, "author...
2009/01/30
[ "https://Stackoverflow.com/questions/496070", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32528/" ]
Example Query: ``` select * from A join B on A.ID = B.SOMEVALUE where A.VALUE="something" and B.ID = (select ID from B where SOMEVALUE = A.ID and THISDATE = (select max(SOMEDATE) from B where ...)) ``` so, if you can read SQL you should see that I am doing a couple correlated subqueries to na...
Normally TOP 1 is a good idea. Consider a large table with millions of rows with no index on the column you are matching, however you are only looking for a single row. SELECT TOP 1 will mean the table scan stops as soon as the one item is found. Without the TOP 1, the table scan will continue right through to the e...
496,073
<p>I've here a CoreData app (no document-based), 1 entity and 1 tableview for edit/add/remove "instances" of the entity. Now I can manual add and save but I would like to</p> <blockquote> <p><code>a)</code> save automaticly changes<br> <code>b</code>) add automaticly some "instances" with the first start.</p> </bl...
[ { "answer_id": 496115, "author": "Abizern", "author_id": 41116, "author_profile": "https://Stackoverflow.com/users/41116", "pm_score": 0, "selected": false, "text": "<p>Have a look at <a href=\"http://lists.apple.com/archives/Cocoa-dev/2006/Apr/msg01285.html\" rel=\"nofollow noreferrer\"...
2009/01/30
[ "https://Stackoverflow.com/questions/496073", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59518/" ]
I've here a CoreData app (no document-based), 1 entity and 1 tableview for edit/add/remove "instances" of the entity. Now I can manual add and save but I would like to > > `a)` save automaticly changes > > `b`) add automaticly some "instances" with the first start. > > > I think `a)` can be solved with NSNotif...
Autosave can be a bit trickier than you'd first expect sometimes, since there may be times when your application data is in an invalid state (for instance, when the user is editing an entity) and either cannot be saved or it would not make sense to save. There's no easy `setAutosaves:YES` property unfortunately, so you...
496,082
<p>I see that Flex3 has a class called <code>ApplicationControlBar</code> dedicated to "holding components that provide global navigation and application commands." (quoted from the <a href="http://livedocs.adobe.com/flex/3/langref/mx/containers/ApplicationControlBar.html" rel="nofollow noreferrer">langref</a>). The qu...
[ { "answer_id": 496238, "author": "cliff.meyers", "author_id": 41754, "author_profile": "https://Stackoverflow.com/users/41754", "pm_score": 2, "selected": true, "text": "<p>ApplicationControlBar is essentially an HBox with both scroll policies set to false and a transparent background. T...
2009/01/30
[ "https://Stackoverflow.com/questions/496082", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42136/" ]
I see that Flex3 has a class called `ApplicationControlBar` dedicated to "holding components that provide global navigation and application commands." (quoted from the [langref](http://livedocs.adobe.com/flex/3/langref/mx/containers/ApplicationControlBar.html)). The question is: is there an advantage of using this clas...
ApplicationControlBar is essentially an HBox with both scroll policies set to false and a transparent background. The only other feature it offers is the ability to be docked. From the Livedocs: Docked mode: The bar is always at the top of the application's drawing area and becomes part of the application chrome. Any ...
496,096
<p>When programming interfaces, I've found I'm doing a lot of casting or object type conversion.</p> <p>Is there a difference between these two methods of conversion? If so, is there a cost difference or how does this affect my program?</p> <pre><code>public interface IMyInterface { void AMethod(); } public cla...
[ { "answer_id": 496110, "author": "Patrick Desjardins", "author_id": 13913, "author_profile": "https://Stackoverflow.com/users/13913", "pm_score": 6, "selected": false, "text": "<p><strong>\"as\"</strong> will return NULL if not possible to cast.</p>\n\n<p><strong>casting before</strong> ...
2009/01/30
[ "https://Stackoverflow.com/questions/496096", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18196/" ]
When programming interfaces, I've found I'm doing a lot of casting or object type conversion. Is there a difference between these two methods of conversion? If so, is there a cost difference or how does this affect my program? ``` public interface IMyInterface { void AMethod(); } public class MyClass : IMyInterf...
The answer below the line was written in 2008. C# 7 introduced pattern matching, which has largely replaced the `as` operator, as you can now write: ``` if (randomObject is TargetType tt) { // Use tt here } ``` Note that `tt` is still in scope after this, but not definitely assigned. (It *is* definitely assigne...
496,112
<pre><code>rbnResubmission.Items.FindByValue("Yes").Attributes.Add("onclick", "getCheckedRadioFieldResubmission(this)"); rbnResubmission.Items.FindByValue("No").Attributes.Add("onclick", "getCheckedRadioFieldResubmission(this)"); </code></pre> <p>So I have these click events for showing rows in a table - that part wor...
[ { "answer_id": 496110, "author": "Patrick Desjardins", "author_id": 13913, "author_profile": "https://Stackoverflow.com/users/13913", "pm_score": 6, "selected": false, "text": "<p><strong>\"as\"</strong> will return NULL if not possible to cast.</p>\n\n<p><strong>casting before</strong> ...
2009/01/30
[ "https://Stackoverflow.com/questions/496112", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24565/" ]
``` rbnResubmission.Items.FindByValue("Yes").Attributes.Add("onclick", "getCheckedRadioFieldResubmission(this)"); rbnResubmission.Items.FindByValue("No").Attributes.Add("onclick", "getCheckedRadioFieldResubmission(this)"); ``` So I have these click events for showing rows in a table - that part works fine. Here's an...
The answer below the line was written in 2008. C# 7 introduced pattern matching, which has largely replaced the `as` operator, as you can now write: ``` if (randomObject is TargetType tt) { // Use tt here } ``` Note that `tt` is still in scope after this, but not definitely assigned. (It *is* definitely assigne...
496,118
<p>I have a use case wherein numbers are monotonically increasing in an vector of integers</p> <pre><code>vec[0] = 2 vec[1] = 5 vec[2] = 8 vec[3] = 10 .. </code></pre> <p>If I am passed number 6, I want to return vec[1], since it lies between vec[1] and vec[2], similarly if passes 9 would have to return vec[2]. My ex...
[ { "answer_id": 496132, "author": "Vinay", "author_id": 28641, "author_profile": "https://Stackoverflow.com/users/28641", "pm_score": 2, "selected": false, "text": "<p>You can use binary search.</p>\n" }, { "answer_id": 496191, "author": "Brian Ensink", "author_id": 1254, ...
2009/01/30
[ "https://Stackoverflow.com/questions/496118", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43756/" ]
I have a use case wherein numbers are monotonically increasing in an vector of integers ``` vec[0] = 2 vec[1] = 5 vec[2] = 8 vec[3] = 10 .. ``` If I am passed number 6, I want to return vec[1], since it lies between vec[1] and vec[2], similarly if passes 9 would have to return vec[2]. My experience with STL is limit...
The STL has four reusable binary search algorithms in the `<algorithm>` header: [`lower_bound`](http://en.cppreference.com/w/cpp/algorithm/lower_bound), [`upper_bound`](http://en.cppreference.com/w/cpp/algorithm/upper_bound), [`equal_range`](http://en.cppreference.com/w/cpp/algorithm/equal_range), and [`binary_search`]...
496,128
<p>We use Sajax for adding small Ajax code to sites. After running into a problem and doing some digging, it seems the library hasn't been updated since 2005.</p> <p>I've appreciated Sajax for being lightweight, easy to use, and easy to install (just include the file in PHP).</p> <p>So, on the LAMP stack, if you ha...
[ { "answer_id": 496143, "author": "meouw", "author_id": 12161, "author_profile": "https://Stackoverflow.com/users/12161", "pm_score": 2, "selected": false, "text": "<p>Sounds a lot like <a href=\"http://www.xajax-project.org/\" rel=\"nofollow noreferrer\">xajax</a></p>\n" }, { "an...
2009/01/30
[ "https://Stackoverflow.com/questions/496128", "https://Stackoverflow.com", "https://Stackoverflow.com/users/57625/" ]
We use Sajax for adding small Ajax code to sites. After running into a problem and doing some digging, it seems the library hasn't been updated since 2005. I've appreciated Sajax for being lightweight, easy to use, and easy to install (just include the file in PHP). So, on the LAMP stack, if you have used Sajax befor...
I would say it is easier to use [`jQuery`.`ajax`](http://api.jquery.com/jQuery.ajax/): ``` $.ajax({ type: 'GET', url: './example.json', dataType: 'json' }).done(function (data) { // Use data... }); $.getJSON('./some.php', { q: 'thing' }).done(function (data) { // Use data... }); $.ajax({ type...
496,173
<p>I want to hide some things when the value of the numericUpDown is changed so I wrote this:</p> <pre><code>if (numericUpDown1.Value = 1) { Label1.Hide(); } </code></pre> <p>but I get this error message:</p> <blockquote> <p><strong><em>Cannot implicitly convert type 'decimal' to 'bool'</em></strong></p> </blo...
[ { "answer_id": 496201, "author": "Zach Scrivena", "author_id": 20029, "author_profile": "https://Stackoverflow.com/users/20029", "pm_score": 3, "selected": false, "text": "<p>I think you mean \"<code>if (numericUpDown1.Value == 1)</code>\".</p>\n\n<p>In most languages, \"<code>==</code>\...
2009/01/30
[ "https://Stackoverflow.com/questions/496173", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I want to hide some things when the value of the numericUpDown is changed so I wrote this: ``` if (numericUpDown1.Value = 1) { Label1.Hide(); } ``` but I get this error message: > > ***Cannot implicitly convert type 'decimal' to 'bool'*** > > > Why is this happening?
I think you mean "`if (numericUpDown1.Value == 1)`". In most languages, "`==`" is the test for equality, while "`=`" is the assignment operator.
496,181
<p>How can I setup a ADOQuery to filter the data to display all lakes that have Brook trout in a DBGrid?</p> <p><strong>Data:</strong></p> <p>Nate Pond - LakeMaps.Lake_Name</p> <pre><code>Brook trout - Species.Species_Name Creek chub Golden shiner </code></pre> <p>Black Pond</p> <pre><code>Brook trout Brown bul...
[ { "answer_id": 496300, "author": "zendar", "author_id": 25732, "author_profile": "https://Stackoverflow.com/users/25732", "pm_score": 1, "selected": false, "text": "<p>You can set <code>Filtered = true</code> and then use <code>OnFilterRecord</code> event and check if detail dataset cont...
2009/01/30
[ "https://Stackoverflow.com/questions/496181", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
How can I setup a ADOQuery to filter the data to display all lakes that have Brook trout in a DBGrid? **Data:** Nate Pond - LakeMaps.Lake\_Name ``` Brook trout - Species.Species_Name Creek chub Golden shiner ``` Black Pond ``` Brook trout Brown bullhead Common shiner ``` Lake Placid ``` Lake trout Smallmo...
You can set `Filtered = true` and then use `OnFilterRecord` event and check if detail dataset contains requested value (this can be done in loop or with `Locate` procedure of dataset) This will probably be very slow on larger amount of data. In those situations I usually filter master records directly in SQL. Somethin...
496,189
<p>What is the better practice of the following two switch/case statements?</p> <p>Is there an easier way (less code) to do this?</p> <pre><code>switch (myValue) { case 1: { methodFor1(); break; } case 2: case 3: { methodFor2or3(); if (myValue == 2) ...
[ { "answer_id": 496211, "author": "Reunanen", "author_id": 19254, "author_profile": "https://Stackoverflow.com/users/19254", "pm_score": 2, "selected": false, "text": "<p>One more alternative:</p>\n\n<pre><code>switch (myValue)\n{\n case 1:\n {\n methodFor1();\n break;...
2009/01/30
[ "https://Stackoverflow.com/questions/496189", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31298/" ]
What is the better practice of the following two switch/case statements? Is there an easier way (less code) to do this? ``` switch (myValue) { case 1: { methodFor1(); break; } case 2: case 3: { methodFor2or3(); if (myValue == 2) methodFor2(); ...
``` switch (myValue) { case 1: methodFor1(); break; case 2: methodFor2or3(); methodFor2(); break; case 3: methodFor2or3(); methodFor3(); break; } ``` Why all the hassle just to avoid repeating `methodFor2or3()` *once*?
496,195
<p>I'm using Linq-to-SQL with a SQL Server backend (of course) as an ORM for a project. I need to get the result set from a stored procedure that returns from a dynamically-created table. Here's what the proc looks like:</p> <pre><code>CREATE procedure [RetailAdmin].[TitleSearch] ( @isbn varchar(50), @author varchar(5...
[ { "answer_id": 496211, "author": "Reunanen", "author_id": 19254, "author_profile": "https://Stackoverflow.com/users/19254", "pm_score": 2, "selected": false, "text": "<p>One more alternative:</p>\n\n<pre><code>switch (myValue)\n{\n case 1:\n {\n methodFor1();\n break;...
2009/01/30
[ "https://Stackoverflow.com/questions/496195", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1249/" ]
I'm using Linq-to-SQL with a SQL Server backend (of course) as an ORM for a project. I need to get the result set from a stored procedure that returns from a dynamically-created table. Here's what the proc looks like: ``` CREATE procedure [RetailAdmin].[TitleSearch] ( @isbn varchar(50), @author varchar(50), @title va...
``` switch (myValue) { case 1: methodFor1(); break; case 2: methodFor2or3(); methodFor2(); break; case 3: methodFor2or3(); methodFor3(); break; } ``` Why all the hassle just to avoid repeating `methodFor2or3()` *once*?
496,204
<p>I've been pouring over the format description and source code for the 7z archive format, but I'm still having trouble writing a valid container. I assume I can create an empty container... anyway here's my start:</p> <pre><code>std::ofstream ofs(archivename.c_str(), std::ios::binary|std::ios::trunc); Byte signat...
[ { "answer_id": 496230, "author": "Fredrik Jansson", "author_id": 58237, "author_profile": "https://Stackoverflow.com/users/58237", "pm_score": 3, "selected": true, "text": "<p>don't know the format of 7z, but I notice when you write down offset, size and crc that these will be written to...
2009/01/30
[ "https://Stackoverflow.com/questions/496204", "https://Stackoverflow.com", "https://Stackoverflow.com/users/809/" ]
I've been pouring over the format description and source code for the 7z archive format, but I'm still having trouble writing a valid container. I assume I can create an empty container... anyway here's my start: ``` std::ofstream ofs(archivename.c_str(), std::ios::binary|std::ios::trunc); Byte signature[6] = {'7', '...
don't know the format of 7z, but I notice when you write down offset, size and crc that these will be written to the file in little-endian format (I assume you have a little-endian CPU). Edit: An probably worse, you are missing the & before major, minor, offset, size and crc, i.e. you are casting the actual values to ...
496,222
<p>I realize that SOAP webservices in .NET return XML representation of whatever object the web method returns, but if I want to return data formatting in XML what is the best object to store it in?</p> <p>I am using the <a href="https://stackoverflow.com/questions/220867/how-to-deal-with-xml-in-c/220981#220981">answe...
[ { "answer_id": 496406, "author": "Kev", "author_id": 419, "author_profile": "https://Stackoverflow.com/users/419", "pm_score": 4, "selected": false, "text": "<p>Just return a XmlDocument. e.g.</p>\n\n<pre><code>[WebMethod]\npublic XmlDocument Quux()\n{\n\n}\n</code></pre>\n" }, { ...
2009/01/30
[ "https://Stackoverflow.com/questions/496222", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20774/" ]
I realize that SOAP webservices in .NET return XML representation of whatever object the web method returns, but if I want to return data formatting in XML what is the best object to store it in? I am using the [answer](https://stackoverflow.com/questions/220867/how-to-deal-with-xml-in-c/220981#220981) to [this questi...
This is how I ended up doing it; ``` StringBuilder sb = new StringBuilder(); XmlWriter writer = XmlWriter.Create(sb, settings); writer.WriteStartDocument(); writer.WriteStartElement("People"); writer.WriteStartElement("Person"); writer.WriteAttributeString("Name", "Nick"); writer.WriteEndElement(); writer.WriteStar...
496,226
<p>I recently embarrassed myself while explaining to a colleague why</p> <pre><code>char a[100]; scanf("%s", &amp;a); // notice a &amp; in front of 'a' </code></pre> <p>is very bad and that the slightly better way to do it is:</p> <pre><code>char a[100]; scanf("%s", a); // notice no &amp; in front of 'a' </code></...
[ { "answer_id": 496263, "author": "jalf", "author_id": 33213, "author_profile": "https://Stackoverflow.com/users/33213", "pm_score": 4, "selected": false, "text": "<p>Well, the <code>&amp;a</code> case should be obvious. You take the address of the array, exactly as expected.\n<code>a</co...
2009/01/30
[ "https://Stackoverflow.com/questions/496226", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51568/" ]
I recently embarrassed myself while explaining to a colleague why ``` char a[100]; scanf("%s", &a); // notice a & in front of 'a' ``` is very bad and that the slightly better way to do it is: ``` char a[100]; scanf("%s", a); // notice no & in front of 'a' ``` Ok. For everybody getting ready to tell me why scanf...
Well, the `&a` case should be obvious. You take the address of the array, exactly as expected. `a` is a bit more subtle, but the answer is that `a` *is* the array. And as any C programmer knows, arrays have a tendency to degenerate into a pointer at the slightest provocation, *for example* when passing it as a function...
496,244
<p>I need to write a select query that joins the tables based on a condition (in this case, based on a value in one of the columns). I would like to do something like this:</p> <pre><code>SELECT * FROM TableA INNER JOIN TableB ON (TableA.Column1 = TableB.Column1 OR TableA.Column1 = 0) -- Does not work! </code...
[ { "answer_id": 496272, "author": "bobwienholt", "author_id": 24257, "author_profile": "https://Stackoverflow.com/users/24257", "pm_score": 2, "selected": false, "text": "<p>I'm not exactly sure what you are doing but it seems like you are looking for an outer join:</p>\n\n<pre><code>SELE...
2009/01/30
[ "https://Stackoverflow.com/questions/496244", "https://Stackoverflow.com", "https://Stackoverflow.com/users/58348/" ]
I need to write a select query that joins the tables based on a condition (in this case, based on a value in one of the columns). I would like to do something like this: ``` SELECT * FROM TableA INNER JOIN TableB ON (TableA.Column1 = TableB.Column1 OR TableA.Column1 = 0) -- Does not work! ```
This should achieve what you need: ``` SELECT * FROM TableA A WHERE A.Column1 = 0 OR EXISTS( SELECT B.Column1 FROM TableB B WHERE B.Column1 = A.Column1 ); ```
496,277
<p>I've got msysGit (Git on Windows) working just fine on my home machine, but at work, where we are behind a Microsoft ISA proxy, I get the following error when I do a git clone:</p> <pre><code>H:\&gt;git clone git://github.com/akitaonrails/vimfiles.git Initialized empty Git repository in H:/vimfiles/.git/ github.com...
[ { "answer_id": 496290, "author": "Marko", "author_id": 31141, "author_profile": "https://Stackoverflow.com/users/31141", "pm_score": 2, "selected": false, "text": "<p>Do you have SOCKS proxy? If you have, you caould try <strong>FreeCap</strong> to socksify your git connection. I've been ...
2009/01/30
[ "https://Stackoverflow.com/questions/496277", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1944/" ]
I've got msysGit (Git on Windows) working just fine on my home machine, but at work, where we are behind a Microsoft ISA proxy, I get the following error when I do a git clone: ``` H:\>git clone git://github.com/akitaonrails/vimfiles.git Initialized empty Git repository in H:/vimfiles/.git/ github.com[0: 65.74.177.129...
I had the exact same error; but the [`~/.gitconfig` global config file](http://git-scm.com/docs/git-config) was the key. If you have a proxy with authentication you need to put in it: ``` git config --global http.proxy http://login:password@our-proxy-server:8088 ``` And it just works (with '`git clone http:`') Exa...
496,304
<p>I'm trying to call a class method from C++. I've tried all combinations of rb_intern I could think of to make it work, but I've gotten nothing.</p> <p>Example class</p> <pre> class CallTest def go (do something here) end end </pre> <p>Trying to call in C++:</p> <pre>rb_funcall(?, rb_intern("go"), 0);</...
[ { "answer_id": 496608, "author": "rampion", "author_id": 9859, "author_profile": "https://Stackoverflow.com/users/9859", "pm_score": 4, "selected": true, "text": "<p>First off, <code>go</code> is, as you've defined it, not a class method, but an <strong>instance method</strong>.</p>\n\n<...
2009/01/30
[ "https://Stackoverflow.com/questions/496304", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25129/" ]
I'm trying to call a class method from C++. I've tried all combinations of rb\_intern I could think of to make it work, but I've gotten nothing. Example class ``` class CallTest def go (do something here) end end ``` Trying to call in C++: ``` rb_funcall(?, rb_intern("go"), 0); ``` What goes in the ? s...
First off, `go` is, as you've defined it, not a class method, but an **instance method**. As an object oriented language, all ruby methods require a receiver, that is, an object that the method is invoked on. For instance methods, the receiver is an instance of the class, for class methods, the receiver is the class o...
496,307
<p>I am working on a code base that has a number of connection strings that access a database server by a specified name.</p> <pre><code>&lt;add name="myConnection" connectionString="Data Source=DevServer;Initial Catalog='devData';Persist Security Info=True;User ID=devUser;Password=devPass;" providerName="...
[ { "answer_id": 496318, "author": "Michael Haren", "author_id": 29, "author_profile": "https://Stackoverflow.com/users/29", "pm_score": 3, "selected": false, "text": "<p>You could update your <a href=\"http://en.wikipedia.org/wiki/Hosts_file\" rel=\"nofollow noreferrer\">hosts file</a> to...
2009/01/30
[ "https://Stackoverflow.com/questions/496307", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1403/" ]
I am working on a code base that has a number of connection strings that access a database server by a specified name. ``` <add name="myConnection" connectionString="Data Source=DevServer;Initial Catalog='devData';Persist Security Info=True;User ID=devUser;Password=devPass;" providerName="System.Data.SqlCl...
The SQL Server Configuration Manager allows you to use a put in an alias, under the Native Client Configuration. I think that's easier to me, but the hosts file solution should work just as well. If you use the SSCM, be sure you back this out when you hit the main network (or edit it), or you won't be able to hit the ...
496,330
<p>Can anyone explain to me why this isn't working?</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; char *getline(int lim) { char c; int i; char *line; line = malloc(sizeof(char) * lim); i = 0; while((c = getchar()) != '\n' &amp;&amp; c != EOF &amp;&amp; i &lt; lim-1) {...
[ { "answer_id": 496343, "author": "CB Bailey", "author_id": 19563, "author_profile": "https://Stackoverflow.com/users/19563", "pm_score": 2, "selected": false, "text": "<p>It looks like you're printing a zero-length string.</p>\n\n<pre><code>*line = '\\0';\nprintf(\"%s\", line);\n</code><...
2009/01/30
[ "https://Stackoverflow.com/questions/496330", "https://Stackoverflow.com", "https://Stackoverflow.com/users/58657/" ]
Can anyone explain to me why this isn't working? ``` #include <stdio.h> #include <stdlib.h> char *getline(int lim) { char c; int i; char *line; line = malloc(sizeof(char) * lim); i = 0; while((c = getchar()) != '\n' && c != EOF && i < lim-1) { *line = c; line++; i+...
Because you are only allocating enough space for a single character in this line: ``` line = malloc(sizeof(char)); ``` And that is getting filled with the `\0` before your `printf` statement. I'm guessing you want to change this line to: ``` /* Allocate enough room for 'lim' - 1 characters and a trailing \0 */ lin...
496,338
<p>I want to be able to link my image. Click on it. Go back to the page and see that it was visited. I want my visited images to have a different color border when I go back.<br /></p> <p>My code:</p> <pre><code>a:link img{border-color:#FFF; border-style:solid; border-width:1px;} a:hover img{border-color:#03F; border...
[ { "answer_id": 496384, "author": "Nick Berardi", "author_id": 17, "author_profile": "https://Stackoverflow.com/users/17", "pm_score": 0, "selected": false, "text": "<p>It may help to tell us which browser isn't working, because they all handle anchor links that have embedded text differe...
2009/01/30
[ "https://Stackoverflow.com/questions/496338", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I want to be able to link my image. Click on it. Go back to the page and see that it was visited. I want my visited images to have a different color border when I go back. My code: ``` a:link img{border-color:#FFF; border-style:solid; border-width:1px;} a:hover img{border-color:#03F; border-style:solid; border-widt...
Link CSS can be hard to get right, because many browsers can be quirky about it. The best order to declare link CSS is * Link * Visited * Hover * Active (Also remembered as the mnemonic LoVe/HAte). Also, try declaring your css: ``` a:hover img {border: 1px solid #036;} ``` instead of specifying it in three diff...
496,354
<p>So far I include everything in index.php:</p> <pre><code>RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?page=$1 [QSA,L] </code></pre> <p>There are also pages where I use $_GET like this:</p> <pre><code>SELECT * FROM news WHERE id = ".intval($_...
[ { "answer_id": 496363, "author": "Grant", "author_id": 30, "author_profile": "https://Stackoverflow.com/users/30", "pm_score": 3, "selected": false, "text": "<pre><code>RewriteRule ^([^/]*)/?([^/]*)$ index.php?page=$1&amp;id=$2 [QSA,L]\n</code></pre>\n\n<p>Should allow your pages to be e...
2009/01/30
[ "https://Stackoverflow.com/questions/496354", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
So far I include everything in index.php: ``` RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ index.php?page=$1 [QSA,L] ``` There are also pages where I use $\_GET like this: ``` SELECT * FROM news WHERE id = ".intval($_GET['id']) ``` If I want to view a...
this single rule should allow both with and without ids (and also makes the slashes optional): ``` RewriteRule ^([^/]*)(/([^/]*)/?)?$ index.php?page=$1&id=$3 [QSA,L] ``` if you don't want to allow / and //, change the `*`'s to `+`'s
496,369
<p>In Java, I can validate an XML document against an XSD schema using javax.xml.validation.Validator, or against a DTD by simply parsing the document using org.xml.sax.XMLReader.</p> <p>What I need though is a way of programmatically determining whether the document itself validates against a DTD (i.e. it contains a ...
[ { "answer_id": 496465, "author": "Kevin", "author_id": 26620, "author_profile": "https://Stackoverflow.com/users/26620", "pm_score": 1, "selected": false, "text": "<p>See the package description for <a href=\"http://java.sun.com/javase/6/docs/api/javax/xml/validation/package-summary.html...
2009/01/30
[ "https://Stackoverflow.com/questions/496369", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34732/" ]
In Java, I can validate an XML document against an XSD schema using javax.xml.validation.Validator, or against a DTD by simply parsing the document using org.xml.sax.XMLReader. What I need though is a way of programmatically determining whether the document itself validates against a DTD (i.e. it contains a `<!DOCTYPE...
There is no 100% foolproof process for determining how to validate an arbitrary XML document. For example, this version 2.4 [web application deployment descriptor](http://en.wikipedia.org/wiki/Deployment_Descriptor) specifies a [W3 schema](http://www.w3.org/XML/Schema) to validate the document: ``` <?xml version="1.0...
496,388
<p>Suppose I have the following code:</p> <pre><code>public class SomeClass() { private readonly object _lock = new object(); public void SomeMethodA() { lock (_lock) { SomeHelperMethod(); //do something that requires lock on _lock } } public void ...
[ { "answer_id": 496500, "author": "AlexDrenea", "author_id": 39624, "author_profile": "https://Stackoverflow.com/users/39624", "pm_score": 1, "selected": false, "text": "<p>OK, \n I now understand your problem.\n Conceptually I am now thinking of a Semaphore object. You can easily check t...
2009/01/30
[ "https://Stackoverflow.com/questions/496388", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5380/" ]
Suppose I have the following code: ``` public class SomeClass() { private readonly object _lock = new object(); public void SomeMethodA() { lock (_lock) { SomeHelperMethod(); //do something that requires lock on _lock } } public void SomeMethodB() ...
This is supported in .NET 4.5 using [`Monitor.IsEntered(object)`](http://msdn.microsoft.com/en-US/library/system.threading.monitor.isentered%28v=vs.110%29.aspx).
496,393
<p>I've been writing tests for my domain objects for some time now, but I'm still not quite sure how to go about testing for security in my web project. Certain users in certain environments can access certain properties of my models etc, but how would you go about testing this? Right now, I'm basing it on the curren...
[ { "answer_id": 585217, "author": "TFD", "author_id": 68607, "author_profile": "https://Stackoverflow.com/users/68607", "pm_score": 0, "selected": false, "text": "<p>If using TDD your tests should only test the code in question, all other associated objects should be mocks/fakes</p>\n\n<p...
2009/01/30
[ "https://Stackoverflow.com/questions/496393", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8588/" ]
I've been writing tests for my domain objects for some time now, but I'm still not quite sure how to go about testing for security in my web project. Certain users in certain environments can access certain properties of my models etc, but how would you go about testing this? Right now, I'm basing it on the current aut...
That link is ONE way, but it's nicer to use a Mock: ``` Mock<ControllerContext> MockContext(string userName) { var mockContext = new Mock<ControllerContext>(); // mock an authenticated user mockContext.SetupGet(p => p.HttpContext.User.Identity.Name).Returns(userName); mockContex...
496,408
<p>I have a file that contains this kind of paths:</p> <pre><code>C:\bad\foo.c C:\good\foo.c C:\good\bar\foo.c C:\good\bar\[variable subdir count]\foo.c </code></pre> <p>And I would like to get the following file:</p> <pre><code>C:\bad\foo.c C:/good/foo.c C:/good/bar/foo.c C:/good/bar/[variable subdir count]/foo.c <...
[ { "answer_id": 496424, "author": "ConcernedOfTunbridgeWells", "author_id": 15401, "author_profile": "https://Stackoverflow.com/users/15401", "pm_score": 1, "selected": false, "text": "<p>You want to substitute '<code>/</code>' for all '<code>\\</code>' but only on the lines that match th...
2009/01/30
[ "https://Stackoverflow.com/questions/496408", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26074/" ]
I have a file that contains this kind of paths: ``` C:\bad\foo.c C:\good\foo.c C:\good\bar\foo.c C:\good\bar\[variable subdir count]\foo.c ``` And I would like to get the following file: ``` C:\bad\foo.c C:/good/foo.c C:/good/bar/foo.c C:/good/bar/[variable subdir count]/foo.c ``` Note that the non matching path ...
``` sed -e '/^C:\\good/ s/\\/\//g' input_file.txt ```
496,409
<p>I'm facing the need to enter "ragged" data in a <em>WinForms</em> application. Some columns are required for some types of entry lines and are not permitted on other entry lines, and the combo box data in later columns needs to vary based on the earlier columns.</p> <p>My question is: is there a better way to handl...
[ { "answer_id": 498557, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 2, "selected": false, "text": "<p>How about <a href=\"http://www.codeproject.com/KB/grid/csharpgridcontrol.aspx\" rel=\"nofollow noreferrer\">Source...
2009/01/30
[ "https://Stackoverflow.com/questions/496409", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28006/" ]
I'm facing the need to enter "ragged" data in a *WinForms* application. Some columns are required for some types of entry lines and are not permitted on other entry lines, and the combo box data in later columns needs to vary based on the earlier columns. My question is: is there a better way to handle data that isn't...
Maybe a repeater control would give you the flexibility you're looking for, <http://msdn.microsoft.com/en-us/vbasic/bb735936.aspx>. I've used it for custom user controls and it's worked great.
496,413
<p>How to I determine the maximum row size for a table? I'm looking for a tool or script that does this so I don't have to add up each column's size by hand.</p> <p>My goal is to produce a report of tables that are too wide so we can look into restructing them. I know we have several that are so wide that only 1 row f...
[ { "answer_id": 496445, "author": "Tomalak", "author_id": 18771, "author_profile": "https://Stackoverflow.com/users/18771", "pm_score": 2, "selected": false, "text": "<p>Have a look at <code>INFORMATION_SCHEMA.COLUMNS</code>. You can add the size of each column in a table to give you an i...
2009/01/30
[ "https://Stackoverflow.com/questions/496413", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5274/" ]
How to I determine the maximum row size for a table? I'm looking for a tool or script that does this so I don't have to add up each column's size by hand. My goal is to produce a report of tables that are too wide so we can look into restructing them. I know we have several that are so wide that only 1 row fits on eac...
Another way, run this then look at MaximumRecordsize ``` dbcc showcontig ('YourTableNameHere') with tableresults ```
496,415
<p>I'm trying to open and read from a serial port using the System.IO.Ports.SerialPort class. I dragged the serial port from the tool pane (Visual&nbsp;Studio&nbsp;2008) on to my Windows Forms application.</p> <p>I've got a property grid set up so I can easily change properties of the serial port at runtime. When I tr...
[ { "answer_id": 496454, "author": "Quassnoi", "author_id": 55159, "author_profile": "https://Stackoverflow.com/users/55159", "pm_score": 1, "selected": false, "text": "<p>In a real <a href=\"http://en.wikipedia.org/wiki/Universal_asynchronous_receiver/transmitter\" rel=\"nofollow noreferr...
2009/01/30
[ "https://Stackoverflow.com/questions/496415", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9266/" ]
I'm trying to open and read from a serial port using the System.IO.Ports.SerialPort class. I dragged the serial port from the tool pane (Visual Studio 2008) on to my Windows Forms application. I've got a property grid set up so I can easily change properties of the serial port at runtime. When I try to open the port, ...
Regarding the differences between HyperTerminal and the .NET serial port object, HyperTerminal is a commercial, stable application. If the underlying serial port object died or threw an exception, HyperTerminal hid it from you. The .NET serial port object throws more exceptions than any other .NET object I've used. Po...
496,430
<p>In a C# 2.0 I have a list of fields and a list of values (stored as strings), a table name, and an ODBC Connection. </p> <p>I need to get the data types of the fields that are on that table, so I know how to generate my sql.</p> <p>What's the best way to get that information from what I've got?</p> <p>My only id...
[ { "answer_id": 496437, "author": "Nick Berardi", "author_id": 17, "author_profile": "https://Stackoverflow.com/users/17", "pm_score": 2, "selected": false, "text": "<p>Try this</p>\n\n<pre><code>select * from sys.columns where object_id = object_id('MyTable')\n</code></pre>\n\n<p>Hope th...
2009/01/30
[ "https://Stackoverflow.com/questions/496430", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16487/" ]
In a C# 2.0 I have a list of fields and a list of values (stored as strings), a table name, and an ODBC Connection. I need to get the data types of the fields that are on that table, so I know how to generate my sql. What's the best way to get that information from what I've got? My only idea is to do a `SELECT TOP...
You're best option is to query your datbases system tables like Nick Beradi mentioned. If that's not an option for whatever reason, you can do something like this: ``` using (SqlConnection conn = new SqlConnection(myConnectionString)) { using (SqlDataAdapter adapter = new SqlDataAdapter("SE...
496,440
<p><strong>Why the following example prints "0" and what must change for it to print "1" as I expected ?</strong></p> <pre><code>#include &lt;iostream&gt; struct base { virtual const int value() const { return 0; } base() { std::cout &lt;&lt; value() &lt;&lt; std::endl; } virtual ~base() {} ...
[ { "answer_id": 496447, "author": "Hank Gay", "author_id": 4203, "author_profile": "https://Stackoverflow.com/users/4203", "pm_score": 0, "selected": false, "text": "<p>The general rule is you don't call a virtual function from a constructor.</p>\n" }, { "answer_id": 496450, "...
2009/01/30
[ "https://Stackoverflow.com/questions/496440", "https://Stackoverflow.com", "https://Stackoverflow.com/users/55935/" ]
**Why the following example prints "0" and what must change for it to print "1" as I expected ?** ``` #include <iostream> struct base { virtual const int value() const { return 0; } base() { std::cout << value() << std::endl; } virtual ~base() {} }; struct derived : public base { virtual...
Because `base` is constructed first and hasn't "matured" into a `derived` yet. It can't call methods on an object when it can't guarantee that the object is already properly initialized.
496,456
<p>I have the following XML</p> <pre><code>&lt;fields&gt; &lt;field position="4" tablename="Students" headername="First Name" fieldreference="FirstName" orderbydirection="ASC" /&gt; &lt;field position="2" tablename="Students" headername="Last Name" fieldreference="LastName" orderbydirection="ASC" /&gt; &lt;field...
[ { "answer_id": 496458, "author": "Otávio Décio", "author_id": 48684, "author_profile": "https://Stackoverflow.com/users/48684", "pm_score": 0, "selected": false, "text": "<p>When you have that function defined on a different dll or lib, so that the compiler defers to the linker to find i...
2009/01/30
[ "https://Stackoverflow.com/questions/496456", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34219/" ]
I have the following XML ``` <fields> <field position="4" tablename="Students" headername="First Name" fieldreference="FirstName" orderbydirection="ASC" /> <field position="2" tablename="Students" headername="Last Name" fieldreference="LastName" orderbydirection="ASC" /> <field position="3" tablename="Students" ...
`extern` changes the linkage. With the keyword, the function / variable is assumed to be available somewhere else and the resolving is deferred to the linker. There's a difference between `extern` on functions and on variables. For **variables** it doesn't instantiate the variable itself, i.e. doesn't allocate any me...
496,468
<p>Lets say I wanted to scrape a webpage, and extract some data. I'd most likely write something like this:</p> <pre><code>let getAllHyperlinks(url:string) = async { let req = WebRequest.Create(url) let! rsp = req.GetResponseAsync() use stream = rsp.GetResponseStream() // dep...
[ { "answer_id": 496484, "author": "Brian", "author_id": 19299, "author_profile": "https://Stackoverflow.com/users/19299", "pm_score": 4, "selected": true, "text": "<p>The key is we are <em>not</em> spawning any new threads. During the whole course of the workflow, there are 1 or 0 active...
2009/01/30
[ "https://Stackoverflow.com/questions/496468", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40516/" ]
Lets say I wanted to scrape a webpage, and extract some data. I'd most likely write something like this: ``` let getAllHyperlinks(url:string) = async { let req = WebRequest.Create(url) let! rsp = req.GetResponseAsync() use stream = rsp.GetResponseStream() // depends on rsp ...
The key is we are *not* spawning any new threads. During the whole course of the workflow, there are 1 or 0 active threads being consumed from the ThreadPool. (An exception, up until the first '!', the code runs on the user thread that did an Async.Run.) "let!" lets go of a thread while the Async operation is at sea, a...
496,469
<p>I have a few .net modules/libraries I am referencing from my main application. Each of the modules/libraries can be configured and after I build them they each have a configuration file such as MyModule1.dll.config, MyModule2.dll.config.</p> <p>When I build my main application an app.config file is outputted to the...
[ { "answer_id": 497002, "author": "Paul Stovell", "author_id": 57132, "author_profile": "https://Stackoverflow.com/users/57132", "pm_score": 1, "selected": false, "text": "<p>If you are using the <em>Properties</em> folder system in Visual Studio, and want Visual Studio to sync them autom...
2009/01/30
[ "https://Stackoverflow.com/questions/496469", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32313/" ]
I have a few .net modules/libraries I am referencing from my main application. Each of the modules/libraries can be configured and after I build them they each have a configuration file such as MyModule1.dll.config, MyModule2.dll.config. When I build my main application an app.config file is outputted to the output di...
If you are using the *Properties* folder system in Visual Studio, and want Visual Studio to sync them automatically, you will want to use the config-per-module approach you have described simply for productivity. Alternatively, if you are just dealing with or entries, it may be easier from one config file. My only ad...
496,470
<p>I'm new to MVC, and am not following how you'd do paging and sorting on a grid. I'm used to using the asp.Net GridView control with an ObjectDataSource pointed at objects in our business layer - and in that case the ODS handles all of the paging &amp; sorting using the methods that our ORM generates on the objects....
[ { "answer_id": 496507, "author": "Nick Berardi", "author_id": 17, "author_profile": "https://Stackoverflow.com/users/17", "pm_score": 2, "selected": false, "text": "<p>With MVC you sort of have to roll your own sorting, paging, etc. I would suggest <a href=\"http://developer.yahoo.com/y...
2009/01/30
[ "https://Stackoverflow.com/questions/496470", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36297/" ]
I'm new to MVC, and am not following how you'd do paging and sorting on a grid. I'm used to using the asp.Net GridView control with an ObjectDataSource pointed at objects in our business layer - and in that case the ODS handles all of the paging & sorting using the methods that our ORM generates on the objects. I've l...
Your can use the same controller, just add an additional parameter and name it sort. Then check in the controller what value sort has, and sort your data based on that parameter. Or if you want to do things on the client side, you can use something like [tablesorter](http://tablesorter.com/docs/), a plugin for jquery.
496,473
<p>I'm porting a medium-sized C++ project from Visual Studio 2005 to MacOS, XCode / GCC 4.0.</p> <p>One of the differences I have just stumbled across has to do with erasing an element from a map. In Visual Studio I could erase an element specified by an iterator and assign the return value to the iterator to get the ...
[ { "answer_id": 496494, "author": "jpalecek", "author_id": 51831, "author_profile": "https://Stackoverflow.com/users/51831", "pm_score": 5, "selected": true, "text": "<p>No. You have to increment the iterator before erasing. Like this</p>\n\n<pre><code>m_ResourceMap.erase(itor++);\n</code...
2009/01/30
[ "https://Stackoverflow.com/questions/496473", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59301/" ]
I'm porting a medium-sized C++ project from Visual Studio 2005 to MacOS, XCode / GCC 4.0. One of the differences I have just stumbled across has to do with erasing an element from a map. In Visual Studio I could erase an element specified by an iterator and assign the return value to the iterator to get the position o...
No. You have to increment the iterator before erasing. Like this ``` m_ResourceMap.erase(itor++); ``` The iterator is invalidated by the erase, so you can't increment it afterwards.
496,483
<p>I have an access DB which we use to track tickets. Each ticket may have multiple occurrences because of different programming changes associated with that ticket. Each record also has a program_type field which is SVR or VB. Example:</p> <pre><code>123456 - SVR - SomeCode 123456 - VB - SomeVBCode </code></pre> <p...
[ { "answer_id": 496537, "author": "DJ.", "author_id": 10492, "author_profile": "https://Stackoverflow.com/users/10492", "pm_score": 2, "selected": true, "text": "<p>This should work:</p>\n\n<pre><code>UPDATE table SET VB_Flag = 1 \nWHERE TicketNum IN (SELECT TicketNum FROM Table WHERE pro...
2009/01/30
[ "https://Stackoverflow.com/questions/496483", "https://Stackoverflow.com", "https://Stackoverflow.com/users/53409/" ]
I have an access DB which we use to track tickets. Each ticket may have multiple occurrences because of different programming changes associated with that ticket. Each record also has a program\_type field which is SVR or VB. Example: ``` 123456 - SVR - SomeCode 123456 - VB - SomeVBCode ``` I've added a column to t...
This should work: ``` UPDATE table SET VB_Flag = 1 WHERE TicketNum IN (SELECT TicketNum FROM Table WHERE program_type = 'VB') ```
496,487
<p>I'm working on a project that is supposed to be used from the command line with the following syntax:</p> <pre><code>program-name input-file </code></pre> <p>The program is supposed to process the input, compute some stuff and spit out results on stdout.</p> <p>My language of choice is C++ for several reasons I'm...
[ { "answer_id": 496492, "author": "Pierre", "author_id": 58082, "author_profile": "https://Stackoverflow.com/users/58082", "pm_score": 3, "selected": false, "text": "<p>Not deallocating memory should not be problem but it is a bad practice.</p>\n" }, { "answer_id": 496501, "au...
2009/01/30
[ "https://Stackoverflow.com/questions/496487", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51568/" ]
I'm working on a project that is supposed to be used from the command line with the following syntax: ``` program-name input-file ``` The program is supposed to process the input, compute some stuff and spit out results on stdout. My language of choice is C++ for several reasons I'm not willing to debate. The compu...
It shouldn't cause any problems in the specific situation described the question. However, it's not exactly normal. Static analysis tools will complain about it. Most importantly, it builds bad habits.
496,488
<p>I'm trying to serialize a custom class that needs to use multiple elements of the same name.<br> I've tried using xmlarray, but it wraps them in another elements. </p> <p>I want my xml to look like this.</p> <pre><code>&lt;root&gt; &lt;trees&gt;some text&lt;/trees&gt; &lt;trees&gt;some more text&lt;/tre...
[ { "answer_id": 498646, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 0, "selected": false, "text": "<p>(edit: obsoleted - my <a href=\"https://stackoverflow.com/questions/496488/xmlserialization-collection-as-array/49...
2009/01/30
[ "https://Stackoverflow.com/questions/496488", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm trying to serialize a custom class that needs to use multiple elements of the same name. I've tried using xmlarray, but it wraps them in another elements. I want my xml to look like this. ``` <root> <trees>some text</trees> <trees>some more text</trees> </root> ``` My code: ``` [Serializable(), X...
Try just using `[XmlElement("trees")]`: ``` [Serializable(), XmlRoot("root")] public class test { [XmlElement("trees")] public List<string> MyProp1 = new List<string>(); public test() { MyProp1.Add("some text"); MyProp1.Add("some more text"); } } ``` Note I changed `ArrayList` to...
496,508
<p>I have these tables:</p> <pre><code>Projects(projectID, CreatedByID) Employees(empID,depID) Departments(depID,OfficeID) Offices(officeID) </code></pre> <p><code>CreatedByID</code> is a <a href="http://en.wikipedia.org/wiki/Foreign_key" rel="nofollow noreferrer">foreign key</a> for <code>Employees</code>. I have a ...
[ { "answer_id": 496525, "author": "TheSmurf", "author_id": 1975282, "author_profile": "https://Stackoverflow.com/users/1975282", "pm_score": 3, "selected": false, "text": "<p>The cost of joins shouldn't worry you too much per se (unless you're trying to scale to millions of users, in whic...
2009/01/30
[ "https://Stackoverflow.com/questions/496508", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50970/" ]
I have these tables: ``` Projects(projectID, CreatedByID) Employees(empID,depID) Departments(depID,OfficeID) Offices(officeID) ``` `CreatedByID` is a [foreign key](http://en.wikipedia.org/wiki/Foreign_key) for `Employees`. I have a query that runs for almost every page load. Is it bad practice to just add a redunda...
Denormalization has the advantage of fast `SELECT`s on large queries. Disadvantages are: * It takes more coding and time to ensure integrity (which is most important in your case) * It's slower on DML (INSERT/UPDATE/DELETE) * It takes more space As for optimization, you may optimize either for faster querying or for...
496,519
<p>I have heard that using exception trapping is not a recommended practice for number testing.</p> <p>For example:</p> <pre><code>bool isnumeric try { int i = int.parse(textbox1.text); isnumeric = true; } catch {isnumenric=false} </code></pre> <p>Is there some other way that I could test for numbers in C#?</p>
[ { "answer_id": 496528, "author": "Andrew Rollings", "author_id": 40410, "author_profile": "https://Stackoverflow.com/users/40410", "pm_score": 3, "selected": false, "text": "<p>Use the built-in <a href=\"http://msdn.microsoft.com/en-us/library/f02979c7.aspx\" rel=\"nofollow noreferrer\">...
2009/01/30
[ "https://Stackoverflow.com/questions/496519", "https://Stackoverflow.com", "https://Stackoverflow.com/users/54009/" ]
I have heard that using exception trapping is not a recommended practice for number testing. For example: ``` bool isnumeric try { int i = int.parse(textbox1.text); isnumeric = true; } catch {isnumenric=false} ``` Is there some other way that I could test for numbers in C#?
Yes try using ``` int i; bool success = Int32.TryParse(textBox1.text, out i); ``` The **TryParse** method basically does what you are doing above.
496,524
<p>In Classic ASP, <strong>Server.MapPath()</strong> doesn't always work properly in the <strong>Application_OnStart</strong> event within <strong>global.asa</strong>. I have an ASP page at <strong>"\testfolder\test.asp"</strong> within a virtual root, I have an XSLT file at <strong>"\xsl\transform.xsl"</strong>. My vi...
[ { "answer_id": 496531, "author": "andynormancx", "author_id": 46354, "author_profile": "https://Stackoverflow.com/users/46354", "pm_score": 3, "selected": true, "text": "<p><em>I am answering my own question here:</em></p>\n\n<p>This problem occurs because when called in <strong>Applicat...
2009/01/30
[ "https://Stackoverflow.com/questions/496524", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46354/" ]
In Classic ASP, **Server.MapPath()** doesn't always work properly in the **Application\_OnStart** event within **global.asa**. I have an ASP page at **"\testfolder\test.asp"** within a virtual root, I have an XSLT file at **"\xsl\transform.xsl"**. My virtual root is located in **"c:\inetpub\wwwroot\testapp\"**. I use ...
*I am answering my own question here:* This problem occurs because when called in **Application\_OnStart**, **MapPath** incorrectly includes the context of the page that caused the application to startup. If the first ASP page to be run when the application isn't yet started is not in the root of the virtual root then...
496,566
<p>Ok, I have been using the following script for over a year now to send email (via gmail) from my host, and it has worked just fine (the <strong>Settings.Get()</strong> just return strings):</p> <pre><code>public class Email : SmtpClient { public MailMessage Message { get; private set; } public Email(string...
[ { "answer_id": 496585, "author": "Oscar Cabrero", "author_id": 14440, "author_profile": "https://Stackoverflow.com/users/14440", "pm_score": 0, "selected": false, "text": "<p>check your event log, maybe the handshake beetwen the your pc and the server is not working.or the certificate is...
2009/01/30
[ "https://Stackoverflow.com/questions/496566", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14777/" ]
Ok, I have been using the following script for over a year now to send email (via gmail) from my host, and it has worked just fine (the **Settings.Get()** just return strings): ``` public class Email : SmtpClient { public MailMessage Message { get; private set; } public Email(string to, string from, string su...
What SMTP-Server and port are you using? You will need to use port 465 or 587 if you are connecting directly to smtp.gmail.com to send ssl mail. It looks like you are using port 25, are you sure that your `Settings.Get("ssl")` returns false? [Read here for details.](http://mail.google.com/support/bin/answer.py?hl=en...
496,568
<p>Is there any way to access all WiFi access points and their respective RSSI values using .NET? It would be really nice if I could do it without using unmanaged code or even better if it worked in mono as well as .NET.</p> <p>If it is possible i would appriciate a code sample. Thanks</p> <hr> <p>Here are a few sim...
[ { "answer_id": 496580, "author": "andynormancx", "author_id": 46354, "author_profile": "https://Stackoverflow.com/users/46354", "pm_score": 0, "selected": false, "text": "<p>You <em>might</em> be able to achieve it using WMI queries. Take a look at this <a href=\"http://social.msdn.micro...
2009/01/30
[ "https://Stackoverflow.com/questions/496568", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45719/" ]
Is there any way to access all WiFi access points and their respective RSSI values using .NET? It would be really nice if I could do it without using unmanaged code or even better if it worked in mono as well as .NET. If it is possible i would appriciate a code sample. Thanks --- Here are a few similiar stackoverflo...
It is a wrapper project with managed code in c# at <http://www.codeplex.com/managedwifi> It supports Windows Vista and XP SP2 (or later version). sample code: ``` using NativeWifi; using System; using System.Text; namespace WifiExample { class Program { /// <summary> /// Converts a 802.11 SS...
496,576
<p>A question was asked recently about <a href="https://stackoverflow.com/questions/471056/removing-sourcesafe-integration-from-visual-studio-6">removing SourceSafe integration from Visual Studio 6</a>. I need to do the same with Visual Studio 2008.</p> <p>Our team uses Subversion and I have installed AnkhSVN, the Sub...
[ { "answer_id": 496590, "author": "Nick Berardi", "author_id": 17, "author_profile": "https://Stackoverflow.com/users/17", "pm_score": 0, "selected": false, "text": "<p>You can usually edit the *.sln file and *.??proj file with out an problems to remove these bindings. These two files ar...
2009/01/30
[ "https://Stackoverflow.com/questions/496576", "https://Stackoverflow.com", "https://Stackoverflow.com/users/60738/" ]
A question was asked recently about [removing SourceSafe integration from Visual Studio 6](https://stackoverflow.com/questions/471056/removing-sourcesafe-integration-from-visual-studio-6). I need to do the same with Visual Studio 2008. Our team uses Subversion and I have installed AnkhSVN, the Subversion plug-in for V...
Found it! [MS's Help and Support site](http://msdn.microsoft.com/en-us/library/bb166193.aspx) describes it, see section 2 Add a DWORD registry key at: ``` HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SourceSafe\HideInVisualStudio ``` Set it to 1. Restart VS2008 and the SourceSafe plug-in option is gone.
496,646
<p>I read that you should define your JavaScript functions in the <code>&lt;head&gt;</code> tag, but how does the location of the <code>&lt;script&gt;</code> (whether in the <code>&lt;head&gt;</code>, <code>&lt;body&gt;</code>, or any other tag) affect a JavaScript function. </p> <p>Specifically, how does it affect t...
[ { "answer_id": 496652, "author": "Otávio Décio", "author_id": 48684, "author_profile": "https://Stackoverflow.com/users/48684", "pm_score": 1, "selected": false, "text": "<p>If you have an inline script (outside functions) located before functions it may call, you may get an error becaus...
2009/01/30
[ "https://Stackoverflow.com/questions/496646", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25847/" ]
I read that you should define your JavaScript functions in the `<head>` tag, but how does the location of the `<script>` (whether in the `<head>`, `<body>`, or any other tag) affect a JavaScript function. Specifically, how does it affect the scope of the function and where you can call it from?
Telling people to add `<SCRIPT>` only in the head **sounds** like a reasonable thing to do, but as others have said there are many reasons why this isn't recommended or even practical - mainly speed and the way that HTML pages are generated dynamically. This is what the [HTML 4 spec says](http://www.w3.org/TR/REC-html...
496,651
<p>How do I connect to a remote URL in Java which requires authentication. I'm trying to find a way to modify the following code to be able to programatically provide a username/password so it doesn't throw a 401.</p> <pre><code>URL url = new URL(String.format("http://%s/manager/list", _host + ":8080")); HttpURLConnec...
[ { "answer_id": 496707, "author": "James Van Huis", "author_id": 31828, "author_profile": "https://Stackoverflow.com/users/31828", "pm_score": 8, "selected": true, "text": "<p>You can set the default authenticator for http requests like this:</p>\n\n<pre><code>Authenticator.setDefault (ne...
2009/01/30
[ "https://Stackoverflow.com/questions/496651", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14128/" ]
How do I connect to a remote URL in Java which requires authentication. I'm trying to find a way to modify the following code to be able to programatically provide a username/password so it doesn't throw a 401. ``` URL url = new URL(String.format("http://%s/manager/list", _host + ":8080")); HttpURLConnection connectio...
You can set the default authenticator for http requests like this: ``` Authenticator.setDefault (new Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication ("username", "password".toCharArray()); } }); ``` Also, if you require more flexibili...
496,658
<p>Here's my situation:</p> <p>I'm trying to create a SSL certificate that will be installed on all developer's machine's, along with two internal servers (everything is non-production).</p> <p>What do I need to do to create a certificate that can be installed in all of these places?</p> <p>Right now I've got someth...
[ { "answer_id": 496738, "author": "Roger Lipscombe", "author_id": 8446, "author_profile": "https://Stackoverflow.com/users/8446", "pm_score": 8, "selected": true, "text": "<p>Here are my scripts for doing this:</p>\n\n<h3>Create Certificate Authority</h3>\n\n<p>Create a self-signed certif...
2009/01/30
[ "https://Stackoverflow.com/questions/496658", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30006/" ]
Here's my situation: I'm trying to create a SSL certificate that will be installed on all developer's machine's, along with two internal servers (everything is non-production). What do I need to do to create a certificate that can be installed in all of these places? Right now I've got something along these lines, u...
Here are my scripts for doing this: ### Create Certificate Authority Create a self-signed certificate (-r), with an exportable private key (-pe), using SHA1 (-r), for signing (-sky signature). The private key is written to a file (-sv). ``` makecert -r -pe -n "CN=My Root Authority" -ss CA -sr CurrentUser ^ ...
496,663
<p>any problems with doing this?</p> <pre><code>int i = new StreamReader("file.txt").ReadToEnd().Split(new char[] {'\n'}).Length </code></pre>
[ { "answer_id": 496678, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 3, "selected": false, "text": "<p>Well, the problem with doing this is that you allocate a <em>lot</em> of memory when doing this on large files.</p...
2009/01/30
[ "https://Stackoverflow.com/questions/496663", "https://Stackoverflow.com", "https://Stackoverflow.com/users/54009/" ]
any problems with doing this? ``` int i = new StreamReader("file.txt").ReadToEnd().Split(new char[] {'\n'}).Length ```
The method you posted isn't particularly good. Lets break this apart: ``` // new StreamReader("file.txt").ReadToEnd().Split(new char[] {'\n'}).Length // becomes this: var file = new StreamReader("file.txt").ReadToEnd(); // big string var lines = file.Split(new char[] {'\n'}); // big array var count = lin...
496,664
<p>This is a follow-up to <a href="https://stackoverflow.com/q/483797/1288">Dynamic Shared Library compilation with g++</a>.</p> <p>I'm trying to create a shared class library in C++ on Linux. I'm able to get the library to compile, and I can call some of the (non-class) functions using the tutorials that I found <a ...
[ { "answer_id": 497067, "author": "nimrodm", "author_id": 23388, "author_profile": "https://Stackoverflow.com/users/23388", "pm_score": 6, "selected": false, "text": "<p>The following shows an example of a shared class library shared.[h,cpp] and a main.cpp module using the library. It's a...
2009/01/30
[ "https://Stackoverflow.com/questions/496664", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1288/" ]
This is a follow-up to [Dynamic Shared Library compilation with g++](https://stackoverflow.com/q/483797/1288). I'm trying to create a shared class library in C++ on Linux. I'm able to get the library to compile, and I can call some of the (non-class) functions using the tutorials that I found [here](https://stackoverf...
**myclass.h** ``` #ifndef __MYCLASS_H__ #define __MYCLASS_H__ class MyClass { public: MyClass(); /* use virtual otherwise linker will try to perform static linkage */ virtual void DoSomething(); private: int x; }; #endif ``` **myclass.cc** ``` #include "myclass.h" #include <iostream> using namespace st...
496,702
<p>I'm trying to write a shell script that, when run, will set some environment variables that will stay set in the caller's shell.</p> <pre><code>setenv FOO foo </code></pre> <p>in csh/tcsh, or</p> <pre><code>export FOO=foo </code></pre> <p>in sh/bash only set it during the script's execution.</p> <p>I already kn...
[ { "answer_id": 496776, "author": "Thomas Kammeyer", "author_id": 4410, "author_profile": "https://Stackoverflow.com/users/4410", "pm_score": 6, "selected": false, "text": "<p>You're not going to be able to modify the caller's shell because it's in a different process context. When child...
2009/01/30
[ "https://Stackoverflow.com/questions/496702", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3832/" ]
I'm trying to write a shell script that, when run, will set some environment variables that will stay set in the caller's shell. ``` setenv FOO foo ``` in csh/tcsh, or ``` export FOO=foo ``` in sh/bash only set it during the script's execution. I already know that ``` source myscript ``` will run the command...
Your shell process has a copy of the parent's environment and no access to the parent process's environment whatsoever. When your shell process terminates any changes you've made to its environment are lost. Sourcing a script file is the most commonly used method for configuring a shell environment, you may just want t...
496,704
<p>I have two arrays built while parsing a text file. The first contains the column names, the second contains the values from the current row. I need to iterate over both lists at once to build a map. Right now I have the following:</p> <pre><code>var currentValues = currentRow.Split(separatorChar); var valueEnumerat...
[ { "answer_id": 496724, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 2, "selected": false, "text": "<p>If you're really using arrays, the best way is probably just to use the conventional <code>for</code> loop with in...
2009/01/30
[ "https://Stackoverflow.com/questions/496704", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8078/" ]
I have two arrays built while parsing a text file. The first contains the column names, the second contains the values from the current row. I need to iterate over both lists at once to build a map. Right now I have the following: ``` var currentValues = currentRow.Split(separatorChar); var valueEnumerator = currentVa...
if there are the same number of column names as there are elements in each row, could you not use a for loop? ``` var currentValues = currentRow.Split(separatorChar); for(var i=0;i<columnList.Length;i++){ // use i to index both (or all) arrays and build your map } ```
496,711
<p>I am writing a class that implements the following method:</p> <pre><code>public void run(javax.sql.DataSource dataSource); </code></pre> <p>Within this method, I wish to construct a Spring application context using a configuration file similar to the following:</p> <pre><code>&lt;bean id="dataSource" abstract="t...
[ { "answer_id": 496737, "author": "duffymo", "author_id": 37213, "author_profile": "https://Stackoverflow.com/users/37213", "pm_score": 0, "selected": false, "text": "<p>If you create an object by calling \"new\", it's not under the control of the Spring factory. </p>\n\n<p>Why not have ...
2009/01/30
[ "https://Stackoverflow.com/questions/496711", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41619/" ]
I am writing a class that implements the following method: ``` public void run(javax.sql.DataSource dataSource); ``` Within this method, I wish to construct a Spring application context using a configuration file similar to the following: ``` <bean id="dataSource" abstract="true" /> <bean id="dao" class="my.Dao"> ...
I discovered two Spring interfaces can be used to implement what I need. The [BeanNameAware](http://static.springframework.org/spring/docs/2.5.x/api/org/springframework/beans/factory/BeanNameAware.html) interface allows Spring to tell an object its name within an application context by calling the [setBeanName(String)]...
496,713
<p>I have a project in subversion, called inboundem. It was my first, and when I created it, I omitted trunk. I need to get it into the correct structure as inboundem/trunk. I had another project like this, but as there were no revisions, I did <code>svn delete</code> and then <code>svn import</code> and that worked we...
[ { "answer_id": 496721, "author": "James McMahon", "author_id": 20774, "author_profile": "https://Stackoverflow.com/users/20774", "pm_score": 2, "selected": false, "text": "<p>Why not just create a folder in the project root named \"trunk\" and then move all the files/folder in root into ...
2009/01/30
[ "https://Stackoverflow.com/questions/496713", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13667/" ]
I have a project in subversion, called inboundem. It was my first, and when I created it, I omitted trunk. I need to get it into the correct structure as inboundem/trunk. I had another project like this, but as there were no revisions, I did `svn delete` and then `svn import` and that worked well. But I have a lot of r...
``` svn mv svn://repo/inboundem svn://repo/trunk svn mkdir svn://repo/inboundem svn mv svn://repo/trunk svn://repo/inboundem/trunk ```
496,722
<p>For example:</p> <pre><code>Queue&lt;System.Drawing.SolidBrush&gt; brushQ = new Queue&lt;System.Drawing.SolidBrush&gt;(); ... brushQ.Clear(); </code></pre> <p>If I don't explicitly dequeue each item and dispose of them individually, do the remaining items get disposed when calling Clear()? How about when the queue...
[ { "answer_id": 496735, "author": "On Freund", "author_id": 2150, "author_profile": "https://Stackoverflow.com/users/2150", "pm_score": 3, "selected": true, "text": "<p>When do you expect them to be disposed? How will the collection know if there are other references to the objects in it?...
2009/01/30
[ "https://Stackoverflow.com/questions/496722", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21727/" ]
For example: ``` Queue<System.Drawing.SolidBrush> brushQ = new Queue<System.Drawing.SolidBrush>(); ... brushQ.Clear(); ``` If I don't explicitly dequeue each item and dispose of them individually, do the remaining items get disposed when calling Clear()? How about when the queue is garbage collected? Assuming the a...
When do you expect them to be disposed? How will the collection know if there are other references to the objects in it?
496,751
<p>I have a web service load driver that's a Windows Script File (WSF), that includes some VBScript and JavaScript files. My web service requires that the incoming message is base64 encoded. I currently have a VBScript function that does this, but it's very inefficient (memory intensive, mostly due to VBScripts awful s...
[ { "answer_id": 506992, "author": "Patrick Cuff", "author_id": 7903, "author_profile": "https://Stackoverflow.com/users/7903", "pm_score": 7, "selected": true, "text": "<p>I was originally using some VBScript code from Antonin Foller: \n<a href=\"http://www.motobit.com/tips/detpg_Base64En...
2009/01/30
[ "https://Stackoverflow.com/questions/496751", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7903/" ]
I have a web service load driver that's a Windows Script File (WSF), that includes some VBScript and JavaScript files. My web service requires that the incoming message is base64 encoded. I currently have a VBScript function that does this, but it's very inefficient (memory intensive, mostly due to VBScripts awful stri...
I was originally using some VBScript code from Antonin Foller: [Base64 Encode VBS Function](http://www.motobit.com/tips/detpg_Base64Encode/) and [Base64 Decode VBS Function](http://www.motobit.com/tips/detpg_Base64/). Searching Antonin's site, I saw he had some code for [quoted printable encoding, using the CDO.Mess...
496,805
<p>I have been running SQL Server 2005 Express Management Studio ("SSMSE"), and I now have a need to install the full version of Management Studio ("SSMS"). This is a known hassle, but I've not found a comprehensive way to carry it out.</p> <p>At first, I uninstalled SSMSE, and then ran <code>SqlRun_Tools.msi</code> t...
[ { "answer_id": 497598, "author": "eksortso", "author_id": 446456, "author_profile": "https://Stackoverflow.com/users/446456", "pm_score": 0, "selected": false, "text": "<p>Well, I roughly found out what the problem was, based on a <a href=\"http://groups.google.com.tw/group/microsoft.pub...
2009/01/30
[ "https://Stackoverflow.com/questions/496805", "https://Stackoverflow.com", "https://Stackoverflow.com/users/446456/" ]
I have been running SQL Server 2005 Express Management Studio ("SSMSE"), and I now have a need to install the full version of Management Studio ("SSMS"). This is a known hassle, but I've not found a comprehensive way to carry it out. At first, I uninstalled SSMSE, and then ran `SqlRun_Tools.msi` to install the toolset...
I have also installed SQL Management Studio before just using the `SqlRun_Tools.msi` package without any problems but I think if you have previously had any other SQL Server 2005 components installed then you will need to install the Setup Support Files first as this is probably what sets up the component installation ...
496,807
<p>Having been bored out of my brains the last few days off work sick, I decided to try and dig up some old code. I could find some binary versions of some ancient Atari ST stuff I wrote, but I couldn't find any source. I did manage to dredge up an old ModeX library I wrote in ASM many moons ago from an archive of the ...
[ { "answer_id": 500682, "author": "Osama Al-Maadeed", "author_id": 25544, "author_profile": "https://Stackoverflow.com/users/25544", "pm_score": 1, "selected": false, "text": "<p>Most of the code I had from the Atari ST was in GFA-Basic, I wouldn't want to touch those dusty floppies.</p>\...
2009/01/30
[ "https://Stackoverflow.com/questions/496807", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26507/" ]
Having been bored out of my brains the last few days off work sick, I decided to try and dig up some old code. I could find some binary versions of some ancient Atari ST stuff I wrote, but I couldn't find any source. I did manage to dredge up an old ModeX library I wrote in ASM many moons ago from an archive of the leg...
I have a MUD I wrote and maintained during college, back in 1990-1993. All C. It was a derivation of Diku MUD called SillyMUD, and it was my pride and joy at the time. You can still find the code on the Intertubes, here and there.
496,814
<p>in my python program to upload a file to the internet, im using a GTK progress bar to show the upload progress. But the problems that im facing is that the progress bar does not show any activity until the upload is complete, and then it abruptly indicates upload complete. im using pycurl to make the http requests...
[ { "answer_id": 496995, "author": "codelogic", "author_id": 43427, "author_profile": "https://Stackoverflow.com/users/43427", "pm_score": 1, "selected": false, "text": "<p>More than likely the issue is that in your progress callback, which is where I presume you're updating the progress b...
2009/01/30
[ "https://Stackoverflow.com/questions/496814", "https://Stackoverflow.com", "https://Stackoverflow.com/users/58385/" ]
in my python program to upload a file to the internet, im using a GTK progress bar to show the upload progress. But the problems that im facing is that the progress bar does not show any activity until the upload is complete, and then it abruptly indicates upload complete. im using pycurl to make the http requests...my...
I'm going to quote the [PyGTK FAQ](http://faq.pygtk.org/index.py?req=show&file=faq23.020.htp): > > You have created a progress bar inside a window, then you start running a loop that does some work: > > > ``` while work_left: ...do something... progressbar.set_fraction(...) ``` > > You will notice that...
496,854
<p>I'm writing a custom control derived from <code>System.Windows.Forms.Control</code>.</p> <p>The control is using the <code>Control.KeyDown</code> event, to watch keystrokes: I should handle some keystrokes (for example <code>&lt;Ctrl&gt;-K</code>) as hotkeys, which cause me to launch a dialog box.</p> <p>If I laun...
[ { "answer_id": 496951, "author": "MusiGenesis", "author_id": 14606, "author_profile": "https://Stackoverflow.com/users/14606", "pm_score": 0, "selected": false, "text": "<p>You can kick off the dialog from a method defined in your form, and start the method from a new thread (include Sys...
2009/01/30
[ "https://Stackoverflow.com/questions/496854", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49942/" ]
I'm writing a custom control derived from `System.Windows.Forms.Control`. The control is using the `Control.KeyDown` event, to watch keystrokes: I should handle some keystrokes (for example `<Ctrl>-K`) as hotkeys, which cause me to launch a dialog box. If I launch the dialog from my `onKeyDown` event handler, the dia...
My first thought was "set the SurpressKeyPress property *before* opening the dialog", but that's not really answering your question. If you really need to return from the event handler before opening the dialog, take a look at the BeginInvoke method. you could do something like this: ``` ... this.BeginInvoke(new Invo...
496,856
<p>I switched my DAL from using LINQ over to Entity Framework. Because my application connects to different databases depending on the current user, I need to dynamically create the DataContext at run time and pass in the appropriate connection string. However, when I tried to programatically create an Entity Framewo...
[ { "answer_id": 496898, "author": "Randolpho", "author_id": 12716, "author_profile": "https://Stackoverflow.com/users/12716", "pm_score": 4, "selected": true, "text": "<p>You will find these links very informative:</p>\n\n<p><a href=\"http://msdn.microsoft.com/en-us/library/system.data.en...
2009/01/30
[ "https://Stackoverflow.com/questions/496856", "https://Stackoverflow.com", "https://Stackoverflow.com/users/57698/" ]
I switched my DAL from using LINQ over to Entity Framework. Because my application connects to different databases depending on the current user, I need to dynamically create the DataContext at run time and pass in the appropriate connection string. However, when I tried to programatically create an Entity Framework co...
You will find these links very informative: <http://msdn.microsoft.com/en-us/library/system.data.entityclient.entityconnection.connectionstring.aspx> <http://weblogs.asp.net/pgielens/archive/2006/08/21/ADO.NET-Entity-Framework-Metadata.aspx> Bottom line? Entity Framework needs the metadata to build your entity mappi...
496,896
<p>Lets say I have this array,</p> <pre><code>int[] numbers = {1, 3, 4, 9, 2}; </code></pre> <p>How can I delete an element by "name"? , lets say number 4?</p> <p>Even <code>ArrayList</code> didn't help to delete?</p> <pre><code>string strNumbers = " 1, 3, 4, 9, 2"; ArrayList numbers = new ArrayList(strNumbers.Spli...
[ { "answer_id": 496989, "author": "ctacke", "author_id": 13154, "author_profile": "https://Stackoverflow.com/users/13154", "pm_score": 3, "selected": false, "text": "<p>Removing from an array itself is not simple, as you then have to deal with resizing. This is one of the great advantage...
2009/01/30
[ "https://Stackoverflow.com/questions/496896", "https://Stackoverflow.com", "https://Stackoverflow.com/users/459737/" ]
Lets say I have this array, ``` int[] numbers = {1, 3, 4, 9, 2}; ``` How can I delete an element by "name"? , lets say number 4? Even `ArrayList` didn't help to delete? ``` string strNumbers = " 1, 3, 4, 9, 2"; ArrayList numbers = new ArrayList(strNumbers.Split(new char[] { ',' })); numbers.RemoveAt(numbers.IndexO...
***If you want to remove all instances of 4 without needing to know the index:*** ***LINQ:*** (.NET Framework 3.5) ``` int[] numbers = { 1, 3, 4, 9, 2 }; int numToRemove = 4; numbers = numbers.Where(val => val != numToRemove).ToArray(); ``` ***Non-LINQ:*** (.NET Framework 2.0) ``` static bool isNotFour(int n) { ...
496,900
<p>has anyone ever tried to get the list of all the movieclips (even the nested ones) that are on Stage at a specified stopped (and current) frame in Flash 8, AS 2?</p> <p>I did the following:</p> <pre><code>for(i in _root){ if(typeof(_root[i])=="movieclip"){ trace(_root[i]);} } </code></pre> <p>But this is good for...
[ { "answer_id": 496927, "author": "brettkelly", "author_id": 60664, "author_profile": "https://Stackoverflow.com/users/60664", "pm_score": 0, "selected": false, "text": "<p>My AS2 experience is pretty limited (I've done bit of AS3), but here goes:</p>\n\n<p>What if you wrote a recursive f...
2009/01/30
[ "https://Stackoverflow.com/questions/496900", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
has anyone ever tried to get the list of all the movieclips (even the nested ones) that are on Stage at a specified stopped (and current) frame in Flash 8, AS 2? I did the following: ``` for(i in _root){ if(typeof(_root[i])=="movieclip"){ trace(_root[i]);} } ``` But this is good for a first level search: that is, i...
Are you just trying to trace? If so there's a nice little undocumented utility called ObjectDumper that can do this. [This is probably the best explanation of it out there](http://blogs.adobe.com/jdehaan/2005/04/hidden_component_goodness_obje.html) So what you can do is this: ``` import mx.data.binding.ObjectDumper...
496,916
<p>I have the following Nant Script snippet.</p> <pre><code>&lt;zip zipfile="${devEnvironment}..\dev-${datetime::get-year(datetime::now())}${datetime::get-month(datetime::now())}${datetime::get-day(datetime::now())}.zip"&gt; &lt;fileset basedir="${devEnvironment}"&gt; &lt;include name="**/*"/&gt; &lt;/...
[ { "answer_id": 497007, "author": "Charlie Martin", "author_id": 35092, "author_profile": "https://Stackoverflow.com/users/35092", "pm_score": 2, "selected": true, "text": "<p>Run it verbose. I'll bet a dollar the macro expansion is evaluating to something you don't expect.</p>\n" }, ...
2009/01/30
[ "https://Stackoverflow.com/questions/496916", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28540/" ]
I have the following Nant Script snippet. ``` <zip zipfile="${devEnvironment}..\dev-${datetime::get-year(datetime::now())}${datetime::get-month(datetime::now())}${datetime::get-day(datetime::now())}.zip"> <fileset basedir="${devEnvironment}"> <include name="**/*"/> </fileset> </zip> ``` The `devEnvir...
Run it verbose. I'll bet a dollar the macro expansion is evaluating to something you don't expect.
496,928
<p>Which of the following is better?</p> <pre><code>a instanceof B </code></pre> <p>or</p> <pre><code>B.class.isAssignableFrom(a.getClass()) </code></pre> <p>The only difference that I know of is, when 'a' is null, the first returns false, while the second throws an exception. Other than that, do they always give t...
[ { "answer_id": 496968, "author": "Adam Rosenfield", "author_id": 9530, "author_profile": "https://Stackoverflow.com/users/9530", "pm_score": 8, "selected": false, "text": "<p><code>instanceof</code> can only be used with reference types, not primitive types. <code>isAssignableFrom()</co...
2009/01/30
[ "https://Stackoverflow.com/questions/496928", "https://Stackoverflow.com", "https://Stackoverflow.com/users/54318/" ]
Which of the following is better? ``` a instanceof B ``` or ``` B.class.isAssignableFrom(a.getClass()) ``` The only difference that I know of is, when 'a' is null, the first returns false, while the second throws an exception. Other than that, do they always give the same result?
When using `instanceof`, you need to know the class of `B` at compile time. When using `isAssignableFrom()` it can be dynamic and change during runtime.
496,935
<p>I am trying to set every row's CheckColor to <i>Blue</i> in the table tblCheckbook (why the hell do people add tbl to the start of every table, I think I know it's a table).</p> <p>I'm using this query</p> <pre><code>UPDATE tblCheckbook SET CheckColor = Blue </code></pre> <p>However, Microsoft SQL Server...
[ { "answer_id": 496939, "author": "dkretz", "author_id": 31641, "author_profile": "https://Stackoverflow.com/users/31641", "pm_score": 3, "selected": false, "text": "<p>use 'Blue' not Blue</p>\n" }, { "answer_id": 496941, "author": "gkrogers", "author_id": 54501, "auth...
2009/01/30
[ "https://Stackoverflow.com/questions/496935", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12243/" ]
I am trying to set every row's CheckColor to *Blue* in the table tblCheckbook (why the hell do people add tbl to the start of every table, I think I know it's a table). I'm using this query ``` UPDATE tblCheckbook SET CheckColor = Blue ``` However, Microsoft SQL Server Management Studio Express complains I...
Try this: ``` UPDATE tblCheckbook SET CheckColor = 'Blue' ```
496,943
<p>i have the application on environment in IIS 5.1 under "localhost/mvcapplication1"</p> <p>The routing configuration is something like:</p> <pre><code> routes.MapRoute("mvc-default", "{controller}.mvc/{action}/{id}" , new { controller = "Home", action = "Index", id = (string)null }); routes.MapRout...
[ { "answer_id": 500757, "author": "Parsa", "author_id": 60996, "author_profile": "https://Stackoverflow.com/users/60996", "pm_score": 2, "selected": false, "text": "<p>You're encountering 404 error because you've set the routing rule \"{controller}.mvc/{action}/{id}\", which obviously ad...
2009/01/30
[ "https://Stackoverflow.com/questions/496943", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
i have the application on environment in IIS 5.1 under "localhost/mvcapplication1" The routing configuration is something like: ``` routes.MapRoute("mvc-default", "{controller}.mvc/{action}/{id}" , new { controller = "Home", action = "Index", id = (string)null }); routes.MapRoute("Root", "" ,...
You're encountering 404 error because you've set the routing rule "{controller}.mvc/{action}/{id}", which obviously adds .mvc extension after the controller name, and the "" routing rule wouldn't take precede, even work because you're using unconfigured IIS. To fix it without configuring IIS, you can change .mvc to ...
496,961
<p>How can I hook up an event to a function name I have defined as a string?</p> <p>I'm using Prototype.js, although this is not Prototype-speficic.</p> <pre><code>$(inputId).observe('click', formData.fields[x].onclick); </code></pre> <p>This would result in JavaScript complaining that my handler is not a function. ...
[ { "answer_id": 496972, "author": "Greg", "author_id": 24181, "author_profile": "https://Stackoverflow.com/users/24181", "pm_score": 7, "selected": true, "text": "<p><a href=\"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Property_Accessors\" rel=\"noreferrer...
2009/01/30
[ "https://Stackoverflow.com/questions/496961", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12579/" ]
How can I hook up an event to a function name I have defined as a string? I'm using Prototype.js, although this is not Prototype-speficic. ``` $(inputId).observe('click', formData.fields[x].onclick); ``` This would result in JavaScript complaining that my handler is not a function. I would prefer not us use `eval()...
[Property accessors](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Property_Accessors) can be used to access any object's properties or functions. If the function is in the global scope, you can get it using the window object: ``` var myFunc = window[myFuncName]; ``` This also works wi...
496,982
<p>Consider the following radio button example.</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"&gt; &lt;mx:Script&gt; &lt;![CDATA[ private function getRb1():RadioButton { trace(rb1 == null); return rb1; ...
[ { "answer_id": 497230, "author": "Christian Nunciato", "author_id": 32129, "author_profile": "https://Stackoverflow.com/users/32129", "pm_score": 2, "selected": true, "text": "<p>I'm not quite sure what you're asking, but hopefully this'll answer your question -- from the Flex docs:</p>\...
2009/01/30
[ "https://Stackoverflow.com/questions/496982", "https://Stackoverflow.com", "https://Stackoverflow.com/users/60786/" ]
Consider the following radio button example. ``` <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"> <mx:Script> <![CDATA[ private function getRb1():RadioButton { trace(rb1 == null); return rb1; } ]]> </mx:Script> <mx:VBox> ...
I'm not quite sure what you're asking, but hopefully this'll answer your question -- from the Flex docs: > > **RadioButtonGroup.selection** > Contains a reference to the currently > selected RadioButton control in the > group. You can access the property in > ActionScript only; *it is not settable > in MXML*. S...