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 |
|---|---|---|---|---|---|---|
199,808 | <p>I have a pictures table that has the following columns:</p>
<pre><code>PICTURE_ID int IDENTITY(1000,1) NOT NULL,
CATEGORY_ID int NOT NULL,
IMGDATA image NOT NULL,
CAPTION1 text COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
MIME_TYPE nchar(20) NOT NULL DEFAULT ('image/jpeg'),
IMGTHDATA image NOT NULL
</code></pre>
<p>... | [
{
"answer_id": 199818,
"author": "Bryant",
"author_id": 10893,
"author_profile": "https://Stackoverflow.com/users/10893",
"pm_score": 1,
"selected": false,
"text": "<p>There is no real simple way to do this. Basically you're going to need to create a handler to display the images. Then i... | 2008/10/14 | [
"https://Stackoverflow.com/questions/199808",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10708/"
] | I have a pictures table that has the following columns:
```
PICTURE_ID int IDENTITY(1000,1) NOT NULL,
CATEGORY_ID int NOT NULL,
IMGDATA image NOT NULL,
CAPTION1 text COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
MIME_TYPE nchar(20) NOT NULL DEFAULT ('image/jpeg'),
IMGTHDATA image NOT NULL
```
In my code-behind I have t... | you can make a page that returns the image as a stream and reference that page from an Image column (or an IMG tag in a template column); see [GridViewDisplayBlob.aspx](http://www.netomatix.com/development/GridViewDisplayBlob.aspx) |
199,832 | <p>Is there a way I can control columns from code. </p>
<p>I had a drop drop box with select : Daily and weekend and the gridview column with Monday, Tuesday, Wednesday, Thursday, Friday, Saturday,sunday.
If the user selects Daily i want to show columns only from Monday to Friday.</p>
<p>It is possible to control fr... | [
{
"answer_id": 199938,
"author": "Stephen Wrighton",
"author_id": 7516,
"author_profile": "https://Stackoverflow.com/users/7516",
"pm_score": 1,
"selected": false,
"text": "<p>In the Item DataBound event handler sub, for every grid row, check the drop list for \"Daily\" or \"weekend\" an... | 2008/10/14 | [
"https://Stackoverflow.com/questions/199832",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14752/"
] | Is there a way I can control columns from code.
I had a drop drop box with select : Daily and weekend and the gridview column with Monday, Tuesday, Wednesday, Thursday, Friday, Saturday,sunday.
If the user selects Daily i want to show columns only from Monday to Friday.
It is possible to control from the code. Oh i... | Use [Columns](http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.columns.aspx) property:
```
GridView1.Columns[5].Visible = false
GridView1.Columns[6].Visible = false
``` |
199,847 | <p>I have the following fields:</p>
<ul>
<li>Inventory control (16 byte record)
<ul>
<li>Product ID code (int – 4 bytes)</li>
<li>Quantity in stock (int – 4 bytes)</li>
<li>Price (double – 8 bytes)</li>
</ul></li>
</ul>
<p>How do I create a fixed length random access file using the above lengths? I tried some exampl... | [
{
"answer_id": 199954,
"author": "Aaron Maenpaa",
"author_id": 2603,
"author_profile": "https://Stackoverflow.com/users/2603",
"pm_score": 4,
"selected": true,
"text": "<p>java.io.RandomAccessFile is the class you're looking for. Here's an example implementation (you'll probably want to ... | 2008/10/14 | [
"https://Stackoverflow.com/questions/199847",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21968/"
] | I have the following fields:
* Inventory control (16 byte record)
+ Product ID code (int – 4 bytes)
+ Quantity in stock (int – 4 bytes)
+ Price (double – 8 bytes)
How do I create a fixed length random access file using the above lengths? I tried some examples online, but I either get an EOF exception or random add... | java.io.RandomAccessFile is the class you're looking for. Here's an example implementation (you'll probably want to write some unit tests, as I haven't :)
```
package test;
import java.io.IOException;
import java.io.RandomAccessFile;
public class Raf {
private static class Record{
private final double pr... |
199,866 | <p>I am just starting out with Silverlight (2 RC0) and can’t seem to get the following to work. I want to create a simple image button user control.</p>
<p>My xaml for the user control is as follows:</p>
<pre><code> <Button>
<Button.Template>
<ControlTemplate>
... | [
{
"answer_id": 200013,
"author": "Jobi Joy",
"author_id": 8091,
"author_profile": "https://Stackoverflow.com/users/8091",
"pm_score": 4,
"selected": true,
"text": "<p>You can get an ImageButton easily just by templating an ordinary Button so you dont require a UserControl at all. Assumin... | 2008/10/14 | [
"https://Stackoverflow.com/questions/199866",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/67719/"
] | I am just starting out with Silverlight (2 RC0) and can’t seem to get the following to work. I want to create a simple image button user control.
My xaml for the user control is as follows:
```
<Button>
<Button.Template>
<ControlTemplate>
<Image Source="{TemplateBinding ImageSo... | You can get an ImageButton easily just by templating an ordinary Button so you dont require a UserControl at all. Assuming that Button.Content will be the ImageSource. The ControlTemplate of the Button will be:
```
<ControlTemplate x:Key="btn_template">
<Image Source="{TemplateBinding Content}" />
</C... |
199,879 | <p>I have a div that contains several child elements, one of which is a flash movie.</p>
<p>When rolling over this div, I want it to change style to indicate it is rolled over. My problem is that the <code>mouseover</code> and <code>mouseout</code> events don't always trigger, especially if the user moves the mouse ove... | [
{
"answer_id": 200026,
"author": "nickf",
"author_id": 9021,
"author_profile": "https://Stackoverflow.com/users/9021",
"pm_score": 1,
"selected": false,
"text": "<p>What you could do is cover the flash element with an invisible div. Place your onmouseover handler on that div, and add a l... | 2008/10/14 | [
"https://Stackoverflow.com/questions/199879",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20851/"
] | I have a div that contains several child elements, one of which is a flash movie.
When rolling over this div, I want it to change style to indicate it is rolled over. My problem is that the `mouseover` and `mouseout` events don't always trigger, especially if the user moves the mouse over the flash element too quickly... | Change the ***wmode*** parameter of the object/embed tag to ***opaque***.
Your code should look something like the following.
```
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia
.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="800" height="600">
... |
199,889 | <p>I'm trying to do a domain lookup in vba with something like this:</p>
<pre><code>DLookup("island", "villages", "village = '" & txtVillage & "'")
</code></pre>
<p>This works fine until txtVillage is something like Dillon's Bay, when the apostrophe is taken to be a single quote, and I get a run-time error.</... | [
{
"answer_id": 199900,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 2,
"selected": false,
"text": "<p>It's worse than you think. Think about what would happen if someone entered a value like this, and you haven't esc... | 2008/10/14 | [
"https://Stackoverflow.com/questions/199889",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10439/"
] | I'm trying to do a domain lookup in vba with something like this:
```
DLookup("island", "villages", "village = '" & txtVillage & "'")
```
This works fine until txtVillage is something like Dillon's Bay, when the apostrophe is taken to be a single quote, and I get a run-time error.
I've written a trivial function th... | The "Replace" function should do the trick. Based on your code above:
```
DLookup("island", "villages", "village = '" & Replace(txtVillage, "'", "''") & "'")
``` |
199,905 | <p>Is it possible to add comments somehow, somewhere? </p>
<p>I don't pretend to be any sort of expert when using MySQL and certainly don't spend all day in it. More often than I would like I forget how I intend to use a column (usally the bit ones) and would be very excited if I could add a comment to remind me if ... | [
{
"answer_id": 199908,
"author": "Edward Z. Yang",
"author_id": 23845,
"author_profile": "https://Stackoverflow.com/users/23845",
"pm_score": 0,
"selected": false,
"text": "<p>Are you sure you're not looking to use an ENUM column instead? Good MySQL tables should be self-documenting.</p>... | 2008/10/14 | [
"https://Stackoverflow.com/questions/199905",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1444/"
] | Is it possible to add comments somehow, somewhere?
I don't pretend to be any sort of expert when using MySQL and certainly don't spend all day in it. More often than I would like I forget how I intend to use a column (usally the bit ones) and would be very excited if I could add a comment to remind me if 1 is good or... | <http://dev.mysql.com/doc/refman/5.0/en/create-table.html>
```
table_option:
{ENGINE|TYPE} [=] engine_name
| AUTO_INCREMENT [=] value
| AVG_ROW_LENGTH [=] value
| [DEFAULT] CHARACTER SET [=] charset_name
| CHECKSUM [=] {0 | 1}
| [DEFAULT] COLLATE [=] collation_name
| COMMENT [=] 'string'
```
---
Exa... |
199,936 | <p>I am currently trying to program my first ajax interface using Rails.</p>
<p>The application currently shows a table populated with list items. The user has to approve or reject each of the list items. I currently have an edit link at the end of each row that shows a form in which I can approve the list item.</p>
... | [
{
"answer_id": 200071,
"author": "Andrew",
"author_id": 17408,
"author_profile": "https://Stackoverflow.com/users/17408",
"pm_score": 4,
"selected": true,
"text": "<p>I don't think that a checkbox is the correct control for what you're looking for.\nYou said you want user's to be able to... | 2008/10/14 | [
"https://Stackoverflow.com/questions/199936",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14755/"
] | I am currently trying to program my first ajax interface using Rails.
The application currently shows a table populated with list items. The user has to approve or reject each of the list items. I currently have an edit link at the end of each row that shows a form in which I can approve the list item.
I am thinking ... | I don't think that a checkbox is the correct control for what you're looking for.
You said you want user's to be able to approve or reject items which means that you have 3 states: unhandled, approved and rejected. A checkbox only supports 2 states: off and on
I would use two links accept and reject and then do it as ... |
199,953 | <p>I have 2 tables. One (domains) has domain ids, and domain names (dom_id, dom_url).</p>
<p>the other contains actual data, 2 of which columns require a TO and FROM domain names. So I have 2 columns rev_dom_from and rev_dom_for, both of which store the domain name id, from the domains table.</p>
<p>Simple.</p>
<p>N... | [
{
"answer_id": 199958,
"author": "Stephen Wrighton",
"author_id": 7516,
"author_profile": "https://Stackoverflow.com/users/7516",
"pm_score": 8,
"selected": true,
"text": "<p>you'd use another join, something along these lines:</p>\n\n<pre><code>SELECT toD.dom_url AS ToURL, \n fromD.d... | 2008/10/14 | [
"https://Stackoverflow.com/questions/199953",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have 2 tables. One (domains) has domain ids, and domain names (dom\_id, dom\_url).
the other contains actual data, 2 of which columns require a TO and FROM domain names. So I have 2 columns rev\_dom\_from and rev\_dom\_for, both of which store the domain name id, from the domains table.
Simple.
Now I need to actua... | you'd use another join, something along these lines:
```
SELECT toD.dom_url AS ToURL,
fromD.dom_url AS FromUrl,
rvw.*
FROM reviews AS rvw
LEFT JOIN domain AS toD
ON toD.Dom_ID = rvw.rev_dom_for
LEFT JOIN domain AS fromD
ON fromD.Dom_ID = rvw.rev_dom_from
```
***EDIT***:
All you're doing is jo... |
199,961 | <p>How can I find out the folder where the windows service .exe file is installed dynamically?</p>
<pre><code>Path.GetFullPath(relativePath);
</code></pre>
<p>returns a path based on <code>C:\WINDOWS\system32</code> directory.</p>
<p>However, the <code>XmlDocument.Load(string filename)</code> method appears to be wo... | [
{
"answer_id": 199976,
"author": "Greg Dean",
"author_id": 1200558,
"author_profile": "https://Stackoverflow.com/users/1200558",
"pm_score": 7,
"selected": true,
"text": "<p>Try</p>\n\n<pre><code>System.Reflection.Assembly.GetEntryAssembly().Location\n</code></pre>\n"
},
{
"answe... | 2008/10/14 | [
"https://Stackoverflow.com/questions/199961",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/437435/"
] | How can I find out the folder where the windows service .exe file is installed dynamically?
```
Path.GetFullPath(relativePath);
```
returns a path based on `C:\WINDOWS\system32` directory.
However, the `XmlDocument.Load(string filename)` method appears to be working against relative path inside the directory where ... | Try
```
System.Reflection.Assembly.GetEntryAssembly().Location
``` |
199,966 | <p>The <code>gcc -S</code> option will generate assembly code in AT&T syntax, is there a way to generate files in Intel syntax? Or is there a way to convert between the two?</p>
| [
{
"answer_id": 200028,
"author": "Jason Dagit",
"author_id": 5113,
"author_profile": "https://Stackoverflow.com/users/5113",
"pm_score": 9,
"selected": true,
"text": "<h3>Use <code>-masm=intel</code></h3>\n<pre><code>gcc -S -masm=intel -Og -fverbose-asm test.c\n</code></pre>\n<p>That wor... | 2008/10/14 | [
"https://Stackoverflow.com/questions/199966",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1841/"
] | The `gcc -S` option will generate assembly code in AT&T syntax, is there a way to generate files in Intel syntax? Or is there a way to convert between the two? | ### Use `-masm=intel`
```
gcc -S -masm=intel -Og -fverbose-asm test.c
```
That works with GCC, and clang3.5 and later. [GCC manual](https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html#index-masm_003ddialect):
>
> * `-masm=dialect`
>
> Output asm instructions using selected dialect. Supported choices
> are intel... |
200,020 | <p>In many symbolic math systems, such as Matlab or Mathematica, you can use a variable like <code>Ans</code> or <code>%</code> to retrieve the last computed value. Is there a similar facility in the Python shell?</p>
| [
{
"answer_id": 200027,
"author": "Mark Cidade",
"author_id": 1659,
"author_profile": "https://Stackoverflow.com/users/1659",
"pm_score": 9,
"selected": true,
"text": "<p>Underscore.</p>\n\n<pre><code>>>> 5+5\n10\n>>> _\n10\n>>> _ + 5\n15\n>>> _\n15\n</... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200020",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23845/"
] | In many symbolic math systems, such as Matlab or Mathematica, you can use a variable like `Ans` or `%` to retrieve the last computed value. Is there a similar facility in the Python shell? | Underscore.
```
>>> 5+5
10
>>> _
10
>>> _ + 5
15
>>> _
15
``` |
200,066 | <p>In C#, how do I get the name of the drive that the Operating System is installed on?</p>
| [
{
"answer_id": 200068,
"author": "TheSoftwareJedi",
"author_id": 18941,
"author_profile": "https://Stackoverflow.com/users/18941",
"pm_score": 5,
"selected": false,
"text": "<p>This should do it for you:</p>\n\n<pre><code>Path.GetPathRoot(Environment.SystemDirectory)\n</code></pre>\n"
... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200066",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | In C#, how do I get the name of the drive that the Operating System is installed on? | This should do it for you:
```
Path.GetPathRoot(Environment.SystemDirectory)
``` |
200,079 | <p>Given the following inheritance tree, what would be the best way of implementing it in a way that works?</p>
<pre><code>abstract class Foo<T> : IEnumerable<T>
{
public abstract Bar CreateBar();
}
class Bar<T> : Foo<T>
{
// Bar's provide a proxy interface to Foo's and limit access ni... | [
{
"answer_id": 200087,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 1,
"selected": false,
"text": "<p>Would it be possible for you to make Baz a nested type within Bar? That's the only way you'll give it more access to ... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200079",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15537/"
] | Given the following inheritance tree, what would be the best way of implementing it in a way that works?
```
abstract class Foo<T> : IEnumerable<T>
{
public abstract Bar CreateBar();
}
class Bar<T> : Foo<T>
{
// Bar's provide a proxy interface to Foo's and limit access nicely.
// The general public should... | Okay, new answer:
1. Split Bar into an interface and a concrete class.
2. Express the public abstract method in terms of IBar.
3. Make Bar a private nested class in Foo, implementing IBar. Give it an internal constructor which you can call from Foo.
4. Write a protected method in Foo which creates an instance of Bar f... |
200,090 | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/194465/how-to-parse-a-string-to-an-int-in-c">How to parse a string to an int in C++?</a> </p>
</blockquote>
<p>How do you convert a C++ string to an int?</p>
<p>Assume you are expecting the string to have actu... | [
{
"answer_id": 200095,
"author": "Martin York",
"author_id": 14065,
"author_profile": "https://Stackoverflow.com/users/14065",
"pm_score": 5,
"selected": false,
"text": "<p>Use the C++ streams.</p>\n\n<pre><code>std::string plop(\"123\");\nstd::stringstream str(plop);\nint x;\n\nst... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200090",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27729/"
] | >
> **Possible Duplicate:**
>
> [How to parse a string to an int in C++?](https://stackoverflow.com/questions/194465/how-to-parse-a-string-to-an-int-in-c)
>
>
>
How do you convert a C++ string to an int?
Assume you are expecting the string to have actual numbers in it ("1", "345", "38944", for example).
Also... | ```
#include <sstream>
// st is input string
int result;
stringstream(st) >> result;
``` |
200,106 | <p>Ok so ive got a swing app going using the "System" look and feel. Now, I want to change the background colour of the main panels to black. Too easy right?</p>
<pre><code>UIManager.put("Panel.background", Color.BLACK);
</code></pre>
<p>Well yeah, except now the controls in the app look stupid, because their 'shadow... | [
{
"answer_id": 200130,
"author": "RodeoClown",
"author_id": 943,
"author_profile": "https://Stackoverflow.com/users/943",
"pm_score": 1,
"selected": false,
"text": "<p>You can see what the default settings (and their keys) are by using UIManager.getDefaults();\nYou can then iterate over ... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200106",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16925/"
] | Ok so ive got a swing app going using the "System" look and feel. Now, I want to change the background colour of the main panels to black. Too easy right?
```
UIManager.put("Panel.background", Color.BLACK);
```
Well yeah, except now the controls in the app look stupid, because their 'shadows', for want of a better w... | You might try these:
* control
* controlDkShadow
* controlHighlight
* controlLtHighlight
* controlShadow
(I just found them in this list: [Swing [Archive] - UIManager: setting background and JScrollBar](http://forums.sun.com/thread.jspa?threadID=183858&forumID=57) ) |
200,124 | <p>I created a way to dynamically add <code>SettingsProperty</code> to a .NET <code>app.config</code> file. It all works nicely, but when I am launching my app the next time I can only see the properties that are created in the designer. How can I load back the properties runtime?</p>
<p>My code for creating the <code... | [
{
"answer_id": 200127,
"author": "TheSoftwareJedi",
"author_id": 18941,
"author_profile": "https://Stackoverflow.com/users/18941",
"pm_score": 7,
"selected": true,
"text": "<p>They are saved in the <solutionname>.suo file. SUO stands for Solution User Options, and should not be ad... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200124",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/260/"
] | I created a way to dynamically add `SettingsProperty` to a .NET `app.config` file. It all works nicely, but when I am launching my app the next time I can only see the properties that are created in the designer. How can I load back the properties runtime?
My code for creating the `SettingsProperty` looks like the fol... | They are saved in the <solutionname>.suo file. SUO stands for Solution User Options, and should not be added to source control.
No .vbproj.user files should be in source control either! |
200,140 | <p>In my code, I want to view all data from a CSV in table form, but it only displays the last line. How about lines 1 and 2? Here's the data:</p>
<pre><code>1,HF6,08-Oct-08,34:22:13,df,jhj,fh,fh,ffgh,gh,g,rt,ffgsaf,asdf,dd,yoawa,DWP,tester,Pattern
2,hf35,08-Oct-08,34:12:13,dg,jh,fh,fgh,fgh,gh,gfh,re,fsaf,asdf,dd,yoko... | [
{
"answer_id": 200175,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 3,
"selected": false,
"text": "<p>Allow me to demonstrate with a smaller example.</p>\n\n<pre><code>my $f;\nwhile ($line = <F>) {\n $f = $line;... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200140",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | In my code, I want to view all data from a CSV in table form, but it only displays the last line. How about lines 1 and 2? Here's the data:
```
1,HF6,08-Oct-08,34:22:13,df,jhj,fh,fh,ffgh,gh,g,rt,ffgsaf,asdf,dd,yoawa,DWP,tester,Pattern
2,hf35,08-Oct-08,34:12:13,dg,jh,fh,fgh,fgh,gh,gfh,re,fsaf,asdf,dd,yokogawa,DWP,DWP,P... | HTML::Template would make your life a lot easier. Here's my go with a cut-down template.
```
#!/usr/local/bin/perl
use strict;
use warnings;
use HTML::Template;
my @table;
while (my $line = <DATA>){
chomp $line;
my @row = map{{cell => $_}} split(/,/, $line);
push @table, {row => \@row};
}
my $tmpl = H... |
200,150 | <p>i am using the apache commons httpclient in a lotus notes java agent and it works fine. BUT when establishing a proxy connection the log will be spamed with the following line :</p>
<pre><code>[INFO] AuthChallengeProcessor - basic authentication scheme selected
</code></pre>
<p>Do you know how to disable the integ... | [
{
"answer_id": 200192,
"author": "Owen",
"author_id": 4853,
"author_profile": "https://Stackoverflow.com/users/4853",
"pm_score": 1,
"selected": true,
"text": "<p>you should be able to set the logging level to something less spammy. there are a few default <a href=\"http://hc.apache.org/... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200150",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27181/"
] | i am using the apache commons httpclient in a lotus notes java agent and it works fine. BUT when establishing a proxy connection the log will be spamed with the following line :
```
[INFO] AuthChallengeProcessor - basic authentication scheme selected
```
Do you know how to disable the integrated loging or how to set... | you should be able to set the logging level to something less spammy. there are a few default [logging options](http://hc.apache.org/httpclient-3.x/logging.html), so it depends on the logging method you chose.
it sounds like your logging level is set to "debug" or "info" and should be set at "notice" or above (to avoi... |
200,151 | <p>Is it possible to search for an object by one of its properties in a Generic List?</p>
<pre><code>Public Class Customer
Private _id As Integer
Private _name As String
Public Property ID() As Integer
Get
Return _id
End Get
Set
_id = value
End Set... | [
{
"answer_id": 200161,
"author": "Aleris",
"author_id": 20417,
"author_profile": "https://Stackoverflow.com/users/20417",
"pm_score": 0,
"selected": false,
"text": "<p>If you are using .NET 3.5 this can be done with <a href=\"http://en.wikipedia.org/wiki/Language_Integrated_Query#LINQ_to... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200151",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23667/"
] | Is it possible to search for an object by one of its properties in a Generic List?
```
Public Class Customer
Private _id As Integer
Private _name As String
Public Property ID() As Integer
Get
Return _id
End Get
Set
_id = value
End Set
End Prope... | Yes, this has everything to do with predicates :)
You want the [Find(Of T)](http://msdn.microsoft.com/en-us/library/x0b5b5bc.aspx) method. You need to pass in a predicate (which is a type of delegate in this case). How you construct that delegate depends on which version of VB you're using. If you're using VB9, you co... |
200,162 | <p>The WebBrowser control has a property called "IsWebBrowserContextMenuEnabled" that disables all ability to right-click on a web page and see a context menu. This is very close to what I want (I don't want anyone to be able to right-click and print, hit back, hit properties, view source, etc).</p>
<p>The only probl... | [
{
"answer_id": 200194,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 3,
"selected": true,
"text": "<p>have you considered writing your own context menu in javascript? Just listen to the user right clicking on the body, then sh... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200162",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3244/"
] | The WebBrowser control has a property called "IsWebBrowserContextMenuEnabled" that disables all ability to right-click on a web page and see a context menu. This is very close to what I want (I don't want anyone to be able to right-click and print, hit back, hit properties, view source, etc).
The only problem is this ... | have you considered writing your own context menu in javascript? Just listen to the user right clicking on the body, then show your menu with copy and paste commands (hint: element.style.display = "block|none"). To copy, execute the following code:
```
CopiedTxt = document.selection.createRange();
CopiedTxt.exec... |
200,163 | <p>I am currently writing a little bootstrap code for a service that can be run in the console. It essentially boils down to calling the OnStart() method instead of using the ServiceBase to start and stop the service (because it doesn't run the application if it isn't installed as a service and makes debugging a nightm... | [
{
"answer_id": 200176,
"author": "Sean",
"author_id": 26095,
"author_profile": "https://Stackoverflow.com/users/26095",
"pm_score": 4,
"selected": false,
"text": "<p>I usually flag my Windows service as a console application which takes a command line parameter of \"-console\" to run usi... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200163",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24064/"
] | I am currently writing a little bootstrap code for a service that can be run in the console. It essentially boils down to calling the OnStart() method instead of using the ServiceBase to start and stop the service (because it doesn't run the application if it isn't installed as a service and makes debugging a nightmare... | Like Ash, I write all actual processing code in a separate class library assembly, which was then referenced by the windows service executable, as well as a console app.
However, there are occasions when it is useful to know if the class library is running in the context of the service executable or the console app. T... |
200,195 | <p>I have a Stored procedure which schedules a job. This Job takes a lot of time to get completed (approx 30 to 40 min). I need to get to know the status of this Job.
Below details would help me</p>
<p>1) How to see the list of all jobs that have got scheduled for a future time and are yet to start</p>
<p>2) How to s... | [
{
"answer_id": 200249,
"author": "Biri",
"author_id": 968,
"author_profile": "https://Stackoverflow.com/users/968",
"pm_score": 2,
"selected": false,
"text": "<p>You haven't specified how would you like to see these details.</p>\n\n<p>For the first sight I would suggest to check <a href=... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200195",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20951/"
] | I have a Stored procedure which schedules a job. This Job takes a lot of time to get completed (approx 30 to 40 min). I need to get to know the status of this Job.
Below details would help me
1) How to see the list of all jobs that have got scheduled for a future time and are yet to start
2) How to see the the list o... | You could try using the system stored procedure sp\_help\_job. This returns information on the job, its steps, schedules and servers. For example
```
EXEC msdb.dbo.sp_help_job @Job_name = 'Your Job Name'
```
[SQL Books Online](http://msdn.microsoft.com/en-us/library/ms186722(SQL.90).aspx) should contain lots of info... |
200,200 | <p>I need to use an alias in the WHERE clause, but It keeps telling me that its an unknown column. Is there any way to get around this issue? I need to select records that have a rating higher than x. Rating is calculated as the following alias:</p>
<pre><code>sum(reviews.rev_rating)/count(reviews.rev_id) as avg_ratin... | [
{
"answer_id": 200203,
"author": "Paul Dixon",
"author_id": 6521,
"author_profile": "https://Stackoverflow.com/users/6521",
"pm_score": 9,
"selected": true,
"text": "<p>You could use a HAVING clause, which <em>can</em> see the aliases, e.g.</p>\n\n<pre><code> HAVING avg_rating>5\n</co... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200200",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I need to use an alias in the WHERE clause, but It keeps telling me that its an unknown column. Is there any way to get around this issue? I need to select records that have a rating higher than x. Rating is calculated as the following alias:
```
sum(reviews.rev_rating)/count(reviews.rev_id) as avg_rating
``` | You could use a HAVING clause, which *can* see the aliases, e.g.
```
HAVING avg_rating>5
```
but in a where clause you'll need to repeat your expression, e.g.
```
WHERE (sum(reviews.rev_rating)/count(reviews.rev_id))>5
```
BUT! Not all expressions will be allowed - using an aggregating function like SUM will n... |
200,205 | <p>I'm experimenting with an updated build system at work; currently, I'm trying to find a good way to set compiler & flags depending on the target platform. </p>
<p>What I would like to do is something like</p>
<pre><code>switch $(PLATFORM)_$(BUILD_TYPE)
case "Linux_x86_release"
CFLAGS = -O3
case "Linux... | [
{
"answer_id": 200222,
"author": "Bruno De Fraine",
"author_id": 6918,
"author_profile": "https://Stackoverflow.com/users/6918",
"pm_score": 3,
"selected": false,
"text": "<p>Configuring such parameters would be the task of a <code>configure</code> script.</p>\n\n<p>That being said, you ... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200205",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15514/"
] | I'm experimenting with an updated build system at work; currently, I'm trying to find a good way to set compiler & flags depending on the target platform.
What I would like to do is something like
```
switch $(PLATFORM)_$(BUILD_TYPE)
case "Linux_x86_release"
CFLAGS = -O3
case "Linux_x86_debug"
CFLAGS =... | Switching to a system which does it for you (automake/autoconf) may be simpler... |
200,213 | <p>I've a small project that I want to share with a few others on a machine that we all have access to. I created a bare copy of the local repo with</p>
<pre><code>git clone --bare --no-hardlinks path/to/.git/ repoToShare.git
</code></pre>
<p>I then moved repoToShare.git to the server.</p>
<p>I can check it out with... | [
{
"answer_id": 200232,
"author": "MDCore",
"author_id": 1896,
"author_profile": "https://Stackoverflow.com/users/1896",
"pm_score": 5,
"selected": true,
"text": "<p>Git installs a bunch of pre-configured hooks in the hooks directory, out of the box they do not execute. If you happen to a... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200213",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/85/"
] | I've a small project that I want to share with a few others on a machine that we all have access to. I created a bare copy of the local repo with
```
git clone --bare --no-hardlinks path/to/.git/ repoToShare.git
```
I then moved repoToShare.git to the server.
I can check it out with the following:
```
git clone ss... | Git installs a bunch of pre-configured hooks in the hooks directory, out of the box they do not execute. If you happen to allow execute on them (Eg. chmod +x) then git will try to run them. The particular error pops up cause the default update is failing to run. To fix, delete the default update hook.
Does [this link... |
200,247 | <p>I don't understand it. </p>
<p>The ids of html elements in the master page are changed by the same id but with a prefix and it's breaking the css design.</p>
<p>In the master page I have:</p>
<pre><code><div id="container" runat="server">
<asp:ContentPlaceHolder ...
...
</code></pre>
<p>The above ... | [
{
"answer_id": 200263,
"author": "Biri",
"author_id": 968,
"author_profile": "https://Stackoverflow.com/users/968",
"pm_score": 1,
"selected": false,
"text": "<p>AFAIK you cannot do this. This is the default behaviour because of the control tree.</p>\n\n<p>If you would like to use CSS th... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200247",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/460927/"
] | I don't understand it.
The ids of html elements in the master page are changed by the same id but with a prefix and it's breaking the css design.
In the master page I have:
```
<div id="container" runat="server">
<asp:ContentPlaceHolder ...
...
```
The above code is rendered
```
<div id="ctl00_ctloo_contai... | WebForms should only rewrite the ID's of server controls (like `<asp:ContentPlaceHolder />`, not ordinary HTML element like `<div id="container">` without `runat="server"`
You cannot prevent the framework from rewriting ID's on server controls. You can use class names instead, though. |
200,286 | <p>we had a heated discussion about a method name. </p>
<p>We have a class <code>User</code>. There is property called "Groups" on the user. It contains all groups that contain the user directly. That's ok. What we have problem with, is the name of the method that would recursively list all user's groups and their "pa... | [
{
"answer_id": 200288,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 1,
"selected": false,
"text": "<p>I think I would choose:</p>\n\n<pre><code>u.GetGroupMembership()\n</code></pre>\n"
},
{
"answer_id": 200296,
... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200286",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/75224/"
] | we had a heated discussion about a method name.
We have a class `User`. There is property called "Groups" on the user. It contains all groups that contain the user directly. That's ok. What we have problem with, is the name of the method that would recursively list all user's groups and their "parent" groups and retu... | I agree with Greg, but would make it simpler:
```
u.GroupMembership();
```
I think appending the verb Get is kind of useless, given
the return type (List of Groups) |
200,309 | <p>How to create a table with a timestamp column that defaults to <code>DATETIME('now')</code>?</p>
<p>Like this:</p>
<pre><code>CREATE TABLE test (
id INTEGER PRIMARY KEY AUTOINCREMENT,
t TIMESTAMP DEFAULT DATETIME('now')
);
</code></pre>
<p>This gives an error.</p>
| [
{
"answer_id": 200329,
"author": "Owen",
"author_id": 4853,
"author_profile": "https://Stackoverflow.com/users/4853",
"pm_score": 9,
"selected": true,
"text": "<p>As of <a href=\"https://www.sqlite.org/releaselog/3_1_0.html\" rel=\"noreferrer\">version 3.1.0</a> you can use <code>CURRENT... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200309",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13262/"
] | How to create a table with a timestamp column that defaults to `DATETIME('now')`?
Like this:
```
CREATE TABLE test (
id INTEGER PRIMARY KEY AUTOINCREMENT,
t TIMESTAMP DEFAULT DATETIME('now')
);
```
This gives an error. | As of [version 3.1.0](https://www.sqlite.org/releaselog/3_1_0.html) you can use `CURRENT_TIMESTAMP` with the [DEFAULT](https://www.sqlite.org/lang_createtable.html#the_default_clause) clause:
>
> If the default value of a column is CURRENT\_TIME, CURRENT\_DATE or CURRENT\_TIMESTAMP, then the value used in the new row... |
200,312 | <p>Does anybody knows why this snippet returns <code>false</code> even if the passed string is "Active"?</p>
<pre><code>if ($('status_'+id).getText()=="Active")
</code></pre>
<p>I've also tried changing the code to</p>
<pre><code>if ($('status_'+id).getText()==String("Active"))
</code></pre>
<p>and</p>
<pre><code>... | [
{
"answer_id": 200313,
"author": "Drew Noakes",
"author_id": 24874,
"author_profile": "https://Stackoverflow.com/users/24874",
"pm_score": 5,
"selected": false,
"text": "<p>A key difference between C++ and .NET/Java is the automatic reclaiming of memory that is no longer required. This ... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200312",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24744/"
] | Does anybody knows why this snippet returns `false` even if the passed string is "Active"?
```
if ($('status_'+id).getText()=="Active")
```
I've also tried changing the code to
```
if ($('status_'+id).getText()==String("Active"))
```
and
```
if (String($('status_'+id).getText())=="Active")
```
and still no luc... | A key difference between C++ and .NET/Java is the automatic reclaiming of memory that is no longer required. This is known as **garbage collection**. For this property, they are known as **managed** platforms.
Both Java/.NET delay the compilation of bytecode into native code until the last minute. For this property th... |
200,314 | <p>I'm writing a WinForms app which has two modes: console or GUI. Three projects within the same solution, one for the console app, one for the UI forms and the third to hold the logic that the two interfaces will both connect too. The Console app runs absolutely smoothly. </p>
<p>A model which holds the user-select... | [
{
"answer_id": 200347,
"author": "Skizz",
"author_id": 1898,
"author_profile": "https://Stackoverflow.com/users/1898",
"pm_score": 2,
"selected": false,
"text": "<p>You've answered your own quesion:-</p>\n\n<blockquote>\n <p>I get an error saying that the DataGridView was being accessed... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200314",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2902/"
] | I'm writing a WinForms app which has two modes: console or GUI. Three projects within the same solution, one for the console app, one for the UI forms and the third to hold the logic that the two interfaces will both connect too. The Console app runs absolutely smoothly.
A model which holds the user-selections, it ha... | Since you are doing UI binding via event subscription, [you might find this helpful](http://groups.google.co.uk/group/microsoft.public.dotnet.languages.csharp/browse_thread/thread/214e55884b16f4d9/f12a3c5980567f06#f12a3c5980567f06); it is an example I wrote a while ago that shows how to subclass `BindingList<T>` so tha... |
200,319 | <p>Is it possible to store web content (such as JSPs, HTML, images, CSS etc) in a JAR file?</p>
<p>I've been looking at various options at modularising our web applications and this is one possibility.</p>
<p>We are currently using JSF and Facelets for our view technology - I'm thinking it may be possible to write so... | [
{
"answer_id": 200341,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 1,
"selected": false,
"text": "<p>Absolutely. Heck, you can store content directly in a WAR file, which is basically a JAR file with a few extra bits. ... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200319",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Is it possible to store web content (such as JSPs, HTML, images, CSS etc) in a JAR file?
I've been looking at various options at modularising our web applications and this is one possibility.
We are currently using JSF and Facelets for our view technology - I'm thinking it may be possible to write some form of custom... | Yes, it is possible to store files e.g. properties, xml, xslt, image etc; in a JAR (or WAR) file and pull them at runtime.
To load a resource from your deployment jar, use the following code.
```
this.getClass().getClassLoader().getResourceAsStream( filename ) ;
```
In a maven project, folders & files placed in res... |
200,337 | <p>I've never learnt JavaScript, but I imagine this is quite a simple problem. Just wanted to know which method is most advised these days.</p>
| [
{
"answer_id": 200339,
"author": "Owen",
"author_id": 4853,
"author_profile": "https://Stackoverflow.com/users/4853",
"pm_score": 8,
"selected": true,
"text": "<pre><code>// use this to avoid redirects when a user clicks \"back\" in their browser\nwindow.location.replace('http://somewher... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200337",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11324/"
] | I've never learnt JavaScript, but I imagine this is quite a simple problem. Just wanted to know which method is most advised these days. | ```
// use this to avoid redirects when a user clicks "back" in their browser
window.location.replace('http://somewhereelse.com');
// use this to redirect, a back button call will trigger the redirection again
window.location.href = "http://somewhereelse.com";
// given for completeness, essentially an alias to window... |
200,372 | <p>I think it important to have an "<strong>undo</strong>" method ala <strong>gmail</strong> when destroying records instead of displaying an annoying popup that says, "<em>Are you sure?</em>".</p>
<p>The way that I've implemented this is to have a "deleted_at" timestamp column in the model which gets timestamped when... | [
{
"answer_id": 200411,
"author": "Andy Jeffries",
"author_id": 2645935,
"author_profile": "https://Stackoverflow.com/users/2645935",
"pm_score": 0,
"selected": false,
"text": "<p>There is a file <a href=\"http://github.com/alto/redline/tree/ed884597354762572b4112ef4d3d13a13d051faa/lib/ac... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200372",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6048/"
] | I think it important to have an "**undo**" method ala **gmail** when destroying records instead of displaying an annoying popup that says, "*Are you sure?*".
The way that I've implemented this is to have a "deleted\_at" timestamp column in the model which gets timestamped when **destroy** method is called
```
def des... | There are indeed some plugins that can be found at [Agile Web Development](http://agilewebdevelopment.com/plugins).
Here are the links and summaries for the plugins which seem to match your description:
1. [Acts as Paranoid](http://agilewebdevelopment.com/plugins/acts_as_paranoid): Make your Active Records "paranoid.... |
200,373 | <p>I want to filter two list with any fastest method in python script. I have used the built-in <code>filter()</code> method for this purpose. but it is quite slow and taking too much time because I have very big list, I think more than 5 million item in each list or may be more.
I do not know how I will make it. Plea... | [
{
"answer_id": 200395,
"author": "Vinko Vrsalovic",
"author_id": 5190,
"author_profile": "https://Stackoverflow.com/users/5190",
"pm_score": 2,
"selected": false,
"text": "<p>I guess filter() is as fast as you can possibly get without having to code the filtering function in C (and in th... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200373",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17451/"
] | I want to filter two list with any fastest method in python script. I have used the built-in `filter()` method for this purpose. but it is quite slow and taking too much time because I have very big list, I think more than 5 million item in each list or may be more.
I do not know how I will make it. Please if anybody ... | Maybe your lists are too large and do not fit in memory, and you experience [thrashing](http://en.wikipedia.org/wiki/Thrash_(computer_science)).
If the sources are in files, you do not need the whole list in memory all at once. Try using *[itertools](https://docs.python.org/2/library/itertools.html#itertools.ifilter)*,... |
200,378 | <p>The CSS syntax highlighting in vim is not entirely optimal. For example: </p>
<pre><code>div.special_class
</code></pre>
<p>stops the highlighting at the <code>_</code>. </p>
<p>Is there an improved highlighter that doesn't bite on an underscore?</p>
<p>Update:
I'm using VIM - Vi IMproved 7.1 (2007 May 12, compi... | [
{
"answer_id": 200389,
"author": "Tomalak",
"author_id": 18771,
"author_profile": "https://Stackoverflow.com/users/18771",
"pm_score": 1,
"selected": false,
"text": "<p>What version of vim are you using?</p>\n\n<p>My css.vim is</p>\n\n<pre><code>\" Vim syntax file\n\" Language: Cascading... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200378",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1896/"
] | The CSS syntax highlighting in vim is not entirely optimal. For example:
```
div.special_class
```
stops the highlighting at the `_`.
Is there an improved highlighter that doesn't bite on an underscore?
Update:
I'm using VIM - Vi IMproved 7.1 (2007 May 12, compiled Jun 17 2008 15:22:40)
and the header of my css... | I don't have that problem. This is the header of my syntax file:
```
" Vim syntax file
" Language: Cascading Style Sheets
" Maintainer: Claudio Fleiner <claudio@fleiner.com>
" URL: http://www.fleiner.com/vim/syntax/css.vim
" Last Change: 2007 Nov 06
" CSS2 by Nikolai Weibull
" Full CSS2, HTML4 support by Yeti
... |
200,386 | <p>I want to set some attributes just before the object is serialized, but as it can be serialized from several locations, is there a way to do this using the OnSerializing method (or similar) for Xml serialization - my class is largely like this - but the On... methods are not being called...:</p>
<pre><code>[Seriali... | [
{
"answer_id": 200426,
"author": "Kent Boogaart",
"author_id": 5380,
"author_profile": "https://Stackoverflow.com/users/5380",
"pm_score": 4,
"selected": true,
"text": "<p>No, <code>XmlSerializer</code> does not support this. If you're using .NET 3.0 or later, take a look at the <code>Da... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200386",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48310/"
] | I want to set some attributes just before the object is serialized, but as it can be serialized from several locations, is there a way to do this using the OnSerializing method (or similar) for Xml serialization - my class is largely like this - but the On... methods are not being called...:
```
[Serializable]
[XmlRoo... | No, `XmlSerializer` does not support this. If you're using .NET 3.0 or later, take a look at the `DataContractSerializer`. |
200,387 | <p>I have two multidimensional arrays (well actually they're only 2D) which have inferred size. How do I deep clone them? Here's what I have gotten so far:</p>
<pre><code>public foo(Character[][] original){
clone = new Character[original.length][];
for(int i = 0; i < original.length; i++)
clone[i]... | [
{
"answer_id": 200418,
"author": "abahgat",
"author_id": 27565,
"author_profile": "https://Stackoverflow.com/users/27565",
"pm_score": 2,
"selected": false,
"text": "<p>You might want to check out the <a href=\"http://java.sun.com/j2se/1.5.0/docs/api/java/util/Arrays.html\" rel=\"nofollo... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200387",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have two multidimensional arrays (well actually they're only 2D) which have inferred size. How do I deep clone them? Here's what I have gotten so far:
```
public foo(Character[][] original){
clone = new Character[original.length][];
for(int i = 0; i < original.length; i++)
clone[i] = (Character[]) ... | ```
/**Creates an independent copy(clone) of the boolean array.
* @param array The array to be cloned.
* @return An independent 'deep' structure clone of the array.
*/
public static boolean[][] clone2DArray(boolean[][] array) {
int rows=array.length ;
//int rowIs=array[0].length ;
//clone the 'shallow' ... |
200,393 | <p>I'm rebuilding a site with a lot of incoming links, and the URL structure is completely changing. I'm using the stock mod_rewrite solution to redirect all old links to new pages.
However, as I'm sure a few links will slip through the net, I've built a small script that runs on my custom 404 page, to log the incoming... | [
{
"answer_id": 200418,
"author": "abahgat",
"author_id": 27565,
"author_profile": "https://Stackoverflow.com/users/27565",
"pm_score": 2,
"selected": false,
"text": "<p>You might want to check out the <a href=\"http://java.sun.com/j2se/1.5.0/docs/api/java/util/Arrays.html\" rel=\"nofollo... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200393",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26107/"
] | I'm rebuilding a site with a lot of incoming links, and the URL structure is completely changing. I'm using the stock mod\_rewrite solution to redirect all old links to new pages.
However, as I'm sure a few links will slip through the net, I've built a small script that runs on my custom 404 page, to log the incoming v... | ```
/**Creates an independent copy(clone) of the boolean array.
* @param array The array to be cloned.
* @return An independent 'deep' structure clone of the array.
*/
public static boolean[][] clone2DArray(boolean[][] array) {
int rows=array.length ;
//int rowIs=array[0].length ;
//clone the 'shallow' ... |
200,422 | <p>I need to call a <a href="http://en.wikipedia.org/wiki/VBScript" rel="noreferrer">VBScript</a> file (.vbs file extension) in my C# Windows application.
How can I do this? </p>
<p>There is an add-in to access a VBScript file
in Visual Studio.
But I need to access the script in code behind. How to do this?</p>
| [
{
"answer_id": 200429,
"author": "Ilya Kochetov",
"author_id": 15329,
"author_profile": "https://Stackoverflow.com/users/15329",
"pm_score": 7,
"selected": true,
"text": "<p>The following code will execute a VBScript script with no prompts or errors and no shell logo.</p>\n\n<pre><code>S... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200422",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22162/"
] | I need to call a [VBScript](http://en.wikipedia.org/wiki/VBScript) file (.vbs file extension) in my C# Windows application.
How can I do this?
There is an add-in to access a VBScript file
in Visual Studio.
But I need to access the script in code behind. How to do this? | The following code will execute a VBScript script with no prompts or errors and no shell logo.
```
System.Diagnostics.Process.Start(@"cscript //B //Nologo c:\scripts\vbscript.vbs");
```
A more complex technique would be to use:
```
Process scriptProc = new Process();
scriptProc.StartInfo.FileName = @"cscript";
scr... |
200,430 | <p>I've tried a couple of approaches to update a column in a mySQL database table from another table but am not having any luck. </p>
<p>I read somewhere that version 3.5.2 does not support multi-table updates and I need a code-based solution - is that correct?</p>
<p>If not can anybody point me in the right directio... | [
{
"answer_id": 200443,
"author": "Node",
"author_id": 7190,
"author_profile": "https://Stackoverflow.com/users/7190",
"pm_score": 0,
"selected": false,
"text": "<p>Multi-table updates are not support in MySQL <= 4.0.4\nI would highly recommend to update your server to MySQL 5.0.xx</p>... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200430",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9948/"
] | I've tried a couple of approaches to update a column in a mySQL database table from another table but am not having any luck.
I read somewhere that version 3.5.2 does not support multi-table updates and I need a code-based solution - is that correct?
If not can anybody point me in the right direction using sql?
``... | When I used to use MySQL that did not support either subqueries or multi-table updates, I used a trick to do what you're describing. Run a query whose results are themselves SQL statements, and then save the output and run that as an SQL script.
```
SELECT CONCAT(
'UPDATE products SET products_ordered = ',
SUM(... |
200,439 | <p>I'm sorry for this very newbish question, I'm not much given into web development. I've got this cool JavaScript in a .js file that we want to use on a small web site. (It's a script to run Cooliris on it).</p>
<p>How do use the .js file or attach it to my HTML code?</p>
| [
{
"answer_id": 200448,
"author": "gizmo",
"author_id": 9396,
"author_profile": "https://Stackoverflow.com/users/9396",
"pm_score": 3,
"selected": false,
"text": "<pre><code><script type=\"text/javascript\" src=\"myfile.js\"></script>\n</code></pre>\n\n<p>Usually inserted in t... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200439",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26004/"
] | I'm sorry for this very newbish question, I'm not much given into web development. I've got this cool JavaScript in a .js file that we want to use on a small web site. (It's a script to run Cooliris on it).
How do use the .js file or attach it to my HTML code? | Just include this line anywhere in your HTML page:
```
<script type="text/javascript" src="yourfile.js"></script>
```
Don't forget the closing tag as IE won't recongize it without a separate closing tag. |
200,470 | <p>We have found out that Firefox (at least v3) and Safari don't properly cache images referenced from a css file. The images are cached, but they are never refreshed, even if you change them on the server. Once Firefox has the image in the cache, it will never check if it has changed.</p>
<p>Our css file looks like t... | [
{
"answer_id": 200481,
"author": "Drew Noakes",
"author_id": 24874,
"author_profile": "https://Stackoverflow.com/users/24874",
"pm_score": 0,
"selected": false,
"text": "<p>Try holding the SHIFT key while you click reload (or press <kbd>F5</kbd>).</p>\n\n<p>Otherwise, use a tool such as ... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200470",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12416/"
] | We have found out that Firefox (at least v3) and Safari don't properly cache images referenced from a css file. The images are cached, but they are never refreshed, even if you change them on the server. Once Firefox has the image in the cache, it will never check if it has changed.
Our css file looks like this:
```
... | I would just add a querystring value to the image url. I usually just create a "version number" and increment it every time the image changes:
```
div#news {
background: url(images/newsitem_background.jpg?v=00001) no-repeat;
...
}
``` |
200,476 | <p>Let's say I have a class</p>
<pre><code>public class ItemController:Controller
{
public ActionResult Login(int id)
{
return View("Hi", id);
}
}
</code></pre>
<p>On a page that is not located at the Item folder, where <code>ItemController</code> resides, I want to create a link to the <code>Logi... | [
{
"answer_id": 201206,
"author": "Adhip Gupta",
"author_id": 384,
"author_profile": "https://Stackoverflow.com/users/384",
"pm_score": 4,
"selected": false,
"text": "<pre><code>Html.ActionLink(article.Title, \"Login/\" + article.ArticleID, 'Item\") \n</code></pre>\n"
},
{
"answer... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200476",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3834/"
] | Let's say I have a class
```
public class ItemController:Controller
{
public ActionResult Login(int id)
{
return View("Hi", id);
}
}
```
On a page that is not located at the Item folder, where `ItemController` resides, I want to create a link to the `Login` method. So which `Html.ActionLink` meth... | I think what you want is this:
ASP.NET MVC1
------------
```
Html.ActionLink(article.Title,
"Login", // <-- Controller Name.
"Item", // <-- ActionMethod
new { id = article.ArticleID }, // <-- Route arguments.
null // <-- htmlArguments .. which are n... |
200,484 | <p>I'm trying to create a use-once HTTP server to handle a single callback and need help with finding a free TCP port in Ruby.</p>
<p>This is the skeleton of what I'm doing:</p>
<pre><code>require 'socket'
t = STDIN.read
port = 8081
while s = TCPServer.new('127.0.0.1', port).accept
puts s.gets
s.print "HTTP/1.1 2... | [
{
"answer_id": 200517,
"author": "gnud",
"author_id": 27204,
"author_profile": "https://Stackoverflow.com/users/27204",
"pm_score": -1,
"selected": true,
"text": "<p>I guess you could try all ports > 5000 (for example) in sequence. But how will you communicate to the client program what ... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200484",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13455/"
] | I'm trying to create a use-once HTTP server to handle a single callback and need help with finding a free TCP port in Ruby.
This is the skeleton of what I'm doing:
```
require 'socket'
t = STDIN.read
port = 8081
while s = TCPServer.new('127.0.0.1', port).accept
puts s.gets
s.print "HTTP/1.1 200/OK\rContent-type: ... | I guess you could try all ports > 5000 (for example) in sequence. But how will you communicate to the client program what port you are listening to? It seems simpler to decide on a port, and then make it easily configurable, if you need to move your script between different enviroments.
For HTTP, the standard port is ... |
200,488 | <p>How would I set an image to come from a theme directory (my theme changes so I don't want to directly reference) I am sure this is possible but every example I find doesn't seem to work. They are usually along the lines of:</p>
<p>asp:image ID="Image1" runat="server" ImageUrl="~/Web/Mode1.jpg" /</p>
<p>where Web w... | [
{
"answer_id": 200840,
"author": "Joe",
"author_id": 13087,
"author_profile": "https://Stackoverflow.com/users/13087",
"pm_score": 0,
"selected": false,
"text": "<p>Not sure if I understood your question right, but if you have an image in a skin file, such as the following, it will come ... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200488",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16989/"
] | How would I set an image to come from a theme directory (my theme changes so I don't want to directly reference) I am sure this is possible but every example I find doesn't seem to work. They are usually along the lines of:
asp:image ID="Image1" runat="server" ImageUrl="~/Web/Mode1.jpg" /
where Web would be a sub dir... | If you are wanting to reference an Image in your Theme folder, then I suggesting using a SkinId. Inside the skin file of each Theme Folder you would define something like this
```
<asp:Image runat="server" SkinId="HomeImage" ImageUrl="Images/HomeImage.gif" />
```
When you go to use the image in your code you do some... |
200,513 | <p>i have a bunch of sql scripts that should upgrade the database when the java web application starts up.</p>
<p>i tried using the ibatis scriptrunner, but it fails gloriously when defining triggers, where the ";" character does not mark an end of statement.</p>
<p>now i have written my own version of a script runne... | [
{
"answer_id": 200608,
"author": "anjanb",
"author_id": 11142,
"author_profile": "https://Stackoverflow.com/users/11142",
"pm_score": 2,
"selected": false,
"text": "<p>sqlplus : yes you can. I run sqlplus from within Xemacs(editor) all the time. So, you can run sqlplus in an interpreted ... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200513",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16542/"
] | i have a bunch of sql scripts that should upgrade the database when the java web application starts up.
i tried using the ibatis scriptrunner, but it fails gloriously when defining triggers, where the ";" character does not mark an end of statement.
now i have written my own version of a script runner, which basicall... | The iBATIS ScriptRunner has a `setDelimiter(String, boolean)` method. This allows you to have a string other than ";" to be the separator between SQL statements.
In your Oracle SQL script, separate the statements with a "/" (slash).
In your Java code, before calling the `runScript` do a `setDelimter("/", false)` whic... |
200,525 | <p>Here is the input (html, not xml):</p>
<pre><code>... html content ...
<tag1> content for tag 1 </tag1>
<tag2> content for tag 2 </tag2>
<tag3> content for tag 3 </tag3>
... html content ...
</code></pre>
<p>I would like to get 3 matches, each with two groups. First group would ... | [
{
"answer_id": 200540,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 1,
"selected": false,
"text": "<p>Is the data proper xml, or does it just look like it?</p>\n\n<p>If it is html, then the <a href=\"http://www.codep... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200525",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27787/"
] | Here is the input (html, not xml):
```
... html content ...
<tag1> content for tag 1 </tag1>
<tag2> content for tag 2 </tag2>
<tag3> content for tag 3 </tag3>
... html content ...
```
I would like to get 3 matches, each with two groups. First group would contain the name of the tag and the second group would contain... | I don't see why you would want to use match group names for that.
Here is a regular expression that would match tag name and tag content into numbered sub matches.
```
<(tag1|tag2|tag3)>(.*?)</$1>
```
Here is a variant with .NET style group names
```
<(?'name'tag1|tag2|tag3)>(?'value'.*?)</\k'name'>.
```
EDIT
R... |
200,527 | <p>I collect statistics on IP addresses from where users visit my site and I have noticed what there are only two IP addresses presented, 172.16.16.1 and 172.16.16.248. The property I use to determine IP address is</p>
<pre><code>Request.UserHostAddress
</code></pre>
<p>What could be a reason of IP address informatio... | [
{
"answer_id": 200546,
"author": "Node",
"author_id": 7190,
"author_profile": "https://Stackoverflow.com/users/7190",
"pm_score": 1,
"selected": false,
"text": "<p>I assume you are behind a NAT/Reverse Proxy so I think you have to use:</p>\n\n<pre><code>Request.ServerVariables(\"REMOTE_A... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200527",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11256/"
] | I collect statistics on IP addresses from where users visit my site and I have noticed what there are only two IP addresses presented, 172.16.16.1 and 172.16.16.248. The property I use to determine IP address is
```
Request.UserHostAddress
```
What could be a reason of IP address information losing? All the users ar... | This looks like the work of a reverse proxy.
When you use a reverse proxy, the client connects to the proxy, which itself opens a new connection to your server. Since ASP.NET uses the infos of the incoming connection to fill the user address, you get the address of the reverse proxy.
If you are indeed in this configur... |
200,545 | <p>I have a public facing website that has been receiving a number of SQL injection attacks over the last few weeks. I exclusively use parameterised stored procedures so I believe that there has been no <em>successful</em> attacks, but a recent log showed an interesting technique:</p>
<p><em>Line breaks added for cla... | [
{
"answer_id": 200548,
"author": "Ishmaeel",
"author_id": 227,
"author_profile": "https://Stackoverflow.com/users/227",
"pm_score": 6,
"selected": true,
"text": "<p>Below is the decoded SQL that they were trying to push:</p>\n\n<pre><code>DECLARE @T varchar(255),\n @C varchar(4000... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200545",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/993/"
] | I have a public facing website that has been receiving a number of SQL injection attacks over the last few weeks. I exclusively use parameterised stored procedures so I believe that there has been no *successful* attacks, but a recent log showed an interesting technique:
*Line breaks added for clarity*
```
http://ww... | Below is the decoded SQL that they were trying to push:
```
DECLARE @T varchar(255),
@C varchar(4000)
DECLARE Table_Cursor CURSOR FOR SELECT a.name,b.name
FROM sysobjects a,syscolumns b
WHERE a.id=b.id
AND a.xtype='u'
AND (b.xtype=99 OR b.xtype=35 OR b.xtype=231 OR b.xtype=167)
OPEN Table_Cursor FETCH N... |
200,550 | <p>I was just wondering what (if any) the difference was between the following two message traps in MFC for the function, OnSize(..).</p>
<h1>1 - Via Message map:</h1>
<pre><code>BEGIN_MESSAGE_MAP(CClassWnd, CBaseClassWnd)
...
ON_WM_SIZE()
..
END_MESSAGE_MAP()
</code></pre>
<h1>2 - Via afx_message:</h1>
<pre><c... | [
{
"answer_id": 200569,
"author": "Gerald",
"author_id": 19404,
"author_profile": "https://Stackoverflow.com/users/19404",
"pm_score": 2,
"selected": false,
"text": "<p>afx_msg is just an empty macro, it's basically just there to denote that the method is an MFC message handler for readab... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200550",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18664/"
] | I was just wondering what (if any) the difference was between the following two message traps in MFC for the function, OnSize(..).
1 - Via Message map:
====================
```
BEGIN_MESSAGE_MAP(CClassWnd, CBaseClassWnd)
...
ON_WM_SIZE()
..
END_MESSAGE_MAP()
```
2 - Via afx\_message:
=====================
```
... | Both parts are necessary to add a message handler to a class. The message map should be declared inside your class, together with declarations for any message handler functions (e.g, `OnSize`).
```
class CClassWnd : public CBaseClassWnd {
...
afx_msg void OnSize(UINT nType, int cx, int cy);
DECLARE_MESSAGE... |
200,574 | <p>I'd like to do the equivalent of the following in LINQ, but I can't figure out how:</p>
<pre><code>IEnumerable<Item> items = GetItems();
items.ForEach(i => i.DoStuff());
</code></pre>
<p>What is the real syntax?</p>
| [
{
"answer_id": 200584,
"author": "Fredrik Kalseth",
"author_id": 1710,
"author_profile": "https://Stackoverflow.com/users/1710",
"pm_score": 11,
"selected": true,
"text": "<p>There is no ForEach extension for <code>IEnumerable</code>; only for <code>List<T></code>. So you could do<... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200574",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/192/"
] | I'd like to do the equivalent of the following in LINQ, but I can't figure out how:
```
IEnumerable<Item> items = GetItems();
items.ForEach(i => i.DoStuff());
```
What is the real syntax? | There is no ForEach extension for `IEnumerable`; only for `List<T>`. So you could do
```
items.ToList().ForEach(i => i.DoStuff());
```
Alternatively, write your own ForEach extension method:
```
public static void ForEach<T>(this IEnumerable<T> enumeration, Action<T> action)
{
foreach(T item in enumeration)
... |
200,578 | <p>I have some auto-generated code which effectively writes out the following in a bunch of different places in some code:</p>
<pre><code>no warnings 'uninitialized';
local %ENV = %ENV;
local $/ = $/;
local @INC = @INC;
local %INC = %INC;
local $_ = $_;
local $| = $|;
local %SIG = %SIG;
use warnings 'uninitializ... | [
{
"answer_id": 200603,
"author": "Peter Kühne",
"author_id": 27351,
"author_profile": "https://Stackoverflow.com/users/27351",
"pm_score": 2,
"selected": false,
"text": "<p>I'm not terribly familiar with Perl, so forgive me if it is actually possible. But normally, variables local to a s... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200578",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8003/"
] | I have some auto-generated code which effectively writes out the following in a bunch of different places in some code:
```
no warnings 'uninitialized';
local %ENV = %ENV;
local $/ = $/;
local @INC = @INC;
local %INC = %INC;
local $_ = $_;
local $| = $|;
local %SIG = %SIG;
use warnings 'uninitialized';
```
Whe... | Perhaps you can arrange for the code that uses those locals to be generated as a closure? Then you could
```
sub run_with_env {
my ($sub, @args) = @_;
no warnings 'uninitialized';
local %ENV = %ENV;
local $/ = $/;
local @INC = @INC;
local %INC = %INC;
local $_ = $_;
local $| = $|;... |
200,587 | <p>I'm trying to set up <a href="http://www.autohotkey.com/" rel="nofollow noreferrer">AutoHotkey</a> macros for some common tasks, and I want the hotkeys to mimic Visual Studio's "two-step shortcut" behaviour - i.e. pressing <kbd>Ctrl</kbd>-<kbd>K</kbd> will enable "macro mode"; within macro mode, pressing certain key... | [
{
"answer_id": 201981,
"author": "Andres",
"author_id": 1815,
"author_profile": "https://Stackoverflow.com/users/1815",
"pm_score": 4,
"selected": true,
"text": "<p>This Autohotkey script, when you press <kbd>ctrl</kbd>+<kbd>k</kbd>, will wait for you to press a key and if you press <kbd... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200587",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5017/"
] | I'm trying to set up [AutoHotkey](http://www.autohotkey.com/) macros for some common tasks, and I want the hotkeys to mimic Visual Studio's "two-step shortcut" behaviour - i.e. pressing `Ctrl`-`K` will enable "macro mode"; within macro mode, pressing certain keys will run a macro and then disable 'macro mode', and any ... | This Autohotkey script, when you press `ctrl`+`k`, will wait for you to press a key and if you press `d`, it will input the current date.
```
^k::
Input Key, L1
FormatTime, Time, , yyyy-MM-dd
if Key = d
Send %Time%
return
``` |
200,602 | <p>What is the best way to count the time between two datetime values fetched from MySQL when I need to count only the time between hours 08:00:00-16:00:00.</p>
<p>For example if I have values 2008-10-13 18:00:00 and 2008-10-14 10:00:00 the time difference should be 02:00:00.</p>
<p>Can I do it with SQL or what is th... | [
{
"answer_id": 200606,
"author": "Chris S",
"author_id": 21574,
"author_profile": "https://Stackoverflow.com/users/21574",
"pm_score": 3,
"selected": false,
"text": "<p>The <a href=\"http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_timediff\" rel=\"noreferrer\... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200602",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | What is the best way to count the time between two datetime values fetched from MySQL when I need to count only the time between hours 08:00:00-16:00:00.
For example if I have values 2008-10-13 18:00:00 and 2008-10-14 10:00:00 the time difference should be 02:00:00.
Can I do it with SQL or what is the best way to do ... | The [TIMEDIFF](http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_timediff) function
>
> TIMEDIFF() returns expr1 – expr2
> expressed as a time value. expr1 and
> expr2 are time or date-and-time
> expressions, but both must be of the
> same type.
>
>
>
```
mysql> SELECT TIMEDIFF('200... |
200,617 | <p>If I have a <code>Linq</code> to <code>SQL</code> expression like this:</p>
<pre><code> from subscription in dbContext.Subscriptions
where subscription.Expires > DateTime.Now
select subscription
</code></pre>
<p>I want this to to use the SQL Servers <code>GETDATE()</code> function instead of the time of the m... | [
{
"answer_id": 200639,
"author": "Per Hornshøj-Schierbeck",
"author_id": 11619,
"author_profile": "https://Stackoverflow.com/users/11619",
"pm_score": 0,
"selected": false,
"text": "<p>You could use the ExecuteQuery to gain full control of the sql <a href=\"http://weblogs.asp.net/scottgu... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8547/"
] | If I have a `Linq` to `SQL` expression like this:
```
from subscription in dbContext.Subscriptions
where subscription.Expires > DateTime.Now
select subscription
```
I want this to to use the SQL Servers `GETDATE()` function instead of the time of the machine running the `C#` program.
The next question would be h... | Try [this](http://peteohanlon.wordpress.com/2008/01/11/sql-server-getdate-and-linq-to-sql/):
```
[Function(Name="GetDate", IsComposable=true)]
public DateTime GetSystemDate()
{
MethodInfo mi = MethodBase.GetCurrentMethod() as MethodInfo;
return (DateTime)this.ExecuteMethodCall(this, mi, new object[]{... |
200,640 | <p>Here's the information <a href="http://www.php.net/manual/en/language.basic-syntax.php" rel="noreferrer">according to the official documentation</a>:</p>
<blockquote>
<p>There are four different pairs of
opening and closing tags which can be
used in PHP. Two of those, <code><?php ?></code>
and <code>&... | [
{
"answer_id": 200649,
"author": "Vinko Vrsalovic",
"author_id": 5190,
"author_profile": "https://Stackoverflow.com/users/5190",
"pm_score": 5,
"selected": false,
"text": "<p>Because the confusion it can generate with XML declarations. Many people <a href=\"http://michaelkimsal.com/blog/... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200640",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1896/"
] | Here's the information [according to the official documentation](http://www.php.net/manual/en/language.basic-syntax.php):
>
> There are four different pairs of
> opening and closing tags which can be
> used in PHP. Two of those, `<?php ?>`
> and `<script language="php"> </script>`,
> are always available. The oth... | There must be a clear distinction between the PHP short tag (`<?`) and shorthand echo tag (`<?=`)
The former is prohibited by the [PHP Coding standard](https://www.php-fig.org/psr/psr-1/), mostly out of common sense because it's a PITA if you ever have to move your code to a server where it's not supported (and you ca... |
200,662 | <p>Is there a way to make sure a (large, 300K) background picture is always displayed first BEFORE any other content is shown on the page?</p>
<p>On the server we have access to PHP.</p>
| [
{
"answer_id": 200672,
"author": "Kent Fredric",
"author_id": 15614,
"author_profile": "https://Stackoverflow.com/users/15614",
"pm_score": 3,
"selected": true,
"text": "<p>All the html content is served and parsed before it even starts to fetch the image, so you have a problem before yo... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200662",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4639/"
] | Is there a way to make sure a (large, 300K) background picture is always displayed first BEFORE any other content is shown on the page?
On the server we have access to PHP. | All the html content is served and parsed before it even starts to fetch the image, so you have a problem before you start.
You could circumvent this by programmatically hiding the content, and then triggering a "show" of it when the image is loaded.
ie:
```
<html>
<body>
<image here/>
<div id="content"... |
200,663 | <p>I need a way to get the elapsed time (wall-clock time) since a program started, in a way that is resilient to users meddling with the system clock.</p>
<p>On windows, the non standard clock() implementation doesn't do the trick, as it appears to work just by calculating the difference with the time sampled at start... | [
{
"answer_id": 200678,
"author": "Steve Moyer",
"author_id": 17008,
"author_profile": "https://Stackoverflow.com/users/17008",
"pm_score": -1,
"selected": false,
"text": "<p>If you have a network connection, you can always acquire the time from an NTP server. This will obviously not be ... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200663",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I need a way to get the elapsed time (wall-clock time) since a program started, in a way that is resilient to users meddling with the system clock.
On windows, the non standard clock() implementation doesn't do the trick, as it appears to work just by calculating the difference with the time sampled at start up, so th... | I guess you can always start some kind of timer. For example under Linux a thread
that would have a loop like this :
```
static void timer_thread(void * arg)
{
struct timespec delay;
unsigned int msecond_delay = ((app_state_t*)arg)->msecond_delay;
delay.tv_sec = 0;
delay.tv_nsec = msec... |
200,676 | <p>I want to sprintf() an unsigned long long value in visual C++ 6.0 (plain C).</p>
<pre><code>char buf[1000]; //bad coding
unsigned __int64 l = 12345678;
char t1[6] = "test1";
char t2[6] = "test2";
sprintf(buf, "%lli, %s, %s", l, t1, t2);
</code></pre>
<p>gives the result</p>
<pre><code>12345678, (null), test1
... | [
{
"answer_id": 200696,
"author": "gimel",
"author_id": 6491,
"author_profile": "https://Stackoverflow.com/users/6491",
"pm_score": -1,
"selected": false,
"text": "<p>Apparently, you did not assign <code>additionaltext</code> to the necessary <code>char *</code> (string). Note that the <c... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200676",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27800/"
] | I want to sprintf() an unsigned long long value in visual C++ 6.0 (plain C).
```
char buf[1000]; //bad coding
unsigned __int64 l = 12345678;
char t1[6] = "test1";
char t2[6] = "test2";
sprintf(buf, "%lli, %s, %s", l, t1, t2);
```
gives the result
```
12345678, (null), test1
```
(watch that `test2` is not prin... | To print an `unsigned __int64` value in Visual C++ 6.0 you should use `%I64u`, not `%lli` (refer to [this page](http://msdn.microsoft.com/en-us/library/aa272936%28VS.60%29.aspx) on MSDN). `%lli` is only supported in Visual Studio 2005 and later versions.
So, your code should be:
```
sprintf(buf, "%I64u, %s, %s", l, t1... |
200,691 | <p>How can I use/display characters like ♥, ♦, ♣, or ♠ in Java/Eclipse?</p>
<p>When I try to use them directly, e.g. in the source code, Eclipse cannot save the file.</p>
<p>What can I do?</p>
<p>Edit: How can I find the unicode escape sequence?</p>
| [
{
"answer_id": 200698,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 2,
"selected": false,
"text": "<p>Either change your encoding to one which will cope, e.g. UTF-8, or find the relevant Unicode number and use a \\uxxxx... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200691",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12860/"
] | How can I use/display characters like ♥, ♦, ♣, or ♠ in Java/Eclipse?
When I try to use them directly, e.g. in the source code, Eclipse cannot save the file.
What can I do?
Edit: How can I find the unicode escape sequence? | The problem is that the characters you are using cannot be represented in the encoding you have the file set to (Cp1252). The way I see it, you essentially have two options:
Option 1. **Change the encoding.** [According to IBM](http://publib.boulder.ibm.com/infocenter/eruinf/v2r1m1/index.jsp?topic=/com.ibm.iru.doc/con... |
200,724 | <p>Is there a way to have XAML properties scale along with the size of the uielements they belong to?</p>
<p>In essence, I have a control template that I have created too large for it's use/ mainly because I want to use the same control with different sizes. The problem is that I can set the control size to Auto (in t... | [
{
"answer_id": 200909,
"author": "Enrico Campidoglio",
"author_id": 26396,
"author_profile": "https://Stackoverflow.com/users/26396",
"pm_score": 2,
"selected": true,
"text": "<p>You could try to bind the width and height of the control inside the template to the width and height respect... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200724",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6251/"
] | Is there a way to have XAML properties scale along with the size of the uielements they belong to?
In essence, I have a control template that I have created too large for it's use/ mainly because I want to use the same control with different sizes. The problem is that I can set the control size to Auto (in the Control... | You could try to bind the width and height of the control inside the template to the width and height respectively of the templated control at runtime. Something like:
```
<Button>
<Button.Template>
<ControlTemplate TargetType={x:Type Button}>
<Border Width="{TemplateBinding Property=ActualWidt... |
200,729 | <p>An initial draft of requirements specification has been completed and now it is time to take stock of requirements, <a href="https://stackoverflow.com/questions/186716/when-reviewing-requirements-specification-what-deadly-sins-need-to-be-addressed">review the specification</a>. Part of this process is to make sure t... | [
{
"answer_id": 200740,
"author": "Galwegian",
"author_id": 3201,
"author_profile": "https://Stackoverflow.com/users/3201",
"pm_score": 3,
"selected": false,
"text": "<p><strong>Continued, frequent, frank, and two-way communication with the customer</strong> strikes me as the main 'techni... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200729",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22088/"
] | An initial draft of requirements specification has been completed and now it is time to take stock of requirements, [review the specification](https://stackoverflow.com/questions/186716/when-reviewing-requirements-specification-what-deadly-sins-need-to-be-addressed). Part of this process is to make sure that there are ... | evaluate the lifecycle of the elements of the model with respect to a generic/overall model such as
```
acquisition --> stewardship --> disposal
```
* do you know where every entity comes from and how you're going to get it into your system?
* do you know where every entity, once acquired, will reside, and for how l... |
200,737 | <p>I want to get the full path of the running process (executable) without having root permission using C++ code. Can someone suggest a way to achieve this.</p>
<p>on Linux platforms i can do it by using following way.</p>
<pre><code>char exepath[1024] = {0};
char procid[1024] = {0};
char exelink[1024] = {0};
sprint... | [
{
"answer_id": 201248,
"author": "Caleb Huitt - cjhuitt",
"author_id": 9876,
"author_profile": "https://Stackoverflow.com/users/9876",
"pm_score": 0,
"selected": false,
"text": "<p>I have done this before in a general case. The general idea is to grab argv[0], and do some processing on ... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200737",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27804/"
] | I want to get the full path of the running process (executable) without having root permission using C++ code. Can someone suggest a way to achieve this.
on Linux platforms i can do it by using following way.
```
char exepath[1024] = {0};
char procid[1024] = {0};
char exelink[1024] = {0};
sprintf(procid, "%u", getpi... | First, I'd like to comment on your Linux solution: it is about 5 times as long as it needs to be, and performs a lot of completely unnecessary operations, as well as using 1024 magic number which is just plain wrong:
```
$ grep PATH_MAX /usr/include/linux/limits.h
#define PATH_MAX 4096 /* # chars in a path ... |
200,738 | <p>Using the PHP <a href="http://www.php.net/pack" rel="noreferrer">pack()</a> function, I have converted a string into a binary hex representation:</p>
<pre><code>$string = md5(time); // 32 character length
$packed = pack('H*', $string);
</code></pre>
<p>The H* formatting means "Hex string, high nibble first".</p>
... | [
{
"answer_id": 200761,
"author": "MvdD",
"author_id": 18044,
"author_profile": "https://Stackoverflow.com/users/18044",
"pm_score": 3,
"selected": false,
"text": "<p>In Python you use the <a href=\"https://docs.python.org/2/library/struct.html\" rel=\"nofollow noreferrer\">struct</a> mod... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200738",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2183/"
] | Using the PHP [pack()](http://www.php.net/pack) function, I have converted a string into a binary hex representation:
```
$string = md5(time); // 32 character length
$packed = pack('H*', $string);
```
The H\* formatting means "Hex string, high nibble first".
To unpack this in PHP, I would simply use the [unpack()](... | There's an easy way to do this with the `binascii` module:
```
>>> import binascii
>>> print binascii.hexlify("ABCZ")
'4142435a'
>>> print binascii.unhexlify("4142435a")
'ABCZ'
```
Unless I'm misunderstanding something about the nibble ordering (high-nibble first is the default… anything different is insane), that s... |
200,742 | <p>I have the following line of text</p>
<pre><code>Reference=*\G{7B35DDAC-FFE2-4435-8A15-CF5C70F23459}#1.0#0#..\..\..\bin\App Components\AcmeFormEngine.dll#ACME Form Engine
</code></pre>
<p>and wish to grab the following as two separate capture groups:</p>
<pre><code>AcmeFormEngine.dll
ACME Form Engine
</code></pre... | [
{
"answer_id": 200758,
"author": "Bartek Szabat",
"author_id": 23774,
"author_profile": "https://Stackoverflow.com/users/23774",
"pm_score": 1,
"selected": false,
"text": "<pre><code> using System.Text.RegularExpressions;\n\n Regex regex = new Regex(\n @\"\\\\(?<filename>[... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200742",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have the following line of text
```
Reference=*\G{7B35DDAC-FFE2-4435-8A15-CF5C70F23459}#1.0#0#..\..\..\bin\App Components\AcmeFormEngine.dll#ACME Form Engine
```
and wish to grab the following as two separate capture groups:
```
AcmeFormEngine.dll
ACME Form Engine
```
Can anyone help? | **I voted for tomalask's non-regex approach.**
However if you HAD to do it with regex, I think you need something like this
```
\\([^\\/?"<>|]+?)\#([^\\/?"<>|]+?)[\r\n]*$
```
This will allow things like - and \_ which are valid in filenames, Its 2 identical groups (each excluding invalid chars for win32 filenames) b... |
200,743 | <p>I need a WiX 3 script to display to display only 2 dialogs: Welcome & Completed. Thats it no need for EULA, folder selection etc. All help appreciated.</p>
| [
{
"answer_id": 259685,
"author": "CheGueVerra",
"author_id": 17787,
"author_profile": "https://Stackoverflow.com/users/17787",
"pm_score": 7,
"selected": true,
"text": "<p>All you need to do is add this in your WIX script, it will give you the WelcomeDlg before the installation and show ... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200743",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22941/"
] | I need a WiX 3 script to display to display only 2 dialogs: Welcome & Completed. Thats it no need for EULA, folder selection etc. All help appreciated. | All you need to do is add this in your WIX script, it will give you the WelcomeDlg before the installation and show the Installation progress, then the Exit Dialog. Don't forget to add the WixUIExtension.dll to your references.
```
<UI Id="UserInterface">
<Property Id="WIXUI_INSTALLDIR" Value="TARGETDIR" />
<Prope... |
200,746 | <p>How do I split strings in J2ME in an effective way?</p>
<p>There is a <a href="http://download.oracle.com/javase/1.4.2/docs/api/java/util/StringTokenizer.html" rel="noreferrer"><code>StringTokenizer</code></a> or <a href="http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html#split%28java.lang.Strin... | [
{
"answer_id": 200760,
"author": "Guido",
"author_id": 12388,
"author_profile": "https://Stackoverflow.com/users/12388",
"pm_score": 2,
"selected": false,
"text": "<p>There is no built in method to split strings. You have to write it on your own using \n<code>String.indexOf()</code> and ... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200746",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3713/"
] | How do I split strings in J2ME in an effective way?
There is a [`StringTokenizer`](http://download.oracle.com/javase/1.4.2/docs/api/java/util/StringTokenizer.html) or [`String.split(String regex)`](http://download.oracle.com/javase/1.5.0/docs/api/java/lang/String.html#split%28java.lang.String%29) in the standard editi... | There are a few implementations of a StringTokenizer class for J2ME. This one by [Ostermiller](http://ostermiller.org/utils/StringTokenizer.html) will most likely include the functionality you need
See also [this page on Mobile Programming Pit Stop](https://web.archive.org/web/20120206073031/http://mobilepit.com:80/09... |
200,752 | <p>I use this code to create a .zip with a list of files:</p>
<pre><code>ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zipFile));
for (int i=0;i<srcFiles.length;i++){
String fileName=srcFiles[i].getName();
ZipEntry zipEntry = new ZipEntry(fileName);
zos.putNextEntry(zipEntry);
Inpu... | [
{
"answer_id": 201085,
"author": "ddimitrov",
"author_id": 18187,
"author_profile": "https://Stackoverflow.com/users/18187",
"pm_score": 0,
"selected": false,
"text": "<p>Depends on the hardware you have (disk speed and file search time). I would say if you are not interested in squeezin... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200752",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/518/"
] | I use this code to create a .zip with a list of files:
```
ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zipFile));
for (int i=0;i<srcFiles.length;i++){
String fileName=srcFiles[i].getName();
ZipEntry zipEntry = new ZipEntry(fileName);
zos.putNextEntry(zipEntry);
InputStream fis = new... | Short answer: I would pick something like 16k.
---
Long answer:
ZIP is using the DEFLATE algorithm for compression (<http://en.wikipedia.org/wiki/DEFLATE>). Deflate is a flavor of Ziv Lempel Welch(search wikipedia for LZW). DEFLATE uses LZ77 and Huffman coding.
This is a dictionary compression, and as far as I know... |
200,755 | <p>In a LINQ to SQL class, why are the properties that are created from the foreign keys <code>EntitySet</code> objects, which implement <code>IEnumerable</code>, where as the objects on the <code>DataContext</code> are <code>Table</code> objects which implement <code>IQueryable</code>?</p>
<p><strong>EDIT:</strong> T... | [
{
"answer_id": 200784,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 2,
"selected": true,
"text": "<p>Tables are effectively a conceptual matter - they really exist on the server, so you need to query to get entries. The... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200755",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27782/"
] | In a LINQ to SQL class, why are the properties that are created from the foreign keys `EntitySet` objects, which implement `IEnumerable`, where as the objects on the `DataContext` are `Table` objects which implement `IQueryable`?
**EDIT:** To clarify, here is an example that illustrates what I'm trying to understand. ... | Tables are effectively a conceptual matter - they really exist on the server, so you need to query to get entries. The foreign key entries are the ones actually fetched by another query, so at that point they're locally available. That's a fairly woolly description, but hopefully it gets over the general concept. |
200,786 | <p>I have a problem with a memory leak in a .NET CF application. </p>
<p>Using <a href="http://blogs.msdn.com/stevenpr/archive/2006/04/17/577636.aspx" rel="nofollow noreferrer">RPM</a> I identified that dynamically creating controls are not garbage collected as expected. Running the same piece of code in .NET Window... | [
{
"answer_id": 200800,
"author": "Mitch Wheat",
"author_id": 16076,
"author_profile": "https://Stackoverflow.com/users/16076",
"pm_score": 1,
"selected": false,
"text": "<p>Are you sure you have a memory leak? The .NET Compact Framework garbage collector works slightly differently to the... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200786",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11123/"
] | I have a problem with a memory leak in a .NET CF application.
Using [RPM](http://blogs.msdn.com/stevenpr/archive/2006/04/17/577636.aspx) I identified that dynamically creating controls are not garbage collected as expected. Running the same piece of code in .NET Window Forms behave differently and disposes the contro... | Some additional information here that explains this behaviour.
[According to Ilya Tumanov](http://forums.microsoft.com/msdn/ShowPost.aspx?PostID=4002811&SiteID=1&mode=1):
>
> **Everything UI related on NETCF is
> intentionally removed from GC scope so
> it is never collected**. This behavior
> is different from d... |
200,810 | <p>I'm trying to create an access control system. </p>
<p>Here's a stripped down example of what the table I'm trying to control access to looks like:</p>
<pre><code>things table:
id group_id name
1 1 thing 1
2 1 thing 2
3 1 thing 3
4 1 thing 4
5 2 thing... | [
{
"answer_id": 200829,
"author": "tvanfosson",
"author_id": 12950,
"author_profile": "https://Stackoverflow.com/users/12950",
"pm_score": 1,
"selected": false,
"text": "<p>I just read a paper last night on this. It has some ideas on how to do this. If you can't use the link on the tit... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200810",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17121/"
] | I'm trying to create an access control system.
Here's a stripped down example of what the table I'm trying to control access to looks like:
```
things table:
id group_id name
1 1 thing 1
2 1 thing 2
3 1 thing 3
4 1 thing 4
5 2 thing 5
```
And the acce... | I don't know the Postgres SQL dialect, but maybe something like:
```
select thing.*, coalesce ( ( select access
from access
where userid = 1
and type = 'thing'
and object_id = thing.id
... |
200,813 | <p>I'm creating a bunch of migrations, some of which are standard "create table" or "modify table" migrations, and some of which modify data. I'm using my actual ActiveRecord models to modify the data, a la:</p>
<pre><code>Blog.all.each do |blog|
update_some_blog_attributes_to_match_new_schema
end
</code></pre>
<p... | [
{
"answer_id": 200815,
"author": "James A. Rosen",
"author_id": 1190,
"author_profile": "https://Stackoverflow.com/users/1190",
"pm_score": 8,
"selected": true,
"text": "<p>The answer is yes!</p>\n\n<pre><code>Blog.reset_column_information\n</code></pre>\n"
},
{
"answer_id": 2008... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200813",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1190/"
] | I'm creating a bunch of migrations, some of which are standard "create table" or "modify table" migrations, and some of which modify data. I'm using my actual ActiveRecord models to modify the data, a la:
```
Blog.all.each do |blog|
update_some_blog_attributes_to_match_new_schema
end
```
The problem is that if I l... | The answer is yes!
```
Blog.reset_column_information
``` |
200,839 | <p>When using resources such as brushes, templates and styles in WPF, they can be specified either as StaticResources </p>
<pre><code><Rectangle Fill="{StaticResource MyBrush}" />
</code></pre>
<p>or as a DynamicResource</p>
<pre><code><ItemsControl ItemTemplate="{DynamicResource MyItemTemplate}" />
</c... | [
{
"answer_id": 200875,
"author": "Phil Wright",
"author_id": 6276,
"author_profile": "https://Stackoverflow.com/users/6276",
"pm_score": 10,
"selected": true,
"text": "<p>A <a href=\"https://msdn.microsoft.com/en-gb/library/cc189045(v=vs.95).aspx\" rel=\"noreferrer\">StaticResource</a> w... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200839",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8521/"
] | When using resources such as brushes, templates and styles in WPF, they can be specified either as StaticResources
```
<Rectangle Fill="{StaticResource MyBrush}" />
```
or as a DynamicResource
```
<ItemsControl ItemTemplate="{DynamicResource MyItemTemplate}" />
```
Most of the times (always?), only one works an... | A [StaticResource](https://msdn.microsoft.com/en-gb/library/cc189045(v=vs.95).aspx) will be resolved and assigned to the property during the loading of the XAML which occurs before the application is actually run. It will only be assigned once and any changes to resource dictionary ignored.
A [DynamicResource](https:/... |
200,842 | <p>We're creating a Interaction design pattern website for a class.
We've been using google docs to create the patterns list during the classes, sharing it with the teacher for evaluation.</p>
<p>So the environment is this:</p>
<ul>
<li>We've been able to fetch a single image from each presentation we want to display... | [
{
"answer_id": 200875,
"author": "Phil Wright",
"author_id": 6276,
"author_profile": "https://Stackoverflow.com/users/6276",
"pm_score": 10,
"selected": true,
"text": "<p>A <a href=\"https://msdn.microsoft.com/en-gb/library/cc189045(v=vs.95).aspx\" rel=\"noreferrer\">StaticResource</a> w... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200842",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26004/"
] | We're creating a Interaction design pattern website for a class.
We've been using google docs to create the patterns list during the classes, sharing it with the teacher for evaluation.
So the environment is this:
* We've been able to fetch a single image from each presentation we want to display, such as: <http://do... | A [StaticResource](https://msdn.microsoft.com/en-gb/library/cc189045(v=vs.95).aspx) will be resolved and assigned to the property during the loading of the XAML which occurs before the application is actually run. It will only be assigned once and any changes to resource dictionary ignored.
A [DynamicResource](https:/... |
200,857 | <p>Was reading up a bit on my C++, and found this article about RTTI (Runtime Type Identification):
<a href="http://msdn.microsoft.com/en-us/library/70ky2y6k(VS.80).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/70ky2y6k(VS.80).aspx</a> . Well, that's another subject :) - However, I stumbled up... | [
{
"answer_id": 200870,
"author": "Greg Rogers",
"author_id": 5963,
"author_profile": "https://Stackoverflow.com/users/5963",
"pm_score": 5,
"selected": false,
"text": "<p>How about this:</p>\n\n<pre><code>const char *getHelloString() const\n{\n return \"HelloWorld!\";\n}\n</code></pre... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200857",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25745/"
] | Was reading up a bit on my C++, and found this article about RTTI (Runtime Type Identification):
<http://msdn.microsoft.com/en-us/library/70ky2y6k(VS.80).aspx> . Well, that's another subject :) - However, I stumbled upon a weird saying in the `type_info`-class, namely about the `::name`-method. It says: "The `type_info... | How about this:
```
const char *getHelloString() const
{
return "HelloWorld!";
}
```
Returning a literal directly means the space for the string is allocated in static storage by the compiler and will be available throughout the duration of the program. |
200,858 | <p>I just noticed that you can do this in C#:</p>
<pre><code>Unit myUnit = 5;
</code></pre>
<p>instead of having to do this:</p>
<pre><code>Unit myUnit = new Unit(5);
</code></pre>
<p>Does anyone know how I can achieve this with my own structs? I had a look at the Unit struct with reflector and noticed the TypeConv... | [
{
"answer_id": 200867,
"author": "Phil Wright",
"author_id": 6276,
"author_profile": "https://Stackoverflow.com/users/6276",
"pm_score": 2,
"selected": false,
"text": "<p>You need to provide a cast operator for the class that takes an Int32.</p>\n"
},
{
"answer_id": 200881,
"... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200858",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21966/"
] | I just noticed that you can do this in C#:
```
Unit myUnit = 5;
```
instead of having to do this:
```
Unit myUnit = new Unit(5);
```
Does anyone know how I can achieve this with my own structs? I had a look at the Unit struct with reflector and noticed the TypeConverter attribute was being used, but after I creat... | You need to provide an implicit conversion operator from int to Unit, like so:
```
public struct Unit
{ // the conversion operator...
public static implicit operator Unit(int value)
{
return new Unit(value);
}
// the boring stuff...
private readonly int val... |
200,869 | <p>I've been trying to call Page Methods from my own JavaScript code but it doesn't work. If I use jQuery AJAX I can sucessfully call the Page Methods, but I need to do this from my own JavaScript code because we can't use third-party libraries (we are building our own library).</p>
<p>Whenever I use jQuery AJAX metho... | [
{
"answer_id": 201208,
"author": "Brendan Kendrick",
"author_id": 13473,
"author_profile": "https://Stackoverflow.com/users/13473",
"pm_score": 2,
"selected": false,
"text": "<p>One relatively easy solution is to have your code-behind implement ICallbackEventHandler.\nIts a little crude ... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200869",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27813/"
] | I've been trying to call Page Methods from my own JavaScript code but it doesn't work. If I use jQuery AJAX I can sucessfully call the Page Methods, but I need to do this from my own JavaScript code because we can't use third-party libraries (we are building our own library).
Whenever I use jQuery AJAX methods I get t... | You're requesting the URL with a GET, while the jQuery code uses a POST. I expect that a Page Method can only be called through a POST, to allow you to include any parameters in the body of your request. You may also need to set the Content-Type of your request to application/json, as the jQuery code does - I don't kno... |
200,878 | <p>Ok, let's see if I can make this make sense. </p>
<p>I have a program written that parses an Excel file and it works just fine. I use the following to get into the file:</p>
<pre><code>string FileToConvert = Server.MapPath(".") + "\\App_Data\\CP-ARFJN-FLAG.XLS";
string connectionString = "Provider=Microsoft.Jet.... | [
{
"answer_id": 200946,
"author": "Ed Harper",
"author_id": 27825,
"author_profile": "https://Stackoverflow.com/users/27825",
"pm_score": 4,
"selected": true,
"text": "<p>It sounds like the XLS file generated by your third-party app may not really be in Excel format - it might actually be... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200878",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14777/"
] | Ok, let's see if I can make this make sense.
I have a program written that parses an Excel file and it works just fine. I use the following to get into the file:
```
string FileToConvert = Server.MapPath(".") + "\\App_Data\\CP-ARFJN-FLAG.XLS";
string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source="... | It sounds like the XLS file generated by your third-party app may not really be in Excel format - it might actually be a tab-delimited text file with an .xls extension.
Try opening it with a text editor and see.
If it is tab delimited, you can ditch the OleDB adapter and open/parse it as a standard text file. |
200,900 | <p>I need to access some members marked internal that are declared in a third party assembly.</p>
<p>I would like to return a value from a particular internal property in a class. Then I'd like to retrieve a value from a property on that returned value. However, these properties return types that are also internal and... | [
{
"answer_id": 200941,
"author": "tvanfosson",
"author_id": 12950,
"author_profile": "https://Stackoverflow.com/users/12950",
"pm_score": 1,
"selected": false,
"text": "<p>You can always retrieve it as an object and use reflection on the returned type to invoke its methods and access its... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200900",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6651/"
] | I need to access some members marked internal that are declared in a third party assembly.
I would like to return a value from a particular internal property in a class. Then I'd like to retrieve a value from a property on that returned value. However, these properties return types that are also internal and declared ... | You just keep digging on the returned value (or the PropertyType of the PropertyInfo):
u
```
sing System;
using System.Reflection;
public class Foo
{
public Foo() {Bar = new Bar { Name = "abc"};}
internal Bar Bar {get;set;}
}
public class Bar
{
internal string Name {get;set;}
}
static class Program
{
... |
200,912 | <p>Some files are uploaded with a reported MIME type:</p>
<pre><code>image/x-citrix-pjpeg
</code></pre>
<p>They are valid jpeg files and I accept them as such.</p>
<p>I was wondering however: why is the MIME type different?<br>
Is there any difference in the format? or was this mimetype invented by some light bulb a... | [
{
"answer_id": 200959,
"author": "Ólafur Waage",
"author_id": 22459,
"author_profile": "https://Stackoverflow.com/users/22459",
"pm_score": 2,
"selected": false,
"text": "<p>The closest i have come to find out what this is, is this thread. Hope it helps.</p>\n\n<p><a href=\"http://forums... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200912",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22674/"
] | Some files are uploaded with a reported MIME type:
```
image/x-citrix-pjpeg
```
They are valid jpeg files and I accept them as such.
I was wondering however: why is the MIME type different?
Is there any difference in the format? or was this mimetype invented by some light bulb at citrix for no apparent reason? | **Update:**
Ok, I did some more searching and testing on this question, and it turns out they're all lying about MIME-type (never trust *any* info send by the client, I know).
I've checked a bunch of files with different encodings (created with libjpeg)
`Official` MIME type for jpeg files: `image/jpeg`
But some... |
200,924 | <p>I'm subclassing a native window (the edit control of a combobox...)</p>
<p>oldWndProc = SetWindowLong(HandleOfCbEditControl, GWL_WNDPROC, newWndProc);</p>
<p>In my subclassing wndproc, I'll have code like this, right, but I can't figure out the syntax for calling the oldWndProc.</p>
<pre><code> int MyWndProc(i... | [
{
"answer_id": 200953,
"author": "kenny",
"author_id": 3225,
"author_profile": "https://Stackoverflow.com/users/3225",
"pm_score": 0,
"selected": false,
"text": "<p>This <a href=\"http://www.pinvoke.net/\" rel=\"nofollow noreferrer\">site</a> will be very helpful with all of your interop... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200924",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9328/"
] | I'm subclassing a native window (the edit control of a combobox...)
oldWndProc = SetWindowLong(HandleOfCbEditControl, GWL\_WNDPROC, newWndProc);
In my subclassing wndproc, I'll have code like this, right, but I can't figure out the syntax for calling the oldWndProc.
```
int MyWndProc(int Msg, int wParam, int lPa... | You'll call [CallWindowProc](http://msdn.microsoft.com/en-us/library/aa452919.aspx) by P/Invoke. Just define the parameters as int variables (as it looks like that's how you defined them in the SetWindowLong call), so something like this:
[DllImport("CallWindowProc"...]
public static extern int CallWindowProc(int prev... |
200,925 | <p>In CakePHP putting a querystring in the url doesn't cause it to be automatically parsed and split like it normally is when the controller is directly invoked. </p>
<p>For example:</p>
<pre><code>$this->testAction('/testing/post?company=utCompany', array('return' => 'vars')) ;
</code></pre>
<p>will result in... | [
{
"answer_id": 201120,
"author": "Ryan Boucher",
"author_id": 27818,
"author_profile": "https://Stackoverflow.com/users/27818",
"pm_score": 2,
"selected": false,
"text": "<p>I have what is either a hack (i.e. may not work for future CakePHP releases) or an undocumented feature.</p>\n\n<p... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200925",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27818/"
] | In CakePHP putting a querystring in the url doesn't cause it to be automatically parsed and split like it normally is when the controller is directly invoked.
For example:
```
$this->testAction('/testing/post?company=utCompany', array('return' => 'vars')) ;
```
will result in:
```
[url] => /testing/post?company=u... | I have what is either a hack (i.e. may not work for future CakePHP releases) or an undocumented feature.
If the second testAction parameter includes an named array called 'url' then the values will be placed in the $this->params object in the controller. This gives us the same net result as when the controller is dire... |
200,932 | <p>When indenting java code with annotations, vim insists on indenting like this:</p>
<pre><code>@Test
public void ...
</code></pre>
<p>I want the annotation to be in the same column as the method definition but I can't seem to find a way to tell vim to do that, except maybe using an indent expression but I'm not... | [
{
"answer_id": 211820,
"author": "WMR",
"author_id": 2844,
"author_profile": "https://Stackoverflow.com/users/2844",
"pm_score": 4,
"selected": true,
"text": "<p>Edit: I cannot delete my own answer because it has already been accepted, but <a href=\"https://stackoverflow.com/a/4414015/28... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200932",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10098/"
] | When indenting java code with annotations, vim insists on indenting like this:
```
@Test
public void ...
```
I want the annotation to be in the same column as the method definition but I can't seem to find a way to tell vim to do that, except maybe using an indent expression but I'm not sure if I can use that to... | Edit: I cannot delete my own answer because it has already been accepted, but [@pydave's answer](https://stackoverflow.com/a/4414015/2844) seems to be the better (more robust) solution.
---
You should probably be using the indentation file for the java FileType (instead of using cindent) by setting `filetype plugin i... |
200,939 | <p>I am using tinyMCE as my text editor on my site and i want to reformat the text before saving it to my database (changing the &rsquo; tags into ' then in to &#39;). I cannot find a simple way of doing this using tinyMCe and using htmlentities() changes everything including <>. Any ideas?</p>
| [
{
"answer_id": 200949,
"author": "Tomasz Tybulewicz",
"author_id": 17405,
"author_profile": "https://Stackoverflow.com/users/17405",
"pm_score": 3,
"selected": false,
"text": "<p>You can user <code>strip_tags($str, $allowed_tags)</code> like below:</p>\n\n<pre><code>$txt = strip_tags($tx... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200939",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am using tinyMCE as my text editor on my site and i want to reformat the text before saving it to my database (changing the ’ tags into ' then in to '). I cannot find a simple way of doing this using tinyMCe and using htmlentities() changes everything including <>. Any ideas? | You can user `strip_tags($str, $allowed_tags)` like below:
```
$txt = strip_tags($txt, '<p><a><br>');
``` |
200,966 | <p>I have these two pieces of code, wich one is more readable?</p>
<ol>
<li><p>foreach</p>
<pre><code>decimal technicalPremium = 0;
foreach (Risk risk in risks)
{
technicalPremium = technicalPremium + risk.TechnicalPremium;
}
return technicalPremium;
</code></pre></li>
<li><p>linq</p>
<pre><code>return risks.Su... | [
{
"answer_id": 200974,
"author": "Ólafur Waage",
"author_id": 22459,
"author_profile": "https://Stackoverflow.com/users/22459",
"pm_score": 5,
"selected": true,
"text": "<p>If the team that works on the code knows what the Linq version does and knows its inner workings, then it is more r... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200966",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12514/"
] | I have these two pieces of code, wich one is more readable?
1. foreach
```
decimal technicalPremium = 0;
foreach (Risk risk in risks)
{
technicalPremium = technicalPremium + risk.TechnicalPremium;
}
return technicalPremium;
```
2. linq
```
return risks.Sum(risk => risk.TechnicalPremium);
``` | If the team that works on the code knows what the Linq version does and knows its inner workings, then it is more readable. |
200,986 | <p><em>Edit: <br>My problem is not a problem anymore: I have redo my performances tests and I have do a fatal stupid error: I had forget a x1000 to get seconds from milliseconds :/
Sorry for that guys.<br>
For info: <br>
- I do some 1900 updates per second from my PC to the DataBase server on local network.<br>
-... | [
{
"answer_id": 200999,
"author": "Danimal",
"author_id": 2757,
"author_profile": "https://Stackoverflow.com/users/2757",
"pm_score": 0,
"selected": false,
"text": "<p>Have you considered passing an XML document to a stored procedure, then iterating through that to find the data to insert... | 2008/10/14 | [
"https://Stackoverflow.com/questions/200986",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26071/"
] | *Edit:
My problem is not a problem anymore: I have redo my performances tests and I have do a fatal stupid error: I had forget a x1000 to get seconds from milliseconds :/
Sorry for that guys.
For info:
- I do some 1900 updates per second from my PC to the DataBase server on local network.
- 3.200 updates... | This should run a little faster:
```
public void InsertUser(IEnumerable<string> userCodes)
{
using (SqlConnection sqlConnection = new SqlConnection(this.connectionString),
SqlCommand sqlCommand = new SqlCommand("InsertUser", sqlConnection))
{
sqlCommand.CommandType = System.Data.CommandType.S... |
201,004 | <p>I have a WCF service running on the IIS with a ServiceHostFactory. It's running fine with the WSHttpBinding but because of the speed and everything being on the same network (no firewalls) i want to speed up things a bit using the NetTcpBinding instead.</p>
<p>When i try to do that i get this error:</p>
<blockquot... | [
{
"answer_id": 201014,
"author": "ZombieSheep",
"author_id": 377,
"author_profile": "https://Stackoverflow.com/users/377",
"pm_score": 1,
"selected": false,
"text": "<p>Could it be something as simple as your firewall rules on the service host disallowing port 808?</p>\n"
},
{
"a... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201004",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11619/"
] | I have a WCF service running on the IIS with a ServiceHostFactory. It's running fine with the WSHttpBinding but because of the speed and everything being on the same network (no firewalls) i want to speed up things a bit using the NetTcpBinding instead.
When i try to do that i get this error:
>
> Could not connect t... | Check out [this post](https://web.archive.org/web/20160611103146/http://marc.bloggingabout.net/2007/10/23/wcf-hosting-non-http-protocols-in-iis-7-0/) on enabling non-HTTP bindings in IIS 7.0. By default, you have to explicitly enable net.tcp in IIS 7.0.
Hope this helps.
UPDATE:
Saw your comment - unfortunately, net.... |
201,037 | <p>Is there a reliable Delta RGB formula or code snippet that does colour Delta of the full RGB tri stim values, like how DeltaE 2000/cmc does Lab/Lch that takes <em>perceptual</em> differences into account?</p>
<p>The RGB Colourspace could be any, but if it needed to be a particular one I could keep it sRGB for the c... | [
{
"answer_id": 207847,
"author": "palm3D",
"author_id": 2686,
"author_profile": "https://Stackoverflow.com/users/2686",
"pm_score": 2,
"selected": false,
"text": "<p>I'm afraid you already gave the only right answer: conversion to a perceptual color space, where the simple delta formula ... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201037",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14642/"
] | Is there a reliable Delta RGB formula or code snippet that does colour Delta of the full RGB tri stim values, like how DeltaE 2000/cmc does Lab/Lch that takes *perceptual* differences into account?
The RGB Colourspace could be any, but if it needed to be a particular one I could keep it sRGB for the calculations. C# i... | I'm afraid you already gave the only right answer: conversion to a perceptual color space, where the simple delta formula makes sense.
Brilliant color scientists have been trying to answer the question of perceptual color differences for over a century. They've looked for a simple RGB formula that works, but human per... |
201,066 | <p>I have deployed ASP.NET web site and ASP.NET web service on the same web server. Both of them require access to shared file. </p>
<p>How to implement/share lock that supports single writers and multiple readers? If somebody reads, nobody can write, but all still can read. If somebody writes, nobody can read/write.<... | [
{
"answer_id": 201113,
"author": "Bartek Szabat",
"author_id": 23774,
"author_profile": "https://Stackoverflow.com/users/23774",
"pm_score": 3,
"selected": true,
"text": "<p>to open file for writing with allowing other threads to read it use System.IO.File.Open method with System.IO.File... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201066",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2625/"
] | I have deployed ASP.NET web site and ASP.NET web service on the same web server. Both of them require access to shared file.
How to implement/share lock that supports single writers and multiple readers? If somebody reads, nobody can write, but all still can read. If somebody writes, nobody can read/write. | to open file for writing with allowing other threads to read it use System.IO.File.Open method with System.IO.FileShare.Read. Ie.:
```
System.IO.File.Open("path.txt",System.IO.FileMode.OpenOrCreate,System.IO.FileAccess.ReadWrite,System.IO.FileShare.Read)
```
Other (reading) threads should use System.IO.FileAccess.Re... |
201,070 | <p>I ran accross a CSR file (Certificate Signing Request) and I need to extract some information from it.</p>
<p>There's a way to decode it using .NET Framework?</p>
| [
{
"answer_id": 353536,
"author": "erickson",
"author_id": 3474,
"author_profile": "https://Stackoverflow.com/users/3474",
"pm_score": 5,
"selected": false,
"text": "<p>It's not .NET, but for interactive use, try the OpenSSL utilities. Specifically:</p>\n\n<pre><code>openssl req -text -in... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201070",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7720/"
] | I ran accross a CSR file (Certificate Signing Request) and I need to extract some information from it.
There's a way to decode it using .NET Framework? | Decoding a CSR is easy if you employ the [OpenSSL.NET](http://openssl-net.sourceforge.net) library:
```
// Load the CSR file
var csr = new X509Request(BIO.File("C:/temp/test.csr", "r"));
OR
var csr = new X509Request(@"-----BEGIN CERTIFICATE REQUEST-----...");
// Read CSR file properties
Console.WriteLine(csr.PublicKe... |
201,087 | <p>When trying to install Visual Studio 2008 I get the following message straight away: </p>
<blockquote>
<p>"You must uninstall all pre-release
products in a specific order before
you can continue with setup."</p>
</blockquote>
<p></p>
<p>And then it gived me <a href="http://www.microsoft.com/express/support/... | [
{
"answer_id": 201127,
"author": "Jason Short",
"author_id": 19974,
"author_profile": "https://Stackoverflow.com/users/19974",
"pm_score": 1,
"selected": false,
"text": "<p>For me I had to uninstall VSS Report Services for SQL Server. Then uninstall everything SQL Express related, then ... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201087",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22621/"
] | When trying to install Visual Studio 2008 I get the following message straight away:
>
> "You must uninstall all pre-release
> products in a specific order before
> you can continue with setup."
>
>
>
And then it gived me [this link on how to do that](http://www.microsoft.com/express/support/uninstall/).
I've... | For me I had to uninstall VSS Report Services for SQL Server. Then uninstall everything SQL Express related, then uninstall Visual Studio. Clean out the registry hive for VS 9.0 and 9.0EXP. THEN it would reinstall. The VS 2008 SP1 RC attempted to update SQL Server Express to 2008 as well. That screwed up a lot of stuff... |
201,101 | <p>I have a large array in <strong>C</strong> (not <strong>C++</strong> if that makes a difference). I want to initialize all members of the same value.</p>
<p>I could swear I once knew a simple way to do this. I could use <code>memset()</code> in my case, but isn't there a way to do this that is built right into the ... | [
{
"answer_id": 201116,
"author": "aib",
"author_id": 1088,
"author_profile": "https://Stackoverflow.com/users/1088",
"pm_score": 11,
"selected": true,
"text": "<p>Unless that value is 0 (in which case you can omit some part of the initializer\nand the corresponding elements will be initi... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201101",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17693/"
] | I have a large array in **C** (not **C++** if that makes a difference). I want to initialize all members of the same value.
I could swear I once knew a simple way to do this. I could use `memset()` in my case, but isn't there a way to do this that is built right into the C syntax? | Unless that value is 0 (in which case you can omit some part of the initializer
and the corresponding elements will be initialized to 0), there's no easy way.
Don't overlook the obvious solution, though:
```
int myArray[10] = { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5 };
```
Elements with missing values will be initialized to ... |
201,141 | <p>I am writing some JNI code in C that I wish to test using cunit. In order to call the JNI functions, I need to create a valid JNIEnv struct.</p>
<p>Does anyone know if there is a mocking framework for such a purpose, or who can give me some pointers on how to create a mock JNIEnv struct myself?</p>
| [
{
"answer_id": 201469,
"author": "David Sykes",
"author_id": 259,
"author_profile": "https://Stackoverflow.com/users/259",
"pm_score": 1,
"selected": false,
"text": "<p>Mocking JNI sounds like a world of pain to me. I think you are likely to be better off mocking the calls implemented in... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201141",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7122/"
] | I am writing some JNI code in C that I wish to test using cunit. In order to call the JNI functions, I need to create a valid JNIEnv struct.
Does anyone know if there is a mocking framework for such a purpose, or who can give me some pointers on how to create a mock JNIEnv struct myself? | jni.h contains the complete structure for JNIEnv\_, including the "jump table" JNINativeInterface\_. You could create your own JNINativeInterface\_ (pointing to mock implementations) and instantiate a JNIEnv\_ from it.
Edit in response to comments: (I didn't look at the other SO question you referenced)
```
#include ... |
201,147 | <p>I'm looking for a simple way to grab thumbnails of FLVs in ASP.NET, without having to change any permissions/settings on the server. Ideally, nothing is installed on the server machine, but if necessary, small tools such as FFmpeg are fine.</p>
<p>I've tried FFmpeg using the command-line tool with Process.Start, bu... | [
{
"answer_id": 201503,
"author": "Anjisan",
"author_id": 25304,
"author_profile": "https://Stackoverflow.com/users/25304",
"pm_score": 1,
"selected": false,
"text": "<p>If you can embed Flash on a page, the easiest way to show a thumbnail of a FLV is to put a video object on the stage, a... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201147",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm looking for a simple way to grab thumbnails of FLVs in ASP.NET, without having to change any permissions/settings on the server. Ideally, nothing is installed on the server machine, but if necessary, small tools such as FFmpeg are fine.
I've tried FFmpeg using the command-line tool with Process.Start, but the same... | If you can embed Flash on a page, the easiest way to show a thumbnail of a FLV is to put a video object on the stage, attach a video to it through a NetStream in actionscript, and then put in an event handler to pause the move immediately after it starts playing.
For example, if you have a video object on the stage ca... |
201,170 | <p>I am currently looking for a way to be notified when a child is added to the visual or logical children.</p>
<p>I am aware of the Visual::OnVisualChildrenChanged method, but it does not apply to me since I can't always inherit and override this function. I am looking for an event.</p>
<p>So, is there a way for th... | [
{
"answer_id": 214561,
"author": "Andy",
"author_id": 3857,
"author_profile": "https://Stackoverflow.com/users/3857",
"pm_score": 1,
"selected": false,
"text": "<p>I believe that <a href=\"http://msdn.microsoft.com/en-us/library/system.windows.frameworkelement.loaded.aspx\" rel=\"nofollo... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201170",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12082/"
] | I am currently looking for a way to be notified when a child is added to the visual or logical children.
I am aware of the Visual::OnVisualChildrenChanged method, but it does not apply to me since I can't always inherit and override this function. I am looking for an event.
So, is there a way for the owner of a Frame... | Isn't it easier to extend
```
System.Windows.Controls.UIElementCollection
```
to do the notification and use
```
protected override UIElementCollection CreateUIElementCollection(FrameworkElement logicalParent)
```
? |
201,178 | <p>I feel like a fool, but here goes:</p>
<pre><code>public interface IHasErrorController{
ErrorController ErrorController { get; set; }
}
public class DSErrorController: ErrorController{yadi yadi ya}
public class DSWebsiteController : Controller, IHasErrorController{
public DSErrorController ErrorController {... | [
{
"answer_id": 201192,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 4,
"selected": true,
"text": "<p>C# (at the moment) has very little [co|contra]variance support; as such, the interface implementation must be an <e... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201178",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11333/"
] | I feel like a fool, but here goes:
```
public interface IHasErrorController{
ErrorController ErrorController { get; set; }
}
public class DSErrorController: ErrorController{yadi yadi ya}
public class DSWebsiteController : Controller, IHasErrorController{
public DSErrorController ErrorController { get; set; }
}... | C# (at the moment) has very little [co|contra]variance support; as such, the interface implementation must be an *exact* match, including the return type. To keep your concreate type on the class API, I would implement the interface explicitly - i.e. add:
```
ErrorController IHasErrorControlloer.ErrorController {
ge... |
201,183 | <p>A strict equality operator will tell you if two object <strong>types</strong> are equal. However, is there a way to tell if two objects are equal, <strong>much like the hash code</strong> value in Java?</p>
<p>Stack Overflow question <em><a href="https://stackoverflow.com/questions/194846">Is there any kind of hash... | [
{
"answer_id": 201249,
"author": "FOR",
"author_id": 27826,
"author_profile": "https://Stackoverflow.com/users/27826",
"pm_score": 0,
"selected": false,
"text": "<p>Depends on what you mean by equality. And therefore it is up to you, as the developer of the classes, to define their equal... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201183",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | A strict equality operator will tell you if two object **types** are equal. However, is there a way to tell if two objects are equal, **much like the hash code** value in Java?
Stack Overflow question *[Is there any kind of hashCode function in JavaScript?](https://stackoverflow.com/questions/194846)* is similar to th... | **The short answer**
The simple answer is: No, there is no generic means to determine that an object is equal to another in the sense you mean. The exception is when you are strictly thinking of an object being typeless.
**The long answer**
The concept is that of an Equals method that compares two different instance... |
201,188 | <p>Is it possible to reference system environment variables (as opposed to Java system properties) in a log4j xml configuration file?</p>
<p>I'd like to be able to do something like:</p>
<pre><code><level value="${env.LOG_LEVEL}" />
</code></pre>
<p>and have it get that from the system environment variables, s... | [
{
"answer_id": 201489,
"author": "Einar",
"author_id": 2964,
"author_profile": "https://Stackoverflow.com/users/2964",
"pm_score": 6,
"selected": false,
"text": "<p>I tried to do that recently and couldn't get it to work. What I ended up doing is sending a variable at startup. So say you... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201188",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22070/"
] | Is it possible to reference system environment variables (as opposed to Java system properties) in a log4j xml configuration file?
I'd like to be able to do something like:
```
<level value="${env.LOG_LEVEL}" />
```
and have it get that from the system environment variables, so I can avoid having to pass in so many... | This syntax is documented only in log4j 2.X so make sure you are using the correct version. It does not work on the 1.X versions.
```
<Appenders>
<File name="file" fileName="${env:LOG_PATH}">
<PatternLayout>
<Pattern>%d %p %c{1.} [%t] %m %ex%n</Pattern>
</PatternLayout>
</File>
... |
201,191 | <p>We are using Linq To SQL with our own data context logic that executes the one linq query across multiple databases. When we get the results back, we need the database for each of the rows. So...</p>
<p>I want to have a property on my class that will return the database name (SQL Server, so DB_NAME()). How can I... | [
{
"answer_id": 201489,
"author": "Einar",
"author_id": 2964,
"author_profile": "https://Stackoverflow.com/users/2964",
"pm_score": 6,
"selected": false,
"text": "<p>I tried to do that recently and couldn't get it to work. What I ended up doing is sending a variable at startup. So say you... | 2008/10/14 | [
"https://Stackoverflow.com/questions/201191",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5189/"
] | We are using Linq To SQL with our own data context logic that executes the one linq query across multiple databases. When we get the results back, we need the database for each of the rows. So...
I want to have a property on my class that will return the database name (SQL Server, so DB\_NAME()). How can I do this in ... | This syntax is documented only in log4j 2.X so make sure you are using the correct version. It does not work on the 1.X versions.
```
<Appenders>
<File name="file" fileName="${env:LOG_PATH}">
<PatternLayout>
<Pattern>%d %p %c{1.} [%t] %m %ex%n</Pattern>
</PatternLayout>
</File>
... |