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
482,308
<p>Google hosts popular ajax libraries for free at :</p> <pre><code>http://code.google.com/apis/ajaxlibs/ </code></pre> <p>You get to take advantage of their bandwidth, their <a href="http://en.wikipedia.org/wiki/Content_Delivery_Network" rel="nofollow noreferrer">CDN</a> and most importantly that users may already h...
[ { "answer_id": 485650, "author": "sh1mmer", "author_id": 53569, "author_profile": "https://Stackoverflow.com/users/53569", "pm_score": 1, "selected": false, "text": "<p>You are asking a couple of questions here.</p>\n\n<p>Firstly as far as I know <a href=\"http://developer.yahoo.com/yui/...
2009/01/27
[ "https://Stackoverflow.com/questions/482308", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16940/" ]
Google hosts popular ajax libraries for free at : ``` http://code.google.com/apis/ajaxlibs/ ``` You get to take advantage of their bandwidth, their [CDN](http://en.wikipedia.org/wiki/Content_Delivery_Network) and most importantly that users may already have it cached from another site that is retrieving their JS fil...
Microsoft launched today the [Microsoft AJAX CDN](http://www.asp.net/ajax/cdn/) that will provide Microsoft AJAX and jQuery libraries.
482,315
<p>My current code to the effect of:</p> <pre><code>if( objectPointer != NULL){ delete objectPointer; } </code></pre> <p>doesn't work because the pointers are getting set to invalid hex numbers by the compiler such as:</p> <ul> <li>0xbaadf00d </li> <li>0xdeadbeef</li> </ul> <p>etc....</p> <p>So what's the best...
[ { "answer_id": 482321, "author": "Johannes Schaub - litb", "author_id": 34509, "author_profile": "https://Stackoverflow.com/users/34509", "pm_score": 3, "selected": false, "text": "<p>The best way is setting it to NULL if it doesn't point to anything. Globals, pointers in other namespace...
2009/01/27
[ "https://Stackoverflow.com/questions/482315", "https://Stackoverflow.com", "https://Stackoverflow.com/users/370/" ]
My current code to the effect of: ``` if( objectPointer != NULL){ delete objectPointer; } ``` doesn't work because the pointers are getting set to invalid hex numbers by the compiler such as: * 0xbaadf00d * 0xdeadbeef etc.... So what's the best way to check for an invalid pointer before trying to delete the o...
Always initialize your pointers to NULL (that is, 0). From <http://www.lysator.liu.se/c/c-faq/c-1.html>: > > A null pointer is conceptually different from an uninitialized pointer. A null pointer is known not to point to any object; an uninitialized pointer might point anywhere. > > >
482,330
<p>Ok so I have this regex that I created and it works fine in RegexBuddy but not when I load it into php. Below is an example of it.</p> <p>Using RegexBuddy I can get it to works with this:</p> <pre><code>\[code\](.*)\[/code\] </code></pre> <p>And checking the dot matches newline, I added the case insensitive, but ...
[ { "answer_id": 482339, "author": "cletus", "author_id": 18393, "author_profile": "https://Stackoverflow.com/users/18393", "pm_score": 3, "selected": true, "text": "<p>You're including the forward slash in the middle of your pattern (/code). Either escape it or delimit your pattern with ...
2009/01/27
[ "https://Stackoverflow.com/questions/482330", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37526/" ]
Ok so I have this regex that I created and it works fine in RegexBuddy but not when I load it into php. Below is an example of it. Using RegexBuddy I can get it to works with this: ``` \[code\](.*)\[/code\] ``` And checking the dot matches newline, I added the case insensitive, but it works that way as well. Here ...
You're including the forward slash in the middle of your pattern (/code). Either escape it or delimit your pattern with something else (I prefer !).
482,342
<p>I have the following code</p> <pre><code>&lt;?php if ($handle = opendir('C:/xampp/htdocs/movies')) { while (false !== ($file = readdir($handle))) { if ($file != "." &amp;&amp; $file != "..") { echo $file."&lt;br /&gt;\n"; } } closedir($handle); } ?&gt; </code></pre> <p>When ...
[ { "answer_id": 482474, "author": "Hexagon Theory", "author_id": 59107, "author_profile": "https://Stackoverflow.com/users/59107", "pm_score": -1, "selected": false, "text": "<p>Replace any instance of <strong>$file</strong> with <strong>mb_substr($file, mb_strrpos($file, '/') + 1)</stron...
2009/01/27
[ "https://Stackoverflow.com/questions/482342", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have the following code ``` <?php if ($handle = opendir('C:/xampp/htdocs/movies')) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { echo $file."<br />\n"; } } closedir($handle); } ?> ``` When it does have mb language such as japanese, it ...
I can't speak definitively for PHP, but I suspect it's the same basic problem as with Python 2 had (before later adding special support for Unicode string filenames). My belief is that PHP is dealing with filenames using the standard C library ‘open’-et-al functions, which are byte-based. On Windows (NT) these try to ...
482,358
<p>I have 2 references to jQuery in my master page which is currently configured for production release:</p> <pre><code>&lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"&gt; &lt;/script&gt; &lt;%--&lt;script type="text/javascript" src="../Scripts/jquery-vsdoc.js"&...
[ { "answer_id": 482364, "author": "John Boker", "author_id": 2847, "author_profile": "https://Stackoverflow.com/users/2847", "pm_score": 1, "selected": false, "text": "<p>Visual Studio should automatically look for the vsdoc one for the intellisense. </p>\n\n<p>If your script that is on ...
2009/01/27
[ "https://Stackoverflow.com/questions/482358", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1463/" ]
I have 2 references to jQuery in my master page which is currently configured for production release: ``` <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"> </script> <%--<script type="text/javascript" src="../Scripts/jquery-vsdoc.js"></script>--%> ``` When I'm dev...
The [suggested workaround](http://blogs.msdn.com/webdevtools/archive/2008/10/28/rich-intellisense-for-jquery.aspx) (since Google doesn't host the documentation) is to reference the documentation script in a way that will never be included, for example ``` <% if (false) { %> <script type="text/javascript" src="../S...
482,363
<p>The JsonResult class is a very useful way to return Json as an action to the client via AJAX.</p> <pre><code>public JsonResult JoinMailingList(string txtEmail) { // ... return new JsonResult() { Data = new { foo = "123", success = true } }; } </code></pre> <p>However (at le...
[ { "answer_id": 482425, "author": "Frank Krueger", "author_id": 338, "author_profile": "https://Stackoverflow.com/users/338", "pm_score": 4, "selected": false, "text": "<p>I think you're getting worked up over nothing. So what if the controller knows about JSON in its public interface?</p...
2009/01/27
[ "https://Stackoverflow.com/questions/482363", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16940/" ]
The JsonResult class is a very useful way to return Json as an action to the client via AJAX. ``` public JsonResult JoinMailingList(string txtEmail) { // ... return new JsonResult() { Data = new { foo = "123", success = true } }; } ``` However (at least according to my first ...
I think you're getting worked up over nothing. So what if the controller knows about JSON in its public interface? I was once told: "Make your code generic, don't make your application generic." You're writing an Application Controller here. It's OK for the Application Controller - whose responsibility is to mitigate...
482,375
<p>I recently became aware that the <code>strdup()</code> function I've enjoyed using so much on OS X is not part of ANSI C, but part of POSIX. I don't want to rewrite all my code, so I think I'm just going to write my own <code>strdup()</code> function. It's not that hard, really, it's just a <code>malloc()</code> and...
[ { "answer_id": 482383, "author": "Eclipse", "author_id": 8701, "author_profile": "https://Stackoverflow.com/users/8701", "pm_score": 5, "selected": true, "text": "<p>Usually, you just use an <code>#if</code> to define the function you want when under a certain compiler. If the built-in ...
2009/01/27
[ "https://Stackoverflow.com/questions/482375", "https://Stackoverflow.com", "https://Stackoverflow.com/users/58897/" ]
I recently became aware that the `strdup()` function I've enjoyed using so much on OS X is not part of ANSI C, but part of POSIX. I don't want to rewrite all my code, so I think I'm just going to write my own `strdup()` function. It's not that hard, really, it's just a `malloc()` and a `strcpy()`. Anyway, I have the fu...
Usually, you just use an `#if` to define the function you want when under a certain compiler. If the built-in library doesn't define strdup, there is no problem in defining it yourself (other than if they do define it in the future, you'll have to take it out.) ``` // Only define strdup for platforms that are missing ...
482,392
<p>I'm working on a website that has a number of style sheets all of which need to be handled as PHP scripts server-side. My <strong><em>.htaccess</em></strong> file looks something like this:</p> <pre><code>&lt;FilesMatch "\.(css)$"&gt; ForceType application/x-httpd-php &lt;/FilesMatch&gt; </code></pre> <p>This ...
[ { "answer_id": 482414, "author": "Cal", "author_id": 59120, "author_profile": "https://Stackoverflow.com/users/59120", "pm_score": 4, "selected": true, "text": "<p>try:</p>\n\n<pre><code>php_value default_mimetype \"text/css\"\n</code></pre>\n" }, { "answer_id": 482416, "auth...
2009/01/27
[ "https://Stackoverflow.com/questions/482392", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13834/" ]
I'm working on a website that has a number of style sheets all of which need to be handled as PHP scripts server-side. My ***.htaccess*** file looks something like this: ``` <FilesMatch "\.(css)$"> ForceType application/x-httpd-php </FilesMatch> ``` This causes a small problem as the mime type of the http-respon...
try: ``` php_value default_mimetype "text/css" ```
482,395
<p>Can someone tell me why:</p> <pre><code>var nl = Convert.ToInt64("17029268.1650117"); </code></pre> <p>fails, and instead you have to do this:</p> <pre><code>var nl = Convert.ToInt64(Convert.ToDouble("17029268.1650117")); </code></pre> <p>Because it seems so stupid!</p>
[ { "answer_id": 482402, "author": "gimel", "author_id": 6491, "author_profile": "https://Stackoverflow.com/users/6491", "pm_score": 3, "selected": false, "text": "<p>The <a href=\"http://msdn.microsoft.com/en-us/library/0zahhahw.aspx\" rel=\"noreferrer\">manual</a> says:</p>\n<blockquote>...
2009/01/27
[ "https://Stackoverflow.com/questions/482395", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11194/" ]
Can someone tell me why: ``` var nl = Convert.ToInt64("17029268.1650117"); ``` fails, and instead you have to do this: ``` var nl = Convert.ToInt64(Convert.ToDouble("17029268.1650117")); ``` Because it seems so stupid!
You should probably also use long.Parse(str) A long is a whole number, so you can't have decimals dude. (tried to tell you on twitter :) )
482,405
<p>I have a file that contains the symbol table <code>details.Its</code> in the form of rows and columns.</p> <p>I need to extract first and last column.</p> <p>How can I do that?</p>
[ { "answer_id": 482427, "author": "Soviut", "author_id": 46914, "author_profile": "https://Stackoverflow.com/users/46914", "pm_score": 3, "selected": false, "text": "<p>What type of delimiter are you using? That is, what separates your columns?</p>\n\n<p>I'll assume you're using comma de...
2009/01/27
[ "https://Stackoverflow.com/questions/482405", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46646/" ]
I have a file that contains the symbol table `details.Its` in the form of rows and columns. I need to extract first and last column. How can I do that?
[csv](http://docs.python.org/library/csv) module is the easier way. You can use any separator with this code: ``` import csv def import_text(filename, separator): for line in csv.reader(open(filename), delimiter=separator, skipinitialspace=True): if line: yield line...
482,410
<p>I would like to know how to convert a string containing digits to a double.</p>
[ { "answer_id": 482423, "author": "Mongoose", "author_id": 46523, "author_profile": "https://Stackoverflow.com/users/46523", "pm_score": 9, "selected": false, "text": "<pre><code>&gt;&gt;&gt; x = \"2342.34\"\n&gt;&gt;&gt; float(x)\n2342.3400000000001\n</code></pre>\n\n<p>There you go. Us...
2009/01/27
[ "https://Stackoverflow.com/questions/482410", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46646/" ]
I would like to know how to convert a string containing digits to a double.
``` >>> x = "2342.34" >>> float(x) 2342.3400000000001 ``` There you go. Use float (which behaves like and has the same precision as a C,C++, or Java double).
482,461
<p>Right now I am trying to call my model, and spit out its results into json/xml format. My only problem is, my database associations aren't being loaded or queried.</p> <p>Normally, I can just run this<br /></p> <pre>@campaign = Campaign.find(:all)</pre> <p>Then get the number of hits by calling, <code>@campaign[0...
[ { "answer_id": 482484, "author": "Cody Caughlan", "author_id": 25398, "author_profile": "https://Stackoverflow.com/users/25398", "pm_score": 4, "selected": true, "text": "<p>The ActiveRecord find() family takes an :include option which allows you to eager load your associatons.</p>\n\n<p...
2009/01/27
[ "https://Stackoverflow.com/questions/482461", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59220/" ]
Right now I am trying to call my model, and spit out its results into json/xml format. My only problem is, my database associations aren't being loaded or queried. Normally, I can just run this ``` @campaign = Campaign.find(:all) ``` Then get the number of hits by calling, `@campaign[0].hits` through the `has_many...
The ActiveRecord find() family takes an :include option which allows you to eager load your associatons. So all you need to do is: > > @campaign = Campaign.find(:all, > :include => :hits) > > > The above will eager load your database calls so that accessing each index [0]. [1], etc wont issue their own SELECT c...
482,485
<p>I have an annoying CSS layout problem. I'm trying to float images on a particular page:</p> <pre><code>img { float: left; } </code></pre> <p>I think make sure my headings don't start indented with:</p> <pre><code>h3 { clear: left; } </code></pre> <p>It all works fine except for some of the images that have ...
[ { "answer_id": 482491, "author": "Kon", "author_id": 22303, "author_profile": "https://Stackoverflow.com/users/22303", "pm_score": 4, "selected": true, "text": "<p>Here's what I always do to make sure the float is always cleared:</p>\n\n<ol>\n<li><p>Add the following to the CSS:</p>\n\n<...
2009/01/27
[ "https://Stackoverflow.com/questions/482485", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18393/" ]
I have an annoying CSS layout problem. I'm trying to float images on a particular page: ``` img { float: left; } ``` I think make sure my headings don't start indented with: ``` h3 { clear: left; } ``` It all works fine except for some of the images that have lists (or any block element) floating past them (o...
Here's what I always do to make sure the float is always cleared: 1. Add the following to the CSS: ``` .clearfix:after { content: "."; display: block; clear: both; visibility: hidden; line-height: 0; height: 0; } .clearfix { display: inline-block; } html[xmlns] .clearfix { display: b...
482,488
<p>I'm wondering what a controller - such as the following Rails controller - would look like in Django, to perform an ajax update of the page after an asynchronous form submission (assuming the following is correct):</p> <pre><code>def create @omelet = Omelet.new(params[:omelet]) render :update do |page| if @omelet...
[ { "answer_id": 482498, "author": "hasen", "author_id": 35364, "author_profile": "https://Stackoverflow.com/users/35364", "pm_score": 0, "selected": false, "text": "<p>I don't of anything in Django where you control specific parts of the page via the view functions (server side code). </p...
2009/01/27
[ "https://Stackoverflow.com/questions/482488", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm wondering what a controller - such as the following Rails controller - would look like in Django, to perform an ajax update of the page after an asynchronous form submission (assuming the following is correct): ``` def create @omelet = Omelet.new(params[:omelet]) render :update do |page| if @omelet.save page...
The "page.replace\_html" in Rails is really a manifestation of RJS - that is Javascript that is generated by the server (and the correct MIME type is sent, etc) and then the client takes that chunk of Javascript and inserts it somewhere in the DOM (probably replacing some other element as specified by DOM ID). So it re...
482,497
<p>I'm using the <strong>TChart control that comes with Delphi 7</strong> and wish to <strong>get the Series and Value # of the line/bar under the mouse pointer.</strong></p> <p>I'm aware of the OnClickSeries event which provides great info but <strong>I really want this info when I <em>hover</em> over a series</stron...
[ { "answer_id": 482564, "author": "Toon Krijthe", "author_id": 18061, "author_profile": "https://Stackoverflow.com/users/18061", "pm_score": 2, "selected": false, "text": "<p>You can check the OnChartMouseMove (or the OnSeriesMouseMove)</p>\n\n<pre><code>procedure TForm5.Chart1MouseMove(S...
2009/01/27
[ "https://Stackoverflow.com/questions/482497", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26335/" ]
I'm using the **TChart control that comes with Delphi 7** and wish to **get the Series and Value # of the line/bar under the mouse pointer.** I'm aware of the OnClickSeries event which provides great info but **I really want this info when I *hover* over a series**. EDIT: I found a hittest method on TChart which work...
I finally found this method which works with multiple series (even of different types) in a chart. ``` TChart.CalcClickedPart(Pos: TPoint; Var Part: TChartClickedPart); ``` The method fills a TChartClickedPart record which contains the following detailed hit-test information: ``` TChartClickedPart = record Part :...
482,560
<p>I have an application that some of my users run from Eclipse, and others run it by using a jar file.</p> <p>I want some actions to be done when running from within the jar, but I don't want them to be done when running from Eclipse.</p> <p>Is there a way to know on runtime whether the current application is runnin...
[ { "answer_id": 482566, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 6, "selected": false, "text": "<p>Well, you can tell whether or not a class has been loaded from a JAR file - use <code>Foo.class.getResource(\"Foo.cla...
2009/01/27
[ "https://Stackoverflow.com/questions/482560", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have an application that some of my users run from Eclipse, and others run it by using a jar file. I want some actions to be done when running from within the jar, but I don't want them to be done when running from Eclipse. Is there a way to know on runtime whether the current application is running from within a j...
Well, you can tell whether or not a class has been loaded from a JAR file - use `Foo.class.getResource("Foo.class")` and see whether the returned URL begins with "jar:" For example, take this program: ``` public class Foo { public static void main(String[] args) { System.out.println(Foo.class.getResource...
482,589
<p>My problem is ::</p> <p>From a string like "/usr/folder1/folder2/filename.ext"</p> <ul> <li>I have to extract out file name only for display (filename.ext only). <ul> <li>My question would be how should I do it? Splitting on "/" and taking the last element is one way but doesn't smell nice to me.</li> </ul></li> ...
[ { "answer_id": 482601, "author": "Nicolas", "author_id": 1730, "author_profile": "https://Stackoverflow.com/users/1730", "pm_score": 2, "selected": false, "text": "<p>You should have a look to the <a href=\"http://java.sun.com/javase/6/docs/api/java/io/File.html\" rel=\"nofollow noreferr...
2009/01/27
[ "https://Stackoverflow.com/questions/482589", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4406/" ]
My problem is :: From a string like "/usr/folder1/folder2/filename.ext" * I have to extract out file name only for display (filename.ext only). + My question would be how should I do it? Splitting on "/" and taking the last element is one way but doesn't smell nice to me. * I have to create a hyperlink which uses UR...
You could try something like this: ``` File file = new File("/usr/folder1/folder2/filename.ext"); System.out.println(file.getName()); ``` I wasn't sure whether this would work if the file does not exist, but have just tried it and it appears to work OK.
482,594
<p>i try to learn design pattern, but it's really really hard to understand main idea of OOD. i have created my software with classic method. On the other hand i want to learn OOD. why i need singleton and others? i coded some simple program: one of them clasical(my style), the other is singleton pattern.Please teach m...
[ { "answer_id": 482609, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 3, "selected": false, "text": "<p>The Singleton pattern is <a href=\"http://steve.yegge.googlepages.com/singleton-considered-stupid\" rel=\"nofollow nor...
2009/01/27
[ "https://Stackoverflow.com/questions/482594", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52420/" ]
i try to learn design pattern, but it's really really hard to understand main idea of OOD. i have created my software with classic method. On the other hand i want to learn OOD. why i need singleton and others? i coded some simple program: one of them clasical(my style), the other is singleton pattern.Please teach me w...
Design patterns are not a design or development *methodology*. They are a *vocabulary*: they help putting names on recurring patterns that occur in software architectures. From my experience, designing a software FROM patterns ends up in hairy software with a lot of single-purpose classes, which increases the number of...
482,604
<p>Is there a way to get the actual size of a class instance in Delphi?</p> <p>I know about the InstanceSize method of the TObject class but that method does not recursively invokes itself for object members. For example, let's say we have two classes:</p> <pre><code>type MyClass1 = class private myVar1 : integ...
[ { "answer_id": 482610, "author": "Toon Krijthe", "author_id": 18061, "author_profile": "https://Stackoverflow.com/users/18061", "pm_score": 2, "selected": false, "text": "<p>No what you want does not exist. If you want something like that, you should write it yourself.</p>\n" }, { ...
2009/01/27
[ "https://Stackoverflow.com/questions/482604", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2695/" ]
Is there a way to get the actual size of a class instance in Delphi? I know about the InstanceSize method of the TObject class but that method does not recursively invokes itself for object members. For example, let's say we have two classes: ``` type MyClass1 = class private myVar1 : integer; myVar2 : inte...
Construct one MyClass1 object and a million MyClass2 such that each MyClass2 points to the same MyClass1. How much memory does each MyClass2 take? 12.000012 bytes? How much memory does a circular list take? Infinity as you can keep chasing pointers for ever? In languages with pointers, a naive recursive size-of algo...
482,628
<p>I'm in an issue where I don't have enough space to accomodate my MDF and LDF files from a LiteSpeed backup we had done.</p> <p>I've come up with the following sproc:</p> <pre><code>exec master.dbo.xp_restore_database @database = 'OSiteDB', @filename = 'L:\OSiteDB_2009_01_07_Wed_LiteSpeed_Full.BKP', @with = 'move ...
[ { "answer_id": 494005, "author": "Cade Roux", "author_id": 18255, "author_profile": "https://Stackoverflow.com/users/18255", "pm_score": 0, "selected": false, "text": "<p>Have you looked at the WITH NORECOVERY options?</p>\n\n<p>In particular, I believe you can restore the database WWITH...
2009/01/27
[ "https://Stackoverflow.com/questions/482628", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm in an issue where I don't have enough space to accomodate my MDF and LDF files from a LiteSpeed backup we had done. I've come up with the following sproc: ``` exec master.dbo.xp_restore_database @database = 'OSiteDB', @filename = 'L:\OSiteDB_2009_01_07_Wed_LiteSpeed_Full.BKP', @with = 'move "O1_SITEDB" to "S:\OS...
You need to restore the LDF as well as the MDF. The log is an integral part of the database: it's not a "database" in the RDBMS sense without it. As an emergency, you need to plug in an external drive or restore to an NTFS compressed folder. Then, you can shrink the database files. However, this is only a quick fix an...
482,631
<p>Does anyone know if the following expression will be possible in the next version(s) of PHP?</p> <pre><code>(new A())-&gt;a(); // Causes a syntax error </code></pre> <p>I find very annoying that currently one must write 2 lines instead of 1:</p> <pre><code>$c = new A(); $c-&gt;a(); </code></pre>
[ { "answer_id": 482641, "author": "Ionuț G. Stan", "author_id": 58808, "author_profile": "https://Stackoverflow.com/users/58808", "pm_score": 4, "selected": true, "text": "<p>The first version does not cause a parse error, it is perfectly valid. The second it is, indeed not possible, but ...
2009/01/27
[ "https://Stackoverflow.com/questions/482631", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6430/" ]
Does anyone know if the following expression will be possible in the next version(s) of PHP? ``` (new A())->a(); // Causes a syntax error ``` I find very annoying that currently one must write 2 lines instead of 1: ``` $c = new A(); $c->a(); ```
The first version does not cause a parse error, it is perfectly valid. The second it is, indeed not possible, but you can easily overcome such a problem with some coding standards. If every team member creates, for each defined class, a function with the same name as the class, and a signature similar to the signature...
482,633
<p>Is it possible to know whether a Java class has been loaded, <em>without</em> attempting to load it? <code>Class.forName</code> attempts to load the class, but I don't want this side effect. Is there another way?</p> <p>(I don't want to override the class loader. I'm looking for a relatively simple method.)</p>
[ { "answer_id": 482637, "author": "Aleksi Yrttiaho", "author_id": 11427, "author_profile": "https://Stackoverflow.com/users/11427", "pm_score": 5, "selected": false, "text": "<p>You can use the <a href=\"http://docs.oracle.com/javase/7/docs/api/java/lang/ClassLoader.html#findLoadedClass(j...
2009/01/27
[ "https://Stackoverflow.com/questions/482633", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41283/" ]
Is it possible to know whether a Java class has been loaded, *without* attempting to load it? `Class.forName` attempts to load the class, but I don't want this side effect. Is there another way? (I don't want to override the class loader. I'm looking for a relatively simple method.)
(Thanks to Aleksi) This code: ``` public class TestLoaded { public static void main(String[] args) throws Exception { java.lang.reflect.Method m = ClassLoader.class.getDeclaredMethod("findLoadedClass", new Class[] { String.class }); m.setAccessible(true); ClassLoader cl = ClassLoader...
482,636
<p>I'm currently trying to find the best way (in term of usability and performance) when dealing with a situation like fetching records tagged with a specific tag, or category, or something like that.</p> <p>A good way (the way I wanted to do), would be to fetch records with the tag/category slug, so the URL would loo...
[ { "answer_id": 483207, "author": "Tony Andrews", "author_id": 18747, "author_profile": "https://Stackoverflow.com/users/18747", "pm_score": 4, "selected": true, "text": "<p>With the first URL style and your current db design, you can do this:</p>\n\n<pre><code>select ...\nfrom posts p\...
2009/01/27
[ "https://Stackoverflow.com/questions/482636", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26721/" ]
I'm currently trying to find the best way (in term of usability and performance) when dealing with a situation like fetching records tagged with a specific tag, or category, or something like that. A good way (the way I wanted to do), would be to fetch records with the tag/category slug, so the URL would look like : ...
With the first URL style and your current db design, you can do this: ``` select ... from posts p join posts_to_tags pt on pt.post_id = p.post_id join tags t on t.id = pt.tag_id where t.slug = [url slug value]; ``` As long as tags.slug is indexed, this should be very efficient, *hardly* any different from ``...
482,649
<p>I have a SWF Video player on my webpage. I want to draw a div tag over it with a high z-index to act as a popup on it . Its a very generic popup. Hence I cannot make it as a part of swf. but, SWF seems to have very high zIndex and would not allow any HTMLO entity to sit over it. How do I achieve this or is there a...
[ { "answer_id": 482662, "author": "Ionuț G. Stan", "author_id": 58808, "author_profile": "https://Stackoverflow.com/users/58808", "pm_score": 4, "selected": true, "text": "<p>There are some arguments that have to be passed to the SWF file in order to be able to achieve that. In the HTML r...
2009/01/27
[ "https://Stackoverflow.com/questions/482649", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50851/" ]
I have a SWF Video player on my webpage. I want to draw a div tag over it with a high z-index to act as a popup on it . Its a very generic popup. Hence I cannot make it as a part of swf. but, SWF seems to have very high zIndex and would not allow any HTMLO entity to sit over it. How do I achieve this or is there an alt...
There are some arguments that have to be passed to the SWF file in order to be able to achieve that. In the HTML representation, inside the object tag you should put: ``` <param name="wmode" value="transparent"> ``` and... ``` <embed wmode="transparent" ... ``` A similar value should apply if you're using a JS l...
482,674
<p>Most references I've seen, and my IDE's code completion all have my specifying a Generic type on both a variables type and its implementation eg.</p> <pre><code>List&lt;String&gt; string = new ArrayList&lt;String&gt;(); </code></pre> <p>Recently I've started skipping the generic type on the implementation eg.</p> ...
[ { "answer_id": 482683, "author": "Itay Maman", "author_id": 27198, "author_profile": "https://Stackoverflow.com/users/27198", "pm_score": 3, "selected": false, "text": "<p>The compiler may allow you to write code with such assignments (depending on your warnings/errors settings) but it i...
2009/01/27
[ "https://Stackoverflow.com/questions/482674", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48234/" ]
Most references I've seen, and my IDE's code completion all have my specifying a Generic type on both a variables type and its implementation eg. ``` List<String> string = new ArrayList<String>(); ``` Recently I've started skipping the generic type on the implementation eg. ``` List<String> strings = new ArrayList(...
> > Is there a reason to include the generic type on the implementation? > > > It's required as it won't necessarily be the same: ``` List<? extends Number> numbers = new ArrayList<Integer>(); ``` One way of avoiding it for common cases is to have static utility methods, and let the compiler's type inference do...
482,678
<p>I want to capture the errors from a script into a file instead of to the screen.</p> <p>In *nix, this is done with stderr redirection, usually</p> <pre><code>echo "Error" 2&gt; errorfile.log </code></pre> <p>How do I do it in a CMD script under Windows?</p>
[ { "answer_id": 482685, "author": "unwind", "author_id": 28169, "author_profile": "https://Stackoverflow.com/users/28169", "pm_score": 4, "selected": false, "text": "<p>That should work in Win32, too.</p>\n\n<p>If you have already redirected stdout, and want stderr redirected to the same ...
2009/01/27
[ "https://Stackoverflow.com/questions/482678", "https://Stackoverflow.com", "https://Stackoverflow.com/users/58807/" ]
I want to capture the errors from a script into a file instead of to the screen. In \*nix, this is done with stderr redirection, usually ``` echo "Error" 2> errorfile.log ``` How do I do it in a CMD script under Windows?
For example: ``` PSKILL NOTEPAD >output.txt 2>&1 ``` This will direct stdout and stderr to a file name output.txt. See [Underused features of Windows batch files](https://stackoverflow.com/questions/245395/underused-features-of-windows-batch-files#246691) for more details.
482,691
<p>I have a strange problem with mod_rewrite, the rules that are relevant here are:</p> <pre><code>RewriteRule ^(.*)\/igre\-(.*)\.php\?Page=([0-9]+)$ game.php?GameUrl=$2&amp;Page=$3 [L] RewriteRule ^(.*)\/igre\-(.*)\.php$ game.php?GameUrl=$2&amp;Page=1 [L] </code></pre> <p>And a corresponding URL might look something...
[ { "answer_id": 482693, "author": "Bouke", "author_id": 58107, "author_profile": "https://Stackoverflow.com/users/58107", "pm_score": 0, "selected": false, "text": "<p>mod_rewrite is not using the query in it's rewriting process. Therefor you first RewriteRule is ignored. You could combin...
2009/01/27
[ "https://Stackoverflow.com/questions/482691", "https://Stackoverflow.com", "https://Stackoverflow.com/users/185527/" ]
I have a strange problem with mod\_rewrite, the rules that are relevant here are: ``` RewriteRule ^(.*)\/igre\-(.*)\.php\?Page=([0-9]+)$ game.php?GameUrl=$2&Page=$3 [L] RewriteRule ^(.*)\/igre\-(.*)\.php$ game.php?GameUrl=$2&Page=1 [L] ``` And a corresponding URL might look something like this: ``` example.com/mise...
The query string is not part of the URI path that is being processed by the [`RewriteRule` directive](http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewriterule). You have to use the [`RewriteCond` directive](http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewritecond) to process the query string. ``` Rew...
482,697
<p>I have uploaded a couple of tutorial videos in youtube.</p> <p>In my winforms application (by using the AxShockwaveFlash object) i reproduce the selected video by the user.</p> <p>AxShockwaveFlash1.LoadMovie(<a href="http://www.youtube" rel="nofollow noreferrer">http://www.youtube</a> ..video1)</p> <p>Here comes ...
[ { "answer_id": 482711, "author": "Qwark", "author_id": 27840, "author_profile": "https://Stackoverflow.com/users/27840", "pm_score": 1, "selected": false, "text": "<p>Without knowing how you have integrated the video in your form, the method I would do is using a webBrowsercontrol in the...
2009/01/27
[ "https://Stackoverflow.com/questions/482697", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have uploaded a couple of tutorial videos in youtube. In my winforms application (by using the AxShockwaveFlash object) i reproduce the selected video by the user. AxShockwaveFlash1.LoadMovie(<http://www.youtube> ..video1) Here comes the story. The first time the user selects a video, reproduction works like a ch...
Try to use ``` AxShockwaveFlash1.Stop(); AxShockwaveFlash1.Movie = "Your source"; AxShockwaveFlash1.Play(); ``` Pattern to avoid leaving flash arguments behind.
482,702
<p>According to this <a href="http://www.cplusplus.com/reference/clibrary/csignal/signal.html" rel="nofollow noreferrer">http://www.cplusplus.com/reference/clibrary/csignal/signal.html</a></p> <p><code>SIGINT</code> is generally used/cause by the user. How do i cause a <code>SIGINT</code> in c++? i seen an example usi...
[ { "answer_id": 482712, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 1, "selected": false, "text": "<p>What other way are you thinking of? The <code>kill()</code> function is the only way the kernel offers to programmatic...
2009/01/27
[ "https://Stackoverflow.com/questions/482702", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
According to this <http://www.cplusplus.com/reference/clibrary/csignal/signal.html> `SIGINT` is generally used/cause by the user. How do i cause a `SIGINT` in c++? i seen an example using `kill(pid, SIGINT);` but i rather cause it another way. Also i am using windows.
C89 and C99 define raise() in signal.h: ``` #include <signal.h> int raise(int sig); ``` This function sends a signal to the calling process, and is equivalent to ``` kill(getpid(), sig); ``` If the platform supports threads, then the call is equivalent to ``` pthread_kill(pthread_self(), sig); ``` The return ...
482,716
<p>Is there an way, ideally backwards compatible to Mac OS X 10.3, to tell if "Voice Over" is activated in System Preferences?</p>
[ { "answer_id": 485314, "author": "Brian Webster", "author_id": 23324, "author_profile": "https://Stackoverflow.com/users/23324", "pm_score": 4, "selected": true, "text": "<p>This appears to be stored in a preferences file for Universal Access. The app identifier is \"com.apple.universal...
2009/01/27
[ "https://Stackoverflow.com/questions/482716", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2811/" ]
Is there an way, ideally backwards compatible to Mac OS X 10.3, to tell if "Voice Over" is activated in System Preferences?
This appears to be stored in a preferences file for Universal Access. The app identifier is "com.apple.universalaccess" and the key containing the flag for whether VoiceOver is on or off is "voiceOverOnOffKey". You should be able to retrieve this using the CFPreferences API, something looking like: ``` CFBooleanRef fl...
482,717
<p>I already have a macro that creates sheets and some other stuff. After a sheet has been created do I want to call another macro that copies data from a second excel (its open) to first and active excel file.</p> <p>First I want to copy to headers, but I cant get that to work - keep getting errors.</p> <pre><code>S...
[ { "answer_id": 482814, "author": "Sam Meldrum", "author_id": 16005, "author_profile": "https://Stackoverflow.com/users/16005", "pm_score": 1, "selected": false, "text": "<p>Would you be happy to make \"my file.xls\" active if it didn't affect the screen? Turning off screen updating is th...
2009/01/27
[ "https://Stackoverflow.com/questions/482717", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52025/" ]
I already have a macro that creates sheets and some other stuff. After a sheet has been created do I want to call another macro that copies data from a second excel (its open) to first and active excel file. First I want to copy to headers, but I cant get that to work - keep getting errors. ``` Sub CopyData(sheetName...
Two years later (Found this on Google, so for anyone else)... As has been mentioned above, you don't need to select anything. These three lines: `Workbooks(File).Worksheets(SheetData).Range("A1").Select Workbooks(File).Worksheets(SheetData).Range(Selection, Selection.End(xlToRight)).Select Workbooks(File).Worksh...
482,729
<p>I have the following code:</p> <pre><code>// Obtain the string names of all the elements within myEnum String[] names = Enum.GetNames( typeof( myEnum ) ); // Obtain the values of all the elements within myEnum Array values = Enum.GetValues( typeof( myEnum ) ); // Print the names and values to file for ( int i =...
[ { "answer_id": 482739, "author": "TWith2Sugars", "author_id": 35389, "author_profile": "https://Stackoverflow.com/users/35389", "pm_score": 2, "selected": false, "text": "<p>What about using a foreach loop, maybe you could work with that?</p>\n\n<pre><code> int i = 0;\n foreach (var o ...
2009/01/27
[ "https://Stackoverflow.com/questions/482729", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1816/" ]
I have the following code: ``` // Obtain the string names of all the elements within myEnum String[] names = Enum.GetNames( typeof( myEnum ) ); // Obtain the values of all the elements within myEnum Array values = Enum.GetValues( typeof( myEnum ) ); // Print the names and values to file for ( int i = 0; i < names....
``` Array values = Enum.GetValues(typeof(myEnum)); foreach( MyEnum val in values ) { Console.WriteLine (String.Format("{0}: {1}", Enum.GetName(typeof(MyEnum), val), val)); } ``` Or, you can cast the System.Array that is returned: ``` string[] names = Enum.GetNames(typeof(MyEnum)); MyEnum[] values = (MyEnum[])Enu...
482,736
<p>I want an animation play only once in the browser. If any user seen the movie and if goes to any other page or refresh(F5) and then come back on the animation page then animation should not play from start. I want to play it from another frame.</p> <p>I think it can be done by set cookie or somthing using javascri...
[ { "answer_id": 482752, "author": "Jan Hančič", "author_id": 185527, "author_profile": "https://Stackoverflow.com/users/185527", "pm_score": 0, "selected": false, "text": "<p>With PHP you can set a cookie with the <a href=\"http://si2.php.net/setcookie\" rel=\"nofollow noreferrer\">SetCoo...
2009/01/27
[ "https://Stackoverflow.com/questions/482736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I want an animation play only once in the browser. If any user seen the movie and if goes to any other page or refresh(F5) and then come back on the animation page then animation should not play from start. I want to play it from another frame. I think it can be done by set cookie or somthing using javascript or php. ...
You can set a session ``` session_start(); ``` And then set a session variable after the flash data ``` $_SESSION["noflash"] = true; ``` And do a check above the flash ``` if(isset($_SESSION["noflash"]) && $_SESSION["noflash"] == true) { // set the correct flashvars } ``` That way the session data is set a...
482,745
<p>Often, one needs several enumerated types together. Sometimes, one has a name clash. Two solutions to this come to mind: use a namespace, or use 'larger' enum element names. Still, the namespace solution has two possible implementations: a dummy class with nested enum, or a full blown namespace.</p> <p>I'm looki...
[ { "answer_id": 482790, "author": "Charles Anderson", "author_id": 11677, "author_profile": "https://Stackoverflow.com/users/11677", "pm_score": 3, "selected": false, "text": "<p>I would definitely avoid using a class for this; use a namespace instead. The question boils down to whether t...
2009/01/27
[ "https://Stackoverflow.com/questions/482745", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6610/" ]
Often, one needs several enumerated types together. Sometimes, one has a name clash. Two solutions to this come to mind: use a namespace, or use 'larger' enum element names. Still, the namespace solution has two possible implementations: a dummy class with nested enum, or a full blown namespace. I'm looking for pros a...
**Original C++03 answer:** The *benefit* from a `namespace` (over a `class`) is that you can use `using` declarations when you want. The *problem* with using a `namespace` is that namespaces can be expanded elsewhere in the code. In a large project, you would not be guaranteed that two distinct enums don't both think...
482,757
<p>i have a function like</p> <pre><code>void printMe (void *i) { printf("%d", i); } </code></pre> <p>where i want to pass a void pointer and print it to screen. The above example is fine if the i is integer, float or double but crashes if i is a char. There is no overloading in C like i usually use in C++. So th...
[ { "answer_id": 482766, "author": "Binary Worrier", "author_id": 18797, "author_profile": "https://Stackoverflow.com/users/18797", "pm_score": 6, "selected": true, "text": "<p>Q1: <em>So the question is this, can we create a function in C that will print the element that is it's parameter...
2009/01/27
[ "https://Stackoverflow.com/questions/482757", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28954/" ]
i have a function like ``` void printMe (void *i) { printf("%d", i); } ``` where i want to pass a void pointer and print it to screen. The above example is fine if the i is integer, float or double but crashes if i is a char. There is no overloading in C like i usually use in C++. So the question is this, can we...
Q1: *So the question is this, can we create a function in C that will print the element that is it's parameter* A: Not in the way you want. You will have to pass information to the function, telling it the type of data you're passing. Q2: *and if yes how is this possible because it totally eludes me at this moment.* ...
482,763
<p>I'm writing applications with ASP.NET MVC. In contrast to traditional ASP.NET you're a lot more responsible for creating all the ids in your generated page. ASP.NET would give you nasty, but unique ids.</p> <p>I'd like to add a quick little jQuery script to check my document for duplicate ids. They may be ids for D...
[ { "answer_id": 482770, "author": "Natrium", "author_id": 59119, "author_profile": "https://Stackoverflow.com/users/59119", "pm_score": 3, "selected": false, "text": "<p>Why don't you just validate your html?</p>\n\n<p>Double ID's are not allowed, and normally you will get a parse-error.<...
2009/01/27
[ "https://Stackoverflow.com/questions/482763", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16940/" ]
I'm writing applications with ASP.NET MVC. In contrast to traditional ASP.NET you're a lot more responsible for creating all the ids in your generated page. ASP.NET would give you nasty, but unique ids. I'd like to add a quick little jQuery script to check my document for duplicate ids. They may be ids for DIVS, image...
The following will log a warning to the console: ``` // Warning Duplicate IDs $('[id]').each(function(){ var ids = $('[id="'+this.id+'"]'); if(ids.length>1 && ids[0]==this) console.warn('Multiple IDs #'+this.id); }); ```
482,788
<p>To include another file in JSP, we use the @include tag</p> <p><em>&lt;%@ include file="NameOfFile"%></em> </p> <p>In my case i want to include a html file whose name will known during the run-time - i,e from Database. </p> <p>How can I do this in JSP?</p>
[ { "answer_id": 482803, "author": "Vinze", "author_id": 26859, "author_profile": "https://Stackoverflow.com/users/26859", "pm_score": 4, "selected": true, "text": "<p>simply using jsp:include :</p>\n\n<pre><code>&lt;jsp:include page=\"&lt;%= htmlFileName %&gt;\" /&gt;\n</code></pre>\n\n<p...
2009/01/27
[ "https://Stackoverflow.com/questions/482788", "https://Stackoverflow.com", "https://Stackoverflow.com/users/56113/" ]
To include another file in JSP, we use the @include tag *<%@ include file="NameOfFile"%>* In my case i want to include a html file whose name will known during the run-time - i,e from Database. How can I do this in JSP?
simply using jsp:include : ``` <jsp:include page="<%= htmlFileName %>" /> ``` It works in my project where the file is stored in session to reload correctly the part updated with ajax
482,800
<p>How do you call a client codes methods from inside a class defined in the client code?</p> <p>For example, I have a memory reading class, that can read values from the memory of a process at a certain address. I also have classes for managing the type of data that is read from memory (I am reading about an in-game ...
[ { "answer_id": 482807, "author": "ljs", "author_id": 3394, "author_profile": "https://Stackoverflow.com/users/3394", "pm_score": 3, "selected": false, "text": "<p>How about referencing 'this' in the constructor:-</p>\n\n<pre><code>class ObjectManager : Memory\n{\n ObjectManager()\n ...
2009/01/27
[ "https://Stackoverflow.com/questions/482800", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
How do you call a client codes methods from inside a class defined in the client code? For example, I have a memory reading class, that can read values from the memory of a process at a certain address. I also have classes for managing the type of data that is read from memory (I am reading about an in-game 'object'. ...
because you are not in a method. You must declare a method to access this. Your main function would invoke the call. If you wish to set a class level field then you will need to do it in the constructor. You still declare the variable in your class definition though (not in a method) ``` class ObjectManager : Memory...
482,811
<p>I have a system consisting of a server accepting remoting calls from clients with TCP as the underlying transportlayer. It normally works like a charm, but if I increase the no. of clients, the server starts at random to close the TCP connections in the middle of the calls. Not all calls are interrupted this way.</p...
[ { "answer_id": 482894, "author": "krosenvold", "author_id": 23691, "author_profile": "https://Stackoverflow.com/users/23691", "pm_score": 4, "selected": true, "text": "<p>I'm tempted to say it works well for an <em>unspecific</em> problem (e.g. framework code) but works less well for <em...
2009/01/27
[ "https://Stackoverflow.com/questions/482811", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a system consisting of a server accepting remoting calls from clients with TCP as the underlying transportlayer. It normally works like a charm, but if I increase the no. of clients, the server starts at random to close the TCP connections in the middle of the calls. Not all calls are interrupted this way. That...
I'm tempted to say it works well for an *unspecific* problem (e.g. framework code) but works less well for *specific* problems. Frameworks are written for other people to use, and you want to give the client total freedom of implementation. Once you know exactly what you are going to do to solve the problem, I think ot...
482,818
<p>On linux, I am opening a pseudo tty on the master side. While there is no client on the slave side, the pseudo tty seems to be echoing everything I am writing to him, which is not what I am expecting. Consider the folowing code :</p> <pre><code>int main(int argc, char * argv[]) { int ptyfd; int rc; /* ...
[ { "answer_id": 482881, "author": "shodanex", "author_id": 11589, "author_profile": "https://Stackoverflow.com/users/11589", "pm_score": 2, "selected": true, "text": "<p>I thought the master side was not a tty, but apparently it is, so you can call things like <code>tcgettattr</code> and ...
2009/01/27
[ "https://Stackoverflow.com/questions/482818", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11589/" ]
On linux, I am opening a pseudo tty on the master side. While there is no client on the slave side, the pseudo tty seems to be echoing everything I am writing to him, which is not what I am expecting. Consider the folowing code : ``` int main(int argc, char * argv[]) { int ptyfd; int rc; /* return code */...
I thought the master side was not a tty, but apparently it is, so you can call things like `tcgettattr` and `tcsetattr`, and suppress the echo.
482,835
<p>I have a specific requirement to remove all client WCF configuration (&lt;system.serviceModel&gt;) out of the main app.config file, and into a separate XML file. The behaviour I would like to see is similar to that available in the appSettings section using the File="" directive. In fact, I'd ideally like to be a...
[ { "answer_id": 484176, "author": "Tad Donaghe", "author_id": 1572436, "author_profile": "https://Stackoverflow.com/users/1572436", "pm_score": 0, "selected": false, "text": "<p>I have an application at work that works kind of like what you're talking about here. We have multiple WCF ser...
2009/01/27
[ "https://Stackoverflow.com/questions/482835", "https://Stackoverflow.com", "https://Stackoverflow.com/users/377/" ]
I have a specific requirement to remove all client WCF configuration (<system.serviceModel>) out of the main app.config file, and into a separate XML file. The behaviour I would like to see is similar to that available in the appSettings section using the File="" directive. In fact, I'd ideally like to be able to speci...
I have a tendency to programatically configure all my service settings. My clients aren't really the type to understand XML and have asked me make configuration files more like the old INI style. This is easy to do (reading INI file code not included): ``` // create the URI which is used as the service endp...
482,842
<p>I want to fetch the DataKey of the Selected Row of GridView on button click.</p>
[ { "answer_id": 482845, "author": "Vojislav Stojkovic", "author_id": 58099, "author_profile": "https://Stackoverflow.com/users/58099", "pm_score": 0, "selected": false, "text": "<p>Use the SelectedDataKey property of the GridView:</p>\n\n<pre><code>DataKey currentKey = myGridView.Selected...
2009/01/27
[ "https://Stackoverflow.com/questions/482842", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I want to fetch the DataKey of the Selected Row of GridView on button click.
I would Personal do it in a Template Field Like so: ``` <asp:TemplateField> <ItemTemplate> //EDIT: after a comment it is suggested that you pass the RowIndex as the command argument which would provide access to the entire row <asp:LinkButton ID="btnCopy" runat="server"CausesValidation="False"Co...
482,847
<p>I have 3 variables like this: $first = 2; $second = 5; $operation = '*';</p> <p>how can I programaticly assign the solution to this math problem to the $answer variable? I have tried eval(), but that does not work.</p>
[ { "answer_id": 482863, "author": "Ionuț G. Stan", "author_id": 58808, "author_profile": "https://Stackoverflow.com/users/58808", "pm_score": 3, "selected": false, "text": "<pre><code>function add($a, $b) {\n return $a + $b;\n}\n\nfunction multiply($a, $b) {\n return $a * $b;\n}\n\n...
2009/01/27
[ "https://Stackoverflow.com/questions/482847", "https://Stackoverflow.com", "https://Stackoverflow.com/users/115/" ]
I have 3 variables like this: $first = 2; $second = 5; $operation = '\*'; how can I programaticly assign the solution to this math problem to the $answer variable? I have tried eval(), but that does not work.
eval() should work perfectly fine for something like this. Remember that eval() returns NULL though, unless you tell it to return something. ``` <?php $first = 3; $second = 4; $operation = "*"; $answer = eval('return '.$first.$operation.$second.';'); echo $answer; ?> ```
482,856
<p>I am using WCF to return a plain old XML (POX) document to the caller. I am using the XML Serializer formatter to turn the objects into XML. </p> <p>In the returned document I have some extraneous xml namespace references (that weren't there in the ASMX version) for the XML Schema and instance. I have seen vario...
[ { "answer_id": 500983, "author": "Sailing Judo", "author_id": 42620, "author_profile": "https://Stackoverflow.com/users/42620", "pm_score": 1, "selected": false, "text": "<p>In my RESTful WCF service which I wrote prior to the WCF RESTful starter kit I did the following which gives me ni...
2009/01/27
[ "https://Stackoverflow.com/questions/482856", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25035/" ]
I am using WCF to return a plain old XML (POX) document to the caller. I am using the XML Serializer formatter to turn the objects into XML. In the returned document I have some extraneous xml namespace references (that weren't there in the ASMX version) for the XML Schema and instance. I have seen various arguments ...
You can remove the XML namespace by setting the Namespace parameter of the DataContract attribute to an empty string, like so: ``` [DataContract(Namespace = "")] public class ResponseInfo { // ... } ``` I hope this helps...
482,857
<p>If you have geographic data stored in ESRI shapes, you have at least three files: one ending with .shp containing the vector-data, one ending with .dbf containing attributes and a file ending with .shx containing an index.</p> <p>I'm interested in the shx-file. How does it work? Does it contain a complete mapping, ...
[ { "answer_id": 482920, "author": "Paul Dixon", "author_id": 6521, "author_profile": "https://Stackoverflow.com/users/6521", "pm_score": 4, "selected": true, "text": "<p>According to the <a href=\"http://www.esri.com/library/whitepapers/pdfs/shapefile.pdf\" rel=\"noreferrer\">spec</a> the...
2009/01/27
[ "https://Stackoverflow.com/questions/482857", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21005/" ]
If you have geographic data stored in ESRI shapes, you have at least three files: one ending with .shp containing the vector-data, one ending with .dbf containing attributes and a file ending with .shx containing an index. I'm interested in the shx-file. How does it work? Does it contain a complete mapping, like 'firs...
According to the [spec](http://www.esri.com/library/whitepapers/pdfs/shapefile.pdf) the shx contains a 100 byte header followed by a sequence of 8 byte records. Each record stores a 4 byte offset and a 4 byte content length for a record in the main .shp data file. ``` +-----------------------------------------------+ ...
482,866
<p><em>Messing around with 'extension functions' for the List module. (I spent quite a while developing 'mapfold' - which threads an accumulator like fold, but uses it as a parameter to create new values like map - then discovered that that is what <code>List.scan_left</code> does)</em></p> <p>For generation of test ...
[ { "answer_id": 482922, "author": "Tomas Petricek", "author_id": 33518, "author_profile": "https://Stackoverflow.com/users/33518", "pm_score": 6, "selected": true, "text": "<p>another option is to use F# \"sequence expressions\" and write something like this:</p>\n\n<pre><code>let crosspr...
2009/01/27
[ "https://Stackoverflow.com/questions/482866", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11410/" ]
*Messing around with 'extension functions' for the List module. (I spent quite a while developing 'mapfold' - which threads an accumulator like fold, but uses it as a parameter to create new values like map - then discovered that that is what `List.scan_left` does)* For generation of test data, I needed to do a cross...
another option is to use F# "sequence expressions" and write something like this: ``` let crossproduct l1 l2 = seq { for el1 in l1 do for el2 in l2 do yield el1, el2 };; ``` (actually, it is almost the same thing as what you wrote, because 'for .. in .. do' in sequence expression can be viewe...
482,873
<p>I'm aware that in WPF you want to keep the sizes of controls as flexible as possible so that they can flow and expand depending on their context (like in CSS).</p> <p>But most of the code examples I come across are hard-coding sizes like the heights in this example:</p> <pre><code>&lt;Grid.ColumnDefinitions&gt; ...
[ { "answer_id": 482932, "author": "Stefano Driussi", "author_id": 49209, "author_profile": "https://Stackoverflow.com/users/49209", "pm_score": 2, "selected": true, "text": "<p>Generally speaking, it's a best practice to use dinamic sizes within XAML because as you say the concept of WPF ...
2009/01/27
[ "https://Stackoverflow.com/questions/482873", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4639/" ]
I'm aware that in WPF you want to keep the sizes of controls as flexible as possible so that they can flow and expand depending on their context (like in CSS). But most of the code examples I come across are hard-coding sizes like the heights in this example: ``` <Grid.ColumnDefinitions> <ColumnDefinition Width="...
Generally speaking, it's a best practice to use dinamic sizes within XAML because as you say the concept of WPF is to be indipendent from fixed dimensions. In your particular example, i don't know if it's wanted from the writer, remember that there are still some cases involving hardcoded values (maybe a custom menu ba...
482,876
<p>My app crashes at a particular point when testing on the phone. The console shows this message</p> <pre><code>Tue Jan 27 15:47:14 unknown SpringBoard[22] &lt;Warning&gt;: Application &lt;SBApplication: 0x3f26180&gt; com.myprof.test activate: deactivate: exited abnormally with signal 10: Bus error </code></pre> <...
[ { "answer_id": 483279, "author": "Martin Pilkington", "author_id": 50185, "author_profile": "https://Stackoverflow.com/users/50185", "pm_score": 2, "selected": false, "text": "<p><a href=\"http://developer.apple.com/DOCUMENTATION/Darwin/Reference/ManPages/man3/signal.3.html\" rel=\"nofol...
2009/01/27
[ "https://Stackoverflow.com/questions/482876", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46297/" ]
My app crashes at a particular point when testing on the phone. The console shows this message ``` Tue Jan 27 15:47:14 unknown SpringBoard[22] <Warning>: Application <SBApplication: 0x3f26180> com.myprof.test activate: deactivate: exited abnormally with signal 10: Bus error ``` Where can I find a list with the mea...
A bus error means that you're trying to access memory that the [CPU can't physically access](http://en.wikipedia.org/wiki/Bus_error). As opposed to a segmentation fault, which means you're accessing memory that doesn't belong to you. Either way, you probably have a stray pointer. Try using the memory allocation debugg...
482,884
<p>This code doesn't appear to be correct in ANSI-C, but ok in C99 :</p> <pre><code>struct a { int x; int y; } z; </code></pre> <p>What are the differences about struct in C99 and ANSI-C ?</p> <p>Edit: I forgot the "a", my bad. This code compiles ok with gcc in C99 mode, but is a parse error on splint, which is know...
[ { "answer_id": 482911, "author": "Fredrik Jansson", "author_id": 58237, "author_profile": "https://Stackoverflow.com/users/58237", "pm_score": 0, "selected": false, "text": "<p>Not too sure, but in \"old\" compilers I remember having to write that as </p>\n\n<pre><code>typedef struct _Z ...
2009/01/27
[ "https://Stackoverflow.com/questions/482884", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15209/" ]
This code doesn't appear to be correct in ANSI-C, but ok in C99 : ``` struct a { int x; int y; } z; ``` What are the differences about struct in C99 and ANSI-C ? Edit: I forgot the "a", my bad. This code compiles ok with gcc in C99 mode, but is a parse error on splint, which is known to not support all the C99 exte...
``` struct { int x; int y; } z; ``` This code is valid C, with the same semantics, from every version of C since 1978 onwards, and probably a lot earlier. It defines a variable, called z, which has as its type a name-less struct type, which consists of two ints. ofaurax, what error message do you get to conclude it ...
482,885
<p>I can drop a table if it exists using the following code but do not know how to do the same with a constraint:</p> <pre><code>IF EXISTS(SELECT 1 FROM sys.objects WHERE OBJECT_ID = OBJECT_ID(N'TableName') AND type = (N'U')) DROP TABLE TableName go </code></pre> <p>I also add the constraint using this code:</p> <p...
[ { "answer_id": 482890, "author": "James L", "author_id": 2700, "author_profile": "https://Stackoverflow.com/users/2700", "pm_score": 9, "selected": true, "text": "<p>The more simple solution is provided in <a href=\"https://stackoverflow.com/a/13186918\">Eric Isaacs's</a> answer. However...
2009/01/27
[ "https://Stackoverflow.com/questions/482885", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2041/" ]
I can drop a table if it exists using the following code but do not know how to do the same with a constraint: ``` IF EXISTS(SELECT 1 FROM sys.objects WHERE OBJECT_ID = OBJECT_ID(N'TableName') AND type = (N'U')) DROP TABLE TableName go ``` I also add the constraint using this code: ``` ALTER TABLE [dbo].[TableName...
The more simple solution is provided in [Eric Isaacs's](https://stackoverflow.com/a/13186918) answer. However, it will find constraints on any table. If you want to target a foreign key constraint on a specific table, use this: ``` IF EXISTS (SELECT * FROM sys.foreign_keys WHERE object_id = OBJECT_ID(N'FK_Table...
482,889
<p>How do I search a column for a text and select all columns and rows which match the search text ?</p> <p>Sample table:</p> <pre><code> ColA ColB ColC ColD Row1 Bob Row2 Jane Row3 Joe Row4 Joe Row5 Jack Row6 Jack Row7 Jack Row8 Peter Row9 Susan ...
[ { "answer_id": 485424, "author": "Phil.Wheeler", "author_id": 15609, "author_profile": "https://Stackoverflow.com/users/15609", "pm_score": 0, "selected": false, "text": "<p>This isn't as pretty as it could be, but it gets the job done:</p>\n\n<pre><code>Public Sub SelectMultiple()\n ...
2009/01/27
[ "https://Stackoverflow.com/questions/482889", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52025/" ]
How do I search a column for a text and select all columns and rows which match the search text ? Sample table: ``` ColA ColB ColC ColD Row1 Bob Row2 Jane Row3 Joe Row4 Joe Row5 Jack Row6 Jack Row7 Jack Row8 Peter Row9 Susan ``` So the marco se...
I ended up doing something slightly different from my question. This macro will search on each row in source sheet and copy it to target sheet, which is the parameter. The data does not have to be sorted, but this makes the runtime of the marco longer. You can fix this by comparing previous row searched for a differen...
482,912
<p>I need to write a query that will group a large number of records by periods of time from Year to Hour.</p> <p>My initial approach has been to decide the periods procedurally in C#, iterate through each and run the SQL to get the data for that period, building up the dataset as I go.</p> <pre><code>SELECT Sum(some...
[ { "answer_id": 482936, "author": "ShuggyCoUk", "author_id": 12748, "author_profile": "https://Stackoverflow.com/users/12748", "pm_score": 4, "selected": true, "text": "<p>As with anything performance related <strong>Measure</strong></p>\n\n<p>Checking the query plan up for the second app...
2009/01/27
[ "https://Stackoverflow.com/questions/482912", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40848/" ]
I need to write a query that will group a large number of records by periods of time from Year to Hour. My initial approach has been to decide the periods procedurally in C#, iterate through each and run the SQL to get the data for that period, building up the dataset as I go. ``` SELECT Sum(someValues) FROM table1 W...
As with anything performance related **Measure** Checking the query plan up for the second approach will tell you any obvious problems in advance (a full table scan when you know one is not needed) but there is no substitute for measuring. In SQL performance testing that measurement should be done with appropriate siz...
482,925
<p>Is there any way to convert a string to Title case, using JSTL tags?</p> <p>Thanks in Advance.</p>
[ { "answer_id": 482959, "author": "Romain Linsolas", "author_id": 26457, "author_profile": "https://Stackoverflow.com/users/26457", "pm_score": 3, "selected": false, "text": "<p>An idea:</p>\n\n<p>In a class, create a simple method that uses the WordUtils from Apache Commons Lang that wil...
2009/01/27
[ "https://Stackoverflow.com/questions/482925", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Is there any way to convert a string to Title case, using JSTL tags? Thanks in Advance.
An alternative to transforming the string on the server is to [let CSS do the work](http://www.w3.org/TR/CSS2/text.html#caps-prop): ``` text-transform: capitalize ```
482,926
<p>To make sure that the text in listbox items is not truncated I want to adjust its width to the width of the item with longest text.</p> <p>Is there any way to get a "actual" width of the listbox item the one which is based on the item's text.</p> <p>ListBox.GetItemRectangle does not seem to be returning this actua...
[ { "answer_id": 482950, "author": "Gerrie Schenck", "author_id": 57036, "author_profile": "https://Stackoverflow.com/users/57036", "pm_score": 2, "selected": false, "text": "<p>Check out the <a href=\"http://msdn.microsoft.com/en-us/library/6xe5hazb.aspx\" rel=\"nofollow noreferrer\">Meas...
2009/01/27
[ "https://Stackoverflow.com/questions/482926", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48829/" ]
To make sure that the text in listbox items is not truncated I want to adjust its width to the width of the item with longest text. Is there any way to get a "actual" width of the listbox item the one which is based on the item's text. ListBox.GetItemRectangle does not seem to be returning this actual width. thank y...
MeasureString method: (copy pasted from msdn) ``` Graphics g = control.CreateGraphics(); int width = (int)g.MeasureString(aString, control.Font).Width; g.dispose(); ``` Add width of the textbox (left and right side) to the value
482,954
<p>Is there a performance hit when iterating over object attributes vs. iterating an array?</p> <p>Example, using objects:</p> <pre><code>var x:Object = {one: 1, two: 2, three: 3}; for (var s:String in x) { trace(x[s]); } </code></pre> <p>Vs using an array</p> <pre><code>var a:Array = [1, 2, 3]; var len:Number = a...
[ { "answer_id": 485265, "author": "Luke", "author_id": 21406, "author_profile": "https://Stackoverflow.com/users/21406", "pm_score": 0, "selected": false, "text": "<p>OK. Why not do some simple measurements?</p>\n\n<pre><code>var time : Number;\n\ntime = getTimer();\n\nvar x:Object = {one...
2009/01/27
[ "https://Stackoverflow.com/questions/482954", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10272/" ]
Is there a performance hit when iterating over object attributes vs. iterating an array? Example, using objects: ``` var x:Object = {one: 1, two: 2, three: 3}; for (var s:String in x) { trace(x[s]); } ``` Vs using an array ``` var a:Array = [1, 2, 3]; var len:Number = a.length; for (var i:Number = 0; i < len; ++i...
I just tried a very similar test, but iterating just once over 200k elements, with opposite results: ``` Task build-arr: 2221ms Task iter-arr: 516ms Task build-obj: 1410ms Task iter-obj: 953ms ``` I suspect Luke's test is dominated by loop overhead, which seems bigger in the array case. Also, note that the array to...
482,971
<p>I have two classes declared like this:</p> <pre><code>class Object1 { protected ulong guid; protected uint type; public Object1(ulong Guid, uint Type) { this.guid = Guid; this.type = Type } // other details omitted } class Object2 : Object1 { // details omitted } </code...
[ { "answer_id": 482974, "author": "Frederik Gheysels", "author_id": 55774, "author_profile": "https://Stackoverflow.com/users/55774", "pm_score": 4, "selected": true, "text": "<pre><code>class Object2 : Object1\n{\n Object2(ulong l, uint i ) : base (l, i)\n {\n }\n}\n</code></pre>\n...
2009/01/27
[ "https://Stackoverflow.com/questions/482971", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have two classes declared like this: ``` class Object1 { protected ulong guid; protected uint type; public Object1(ulong Guid, uint Type) { this.guid = Guid; this.type = Type } // other details omitted } class Object2 : Object1 { // details omitted } ``` In the client ...
``` class Object2 : Object1 { Object2(ulong l, uint i ) : base (l, i) { } } ```
482,972
<p>Digital commercial products that customers pay for download link.</p> <p>I have put all the zipped files (products) outside of web document root and buyers download them via a php script which is integrated with paypal IPN to make sure the downloader is a paying buyer. </p> <p>Sort of like: <a href="http://www.mys...
[ { "answer_id": 482983, "author": "David Grant", "author_id": 40581, "author_profile": "https://Stackoverflow.com/users/40581", "pm_score": 2, "selected": false, "text": "<p>You have an extra newline character for your Content-Transfer-Encoding header - perhaps that is resulting in three ...
2009/01/27
[ "https://Stackoverflow.com/questions/482972", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49318/" ]
Digital commercial products that customers pay for download link. I have put all the zipped files (products) outside of web document root and buyers download them via a php script which is integrated with paypal IPN to make sure the downloader is a paying buyer. Sort of like: <http://www.mysite.com/download.php?buye...
You'd be better off just using [`readfile()`](http://www.php.net/readfile). Unless you have ignore\_user\_abort on, then the script will terminate automatically if the user cancels anyway. If you're still having problems, load the file up in a hex editor and compare the first few characters and the last few characters...
482,986
<p>It is easy to read an XML file and get the exact Node Text, but how do I Update that Node with a new value?</p> <p>To read:</p> <pre><code>public static String GetSettings(SettingsType type, SectionType section) { XmlTextReader reader = new XmlTextReader(HttpContext.Current.Request.MapPath(APPSETTINGSPATH)); ...
[ { "answer_id": 482998, "author": "AnthonyWJones", "author_id": 17516, "author_profile": "https://Stackoverflow.com/users/17516", "pm_score": 2, "selected": false, "text": "<p><code>XmlDocument.Load</code> has an overload that will take the filename directly so there is no need for the re...
2009/01/27
[ "https://Stackoverflow.com/questions/482986", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28004/" ]
It is easy to read an XML file and get the exact Node Text, but how do I Update that Node with a new value? To read: ``` public static String GetSettings(SettingsType type, SectionType section) { XmlTextReader reader = new XmlTextReader(HttpContext.Current.Request.MapPath(APPSETTINGSPATH)); XmlDocument docume...
You don't need an "update" method - setting the InnerText property updates it. However, it only applies the update in memory. You *do* need to rewrite the whole file though - you can't just update a small part of it (at least, not without a *lot* of work and no out-of-the-box support).
483,005
<p>I have following class</p> <pre><code> public abstract class AbsTrinityEvent { public event IsSelected OnSelectedEvent; bool _IsSelected; ITrinityEvent _objTrinityEvent; public AbsTrinityEvent(ITrinityEvent objTrinityEvent) { _objTrinityEvent = objTrinityEvent; } public I...
[ { "answer_id": 497071, "author": "Robert Macnee", "author_id": 19273, "author_profile": "https://Stackoverflow.com/users/19273", "pm_score": 4, "selected": false, "text": "<p>First off, you're much better off doing this in XAML. It makes things much clearer and shorter. I'm going to an...
2009/01/27
[ "https://Stackoverflow.com/questions/483005", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have following class ``` public abstract class AbsTrinityEvent { public event IsSelected OnSelectedEvent; bool _IsSelected; ITrinityEvent _objTrinityEvent; public AbsTrinityEvent(ITrinityEvent objTrinityEvent) { _objTrinityEvent = objTrinityEvent; } public ITrinityEvent T...
First off, you're much better off doing this in XAML. It makes things much clearer and shorter. I'm going to answer in both XAML and code-behind to demonstrate this. The easiest way is to make a Style applied to ListViewItem and using a Setter to apply the binding. On a ListViewItem, the DataContext is going to be you...
483,011
<p>I currently have the query running on Postgres:</p> <pre><code>SELECT * FROM addenda.users WHERE users.username LIKE '%\_' </code></pre> <p>But rather then returning just entries ending in an underscore, I get all results back, regardless of whether it contains an underscore or not. </p> <p>Running the query bel...
[ { "answer_id": 483049, "author": "Stephen Denne", "author_id": 11721, "author_profile": "https://Stackoverflow.com/users/11721", "pm_score": 5, "selected": true, "text": "<p>Is your backslash not getting through to PostgreSQL? If you're passing the string through another layer that treat...
2009/01/27
[ "https://Stackoverflow.com/questions/483011", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3410/" ]
I currently have the query running on Postgres: ``` SELECT * FROM addenda.users WHERE users.username LIKE '%\_' ``` But rather then returning just entries ending in an underscore, I get all results back, regardless of whether it contains an underscore or not. Running the query below returns a username which is ju...
Is your backslash not getting through to PostgreSQL? If you're passing the string through another layer that treats the backslash as an escape character (e.g. a Java String), then that layer may be removing the backslash, and you might need to escape your backslash for that layer. Do you have any more single character...
483,014
<p><strong>bpp</strong> = bits per pixel, so 32bpp means 8/8/8/8 for R/G/B/A.</p> <p>Like .NET has an enum for these "System.Drawing.Imaging.PixelFormat".</p> <p>Now once I have a <strong>Bitmap</strong> or <strong>Image</strong> object with my graphics, <strong>how would I save it</strong> to a file / what format wo...
[ { "answer_id": 483045, "author": "Dead account", "author_id": 52458, "author_profile": "https://Stackoverflow.com/users/52458", "pm_score": -1, "selected": false, "text": "<p>Untested code -</p>\n\n<pre><code>Image myImage = new Image();\nEncoderParameters parameters = new EncoderParamet...
2009/01/27
[ "https://Stackoverflow.com/questions/483014", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41021/" ]
**bpp** = bits per pixel, so 32bpp means 8/8/8/8 for R/G/B/A. Like .NET has an enum for these "System.Drawing.Imaging.PixelFormat". Now once I have a **Bitmap** or **Image** object with my graphics, **how would I save it** to a file / what format would I use? What image file format (JPEG/GIF/PNG) supports low bit-de...
Try this: ``` ImageCodecInfo pngCodec = ImageCodecInfo.GetImageEncoders().Where(codec => codec.FormatID.Equals(ImageFormat.Png.Guid)).FirstOrDefault(); if (pngCodec != null) { EncoderParameters parameters = new EncoderParameters(); parameters.Param[0] = new EncoderParameter(Encoder.ColorDepth, 8); myImage....
483,018
<p>I recently finished a university course in C. Therefore I lack experience, of course.</p> <p>Some universities tend to teach their students secure programming, <a href="http://www.courses.fas.harvard.edu/~cs50/get/podcasts/2007/lectures/notes9m.pdf" rel="nofollow noreferrer">or at least some elements</a>. There's <...
[ { "answer_id": 483035, "author": "OregonGhost", "author_id": 20363, "author_profile": "https://Stackoverflow.com/users/20363", "pm_score": 0, "selected": false, "text": "<p>Actually, Microsoft did provide secure alternatives to the CRT functions. Everybody I know hates them though and di...
2009/01/27
[ "https://Stackoverflow.com/questions/483018", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59300/" ]
I recently finished a university course in C. Therefore I lack experience, of course. Some universities tend to teach their students secure programming, [or at least some elements](http://www.courses.fas.harvard.edu/~cs50/get/podcasts/2007/lectures/notes9m.pdf). There's [even a video](http://www.courses.fas.harvard.ed...
The Posix function for this (available on nearly every system) is `strdup()`. `strcpy()` is used if you don't want to allocate new memory and already have a buffer you want to use, but then you better known how big that buffer is and if the string fits in it. If you don't know if the string fits, there is `strncpy()` t...
483,072
<p>i have a module (a single .py file, actually), with a class called HashedDir.</p> <p>when i import the file and instanciate 2 instances of that class, when i check the object's fields they're always the same, even if the two objects should be different.</p> <p>Eg:</p> <pre><code> h1 = HashedDir('/path/to/dir') p...
[ { "answer_id": 483123, "author": "Corey", "author_id": 1595, "author_profile": "https://Stackoverflow.com/users/1595", "pm_score": 3, "selected": false, "text": "<p>Is it fileList you're talking about? You have it as a class variable, to make it an instance variable you need to do:</p>\...
2009/01/27
[ "https://Stackoverflow.com/questions/483072", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42636/" ]
i have a module (a single .py file, actually), with a class called HashedDir. when i import the file and instanciate 2 instances of that class, when i check the object's fields they're always the same, even if the two objects should be different. Eg: ``` h1 = HashedDir('/path/to/dir') print h1.getList()['files'] #...
There are two kinds of variables in a class: * class variables, defined at the class level, and common to all instances * instance variables, defined within a class method (usually `__init__`) and qualified by the instance (usually `self.`). Example ``` class SomeClass( object ): classVariable = 0 def __init...
483,073
<p>I understand passing in a function to another function as a callback and having it execute, but I'm not understanding the best implementation to do that. I'm looking for a very basic example, like this:</p> <pre><code>var myCallBackExample = { myFirstFunction : function( param1, param2, callback ) { // ...
[ { "answer_id": 483089, "author": "annakata", "author_id": 13018, "author_profile": "https://Stackoverflow.com/users/13018", "pm_score": 3, "selected": false, "text": "<p>Callbacks are about signals and \"new\" is about creating object instances. </p>\n\n<p>In this case it would be even m...
2009/01/27
[ "https://Stackoverflow.com/questions/483073", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I understand passing in a function to another function as a callback and having it execute, but I'm not understanding the best implementation to do that. I'm looking for a very basic example, like this: ``` var myCallBackExample = { myFirstFunction : function( param1, param2, callback ) { // Do something w...
You can just say ``` callback(); ``` Alternately you can use the `call` method if you want to adjust the value of `this` within the callback. ``` callback.call( newValueForThis); ``` Inside the function `this` would be whatever `newValueForThis` is.
483,087
<p>I've just started playing with Guice, and a use-case I can think of is that in a test I just want to override a single binding. I think I'd like to use the rest of the production level bindings to ensure everything is setup correctly and to avoid duplication.</p> <p>So imagine I have the following Module</p> <pre...
[ { "answer_id": 531110, "author": "albertb", "author_id": 26715, "author_profile": "https://Stackoverflow.com/users/26715", "pm_score": 8, "selected": true, "text": "<p>This might not be the answer you're looking for, but if you're writing unit tests, you probably shouldn't be using an in...
2009/01/27
[ "https://Stackoverflow.com/questions/483087", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51577/" ]
I've just started playing with Guice, and a use-case I can think of is that in a test I just want to override a single binding. I think I'd like to use the rest of the production level bindings to ensure everything is setup correctly and to avoid duplication. So imagine I have the following Module ``` public class Pr...
This might not be the answer you're looking for, but if you're writing unit tests, you probably shouldn't be using an injector and rather be injecting mock or fake objects by hand. On the other hand, if you really want to replace a single binding, you could use `Modules.override(..)`: ``` public class ProductionModul...
483,091
<p>I want to output two different views (one as a string that will be sent as an email), and the other the page displayed to a user.</p> <p>Is this possible in ASP.NET MVC beta?</p> <p>I've tried multiple examples:</p> <p><strong>1.</strong> <a href="http://brightmix.com/blog/how-to-renderpartial-to-string-in-asp-ne...
[ { "answer_id": 484932, "author": "Tim Scott", "author_id": 29493, "author_profile": "https://Stackoverflow.com/users/29493", "pm_score": 5, "selected": false, "text": "<p>This works for me:</p>\n\n<pre><code>public virtual string RenderView(ViewContext viewContext)\n{\n var response =...
2009/01/27
[ "https://Stackoverflow.com/questions/483091", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31532/" ]
I want to output two different views (one as a string that will be sent as an email), and the other the page displayed to a user. Is this possible in ASP.NET MVC beta? I've tried multiple examples: **1.** [RenderPartial to String in ASP.NET MVC Beta](http://brightmix.com/blog/how-to-renderpartial-to-string-in-asp-ne...
Here's what I came up with, and it's working for me. I added the following method(s) to my controller base class. (You can always make these static methods somewhere else that accept a controller as a parameter I suppose) **MVC2 .ascx style** ``` protected string RenderViewToString<T>(string viewPath, T model) { Vi...
483,115
<p>i am sending emails with the integrated System.Net.Mail</p> <p>i do like </p> <pre><code>MailAddress abs = new System.Net.Mail.MailAddress("my@email.com", "Web Präsenz", System.Text.Encoding.UTF8); </code></pre> <p>when the E-Mail comes to Client the "ä" character is missing. seems like some encoding Problems.</p...
[ { "answer_id": 483855, "author": "craigmoliver", "author_id": 12252, "author_profile": "https://Stackoverflow.com/users/12252", "pm_score": 2, "selected": false, "text": "<p>try adding these too:</p>\n\n<pre><code>message.BodyEncoding = System.Text.Encoding.UTF8;\nmessage.SubjectEncodin...
2009/01/27
[ "https://Stackoverflow.com/questions/483115", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
i am sending emails with the integrated System.Net.Mail i do like ``` MailAddress abs = new System.Net.Mail.MailAddress("my@email.com", "Web Präsenz", System.Text.Encoding.UTF8); ``` when the E-Mail comes to Client the "ä" character is missing. seems like some encoding Problems. anyone knows how to fix it?
try adding these too: ``` message.BodyEncoding = System.Text.Encoding.UTF8; message.SubjectEncoding = System.Text.Encoding.UTF8; ``` It may also be a mail server issue. Try sending it to various e-mail address; POP3, WebMail, etc. There some more info here, though you've probably already looked here: <http://msdn...
483,119
<p>I have a base class, BaseObject, and a number of classes which derive from BaseObject (DerivedObject1, DerivedObject2 etc)</p> <p>I have a collection of BaseObjects in which I storing the derived objects. The code I use to do this is:</p> <pre><code>// declaring and initializing the idictionary public IDictionary&...
[ { "answer_id": 486772, "author": "Riri", "author_id": 298, "author_profile": "https://Stackoverflow.com/users/298", "pm_score": 0, "selected": false, "text": "<p>The best way to troubleshoot a failing BTSTask ImportBindings action is to manually import the finding file. Right click on th...
2009/01/27
[ "https://Stackoverflow.com/questions/483119", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a base class, BaseObject, and a number of classes which derive from BaseObject (DerivedObject1, DerivedObject2 etc) I have a collection of BaseObjects in which I storing the derived objects. The code I use to do this is: ``` // declaring and initializing the idictionary public IDictionary<ulong, BaseObject> Ob...
Thanks for your answer Richard but I did try importing the binding file manually through the BizTalk admin console and this worked fine. After further investigation, my colleague (thanks Brad) discovered that the only significant difference between the binding file which was failing and a previous working version was ...
483,164
<p>Some loading routines in my program takes to long to complete. I want a quick small snippet for checking how long a function took to execute. By small I mean "preferably without 3rd party libraries".</p> <p>Maybe something as simple as taking the system time?</p> <pre><code>start = current_system_time() load_somet...
[ { "answer_id": 483210, "author": "jvasak", "author_id": 5840, "author_profile": "https://Stackoverflow.com/users/5840", "pm_score": 3, "selected": false, "text": "<p>This is a quick and dirty way to time a block of C/C++ code. You need to <code>#include &lt;sys/time.h&gt;</code>, which ...
2009/01/27
[ "https://Stackoverflow.com/questions/483164", "https://Stackoverflow.com", "https://Stackoverflow.com/users/56763/" ]
Some loading routines in my program takes to long to complete. I want a quick small snippet for checking how long a function took to execute. By small I mean "preferably without 3rd party libraries". Maybe something as simple as taking the system time? ``` start = current_system_time() load_something() delta = curren...
Your answer: Yes Caveat: That **WON'T** work in multihtreaded code or multiple core machines, you need a robust wall-clock timer. So I recommend you use omp's wallclock. OMP is included with VC and GCC, and most compilers and its a standard you don't need to worry about disappearing ``` #include <omp.h> // Starting ...
483,173
<p>I have the following SWT test code:</p> <pre><code>public static void main(String[] args) { shell = new Shell(); shell.setText(APP_NAME + " " + APP_VERSION); shell.addShellListener(new ShellListener() { public void shellActivated(ShellEvent event) { } public void shellClosed(ShellEvent e...
[ { "answer_id": 483317, "author": "McDowell", "author_id": 304, "author_profile": "https://Stackoverflow.com/users/304", "pm_score": 4, "selected": true, "text": "<p>You are not releasing the native resources correctly - you have a resource leak.</p>\n\n<p>You don't need to do this:</p>\n...
2009/01/27
[ "https://Stackoverflow.com/questions/483173", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19410/" ]
I have the following SWT test code: ``` public static void main(String[] args) { shell = new Shell(); shell.setText(APP_NAME + " " + APP_VERSION); shell.addShellListener(new ShellListener() { public void shellActivated(ShellEvent event) { } public void shellClosed(ShellEvent event) { exit()...
You are not releasing the native resources correctly - you have a resource leak. You don't need to do this: ``` private void exit() { System.exit(0); } ``` The main method will exit when the shell is disposed. If you *must* use an exit method, call it after you've disposed all SWT resources: ``` Display di...
483,193
<p>I need to remove a highly referenced table in a SQL Server database. How can I get a list of all the foreign key constraints I will need to remove in order to drop the table?</p> <p>(SQL answers preferable over clicking about in the GUI of the management studio.)</p>
[ { "answer_id": 483259, "author": "BankZ", "author_id": 57531, "author_profile": "https://Stackoverflow.com/users/57531", "pm_score": 7, "selected": false, "text": "<p>Try this :</p>\n\n<pre><code>sp_help 'TableName'\n</code></pre>\n" }, { "answer_id": 483266, "author": "Gishu...
2009/01/27
[ "https://Stackoverflow.com/questions/483193", "https://Stackoverflow.com", "https://Stackoverflow.com/users/56679/" ]
I need to remove a highly referenced table in a SQL Server database. How can I get a list of all the foreign key constraints I will need to remove in order to drop the table? (SQL answers preferable over clicking about in the GUI of the management studio.)
Not sure why no one suggested but I use `sp_fkeys` to query foreign keys for a given table: ``` EXEC sp_fkeys 'TableName' ``` You can also specify the schema: ``` EXEC sp_fkeys @pktable_name = 'TableName', @pktable_owner = 'dbo' ``` Without specifying the schema, the [docs](https://learn.microsoft.com/en-us/sql/r...
483,199
<p>When I compile my Windows application (called CrosslinesDetection) in Visual C++ 2005 including OpenCV 1.1, a computer vision library, I do not get any compile or link errors, but when I am running it, it gets to a point and freezes, and Windows says the following:</p> <pre><code>"Unhandled exception at 0x7c915223 ...
[ { "answer_id": 485541, "author": "jmihalicza", "author_id": 59019, "author_profile": "https://Stackoverflow.com/users/59019", "pm_score": 0, "selected": false, "text": "<p>Isn't it</p>\n\n<pre><code>cvReleaseImage( img );\n</code></pre>\n\n<p>? (ampersand removed)\nAlso you should check ...
2009/01/27
[ "https://Stackoverflow.com/questions/483199", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59298/" ]
When I compile my Windows application (called CrosslinesDetection) in Visual C++ 2005 including OpenCV 1.1, a computer vision library, I do not get any compile or link errors, but when I am running it, it gets to a point and freezes, and Windows says the following: ``` "Unhandled exception at 0x7c915223 in CrosslinesD...
I would suggest to test this same code in a native project, without managed code. Either MFC or a Win32 console application.
483,213
<p>Well I tried to figure out is this possible in any way. Here is code:</p> <pre><code>a=function(text) { var b=text; if (!arguments.callee.prototype.get) arguments.callee.prototype.get=function() { return b; } else alert('already created!'); } var c=new a("test"); // creates ...
[ { "answer_id": 483244, "author": "geowa4", "author_id": 50214, "author_profile": "https://Stackoverflow.com/users/50214", "pm_score": 2, "selected": false, "text": "<p>Methods on the prototype cannot access \"private\" members as they exist in javascript; you need some kind of privileged...
2009/01/27
[ "https://Stackoverflow.com/questions/483213", "https://Stackoverflow.com", "https://Stackoverflow.com/users/58260/" ]
Well I tried to figure out is this possible in any way. Here is code: ``` a=function(text) { var b=text; if (!arguments.callee.prototype.get) arguments.callee.prototype.get=function() { return b; } else alert('already created!'); } var c=new a("test"); // creates prototype inst...
JavaScript traditionally did not provide a mechanism for property hiding ('private members'). As JavaScript is lexically scoped, you could always simulate this on a per-object level by using the constructor function as a closure over your 'private members' and defining your methods in the constructor, but this won't w...
483,215
<p>How does the code looks that would create an object of class:</p> <pre><code>string myClass = "MyClass"; </code></pre> <p>Of the above type, and then call</p> <pre><code>string myMethod = "MyMethod"; </code></pre> <p>On that object?</p>
[ { "answer_id": 483231, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 4, "selected": true, "text": "<ul>\n<li>Use <a href=\"http://msdn.microsoft.com/en-us/library/system.type.gettype.aspx\" rel=\"noreferrer\"><code>Type....
2009/01/27
[ "https://Stackoverflow.com/questions/483215", "https://Stackoverflow.com", "https://Stackoverflow.com/users/452521/" ]
How does the code looks that would create an object of class: ``` string myClass = "MyClass"; ``` Of the above type, and then call ``` string myMethod = "MyMethod"; ``` On that object?
* Use [`Type.GetType(string)`](http://msdn.microsoft.com/en-us/library/system.type.gettype.aspx) to get the type object. * Use [`Activator.CreateInstance(Type)`](http://msdn.microsoft.com/en-us/library/system.activator.createinstance.aspx) to create an instance. * Use [`Type.GetMethod(string)`](http://msdn.microsoft.co...
483,250
<p>Although I deeply fell in love with the MVVM pattern there seem to be a lot of problems I cannot (yet) figure out for myself.</p> <p>I wonder what the parameters of the methods of the IComamnd interface are good for</p> <p>e.g. <code>void Execute(object parameter);</code></p> <p>I tie my view to the view model li...
[ { "answer_id": 483272, "author": "Steven Robbins", "author_id": 26507, "author_profile": "https://Stackoverflow.com/users/26507", "pm_score": 4, "selected": true, "text": "<p>You can add CommandParameter=\"\" to pass a parameter. Usually you'll pass in the binding, or an id that's part o...
2009/01/27
[ "https://Stackoverflow.com/questions/483250", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22038/" ]
Although I deeply fell in love with the MVVM pattern there seem to be a lot of problems I cannot (yet) figure out for myself. I wonder what the parameters of the methods of the IComamnd interface are good for e.g. `void Execute(object parameter);` I tie my view to the view model like this ``` <Button Command="{Bind...
You can add CommandParameter="" to pass a parameter. Usually you'll pass in the binding, or an id that's part of the binding, so the command knows what record to work with.
483,255
<p>Let's say we have</p> <pre><code>class A { public: virtual int foo() { cout &lt;&lt; "foo!"; } } class B : public A { public: virtual int foo() =0; } class C : public B { public: virtual int foo() { cout &lt;&lt; "moo!"; } } </code></pre> <p>Is this really <em>overriding</em>? I think...
[ { "answer_id": 483278, "author": "Paul Mitchell", "author_id": 38966, "author_profile": "https://Stackoverflow.com/users/38966", "pm_score": 1, "selected": false, "text": "<p>It seems to me that the only effect of the pure virtual method here is to make B an abstract class.</p>\n" }, ...
2009/01/27
[ "https://Stackoverflow.com/questions/483255", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59320/" ]
Let's say we have ``` class A { public: virtual int foo() { cout << "foo!"; } } class B : public A { public: virtual int foo() =0; } class C : public B { public: virtual int foo() { cout << "moo!"; } } ``` Is this really *overriding*? I think this is actually **overloading**. What is th...
Overloading would mean that you had two functions of the same name but with different parameters. That's not the case here. Example: ``` int functionA() { /*...*/ }; int functionA(int someParameter) { /*...*/ }; ``` Overriding means rewriting a function with the same parameters in a subclass. That is what you prese...
483,262
<p>I need to prevent the .NET WebBrowser control from showing any "Do you want to open or save this file?" and "Save As" dialogs. Instead, I want to display a message box telling users that file downloads are disabled for security reasons.</p> <p>I started with the <code>FileDownload</code> event of <code>WebBrowser</...
[ { "answer_id": 486756, "author": "lubos hasko", "author_id": 275, "author_profile": "https://Stackoverflow.com/users/275", "pm_score": 2, "selected": false, "text": "<p>You could use <code>Navigating</code> event which allows cancellation.</p>\n\n<p>Inside of this event, you could try to...
2009/01/27
[ "https://Stackoverflow.com/questions/483262", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7641/" ]
I need to prevent the .NET WebBrowser control from showing any "Do you want to open or save this file?" and "Save As" dialogs. Instead, I want to display a message box telling users that file downloads are disabled for security reasons. I started with the `FileDownload` event of `WebBrowser`, but it does not allow can...
You could use `Navigating` event which allows cancellation. Inside of this event, you could try to connect to URL that's being navigated yourself, inspect http response headers and cancel navigating if inappropriate ContentType is detected. ``` System.Net.WebRequest request = System.Net.WebRequest.Create(e.Url); // ...
483,276
<p>From some old c++ code im trying to use a com dll, it works fine when the dll is registered, but it crahses if the dll isnt registered.</p> <p>// Initialize COM. HRESULT hr = CoInitialize(NULL);</p> <p>IGetTestPtr ptest(__uuidof(tester));</p> <p><em>"Use method from the dll"</em></p> <p>// Uninitialize COM. CoUn...
[ { "answer_id": 483290, "author": "Quassnoi", "author_id": 55159, "author_profile": "https://Stackoverflow.com/users/55159", "pm_score": 2, "selected": false, "text": "<p>If the DLL is registered, there is a record in <code>HKCR/CLSID/{uuidof(tester)}</code> (curly brackets do matter).</p...
2009/01/27
[ "https://Stackoverflow.com/questions/483276", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36476/" ]
From some old c++ code im trying to use a com dll, it works fine when the dll is registered, but it crahses if the dll isnt registered. // Initialize COM. HRESULT hr = CoInitialize(NULL); IGetTestPtr ptest(\_\_uuidof(tester)); *"Use method from the dll"* // Uninitialize COM. CoUninitialize(); Is it anyway to check...
Calling CreateInstance on your object will return an HRESULT that can be tested for success: ``` IGetTestPtr p = null; HRESULT hRes = p.CreateInstance( __uuidof(tester) ); bool bSuccess = SUCCEEDED(hRes); ``` This assumes you've created an interface wrapper around your type library using Visual Studio, where COM Sm...
483,281
<p>Do people have any recommendations on how i could write my own custom JAXB annotation handling class to support the generation of xs:annotation/xs:documentation elements in the xsd schema?. I'd like to create a new java annotation "@XmlAnnotation" which would include a "documentation" attribute. I'd then make these ...
[ { "answer_id": 485148, "author": "Pierre", "author_id": 58082, "author_profile": "https://Stackoverflow.com/users/58082", "pm_score": 1, "selected": false, "text": "<p>This XmlRootElement is almost empty ( <a href=\"http://docjar.org/src/api/javax/xml/bind/annotation/XmlRootElement.java\...
2009/01/27
[ "https://Stackoverflow.com/questions/483281", "https://Stackoverflow.com", "https://Stackoverflow.com/users/55794/" ]
Do people have any recommendations on how i could write my own custom JAXB annotation handling class to support the generation of xs:annotation/xs:documentation elements in the xsd schema?. I'd like to create a new java annotation "@XmlAnnotation" which would include a "documentation" attribute. I'd then make these cla...
This XmlRootElement is almost empty ( <http://docjar.org/src/api/javax/xml/bind/annotation/XmlRootElement.java>, there is not 'active' code inside The main modification would be to change the code **using** this annotation and generating the xsd file.
483,295
<p>I appear to have a memory leak in this piece of code. It is a console app, which creates a couple of classes (WorkerThread), each of which writes to the console at specified intervals. The Threading.Timer is used to do this, hence writing to the console is performed in a separate thread (the TimerCallback is called ...
[ { "answer_id": 483322, "author": "Greg Dean", "author_id": 1200558, "author_profile": "https://Stackoverflow.com/users/1200558", "pm_score": 0, "selected": false, "text": "<p>Well you never actually call <code>dispose</code> on the WorkerThread instances. </p>\n" }, { "answer_id...
2009/01/27
[ "https://Stackoverflow.com/questions/483295", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42119/" ]
I appear to have a memory leak in this piece of code. It is a console app, which creates a couple of classes (WorkerThread), each of which writes to the console at specified intervals. The Threading.Timer is used to do this, hence writing to the console is performed in a separate thread (the TimerCallback is called in ...
Well, having had some time to look into this again, it appears that the memory leak is a bit of a red herring. *When I stop writing to the console, the memory usage stops increasing*. However, there is a remaining issue in that every time I edit the test.xml file (which fires the Changed event on the FileSystemWatcher...
483,306
<p>Since HTA applications are hosted within MSHTA.exe how does one provide a manifest? Plus I assume providing a MSHTA.exe.manifest could potentially break other HTA apps?</p>
[ { "answer_id": 517978, "author": "Toby Allen", "author_id": 6244, "author_profile": "https://Stackoverflow.com/users/6244", "pm_score": 0, "selected": false, "text": "<p><strong>Edit:</strong> My answer is wrong, but I'll leave it here to avoid any similar wrong answers :)</p>\n\n<hr>\n\...
2009/01/27
[ "https://Stackoverflow.com/questions/483306", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1995476/" ]
Since HTA applications are hosted within MSHTA.exe how does one provide a manifest? Plus I assume providing a MSHTA.exe.manifest could potentially break other HTA apps?
On Vista+, MSHTA.exe has an embedded manifest, which takes priority over external manifests, so your suggestion is not an option. On XP/2003, yes, your suggestion would work, although it would be bad form, as is dropping files in System32 to modify the behavior of a system binary (especially make sure that any registr...
483,313
<p>I have come across a problem where, my asp.net code is being rendered differently on Firefox and IE. When I say differently, I mean, A linkButton in IE renders as anchor tags. On Firefox however, it renders as a span </p> <p>code example</p> <pre><code>&lt;ItemTemplate&gt; &lt;div id="&lt;%#Eval("Id","{0}") %&...
[ { "answer_id": 483345, "author": "NeedHack", "author_id": 44950, "author_profile": "https://Stackoverflow.com/users/44950", "pm_score": 1, "selected": false, "text": "<p>Surely this is caused by adaptive rendering, where ASP.Net emits html tailored for the browser?</p>\n\n<p><a href=\"ht...
2009/01/27
[ "https://Stackoverflow.com/questions/483313", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5197/" ]
I have come across a problem where, my asp.net code is being rendered differently on Firefox and IE. When I say differently, I mean, A linkButton in IE renders as anchor tags. On Firefox however, it renders as a span code example ``` <ItemTemplate> <div id="<%#Eval("Id","{0}") %>"> <asp:LinkButton ID="Produc...
I am very emabarrased to admit that I have made the most absent minded of blunders **Jay S** very rightly pointed out that I should make sure I'm looking at the correct instance of the code. Some of the links on the local version are pointing to the Dev version on the Dev Server. It is not up to date and actually has ...
483,333
<p>Suppose assembly Assembly1.dll contains 3 classes: Class C1, C2, C3.</p> <p>I want to expose only class C1 to the outside world. Classes C2 and C3 will not be accessible. How to acheive this? </p> <p>Note: Making classes C2 and C3 private is not an option as this will make them unaccessible inside the assembly its...
[ { "answer_id": 483335, "author": "Vojislav Stojkovic", "author_id": 58099, "author_profile": "https://Stackoverflow.com/users/58099", "pm_score": 5, "selected": true, "text": "<p>Make classes C2 and C3 internal, as in:</p>\n\n<pre><code>internal class C2\n{\n//...\n}\n</code></pre>\n" ...
2009/01/27
[ "https://Stackoverflow.com/questions/483333", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59326/" ]
Suppose assembly Assembly1.dll contains 3 classes: Class C1, C2, C3. I want to expose only class C1 to the outside world. Classes C2 and C3 will not be accessible. How to acheive this? Note: Making classes C2 and C3 private is not an option as this will make them unaccessible inside the assembly itself.
Make classes C2 and C3 internal, as in: ``` internal class C2 { //... } ```
483,337
<p>Can I make an assumption that given</p> <pre><code>std::string str; ... // do something to str </code></pre> <p>Is the following statement is always true?</p> <pre><code>(str.empty() == (str == "")) </code></pre>
[ { "answer_id": 483361, "author": "A. Rex", "author_id": 3508, "author_profile": "https://Stackoverflow.com/users/3508", "pm_score": 6, "selected": false, "text": "<h3>Answer</h3>\n\n<p>Yes. Here is the relevant implementation from <code>bits/basic_string.h</code>, the code for <code>bas...
2009/01/27
[ "https://Stackoverflow.com/questions/483337", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59320/" ]
Can I make an assumption that given ``` std::string str; ... // do something to str ``` Is the following statement is always true? ``` (str.empty() == (str == "")) ```
### Answer Yes. Here is the relevant implementation from `bits/basic_string.h`, the code for `basic_string<_CharT, _Traits, _Alloc>`: ``` /** * Returns true if the %string is empty. Equivalent to *this == "". */ bool empty() const { return this->size() == 0; } ``` ### Discussion Even though the two...
483,341
<p>I've managed to find the Regex to get almost the result I want here i.e.</p> <pre><code>Regex r1 = new Regex(@"\[(.*?)\]"); string row = HEADERNAMES[COL1,COL2,COL3,COL4]; Match match = r1.Match(row); string result = match.ToString(); </code></pre> <p>Outputs: "[COL1,COL2,COL3,COL4]";</p> <p>I know I can then use:...
[ { "answer_id": 483362, "author": "aku", "author_id": 1196, "author_profile": "https://Stackoverflow.com/users/1196", "pm_score": 4, "selected": true, "text": "<pre><code>Regex r1 = new Regex(@\"\\[(.+)\\]\");\nstring row = \"HEADERNAMES[COL1, COL2, COL3, COL4]\";\n// Regex puts capture g...
2009/01/27
[ "https://Stackoverflow.com/questions/483341", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I've managed to find the Regex to get almost the result I want here i.e. ``` Regex r1 = new Regex(@"\[(.*?)\]"); string row = HEADERNAMES[COL1,COL2,COL3,COL4]; Match match = r1.Match(row); string result = match.ToString(); ``` Outputs: "[COL1,COL2,COL3,COL4]"; I know I can then use: ``` result.Replace("[", ""); re...
``` Regex r1 = new Regex(@"\[(.+)\]"); string row = "HEADERNAMES[COL1, COL2, COL3, COL4]"; // Regex puts capture groups (i.e. things captured between ( and ) ) // in Groups collection string match = r1.Match(row).Groups[1].Value; //match = "COL1, COL2, COL3, COL4" ```
483,348
<p>Does anyone know of a Java library that handles finding sentence boundaries? I'm thinking that it would be a smart StringTokenizer implementation that knows about all of the sentence terminators that languages can use.</p> <p>Here's my experience with BreakIterator:</p> <p>Using the example <a href="http://java.su...
[ { "answer_id": 483357, "author": "GaryF", "author_id": 1035, "author_profile": "https://Stackoverflow.com/users/1035", "pm_score": 2, "selected": false, "text": "<p>You want to look into the internationalized BreakIterator classes. A good starting point for <a href=\"http://java.sun.com/...
2009/01/27
[ "https://Stackoverflow.com/questions/483348", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16534/" ]
Does anyone know of a Java library that handles finding sentence boundaries? I'm thinking that it would be a smart StringTokenizer implementation that knows about all of the sentence terminators that languages can use. Here's my experience with BreakIterator: Using the example [here](http://java.sun.com/docs/books/tu...
You wrote: > > I'm thinking that it would be a smart StringTokenizer implementation that knows about all of the sentence terminators that languages can use. > > > A basic problem here is that sentence terminators depend on the context, consider: > > How did Dr. Jones compute 5! without recursion? > > > This...
483,359
<p>I remembered someone telling me one good one. But i cannot remember it. I spent the last 20mins with google trying to learn more.</p> <p>What are examples of bad/not great code that causes a performance hit due to garbage collection ?</p>
[ { "answer_id": 483370, "author": "Lemmy", "author_id": 58598, "author_profile": "https://Stackoverflow.com/users/58598", "pm_score": 0, "selected": false, "text": "<p>One example would be object references that are kept in member variables oder static variables. Here is an example:</p>\n...
2009/01/27
[ "https://Stackoverflow.com/questions/483359", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I remembered someone telling me one good one. But i cannot remember it. I spent the last 20mins with google trying to learn more. What are examples of bad/not great code that causes a performance hit due to garbage collection ?
from an old [sun tech tip](http://java.sun.com/developer/TechTips/1997/tt0903.html#tip2) -- sometimes it helps to explicitly nullify references in order to make them eligible for garbage collection earlier: ``` public class Stack { private static final int MAXLEN = 10; private Object stk[] = new Object[MAXLEN]; ...
483,419
<p>I have a WPF dialog with a couple of textboxes on it. Textboxes are bound to my business object and have WPF validation rules attached.</p> <p>The problem is that user can perfectly click 'OK' button and close the dialog, without actually entering the data into textboxes. Validation rules never fire, since user did...
[ { "answer_id": 496871, "author": "Robert Macnee", "author_id": 19273, "author_profile": "https://Stackoverflow.com/users/19273", "pm_score": 7, "selected": true, "text": "<p>We have this issue in our application as well. The validation only fires when bindings update, so you have to upd...
2009/01/27
[ "https://Stackoverflow.com/questions/483419", "https://Stackoverflow.com", "https://Stackoverflow.com/users/430254/" ]
I have a WPF dialog with a couple of textboxes on it. Textboxes are bound to my business object and have WPF validation rules attached. The problem is that user can perfectly click 'OK' button and close the dialog, without actually entering the data into textboxes. Validation rules never fire, since user didn't even a...
We have this issue in our application as well. The validation only fires when bindings update, so you have to update them by hand. We do this in the Window's [Loaded](http://msdn.microsoft.com/en-us/library/system.windows.frameworkelement.loaded(VS.95).aspx) event: ``` public void Window_Loaded(object sender, RoutedEv...
483,420
<p>In javascript I have an array as follows: </p> <pre><code>var foo = [2, 2, 4, 4, 128, 2, 2, 1, 4, 18, 27, 16, 2, 1, 18, 21, 5, 1, 128, 1, 2, 2, 1, 18, 12, 60, 2, 28, 1, 17, 2, 3, 4, 2, 2, 2, 1, 27, 2, 17, 7, 2, 2, 2, 5, 1, 2, 4, 7, 1, 2, 1, 1, 1, 2, 1, 5, 7, 2, 7, 6, 1, 7, 1, 5, 8, 4]; </code></pre> <p>And I am in...
[ { "answer_id": 483479, "author": "Christoph", "author_id": 48015, "author_profile": "https://Stackoverflow.com/users/48015", "pm_score": 1, "selected": false, "text": "<p>Here's the de-bugged version of my previous answer using an index table. I did a little benchmarking and for the inpu...
2009/01/27
[ "https://Stackoverflow.com/questions/483420", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52175/" ]
In javascript I have an array as follows: ``` var foo = [2, 2, 4, 4, 128, 2, 2, 1, 4, 18, 27, 16, 2, 1, 18, 21, 5, 1, 128, 1, 2, 2, 1, 18, 12, 60, 2, 28, 1, 17, 2, 3, 4, 2, 2, 2, 1, 27, 2, 17, 7, 2, 2, 2, 5, 1, 2, 4, 7, 1, 2, 1, 1, 1, 2, 1, 5, 7, 2, 7, 6, 1, 7, 1, 5, 8, 4]; ``` And I am interested in finding a way ...
My previous answer used a reverse index table, but contained some bugs - which are now fixed - and was harder to understand than the following code. This is actually the slowest of all solutions given in the answers - for maximum performance, check my other answer. ``` var foo = [2, 2, 4, 4, 128, 2, 2, 1, 4, 18, 27, ...
483,428
<p>I am trying to decide if a string is a number in Ruby. This is my code</p> <pre><code>whatAmI = "32.3a22" puts "This is always false " + String(whatAmI.is_a?(Fixnum)); isNum = false; begin Float(whatAmI) isNum = true; rescue Exception =&gt; e puts "What does Ruby say? " + e isNum = false; end puts isNum </c...
[ { "answer_id": 483450, "author": "dylanfm", "author_id": 38795, "author_profile": "https://Stackoverflow.com/users/38795", "pm_score": 2, "selected": false, "text": "<p>I don't know about the <code>can_convert</code> method, but generally a class will define methods like <code>to_s</code...
2009/01/27
[ "https://Stackoverflow.com/questions/483428", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8047/" ]
I am trying to decide if a string is a number in Ruby. This is my code ``` whatAmI = "32.3a22" puts "This is always false " + String(whatAmI.is_a?(Fixnum)); isNum = false; begin Float(whatAmI) isNum = true; rescue Exception => e puts "What does Ruby say? " + e isNum = false; end puts isNum ``` I realize that...
You've got the right idea. It can be done a little more compactly, though: ``` isNum = Float(whatAmI) rescue nil ``` Inlining "rescue" is great fun. Parenthesize the part you're rescuing if you put it in the middle of more stuff, like: ``` if (isNum = Float(whatAmI) rescue nil) && isNum > 20 ... ```
483,429
<p>I am looking for ways to find matching patterns in lists or arrays of strings, specifically in .NET, but algorithms or logic from other languages would be helpful. </p> <p>Say I have 3 arrays (or in this specific case List(Of String)) </p> <pre><code>Array1 "Do" "Re" "Mi" "Fa" "So" "La" "Ti" Array2 "Mi" "Fa" "Jim...
[ { "answer_id": 483474, "author": "Tobias Wärre", "author_id": 21097, "author_profile": "https://Stackoverflow.com/users/21097", "pm_score": 1, "selected": false, "text": "<p>Looks like you want to use an intersection function on sets of data. Intersection picks out elements that are comm...
2009/01/27
[ "https://Stackoverflow.com/questions/483429", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16391/" ]
I am looking for ways to find matching patterns in lists or arrays of strings, specifically in .NET, but algorithms or logic from other languages would be helpful. Say I have 3 arrays (or in this specific case List(Of String)) ``` Array1 "Do" "Re" "Mi" "Fa" "So" "La" "Ti" Array2 "Mi" "Fa" "Jim" "Bob" "So" Array3 ...
As others have mentioned the function you want is Intersect. If you are using .NET 3.0 consider using LINQ's Intersect function. See [the following post for more information](http://blogs.conchango.com/simonmunro/archive/2008/10/23/12904.aspx) Consider using LinqPAD to experiment. [www.linqpad.net](http://www.linqpa...
483,436
<p>All </p> <p>I wish to call the svnlook commandline from my MSbuild script using the Exec command, however all the documentation I have read seems to indicate that this can only be run on the machine holding the repository itself (i.e. the server.) </p> <p>Does anyone know how I can access this functionality from t...
[ { "answer_id": 484168, "author": "Stefan", "author_id": 48003, "author_profile": "https://Stackoverflow.com/users/48003", "pm_score": 3, "selected": true, "text": "<p>svnlook works directly on the repository database. That database is not available on the client computer (usually, unless...
2009/01/27
[ "https://Stackoverflow.com/questions/483436", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11802/" ]
All I wish to call the svnlook commandline from my MSbuild script using the Exec command, however all the documentation I have read seems to indicate that this can only be run on the machine holding the repository itself (i.e. the server.) Does anyone know how I can access this functionality from the client machine...
svnlook works directly on the repository database. That database is not available on the client computer (usually, unless you access the repository via file:///). So there's no way to use svnlook. You can get most information with the svn client. you didn't mention what information you want exactly, but I suggest usi...
483,535
<p>We've got a weird problem with joining tables from SQL Server 2005 and MS Access 2003.</p> <p>There's a big table on the server and a rather small table locally in Access. The tables are joined via 3 fields, one of them a datetime field (containing a day; idea is to fetch additional data (daily) from the big server...
[ { "answer_id": 483586, "author": "SQLMenace", "author_id": 740, "author_profile": "https://Stackoverflow.com/users/740", "pm_score": 0, "selected": false, "text": "<p>Please post the query that is doing this, just because you have indexes doesn't mean that they will be used. If your <cod...
2009/01/27
[ "https://Stackoverflow.com/questions/483535", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
We've got a weird problem with joining tables from SQL Server 2005 and MS Access 2003. There's a big table on the server and a rather small table locally in Access. The tables are joined via 3 fields, one of them a datetime field (containing a day; idea is to fetch additional data (daily) from the big server table to ...
Thanks for your quick answer! The actual query is really huge; you won't be happy with it :) However, we've narrowed it down to a simple: ``` SELECT * FROM server_table INNER JOIN access_table ON server_table.date = local_table.date; ``` If the server\_table is a big table (hard to say, we've got 1.5 million rows ...
483,538
<p>Assume we have a method like this:</p> <pre><code>public IEnumerable&lt;T&gt; FirstMethod() { var entities = from t in context.Products where {some conditions} select t; foreach( var entity in entities ) { entity.SomeProperty = {SomeValue}; yield re...
[ { "answer_id": 483554, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 4, "selected": true, "text": "<p>The latter (deferred); <code>FirstMethod</code> is an iterator block (because of <code>yield return</code>); this m...
2009/01/27
[ "https://Stackoverflow.com/questions/483538", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34623/" ]
Assume we have a method like this: ``` public IEnumerable<T> FirstMethod() { var entities = from t in context.Products where {some conditions} select t; foreach( var entity in entities ) { entity.SomeProperty = {SomeValue}; yield return entity; ...
The latter (deferred); `FirstMethod` is an iterator block (because of `yield return`); this means that you have a chain of iterators. Nothing is read until the **final caller** starts iterating the data; then each record is read in turn during the **final caller's** `foreach` (between which the connection/command is op...
483,542
<p>I have a databound and itemtemplated ListBox:</p> <pre><code>&lt;ListBox x:Name="lbLista" ScrollViewer.VerticalScrollBarVisibility="Visible"&gt; &lt;ListBox.ItemTemplate&gt; &lt;DataTemplate&gt; &lt;StackPanel Orientation="Horizontal"&gt; &lt;CheckBox IsChecked="{Binding Delete...
[ { "answer_id": 483612, "author": "Muad'Dib", "author_id": 49910, "author_profile": "https://Stackoverflow.com/users/49910", "pm_score": 6, "selected": true, "text": "<p>I pasted your code into test project, added about 20 items and I get usable scroll bars, no problem, and they work as e...
2009/01/27
[ "https://Stackoverflow.com/questions/483542", "https://Stackoverflow.com", "https://Stackoverflow.com/users/54155/" ]
I have a databound and itemtemplated ListBox: ``` <ListBox x:Name="lbLista" ScrollViewer.VerticalScrollBarVisibility="Visible"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Orientation="Horizontal"> <CheckBox IsChecked="{Binding Deleteable, Mode=TwoWay}" /> <Label C...
I pasted your code into test project, added about 20 items and I get usable scroll bars, no problem, and they work as expected. When I only add a couple items (such that scrolling is unnecessary) I get no usable scrollbar. Could this be the case? that you are not adding enough items? If you remove the `ScrollViewer.Ve...
483,545
<p>I have a simple form on a view page, implemented as a user control, that looks something like this:</p> <pre><code>&lt;%=Html.BeginForm("List", "Building", FormMethod.Post) %&gt; //several fields go here &lt;%Html.EndForm(); %&gt; </code></pre> <p>There are two problems I would like resolved, the first is that I...
[ { "answer_id": 483598, "author": "Craig Stuntz", "author_id": 7714, "author_profile": "https://Stackoverflow.com/users/7714", "pm_score": 4, "selected": true, "text": "<p>1) Use FormCollection as the argument:</p>\n\n<pre><code>public ActionResult List(FormCollection searchQuery)\n</code...
2009/01/27
[ "https://Stackoverflow.com/questions/483545", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13139/" ]
I have a simple form on a view page, implemented as a user control, that looks something like this: ``` <%=Html.BeginForm("List", "Building", FormMethod.Post) %> //several fields go here <%Html.EndForm(); %> ``` There are two problems I would like resolved, the first is that I would like the controller method that...
1) Use FormCollection as the argument: ``` public ActionResult List(FormCollection searchQuery) ``` Now you can iterate the FormCollection and get key/value search terms from your search form. 2) Remove the "=" from BeginForm: ``` <% Html.BeginForm("List", "Building", FormMethod.Post) %> ``` That said, you [shou...
483,568
<p>I'd like to automate the script generation in SQL Server Management Studio 2008.</p> <p>Right now what I do is :</p> <ul> <li>Right click on my database, Tasks, "Generate Scripts..."</li> <li>manually select all the export options I need, and hit select all on the "select object" tab</li> <li>Select the export fol...
[ { "answer_id": 483585, "author": "John Sheehan", "author_id": 1786, "author_profile": "https://Stackoverflow.com/users/1786", "pm_score": 3, "selected": false, "text": "<p>In Tools > Options > Designers > Table and Database Designers there's an option for 'Auto generate change scripts' t...
2009/01/27
[ "https://Stackoverflow.com/questions/483568", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47341/" ]
I'd like to automate the script generation in SQL Server Management Studio 2008. Right now what I do is : * Right click on my database, Tasks, "Generate Scripts..." * manually select all the export options I need, and hit select all on the "select object" tab * Select the export folder * Eventually hit the "Finish" b...
What Brann is mentioning from the Visual Studio 2008 SP1 Team Suite is version 1.4 of the Database Publishing Wizard. It's installed with sql server 2008 (maybe only professional?) to \Program Files\Microsoft SQL Server\90\Tools\Publishing\1.4. The VS call from server explorer is simply calling this. You can achieve th...
483,574
<p>Could you please tip how to properly name object construction approach where public proprieties values are being set on object creation?</p> <p>For example,</p> <pre><code>SqlCommand command = new SqlCommand { Connection = connection, CommandType = CommandType.Text }; </code></pre>
[ { "answer_id": 483582, "author": "Jason Punyon", "author_id": 6212, "author_profile": "https://Stackoverflow.com/users/6212", "pm_score": 4, "selected": true, "text": "<p>I believe these are called Object Initializers...</p>\n" }, { "answer_id": 483600, "author": "Arcturus", ...
2009/01/27
[ "https://Stackoverflow.com/questions/483574", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41956/" ]
Could you please tip how to properly name object construction approach where public proprieties values are being set on object creation? For example, ``` SqlCommand command = new SqlCommand { Connection = connection, CommandType = CommandType.Text }; ```
I believe these are called Object Initializers...
483,579
<p>I am displaying the contents of a datetime field in mysql in a table with php, and want to show just the date. Is there a way to convert or do this, or must the actual string be editied or trimmed?</p>
[ { "answer_id": 483603, "author": "Paul Dixon", "author_id": 6521, "author_profile": "https://Stackoverflow.com/users/6521", "pm_score": 3, "selected": true, "text": "<h2>Using strtotime...</h2>\n\n<p>A simple way is like this:</p>\n\n<pre><code>$date=\"2009-01-27 14:30:22\";\necho strfti...
2009/01/27
[ "https://Stackoverflow.com/questions/483579", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1246613/" ]
I am displaying the contents of a datetime field in mysql in a table with php, and want to show just the date. Is there a way to convert or do this, or must the actual string be editied or trimmed?
Using strtotime... ------------------ A simple way is like this: ``` $date="2009-01-27 14:30:22"; echo strftime("%d %m %Y", strtotime($date)); ``` i.e. turn your mysql date into a time value with [strtotime](http://php.net/strtotime), then reformat it with [strftime](http://php.net/strftime). However this only wor...
483,591
<p>I have written some code that works pretty well, but I have a strange bug Here is an example...</p> <hr> <h2><strong><a href="http://vimeo.com/3112710" rel="nofollow noreferrer">PLEASE WATCH MY COMBOBOX BUG VIDEO</a></strong></h2> <hr> <p>Like I said, this works well every time datachanged fires - the right inde...
[ { "answer_id": 521725, "author": "Steve -Cutter- Blades", "author_id": 63437, "author_profile": "https://Stackoverflow.com/users/63437", "pm_score": 0, "selected": false, "text": "<p>First, the Ext JS combobox should automatically apply the value and display when an item is selected, bar...
2009/01/27
[ "https://Stackoverflow.com/questions/483591", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59350/" ]
I have written some code that works pretty well, but I have a strange bug Here is an example... --- **[PLEASE WATCH MY COMBOBOX BUG VIDEO](http://vimeo.com/3112710)** ------------------------------------------------------------------ --- Like I said, this works well every time datachanged fires - the right index is...
It's probably because when you type random data into combo, it may not locate correct fieldValue every time. Then it *stucks* at the last non-existing value. Try to set ComboBox to any *existing* value (in combo's datastore) before doing new setValue() in your datachanged event handler. Or you can try to use clearValu...