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
449,131
<p>In my application, I need to change some value ("Environment") in appSetting of app.config at runtime.</p> <p>I use AppSettingsReader</p> <pre><code> private static AppSettingsReader _settingReader; public static AppSettingsReader SettingReader { get { if (_settingReader ==...
[ { "answer_id": 449238, "author": "Jonathan Allen", "author_id": 5274, "author_profile": "https://Stackoverflow.com/users/5274", "pm_score": 0, "selected": false, "text": "<pre><code>System.Configuration.ApplicationSettingsBase.Reload\n</code></pre>\n" }, { "answer_id": 449651, ...
2009/01/16
[ "https://Stackoverflow.com/questions/449131", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26447/" ]
In my application, I need to change some value ("Environment") in appSetting of app.config at runtime. I use AppSettingsReader ``` private static AppSettingsReader _settingReader; public static AppSettingsReader SettingReader { get { if (_settingReader == null) { ...
AppSettingsReader doesn't seem to have any method to reload from disk. It just derives from Object. Creating a new instance seems to be the only thing that would work... I may be wrong, but AppSettings are supposed to be read-only values for your app. More like configuration parameters for your application that can be ...
449,138
<p>I have a form which contains a whole heap of data entry fields that will be completed by the user including some elements where the user can dictate how many of the same items they will enter. This is as is being used in Phil Haack's blog entry <a href="http://haacked.com/archive/2008/10/23/model-binding-to-a-list.a...
[ { "answer_id": 449198, "author": "Schotime", "author_id": 29376, "author_profile": "https://Stackoverflow.com/users/29376", "pm_score": 1, "selected": false, "text": "<p>You could just add the myItem as a parameter like so:</p>\n\n<pre><code>public ActionResult Add(FormCollection form, L...
2009/01/16
[ "https://Stackoverflow.com/questions/449138", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17248/" ]
I have a form which contains a whole heap of data entry fields that will be completed by the user including some elements where the user can dictate how many of the same items they will enter. This is as is being used in Phil Haack's blog entry [Model Binding To A List](http://haacked.com/archive/2008/10/23/model-bindi...
I have decided to work with exclusively with the `FormCollection` rather than muddying the waters with some data being passed through using `FormCollection` and other data being mapped to a List by the framework. The below code takes the items and hydrates the DTO manually. This works nicely and allows me to do some ot...
449,140
<p>I'm trying to create a bunch of entries in a database with a single script and the problem I'm encountering is how to reference the generated primary key of the previous entry I created.</p> <p>For example if I created a customer, then tried to create an order for that customer, how do I get the primary key generat...
[ { "answer_id": 449146, "author": "Spencer Ruport", "author_id": 52551, "author_profile": "https://Stackoverflow.com/users/52551", "pm_score": 3, "selected": true, "text": "<p>Like so:</p>\n\n<pre><code>DECLARE @customerid int;\nINSERT INTO customers(name) VALUES('Spencer');\nSET @custome...
2009/01/16
[ "https://Stackoverflow.com/questions/449140", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34859/" ]
I'm trying to create a bunch of entries in a database with a single script and the problem I'm encountering is how to reference the generated primary key of the previous entry I created. For example if I created a customer, then tried to create an order for that customer, how do I get the primary key generated for the...
Like so: ``` DECLARE @customerid int; INSERT INTO customers(name) VALUES('Spencer'); SET @customerid = @@IDENTITY; ``` **EDIT:** Apparently it needs to be SCOPE\_IDENTITY() in order to function as expected with triggers. ``` DECLARE @customerid int; INSERT INTO customers(name) VALUES('Spencer'); SET @customerid = ...
449,142
<p>I'm in the process of designing a system that will allow me to represent broad-scope tasks as workflows, which expose their workitems via an IEnumerable method. The intention here is to use C#'s 'yield' mechanism to allow me to write psuedo-procedural code that the workflow execution system can execute as it sees fi...
[ { "answer_id": 449157, "author": "duffymo", "author_id": 37213, "author_profile": "https://Stackoverflow.com/users/37213", "pm_score": 3, "selected": true, "text": "<p>Personally, this would be a \"buy before build\" decision for me. I'd buy something before I'd write it. </p>\n\n<p>I ...
2009/01/16
[ "https://Stackoverflow.com/questions/449142", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16942/" ]
I'm in the process of designing a system that will allow me to represent broad-scope tasks as workflows, which expose their workitems via an IEnumerable method. The intention here is to use C#'s 'yield' mechanism to allow me to write psuedo-procedural code that the workflow execution system can execute as it sees fit. ...
Personally, this would be a "buy before build" decision for me. I'd buy something before I'd write it. I work for a company that's rather large and can be foolish with its money, so if you're writing this for yourself and can't buy something I'll retract the comment. Here are a few random ideas: I'd externalize th...
449,158
<p>This question is somewhat related to <a href="https://stackoverflow.com/questions/134858/whats-the-simplest-way-to-make-a-http-get-request-in-perl">What’s the simplest way to make a HTTP GET request in Perl?</a>.</p> <p>Before making the request via <code>LWP::Simple</code> I have a hash of query string components ...
[ { "answer_id": 449204, "author": "Leon Timmermans", "author_id": 4727, "author_profile": "https://Stackoverflow.com/users/4727", "pm_score": 5, "selected": true, "text": "<p><a href=\"http://search.cpan.org/perldoc?URI::Escape\" rel=\"noreferrer\">URI::Escape</a> does what you want.</p>\...
2009/01/16
[ "https://Stackoverflow.com/questions/449158", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3594/" ]
This question is somewhat related to [What’s the simplest way to make a HTTP GET request in Perl?](https://stackoverflow.com/questions/134858/whats-the-simplest-way-to-make-a-http-get-request-in-perl). Before making the request via `LWP::Simple` I have a hash of query string components that I need to serialize/escape....
[URI::Escape](http://search.cpan.org/perldoc?URI::Escape) does what you want. ``` use URI::Escape; sub escape_hash { my %hash = @_; my @pairs; for my $key (keys %hash) { push @pairs, join "=", map { uri_escape($_) } $key, $hash{$key}; } return join "&", @pairs; } ```
449,159
<p>I often accidently step into code that I'm not interested in while debugging in Delphi.</p> <p>Let's start by saying that I know that you can step over with F8, and that you can run to a certain line with f4.</p> <p>Example:</p> <pre><code>function TMyClass.DoStuff():Integer; begin // do some stuff bla(); end...
[ { "answer_id": 449173, "author": "utku_karatas", "author_id": 14716, "author_profile": "https://Stackoverflow.com/users/14716", "pm_score": 2, "selected": false, "text": "<p>AFAIK, the debugger is only aware of the files in Browsing Path that you can modify in Options. So if you exclude ...
2009/01/16
[ "https://Stackoverflow.com/questions/449159", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38813/" ]
I often accidently step into code that I'm not interested in while debugging in Delphi. Let's start by saying that I know that you can step over with F8, and that you can run to a certain line with f4. Example: ``` function TMyClass.DoStuff():Integer; begin // do some stuff bla(); end; procedure TMyClass.Foo() ...
There is a "magic nodebug switch". {$D-} will disable the generation of debug code. Place that at the top of your FastMM unit and you won't end up tracing into it. And if you do end up in a function you don't want to be in, SHIFT-F8 will get you out very quickly. (**WARNING:** Don't use SHIFT-F8 from inside an assembly...
449,172
<p>I found this line of code in the Virtuemart plugin for Joomla on line 2136 in administrator/components/com_virtuemart/classes/ps_product.php</p> <pre><code>eval ("\$text_including_tax = \"$text_including_tax\";"); </code></pre>
[ { "answer_id": 449177, "author": "alex", "author_id": 31671, "author_profile": "https://Stackoverflow.com/users/31671", "pm_score": 0, "selected": false, "text": "<p>It is evaluating the string as PHP code.</p>\n\n<p>But it seems to be making a variable equal itself? Weird.</p>\n" }, ...
2009/01/16
[ "https://Stackoverflow.com/questions/449172", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1797/" ]
I found this line of code in the Virtuemart plugin for Joomla on line 2136 in administrator/components/com\_virtuemart/classes/ps\_product.php ``` eval ("\$text_including_tax = \"$text_including_tax\";"); ```
Scrap my previous answer. The reason this eval() is here is shown in the [php eval docs](http://www.php.net/eval) This is what's happening: ``` $text_including_tax = '$tax <a href="...">...</a>'; ... $tax = 10; ... eval ("\$text_including_tax = \"$text_including_tax\";"); ``` At the end of this `$text_includin...
449,194
<p>I'm still learning Castle Windsor and I see that it supports forwarded types - a term I was unfamiliar with.</p> <p>Quick Google search and I found <a href="http://msdn.microsoft.com/en-us/library/ms404275.aspx" rel="nofollow noreferrer">this</a> article that explains it pretty throughly however I still don't under...
[ { "answer_id": 449177, "author": "alex", "author_id": 31671, "author_profile": "https://Stackoverflow.com/users/31671", "pm_score": 0, "selected": false, "text": "<p>It is evaluating the string as PHP code.</p>\n\n<p>But it seems to be making a variable equal itself? Weird.</p>\n" }, ...
2009/01/16
[ "https://Stackoverflow.com/questions/449194", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5056/" ]
I'm still learning Castle Windsor and I see that it supports forwarded types - a term I was unfamiliar with. Quick Google search and I found [this](http://msdn.microsoft.com/en-us/library/ms404275.aspx) article that explains it pretty throughly however I still don't understand how this applies to IoC or how I would us...
Scrap my previous answer. The reason this eval() is here is shown in the [php eval docs](http://www.php.net/eval) This is what's happening: ``` $text_including_tax = '$tax <a href="...">...</a>'; ... $tax = 10; ... eval ("\$text_including_tax = \"$text_including_tax\";"); ``` At the end of this `$text_includin...
449,202
<p>If you were trying to create a domain object in a database schema, and in your code said domain object has a hashtable/list member, like so:</p> <pre><code>public class SpaceQuadrant : PersistentObject { public SpaceQuadrant() { } public virtual Dictionary&lt;SpaceCoordinate, SpaceObject&gt; Space...
[ { "answer_id": 449275, "author": "Bill Karwin", "author_id": 20860, "author_profile": "https://Stackoverflow.com/users/20860", "pm_score": 2, "selected": false, "text": "<p>Relations are not hash tables; they are sets.</p>\n\n<p>I wouldn't organize the database using the coordinates as t...
2009/01/16
[ "https://Stackoverflow.com/questions/449202", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25847/" ]
If you were trying to create a domain object in a database schema, and in your code said domain object has a hashtable/list member, like so: ``` public class SpaceQuadrant : PersistentObject { public SpaceQuadrant() { } public virtual Dictionary<SpaceCoordinate, SpaceObject> Space { get; ...
First, dedicated support for geo-located data exists in many databases - different algorithms can be used (a spatial version of a B-Tree exists for instance), and support for proximity searches probably will exist. Since you have a different hash table for each SpaceQuadrant, you'd need something like (edited from S.L...
449,207
<p>Running VBA under XP I was able to call ActivateKeyboardLayout to switch my input language from English to another language. However, this no longer works under Vista64.</p> <p>Any suggestions or workarounds?</p> <p>The code that used to work under XP was similar to the following:</p> <pre><code>Private Declare F...
[ { "answer_id": 449378, "author": "Ana Betts", "author_id": 5728, "author_profile": "https://Stackoverflow.com/users/5728", "pm_score": 0, "selected": false, "text": "<p>This is just a blind guess, but have you tried running your app as elevated administrator to see if it makes a differen...
2009/01/16
[ "https://Stackoverflow.com/questions/449207", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12113/" ]
Running VBA under XP I was able to call ActivateKeyboardLayout to switch my input language from English to another language. However, this no longer works under Vista64. Any suggestions or workarounds? The code that used to work under XP was similar to the following: ``` Private Declare Function ActivateKeyboardLayo...
Your declaration for the ActivateKeyboardLayout is actually incorrect. For 32-bit systems your code should be something like this: ``` Private Declare Function ActivateKeyboardLayout Lib "user32" (ByVal HKL As Long, _ ByVal flags As Long) As Long Const aklPUNJABI As Long = &H4460446 Dim oldLayout as Long oldLayou...
449,237
<p>I'm working on a site where the images and other resources will be located on a separate domain from the main content of the site. We will use something like 'www.example.com' for the main site, and then 'images.example.com' for all extra resources for styles, etc.</p> <p>When developing the site I will keep all of...
[ { "answer_id": 449243, "author": "Diodeus - James MacFarlane", "author_id": 12579, "author_profile": "https://Stackoverflow.com/users/12579", "pm_score": 0, "selected": false, "text": "<p>You duped your own question:</p>\n\n<p><a href=\"https://stackoverflow.com/questions/449236/dynamica...
2009/01/16
[ "https://Stackoverflow.com/questions/449237", "https://Stackoverflow.com", "https://Stackoverflow.com/users/392/" ]
I'm working on a site where the images and other resources will be located on a separate domain from the main content of the site. We will use something like 'www.example.com' for the main site, and then 'images.example.com' for all extra resources for styles, etc. When developing the site I will keep all of these res...
Is keeping the CSS file on the image server an option? If that it possible, you could make all the image references relative, and then you just need to update the link to the css file. ``` <link rel="stylesheet" href="<%= ConfigurationManager.AppSettings("css-server") %>style.css" /> ``` If you still want to send or...
449,241
<p>I have been trying to add a scroller to my context section that will only allow the box to scroll horizontally within the visible of the viewer's screen, not vertical.</p> <p>Does anyone know any code to have scrollable content in a div in a fluid css layout design?</p> <p>Also, here is a link to a website that ha...
[ { "answer_id": 449253, "author": "Matt Hamilton", "author_id": 615, "author_profile": "https://Stackoverflow.com/users/615", "pm_score": 4, "selected": true, "text": "<p>You probably want to take a look at <a href=\"http://www.blooberry.com/~bloo/indexdot/css/properties/position/overflow...
2009/01/16
[ "https://Stackoverflow.com/questions/449241", "https://Stackoverflow.com", "https://Stackoverflow.com/users/55695/" ]
I have been trying to add a scroller to my context section that will only allow the box to scroll horizontally within the visible of the viewer's screen, not vertical. Does anyone know any code to have scrollable content in a div in a fluid css layout design? Also, here is a link to a website that has the exact scrol...
You probably want to take a look at [overflow-x: scroll](http://www.blooberry.com/~bloo/indexdot/css/properties/position/overflowx.htm), which, along with setting a fixed size on the parent, will force a horizontal scrollbar if the content is too wide. Some example html: ``` <div style="width: 50px; overflow-x: scrol...
449,271
<p>Is there an easy way to round a Time down to the nearest 15 minutes? </p> <p>This is what I'm currently doing. Is there an easier way to do it?</p> <pre><code>t = Time.new rounded_t = Time.local(t.year, t.month, t.day, t.hour, t.min/15*15) </code></pre>
[ { "answer_id": 449290, "author": "Shalmanese", "author_id": 14559, "author_profile": "https://Stackoverflow.com/users/14559", "pm_score": 3, "selected": false, "text": "<p>You could do:</p>\n\n<pre><code>Time.at(t.to_i/(15*60)*(15*60))\n</code></pre>\n" }, { "answer_id": 449293, ...
2009/01/16
[ "https://Stackoverflow.com/questions/449271", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4883/" ]
Is there an easy way to round a Time down to the nearest 15 minutes? This is what I'm currently doing. Is there an easier way to do it? ``` t = Time.new rounded_t = Time.local(t.year, t.month, t.day, t.hour, t.min/15*15) ```
You said "round down", so I'm not sure if you're actually looking for the round or the floor, but here's the code to do both. I think something like this reads really well if you add `round_off` and `floor` methods to the Time class. The added benefit is that you can more easily round by any time partition. ``` requir...
449,273
<p>I've been wondering this for some time now. I'm by far not a hardcore programmer, mainly small Python scripts and I've written a couple molecular dynamics simulations. For the real question: What is the point of the <i><b>switch statement</i></b>? Why can't you just use the <i><b>if-else statement</i></b>?</p> ...
[ { "answer_id": 449278, "author": "aku", "author_id": 1196, "author_profile": "https://Stackoverflow.com/users/1196", "pm_score": 5, "selected": false, "text": "<p>Switch can be <a href=\"http://www.gccsummit.org/2006/view_abstract.php?content_key=18\" rel=\"noreferrer\">optimized by comp...
2009/01/16
[ "https://Stackoverflow.com/questions/449273", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41718/" ]
I've been wondering this for some time now. I'm by far not a hardcore programmer, mainly small Python scripts and I've written a couple molecular dynamics simulations. For the real question: What is the point of the ***switch statement***? Why can't you just use the ***if-else statement***? Thanks for your answer and ...
A *switch* construct is more easily translated into a [jump (or branch) table](http://en.wikipedia.org/wiki/Jump_table). This can make switch statements much more efficient than *if-else* when the case labels are close together. The idea is to place a bunch of jump instructions sequentially in memory and then add the v...
449,280
<p>I've developed a system in my application where emails are picked up with a regex, and then reversed in the source (to thwart bots). I then add the span class 'obfuscate email'. I then use CSS to reverse the the text back to be displayed and Javascript make sure that <code>mailto:</code> links still work.</p> <p>I ...
[ { "answer_id": 449300, "author": "A. Rex", "author_id": 3508, "author_profile": "https://Stackoverflow.com/users/3508", "pm_score": 2, "selected": false, "text": "<p>You can use the same Javascript to reverse the text as well as the mailto links. If the user doesn't have Javascript, the...
2009/01/16
[ "https://Stackoverflow.com/questions/449280", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31671/" ]
I've developed a system in my application where emails are picked up with a regex, and then reversed in the source (to thwart bots). I then add the span class 'obfuscate email'. I then use CSS to reverse the the text back to be displayed and Javascript make sure that `mailto:` links still work. I was pretty happy with...
I personally think it's going a bit over the top, but if you really want to obfuscate the address, why not obfuscate it in a human readable way? Instead of reversing the address, make the server output "info at leaklocations dot com dot au" and get javascript to fix it up? If you wanted to stick to using the RTL CSS m...
449,337
<p>I have a table named "buildings" that contains a varchar(50) field named "use". The table already has several thousand records, however the "use" values are all null. I would like to update these this table with randomly chosen values from a list of strings <em>(e.g., warehouse, office, market, retail, workshop)</...
[ { "answer_id": 449351, "author": "Michael Haren", "author_id": 29, "author_profile": "https://Stackoverflow.com/users/29", "pm_score": 0, "selected": false, "text": "<p>It's not random, but this is a nice and easy way to do it, provided you have a realtively uniform distribution of IDs:<...
2009/01/16
[ "https://Stackoverflow.com/questions/449337", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19977/" ]
I have a table named "buildings" that contains a varchar(50) field named "use". The table already has several thousand records, however the "use" values are all null. I would like to update these this table with randomly chosen values from a list of strings *(e.g., warehouse, office, market, retail, workshop)*. I would...
This might work for you: ``` BEGIN; UPDATE Buildings SET Use = (ARRAY['warehouse', 'office', 'market', 'retail', 'workshop', NULL])[floor(random() * 6.0) + 1]; COMMIT; ```
449,344
<p>Here is my DataList:</p> <pre><code>&lt;asp:DataList id="DataList" Visible="false" RepeatDirection="Horizontal" Width="100%" HorizontalAlign="Justify" RepeatLayout="Flow" runat="server"&gt; [Contents Removed] &lt;/asp:DataList&gt; </code></pre> <p>This generates markup that has each item wrapped in a span....
[ { "answer_id": 449400, "author": "Mike Robinson", "author_id": 43687, "author_profile": "https://Stackoverflow.com/users/43687", "pm_score": 1, "selected": false, "text": "<p>I may be confused, but why not just use a repeater and a custom item template?</p>\n" }, { "answer_id": 4...
2009/01/16
[ "https://Stackoverflow.com/questions/449344", "https://Stackoverflow.com", "https://Stackoverflow.com/users/326/" ]
Here is my DataList: ``` <asp:DataList id="DataList" Visible="false" RepeatDirection="Horizontal" Width="100%" HorizontalAlign="Justify" RepeatLayout="Flow" runat="server"> [Contents Removed] </asp:DataList> ``` This generates markup that has each item wrapped in a span. From there, I'd like to break each of...
If you really needed to use a datalist for some reason instead of implementing this as a repeater, you can try doing something like this: ``` <asp:DataList ID="dataList" runat="server" RepeatDirection="Horizontal" Width="100%" HorizontalAlign="Justify" RepeatLayout="Flow" OnItemDataBound="dataList_ItemDataBound"> ...
449,367
<p>I'd like to be able to run an xml transformation using an xslt file in my AIR project. What's the best way to accomplish this?</p>
[ { "answer_id": 574403, "author": "dirkgently", "author_id": 66692, "author_profile": "https://Stackoverflow.com/users/66692", "pm_score": 1, "selected": false, "text": "<p>XSLT support is typically provided by browsers. The version of Webkit embedded in AIR does not support XSLT. So, you...
2009/01/16
[ "https://Stackoverflow.com/questions/449367", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47110/" ]
I'd like to be able to run an xml transformation using an xslt file in my AIR project. What's the best way to accomplish this?
In AIR 1.5, a version of Webkit with support for XSLT is included. Use the class `XSLTProcessor` from JavaScript just like you would in Firefox. (Note: There is one annoying bug. Stylesheets cannot contain non-breaking spaces, no matter whether literally or as a character reference. I am told that more recent versions...
449,369
<p>I'd like to play videos, as well as display images and possibly other flash content using adobe air, and reading from the local file system. I've been searching APIs and I have not yet been able to connect the dots.</p> <p>I know of <strong>flash.filesystem.File</strong> and <strong>flash.filesystem.FileStream</str...
[ { "answer_id": 449544, "author": "Christian Nunciato", "author_id": 32129, "author_profile": "https://Stackoverflow.com/users/32129", "pm_score": 0, "selected": false, "text": "<p>Try adding \"-use-network=false\" to your Flex compiler settings. This will give you access to load local r...
2009/01/16
[ "https://Stackoverflow.com/questions/449369", "https://Stackoverflow.com", "https://Stackoverflow.com/users/758/" ]
I'd like to play videos, as well as display images and possibly other flash content using adobe air, and reading from the local file system. I've been searching APIs and I have not yet been able to connect the dots. I know of **flash.filesystem.File** and **flash.filesystem.FileStream** and have experimented with load...
The use I have in mind is required to be programmatic in usage. I was looking for a way to do this directly with ActionScript. I finally stumbled onto the solution I was hoping for... using a NetStream object, but (non-intuitively) you can use this to access local files as well: ``` private function playVideo():void...
449,409
<p>Does assigning an unused object reference to <code>null</code> in Java improve the garbage collection process in any measurable way?</p> <p>My experience with Java (and C#) has taught me that is often counter intuitive to try and outsmart the virtual machine or JIT compiler, but I've seen co-workers use this method...
[ { "answer_id": 449416, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 2, "selected": false, "text": "<p>Yes. </p>\n\n<p>From \"The Pragmatic Programmer\" p.292:</p>\n\n<p>By setting a reference to NULL you reduce the number of ...
2009/01/16
[ "https://Stackoverflow.com/questions/449409", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20774/" ]
Does assigning an unused object reference to `null` in Java improve the garbage collection process in any measurable way? My experience with Java (and C#) has taught me that is often counter intuitive to try and outsmart the virtual machine or JIT compiler, but I've seen co-workers use this method and I am curious if ...
Typically, no. But like all things: it depends. The GC in Java these days is VERY good and everything should be cleaned up very shortly after it is no longer reachable. This is just after leaving a method for local variables, and when a class instance is no longer referenced for fields. You only need to explicitly nu...
449,410
<p>Let's say, for instance, I have the following extremely simple window:</p> <pre><code>&lt;Window x:Class="CalendarGenerator.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" ...
[ { "answer_id": 449417, "author": "Matt Hamilton", "author_id": 615, "author_profile": "https://Stackoverflow.com/users/615", "pm_score": 6, "selected": true, "text": "<p>First you'd need to give your ListBox a name so that it's accessible from your code behind (<em>edit</em> I note you'v...
2009/01/16
[ "https://Stackoverflow.com/questions/449410", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18811/" ]
Let's say, for instance, I have the following extremely simple window: ``` <Window x:Class="CalendarGenerator.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="Window1" Height="300" Width="447...
First you'd need to give your ListBox a name so that it's accessible from your code behind (*edit* I note you've already done this, so I'll change my example ListBox's name to reflect yours): ``` <ListBox x:Name="eventList" ... /> ``` Then it's as simple as setting the ListBox's [ItemsSource](http://msdn.microsoft.c...
449,436
<p>I've seen implementations of Singleton patterns where instance variable was declared as static variable in GetInstance method. Like this:</p> <pre><code>SomeBaseClass &amp;SomeClass::GetInstance() { static SomeClass instance; return instance; } </code></pre> <p>I see following positive sides of this approach...
[ { "answer_id": 449488, "author": "1800 INFORMATION", "author_id": 3146, "author_profile": "https://Stackoverflow.com/users/3146", "pm_score": -1, "selected": false, "text": "<p>It shares all of the common failings of Singleton implementations, namely:</p>\n\n<ul>\n<li><a href=\"http://go...
2009/01/16
[ "https://Stackoverflow.com/questions/449436", "https://Stackoverflow.com", "https://Stackoverflow.com/users/53481/" ]
I've seen implementations of Singleton patterns where instance variable was declared as static variable in GetInstance method. Like this: ``` SomeBaseClass &SomeClass::GetInstance() { static SomeClass instance; return instance; } ``` I see following positive sides of this approach: * The code is simpler, beca...
In C++11 it is thread safe: > > §6.7 [stmt.dcl] p4 If control enters the declaration concurrently while the variable is being initialized, the concurrent execution shall wait for completion of the initialization. > > > In C++03: * Under g++ it is thread safe. But this is because g++ explicitly adds code to g...
449,475
<p>This is locale specific to the US wherein it considered that the start of a week is Sunday; I want to be able to ask SQL to give me the date of the next Sunday relative to today [getDate()]. If today is Jan 15 it should return Jan 18; if today were Sunday it should return the following Sunday which is the 25th. This...
[ { "answer_id": 449491, "author": "Cade Roux", "author_id": 18255, "author_profile": "https://Stackoverflow.com/users/18255", "pm_score": 4, "selected": true, "text": "<pre><code>DECLARE @d AS datetime\nSET @d = '1/15/2009'\nPRINT @d\nPRINT DATEADD(day, 8 - DATEPART(weekday, @d), @d)\nSET...
2009/01/16
[ "https://Stackoverflow.com/questions/449475", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40714/" ]
This is locale specific to the US wherein it considered that the start of a week is Sunday; I want to be able to ask SQL to give me the date of the next Sunday relative to today [getDate()]. If today is Jan 15 it should return Jan 18; if today were Sunday it should return the following Sunday which is the 25th. This wo...
``` DECLARE @d AS datetime SET @d = '1/15/2009' PRINT @d PRINT DATEADD(day, 8 - DATEPART(weekday, @d), @d) SET @d = '1/18/2009' PRINT @d PRINT DATEADD(day, 8 - DATEPART(weekday, @d), @d) -- So it should be able to be used inline pretty efficiently: DATEADD(day, 8 - DATEPART(weekday, datecolumn), datecolumn) -- If you...
449,506
<p>In an ASP.Net application, I need to send some data (urlEncodedUserInput) via http POST to an external server in response to user input, without holding up the page response. It doesn't matter what the response from the other server is, and I don't care if the request fails sometimes. This seems to be operating fine...
[ { "answer_id": 449522, "author": "Adam Lassek", "author_id": 1249, "author_profile": "https://Stackoverflow.com/users/1249", "pm_score": 3, "selected": false, "text": "<p>I think <a href=\"http://thevalerios.net/matt/2008/05/use-threadpoolqueueuserworkitem-with-anonymous-types/\" rel=\"n...
2009/01/16
[ "https://Stackoverflow.com/questions/449506", "https://Stackoverflow.com", "https://Stackoverflow.com/users/55729/" ]
In an ASP.Net application, I need to send some data (urlEncodedUserInput) via http POST to an external server in response to user input, without holding up the page response. It doesn't matter what the response from the other server is, and I don't care if the request fails sometimes. This seems to be operating fine (s...
I think [Threadpool.QueueUserWorkItem](http://thevalerios.net/matt/2008/05/use-threadpoolqueueuserworkitem-with-anonymous-types/) is what you're looking for. With the addition of lambdas and anonymous types, this can be really simple: ``` var request = new { url = externalServerUrl, input = urlEncodedUserInput }; Thre...
449,512
<p>I was looking at postgres question and it called for updating a table with random values. </p> <p>I only noticed it was targeted at postgres after answering it, but in answering it I hit a mystery. </p> <p>Here is my sample code in question:</p> <pre><code>create table #Buildings([Use] varchar(50), n int) insert...
[ { "answer_id": 449543, "author": "John Boker", "author_id": 2847, "author_profile": "https://Stackoverflow.com/users/2847", "pm_score": 4, "selected": true, "text": "<p>I have an idea:</p>\n\n<p>maybe the value is being computed on every when statement, if it gets to the first one, compu...
2009/01/16
[ "https://Stackoverflow.com/questions/449512", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17174/" ]
I was looking at postgres question and it called for updating a table with random values. I only noticed it was targeted at postgres after answering it, but in answering it I hit a mystery. Here is my sample code in question: ``` create table #Buildings([Use] varchar(50), n int) insert #Buildings select null,null...
I have an idea: maybe the value is being computed on every when statement, if it gets to the first one, computes a value other than 0 it goes to the second, it then computes a value other than 1, then the next and so on, if it makes it's way to 5 and then computes a number other than 5 it goes to else. this would als...
449,513
<p>I'm trying to brush up on my LINQ by writing some simple extension methods. Is there any better way to write such a function as below that removes a given list of characters from a string (using LINQ)? </p> <p>It helps me to think of the extension methods that LINQ relies on first:</p> <pre><code>public static str...
[ { "answer_id": 449577, "author": "JaredPar", "author_id": 23283, "author_profile": "https://Stackoverflow.com/users/23283", "pm_score": 1, "selected": false, "text": "<p>try this for terseness</p>\n\n<pre><code>public static string Remove(this string source, IEnumerable&lt;char&gt; chars...
2009/01/16
[ "https://Stackoverflow.com/questions/449513", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11574/" ]
I'm trying to brush up on my LINQ by writing some simple extension methods. Is there any better way to write such a function as below that removes a given list of characters from a string (using LINQ)? It helps me to think of the extension methods that LINQ relies on first: ``` public static string Remove(this strin...
I would prefer the first form with extension methods though simplified to ``` public static string Remove(this string s, IEnumerable<char> chars) { return new string(s.Where(c => !chars.Contains(c)).ToArray()); } ``` As for **select** keyword, it's obligatory in second form. The [documentation](http://msdn.micro...
449,517
<p>from this post <a href="https://stackoverflow.com/questions/334183/what-is-the-most-efficient-way-to-store-tags-in-a-database">What is the most efficient way to store tags in a database?</a></p> <p>It was recommended to store tag tables like this.</p> <pre><code>Table: Item Columns: ItemID, Title, Content Table: ...
[ { "answer_id": 449524, "author": "Cade Roux", "author_id": 18255, "author_profile": "https://Stackoverflow.com/users/18255", "pm_score": 1, "selected": false, "text": "<p>Why? It's normalized. ItemID will be the primary key (perhaps a surrogate or identity), TagID will almost certainly...
2009/01/16
[ "https://Stackoverflow.com/questions/449517", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
from this post [What is the most efficient way to store tags in a database?](https://stackoverflow.com/questions/334183/what-is-the-most-efficient-way-to-store-tags-in-a-database) It was recommended to store tag tables like this. ``` Table: Item Columns: ItemID, Title, Content Table: Tag Columns: TagID, Title Table...
There's nothing wrong with the second design you show, the one with the `TagList` table, except that it takes more space. That is, if you tag 10,000 items with the tag "database-design", then in the two-table design, you have to store that string 10,000 times. If space-efficiency is more important, you could use the ...
449,528
<p>I'm seeing a strange situation, that I'm trying to figure out if it's a PHP issue, file issue, or normal operation. I have some users complaining about very fast timeouts on our site (session expires?), and checking the php tmp directory, I see things like this:</p> <pre><code>-rw------- 1 www-data www-data 377 2...
[ { "answer_id": 449545, "author": "John Kurlak", "author_id": 55732, "author_profile": "https://Stackoverflow.com/users/55732", "pm_score": 0, "selected": false, "text": "<p>I'm not sure what you mean, exactly, but you could try putting:</p>\n\n<pre><code>&lt;?php set_time_limit(100); ?&g...
2009/01/16
[ "https://Stackoverflow.com/questions/449528", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45580/" ]
I'm seeing a strange situation, that I'm trying to figure out if it's a PHP issue, file issue, or normal operation. I have some users complaining about very fast timeouts on our site (session expires?), and checking the php tmp directory, I see things like this: ``` -rw------- 1 www-data www-data 377 2009-01-15 22:46...
Two possibilities spring to mind, one is that your out of disk space in a shared hosting environment, if this is not the case then your website may be sharing its session directory with other websites that have a short timeout on their sessions. The gc\_maxlifetime setting defaults to 1440 seconds, but if you share th...
449,532
<p>At my work we have our own XML classes which build a DOM, but I'm not sure how consecutive whitespace should be handled?</p> <p>e.g.</p> <pre><code>&lt;some-text&gt; Hello World &lt;/some-text&gt; </code></pre> <p>When this is read into the DOM, should the text node include the consecutive whitespace inbetwee...
[ { "answer_id": 449534, "author": "Steven A. Lowe", "author_id": 9345, "author_profile": "https://Stackoverflow.com/users/9345", "pm_score": 2, "selected": false, "text": "<p>EDIT: whitespace within tags is considered significant (my initial thoughts on this being like HTML were wrong; go...
2009/01/16
[ "https://Stackoverflow.com/questions/449532", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26335/" ]
At my work we have our own XML classes which build a DOM, but I'm not sure how consecutive whitespace should be handled? e.g. ``` <some-text> Hello World </some-text> ``` When this is read into the DOM, should the text node include the consecutive whitespace inbetween Hello and World or just reduce it to one sp...
`&nbsp;` is a HTML entity and nothing to do with XML itself. To answer your question though, i would treat that as significant. Even the HTML DOM treats consecutive spaces as significant, it's just that it only visually renders one space. How it appears in the DOM and how it appears on your screen are two entirely dif...
449,560
<p>How do I get the size occupied in memory by an object in Python?</p>
[ { "answer_id": 450034, "author": "nosklo", "author_id": 17160, "author_profile": "https://Stackoverflow.com/users/17160", "pm_score": 10, "selected": false, "text": "<p>Just use the <a href=\"http://docs.python.org/library/sys.html#sys.getsizeof\" rel=\"noreferrer\"><code>sys.getsizeof</...
2009/01/16
[ "https://Stackoverflow.com/questions/449560", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46646/" ]
How do I get the size occupied in memory by an object in Python?
Just use the [`sys.getsizeof`](http://docs.python.org/library/sys.html#sys.getsizeof) function defined in the `sys` module. > > `sys.getsizeof(object[, default])`: > > > Return the size of an object in bytes. > The object can be any type of object. > All built-in objects will return > correct results, but this does...
449,599
<p>I have 4 images, which I want to fade between each other in a loop. I have something like the following:</p> <pre><code>&lt;img src="/images/image-1.jpg" id="featureImg1" /&gt; &lt;img src="/images/image-2.jpg" id="featureImg2" style="display:none;" /&gt; &lt;img src="/images/image-3.jpg" id="featureImg3" style="di...
[ { "answer_id": 449640, "author": "strager", "author_id": 39992, "author_profile": "https://Stackoverflow.com/users/39992", "pm_score": 3, "selected": false, "text": "<p>You can use a <code>div</code> and an <code>img</code>, like so:</p>\n\n<pre><code>&lt;div id=\"featureImgContainer\"&g...
2009/01/16
[ "https://Stackoverflow.com/questions/449599", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5441/" ]
I have 4 images, which I want to fade between each other in a loop. I have something like the following: ``` <img src="/images/image-1.jpg" id="featureImg1" /> <img src="/images/image-2.jpg" id="featureImg2" style="display:none;" /> <img src="/images/image-3.jpg" id="featureImg3" style="display:none;" /> <img src="/im...
I'd highly recommend the [jQuery Cycle](http://malsup.com/jquery/cycle/) plugin. It may do more than you're looking for in this case, but it's well structured and easy to setup. There's also a lightweight version called [jQuery Cycle Lite](http://malsup.com/jquery/cycle/lite/) which just supports fade transitions.
449,607
<p>Working on a common codebase, one developer is running SQL Server Express 2005 and the other 2 are running SQL Server 2005. Everything is working fine, but the connection strings differ. To maintain common configuration and build scripts we're looking to mask <strong>"localhost\sqlexpress"</strong> to just <strong>"...
[ { "answer_id": 449624, "author": "Danut Enachioiu", "author_id": 24226, "author_profile": "https://Stackoverflow.com/users/24226", "pm_score": 0, "selected": false, "text": "<p>You can name SQL Server instances to anything you want. I'm pretty sure you can do it in SQL Express as well, s...
2009/01/16
[ "https://Stackoverflow.com/questions/449607", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29689/" ]
Working on a common codebase, one developer is running SQL Server Express 2005 and the other 2 are running SQL Server 2005. Everything is working fine, but the connection strings differ. To maintain common configuration and build scripts we're looking to mask **"localhost\sqlexpress"** to just **"localhost"** like the ...
Just tested things out and got it working. sql express doesnt enable tcp/ip by default and when enabled doesnt use the default port 1433. to make this happen you need to open up "Sql server configuration manager" then under protocols enable tcp/ip. after that double click "tcp/ip", select the "IP Addresses" tab and s...
449,627
<p>I realise that it's not elegant or desired, but is it allowed (in well-formed XML) for an attribute value in an XML element to span multiple lines?</p> <p>e.g.</p> <pre><code>&lt;some-xml-element value="this value goes over.... multiple lines!" /&gt; </code></pre> <p>Yeah I realise there's better ways of writing ...
[ { "answer_id": 449644, "author": "Reji", "author_id": 50388, "author_profile": "https://Stackoverflow.com/users/50388", "pm_score": 2, "selected": false, "text": "<p>Yes the first example is a valid one.</p>\n" }, { "answer_id": 449647, "author": "derobert", "author_id": ...
2009/01/16
[ "https://Stackoverflow.com/questions/449627", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26335/" ]
I realise that it's not elegant or desired, but is it allowed (in well-formed XML) for an attribute value in an XML element to span multiple lines? e.g. ``` <some-xml-element value="this value goes over.... multiple lines!" /> ``` Yeah I realise there's better ways of writing that. I would personally write it like:...
<http://www.w3.org/TR/REC-xml/#NT-AttValue> Seems to say everything except `<`, `&`, and your delimiter (`'` or `"`) are OK. So newline should be, too.
449,648
<p>I am running a market survey and all the survey data is saved in the database. I need a query for counting the number of rows in which option "1" is selected for question "1", option "2" for question "1" and so on for all questions and options… I need to specify few conditions here, I have to match distinct ID's of ...
[ { "answer_id": 449757, "author": "jedihawk", "author_id": 54322, "author_profile": "https://Stackoverflow.com/users/54322", "pm_score": 0, "selected": false, "text": "<p>I think you're going to have to do it the hard way:</p>\n\n<pre><code>SELECT COUNT(`keyfield`)\n WHERE `column` = '1'\...
2009/01/16
[ "https://Stackoverflow.com/questions/449648", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I am running a market survey and all the survey data is saved in the database. I need a query for counting the number of rows in which option "1" is selected for question "1", option "2" for question "1" and so on for all questions and options… I need to specify few conditions here, I have to match distinct ID's of 3 t...
The basis for a query would be something like this: ``` SELECT q.question, a.answer, COUNT(a.answer) FROM questions q LEFT JOIN answers a ON (q.id = a.question_id) GROUP BY q.id, a.id ORDER BY q.id, a.id ``` You could add the necessary conditions in a `WHERE` clause.
449,650
<p>I was reading about DoS attacks on Apache servers but the "Brute Force" word pops up sometimes I know DoS attacks but "Brute Force" seems to be similar, is there a difference or it is just another word of DoS?</p>
[ { "answer_id": 449657, "author": "Reji", "author_id": 50388, "author_profile": "https://Stackoverflow.com/users/50388", "pm_score": 3, "selected": false, "text": "<p>DoS or Denial of Service is an attempt to make a computer resource unavailable to its intended users. it generally consist...
2009/01/16
[ "https://Stackoverflow.com/questions/449650", "https://Stackoverflow.com", "https://Stackoverflow.com/users/55750/" ]
I was reading about DoS attacks on Apache servers but the "Brute Force" word pops up sometimes I know DoS attacks but "Brute Force" seems to be similar, is there a difference or it is just another word of DoS?
Brute force refers to a solution to a problem that relies on computers being fast to get an answer. Generally, it works by trying all possibilities. For example, if you want to know the sum of all numbers 1 through 100, you could do something like: ``` sum = 0 for i from 1 to 100 sum = sum + i end ``` That'd be br...
449,662
<p>We are testing an application specific Design where we need to show progressive counts after firing many queries simultaneously.</p> <p>When we are firing a single query, we are successfully able to get Results Asynchronously.</p> <p>But, when we are firing 3-4 queries simultaneously, after a significant amount of...
[ { "answer_id": 449809, "author": "James Anderson", "author_id": 38207, "author_profile": "https://Stackoverflow.com/users/38207", "pm_score": 0, "selected": false, "text": "<p>The most likely cause is your transactions are not issueing \"commits\" so there is buildup of uncommited data i...
2009/01/16
[ "https://Stackoverflow.com/questions/449662", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
We are testing an application specific Design where we need to show progressive counts after firing many queries simultaneously. When we are firing a single query, we are successfully able to get Results Asynchronously. But, when we are firing 3-4 queries simultaneously, after a significant amount of time & after get...
The pagesize of a bufferpool has to match the pagesize of the tablespaces it is associated with. Do all of your tablespaces use 32K pages? You should check whether there is a different bufferpool that is running out of pages. 10,000 pages should be more than enough to avoid the error you are seeing.
449,690
<p>I'm trying to monkey-patch (duck-punch :-) a <code>LWP::UserAgent</code> instance, like so:</p> <pre><code>sub _user_agent_get_basic_credentials_patch { return ($username, $password); } my $agent = LWP::UserAgent-&gt;new(); $agent-&gt;get_basic_credentials = _user_agent_get_basic_credentials_patch; </code></pre>...
[ { "answer_id": 449692, "author": "cdleary", "author_id": 3594, "author_profile": "https://Stackoverflow.com/users/3594", "pm_score": -1, "selected": false, "text": "<p><strong>Edit:</strong> This was an incorrect attempt at a solution that I'm keeping for posterity. Look at the upvoted/a...
2009/01/16
[ "https://Stackoverflow.com/questions/449690", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3594/" ]
I'm trying to monkey-patch (duck-punch :-) a `LWP::UserAgent` instance, like so: ``` sub _user_agent_get_basic_credentials_patch { return ($username, $password); } my $agent = LWP::UserAgent->new(); $agent->get_basic_credentials = _user_agent_get_basic_credentials_patch; ``` This isn't the right syntax -- it yiel...
If dynamic scope (using `local`) isn't satisfactory, you can automate the custom package reblessing technique: ``` MONKEY_PATCH_INSTANCE: { my $counter = 1; # could use a state var in perl 5.10 sub monkey_patch_instance { my($instance, $method, $code) = @_; my $package = ref($instance) . '::MonkeyPatch'...
449,704
<p>I have a fast dedicated internet connection and a static IP address at my office. I also have a web site that I want to host on my server machine (win server 2003). I know how to setup a web site through IIS but have no clue how to point my domain to my site and configure my server to serve for that domain. Can anyo...
[ { "answer_id": 449714, "author": "blank", "author_id": 1348, "author_profile": "https://Stackoverflow.com/users/1348", "pm_score": 1, "selected": false, "text": "<p>This isn't really a programming question, but to start with you need to configure your dns server to point at your static i...
2009/01/16
[ "https://Stackoverflow.com/questions/449704", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49742/" ]
I have a fast dedicated internet connection and a static IP address at my office. I also have a web site that I want to host on my server machine (win server 2003). I know how to setup a web site through IIS but have no clue how to point my domain to my site and configure my server to serve for that domain. Can anyone ...
As far as DNS goes, the easiest thing to do would be to use a service like [EveryDNS](http://www.everydns.com) to configure your domain to point to your IP. At your domain registrar, set the nameservers to EveryDNS's nameservers: ``` ns1.everydns.net ns2.everydns.net ns3.everydns.net ns4.everydns.net ``` Then you wa...
449,736
<p>I want to know more about "<a href="https://stackoverflow.com/questions/92396/why-cant-variables-be-declared-in-a-switch-statement">Why can’t variables be declared in a switch statement?</a>"</p> <p>I read the post but i am not getting it exactly. You can just declare variable inside switch but to decalre and initi...
[ { "answer_id": 449749, "author": "1800 INFORMATION", "author_id": 3146, "author_profile": "https://Stackoverflow.com/users/3146", "pm_score": 4, "selected": false, "text": "<p>Essentially because the initialisation of the variable would be skipped if the label containing the variable ini...
2009/01/16
[ "https://Stackoverflow.com/questions/449736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/55759/" ]
I want to know more about "[Why can’t variables be declared in a switch statement?](https://stackoverflow.com/questions/92396/why-cant-variables-be-declared-in-a-switch-statement)" I read the post but i am not getting it exactly. You can just declare variable inside switch but to decalre and initialize a variable or t...
Essentially because the initialisation of the variable would be skipped if the label containing the variable initialisation was not hit. This would be bad because the compiler would then have to emit code that would destroy said variable if and only if the initialisation code had run. For example: ``` class A { // ...
449,773
<p>I have to show rich text that i pull from server, so i'm using UIWebView. Now the problem is that i have no control over the font which is used in UIWebView. How can i change the font to use system font (making it consistent with rest of the application)?</p> <p>I'm doing something like this at the moment:</p> <pr...
[ { "answer_id": 449829, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 6, "selected": true, "text": "<p>Reference a css style sheet in your HTML document or put the style information into the top of the HTML document itself</p>\...
2009/01/16
[ "https://Stackoverflow.com/questions/449773", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49739/" ]
I have to show rich text that i pull from server, so i'm using UIWebView. Now the problem is that i have no control over the font which is used in UIWebView. How can i change the font to use system font (making it consistent with rest of the application)? I'm doing something like this at the moment: ``` myRichTextVie...
Reference a css style sheet in your HTML document or put the style information into the top of the HTML document itself
449,775
<p>I decided that I'll learn Python tonight :) I know C pretty well (wrote an OS in it), so I'm not a noob in programming, so everything in Python seems pretty easy, but I don't know how to solve this problem: let's say I have this address:</p> <p><a href="http://example.com/random/folder/path.html" rel="nofollow noref...
[ { "answer_id": 449782, "author": "Sebastian Dietz", "author_id": 52837, "author_profile": "https://Stackoverflow.com/users/52837", "pm_score": 3, "selected": false, "text": "<p>I have no experience with Python, but I found the <a href=\"https://docs.python.org/3/library/urllib.parse.html...
2009/01/16
[ "https://Stackoverflow.com/questions/449775", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I decided that I'll learn Python tonight :) I know C pretty well (wrote an OS in it), so I'm not a noob in programming, so everything in Python seems pretty easy, but I don't know how to solve this problem: let's say I have this address: <http://example.com/random/folder/path.html> Now how can I create two strings fr...
The *urlparse* module in Python 2.x (or urllib.parse in Python 3.x) would be the way to do it. ``` >>> from urllib.parse import urlparse >>> url = 'http://example.com/random/folder/path.html' >>> parse_object = urlparse(url) >>> parse_object.netloc 'example.com' >>> parse_object.path '/random/folder/path.html' >>> par...
449,803
<p>You can do '<code>ls -l</code>' to get a detailed directory listing like this:</p> <pre><code>-rw-rw-rw- 1 alice themonkeys 1159995999 2008-08-20 07:01 foo.log -rw-rw-rw- 1 bob bob 244251992 2008-08-20 05:30 bar.txt </code></pre> <p>But notice how you have to slide your finger along the screen to figur...
[ { "answer_id": 449818, "author": "dreeves", "author_id": 4234, "author_profile": "https://Stackoverflow.com/users/4234", "pm_score": 1, "selected": false, "text": "<p>Here's a perl script that will filter the output of '<code>ls -l</code>' to add the commas.\nIf you call the script com...
2009/01/16
[ "https://Stackoverflow.com/questions/449803", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4234/" ]
You can do '`ls -l`' to get a detailed directory listing like this: ``` -rw-rw-rw- 1 alice themonkeys 1159995999 2008-08-20 07:01 foo.log -rw-rw-rw- 1 bob bob 244251992 2008-08-20 05:30 bar.txt ``` But notice how you have to slide your finger along the screen to figure out the order of magnitude of those...
I don't think 'ls' has exactly that capability. If you are looking for readability, 'ls -lh' will give you file sizes that are easier for humans to parse. ``` -rw-rw-rw- 1 alice themonkeys 1.2G 2008-08-20 07:01 foo.log -rw-rw-rw- 1 bob bob 244M 2008-08-20 05:30 bar.txt ```
449,808
<p>Are there any ways providing an alternate GIF/PNG image, in case the user has no Adobe Flash installed and/or deactivated. I’ve found recommendations, like the following from W3C, which determine via JavaScript the existence of Adobe Flash on the client: <a href="http://www.w3.org/WAI/GL/WD-WCAG10-NONW3C-TECHS-20000...
[ { "answer_id": 449828, "author": "balexandre", "author_id": 28004, "author_profile": "https://Stackoverflow.com/users/28004", "pm_score": 2, "selected": false, "text": "<p>I don't know why you want to avoid javascript, it is the best solution when dealing with Flash.</p>\n\n<p>using the ...
2009/01/16
[ "https://Stackoverflow.com/questions/449808", "https://Stackoverflow.com", "https://Stackoverflow.com/users/898/" ]
Are there any ways providing an alternate GIF/PNG image, in case the user has no Adobe Flash installed and/or deactivated. I’ve found recommendations, like the following from W3C, which determine via JavaScript the existence of Adobe Flash on the client: [W3C Providing alternative images](http://www.w3.org/WAI/GL/WD-WC...
Actually having flash installed but javascript turned off is a valid scenario. This should work across most browsers: ``` <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="800" height="600" id="flashContent"> <param name="movie" value="flash.swf" /> <!--[if !IE]>--> <object type="application/...
449,858
<p>I have a place holder image saying something like:</p> <pre><code>Your rating is: [rating here] </code></pre> <p>My PHP code is supposed to dynamically insert the rating number where there is a blank space left out for it on the placeholder image. How can I do that?</p>
[ { "answer_id": 449886, "author": "Al W", "author_id": 50011, "author_profile": "https://Stackoverflow.com/users/50011", "pm_score": 1, "selected": false, "text": "<p>I know that the question is \"How to dynamically create an image with a specified number on it?\" but I'll address the und...
2009/01/16
[ "https://Stackoverflow.com/questions/449858", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49153/" ]
I have a place holder image saying something like: ``` Your rating is: [rating here] ``` My PHP code is supposed to dynamically insert the rating number where there is a blank space left out for it on the placeholder image. How can I do that?
Here's a an example how you could do it - use [gd function](http://uk.php.net/manual/en/ref.image.php) calls to make your image, but play nice and cache the images. This sample plays *even nicer* by ensuring that if the browser already has the required image, it returns a 304... ``` #here's where we'll store the cache...
449,887
<p>I need to send email via my C# app.</p> <p>I come from a VB 6 background and had a lot of bad experiences with the MAPI control. First of all, MAPI did not support HTML emails and second, all the emails were sent to my default mail outbox. So I still needed to click on send receive.</p> <p>If I needed to send bulk h...
[ { "answer_id": 449893, "author": "Frederik Gheysels", "author_id": 55774, "author_profile": "https://Stackoverflow.com/users/55774", "pm_score": 2, "selected": false, "text": "<p>The .NET framework has some built-in classes which allows you to send e-mail via your app.</p>\n\n<p>You shou...
2009/01/16
[ "https://Stackoverflow.com/questions/449887", "https://Stackoverflow.com", "https://Stackoverflow.com/users/279238/" ]
I need to send email via my C# app. I come from a VB 6 background and had a lot of bad experiences with the MAPI control. First of all, MAPI did not support HTML emails and second, all the emails were sent to my default mail outbox. So I still needed to click on send receive. If I needed to send bulk html bodied emai...
You could use the **System.Net.Mail.MailMessage** class of the .NET framework. You can find the [MSDN documentation here](http://msdn.microsoft.com/en-us/library/system.net.mail.mailmessage(VS.80).aspx). Here is a simple example (code snippet): ``` using System.Net; using System.Net.Mail; using System.Net.Mime; ......
449,910
<p>Although i can grasp the concepts of the .Net framework and windows apps, i want to create an app that will involve me simulating website clicks and getting data/response times from that page. I have not had any experience with web yet as im only a junior, could someone explain to me (in english!!) the basic concept...
[ { "answer_id": 449918, "author": "splattne", "author_id": 6461, "author_profile": "https://Stackoverflow.com/users/6461", "pm_score": 3, "selected": false, "text": "<p>You could use the <strong>System.Net.WebClient class</strong> of the .NET Framework. See the <a href=\"http://msdn.micro...
2009/01/16
[ "https://Stackoverflow.com/questions/449910", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36243/" ]
Although i can grasp the concepts of the .Net framework and windows apps, i want to create an app that will involve me simulating website clicks and getting data/response times from that page. I have not had any experience with web yet as im only a junior, could someone explain to me (in english!!) the basic concepts o...
what do you want to do? send a request and grab the response in a String so you can process? [HttpWebRequest](http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.aspx) and [HttpWebResponse](http://msdn.microsoft.com/en-us/library/system.net.httpwebresponse.aspx) will work if you need to connect through...
449,915
<p>I have a Component which I am using both in a standalone Java application as well as in a Java applet. How can I figure out from within the Component whether my component is in an applet?</p> <p>Also, once I figure out that I'm running in an Applet, how can I get access to the Applet?</p>
[ { "answer_id": 449938, "author": "Alnitak", "author_id": 6782, "author_profile": "https://Stackoverflow.com/users/6782", "pm_score": 3, "selected": true, "text": "<p>I think you should be able to do it by repeatedly calling <code>Component.getParent()</code> until you get to the top of t...
2009/01/16
[ "https://Stackoverflow.com/questions/449915", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6583/" ]
I have a Component which I am using both in a standalone Java application as well as in a Java applet. How can I figure out from within the Component whether my component is in an applet? Also, once I figure out that I'm running in an Applet, how can I get access to the Applet?
I think you should be able to do it by repeatedly calling `Component.getParent()` until you get to the top of the container tree, and then checking whether that container is an `instanceof Applet`. The code below is completely untested: ``` boolean isInAnApplet(Component c) { Component p = c.getParent(); if (...
449,917
<p>A web page displays the following:-</p> <ul> <li>Bob</li> <li>Fred</li> <li>John</li> </ul> <p>However when the user (that would be me) prints the web page I want multiple repeats of this output with slight variations to be printed on separate pages :-</p> <ul> <li><strong>Bob</strong></li> <li>Fred</li> <li>John...
[ { "answer_id": 449937, "author": "Zhaph - Ben Duguid", "author_id": 33051, "author_profile": "https://Stackoverflow.com/users/33051", "pm_score": 2, "selected": false, "text": "<p>I'm not sure you can do it all via CSS, but here's some to get you started.</p>\n\n<p>To get a page break in...
2009/01/16
[ "https://Stackoverflow.com/questions/449917", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17516/" ]
A web page displays the following:- * Bob * Fred * John However when the user (that would be me) prints the web page I want multiple repeats of this output with slight variations to be printed on separate pages :- * **Bob** * Fred * John `>page break here<` * Bob * **Fred** * John `>page break here<` * Bob * Fre...
Ok, so taking into account the comments etc to my post something like this: For ease of display here, I'm using on page styles, but you can easily use off page references. Declaring the following styles: ``` <!-- media="print" means these styles will only be used by printing devices --> <style type="text/css" med...
449,922
<p>The stored procedures being written here currently concats the parameters to the queries:</p> <pre><code> SELECT * FROM Names WHERE Name = ' || prmName || ' ORDER BY ' || prmSortField </code></pre> <p>Is it possible to parameterize this query inside the stored procedure? Possibly like:</p> <pre><co...
[ { "answer_id": 449935, "author": "cletus", "author_id": 18393, "author_profile": "https://Stackoverflow.com/users/18393", "pm_score": 3, "selected": true, "text": "<p>Absolutely. Use <a href=\"http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/sqloperations.htm\" rel=\"nofol...
2009/01/16
[ "https://Stackoverflow.com/questions/449922", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31505/" ]
The stored procedures being written here currently concats the parameters to the queries: ``` SELECT * FROM Names WHERE Name = ' || prmName || ' ORDER BY ' || prmSortField ``` Is it possible to parameterize this query inside the stored procedure? Possibly like: ``` query = 'select * From Names Where...
Absolutely. Use [cursors](http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/sqloperations.htm). ``` DECLARE CURSOR c1 (job VARCHAR2, max_wage NUMBER) IS SELECT * FROM employees WHERE job_id = job AND salary > max_wage; BEGIN FOR person IN c1('CLERK', 3000) LOOP -- process data record DB...
449,933
<p>I am making an app with many database operations. Since SQLite caches data, in my applicationDidReceiveMemoryWarning method, I am closing the database and opening it again to delete the cached data.</p> <p>When the do this, I get this error</p> <blockquote> <p>*** Terminating app due to uncaught exception 'NSInt...
[ { "answer_id": 449935, "author": "cletus", "author_id": 18393, "author_profile": "https://Stackoverflow.com/users/18393", "pm_score": 3, "selected": true, "text": "<p>Absolutely. Use <a href=\"http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/sqloperations.htm\" rel=\"nofol...
2009/01/16
[ "https://Stackoverflow.com/questions/449933", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46297/" ]
I am making an app with many database operations. Since SQLite caches data, in my applicationDidReceiveMemoryWarning method, I am closing the database and opening it again to delete the cached data. When the do this, I get this error > > \*\*\* Terminating app due to uncaught exception 'NSInternalInconsistencyExcept...
Absolutely. Use [cursors](http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14261/sqloperations.htm). ``` DECLARE CURSOR c1 (job VARCHAR2, max_wage NUMBER) IS SELECT * FROM employees WHERE job_id = job AND salary > max_wage; BEGIN FOR person IN c1('CLERK', 3000) LOOP -- process data record DB...
449,941
<p>Considering the simplistic scenario:</p> <pre> function Base() {} function Child() {} Child.prototype = new Base; </pre> <p>I wonder why would an instance of Child have constructor property set to Base and not to Child?</p>
[ { "answer_id": 449955, "author": "Christoph", "author_id": 48015, "author_profile": "https://Stackoverflow.com/users/48015", "pm_score": 3, "selected": true, "text": "<p>It's all tied to how inheritance works in JavaScript. Check <a href=\"http://joost.zeekat.nl/constructors-considered-m...
2009/01/16
[ "https://Stackoverflow.com/questions/449941", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23815/" ]
Considering the simplistic scenario: ``` function Base() {} function Child() {} Child.prototype = new Base; ``` I wonder why would an instance of Child have constructor property set to Base and not to Child?
It's all tied to how inheritance works in JavaScript. Check [this link](http://joost.zeekat.nl/constructors-considered-mildly-confusing.html) for a detailed explanation (basically, `constructor` is just another property of the prototype). **Edit:** Also, if you want 'real' prototypical inheritance, you have to use som...
449,944
<p>Having written a <a href="http://www.codeproject.com/KB/testing/bddnbehave.aspx" rel="nofollow noreferrer">small article</a> on BDD, I got questions from people asking whether there are any cases of large-scale use of BDD (and specifically NBehave). </p> <p>So my question goes to the community: do you have a projec...
[ { "answer_id": 497665, "author": "Bill K", "author_id": 12943, "author_profile": "https://Stackoverflow.com/users/12943", "pm_score": 2, "selected": false, "text": "<p>I was on a small team that used BDD on a website.</p>\n\n<p>The way we used it was essentially TDD, but the tests are si...
2009/01/16
[ "https://Stackoverflow.com/questions/449944", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9476/" ]
Having written a [small article](http://www.codeproject.com/KB/testing/bddnbehave.aspx) on BDD, I got questions from people asking whether there are any cases of large-scale use of BDD (and specifically NBehave). So my question goes to the community: do you have a project that used BDD successfully? If so, what benef...
We've used somewhat of BDD at the code level in different scenarios (open source and ND projects). 1. Telling the view in MVC scenario, what kind of input to accept from user ([DDD and Rule driven UI Validation in .NET](http://abdullin.com/journal/2009/1/29/ddd-and-rule-driven-ui-validation-in-net.html)) ``` result =...
449,952
<p>I have this team build target setup to after compile</p> <pre><code> &lt;Target Name="AfterCompile"&gt; &lt;Copy SourceFiles="$(SolutionRoot)\Development_VS2008\MyCompanyName.SharePoint.12" DestinationFolder="c:\testing"&gt;&lt;/Copy&gt; &lt;/Target&gt; </code></pre> <p>I want the folder structure copied fr...
[ { "answer_id": 449965, "author": "Kent Boogaart", "author_id": 5380, "author_profile": "https://Stackoverflow.com/users/5380", "pm_score": 3, "selected": false, "text": "<p>I think it might be just because <code>SourceFiles</code> is a directory rather than the files you want to copy. Tr...
2009/01/16
[ "https://Stackoverflow.com/questions/449952", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41291/" ]
I have this team build target setup to after compile ``` <Target Name="AfterCompile"> <Copy SourceFiles="$(SolutionRoot)\Development_VS2008\MyCompanyName.SharePoint.12" DestinationFolder="c:\testing"></Copy> </Target> ``` I want the folder structure copied from source to destination... Amazingly I am gettin...
I think it might be just because `SourceFiles` is a directory rather than the files you want to copy. Try this: ``` <Target Name="AfterCompile"> <ItemGroup> <FilesToCopy Include="$(SolutionRoot)\Development_VS2008\MyCompanyName.SharePoint.12\**\*.*"/> </ItemGroup> <Copy SourceFiles="@(FilesToCopy)...
449,962
<p>We have a web app that is using MVC Preview 3. I'm new to the project and relatively new to ASP.NET MVC itself - soon we will be looking to upgrade to either the Beta or RC version.</p> <ol> <li><p>Are there any major difference between preview 3 and Beta version that would require extensive refactoring?</p></li> <...
[ { "answer_id": 449965, "author": "Kent Boogaart", "author_id": 5380, "author_profile": "https://Stackoverflow.com/users/5380", "pm_score": 3, "selected": false, "text": "<p>I think it might be just because <code>SourceFiles</code> is a directory rather than the files you want to copy. Tr...
2009/01/16
[ "https://Stackoverflow.com/questions/449962", "https://Stackoverflow.com", "https://Stackoverflow.com/users/55788/" ]
We have a web app that is using MVC Preview 3. I'm new to the project and relatively new to ASP.NET MVC itself - soon we will be looking to upgrade to either the Beta or RC version. 1. Are there any major difference between preview 3 and Beta version that would require extensive refactoring? 2. Any "gotchas"? 3. From ...
I think it might be just because `SourceFiles` is a directory rather than the files you want to copy. Try this: ``` <Target Name="AfterCompile"> <ItemGroup> <FilesToCopy Include="$(SolutionRoot)\Development_VS2008\MyCompanyName.SharePoint.12\**\*.*"/> </ItemGroup> <Copy SourceFiles="@(FilesToCopy)...
449,963
<p>It there a way to read the params inside a class of a gem I tried require "cgi" and require "action_pack" but no chance... Any clues ?</p> <p>Thanx</p>
[ { "answer_id": 449988, "author": "Keltia", "author_id": 16143, "author_profile": "https://Stackoverflow.com/users/16143", "pm_score": 1, "selected": false, "text": "<p>Be more precise. The params of what? A submitted form?</p>\n\n<p>If yes, you could do that:</p>\n\n<pre><code>require ...
2009/01/16
[ "https://Stackoverflow.com/questions/449963", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1438479/" ]
It there a way to read the params inside a class of a gem I tried require "cgi" and require "action\_pack" but no chance... Any clues ? Thanx
Be more precise. The params of what? A submitted form? If yes, you could do that: ``` require "cgi" ... cgi = CGI.new h = cgi.params login = h['login'][0] password = h['password'][0] ``` and so on.
449,993
<p>I have the following code:</p> <pre> <code> Imports System.IO Public Class Blah Public Sub New() InitializeComponent() Dim watcher As New FileSystemWatcher("C:\") watcher.EnableRaisingEvents = True AddHandler watcher.Changed, AddressOf watcher_Changed End Sub Private ...
[ { "answer_id": 450001, "author": "lc.", "author_id": 44853, "author_profile": "https://Stackoverflow.com/users/44853", "pm_score": 1, "selected": false, "text": "<p>Assuming the path is the same every time, is it possible the program you are using to save the file is actually doing the s...
2009/01/16
[ "https://Stackoverflow.com/questions/449993", "https://Stackoverflow.com", "https://Stackoverflow.com/users/55732/" ]
I have the following code: ``` Imports System.IO Public Class Blah Public Sub New() InitializeComponent() Dim watcher As New FileSystemWatcher("C:\") watcher.EnableRaisingEvents = True AddHandler watcher.Changed, AddressOf watcher_Changed End Sub Private Sub watcher_Cha...
From the "Troubleshooting FileSystemWatcher Components" section of the VS.NET documentation... > > ### Multiple Created Events Generated for a Single Action > > > You may notice in certain situations that a single creation event generates multiple Created events that are handled by your component. For example, if y...
450,009
<p>How do I get the internal serial number of a USB-Stick or USB-HardDrive in C#?</p>
[ { "answer_id": 450020, "author": "Yuval Adam", "author_id": 24545, "author_profile": "https://Stackoverflow.com/users/24545", "pm_score": 6, "selected": true, "text": "<p>Try this:</p>\n\n<pre><code>// add a reference to the System.Management assembly and\n// import the System.Management...
2009/01/16
[ "https://Stackoverflow.com/questions/450009", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42475/" ]
How do I get the internal serial number of a USB-Stick or USB-HardDrive in C#?
Try this: ``` // add a reference to the System.Management assembly and // import the System.Management namespace at the top in your "using" statement. // Then in a method, or on a button click: ManagementObjectSearcher theSearcher = new ManagementObjectSearcher("SELECT * FROM Win32_DiskDrive WHERE InterfaceType='USB'...
450,026
<p>I need a generic transliteration or substitution regex that will map extended latin characters to similar looking ASCII characters, and all other extended characters to '' (empty string) so that...</p> <ul> <li><p>é becomes e</p></li> <li><p>ê becomes e</p></li> <li><p>á becomes a</p></li> <li><p>ç becomes c</p></l...
[ { "answer_id": 450071, "author": "user55400", "author_id": 55400, "author_profile": "https://Stackoverflow.com/users/55400", "pm_score": 2, "selected": false, "text": "<p>Maybe a <a href=\"http://search.cpan.org\" rel=\"nofollow noreferrer\">CPAN</a> module might be of help?</p>\n\n<p><a...
2009/01/16
[ "https://Stackoverflow.com/questions/450026", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17492/" ]
I need a generic transliteration or substitution regex that will map extended latin characters to similar looking ASCII characters, and all other extended characters to '' (empty string) so that... * é becomes e * ê becomes e * á becomes a * ç becomes c * Ď becomes D and so on, but things like ‡ or Ω or ‰ just get st...
All brilliant answers. But none actually really worked. Putting extended characters directly in the source-code caused problems when working in terminal windows or various code/text editors across platforms. I was able to try out Unicode::Normalize, Text::Unidecode and Text::Unaccent, but wan't able to get any of them ...
450,033
<p>How can I do that, so whenever a user clicks a link we play a sound? Using javascript and jquery here.</p>
[ { "answer_id": 450040, "author": "Javache", "author_id": 1074, "author_profile": "https://Stackoverflow.com/users/1074", "pm_score": 0, "selected": false, "text": "<p>First things first, i'd not like that as a user.</p>\n\n<p>The best way to do is probably using a small flash applet that...
2009/01/16
[ "https://Stackoverflow.com/questions/450033", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49153/" ]
How can I do that, so whenever a user clicks a link we play a sound? Using javascript and jquery here.
Use this plugin: <https://github.com/admsev/jquery-play-sound> ```js $.playSound('http://example.org/sound.mp3'); ```
450,042
<p>I've slightly modified the iPhone SDK's GLSprite example while learning OpenGL ES and it turns out to be quite slow. Even in the simulator (on the hw worst) so I must be doing something wrong since it's only 400 textured triangles. </p> <pre><code>const GLfloat spriteVertices[] = { 0.0f, 0.0f, 100.0f, 0.0f, ...
[ { "answer_id": 450088, "author": "Nils Pipenbrinck", "author_id": 15955, "author_profile": "https://Stackoverflow.com/users/15955", "pm_score": 2, "selected": false, "text": "<p>Your texture is 512*512*4 bytes per pixel. That's a megabyte of data. If you render it 200 times per frame you...
2009/01/16
[ "https://Stackoverflow.com/questions/450042", "https://Stackoverflow.com", "https://Stackoverflow.com/users/55797/" ]
I've slightly modified the iPhone SDK's GLSprite example while learning OpenGL ES and it turns out to be quite slow. Even in the simulator (on the hw worst) so I must be doing something wrong since it's only 400 textured triangles. ``` const GLfloat spriteVertices[] = { 0.0f, 0.0f, 100.0f, 0.0f, 0.0f, 100.0f...
(I know this is very late, but I couldn't resist. I'll post anyway, in case other people come here looking for advice.) This has nothing to do with the texture size. I don't know why people rated up Nils. He seems to have a fundamental misunderstanding of the OpenGL pipeline. He seems to think that for a given triangl...
450,050
<p>Is it possible to copy a directory in a team build target?</p>
[ { "answer_id": 450066, "author": "Aaron Powell", "author_id": 11388, "author_profile": "https://Stackoverflow.com/users/11388", "pm_score": 1, "selected": false, "text": "<p>I've found the easiest way (if you want to be a bit more stringent about what to include/ exclude) is with some cu...
2009/01/16
[ "https://Stackoverflow.com/questions/450050", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41291/" ]
Is it possible to copy a directory in a team build target?
``` <Copy SourceFiles="@(SourceItemGroup)" DestinationFolder="$(YourDir\SubDir\%(RecursiveDir)" /> ```
450,055
<p>I would like to draw a control on some other control in it's overriden paint event. By drawing I mean real drawing, not placing the control inside the other control. Is there any nice way to do that?</p>
[ { "answer_id": 450086, "author": "Spence", "author_id": 53771, "author_profile": "https://Stackoverflow.com/users/53771", "pm_score": 0, "selected": false, "text": "<p>Perhaps what you're after is a \"panel\" which you can inherit from and then create your own behaviour?</p>\n\n<pre><cod...
2009/01/16
[ "https://Stackoverflow.com/questions/450055", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40872/" ]
I would like to draw a control on some other control in it's overriden paint event. By drawing I mean real drawing, not placing the control inside the other control. Is there any nice way to do that?
Try the static methods on the **ControlPaint** class. Drawn controls may not be skinned like the rest of the GUI, but the effect will be pretty believable. Below is a stripped-down version of some of my code. It is overriding the DrawItem method of an ownerdrawn ListBox to make the list items look like buttons, using *...
450,059
<p>I have a string "test1" and my comboBox contains <code>test1</code>, <code>test2</code>, and <code>test3</code>. How do I set the selected item to "test1"? That is, how do I match my string to one of the comboBox items?</p> <p>I was thinking of the line below, but this doesn't work.</p> <pre><code>comboBox1.Select...
[ { "answer_id": 450062, "author": "Frederik Gheysels", "author_id": 55774, "author_profile": "https://Stackoverflow.com/users/55774", "pm_score": 5, "selected": false, "text": "<p>If the items in your ComboBox are strings, you can try:</p>\n\n<pre><code>comboBox1.SelectedItem = \"test1\";...
2009/01/16
[ "https://Stackoverflow.com/questions/450059", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a string "test1" and my comboBox contains `test1`, `test2`, and `test3`. How do I set the selected item to "test1"? That is, how do I match my string to one of the comboBox items? I was thinking of the line below, but this doesn't work. ``` comboBox1.SelectedText = "test1"; ```
This should do the trick: ``` Combox1.SelectedIndex = Combox1.FindStringExact("test1") ```
450,083
<p>assume that i have a program written in assembly language which takes an input sentence from the user ( combination of digits and letters) and on the next line will display the number of small letters in the sentence. Also display the number of digits in the sentence.</p> <p>my question is: how i can make the coun...
[ { "answer_id": 450099, "author": "mmx", "author_id": 33708, "author_profile": "https://Stackoverflow.com/users/33708", "pm_score": 2, "selected": false, "text": "<p>I assume you mean x86 assembly and the string is null terminated.</p>\n\n<pre><code>mov eax, STRING_VARIABLE\nxor ebx, ebx\...
2009/01/16
[ "https://Stackoverflow.com/questions/450083", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
assume that i have a program written in assembly language which takes an input sentence from the user ( combination of digits and letters) and on the next line will display the number of small letters in the sentence. Also display the number of digits in the sentence. my question is: how i can make the count instructi...
I assume you mean x86 assembly and the string is null terminated. ``` mov eax, STRING_VARIABLE xor ebx, ebx xor ecx, ecx .loop: mov dl, [eax] cmp dl, 0 jz .end cmp dl, '0' jb .notdigit cmp dl, '9' ja .notdigit inc ecx jmp .notlowercase .notdigit: cmp dl, 'a' jb .notlowercase cmp dl, 'z' ja...
450,091
<p>Here is the situation:<br> I have a table value function with a datetime parameter ,lest's say tdf(p_date) , that filters about two million rows selecting those with column date smaller than p_date and computes some aggregate values on other columns.<br> It works great but if p_date is a custom scalar value function...
[ { "answer_id": 450487, "author": "gbn", "author_id": 27535, "author_profile": "https://Stackoverflow.com/users/27535", "pm_score": 4, "selected": true, "text": "<p>The overhead is your scalar function.</p>\n\n<p>The TVF here is expanded like an inline macro so</p>\n\n<pre><code>SELECT * ...
2009/01/16
[ "https://Stackoverflow.com/questions/450091", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28419/" ]
Here is the situation: I have a table value function with a datetime parameter ,lest's say tdf(p\_date) , that filters about two million rows selecting those with column date smaller than p\_date and computes some aggregate values on other columns. It works great but if p\_date is a custom scalar value function (...
The overhead is your scalar function. The TVF here is expanded like an inline macro so ``` SELECT * FROM [dbo].[tdf] (getdate()) ``` becomes ``` SELECT idProduct, SUM(Quantity) AS TotalQuantity, max(Date) as LastDate FROM POC WHERE Date < getdate() GROUP BY idProduct ``` When you use ...
450,093
<p>referring to <a href="https://stackoverflow.com/questions/444927/logic-behind-hiding-elements">my previous question</a> I came accross to another problem. The div I am showing includes links in it. When I click on them, the div disappears as expected but not as desired.. (we want it to disappear whenever we click on...
[ { "answer_id": 450119, "author": "Christoph", "author_id": 48015, "author_profile": "https://Stackoverflow.com/users/48015", "pm_score": 0, "selected": false, "text": "<p>You have to add their own event listeners to the links and call <code>event.stopPropagation()</code> inside.</p>\n" ...
2009/01/16
[ "https://Stackoverflow.com/questions/450093", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49742/" ]
referring to [my previous question](https://stackoverflow.com/questions/444927/logic-behind-hiding-elements) I came accross to another problem. The div I am showing includes links in it. When I click on them, the div disappears as expected but not as desired.. (we want it to disappear whenever we click on anywhere on p...
You need to bind your links to a click event and stop the bubbling so the document doesnt recieve the bubbled click. I think a better approach to avoid binding multiple click events is to listen for the anchor being clicked inside the doucument click. So basically if the element that triggered the click event is an ...
450,107
<p>I'm trying to compile a project from the command line, like this:</p> <pre><code>devenv.exe myproj.sln /build release </code></pre> <p>It looks like the code compiles well, but that's not all I need:</p> <p>I want to be able to capture the output (e.g. warnings, errors) from the compiler as they occur. Unfortunat...
[ { "answer_id": 450125, "author": "Aamir", "author_id": 30341, "author_profile": "https://Stackoverflow.com/users/30341", "pm_score": 3, "selected": false, "text": "<p>use devenv.com in place of devenv.exe and you will get what you want.</p>\n\n<p>You can use MSBuild.exe as well for more ...
2009/01/16
[ "https://Stackoverflow.com/questions/450107", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46411/" ]
I'm trying to compile a project from the command line, like this: ``` devenv.exe myproj.sln /build release ``` It looks like the code compiles well, but that's not all I need: I want to be able to capture the output (e.g. warnings, errors) from the compiler as they occur. Unfortunately as soon as I issue the above ...
devenv uses this interesting dispatcher that switches between command line mode and windowed mode. There's actually a devenv.com in addition to devenv.exe, and since \*.com takes precedence over \*.exe, it gets invoked first. devenv.com analyzes the command line and decides what to invoke. In other words, change your ...
450,108
<p>I am trying to write a pattern for extracting the path for files found in img tags in HTML.</p> <pre><code>String string = "&lt;img src=\"file:/C:/Documents and Settings/elundqvist/My Documents/My Pictures/import dialog step 1.JPG\" border=\"0\" /&gt;"; </code></pre> <p>My Pattern:</p> <pre><code>src\\s*=\\s*\"(....
[ { "answer_id": 450113, "author": "Gumbo", "author_id": 53114, "author_profile": "https://Stackoverflow.com/users/53114", "pm_score": 3, "selected": false, "text": "<p>Try this expression:</p>\n\n<pre><code>src\\s*=\\s*\"([^\"]+)\"\n</code></pre>\n" }, { "answer_id": 450117, "...
2009/01/16
[ "https://Stackoverflow.com/questions/450108", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51382/" ]
I am trying to write a pattern for extracting the path for files found in img tags in HTML. ``` String string = "<img src=\"file:/C:/Documents and Settings/elundqvist/My Documents/My Pictures/import dialog step 1.JPG\" border=\"0\" />"; ``` My Pattern: ``` src\\s*=\\s*\"(.+)\" ``` Problem is that my pattern will ...
Your pattern should be (unescaped): ``` src\s*=\s*"(.+?)" ``` The important part is the added question mark that matches the group as few times as possible
450,115
<p>The use case is simple. At a certain point of time, I need to be able to show the user his familiar compose email dialog (Outlook or other) with </p> <ul> <li>fields like from, to, Subject already filled up with certain application determined values.</li> <li>The email would also have an attachment along with it.</...
[ { "answer_id": 450133, "author": "gkrogers", "author_id": 54501, "author_profile": "https://Stackoverflow.com/users/54501", "pm_score": 2, "selected": false, "text": "<p>It's probably <b>not</b> the most efficient or elegant way, but shelling a \"mailto:\" link will do what you want, I t...
2009/01/16
[ "https://Stackoverflow.com/questions/450115", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1695/" ]
The use case is simple. At a certain point of time, I need to be able to show the user his familiar compose email dialog (Outlook or other) with * fields like from, to, Subject already filled up with certain application determined values. * The email would also have an attachment along with it. The mail should not b...
You can create a process object and have it call "mailto:user@example.com?subject=My+New+Subject". This will cause the system to act on the mailto with its default handler, however, while you can set subjects and such this wont handle adding an attachment. I'll freely admit im not entirely sure how you'd go about forci...
450,142
<p>I am using a Gridview to display some data. In EditItemTemplate of gridview I am using DropDownList for one of the column of gridview. DataSource of gridview is a table "UserEntries". And Datasource of Dropdown is another table "TypeEntries". Columns of TypeEntries are - Guid and TypeName. Guid is DataValueField of ...
[ { "answer_id": 450168, "author": "mmx", "author_id": 33708, "author_profile": "https://Stackoverflow.com/users/33708", "pm_score": 0, "selected": false, "text": "<p>C# is case sensitive, you should use <code>DropDownList</code> instead.</p>\n" }, { "answer_id": 450220, "autho...
2009/01/16
[ "https://Stackoverflow.com/questions/450142", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43886/" ]
I am using a Gridview to display some data. In EditItemTemplate of gridview I am using DropDownList for one of the column of gridview. DataSource of gridview is a table "UserEntries". And Datasource of Dropdown is another table "TypeEntries". Columns of TypeEntries are - Guid and TypeName. Guid is DataValueField of dro...
If you get "Object reference not set to an instance of an object." in exception, it means the "ddlTypeListInGrid" control was not found. So you can not cast NULL ( NOTHING ) to target type. You propably do this code in wrogn page's life cycle. Try it in one of later oage events (Load, LoadComplete, etc..) or check, if...
450,151
<p>I am just getting started with WCF and would like to set up a distributable networked system as follows: (but am not sure if it is possible.)</p> <p>I have a .net client that has business logic. It will need various data from various sources so I would like to add a 'server' that contains an in-memory cache but als...
[ { "answer_id": 453854, "author": "thaBadDawg", "author_id": 48832, "author_profile": "https://Stackoverflow.com/users/48832", "pm_score": 2, "selected": true, "text": "<p>I don't know if this exactly will get you what you are looking for, but I this is what I use to add my WCF endpoints ...
2009/01/16
[ "https://Stackoverflow.com/questions/450151", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30132/" ]
I am just getting started with WCF and would like to set up a distributable networked system as follows: (but am not sure if it is possible.) I have a .net client that has business logic. It will need various data from various sources so I would like to add a 'server' that contains an in-memory cache but also WCF capa...
I don't know if this exactly will get you what you are looking for, but I this is what I use to add my WCF endpoints to my Windows Service. This is the code that the service runs to load all the wcf services: ``` IDictionary<string, ServiceHost> hosts; NetTcpBinding binding; CustomBinding mexBinding; private void Add...
450,159
<p>I am using asp .net web form search in c#, for example with fields: - name - fruit</p> <p>I want to write a sproc that can search name or fruit. If I knew that both would have values, I would pass two parameters into the sproc and would write:</p> <pre><code>Select * from myTable where name =@name and fruit = @fru...
[ { "answer_id": 450164, "author": "tvanfosson", "author_id": 12950, "author_profile": "https://Stackoverflow.com/users/12950", "pm_score": 3, "selected": true, "text": "<p>You'll need to make sure that empty strings aren't passed as arguments instead of null, but the following should work...
2009/01/16
[ "https://Stackoverflow.com/questions/450159", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52843/" ]
I am using asp .net web form search in c#, for example with fields: - name - fruit I want to write a sproc that can search name or fruit. If I knew that both would have values, I would pass two parameters into the sproc and would write: ``` Select * from myTable where name =@name and fruit = @fruit ``` However some...
You'll need to make sure that empty strings aren't passed as arguments instead of null, but the following should work. I'm pretty sure, though, that if the user doesn't input anything the form value will be null. ``` select * from myTable where (@name is null or name = @name) and (@fruit is null or fruit = @fruit) ...
450,165
<p>I get the following error:</p> <pre><code>javax.servlet.ServletException: Cannot find a matching 1-argument function named {http://exslt.org/dynamic}evaluate() at org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841) at org.apache.jasper.runtime.PageContextImpl.handlePageExceptio...
[ { "answer_id": 450490, "author": "Zhaph - Ben Duguid", "author_id": 33051, "author_profile": "https://Stackoverflow.com/users/33051", "pm_score": 4, "selected": true, "text": "<p>I'd probably store the details of each field, and then the roles and status that can edit them, and do it tha...
2009/01/16
[ "https://Stackoverflow.com/questions/450165", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I get the following error: ``` javax.servlet.ServletException: Cannot find a matching 1-argument function named {http://exslt.org/dynamic}evaluate() at org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841) at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextI...
I'd probably store the details of each field, and then the roles and status that can edit them, and do it that way. What are the rules for the system? Basically, are there really 300 possible conditions? Or is that really certain fields are only editable for certain status, and then only certain roles can edit those f...
450,177
<p><strong>The problem</strong></p> <ul> <li>I have a word template which uses VBA's <code>Declare</code> statement to link to a dll, whose path can be determined within the VBA macro</li> <li>I want to delploy this to the users %APPDATA%\Microsoft\Word\STARTUP directory</li> <li>I DON'T want to permanently change the...
[ { "answer_id": 451667, "author": "SparcU", "author_id": 32887, "author_profile": "https://Stackoverflow.com/users/32887", "pm_score": 3, "selected": false, "text": "<p>You can use LoadLibrary api. </p>\n\n<p>For example in my projects the code looks like this: </p>\n\n<pre><code>If Libra...
2009/01/16
[ "https://Stackoverflow.com/questions/450177", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22648/" ]
**The problem** * I have a word template which uses VBA's `Declare` statement to link to a dll, whose path can be determined within the VBA macro * I want to delploy this to the users %APPDATA%\Microsoft\Word\STARTUP directory * I DON'T want to permanently change the user's PATH environment variable (temporarily would...
You can use LoadLibrary api. For example in my projects the code looks like this: ``` If LibraryLoaded() Then Call MyFunc ... End If Public Function LibraryLoaded() As Boolean Static IsLoaded As Boolean Static TriedToLoadAlready As Boolean If TriedToLoadAlready Then LibraryLoaded = IsLoaded Exit Fu...
450,180
<p><strong>UPDATE</strong>: Here's <a href="http://tinyurl.com/7zgwb4" rel="noreferrer">my implementation of Hashed Timing Wheels</a>. Please let me know if you have an idea to improve the performance and concurrency. (20-Jan-2009)</p> <pre><code>// Sample usage: public static void main(String[] args) throws Exceptio...
[ { "answer_id": 450397, "author": "Douglas Leeder", "author_id": 3978, "author_profile": "https://Stackoverflow.com/users/3978", "pm_score": 0, "selected": false, "text": "<p>You've got a hard-limit on the number of items in the queue - there is a limit to TCP sockets.</p>\n\n<p>Therefore...
2009/01/16
[ "https://Stackoverflow.com/questions/450180", "https://Stackoverflow.com", "https://Stackoverflow.com/users/55808/" ]
**UPDATE**: Here's [my implementation of Hashed Timing Wheels](http://tinyurl.com/7zgwb4). Please let me know if you have an idea to improve the performance and concurrency. (20-Jan-2009) ``` // Sample usage: public static void main(String[] args) throws Exception { Timer timer = new HashedWheelTimer(); for (i...
How about trying to separate the handing of the normal case where things complete quickly from the error cases? Use both a hash table and a priority queue. When a task is started it gets put in the hash table and if it finishes quickly it gets removed in O(1) time. Every one second you scan the hash table and any tas...
450,186
<p>everubody! can you help me with my trouble? I'm trying to create form for filling resume. User should not use mail client to submit form. How can I realize this idea on javascript or PHP? </p>
[ { "answer_id": 450191, "author": "Sergio", "author_id": 32037, "author_profile": "https://Stackoverflow.com/users/32037", "pm_score": 0, "selected": false, "text": "<p>If the form as a file upload... You can just upload the cv to the webserver and then use your application to send an Ema...
2009/01/16
[ "https://Stackoverflow.com/questions/450186", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
everubody! can you help me with my trouble? I'm trying to create form for filling resume. User should not use mail client to submit form. How can I realize this idea on javascript or PHP?
First: You need a server based script. Without any server interaction, no mail can be sent. PHP has a [mail() function](http://de2.php.net/manual/en/function.mail.php) and it works very well, if your server administrator enabled it. Very simple example: ``` <?php // The message $message = "Line 1\nLine 2\nLine 3"; /...
450,206
<p>I got into problem of predicate And operator. Code is :</p> <pre><code>SQLDBDataContext sqlDS = new SQLDBDataContext(); Expression&lt;Func&lt;User,bool&gt;&gt; pred = null; //delcare the predicate to start with. if (Request["Name"] != null &amp;&amp; ! Request["Name"].Equals(string.Empty)) { pred = c =&gt; ( ...
[ { "answer_id": 450231, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 2, "selected": false, "text": "<p><code>And</code> is the binary And operator; you mean <code>Expression.AndAlso</code>, i.e.</p>\n\n<pre><code>pred...
2009/01/16
[ "https://Stackoverflow.com/questions/450206", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51635/" ]
I got into problem of predicate And operator. Code is : ``` SQLDBDataContext sqlDS = new SQLDBDataContext(); Expression<Func<User,bool>> pred = null; //delcare the predicate to start with. if (Request["Name"] != null && ! Request["Name"].Equals(string.Empty)) { pred = c => ( c.ContactFirst.Contains(Request["Name...
`And` is the binary And operator; you mean `Expression.AndAlso`, i.e. ``` pred = Expression.AndAlso(pred, {new bit}) ``` However, I suspect you are doing this the hard way. It is easier to use things like: ``` IQueryable<Foo> source = ... if(condition1) { source = source.Where(predicate1); } if(condition2) { ...
450,222
<p>I have the following code: </p> <pre><code>[replyAllBtn addTarget:self.target action:@selector(ReplyAll:) forControlEvents:UIControlEventTouchUpInside]; - (void)replyAll:(NSInteger)tid { // some code } </code></pre> <p>How can I send a parameter to the <code>ReplyAll</code> function?</p>
[ { "answer_id": 450327, "author": "Thomas Tempelmann", "author_id": 43615, "author_profile": "https://Stackoverflow.com/users/43615", "pm_score": 1, "selected": false, "text": "<p>The MVC model used in Cocoa works differently. Basically, the idea is that a control (=view) such as a button...
2009/01/16
[ "https://Stackoverflow.com/questions/450222", "https://Stackoverflow.com", "https://Stackoverflow.com/users/55817/" ]
I have the following code: ``` [replyAllBtn addTarget:self.target action:@selector(ReplyAll:) forControlEvents:UIControlEventTouchUpInside]; - (void)replyAll:(NSInteger)tid { // some code } ``` How can I send a parameter to the `ReplyAll` function?
The replyAll method should accept (id)sender. If a UIButton fired the event, then that same UIButton will be passed as the sender. UIButton has a property "tag" that you can attach your own custom data to (much like .net winforms). So you'd hook up your event with: ``` [replyAllBtn addTarget:self.target action:@selec...
450,226
<p>I have the next code in a JSTL file: </p> <pre><code>&lt;c:choose&gt; &lt;c:when test="${application.lodging eq 'F'}"&gt;&lt;bean:message key="courseapplication.lodgingF"/&gt;&lt;/c:when&gt; &lt;c:when test="${application.lodging eq 'H'}"&gt;&lt;bean:message key="courseapplication.lodgingH"/&gt;&lt;/c:when&...
[ { "answer_id": 450311, "author": "VonC", "author_id": 6309, "author_profile": "https://Stackoverflow.com/users/6309", "pm_score": 0, "selected": false, "text": "<p>Did you try to use a simple comparison against string, as <a href=\"https://stackoverflow.com/questions/123598#368526\">sugg...
2009/01/16
[ "https://Stackoverflow.com/questions/450226", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2138/" ]
I have the next code in a JSTL file: ``` <c:choose> <c:when test="${application.lodging eq 'F'}"><bean:message key="courseapplication.lodgingF"/></c:when> <c:when test="${application.lodging eq 'H'}"><bean:message key="courseapplication.lodgingH"/></c:when> <c:when test="${application.lodging eq 'B'}"><be...
Exception indicates that that `application.lodging` is number, not string. Is that right? In such case, you might need to convert your 'F', 'H', 'B' strings to numbers first (do you want to compare characters?)
450,233
<p>So I have a generic list, and an <code>oldIndex</code> and a <code>newIndex</code> value.</p> <p>I want to move the item at <code>oldIndex</code>, to <code>newIndex</code>...as simply as possible.</p> <p>Any suggestions?</p> <h2>Note</h2> <p>The item should be end up between the items at <code>(newIndex - 1)</co...
[ { "answer_id": 450242, "author": "Aaron Maenpaa", "author_id": 2603, "author_profile": "https://Stackoverflow.com/users/2603", "pm_score": 1, "selected": false, "text": "<p>I would expect either:</p>\n\n<pre><code>// Makes sure item is at newIndex after the operation\nT item = list[oldIn...
2009/01/16
[ "https://Stackoverflow.com/questions/450233", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39709/" ]
So I have a generic list, and an `oldIndex` and a `newIndex` value. I want to move the item at `oldIndex`, to `newIndex`...as simply as possible. Any suggestions? Note ---- The item should be end up between the items at `(newIndex - 1)` and `newIndex` *before* it was removed.
I know you said "generic list" but you didn't specify that you needed to use the *List(T)* class so here is a shot at something different. The *ObservableCollection(T)* class has a [Move method](http://msdn.microsoft.com/en-us/library/ms654933.aspx) that does exactly what you want. ``` public void Move(int oldIndex, ...
450,238
<p>Are there any problems with not prefixing private fields with an underscore in C# if the binary version is going to be consumed by other framework languages? For example since C# is case-sensitive you can call a field "foo" and the public property "Foo" and it works fine.</p> <p>Would this have <strong>any</strong>...
[ { "answer_id": 450251, "author": "Binary Worrier", "author_id": 18797, "author_profile": "https://Stackoverflow.com/users/18797", "pm_score": 7, "selected": true, "text": "<p>It will have <strong>no</strong> effect.</p>\n\n<p>Part of the recommendations for writing CLS-compliant librarie...
2009/01/16
[ "https://Stackoverflow.com/questions/450238", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25319/" ]
Are there any problems with not prefixing private fields with an underscore in C# if the binary version is going to be consumed by other framework languages? For example since C# is case-sensitive you can call a field "foo" and the public property "Foo" and it works fine. Would this have **any** effect on a case-insen...
It will have **no** effect. Part of the recommendations for writing CLS-compliant libraries is to NOT have two public/protected entities that differ only by case e.g you should **NOT** have ``` public void foo() {...} ``` and ``` public void Foo() {...} ``` what you're describing isn't a problem because the pri...
450,285
<p>I'm building a web application that will is going to manipulate (pad, mix, merge etc) sound files and I've found that <a href="http://sox.sourceforge.net/" rel="noreferrer">sox</a> does exactly what I want. Sox is a linux command line program and I'm feeling a little uncomfortable with having the python web app star...
[ { "answer_id": 450299, "author": "z -", "author_id": 38264, "author_profile": "https://Stackoverflow.com/users/38264", "pm_score": 2, "selected": false, "text": "<p>I am not familiar with sox, but instead of making repeated calls to the program as a command line, is it possible to set i...
2009/01/16
[ "https://Stackoverflow.com/questions/450285", "https://Stackoverflow.com", "https://Stackoverflow.com/users/261/" ]
I'm building a web application that will is going to manipulate (pad, mix, merge etc) sound files and I've found that [sox](http://sox.sourceforge.net/) does exactly what I want. Sox is a linux command line program and I'm feeling a little uncomfortable with having the python web app starting new sox processes on my se...
The [`subprocess`](http://docs.python.org/library/subprocess.html) module is the preferred way of running other programs from Python -- much more flexible and nicer to use than `os.system`. ``` import subprocess #subprocess.check_output(['ls', '-l']) # All that is technically needed... print(subprocess.check_output(...
450,290
<p>I am installing active python, django. I really dont know how to set the python path in vista environment system. first of all will it work in vista.</p>
[ { "answer_id": 450304, "author": "schnaader", "author_id": 34065, "author_profile": "https://Stackoverflow.com/users/34065", "pm_score": 1, "selected": false, "text": "<p>Perhaps this helps: It's a <a href=\"http://www.neuralwiki.org/index.php?title=Guide_to_installing_Python_in_Windows_...
2009/01/16
[ "https://Stackoverflow.com/questions/450290", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14752/" ]
I am installing active python, django. I really dont know how to set the python path in vista environment system. first of all will it work in vista.
Temporary Change ================ To change the python path temporarily (i.e., for one interactive session), just append to `sys.path` like this: ``` >>> import sys >>> sys.path ['', 'C:\\Program Files\\PyScripter\\Lib\\rpyc.zip', 'C:\\Windows\\system32\\python27.zip', 'C:\\Python27\\DLLs', 'C:\\Python27\\lib', ...
450,316
<p>I've noticed that the <code>&lt;input&gt;</code> element in HTML ignores the CSS pair of "left" and "right" properties. Same for the pair "top" and "bottom". See the sample code below:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;style&gt;&lt;!-- #someid { position: absolute; ...
[ { "answer_id": 450355, "author": "annakata", "author_id": 13018, "author_profile": "https://Stackoverflow.com/users/13018", "pm_score": 3, "selected": false, "text": "<p>It's not ignoring left or top, you'll see it does position 10px out. What's happening is that the right and the bottom...
2009/01/16
[ "https://Stackoverflow.com/questions/450316", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11384/" ]
I've noticed that the `<input>` element in HTML ignores the CSS pair of "left" and "right" properties. Same for the pair "top" and "bottom". See the sample code below: ``` <html> <head> <style><!-- #someid { position: absolute; left: 10px; right: 10px; ...
You can Use a Wrapper DIV ``` <html> <head> <style><!-- #wrapper { position: absolute; left: 10px; right: 10px; top: 10px; bottom: 10px; }...
450,335
<p>F# keyword '<strong>Some</strong>' - what does it mean? </p>
[ { "answer_id": 450342, "author": "mmx", "author_id": 33708, "author_profile": "https://Stackoverflow.com/users/33708", "pm_score": 6, "selected": false, "text": "<p><code>Some</code> is not a keyword. There is an <code>option</code> type however, which is a discriminated union containing...
2009/01/16
[ "https://Stackoverflow.com/questions/450335", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
F# keyword '**Some**' - what does it mean?
`Some` is not a keyword. There is an `option` type however, which is a discriminated union containing two things: 1. `Some` which holds a value of some type. 2. `None` which represents lack of value. It's defined as: ``` type 'a option = | None | Some of 'a ``` It acts kind of like a nullable type, where y...
450,352
<pre><code>Warning: include_once(Zend/Http/Client.php) [function.include-once]: failed to open stream: No such file or directory in /home/hotbuzz/public_html/include/Zend/Loader.php on line 83 Warning: include_once() [function.include]: Failed opening 'Zend/Http/Client.php' for inclusion (include_path='/home/hotbuzz/p...
[ { "answer_id": 450379, "author": "stunti", "author_id": 54949, "author_profile": "https://Stackoverflow.com/users/54949", "pm_score": 0, "selected": false, "text": "<p>There is something weird in your include path ;.:</p>\n\n<p>I think you probably have use the syntax of windows in a lin...
2009/01/16
[ "https://Stackoverflow.com/questions/450352", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
``` Warning: include_once(Zend/Http/Client.php) [function.include-once]: failed to open stream: No such file or directory in /home/hotbuzz/public_html/include/Zend/Loader.php on line 83 Warning: include_once() [function.include]: Failed opening 'Zend/Http/Client.php' for inclusion (include_path='/home/hotbuzz/public_h...
try this ``` set_include_path(dirname(realpath(__FILE__)).PATH_SEPARATOR.get_include_path()); ```
450,373
<p>I am pretty new to C# and .NET and I'm strugling a little with the whole concept of databinding. What I am asking for is a quick rundown of the concept, or even better, point me towards sources on the net (preferred) or in print that can help me get my head around the idea.</p> <p>EDIT:</p> <p>I do my development ...
[ { "answer_id": 450387, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 5, "selected": true, "text": "<p>Well, what architecture are you using? winforms? asp.net? wpf?</p>\n\n<p>The <em>high level</em> is that if you hav...
2009/01/16
[ "https://Stackoverflow.com/questions/450373", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45704/" ]
I am pretty new to C# and .NET and I'm strugling a little with the whole concept of databinding. What I am asking for is a quick rundown of the concept, or even better, point me towards sources on the net (preferred) or in print that can help me get my head around the idea. EDIT: I do my development in vs2008 and we ...
Well, what architecture are you using? winforms? asp.net? wpf? The *high level* is that if you have objects such as: ``` public class Person { public string Name {get;set;} public DateTime DateOfBirth {get;set;} } ``` Then you can get the binding framework to do all the hard work, and you just say what you ...
450,377
<p>I have a side project that I wrote a few years ago in WinForms. To better help me learn WPF, I would like to rewrite it in WPF. Ideally, I would like to just modify the current project that I have and rewrite the UI in WPF instead of creating a new project.</p> <p>I'm having some problems doing that. I did the foll...
[ { "answer_id": 450438, "author": "Norbert B.", "author_id": 2605840, "author_profile": "https://Stackoverflow.com/users/2605840", "pm_score": 1, "selected": false, "text": "<p>Sadly no.</p>\n\n<p>WPF and Windows Forms projects aren't very compatible. </p>\n\n<ul>\n<li>Try to extract as m...
2009/01/16
[ "https://Stackoverflow.com/questions/450377", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3857/" ]
I have a side project that I wrote a few years ago in WinForms. To better help me learn WPF, I would like to rewrite it in WPF. Ideally, I would like to just modify the current project that I have and rewrite the UI in WPF instead of creating a new project. I'm having some problems doing that. I did the following (usi...
I don't know for *certain* what in the project file informs Visual Studio what type of project is being used, but my guess is the "ProjectTypeGuids" is key. My WPF projects have this: ``` <ProjectTypeGuids> {60dc8134-eba5-43b8-bcc9-bb4bc16c2548}; {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} </ProjectTypeGuids> ``` ...
450,380
<p>How can I login to the this page <a href="http://www.bhmobile.ba/portal/index" rel="noreferrer">http://www.bhmobile.ba/portal/index</a> by using HttpWebRequest?</p> <p>Login button is &quot;Pošalji&quot; (upper left corner).</p> <h3>HTML source of login page:</h3> <pre><code>&lt;table id=&quot;maintable&quot; border...
[ { "answer_id": 595318, "author": "missaghi", "author_id": 46706, "author_profile": "https://Stackoverflow.com/users/46706", "pm_score": 6, "selected": true, "text": "<p>Make a new default.aspx, and put this in the code behind: I cant test any further based on your current question, becau...
2009/01/16
[ "https://Stackoverflow.com/questions/450380", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17465/" ]
How can I login to the this page <http://www.bhmobile.ba/portal/index> by using HttpWebRequest? Login button is "Pošalji" (upper left corner). ### HTML source of login page: ``` <table id="maintable" border="0" cellspacing="0" cellpadding="0" style="height:100%; width:100%"> <tr> <td width="367" style="vertica...
Make a new default.aspx, and put this in the code behind: I cant test any further based on your current question, because you didn't include a valid username/password. ``` using System; using System.Web; using System.Net; using System.IO; using System.Web.UI; using System.Web.UI.WebControls; ...
450,383
<p>I have researched on spidering and think that it is a little too complex for quite a simple app I am trying to make. Some data on a web page is not available to view in the source as it is just being displayed by the browser. </p> <p>If I wanted to get a value from a specific web page that I was to display in a Web...
[ { "answer_id": 450395, "author": "Bombe", "author_id": 43582, "author_profile": "https://Stackoverflow.com/users/43582", "pm_score": 2, "selected": false, "text": "<p>You’re not looking for <a href=\"http://en.wikipedia.org/wiki/Web_crawler\" rel=\"nofollow noreferrer\">spidering</a>, yo...
2009/01/16
[ "https://Stackoverflow.com/questions/450383", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36243/" ]
I have researched on spidering and think that it is a little too complex for quite a simple app I am trying to make. Some data on a web page is not available to view in the source as it is just being displayed by the browser. If I wanted to get a value from a specific web page that I was to display in a WebBrowser co...
I'd have to agree with Bombe, it sounds more like you want HTML Screen Scraping. It requires lots of parsing, and if the page your scraping ever changes, your app will break, however here's a small example of how to do it: ``` WebClient webClient = new WebClient(); const string strUrl = "http://www.yahoo.com/"; byte...
450,392
<p>Is there any documentation that discribes all the available functions and objects in shoe?</p> <p>update: 2008.01.21 I am looking for a list of all the methods that can be called against an animate object. </p> <p>For example I only figured out how to pause an animation using the toggle() method by reading source ...
[ { "answer_id": 450421, "author": "mookid8000", "author_id": 6560, "author_profile": "https://Stackoverflow.com/users/6560", "pm_score": 0, "selected": false, "text": "<p>I have never seen such thing for Shoes. It seems Why prefers to document his stuff with cartoons and collages.</p>\n\n...
2009/01/16
[ "https://Stackoverflow.com/questions/450392", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Is there any documentation that discribes all the available functions and objects in shoe? update: 2008.01.21 I am looking for a list of all the methods that can be called against an animate object. For example I only figured out how to pause an animation using the toggle() method by reading source code from the sho...
If you run ``` shoes -m ``` in a console (command prompt) window, shoes will run in Help/Manual mode. In this mode it displays the shoes manual, complete with runnable examples (the manual is a shoes application) This mode has a built-in search feature which jumps straight to the relevant section of the docs and ...
450,408
<p>How do I update additional data in HABTM tables.</p> <p>For Example: I have <code>movies</code>, <code>people</code> and HABTM <code>movies_people</code> tables, but there is additional <code>persontype_id</code> field in <code>movies_people</code> table which indicates role of this person in that particular movie....
[ { "answer_id": 450505, "author": "PJ Davis", "author_id": 39077, "author_profile": "https://Stackoverflow.com/users/39077", "pm_score": 3, "selected": true, "text": "<p>You should probably be using a has_many :through association, which was introduced just for this reason. Instead of jus...
2009/01/16
[ "https://Stackoverflow.com/questions/450408", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27257/" ]
How do I update additional data in HABTM tables. For Example: I have `movies`, `people` and HABTM `movies_people` tables, but there is additional `persontype_id` field in `movies_people` table which indicates role of this person in that particular movie. How do I add/change this value?
You should probably be using a has\_many :through association, which was introduced just for this reason. Instead of just a movies\_people table, you'd have an additional model, called somthing like Favorite or Viewing (depending on what you're trying to accomplish with the association), which belongs\_to both :movies ...
450,410
<p>Perl</p> <pre><code>print 2 % -18; </code></pre> <p>--></p> <pre><code>-16 </code></pre> <p>Tcl</p> <pre><code>puts [expr {2 % -18}] </code></pre> <p>--></p> <pre><code>-16 </code></pre> <p>but VBScript</p> <pre><code>wscript.echo 2 mod -18 </code></pre> <p>--></p> <pre><code>2 </code></pre> <p>Why the d...
[ { "answer_id": 450425, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 3, "selected": false, "text": "<p>Wikipedia's <a href=\"http://en.wikipedia.org/wiki/Modulo_operation\" rel=\"noreferrer\">\"Modulo operation\"</a> pag...
2009/01/16
[ "https://Stackoverflow.com/questions/450410", "https://Stackoverflow.com", "https://Stackoverflow.com/users/426/" ]
Perl ``` print 2 % -18; ``` --> ``` -16 ``` Tcl ``` puts [expr {2 % -18}] ``` --> ``` -16 ``` but VBScript ``` wscript.echo 2 mod -18 ``` --> ``` 2 ``` Why the difference?
The [wikipedia answer](http://en.wikipedia.org/wiki/Modulo_operation) is fairly helpful here. A short summary is that any integer can be defined as a = qn + r where all of these letters are integers, and 0 <= |r| < |n|. Almost every programming language will require that (a/n) \* n + (a%n) = a. So the definiti...
450,424
<p>I am using the following code to write the table. Now I wish to add subscript text after the table text. How can it be achieved?</p> <p>My code has:</p> <pre><code> oCell = document.createElement("TD"); oCell.innerHTML = data; oRow.appendChild(oCell); </code></pre> <p>How do I add a subscript text followed b...
[ { "answer_id": 450444, "author": "Gumbo", "author_id": 53114, "author_profile": "https://Stackoverflow.com/users/53114", "pm_score": 2, "selected": false, "text": "<p>You can use the following to append another element to the <code>td</code> element:</p>\n\n<pre><code>var newElem = docum...
2009/01/16
[ "https://Stackoverflow.com/questions/450424", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44984/" ]
I am using the following code to write the table. Now I wish to add subscript text after the table text. How can it be achieved? My code has: ``` oCell = document.createElement("TD"); oCell.innerHTML = data; oRow.appendChild(oCell); ``` How do I add a subscript text followed by the data?
You may mean this: ``` oCell = document.createElement("TD"); oSub = document.createElement("sub"); oSub.innerHTML = data; oCell.appendChild(oSub); oRow.appendChild(oCell); ```
450,428
<p>I'm looking for a way to know in a Java application (<em>without</em> JNI - it's a multi-platform application) can detect if the screen is locked.</p> <p>For information... our application records time while a user is working - we want it to automatically stop recording when the screen is locked instead of the user...
[ { "answer_id": 450444, "author": "Gumbo", "author_id": 53114, "author_profile": "https://Stackoverflow.com/users/53114", "pm_score": 2, "selected": false, "text": "<p>You can use the following to append another element to the <code>td</code> element:</p>\n\n<pre><code>var newElem = docum...
2009/01/16
[ "https://Stackoverflow.com/questions/450428", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4003/" ]
I'm looking for a way to know in a Java application (*without* JNI - it's a multi-platform application) can detect if the screen is locked. For information... our application records time while a user is working - we want it to automatically stop recording when the screen is locked instead of the user having to do so ...
You may mean this: ``` oCell = document.createElement("TD"); oSub = document.createElement("sub"); oSub.innerHTML = data; oCell.appendChild(oSub); oRow.appendChild(oCell); ```
450,431
<p>I'm trying to return the html representation of a user/server control through a page method. It works when I call the overload which takes the virtual path to the user control, but not when I try to call the overload which takes a type. The sample code is below. Any suggestions?</p> <pre><code>[WebMethod] public st...
[ { "answer_id": 450449, "author": "lomaxx", "author_id": 493, "author_profile": "https://Stackoverflow.com/users/493", "pm_score": 5, "selected": false, "text": "<p>On the <a href=\"http://msdn.microsoft.com/en-us/library/ewtd66a0(v=VS.90).aspx#CommunityContent\" rel=\"noreferrer\">MSDN p...
2009/01/16
[ "https://Stackoverflow.com/questions/450431", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15048/" ]
I'm trying to return the html representation of a user/server control through a page method. It works when I call the overload which takes the virtual path to the user control, but not when I try to call the overload which takes a type. The sample code is below. Any suggestions? ``` [WebMethod] public static string Lo...
On the [MSDN page for LoadControl](http://msdn.microsoft.com/en-us/library/ewtd66a0(v=VS.90).aspx#CommunityContent) there is this comment at the bottom: > > Description > A page that loads a user control using the > Page.LoadControl(Type, Object[]) does not seem to create its children > added in the ascx file. ...
450,447
<p>I often connect to my work TFS instance over VPN. Becasue my home computer is not on the domain, I'm forced to enter my userid/password for each tf.exe command. Is there a way to cache or save this locally?</p>
[ { "answer_id": 450518, "author": "tvanfosson", "author_id": 12950, "author_profile": "https://Stackoverflow.com/users/12950", "pm_score": 0, "selected": false, "text": "<p>Have you tried setting your username and password to exactly the same as your work environment? I seem to recall th...
2009/01/16
[ "https://Stackoverflow.com/questions/450447", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25201/" ]
I often connect to my work TFS instance over VPN. Becasue my home computer is not on the domain, I'm forced to enter my userid/password for each tf.exe command. Is there a way to cache or save this locally?
Though I can't solve your problem completely, I can make half of it go away (this command is set up to run SSMS, not VS, though you can change it): ``` %windir%\system32\runas.exe /netonly /user:DOMAIN\UserID "C:\Program Files\Microsoft SQL Server\90\Tools\Binn\VSShell\Common7\IDE\SqlWb.exe" ``` The "/netonly" switc...
450,462
<p>I have a two related questions.</p> <p>First: I'm looking to do a full text search against a custom entity in Dynamics CRM 4.0. Has anyone done this before or know how to do it?</p> <p>I know that I can build QueryExpressions with the web service and sdk but can I do a full text search with boolean type syntax usi...
[ { "answer_id": 451382, "author": "Mikeyb", "author_id": 55924, "author_profile": "https://Stackoverflow.com/users/55924", "pm_score": 3, "selected": true, "text": "<p>Searching and filtering via the CRM SDK does take some time to get used to. In order to simulate full text search, you n...
2009/01/16
[ "https://Stackoverflow.com/questions/450462", "https://Stackoverflow.com", "https://Stackoverflow.com/users/54609/" ]
I have a two related questions. First: I'm looking to do a full text search against a custom entity in Dynamics CRM 4.0. Has anyone done this before or know how to do it? I know that I can build QueryExpressions with the web service and sdk but can I do a full text search with boolean type syntax using this method? A...
Searching and filtering via the CRM SDK does take some time to get used to. In order to simulate full text search, you need to use nested FilterExpressions as your QueryExpression.Criteria. [SDK page for nested filters](http://msdn.microsoft.com/en-us/library/bb928435.aspx) The hardest part is figuring out how to build...
450,463
<p>My class has the following core:</p> <pre><code>class SmartDbConnection { private readonly IDbConnection Connection; public SmartDbConnection(string ConnectionString) { if(ConnectionString.Contains("MultipleActiveResultSets=true")) { Connection = new SqlConnection(Connection...
[ { "answer_id": 450475, "author": "user53378", "author_id": 53378, "author_profile": "https://Stackoverflow.com/users/53378", "pm_score": 3, "selected": false, "text": "<p>Why don't you accept IDbConnection instead of connectionstring to your ctor?</p>\n" }, { "answer_id": 450477,...
2009/01/16
[ "https://Stackoverflow.com/questions/450463", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48465/" ]
My class has the following core: ``` class SmartDbConnection { private readonly IDbConnection Connection; public SmartDbConnection(string ConnectionString) { if(ConnectionString.Contains("MultipleActiveResultSets=true")) { Connection = new SqlConnection(ConnectionString); ...
First - I've added `IDisposable` to this, as I believe it is important. Second, note that providers are an alternative here: ``` class SmartDbConnection { private DbConnection Connection; public SmartDbConnection(string provider, string connectionString) { Connection = DbProviderFactories.GetFact...
450,464
<p>I'm writing in C# the next generation of an old app originally written in Delphi. I often have to look in the old code and wondered if there's anyway to install Pascal syntax highlighting in the Visual Studio 2008 editor.</p> <p>TIA.</p>
[ { "answer_id": 450475, "author": "user53378", "author_id": 53378, "author_profile": "https://Stackoverflow.com/users/53378", "pm_score": 3, "selected": false, "text": "<p>Why don't you accept IDbConnection instead of connectionstring to your ctor?</p>\n" }, { "answer_id": 450477,...
2009/01/16
[ "https://Stackoverflow.com/questions/450464", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12379/" ]
I'm writing in C# the next generation of an old app originally written in Delphi. I often have to look in the old code and wondered if there's anyway to install Pascal syntax highlighting in the Visual Studio 2008 editor. TIA.
First - I've added `IDisposable` to this, as I believe it is important. Second, note that providers are an alternative here: ``` class SmartDbConnection { private DbConnection Connection; public SmartDbConnection(string provider, string connectionString) { Connection = DbProviderFactories.GetFact...