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
442,138
<p>Let's say I have a editor template (which inserts some arbitrary snippet of code) defined in my editor preferences.</p> <p>I'd like to access that template programmatically. How do I do this?</p> <p>I know the classes TemplateStore, TemplatePreferencesPage, and TemplatePersistentData exist, but I haven't been abl...
[ { "answer_id": 442212, "author": "VonC", "author_id": 6309, "author_profile": "https://Stackoverflow.com/users/6309", "pm_score": 3, "selected": false, "text": "<p>May be this <a href=\"http://kickjava.com/src/org/eclipse/jdt/internal/ui/JavaPlugin.java.htm\" rel=\"nofollow noreferrer\">...
2009/01/14
[ "https://Stackoverflow.com/questions/442138", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2288585/" ]
Let's say I have a editor template (which inserts some arbitrary snippet of code) defined in my editor preferences. I'd like to access that template programmatically. How do I do this? I know the classes TemplateStore, TemplatePreferencesPage, and TemplatePersistentData exist, but I haven't been able to put them tog...
May be this [`JavaPlugin` class](http://kickjava.com/src/org/eclipse/jdt/internal/ui/JavaPlugin.java.htm) (within `org.eclipse.jdt.internal.ui` package of eclipse) may provide you with a first lead to follow. ``` /** * Returns the template store for the code generation templates. * * @return the template store ...
442,139
<p>I need to have a windows executable for some code which was written in 1994 for UNIX. I tried to do this from cygwin environment. The C++ standard was changed from this time and the standard libraries too.</p> <p>I tried to use -std= and -traditional-cpp options, but that options didn't helped me at all. I also fou...
[ { "answer_id": 442237, "author": "Jonathan Leffler", "author_id": 15168, "author_profile": "https://Stackoverflow.com/users/15168", "pm_score": 1, "selected": false, "text": "<p>The C code in library (library/linpack and library/recipes) compiles fine using:</p>\n\n<pre><code>gcc -c *.c\...
2009/01/14
[ "https://Stackoverflow.com/questions/442139", "https://Stackoverflow.com", "https://Stackoverflow.com/users/53481/" ]
I need to have a windows executable for some code which was written in 1994 for UNIX. I tried to do this from cygwin environment. The C++ standard was changed from this time and the standard libraries too. I tried to use -std= and -traditional-cpp options, but that options didn't helped me at all. I also found that -f...
The C code in library (library/linpack and library/recipes) compiles fine using: ``` gcc -c *.c ``` The C++ code is more problematic. There are headers in ../include and they require -DANSI to yield function prototypes. They are not declared `extern "C"` in the headers; they are included correctly in the headers in ...
442,144
<p>I am using CGI::Application on mod_perl with DBIx::Class and I'd like to have something like new define a new dbic schema on instantiation. So far I haven't been able to get it to work. The closest thing I have come to is a superclass that has a connect() method that returns a new object, but I would rather it b...
[ { "answer_id": 833434, "author": "Penfold", "author_id": 11952, "author_profile": "https://Stackoverflow.com/users/11952", "pm_score": 0, "selected": false, "text": "<p>I don't have a single answer, but <a href=\"http://lists.scsys.co.uk/pipermail/dbix-class/2006-June/001690.html\" rel=\...
2009/01/14
[ "https://Stackoverflow.com/questions/442144", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12448/" ]
I am using CGI::Application on mod\_perl with DBIx::Class and I'd like to have something like new define a new dbic schema on instantiation. So far I haven't been able to get it to work. The closest thing I have come to is a superclass that has a connect() method that returns a new object, but I would rather it be alre...
Of course you can't serialise a database connection into a session file or whatever, and you can't create it before apache forks, but you can keep one live per child process. An option for creating it ahead of time is to do it in your base mod\_perl handler sub, but since the client connection has already started at t...
442,155
<p>I would like to do the following but I don't think this will work:</p> <pre><code>.OrderByDescending(s =&gt; Score(s)), ... private double Score(Story s) { DateTime now = DateTime.Now; TimeSpan elapsed = now.Subtract(s.PostedOn); double daysAgo = elapsed.TotalDays; ...
[ { "answer_id": 442219, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 4, "selected": true, "text": "<p>Yes, that should work if the sequence is a sequence of <code>Story</code> items; what problem are you having? Note ...
2009/01/14
[ "https://Stackoverflow.com/questions/442155", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I would like to do the following but I don't think this will work: ``` .OrderByDescending(s => Score(s)), ... private double Score(Story s) { DateTime now = DateTime.Now; TimeSpan elapsed = now.Subtract(s.PostedOn); double daysAgo = elapsed.TotalDays; return s....
Yes, that should work if the sequence is a sequence of `Story` items; what problem are you having? Note that if `Score` doesn't apply to any instance, it might be worth making it static. Another option is to make the Score() method an instance method on a `Story`, or an extension method. Note that this only applies t...
442,159
<p>The Data in my DataTable is like</p> <pre><code>ID ContactName1 Designation1 ContactName2 Designation2 1 A dummy B sam </code></pre> <p>The Table structure of my Table is</p> <pre><code>ID ContactName Designation </code></pre> <p>I am passing the values in the stored procedure as...
[ { "answer_id": 442203, "author": "David", "author_id": 49460, "author_profile": "https://Stackoverflow.com/users/49460", "pm_score": 3, "selected": true, "text": "<p>Assuming your ID primary key is set on auto-increment, and your table has three fields:</p>\n\n<pre><code>INSERT INTO Data...
2009/01/14
[ "https://Stackoverflow.com/questions/442159", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
The Data in my DataTable is like ``` ID ContactName1 Designation1 ContactName2 Designation2 1 A dummy B sam ``` The Table structure of my Table is ``` ID ContactName Designation ``` I am passing the values in the stored procedure as: ``` @ContactName1 @Designation1 @ContactName2...
Assuming your ID primary key is set on auto-increment, and your table has three fields: ``` INSERT INTO DataTable (ContactName, Designation) VALUES (@ContactName1, @Designation1), (@ContactName2, @Designation2); ``` As per the actual ID, if you don't have it on auto-increment, which judging from the commen...
442,164
<p>I just want a simple SVG image that has some arbitrary text on an angle, which I can do. Thing is, I also want the text to have a sort of "outline" effect. Like rather than a solid D, the inside and outside edges of the letter D are drawn with a line of a specified thickness and the rest of the D isn't drawn at al...
[ { "answer_id": 442172, "author": "Xn0vv3r", "author_id": 42475, "author_profile": "https://Stackoverflow.com/users/42475", "pm_score": 6, "selected": true, "text": "<p>Yes it can ;-)</p>\n\n<p>I tried to realize that with <a href=\"http://www.inkscape.org\" rel=\"noreferrer\">Inkscape</a...
2009/01/14
[ "https://Stackoverflow.com/questions/442164", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18393/" ]
I just want a simple SVG image that has some arbitrary text on an angle, which I can do. Thing is, I also want the text to have a sort of "outline" effect. Like rather than a solid D, the inside and outside edges of the letter D are drawn with a line of a specified thickness and the rest of the D isn't drawn at all, so...
Yes it can ;-) I tried to realize that with [Inkscape](http://www.inkscape.org) and then edited the source of the svg-File. Just don't fill it and use a stroke with color and width to draw it. I got that: ```html <text x="100" y="100" id="text2383" xml:space="preserve" style="font-size:56px;font-style:normal;font-wei...
442,166
<p>I am developing an application with mod<code>_</code>perl and restarting the server every time I change code is a huge drag. I'd like to still use mod<code>_</code>perl for development because it's what I plan on using for the live server. I didn't see anything in the documentation about how to do this.</p> <p>Th...
[ { "answer_id": 442177, "author": "David", "author_id": 49460, "author_profile": "https://Stackoverflow.com/users/49460", "pm_score": 4, "selected": true, "text": "<p>I think Apache2::Reload will somewhat accomplish what you're looking for. However, remember to delete all this implementa...
2009/01/14
[ "https://Stackoverflow.com/questions/442166", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12448/" ]
I am developing an application with mod`_`perl and restarting the server every time I change code is a huge drag. I'd like to still use mod`_`perl for development because it's what I plan on using for the live server. I didn't see anything in the documentation about how to do this. Thoughts?
I think Apache2::Reload will somewhat accomplish what you're looking for. However, remember to delete all this implementation once you're ready to put the app in production. **Monitor All Modules in %INC** To monitor and reload all modules in %INC at the beginning of request's processing, simply add the following con...
442,174
<p>This is what I am trying to do</p> <pre> <code> Declare @Var varchar(50) Declare @Num1 varchar(50) Declare @Num2 varchar(50) Declare @Counter smallint Set @Counter=1 Set @Num1='Hello' Set @Num2='Hi' while (@Counter&lt;2) begin Set @Var=N'@Num'+convert(varchar,@Counter) //Now I want to get the value of '@...
[ { "answer_id": 442180, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 1, "selected": false, "text": "<p>AFAIK, you can't do that directly; anything wrong with something like:</p>\n\n<pre><code>SET @Var = SELECT CASE @C...
2009/01/14
[ "https://Stackoverflow.com/questions/442174", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
This is what I am trying to do ``` Declare @Var varchar(50) Declare @Num1 varchar(50) Declare @Num2 varchar(50) Declare @Counter smallint Set @Counter=1 Set @Num1='Hello' Set @Num2='Hi' while (@Counter<2) begin Set @Var=N'@Num'+convert(varchar,@Counter) //Now I want to get the value of '@Num1' that is stored...
This is not a very elegant solution to your problem but at least it solves it :) ``` Declare @Var varchar(50) Declare @Num1 varchar(50) Declare @Num2 varchar(50) Declare @Counter smallint Declare @text varchar(50) Set @Counter=1 Set @Num1='Hello' Set @Num2='Hi' while (@Counter<3) begin SET @text = CA...
442,176
<p>I have a sketch that I want to put up on my website, and I also intend to write a short play at some point which I'd also want to make freely available.</p> <p>I'm trying to work out the best way of representing this in HTML. I basically need two columns - one for the character speaking, and one for the text. Each ...
[ { "answer_id": 442192, "author": "chaos", "author_id": 47529, "author_profile": "https://Stackoverflow.com/users/47529", "pm_score": 2, "selected": false, "text": "<p>IMO that actually is tabular data. First column is speaker, second column is text.</p>\n\n<p>If you want to be fashionab...
2009/01/14
[ "https://Stackoverflow.com/questions/442176", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22656/" ]
I have a sketch that I want to put up on my website, and I also intend to write a short play at some point which I'd also want to make freely available. I'm trying to work out the best way of representing this in HTML. I basically need two columns - one for the character speaking, and one for the text. Each speech obv...
I second the heresy :-) Always good to consider CSS before resorting to tables - but often tables really are the best fit. It looks like it in this case. The only additional consideration would be accessibility. I've heard that tables make it harder for text reader software to process tables, but I don't see why this...
442,216
<p>If I were to implement a web application from scratch today, which app stack should I go for? Three main candidates are java, python and Ruby on Rails (RoR). There is also .NET, but its biased towards M$. </p> <p>Pro-java:</p> <pre><code>1) Stacks of thick books 2) Largest developer community 3) Typed languages, w...
[ { "answer_id": 442227, "author": "Swaroop C H", "author_id": 4869, "author_profile": "https://Stackoverflow.com/users/4869", "pm_score": 6, "selected": true, "text": "<p>Pick which is familiar to you and run with it.</p>\n\n<p>Or you can pick <a href=\"http://docs.djangoproject.com/en/de...
2009/01/14
[ "https://Stackoverflow.com/questions/442216", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19501/" ]
If I were to implement a web application from scratch today, which app stack should I go for? Three main candidates are java, python and Ruby on Rails (RoR). There is also .NET, but its biased towards M$. Pro-java: ``` 1) Stacks of thick books 2) Largest developer community 3) Typed languages, which prevents subtle ...
Pick which is familiar to you and run with it. Or you can pick [Django on Jython](http://docs.djangoproject.com/en/dev/howto/jython/) to get best of Java libraries and Python's speed-coding. Or pick Java if you need to convince somebody that it is enterprise-y. I would say if you're working alone / in a small team, ...
442,218
<p>Let me illustrate this question with an example:</p> <pre><code>import numpy matrix = numpy.identity(5, dtype=bool) #Using identity as a convenient way to create an array with the invariant that there will only be one True value per row, the solution should apply to any array with this invariant base = numpy.arang...
[ { "answer_id": 442231, "author": "saffsd", "author_id": 37984, "author_profile": "https://Stackoverflow.com/users/37984", "pm_score": 0, "selected": false, "text": "<p>Here is another ugly way of doing it:</p>\n\n<pre><code>n.apply_along_axis(base.__getitem__, 0, matrix).reshape((5,1))\n...
2009/01/14
[ "https://Stackoverflow.com/questions/442218", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37984/" ]
Let me illustrate this question with an example: ``` import numpy matrix = numpy.identity(5, dtype=bool) #Using identity as a convenient way to create an array with the invariant that there will only be one True value per row, the solution should apply to any array with this invariant base = numpy.arange(5,30,5) #Thi...
If I understand your question correctly you can simply use matrix multiplication: ``` result = numpy.dot(matrix, base) ``` If the result must have the same shape as in your example just add a reshape: ``` result = numpy.dot(matrix, base).reshape((5,1)) ``` If the matrix is not symmetric be careful about the order...
442,230
<p>I've encountered some errors when I tried to install an artifact manually with Maven 2. I wanted to install a jar from a local directory with the command</p> <pre><code>mvn install:install-file -Dfile=jta-1.0.1B.jar </code></pre> <p>But Maven gave a build error which reads like:</p> <pre><code>Invalid task '.01B....
[ { "answer_id": 442243, "author": "Romain Linsolas", "author_id": 26457, "author_profile": "https://Stackoverflow.com/users/26457", "pm_score": 8, "selected": true, "text": "<p>You need to indicate the groupId, the artifactId and the version for your artifact:</p>\n\n<pre><code>mvn instal...
2009/01/14
[ "https://Stackoverflow.com/questions/442230", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11927/" ]
I've encountered some errors when I tried to install an artifact manually with Maven 2. I wanted to install a jar from a local directory with the command ``` mvn install:install-file -Dfile=jta-1.0.1B.jar ``` But Maven gave a build error which reads like: ``` Invalid task '.01B.jar': you must specify a valid lifecy...
You need to indicate the groupId, the artifactId and the version for your artifact: ``` mvn install:install-file \ -DgroupId=javax.transaction \ -DartifactId=jta \ -Dpackaging=jar \ -Dversion=1.0.1B \ -Dfile=jta-1.0.1B.jar \ -DgeneratePom=true ```
442,235
<p>There are multiple places in an application which call XmlWriter.Create on the same file, all accessed through the following function. When one calls while another is still writing, I get an IOException. What's the best way to lock or synchronize access?</p> <p>Here's the function that's being used:</p> <pre><code...
[ { "answer_id": 442246, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 2, "selected": false, "text": "<p>A static lock should do the job quickly and simply:</p>\n\n<pre><code>private static readonly object syncLock = ne...
2009/01/14
[ "https://Stackoverflow.com/questions/442235", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5/" ]
There are multiple places in an application which call XmlWriter.Create on the same file, all accessed through the following function. When one calls while another is still writing, I get an IOException. What's the best way to lock or synchronize access? Here's the function that's being used: ``` public void ...
Using a lock can solve your concurrency problem and thus avoid the IOException, but you must remember to use the same object either on SaveToDisk and ReadFromDisk (i assume this is the reading function), otherwise it's totally useless to lock only when you read. ``` private static readonly object syncLock = new object...
442,245
<p>In AS3 you have a function on a string with this signature:</p> <pre><code>function replace(pattern:*, repl:Object):String </code></pre> <p>The repl:Object can also specify a function. If you specify a function, the string returned by the function is inserted in place of the matching content.</p> <p>Also, is it ...
[ { "answer_id": 442253, "author": "Konrad Rudolph", "author_id": 1968, "author_profile": "https://Stackoverflow.com/users/1968", "pm_score": 4, "selected": true, "text": "<p>In order to do this in C#, use <code>System.Text.RegularExpressions.Regex.Replace()</code> which takes a callback.<...
2009/01/14
[ "https://Stackoverflow.com/questions/442245", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26521/" ]
In AS3 you have a function on a string with this signature: ``` function replace(pattern:*, repl:Object):String ``` The repl:Object can also specify a function. If you specify a function, the string returned by the function is inserted in place of the matching content. Also, is it possible to get the the original ...
In order to do this in C#, use `System.Text.RegularExpressions.Regex.Replace()` which takes a callback.
442,265
<p>I am creating a class that determines which of number of registered WCF client callbacks to call. When a client registers with the server, it supplies the token it is interested in. The class then stores a mapping of token to IClientCallback interface for that token, in a Dictionary.</p> <p>The method and it's cl...
[ { "answer_id": 442282, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 3, "selected": true, "text": "<p>Well, why do you care what the contents of the dictionary is? If you've injected it then you may well care - but at th...
2009/01/14
[ "https://Stackoverflow.com/questions/442265", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5691/" ]
I am creating a class that determines which of number of registered WCF client callbacks to call. When a client registers with the server, it supplies the token it is interested in. The class then stores a mapping of token to IClientCallback interface for that token, in a Dictionary. The method and it's class under te...
Well, why do you care what the contents of the dictionary is? If you've injected it then you may well care - but at that point it's part of the API. If you can do without the constructor taking a dictionary, then just test the actual *effects* of the dictionary's contents. So, if you call Register twice for the same t...
442,269
<p>I am using jQuery $.load() function to get content from server. the loaded content contain this:</p> <pre><code>&lt;p id="p1"&gt;123&lt;/p&gt; &lt;script&gt; $(document).ready(function(){ $('#p1').html('ABC'); alert($('#p1').html()); }); &lt;/script&gt; </code></pre> <p>changing text of paragraph ...
[ { "answer_id": 442288, "author": "rz.", "author_id": 7407, "author_profile": "https://Stackoverflow.com/users/7407", "pm_score": 2, "selected": false, "text": "<p>I think your selector is incorrect. $('#p') will select elements (though in principle there should be only one, but that's s...
2009/01/14
[ "https://Stackoverflow.com/questions/442269", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I am using jQuery $.load() function to get content from server. the loaded content contain this: ``` <p id="p1">123</p> <script> $(document).ready(function(){ $('#p1').html('ABC'); alert($('#p1').html()); }); </script> ``` changing text of paragraph to 'ABC' not affected to page but alert() display ...
I think your selector is incorrect. $('#p') will select elements (though in principle there should be only one, but that's separate) with id "p". Not all elements. So I think you either mean $('p') or $('#p1').
442,289
<p>I just moved my apache/mongrel setups to use passenger and I started noticing my index page is getting hit pretty aggressively (approx 5000 hits a day) </p> <p>I chucked in some logging and it turns out the ip address (REMOTE_ADDR) is showing up as "::1" for these hits. </p> <p>Has anyone seen this kind of activit...
[ { "answer_id": 443735, "author": "Matt Darby", "author_id": 52283, "author_profile": "https://Stackoverflow.com/users/52283", "pm_score": 0, "selected": false, "text": "<p>Do you have some type of monitoring system hitting the web server? I've used Passenger for months and haven't seen t...
2009/01/14
[ "https://Stackoverflow.com/questions/442289", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17174/" ]
I just moved my apache/mongrel setups to use passenger and I started noticing my index page is getting hit pretty aggressively (approx 5000 hits a day) I chucked in some logging and it turns out the ip address (REMOTE\_ADDR) is showing up as "::1" for these hits. Has anyone seen this kind of activity? There must be...
See <http://wiki.apache.org/httpd/InternalDummyConnection>. When the Apache HTTP Server manages its child processes, it needs a way to wake up processes that are listening for new connections. To do this, it sends a simple HTTP request back to itself. You can filter them using mod\_rewrite, SetEnvIf or a regular expr...
442,299
<p>I'm trying to solve a problem that looks like a standard Linear Programming problem with one twist.</p> <p>We have as input a set of "phrases" each of which has a weight. We need to choose how many times to repeat each phrase in a text to maximize the total weight, subject to a max character length limitation.</p>...
[ { "answer_id": 442359, "author": "Georg Schölly", "author_id": 24587, "author_profile": "https://Stackoverflow.com/users/24587", "pm_score": 0, "selected": false, "text": "<p>Just recalculate the weights. For example:</p>\n\n<pre>\nkey = 3\nboard = 2\nkeyboard = 5\n</pre>\n\n<p>This chan...
2009/01/14
[ "https://Stackoverflow.com/questions/442299", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm trying to solve a problem that looks like a standard Linear Programming problem with one twist. We have as input a set of "phrases" each of which has a weight. We need to choose how many times to repeat each phrase in a text to maximize the total weight, subject to a max character length limitation. This seems li...
You have another problem, a concatenation of two phrases might form a third phrase. For example, if you have ``` list...4 sting...6 ingrave...7 abcd...5 ``` then a solution "`listingrave`" has "gain" 17, whereas anything you could do with "`abcd`" ("`abcdingrave`") has only 12, although for length 4, "`abcd`" is the...
442,302
<p>In many GUIs when I select a section of text and then hit the <kbd>Tab</kbd> or <kbd>Shift</kbd>+<kbd>Tab</kbd> button the selected section will indent in or out. </p> <p>In VIM I can select a visual section and then hit the <kbd>&lt;</kbd> or <kbd>></kbd> key to change indenting, however once I hit the <kbd>&lt;</...
[ { "answer_id": 442309, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 6, "selected": false, "text": "<p>You can prefix a number, ie. <code>2&gt;</code> to indent two tab stops. Or, you can use <code>&gt;</code> to indent o...
2009/01/14
[ "https://Stackoverflow.com/questions/442302", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17174/" ]
In many GUIs when I select a section of text and then hit the `Tab` or `Shift`+`Tab` button the selected section will indent in or out. In VIM I can select a visual section and then hit the `<` or `>` key to change indenting, however once I hit the `<` key my selection is cleared so I am stuck selecting the section a...
``` vmap <Tab> >gv vmap <S-Tab> <gv ```
442,311
<p>I need some help getting a regex working to parse all referrers from an apache access log file which <strong>come from real links offsite</strong> and which are valid referrals from real people rather than bots or spiders. I'm working in Perl.</p> <p>This bit of code <em>almost</em> works already [the access log is...
[ { "answer_id": 442344, "author": "derobert", "author_id": 27727, "author_profile": "https://Stackoverflow.com/users/27727", "pm_score": 2, "selected": false, "text": "<p>Unless you have some really weird requirement to reinvent the wheel,</p>\n\n<p><a href=\"http://search.cpan.org/search...
2009/01/14
[ "https://Stackoverflow.com/questions/442311", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17492/" ]
I need some help getting a regex working to parse all referrers from an apache access log file which **come from real links offsite** and which are valid referrals from real people rather than bots or spiders. I'm working in Perl. This bit of code *almost* works already [the access log is opened with the filehandle $f...
Manni's suggestion to eliminate POST and HEAD was indeed correct because I was looking for negative matches (therefore should not restrict to GET as when parsing for query strings). Likewise with the error in the dot before the host without a www, and also needing to eliminate "-" (no referrer) Also, I eliminated all ...
442,317
<p>I want to create a Blog object which has a relation between User. To create the relationship do I have to select User entity first, then set it to User property of Blog object? In Entity Framework samples suggest to set the User object to ViewState and retrieve it when you need to create the relationship, like a bas...
[ { "answer_id": 443068, "author": "Craig Stuntz", "author_id": 7714, "author_profile": "https://Stackoverflow.com/users/7714", "pm_score": 0, "selected": false, "text": "<p>This is not officially supported at present, <a href=\"http://blogs.msdn.com/efdesign/archive/2008/10/27/foreign-key...
2009/01/14
[ "https://Stackoverflow.com/questions/442317", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4215/" ]
I want to create a Blog object which has a relation between User. To create the relationship do I have to select User entity first, then set it to User property of Blog object? In Entity Framework samples suggest to set the User object to ViewState and retrieve it when you need to create the relationship, like a basic ...
We use the following solution to set foreign keys without retreiving the corresponding entity from the context. ``` Blog blog = new Blog { Name = blogName, Slogan = slogan, UsersReference.EntityKey = new EntityKey("EntityModel.Users", "UserId", userI...
442,326
<p>I am inside a UIView subclass (CustomView in the code below).</p> <p>I am drawing a border around an image in a UIImageView subclass (containerView). The Core Graphics code for this is located inside <code>drawInRect:</code> in the subclass.</p> <p>The Core Animation transition is a flip, however when it is drawn...
[ { "answer_id": 442632, "author": "Lily Ballard", "author_id": 582, "author_profile": "https://Stackoverflow.com/users/582", "pm_score": 3, "selected": true, "text": "<p>You're implementing <code>drawRect:</code>, not <code>drawInRect:</code>, right? Also, have you verified that outside o...
2009/01/14
[ "https://Stackoverflow.com/questions/442326", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26088/" ]
I am inside a UIView subclass (CustomView in the code below). I am drawing a border around an image in a UIImageView subclass (containerView). The Core Graphics code for this is located inside `drawInRect:` in the subclass. The Core Animation transition is a flip, however when it is drawn, the Core Graphics code is n...
You're implementing `drawRect:`, not `drawInRect:`, right? Also, have you verified that outside of this transition, it actually works? Can you paste your `drawRect:`implementation? I'm just afraid that UIImageView sets the contents of its layer directly instead of relying on `drawRect:` to do it, which would mean your...
442,334
<p>I am working on a winforms application that uses Sybase Datawindow.net. Basically I have a datawindow that retrieves data (dw_retailer.Retrieve(id)) and what I get back is an object list. The datawindow itself excists of labels and textboxes and I bind the data like this</p> <pre><code>newRetailer.foto1 = ((object[...
[ { "answer_id": 442361, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 0, "selected": false, "text": "<p>You say it is an \"object list\"; rather than fixate on <code>object[]</code>, how about the non-generic <code>ILi...
2009/01/14
[ "https://Stackoverflow.com/questions/442334", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50124/" ]
I am working on a winforms application that uses Sybase Datawindow.net. Basically I have a datawindow that retrieves data (dw\_retailer.Retrieve(id)) and what I get back is an object list. The datawindow itself excists of labels and textboxes and I bind the data like this ``` newRetailer.foto1 = ((object[])(dataWindow...
``` _targetForm.dw_retailer.SetColumn(6); _targetForm.dw_retailer.SetText(retailer.text); _targetForm.dw_retailer.SetColumn(9); _targetForm.dw_retailer.SetText(retailer.webname); ``` First you have to activate the control you want to edit with SetColumn and then call SetText. Now everyone knows!
442,337
<p>is there an easy way to hook to an event that is triggered on change of global screen resolution?</p>
[ { "answer_id": 442368, "author": "Frederick The Fool", "author_id": 32688, "author_profile": "https://Stackoverflow.com/users/32688", "pm_score": 6, "selected": true, "text": "<p>Handle the following event:</p>\n\n<pre><code>Microsoft.Win32.SystemEvents.DisplaySettingsChanged\n</code></p...
2009/01/14
[ "https://Stackoverflow.com/questions/442337", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47694/" ]
is there an easy way to hook to an event that is triggered on change of global screen resolution?
Handle the following event: ``` Microsoft.Win32.SystemEvents.DisplaySettingsChanged ``` You may refer to [this](http://msdn.microsoft.com/en-us/library/microsoft.win32.systemevents.displaysettingschanged.aspx) page for more details. You may also wanna see the [msdn article](http://msdn.microsoft.com/en-us/library/...
442,343
<p>I have some extremely weird behavior that seems to result in silent exceptions. How can I write a general try catch where I can debug all exceptions. Something along the lines of:</p> <pre><code>try: # something that fails except e: print e </code></pre> <p>A bit more about the problem at hand in detail:</...
[ { "answer_id": 442348, "author": "Swaroop C H", "author_id": 4869, "author_profile": "https://Stackoverflow.com/users/4869", "pm_score": 2, "selected": false, "text": "<p>Does this work? :</p>\n\n<pre><code>except BaseException, e:\n</code></pre>\n" }, { "answer_id": 442353, ...
2009/01/14
[ "https://Stackoverflow.com/questions/442343", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3355/" ]
I have some extremely weird behavior that seems to result in silent exceptions. How can I write a general try catch where I can debug all exceptions. Something along the lines of: ``` try: # something that fails except e: print e ``` A bit more about the problem at hand in detail: I have a Django app that o...
Exceptions are already printed by default before program termination. If you want to send the error somewhere else (not print it) you can do this: ``` try: something() except Exception as e: send_somewhere(traceback.format_exception(*sys.exc_info())) raise # reraises the exception ``` note that this form...
442,354
<p>Alright, I'm trying to get arguments to work properly with a small test application. My code is below. I'm not too experienced at C++, so I'm not sure why when I launch test with -print (or --print) it automatically states "Not a valid option" and then finishes up.</p> <pre><code>#include &lt;iostream&gt; int main...
[ { "answer_id": 442364, "author": "gak", "author_id": 11125, "author_profile": "https://Stackoverflow.com/users/11125", "pm_score": 5, "selected": true, "text": "<p>You're comparing the memory address of the string \"-print\" to the memory address of <code>argument</code>. This won't work...
2009/01/14
[ "https://Stackoverflow.com/questions/442354", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49000/" ]
Alright, I'm trying to get arguments to work properly with a small test application. My code is below. I'm not too experienced at C++, so I'm not sure why when I launch test with -print (or --print) it automatically states "Not a valid option" and then finishes up. ``` #include <iostream> int main(int argc, char* arg...
You're comparing the memory address of the string "-print" to the memory address of `argument`. This won't work! Use `strcmp()` to compare string values. Instead of: ``` if (argument == "-print") ``` do ``` if (strcmp(argument, "-print") == 0) ```
442,384
<p>In my HTML page, I need to check if Adobe Flash player is installed. If not, I want to automatically jump to another HTML page to tell the user that Flash player is required.</p> <p>I'm using JavaScript to check if the Flash player is available, using the '<a href="http://www.featureblend.com/javascript-flash-detec...
[ { "answer_id": 442393, "author": "Georg Schölly", "author_id": 24587, "author_profile": "https://Stackoverflow.com/users/24587", "pm_score": 6, "selected": true, "text": "<pre><code>window.location.href = \"http://stackoverflow.com\";\n</code></pre>\n\n<p>For local files this should work...
2009/01/14
[ "https://Stackoverflow.com/questions/442384", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2796/" ]
In my HTML page, I need to check if Adobe Flash player is installed. If not, I want to automatically jump to another HTML page to tell the user that Flash player is required. I'm using JavaScript to check if the Flash player is available, using the '[JavaScript Flash detection library](http://www.featureblend.com/java...
``` window.location.href = "http://stackoverflow.com"; ``` For local files this should work if you know the relative path: (In your case this works.) ``` window.location.href = "someOtherFile.html"; ``` Maybe you could also do it absolute using this: (Not tested.) ``` window.location.pathname = "/path/to/another/...
442,386
<p>The drive the VM's are running on have run out of space and this caused all my VM's to go into Paused-Critical state.</p> <p>To free up some space I want to delete some snapshots I took. Where my snapshot is extended from the main VM with the Now (green arrow) extending the snapshot.</p> <p>When I try to delete t...
[ { "answer_id": 442393, "author": "Georg Schölly", "author_id": 24587, "author_profile": "https://Stackoverflow.com/users/24587", "pm_score": 6, "selected": true, "text": "<pre><code>window.location.href = \"http://stackoverflow.com\";\n</code></pre>\n\n<p>For local files this should work...
2009/01/14
[ "https://Stackoverflow.com/questions/442386", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
The drive the VM's are running on have run out of space and this caused all my VM's to go into Paused-Critical state. To free up some space I want to delete some snapshots I took. Where my snapshot is extended from the main VM with the Now (green arrow) extending the snapshot. When I try to delete the snapshot I get ...
``` window.location.href = "http://stackoverflow.com"; ``` For local files this should work if you know the relative path: (In your case this works.) ``` window.location.href = "someOtherFile.html"; ``` Maybe you could also do it absolute using this: (Not tested.) ``` window.location.pathname = "/path/to/another/...
442,404
<p>I want to know how to get the X and Y position of HTML elements such as <code>img</code> and <code>div</code> in JavaScript.</p>
[ { "answer_id": 442420, "author": "AnthonyWJones", "author_id": 17516, "author_profile": "https://Stackoverflow.com/users/17516", "pm_score": 6, "selected": false, "text": "<p>HTML elements on most browsers will have:-</p>\n\n<pre><code>offsetLeft\noffsetTop\n</code></pre>\n\n<p>These spe...
2009/01/14
[ "https://Stackoverflow.com/questions/442404", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I want to know how to get the X and Y position of HTML elements such as `img` and `div` in JavaScript.
The correct approach is to use [`element.getBoundingClientRect()`](https://developer.mozilla.org/en-US/docs/Web/API/Element/getBoundingClientRect): ``` var rect = element.getBoundingClientRect(); console.log(rect.top, rect.right, rect.bottom, rect.left); ``` Internet Explorer has supported this since as long as you ...
442,405
<p>In regards to this: <a href="https://web.archive.org/web/20130105040736/http://stackoverflow.uservoice.com:80/forums/1722-general/suggestions/103227-parser-does-not-match-all-valid-urls" rel="nofollow noreferrer">http://stackoverflow.uservoice.com/pages/general/suggestions/103227-parser-does-not-match-all-valid-urls...
[ { "answer_id": 459811, "author": "localshred", "author_id": 29690, "author_profile": "https://Stackoverflow.com/users/29690", "pm_score": 5, "selected": true, "text": "<p>Even though the question is vague, I'll attempt to respond with possible solutions.</p>\n\n<p><strong>Possible Intent...
2009/01/14
[ "https://Stackoverflow.com/questions/442405", "https://Stackoverflow.com", "https://Stackoverflow.com/users/115/" ]
In regards to this: [http://stackoverflow.uservoice.com/pages/general/suggestions/103227-parser-does-not-match-all-valid-urls](https://web.archive.org/web/20130105040736/http://stackoverflow.uservoice.com:80/forums/1722-general/suggestions/103227-parser-does-not-match-all-valid-urls) is this regex adequate or will it n...
Even though the question is vague, I'll attempt to respond with possible solutions. **Possible Intention 1**: To match any URL's in a given file (for replacement): ``` /^([^:]+):\/\/([-\w._]+)(\/[-\w._]\?(.+)?)?$/ig ``` The above should match nearly all URL formats, with the following captured groups: ``` 0 => ent...
442,409
<p>Is there any way i can calculate bandwidth (packets sent and received) by an exe/application via net? have looked into <a href="http://msdn.microsoft.com/en-us/library/system.net.networkinformation.ipglobalproperties.aspx" rel="nofollow noreferrer">IPGlobalProperties</a>, and other classes.</p> <p>I want packets se...
[ { "answer_id": 442459, "author": "Rasmus Faber", "author_id": 5542, "author_profile": "https://Stackoverflow.com/users/5542", "pm_score": 5, "selected": false, "text": "<p>One way is to retrieve the value of the <a href=\"http://msdn.microsoft.com/en-us/library/system.diagnostics.perform...
2009/01/14
[ "https://Stackoverflow.com/questions/442409", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Is there any way i can calculate bandwidth (packets sent and received) by an exe/application via net? have looked into [IPGlobalProperties](http://msdn.microsoft.com/en-us/library/system.net.networkinformation.ipglobalproperties.aspx), and other classes. I want packets sent and received by a single application. I have...
One way is to retrieve the value of the [performance counters](http://msdn.microsoft.com/en-us/library/system.diagnostics.performancecounter.aspx) ".NET CLR Networking/Bytes Received" and ".NET CLR Networking/Bytes Sent" for your application: ``` PerformanceCounter bytesSentPerformanceCounter= new PerformanceCounter()...
442,425
<p>How would I create a nested grouping for the table below, using LINQ? I want to group by <code>Code</code>, then by <code>Mktcode</code>.</p> <pre><code>Code Mktcode Id ==== ======= ==== 1 10 0001 2 20 0010 1 10 0012 1 20 0010 1 20 0014 2 20 0001 2 30 000...
[ { "answer_id": 442472, "author": "thinkbeforecoding", "author_id": 47001, "author_profile": "https://Stackoverflow.com/users/47001", "pm_score": 4, "selected": false, "text": "<p>You can build lookups (Kinds of Dictionary&lt;,List&lt;>>) using <code>group by into</code></p>\n\n<pre><code...
2009/01/14
[ "https://Stackoverflow.com/questions/442425", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3834/" ]
How would I create a nested grouping for the table below, using LINQ? I want to group by `Code`, then by `Mktcode`. ``` Code Mktcode Id ==== ======= ==== 1 10 0001 2 20 0010 1 10 0012 1 20 0010 1 20 0014 2 20 0001 2 30 0002 1 30 0002 1 30 000...
I'd think of it this way: * You're primarily grouping by code, so do that first * For each group, you've still got a list of results - so apply another grouping there. Something like: ``` var groupedByCode = source.GroupBy(x => x.Code); var groupedByCodeAndThenId = groupedByCode.Select(group => new { Key=group....
442,429
<p>I'm looking for an algorithm that sorts strings similar to the way files (and folders) are sorted in Windows Explorer. It seems that numeric values in strings are taken into account when sorted which results in something like</p> <pre><code>name 1, name 2, name 10 </code></pre> <p>instead of</p> <pre><code>name 1...
[ { "answer_id": 442436, "author": "Michael Borgwardt", "author_id": 16883, "author_profile": "https://Stackoverflow.com/users/16883", "pm_score": 5, "selected": true, "text": "<p>It's called \"natural sort order\". Jeff had a <a href=\"http://blog.codinghorror.com/sorting-for-humans-natur...
2009/01/14
[ "https://Stackoverflow.com/questions/442429", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17255/" ]
I'm looking for an algorithm that sorts strings similar to the way files (and folders) are sorted in Windows Explorer. It seems that numeric values in strings are taken into account when sorted which results in something like ``` name 1, name 2, name 10 ``` instead of ``` name 1, name 10, name 2 ``` which you get...
It's called "natural sort order". Jeff had a [pretty extensive blog entry](http://blog.codinghorror.com/sorting-for-humans-natural-sort-order/) on it a while ago, which describes the difficulties you might overlook and has links to several implementations.
442,439
<p>I am trying to use Microsoft's <a href="http://www.microsoft.com/downloads/details.aspx?familyid=A362781C-3870-43BE-8926-862B40AA0CD0&amp;displaylang=en" rel="nofollow noreferrer">CLRProfiler</a> to profile my fairly large app, and it is crashing whenever it tries to write (or read) a log file. Ironically, the exact...
[ { "answer_id": 442450, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 2, "selected": false, "text": "<p>I suspect that is a dead avenue. Perhaps try jetBrains <a href=\"http://www.jetbrains.com/profiler/index.html\" re...
2009/01/14
[ "https://Stackoverflow.com/questions/442439", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6091/" ]
I am trying to use Microsoft's [CLRProfiler](http://www.microsoft.com/downloads/details.aspx?familyid=A362781C-3870-43BE-8926-862B40AA0CD0&displaylang=en) to profile my fairly large app, and it is crashing whenever it tries to write (or read) a log file. Ironically, the exact bug is documented on the [MS 'Feedback' sit...
The CLR Profiler is quite unstable, I also experienced many crashes with it. One hint that I have heard at PDC is to use it only as a snapshot tool: don't collect the mem usage information during the run of the application, but stop the app at a point where you know you have the mem problem already, and make a mem sn...
442,442
<p>How to know, in Python, that the directory you are in is inside a symbolic link ?</p> <p>I have a directory <strong>/tmp/foo/kiwi</strong></p> <p>I create a symlink <strong>/tmp/bar</strong> pointing to <strong>/tmp/foo</strong></p> <p>I enter into <strong>/tmp/bar/kiwi</strong></p> <p>the linux command <strong>...
[ { "answer_id": 442453, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 2, "selected": false, "text": "<p>If your symlink is set up in the way you state, then <code>/tmp/foo/kiwi</code> is the directory that you're really in...
2009/01/14
[ "https://Stackoverflow.com/questions/442442", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22035/" ]
How to know, in Python, that the directory you are in is inside a symbolic link ? I have a directory **/tmp/foo/kiwi** I create a symlink **/tmp/bar** pointing to **/tmp/foo** I enter into **/tmp/bar/kiwi** the linux command **pwd** tells me I'm in **/tmp/bar/kiwi**, which is correct. The python command prompt tel...
If you don't find anything else, you can use ``` os.getenv("PWD") ``` It's not really a portable python method, but works on POSIX systems. It gets the value of the `PWD` environment variable, which is set by the `cd` command (if you don't use `cd -P`) to the path name you navigated into (see `man cd`) before runni...
442,456
<p>I have a file 'records.txt' which contains over 200,000 records.</p> <p>Each record is on a separate line and has multiple fields separated by a delimiter '|'.</p> <p>Each row should have 35 fields, but the <strong>problem is one of these rows has &lt;>35 fields, i.e. &lt;>35 '|' characters.</strong></p> <p>Can s...
[ { "answer_id": 442470, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 1, "selected": false, "text": "<p>This small perl script should do it:</p>\n\n<pre><code>cat records.txt | perl -ne '$t = $_; $t =~ s/[^\\|]//g; print u...
2009/01/14
[ "https://Stackoverflow.com/questions/442456", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18615/" ]
I have a file 'records.txt' which contains over 200,000 records. Each record is on a separate line and has multiple fields separated by a delimiter '|'. Each row should have 35 fields, but the **problem is one of these rows has <>35 fields, i.e. <>35 '|' characters.** Can someone please suggest a way in Unix, by whi...
Try this: ``` awk -F '|' 'NF != 35 {print NR, $0} ' your_filefile ```
442,460
<p>I have this table contains name and value, how can i convert the contents of</p> <pre><code>$row=mysql_fetch_array($result); </code></pre> <p>into checkboxes?</p>
[ { "answer_id": 442473, "author": "nes1983", "author_id": 52573, "author_profile": "https://Stackoverflow.com/users/52573", "pm_score": 0, "selected": false, "text": "<p>See here: <a href=\"http://dev.w3.org/html5/spec/Overview.html#checkbox-state\" rel=\"nofollow noreferrer\">http://dev....
2009/01/14
[ "https://Stackoverflow.com/questions/442460", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have this table contains name and value, how can i convert the contents of ``` $row=mysql_fetch_array($result); ``` into checkboxes?
Assuming $row is an associative array mapping column name onto a boolean 1 or 0 value, you could do something like this: ``` foreach($row as $colname=>$boolean) { //create a name for the checkbox which will produce a nice //PHP array of checked column names in $_POST['col'] $name="col[$colname]"; //c...
442,462
<p>I have some content from server using $.ajax() function. I try to replace some element with this data and then manipulate it. Here is code:</p> <pre><code>$.ajax({ type: "GET", url: "smpl.php", success: function(servmsg){ $('#panelInfo').replaceWith('&lt;p&gt;' + servmsg + '&lt;/p&gt;'); } }...
[ { "answer_id": 442478, "author": "Kobi", "author_id": 7586, "author_profile": "https://Stackoverflow.com/users/7586", "pm_score": 0, "selected": false, "text": "<p>The event binding code should be inside the 'success' function, so it will run after #years is added to the page. Otherwise,...
2009/01/14
[ "https://Stackoverflow.com/questions/442462", "https://Stackoverflow.com", "https://Stackoverflow.com/users/54938/" ]
I have some content from server using $.ajax() function. I try to replace some element with this data and then manipulate it. Here is code: ``` $.ajax({ type: "GET", url: "smpl.php", success: function(servmsg){ $('#panelInfo').replaceWith('<p>' + servmsg + '</p>'); } }); ``` response from ser...
You need to change your code to: ``` $.ajax({ type: "GET", url: "smpl.php", success: function(servmsg){ $('#panelInfo').replaceWith('<p>' + servmsg + '</p>'); $('#years').change(function() { //or .click() //do something }); } }); ``` Alternately, you could keep you...
442,464
<p>---HTML </p> <pre><code>&lt;div id="story"&gt; &lt;div id="individual"&gt; &lt;img src='uploads/1231924837Picture.png'/&gt; &lt;h2&gt;2009-01-14&lt;/h2&gt; &lt;h1&gt;Headline&lt;/h1&gt; &lt;p&gt;stroy story etc stroy story etc stroy story etc&lt;/p&gt; &lt;/div&gt; &lt;br /&gt; &lt;div id="storynav"&gt; &lt;a h...
[ { "answer_id": 442519, "author": "quark", "author_id": 46680, "author_profile": "https://Stackoverflow.com/users/46680", "pm_score": 0, "selected": false, "text": "<p>Read that: <a href=\"http://www.quirksmode.org/css/clearing.html\" rel=\"nofollow noreferrer\">http://www.quirksmode.org/...
2009/01/14
[ "https://Stackoverflow.com/questions/442464", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31677/" ]
---HTML ``` <div id="story"> <div id="individual"> <img src='uploads/1231924837Picture.png'/> <h2>2009-01-14</h2> <h1>Headline</h1> <p>stroy story etc stroy story etc stroy story etc</p> </div> <br /> <div id="storynav"> <a href='home.php?start=0'>1</a> <a href='home.php?start=1'>2</a> <a href='home.php?start=2'>3...
You are setting the image to float right which means that the container div cannot work out it's actual height. You need to clear the floated element which essentially lets the container know how large the image actualy is. You will need to add an element with the style `clear: both;` underneath the img tag in your HT...
442,471
<p>Consider the following class</p> <pre><code>public class SchemaExecutor: ISchemaExecutor { public SchemaExecutor(SqlPlusSettings sqlPlusSettings) { _sqlPlusSettings = sqlPlusSettings; } ... </code></pre> <p>And container configuration</p> <pre><code>ObjectFactory.Initialize( x =&gt; { SqlP...
[ { "answer_id": 460254, "author": "Mark G", "author_id": 34556, "author_profile": "https://Stackoverflow.com/users/34556", "pm_score": 2, "selected": false, "text": "<p>You need to just let the IoC do what it does and inject your dependencies for you...</p>\n\n<pre><code>ObjectFactory.Ini...
2009/01/14
[ "https://Stackoverflow.com/questions/442471", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Consider the following class ``` public class SchemaExecutor: ISchemaExecutor { public SchemaExecutor(SqlPlusSettings sqlPlusSettings) { _sqlPlusSettings = sqlPlusSettings; } ... ``` And container configuration ``` ObjectFactory.Initialize( x => { SqlPlusSettings sqlPlusSettings = GetSqlPlus...
You need to just let the IoC do what it does and inject your dependencies for you... ``` ObjectFactory.Initialize( x => { x.ForRequestedType<SqlPlusSettings>().TheDefaultIsConcreteType<SqlPlusSettings>().AsSingletons; x.ForRequestedType<ISchemaExecutor>().TheDefaultIsConcreteType<SchemaExecutor>(); }); ...
442,476
<p>What would be the way to retrieve the Windows SDK folder in an MSBuild task?</p> <p>Using the generateBootstrapper task I'm creating a bootstrapper for my setup to be able to install the pre-requisites. This task needs the path to the folder where the pre-requisite packages are located, i.e. the Windows SDK folder ...
[ { "answer_id": 442631, "author": "John Sibly", "author_id": 1078, "author_profile": "https://Stackoverflow.com/users/1078", "pm_score": 2, "selected": false, "text": "<p>The path to the bootstrapper is stored under the registry key:</p>\n\n<pre><code>HKEY_LOCAL_MACHINE\\SOFTWARE\\Microso...
2009/01/14
[ "https://Stackoverflow.com/questions/442476", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40347/" ]
What would be the way to retrieve the Windows SDK folder in an MSBuild task? Using the generateBootstrapper task I'm creating a bootstrapper for my setup to be able to install the pre-requisites. This task needs the path to the folder where the pre-requisite packages are located, i.e. the Windows SDK folder ``` "C:\...
You can also use the [GetFrameworkSdkPath](http://msdn.microsoft.com/en-us/library/ms164298.aspx) MSBuild task. ``` <GetFrameworkSdkPath> <Output TaskParameter="Path" PropertyName="WindowsSdkPath" /> </GetFrameworkSdkPath> ``` For example: ``` <GenerateBootstrapper ApplicationFile="$(SolutionName).applicatio...
442,482
<p>I am try use</p> <p><code>(?&lt;key&gt;.{5}keyword.{5}?)</code> </p> <p>to test "other string keyword other text" </p> <p>it will get "ring keyword othe"</p> <p>and I want "akeyword other text" or "other string keyworda" or "akeywordc" are match, too.</p> <p>How to modify regex?</p> <hr> <p>I have a long stri...
[ { "answer_id": 442506, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 1, "selected": false, "text": "<p>It isn't clear what you want to pass and fail; in particular, the <code>.{5}</code> demands 5 characters before th...
2009/01/14
[ "https://Stackoverflow.com/questions/442482", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I am try use `(?<key>.{5}keyword.{5}?)` to test "other string keyword other text" it will get "ring keyword othe" and I want "akeyword other text" or "other string keyworda" or "akeywordc" are match, too. How to modify regex? --- I have a long string and I want get find keyword and get it with perfix and suffi...
Could this be what you are looking for: ``` (?<key>.{0,5}keyword[\s\S]{0,5}) ```
442,485
<p>I am trying to emulate a POS printer with System.Drawing and one of the functions I need is to draw text at double height. Any idea how I can do this using .Net's Graphics class?</p> <p>Do I need to draw the text twice as large and condense it or draw normal size and then stretch? Both seem like messy options but i...
[ { "answer_id": 442506, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 1, "selected": false, "text": "<p>It isn't clear what you want to pass and fail; in particular, the <code>.{5}</code> demands 5 characters before th...
2009/01/14
[ "https://Stackoverflow.com/questions/442485", "https://Stackoverflow.com", "https://Stackoverflow.com/users/54943/" ]
I am trying to emulate a POS printer with System.Drawing and one of the functions I need is to draw text at double height. Any idea how I can do this using .Net's Graphics class? Do I need to draw the text twice as large and condense it or draw normal size and then stretch? Both seem like messy options but is there an...
Could this be what you are looking for: ``` (?<key>.{0,5}keyword[\s\S]{0,5}) ```
442,488
<p>Following class structure is given:</p> <pre><code>class Job { String description; Collection&lt;JobHistory&gt; history; } class JobHistory { Date assignDate; User jobOwner; } class JobOwner { String name; String id; } </code></pre> <p>This class-structure is accessible on the db via JP...
[ { "answer_id": 442544, "author": "cletus", "author_id": 18393, "author_profile": "https://Stackoverflow.com/users/18393", "pm_score": 2, "selected": true, "text": "<p>Try:</p>\n\n<pre><code>SELECT j, j.history FROM Job j JOIN User u WHERE u.name = :name\n</code></pre>\n\n<p>If I were to ...
2009/01/14
[ "https://Stackoverflow.com/questions/442488", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34856/" ]
Following class structure is given: ``` class Job { String description; Collection<JobHistory> history; } class JobHistory { Date assignDate; User jobOwner; } class JobOwner { String name; String id; } ``` This class-structure is accessible on the db via JPA. In the DAO-Layer I can write ...
Try: ``` SELECT j, j.history FROM Job j JOIN User u WHERE u.name = :name ``` If I were to do this in EclipseLink, I would change it slightly: ``` public List<Job> getAllJobsForUser(String username) { List<Job> jobs = entityManager .createQuery("SELECT j FROM Job j JOIN User u WHERE u.name = :name") .setPa...
442,491
<p>I have a <em>UISearchBar</em> and on the delegate method I hide the keyboard when the text field is cleared:</p> <pre><code>- (void)searchBar:(UISearchBar *)filterBar textDidChange:(NSString *)filterText { NSLog(@"filter: %@", filterText); if ([filterText length] == 0) { NSLog(@"hiding keyboard"); ...
[ { "answer_id": 442635, "author": "Lily Ballard", "author_id": 582, "author_profile": "https://Stackoverflow.com/users/582", "pm_score": 1, "selected": false, "text": "<p>I would suggest you <em>stop</em> trying to do this. Hiding the keyboard when the field empties out is completely non-...
2009/01/14
[ "https://Stackoverflow.com/questions/442491", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33165/" ]
I have a *UISearchBar* and on the delegate method I hide the keyboard when the text field is cleared: ``` - (void)searchBar:(UISearchBar *)filterBar textDidChange:(NSString *)filterText { NSLog(@"filter: %@", filterText); if ([filterText length] == 0) { NSLog(@"hiding keyboard"); [filterBar re...
I basically agree with Kevin, but that doesn't help you so here goes: Try looping through the subviews of the searchbar and find the sibling which is of the class UITextField. Then either set the delegate property of this text field to your ViewController's class and handle the callback there (e.g. textViewShouldRetur...
442,496
<p>Can anybody tell my why this doesn't work in the Android emulator? From the browser I have access and the server is internal. All I can think of is that I'm missing some configuration on my app so it can access the network layer.</p> <pre><code>try { InetAddress server = Inet4Address.getByName("thehost"); /...
[ { "answer_id": 442590, "author": "Reto Meier", "author_id": 822, "author_profile": "https://Stackoverflow.com/users/822", "pm_score": 6, "selected": true, "text": "<p>As far as configuration goes, the only setting you should need to access the Internet from your application is the INTERN...
2009/01/14
[ "https://Stackoverflow.com/questions/442496", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48869/" ]
Can anybody tell my why this doesn't work in the Android emulator? From the browser I have access and the server is internal. All I can think of is that I'm missing some configuration on my app so it can access the network layer. ``` try { InetAddress server = Inet4Address.getByName("thehost"); //Doesn't work ...
As far as configuration goes, the only setting you should need to access the Internet from your application is the INTERNET permission, enabled by adding the following line *outside* the Application tags within your application Manifest. ``` <uses-permission android:name="android.permission.INTERNET" /> ``` So the m...
442,498
<p>Following on from my recent <a href="https://stackoverflow.com/questions/428073/what-is-the-best-simplest-way-to-read-in-an-xml-file-in-java-application" title="question">question</a> regarding parsing XML files in Java I have decided to use the commons-digester library. I am now familiar with this process and now w...
[ { "answer_id": 442545, "author": "ng.", "author_id": 21896, "author_profile": "https://Stackoverflow.com/users/21896", "pm_score": 1, "selected": false, "text": "<p>I realise this is not a direct answer to your question, but that is a hell of a lot of code for such a simple config, and y...
2009/01/14
[ "https://Stackoverflow.com/questions/442498", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42435/" ]
Following on from my recent [question](https://stackoverflow.com/questions/428073/what-is-the-best-simplest-way-to-read-in-an-xml-file-in-java-application "question") regarding parsing XML files in Java I have decided to use the commons-digester library. I am now familiar with this process and now want to create a Java...
It has been a while since I looked at the commons digester, but I expect the *InstantiationException* is because the digester expects the *MyConfig* class to be a [JavaBean](http://java.sun.com/javase/technologies/desktop/javabeans/docs/spec.html). One of the defining characteristics of a JavaBean is that it has a **pu...
442,503
<p>I have a column containing items that can be sorted by the user:</p> <pre><code>DOC_ID DOC_Order DOC_Name 1 1 aaa 2 3 bbb 3 2 ccc </code></pre> <p>I'm trying to figure out a way to properly initialize DOC_Order when the entry is created. A good value would either be...
[ { "answer_id": 442567, "author": "cmsjr", "author_id": 23114, "author_profile": "https://Stackoverflow.com/users/23114", "pm_score": 6, "selected": true, "text": "<p>The syntax to add a default like that would be</p>\n\n<pre><code>alter table DOC_Order \nadd constraint \ndf_DOC_Order \nd...
2009/01/14
[ "https://Stackoverflow.com/questions/442503", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5789/" ]
I have a column containing items that can be sorted by the user: ``` DOC_ID DOC_Order DOC_Name 1 1 aaa 2 3 bbb 3 2 ccc ``` I'm trying to figure out a way to properly initialize DOC\_Order when the entry is created. A good value would either be the corresponding DO-CID...
The syntax to add a default like that would be ``` alter table DOC_Order add constraint df_DOC_Order default([dbo].[NEWDOC_Order]()) for DOC_Order ``` Also, you might want to alter your function to handle when DOC\_Order is null ``` Create FUNCTION [dbo].[NEWDOC_Order] ( ) RETURNS int AS BEGIN RETURN (SELECT ...
442,529
<p>Is there any standard, de facto or otherwise, for XML documents? For example which is the "best" way to write a tag?</p> <pre><code>&lt;MyTag /&gt; &lt;myTag /&gt; &lt;mytag /&gt; &lt;my-tag /&gt; &lt;my_tag /&gt; </code></pre> <p>Likewise if I have an enumerated value for an attribute which is better</p> <pre><c...
[ { "answer_id": 442536, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 6, "selected": false, "text": "<p>I suspect the most common values would be camelCased - i.e.</p>\n\n<pre><code>&lt;myTag someAttribute=\"someValue\...
2009/01/14
[ "https://Stackoverflow.com/questions/442529", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18107/" ]
Is there any standard, de facto or otherwise, for XML documents? For example which is the "best" way to write a tag? ``` <MyTag /> <myTag /> <mytag /> <my-tag /> <my_tag /> ``` Likewise if I have an enumerated value for an attribute which is better ``` <myTag attribute="value one"/> <myTag attribute="ValueOne"/> <m...
I suspect the most common values would be camelCased - i.e. ``` <myTag someAttribute="someValue"/> ``` In particular, the spaces cause a few glitches if mixed with code-generators (i.e. to [de]serialize xml to objects), since not many languages allow enums with spaces (demanding a mapping between the two).
442,550
<p>When I try to debug the following function segment, the execution brakes (jumps out of the function) at line pCellTower->m_pCellTowerInfo = pCellInfo:</p> <pre><code>RILCELLTOWERINFO* pCellInfo = (RILCELLTOWERINFO*)lpData; CCellTower *pCellTower = (CCellTower*)cbData; if(pCellTower != NULL) { pCellTower-&gt;m_...
[ { "answer_id": 442561, "author": "MSalters", "author_id": 15416, "author_profile": "https://Stackoverflow.com/users/15416", "pm_score": 3, "selected": true, "text": "<p>The most likely explanation is that pCellTower isn't set either. It could contain random bits, and end up pointing outs...
2009/01/14
[ "https://Stackoverflow.com/questions/442550", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22996/" ]
When I try to debug the following function segment, the execution brakes (jumps out of the function) at line pCellTower->m\_pCellTowerInfo = pCellInfo: ``` RILCELLTOWERINFO* pCellInfo = (RILCELLTOWERINFO*)lpData; CCellTower *pCellTower = (CCellTower*)cbData; if(pCellTower != NULL) { pCellTower->m_pCellTowerInfo =...
The most likely explanation is that pCellTower isn't set either. It could contain random bits, and end up pointing outside the memory allocated to your app. The OS cannot allow your program to write outside the space allocated to it, so it sends the program some kind of message (Windows:exception, Unix/Linux:signal) th...
442,585
<p>Our development policy dictates that all database accesses are made via stored procedures, and this is creating an issue when using LINQ.</p> <p>The scenario discussed below has been somewhat simplified, in order to make the explanation easier.</p> <p>Consider a database that has 2 tables.</p> <ul> <li>Orders (Or...
[ { "answer_id": 442595, "author": "cmsjr", "author_id": 23114, "author_profile": "https://Stackoverflow.com/users/23114", "pm_score": 3, "selected": true, "text": "<p>Have you considered creating a view like the below for the stored procedure to select from? It would add complexity, but a...
2009/01/14
[ "https://Stackoverflow.com/questions/442585", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13397/" ]
Our development policy dictates that all database accesses are made via stored procedures, and this is creating an issue when using LINQ. The scenario discussed below has been somewhat simplified, in order to make the explanation easier. Consider a database that has 2 tables. * Orders (OrderID (PK), InvoiceAddressID...
Have you considered creating a view like the below for the stored procedure to select from? It would add complexity, but allow LINQ to see the Entity the way you wanted. ``` Create view OrderAddress as Select o.OrderID ,i.AddressID as InvID ,d.AddressID as DelID ... from Orders o left join Addresses i on o.InvAddr...
442,587
<p>I have a SQLServer with a linked server onto another database somewhere else. I have created a view on that linked server</p> <pre><code>create view vw_foo as select [id], [name] from LINKEDSERVER.RemoteDatabase.dbo.tbl_bar </code></pre> <p>I'd like to to the following</p> <pre><code>alter table [baz] add foo_id...
[ { "answer_id": 442609, "author": "cmsjr", "author_id": 23114, "author_profile": "https://Stackoverflow.com/users/23114", "pm_score": 0, "selected": false, "text": "<p>No, foreign keys have to be made against user tables. Have you tried the below?</p>\n\n<pre><code>alter table [baz] with ...
2009/01/14
[ "https://Stackoverflow.com/questions/442587", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1039/" ]
I have a SQLServer with a linked server onto another database somewhere else. I have created a view on that linked server ``` create view vw_foo as select [id], [name] from LINKEDSERVER.RemoteDatabase.dbo.tbl_bar ``` I'd like to to the following ``` alter table [baz] add foo_id int not null go alter table [baz] w...
Foreign keys can't be connected to non-local objects - they have to reference local tables. You get the "maximum number of prefixes" error because you're referencing the table with a 4-part name (LinkedServer.Database.Schema.Object), and a local object would only have a 3-part name. Other solutions : 1. Replicate the...
442,589
<p>I'm looking for a piece of code which behaves a bit like a singleton but isn't (because singleton's are bad :) What I'm looking for must meet these goals:</p> <ol> <li>Thread safe</li> <li>Simple (Understand &amp; use, i.e. few lines of code. Library calls are OK)</li> <li>Fast</li> <li>Not a singleton; for tests, ...
[ { "answer_id": 442603, "author": "cletus", "author_id": 18393, "author_profile": "https://Stackoverflow.com/users/18393", "pm_score": 3, "selected": false, "text": "<p>The best idiom for threadsafe initialization code (imho) is the lazy inner class. The classic version is</p>\n\n<pre><c...
2009/01/14
[ "https://Stackoverflow.com/questions/442589", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34088/" ]
I'm looking for a piece of code which behaves a bit like a singleton but isn't (because singleton's are bad :) What I'm looking for must meet these goals: 1. Thread safe 2. Simple (Understand & use, i.e. few lines of code. Library calls are OK) 3. Fast 4. Not a singleton; for tests, it must be possible to overwrite th...
Here is a solution that fulfills all my requirements: ``` /** Lazy initialization of a field value based on the (correct) * double checked locking idiom by Joschua Bloch * * <p>See "Effective Java, Second Edition", p. 283 */ public abstract class LazyInit<T> { private volatile T field; /** Return the value. ...
442,596
<p>Can anyone point to an example written in Python (django preferred) with ajax for cascading forms? Cascading Forms is basically forms whose field values change if and when another field value changes. Example Choose Country, and then States will change...</p>
[ { "answer_id": 442659, "author": "Oli", "author_id": 12870, "author_profile": "https://Stackoverflow.com/users/12870", "pm_score": 2, "selected": false, "text": "<p>This is (<em>mostly</em>) front-end stuff.</p>\n\n<p>As you may have noticed Django attempts to leave all the AJAX stuff up...
2009/01/14
[ "https://Stackoverflow.com/questions/442596", "https://Stackoverflow.com", "https://Stackoverflow.com/users/54957/" ]
Can anyone point to an example written in Python (django preferred) with ajax for cascading forms? Cascading Forms is basically forms whose field values change if and when another field value changes. Example Choose Country, and then States will change...
This is (*mostly*) front-end stuff. As you may have noticed Django attempts to leave all the AJAX stuff up to you, so I don't think you'll find anything built in to do this. However, using JS (which is what you'll have to do in order to do this without submitting a billion forms manually), you could easily have a dja...
442,612
<p>I can successfully hide some table cells using jQuery. When I then measure the height of a hidden cell, the space that the cell would occupy if not hidden appears as blank space, pushing all the remaining cells in that row across by one column. It's as if the the cell is reinserted in the table flow, but its content...
[ { "answer_id": 609555, "author": "Stephen Curial", "author_id": 1399919, "author_profile": "https://Stackoverflow.com/users/1399919", "pm_score": 1, "selected": false, "text": "<p>Given the large volume of data and the rate that it's growing, I don't think that Amazon would be a good opt...
2009/01/14
[ "https://Stackoverflow.com/questions/442612", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12006/" ]
I can successfully hide some table cells using jQuery. When I then measure the height of a hidden cell, the space that the cell would occupy if not hidden appears as blank space, pushing all the remaining cells in that row across by one column. It's as if the the cell is reinserted in the table flow, but its content is...
Given the large volume of data and the rate that it's growing, I don't think that Amazon would be a good option. I'm assuming that you'll want to be storing the data on a persistent storage. But with EC2 you need to allocate a given amount of storage and attach it as a disk. Unless you want to allocate a really large a...
442,634
<p>We have a system with an Oracle backend to which we have access (though possibly not administrative access) and a front end to which we do not have the source code. The database is quite large and not easily understood - we have no documentation. I'm also not particularly knowledgable about Oracle in general.</p> <...
[ { "answer_id": 442648, "author": "tuinstoel", "author_id": 43901, "author_profile": "https://Stackoverflow.com/users/43901", "pm_score": 3, "selected": false, "text": "<p>Start with querying Oracle system views like V$SQL, v$sqlarea and\nv$sqltext. </p>\n" }, { "answer_id": 44285...
2009/01/14
[ "https://Stackoverflow.com/questions/442634", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51998/" ]
We have a system with an Oracle backend to which we have access (though possibly not administrative access) and a front end to which we do not have the source code. The database is quite large and not easily understood - we have no documentation. I'm also not particularly knowledgable about Oracle in general. One aspe...
Clearly there are many methods. The one that I find easiest is: (1) Connect to the database as SYS or SYSTEM (2) Query V$SESSION to identify the database session you are interested in. Record the SID and SERIAL# values. (3) Execute the following commands to activate tracing for the session: ``` exec sys.dbms_syste...
442,650
<p>I have following text in a file</p> <pre><code>23456789 </code></pre> <p>When I tried to replace the above text using command </p> <pre><code>1,$s/\(\d\)\(\d\d\d\)\(\d\d\)*\&gt;/\3\g </code></pre> <p>I am getting <code>89</code>. Shouldn't it be <code>6789</code>? Can anyone tell me why it is <code>89<...
[ { "answer_id": 442661, "author": "tddmonkey", "author_id": 51577, "author_profile": "https://Stackoverflow.com/users/51577", "pm_score": 2, "selected": true, "text": "<p>Group 3 is defined as being 2 digits long. If you want to match the last 4 digits you want <code>\\(\\d\\d\\d\\d\\)</...
2009/01/14
[ "https://Stackoverflow.com/questions/442650", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39615/" ]
I have following text in a file ``` 23456789 ``` When I tried to replace the above text using command ``` 1,$s/\(\d\)\(\d\d\d\)\(\d\d\)*\>/\3\g ``` I am getting `89`. Shouldn't it be `6789`? Can anyone tell me why it is `89`.
Group 3 is defined as being 2 digits long. If you want to match the last 4 digits you want `\(\d\d\d\d\)` with no `*` at the end. If you just want to match all digits but the first 4, put your `*` inside the group match rather than outside.
442,658
<p>I've been wrestling with a problem, maybe you guys can point me in the right direction.</p> <p>I'm trying to digitally sign a pdf, on the webserver, over an https connection.</p> <p>At page load i'm doing as so:</p> <pre><code>HttpClientCertificate cs = Request.ClientCertificate; X509Certificate card = new X509Ce...
[ { "answer_id": 20130453, "author": "DanM7", "author_id": 1387518, "author_profile": "https://Stackoverflow.com/users/1387518", "pm_score": 4, "selected": false, "text": "<p>This can happen any time you access uninitialized fields in cryptography. </p>\n\n<p>In your code, if <code>Reques...
2009/01/14
[ "https://Stackoverflow.com/questions/442658", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32037/" ]
I've been wrestling with a problem, maybe you guys can point me in the right direction. I'm trying to digitally sign a pdf, on the webserver, over an https connection. At page load i'm doing as so: ``` HttpClientCertificate cs = Request.ClientCertificate; X509Certificate card = new X509Certificate(cs.Certificate); O...
This can happen any time you access uninitialized fields in cryptography. In your code, if `Request.ClientCertificate` returns an object with no raw certificate data then you will see the error when you call `card.GetRawCertData()` on your fourth line. As a simple test, try the following: ``` var cert = new System....
442,666
<p>In workflowRuntime_WorkflowUnloaded and Loaded etc.. the only thing I can get which is pretty useless is the workflowinstanceId. I want to be able to access some DPs that are on the root activity, whenever I do a GetWorkFlowDefintion() and cast to root activity, all the property that I've passed in are all null.. </...
[ { "answer_id": 442675, "author": "Dan", "author_id": 50442, "author_profile": "https://Stackoverflow.com/users/50442", "pm_score": 1, "selected": false, "text": "<p>You have to use the TrackingServices to get more than just the basic info. See <a href=\"http://msdn.microsoft.com/en-us/li...
2009/01/14
[ "https://Stackoverflow.com/questions/442666", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
In workflowRuntime\_WorkflowUnloaded and Loaded etc.. the only thing I can get which is pretty useless is the workflowinstanceId. I want to be able to access some DPs that are on the root activity, whenever I do a GetWorkFlowDefintion() and cast to root activity, all the property that I've passed in are all null..
You have to use the TrackingServices to get more than just the basic info. See <http://msdn.microsoft.com/en-us/library/ms735887(VS.85).aspx> We use the default sqlTrackingService, host the workflow in a windows service, it is exposed using wcf and it is a state machine workflow. Here is how we used it in one case: ...
442,691
<p>Im getting a string (simplified) from the backend that should be :</p> <pre><code>{ "menu": "Reallocate:"} </code></pre> <p>However it comes to jsp as:</p> <pre><code>{ &amp;amp;#034;menu&amp;amp;#034;: &amp;amp;#034;Reallocate:&amp;amp;#034;} </code></pre> <p>and i cannot pass this to the:</p> <pre><code>var ...
[ { "answer_id": 442712, "author": "Gonzalo Quero", "author_id": 40996, "author_profile": "https://Stackoverflow.com/users/40996", "pm_score": 1, "selected": false, "text": "<p>Maybe you could decode it before passing to eval. The Prototype Javascript library has built-in functions in the ...
2009/01/14
[ "https://Stackoverflow.com/questions/442691", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51582/" ]
Im getting a string (simplified) from the backend that should be : ``` { "menu": "Reallocate:"} ``` However it comes to jsp as: ``` { &amp;#034;menu&amp;#034;: &amp;#034;Reallocate:&amp;#034;} ``` and i cannot pass this to the: ``` var data=eval("(" + src + ")"); ``` as it just doesn't like it.. How can i con...
fixed this with: ``` src = '{ "menu": "Reallocate:"}'; fname = fname.replace(/&#034;/g,'"'); document.getElementById("testout").value = fname; ``` you can add other bits to replace other things too. :)
442,697
<p>I have an application containing 4 MDB's each of which receives SOAP messages over JMS from MQ. Once the messages have been received we process the XML into an object model and process accordingly which always involves either loading or saving messages to an Oracle database via Hibernate.</p> <p>Additionally we hav...
[ { "answer_id": 442712, "author": "Gonzalo Quero", "author_id": 40996, "author_profile": "https://Stackoverflow.com/users/40996", "pm_score": 1, "selected": false, "text": "<p>Maybe you could decode it before passing to eval. The Prototype Javascript library has built-in functions in the ...
2009/01/14
[ "https://Stackoverflow.com/questions/442697", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44313/" ]
I have an application containing 4 MDB's each of which receives SOAP messages over JMS from MQ. Once the messages have been received we process the XML into an object model and process accordingly which always involves either loading or saving messages to an Oracle database via Hibernate. Additionally we have a quartz...
fixed this with: ``` src = '{ "menu": "Reallocate:"}'; fname = fname.replace(/&#034;/g,'"'); document.getElementById("testout").value = fname; ``` you can add other bits to replace other things too. :)
442,699
<p>I have the following C++ method :</p> <p>__declspec(dllexport) void __stdcall getDoubles(int *count, double **values); the method allocates and fills an array of double and sets *count to the size of the array.</p> <p>The only way i managed to get this to work via pinvoke is :</p> <pre><code>[System.Runtime.Inte...
[ { "answer_id": 442785, "author": "Ahmed", "author_id": 42749, "author_profile": "https://Stackoverflow.com/users/42749", "pm_score": 3, "selected": true, "text": "<p>I think you can use</p>\n\n<pre><code>Marshal.Copy( source, destination, 0, size );\n</code></pre>\n" }, { "answer...
2009/01/14
[ "https://Stackoverflow.com/questions/442699", "https://Stackoverflow.com", "https://Stackoverflow.com/users/54969/" ]
I have the following C++ method : \_\_declspec(dllexport) void \_\_stdcall getDoubles(int \*count, double \*\*values); the method allocates and fills an array of double and sets \*count to the size of the array. The only way i managed to get this to work via pinvoke is : ``` [System.Runtime.InteropServices.DllImport...
I think you can use ``` Marshal.Copy( source, destination, 0, size ); ```
442,701
<p>I am currently testing this in Mozilla FireFox 3.0.5 using FireBug 1.3.0 with jQuery 1.2.6.</p> <h2>First try</h2> <pre><code>document.getElementById("x").onfocus = function () { var helloWorld = "Hello World"; }; </code></pre> <p><strong>FireBug console:</strong></p> <p>document.getElementById("helloworld")...
[ { "answer_id": 442760, "author": "Adam Bellaire", "author_id": 21632, "author_profile": "https://Stackoverflow.com/users/21632", "pm_score": 2, "selected": false, "text": "<p>jQuery doesn't attach the callbacks directly, instead it stores them internally in a registry. Whenever an event...
2009/01/14
[ "https://Stackoverflow.com/questions/442701", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20946/" ]
I am currently testing this in Mozilla FireFox 3.0.5 using FireBug 1.3.0 with jQuery 1.2.6. First try --------- ``` document.getElementById("x").onfocus = function () { var helloWorld = "Hello World"; }; ``` **FireBug console:** document.getElementById("helloworld").onfocus.toString() **= function body as a st...
To view events that jQuery has bound use : ``` $("#helloworld").data('events'); ``` If you bind the focus as per your example and you run the above in firebug console it will return ``` Object focus=Object ```
442,704
<p>Is there some easy way to handle multiple submit buttons from the same form? For example:</p> <pre><code>&lt;% Html.BeginForm("MyAction", "MyController", FormMethod.Post); %&gt; &lt;input type="submit" value="Send" /&gt; &lt;input type="submit" value="Cancel" /&gt; &lt;% Html.EndForm(); %&gt; </code></pre> <p>Any ...
[ { "answer_id": 442721, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 4, "selected": false, "text": "<p>You should be able to name the buttons and give them a value; then map this name as an argument to the action. Alt...
2009/01/14
[ "https://Stackoverflow.com/questions/442704", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3713/" ]
Is there some easy way to handle multiple submit buttons from the same form? For example: ``` <% Html.BeginForm("MyAction", "MyController", FormMethod.Post); %> <input type="submit" value="Send" /> <input type="submit" value="Cancel" /> <% Html.EndForm(); %> ``` Any idea how to do this in ASP.NET Framework Beta? All...
Here is a mostly clean attribute-based solution to the multiple submit button issue based heavily on the post and comments from [Maarten Balliauw](http://blog.maartenballiauw.be/post/2009/11/26/supporting-multiple-submit-buttons-on-an-aspnet-mvc-view.aspx). ``` [AttributeUsage(AttributeTargets.Method, AllowMultiple = ...
442,710
<p>I have a Perl program, that needs to use packages (that I also write). Some of those packages are only chosen in Runtime (based on some environment variable). I don't want to put in my code a "use" line for all of those packages, of course, but only one "use" line, based on this variable, something like:</p> <pre><...
[ { "answer_id": 442738, "author": "Nathan Fellman", "author_id": 1084, "author_profile": "https://Stackoverflow.com/users/1084", "pm_score": 4, "selected": true, "text": "<pre><code>eval \"require $ENV{a}\";\n</code></pre>\n\n<p>\"<code>use</code>\" doesn't work well here because it only ...
2009/01/14
[ "https://Stackoverflow.com/questions/442710", "https://Stackoverflow.com", "https://Stackoverflow.com/users/54162/" ]
I have a Perl program, that needs to use packages (that I also write). Some of those packages are only chosen in Runtime (based on some environment variable). I don't want to put in my code a "use" line for all of those packages, of course, but only one "use" line, based on this variable, something like: ``` use $ENV{...
``` eval "require $ENV{a}"; ``` "`use`" doesn't work well here because it only imports in the context of the `eval`. As @Manni said, actually, it's better to use require. Quoting from `man perlfunc`: ``` If EXPR is a bareword, the require assumes a ".pm" extension and replaces "::" with "/" in the filename for yo...
442,723
<p>I have already googled for this </p> <pre> <code> I have a Table with following structure in SQL 2000 ID ContactName Designation 1 A CEO 2 B ABC 3 C DEF 4 D GHI </code></pre> <p>I need the Output as follows</p> <pre><code> ContactName1 Contactname2 ContactName3...
[ { "answer_id": 442884, "author": "texmex5", "author_id": 54814, "author_profile": "https://Stackoverflow.com/users/54814", "pm_score": 2, "selected": false, "text": "<p>I am not quite sure what do you mean by \"button hardly changes\" but when I write <code>&lt;Button x:Name=\"button\" B...
2009/01/14
[ "https://Stackoverflow.com/questions/442723", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have already googled for this ``` I have a Table with following structure in SQL 2000 ID ContactName Designation 1 A CEO 2 B ABC 3 C DEF 4 D GHI ``` I need the Output as follows ``` ContactName1 Contactname2 ContactName3 ContactName4 A CEO B ABC ...
I am not quite sure what do you mean by "button hardly changes" but when I write `<Button x:Name="button" Background="Gold" Foreground="Red" Content="Hello!" />` I get a golden button with red text. If you want to edit the button even more (change how it looks when you click on it etc.) then you still have to use templ...
442,729
<p>Calling all C macro gurus...</p> <p>Is there any way to write a C macro that will replace something like this:</p> <pre><code>my_var = 5; </code></pre> <p>with this:</p> <pre><code>setVar(&amp;my_var, 5); </code></pre> <p>In other words, can I write a C macro that will override assignments for a specific variab...
[ { "answer_id": 442820, "author": "Aaron Digulla", "author_id": 34088, "author_profile": "https://Stackoverflow.com/users/34088", "pm_score": 3, "selected": true, "text": "<p>Not with the standard preprocessor. It cannot change the parsing of the file, only replace proper names with a pie...
2009/01/14
[ "https://Stackoverflow.com/questions/442729", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1384/" ]
Calling all C macro gurus... Is there any way to write a C macro that will replace something like this: ``` my_var = 5; ``` with this: ``` setVar(&my_var, 5); ``` In other words, can I write a C macro that will override assignments for a specific variable (in the above example, my\_var) and instead pass it to a ...
Not with the standard preprocessor. It cannot change the parsing of the file, only replace proper names with a piece of code (and "=" isn't valid in a name). If you're feeling adventurous, you can try to replace the executable "cpp" with a small script which pre-processes the source code. But that might wreck havoc wi...
442,733
<p>I have replaced an <code>NSTextField</code> with an <code>NSTokenField</code> so that I can perform some auto-completion. The value of the <code>NSTextField</code> was bound to a <code>NSString</code> attribute of a controller class. Now that I have changed the <code>NSTextField</code> to an <code>NSTokenField</cod...
[ { "answer_id": 452907, "author": "Rob Keniger", "author_id": 50122, "author_profile": "https://Stackoverflow.com/users/50122", "pm_score": 1, "selected": false, "text": "<p>NSTokenField's value binding accepts an NSString or NSNumber binding, not an NSArray. How have you determined that ...
2009/01/14
[ "https://Stackoverflow.com/questions/442733", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2799/" ]
I have replaced an `NSTextField` with an `NSTokenField` so that I can perform some auto-completion. The value of the `NSTextField` was bound to a `NSString` attribute of a controller class. Now that I have changed the `NSTextField` to an `NSTokenField` the value has changed to an `NSArray`. How do I make the `NSTokenF...
If all you want is autocompletion, and not tokenization, you can achieve this by using a plain NSTextField and implementing the delegate method: ``` - (NSArray *)control:(NSControl *)control textView:(NSTextView *)textView completions:(NSArray *)words forPartialWordRange:(NSRange)charRange indexOfSelectedItem:(NSInteg...
442,735
<p>I'm writing some unit tests which are going to verify our handling of various resources that use other character sets apart from the normal latin alphabet: Cyrilic, Hebrew etc.</p> <p>The problem I have is that I cannot find a way to embed the expectations in the test source file: here's an example of what I'm try...
[ { "answer_id": 442761, "author": "Johannes Schaub - litb", "author_id": 34509, "author_profile": "https://Stackoverflow.com/users/34509", "pm_score": 4, "selected": false, "text": "<p>You have to tell GCC which encoding your file uses to code those characters into the file. </p>\n\n<p>Us...
2009/01/14
[ "https://Stackoverflow.com/questions/442735", "https://Stackoverflow.com", "https://Stackoverflow.com/users/912/" ]
I'm writing some unit tests which are going to verify our handling of various resources that use other character sets apart from the normal latin alphabet: Cyrilic, Hebrew etc. The problem I have is that I cannot find a way to embed the expectations in the test source file: here's an example of what I'm trying to do.....
A tedious but portable way is to build your strings using numeric escape codes. For example: ``` wchar_t *string = L"דונדארןמע"; ``` becomes: ``` wchar_t *string = "\x05d3\x05d5\x05e0\x05d3\x05d0\x05e8\x05df\x05de\x05e2"; ``` You have to convert all your Unicode characters to numeric escapes. That way your source...
442,737
<p>I've read a lot of articles about Subversion and pushing the information to a web server, but I'm still having difficulties.</p> <p>I can understand the basics about creating the repository and checking out etc., but I need help for the web server part.</p> <p>I'm running Apache and Subverion is running on the dev...
[ { "answer_id": 442746, "author": "Xn0vv3r", "author_id": 42475, "author_profile": "https://Stackoverflow.com/users/42475", "pm_score": 1, "selected": false, "text": "<p>I find there is a very good documentation for most of your questions in the <a href=\"http://tortoisesvn.net/downloads\...
2009/01/14
[ "https://Stackoverflow.com/questions/442737", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I've read a lot of articles about Subversion and pushing the information to a web server, but I'm still having difficulties. I can understand the basics about creating the repository and checking out etc., but I need help for the web server part. I'm running Apache and Subverion is running on the development server I...
There is a standard of folder structure to your repository which typically consists of at least a "trunk" and "branch" folder. This is because Subversion allows you to create a branch (it copies off the trunk and allows concurrent commits) so you can work on say "version 2" of your website. Personally I wouldn't creat...
442,742
<p>in the following code :</p> <pre><code>var benq:Base64Encoder = new Base64Encoder(); benq.encode("force",0,5); var tmp:String = benq.toString(); </code></pre> <p>'tmp' turns out to be an empty string, i.e. with length 0. why? how to encode a string using base64encoder? </p>
[ { "answer_id": 442781, "author": "schnaader", "author_id": 34065, "author_profile": "https://Stackoverflow.com/users/34065", "pm_score": 0, "selected": false, "text": "<p>Are you using Flex 3, as it seems to be a new feature? Also try encoding into a bytearray using encodeBytes and using...
2009/01/14
[ "https://Stackoverflow.com/questions/442742", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49560/" ]
in the following code : ``` var benq:Base64Encoder = new Base64Encoder(); benq.encode("force",0,5); var tmp:String = benq.toString(); ``` 'tmp' turns out to be an empty string, i.e. with length 0. why? how to encode a string using base64encoder?
Are you sure that your code isn't working. I just copied and pasted it into a test app and it returned tmp as 'Zm9yY2U=' Are you doing anything else to the var tmp? if debugging make sure that it has processed the var tmp:String.... line when your checking the output ``` <?xml version="1.0" encoding="utf-8"?><mx:Appl...
442,744
<p>How can I describe the language</p> <pre><code>A → AA | ( A ) | ε </code></pre> <p>generates using regular expressions? </p>
[ { "answer_id": 442778, "author": "David Schmitt", "author_id": 4918, "author_profile": "https://Stackoverflow.com/users/4918", "pm_score": 3, "selected": false, "text": "<p>Regular expressions cannot match nesting brackets.</p>\n" }, { "answer_id": 442866, "author": "MSalters...
2009/01/14
[ "https://Stackoverflow.com/questions/442744", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
How can I describe the language ``` A → AA | ( A ) | ε ``` generates using regular expressions?
Regular expressions accept strings from regular languages. Regular languages can also be accepted by an FSM. There's an potentially infinite number of brackets in your language that you have to match up. That means you need an infinite state, obviously impossible in any *Finite* State Machine. Therefore, your languag...
442,770
<p>I have created Ruby test script that use Selenium RC to test my web app directly in 2 browsers(IE, Firefox). My script runs - first on IE then continue on Firefox and then should be continued and finished in already opened IE browser. My problem is: I can't continue(reconnect) to run my script in already opened IE ...
[ { "answer_id": 442791, "author": "Yuval Adam", "author_id": 24545, "author_profile": "https://Stackoverflow.com/users/24545", "pm_score": 4, "selected": false, "text": "<p><a href=\"http://commons.apache.org/math/\" rel=\"nofollow noreferrer\">Apache Commons - Math</a> has what you are l...
2009/01/14
[ "https://Stackoverflow.com/questions/442770", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have created Ruby test script that use Selenium RC to test my web app directly in 2 browsers(IE, Firefox). My script runs - first on IE then continue on Firefox and then should be continued and finished in already opened IE browser. My problem is: I can't continue(reconnect) to run my script in already opened IE brow...
A co-worker suggested [colt](http://acs.lbl.gov/~hoschek/colt/), as he used it before. This [function](http://acs.lbl.gov/~hoschek/colt/api/cern/jet/random/Normal.html#cdf(double)) has exactly the result as the example in the reference document.
442,772
<p>I was fooling around with some functional programming when I came across the need for this function, however I don't know what this sort of thing is called in standard nomenclature. Anyone recognizes it?</p> <pre><code>function WhatAmIDoing(args...) return function() return args end end </code></pre> ...
[ { "answer_id": 442788, "author": "Ironicnet", "author_id": 47213, "author_profile": "https://Stackoverflow.com/users/47213", "pm_score": -1, "selected": false, "text": "<p>A delegate?</p>\n\n<p>Basically you are returning a function?? or the output of a function?</p>\n\n<p>Didn't underst...
2009/01/14
[ "https://Stackoverflow.com/questions/442772", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15124/" ]
I was fooling around with some functional programming when I came across the need for this function, however I don't know what this sort of thing is called in standard nomenclature. Anyone recognizes it? ``` function WhatAmIDoing(args...) return function() return args end end ``` **Edit:** generalized t...
WhatAmIDoing is a [higher-order function](http://en.wikipedia.org/wiki/Higher_order_function) because it is a function that returns another function. The thing that it returns is a [thunk](http://en.wikipedia.org/wiki/Thunk) — a closure created for delayed computation of the actual value. Usually thunks are created to...
442,780
<p>I understand that the question is rather hard to understand, I didn't know how to ask it better, so I'll use this code example to make things more clear:<br> If I have the following files:</p> <p>test.php:</p> <pre><code>&lt;?php include('include.php'); echo myClass::myStaticFunction(); ?&gt; </code></pre> <p>i...
[ { "answer_id": 442799, "author": "Ivan", "author_id": 53712, "author_profile": "https://Stackoverflow.com/users/53712", "pm_score": 3, "selected": true, "text": "<p>in case you need to get \"test.php\" see <code>$_SERVER['SCRIPT_NAME']</code></p>\n" }, { "answer_id": 443345, ...
2009/01/14
[ "https://Stackoverflow.com/questions/442780", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35197/" ]
I understand that the question is rather hard to understand, I didn't know how to ask it better, so I'll use this code example to make things more clear: If I have the following files: test.php: ``` <?php include('include.php'); echo myClass::myStaticFunction(); ?> ``` include.php ``` <?php __autoload($class...
in case you need to get "test.php" see `$_SERVER['SCRIPT_NAME']`
442,784
<p>As I understand the standard, a trivial destructor is one which is implicitly declared and whose class has only base and non-static members with trivial destructors. Given the recursivity of this definition, it seems to me that the only "recursion-stopping" condition is to find a base or non-static member with a non...
[ { "answer_id": 442798, "author": "Johannes Schaub - litb", "author_id": 34509, "author_profile": "https://Stackoverflow.com/users/34509", "pm_score": 4, "selected": true, "text": "<p>No. An implicitly defined, trivial destructor is by definition trivial :) The difference between the decl...
2009/01/14
[ "https://Stackoverflow.com/questions/442784", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41789/" ]
As I understand the standard, a trivial destructor is one which is implicitly declared and whose class has only base and non-static members with trivial destructors. Given the recursivity of this definition, it seems to me that the only "recursion-stopping" condition is to find a base or non-static member with a non-im...
No. An implicitly defined, trivial destructor is by definition trivial :) The difference between the declare and define thingy is that in order for the compiler to even *see* that a destructor is available, there must always a declaration. So if you don't provide one, it will implicitly provide one. But now, it will ...
442,786
<p>as per the title; is it possible to have nested comments in valid HTML? see the example below...</p> <pre><code>&lt;p&gt;some text&lt;/p&gt; &lt;!-- comment 1 &lt;p&gt;commented out html&lt;/p&gt; &lt;!-- comment 2 // are nested html comment allowed? end of comment 2 --&gt; &lt;p&gt;mo...
[ { "answer_id": 442794, "author": "Sergio", "author_id": 32037, "author_profile": "https://Stackoverflow.com/users/32037", "pm_score": 3, "selected": false, "text": "<p>It cannot be done. <code>--&gt;</code> will always end an existing HTML comment.</p>\n" }, { "answer_id": 442796...
2009/01/14
[ "https://Stackoverflow.com/questions/442786", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14260/" ]
as per the title; is it possible to have nested comments in valid HTML? see the example below... ``` <p>some text</p> <!-- comment 1 <p>commented out html</p> <!-- comment 2 // are nested html comment allowed? end of comment 2 --> <p>more commented out html</p> end of comment 1 --> <p...
When you nest a comment, replace "--" with "- -". When you un-nest, reverse the procedure. It's not the `<!--` that is forbidden but the `--`. Example: ``` <!-- some stuff <!- - some inner stuff - -> <!- - a sibling - -> the footer --> ```
442,815
<p>There's been a lot of interest in <a href="http://en.wikipedia.org/wiki/Service-oriented_architecture" rel="noreferrer">Service-Oriented Architecture</a> (SOA) at my company recently. Whenever I try to see how we might use it, I always run up against a mental block. Crudely:</p> <ul> <li><p>Object-orientation says:...
[ { "answer_id": 442843, "author": "Jesse Pepper", "author_id": 43058, "author_profile": "https://Stackoverflow.com/users/43058", "pm_score": 4, "selected": true, "text": "<p>I really think SOA is only useful for external interfaces (generally speaking, to those outside your company), and ...
2009/01/14
[ "https://Stackoverflow.com/questions/442815", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21849/" ]
There's been a lot of interest in [Service-Oriented Architecture](http://en.wikipedia.org/wiki/Service-oriented_architecture) (SOA) at my company recently. Whenever I try to see how we might use it, I always run up against a mental block. Crudely: * Object-orientation says: "keep data and methods that manipulate data ...
I really think SOA is only useful for external interfaces (generally speaking, to those outside your company), and even then, only in cases when performance doesn't really matter, you don't need ordered delivery of messages. In light of that, I think they can coexist. Keep your applications working and communicating u...
442,817
<p>I have a list view that is periodically updated (every 60 seconds). It was anoying to me that i would get a flicker every time it up dated. The method being used was to clear all the items and then recreate them. I decided to instead of clearing the items I would just write directly to the cell with the new text. Is...
[ { "answer_id": 442828, "author": "Stormenet", "author_id": 2090, "author_profile": "https://Stackoverflow.com/users/2090", "pm_score": 8, "selected": true, "text": "<p>The ListView control has a flicker issue. The problem appears to be that the control's Update overload is improperly imp...
2009/01/14
[ "https://Stackoverflow.com/questions/442817", "https://Stackoverflow.com", "https://Stackoverflow.com/users/54009/" ]
I have a list view that is periodically updated (every 60 seconds). It was anoying to me that i would get a flicker every time it up dated. The method being used was to clear all the items and then recreate them. I decided to instead of clearing the items I would just write directly to the cell with the new text. Is th...
The ListView control has a flicker issue. The problem appears to be that the control's Update overload is improperly implemented such that it acts like a Refresh. An Update should cause the control to redraw only its invalid regions whereas a Refresh redraws the control’s entire client area. So if you were to change, s...
442,862
<p>Java <code>.class</code> files can be decompiled fairly easily. How can I protect my database if I have to use the login data in the code?</p>
[ { "answer_id": 442868, "author": "Keltia", "author_id": 16143, "author_profile": "https://Stackoverflow.com/users/16143", "pm_score": 4, "selected": false, "text": "<p>Put the password into a file that the application will read. NEVER embed passwords in a source file. Period.</p>\n\n<p>...
2009/01/14
[ "https://Stackoverflow.com/questions/442862", "https://Stackoverflow.com", "https://Stackoverflow.com/users/54988/" ]
Java `.class` files can be decompiled fairly easily. How can I protect my database if I have to use the login data in the code?
Never hard-code passwords into your code. This was brought up recently in the [Top 25 Most Dangerous Programming Mistakes](http://blog.codinghorror.com/top-25-most-dangerous-programming-mistakes/): > > Hard-coding a secret account and > password into your software is > extremely convenient -- for skilled > reverse...
442,869
<p>I have a C# WCF REST Service which allows the addition of a bookmark, by sending an HTTP POST request with the bookmark serialised in XML. I have specified the operation contract for the service, which picks up the xml and automatically deserialises the object for me. My problem is that the deserialisation only work...
[ { "answer_id": 442947, "author": "Jomit", "author_id": 49730, "author_profile": "https://Stackoverflow.com/users/49730", "pm_score": -1, "selected": false, "text": "<p>Try setting the Order to 0 in the DataMember attribute (for all members):</p>\n\n<p>[DataMember(Name = \"Title\", Order ...
2009/01/14
[ "https://Stackoverflow.com/questions/442869", "https://Stackoverflow.com", "https://Stackoverflow.com/users/54976/" ]
I have a C# WCF REST Service which allows the addition of a bookmark, by sending an HTTP POST request with the bookmark serialised in XML. I have specified the operation contract for the service, which picks up the xml and automatically deserialises the object for me. My problem is that the deserialisation only works c...
The DataContractSerializer requires strict ordering of elements for both versioning and performance reasons. There are some options I can think of, 1. write a message inspector to re-order the raw XML elements in AfterReceivedRequest before it's deserialized by dataContractSerializer. 2. using the XmlSerializer for ...
442,878
<p>I embed SVG graphics in my Flex application using</p> <pre><code>package MyUI { public class Assets { [Embed(source="/assets/pic.svg"] [Bindable] public static var svgPic:Class; } } </code></pre> <p>and then extending the Tree class with some of my own code, setting the icon upo...
[ { "answer_id": 443357, "author": "Christian Nunciato", "author_id": 32129, "author_profile": "https://Stackoverflow.com/users/32129", "pm_score": 0, "selected": false, "text": "<p>The answer to this question might point you in the right direction, without knowing more about the trouble y...
2009/01/14
[ "https://Stackoverflow.com/questions/442878", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2077/" ]
I embed SVG graphics in my Flex application using ``` package MyUI { public class Assets { [Embed(source="/assets/pic.svg"] [Bindable] public static var svgPic:Class; } } ``` and then extending the Tree class with some of my own code, setting the icon upon adding a node to the dat...
Subclass [mx.controls.treeClasses.TreeItemRenderer](http://livedocs.adobe.com/flex/3/langref/mx/controls/treeClasses/TreeItemRenderer.html) and make it resize the icon to your desired dimensions, or create your own item renderer implementation by using the same interfaces as TreeItemRenderer. Set a custom item renderer...
442,883
<p>I have a SQL query that takes a very long time to run on MySQL (it takes several minutes). The query is run against a table that has over 100 million rows, so I'm not surprised it's slow. In theory, though, it should be possible to speed it up as I really only want to get back the rows from the large table (let's ca...
[ { "answer_id": 442909, "author": "Adam Pope", "author_id": 12226, "author_profile": "https://Stackoverflow.com/users/12226", "pm_score": 0, "selected": false, "text": "<p>SELECT id FROM A JOIN B ON A.ref = B.ref</p>\n\n<p>You may be able to optimize further by using an appropriate type o...
2009/01/14
[ "https://Stackoverflow.com/questions/442883", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11522/" ]
I have a SQL query that takes a very long time to run on MySQL (it takes several minutes). The query is run against a table that has over 100 million rows, so I'm not surprised it's slow. In theory, though, it should be possible to speed it up as I really only want to get back the rows from the large table (let's call ...
The query optimizer is probably already doing the best that it can, but in the unlikely event that it's reading the giant table (A) first, you can explicitly tell it to read B first using the `STRAIGHT_JOIN` syntax: ``` SELECT STRAIGHT_JOIN id FROM B, A where B.ref = A.ref; ```
442,910
<p>I would like to define an asp.net page from xml, then parse/render it by calling a command name. Just like they do in Flex. Does someone has an idea how to do that?</p> <p>Like for example, from XML:</p> <pre><code>&lt;button onClick="DoJavascript()" text="Submit"/&gt; &lt;gridview ......./&gt; </code></pre> <p>T...
[ { "answer_id": 443067, "author": "Otávio Décio", "author_id": 48684, "author_profile": "https://Stackoverflow.com/users/48684", "pm_score": 1, "selected": false, "text": "<p>You could try XSLT, that's in general what is used to transform XML.</p>\n" }, { "answer_id": 443139, ...
2009/01/14
[ "https://Stackoverflow.com/questions/442910", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I would like to define an asp.net page from xml, then parse/render it by calling a command name. Just like they do in Flex. Does someone has an idea how to do that? Like for example, from XML: ``` <button onClick="DoJavascript()" text="Submit"/> <gridview ......./> ``` To parse: `<asp:button runat="server" onClick...
You could try XSLT, that's in general what is used to transform XML.
442,915
<p>I have an access database on a windows machine, which I must import into mysql on a linux webserver. At the moment the access dabatbase table is exported as a text file, automatically copied with ftp, and then loaded into mysql.</p> <p>Is there a better way to do this, perhaps using an ODBC connection or something ...
[ { "answer_id": 442939, "author": "Keltia", "author_id": 16143, "author_profile": "https://Stackoverflow.com/users/16143", "pm_score": 1, "selected": false, "text": "<p>If you do want incremental updates, the way to do it is writing a script that does connect to both databases (through OD...
2009/01/14
[ "https://Stackoverflow.com/questions/442915", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1246613/" ]
I have an access database on a windows machine, which I must import into mysql on a linux webserver. At the moment the access dabatbase table is exported as a text file, automatically copied with ftp, and then loaded into mysql. Is there a better way to do this, perhaps using an ODBC connection or something else? Wh...
Why not link the tables through ODBC as suggested by Keltia, and then use a series of queries to add records that are missing and to update changed records. The queries can be run through VBA. ADO will also work well with MySQL and Access. Some notes on code used in Access: ``` Set db = CurrentDb strSQL = "Inse...
442,918
<p>Google/MyBrain are failing me. Without using a framework (which I'll never get past my colleagues), how do you inject a dependency into an HTTPModule given that you (the programmer) are not in control of creating the instance?</p> <p>Are we into hacking up custom web.config sections + reflection or is there somethi...
[ { "answer_id": 443038, "author": "loraderon", "author_id": 22092, "author_profile": "https://Stackoverflow.com/users/22092", "pm_score": 0, "selected": false, "text": "<p>You can use a very simple one-class ioc <a href=\"http://www.kenegozi.com/Blog/2008/01/17/its-my-turn-to-build-an-ioc...
2009/01/14
[ "https://Stackoverflow.com/questions/442918", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13018/" ]
Google/MyBrain are failing me. Without using a framework (which I'll never get past my colleagues), how do you inject a dependency into an HTTPModule given that you (the programmer) are not in control of creating the instance? Are we into hacking up custom web.config sections + reflection or is there something cleaner...
I've stumbled on a programatic solution. Eliminating web.config references entirely, you can add a module into global.asax if you're careful with the life-cycle. In global.asax add: ``` public static ErrorModule myErrorModule; public override void Init() { base.Init(); myErrorModule = new ErrorModule(new Log...
442,924
<p>I normally try to avoid duplication and adhere to the DRY principle. However, I'm wondering about a case like this:</p> <pre><code>public class Feature { final static String FEATURE_LABEL = "blah"; public void doSomething() { ... } ... } public class FeatureTest { ... @Test public void doS...
[ { "answer_id": 442955, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 1, "selected": false, "text": "<p>I would stick with the reference for the moment.</p>\n\n<p>The thing is, if the requirement changes that <em>should</...
2009/01/14
[ "https://Stackoverflow.com/questions/442924", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18995/" ]
I normally try to avoid duplication and adhere to the DRY principle. However, I'm wondering about a case like this: ``` public class Feature { final static String FEATURE_LABEL = "blah"; public void doSomething() { ... } ... } public class FeatureTest { ... @Test public void doSomethingShould...
Yes, use a literal here. Quoting myself from [a question on literals](https://stackoverflow.com/questions/401919/is-hard-coding-literals-ever-acceptable#437811): *Hardcoded literals should appear in unit tests for the test values, unless there is so much reuse of a value within a single test class that a local consta...
442,933
<p>Is there a shortcut to add an event method for a control? If I have a button, I want to add the Click method without having to type it out or switch to design view.</p> <p>EDIT: Seriously! When i did this in VB I had a drop down list of all the controls and their events. Is that so hard to do for C#? </p>
[ { "answer_id": 442954, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 4, "selected": true, "text": "<p>Winforms? Webforms? What?</p>\n\n<p>One option is to (after initialization) hook the event your self - intellisense...
2009/01/14
[ "https://Stackoverflow.com/questions/442933", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23230/" ]
Is there a shortcut to add an event method for a control? If I have a button, I want to add the Click method without having to type it out or switch to design view. EDIT: Seriously! When i did this in VB I had a drop down list of all the controls and their events. Is that so hard to do for C#?
Winforms? Webforms? What? One option is to (after initialization) hook the event your self - intellisense supplies the event name, and [Tab][Tab] creates the method stub - i.e. ``` public MyForm() { InitializeComponent() someButton.Click += (press [tab][tab] now) } ``` and it does the rest... likewise in we...
442,985
<p>Ok, here's a problem script.</p> <pre><code>var links = [ 'one', 'two', 'three' ]; for( var i = 0; i &lt; links.length; i++ ) { var a = document.createElement( 'div' ); a.innerHTML = links[i]; a.onclick = function() { alert( i ) } document.body.appendChild( a ); } </code></pre> <p>This script gene...
[ { "answer_id": 442999, "author": "Greg", "author_id": 24181, "author_profile": "https://Stackoverflow.com/users/24181", "pm_score": 5, "selected": true, "text": "<p>You need to use this little closure trick - create and execute a function that returns your event handler function.</p>\n\n...
2009/01/14
[ "https://Stackoverflow.com/questions/442985", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12161/" ]
Ok, here's a problem script. ``` var links = [ 'one', 'two', 'three' ]; for( var i = 0; i < links.length; i++ ) { var a = document.createElement( 'div' ); a.innerHTML = links[i]; a.onclick = function() { alert( i ) } document.body.appendChild( a ); } ``` This script generates three divs: one, two an...
You need to use this little closure trick - create and execute a function that returns your event handler function. ``` var links = [ 'one', 'two', 'three' ]; for( var i = 0; i < links.length; i++ ) { var a = document.createElement( 'div' ); a.innerHTML = links[i]; a.onclick = (function(i) { return functi...
443,000
<p>We have several different optimization algorithms that produce a different result for each run. For example the goal of the optimization could be to find the minimum of a function, where 0 is the global minima. The optimization runs returns data like this:</p> <pre><code>[0.1, 0.1321, 0.0921, 0.012, 0.4] </code></p...
[ { "answer_id": 443031, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 3, "selected": false, "text": "<p>Let the tests run, and if any of them fail, rerun <em>just those tests</em> 50 times and see what proportion of the t...
2009/01/14
[ "https://Stackoverflow.com/questions/443000", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48181/" ]
We have several different optimization algorithms that produce a different result for each run. For example the goal of the optimization could be to find the minimum of a function, where 0 is the global minima. The optimization runs returns data like this: ``` [0.1, 0.1321, 0.0921, 0.012, 0.4] ``` Which is quite clo...
It sounds like your optimizer needs two kinds of testing: 1. testing the overall effectiveness of the algorithm 2. testing the integrity of your implementation of the algorithm Since the algorithm involves randomization, (1) is difficult to unit-test. Any test of a random process will fail some proportion of the tim...
443,009
<p>Hey guys i wrote a quick test. I want delete to call deleteMe which will then delete itself. The purpose of this is so i can delete obj normally which are allocated by a lib. (i dont want any crashes due to crt or w/e).</p> <p>With delete this i get a stackoverflow, without it msvc says i leaked 4 bytes. When i don...
[ { "answer_id": 443025, "author": "Paul Tomblin", "author_id": 3333, "author_profile": "https://Stackoverflow.com/users/3333", "pm_score": 1, "selected": false, "text": "<p>You should not be overriding delete. Especially not to a function that ends up calling delete. Any memory freeing ...
2009/01/14
[ "https://Stackoverflow.com/questions/443009", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Hey guys i wrote a quick test. I want delete to call deleteMe which will then delete itself. The purpose of this is so i can delete obj normally which are allocated by a lib. (i dont want any crashes due to crt or w/e). With delete this i get a stackoverflow, without it msvc says i leaked 4 bytes. When i dont call tes...
The recursion is due to `deleteMe` calling `delete`, which calls B's `operator delete` that calls `deleteMe` again. It's OK to overload `operator delete` (although you usually overload `operator new` as well), especially when handling "foreign" objects which is likely your case, however you must in turn call the actual...
443,030
<p>I have a custom feature which is an Edit Control Block (ECB) action in a document library that gets deployed as a solution package (WSP). When you pull down the dropdown next to a file, you see the feature and when the ECB action is selected, the user is redirected to a custom application page.</p> <p>I allow this ...
[ { "answer_id": 443143, "author": "Oleg Sych", "author_id": 49858, "author_profile": "https://Stackoverflow.com/users/49858", "pm_score": 2, "selected": false, "text": "<p>You can redistribute T4 as part of <a href=\"http://www.microsoft.com/downloads/details.aspx?familyid=693EE22D-4BB1-4...
2009/01/14
[ "https://Stackoverflow.com/questions/443030", "https://Stackoverflow.com", "https://Stackoverflow.com/users/54997/" ]
I have a custom feature which is an Edit Control Block (ECB) action in a document library that gets deployed as a solution package (WSP). When you pull down the dropdown next to a file, you see the feature and when the ECB action is selected, the user is redirected to a custom application page. I allow this feature to...
It looks like there may soon be another option. Yesterday, Miguel de Icaza posted about T4 integration in MonoDevelop, so I'm expecting there to be a mono equivalent T4 toolset any time now. See: <http://tirania.org/blog/archive/2009/Mar-10.html>
443,044
<p>Is it possible to use If Else conditional in a LINQ query?</p> <p>Something like</p> <pre><code>from p in db.products if p.price&gt;0 select new { Owner=from q in db.Users select q.Name } else select new { Owner = from r in db.ExternalUsers select r.Name } </code></pre>
[ { "answer_id": 443050, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 4, "selected": false, "text": "<p>I assume from <code>db</code> that this is LINQ-to-SQL / Entity Framework / similar (not LINQ-to-Objects);</p>\n\n...
2009/01/14
[ "https://Stackoverflow.com/questions/443044", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3834/" ]
Is it possible to use If Else conditional in a LINQ query? Something like ``` from p in db.products if p.price>0 select new { Owner=from q in db.Users select q.Name } else select new { Owner = from r in db.ExternalUsers select r.Name } ```
This might work... ``` from p in db.products select new { Owner = (p.price > 0 ? from q in db.Users select q.Name : from r in db.ExternalUsers select r.Name) } ```
443,074
<p>I'm working on a project which shall contain two targets. One for building a Framework to use in Mac development and another to create a static library to use in iPhone development.</p> <p>In the common code it's no problem to #ifdef between the platforms, but I just can't get the targets and dependencies right.</p...
[ { "answer_id": 443749, "author": "Henrik Hartz", "author_id": 50830, "author_profile": "https://Stackoverflow.com/users/50830", "pm_score": -1, "selected": false, "text": "<p>Can't you use the <a href=\"http://www.ddj.com//cpp/205918714\" rel=\"nofollow noreferrer\">PIMPL idiom</a>? And/...
2009/01/14
[ "https://Stackoverflow.com/questions/443074", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25724/" ]
I'm working on a project which shall contain two targets. One for building a Framework to use in Mac development and another to create a static library to use in iPhone development. In the common code it's no problem to #ifdef between the platforms, but I just can't get the targets and dependencies right. The first q...
Just to let you know: I ended up having one project with different targets for the different platforms. But I didn't include the framework I depend on in the targets itself, but rather added them to the *Other Linker Flags* build settings: ``` -framework Foundation -framework Security ``` You can check it out in th...
443,081
<p>I have a big set of data in excel of the following form</p> <hr> <pre><code>A B 1 stuff1 6 stuff2 3 stuff3 1 stuff4 1 stuff5 7 stuff6 3 stuff7 2 stuff8 . . . . . . 5 stuffn </code></pre> <hr> <p>and what i would like is some vba code that will select all the cells in B that have a "1" i...
[ { "answer_id": 443663, "author": "codybartfast", "author_id": 53252, "author_profile": "https://Stackoverflow.com/users/53252", "pm_score": 1, "selected": false, "text": "<p>Yes, I've successfully installed it ( Win7 64bit + Dev edition + SP1 + Team Explorer) and not encountered any issu...
2009/01/14
[ "https://Stackoverflow.com/questions/443081", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a big set of data in excel of the following form --- ``` A B 1 stuff1 6 stuff2 3 stuff3 1 stuff4 1 stuff5 7 stuff6 3 stuff7 2 stuff8 . . . . . . 5 stuffn ``` --- and what i would like is some vba code that will select all the cells in B that have a "1" in column A - I will be using...
So, i tried installing this on my other laptop, and it installed fine. Only (software) difference between the 2 laptops was that one had been running for a few days longer, and had all of the windows update patches installed on it. So, I checked the first laptop that the install failed on, and there were a bunch of O...
443,102
<p>My wcf service's web.config looks like this:</p> <p>How can I confirm that it is using the settings correctly?</p> <p><strong>I still get this timeout error sometimes even though I have configured the binding to use: SendTimeout = 10 minutes etc. ?</strong></p> <pre><code>&lt;system.serviceModel&gt; &lt;serv...
[ { "answer_id": 443145, "author": "ctacke", "author_id": 13154, "author_profile": "https://Stackoverflow.com/users/13154", "pm_score": 2, "selected": false, "text": "<p>Yes, COM assemblies are registered so that the COM infrastructure knows they exist. The DLLs are found by registration ...
2009/01/14
[ "https://Stackoverflow.com/questions/443102", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39677/" ]
My wcf service's web.config looks like this: How can I confirm that it is using the settings correctly? **I still get this timeout error sometimes even though I have configured the binding to use: SendTimeout = 10 minutes etc. ?** ``` <system.serviceModel> <services> <service behaviorConfiguration="MyServ...
1) No - it is NOT necessary to register COM *objects*. Registration is needed to create *new* COM objects. There are many interfaces (COM or native functions) that want a COM object. Their API tells you which interface your COM object should support. Since you pass in an existing COM object, they don't need registratio...
443,111
<p>I.e. the match of</p> <pre><code> He said, "For my part, it was Greek to me. " </code></pre> <p>should be </p> <pre><code>For my part, it was Greek to me. </code></pre> <p>Without the trailing space. I've tried</p> <pre><code>\"\s*([^\"]*)\s*\" </code></pre> <p>but it's always matching trailing whitespaces in ...
[ { "answer_id": 443124, "author": "Sebastian Dietz", "author_id": 52837, "author_profile": "https://Stackoverflow.com/users/52837", "pm_score": 1, "selected": false, "text": "<p>Wouldn't it be easier to just trim the blanks afterwards using simple string functions? This would also simplif...
2009/01/14
[ "https://Stackoverflow.com/questions/443111", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4085/" ]
I.e. the match of ``` He said, "For my part, it was Greek to me. " ``` should be ``` For my part, it was Greek to me. ``` Without the trailing space. I've tried ``` \"\s*([^\"]*)\s*\" ``` but it's always matching trailing whitespaces in the group.
try: ``` \"\s*([^\"]*?)\s*\" ``` But be careful, this version is contingent upon the closing quotation mark (because it's lazy). When you add the lazy operator here, it grabs the smallest possible string it can. If there are no closing quotes, this regular expression will fail If you're sure there's no empty string...
443,128
<p>I'm using winsock and calling <code>connect</code> on a non-blocking socket. I occasionally see some delay (up to 200ms) before the function returns when the CPU is hogged by other processes. From what I know, a <code>connect</code> on a non-blocking socket should return immediately, but perhaps <code>connect</code>...
[ { "answer_id": 443124, "author": "Sebastian Dietz", "author_id": 52837, "author_profile": "https://Stackoverflow.com/users/52837", "pm_score": 1, "selected": false, "text": "<p>Wouldn't it be easier to just trim the blanks afterwards using simple string functions? This would also simplif...
2009/01/14
[ "https://Stackoverflow.com/questions/443128", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15109/" ]
I'm using winsock and calling `connect` on a non-blocking socket. I occasionally see some delay (up to 200ms) before the function returns when the CPU is hogged by other processes. From what I know, a `connect` on a non-blocking socket should return immediately, but perhaps `connect` causes a context switch and since t...
try: ``` \"\s*([^\"]*?)\s*\" ``` But be careful, this version is contingent upon the closing quotation mark (because it's lazy). When you add the lazy operator here, it grabs the smallest possible string it can. If there are no closing quotes, this regular expression will fail If you're sure there's no empty string...
443,144
<p>I have a class that defines a read-only property that effectively exposes a private field, something like this:</p> <pre><code>public class Container { private List&lt;int&gt; _myList; public List&lt;int&gt; MyList { get { return _myList;} } public Container() : base () { _...
[ { "answer_id": 443179, "author": "Stu Mackellar", "author_id": 28591, "author_profile": "https://Stackoverflow.com/users/28591", "pm_score": 1, "selected": false, "text": "<p>Have a look at the static <a href=\"http://msdn.microsoft.com/en-us/library/53kysx7b.aspx\" rel=\"nofollow norefe...
2009/01/14
[ "https://Stackoverflow.com/questions/443144", "https://Stackoverflow.com", "https://Stackoverflow.com/users/54981/" ]
I have a class that defines a read-only property that effectively exposes a private field, something like this: ``` public class Container { private List<int> _myList; public List<int> MyList { get { return _myList;} } public Container() : base () { _myList = new List<int>(); ...
The reference is ["readonly"](http://msdn.microsoft.com/en-us/library/acdd6hb7(VS.71).aspx), the the actual object. I.e. you can't replace the reference with another object. So if you have a class that breaks it like this: ``` public class Container { private readonly List<int> _myList; public List<int> MyLi...
443,151
<p>I've been trying to make sense of the BouncyCastle cryptography APIs for Java. Unfortunately, I'm finding Java cryptography in general to be so obscured by service provider interfaces and jargon that I can't wrap my head around what anything actually does. I've tried reading the necessary documentation repeatedly bu...
[ { "answer_id": 443247, "author": "Jason S", "author_id": 44330, "author_profile": "https://Stackoverflow.com/users/44330", "pm_score": 1, "selected": false, "text": "<p>hmm, have you tried the <a href=\"https://rads.stackoverflow.com/amzn/click/com/1565924029\" rel=\"nofollow noreferrer\...
2009/01/14
[ "https://Stackoverflow.com/questions/443151", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15255/" ]
I've been trying to make sense of the BouncyCastle cryptography APIs for Java. Unfortunately, I'm finding Java cryptography in general to be so obscured by service provider interfaces and jargon that I can't wrap my head around what anything actually does. I've tried reading the necessary documentation repeatedly but i...
``` import java.security.GeneralSecurityException; import java.security.KeyPair; import java.security.KeyPairGenerator; import java.security.PrivateKey; import java.security.PublicKey; import javax.crypto.Cipher; public class RSACrypto { /* A 1024-bit key will encrypt messages up to 117 bytes long. */ private st...