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 |
|---|---|---|---|---|---|---|
374,135 | <p>We have several legacy applications which use Access databases for storing data and/or configuration. </p>
<p>Sometimes we have to do small changes or corrections at our customers databases. (Adding an index, modifying a data row, ...) In many cases Access is available on the customers' workstations, but sometimes ... | [
{
"answer_id": 374173,
"author": "Aaron Digulla",
"author_id": 34088,
"author_profile": "https://Stackoverflow.com/users/34088",
"pm_score": 1,
"selected": false,
"text": "<p>MS Access uses ODBC so any DB tool on windows can be used.</p>\n\n<p>The main problem with these tools is that ma... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374135",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23368/"
] | We have several legacy applications which use Access databases for storing data and/or configuration.
Sometimes we have to do small changes or corrections at our customers databases. (Adding an index, modifying a data row, ...) In many cases Access is available on the customers' workstations, but sometimes it's not.
... | I use VBScript for edits and updates of databases when Access is not available. Scripts can be written quite quickly and there are a number of ready-made scripts available on-line, such as for compacting a database.
This example links a table.
```
Dim adoCn
Dim adoCat
Dim adoTbl
strLinkFile = "C:\Docs\DB1.mdb"
strAc... |
374,152 | <p>I am trying to format some bad html to output into a pop window. The html is stored in a field in a mysql database.</p>
<p>I have been performing json_encode and htmlspecialchars on the row in the php like so:</p>
<pre><code>$html = htmlentities(json_encode($row2['ARTICLE_DESC']));
</code></pre>
<p>and calling my... | [
{
"answer_id": 374170,
"author": "Greg",
"author_id": 24181,
"author_profile": "https://Stackoverflow.com/users/24181",
"pm_score": 2,
"selected": true,
"text": "<p>You shouldn't have the single quotes in the function call. It should look like this:</p>\n\n<pre><code><p><a href... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374152",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1246613/"
] | I am trying to format some bad html to output into a pop window. The html is stored in a field in a mysql database.
I have been performing json\_encode and htmlspecialchars on the row in the php like so:
```
$html = htmlentities(json_encode($row2['ARTICLE_DESC']));
```
and calling my makewindows function, which sim... | You shouldn't have the single quotes in the function call. It should look like this:
```
<p><a href='#' onclick=\"makewindows(" . $html . "); return false;\">Click for full description </a></p>
```
Then the output will look like
```
<p><a href='#' onclick="makewindows("....."); return false;">Click for fu... |
374,156 | <p>I have the following Query and i need the query to fetch data from SomeTable based on the filter criteria present in the Someothertable. If there is nothing present in SomeOtherTable Query should return me all the data present in SomeTable</p>
<p>SQL SERVER 2005</p>
<p>SomeOtherTable does not have any indexes or ... | [
{
"answer_id": 374178,
"author": "Matthew Wright",
"author_id": 47006,
"author_profile": "https://Stackoverflow.com/users/47006",
"pm_score": 2,
"selected": false,
"text": "<p>Try:</p>\n\n<pre><code>SELECT\n *\nFROM\n SomeTable\nLEFT JOIN SomeOtherTable ON SomeTable.ID=SomeOtherTab... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374156",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21195/"
] | I have the following Query and i need the query to fetch data from SomeTable based on the filter criteria present in the Someothertable. If there is nothing present in SomeOtherTable Query should return me all the data present in SomeTable
SQL SERVER 2005
SomeOtherTable does not have any indexes or any constraint all... | I am going to stick to my original Query. |
374,215 | <p>I have a strange phenomenon while continuously instantiating a com-wrapper and then letting the GC collect it (not forced).</p>
<p>I'm testing this on .net cf on WinCE x86. Monitoring the performance with .net Compact framework remote monitor. Native memory is tracked with Windows CE Remote performance monitor from... | [
{
"answer_id": 374228,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 2,
"selected": false,
"text": "<p>Well, there's a bug in your code in that you're creating a lot of IDisposable instances and never calling Dispose on ... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374215",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2090/"
] | I have a strange phenomenon while continuously instantiating a com-wrapper and then letting the GC collect it (not forced).
I'm testing this on .net cf on WinCE x86. Monitoring the performance with .net Compact framework remote monitor. Native memory is tracked with Windows CE Remote performance monitor from the platf... | I doubt it's a bug in RPM. What we don't have here is any insight into the Ppb.Drawing stuff. The place I see for a potential problem is the GetIImagingFactory call. What does it do? It's probably just a singleton getter, but it's something I'd chase.
I also see an AllochHGlobal, but nowhere do I see that allocation g... |
374,238 | <p>I'm trying to get the unitpngfix to work but I can't seem to get the png to show up in IE6.</p>
<p>This this my code:</p>
<pre><code><html>
<head>
<style type="text/css">
#boxouter {
width: 12em;
height: 12em;
background: url(gradient.gif) #ffdf00 bottom repeat... | [
{
"answer_id": 374297,
"author": "Eduardo Campañó",
"author_id": 12091,
"author_profile": "https://Stackoverflow.com/users/12091",
"pm_score": 2,
"selected": false,
"text": "<p>I also had some problems with unitpngfix and I really dislike using the [if lt IE 7] and embedding styles in th... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374238",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm trying to get the unitpngfix to work but I can't seem to get the png to show up in IE6.
This this my code:
```
<html>
<head>
<style type="text/css">
#boxouter {
width: 12em;
height: 12em;
background: url(gradient.gif) #ffdf00 bottom repeat-x;
position: relative;
... | I also had some problems with unitpngfix and I really dislike using the [if lt IE 7] and embedding styles in the html.
I found [this](http://jquery.andreaseberhard.de/pngFix/) jQuery plugin wich is unobtrusive and works well with PNG images and css backgrounds in IE6. |
374,245 | <p>for the xml </p>
<pre><code><grandparent>
<parent1>
<child>data1</child>
</parent1>
<parent2>
<child>data2</child>
</parent2>
</grandparent>
</code></pre>
<p>I need the list containing tuples of parent,data for each parent in xml.</p>
<... | [
{
"answer_id": 374565,
"author": "Mapad",
"author_id": 28165,
"author_profile": "https://Stackoverflow.com/users/28165",
"pm_score": 3,
"selected": false,
"text": "<p>It seems you can get access to the parent from the child using version 1.3 of ElementTree (check <a href=\"http://effbot.... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374245",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2220518/"
] | for the xml
```
<grandparent>
<parent1>
<child>data1</child>
</parent1>
<parent2>
<child>data2</child>
</parent2>
</grandparent>
```
I need the list containing tuples of parent,data for each parent in xml.
Is there a way to do it USING cElementTree? I am able to do it for child,data, but unfortun... | It seems you can get access to the parent from the child using version 1.3 of ElementTree (check <http://effbot.org/zone/element-xpath.htm>), by using xpath commands like `child.find('../parent')`. But I think python ships with version 1.2 or something.
You should also check for lxml which is compatible with etree and... |
374,267 | <p>I'm trying to create a query which uses a list of ids in the where clause, using the Silverlight ADO.Net Data Services client api (and therefore Linq To Entities). Does anyone know of a workaround to Contains not being supported?</p>
<p>I want to do something like this:</p>
<pre><code>List<long?> txnIds = ne... | [
{
"answer_id": 374298,
"author": "AndreasN",
"author_id": 24821,
"author_profile": "https://Stackoverflow.com/users/24821",
"pm_score": 2,
"selected": false,
"text": "<p>I'm not sure about Silverligth, but in linq to objects i always use any() for these queries.</p>\n\n<pre><code>var q =... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374267",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38249/"
] | I'm trying to create a query which uses a list of ids in the where clause, using the Silverlight ADO.Net Data Services client api (and therefore Linq To Entities). Does anyone know of a workaround to Contains not being supported?
I want to do something like this:
```
List<long?> txnIds = new List<long?>();
// Fill li... | **Update:** EF ≥ 4 supports [`Contains`](http://msdn.microsoft.com/en-us/library/bb352880.aspx "Enumerable.Contains<T>") directly (Checkout [`Any`](http://msdn.microsoft.com/en-us/library/bb534972.aspx "Enumerable.Any<T>")), so you don't need any workaround.
```
public static IQueryable<TEntity> WhereIn<TEntity, TValu... |
374,305 | <p>I was wondering if anyone has any preference for referencing images/ css or javascript files in their sites?</p>
<p>The reason I ask is if a client wants to host the site we've writen under a virtual directory, the site usually has to have it's file references changed - even down to url (...image path) in CSS files... | [
{
"answer_id": 374315,
"author": "Andreas Grech",
"author_id": 44084,
"author_profile": "https://Stackoverflow.com/users/44084",
"pm_score": 5,
"selected": true,
"text": "<p><strong>Images</strong> (like background-url) <strong>in CSS are always referenced relative to the css file.</stro... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374305",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5791/"
] | I was wondering if anyone has any preference for referencing images/ css or javascript files in their sites?
The reason I ask is if a client wants to host the site we've writen under a virtual directory, the site usually has to have it's file references changed - even down to url (...image path) in CSS files because w... | **Images** (like background-url) **in CSS are always referenced relative to the css file.**
Example:
```
/img/a.gif
/css/c.css
```
To reference `a.gif` from the css file, you must always reference it like such `../img/a.gif`, irrelevant to where a page is located or how it is rewritten |
374,316 | <p>If I have a double (234.004223), etc., I would like to round this to x significant digits in C#.</p>
<p>So far I can only find ways to round to x decimal places, but this simply removes the precision if there are any 0s in the number.</p>
<p>For example, 0.086 to one decimal place becomes 0.1, but I would like it ... | [
{
"answer_id": 374360,
"author": "Bravax",
"author_id": 13911,
"author_profile": "https://Stackoverflow.com/users/13911",
"pm_score": 2,
"selected": false,
"text": "<p>This question is similiar to the one you're asking: </p>\n\n<p><a href=\"https://stackoverflow.com/questions/158172/for... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374316",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47026/"
] | If I have a double (234.004223), etc., I would like to round this to x significant digits in C#.
So far I can only find ways to round to x decimal places, but this simply removes the precision if there are any 0s in the number.
For example, 0.086 to one decimal place becomes 0.1, but I would like it to stay at 0.08. | The framework doesn't have a built-in function to round (or truncate, as in your example) to a number of significant digits. One way you can do this, though, is to scale your number so that your first significant digit is right after the decimal point, round (or truncate), then scale back. The following code should do ... |
374,326 | <p>How can I get the filename from a file path in Ruby?</p>
<p>For example if I have a path of <code>"C:\projects\blah.dll"</code> and I just want the "blah".</p>
<p>Is there a <code>LastIndexOf</code> method in Ruby?</p>
| [
{
"answer_id": 374345,
"author": "Jonathan Lonowski",
"author_id": 15031,
"author_profile": "https://Stackoverflow.com/users/15031",
"pm_score": 9,
"selected": false,
"text": "<p>Try <a href=\"http://ruby-doc.org/core-1.8.7/classes/File.html#M000803\" rel=\"noreferrer\"><code>File.basena... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374326",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11755/"
] | How can I get the filename from a file path in Ruby?
For example if I have a path of `"C:\projects\blah.dll"` and I just want the "blah".
Is there a `LastIndexOf` method in Ruby? | ```
require 'pathname'
Pathname.new('/opt/local/bin/ruby').basename
# => #<Pathname:ruby>
```
I haven't been a Windows user in a long time, but the Pathname rdoc says it has no issues with directory-name separators on Windows. |
374,330 | <p>I'd like to know how to convert this vb script to C#</p>
<pre><code>Dim strFolder As String
Dim objShell As Object
strFolder = "C:\zz"
Set objShell = CreateObject("Wscript.Shell")
objShell.Run "%COMSPEC% /c Echo Y| cacls " & _
strFolder & _
" /t /c /g everyone:F ", 2, Tr... | [
{
"answer_id": 374413,
"author": "tvanfosson",
"author_id": 12950,
"author_profile": "https://Stackoverflow.com/users/12950",
"pm_score": 0,
"selected": false,
"text": "<p>Is upgrading to a newer version not possible? .NET 2.0 introduced classes in the <a href=\"http://msdn.microsoft.co... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374330",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'd like to know how to convert this vb script to C#
```
Dim strFolder As String
Dim objShell As Object
strFolder = "C:\zz"
Set objShell = CreateObject("Wscript.Shell")
objShell.Run "%COMSPEC% /c Echo Y| cacls " & _
strFolder & _
" /t /c /g everyone:F ", 2, True
```
What I'm tryi... | It's not possible to upgrade unfortunately - I work for a big company, so would mean updating loads of people - which would be a mission...
But - creating a process worked!
```
System.Diagnostics.Process meProc = System.Diagnostics.Process.Start ("cmd.exe", " /c echo y| cacls C:\\zzz /t /c /g everyone:F");
```
Than... |
374,339 | <p>This would be very handy as typecasting gets boring fast.</p>
| [
{
"answer_id": 374346,
"author": "krosenvold",
"author_id": 23691,
"author_profile": "https://Stackoverflow.com/users/23691",
"pm_score": 5,
"selected": true,
"text": "<p>If you use generics (java 5), you can avoid all casting with</p>\n\n<pre><code> List<String> myList = new Array... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374339",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11911/"
] | This would be very handy as typecasting gets boring fast. | If you use generics (java 5), you can avoid all casting with
```
List<String> myList = new ArrayList<String>();
myList.add(" a test");
String temp = myList.get(0);
```
Unless I am missing something in your question that should cover both needs. |
374,348 | <p>Recently I worked on FindBugs warnings about exposing internal state, i.e. when a reference to an array was returned instead of returning a copy of the array. I created some templates to make converting that code easier.</p>
<p>Which one did you create to support defensive programming and want to share with the SO ... | [
{
"answer_id": 374408,
"author": "Markus",
"author_id": 45064,
"author_profile": "https://Stackoverflow.com/users/45064",
"pm_score": 2,
"selected": false,
"text": "<p>Not a template, but I use <code>array.clone()</code> instead of <code>System.arraycopy()</code>. Is there anything wrong... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374348",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16193/"
] | Recently I worked on FindBugs warnings about exposing internal state, i.e. when a reference to an array was returned instead of returning a copy of the array. I created some templates to make converting that code easier.
Which one did you create to support defensive programming and want to share with the SO crowd?
Te... | I like having as a template a "safer" equals() definition:
```
/**
* Implement equals based on ${cursor}. <br />
* See {@link #compareTo(Object) compareTo}
* @see java.lang.Object#equals(java.lang.Object)
*/
public boolean equals(final Object anObject)
{
boolean res = false;
if(anObject == null) { return ... |
374,386 | <p>This appears to be the most commonly asked C# interop question and yet seems to be difficult to find a working solution for.</p>
<p>I am in need of allocating an array of matrix datastructure in C# passing it to a C DLL which fills up the data and returns it to the caller to deal with.</p>
<p>Based on various page... | [
{
"answer_id": 379324,
"author": "Darin Dimitrov",
"author_id": 29407,
"author_profile": "https://Stackoverflow.com/users/29407",
"pm_score": 0,
"selected": false,
"text": "<p>Here's how I did it in an old project in which I had to pass a matrix of integers to a C routine that would fill... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374386",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | This appears to be the most commonly asked C# interop question and yet seems to be difficult to find a working solution for.
I am in need of allocating an array of matrix datastructure in C# passing it to a C DLL which fills up the data and returns it to the caller to deal with.
Based on various pages on the web, I s... | Here's a modified version of my initial code that works with an array of matrices:
```
typedef struct Matrix
{
int rowsCount;
int colsCount;
int* data;
} TMatrix;
extern "C" __declspec(dllexport) void InitializeMatrix(TMatrix** matrices, int count)
{
srand(time(NULL));
printf("<unmanaged>\n");
... |
374,398 | <p>Is it safe to assume that event subscribers are called in order of subscription?<br>
Example: </p>
<pre><code>void One(object sender, EventArgs e) {}
void Two(object sender, EventArgs e) {}
event EventHandler foo;
foo += One;
foo += Two;
</code></pre>
<p>Is One() always called before Two() when the event is fir... | [
{
"answer_id": 374426,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 7,
"selected": true,
"text": "<p>Given that implementation, yes, they will always be called in that order.</p>\n\n<p>If the event actually uses some we... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374398",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8976/"
] | Is it safe to assume that event subscribers are called in order of subscription?
Example:
```
void One(object sender, EventArgs e) {}
void Two(object sender, EventArgs e) {}
event EventHandler foo;
foo += One;
foo += Two;
```
Is One() always called before Two() when the event is fired?
Edit:
You should ofc... | Given that implementation, yes, they will always be called in that order.
If the event actually uses some weird and wonderful way of handling subscriptions, it could do different things - but "normal" implementations will do the right thing.
To be clear, subscribing to an event handler just means invoking the appropr... |
374,399 | <p>In C++, I can't think of a case in which I would like to inherit private/protected from a
base class:</p>
<pre><code>class Base;
class Derived1 : private Base;
class Derived2 : protected Base;
</code></pre>
<p>Is it really useful?</p>
| [
{
"answer_id": 374414,
"author": "Johannes Schaub - litb",
"author_id": 34509,
"author_profile": "https://Stackoverflow.com/users/34509",
"pm_score": 5,
"selected": false,
"text": "<p>Private can be useful in quite a few circumstances. Just one of them are policies:</p>\n\n<p><a href=\"h... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374399",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46418/"
] | In C++, I can't think of a case in which I would like to inherit private/protected from a
base class:
```
class Base;
class Derived1 : private Base;
class Derived2 : protected Base;
```
Is it really useful? | It is useful when you want to have access to some members of the base class, but without exposing them in your class interface. Private inheritance can also be seen as some kind of composition: the [C++ faq-lite](http://www.parashift.com/c++-faq-lite/private-inheritance.html) gives the following example to illustrate t... |
374,405 | <p>I am trying to create a DLL for authentication using Java and JNI.</p>
<p>To create the DLL, I have created a Win32 application whose Character Set and Runtime Library information are Multi-Byte String and Multi-threaded (/MT) respectively.</p>
<p>I have tested the DLL on WinXP with valid and invalid user credenti... | [
{
"answer_id": 374414,
"author": "Johannes Schaub - litb",
"author_id": 34509,
"author_profile": "https://Stackoverflow.com/users/34509",
"pm_score": 5,
"selected": false,
"text": "<p>Private can be useful in quite a few circumstances. Just one of them are policies:</p>\n\n<p><a href=\"h... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374405",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45960/"
] | I am trying to create a DLL for authentication using Java and JNI.
To create the DLL, I have created a Win32 application whose Character Set and Runtime Library information are Multi-Byte String and Multi-threaded (/MT) respectively.
I have tested the DLL on WinXP with valid and invalid user credentials. Both work fi... | It is useful when you want to have access to some members of the base class, but without exposing them in your class interface. Private inheritance can also be seen as some kind of composition: the [C++ faq-lite](http://www.parashift.com/c++-faq-lite/private-inheritance.html) gives the following example to illustrate t... |
374,425 | <p>Some of my script are using different encoding, and when I try to combine them, this has becom an issue.</p>
<p>But I can't change the encoding they use, instead I want to change the encodig of the result from script A, and use it as parameter in script B. </p>
<p>So: is there any simple way to change a string fro... | [
{
"answer_id": 374459,
"author": "Martin v. Löwis",
"author_id": 33006,
"author_profile": "https://Stackoverflow.com/users/33006",
"pm_score": 0,
"selected": false,
"text": "<p>You need to use the <a href=\"http://www.php.net/iconv\" rel=\"nofollow noreferrer\">iconv</a> package, specifi... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374425",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36975/"
] | Some of my script are using different encoding, and when I try to combine them, this has becom an issue.
But I can't change the encoding they use, instead I want to change the encodig of the result from script A, and use it as parameter in script B.
So: is there any simple way to change a string from UTF-8 to ISO-88... | Have a look at [`iconv()`](http://php.net/function.iconv) or [`mb_convert_encoding()`](http://php.net/function.mb-convert-encoding).
Just by the way: why don't [`utf8_encode()`](http://php.net/function.utf8-encode) and [`utf8_decode()`](http://php.net/function.utf8-decode) work for you?
>
> **utf8\_decode** — Convert... |
374,438 | <p>I have several files containing this line</p>
<pre><code>Release: X
</code></pre>
<p>I want to increment X in all the files. </p>
<p>If X was constant between the files, I could have a bash script looping around the files and doing ($1 containing the former release number and $2 the new one, ie. $1 + 1) :</p>
<p... | [
{
"answer_id": 374457,
"author": "Adam Liss",
"author_id": 29157,
"author_profile": "https://Stackoverflow.com/users/29157",
"pm_score": 5,
"selected": true,
"text": "<p>Use <code>awk</code> - it's exactly the right tool for this:</p>\n\n<pre><code>awk '/Release: [0-9]+/ { printf \"Relea... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374438",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20986/"
] | I have several files containing this line
```
Release: X
```
I want to increment X in all the files.
If X was constant between the files, I could have a bash script looping around the files and doing ($1 containing the former release number and $2 the new one, ie. $1 + 1) :
```
sed 's/Release: '$1'/Release: '$2'/... | Use `awk` - it's exactly the right tool for this:
```
awk '/Release: [0-9]+/ { printf "Release: %d\n", $2+1 }' < $file > $file.new
```
Translation:
* Search for lines that contain "Release: " followed by one or more digits.
* Print "Release: " followed by a number and a newline. The number is the second word in the... |
374,440 | <p>I know that within a view I can render an action from the same controller using Html.RenderPartial. However, I need to render the output from an action under a different controller. What is the best way to do this? I would prefer to do this directly within the view, rather than doing it in the controller and saving ... | [
{
"answer_id": 374454,
"author": "Garry Shutler",
"author_id": 6369,
"author_profile": "https://Stackoverflow.com/users/6369",
"pm_score": 2,
"selected": true,
"text": "<p>The best thing to do is use <code>Html.RenderAction</code> which needs a references to the 'Futures' assembly <code>... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374440",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39430/"
] | I know that within a view I can render an action from the same controller using Html.RenderPartial. However, I need to render the output from an action under a different controller. What is the best way to do this? I would prefer to do this directly within the view, rather than doing it in the controller and saving the... | The best thing to do is use `Html.RenderAction` which needs a references to the 'Futures' assembly `Microsoft.Web.Mvc` which [there's a question about how to get it](https://stackoverflow.com/questions/334408/where-to-get-microsoftwebmvcdll).
You will also need to add the namespace in your web.config in order to user ... |
374,451 | <p>I have written a custom control, that has several sub panels. I want these sub panels to accept any additional controls dropped on them at design time.</p>
<p>Unfortunately any control that gets dropped at design time ends up on my custom control, not on the panels. This shows in particular if I try to drop a label... | [
{
"answer_id": 374911,
"author": "Toby Allen",
"author_id": 6244,
"author_profile": "https://Stackoverflow.com/users/6244",
"pm_score": 1,
"selected": false,
"text": "<p>I cant tell from the details, but are you setting the parent of the label to you sub panel? If its at design time you... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374451",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21506/"
] | I have written a custom control, that has several sub panels. I want these sub panels to accept any additional controls dropped on them at design time.
Unfortunately any control that gets dropped at design time ends up on my custom control, not on the panels. This shows in particular if I try to drop a label: The labe... | This is a good question. You can allow your custom TWinControl to have other controls dropped on it at design-time by adding csAcceptControls to your controls ControlStyle property.
```
constructor TMyContainer.Create(AOwner: TComponent);
begin
inherited;
ControlStyle := ControlStyle + [csAcceptControls];
end;
``... |
374,487 | <p>How to make this work in Opera? I found this piece of code for Opera, but it doesn't work for me:</p>
<pre><code> function AddToFavorites(title, url) {
if (window.sidebar) { // Mozilla Firefox Bookmark
window.sidebar.addPanel(title, url,"");
return false;
}
else if( window.external ) {... | [
{
"answer_id": 374743,
"author": "Grant Wagner",
"author_id": 9254,
"author_profile": "https://Stackoverflow.com/users/9254",
"pm_score": 0,
"selected": false,
"text": "<p>The following code works in Opera 8.54. It does not work in 9.27 or 9.63 (the only two other versions I have availab... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374487",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38256/"
] | How to make this work in Opera? I found this piece of code for Opera, but it doesn't work for me:
```
function AddToFavorites(title, url) {
if (window.sidebar) { // Mozilla Firefox Bookmark
window.sidebar.addPanel(title, url,"");
return false;
}
else if( window.external ) { // IE Favorit... | *If* you insist on it, then do it without dynamically generated redundant links:
```
<a href="http://real.url.example.com" title="Bookmark me, pleaeease!"
rel="sidebar"
onclick="return !addToFav(this.href,this.title)">
```
but please, just don't do it.
As Opera user I will be grateful for not pushing that... |
374,493 | <p>I want to have a TextBox which does accept the TAB key (and places a TAB, ASCII 0x09, \t accordingly into the textbox) instead of jumping to the next control. The TextBox has a property AcceptsTab, which I have set to true but this does not give the desired result. It turns out the AcceptsTab property only works the... | [
{
"answer_id": 374508,
"author": "Samiksha",
"author_id": 29515,
"author_profile": "https://Stackoverflow.com/users/29515",
"pm_score": 0,
"selected": false,
"text": "<p>Sel multilines to true and set the line size to 1. you will get the desired result.</p>\n"
},
{
"answer_id": 3... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374493",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47045/"
] | I want to have a TextBox which does accept the TAB key (and places a TAB, ASCII 0x09, \t accordingly into the textbox) instead of jumping to the next control. The TextBox has a property AcceptsTab, which I have set to true but this does not give the desired result. It turns out the AcceptsTab property only works then M... | Here's what you do. Create your own class that inherits from TextBox. In the constructor, set multiline to true, and AcceptsTab to true. Then, override WndProc and use this code:
```
protected override void WndProc(ref Message m)
{
if (m.Msg == (int)0x102 && m.WParam.ToInt32() == 13)
... |
374,497 | <p>I have a folder full of files i need to post to a webservice using cURL but i'm not sure on the whole variables and iterations in batch files thing.</p>
<p>I know the syntax for curl should be </p>
<pre><code>c:\curl\bin\curl -X POST -F File=@[filename] -F "title=[title]" -F "notes=[notes]" "http://xxx/AddScannedI... | [
{
"answer_id": 374501,
"author": "mat",
"author_id": 42083,
"author_profile": "https://Stackoverflow.com/users/42083",
"pm_score": 2,
"selected": false,
"text": "<p>You should try with the <code>-g</code> aka <code>--globoff</code> cURL option.</p>\n\n<p>The default behavior is to :</p>\... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374497",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46323/"
] | I have a folder full of files i need to post to a webservice using cURL but i'm not sure on the whole variables and iterations in batch files thing.
I know the syntax for curl should be
```
c:\curl\bin\curl -X POST -F File=@[filename] -F "title=[title]" -F "notes=[notes]" "http://xxx/AddScannedImage?debtref=[filenam... | You should try with the `-g` aka `--globoff` cURL option.
The default behavior is to :
>
> You can specify multiple URLs or parts of URLs by writing part sets
> within braces as in:
>
>
>
> ```
> http://site.{one,two,three}.com
>
> ```
>
> or you can get sequences of alphanumeric series by using [] as in:
>
>... |
374,518 | <p>The application I'm trying to localize is a WinForms application that has a few hosted WPF user controls (WPF user controls hosted in an ElementHost WinForms control).</p>
<p>I use <a href="http://msdn.microsoft.com/en-us/library/y99d1cd3.aspx" rel="nofollow noreferrer">resx</a> files to localize the WinForms, whic... | [
{
"answer_id": 637370,
"author": "dustyburwell",
"author_id": 77040,
"author_profile": "https://Stackoverflow.com/users/77040",
"pm_score": 2,
"selected": false,
"text": "<p>Blech...The WPF team sure seemed to leave something to be desired with their localization solution. Well, for wha... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374518",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/373/"
] | The application I'm trying to localize is a WinForms application that has a few hosted WPF user controls (WPF user controls hosted in an ElementHost WinForms control).
I use [resx](http://msdn.microsoft.com/en-us/library/y99d1cd3.aspx) files to localize the WinForms, which VS2008 manages quite well.
The problem start... | Blech...The WPF team sure seemed to leave something to be desired with their localization solution. Well, for what it's worth, here's what I've been doing (to be fair, I've actually borrowed this idea from [Jecho Jekov](http://www.codeproject.com/KB/WPF/WPF_Localization.aspx) on CodeProject):
First, you'll need to cre... |
374,522 | <p>I'm having trouble coming up with the proper syntax for allowing either a string or a NULL to be passed to the database. Here's my code:</p>
<pre><code>string insertString = String.Format(
@"INSERT INTO upload_history (field1, field2, field3)
VALUES ('{0}', '{1}', '{2}')",
varField1, varField2, varFiel... | [
{
"answer_id": 374525,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 6,
"selected": true,
"text": "<p>Don't concatenate the string (<code>string.Format</code>) - use parameters (<code>@p1</code> etc) - then you can pa... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374522",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39317/"
] | I'm having trouble coming up with the proper syntax for allowing either a string or a NULL to be passed to the database. Here's my code:
```
string insertString = String.Format(
@"INSERT INTO upload_history (field1, field2, field3)
VALUES ('{0}', '{1}', '{2}')",
varField1, varField2, varField3);
```
I u... | Don't concatenate the string (`string.Format`) - use parameters (`@p1` etc) - then you can pass `DBNull.Value` to mean null to SQL Server
```
SqlCommand cmd = new SqlCommand();
cmd.CommandText = @"INSERT INTO upload_history (field1, field2, field3)
VALUES (@p1, @p2, @p3)";
cmd.Parameters.AddWithValue("@p1", (objec... |
374,531 | <p>First sorry for my bad english but I'll try my best.</p>
<p>Right now I'm programming a .net application using Access 2007 as datastore.</p>
<p>In a nutshell: I have two threads. One thread inserts a row with a transaction into a table. The other thread updates many rows in constant intervals. </p>
<p><strong>Thr... | [
{
"answer_id": 374547,
"author": "Samiksha",
"author_id": 29515,
"author_profile": "https://Stackoverflow.com/users/29515",
"pm_score": 0,
"selected": false,
"text": "<p>Use MARS(Multiple Active Resultsets) in this case.\nSearch on net for how to implement MARS.</p>\n"
},
{
"answ... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374531",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | First sorry for my bad english but I'll try my best.
Right now I'm programming a .net application using Access 2007 as datastore.
In a nutshell: I have two threads. One thread inserts a row with a transaction into a table. The other thread updates many rows in constant intervals.
**Thread 1**
```
Database db = _lo... | Stefan Gruber asked:
>
> Can I insert my transactions to some
> kind of transaction queue into Access?
> Why isn't Access doing this by
> itselft?
>
>
>
I think you are failing to understand the Jet database engine. First off, a clarification: MS may use "MS Access" as the name in it's ODBC and OLEDB connectio... |
374,535 | <p>This is a very basic question. I'm just on my mission to learn ASP.NET (C#). I've done classic ASP and PHP before.</p>
<p>For this project I have <strong>ASP.NET 2.0</strong> at my hands.</p>
<p>I have a Web Form that has a <a href="http://www.trirand.com/blog/" rel="nofollow noreferrer">jqGrid</a> Datagrid that I... | [
{
"answer_id": 374542,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 3,
"selected": false,
"text": "<p>Using System.Xml (or System.Xml.Linq) would be less overhead in terms of getting it right than hand-coding Response.W... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374535",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/999/"
] | This is a very basic question. I'm just on my mission to learn ASP.NET (C#). I've done classic ASP and PHP before.
For this project I have **ASP.NET 2.0** at my hands.
I have a Web Form that has a [jqGrid](http://www.trirand.com/blog/) Datagrid that I want to feed XML data via AJAX. jqGrid is not the problem here, th... | Another solution to using a full blown XmlDocument/Linq in the ashx is to use the XmlWriter, sort of a halfway solution between hand crafting the xml as a string and using a dom.
Something like:
```
StringBuilder query = new StringBuilder();
using (XmlWriter xmlWriter = XmlWriter.Create(query))
{
xmlWriter.Write... |
374,555 | <p>In my code, I am using JavaScript to fire off an <code>window.open()</code> event on an ASPX page. I´m outputting a file in the <code>Page_Load()</code> event of this page:</p>
<pre><code>Response.Clear();
Response.ClearContent();
Response.ClearHeaders();
Response.Charset = "";
Response.ContentType = "application/o... | [
{
"answer_id": 374568,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 2,
"selected": false,
"text": "<p>Make the polling thread call back to the main form using <a href=\"http://msdn.microsoft.com/en-us/library/system.win... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374555",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17885/"
] | In my code, I am using JavaScript to fire off an `window.open()` event on an ASPX page. I´m outputting a file in the `Page_Load()` event of this page:
```
Response.Clear();
Response.ClearContent();
Response.ClearHeaders();
Response.Charset = "";
Response.ContentType = "application/octet-stream";
Response.AddHeader("Co... | Make the polling thread call back to the main form using [Control.Invoke](http://msdn.microsoft.com/en-us/library/system.windows.forms.control.invoke.aspx) or [Control.BeginInvoke](http://msdn.microsoft.com/en-us/library/system.windows.forms.control.begininvoke.aspx), and create the form in the callback.
I assume you'... |
374,556 | <p>I am trying to use the following code to export tables from access to excel</p>
<p>I am getting error object does not support property or method at the end</p>
<pre><code> Set objexcel = New Excel.Application
objexcel.Visible = True
If Dir("C:\reports\Data_Analysis1.xls") = "" Then
objexcel.Workbooks.Add... | [
{
"answer_id": 374589,
"author": "Binary Worrier",
"author_id": 18797,
"author_profile": "https://Stackoverflow.com/users/18797",
"pm_score": 2,
"selected": true,
"text": "<p>DoCmd as in \"DoCmd.TransferSpreadsheet\" is an MS Access command, not an excel command. I think that is your pro... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374556",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31132/"
] | I am trying to use the following code to export tables from access to excel
I am getting error object does not support property or method at the end
```
Set objexcel = New Excel.Application
objexcel.Visible = True
If Dir("C:\reports\Data_Analysis1.xls") = "" Then
objexcel.Workbooks.Add
Set wbexcel = obj... | DoCmd as in "DoCmd.TransferSpreadsheet" is an MS Access command, not an excel command. I think that is your problem.
If this VBA is running inside MS Access then just refer to it as
```
DoCmd.TransferSpreadsheet
```
Not
```
objexcel.DoCmd.TransferSpreadsheet
```
Also, if that is what you're doing, you don't need... |
374,567 | <p><strong>Final Edit:</strong> I found a solution to the problem (at the bottom of the question).</p>
<p>I've got an Nunit problem that's causing me grief. <strong>Edit:</strong> actually it looks more like a SQLite problem, but I'm not 100% certain yet.</p>
<p>My TestFixture has a setup that generates a random file... | [
{
"answer_id": 374595,
"author": "Steven A. Lowe",
"author_id": 9345,
"author_profile": "https://Stackoverflow.com/users/9345",
"pm_score": 1,
"selected": false,
"text": "<p>try calling Close on the dbconnection</p>\n\n<p>make sure the sqllite process is terminated</p>\n\n<p>you can see ... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374567",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6408/"
] | **Final Edit:** I found a solution to the problem (at the bottom of the question).
I've got an Nunit problem that's causing me grief. **Edit:** actually it looks more like a SQLite problem, but I'm not 100% certain yet.
My TestFixture has a setup that generates a random filename that's used as a SQLite database in ea... | Thanks for the posted answer at the bottom. I was digging for hours for exactly the same case and
```
GC.Collect ();
GC.WaitForPendingFinalizers ();
```
did the trick. |
374,571 | <p>I configured apache on 4 ports (with virtual hosts as some ports used HTTPS) and the aim is to redirect post requests to different servlets running in a TOMCAT instance on some other machine. The calls are made from a <code>httpclient</code> (java client) . When I run the client it throws the error 301 Error: Moved ... | [
{
"answer_id": 374601,
"author": "Paul Dixon",
"author_id": 6521,
"author_profile": "https://Stackoverflow.com/users/6521",
"pm_score": 2,
"selected": false,
"text": "<p>A 301 sounds like the appropriate response if you really want to redirect, but maybe you really wanted to proxy the re... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374571",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15264/"
] | I configured apache on 4 ports (with virtual hosts as some ports used HTTPS) and the aim is to redirect post requests to different servlets running in a TOMCAT instance on some other machine. The calls are made from a `httpclient` (java client) . When I run the client it throws the error 301 Error: Moved Permanently. N... | Achieved this using JK and mod rewrite. The problem was with two way SSL and I configured the ports to run in conjunction with 443 (SSL) port.
i.e.
Note: if one intends to rewrite URL's in the virtual hosts then JK mount has to be reloaded for each virtual host.
My URL rewrites look like this
RewriteEngine on ... |
374,572 | <p>I want to create variables as <code>a1</code>,<code>a2</code>,<code>a3</code>...<code>a10</code>.
For that I used a for loop. As the variable in loop increments I need to create a variable as above.</p>
<p>Can anyone give me an idea?</p>
<p>At the time of creation I also need to be able to assign values to them.</... | [
{
"answer_id": 374579,
"author": "S.Lott",
"author_id": 10661,
"author_profile": "https://Stackoverflow.com/users/10661",
"pm_score": 4,
"selected": false,
"text": "<p>Usually, we use a list, not a bunch of individual variables.</p>\n\n<pre><code>a = 10*[0]\na[0], a[1], a[2], a[9]\n</cod... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374572",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46646/"
] | I want to create variables as `a1`,`a2`,`a3`...`a10`.
For that I used a for loop. As the variable in loop increments I need to create a variable as above.
Can anyone give me an idea?
At the time of creation I also need to be able to assign values to them.
That's where I'm getting syntax error. | Following what S.Lott said, you can also use a dict, if you really nead unique names and that the order of the items is not important:
```
data = {}
for i in range(0, 10):
data['a%d' % i] = i
>>>data
{'a1': 1, 'a0': 0, 'a3': 3, 'a2': 2, 'a5': 5, 'a4': 4, 'a7': 7, 'a6': 6, 'a9': 9, 'a8': 8}
```
I would add that th... |
374,573 | <p>I have this Web Application in JSP running on JBoss Application Server. I am using <a href="https://stackoverflow.com/questions/359147/mask-urls-in-jsp">Servlets for friendly urls</a>. I'm sending search parameters through my JSP's and Servlets. I am using a form with a text box, the Servlet </p>
<p>The first Servl... | [
{
"answer_id": 374612,
"author": "Arnout",
"author_id": 3496,
"author_profile": "https://Stackoverflow.com/users/3496",
"pm_score": 1,
"selected": false,
"text": "<p>First off, I have no idea <em>how</em> to solve this, since I don't know much about Java and JSP.</p>\n\n<p>Having said th... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374573",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1492/"
] | I have this Web Application in JSP running on JBoss Application Server. I am using [Servlets for friendly urls](https://stackoverflow.com/questions/359147/mask-urls-in-jsp). I'm sending search parameters through my JSP's and Servlets. I am using a form with a text box, the Servlet
The first Servlet uses `request.getP... | Try to set URIEncoding in {jboss.server}/deploy/jboss-web.deployer/server.xml.
Ex:
```
<Connector port="8080" address="${jboss.bind.address}"
maxThreads="250" maxHttpHeaderSize="8192"
emptySessionPath="true" protocol="HTTP/1.1"
enableLookups="false" redirectPort="8443" acceptCount="100"
connec... |
374,600 | <p>Aloha</p>
<p>I received a few nice xsd files which I want to convert to classes (using xsd.exe)
All the xsd's have the same includes, like this:</p>
<pre><code><xs:include schemaLocation="kstypes.xsd" />
<xs:include schemaLocation="ksparams.xsd" />
</code></pre>
<p>When I generate a class for each xsd... | [
{
"answer_id": 374682,
"author": "Harper Shelby",
"author_id": 21196,
"author_profile": "https://Stackoverflow.com/users/21196",
"pm_score": 1,
"selected": false,
"text": "<p>Looking over the documentation, it would appear that the 'best' way (not an easy way!) would be to use the /eleme... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374600",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6399/"
] | Aloha
I received a few nice xsd files which I want to convert to classes (using xsd.exe)
All the xsd's have the same includes, like this:
```
<xs:include schemaLocation="kstypes.xsd" />
<xs:include schemaLocation="ksparams.xsd" />
```
When I generate a class for each xsd the types declared in these files are duplic... | try the approach outlined here :
<http://blog.hosca.com/blog/fpmlgen/> |
374,606 | <p>Here's what I did:</p>
<ol>
<li>I've opened a C++ Builder 6 - project in C++ Builder 2009.</li>
<li>Auto-converted it to a C++ Builder 2009 project.</li>
<li>Told it (<em>C++ Builder 2009</em>) to build everything.</li>
</ol>
<p>Here's what <em>it</em> did:</p>
<ol>
<li>Successfully compiled everything.</li>
<li>... | [
{
"answer_id": 379269,
"author": "stukelly",
"author_id": 5891,
"author_profile": "https://Stackoverflow.com/users/5891",
"pm_score": 3,
"selected": true,
"text": "<p>It looks like a Code Guard error. Try deleting all the object (.obj) files and rebuilding the entire project.</p>\n\n<p>... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374606",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4085/"
] | Here's what I did:
1. I've opened a C++ Builder 6 - project in C++ Builder 2009.
2. Auto-converted it to a C++ Builder 2009 project.
3. Told it (*C++ Builder 2009*) to build everything.
Here's what *it* did:
1. Successfully compiled everything.
2. Failed to complete ILINK32, exiting with
```
"Error: Unresolved ext... | It looks like a Code Guard error. Try deleting all the object (.obj) files and rebuilding the entire project.
If this still does not work, then turn off the Code Guard option in C++Builder 6 and try importing the project again.
You may also want to try the [CodeGear/Embarcadero Discussion Forums](https://forums.codeg... |
374,618 | <p>I have several large csv files with thousands of columns that I need to import and then remove entire columns based contents of the column. Is there an easy way to handle this in Ruby?</p>
<p>I could transpose the data and then just delete rows but I was wondering if there was a more syntactically sugary way of do... | [
{
"answer_id": 374625,
"author": "Keltia",
"author_id": 16143,
"author_profile": "https://Stackoverflow.com/users/16143",
"pm_score": 3,
"selected": true,
"text": "<p>You need to iterate on rows and remove columns with <code>Array#slice!</code>.</p>\n\n<p>Something like:</p>\n\n<pre><cod... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6805/"
] | I have several large csv files with thousands of columns that I need to import and then remove entire columns based contents of the column. Is there an easy way to handle this in Ruby?
I could transpose the data and then just delete rows but I was wondering if there was a more syntactically sugary way of doing it. | You need to iterate on rows and remove columns with `Array#slice!`.
Something like:
```
my_array.each do |row|
row.slice!(3) if <insert condition>
end
```
should do it. |
374,626 | <p>I am writing a program in Python, and I realized that a problem I need to solve requires me, given a set <code>S</code> with <code>n</code> elements (|S|=n), to test a function on all possible subsets of a certain order <code>m</code> (i.e. with <em>m</em> number of elements). To use the answer to produce a partial ... | [
{
"answer_id": 374645,
"author": "recursive",
"author_id": 44743,
"author_profile": "https://Stackoverflow.com/users/44743",
"pm_score": 8,
"selected": true,
"text": "<p><a href=\"http://docs.python.org/library/itertools.html#itertools.combinations\" rel=\"noreferrer\">itertools.combinat... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374626",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46634/"
] | I am writing a program in Python, and I realized that a problem I need to solve requires me, given a set `S` with `n` elements (|S|=n), to test a function on all possible subsets of a certain order `m` (i.e. with *m* number of elements). To use the answer to produce a partial solution, and then try again with the next ... | [itertools.combinations](http://docs.python.org/library/itertools.html#itertools.combinations) is your friend if you have Python 2.6 or greater. Otherwise, check the link for an implementation of an equivalent function.
```
import itertools
def findsubsets(S,m):
return set(itertools.combinations(S, m))
```
S: Th... |
374,628 | <p>I'm working on a solution that has two projects: One ASP.NET web application, and one Custom Web Control library.
The custom control library is used in the asp.net application. When I compile the solution, the app.config file of the custom web control library is not transfered with the dll to the ASP.NET apllicatio... | [
{
"answer_id": 374645,
"author": "recursive",
"author_id": 44743,
"author_profile": "https://Stackoverflow.com/users/44743",
"pm_score": 8,
"selected": true,
"text": "<p><a href=\"http://docs.python.org/library/itertools.html#itertools.combinations\" rel=\"noreferrer\">itertools.combinat... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374628",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32582/"
] | I'm working on a solution that has two projects: One ASP.NET web application, and one Custom Web Control library.
The custom control library is used in the asp.net application. When I compile the solution, the app.config file of the custom web control library is not transfered with the dll to the ASP.NET apllications ... | [itertools.combinations](http://docs.python.org/library/itertools.html#itertools.combinations) is your friend if you have Python 2.6 or greater. Otherwise, check the link for an implementation of an equivalent function.
```
import itertools
def findsubsets(S,m):
return set(itertools.combinations(S, m))
```
S: Th... |
374,644 | <p>I have the following code:</p>
<pre><code><script type="text/javascript">
function SubmitForm()
{
form1.submit();
}
function ShowResponse()
{
}
</script>
.
.
.
<div>
<a href="#" onclick="SubmitForm();">Click</a>
</di... | [
{
"answer_id": 374657,
"author": "sblundy",
"author_id": 4893,
"author_profile": "https://Stackoverflow.com/users/4893",
"pm_score": 0,
"selected": false,
"text": "<p>You need to be using AJAX. Submitting the form usually results in the browser loading a new page.</p>\n"
},
{
"an... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374644",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46279/"
] | I have the following code:
```
<script type="text/javascript">
function SubmitForm()
{
form1.submit();
}
function ShowResponse()
{
}
</script>
.
.
.
<div>
<a href="#" onclick="SubmitForm();">Click</a>
</div>
```
I want to capture the html response of... | You won't be able to do this easily with plain javascript. When you post a form, the form inputs are sent to the server and your page is refreshed - the data is handled on the server side. That is, the `submit()` function doesn't actually return anything, it just sends the form data to the server.
If you really wanted... |
374,651 | <p>How do I check if a given object is nullable in other words how to implement the following method...</p>
<pre><code>bool IsNullableValueType(object o)
{
...
}
</code></pre>
<p>I am looking for nullable <em>value types.</em> I didn't have reference types in mind.</p>
<pre><code>//Note: This is just a sample. The ... | [
{
"answer_id": 374663,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 9,
"selected": true,
"text": "<p>There are two types of nullable - <code>Nullable<T></code> and reference-type.</p>\n\n<p>Jon has corrected me... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374651",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39648/"
] | How do I check if a given object is nullable in other words how to implement the following method...
```
bool IsNullableValueType(object o)
{
...
}
```
I am looking for nullable *value types.* I didn't have reference types in mind.
```
//Note: This is just a sample. The code has been simplified
//to fit in a p... | There are two types of nullable - `Nullable<T>` and reference-type.
Jon has corrected me that it is hard to get type if boxed, but you can with generics:
- so how about below. This is actually testing type `T`, but using the `obj` parameter purely for generic type inference (to make it easy to call) - it would work a... |
374,670 | <p>I am retrieving Japanese characters from a data source and I want to return this data to Excel in an XLOPER. I am using a Japanese version of Excel 2003 (hence XLOPERs and not XLOPER12s).</p>
<pre><code>wchar_t* pszW = OLE2W(bstrResult); //I have the data I am trying to copy in a CComBSTR
ULONG ulSize = ::WideCha... | [
{
"answer_id": 374723,
"author": "MSalters",
"author_id": 15416,
"author_profile": "https://Stackoverflow.com/users/15416",
"pm_score": 0,
"selected": false,
"text": "<p>A char* is a sequence of bytes, interpreted using the current charset. To be precose, that is the charset used by the ... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374670",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5025/"
] | I am retrieving Japanese characters from a data source and I want to return this data to Excel in an XLOPER. I am using a Japanese version of Excel 2003 (hence XLOPERs and not XLOPER12s).
```
wchar_t* pszW = OLE2W(bstrResult); //I have the data I am trying to copy in a CComBSTR
ULONG ulSize = ::WideCharToMultiByte( C... | ***User Error!***
The above code is good. The problem is that Excel was using the wrong code page. I hadn't set the language for non-unicode programs to Japanese in Control Panel.
The code now works for the English version of Excel too.
That was a day and a half well spent... |
374,673 | <p>The build.xml has a <em>test</em> and a <em>build</em> target. The <em>test</em> target obviously depends on the <em>build</em> target. </p>
<p>How can I run the test target only, <strong>temporarily</strong> skipping the compilation, without modifying the build.xml file ? </p>
<p>I'm asking because the compilatio... | [
{
"answer_id": 374680,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 2,
"selected": false,
"text": "<p>Personally I've found the dependency stuff in Ant to get in the way more than helping. I usually set up two sets of t... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374673",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18804/"
] | The build.xml has a *test* and a *build* target. The *test* target obviously depends on the *build* target.
How can I run the test target only, **temporarily** skipping the compilation, without modifying the build.xml file ?
I'm asking because the compilation is too long, and kept up-to-date by a continuous integra... | No, you can't skip it without modifying the build file.
Here is what I do in my projects to solve this issue.
For every public target I will create a private target with "do-" in front of it.
The private target has no dependency, and the public target has the "do-" target as a dependency.
For example:
```
<target na... |
374,687 | <p>I could replicate the problem with various shells under FreeBSD, GNU/Linux, and Solaris. It had me head-scratching for more than an hour, so I decided to post the question here.</p>
| [
{
"answer_id": 374702,
"author": "Bombe",
"author_id": 43582,
"author_profile": "https://Stackoverflow.com/users/43582",
"pm_score": 5,
"selected": true,
"text": "<p>Due to the piping the <code>read</code> is executed in its own subshell.</p>\n\n<pre><code>echo foo | while read a; do ech... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374687",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20520/"
] | I could replicate the problem with various shells under FreeBSD, GNU/Linux, and Solaris. It had me head-scratching for more than an hour, so I decided to post the question here. | Due to the piping the `read` is executed in its own subshell.
```
echo foo | while read a; do echo $a; done
```
will do what you expect it to. |
374,715 | <p>I am trying to add enhancements to a 4 year old VC++ 6.0 program. The debug build runs from the command line but not in the debugger: it crashes with an access violation inside printf(). If I skip the printf, then it crashes in malloc() (called from within fopen()) and I can't skip over that.</p>
<p>This means I ca... | [
{
"answer_id": 374819,
"author": "Sunlight",
"author_id": 33650,
"author_profile": "https://Stackoverflow.com/users/33650",
"pm_score": 2,
"selected": false,
"text": "<p>When run from the debugger, a different heap is used; this is referred to as the <em>debug heap</em>. This has differe... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374715",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41013/"
] | I am trying to add enhancements to a 4 year old VC++ 6.0 program. The debug build runs from the command line but not in the debugger: it crashes with an access violation inside printf(). If I skip the printf, then it crashes in malloc() (called from within fopen()) and I can't skip over that.
This means I cannot run i... | You can use [`_CrtSetDbgFlag()`](http://msdn.microsoft.com/en-us/library/5at7yxcs(VS.71).aspx) to enable a bunch of useful heap debugging techniques. There's a host of other [CRT debugging functions](http://msdn.microsoft.com/en-us/library/1666sb98(VS.71).aspx) available that should help you track down where your probl... |
374,734 | <p>I'm calling a WebService exposed by Oracle that accepts an input of an ItemID and returns to me the corresponding Item Number. I want to grab the Item Number that has been returned out of the XML contained in the response.</p>
<p>The XML looks like this:</p>
<pre><code><env:Envelope
xmlns:env="http://schemas.... | [
{
"answer_id": 374750,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 5,
"selected": true,
"text": "<p>I'd personally use LINQ to XML, because I find that easier to deal with than XPath, particularly when namespaces are i... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374734",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26853/"
] | I'm calling a WebService exposed by Oracle that accepts an input of an ItemID and returns to me the corresponding Item Number. I want to grab the Item Number that has been returned out of the XML contained in the response.
The XML looks like this:
```
<env:Envelope
xmlns:env="http://schemas.xmlsoap.org/soap/envelop... | I'd personally use LINQ to XML, because I find that easier to deal with than XPath, particularly when namespaces are involved. You'd do something like:
```
XNamespace ns0 = "http://dev1/MyWebService1.wsdl";
String result = doc.Descendants(ns0 + "result").First().Value;
```
Note that `doc` here is expected to be an ... |
374,740 | <p>I need to write a unit test for a method that will print a document. Is there an easy way to send the output to the Windows equivalent of /dev/null? I'm guessing that having our build server print a document on every check in is going to get expensive quickly. ;)</p>
<p>Ideally, this would work on both our build... | [
{
"answer_id": 374765,
"author": "Campbell",
"author_id": 942,
"author_profile": "https://Stackoverflow.com/users/942",
"pm_score": 2,
"selected": true,
"text": "<p>You should use a mocking framework to mock out the print method so that it is never actually executed.</p>\n\n<p>Check out ... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374740",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/549/"
] | I need to write a unit test for a method that will print a document. Is there an easy way to send the output to the Windows equivalent of /dev/null? I'm guessing that having our build server print a document on every check in is going to get expensive quickly. ;)
Ideally, this would work on both our build server (whic... | You should use a mocking framework to mock out the print method so that it is never actually executed.
Check out TypeMock or RhinoMocks for something that will help you do this.
This is how it would look using TypeMock:
```
Mock mock = MockManager.Mock<PrintManager>();
mock.ExpectCall("Print");
```
Then you would ... |
374,762 | <p>I am looking to export a few files into Excel from MS Access based on querying a table.</p>
<p>It's like this the query will be </p>
<pre><code>select * from table where field = 0
</code></pre>
<p>I would like to loop the query till field is 9 and I want to save each
result in a different name like field... | [
{
"answer_id": 374835,
"author": "LeppyR64",
"author_id": 16592,
"author_profile": "https://Stackoverflow.com/users/16592",
"pm_score": 1,
"selected": false,
"text": "<p>Speicify the sheet name in the \"Range\" field of the TransferSpreadsheet Command.</p>\n\n<pre><code>DoCmd.TransferSpr... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374762",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31132/"
] | I am looking to export a few files into Excel from MS Access based on querying a table.
It's like this the query will be
```
select * from table where field = 0
```
I would like to loop the query till field is 9 and I want to save each
result in a different name like field1, field2
How will this have to be m... | I finally got it done this way
```
For i = 1 To 9
CurrentDb.QueryDefs("MyQuery").SQL = "Select * from table Where field = " & i
DoCmd.TransferSpreadsheet acExport, _
acSpreadsheetTypeExcel9, _
"MyQuery", _
"C:\Repor... |
374,768 | <p>I have the following code (adapted from an example given in <a href="http://diveintopython.net/file_handling/file_objects.html#d0e14928" rel="nofollow noreferrer">Dive Into Python</a>) that reads the entire contents of a file into a buffer.</p>
<pre><code>buffer = ""
try:
file = open(postFileName, 'rU')
tr... | [
{
"answer_id": 374821,
"author": "Oli",
"author_id": 22035,
"author_profile": "https://Stackoverflow.com/users/22035",
"pm_score": 0,
"selected": false,
"text": "<p>With a recent version of Python, you don't need to nest try-except and try-finally. try-except-finally has been unified:</p... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374768",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1288/"
] | I have the following code (adapted from an example given in [Dive Into Python](http://diveintopython.net/file_handling/file_objects.html#d0e14928)) that reads the entire contents of a file into a buffer.
```
buffer = ""
try:
file = open(postFileName, 'rU')
try:
# Read the entire POST log file into a b... | I find that finally blocks are often overused. The file close (and a few other similar patterns) are so important that Python 3.0 will have a **with** statement just to cover this base in a slightly less obscure way.
* Do I need an except with a finally?
That hits on the confusing nature of this specific example, an... |
374,770 | <p>Imagine this case where I have an object that I need to check a property.
However, the object can currently have a null value.</p>
<p>How can I check these two conditions in a single "if" condition?</p>
<p>Currently, I have to do something like this:</p>
<pre class="lang-cs prettyprint-override"><code>if (... | [
{
"answer_id": 374776,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 6,
"selected": true,
"text": "<pre class=\"lang-cs prettyprint-override\"><code>if (myObject != null && myObject.Id != pId)\n{\n myObject.... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374770",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29544/"
] | Imagine this case where I have an object that I need to check a property.
However, the object can currently have a null value.
How can I check these two conditions in a single "if" condition?
Currently, I have to do something like this:
```cs
if (myObject != null)
{
if (myObject.Id != pId)
{
myObject... | ```cs
if (myObject != null && myObject.Id != pId)
{
myObject.Id = pId;
myObject.Order = pOrder;
}
```
`&&` is a short-circuiting logic test - it only evaluates the right-hand-side if the left-hand-side is true. Contrast to `a & b`, which always evaluates both sides (and when used with integral types instead of ... |
374,786 | <p>I've been at this for several days and searches including here haven't give me any solutions yet.</p>
<p>I am creating a Bookmarklet which is to interact with a POST API. I've gotten most of it working except the most important part; the sending of data from the iframe (I know horrible! If anyone knows a better sol... | [
{
"answer_id": 375311,
"author": "singpolyma",
"author_id": 8611,
"author_profile": "https://Stackoverflow.com/users/8611",
"pm_score": 0,
"selected": false,
"text": "<p>If you need to pass data to the iframe, and the iframe is actually including another page, but that other page is on t... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374786",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I've been at this for several days and searches including here haven't give me any solutions yet.
I am creating a Bookmarklet which is to interact with a POST API. I've gotten most of it working except the most important part; the sending of data from the iframe (I know horrible! If anyone knows a better solution plea... | You should look into [easyXDM](http://easyxdm.net), it's very easy to use. Check out one of the examples on <http://consumer.easyxdm.net/current/example/methods.html> |
374,790 | <p>I understand that boxing and unboxing is about casting (real type to object... object to real type). But I do not understand what the MSDN say about it with the Nullable. Here is the text I do not understand:</p>
<blockquote>
<p>When a nullable type is boxed, the common language runtime automatically boxes the un... | [
{
"answer_id": 374801,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 5,
"selected": true,
"text": "<p>What it's saying is that if you do:</p>\n\n<pre><code>int? x = 5;\nobject y = x; // Boxing\n</code></pre>\n\n<p>You en... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374790",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46827/"
] | I understand that boxing and unboxing is about casting (real type to object... object to real type). But I do not understand what the MSDN say about it with the Nullable. Here is the text I do not understand:
>
> When a nullable type is boxed, the common language runtime automatically boxes the underlying value of th... | What it's saying is that if you do:
```
int? x = 5;
object y = x; // Boxing
```
You end up with a boxed `int`, not a boxed `Nullable<int>`. Similarly if you do:
```
int? x = null; // Same as new Nullable<int>() - HasValue = false;
object y = x; // Boxing
```
Then y ends up as a null reference. |
374,791 | <p>I've had to move my page title into my node to accommodate a client need, but I'm unable to now get a title to display on a page view of my views list. The argument I have to display title on edit, admin and track pages is:</p>
<pre><code><?php if ($title && ((arg(2) == 'track') || (arg(2) == 'edit') || ... | [
{
"answer_id": 375387,
"author": "Steve Perks",
"author_id": 16124,
"author_profile": "https://Stackoverflow.com/users/16124",
"pm_score": 3,
"selected": true,
"text": "<p>OK - I found my own solution that didn't require creating 20 plus page templates. For the above example, I added the... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374791",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16124/"
] | I've had to move my page title into my node to accommodate a client need, but I'm unable to now get a title to display on a page view of my views list. The argument I have to display title on edit, admin and track pages is:
```
<?php if ($title && ((arg(2) == 'track') || (arg(2) == 'edit') ||
(arg(0) == 'admin'))):... | OK - I found my own solution that didn't require creating 20 plus page templates. For the above example, I added the condition of `!node->type` to my query, since view's don't provide a node-type, then went through the site ensuring that title's were disabled at the page view level where needed.
```
<?php if ($title &... |
374,797 | <p>I'm using Zend Studio 6.1 for Eclipse, which comes bundled with the Subversive plug-in.</p>
<p>My repo layout is:</p>
<pre><code>/trunk/
/branches/
/tags/
</code></pre>
<p>My application code is in:</p>
<pre><code>/trunk/application
</code></pre>
<p>I'm trying to add some view templates in:</p>
<pre><code>/tru... | [
{
"answer_id": 374810,
"author": "RB.",
"author_id": 15393,
"author_profile": "https://Stackoverflow.com/users/15393",
"pm_score": 4,
"selected": false,
"text": "<p>It's actually fine to say \"Yes\" to this warning.</p>\n\n<p>A common layout for version control is to have 3 root folders:... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374797",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3407/"
] | I'm using Zend Studio 6.1 for Eclipse, which comes bundled with the Subversive plug-in.
My repo layout is:
```
/trunk/
/branches/
/tags/
```
My application code is in:
```
/trunk/application
```
I'm trying to add some view templates in:
```
/trunk/application/views/tags/index.tpl
```
BUT Subversive won't let ... | I finally got it working.
I can only assume it's a bug in the Zend Studio for Eclipse's Subversive plugin.
If I try to commit by right clicking on the files in "PHP Explorer", it fails.
If I "Override and Commit" via "Team -> Synchronize with Repository", it works fine. |
374,818 | <p>I have a .net project in subversion which is contineously integrated with
Cruisecontrol.net.</p>
<p>i use Svn source control CCNET task.</p>
<p>The .net project library directory with set of reusable components configured as subversion externals.</p>
<p>ProjectA\libraries {reusable components directory}
ProjectA... | [
{
"answer_id": 374836,
"author": "keithwarren7",
"author_id": 40714,
"author_profile": "https://Stackoverflow.com/users/40714",
"pm_score": 0,
"selected": false,
"text": "<p>I just setup a polling interval to check for mods - using the triggers node in ccnet.config it is an intervalTrigg... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374818",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32670/"
] | I have a .net project in subversion which is contineously integrated with
Cruisecontrol.net.
i use Svn source control CCNET task.
The .net project library directory with set of reusable components configured as subversion externals.
ProjectA\libraries {reusable components directory}
ProjectA\libraries\component1
Pr... | In CruiseControl.NET 1.4 there is a few new flags for the subversion source control block, one of them is CheckExternals set this to true in your config and any modifications in your externals should trigger a build.
```
<checkExternals>True</checkExternals>
<checkExternalsRecursive>True</checkExternalsRecursive>
``` |
374,824 | <p>Here is classical object model:</p>
<pre><code> class ViewBase
{
void DoSomethingForView() { } //May be virtual
}
class View1 : ViewBase //(derived class from ViewBase)
{
void DoSomethingForView() { }
void DoSomethingForView1Special() { }
}
class View2: ViewBase //(another derived class from ViewB... | [
{
"answer_id": 376250,
"author": "Axeman",
"author_id": 11289,
"author_profile": "https://Stackoverflow.com/users/11289",
"pm_score": 3,
"selected": true,
"text": "<p>So this gives you roughly equivalent syntax in Perl. It doesn't help you out with some of your conflicting criteria, thou... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374824",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/43056/"
] | Here is classical object model:
```
class ViewBase
{
void DoSomethingForView() { } //May be virtual
}
class View1 : ViewBase //(derived class from ViewBase)
{
void DoSomethingForView() { }
void DoSomethingForView1Special() { }
}
class View2: ViewBase //(another derived class from ViewBase)
{
vo... | So this gives you roughly equivalent syntax in Perl. It doesn't help you out with some of your conflicting criteria, though.
Note the following:
* class ABC {...} is replaced by the perl syntax package ABC;
* The capital camel-case method names are turned into proper "snake-case" perl.
* App has been turned to sigil... |
374,841 | <p>I have a coldfusion web site I need to change. Have no idea or experience with this environment (I do know ASP.NET). All I need to do is to write a condition based on the referral value (the URL) of the page, and redirect to another page in some cases.
Can anyone give me an example of the syntax that would perform t... | [
{
"answer_id": 374892,
"author": "DanSingerman",
"author_id": 43965,
"author_profile": "https://Stackoverflow.com/users/43965",
"pm_score": 1,
"selected": false,
"text": "<p>Haven't done coldfusion in a little while but:</p>\n\n<pre><code><cfif some_condition_based_on_your_url>\n ... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374841",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1363/"
] | I have a coldfusion web site I need to change. Have no idea or experience with this environment (I do know ASP.NET). All I need to do is to write a condition based on the referral value (the URL) of the page, and redirect to another page in some cases.
Can anyone give me an example of the syntax that would perform this... | All of the other examples would work...also if you're looking to redirect based on a referral from an external site, you may want to check CGI.HTTP\_REFERER. Check out the CGI scope for several other options.
```
<cfif reFindNoCase('[myRegex]',cgi.http_referer)>
<cflocation url="my_new_url">
</cfif>
```
...my ex... |
374,843 | <p><strong>The cause was probably that I ran out of disk space, causing everything to work strangely. I will leave this question up anyways in case anyone else has a similar issue.</strong></p>
<p>I have a few PHP scripts that have hung for a long time, but apparently they are not really using much CPU time as they do... | [
{
"answer_id": 374892,
"author": "DanSingerman",
"author_id": 43965,
"author_profile": "https://Stackoverflow.com/users/43965",
"pm_score": 1,
"selected": false,
"text": "<p>Haven't done coldfusion in a little while but:</p>\n\n<pre><code><cfif some_condition_based_on_your_url>\n ... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374843",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8005/"
] | **The cause was probably that I ran out of disk space, causing everything to work strangely. I will leave this question up anyways in case anyone else has a similar issue.**
I have a few PHP scripts that have hung for a long time, but apparently they are not really using much CPU time as they don't get killed. Still t... | All of the other examples would work...also if you're looking to redirect based on a referral from an external site, you may want to check CGI.HTTP\_REFERER. Check out the CGI scope for several other options.
```
<cfif reFindNoCase('[myRegex]',cgi.http_referer)>
<cflocation url="my_new_url">
</cfif>
```
...my ex... |
374,846 | <p>I have a 3 table SQLServer Database.</p>
<pre><code>Project
ProjectID
ProjectName
Thing
ThingID
ThingName
ProjectThingLink
ProjectID
ThingID
CreatedDate
</code></pre>
<p>When a Thing is ascribed to a Project an entry is put in the ProjectThingLink table.
Things can move between Projects. The CreatedDate is used to... | [
{
"answer_id": 374868,
"author": "Tony Andrews",
"author_id": 18747,
"author_profile": "https://Stackoverflow.com/users/18747",
"pm_score": 3,
"selected": true,
"text": "<pre><code>select p.projectName, t.ThingName\nfrom projects p\njoin projectThingLink l on l.projectId = p.projectId\nj... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374846",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5552/"
] | I have a 3 table SQLServer Database.
```
Project
ProjectID
ProjectName
Thing
ThingID
ThingName
ProjectThingLink
ProjectID
ThingID
CreatedDate
```
When a Thing is ascribed to a Project an entry is put in the ProjectThingLink table.
Things can move between Projects. The CreatedDate is used to know which Project a Th... | ```
select p.projectName, t.ThingName
from projects p
join projectThingLink l on l.projectId = p.projectId
join thing t on t.thingId = l.thingId
where l.createdDate =
( select max(l2.createdDate)
from projectThingLink l2
where l2.thingId = l.thingId
);
```
NOTE: Corrected after comment |
374,885 | <p>I'm looking into a restful design and would like to use the HTTP methods (<code>POST</code>, <code>GET</code>, ...) and HTTP headers as much as possible. I already found out that the HTTP methods <code>PUT</code> and <code>DELETE</code> are not supported from the browser.</p>
<p>Now I'm looking to get different rep... | [
{
"answer_id": 374925,
"author": "James Anderson",
"author_id": 38207,
"author_profile": "https://Stackoverflow.com/users/38207",
"pm_score": 0,
"selected": false,
"text": "<p>Use some javascript!</p>\n\n<pre>\nxmlhttp=new XMLHttpRequest();\nxmlhttp.open('PUT',http://www.mydomain.org/doc... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374885",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15490/"
] | I'm looking into a restful design and would like to use the HTTP methods (`POST`, `GET`, ...) and HTTP headers as much as possible. I already found out that the HTTP methods `PUT` and `DELETE` are not supported from the browser.
Now I'm looking to get different representations of the same resource and would like to do... | I don't think it's possible to do it in the way you are trying to do it.
Indication of the accepted data format is usually done through adding the extension to the resource name. So, if you have resource like
```
/resources/resource
```
and `GET /resources/resource` returns its HTML representation, to indicate that... |
374,886 | <p>I'm trying to setup Spring using Hibernate and JPA, but when trying to persist an object, nothing seems to be added to the database.</p>
<p>Am using the following:</p>
<pre><code><bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="url" value="${jdbc.url}"/>
&l... | [
{
"answer_id": 374913,
"author": "Juan Manuel",
"author_id": 47033,
"author_profile": "https://Stackoverflow.com/users/47033",
"pm_score": 1,
"selected": false,
"text": "<p>Probably you're keeping the transaction active and it is not calling \"commit\" until other methods running support... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374886",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32713/"
] | I'm trying to setup Spring using Hibernate and JPA, but when trying to persist an object, nothing seems to be added to the database.
Am using the following:
```
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
<property name="url" value="${jdbc.url}"/>
<property name="driverClassName" va... | Thanks to eric and Juan Manuel's answers, I was able to figure out that the transaction wasn't committed.
Adding @Transactional to the storeAccount method did the trick! |
374,906 | <p>We use a customized installation of SugarCRM and I need to make a change to the "Convert Lead to Contact" form. On the form, only "last name" is marked as required, but if the user does not enter a salutation or first name, Sugar will throw an SQL error on the insert (because salutation and first name are required f... | [
{
"answer_id": 375729,
"author": "Ed Schwehm",
"author_id": 1206,
"author_profile": "https://Stackoverflow.com/users/1206",
"pm_score": 2,
"selected": true,
"text": "<p>I appear to have figured out a solution. I created an upgrade file in \"custom/Extension/modules/Contacts/Ext/Vardefs\"... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374906",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1206/"
] | We use a customized installation of SugarCRM and I need to make a change to the "Convert Lead to Contact" form. On the form, only "last name" is marked as required, but if the user does not enter a salutation or first name, Sugar will throw an SQL error on the insert (because salutation and first name are required fiel... | I appear to have figured out a solution. I created an upgrade file in "custom/Extension/modules/Contacts/Ext/Vardefs" called "custom.php". The contents of the file are below:
```
<?php
$dictionary['Contact']['fields']['salutation']['required'] = true;
$dictionary['Contact']['fields']['first_name']['required'] = true;
... |
374,930 | <p>I have a .NET webform that has a file upload control that is tied to a regular expression validator. This validator needs to validate that only certain filetypes should be allowed for upload (jpg,gif,doc,pdf)</p>
<p>The current regular expression that does this is:</p>
<pre>
<code>
^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(... | [
{
"answer_id": 374956,
"author": "Dario Solera",
"author_id": 16026,
"author_profile": "https://Stackoverflow.com/users/16026",
"pm_score": 9,
"selected": true,
"text": "<p>Your regex seems a bit too complex in my opinion. Also, remember that the dot is a special character meaning \"any ... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374930",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1638/"
] | I have a .NET webform that has a file upload control that is tied to a regular expression validator. This validator needs to validate that only certain filetypes should be allowed for upload (jpg,gif,doc,pdf)
The current regular expression that does this is:
```
^(([a-zA-Z]:)|(\\{2}\w+)\$?)(\\(\w[\w].*))(.jpg|.JPG|.... | Your regex seems a bit too complex in my opinion. Also, remember that the dot is a special character meaning "any character". The following regex should work (note the escaped dots):
```
^.*\.(jpg|JPG|gif|GIF|doc|DOC|pdf|PDF)$
```
You can use a tool like [Expresso](http://www.ultrapico.com/Expresso.htm) to test your... |
374,940 | <p>As input I get an int (well, actually a string I should convert to an int).<br>
This int should be converted to bits.<br>
For each bit position that has a 1, I should get the position.<br>
In my database, I want all records that have an int value field that has this position as value.<br>
I currently have the follow... | [
{
"answer_id": 374955,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 2,
"selected": false,
"text": "<p>I suspect <a href=\"http://msdn.microsoft.com/en-us/library/system.collections.bitarray.aspx\" rel=\"nofollow norefer... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374940",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11333/"
] | As input I get an int (well, actually a string I should convert to an int).
This int should be converted to bits.
For each bit position that has a 1, I should get the position.
In my database, I want all records that have an int value field that has this position as value.
I currently have the following nai... | Your feeling is correct. This should be solved with bitmasks. BitConverter does not return bits (and how could it? "bits" isn't an actual data type), it converts raw bytes to CLR data types. Whenever you want to extract the bits out of something, you should think bitmasks.
If you want to check if a bit at a certain po... |
374,952 | <p>I'm trying to use Live Search 2.0 but even a simple example doesn't seem to work. Microsoft only has example code for 1.1 and they're not giving out AppIDs for that version.</p>
<p>Here's what I'm trying with:</p>
<pre><code><?php
$server = new SoapClient('http://soap.search.msn.com/webservices.asmx?wsdl');
cl... | [
{
"answer_id": 385399,
"author": "Marek",
"author_id": 34452,
"author_profile": "https://Stackoverflow.com/users/34452",
"pm_score": 3,
"selected": true,
"text": "<p>You could begin by using the proper soap api url for 2.0.\nIt's now\n\"<a href=\"http://api.search.live.net/search.wsdl?Ap... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374952",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27736/"
] | I'm trying to use Live Search 2.0 but even a simple example doesn't seem to work. Microsoft only has example code for 1.1 and they're not giving out AppIDs for that version.
Here's what I'm trying with:
```
<?php
$server = new SoapClient('http://soap.search.msn.com/webservices.asmx?wsdl');
class Search {
public ... | You could begin by using the proper soap api url for 2.0.
It's now
"<http://api.search.live.net/search.wsdl?AppID=YourAppId>" taken from (<http://msdn.microsoft.com/en-us/library/dd250965.aspx> )
You can also use the new JSON api with php.
```
$appid = 'Your app id';
$searchitem = 'PHP Manual';
$request = 'http:/... |
374,960 | <p>In a scripting step in a scheduled task in SQL Server Agent 2005, I need to trigger a webscript that is running on a different server. I'm doing this:</p>
<pre><code>Dim ie
Set ie = CreateObject( "InternetExplorer.Application" )
ie.navigate "...to my dreamscript"
' Wait till IE is ready
Do While ie.Busy
(1)
... | [
{
"answer_id": 374988,
"author": "Ken Yao",
"author_id": 42356,
"author_profile": "https://Stackoverflow.com/users/42356",
"pm_score": 2,
"selected": true,
"text": "<p>You can write a console applicaton and execute the console app in SQL agent job.</p>\n"
},
{
"answer_id": 375251... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374960",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | In a scripting step in a scheduled task in SQL Server Agent 2005, I need to trigger a webscript that is running on a different server. I'm doing this:
```
Dim ie
Set ie = CreateObject( "InternetExplorer.Application" )
ie.navigate "...to my dreamscript"
' Wait till IE is ready
Do While ie.Busy
(1)
Loop
ie.Quit
... | You can write a console applicaton and execute the console app in SQL agent job. |
374,973 | <p>Which is more efficient?</p>
<pre><code>SELECT theField
FROM theTable
GROUP BY theField
</code></pre>
<p>or</p>
<pre><code>SELECT DISTINCT theField
FROM theTable
</code></pre>
| [
{
"answer_id": 375002,
"author": "Ken Yao",
"author_id": 42356,
"author_profile": "https://Stackoverflow.com/users/42356",
"pm_score": 3,
"selected": false,
"text": "<p>You can check the Execution Plan to look for the total cost of this statements. The answer may vary in different scenar... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374973",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2173/"
] | Which is more efficient?
```
SELECT theField
FROM theTable
GROUP BY theField
```
or
```
SELECT DISTINCT theField
FROM theTable
``` | In your example, both queries will generate the same execution plan so their performance will be the same.
However, they both have their own purpose. To make your code easier to understand, you should use distinct to **eliminate duplicate rows** and group by to **apply aggregate operators** (sum, count, max, ...). |
374,997 | <p>I've a process name and I've to send a <code>kill()</code> signal to that process but I need its PID to call <code>kill()</code>. I would only like to use:</p>
<pre><code>popen("pidof process_name");
</code></pre>
<p>as the last thing. Is there any other way to find out the process' PID? One way I could think of i... | [
{
"answer_id": 375048,
"author": "Martin Beckett",
"author_id": 10897,
"author_profile": "https://Stackoverflow.com/users/10897",
"pm_score": 2,
"selected": false,
"text": "<p>Use sysctl - <a href=\"http://programming-in-linux.blogspot.com/2008/03/get-process-id-by-name-in-c.html\" rel=\... | 2008/12/17 | [
"https://Stackoverflow.com/questions/374997",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7205/"
] | I've a process name and I've to send a `kill()` signal to that process but I need its PID to call `kill()`. I would only like to use:
```
popen("pidof process_name");
```
as the last thing. Is there any other way to find out the process' PID? One way I could think of is to send a socket request to that process and a... | You mentioned you were using linux. It isn't the cleanest solution, but you can go through every entry in /proc and check the process name in cmdline against what you are looking for. |
375,009 | <p>I have simple regex</p>
<pre><code>"\".*\""
</code></pre>
<p>for me its says select everything between " and ", but it also catches</p>
<pre><code>"text") != -1 || file.indexOf(".exe"
</code></pre>
<p>for me its two strings, for regex its one. how can i make regex to see that its two strings?</p>
<p>P.S. I'm us... | [
{
"answer_id": 375021,
"author": "RB.",
"author_id": 15393,
"author_profile": "https://Stackoverflow.com/users/15393",
"pm_score": 0,
"selected": false,
"text": "<p>Look into <a href=\"http://en.wikipedia.org/wiki/Regex#Lazy_quantification\" rel=\"nofollow noreferrer\">Lazy Quantificatio... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375009",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have simple regex
```
"\".*\""
```
for me its says select everything between " and ", but it also catches
```
"text") != -1 || file.indexOf(".exe"
```
for me its two strings, for regex its one. how can i make regex to see that its two strings?
P.S. I'm using Java. | That's the non-greedy form:
```
".*?"
```
The `*?` means: "Match as little as possible", while the `*` alone means "Match as much as possible".
The latter basically goes on until the end of the string, giving characters back one by one so the final `"` can match. That's why you get everything between the first and... |
375,014 | <p>I would like to be able to refactor out the <strong>OrderBy</strong> clause in a linq expression. </p>
<p>Here is an example of a refactor of the <strong>where</strong> clause </p>
<p>before:</p>
<pre><code>results = ctx.ActiveUsers
.Where(u => u.CompanyID != 1 &&
(u.LastName.ToLower().... | [
{
"answer_id": 375074,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 3,
"selected": true,
"text": "<p>Assuming you want to actually take a string such as \"LastName\", \"FirstName\" etc, I'd do something like:</p>\n\n<pr... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375014",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31470/"
] | I would like to be able to refactor out the **OrderBy** clause in a linq expression.
Here is an example of a refactor of the **where** clause
before:
```
results = ctx.ActiveUsers
.Where(u => u.CompanyID != 1 &&
(u.LastName.ToLower().Contains(searchString)
|| u.Email.ToLower().Contains(se... | Assuming you want to actually take a string such as "LastName", "FirstName" etc, I'd do something like:
```
var unordered = ctx.ActiveUsers
.Where(Employee.GetExpression(searchString))
.OrderBy(ordering)
.Select(u => new Employee {
ID = u.... |
375,053 | <p>The goal is to take the current working directory split it at <code>/clients/</code> and see if the user is in</p>
<pre>[something]/clients/[their username]/[something]</pre>
<p>for example, the goal would be for input:</p>
<pre><code>cwd = "/volumes/raid0/www/clients/mikey/test_folder/"
$session->username = "... | [
{
"answer_id": 375089,
"author": "Ruben Vermeersch",
"author_id": 32713,
"author_profile": "https://Stackoverflow.com/users/32713",
"pm_score": 1,
"selected": false,
"text": "<p>Something like this might get you started:</p>\n\n<pre><code><?php\n$regex = '%(.+)(/|\\\\\\\\)clients(/|\\... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375053",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | The goal is to take the current working directory split it at `/clients/` and see if the user is in
```
[something]/clients/[their username]/[something]
```
for example, the goal would be for input:
```
cwd = "/volumes/raid0/www/clients/mikey/test_folder/"
$session->username = "mikey"
```
to return with
```
$aut... | There is no need to use regular expressions here, you're looking for a string in another string. So that would be something like:
```
$isAuthorized = strpos(str_replace('\\', '/', getcwd()), "/clients/$username/") !== FALSE;
``` |
375,066 | <p>I'm working with an application that logs to Windows Application Log regularly (viewable through the Event Viewer administrative tool), and I'm looking for a way to back it up on a daily basis. This is important because we sometimes discover a problem with the application - and to investigate further we need informa... | [
{
"answer_id": 375113,
"author": "Dave Swersky",
"author_id": 34796,
"author_profile": "https://Stackoverflow.com/users/34796",
"pm_score": 2,
"selected": false,
"text": "<p>You can use Windows Management Instrumentation (WMI) to read the event log and do whatever you like with the resul... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375066",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21263/"
] | I'm working with an application that logs to Windows Application Log regularly (viewable through the Event Viewer administrative tool), and I'm looking for a way to back it up on a daily basis. This is important because we sometimes discover a problem with the application - and to investigate further we need informatio... | Here is a WMI script that I found a while ago. This could be what you're searching!
```
dim strComputer = "." 'Define here the Remote IP Address or Computername
dim objWMIService
dim colLogFiles
dim objLogfile
dim errBackupLog
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate,(Backup)}!\\" ... |
375,068 | <p>Right now we just use something like this</p>
<pre><code> stopWatch.Start();
try
{
method();
}
finally
{
stopWatch.Stop();
}
</code></pre>
<p>Which works fine for synchronous methods, but some are executing asynchronously, s... | [
{
"answer_id": 375169,
"author": "Grzenio",
"author_id": 5363,
"author_profile": "https://Stackoverflow.com/users/5363",
"pm_score": 1,
"selected": false,
"text": "<p>The stopwatch should measure time spent only in one thread. You would need to run a separate instance on every thread. Th... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375068",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23822/"
] | Right now we just use something like this
```
stopWatch.Start();
try
{
method();
}
finally
{
stopWatch.Stop();
}
```
Which works fine for synchronous methods, but some are executing asynchronously, so the time is skewed when ... | Hmm, from Jon Skeet's answer to this question:
[Timing a line of code accurately in a threaded application, C#](https://stackoverflow.com/questions/252793/timing-a-line-of-code-accurately-in-a-threaded-application-c)
And also this article:
<http://lyon-smith.org/blogs/code-o-rama/archive/2007/07/17/timing-code-on-w... |
375,083 | <p>Hey all, I have something of an interesting requirement for my project. I need a <code>has_one</code> relationship where it is either one class or the other, but without inheritance. I could get away with inheritance if it is the only way, but the two associate records have completely different data and aren't rel... | [
{
"answer_id": 375142,
"author": "AJ.",
"author_id": 46890,
"author_profile": "https://Stackoverflow.com/users/46890",
"pm_score": 0,
"selected": false,
"text": "<p>Perhaps one way to do this, is to create to has-one associations in Foo, for Bar and Baz. Then create a method called assi... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375083",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24950/"
] | Hey all, I have something of an interesting requirement for my project. I need a `has_one` relationship where it is either one class or the other, but without inheritance. I could get away with inheritance if it is the only way, but the two associate records have completely different data and aren't related at all.
Wh... | You're trying to model something that doesn't fit the relational database paradigm. All references in SQL have one origin and one target.
FWIW, Polymorphic Associations is also an anti-pattern because it breaks this rule. It should be a clue that it's a broken design when the *documentation* says you must forgo a ref... |
375,093 | <p>I'm trying to achieve something google isn't able to give answer. I'm trying to create an asp.net usercontrol that when I put content into it's open close tag will include it for me to be still able to acess it's content by ID from the Parent. Here is an exemple of what I want to achieve.</p>
<p>Usercontrol:</p>
<... | [
{
"answer_id": 375260,
"author": "Pawel Krakowiak",
"author_id": 41420,
"author_profile": "https://Stackoverflow.com/users/41420",
"pm_score": 0,
"selected": false,
"text": "<p>Add a public property in the user control's code behind file. If you need design time support there's more work... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375093",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47109/"
] | I'm trying to achieve something google isn't able to give answer. I'm trying to create an asp.net usercontrol that when I put content into it's open close tag will include it for me to be still able to acess it's content by ID from the Parent. Here is an exemple of what I want to achieve.
Usercontrol:
```
<%@ Control... | Ok I fixed it here is the solution I used :
In MyUserConstrol.ascx file I have put a placeholder where I wanted innerHTML to show :
```
<asp:PlaceHolder runat="server" ID="plhContent" />
```
Then in the MyUserControl.ascx.cs file I added those attribute to the class:
```
[ParseChildren(false)]
[PersistChildren(tru... |
375,100 | <p>When I set a component to visible=false the component hides, but how do I get it to take no space (get the container it belongs to to resize??)</p>
<p></p>
<pre><code><mx:HBox width="100%" height="100%">
...
</mx:HBox>
<mx:HBox width="100%" id="boxAddComment" visible="false" >
<mx:TextAre... | [
{
"answer_id": 375123,
"author": "mmattax",
"author_id": 1638,
"author_profile": "https://Stackoverflow.com/users/1638",
"pm_score": 6,
"selected": true,
"text": "<p>use the <strong>includeInLayout</strong> property. e.g.</p>\n\n<pre>\n<code>\n<mx:HBox width="100%" height=&q... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375100",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40939/"
] | When I set a component to visible=false the component hides, but how do I get it to take no space (get the container it belongs to to resize??)
```
<mx:HBox width="100%" height="100%">
...
</mx:HBox>
<mx:HBox width="100%" id="boxAddComment" visible="false" >
<mx:TextArea id="txtComment"/>
<mx:Button label="Sp... | use the **includeInLayout** property. e.g.
```
<mx:HBox width="100%" height="100%">
...
</mx:HBox>
<mx:HBox width="100%" id="boxAddComment" visible="false" includeInLayout="false" >
<mx:TextArea id="txtComment"/>
<mx:Button label="Spara" click="addComment();"/>
</mx:HBox>
``` |
375,104 | <p>If I'm trying to match a quote-delimited string with a regex, which of the following is "better" (where "better" means both more efficient and less likely to do something unexpected):</p>
<pre><code>/"[^"]+"/ # match quote, then everything that's not a quote, then a quote
</code></pre>
<p>or</p>
<pre><code>/".+?"... | [
{
"answer_id": 375126,
"author": "PEZ",
"author_id": 44639,
"author_profile": "https://Stackoverflow.com/users/44639",
"pm_score": 2,
"selected": false,
"text": "<p>I'd go for number two since it's much easier to read. But I'd still like to match empty strings so I would use:</p>\n\n<pre... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375104",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1821/"
] | If I'm trying to match a quote-delimited string with a regex, which of the following is "better" (where "better" means both more efficient and less likely to do something unexpected):
```
/"[^"]+"/ # match quote, then everything that's not a quote, then a quote
```
or
```
/".+?"/ # match quote, then *anything* (n... | You should use number one, because number two is bad practice. Consider that the developer who comes after you wants to match strings that are followed by an exclamation point. Should he use:
```
"[^"]*"!
```
or:
```
".*?"!
```
The difference appears when you have the subject:
```
"one" "two"!
```
The first re... |
375,120 | <p>I have colleagues working on a .NET 1.1 project, where they obtain XML files from an external party and programmatically instruct iTextSharp to generate PDF content based on the XML data.</p>
<p>The tricky part is, within this XML are segments of arbitrary HTML content. These are HTML code users copied and pasted f... | [
{
"answer_id": 375201,
"author": "D'Arcy Rittich",
"author_id": 39430,
"author_profile": "https://Stackoverflow.com/users/39430",
"pm_score": 0,
"selected": false,
"text": "<p>I don't have any solid answers, but I'll give you two directions to explore, both of which I have used before.</... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375120",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2663/"
] | I have colleagues working on a .NET 1.1 project, where they obtain XML files from an external party and programmatically instruct iTextSharp to generate PDF content based on the XML data.
The tricky part is, within this XML are segments of arbitrary HTML content. These are HTML code users copied and pasted from their ... | I have found .NET 2.0-based components like [ExpertPDF](http://www.html-to-pdf.net/) and [ABCpdf](http://www.websupergoo.com/products.htm#pd) do a fairly good job interpreting the CSS styles and aligning the tables properly in PDF. Right now I am suggesting to my colleagues the use of a separate .NET 2.0 web service th... |
375,128 | <p>Is there a way to configure Velocity to use something other than toString() to convert an object to a string in a template? For example, suppose I'm using a simple date class with a format() method, and I use the same format every time. If all of my velocity code looks like this:</p>
<pre><code>$someDate.format('M-... | [
{
"answer_id": 375201,
"author": "D'Arcy Rittich",
"author_id": 39430,
"author_profile": "https://Stackoverflow.com/users/39430",
"pm_score": 0,
"selected": false,
"text": "<p>I don't have any solid answers, but I'll give you two directions to explore, both of which I have used before.</... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375128",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13210/"
] | Is there a way to configure Velocity to use something other than toString() to convert an object to a string in a template? For example, suppose I'm using a simple date class with a format() method, and I use the same format every time. If all of my velocity code looks like this:
```
$someDate.format('M-D-yyyy')
```
... | I have found .NET 2.0-based components like [ExpertPDF](http://www.html-to-pdf.net/) and [ABCpdf](http://www.websupergoo.com/products.htm#pd) do a fairly good job interpreting the CSS styles and aligning the tables properly in PDF. Right now I am suggesting to my colleagues the use of a separate .NET 2.0 web service th... |
375,133 | <p>If I have the following nvarchar variable - BTA200, how can I extract just the BTA from it?</p>
<p>Also, if I have varying lengths such as BTA50, BTA030, how can I extract just the numeric part?</p>
| [
{
"answer_id": 375145,
"author": "RB.",
"author_id": 15393,
"author_profile": "https://Stackoverflow.com/users/15393",
"pm_score": 2,
"selected": false,
"text": "<p>LEFT ('BTA200', 3) will work for the examples you have given, as in :</p>\n\n<pre><code>SELECT LEFT(MyField, 3)\nFROM MyTab... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375133",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33690/"
] | If I have the following nvarchar variable - BTA200, how can I extract just the BTA from it?
Also, if I have varying lengths such as BTA50, BTA030, how can I extract just the numeric part? | I would recommend a combination of PatIndex and Left. Carefully constructed, you can write a query that always works, no matter what your data looks like.
Ex:
```
Declare @Temp Table(Data VarChar(20))
Insert Into @Temp Values('BTA200')
Insert Into @Temp Values('BTA50')
Insert Into @Temp Values('BTA030')
Insert Into ... |
375,141 | <p>I've trying to achieve something like this:</p>
<pre><code>class Base
{
public:
Base(string S)
{
...
};
}
class Derived: Base
{
public:
int foo;
string bar()
{
return stringof(foo); // actually, something more complex
};
Derived(int f) : foo(f), Base(bar())
{
};
}
</code></pre>
<p>... | [
{
"answer_id": 375171,
"author": "Judge Maygarden",
"author_id": 1491,
"author_profile": "https://Stackoverflow.com/users/1491",
"pm_score": 3,
"selected": true,
"text": "<p>Yes, using a function (static class method or regular function) that takes <em>foo</em> as a parameter and returns... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375141",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1737/"
] | I've trying to achieve something like this:
```
class Base
{
public:
Base(string S)
{
...
};
}
class Derived: Base
{
public:
int foo;
string bar()
{
return stringof(foo); // actually, something more complex
};
Derived(int f) : foo(f), Base(bar())
{
};
}
```
Now, this doesn't work as ... | Yes, using a function (static class method or regular function) that takes *foo* as a parameter and returns a string is a good solution. You can call this same function from Derived::bar to prevent code duplication. So, your constructor would look like this:
```
Derived(int f) : Base(stringof(f)), foo(f) {}
```
I pl... |
375,150 | <p>As the title says, whats the difference between</p>
<pre><code>MyFunction = function() {
}
</code></pre>
<p>and</p>
<pre><code>function MyFunction() {
}
</code></pre>
<p>Nothing?</p>
<p><strong>Duplicate:</strong> <a href="https://stackoverflow.com/questions/336859/javascript-var-functionname-function-vs-func... | [
{
"answer_id": 375162,
"author": "singpolyma",
"author_id": 8611,
"author_profile": "https://Stackoverflow.com/users/8611",
"pm_score": 0,
"selected": false,
"text": "<p>I think you mean</p>\n\n<pre><code>var MyFunction = function() {\n}\n</code></pre>\n\n<p>And in many cases, there is l... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375150",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39655/"
] | As the title says, whats the difference between
```
MyFunction = function() {
}
```
and
```
function MyFunction() {
}
```
Nothing?
**Duplicate:** [var functionName = function() {} vs function functionName() {}](https://stackoverflow.com/questions/336859/javascript-var-functionname-function-vs-function-function... | The first form is actually a variable with an **anonymous function** assigned to it, the second is a **declared function**.
They're *almost* interchangeable, but have some differences: debuggers have a harder time with anons (because they lack a name) and the JS engine can directly access declared functions wherever ... |
375,154 | <p>Assuming the file exists (using <code>os.path.exists(filename)</code> to first make sure that it does), how do I display the time a file was last modified? This is on Linux if that makes any difference.</p>
| [
{
"answer_id": 375168,
"author": "Douglas Leeder",
"author_id": 3978,
"author_profile": "https://Stackoverflow.com/users/3978",
"pm_score": 7,
"selected": true,
"text": "<p><a href=\"http://docs.python.org/library/os.html#os.stat\" rel=\"noreferrer\">os.stat()</a></p>\n\n<pre><code>impor... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375154",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1288/"
] | Assuming the file exists (using `os.path.exists(filename)` to first make sure that it does), how do I display the time a file was last modified? This is on Linux if that makes any difference. | [os.stat()](http://docs.python.org/library/os.html#os.stat)
```
import os
filename = "/etc/fstab"
statbuf = os.stat(filename)
print("Modification time: {}".format(statbuf.st_mtime))
```
Linux does not record the creation time of a file ([for most fileystems](https://unix.stackexchange.com/q/24441/61642)). |
375,164 | <p>I am using jqGrid of which I downloaded from here <a href="http://www.trirand.com/blog" rel="nofollow noreferrer">http://www.trirand.com/blog</a> . I followed the tutorial word by word to test out the grid. Now the alterations I did is that the page from which the grid gets the data is in asp.net instead of php. </p... | [
{
"answer_id": 376774,
"author": "Christian Payne",
"author_id": 5188,
"author_profile": "https://Stackoverflow.com/users/5188",
"pm_score": 1,
"selected": false,
"text": "<p>Have you added:</p>\n\n<pre><code><script src=\"grid/js/jqDnR.js\" type=\"text/javascript\">\n</script&g... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375164",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45471/"
] | I am using jqGrid of which I downloaded from here <http://www.trirand.com/blog> . I followed the tutorial word by word to test out the grid. Now the alterations I did is that the page from which the grid gets the data is in asp.net instead of php.
The problem is that the grid loads fine and there is a response with t... | Have you added:
```
<script src="grid/js/jqDnR.js" type="text/javascript">
</script>
```
Also, your XML is missing the closing
```
</rows>
```
tag. Try that! |
375,165 | <p>I would like to create a visual effect when an item in a listbox is double clicked. So far I have drag and drop functionality where the item is visually attached to the mouse and can be moved to a drop target. From that functionality I am able to animate the item using the same logic of getting the item container, h... | [
{
"answer_id": 403488,
"author": "Nick",
"author_id": 26161,
"author_profile": "https://Stackoverflow.com/users/26161",
"pm_score": 1,
"selected": false,
"text": "<p>OK, you could try taking a Visual element and setting it's background to a visualbrush of your ListItem and animate that t... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375165",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42858/"
] | I would like to create a visual effect when an item in a listbox is double clicked. So far I have drag and drop functionality where the item is visually attached to the mouse and can be moved to a drop target. From that functionality I am able to animate the item using the same logic of getting the item container, howe... | Here's some code I worked up to draw a visual to a bitmap. You may be able to adapt this to your needs, and draw the bitmap by adorning the UIElement that represents a common ancestor of the two list views. Note the use of FrameworkElement.TransformToAncestor to get the coordinates of a nested element in terms of an an... |
375,172 | <p>I'm currently developing an OSGi based application (using Equinox) by trying to mavenize a web tutorial I've found on OSGi+Equinox. In this project, there are bundles depending on other bundles (quote-service depends on quote).
The compile phase does succeed, but the package phase does not. Maven complains the follo... | [
{
"answer_id": 377564,
"author": "Patriarch24",
"author_id": 47122,
"author_profile": "https://Stackoverflow.com/users/47122",
"pm_score": 4,
"selected": false,
"text": "<p>The answer is quite simple : I removed the already defined manifest, and used bnd entries in the bundle plugin inst... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375172",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47122/"
] | I'm currently developing an OSGi based application (using Equinox) by trying to mavenize a web tutorial I've found on OSGi+Equinox. In this project, there are bundles depending on other bundles (quote-service depends on quote).
The compile phase does succeed, but the package phase does not. Maven complains the followin... | The answer is quite simple : I removed the already defined manifest, and used bnd entries in the bundle plugin instructions. That works ! |
375,178 | <p>I can't find any post regarding the cache on logout so I'm going to ask this question. If there is a similar question. Please let me know.</p>
<p>I have a Logout page that basically call FormAuthentications signout method then redirect the user to the login page. It work fine but the problem is user can click on th... | [
{
"answer_id": 375222,
"author": "Chris Van Opstal",
"author_id": 7264,
"author_profile": "https://Stackoverflow.com/users/7264",
"pm_score": 0,
"selected": false,
"text": "<p>There's no foolproof way to accomplish this. The user ultimately has control over the cache settings and no-cach... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375178",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28647/"
] | I can't find any post regarding the cache on logout so I'm going to ask this question. If there is a similar question. Please let me know.
I have a Logout page that basically call FormAuthentications signout method then redirect the user to the login page. It work fine but the problem is user can click on the browser'... | Depending on your requirements a possible solution might be to set the Cache-Control header to "no-cache" on every authenticated page. This will prevent pages from being cached downstream. It could be achieved by writing a custom [HttpModule](http://msdn.microsoft.com/en-us/library/system.web.ihttpmodule.aspx) that wil... |
375,194 | <p>suppose that I have this RDBM table (<a href="http://en.wikipedia.org/wiki/Entity-attribute-value_model" rel="nofollow noreferrer">Entity-attribute-value_model</a>):</p>
<pre><code>col1: entityID
col2: attributeName
col3: value
</code></pre>
<p>and I want to use HBase due to scaling issues.</p>
<p>I know that the... | [
{
"answer_id": 546453,
"author": "The D Williams",
"author_id": 52485,
"author_profile": "https://Stackoverflow.com/users/52485",
"pm_score": 4,
"selected": true,
"text": "<p>Secondary indexes would indeed be useful for many potential applications of HBase, and I believe the developers a... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375194",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20065/"
] | suppose that I have this RDBM table ([Entity-attribute-value\_model](http://en.wikipedia.org/wiki/Entity-attribute-value_model)):
```
col1: entityID
col2: attributeName
col3: value
```
and I want to use HBase due to scaling issues.
I know that the only way to access Hbase table is using a primary key (cursor). you ... | Secondary indexes would indeed be useful for many potential applications of HBase, and I believe the developers are in fact looking at it. Checkout <http://www.mail-archive.com/hbase-dev@hadoop.apache.org/msg04801.html>.
In the mean time though, if your application data storage can be modelled as a star schema (see <h... |
375,203 | <p>my ruby (on rails) class looks like:</p>
<p>class Foo
def self.method1
someAction
end</p>
<p>def self.method2
someAction
end</p>
<p>def someAction
//doSmth
end
end</p>
<p>any ideas how to make this work or achieve the same behavior some other way?</p>
<p>thanks!</p>
| [
{
"answer_id": 375224,
"author": "Hates_",
"author_id": 3410,
"author_profile": "https://Stackoverflow.com/users/3410",
"pm_score": 1,
"selected": false,
"text": "<p>You cannot call an instance method from a class method, without an actual instance of the class itself. You can do it as s... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375203",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47124/"
] | my ruby (on rails) class looks like:
class Foo
def self.method1
someAction
end
def self.method2
someAction
end
def someAction
//doSmth
end
end
any ideas how to make this work or achieve the same behavior some other way?
thanks! | If some\_action is appropriate as a class method, I'd do it like this:
```
class Foo
def self.method1
some_action
end
def self.some_action
# do stuff
end
def some_action
self.class.some_action
end
end
```
If method1 is supposed to be a convenience method, then I'd do like Hates\_ s... |
375,204 | <p>I have a problem. I built a script to make a request to an internal link that sends back a response. This is what the script looks like:</p>
<pre><code>jQuery.get(callUrl, function(data) {
console.log(typeof data);
jQuery.each(data.items, function(i, item) {
console.log(i);
});
}, 'json');
</code></pre>
... | [
{
"answer_id": 375236,
"author": "Mark Bell",
"author_id": 43140,
"author_profile": "https://Stackoverflow.com/users/43140",
"pm_score": 4,
"selected": true,
"text": "<p>The JSON needs to have brackets around it, so it should be:</p>\n\n<pre><code>({\"items\":[ \n {\n \"src... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375204",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32816/"
] | I have a problem. I built a script to make a request to an internal link that sends back a response. This is what the script looks like:
```
jQuery.get(callUrl, function(data) {
console.log(typeof data);
jQuery.each(data.items, function(i, item) {
console.log(i);
});
}, 'json');
```
and the response that ... | The JSON needs to have brackets around it, so it should be:
```
({"items":[
{
"src": "gallery_item_data_Jc4EaLP6vlwd_large.jpg",
"id": "83",
"gallery_id": "30",
"username": "admin"
}]
})
```
You should then be able to use getJSON, as this is the easiest way to get the data as an object. H... |
375,223 | <p>I have a Panel with a collection of controls in it. How can I get the index of a specific control when iterating through them? I'm using <code>foreach</code> to iterate, but there's no Index property. Should I use <code>for x = 0...</code> and return <code>x</code> when my match is made, or what?</p>
| [
{
"answer_id": 375242,
"author": "Steven Behnke",
"author_id": 42588,
"author_profile": "https://Stackoverflow.com/users/42588",
"pm_score": 3,
"selected": false,
"text": "<p>You could use:</p>\n\n<pre><code>panel.Controls.IndexOf(control);\n</code></pre>\n\n<p>Or you could iterate over ... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375223",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28240/"
] | I have a Panel with a collection of controls in it. How can I get the index of a specific control when iterating through them? I'm using `foreach` to iterate, but there's no Index property. Should I use `for x = 0...` and return `x` when my match is made, or what? | You could use:
```
panel.Controls.IndexOf(control);
```
Or you could iterate over them with a for loop instead of a foreach loop. Or you could just create an index that you increment inside of the foreach loop. |
375,248 | <p>I came across a problem in my current application that required fiddling with the query string in a base <code>Page</code> class (which all my pages inherit from) to solve the problem. Since some of my pages use the query string I was wondering if there is any class that provides clean and simple query string manipu... | [
{
"answer_id": 375304,
"author": "technophile",
"author_id": 23029,
"author_profile": "https://Stackoverflow.com/users/23029",
"pm_score": 3,
"selected": true,
"text": "<p>Use <code>HttpUtility.ParseQueryString</code>, as someone suggested (and then deleted).</p>\n\n<p>This will work, be... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375248",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40007/"
] | I came across a problem in my current application that required fiddling with the query string in a base `Page` class (which all my pages inherit from) to solve the problem. Since some of my pages use the query string I was wondering if there is any class that provides clean and simple query string manipulation.
Examp... | Use `HttpUtility.ParseQueryString`, as someone suggested (and then deleted).
This will work, because the return value from that method is actually an `HttpValueCollection`, which inherits `NameValueCollection` (and is internal, you can't reference it directly). You can then set the names/values in the collection norma... |
375,252 | <p>I have a java applet that is embedded in html using the <code>object-comment-embed</code> method. I would like to resize the applet whenever the browser window is resized. I have found solutions around the internet, but they all work based on the deprecated <code>applet</code> tag.</p>
<p>Also, when trying a <code>... | [
{
"answer_id": 375290,
"author": "Jack",
"author_id": 24998,
"author_profile": "https://Stackoverflow.com/users/24998",
"pm_score": 2,
"selected": false,
"text": "<p>Try replacing these lines:</p>\n\n<pre><code>document.getElementById('MyApplet1').setSize(applet_width, applet_height);\nd... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375252",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7161/"
] | I have a java applet that is embedded in html using the `object-comment-embed` method. I would like to resize the applet whenever the browser window is resized. I have found solutions around the internet, but they all work based on the deprecated `applet` tag.
Also, when trying a `setSize()` call on my `embed` element... | Try replacing these lines:
```
document.getElementById('MyApplet1').setSize(applet_width, applet_height);
document.getElementById('MyApplet2').setSize(applet_width, applet_height);
```
with:
```
document.getElementById('MyApplet1').style.height = applet_height + "px";
document.getElementById('MyApplet1').style.widt... |
375,262 | <p>Let's say I have a payments table like so:</p>
<pre><code>CREATE TABLE Payments (
PaymentID INT,
CustomerID INT,
Value INT,
PaidOn DATE
);
INSERT INTO Payments
VALUES
(1, 1, 5, '2000-01-01'),
(2, 1, 10, '2000-02-01'),
(3, 2, 10, '2000-01-02'),
(4, 2, 10, '2000-01-20'),
(5, 2, 5, '2000-02-02'),
</code></pr... | [
{
"answer_id": 375271,
"author": "RB.",
"author_id": 15393,
"author_profile": "https://Stackoverflow.com/users/15393",
"pm_score": 3,
"selected": true,
"text": "<p>The following query will accomplish that. It pulls out all the rows for which there is not a greater Value.</p>\n\n<pre><cod... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375262",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/420/"
] | Let's say I have a payments table like so:
```
CREATE TABLE Payments (
PaymentID INT,
CustomerID INT,
Value INT,
PaidOn DATE
);
INSERT INTO Payments
VALUES
(1, 1, 5, '2000-01-01'),
(2, 1, 10, '2000-02-01'),
(3, 2, 10, '2000-01-02'),
(4, 2, 10, '2000-01-20'),
(5, 2, 5, '2000-02-02'),
```
And I want to run ... | The following query will accomplish that. It pulls out all the rows for which there is not a greater Value.
```
SELECT *
FROM payments p
WHERE NOT EXISTS (
SELECT *
FROM payments p2
WHERE p2.CustomerID = p.CustomerId
AND p2.Value > p.Value
)
``` |
375,265 | <p>I've implemented my own event handler and added it to the selection model of the table:</p>
<pre><code>table.getSelectionModel().addListSelectionListener(event);
</code></pre>
<p>And implemented the method for "event" (mentioned above):</p>
<pre><code>public void valueChanged(ListSelectionEvent e) {
log.debug... | [
{
"answer_id": 375308,
"author": "Draemon",
"author_id": 26334,
"author_profile": "https://Stackoverflow.com/users/26334",
"pm_score": 4,
"selected": true,
"text": "<p>1) I think you'll find it fires once for de-selecting the old selection and once for selecting the new selection. If you... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375265",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33429/"
] | I've implemented my own event handler and added it to the selection model of the table:
```
table.getSelectionModel().addListSelectionListener(event);
```
And implemented the method for "event" (mentioned above):
```
public void valueChanged(ListSelectionEvent e) {
log.debug("value changed");
}
```
Unfortunat... | 1) I think you'll find it fires once for de-selecting the old selection and once for selecting the new selection. If you log the details of the event you should see exactly what's going on. I can't remember the details, so perhaps this is wrong. Either way you should be able to call getValueIsAdjusting() on the event a... |
375,291 | <p>I am using a ScrollViewer as part of my Silverlight application. It has a horizontal orientation, and I would like it to appear such that only the scroll buttons appear, but not the scroll bar itself. Something like this crude ASCII rendering:</p>
<pre><code>------------------------------------------------------
... | [
{
"answer_id": 375794,
"author": "Bryant",
"author_id": 10893,
"author_profile": "https://Stackoverflow.com/users/10893",
"pm_score": 1,
"selected": false,
"text": "<p>I've done something similar and the best way I found to do this was to put your content in a scroll viewer and just turn... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375291",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22407/"
] | I am using a ScrollViewer as part of my Silverlight application. It has a horizontal orientation, and I would like it to appear such that only the scroll buttons appear, but not the scroll bar itself. Something like this crude ASCII rendering:
```
------------------------------------------------------
| | ... | Here is another option. Override the default template for SCrollviewer and handle the buttons as PageUp/PageDown. My example below is a scrollviewer that scrolls vertically. You can easily change to to horizontal scrolling and change the handlers from PageUp/PageDown to Left and Right handlers.
```
<ControlTemplate Ta... |
375,300 | <p>I want to decode all the HTML entities in a complicated data structure. Basically I'm looking for a "super map()" function. Here's what I have so far:</p>
<pre><code>sub _html_decode {
my $self = shift;
my $ref = shift;
if (ref($ref) eq "HASH") {
$self->_html_decode_hash($ref)
}
if (... | [
{
"answer_id": 375342,
"author": "Leon Timmermans",
"author_id": 4727,
"author_profile": "https://Stackoverflow.com/users/4727",
"pm_score": 2,
"selected": false,
"text": "<p>I think this should do, but I haven't tested it.</p>\n\n<pre><code>sub _html_decode {\n my ($self, $ref) = @_;... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375300",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25068/"
] | I want to decode all the HTML entities in a complicated data structure. Basically I'm looking for a "super map()" function. Here's what I have so far:
```
sub _html_decode {
my $self = shift;
my $ref = shift;
if (ref($ref) eq "HASH") {
$self->_html_decode_hash($ref)
}
if (ref($ref) eq "ARR... | [Data::Rmap](http://search.cpan.org/~bowmanbs/Data-Rmap-0.62/lib/Data/Rmap.pm) seems to do this as well. Does anyone have any experience with this module? |
375,314 | <p>I am new to threads and in need of help. I have a data entry app that takes an exorbitant amount of time to insert a new record(i.e 50-75 seconds). So my solution was to send an insert statement out via a ThreadPool and allow the user to begin entering the data for the record while that insert which returns a new ... | [
{
"answer_id": 375344,
"author": "Charles Bretana",
"author_id": 32632,
"author_profile": "https://Stackoverflow.com/users/32632",
"pm_score": 0,
"selected": false,
"text": "<p>First, you should probably find out, and fix, the reason why an insert is taking so long... 50-75 seconds is un... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375314",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47142/"
] | I am new to threads and in need of help. I have a data entry app that takes an exorbitant amount of time to insert a new record(i.e 50-75 seconds). So my solution was to send an insert statement out via a ThreadPool and allow the user to begin entering the data for the record while that insert which returns a new recor... | Everyone else, including you, addressed the core problems (insert time, why you're doing an insert, then update), so I'll stick with just the technical concerns with your proposed solution. So, if I get the flow right:
* Thread 1: Start data entry for
record
* Thread 2: Background calls to DB to retrieve new Id
* The ... |
375,320 | <p><img src="https://farm4.static.flickr.com/3200/3116366800_570cc971b9_m.jpg" alt="Screenshot of Drop Down" /></p>
<p>This would be my issue I have a drop down that's not displaying fully. I'm not sure even where to start so here's the HTML surronding the drop down and I'll provide the CSS also.</p>
<p>HTML</p>
<pre><... | [
{
"answer_id": 375397,
"author": "EndangeredMassa",
"author_id": 106,
"author_profile": "https://Stackoverflow.com/users/106",
"pm_score": 3,
"selected": true,
"text": "<p>It looks like you are setting \"line-height:15px;\" on \"select\" elements. Remove that and see if it fixes the issu... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375320",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/657/"
] | 
This would be my issue I have a drop down that's not displaying fully. I'm not sure even where to start so here's the HTML surronding the drop down and I'll provide the CSS also.
HTML
```
<div id="add_item">
<ul class="vert... | It looks like you are setting "line-height:15px;" on "select" elements. Remove that and see if it fixes the issue. |
375,345 | <p>I'm using .Net 2.0 and this is driving me crazy but there's probably some easy thing I'm not doing that I am now too confused to see.</p>
<p>I have an application that has a bespoke collection of objects in it, only the main form should be able to change the contents of that collection and all other forms should be... | [
{
"answer_id": 375386,
"author": "BenAlabaster",
"author_id": 40650,
"author_profile": "https://Stackoverflow.com/users/40650",
"pm_score": 3,
"selected": true,
"text": "<p>If the main form needs read/write access but other forms don't, then I would make the collection a property of your... | 2008/12/17 | [
"https://Stackoverflow.com/questions/375345",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm using .Net 2.0 and this is driving me crazy but there's probably some easy thing I'm not doing that I am now too confused to see.
I have an application that has a bespoke collection of objects in it, only the main form should be able to change the contents of that collection and all other forms should be able to r... | If the main form needs read/write access but other forms don't, then I would make the collection a property of your main form that is read/write from within your form, but read only from outside your form. You can do this using something like:
C#
```
private myCollection _MyCollection;
public myCollection MyCollecti... |