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
361,151
<p>I made an html file called test.html then I navigated to it as "<a href="http://site.com/test.html?test1=a" rel="nofollow noreferrer">http://site.com/test.html?test1=a</a>" but the textbox stayed blank. Why is this? </p> <p>Super simple code</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;Test&lt;/title&gt; ...
[ { "answer_id": 361158, "author": "Sydius", "author_id": 43496, "author_profile": "https://Stackoverflow.com/users/43496", "pm_score": 3, "selected": true, "text": "<p>The file should be a PHP file, so test.php.</p>\n\n<p>Then maybe something like this:</p>\n\n<pre><code>&lt;html&gt;\n&lt...
2008/12/11
[ "https://Stackoverflow.com/questions/361151", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39143/" ]
I made an html file called test.html then I navigated to it as "<http://site.com/test.html?test1=a>" but the textbox stayed blank. Why is this? Super simple code ``` <html> <head> <title>Test</title> </head> <body > <input type=text name="test1"> </body> </html> ```
The file should be a PHP file, so test.php. Then maybe something like this: ``` <html> <head> <title>Test</title> </head> <body> <input type="text" name="test1" value="<?php echo htmlspecialchars($_GET['test1'], ENT_QUOTES); ?>"> </body> </html> ``` The reason it stays blank in your example is because there...
361,161
<p>I have a Rails app that lets a user construct a database query by filling out an extensive form. I wondered the best practice for checking form parameters in Rails. Previously, I have had my <code>results</code> method (the one to which the form submits) do the following:</p> <pre><code>if params[:name] &amp;&amp...
[ { "answer_id": 361186, "author": "Jamal Hansen", "author_id": 2035722, "author_profile": "https://Stackoverflow.com/users/2035722", "pm_score": 3, "selected": false, "text": "<p>Looks like you are doing the validation in the controller, try putting it in the model, it's better suited to ...
2008/12/11
[ "https://Stackoverflow.com/questions/361161", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38743/" ]
I have a Rails app that lets a user construct a database query by filling out an extensive form. I wondered the best practice for checking form parameters in Rails. Previously, I have had my `results` method (the one to which the form submits) do the following: ``` if params[:name] && !params[:name].blank? @name = p...
You could try active\_form ([<http://github.com/cs/active_form/tree/master/lib/active_form.rb>](http://github.com/cs/active_form/tree/master/lib/active_form.rb)) - just ActiveRecord minus the database stuff. This way you can use all of AR's validation stuff and treat your form like you would any other model. ``` class...
361,163
<p>I want to use pretty 3d button images on my website. However, currently the way this works is the text is part of the image.</p> <p>So, when I want to change the text (or make a new button) it's a 10 minute editing chore instead of a 20 second text change.</p> <p>I've seen a few websites that have a blank button w...
[ { "answer_id": 361171, "author": "Jimmy", "author_id": 4435, "author_profile": "https://Stackoverflow.com/users/4435", "pm_score": 0, "selected": false, "text": "<p>perhaps something like</p>\n\n<pre><code>a { \n width: something ; \n height: something; \n display: block; \n back...
2008/12/11
[ "https://Stackoverflow.com/questions/361163", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4906/" ]
I want to use pretty 3d button images on my website. However, currently the way this works is the text is part of the image. So, when I want to change the text (or make a new button) it's a 10 minute editing chore instead of a 20 second text change. I've seen a few websites that have a blank button with text on it. ...
Make the button a background image: ``` <style> div.button a { display: block; width: /* image width */; line-height: /* image height */; text-align: center; background: url(/* image uri */) no-repeat; } </style> ```
361,175
<p>Been using the code below to return a single record from the database. I have read that ExecuteScalar is the right way to return a single record. I have never been able to get ExecuteScalar to work though. How would I change this to return a single value in VB.Net using ExecuteScalar?</p> <pre><code> Dim oracl...
[ { "answer_id": 361205, "author": "Jim Anderson", "author_id": 42439, "author_profile": "https://Stackoverflow.com/users/42439", "pm_score": 2, "selected": false, "text": "<p>ExecuteScalar returns a single value (scalar) not a record.</p>\n" }, { "answer_id": 372242, "author":...
2008/12/11
[ "https://Stackoverflow.com/questions/361175", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38349/" ]
Been using the code below to return a single record from the database. I have read that ExecuteScalar is the right way to return a single record. I have never been able to get ExecuteScalar to work though. How would I change this to return a single value in VB.Net using ExecuteScalar? ``` Dim oracleConnection As N...
From Microsoft "The ExecuteOracleScalar() method of the OracleCommand class is used to execute a SQL statement or stored procedure that returns a single value as an OracleType data type. If the command returns a result set, the method returns the value of the first column of the first row. The method returns a null re...
361,204
<p>I am trying to use ASP to create a connection to my database and i have the following connection code:</p> <pre><code>Set objConn = ConnectDB() Set objRS = objConn.Execute(query) </code></pre> <p>I have an include file that I have at the top of my page:</p> <pre><code>&lt;!--#include FILE=dbcano.inc--&gt; </cod...
[ { "answer_id": 361227, "author": "Eran Galperin", "author_id": 10585, "author_profile": "https://Stackoverflow.com/users/10585", "pm_score": 1, "selected": false, "text": "<p>The easiest way to get the headers of a URL is with <a href=\"http://www.php.net/get_headers\" rel=\"nofollow nor...
2008/12/11
[ "https://Stackoverflow.com/questions/361204", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I am trying to use ASP to create a connection to my database and i have the following connection code: ``` Set objConn = ConnectDB() Set objRS = objConn.Execute(query) ``` I have an include file that I have at the top of my page: ``` <!--#include FILE=dbcano.inc--> ``` And I get this error when I call my page: ...
I think you need a multi-process batch URL fetching daemon. PHP does not support multithreading, but there's nothing stopping you from spawning multiple PHP daemon processes. Having said that, PHP's lack of a proper garbage collector means that long-running processes can leak memory. Run a daemon which spawns lots of...
361,209
<p>I've got two controls, a TextBlock and a PopUp. When the user clicks (MouseDown) on the textblock, I want to display the popup. I would think that I could do this with an EventTrigger on the Popup, but I can't use setters in an EventTrigger, I can only start storyboards. I want to do this strictly in XAML, because t...
[ { "answer_id": 361302, "author": "bendewey", "author_id": 37881, "author_profile": "https://Stackoverflow.com/users/37881", "pm_score": 3, "selected": false, "text": "<p>I had some issues with the MouseDown part of this, but here is some code that might get your started.</p>\n\n<pre><cod...
2008/12/11
[ "https://Stackoverflow.com/questions/361209", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4572/" ]
I've got two controls, a TextBlock and a PopUp. When the user clicks (MouseDown) on the textblock, I want to display the popup. I would think that I could do this with an EventTrigger on the Popup, but I can't use setters in an EventTrigger, I can only start storyboards. I want to do this strictly in XAML, because the ...
I did something simple, but it works. I used a typical ToggleButton, which I restyled as a textblock by changing its control template. Then I just bound the IsChecked property on the ToggleButton to the IsOpen property on the popup. Popup has some properties like StaysOpen that let you modify the closing behavior. Th...
361,225
<p>I'd like to create a custom loading screen for a JavaFX application. Don't want the user to see the Java coffee cup icon, I want to put my own graphic there!</p> <p>I've found out how to provide a static image, or even an animated GIF, but I'm more interested in a Flash-like screen where I can specify what the sta...
[ { "answer_id": 1003425, "author": "Atiaxi", "author_id": 2555346, "author_profile": "https://Stackoverflow.com/users/2555346", "pm_score": 1, "selected": false, "text": "<p>If you're setting things up as shown on <a href=\"http://weblogs.java.net/blog/joshy/archive/2008/08/a_better_apple...
2008/12/11
[ "https://Stackoverflow.com/questions/361225", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2197/" ]
I'd like to create a custom loading screen for a JavaFX application. Don't want the user to see the Java coffee cup icon, I want to put my own graphic there! I've found out how to provide a static image, or even an animated GIF, but I'm more interested in a Flash-like screen where I can specify what the state of the i...
JavaFX preloader class ====================== I have created a very simple preloader screen using native JavaFX APIs. Here it's explained how to do this: <https://docs.oracle.com/javafx/2/deployment/preloaders.htm> (old but workable examples) - this is newer and seems to be the same: <https://docs.oracle.com/javase/8/...
361,231
<p>I have a cookie which is generated from a servlet and that I would like to be persistent - that is, set the cookie, close down IE, start it back up, and still be able to read the cookie. The code that I'm using is the following:</p> <pre><code>HttpServletResponse response = (HttpServletResponse) FacesContext...
[ { "answer_id": 361404, "author": "Igal Serban", "author_id": 25737, "author_profile": "https://Stackoverflow.com/users/25737", "pm_score": 1, "selected": false, "text": "<p>Few suggestions.</p>\n\n<ol>\n<li>Are you using fqdn to access the site?</li>\n<li>use <a href=\"http://www.fiddler...
2008/12/11
[ "https://Stackoverflow.com/questions/361231", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1322/" ]
I have a cookie which is generated from a servlet and that I would like to be persistent - that is, set the cookie, close down IE, start it back up, and still be able to read the cookie. The code that I'm using is the following: ``` HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInsta...
I know nothing of Java or servlets, but IE will only persist a cookie if it has an Expires date, setting max-age is not sufficient, IE will continue to treat it as a session cookie.
361,248
<p>Does VbScript have a native implementation for Regex? I need to validate e-mail addresses on an old ASP application.</p> <p>Any pointers would be great.</p>
[ { "answer_id": 361273, "author": "Fionnuala", "author_id": 2548, "author_profile": "https://Stackoverflow.com/users/2548", "pm_score": 4, "selected": true, "text": "<p>This example is by AlexCuse from <a href=\"http://wiki.lessthandot.com/index.php/Using_Regular_Expressions_For_Pattern_M...
2008/12/11
[ "https://Stackoverflow.com/questions/361248", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1965/" ]
Does VbScript have a native implementation for Regex? I need to validate e-mail addresses on an old ASP application. Any pointers would be great.
This example is by AlexCuse from [LessThanDot](http://wiki.lessthandot.com/index.php/Using_Regular_Expressions_For_Pattern_Matching_in_Access) ``` Function ValidEmail(ByVal emailAddress) 'this function will use regular expressions to check an ' 'email address for validity ' 'instantiate regex object container, outp...
361,258
<p>I was going through some code and came across a scenario where my combobox has not been initialized yet. This is in .NET 2.0 and in the following code, this.cbRegion.SelectedValue is null.</p> <pre><code>int id = (int)this.cbRegion.SelectedValue; </code></pre> <p>This code threw a null reference exception instead...
[ { "answer_id": 361268, "author": "Chris Van Opstal", "author_id": 7264, "author_profile": "https://Stackoverflow.com/users/7264", "pm_score": 1, "selected": false, "text": "<p>It's attempting to read the object before it casts it. Hence you're getting the null exception instead of a cast...
2008/12/11
[ "https://Stackoverflow.com/questions/361258", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23502/" ]
I was going through some code and came across a scenario where my combobox has not been initialized yet. This is in .NET 2.0 and in the following code, this.cbRegion.SelectedValue is null. ``` int id = (int)this.cbRegion.SelectedValue; ``` This code threw a null reference exception instead of an invalid cast excepti...
It has to do with [Boxing](http://www.csharphelp.com/archives/archive100.html) and unboxing. It is trying to pull an int out of the box (unbox), but the object is null, so you get a null reference exception before it ever gets the change to cast.
361,266
<p>If I have a base class such that</p> <pre><code>public abstract class XMLSubscription &lt;T extends XMLMessage&gt; </code></pre> <p>Is it possible to write a method in XMLSubscription that returns a class object of T?</p> <p>The only possible solution that I came up with is to have each descendant of XMLSubscript...
[ { "answer_id": 361288, "author": "Greg Case", "author_id": 462, "author_profile": "https://Stackoverflow.com/users/462", "pm_score": 3, "selected": true, "text": "<p>Unfortunately - and yes, this is due to type erasure - there is no way to return the <code>Class</code> object without pro...
2008/12/11
[ "https://Stackoverflow.com/questions/361266", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7949/" ]
If I have a base class such that ``` public abstract class XMLSubscription <T extends XMLMessage> ``` Is it possible to write a method in XMLSubscription that returns a class object of T? The only possible solution that I came up with is to have each descendant of XMLSubscription have a method like: ``` public cla...
Unfortunately - and yes, this is due to type erasure - there is no way to return the `Class` object without providing it at runtime somehow. Fortunately this is not usually too difficult. Here's how I've typically done this / seen it done: ``` public abstract class XMLSubscription <T extends XMLMessage> { private...
361,285
<p>I'm writing a basic crawler that simply caches pages with PHP.</p> <p>All it does is use <code>get_file_contents</code> to get contents of a webpage and regex to get all the links out <code>&lt;a href="URL"&gt;DESCRIPTION&lt;/a&gt;</code> - at the moment it returns:</p> <pre><code>Array { [url] =&gt; URL [desc] =&...
[ { "answer_id": 361320, "author": "Kornel", "author_id": 27009, "author_profile": "https://Stackoverflow.com/users/27009", "pm_score": 3, "selected": true, "text": "<p>First of all, regex and HTML don't mix. Use:</p>\n\n<pre><code>foreach(DOMDocument::loadHTML($source)-&gt;getElementsByTa...
2008/12/11
[ "https://Stackoverflow.com/questions/361285", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24416/" ]
I'm writing a basic crawler that simply caches pages with PHP. All it does is use `get_file_contents` to get contents of a webpage and regex to get all the links out `<a href="URL">DESCRIPTION</a>` - at the moment it returns: ``` Array { [url] => URL [desc] => DESCRIPTION } ``` The problem I'm having is figuring ou...
First of all, regex and HTML don't mix. Use: ``` foreach(DOMDocument::loadHTML($source)->getElementsByTagName('a') as $a) { $a->getAttribute('href'); } ``` Links that may go outside your site start with protocol or `//`, i.e. ``` http://example.com //example.com/ ``` `href="google.com"` is link to a local file....
361,304
<p>How do I get the sequence number of the row just inserted?</p>
[ { "answer_id": 361309, "author": "Mark Harrison", "author_id": 116, "author_profile": "https://Stackoverflow.com/users/116", "pm_score": 6, "selected": true, "text": "<p>insert ... returning.</p>\n\n<pre><code>declare\n s2 number;\n begin\n insert into seqtest2(x) values ('aaa') retu...
2008/12/11
[ "https://Stackoverflow.com/questions/361304", "https://Stackoverflow.com", "https://Stackoverflow.com/users/116/" ]
How do I get the sequence number of the row just inserted?
insert ... returning. ``` declare s2 number; begin insert into seqtest2(x) values ('aaa') returning seq into s2; dbms_output.put_line(s2); end; ``` "seq" here refers to the name of the column whose value you want to store into variable s2. in python: ``` myseq=curs.var(cx_Oracle.NUMBER) curs.prepare("i...
361,307
<p>When using the 'as' keyword in C# to make a cast which fails, null gets returned. What's going on in the background? Is it simply suppressing an exception so I don't have to write handling code for a failure?</p> <p>I'm interested in the performance characteristics of it compared to a typical cast wrapped in a try-...
[ { "answer_id": 361318, "author": "Greg Beech", "author_id": 13552, "author_profile": "https://Stackoverflow.com/users/13552", "pm_score": 7, "selected": true, "text": "<p>It's using the IL instruction <a href=\"http://msdn.microsoft.com/en-us/library/system.reflection.emit.opcodes.isinst...
2008/12/11
[ "https://Stackoverflow.com/questions/361307", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10756/" ]
When using the 'as' keyword in C# to make a cast which fails, null gets returned. What's going on in the background? Is it simply suppressing an exception so I don't have to write handling code for a failure? I'm interested in the performance characteristics of it compared to a typical cast wrapped in a try-catch.
It's using the IL instruction [`isinst`](http://msdn.microsoft.com/en-us/library/system.reflection.emit.opcodes.isinst.aspx) to perform the cast instead of the [`castclass`](http://msdn.microsoft.com/en-us/library/system.reflection.emit.opcodes.castclass.aspx) instruction that is used when casting. This is a special in...
361,316
<p>I'm working with the PieChart and PieSeries components in Flex, and have ran into an issue. When the labelPosition property of a PieSeries is set to 'inside' and there is only one slice in the pie, the label doesn't get displayed.</p> <p>Looking at the docs, I'm guessing its some quirk related to when inside labels...
[ { "answer_id": 419917, "author": "inferis", "author_id": 51998, "author_profile": "https://Stackoverflow.com/users/51998", "pm_score": 2, "selected": true, "text": "<p>All I can do is point out <a href=\"http://bugs.adobe.com/jira/browse/FLEXDMV-1569\" rel=\"nofollow noreferrer\">this bu...
2008/12/11
[ "https://Stackoverflow.com/questions/361316", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9276/" ]
I'm working with the PieChart and PieSeries components in Flex, and have ran into an issue. When the labelPosition property of a PieSeries is set to 'inside' and there is only one slice in the pie, the label doesn't get displayed. Looking at the docs, I'm guessing its some quirk related to when inside labels are remov...
All I can do is point out [this bug report](http://bugs.adobe.com/jira/browse/FLEXDMV-1569), which looks to be what you've come across. I'm afraid I can't get the suggested patch to work though, maybe you'll have better luck.
361,329
<p>Let's say I have some code like this </p> <pre><code>if(isset($_GET['foo'])) //do something if(isset($_GET['bar'])) //do something else </code></pre> <p>If a user is at example.com/?foo=abc and clicks on a link to set bar=xyz, I want to easily take them to example.com/?foo=abc&amp;bar=xyz, rather than example...
[ { "answer_id": 361354, "author": "Logan Serman", "author_id": 29595, "author_profile": "https://Stackoverflow.com/users/29595", "pm_score": 0, "selected": false, "text": "<p>Just set the link that changes bar to xyz to also have foo=abc if foo is already set.</p>\n\n<pre><code>$link = ($...
2008/12/11
[ "https://Stackoverflow.com/questions/361329", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30098/" ]
Let's say I have some code like this ``` if(isset($_GET['foo'])) //do something if(isset($_GET['bar'])) //do something else ``` If a user is at example.com/?foo=abc and clicks on a link to set bar=xyz, I want to easily take them to example.com/?foo=abc&bar=xyz, rather than example.com/?bar=xyz. I can think o...
Here's one way.... ``` //get passed params //(you might do some sanitizing at this point) $params=$_GET; //morph the params with new values $params['bar']='xyz'; //build new query string $query=''; $sep='?'; foreach($params as $name=>$value) { $query.=$sep.$name.'='.urlencode($value); $sep='&'; } ```
361,330
<p>I need to use the popcnt instruction in a project that is compiled using Visual Stdio 2005<br> The intrinsic <code>__popcnt()</code> only works with VS2008 and the compiler doesn't seem to recognize the instruction even when I write in a <code>__asm {}</code> block.</p> <p>Is there any way to do this?</p>
[ { "answer_id": 361665, "author": "bugmagnet", "author_id": 426, "author_profile": "https://Stackoverflow.com/users/426", "pm_score": 2, "selected": false, "text": "<p>Okay, this is a wild guess thing but ... assuming you've set up VS2005 like <a href=\"http://social.msdn.microsoft.com/Fo...
2008/12/11
[ "https://Stackoverflow.com/questions/361330", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9611/" ]
I need to use the popcnt instruction in a project that is compiled using Visual Stdio 2005 The intrinsic `__popcnt()` only works with VS2008 and the compiler doesn't seem to recognize the instruction even when I write in a `__asm {}` block. Is there any way to do this?
Okay, this is a wild guess thing but ... assuming you've set up VS2005 like [this](http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/3e24f203-c516-41e2-a7bf-325452157336/) to do assembly language, then you could get a hold of the [SSE4.1 manual](http://www.developers.net/filestore2/download/2550) from Inte...
361,336
<p>I'm trying to build my first generic list and have run into some problems. I understand the declaration looks like " <code>List&lt;T&gt;</code> ", and I have <code>using System.Collections.Generic;</code> at the top of my page. However, Visual Studio doesn't recognize the <code>T</code> variable. </p> <p>What am I ...
[ { "answer_id": 361346, "author": "Aistina", "author_id": 37472, "author_profile": "https://Stackoverflow.com/users/37472", "pm_score": 2, "selected": false, "text": "<p>Are you trying to use the List class or are you trying to build your own? What does your code look like at the moment?<...
2008/12/11
[ "https://Stackoverflow.com/questions/361336", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42987/" ]
I'm trying to build my first generic list and have run into some problems. I understand the declaration looks like " `List<T>` ", and I have `using System.Collections.Generic;` at the top of my page. However, Visual Studio doesn't recognize the `T` variable. What am I missing?
`List<T>` means `List<WhateverTypeYouWantItToBeAListOf>`. So for example: If I have an Employee Class, and I wanted a collection of Employees, I could say: ``` List<Employee> employeeList = new List<Employee>(); ``` I could then add `Employee` Objects to that list, and have it be Type-safe and extend to however man...
361,359
<p>I have three DIVs, something like this:</p> <pre><code>&lt;div id="header"&gt; ... &lt;/div&gt; &lt;div id="content"&gt; &lt;div id="popup"&gt; ... &lt;/div&gt; &lt;/div&gt; </code></pre> <p>DIV#header is "position: fixed" and used as a non-scrolling header at the top of the screen. DIV#conten...
[ { "answer_id": 361360, "author": "Frank Krueger", "author_id": 338, "author_profile": "https://Stackoverflow.com/users/338", "pm_score": 2, "selected": false, "text": "<p>From <a href=\"http://msdn.microsoft.com/en-us/library/aa365247.aspx\" rel=\"nofollow noreferrer\">Naming a File or D...
2008/12/11
[ "https://Stackoverflow.com/questions/361359", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2168/" ]
I have three DIVs, something like this: ``` <div id="header"> ... </div> <div id="content"> <div id="popup"> ... </div> </div> ``` DIV#header is "position: fixed" and used as a non-scrolling header at the top of the screen. DIV#content has some content in it and is "position: relative". DIV#popup...
Turns out that the edit control (At least in my development environment) is a combo box, so `EM_SETLIMITTEXT` isn't appropriate. Instead, I tracked down the combo box using `GetDlgCtrl` on the parent of the file open dialog (I do this in the `OnInitDialog` handler), cast it to `CComboBox*`, then call `LimitText()` to...
361,363
<p>Using only ANSI C, is there any way to measure time with milliseconds precision or more? I was browsing time.h but I only found second precision functions.</p>
[ { "answer_id": 361492, "author": "Robert Gamble", "author_id": 25222, "author_profile": "https://Stackoverflow.com/users/25222", "pm_score": 8, "selected": true, "text": "<p>There is no ANSI C function that provides better than 1 second time resolution but the POSIX function <a href=\"ht...
2008/12/11
[ "https://Stackoverflow.com/questions/361363", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44808/" ]
Using only ANSI C, is there any way to measure time with milliseconds precision or more? I was browsing time.h but I only found second precision functions.
There is no ANSI C function that provides better than 1 second time resolution but the POSIX function [`gettimeofday`](http://www.opengroup.org/onlinepubs/000095399/functions/gettimeofday.html) provides microsecond resolution. The clock function only measures the amount of time that a process has spent executing and is...
361,371
<p>This is quite a controversial topic, and before you say "no", is it really, really needed? </p> <p>I have been programming for about 10 years, and I can't honestly say that I can recall a time where inheritance solved a problem that couldn't be solved another way. On the other hand I can recall many times when ...
[ { "answer_id": 361388, "author": "jmucchiello", "author_id": 44065, "author_profile": "https://Stackoverflow.com/users/44065", "pm_score": 2, "selected": false, "text": "<p>No. Sometimes you need inheritance. And for those times where you don't -- don't use it. You can always \"just\" us...
2008/12/11
[ "https://Stackoverflow.com/questions/361371", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45365/" ]
This is quite a controversial topic, and before you say "no", is it really, really needed? I have been programming for about 10 years, and I can't honestly say that I can recall a time where inheritance solved a problem that couldn't be solved another way. On the other hand I can recall many times when I used inherit...
I [blogged about this](https://codeblog.jonskeet.uk/2007/02/27/wacky-ideas-1-inheritance-is-dead-long-live-mix-ins/) as a wacky idea a while ago. I don't think it should be removed, but I think classes should be sealed by default to *discourage* inheritance when it's not appropriate. It's a powerful tool to have avail...
361,391
<p>In a client-server system, is it considered good architecture for a server method to "ask the client" for more information? If so, what's the best way to design such a scenario? Is there a "pattern" for this?</p> <p>For example, suppose the end user selects a set of records they want to delete in the client UI, t...
[ { "answer_id": 361419, "author": "BCS", "author_id": 1343, "author_profile": "https://Stackoverflow.com/users/1343", "pm_score": 1, "selected": false, "text": "<p>Some sort of reply that say \"Records x, y and z were not deleted, try again with <code>I_RELLY_WANT_TO</code> set to delete ...
2008/12/11
[ "https://Stackoverflow.com/questions/361391", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16012/" ]
In a client-server system, is it considered good architecture for a server method to "ask the client" for more information? If so, what's the best way to design such a scenario? Is there a "pattern" for this? For example, suppose the end user selects a set of records they want to delete in the client UI, then the clie...
A callback like that reverses the role of the client and server. In lots of these types of architectures, the client has no capacity to listen to requests. If it does, you're starting to look at P2P kind of system. Perhaps something like this might work. ``` client code: special_records = server.deleteRecords(recor...
361,443
<p>I am trying to learn more about regular expressions I have one below that I believe finds cases where there is a missing close paren on a number up to 999 billion. The one below it I thought should do the same but I do not get similar results</p> <pre><code> missingParenReg=re.compile(r"^\([$]*[0-9]{1,3}[,]?[0-9]...
[ { "answer_id": 361475, "author": "jfs", "author_id": 4279, "author_profile": "https://Stackoverflow.com/users/4279", "pm_score": 2, "selected": false, "text": "<p>Are there nested parentheses (your regexps assume there are not)? If not:</p>\n\n<pre><code>whether_paren_is_missing = (astri...
2008/12/11
[ "https://Stackoverflow.com/questions/361443", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30105/" ]
I am trying to learn more about regular expressions I have one below that I believe finds cases where there is a missing close paren on a number up to 999 billion. The one below it I thought should do the same but I do not get similar results ``` missingParenReg=re.compile(r"^\([$]*[0-9]{1,3}[,]?[0-9]{0,3}[,]?[0-9]...
The trickier part about regular expressions isn't making them accept valid input, it's making them reject invalid input. For example, the second expression accepts input that is clearly wrong, including: * `(1,2,3,4` -- one digit between each comma * `(12,34,56` -- two digits between each comma * `(1234......5` -- unl...
361,455
<p>I have a MySQL query structured as follows:</p> <pre><code>SELECT time(c.start_time), time(c.end_time), time(c.end_time) - time(c.start_time) as 'opening_hours' FROM my_shop c; </code></pre> <p>The data in start and end time is 1970-01-01 07:00:00 and 1970-01-01 19:00:00 respectively.</p> <p>On my ...
[ { "answer_id": 361582, "author": "Bill Karwin", "author_id": 20860, "author_profile": "https://Stackoverflow.com/users/20860", "pm_score": 2, "selected": true, "text": "<p>I'd do it this way:</p>\n\n<pre><code>SELECT TIME(c.start_time),\n TIME(c.end_time),\n EXTRACT(HOUR FROM...
2008/12/11
[ "https://Stackoverflow.com/questions/361455", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24390/" ]
I have a MySQL query structured as follows: ``` SELECT time(c.start_time), time(c.end_time), time(c.end_time) - time(c.start_time) as 'opening_hours' FROM my_shop c; ``` The data in start and end time is 1970-01-01 07:00:00 and 1970-01-01 19:00:00 respectively. On my local machine this this query ret...
I'd do it this way: ``` SELECT TIME(c.start_time), TIME(c.end_time), EXTRACT(HOUR FROM TIMEDIFF(TIME(c.end_time), TIME(c.start_time))) AS 'opening_hours' FROM my_shop c; ```
361,457
<p>I've got this code in a pair of button click event handlers on a C# form:</p> <pre><code>class frmLogin { private const int SHORT_HEIGHT = 120; private const int LONG_HEIGHT = 220; private EventHandler ExpandHandler; private EventHandler ShrinkHandler; public frmLogin() { Initializ...
[ { "answer_id": 361715, "author": "MusiGenesis", "author_id": 14606, "author_profile": "https://Stackoverflow.com/users/14606", "pm_score": 2, "selected": false, "text": "<p>Check the display mode for the laptop, and in particular check the aspect-ratio setting. Sometimes laptops do weir...
2008/12/11
[ "https://Stackoverflow.com/questions/361457", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22225/" ]
I've got this code in a pair of button click event handlers on a C# form: ``` class frmLogin { private const int SHORT_HEIGHT = 120; private const int LONG_HEIGHT = 220; private EventHandler ExpandHandler; private EventHandler ShrinkHandler; public frmLogin() { InitializeComponent(); ...
My guess: The DPI or system font size is different on that machine and your form's AutoScaleMode is either "Font" or "Dpi", making your form's MinimumSize or MaximumSize prevent the change.
361,467
<p>I am using jQuert .ajax function to call a page method. The site is using FormsAuthentication. So when an authentication ticket expires a call to the page method will obviously cause a redirect to the login page. </p> <p>Now, the geniuses that wrote the System.Web.Handlers.ScriptModule decided that if for some reas...
[ { "answer_id": 361564, "author": "Strelok", "author_id": 2788, "author_profile": "https://Stackoverflow.com/users/2788", "pm_score": 4, "selected": true, "text": "<p>I think I worked around it. Ofcourse relying on internal MS AJAX related errors is not really nice, but this will do the t...
2008/12/11
[ "https://Stackoverflow.com/questions/361467", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2788/" ]
I am using jQuert .ajax function to call a page method. The site is using FormsAuthentication. So when an authentication ticket expires a call to the page method will obviously cause a redirect to the login page. Now, the geniuses that wrote the System.Web.Handlers.ScriptModule decided that if for some reason a REST ...
I think I worked around it. Ofcourse relying on internal MS AJAX related errors is not really nice, but this will do the trick for others faces with this problem. Basically what you do, is you set the **X-MicrosoftAjax** header to the value **Delta=true** (case is important here), the ScriptModule will interpret this ...
361,468
<p>I'm looking for a way in .NET (2.0, C# in particular) for source code to trigger a debugging break as if a breakpoint was set at that point, without having to remember to set a specific breakpoint there in the debugger, and without interfering with production runtime.</p> <p>Our code needs to swallow exceptions in ...
[ { "answer_id": 361473, "author": "shahkalpesh", "author_id": 23574, "author_profile": "https://Stackoverflow.com/users/23574", "pm_score": 4, "selected": false, "text": "<p><code>System.Diagnostics.Debugger.Break</code>?</p>\n" }, { "answer_id": 361479, "author": "CheGueVerra...
2008/12/11
[ "https://Stackoverflow.com/questions/361468", "https://Stackoverflow.com", "https://Stackoverflow.com/users/181460/" ]
I'm looking for a way in .NET (2.0, C# in particular) for source code to trigger a debugging break as if a breakpoint was set at that point, without having to remember to set a specific breakpoint there in the debugger, and without interfering with production runtime. Our code needs to swallow exceptions in production...
You probably are after something like this: ``` if(System.Diagnostics.Debugger.IsAttached) System.Diagnostics.Debugger.Break(); ``` Of course that will still get compiled in a Release build. If you want it to behave more like the Debug object where the code simply doesn't exist in a Release build, then you could d...
361,471
<p>I have a web application with multiple web services. This web application has business and persistency layer. Is it possible to use separate log appender (log file) per web service?</p> <p>This applies to web pages too. Essentially I want to separate my logs NOT based on the class or layer/namespace, but from point...
[ { "answer_id": 361622, "author": "George Stocker", "author_id": 16587, "author_profile": "https://Stackoverflow.com/users/16587", "pm_score": 1, "selected": false, "text": "<p>You can define which logger to get in each web service:</p>\n\n<pre><code>namespace log4net\n{\n public class...
2008/12/11
[ "https://Stackoverflow.com/questions/361471", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16073/" ]
I have a web application with multiple web services. This web application has business and persistency layer. Is it possible to use separate log appender (log file) per web service? This applies to web pages too. Essentially I want to separate my logs NOT based on the class or layer/namespace, but from point of entry,...
I could do this using PropertyFilter. I defined the following appender in config file: ``` <appender name="UiFileAppender" type="log4net.Appender.RollingFileAppender"> <file value="Log1.log" /> <appendToFile value="true" /> <rollingStyle value="Size" /> <maxSizeRollBackups value="10" /> <maximumFileSize valu...
361,477
<p>Note: Using MySQL 4.0, which means no subqueries (at present).</p> <p>I have 2 tables:</p> <ul> <li>A "user_details" table</li> <li>A "skills" table, which has the user_id and a "skill_id", which maps to a predefined set of skills defined elsewhere.</li> </ul> <p>The current query allows an admin to search for us...
[ { "answer_id": 361537, "author": "dkretz", "author_id": 31641, "author_profile": "https://Stackoverflow.com/users/31641", "pm_score": 1, "selected": false, "text": "<p>Just add more single joins.</p>\n\n<p>INNER JOIN skills s ON u.id - us.userid AND skill_id = $s1<br>\nINNER JOIN skills ...
2008/12/11
[ "https://Stackoverflow.com/questions/361477", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29854/" ]
Note: Using MySQL 4.0, which means no subqueries (at present). I have 2 tables: * A "user\_details" table * A "skills" table, which has the user\_id and a "skill\_id", which maps to a predefined set of skills defined elsewhere. The current query allows an admin to search for users by selecting skills, and the query ...
You don't need a subquery or a join. ``` SELECT user_id FROM skills WHERE skill_id IN (51, 52, 53, 54, 55) GROUP BY user_id HAVING COUNT(*) = 5; ```
361,487
<p>What is the exact pixel size of one column when I used the columns attribute to determine a width of an ASP.NET textbox control?</p> <pre><code>&lt;asp:TextBox id="MyTextBox" runat="server" columns="10" /&gt; </code></pre>
[ { "answer_id": 361521, "author": "Ryan Smith", "author_id": 10420, "author_profile": "https://Stackoverflow.com/users/10420", "pm_score": 2, "selected": true, "text": "<p>I always use:</p>\n\n<pre><code>style=\"width: 250px;\"\n</code></pre>\n\n<p>That way you can set it exactly. Otherw...
2008/12/12
[ "https://Stackoverflow.com/questions/361487", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26327/" ]
What is the exact pixel size of one column when I used the columns attribute to determine a width of an ASP.NET textbox control? ``` <asp:TextBox id="MyTextBox" runat="server" columns="10" /> ```
I always use: ``` style="width: 250px;" ``` That way you can set it exactly. Otherwise it's going to depend on the font-size of the textbox as well as the way the browser renders it. Rows on the other hand is something I've always struggled with.
361,490
<p>I have a silverlight 2 app that has an ObservableCollection of a class from a separate assem/lib. When I set my ListBox.ItemsSource on that collection, and run it, I get the error code:</p> <blockquote> <p>4004 &quot;System.ArgumentException: Value does not fall within the expected range.&quot;</p> </blockquote> <p>...
[ { "answer_id": 373318, "author": "Abram Simon", "author_id": 46204, "author_profile": "https://Stackoverflow.com/users/46204", "pm_score": 1, "selected": false, "text": "<p>Are you trying to use a standard class library or a \"Silverlight Class Library\"?</p>\n\n<p>Because Silverlight 2 ...
2008/12/12
[ "https://Stackoverflow.com/questions/361490", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33324/" ]
I have a silverlight 2 app that has an ObservableCollection of a class from a separate assem/lib. When I set my ListBox.ItemsSource on that collection, and run it, I get the error code: > > 4004 "System.ArgumentException: Value does not fall within the expected range." > > > Here is part of the code: ``` public ...
Are you trying to use a standard class library or a "Silverlight Class Library"? Because Silverlight 2 uses a subset of the CLR it cannot access standard class libraries that were compiled using the full CLR. To use an external assembly you must create it as a "Silverlight Class Library". This will create a project th...
361,529
<p>I'm using Spring, but this question applies to all JSP-controller type designs.</p> <p>The JSP page references data (using tags) which is populated by the corresponding controller. My question is, where is the appropriate place to perform formatting, in JSP or the controller?</p> <p>So far I've been preparing the ...
[ { "answer_id": 361588, "author": "davetron5000", "author_id": 3029, "author_profile": "https://Stackoverflow.com/users/3029", "pm_score": 3, "selected": false, "text": "<p>JSPs typically do not have a lot (or any?) code in them, so your options would be</p>\n\n<ul>\n<li>controller</li>\n...
2008/12/12
[ "https://Stackoverflow.com/questions/361529", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24396/" ]
I'm using Spring, but this question applies to all JSP-controller type designs. The JSP page references data (using tags) which is populated by the corresponding controller. My question is, where is the appropriate place to perform formatting, in JSP or the controller? So far I've been preparing the data by formattin...
JSPs typically do not have a lot (or any?) code in them, so your options would be * controller * tag libraries I would say that a tag library would probably be what you want for most cases, because typically the view is the code that cares about things like formatting. If standard tag libraries don't get you there, ...
361,570
<p>For my project I have to serialize and deserialize a random tree using Java and XStream. My teacher made the Tree/RandomTree algorithms, so I don't have to worry about that. What I don't know how to do is this: I am using FileInputStream to read/write the xml file that I serialized and deserialized, but when I de...
[ { "answer_id": 361571, "author": "Jim Puls", "author_id": 6010, "author_profile": "https://Stackoverflow.com/users/6010", "pm_score": 2, "selected": false, "text": "<p>Why not just build a proper app in PHP instead of going through the hassle? Recent PHP is <a href=\"http://us2.php.net/m...
2008/12/12
[ "https://Stackoverflow.com/questions/361570", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36268/" ]
For my project I have to serialize and deserialize a random tree using Java and XStream. My teacher made the Tree/RandomTree algorithms, so I don't have to worry about that. What I don't know how to do is this: I am using FileInputStream to read/write the xml file that I serialized and deserialized, but when I deserial...
I'm rather sceptical on the merits of code generation in the context of a dynamic language, such as PHP. You can generally use other kinds of abstraction to get the same results. Unlike a statically typed, compiled language, it is rather easy to use dynamic hooks such as \_\_get and \_\_set and reflection, to make gene...
361,583
<p><b>Duplicate of: <a href="https://stackoverflow.com/questions/255214/when-should-i-use-the-visitor-design-pattern">When Should I Use The Visitor Design Pattern</a></b></p> <p>Why would someone want to use the visitor pattern? I've read a couple of articles, but I'm not getting something.</p> <p>If I need a functio...
[ { "answer_id": 361603, "author": "S.Lott", "author_id": 10661, "author_profile": "https://Stackoverflow.com/users/10661", "pm_score": 6, "selected": false, "text": "<p>The issue arises when you have a complex structure, i.e., a hierarchy or something else that's not simply linear. When ...
2008/12/12
[ "https://Stackoverflow.com/questions/361583", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
**Duplicate of: [When Should I Use The Visitor Design Pattern](https://stackoverflow.com/questions/255214/when-should-i-use-the-visitor-design-pattern)** Why would someone want to use the visitor pattern? I've read a couple of articles, but I'm not getting something. If I need a function to bill a custom, I could use...
The issue arises when you have a complex structure, i.e., a hierarchy or something else that's not simply linear. When you can't simply iterate over the structure, a visitor is very handy. If I have a hierarchy (or tree), each Node has a list of children. When I want to apply a process to every node in the tree, it's ...
361,609
<p>After an upgrade to XP and Java 1.6 one of our intranet apps is experiencing a problem when running a java applet in the browser. The java applet is a document editor and accepts a parameter to where the document is located. I assume it copies this file to the users machine for editing. I wish I knew more but I don'...
[ { "answer_id": 361786, "author": "Natalia", "author_id": 11067, "author_profile": "https://Stackoverflow.com/users/11067", "pm_score": 0, "selected": false, "text": "<p>You say you went from Java v1.3 directly to Java 1.6, have you had a chance to test it at all with Java 1.4 or 1.5? A ...
2008/12/12
[ "https://Stackoverflow.com/questions/361609", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17211/" ]
After an upgrade to XP and Java 1.6 one of our intranet apps is experiencing a problem when running a java applet in the browser. The java applet is a document editor and accepts a parameter to where the document is located. I assume it copies this file to the users machine for editing. I wish I knew more but I don't h...
I worked out the problem. Turn off temporary files in the java control panel.
361,628
<p>What guidlines do you use when deciding whether to let a method dodge an exception (ie: let the exception propogate up) or handle it once the exception is recieved?</p> <p>Here is an example of what I am trying to ask</p> <p>If I have three methods method1,2,3 and 3. Method1 calls Method2 which Calls Method3. and ...
[ { "answer_id": 361646, "author": "TerryH", "author_id": 44736, "author_profile": "https://Stackoverflow.com/users/44736", "pm_score": 0, "selected": false, "text": "<p>If the lower level routine knows what to do about the exceptional condition, it should probably handle it. If it is an ...
2008/12/12
[ "https://Stackoverflow.com/questions/361628", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42303/" ]
What guidlines do you use when deciding whether to let a method dodge an exception (ie: let the exception propogate up) or handle it once the exception is recieved? Here is an example of what I am trying to ask If I have three methods method1,2,3 and 3. Method1 calls Method2 which Calls Method3. and the exception is ...
The rule I follow: If I can fix an exception, or nullify the problem that caused it (sometimes this means just ignoring it altogether), I'll handle it. Otherwise it gets passed up to the next level. And I always try to fix exceptions as low in the tree as possible (i.e. as soon as possible after they occur) - this lo...
361,633
<p>VStudio ASP.NET gives the following message: </p> <pre><code>Attribute 'bgcolor' is considered outdated. A newer construct is recommended. </code></pre> <p>What is the recommended construct?</p> <p><code>bgcolor</code> is within a <code>&lt;td&gt;</code> element.<br> Another related message is : </p> <pre><cod...
[ { "answer_id": 361641, "author": "Tmdean", "author_id": 45084, "author_profile": "https://Stackoverflow.com/users/45084", "pm_score": 2, "selected": false, "text": "<p>The newer replacement is cascading style sheets (CSS). Any attributes or elements that control the visual appearance of ...
2008/12/12
[ "https://Stackoverflow.com/questions/361633", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1682/" ]
VStudio ASP.NET gives the following message: ``` Attribute 'bgcolor' is considered outdated. A newer construct is recommended. ``` What is the recommended construct? `bgcolor` is within a `<td>` element. Another related message is : ``` Attribute 'bordercolor' is not a valid attribute of element 'table'. `...
[`BGColor`](http://webdesign.about.com/od/intermediatetutorials/a/aa080502a.htm) was deprecated in the W3C HTML 4.0 Specification. Newer Web sites and web applications use CSS (Cascading Style Sheets) to render the same thing, as follows: ``` body { background-color : #ffffff; } ``` For tables, do the followin...
361,661
<p>I have a database table (named Topics) which includes these fields :</p> <ol> <li>topicId </li> <li>name</li> <li>parentId</li> </ol> <p>and by using them I wanna populate a TreeView in c#. How can I do that ?</p> <p>Thanks in advance...</p>
[ { "answer_id": 361678, "author": "Bob", "author_id": 45, "author_profile": "https://Stackoverflow.com/users/45", "pm_score": 5, "selected": true, "text": "<p>It will probably be something like this. Give some more detail as to what exactly you want to do if you need more. </p>\n\n<pre><c...
2008/12/12
[ "https://Stackoverflow.com/questions/361661", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44852/" ]
I have a database table (named Topics) which includes these fields : 1. topicId 2. name 3. parentId and by using them I wanna populate a TreeView in c#. How can I do that ? Thanks in advance...
It will probably be something like this. Give some more detail as to what exactly you want to do if you need more. ``` //In Page load foreach (DataRow row in topics.Rows) { TreeNode node = new TreeNode(dr["name"], dr["topicId"]) node.PopulateOnDemand = true; TreeView1.Nodes.Add(node); } /// protected...
361,686
<p>Not a programming question per se, but interesting for people who do commercial web development.</p> <p>How do you track all of your clients' hosting, domain registration, and SSL certificate expiry dates?</p> <p>Do you just keep a spreadsheet or is there some useful piece of software for this?</p> <p>I've search...
[ { "answer_id": 361692, "author": "Kibbee", "author_id": 1862, "author_profile": "https://Stackoverflow.com/users/1862", "pm_score": 1, "selected": false, "text": "<p>You would probably be better off using whatever tool you usually use for managing your time/schedule than having some spec...
2008/12/12
[ "https://Stackoverflow.com/questions/361686", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15531/" ]
Not a programming question per se, but interesting for people who do commercial web development. How do you track all of your clients' hosting, domain registration, and SSL certificate expiry dates? Do you just keep a spreadsheet or is there some useful piece of software for this? I've searched extensively and can't...
How about we turn it into a programming question! You could use this code (C#), though I would recommend modifying it a bit (e.g. put url's in a file) and throwing it into a service. This code sets up a certificate validation callback which the HttpWebRequest will call anytime it encounters a certificate. This lets us...
361,717
<p>I have HTML code like this :</p> <pre><code>&lt;div&gt; &lt;a&gt;Link A1&lt;/a&gt; &lt;a&gt;Link A2&lt;/a&gt; &lt;a&gt;Link A3&lt;/a&gt; &lt;/div&gt; &lt;div&gt; &lt;a&gt;Link B1&lt;/a&gt; &lt;a&gt;Link B2&lt;/a&gt; &lt;a&gt;Link B3&lt;/a&gt; &lt;/div&gt; </code></pre> <p...
[ { "answer_id": 361724, "author": "Shog9", "author_id": 811, "author_profile": "https://Stackoverflow.com/users/811", "pm_score": 7, "selected": true, "text": "<p>Fortunately, jQuery selectors allow you much more freedom:</p>\n\n<pre><code>$(\"div a\").click( function(event)\n{\n var cl...
2008/12/12
[ "https://Stackoverflow.com/questions/361717", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10629/" ]
I have HTML code like this : ``` <div> <a>Link A1</a> <a>Link A2</a> <a>Link A3</a> </div> <div> <a>Link B1</a> <a>Link B2</a> <a>Link B3</a> </div> ``` When user clicks a link from above HTML, I want to get the jQuery object of the corresponding `<a>` element, and then man...
Fortunately, jQuery selectors allow you much more freedom: ``` $("div a").click( function(event) { var clicked = $(this); // jQuery wrapper for clicked element // ... click-specific code goes here ... }); ``` ...will attach the specified callback to each `<a>` contained in a `<div>`.
361,723
<p>I am having difficulty with the following method. I can't figure out if my problem is, but I have narrowed it down to not populating the array list from the file. Any help is greatly appreciated.</p> <pre><code>private void searchButtonActionPerformed(java.awt.event.ActionEvent evt) { //create arraylists ArrayLi...
[ { "answer_id": 361755, "author": "jmucchiello", "author_id": 44065, "author_profile": "https://Stackoverflow.com/users/44065", "pm_score": 2, "selected": false, "text": "<p>Aside from all the other problems people have listed...</p>\n\n<pre><code>String pass = \"\";\nwhile(flag = false) ...
2008/12/12
[ "https://Stackoverflow.com/questions/361723", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I am having difficulty with the following method. I can't figure out if my problem is, but I have narrowed it down to not populating the array list from the file. Any help is greatly appreciated. ``` private void searchButtonActionPerformed(java.awt.event.ActionEvent evt) { //create arraylists ArrayList<String> model...
Aside from all the other problems people have listed... ``` String pass = ""; while(flag = false) { if(outputline.charAt(i) != ',') pass.concat(Character.toString(outputline.charAt(i))); ``` pass is a String. Strings are immutable. You want ``` pass = pass.concat(.....) ```
361,742
<p>Sorry if this is a really basic question but I struggling with how I should attack this. I am trying to wrap up some commands for a OLE object, the basic spec looks like this:</p> <pre><code>Set Window window_id //Units is part of the position setter. [ Position ( x, y ) [ Units paper_units ] ] [ Widt...
[ { "answer_id": 361749, "author": "jop", "author_id": 11830, "author_profile": "https://Stackoverflow.com/users/11830", "pm_score": 0, "selected": false, "text": "<p>Yes. I think you got it covered well enough.</p>\n" }, { "answer_id": 361759, "author": "Andrew Kennan", "a...
2008/12/12
[ "https://Stackoverflow.com/questions/361742", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6335/" ]
Sorry if this is a really basic question but I struggling with how I should attack this. I am trying to wrap up some commands for a OLE object, the basic spec looks like this: ``` Set Window window_id //Units is part of the position setter. [ Position ( x, y ) [ Units paper_units ] ] [ Width win_width [ U...
That sounds reasonable to me. I would definately keep the construction of the ICommand instances internal to the CommandBuilder: ``` class CommandBuilder { private List<ICommand> _commands = new List<ICommand>(); public CommandBuilder Position(double x, double y) { _commands.Add(new PositionCommand(x,y)) ...
361,747
<p>I was browsing through the questions and noticed this:</p> <pre><code>SELECT prodid, issue FROM Sales WHERE custid = @custid AND datesold = SELECT MAX(datesold) FROM Sales s WHERE s.prodid = Sales.prodid AND s.issue = Sales.issue AND s.custid = @cust...
[ { "answer_id": 361751, "author": "Steven A. Lowe", "author_id": 9345, "author_profile": "https://Stackoverflow.com/users/9345", "pm_score": 5, "selected": false, "text": "<p>@ is used as a prefix denoting stored procedure and function parameter names, and also variable names</p>\n" }, ...
2008/12/12
[ "https://Stackoverflow.com/questions/361747", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27620/" ]
I was browsing through the questions and noticed this: ``` SELECT prodid, issue FROM Sales WHERE custid = @custid AND datesold = SELECT MAX(datesold) FROM Sales s WHERE s.prodid = Sales.prodid AND s.issue = Sales.issue AND s.custid = @custid ``` I was...
The @CustID means it's a parameter that you will supply a value for later in your code. This is the best way of protecting against SQL injection. Create your query using parameters, rather than concatenating strings and variables. The database engine puts the parameter value into where the placeholder is, and there is ...
361,752
<p>I'm working on a Perl script. How can I pass command line parameters to it?</p> <p>Example:</p> <pre><code>script.pl "string1" "string2" </code></pre>
[ { "answer_id": 361757, "author": "George Stocker", "author_id": 16587, "author_profile": "https://Stackoverflow.com/users/16587", "pm_score": 6, "selected": false, "text": "<p>You pass them in just like you're thinking, and in your script, you get them from the array <code>@ARGV</code>. ...
2008/12/12
[ "https://Stackoverflow.com/questions/361752", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15884/" ]
I'm working on a Perl script. How can I pass command line parameters to it? Example: ``` script.pl "string1" "string2" ```
Depends on what you want to do. If you want to use the two arguments as input files, you can just pass them in and then use `<>` to read their contents. If they have a different meaning, you can use `GetOpt::Std` and `GetOpt::Long` to process them easily. `GetOpt::Std` supports only single-character switches and `GetO...
361,756
<p>Is tight looping in a program bad?</p> <p>I have an application that has two threads for a game-physics simulator. An updateGame thread and a render thread. The render thread is throttled by causing the thread to sleep for some milliseconds (to achieve the frame-rate I want) and the updateGame thread (that updates...
[ { "answer_id": 361764, "author": "Adam Liss", "author_id": 29157, "author_profile": "https://Stackoverflow.com/users/29157", "pm_score": 2, "selected": false, "text": "<p>It's only \"bad\" if it has an adverse impact on something else in your system. Rather than sleeping for 1ms, you mi...
2008/12/12
[ "https://Stackoverflow.com/questions/361756", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2635/" ]
Is tight looping in a program bad? I have an application that has two threads for a game-physics simulator. An updateGame thread and a render thread. The render thread is throttled by causing the thread to sleep for some milliseconds (to achieve the frame-rate I want) and the updateGame thread (that updates my in game...
I read a really great post about efficiently and effectively executing physics calculations loop: [Fix Your Timestep!](http://gafferongames.com/game-physics/fix-your-timestep/) When a game is running that is usually the main application that the user cares about so tight looping is not that big of a deal. What you rea...
361,775
<p>I have a div tag styled through CSS. I set the padding to 10px (padding:10px), it works just as I wanted in Firefox and IE7, but in IE6 it adds additional padding at the bottom (about 2-3px I think). Anyone has idea about what's happening here?</p> <p>[update]</p> <p>I just noticed this, the div tag I'm talking a...
[ { "answer_id": 361810, "author": "jimg", "author_id": 2621, "author_profile": "https://Stackoverflow.com/users/2621", "pm_score": 2, "selected": false, "text": "<p>I would highly recommend taking a look at the <a href=\"http://www.positioniseverything.net/explorer.html\" rel=\"nofollow n...
2008/12/12
[ "https://Stackoverflow.com/questions/361775", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40538/" ]
I have a div tag styled through CSS. I set the padding to 10px (padding:10px), it works just as I wanted in Firefox and IE7, but in IE6 it adds additional padding at the bottom (about 2-3px I think). Anyone has idea about what's happening here? [update] I just noticed this, the div tag I'm talking about has a backgro...
Is there an image in your div? If there's an image, there's a bug in IE 6 that can cause white space within the div to create extra padding on the bottom Extra padding shows up with ``` <div> <img src="myimage.jpg"> </div> ``` Extra padding doesn't show up when you change your HTML to ``` <div><img src="myimage.jp...
361,799
<p>I have been working for a while to create an iPhone app. Today when my battery was low, I was working and constantly saving my source files then the power went out...</p> <p>Now when I plugged my computer back in and it is getting good power I try to open my project file and I get an error:</p> <blockquote> <p>Unab...
[ { "answer_id": 361859, "author": "Marc Charbonneau", "author_id": 35136, "author_profile": "https://Stackoverflow.com/users/35136", "pm_score": 0, "selected": false, "text": "<p>It sounds like you're going to have to create a new project in Xcode, go into the old directory, and drag all ...
2008/12/12
[ "https://Stackoverflow.com/questions/361799", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have been working for a while to create an iPhone app. Today when my battery was low, I was working and constantly saving my source files then the power went out... Now when I plugged my computer back in and it is getting good power I try to open my project file and I get an error: > > Unable to Open Project > > ...
I came across this problem and my senior told me about a solution i.e: Right click on your `projectname.xcodeproj` file here `projectname` will be the name of your project. Now after right clicked select *Show Packages Contents*. After that open your `projectname.pbxproj` file in a text editor. Now search for the line...
361,801
<p>I'm a newbie with Subversion, so I don't now if this is a dumb question:</p> <p>I've inherited a subversion repository with a flat structure with no /trunk /tags /branches top level).</p> <p>I'd like re-structure it so that it follows the </p> <pre><code>/trunk /tags /branches </code></pre> <p>layout.</p> <p>Is...
[ { "answer_id": 361821, "author": "rz.", "author_id": 7407, "author_profile": "https://Stackoverflow.com/users/7407", "pm_score": 1, "selected": false, "text": "<p>Yes. Just make the desired top level structure, add those directories with svn add. Do a checkin (svn ci) and then move stuf...
2008/12/12
[ "https://Stackoverflow.com/questions/361801", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm a newbie with Subversion, so I don't now if this is a dumb question: I've inherited a subversion repository with a flat structure with no /trunk /tags /branches top level). I'd like re-structure it so that it follows the ``` /trunk /tags /branches ``` layout. Is this possible?
Especially if you're using Subversion 1.4, see this answer for an alternative: [svn: replace trunk with branch](https://stackoverflow.com/questions/331388/svn-replace-trunk-with-branch#331574). Otherwise, `move` is the simplest way to achieve the restructuring. As @JoelFan said, `move` will work on directories, so yo...
361,839
<p>Sorry for asking an implement my feature question type question last time. I am new to Stackoverflow.com and also to php that's why.</p> <p>What I was trying to ask is:</p> <p>I have made a admin account. Members have registration page so a member will register. When user registers in the database table I will h...
[ { "answer_id": 361858, "author": "Levi", "author_id": 27620, "author_profile": "https://Stackoverflow.com/users/27620", "pm_score": 0, "selected": false, "text": "<p>What I would do is to set up a form inside of the table.</p>\n\n<p><code>?&gt; &lt;form name=\"deleteUser\" id=\"deleteUse...
2008/12/12
[ "https://Stackoverflow.com/questions/361839", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40975/" ]
Sorry for asking an implement my feature question type question last time. I am new to Stackoverflow.com and also to php that's why. What I was trying to ask is: I have made a admin account. Members have registration page so a member will register. When user registers in the database table I will have a field for whi...
Try this: ``` echo '<td><a href="http://yourwebsite/yourscriptname.php?action=del&amp;member_id=' . htmlspecialchars($row['member_id']) . '">Delete</a>'; if ($row['approved'] == 0) { echo '&nbsp;<a href="http://yourwebsite/yourscriptname.php?action=approve&amp;member_id=' . htmlspecialchars($row['member_...
361,840
<p>This afternoon, upon noticing a broken build and the fact that some files looked like very old versions (about 2 weeks old), I checked the svn log. Apparently just this afternoon, 1 of the developers did an "svn copy" of a directory from an older revision to the same directory. Thus it appears that the latest vers...
[ { "answer_id": 361932, "author": "TheSmurf", "author_id": 1975282, "author_profile": "https://Stackoverflow.com/users/1975282", "pm_score": -1, "selected": false, "text": "<p>Probably, but make a backup first.</p>\n\n<p>Actually, I'm left wondering why you don't have a daily backup that ...
2008/12/12
[ "https://Stackoverflow.com/questions/361840", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16012/" ]
This afternoon, upon noticing a broken build and the fact that some files looked like very old versions (about 2 weeks old), I checked the svn log. Apparently just this afternoon, 1 of the developers did an "svn copy" of a directory from an older revision to the same directory. Thus it appears that the latest version "...
According to [the SVN book](http://svnbook.red-bean.com/), ``` svn merge -c -1234 ``` should do the trick. There's a whole [section](http://svnbook.red-bean.com/en/1.5/svn.branchmerge.basicmerging.html#svn.branchmerge.basicmerging.undo) about this in the book. The verbose explanation: `-c -1234` translates into `-...
361,852
<p>Sorry - this may be an easy question, I'm new to iPhone development and still wrapping my head around Views vs ViewControllers.</p> <p>I have a NavigationViewController and I can push Views using the following method in the RootViewController which is connected to a Bar Button Item:</p> <pre><code>- (IBAction)swit...
[ { "answer_id": 361914, "author": "Ben Gottlieb", "author_id": 6694, "author_profile": "https://Stackoverflow.com/users/6694", "pm_score": 1, "selected": false, "text": "<p>You'll want to declare your method as an IBAction in your header file:\n<code><pre>\n- (IBAction) myMethod: (id) sen...
2008/12/12
[ "https://Stackoverflow.com/questions/361852", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29941/" ]
Sorry - this may be an easy question, I'm new to iPhone development and still wrapping my head around Views vs ViewControllers. I have a NavigationViewController and I can push Views using the following method in the RootViewController which is connected to a Bar Button Item: ``` - (IBAction)switch:(id)sender { ...
Your RootViewController should have its own xib file. In this xib, the RootViewController is represented by the object named "File's Owner". You can link buttons on the view to File's Owner the same way you can link things to RootViewController in MainMenu.xib.
361,854
<p>I'm trying to get udp multicast data using sockets and c++ (c). I have a server with 2 network cards so I need to bind socket to specific interface. Currently I'm testing on another server that has only one network card.</p> <p>When I use INADDR_ANY I can see the udp data, when I bind to specific interface I don't ...
[ { "answer_id": 362485, "author": "David Allan Finch", "author_id": 27417, "author_profile": "https://Stackoverflow.com/users/27417", "pm_score": 2, "selected": false, "text": "<p>I think you need to add IP_MULTICAST_IF</p>\n\n<pre><code> struct ip_mreq multi;\n\n multi.imr_...
2008/12/12
[ "https://Stackoverflow.com/questions/361854", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm trying to get udp multicast data using sockets and c++ (c). I have a server with 2 network cards so I need to bind socket to specific interface. Currently I'm testing on another server that has only one network card. When I use INADDR\_ANY I can see the udp data, when I bind to specific interface I don't see any d...
After some searching and testing I found out [here](http://www.kohala.com/start/mcast.api.txt) that when **binding** udp multicast socket we specify port and leave address empty e.g. specify `INADDR_ANY`. So the following ``` addr.sin_family = AF_INET; addr.sin_port = htons(port); addr.sin_addr.s_addr = (source_iface...
361,856
<p>I need some help with jQuery script again :-) Just trying to play with jQuery..I use script below for coloring options of select element. It works in pure html, but in my asp.net 2.0 (Master + Content pages) does not. Script is placed in Head section.</p> <pre><code>function pageLoad(){ var allOddSelectOption ...
[ { "answer_id": 361861, "author": "Christian C. Salvadó", "author_id": 5445, "author_profile": "https://Stackoverflow.com/users/5445", "pm_score": 3, "selected": true, "text": "<p>Check <a href=\"http://docs.jquery.com/CSS/css#properties\" rel=\"nofollow noreferrer\">css(properties)</a>, ...
2008/12/12
[ "https://Stackoverflow.com/questions/361856", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24507/" ]
I need some help with jQuery script again :-) Just trying to play with jQuery..I use script below for coloring options of select element. It works in pure html, but in my asp.net 2.0 (Master + Content pages) does not. Script is placed in Head section. ``` function pageLoad(){ var allOddSelectOption = "select optio...
Check [css(properties)](http://docs.jquery.com/CSS/css#properties), you can apply styles very easy. ``` $(document).ready(function(){ $("select option:odd").css({'background-color' : 'yellow', 'font-weight' : 'bolder'}); }); ``` EDIT: For ASP .NET 2.0 `$(document).ready()` will work, since you can call it [multipl...
361,904
<pre><code>function holiday_hitlist($tablename, $hit_user){ global $host, $user, $pass, $dbname; $link = mysql_connect($host, $user, $pass, $dbname); print "&lt;div class=\"hit_list\"&gt; &lt;h3&gt;My Holiday Hitlist&lt;/h3&gt; &lt;p&gt;Five things I want the most, based on my des...
[ { "answer_id": 361915, "author": "Zoredache", "author_id": 20267, "author_profile": "https://Stackoverflow.com/users/20267", "pm_score": 4, "selected": true, "text": "<p>See the line </p>\n\n<pre><code>$output = print \"&lt;li&gt;&lt;a href=\\\"$url\\\" target=\\\"_blank\\\"&gt;$title&lt...
2008/12/12
[ "https://Stackoverflow.com/questions/361904", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7853/" ]
``` function holiday_hitlist($tablename, $hit_user){ global $host, $user, $pass, $dbname; $link = mysql_connect($host, $user, $pass, $dbname); print "<div class=\"hit_list\"> <h3>My Holiday Hitlist</h3> <p>Five things I want the most, based on my desirability ratings.<br/>You can'...
See the line ``` $output = print "<li><a href=\"$url\" target=\"_blank\">$title</a> $price</li>"; ``` you should probably remove the print after the $output = Or maybe you just need to remove the $output = I am not quite sure what you intend. To explain, $output is getting the return value of print "..."
361,910
<p>Say you have something like an ASP.NET ASP:DetailsView to show and edit a single record in a database.</p> <p>It's simple to record the error cases... you add validation and a validation summary. When your update form fails validation it naturally makes noise: it shows the validation message and/or the validation ...
[ { "answer_id": 361925, "author": "tvanfosson", "author_id": 12950, "author_profile": "https://Stackoverflow.com/users/12950", "pm_score": 1, "selected": false, "text": "<p>Use the ItemCommand event and perform reset to clean state for every command that is given. Then if validation fail...
2008/12/12
[ "https://Stackoverflow.com/questions/361910", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22452/" ]
Say you have something like an ASP.NET ASP:DetailsView to show and edit a single record in a database. It's simple to record the error cases... you add validation and a validation summary. When your update form fails validation it naturally makes noise: it shows the validation message and/or the validation summary. No...
As far as I know, there is no native way of doing this. You may rant about it, maybe Microsoft will hear it :). Resetting the "success message" on Page\_Load, or wherever in your code-behind, won't work. This is because ASP.NET validation is usually done both client and server-side. This means for every validation con...
361,921
<pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Text; namespace ConsoleApplication1 { public class Class1 { static void Main(string[] args) { List&lt;Car&gt; mylist = new List&lt;Car&gt;(); Car car1...
[ { "answer_id": 361931, "author": "leppie", "author_id": 15541, "author_profile": "https://Stackoverflow.com/users/15541", "pm_score": 3, "selected": false, "text": "<p>This is not LINQ2SQL.</p>\n\n<p>Also, LINQ is not used for updating, only to query for objects.</p>\n" }, { "ans...
2008/12/12
[ "https://Stackoverflow.com/questions/361921", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42564/" ]
``` using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Text; namespace ConsoleApplication1 { public class Class1 { static void Main(string[] args) { List<Car> mylist = new List<Car>(); Car car1; Car ca...
Everything leppie said - plus: ``` int index = mylist.FindIndex(p => p.id == 1); if(index<0) { mylist.Add(car3); } else { mylist[index] = car3; } ``` This just uses the existing FindIndex to locate a car with id 1, then replace or add it. No LINQ; no SQL - just a lambda and `List<T>`.
361,922
<p>I am trying to create 1 Parent Drop Down, that has 2 dependent child drop down lists using JAVASCRIPT.</p> <p>My html page is at - <a href="http://www.larkgrove.com/entryform/entryform.html" rel="nofollow noreferrer">http://www.larkgrove.com/entryform/entryform.html</a></p> <p>I am using the Dynamic Options Lists ...
[ { "answer_id": 361987, "author": "danieltalsky", "author_id": 22452, "author_profile": "https://Stackoverflow.com/users/22452", "pm_score": 0, "selected": false, "text": "<p>Well, first of all, let's have a look at your code:</p>\n\n<pre><code>&lt;script type=\"text/javascript\"&gt;\nvar...
2008/12/12
[ "https://Stackoverflow.com/questions/361922", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I am trying to create 1 Parent Drop Down, that has 2 dependent child drop down lists using JAVASCRIPT. My html page is at - <http://www.larkgrove.com/entryform/entryform.html> I am using the Dynamic Options Lists / Dependent Selects: <http://www.javascripttoolbox.com/lib/dynamicoptionlist/examples.php> If you check ...
I know you are using the Dynamic options script, but I thought that I would put up a quick from scratch solution. The code is a little verbose, but I am hoping it will be easier to see whats going on this way. The final working page is here: <http://ryanscook.com/Files/DropDownListTest.htm> Lets start by assuming you ...
361,930
<p>Are all these types of sites just illegally scraping Google or another search engine?<br> As far as I can tell ther is no 'legal' way to get this data for a commercial site.. The Yahoo! api ( <a href="http://developer.yahoo.com/search/siteexplorer/V1/inlinkData.html" rel="nofollow noreferrer">http://developer.yahoo....
[ { "answer_id": 754901, "author": "Shalom Craimer", "author_id": 54491, "author_profile": "https://Stackoverflow.com/users/54491", "pm_score": 2, "selected": false, "text": "<p>For example, if you wanted to find all the links to Google's homepage, search for</p>\n\n<pre><code>link:http://...
2008/12/12
[ "https://Stackoverflow.com/questions/361930", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45598/" ]
Are all these types of sites just illegally scraping Google or another search engine? As far as I can tell ther is no 'legal' way to get this data for a commercial site.. The Yahoo! api ( <http://developer.yahoo.com/search/siteexplorer/V1/inlinkData.html> ) is only for noncommercial use, Yahoo! Boss does not allow a...
For example, if you wanted to find all the links to Google's homepage, search for ``` link:http://www.google.com ``` So if you want to find all the inbound links, you can simply traverse your website's tree, and for each item it finds, build a URL. Then query Google for: ``` link:URL ``` And you'll get a collecti...
361,938
<p>I am trying to reach methods and properties of ObjectFrame through vb.net. But when I declared this as </p> <pre><code>Dim objOLEObject As ObjectFrame </code></pre> <p>and then trying to instantiate it as </p> <pre><code>ObjOLEObject = New ObjectFrame </code></pre> <p>it shows error like:</p> <p>"<strong>429: R...
[ { "answer_id": 361963, "author": "JoshBerke", "author_id": 26160, "author_profile": "https://Stackoverflow.com/users/26160", "pm_score": 1, "selected": false, "text": "<p>Make sure the dll has been registered using regsvr32. Verify by looking in the registry for the CLSID.</p>\n\n<p>Make...
2008/12/12
[ "https://Stackoverflow.com/questions/361938", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45255/" ]
I am trying to reach methods and properties of ObjectFrame through vb.net. But when I declared this as ``` Dim objOLEObject As ObjectFrame ``` and then trying to instantiate it as ``` ObjOLEObject = New ObjectFrame ``` it shows error like: "**429: Retriveing the COM class factory for component with CLSID {3806...
Make sure the dll has been registered using regsvr32. Verify by looking in the registry for the CLSID. Make sure all dependant dll's are available. I believe this is a class not registered error.
361,945
<p>Are there techniques for comparing the same data stored in different schemas? The situation is something like this. If I have a db with schema A and it stores data for a feature in say, 5 tables. Schema A -> Schema B is done during an upgrade process. During the upgrade process some transformation logic is applied a...
[ { "answer_id": 361988, "author": "Martin v. Löwis", "author_id": 33006, "author_profile": "https://Stackoverflow.com/users/33006", "pm_score": 2, "selected": true, "text": "<p>Basically, you should create object representations for both schema versions, and then compare objects. This is ...
2008/12/12
[ "https://Stackoverflow.com/questions/361945", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45599/" ]
Are there techniques for comparing the same data stored in different schemas? The situation is something like this. If I have a db with schema A and it stores data for a feature in say, 5 tables. Schema A -> Schema B is done during an upgrade process. During the upgrade process some transformation logic is applied and ...
Basically, you should create object representations for both schema versions, and then compare objects. This is best done if they all fit into memory simultaneously; if not, you need to iterate over all objects in one representation, fetch the corresponding object in the other representation, compare them, and then do ...
361,955
<p>I'm trying to build about 600 projects some are .net 2.0, some are 3.5. I'm using Windows 2003 Enterprise Edition 32 bit with all the latest windows updates.</p> <p>Builds fine when maxcpucount is 1. If I bump it up to try and improve performance it get reference errors. When I look at the project references fro...
[ { "answer_id": 378668, "author": "Gregg", "author_id": 18266, "author_profile": "https://Stackoverflow.com/users/18266", "pm_score": 3, "selected": false, "text": "<p>In order for MSBuild to run with multiple cores/cpus, it needs to be able to determine beforehand what all of the depende...
2008/12/12
[ "https://Stackoverflow.com/questions/361955", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45005/" ]
I'm trying to build about 600 projects some are .net 2.0, some are 3.5. I'm using Windows 2003 Enterprise Edition 32 bit with all the latest windows updates. Builds fine when maxcpucount is 1. If I bump it up to try and improve performance it get reference errors. When I look at the project references from where the e...
In order for MSBuild to run with multiple cores/cpus, it needs to be able to determine beforehand what all of the dependencies are. Generally this means you either need to have all of your projects in a single *huge* solution and set up all of your references to be project references or set up multiple solutions and se...
361,973
<p>I have written my program in c# .net. I want to convert it in to a powershell cmdlet. I was instructed to use pssnapin and getproc programs. Can anyone plz help me out..</p> <p>Regards Arun</p>
[ { "answer_id": 362050, "author": "user44526", "author_id": 44526, "author_profile": "https://Stackoverflow.com/users/44526", "pm_score": 1, "selected": false, "text": "<p>Install windows powershell template thereby u will get the pssnapin program, using that you can convert your .cs file...
2008/12/12
[ "https://Stackoverflow.com/questions/361973", "https://Stackoverflow.com", "https://Stackoverflow.com/users/201406/" ]
I have written my program in c# .net. I want to convert it in to a powershell cmdlet. I was instructed to use pssnapin and getproc programs. Can anyone plz help me out.. Regards Arun
So, here's the PSCmdlet-Class[from medata], that you can inherit from. ``` namespace System.Management.Automation { public abstract class PSCmdlet : Cmdlet { protected PSCmdlet(); public PSHost Host { get; } public CommandInvocationIntrinsics InvokeCommand { get; } public Provi...
361,975
<p>How do I properly set the default character encoding used by the JVM (1.5.x) programmatically?</p> <p>I have read that <code>-Dfile.encoding=whatever</code> used to be the way to go for older JVMs. I don't have that luxury for reasons I wont get into.</p> <p>I have tried:</p> <pre><code>System.setProperty("file.e...
[ { "answer_id": 361981, "author": "Marc Novakowski", "author_id": 27020, "author_profile": "https://Stackoverflow.com/users/27020", "pm_score": 4, "selected": false, "text": "<p>I can't answer your original question but I would like to offer you some advice -- don't depend on the JVM's de...
2008/12/12
[ "https://Stackoverflow.com/questions/361975", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
How do I properly set the default character encoding used by the JVM (1.5.x) programmatically? I have read that `-Dfile.encoding=whatever` used to be the way to go for older JVMs. I don't have that luxury for reasons I wont get into. I have tried: ``` System.setProperty("file.encoding", "UTF-8"); ``` And the prope...
Unfortunately, the `file.encoding` property has to be specified as the JVM starts up; by the time your main method is entered, the character encoding used by `String.getBytes()` and the default constructors of `InputStreamReader` and `OutputStreamWriter` has been permanently cached. As [Edward Grech points out,](https...
362,000
<p>I have this input text:</p> <pre><code>&lt;html&gt;&lt;head&gt;&lt;meta http-equiv="content-type" content="text/html; charset=utf-8"&gt;&lt;/head&gt;&lt;body&gt;&lt;table cellspacing="0" cellpadding="0" border="0" align="center" width="603"&gt; &lt;tbody&gt;&lt;tr&gt; &lt;td&gt;&lt;table cellspacing="0" cellp...
[ { "answer_id": 362033, "author": "PhiLho", "author_id": 15459, "author_profile": "https://Stackoverflow.com/users/15459", "pm_score": 3, "selected": false, "text": "<p>There are excellent HTML parsers for Perl, learn to use them and stick with that. HTML is complex, allows > in attribute...
2008/12/12
[ "https://Stackoverflow.com/questions/362000", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38124/" ]
I have this input text: ``` <html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body><table cellspacing="0" cellpadding="0" border="0" align="center" width="603"> <tbody><tr> <td><table cellspacing="0" cellpadding="0" border="0" width="603"> <tbody><tr> <td width=...
If you must avoid any additional module, like an HTML parser, you could try: ``` while ($string =~ m/(?:\<\s*(?:img|iframe)[^\>]+src\s*=\s*\"((?:\w|_|\\|-|\/|\.|:)+)\"|background\s*=\s*\"([^\>]+\.jpg)|\<\s*iframe)/g) { $old_src = $1; my @tmp = split(/\/Elearning/,$old_src); $new_src =...
362,032
<p>I want the Perl script to extract a data from a text file and save it as another text file. Each line of the text file contains an URL to a jpg like "<a href="http://pics1.riyaj.com/thumbs/000/082/104//small.jpg" rel="nofollow noreferrer">http://pics1.riyaj.com/thumbs/000/082/104//small.jpg</a>". I want the script t...
[ { "answer_id": 362128, "author": "brian d foy", "author_id": 2766176, "author_profile": "https://Stackoverflow.com/users/2766176", "pm_score": 2, "selected": false, "text": "<p>What have you tried so far?</p>\n\n<p>Here's a short program that gives you the meat of the problem, and you ca...
2008/12/12
[ "https://Stackoverflow.com/questions/362032", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45614/" ]
I want the Perl script to extract a data from a text file and save it as another text file. Each line of the text file contains an URL to a jpg like "<http://pics1.riyaj.com/thumbs/000/082/104//small.jpg>". I want the script to extract the last 6 numbers of each jpg URL, (i.e 082104) to a variable. I want the variable ...
What have you tried so far? Here's a short program that gives you the meat of the problem, and you can add the rest of it: ``` while( ) { s|http://.*/\d+/(\d+)/(\d+).*?jpg|php?id=$1$2|; print; } ``` This is very close to the command-line program the handles the looping and printing for you with th...
362,059
<p>What is the Big-O time complexity of the following nested loops:</p> <pre class="lang-cpp prettyprint-override"><code>for (int i = 0; i &lt; N; i++) { for (int j = i + 1; j &lt; N; j++) { System.out.println(&quot;i = &quot; + i + &quot; j = &quot; + j); } } </code></pre> <p>Would it be <em>O(N^2)</em...
[ { "answer_id": 362062, "author": "Alex Gaynor", "author_id": 37181, "author_profile": "https://Stackoverflow.com/users/37181", "pm_score": 7, "selected": true, "text": "<p>Yep, it's still O(n^2), it has a smaller constant factor, but that doesn't affect O notation.</p>\n" }, { "a...
2008/12/12
[ "https://Stackoverflow.com/questions/362059", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2635/" ]
What is the Big-O time complexity of the following nested loops: ```cpp for (int i = 0; i < N; i++) { for (int j = i + 1; j < N; j++) { System.out.println("i = " + i + " j = " + j); } } ``` Would it be *O(N^2)* still?
Yep, it's still O(n^2), it has a smaller constant factor, but that doesn't affect O notation.
362,104
<p>I have a Template Column under which I have Placed a Dropdownlist. Now I would Like to get the selectedRow of the datagrid on selectedIndeChanged event of the dropdownlist that's inside the template Column</p>
[ { "answer_id": 362177, "author": "Tom Jelen", "author_id": 28399, "author_profile": "https://Stackoverflow.com/users/28399", "pm_score": 2, "selected": true, "text": "<p>You can get the index of the item in the datagrid, by looking at the DataGridItem your dropdownlist is contained withi...
2008/12/12
[ "https://Stackoverflow.com/questions/362104", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a Template Column under which I have Placed a Dropdownlist. Now I would Like to get the selectedRow of the datagrid on selectedIndeChanged event of the dropdownlist that's inside the template Column
You can get the index of the item in the datagrid, by looking at the DataGridItem your dropdownlist is contained within. Assuming your DropDownList is directly in the TemplateColumn and is not wrapped by other elements, then the following example shows how to do this: ``` protected void DropDown_SelectedIndexChan...
362,105
<p>I have a Hash like this</p> <pre><code>{ 55 =&gt; {:value=&gt;61, :rating=&gt;-147}, 89 =&gt; {:value=&gt;72, :rating=&gt;-175}, 78 =&gt; {:value=&gt;64, :rating=&gt;-155}, 84 =&gt; {:value=&gt;90, :rating=&gt;-220}, 95 =&gt; {:value=&gt;39, :rating=&gt;-92}, 46 =&gt; {:value=&gt;97, :rating=&gt;-237}, ...
[ { "answer_id": 362133, "author": "Gareth", "author_id": 31582, "author_profile": "https://Stackoverflow.com/users/31582", "pm_score": 3, "selected": false, "text": "<p>Hashes in Ruby can't be sorted (at least not before 1.9)</p>\n\n<p>This means that looping through a Hash won't necessar...
2008/12/12
[ "https://Stackoverflow.com/questions/362105", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45622/" ]
I have a Hash like this ``` { 55 => {:value=>61, :rating=>-147}, 89 => {:value=>72, :rating=>-175}, 78 => {:value=>64, :rating=>-155}, 84 => {:value=>90, :rating=>-220}, 95 => {:value=>39, :rating=>-92}, 46 => {:value=>97, :rating=>-237}, 52 => {:value=>73, :rating=>-177}, 64 => {:value=>69, :rating=>-16...
I would change the data structure to an array of hashes: ``` my_array = [ {:id => 78, :value=>64, :rating=>-155}, {:id => 84, :value=>90, :rating=>-220}, {:id => 95, :value=>39, :rating=>-92} ] ``` You can sort this kind of structure easily with ``` my_array.sort_by { |record| record[:rating] } ``` To get t...
362,112
<p>Consider a simple table with an auto-increment column like this:</p> <pre><code>CREATE TABLE foo ( `fooid` bigint unsigned NOT NULL auto_increment, ....snipped.... other columns PRIMARY KEY (`fooid`) ) ENGINE=InnoDB AUTO_INCREMENT=10 </code></pre> <p>How does one redesign this so that we don't hit the max...
[ { "answer_id": 362119, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 7, "selected": true, "text": "<p>Suppose you insert one row every millisecond. </p>\n\n<p>18446744073709551615 millseconds =\n18446744073709552 seconds...
2008/12/12
[ "https://Stackoverflow.com/questions/362112", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24457/" ]
Consider a simple table with an auto-increment column like this: ``` CREATE TABLE foo ( `fooid` bigint unsigned NOT NULL auto_increment, ....snipped.... other columns PRIMARY KEY (`fooid`) ) ENGINE=InnoDB AUTO_INCREMENT=10 ``` How does one redesign this so that we don't hit the max of the bigint datatype ? ...
Suppose you insert one row every millisecond. 18446744073709551615 millseconds = 18446744073709552 seconds = 307445734561826 minutes = 5124095576030 hours = 213503982335 days = 584942417 years So it's not *really* like the Y2K problem You could insert a *million* rows per millisecond and still be okay for over 500 ...
362,113
<p>I've been thinking, just how deep into everything do you have to go before something is automatically thread-safe?</p> <p>Quick example:</p> <pre><code>int dat = 0; void SetInt(int data) { dat = data; } </code></pre> <p>.. Would this method be considered threadsafe? I ussually wrap all my set-methods in mutex...
[ { "answer_id": 362118, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 2, "selected": false, "text": "<p>In general, a thread context switch can happen at <em>any</em> time, between any two assembly language instructions. T...
2008/12/12
[ "https://Stackoverflow.com/questions/362113", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25745/" ]
I've been thinking, just how deep into everything do you have to go before something is automatically thread-safe? Quick example: ``` int dat = 0; void SetInt(int data) { dat = data; } ``` .. Would this method be considered threadsafe? I ussually wrap all my set-methods in mutex'es, just to be sure, but everyti...
In general, a thread context switch can happen at *any* time, between any two assembly language instructions. The CPU is completely unaware of how the assembly language maps to your source code. Furthermore, with multiple processors, other instructions can be executing on a different CPU core at the very same time. Ha...
362,120
<p>Why the FontFamily param of the Font object is a string and not an enum?</p>
[ { "answer_id": 362125, "author": "Tomalak", "author_id": 18771, "author_profile": "https://Stackoverflow.com/users/18771", "pm_score": 2, "selected": false, "text": "<p>Because an Enum is a set of fixed values that forces a re-compile when it changes (and in this case this would ultimate...
2008/12/12
[ "https://Stackoverflow.com/questions/362120", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45624/" ]
Why the FontFamily param of the Font object is a string and not an enum?
FontFamily refers to the name of the Font. While you could use "monospace" or "serif" I wouldn't think it would be supported by .Net. Remember, using a enum would be impossible. A enum is a static compile-time feature, which means that it can't "generate" a enum dynamically from fonts on your system. Indeed, including...
362,121
<p>I have the following table</p> <pre> custid ordid qty datesold 1 A2 12 2008-01-05 2 A5 5 2008-01-02 1 A1 5 2008-01-01 2 A7 3 2007-02-05 </pre> <p>What't the best way of getting the previous order for every customer?</p> <p>Th...
[ { "answer_id": 362143, "author": "Robert Wagner", "author_id": 10784, "author_profile": "https://Stackoverflow.com/users/10784", "pm_score": 1, "selected": false, "text": "<p>A common solution for this kind of problem is to choose the Max(datesold) and get the latest that way. This is ok...
2008/12/12
[ "https://Stackoverflow.com/questions/362121", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23667/" ]
I have the following table ``` custid ordid qty datesold 1 A2 12 2008-01-05 2 A5 5 2008-01-02 1 A1 5 2008-01-01 2 A7 3 2007-02-05 ``` What't the best way of getting the previous order for every customer? Thanks
If by "previous" you mean "the one before the latest": ``` SELECT TOP 1 ordid FROM orders WHERE custid = @custid and datesold < (SELECT MAX(datesold) FROM orders i where i.custid = orders.custid) ORDER BY datesold DESC ``` Of course `datesold` has to be a DATETIME with distinct enough values for this to wo...
362,124
<p>any generic way to trace/log values of all local variables when an exception occurs in a method? (in C# 3)</p>
[ { "answer_id": 362146, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 3, "selected": false, "text": "<p>You can't, basically. Reflection lets you get at <em>instance</em> (and static) variables but if you want to log loca...
2008/12/12
[ "https://Stackoverflow.com/questions/362124", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7722/" ]
any generic way to trace/log values of all local variables when an exception occurs in a method? (in C# 3)
Answer: Using PostSharp (Policy Injection), XTraceMethodBoundary attribute, override OnException . this logs all the method input and return parameters types and values. I modified PostSharp to add a simple method to log parameters. not perfect but good enough ``` private static void TraceMethodArguments(MethodExecut...
362,154
<p>I'm just reading Code Complete by Steve McConell and I'm thinking of an Example he gives in a section about loose coupling. It's about the interface of a method that calculates the number of holidays for an employee, which is calculated from the entry date of the employee and her sales. The author suggests a to have...
[ { "answer_id": 362169, "author": "shahkalpesh", "author_id": 23574, "author_profile": "https://Stackoverflow.com/users/23574", "pm_score": 1, "selected": false, "text": "<p>1) Providing parameters doesn't break encapsulation. It just shows that these parameters are used to calculate holi...
2008/12/12
[ "https://Stackoverflow.com/questions/362154", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18722/" ]
I'm just reading Code Complete by Steve McConell and I'm thinking of an Example he gives in a section about loose coupling. It's about the interface of a method that calculates the number of holidays for an employee, which is calculated from the entry date of the employee and her sales. The author suggests a to have en...
The problems I see with your argument number 2 are 1. you are assuming every needed value comes from an Employee instance. This is by no means always true. For example, say you have to consider the financial state of the company to calculate how much 'bonus holiday' give to any employee. Would you add financial state ...
362,215
<p>I want to build a threaded forum for an elearning site (opensource asp.net mvc ofcourse, though this doesn't matter for this question). </p> <p>What should be the DB structure which will help retrieve the forum postings with optimum performance? I am not putting a no. to it as it may vary with the amount of rows ...
[ { "answer_id": 362230, "author": "Tomalak", "author_id": 18771, "author_profile": "https://Stackoverflow.com/users/18771", "pm_score": 3, "selected": true, "text": "<p>When you have non-recursive top-down (Forum -&gt; Thread -&gt; Postings) retrieval of your data in mind for the most com...
2008/12/12
[ "https://Stackoverflow.com/questions/362215", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34644/" ]
I want to build a threaded forum for an elearning site (opensource asp.net mvc ofcourse, though this doesn't matter for this question). What should be the DB structure which will help retrieve the forum postings with optimum performance? I am not putting a no. to it as it may vary with the amount of rows being retrie...
When you have non-recursive top-down (Forum -> Thread -> Postings) retrieval of your data in mind for the most common use case, than this table structure is a good start, because this would result mainly in `WHERE ParentId = @SomeId` queries. When you want to be able to calculate things like "How many postings exist i...
362,222
<p>I am actually rendering an excel file in the browser. I use the Response.Writefile(filePath) to dod this. It is working perfectly fine in few of the machines. I am getting a pop up with "Open","Save" and "Cancel" option. </p> <p>But incase of few machines after i do a save click on the popup a plain empty page rema...
[ { "answer_id": 362712, "author": "HectorMac", "author_id": 1400, "author_profile": "https://Stackoverflow.com/users/1400", "pm_score": 3, "selected": true, "text": "<p>Are you setting any HTTP headers? If you are not, you are relying on the browser to interpret the data correctly.</p>\n\...
2008/12/12
[ "https://Stackoverflow.com/questions/362222", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20951/" ]
I am actually rendering an excel file in the browser. I use the Response.Writefile(filePath) to dod this. It is working perfectly fine in few of the machines. I am getting a pop up with "Open","Save" and "Cancel" option. But incase of few machines after i do a save click on the popup a plain empty page remains open. ...
Are you setting any HTTP headers? If you are not, you are relying on the browser to interpret the data correctly. To tell the browser you are sending excel content: ``` Response.ContentType = "application/x-excel"; ``` To tell the browser to treat the response as download: ``` Response.AddHeader("content-dispositi...
362,224
<p>I found this question in an old question in your website so i thought i can do it but I think I was mistaken :-)</p> <p>the old post was <a href="https://stackoverflow.com/questions/360943/read-text-from-file-and-apply-some-operations-on-it">here</a></p> <p>I'm new at the jagged array thing so did the following co...
[ { "answer_id": 362284, "author": "benlumley", "author_id": 39161, "author_profile": "https://Stackoverflow.com/users/39161", "pm_score": 7, "selected": true, "text": "<p>The bad news: there are GUI tools to help with this, but its a skilled and wide ranging job. So they don't cover every...
2008/12/12
[ "https://Stackoverflow.com/questions/362224", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I found this question in an old question in your website so i thought i can do it but I think I was mistaken :-) the old post was [here](https://stackoverflow.com/questions/360943/read-text-from-file-and-apply-some-operations-on-it) I'm new at the jagged array thing so did the following code ``` StreamReader rows = ...
The bad news: there are GUI tools to help with this, but its a skilled and wide ranging job. So they don't cover everything, its likely you will need to use command line stuff/sql statements etc to help. I've only really used the command line tools. I'll give a bit of an overview of things I know/have used: First, you...
362,227
<p>I have a problem only in Google Chrome (Firefox, IE, Netscape, Safari and Opera are Okay) where a padding property which should be applied to text in a cell, is being applied to all empty cells aswell. It's easy to solve by adding more specific styles to my affected perimeter cells and using different styles, but th...
[ { "answer_id": 362284, "author": "benlumley", "author_id": 39161, "author_profile": "https://Stackoverflow.com/users/39161", "pm_score": 7, "selected": true, "text": "<p>The bad news: there are GUI tools to help with this, but its a skilled and wide ranging job. So they don't cover every...
2008/12/12
[ "https://Stackoverflow.com/questions/362227", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36076/" ]
I have a problem only in Google Chrome (Firefox, IE, Netscape, Safari and Opera are Okay) where a padding property which should be applied to text in a cell, is being applied to all empty cells aswell. It's easy to solve by adding more specific styles to my affected perimeter cells and using different styles, but that ...
The bad news: there are GUI tools to help with this, but its a skilled and wide ranging job. So they don't cover everything, its likely you will need to use command line stuff/sql statements etc to help. I've only really used the command line tools. I'll give a bit of an overview of things I know/have used: First, you...
362,231
<p>I'm interested in implementing autocomplete in Python. For example, as the user types in a string, I'd like to show the subset of files on disk whose names start with that string. </p> <p>What's an efficient algorithm for finding strings that match some condition in a large corpus (say a few hundred thousand string...
[ { "answer_id": 362264, "author": "Toni Ruža", "author_id": 6267, "author_profile": "https://Stackoverflow.com/users/6267", "pm_score": 2, "selected": false, "text": "<p>I used <a href=\"http://pylucene.osafoundation.org/\" rel=\"nofollow noreferrer\">Lucene</a> to autocomplete a text fie...
2008/12/12
[ "https://Stackoverflow.com/questions/362231", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13055/" ]
I'm interested in implementing autocomplete in Python. For example, as the user types in a string, I'd like to show the subset of files on disk whose names start with that string. What's an efficient algorithm for finding strings that match some condition in a large corpus (say a few hundred thousand strings)? Someth...
For exact matching, generally the way to implement something like this is to store your corpus in a [trie](http://en.wikipedia.org/wiki/Trie). The idea is that you store each letter as a node in the tree, linking to the next letter in a word. Finding the matches is simply walking the tree, and showing all children of y...
362,252
<p>If there are many return records from DB. It will get stackoverflow problem. <code>User</code> is a class, which has a one to many relationship (to 3 other classes). When I print out the SQL, i found that the system runs the same query many time to get the data from DB. Does anyone know what the problem is?</p> <pr...
[ { "answer_id": 362244, "author": "Eugene Yokota", "author_id": 3827, "author_profile": "https://Stackoverflow.com/users/3827", "pm_score": 1, "selected": false, "text": "<p>Anything that can uniquely identify the record is a good identity data type. GUID is generally good, but it's not t...
2008/12/12
[ "https://Stackoverflow.com/questions/362252", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
If there are many return records from DB. It will get stackoverflow problem. `User` is a class, which has a one to many relationship (to 3 other classes). When I print out the SQL, i found that the system runs the same query many time to get the data from DB. Does anyone know what the problem is? ``` result.addAll(get...
Edited after reading Frans Bouma's answer, since my answer has been accepted and therefore moved to the top. Thanks, Frans. GUIDs do make a good unique value, however due to their complex nature they're not really human-readable, which can make support difficult. If you're going to use GUIDs you might want to consider...
362,278
<p>I'm begginer in java I'm reading data from serial port and I have stored the data in string array data is 24 byte length.</p> <p>Data I'm getting as output: 12120814330006050.0 </p> <p>data also contains hexadecimal character in the string I want to read first character of the string. I have done:</p> <pre><code>...
[ { "answer_id": 362289, "author": "Markus Lausberg", "author_id": 39062, "author_profile": "https://Stackoverflow.com/users/39062", "pm_score": 2, "selected": false, "text": "<p>single characters you can get from a string with</p>\n\n<pre><code>str.getChar(0);\n</code></pre>\n\n<p>When yo...
2008/12/12
[ "https://Stackoverflow.com/questions/362278", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm begginer in java I'm reading data from serial port and I have stored the data in string array data is 24 byte length. Data I'm getting as output: 12120814330006050.0 data also contains hexadecimal character in the string I want to read first character of the string. I have done: ``` String str=dispArray[i].subs...
single characters you can get from a string with ``` str.getChar(0); ``` When you know that the string contains hex values in every character you dont have to convert every single character. You can put the complete string in and get the dec value of the hex string back. Otherwise you only calculate 1 hex value and ...
362,300
<p>I plan to use a distributed cache in my load-balanced webapp. So I'm going to try to abstract out the common functions between apache ehcache and memcached.</p> <p>My goal is to be able to make a simple configuration switch to select the caching solution to use. Should I go the SPI route e.g. like how XML parsers a...
[ { "answer_id": 362289, "author": "Markus Lausberg", "author_id": 39062, "author_profile": "https://Stackoverflow.com/users/39062", "pm_score": 2, "selected": false, "text": "<p>single characters you can get from a string with</p>\n\n<pre><code>str.getChar(0);\n</code></pre>\n\n<p>When yo...
2008/12/12
[ "https://Stackoverflow.com/questions/362300", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24457/" ]
I plan to use a distributed cache in my load-balanced webapp. So I'm going to try to abstract out the common functions between apache ehcache and memcached. My goal is to be able to make a simple configuration switch to select the caching solution to use. Should I go the SPI route e.g. like how XML parsers are wired i...
single characters you can get from a string with ``` str.getChar(0); ``` When you know that the string contains hex values in every character you dont have to convert every single character. You can put the complete string in and get the dec value of the hex string back. Otherwise you only calculate 1 hex value and ...
362,326
<p>I have 6 classes, which are all document types. All the document types have the same 8 fields. There is one class which consists of only these 8 fields. The rest of the classes have more fields. Some of these classes have the same fields (beside the 8 fields).</p> <p>Example:</p> <p>class Document: fields 1 to 8</...
[ { "answer_id": 362332, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 3, "selected": true, "text": "<p>Either make Document the base type of Form etc, or make a form have the extra fields and a reference to a separate Doc...
2008/12/12
[ "https://Stackoverflow.com/questions/362326", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40676/" ]
I have 6 classes, which are all document types. All the document types have the same 8 fields. There is one class which consists of only these 8 fields. The rest of the classes have more fields. Some of these classes have the same fields (beside the 8 fields). Example: class Document: fields 1 to 8 class Form: field...
Either make Document the base type of Form etc, or make a form have the extra fields and a reference to a separate Document (i.e. use composition instead of inheritance). In this case it sounds like inheritance would quite possibly be the best option, but it really depends on what you want to do with it. Do you have co...
362,328
<p>I'm trying to run PHPDocumentor on my WAMPServer setup. It runs fine, but I'd like to exclude certain directories, such as \sqlbuddy\ which don't contain my own code. Ironically, PHPDocumentor appears to be ignoring my --ignore switch. I've tried several ways of expressing the same thing, but with the same result. B...
[ { "answer_id": 369259, "author": "Bob Fanger", "author_id": 19165, "author_profile": "https://Stackoverflow.com/users/19165", "pm_score": 3, "selected": true, "text": "<p>Which version of phpDocumentor are you using?</p>\n\n<p>Because the <a href=\"http://phpdoc.org/news.php?id=57\" rel=...
2008/12/12
[ "https://Stackoverflow.com/questions/362328", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4742/" ]
I'm trying to run PHPDocumentor on my WAMPServer setup. It runs fine, but I'd like to exclude certain directories, such as \sqlbuddy\ which don't contain my own code. Ironically, PHPDocumentor appears to be ignoring my --ignore switch. I've tried several ways of expressing the same thing, but with the same result. Belo...
Which version of phpDocumentor are you using? Because the [phpDocumentor 1.4.2 release notes](http://phpdoc.org/news.php?id=57) states: > > This release fixes two > Windows-specific bugs, one involving > usage of the "--ignore" option, and > one involving usage of the @filesource > tag. > > >
362,334
<p>Is there any standalone alternative to activerecord-like migrations. Something like a script that is able to track current schema version and apply outstanding migrations. Basically, these migration files could be just a plain SQL files, something like:</p> <pre> [timestamp]_create_users.sql reverse_[timestamp]_cre...
[ { "answer_id": 362353, "author": "benlumley", "author_id": 39161, "author_profile": "https://Stackoverflow.com/users/39161", "pm_score": 0, "selected": false, "text": "<p>Not a linux option, but might answer this question for some people:</p>\n\n<p>SQLYog can do this for MySQL - its a wi...
2008/12/12
[ "https://Stackoverflow.com/questions/362334", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45652/" ]
Is there any standalone alternative to activerecord-like migrations. Something like a script that is able to track current schema version and apply outstanding migrations. Basically, these migration files could be just a plain SQL files, something like: ``` [timestamp]_create_users.sql reverse_[timestamp]_create_user...
Try <http://freshmeat.net/projects/liquibase/> If you are using MySQL specifically, have a look at: <http://www.mysqldiff.org/> I used this to synchronize the schema of two databases (so you would have to apply the changes to a "master"). There's also <http://phpmyversion.sourceforge.net/>
362,355
<p>We have a <a href="http://blogs.msdn.com/murrays/archive/2006/10/14/richedit-versions.aspx" rel="nofollow noreferrer">RichEdit</a> control into which we allow the user to insert an <a href="http://en.wikipedia.org/wiki/Office_MathML" rel="nofollow noreferrer">Office MathML</a> equation object.</p> <p>Basically the ...
[ { "answer_id": 362363, "author": "Jonas Elfström", "author_id": 44620, "author_profile": "https://Stackoverflow.com/users/44620", "pm_score": 0, "selected": false, "text": "<p>I'm pretty sure you can't do this in JavaScript / jQuery. Not without some plugin anyway.</p>\n\n<p>Also it soun...
2008/12/12
[ "https://Stackoverflow.com/questions/362355", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38124/" ]
We have a [RichEdit](http://blogs.msdn.com/murrays/archive/2006/10/14/richedit-versions.aspx) control into which we allow the user to insert an [Office MathML](http://en.wikipedia.org/wiki/Office_MathML) equation object. Basically the logic goes like this: the user click on insert math equation, we allow them to use a...
You could use a browser engine render the page as an image, and then cut out the requested section of the page. I don't know if there is a jquery or php extension that does it for you, but you could use an exec call and use for instance [CutyCapt](http://cutycapt.sourceforge.net/) to render the page, and an image proc...
362,360
<p>I am developing a Web Album using Grails and for image processing, I am using grails-image-tools plugin. I need a functionality to resize the images if the uploaded images size is too big (for eg: more than 600 * 840 ) . In this case I need to resize this image to 600 * 840). What is the most efficient way to do thi...
[ { "answer_id": 362411, "author": "Warrior", "author_id": 40933, "author_profile": "https://Stackoverflow.com/users/40933", "pm_score": 4, "selected": true, "text": "<pre><code>import java.awt.Image as AWTImage \nimport java.awt.image.BufferedImage \nimport javax.swing.ImageIcon \nim...
2008/12/12
[ "https://Stackoverflow.com/questions/362360", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11193/" ]
I am developing a Web Album using Grails and for image processing, I am using grails-image-tools plugin. I need a functionality to resize the images if the uploaded images size is too big (for eg: more than 600 \* 840 ) . In this case I need to resize this image to 600 \* 840). What is the most efficient way to do this...
``` import java.awt.Image as AWTImage import java.awt.image.BufferedImage import javax.swing.ImageIcon import javax.imageio.ImageIO as IIO import java.awt.Graphics2D static resize = { bytes, out, maxW, maxH -> AWTImage ai = new ImageIcon(bytes).image int width = ai.getWidth( null ) int height ...
362,367
<p>So in C#, I can treat a <code>string[]</code> as an <code>IEnumerable&lt;string&gt;</code>.</p> <p>Is there a Java equivalent?</p>
[ { "answer_id": 362387, "author": "Learning", "author_id": 18275, "author_profile": "https://Stackoverflow.com/users/18275", "pm_score": 3, "selected": false, "text": "<p><code>Iterable &lt;T&gt;</code></p>\n" }, { "answer_id": 362396, "author": "bruno conde", "author_id":...
2008/12/12
[ "https://Stackoverflow.com/questions/362367", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35086/" ]
So in C#, I can treat a `string[]` as an `IEnumerable<string>`. Is there a Java equivalent?
`Iterable<String>` is the equivalent of `IEnumerable<string>`. It would be an odditity in the type system if arrays implemented `Iterable`. `String[]` is an instance of `Object[]`, but `Iterable<String>` is not an `Iterable<Object>`. Classes and interfaces cannot multiply implement the same generic interface with diff...
362,386
<pre><code>dev%40bionic%2Dcomms%2Eco%2Euk </code></pre> <p>I want to turn the above back in to readable text. Can anyone tell me how? Thanks</p> <p>EDIT Forgive my oversight, PHP is the language of choice!</p>
[ { "answer_id": 362403, "author": "Piskvor left the building", "author_id": 19746, "author_profile": "https://Stackoverflow.com/users/19746", "pm_score": 2, "selected": false, "text": "<p>In JavaScript: <code>decodeURIComponent(\"dev%40bionic%2Dcomms%2Eco%2Euk\")</code></p>\n" }, { ...
2008/12/12
[ "https://Stackoverflow.com/questions/362386", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31677/" ]
``` dev%40bionic%2Dcomms%2Eco%2Euk ``` I want to turn the above back in to readable text. Can anyone tell me how? Thanks EDIT Forgive my oversight, PHP is the language of choice!
You haven't said which language, but in many the function you want is urldecode (Looking at your other questions, you probably want PHP. It is [urldecode](http://uk3.php.net/urldecode) there :))
362,401
<p>I have a web application which i deploy in Tomcat. I want to secure all pages under the url path <em>administration/*</em>. </p> <p>I have set up container-managed security entering the next snippet in the web.xml file:</p> <pre><code>&lt;security-role&gt; &lt;role-name&gt;administrator&lt;/role-name&gt; &lt;/...
[ { "answer_id": 362657, "author": "miceuz", "author_id": 24443, "author_profile": "https://Stackoverflow.com/users/24443", "pm_score": 3, "selected": false, "text": "<p>Yes, <a href=\"http://tomcat.apache.org/tomcat-4.1-doc/realm-howto.html#DataSourceRealm\" rel=\"nofollow noreferrer\">it...
2008/12/12
[ "https://Stackoverflow.com/questions/362401", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2138/" ]
I have a web application which i deploy in Tomcat. I want to secure all pages under the url path *administration/\**. I have set up container-managed security entering the next snippet in the web.xml file: ``` <security-role> <role-name>administrator</role-name> </security-role> <login-config> <auth-method>B...
Yes, [it is possible](http://tomcat.apache.org/tomcat-4.1-doc/realm-howto.html#DataSourceRealm).
362,419
<p>I'd like to periodically run an arbitrary .NET exe under a specified user account from a Windows Service. </p> <p>So far I've got my windows service running with logic to decide what the target process is, and when to run it. The target process is started in the following manner:</p> <ol> <li>The Windows Service i...
[ { "answer_id": 362474, "author": "Vinko Vrsalovic", "author_id": 5190, "author_profile": "https://Stackoverflow.com/users/5190", "pm_score": 1, "selected": false, "text": "<p>I won't suggest neither psexec nor the task planner. But, have you looked at <a href=\"http://sourceforge.net/pro...
2008/12/12
[ "https://Stackoverflow.com/questions/362419", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15608/" ]
I'd like to periodically run an arbitrary .NET exe under a specified user account from a Windows Service. So far I've got my windows service running with logic to decide what the target process is, and when to run it. The target process is started in the following manner: 1. The Windows Service is started using "adm...
I seem to have a working implementation (Works On My Machine(TM)) for the following scenarios: Batch File, .NET Console Assembly, .NET Windows Forms application. Here's how: I have a windows service running as the Administrator user. I add the following policies to the Administrator user: * Log on as a service * Ac...
362,424
<p>Lets say I have a concrete class Class1 and I am creating an anonymous class out of it.</p> <pre><code>Object a = new Class1(){ void someNewMethod(){ } }; </code></pre> <p>Now is there any way I could overload the constructor of this anonymous class. Like shown below</p> <pre><code>Object a ...
[ { "answer_id": 362443, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 9, "selected": true, "text": "<p>From the <a href=\"http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.9.5.1\" rel=\"noreferrer\">Java...
2008/12/12
[ "https://Stackoverflow.com/questions/362424", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27784/" ]
Lets say I have a concrete class Class1 and I am creating an anonymous class out of it. ``` Object a = new Class1(){ void someNewMethod(){ } }; ``` Now is there any way I could overload the constructor of this anonymous class. Like shown below ``` Object a = new Class1(){ void someNewM...
From the [Java Language Specification](http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.9.5.1), section 15.9.5.1: > > An anonymous class cannot have an > explicitly declared constructor. > > > Sorry :( EDIT: As an alternative, you can create some final local variables, and/or include an insta...
362,426
<p>What is the "cleanest" way to implement an command-line UI, similar to git's, for example:</p> <pre><code>git push origin/master git remote add origin git://example.com master </code></pre> <p>Ideally also allowing the more flexible parsing, for example,</p> <pre><code>jump_to_folder app theappname v2 jump_to_fol...
[ { "answer_id": 362475, "author": "klozovin", "author_id": 33841, "author_profile": "https://Stackoverflow.com/users/33841", "pm_score": 2, "selected": false, "text": "<p>Straight from one of my scripts:</p>\n\n<pre><code>import sys\n\ndef prog1_func1_act1(): print \"pfa1\"\ndef prog2_fun...
2008/12/12
[ "https://Stackoverflow.com/questions/362426", "https://Stackoverflow.com", "https://Stackoverflow.com/users/745/" ]
What is the "cleanest" way to implement an command-line UI, similar to git's, for example: ``` git push origin/master git remote add origin git://example.com master ``` Ideally also allowing the more flexible parsing, for example, ``` jump_to_folder app theappname v2 jump_to_folder app theappname source jump_to_fol...
[argparse](http://docs.python.org/library/argparse.html#sub-commands) is perfect for this, specifically ["sub-commands"](http://docs.python.org/library/argparse.html#sub-commands) and positional args ``` import argparse def main(): arger = argparse.ArgumentParser() # Arguments for top-level, e.g "subcmds.py ...
362,429
<p>I've created a utf8 encoded RSS feed which presents news data drawn from a database. I've set all aspects of my database to utf8 and also saved the text which i have put into the database as utf8 by pasting it into notepad and saving as utf8. So everything should be encoded in utf8 when the RSS feed is presented to ...
[ { "answer_id": 362649, "author": "Kornel", "author_id": 27009, "author_profile": "https://Stackoverflow.com/users/27009", "pm_score": 0, "selected": false, "text": "<p>Your escaping function is too simple. You need to change <code>&amp;</code> to <code>&amp;amp;</code> first.</p>\n\n<p>I...
2008/12/12
[ "https://Stackoverflow.com/questions/362429", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45427/" ]
I've created a utf8 encoded RSS feed which presents news data drawn from a database. I've set all aspects of my database to utf8 and also saved the text which i have put into the database as utf8 by pasting it into notepad and saving as utf8. So everything should be encoded in utf8 when the RSS feed is presented to the...
Get rid of your escaping code and use XMLFormat instead: ``` <item> <title>#XMLFormat(news.headline)#</title> <link>#Application.siteRoot#news/index.cfm?id=#XMLFormat(news.id)#</link> <guid>#Application.siteRoot#news/index.cfm?id=#XMLFormat(news.id)#</guid> <pubDate>#XMLFormat(news.date)# #XMLFormat(ne...
362,434
<p>I dropped a database from SQL Server, however it turns out that <strong>my login</strong> was set to use the dropped database as its default. I can connect to SQL Server Management Studio by using the 'options' button in the connection dialog and selecting 'master' as the database to connect to. However, whenever I ...
[ { "answer_id": 362435, "author": "Martin Brown", "author_id": 20553, "author_profile": "https://Stackoverflow.com/users/20553", "pm_score": 8, "selected": false, "text": "<p>What you can do is set your default database using the sp_defaultdb system stored procedure. Log in as you have do...
2008/12/12
[ "https://Stackoverflow.com/questions/362434", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20553/" ]
I dropped a database from SQL Server, however it turns out that **my login** was set to use the dropped database as its default. I can connect to SQL Server Management Studio by using the 'options' button in the connection dialog and selecting 'master' as the database to connect to. However, whenever I try to do anythi...
Alternative to sp\_defaultdb (which [will be removed in a future version of Microsoft SQL Server](https://learn.microsoft.com/en-us/sql/relational-databases/system-stored-procedures/sp-defaultdb-transact-sql)) could be [`ALTER LOGIN`](https://learn.microsoft.com/en-us/sql/t-sql/statements/alter-login-transact-sql): ``...
362,441
<p>I am sure this is a very simple problem, but I am new to VB.NET, so I am having an issue with it.</p> <p>I have a <code>Decimal</code> variable, and I need to split it into two separate variables, one containing the integer part, and one containing the fractional part. </p> <p>For example, for x = 12.34 you would ...
[ { "answer_id": 362453, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 5, "selected": true, "text": "<p>You can use <a href=\"http://msdn.microsoft.com/en-us/library/7d101hyf.aspx\" rel=\"noreferrer\">Math.Truncate(decimal...
2008/12/12
[ "https://Stackoverflow.com/questions/362441", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30297/" ]
I am sure this is a very simple problem, but I am new to VB.NET, so I am having an issue with it. I have a `Decimal` variable, and I need to split it into two separate variables, one containing the integer part, and one containing the fractional part. For example, for x = 12.34 you would end up with a y = 12 and a z...
You can use [Math.Truncate(decimal)](http://msdn.microsoft.com/en-us/library/7d101hyf.aspx) and then subtract that from the original. Be aware that that will give you a negative value for both parts if the input is decimal (e.g. -1.5 => -1, -.5) EDIT: Here's a version of Eduardo's code which uses decimal throughout: ...
362,444
<p>I would like to write a macro for Notepad++ which should replace char1, char2, char3 with char4, char5, char6, respectively.</p>
[ { "answer_id": 362497, "author": "Samiksha", "author_id": 29515, "author_profile": "https://Stackoverflow.com/users/29515", "pm_score": 2, "selected": false, "text": "<p>This post can help you as a little bit related :</p>\n\n<p><a href=\"https://stackoverflow.com/questions/283608/using-...
2008/12/12
[ "https://Stackoverflow.com/questions/362444", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4235/" ]
I would like to write a macro for Notepad++ which should replace char1, char2, char3 with char4, char5, char6, respectively.
Macros in Notepad++ are just a bunch of encoded operations: you start recording, operate on the buffer, perhaps activating menus, stop recording then play the macro. After investigation, I found out they are saved in the file shortcuts.xml in the Macros section. For example, I have there: ```xml <Macro name="Trim T...
362,461
<p>I am trying to build a working encrypted signature for the Amazon S3 web service, writing a connection library using Objective C. </p> <p>I have run into HMAC SHA-1 digest problems with the ObjC code, so I'm putting that to the side and looking at existing, working Perl code, to try to troubleshoot digest creation....
[ { "answer_id": 362501, "author": "innaM", "author_id": 7498, "author_profile": "https://Stackoverflow.com/users/7498", "pm_score": 1, "selected": false, "text": "<p>I'm afraid I can't help much here, but there's definitely something wrong with what you posted. Your example script produce...
2008/12/12
[ "https://Stackoverflow.com/questions/362461", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19410/" ]
I am trying to build a working encrypted signature for the Amazon S3 web service, writing a connection library using Objective C. I have run into HMAC SHA-1 digest problems with the ObjC code, so I'm putting that to the side and looking at existing, working Perl code, to try to troubleshoot digest creation. I am tes...
I find the the main problems I have had with hashes in comparisons are: 1. ensure the data and key are the same in both comparisons 2. ensure the data and key are in the same character encoding in both comparisons 3. ensure the key and text are being passed the same in both scripts, i.e. which one is key and which one...
362,468
<p>I'm new to log4net, so hopefully this is a really easy question for someone?!</p> <p>I've got log4net working with the RollingLogFileAppender for my web application. I'm using logging to try and find where some performance issues are coming from. In order to do this, it'd be useful to include the ASP.NET SessionI...
[ { "answer_id": 362526, "author": "Richard Ev", "author_id": 39709, "author_profile": "https://Stackoverflow.com/users/39709", "pm_score": 1, "selected": false, "text": "<p>You can try:</p>\n\n<pre><code>&lt;conversionPattern\n value=\"%date %-5level %logger ${COMPUTERNAME} [%property{...
2008/12/12
[ "https://Stackoverflow.com/questions/362468", "https://Stackoverflow.com", "https://Stackoverflow.com/users/475/" ]
I'm new to log4net, so hopefully this is a really easy question for someone?! I've got log4net working with the RollingLogFileAppender for my web application. I'm using logging to try and find where some performance issues are coming from. In order to do this, it'd be useful to include the ASP.NET SessionID in the log...
**UPDATE (2014-06-12):** Starting from log4net 1.2.11 you can use `%aspnet-request{ASP.NET_SessionId}` in conversion pattern for this purpose. References: <https://issues.apache.org/jira/browse/LOG4NET-87> <http://logging.apache.org/log4net/release/sdk/log4net.Layout.PatternLayout.html> --- You should create Applica...
362,483
<p>Is is possible to put a constant where clause to a Linq to SQl mapping.</p> <p>I really don't want to do this at the query level or in my Data Access Object as these are currently completely generic and would like to keep it that way to make life for the other developers and save me repeating myself constantly.</p>...
[ { "answer_id": 362534, "author": "Paul Nearney", "author_id": 24071, "author_profile": "https://Stackoverflow.com/users/24071", "pm_score": 3, "selected": true, "text": "<p>One way I have tackled this is to use an extension method that returns an IQueryable of your entity type, and then ...
2008/12/12
[ "https://Stackoverflow.com/questions/362483", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1213936/" ]
Is is possible to put a constant where clause to a Linq to SQl mapping. I really don't want to do this at the query level or in my Data Access Object as these are currently completely generic and would like to keep it that way to make life for the other developers and save me repeating myself constantly. Colin G
One way I have tackled this is to use an extension method that returns an IQueryable of your entity type, and then use this wherever that entity is needed. For example, if all my custom queries were only interested in Horses that didn't have the Inactive flag set, I would have an extension method called GetHorses: ``...