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 |
|---|---|---|---|---|---|---|
70,405 | <p>I'm doing simple string input parsing and I am in need of a string tokenizer. I am new to C# but have programmed Java, and it seems natural that C# should have a string tokenizer. Does it? Where is it? How do I use it?</p>
| [
{
"answer_id": 70413,
"author": "Steve Morgan",
"author_id": 5806,
"author_profile": "https://Stackoverflow.com/users/5806",
"pm_score": 2,
"selected": false,
"text": "<p>I think the nearest in the .NET Framework is </p>\n\n<pre>\nstring.Split()\n</pre>\n"
},
{
"answer_id": 70425... | 2008/09/16 | [
"https://Stackoverflow.com/questions/70405",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/432/"
] | I'm doing simple string input parsing and I am in need of a string tokenizer. I am new to C# but have programmed Java, and it seems natural that C# should have a string tokenizer. Does it? Where is it? How do I use it? | You could use [String.Split method](http://msdn.microsoft.com/en-us/library/system.string.split.aspx "String.Split method msdn reference").
```
class ExampleClass
{
public ExampleClass()
{
string exampleString = "there is a cat";
// Split string on spaces. This will separate all the words in a ... |
70,417 | <p>I have the following code:</p>
<pre><code>Dim obj As New Access.Application
obj.OpenCurrentDatabase (CurrentProject.Path & "\Working.mdb")
obj.Run "Routine"
obj.CloseCurrentDatabase
Set obj = Nothing
</code></pre>
<p>The problem I'm experimenting is a pop-up that tells me Access can't set the focus on the othe... | [
{
"answer_id": 70413,
"author": "Steve Morgan",
"author_id": 5806,
"author_profile": "https://Stackoverflow.com/users/5806",
"pm_score": 2,
"selected": false,
"text": "<p>I think the nearest in the .NET Framework is </p>\n\n<pre>\nstring.Split()\n</pre>\n"
},
{
"answer_id": 70425... | 2008/09/16 | [
"https://Stackoverflow.com/questions/70417",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11498/"
] | I have the following code:
```
Dim obj As New Access.Application
obj.OpenCurrentDatabase (CurrentProject.Path & "\Working.mdb")
obj.Run "Routine"
obj.CloseCurrentDatabase
Set obj = Nothing
```
The problem I'm experimenting is a pop-up that tells me Access can't set the focus on the other database. As you can see fro... | You could use [String.Split method](http://msdn.microsoft.com/en-us/library/system.string.split.aspx "String.Split method msdn reference").
```
class ExampleClass
{
public ExampleClass()
{
string exampleString = "there is a cat";
// Split string on spaces. This will separate all the words in a ... |
70,455 | <p>I want to port data from one server's database to another server's database.
The databases are both on a different mssql 2005 server.
Replication is probably not an option since the destination database is generated from scratch on a [time interval] basis.</p>
<p>Preferebly I would do something like</p>
<pre><code... | [
{
"answer_id": 70464,
"author": "Thomas Rushton",
"author_id": 6977,
"author_profile": "https://Stackoverflow.com/users/6977",
"pm_score": 0,
"selected": false,
"text": "<p>Can you use the Data Transformation Services to do the job? This provides all sorts of bolt-together tools for doi... | 2008/09/16 | [
"https://Stackoverflow.com/questions/70455",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11333/"
] | I want to port data from one server's database to another server's database.
The databases are both on a different mssql 2005 server.
Replication is probably not an option since the destination database is generated from scratch on a [time interval] basis.
Preferebly I would do something like
```
insert *
from db1/ta... | I think what you want to do is create a linked server as per [this webarchive snapshot of msdn article from 2015](http://web.archive.org/web/20150628090613/https://msdn.microsoft.com/en-us/library/aa213778(SQL.80).aspx) or [this article from learn.microsoft.com](https://learn.microsoft.com/en-us/sql/relational-database... |
70,471 | <p>So, I have willfully kept myself a Java n00b until recently, and my first real exposure brought about a minor shock: Java does not have C# style properties!</p>
<p>Ok, I can live with that. However, I can also swear that I have seen property getter/setter code in Java in one codebase, but I cannot remember where. H... | [
{
"answer_id": 70519,
"author": "Mark Embling",
"author_id": 6844,
"author_profile": "https://Stackoverflow.com/users/6844",
"pm_score": 2,
"selected": false,
"text": "<p>My Java experience is not that high either, so anyone feel free to correct me. But AFAIK, the general convention is t... | 2008/09/16 | [
"https://Stackoverflow.com/questions/70471",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/227/"
] | So, I have willfully kept myself a Java n00b until recently, and my first real exposure brought about a minor shock: Java does not have C# style properties!
Ok, I can live with that. However, I can also swear that I have seen property getter/setter code in Java in one codebase, but I cannot remember where. How was tha... | There is a "standard" pattern for getters and setters in Java, called [Bean properties](http://docs.oracle.com/javase/tutorial/javabeans/writing/properties.html). Basically any method starting with `get`, taking no arguments and returning a value, is a property getter for a property named as the rest of the method name... |
70,501 | <p>I have a method in .NET (C#) which returns <code>string[][]</code>. When using RegAsm or TlbExp (from the .NET 2.0 SDK) to create a COM type library for the containing assembly, I get the following warning:</p>
<blockquote>
<p>WARNING: There is no marshaling support for nested arrays.</p>
</blockquote>
<p>This w... | [
{
"answer_id": 71395,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 1,
"selected": false,
"text": "<p>The equivalent of variant in C# is System.Object. So you might want to try to return the result cast to object and pick it ... | 2008/09/16 | [
"https://Stackoverflow.com/questions/70501",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7724/"
] | I have a method in .NET (C#) which returns `string[][]`. When using RegAsm or TlbExp (from the .NET 2.0 SDK) to create a COM type library for the containing assembly, I get the following warning:
>
> WARNING: There is no marshaling support for nested arrays.
>
>
>
This warning results in the method in question no... | Even if you were to return an Object (which maps to a Variant in COM Interop), that doesn't solve your problem. VB will be able to "hold" onto it and "pass it around", but it won't be able to do anything with it.
Technically, there is no exact equivalent in VB for a string[][]. However, if your array is not "jagged" (... |
70,528 | <p>Python gives us the ability to create 'private' methods and variables within a class by prepending double underscores to the name, like this: <code>__myPrivateMethod()</code>. How, then, can one explain this</p>
<pre><code>>>>> class MyClass:
... def myPublicMethod(self):
... print 'publi... | [
{
"answer_id": 70555,
"author": "xsl",
"author_id": 11387,
"author_profile": "https://Stackoverflow.com/users/11387",
"pm_score": 7,
"selected": false,
"text": "<p>From <em><a href=\"http://www.faqs.org/docs/diveintopython/fileinfo_private.html\" rel=\"noreferrer\">Dive Into Python, 3.9.... | 2008/09/16 | [
"https://Stackoverflow.com/questions/70528",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1943957/"
] | Python gives us the ability to create 'private' methods and variables within a class by prepending double underscores to the name, like this: `__myPrivateMethod()`. How, then, can one explain this
```
>>>> class MyClass:
... def myPublicMethod(self):
... print 'public method'
... def __myPrivateMet... | The name scrambling is used to ensure that subclasses don't accidentally override the private methods and attributes of their superclasses. It's not designed to prevent deliberate access from outside.
For example:
```
>>> class Foo(object):
... def __init__(self):
... self.__baz = 42
... def foo(self)... |
70,529 | <p>In order to know how many times a pattern exists in current buffer, I do:</p>
<pre><code>:%s/pattern-here/pattern-here/g
</code></pre>
<p>It gives the number of occurrences of the pattern, but is obviously cumbersome and also has the side-effect of setting the 'changed' status.</p>
<p>Is there a more elegant way ... | [
{
"answer_id": 70657,
"author": "Bruno De Fraine",
"author_id": 6918,
"author_profile": "https://Stackoverflow.com/users/6918",
"pm_score": 8,
"selected": true,
"text": "<p>To avoid the substitution, leave the second pattern empty, and add the “n” flag:</p>\n\n<pre><code>:%s/pattern-here... | 2008/09/16 | [
"https://Stackoverflow.com/questions/70529",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6984/"
] | In order to know how many times a pattern exists in current buffer, I do:
```
:%s/pattern-here/pattern-here/g
```
It gives the number of occurrences of the pattern, but is obviously cumbersome and also has the side-effect of setting the 'changed' status.
Is there a more elegant way to count? | To avoid the substitution, leave the second pattern empty, and add the “n” flag:
```
:%s/pattern-here//gn
```
This is described as [an official tip](http://vimdoc.sourceforge.net/htmldoc/tips.html#count-items). |
70,560 | <p>When entering a question, stackoverflow presents you with a list of questions that it thinks likely to cover the same topic. I have seen similar features on other sites or in other programs, too (Help file systems, for example), but I've never programmed something like this myself. Now I'm curious to know what sort ... | [
{
"answer_id": 70656,
"author": "Antti Rasinen",
"author_id": 8570,
"author_profile": "https://Stackoverflow.com/users/8570",
"pm_score": 5,
"selected": true,
"text": "<p>One approach is the so called bag-of-words model.</p>\n\n<p>As you guessed, first you count how many times words appe... | 2008/09/16 | [
"https://Stackoverflow.com/questions/70560",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2077/"
] | When entering a question, stackoverflow presents you with a list of questions that it thinks likely to cover the same topic. I have seen similar features on other sites or in other programs, too (Help file systems, for example), but I've never programmed something like this myself. Now I'm curious to know what sort of ... | One approach is the so called bag-of-words model.
As you guessed, first you count how many times words appear in the text (usually called document in the NLP-lingo). Then you throw out the so called stop words, such as "the", "a", "or" and so on.
You're left with words and word counts. Do this for a while and you get... |
70,575 | <p>Is there any need of Virtual Constructors? If so can any one post a scenario?</p>
| [
{
"answer_id": 70589,
"author": "grigy",
"author_id": 1692070,
"author_profile": "https://Stackoverflow.com/users/1692070",
"pm_score": 1,
"selected": false,
"text": "<p>In what language? In C++ for example the constructors can not be virtual.</p>\n"
},
{
"answer_id": 70597,
... | 2008/09/16 | [
"https://Stackoverflow.com/questions/70575",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11554/"
] | Is there any need of Virtual Constructors? If so can any one post a scenario? | If you are talking about virtual destructors in C++ (there isn't any such thing as virtual constructors) then they should always be used if you are using your child classes polymorphically.
```
class A
{
~A();
}
class B : public A
{
~B();
}
A* pB = new B();
delete pB; // NOTE: WILL NOT CALL B's destructor
class... |
70,600 | <p>I'm trying to find a way of finding out who is downloading what image from an image gallery. Users can download using a button beside the thumbnail or right click and use the "save link as" Is it possible to relate a user session or ID to a "save link as" action from all browsers using either PHP or JavaScript.</p>
| [
{
"answer_id": 70633,
"author": "Jesper Blad Jensen",
"author_id": 11559,
"author_profile": "https://Stackoverflow.com/users/11559",
"pm_score": 0,
"selected": false,
"text": "<p>You need a gateway script, like ImageDownload.php?picture=me.jpg, or something like that.</p>\n\n<p>That page... | 2008/09/16 | [
"https://Stackoverflow.com/questions/70600",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm trying to find a way of finding out who is downloading what image from an image gallery. Users can download using a button beside the thumbnail or right click and use the "save link as" Is it possible to relate a user session or ID to a "save link as" action from all browsers using either PHP or JavaScript. | Yes, my preferred way of doing this would be via PHP. You'd have to set up a script which would load up the file and send it to the user browser. This script would also be able to log the download somewhere (e.g. your database).
For example - in very rough pseudo-code:
download.php
```
$file = $_GET['file'];
updateF... |
70,614 | <p>I've just introduced a friend to <strong>GNU Screen</strong> and they're having a hard time getting used to it. That makes me think about the essential things he needs to know about the excellent <strong>Screen</strong> utility, the same things that you'd think worthwhile to teach someone, a beginner, from the groun... | [
{
"answer_id": 70683,
"author": "agnul",
"author_id": 6069,
"author_profile": "https://Stackoverflow.com/users/6069",
"pm_score": 5,
"selected": false,
"text": "<p>If your friend is in the habit of pressing <code>^A</code> to get to the beginning of the line in Bash, he/she is in for som... | 2008/09/16 | [
"https://Stackoverflow.com/questions/70614",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6414/"
] | I've just introduced a friend to **GNU Screen** and they're having a hard time getting used to it. That makes me think about the essential things he needs to know about the excellent **Screen** utility, the same things that you'd think worthwhile to teach someone, a beginner, from the ground up. What are some analogies... | I've been using `Screen` for over 10 years and probably use less than half the features. So it's definitely not necessary to learn all its features right away (and I wouldn't recommend trying). My day-to-day commands are:
```
^A ^W - window list, where am I
^A ^C - create new window
^A space - next window
^A p - previ... |
70,625 | <p>How would you refactor these two classes to abstract out the similarities? An abstract class? Simple inheritance? What would the refactored class(es) look like?</p>
<pre><code>public class LanguageCode
{
/// <summary>
/// Get the lowercase two-character ISO 639-1 language code.
/// </summary>... | [
{
"answer_id": 70645,
"author": "Chris Kimpton",
"author_id": 48310,
"author_profile": "https://Stackoverflow.com/users/48310",
"pm_score": 2,
"selected": false,
"text": "<p>It depends, if they are not going to do much more, then I would probably leave them as is - IMHO factoring out stu... | 2008/09/16 | [
"https://Stackoverflow.com/questions/70625",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11574/"
] | How would you refactor these two classes to abstract out the similarities? An abstract class? Simple inheritance? What would the refactored class(es) look like?
```
public class LanguageCode
{
/// <summary>
/// Get the lowercase two-character ISO 639-1 language code.
/// </summary>
public readonly stri... | Unless you have a strong reason for refactoring (because you are going to add more classes like those in near future) the penalty of changing the design for such a small and contrived example would overcome the gain in maintenance or overhead in this scenario. Anyhow here is a possible design based on generic and lambd... |
70,653 | <p>I'm looking for a python library that will help me to create an authentication method for a desktop app I'm writing.
I have found several method in web framework such as django or turbogears.</p>
<p>I just want a kind of username-password association stored into a local file.
I can write it by myself, but I'm reall... | [
{
"answer_id": 70712,
"author": "Toni Ruža",
"author_id": 6267,
"author_profile": "https://Stackoverflow.com/users/6267",
"pm_score": 2,
"selected": false,
"text": "<p>I think you should make your own authentication method as you can make it fit your application best but use a library fo... | 2008/09/16 | [
"https://Stackoverflow.com/questions/70653",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11563/"
] | I'm looking for a python library that will help me to create an authentication method for a desktop app I'm writing.
I have found several method in web framework such as django or turbogears.
I just want a kind of username-password association stored into a local file.
I can write it by myself, but I'm really it alrea... | Treat the following as pseudo-code..
```
try:
from hashlib import sha as hasher
except ImportError:
# You could probably exclude the try/except bit,
# but older Python distros dont have hashlib.
try:
import sha as hasher
except ImportError:
import md5 as hasher
def hash_password(pa... |
70,668 | <p>What is the best way to backup VMWare Servers (1.0.x)?
The virtual machines in question are our development environment, and run isololated from the main network (so you can't just copy data from virtual to real servers).</p>
<p>The image files are normally in use and locked when the server is running, so it is di... | [
{
"answer_id": 70692,
"author": "Roger Lipscombe",
"author_id": 8446,
"author_profile": "https://Stackoverflow.com/users/8446",
"pm_score": 0,
"selected": false,
"text": "<p>If I recall correctly, VMWare Server has a scripting interface, available via Perl or COM. You might be able to us... | 2008/09/16 | [
"https://Stackoverflow.com/questions/70668",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11538/"
] | What is the best way to backup VMWare Servers (1.0.x)?
The virtual machines in question are our development environment, and run isololated from the main network (so you can't just copy data from virtual to real servers).
The image files are normally in use and locked when the server is running, so it is difficult to... | VMWare server includes the command line tool "vmware-cmd", which can be used to perform virtually any operation that can be performed through the console.
In this case you would simply add a "vmware-cmd susepend" to your script before starting your backup, and a "vmware-cmd start" after the backup is completed.
We us... |
70,681 | <p>Is there a way to make psycopg and postgres deal with errors without having to reestablish the connection, like MySQLdb? The commented version of the below works with MySQLdb, the comments make it work with Psycopg2:</p>
<pre><code>results = {'felicitas': 3, 'volumes': 8, 'acillevs': 1, 'mosaics': 13, 'perat\xe9':... | [
{
"answer_id": 70692,
"author": "Roger Lipscombe",
"author_id": 8446,
"author_profile": "https://Stackoverflow.com/users/8446",
"pm_score": 0,
"selected": false,
"text": "<p>If I recall correctly, VMWare Server has a scripting interface, available via Perl or COM. You might be able to us... | 2008/09/16 | [
"https://Stackoverflow.com/questions/70681",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11596/"
] | Is there a way to make psycopg and postgres deal with errors without having to reestablish the connection, like MySQLdb? The commented version of the below works with MySQLdb, the comments make it work with Psycopg2:
```
results = {'felicitas': 3, 'volumes': 8, 'acillevs': 1, 'mosaics': 13, 'perat\xe9': 1, 'representa... | VMWare server includes the command line tool "vmware-cmd", which can be used to perform virtually any operation that can be performed through the console.
In this case you would simply add a "vmware-cmd susepend" to your script before starting your backup, and a "vmware-cmd start" after the backup is completed.
We us... |
70,682 | <p>I am looking for details of the VTable structure, order and contents, and the location of the vtable pointers within objects. </p>
<p>Ideally, this will cover single inheritance, multiple inheritance, and virtual inheritance.</p>
<p>References to external documentation would also be appreciated</p>
<p>Documentati... | [
{
"answer_id": 25674843,
"author": "GlGuru",
"author_id": 497840,
"author_profile": "https://Stackoverflow.com/users/497840",
"pm_score": -1,
"selected": false,
"text": "<p>Most of the compiler implementations that I have seen just \"embed\" the base object into the derived object. It be... | 2008/09/16 | [
"https://Stackoverflow.com/questions/70682",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8516/"
] | I am looking for details of the VTable structure, order and contents, and the location of the vtable pointers within objects.
Ideally, this will cover single inheritance, multiple inheritance, and virtual inheritance.
References to external documentation would also be appreciated
Documentation of GCC 4.0x class lay... | A virtual table is generally treated as an array of function pointers, although compilers are free to put data pointers (in MI and VI scenarios, or to typeinfos), integers (for fixups), or sentinel elements (such as NULL pointers) into it as well. The layout is generally compiler-specific (or ABI-specific where multipl... |
70,689 | <p>What is an efficient way to implement a singleton design pattern in Java?</p>
| [
{
"answer_id": 70737,
"author": "Neil Burroughs",
"author_id": 5166,
"author_profile": "https://Stackoverflow.com/users/5166",
"pm_score": 6,
"selected": false,
"text": "<p>Make sure that you really need it. Do a google search for "singleton anti-pattern" to see some arguments ... | 2008/09/16 | [
"https://Stackoverflow.com/questions/70689",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11581/"
] | What is an efficient way to implement a singleton design pattern in Java? | Use an enum:
```
public enum Foo {
INSTANCE;
}
```
Joshua Bloch explained this approach in his [Effective Java Reloaded](http://sites.google.com/site/io/effective-java-reloaded) talk at Google I/O 2008: [link to video](http://www.youtube.com/watch?v=pi_I7oD_uGI#t=28m50s). Also see slides 30-32 of his presentatio... |
70,694 | <p>I am trying to create a Task Scheduler task to start my SQL Server 2005 instance every morning, because something stops it every night. This is a temporary solution until I can diagnose the stoppage.</p>
<p>I created a task to run under my admin user, and to start the program, <em>cmd</em> with the arguments <em>/... | [
{
"answer_id": 70737,
"author": "Neil Burroughs",
"author_id": 5166,
"author_profile": "https://Stackoverflow.com/users/5166",
"pm_score": 6,
"selected": false,
"text": "<p>Make sure that you really need it. Do a google search for "singleton anti-pattern" to see some arguments ... | 2008/09/16 | [
"https://Stackoverflow.com/questions/70694",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8741/"
] | I am trying to create a Task Scheduler task to start my SQL Server 2005 instance every morning, because something stops it every night. This is a temporary solution until I can diagnose the stoppage.
I created a task to run under my admin user, and to start the program, *cmd* with the arguments */c net start mssqlserv... | Use an enum:
```
public enum Foo {
INSTANCE;
}
```
Joshua Bloch explained this approach in his [Effective Java Reloaded](http://sites.google.com/site/io/effective-java-reloaded) talk at Google I/O 2008: [link to video](http://www.youtube.com/watch?v=pi_I7oD_uGI#t=28m50s). Also see slides 30-32 of his presentatio... |
70,732 | <p>Lasty, I tried to implements an hybrid structure in Java, something that looks like:</p>
<pre><code>public class MapOfSet<K, V extends HasKey<K>> implements Set<V>, Map<K, Set<V>>
</code></pre>
<p>Where HasKey is the following interface:</p>
<pre><code>public interface HasKey<K>... | [
{
"answer_id": 70760,
"author": "Avi",
"author_id": 1605,
"author_profile": "https://Stackoverflow.com/users/1605",
"pm_score": 0,
"selected": false,
"text": "<p>I would say that something that is meant to be sometimes used as a Map and sometimes as a Set should implement Map, since that... | 2008/09/16 | [
"https://Stackoverflow.com/questions/70732",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1730/"
] | Lasty, I tried to implements an hybrid structure in Java, something that looks like:
```
public class MapOfSet<K, V extends HasKey<K>> implements Set<V>, Map<K, Set<V>>
```
Where HasKey is the following interface:
```
public interface HasKey<K> {
public K getKey();
}
```
Unfortunately, there are some conflict... | Perhaps you could add more information which operations do you really want. I guess you want to create a set which automatically groups their elements by a key, right? The question is which operations do you want to be able to have? How are elements added to the Set? Can elements be deleted by removing them from a grou... |
70,758 | <p>I know you can put <% if %> statements in the ItemTemplate to hide controls but the column is still there.
You cannot put <% %> statements into the LayoutTemplate which is where the column headings are declared, hence the problem.
Does anyone know of a better way?</p>
| [
{
"answer_id": 70955,
"author": "Magnus Johansson",
"author_id": 3584,
"author_profile": "https://Stackoverflow.com/users/3584",
"pm_score": 0,
"selected": false,
"text": "<p>You can always set the column width to 0 (zero) if you don't find a better way.</p>\n"
},
{
"answer_id": ... | 2008/09/16 | [
"https://Stackoverflow.com/questions/70758",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10186/"
] | I know you can put <% if %> statements in the ItemTemplate to hide controls but the column is still there.
You cannot put <% %> statements into the LayoutTemplate which is where the column headings are declared, hence the problem.
Does anyone know of a better way? | Here's another solution that I just did, seeing that I understand what you want to do:
**Here's your ASCX / ASPX**
```
<asp:ListView ID="ListView1" runat="server" DataSourceID="MyDataSource" ItemPlaceholderID="itemPlaceHolder" OnDataBound="ListView1_DataBound">
<LayoutTemplate>
<table border="... |
70,773 | <p>What are the pros / cons of using <code>pthread_cond_wait</code> or using a semaphore ?
I am waiting for a state change like this :</p>
<pre><code>pthread_mutex_lock(&cam->video_lock);
while(cam->status == WAIT_DISPLAY) {
pthread_cond_wait(&cam->video_cond, &cam->video_lock);
}
pthread_m... | [
{
"answer_id": 70924,
"author": "Javier",
"author_id": 11649,
"author_profile": "https://Stackoverflow.com/users/11649",
"pm_score": 0,
"selected": false,
"text": "<p>In your second snippet, you're getting the lock multitude of times, never releasing it.</p>\n\n<p>In general, the state y... | 2008/09/16 | [
"https://Stackoverflow.com/questions/70773",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11589/"
] | What are the pros / cons of using `pthread_cond_wait` or using a semaphore ?
I am waiting for a state change like this :
```
pthread_mutex_lock(&cam->video_lock);
while(cam->status == WAIT_DISPLAY) {
pthread_cond_wait(&cam->video_cond, &cam->video_lock);
}
pthread_mutex_unlock(&cam->video_lock);
```
Using a prop... | A semaphore is suited cleanly to a producer-consumer model, although it has other uses. Your program logic is responsible for ensuring that the right number of posts are made for the number of waits. If you post a semaphore and nobody is waiting on it yet, then when they do wait they continue immediately. If your probl... |
70,779 | <p>I need to be able to quickly convert an image (inside a rails controller) so that the hosting company using managing our application can quickly test at any time to ensure that rmagick is not only successfully installed, but can be called throgh the rails stiack, what is the quickest clean code I can use to do this?... | [
{
"answer_id": 70932,
"author": "tomafro",
"author_id": 7126,
"author_profile": "https://Stackoverflow.com/users/7126",
"pm_score": 0,
"selected": false,
"text": "<p>I'd log on to the server and try out your code in script/console. This will still go through the rails stack, but will al... | 2008/09/16 | [
"https://Stackoverflow.com/questions/70779",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7473/"
] | I need to be able to quickly convert an image (inside a rails controller) so that the hosting company using managing our application can quickly test at any time to ensure that rmagick is not only successfully installed, but can be called throgh the rails stiack, what is the quickest clean code I can use to do this? | I wanted to do this so that I can easily hit it with a web browser, as I'm deployng to managed servers, which I do not have shell access onto (for increased security).
So this is what I did
```
class DiagnosticsController < ApplicationController
require 'RMagick'
def rmagick
images_path = "public/images"
... |
70,782 | <p>How to get a file's creation date or file size, for example this Hello.jpg at <a href="http://www.mywebsite.com/now/Hello.jpg(note" rel="nofollow noreferrer">http://www.mywebsite.com/now/Hello.jpg(note</a>: This URL does not exist)? The purpose of this question is to make my application re-download the files from th... | [
{
"answer_id": 70803,
"author": "Vinko Vrsalovic",
"author_id": 5190,
"author_profile": "https://Stackoverflow.com/users/5190",
"pm_score": 4,
"selected": true,
"text": "<p>If you use the HEAD request it will send the headers for the resource, there you can check the cache control header... | 2008/09/16 | [
"https://Stackoverflow.com/questions/70782",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | How to get a file's creation date or file size, for example this Hello.jpg at <http://www.mywebsite.com/now/Hello.jpg(note>: This URL does not exist)? The purpose of this question is to make my application re-download the files from the any website when it has detected that the website has an updated version of the fil... | If you use the HEAD request it will send the headers for the resource, there you can check the cache control headers which will tell you if the resource has been modified, last modification time, size (content-length) and date.
```
$ telnet www.google.com 80
Trying 216.239.59.103...
Connected to www.l.google.com.
Esc... |
70,797 | <p>How do I have a Python script that a) can accept user input and how do I make it b) read in arguments if run from the command line?</p>
| [
{
"answer_id": 70814,
"author": "lbz",
"author_id": 11530,
"author_profile": "https://Stackoverflow.com/users/11530",
"pm_score": 9,
"selected": false,
"text": "<pre><code>var = raw_input(\"Please enter something: \")\nprint \"you entered\", var\n</code></pre>\n\n<p>Or for Python 3:</p>\... | 2008/09/16 | [
"https://Stackoverflow.com/questions/70797",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1384652/"
] | How do I have a Python script that a) can accept user input and how do I make it b) read in arguments if run from the command line? | To read user input you can try [the `cmd` module](https://docs.python.org/dev/library/cmd.html) for easily creating a mini-command line interpreter (with help texts and autocompletion) and [`raw_input`](https://docs.python.org/2/library/functions.html#raw_input) ([`input`](https://docs.python.org/dev/library/functions.... |
70,842 | <p>How should I run another program from within my <code>C</code> program? I need to be able to write data into <code>STDIN</code> of the launched program (and maybe read from it's <code>STDOUT</code>)</p>
<p>I am not sure if this is a standard C function. I need the solution that should work under Linux.</p>
| [
{
"answer_id": 70848,
"author": "freespace",
"author_id": 8297,
"author_profile": "https://Stackoverflow.com/users/8297",
"pm_score": 5,
"selected": true,
"text": "<p>You want to use <code>popen</code>. It gives you a unidirectional pipe with which you can access stdin and stdout of the ... | 2008/09/16 | [
"https://Stackoverflow.com/questions/70842",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6974/"
] | How should I run another program from within my `C` program? I need to be able to write data into `STDIN` of the launched program (and maybe read from it's `STDOUT`)
I am not sure if this is a standard C function. I need the solution that should work under Linux. | You want to use `popen`. It gives you a unidirectional pipe with which you can access stdin and stdout of the program.
popen is standard on modern unix and unix-like OS, of which Linux is one :-)
Type
```
man popen
```
in a terminal to read more about it.
**EDIT**
Whether `popen` produces unidirectional or bidir... |
70,850 | <p>What advantage, if any, is provided by formatting C code as follows:</p>
<pre><code>while(lock_file(lockdir)==0)
{
count++;
if(count==20)
{
fprintf(stderr,"Can't lock dir %s\n",lockdir);
exit(1);
}
sleep(3);
}
if(rmdir(serverdir)!=0)
{
switch(errno)
... | [
{
"answer_id": 70862,
"author": "cruizer",
"author_id": 6441,
"author_profile": "https://Stackoverflow.com/users/6441",
"pm_score": 3,
"selected": false,
"text": "<p>Nothing. Indentation and other coding standards are a matter of preference.</p>\n"
},
{
"answer_id": 70863,
"a... | 2008/09/16 | [
"https://Stackoverflow.com/questions/70850",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2974/"
] | What advantage, if any, is provided by formatting C code as follows:
```
while(lock_file(lockdir)==0)
{
count++;
if(count==20)
{
fprintf(stderr,"Can't lock dir %s\n",lockdir);
exit(1);
}
sleep(3);
}
if(rmdir(serverdir)!=0)
{
switch(errno)
{
ca... | The top example is know as "Whitesmiths style". [Wikipedia's entry on Indent Styles](http://en.wikipedia.org/wiki/Indent_style) explains several styles along with their advantages and disadvantages. |
70,855 | <p>Is there a realistic way of implementing a multi-threaded model in PHP whether truly, or just simulating it. Some time back it was suggested that you could force the operating system to load another instance of the PHP executable and handle other simultaneous processes.</p>
<p>The problem with this is that when the... | [
{
"answer_id": 71043,
"author": "J.D. Fitz.Gerald",
"author_id": 11542,
"author_profile": "https://Stackoverflow.com/users/11542",
"pm_score": 4,
"selected": false,
"text": "<p>While you can't thread, you do have some degree of process control in php. The two function sets that are usefu... | 2008/09/16 | [
"https://Stackoverflow.com/questions/70855",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11190/"
] | Is there a realistic way of implementing a multi-threaded model in PHP whether truly, or just simulating it. Some time back it was suggested that you could force the operating system to load another instance of the PHP executable and handle other simultaneous processes.
The problem with this is that when the PHP code ... | Multi-threading is possible in php
==================================
Yes you can do multi-threading in PHP with [pthreads](https://github.com/krakjoe/pthreads)
From [the PHP documentation](http://www.php.net/manual/en/intro.pthreads.php):
>
> pthreads is an object-orientated API that provides all of the tools nee... |
70,880 | <p>Say I have the following C++:</p>
<pre><code>char *p = new char[cb];
SOME_STRUCT *pSS = (SOME_STRUCT *) p;
delete pSS;
</code></pre>
<p>Is this safe according to the C++ standard? Do I need to cast back to a <code>char*</code> and then use <code>delete[]</code>? I know it'll work in most C++ compilers, because it'... | [
{
"answer_id": 70904,
"author": "Daniel James",
"author_id": 2434,
"author_profile": "https://Stackoverflow.com/users/2434",
"pm_score": 3,
"selected": false,
"text": "<p>No, it's undefined behaviour - a compiler could plausibly do something different, and as the C++ FAQ entry that <a hr... | 2008/09/16 | [
"https://Stackoverflow.com/questions/70880",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8446/"
] | Say I have the following C++:
```
char *p = new char[cb];
SOME_STRUCT *pSS = (SOME_STRUCT *) p;
delete pSS;
```
Is this safe according to the C++ standard? Do I need to cast back to a `char*` and then use `delete[]`? I know it'll work in most C++ compilers, because it's plain-ordinary-data, with no destructors. Is i... | It's not guaranteed to be safe. Here's a relevant link in the C++ FAQ lite:
[16.13] Can I drop the `[]` when deleting array of some built-in type (`char`, `int`, etc.)?
[http://www.parashift.com/c++-faq-lite/freestore-mgmt.html#faq-16.13](https://isocpp.org/wiki/faq/freestore-mgmt#delete-array-built-ins) |
70,947 | <p>I have a workbook with 20 different pivot tables. Is there any easy way to find all the pivot tables and refresh them in VBA?</p>
| [
{
"answer_id": 70976,
"author": "GSerg",
"author_id": 11683,
"author_profile": "https://Stackoverflow.com/users/11683",
"pm_score": 9,
"selected": true,
"text": "<p>Yes.</p>\n\n<pre><code>ThisWorkbook.RefreshAll\n</code></pre>\n\n<p>Or, if your Excel version is old enough,</p>\n\n<pre><c... | 2008/09/16 | [
"https://Stackoverflow.com/questions/70947",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8418/"
] | I have a workbook with 20 different pivot tables. Is there any easy way to find all the pivot tables and refresh them in VBA? | Yes.
```
ThisWorkbook.RefreshAll
```
Or, if your Excel version is old enough,
```
Dim Sheet as WorkSheet, Pivot as PivotTable
For Each Sheet in ThisWorkbook.WorkSheets
For Each Pivot in Sheet.PivotTables
Pivot.RefreshTable
Pivot.Update
Next
Next
``` |
70,956 | <p>Is there a good way to exclude certain pages from using a HTTP module?</p>
<p>I have an application that uses a custom HTTP module to validate a session. The HTTPModule is set up like this in web config:</p>
<pre><code><system.web>
<!-- ... -->
<httpModules>
<add name="SessionValidatio... | [
{
"answer_id": 71790,
"author": "Crob",
"author_id": 2460,
"author_profile": "https://Stackoverflow.com/users/2460",
"pm_score": 5,
"selected": true,
"text": "<p>You could use an HTTPHandler instead of an HTTPModule. Handlers let you specify a path when you declare them in Web.Config. ... | 2008/09/16 | [
"https://Stackoverflow.com/questions/70956",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6308/"
] | Is there a good way to exclude certain pages from using a HTTP module?
I have an application that uses a custom HTTP module to validate a session. The HTTPModule is set up like this in web config:
```
<system.web>
<!-- ... -->
<httpModules>
<add name="SessionValidationModule"
type="SessionValidationMod... | You could use an HTTPHandler instead of an HTTPModule. Handlers let you specify a path when you declare them in Web.Config.
```
<add verb="*" path="/validate/*.aspx" type="Handler,Assembly"/>
```
If you must use an HTTPModule, you could just check the path of the request and if it's one to be excluded, bypass the v... |
70,964 | <p>Originally I am looking for a solution in Actionscript. The point of this question is the algorithm, which detects the exact Minute, when a clock has to switch the Daylight Saving Time. </p>
<p>So for example between the 25th and the 31th of October we have to check, if the actual date is a sunday, it is before or ... | [
{
"answer_id": 154765,
"author": "Benno Richters",
"author_id": 3565,
"author_profile": "https://Stackoverflow.com/users/3565",
"pm_score": 2,
"selected": false,
"text": "<p>There is no real algorithm for dealing with Daylight Saving Time. Basically every country can decide for themselve... | 2008/09/16 | [
"https://Stackoverflow.com/questions/70964",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Originally I am looking for a solution in Actionscript. The point of this question is the algorithm, which detects the exact Minute, when a clock has to switch the Daylight Saving Time.
So for example between the 25th and the 31th of October we have to check, if the actual date is a sunday, it is before or after 2 o'... | There is no real algorithm for dealing with Daylight Saving Time. Basically every country can decide for themselves when -and if- DST starts and ends. The only thing we can do as developers is using some sort of table to look it up. Most computer languages integrate such a table in the language.
In Java you could use ... |
70,992 | <p>Relating to my <a href="https://stackoverflow.com/questions/48733/javahibernate-jpa-designing-the-server-data-reload">earlier question</a>, I want to ensure all the child objects are loaded as I have a multiple threads that may need to access the data (and thus avoid lazy loading exceptions). I understand the way t... | [
{
"answer_id": 71172,
"author": "Jeremy",
"author_id": 4419,
"author_profile": "https://Stackoverflow.com/users/4419",
"pm_score": 3,
"selected": false,
"text": "<p>I'm not sure about using the fetch keyword in your EJBQL, you might be getting it confused with the annotation...</p>\n\n<p... | 2008/09/16 | [
"https://Stackoverflow.com/questions/70992",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48310/"
] | Relating to my [earlier question](https://stackoverflow.com/questions/48733/javahibernate-jpa-designing-the-server-data-reload), I want to ensure all the child objects are loaded as I have a multiple threads that may need to access the data (and thus avoid lazy loading exceptions). I understand the way to do this is to... | Changing the annotation is a bad idea IMO. As it can't be changed to lazy at runtime. Better to make everything lazy, and fetch as needed.
I'm not sure I understand your problem without mappings. Left join fetch should be all you need for the use case you describe. Of course you'll get back an order for every orderlin... |
70,993 | <p>We all know the various ways of testing OO systems. However, it looks like I'll be going to do a project where I'll be dealing with PLC ladder logic (don't ask :/), and I was wondering if there's a good way of testing the validity of the system.</p>
<p>The only way I see so far is simply constructing a huge table w... | [
{
"answer_id": 71105,
"author": "jbdavid",
"author_id": 6314,
"author_profile": "https://Stackoverflow.com/users/6314",
"pm_score": 4,
"selected": true,
"text": "<p>The verification of \"logical\" systems in the IC design arena is known as \"Design Verification\", which is the process of... | 2008/09/16 | [
"https://Stackoverflow.com/questions/70993",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/909/"
] | We all know the various ways of testing OO systems. However, it looks like I'll be going to do a project where I'll be dealing with PLC ladder logic (don't ask :/), and I was wondering if there's a good way of testing the validity of the system.
The only way I see so far is simply constructing a huge table with all kn... | The verification of "logical" systems in the IC design arena is known as "Design Verification", which is the process of ensuring that the system you design in hardware (RTL) implements the desired functionality.
Ladder logic can be transformed to one of the modern HDL's like Verilog..
transform each ladder
```
|--... |
71,000 | <p>I'm trying to create a Zip file from .Net that can be read from Java code.</p>
<p>I've used SharpZipLib to create the Zip file but also if the file generated is valid according to the CheckZip function of the #ZipLib library and can be successfully uncompressed via WinZip or WinRar I always get an error when trying... | [
{
"answer_id": 71060,
"author": "aku",
"author_id": 1196,
"author_profile": "https://Stackoverflow.com/users/1196",
"pm_score": 2,
"selected": false,
"text": "<p>Can't help with SharpZipLib, but you can try to create zip file using <a href=\"http://msdn.microsoft.com/en-us/library/system... | 2008/09/16 | [
"https://Stackoverflow.com/questions/71000",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11673/"
] | I'm trying to create a Zip file from .Net that can be read from Java code.
I've used SharpZipLib to create the Zip file but also if the file generated is valid according to the CheckZip function of the #ZipLib library and can be successfully uncompressed via WinZip or WinRar I always get an error when trying to uncomp... | I have used [DotNetZip library](http://www.codeplex.com/DotNetZip) and it seems to work properly. Typical code:
```
using (ZipFile zipFile = new ZipFile())
{
zipFile.AddDirectory(sourceFolderPath);
zipFile.Save(archiveFolderName);
}
``` |
71,022 | <p>How do you return 1 value per row of the max of several columns:</p>
<p><strong>TableName</strong></p>
<pre><code>[Number, Date1, Date2, Date3, Cost]
</code></pre>
<p>I need to return something like this:</p>
<pre><code>[Number, Most_Recent_Date, Cost]
</code></pre>
<p>Query?</p>
| [
{
"answer_id": 71045,
"author": "Lasse V. Karlsen",
"author_id": 267,
"author_profile": "https://Stackoverflow.com/users/267",
"pm_score": 9,
"selected": true,
"text": "<p>This is an old answer and broken in many way.</p>\n<p>See <a href=\"https://stackoverflow.com/a/6871572/194653\">htt... | 2008/09/16 | [
"https://Stackoverflow.com/questions/71022",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11703/"
] | How do you return 1 value per row of the max of several columns:
**TableName**
```
[Number, Date1, Date2, Date3, Cost]
```
I need to return something like this:
```
[Number, Most_Recent_Date, Cost]
```
Query? | This is an old answer and broken in many way.
See <https://stackoverflow.com/a/6871572/194653> which has way more upvotes and works with sql server 2008+ and handles nulls, etc.
**Original but problematic answer**:
Well, you can use the CASE statement:
```
SELECT
CASE
WHEN Date1 >= Date2 AND Date1 >= Da... |
71,030 | <p>I'm aware I can add maven repositories for fetching dependencies in ~/.m2/settings.xml. But is it possible to add a repository using command line, something like:</p>
<pre><code>mvn install -Dmaven.repository=http://example.com/maven2
</code></pre>
<p>The reason I want to do this is because I'm using a continuous ... | [
{
"answer_id": 71132,
"author": "Jorge Ferreira",
"author_id": 6508,
"author_profile": "https://Stackoverflow.com/users/6508",
"pm_score": 3,
"selected": false,
"text": "<p>I am not sure if you can do it using the command line. You can on the other hand add repositories in the <strong>po... | 2008/09/16 | [
"https://Stackoverflow.com/questions/71030",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1113/"
] | I'm aware I can add maven repositories for fetching dependencies in ~/.m2/settings.xml. But is it possible to add a repository using command line, something like:
```
mvn install -Dmaven.repository=http://example.com/maven2
```
The reason I want to do this is because I'm using a continuous integration tool where I h... | You can do this but you're probably better off doing it in the POM as others have said.
On the command line you can specify a property for the local repository, and another repository for the remote repositories. The remote repository will have all default settings though
The example below specifies two remote reposi... |
71,074 | <p>I can make Firefox not display the ugly dotted focus outlines on <b>links</b> with this:</p>
<pre class="lang-css prettyprint-override"><code>a:focus {
outline: none;
}
</code></pre>
<p>But how can I do this for <code><button></code> tags as well? When I do this:</p>
<pre class="lang-css prettyprint-o... | [
{
"answer_id": 71251,
"author": "Vitaly Sharovatov",
"author_id": 6647,
"author_profile": "https://Stackoverflow.com/users/6647",
"pm_score": 3,
"selected": false,
"text": "<p>There's no way to remove these dotted focus in Firefox using CSS.</p>\n\n<p>If you have access to the computers ... | 2008/09/16 | [
"https://Stackoverflow.com/questions/71074",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4639/"
] | I can make Firefox not display the ugly dotted focus outlines on **links** with this:
```css
a:focus {
outline: none;
}
```
But how can I do this for `<button>` tags as well? When I do this:
```css
button:focus {
outline: none;
}
```
the buttons still have the dotted focus outline when I click on them... | ```css
button::-moz-focus-inner {
border: 0;
}
``` |
71,108 | <p>Under what circumstances might you want to use multiple indirection (that is, a chain of pointers as in <code>Foo **</code>) in C++?</p>
| [
{
"answer_id": 71143,
"author": "aku",
"author_id": 1196,
"author_profile": "https://Stackoverflow.com/users/1196",
"pm_score": 3,
"selected": false,
"text": "<p>IMO most common usage is to pass reference to pointer variable</p>\n\n<pre><code>void test(int ** var)\n{\n ...\n}\n\nint *foo... | 2008/09/16 | [
"https://Stackoverflow.com/questions/71108",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11575/"
] | Under what circumstances might you want to use multiple indirection (that is, a chain of pointers as in `Foo **`) in C++? | Most common usage as @aku pointed out is to allow a change to a pointer parameter to be visible after the function returns.
```
#include <iostream>
using namespace std;
struct Foo {
int a;
};
void CreateFoo(Foo** p) {
*p = new Foo();
(*p)->a = 12;
}
int main(int argc, char* argv[])
{
Foo* p = NULL;... |
71,118 | <p>I have developed a simple page using JQuery. It works fine in almost all browsers (i.e. Firefox, IE, Chrome) but whenever the page is opened in IE, it prompts Javascript error like,</p>
<pre><code>'guid' is null or not an object on line 1834
</code></pre>
<p>Do you have any idea ?</p>
| [
{
"answer_id": 71269,
"author": "Wouter Lievens",
"author_id": 7927,
"author_profile": "https://Stackoverflow.com/users/7927",
"pm_score": 0,
"selected": false,
"text": "<p>Maybe you're using the parentNode or parentElement property? There are some issues with that in IE vs other browser... | 2008/09/16 | [
"https://Stackoverflow.com/questions/71118",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/959/"
] | I have developed a simple page using JQuery. It works fine in almost all browsers (i.e. Firefox, IE, Chrome) but whenever the page is opened in IE, it prompts Javascript error like,
```
'guid' is null or not an object on line 1834
```
Do you have any idea ? | Thanks guys for your messages.
The error was on my part. For hover event, I was not passing function for "out". Therefore the handler was passed as undefined in jQuery.event function and that causing error for statement ,
if ( !handler.guid )
written at 1834 line of jquery-1.2.6.js file.
While using I thought that ... |
71,151 | <p>Using the Python Documentation I found the <a href="http://docs.python.org/lib/module-HTMLParser.html" rel="noreferrer">HTML parser</a> but I have no idea which library to import to use it, how do I find this out (bearing in mind it doesn't say on the page).</p>
| [
{
"answer_id": 71161,
"author": "1077",
"author_id": 10776,
"author_profile": "https://Stackoverflow.com/users/10776",
"pm_score": 5,
"selected": true,
"text": "<p>Try:</p>\n\n<pre><code>import HTMLParser\n</code></pre>\n\n<p>In Python 3.0, the HTMLParser module has been renamed to html.... | 2008/09/16 | [
"https://Stackoverflow.com/questions/71151",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1384652/"
] | Using the Python Documentation I found the [HTML parser](http://docs.python.org/lib/module-HTMLParser.html) but I have no idea which library to import to use it, how do I find this out (bearing in mind it doesn't say on the page). | Try:
```
import HTMLParser
```
In Python 3.0, the HTMLParser module has been renamed to html.parser
you can check about this [here](http://docs.python.org/library/htmlparser.html)
Python 3.0
```
import html.parser
```
Python 2.2 and above
```
import HTMLParser
``` |
71,157 | <p>I may have this completely wrong, but my understanding is that the --standalone compiler option tells the compiler to include the F# core and other dependencies in the exe, so that you can run it on another machine without installing any 'runtime'.</p>
<p>However, I can't get this to work in the CTP - it doesn't ev... | [
{
"answer_id": 71200,
"author": "aku",
"author_id": 1196,
"author_profile": "https://Stackoverflow.com/users/1196",
"pm_score": 1,
"selected": false,
"text": "<p>F# manual: <a href=\"http://research.microsoft.com/fsharp/manual/compiler.aspx#Standalone\" rel=\"nofollow noreferrer\">Static... | 2008/09/16 | [
"https://Stackoverflow.com/questions/71157",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11410/"
] | I may have this completely wrong, but my understanding is that the --standalone compiler option tells the compiler to include the F# core and other dependencies in the exe, so that you can run it on another machine without installing any 'runtime'.
However, I can't get this to work in the CTP - it doesn't even seem to... | Answer from MS:
*There is a CTP update 1.9.6.2 that fixed some --standalone bugs.*
I'm reinstalling now...
UPDATE:
Works for me - so the my accepted answer is **download CTP update 1.9.6.2**. |
71,180 | <p>How can I find the last row that contains data in a specific column and on a specific sheet?</p>
| [
{
"answer_id": 71197,
"author": "Galwegian",
"author_id": 3201,
"author_profile": "https://Stackoverflow.com/users/3201",
"pm_score": -1,
"selected": false,
"text": "<pre><code>Function LastRow(rng As Range) As Long\n Dim iRowN As Long\n Dim iRowI As Long\n Dim iColN As Integer\... | 2008/09/16 | [
"https://Stackoverflow.com/questions/71180",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8418/"
] | How can I find the last row that contains data in a specific column and on a specific sheet? | How about:
```
Function GetLastRow(strSheet, strColumn) As Long
Dim MyRange As Range
Set MyRange = Worksheets(strSheet).Range(strColumn & "1")
GetLastRow = Cells(Rows.Count, MyRange.Column).End(xlUp).Row
End Function
```
Regarding a comment, this will return the row number of the last cell even when onl... |
71,257 | <p>How do I suspend a whole process (like the Process Explorer does when I click Suspend) in C#.</p>
<p>I'm starting the Process with Process.Start, and on a certain event, I want to suspend the process to be able to do some investigation on a "snapshot" of it.</p>
| [
{
"answer_id": 71290,
"author": "Dave Moore",
"author_id": 6996,
"author_profile": "https://Stackoverflow.com/users/6996",
"pm_score": 1,
"selected": false,
"text": "<p>See this CodeProject article for the win32 basics : <a href=\"http://www.codeproject.com/KB/threads/pausep.aspx\" rel=\... | 2008/09/16 | [
"https://Stackoverflow.com/questions/71257",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9632/"
] | How do I suspend a whole process (like the Process Explorer does when I click Suspend) in C#.
I'm starting the Process with Process.Start, and on a certain event, I want to suspend the process to be able to do some investigation on a "snapshot" of it. | Here's my suggestion:
```
[Flags]
public enum ThreadAccess : int
{
TERMINATE = (0x0001),
SUSPEND_RESUME = (0x0002),
GET_CONTEXT = (0x0008),
SET_CONTEXT = (0x0010),
SET_INFORMATION = (0x0020),
QUERY_INFORMATION = (0x0040),
SET_THREAD_TOKEN = (0x0080),
IMPERSONATE... |
71,309 | <p>for example this code</p>
<pre><code>var html = "<p>This text is <a href=#> good</a></p>";
var newNode = Builder.node('div',{className: 'test'},[html]);
$('placeholder').update(newNode);
</code></pre>
<p>casues the p and a tags to be shown, how do I prevent them from being escaped?</p>
| [
{
"answer_id": 71371,
"author": "Leo Lännenmäki",
"author_id": 2451,
"author_profile": "https://Stackoverflow.com/users/2451",
"pm_score": 3,
"selected": true,
"text": "<p>The last parameter to Builder.node is \"Array, List of other nodes to be appended as children\" according to the <a ... | 2008/09/16 | [
"https://Stackoverflow.com/questions/71309",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6892/"
] | for example this code
```
var html = "<p>This text is <a href=#> good</a></p>";
var newNode = Builder.node('div',{className: 'test'},[html]);
$('placeholder').update(newNode);
```
casues the p and a tags to be shown, how do I prevent them from being escaped? | The last parameter to Builder.node is "Array, List of other nodes to be appended as children" according to the [Wiki](http://github.com/madrobby/scriptaculous/wikis/builder). So when you pass it a string it is treated like text.
You could use:
```
var a = Builder.node('div').update("<a href='#'>foo</a>")
```
Where ... |
71,323 | <p>I'm trying to replace each <code>,</code> in the current file by a new line:</p>
<pre><code>:%s/,/\n/g
</code></pre>
<p>But it inserts what looks like a <code>^@</code> instead of an actual newline. The file is not in DOS mode or anything.</p>
<p>What should I do?</p>
<p>If you are curious, like me, check the q... | [
{
"answer_id": 71334,
"author": "Konrad Rudolph",
"author_id": 1968,
"author_profile": "https://Stackoverflow.com/users/1968",
"pm_score": 13,
"selected": true,
"text": "<h2>Use <code>\\r</code> instead of <code>\\n</code>.</h2>\n<p>Substituting by <code>\\n</code> inserts a null charact... | 2008/09/16 | [
"https://Stackoverflow.com/questions/71323",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5190/"
] | I'm trying to replace each `,` in the current file by a new line:
```
:%s/,/\n/g
```
But it inserts what looks like a `^@` instead of an actual newline. The file is not in DOS mode or anything.
What should I do?
If you are curious, like me, check the question *[Why is \r a newline for Vim?](https://stackoverflow.... | Use `\r` instead of `\n`.
-------------------------
Substituting by `\n` inserts a null character into the text. To get a newline, use `\r`. When *searching* for a newline, you’d still use `\n`, however. This asymmetry is due to the fact that `\n` and `\r` [do slightly different things](http://vim.wikia.com/wiki/Searc... |
71,328 | <p>I have PHP configured so that magic quotes are on and register globals are off.</p>
<p>I do my best to always call htmlentities() for anything I am outputing that is derived from user input.</p>
<p>I also occasionally seach my database for common things used in xss attached such as...</p>
<pre><code><script
</... | [
{
"answer_id": 71358,
"author": "Konrad Rudolph",
"author_id": 1968,
"author_profile": "https://Stackoverflow.com/users/1968",
"pm_score": 2,
"selected": false,
"text": "<p>Escaping all user input is enough for most sites. Also make sure that session IDs don't end up in the URL so they c... | 2008/09/16 | [
"https://Stackoverflow.com/questions/71328",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4012/"
] | I have PHP configured so that magic quotes are on and register globals are off.
I do my best to always call htmlentities() for anything I am outputing that is derived from user input.
I also occasionally seach my database for common things used in xss attached such as...
```
<script
```
What else should I be doing... | Escaping input is not the best you can do for successful XSS prevention. Also output must be escaped. If you use Smarty template engine, you may use `|escape:'htmlall'` modifier to convert all sensitive characters to HTML entities (I use own `|e` modifier which is alias to the above).
My approach to input/output secur... |
71,413 | <p>Given a table of votes (users vote for a choice, and must supply an email address):</p>
<pre><code>votes
--
id: int
choice: int
timestamp: timestamp
ip: varchar
email: varchar
</code></pre>
<p>What's the best way to count "unique" votes (a user being a unique combination of email + ip) given the constraint they ma... | [
{
"answer_id": 71430,
"author": "Galwegian",
"author_id": 3201,
"author_profile": "https://Stackoverflow.com/users/3201",
"pm_score": 2,
"selected": false,
"text": "<p>Something like </p>\n\n<pre><code>select email, ip, count(choice)\nfrom votes\ngroup by email, ip, datepart(hour, timest... | 2008/09/16 | [
"https://Stackoverflow.com/questions/71413",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Given a table of votes (users vote for a choice, and must supply an email address):
```
votes
--
id: int
choice: int
timestamp: timestamp
ip: varchar
email: varchar
```
What's the best way to count "unique" votes (a user being a unique combination of email + ip) given the constraint they may only vote *twice* per ho... | Something like
```
select email, ip, count(choice)
from votes
group by email, ip, datepart(hour, timestamp)
```
If I understand correctly |
71,416 | <p>I'm trying to do something like the following:</p>
<pre><code>enum E;
void Foo(E e);
enum E {A, B, C};
</code></pre>
<p>which the compiler rejects. I've had a quick look on Google and the consensus seems to be "you can't do it", but I can't understand why. Can anyone explain?</p>
<p>Clarification 2: I'm doing... | [
{
"answer_id": 71428,
"author": "prakash",
"author_id": 123,
"author_profile": "https://Stackoverflow.com/users/123",
"pm_score": 1,
"selected": false,
"text": "<p>It seems it can not be forward-declared in GCC!</p>\n<p>An interesting discussion is <a href=\"http://bytes.com/forum/thread... | 2008/09/16 | [
"https://Stackoverflow.com/questions/71416",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11437/"
] | I'm trying to do something like the following:
```
enum E;
void Foo(E e);
enum E {A, B, C};
```
which the compiler rejects. I've had a quick look on Google and the consensus seems to be "you can't do it", but I can't understand why. Can anyone explain?
Clarification 2: I'm doing this as I have private methods in ... | The reason the enum can't be forward declared is that, without knowing the values, the compiler can't know the storage required for the enum variable. C++ compilers are allowed to specify the actual storage space based on the size necessary to contain all the values specified. If all that is visible is the forward decl... |
71,417 | <p>From question <em><a href="https://stackoverflow.com/questions/71323/how-to-replace-a-character-for-a-newline-in-vim">How to replace a character for a newline in Vim?</a></em>. You have to use \r when replacing text for a newline, like this</p>
<pre><code>:%s/%/\r/g
</code></pre>
<p>But when replacing end of lines... | [
{
"answer_id": 71531,
"author": "Aristotle Pagaltzis",
"author_id": 9410,
"author_profile": "https://Stackoverflow.com/users/9410",
"pm_score": 6,
"selected": false,
"text": "<h3><a href=\"http://vimdoc.sf.net/htmldoc/pattern.html#NL-used-for-Nul\" rel=\"noreferrer\"><code>:help NL-used-... | 2008/09/16 | [
"https://Stackoverflow.com/questions/71417",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5190/"
] | From question *[How to replace a character for a newline in Vim?](https://stackoverflow.com/questions/71323/how-to-replace-a-character-for-a-newline-in-vim)*. You have to use \r when replacing text for a newline, like this
```
:%s/%/\r/g
```
But when replacing end of lines and newlines for a character, you can do it... | From [vim docs on patterns](http://vimdoc.sourceforge.net/htmldoc/pattern.html#/%5Cr):
>
> `\r` matches <CR>
>
>
> `\n` matches an end-of-line -
> When matching in a string instead of
> buffer text a literal newline
> character is matched.
>
>
> |
71,419 | <p>I've heard many programmers, particularly Delphi programmers scorn the use of 'with'. </p>
<p>I thought it made programs run faster (only one reference to parent object) and that it was easier to read the code if used sensibly (less than a dozen lines of code and no nesting).</p>
<p>Here's an example:</p>
<pre><... | [
{
"answer_id": 71432,
"author": "Ralph M. Rickenbach",
"author_id": 4549416,
"author_profile": "https://Stackoverflow.com/users/4549416",
"pm_score": 2,
"selected": false,
"text": "<p>I do not like it because it makes debbuging a hassle. You cannot read the value of a variable or the lik... | 2008/09/16 | [
"https://Stackoverflow.com/questions/71419",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11781/"
] | I've heard many programmers, particularly Delphi programmers scorn the use of 'with'.
I thought it made programs run faster (only one reference to parent object) and that it was easier to read the code if used sensibly (less than a dozen lines of code and no nesting).
Here's an example:
```
procedure TBitmap32.Fill... | One annoyance with using with is that the debugger can't handle it. So it makes debugging more difficult.
A bigger problem is that it is less easy to read the code. Especially if the with statement is a bit longer.
```
procedure TMyForm.ButtonClick(...)
begin
with OtherForm do begin
Left := 10;
Top := 20;
... |
71,423 | <p>I want to disable the selection of certain rows in a datagridview.</p>
<p>It must be possible to remove the select property for one or more datagridview rows in a datagridview shown in a winform. The goal is that the user can't select certain rows. (depending on a condition)</p>
<p>Thankx,</p>
| [
{
"answer_id": 71665,
"author": "szevvy",
"author_id": 11437,
"author_profile": "https://Stackoverflow.com/users/11437",
"pm_score": 5,
"selected": true,
"text": "<p>If SelectionMode is FullRowSelect, then you'll need to override SetSelectedRowCore for that DataGridView, and not call the... | 2008/09/16 | [
"https://Stackoverflow.com/questions/71423",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4392/"
] | I want to disable the selection of certain rows in a datagridview.
It must be possible to remove the select property for one or more datagridview rows in a datagridview shown in a winform. The goal is that the user can't select certain rows. (depending on a condition)
Thankx, | If SelectionMode is FullRowSelect, then you'll need to override SetSelectedRowCore for that DataGridView, and not call the base SetSelectedRowCore for rows you don't want selected.
If SelectionMode is not FullRowSelect, you'll want to additionally override SetSelectedCellCore (and not call the base SetSelectedCellCore... |
71,440 | <p>I have a UserControl in my Asp.net project that has a public property. I do not want this property to show up in the Visual Studio Property Window when a user highlights an instance of the UserControl in the IDE. What attribute (or other method) should I use to prevent it from showing up?</p>
<pre><code>class MyCon... | [
{
"answer_id": 71454,
"author": "Phil Wright",
"author_id": 6276,
"author_profile": "https://Stackoverflow.com/users/6276",
"pm_score": 5,
"selected": true,
"text": "<p>Use the following attribute ...</p>\n\n<pre><code>using System.ComponentModel;\n\n[Browsable(false)]\npublic bool Sampl... | 2008/09/16 | [
"https://Stackoverflow.com/questions/71440",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51/"
] | I have a UserControl in my Asp.net project that has a public property. I do not want this property to show up in the Visual Studio Property Window when a user highlights an instance of the UserControl in the IDE. What attribute (or other method) should I use to prevent it from showing up?
```
class MyControl : System.... | Use the following attribute ...
```
using System.ComponentModel;
[Browsable(false)]
public bool SampleProperty { get; set; }
```
In VB.net, this [will be](https://stackoverflow.com/questions/71440/set-a-usercontrol-property-to-not-show-up-in-vs-properties-window#71481):
```
<System.ComponentModel.Browsable(False)>... |
71,468 | <p>Does anybody know of a tool to test OCSP responses? Preferably, something that can be used from a Windows Command-line and/or can be included (easily) in a Java/python program </p>
| [
{
"answer_id": 71674,
"author": "Alexey Feldgendler",
"author_id": 10682,
"author_profile": "https://Stackoverflow.com/users/10682",
"pm_score": 1,
"selected": false,
"text": "<p>The newpki client claims to be able to do that.\n<a href=\"http://www.newpki.org/\" rel=\"nofollow noreferrer... | 2008/09/16 | [
"https://Stackoverflow.com/questions/71468",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Does anybody know of a tool to test OCSP responses? Preferably, something that can be used from a Windows Command-line and/or can be included (easily) in a Java/python program | Looking a bit more, I think I've found some answers:
a) OpenSSL at the rescue:
```
openssl ocsp -whatever
```
For more info, <http://www.openssl.org/docs/apps/ocsp.html>
b) <http://www.openvalidation.org/> is another way of testing a cert. And via its links, I got to:
* <http://security.polito.it/tools/ocsp/>
* A... |
71,469 | <p>Let's assume we've got the following Java code:</p>
<pre><code>public class Maintainer {
private Map<Enum, List<Listener>> map;
public Maintainer() {
this.map = new java.util.ConcurrentHashMap<Enum, List<Listener>>();
}
public void addListener( Listener listener, Enum eve... | [
{
"answer_id": 71504,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 3,
"selected": true,
"text": "<p>What would be wrong with doing something like the following:</p>\n\n<p>Defining a 'Maintainer' interface with the addListener... | 2008/09/16 | [
"https://Stackoverflow.com/questions/71469",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7345/"
] | Let's assume we've got the following Java code:
```
public class Maintainer {
private Map<Enum, List<Listener>> map;
public Maintainer() {
this.map = new java.util.ConcurrentHashMap<Enum, List<Listener>>();
}
public void addListener( Listener listener, Enum eventType ) {
List<Listener> listen... | What would be wrong with doing something like the following:
Defining a 'Maintainer' interface with the addListener(Listener, Enum) method.
Create a DefaultMaintainer class (as above) which implements Maintainer.
Then, in each Listener class, 'inject' the Maintainer interface (constructor injection might be a good c... |
71,478 | <p>Is it possible in <code>PHP (as it is in C++)</code> to declare a <code>class method</code> OUTSIDE the <code>class definition?</code></p>
| [
{
"answer_id": 71502,
"author": "Silver Dragon",
"author_id": 9440,
"author_profile": "https://Stackoverflow.com/users/9440",
"pm_score": 1,
"selected": false,
"text": "<p>No. </p>\n\n<p>You can extend previously declared classes, though, if that helps.</p>\n"
},
{
"answer_id": 7... | 2008/09/16 | [
"https://Stackoverflow.com/questions/71478",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Is it possible in `PHP (as it is in C++)` to declare a `class method` OUTSIDE the `class definition?` | No, as of PHP 5.2. However, you may use `__call` magic method to forward call to arbitrary function or method.
```
class A {
public function __call($method, $args) {
if ($method == 'foo') {
return call_user_func_array('bar', $args);
}
}
}
function bar($x) {
echo $x;
}
$a = n... |
71,518 | <p>I just tried FxCop. It does detect unused private methods, but not unused public. Is there a custom rule that I can download, plug-in that will detect public methods that aren't called from within the same assembly?</p>
| [
{
"answer_id": 71538,
"author": "Loofer",
"author_id": 5552,
"author_profile": "https://Stackoverflow.com/users/5552",
"pm_score": 2,
"selected": false,
"text": "<p><a href=\"http://www.ndepend.com/\" rel=\"nofollow noreferrer\">NDepend</a> is your friend for this kind of thing</p>\n"
... | 2008/09/16 | [
"https://Stackoverflow.com/questions/71518",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9328/"
] | I just tried FxCop. It does detect unused private methods, but not unused public. Is there a custom rule that I can download, plug-in that will detect public methods that aren't called from within the same assembly? | Corey, my answer of using FxCop had assumed you were interested in removing unused private members, however to solve the problem with other cases you can try using [NDepend](http://www.ndepend.com/). Here is some CQL to detect unused public members (adapted from an article listed below):
```
// <Name>Potentially unuse... |
71,534 | <p>I hope I haven't painted myself into a corner. I've gotten what seems to be most of the way through implementing a Makefile and I can't get the last bit to work. I hope someone here can suggest a technique to do what I'm trying to do.</p>
<p>I have what I'll call "bills of materials" in version controlled files i... | [
{
"answer_id": 71623,
"author": "mbyrne215",
"author_id": 5241,
"author_profile": "https://Stackoverflow.com/users/5241",
"pm_score": 0,
"selected": false,
"text": "<p>I'm not a make expert, but I would try have $(BOMS) depend on $(SIGS), and making the $(SIGS) target execute the if/else... | 2008/09/16 | [
"https://Stackoverflow.com/questions/71534",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7685/"
] | I hope I haven't painted myself into a corner. I've gotten what seems to be most of the way through implementing a Makefile and I can't get the last bit to work. I hope someone here can suggest a technique to do what I'm trying to do.
I have what I'll call "bills of materials" in version controlled files in a source r... | Make is very bad at being able to detect actual file changes, as opposed to just updated timestamps.
It sounds to me that the root of the problem is that the bom-checkout always modifies the timestamp of the bom, causing the dependencies to be regenerated. I would probably try to solve this problem instead -- try to ... |
71,561 | <p>In a web interface, I've got a text field. When user enters text and accepts with enter, application performs an action.</p>
<p>I wanted to test the behavior with Selenium. Unfortunately, invoking 'keypress' with chr(13) insert representation of the character into the field.</p>
<p>Is there a way other then submit... | [
{
"answer_id": 71580,
"author": "Scott Gowell",
"author_id": 6943,
"author_profile": "https://Stackoverflow.com/users/6943",
"pm_score": 0,
"selected": false,
"text": "<p>Though I haven't tested this I imagine you can use \"\\r\\n\" appended to a string to simulate a new line. If not loo... | 2008/09/16 | [
"https://Stackoverflow.com/questions/71561",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9622/"
] | In a web interface, I've got a text field. When user enters text and accepts with enter, application performs an action.
I wanted to test the behavior with Selenium. Unfortunately, invoking 'keypress' with chr(13) insert representation of the character into the field.
Is there a way other then submitting the form? I'... | This Java code works for me:
```
selenium.keyDown(id, "\\13");
```
Notice the escape. You probably need something like chr(\13) |
71,562 | <p>We're using SQL Server 2005 in a project. The users of the system have the ability to search some objects by using 'keywords'. The way we implement this is by creating a full-text catalog for the significant columns in each table that may contain these 'keywords' and then using CONTAINS to search for the keywords th... | [
{
"answer_id": 71604,
"author": "Darren Gosbell",
"author_id": 11860,
"author_profile": "https://Stackoverflow.com/users/11860",
"pm_score": 3,
"selected": true,
"text": "<p>These \"small words\" are considered \"noise words\" by the full text index. You can customize the list of noise w... | 2008/09/16 | [
"https://Stackoverflow.com/questions/71562",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2384/"
] | We're using SQL Server 2005 in a project. The users of the system have the ability to search some objects by using 'keywords'. The way we implement this is by creating a full-text catalog for the significant columns in each table that may contain these 'keywords' and then using CONTAINS to search for the keywords the u... | These "small words" are considered "noise words" by the full text index. You can customize the list of noise words. This [blog post](http://arcanecode.wordpress.com/2008/05/29/creating-and-customizing-noise-words-in-sql-server-2005-full-text-search/) provides more details. You need to repopulate your full text index wh... |
71,565 | <p>If I have the following:</p>
<pre><code>Public Class Product
Public Id As Integer
Public Name As String
Public AvailableColours As List(Of Colour)
Public AvailableSizes As List(Of Size)
End Class
</code></pre>
<p>and I want to get a list of products from the database and display them on a page alon... | [
{
"answer_id": 71606,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "<p>Personally, I'd get more data from the database through fewer methods and then bind the UI against only those parts of the d... | 2008/09/16 | [
"https://Stackoverflow.com/questions/71565",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/984/"
] | If I have the following:
```
Public Class Product
Public Id As Integer
Public Name As String
Public AvailableColours As List(Of Colour)
Public AvailableSizes As List(Of Size)
End Class
```
and I want to get a list of products from the database and display them on a page along with their available siz... | You're probably best off benchmarking both and finding out. I've seen situations where just doing multiple queries (MySQL likes this) is faster than JOINs and one big slow query that takes a lot memory and causes the DB server to thrash. I say benchmark because it's going to depend on your database server, how much mem... |
71,578 | <p>I have a database in ISO-8859-2 format, but I need to create XML in UTF-8. This means that I must encode the database before prinitng in UTF-8. I know very little about ASP.Net, so I'm hoping someone can help.</p>
<p>In PHP I would do something like this:</p>
<pre><code>db_connect();
mysql_query("SET NAMES 'UTF8'... | [
{
"answer_id": 71639,
"author": "Mike Dimmick",
"author_id": 6970,
"author_profile": "https://Stackoverflow.com/users/6970",
"pm_score": 1,
"selected": false,
"text": "<p>The .NET Framework's internal string type is UTF-16. All database access will convert to UTF-16 so that you can view ... | 2008/09/16 | [
"https://Stackoverflow.com/questions/71578",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/205368/"
] | I have a database in ISO-8859-2 format, but I need to create XML in UTF-8. This means that I must encode the database before prinitng in UTF-8. I know very little about ASP.Net, so I'm hoping someone can help.
In PHP I would do something like this:
```
db_connect();
mysql_query("SET NAMES 'UTF8'");
mysql_query("SET c... | Assuming you have a value string in `str`, this is the pure-.NET way of doing this.
```
var encoding = System.Text.Encoding.GetEncoding("iso-8859-2");
var bytes = System.Text.Encoding.Convert(encoding, System.Text.Encoding.Default, encoding.GetBytes(str));
var newString = System.Text.Encoding.Default.GetString(bytes... |
71,585 | <p>Since generics were introduced, Class is parametrized, so that List.class produces Class<List>. This is clear.</p>
<p>What I am not able to figure out is how to get a instance of Class of type which is parametrized itself, i.e. Class<List<String>>. Like in this snippet:</p>
<pre><code>public class GenTest... | [
{
"answer_id": 71753,
"author": "Avi",
"author_id": 1605,
"author_profile": "https://Stackoverflow.com/users/1605",
"pm_score": 4,
"selected": true,
"text": "<p>The Class class is a run-time representation of a type. Since parametrized types undergo type erasure at runtime, the class obj... | 2008/09/16 | [
"https://Stackoverflow.com/questions/71585",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7135/"
] | Since generics were introduced, Class is parametrized, so that List.class produces Class<List>. This is clear.
What I am not able to figure out is how to get a instance of Class of type which is parametrized itself, i.e. Class<List<String>>. Like in this snippet:
```
public class GenTest {
static <T> T instantiat... | The Class class is a run-time representation of a type. Since parametrized types undergo type erasure at runtime, the class object for Class would be the same as for Class<List<Integer>> and Class<List<String>>.
The reason you cannot instantiate them using the .class notation is that this is a special syntax used for ... |
71,590 | <p>With this code I can show an animated gif while the server script is running:</p>
<pre><code>function calculateTotals() {
$('#results').load('getResults.php', null, showStatusFinished);
showLoadStatus();
}
function showLoadStatus() {
$('#status').html('');
}
function showStatusFinished() {
$('#st... | [
{
"answer_id": 71648,
"author": "squadette",
"author_id": 7754,
"author_profile": "https://Stackoverflow.com/users/7754",
"pm_score": 0,
"selected": false,
"text": "<p>Your server-side script should somehow keep its progress somewhere on server (file, field in database, memcached, etc.).... | 2008/09/16 | [
"https://Stackoverflow.com/questions/71590",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4639/"
] | With this code I can show an animated gif while the server script is running:
```
function calculateTotals() {
$('#results').load('getResults.php', null, showStatusFinished);
showLoadStatus();
}
function showLoadStatus() {
$('#status').html('');
}
function showStatusFinished() {
$('#status').html('Fi... | After reading your comments to Andrew's answer.
You would read the status like this:
```
function getStatus() {
$.getJSON("/status.php",{"session":0, "requestID":12345},
function(data) { //data is the returned JSON object from the server {name:"value"}
setStatus(data.status);
window.setTi... |
71,599 | <p>I've downloaded the IKVM sources (<a href="http://www.ikvm.net/" rel="nofollow noreferrer">http://www.ikvm.net/</a>) from <a href="http://sourceforge.net/cvs/?group_id=69637" rel="nofollow noreferrer">http://sourceforge.net/cvs/?group_id=69637</a></p>
<p>Now I'm trying to get it to build in Visual Studio 2008 and a... | [
{
"answer_id": 71744,
"author": "Ryan Lanciaux",
"author_id": 1385358,
"author_profile": "https://Stackoverflow.com/users/1385358",
"pm_score": 1,
"selected": false,
"text": "<p>I don't know that this would do it for you but can you try building from the command line?</p>\n\n<p>msbuild _... | 2008/09/16 | [
"https://Stackoverflow.com/questions/71599",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6583/"
] | I've downloaded the IKVM sources (<http://www.ikvm.net/>) from <http://sourceforge.net/cvs/?group_id=69637>
Now I'm trying to get it to build in Visual Studio 2008 and am stuck. Does anyone know of documentation of how to build the thing, or could even give me pointers?
I've tried opening the ikvm8.sln, which opens a... | OK just got the following reply from the author: <http://weblog.ikvm.net/CommentView.aspx?guid=7e91b51d-6f84-4485-b61f-ea9e068a5fcf>
>
> If you want to build from cvs, you're on your own. However, you can more easily build from source if you use an official release.
>
>
> If you download ikvm-0.36.0.11.zip, classpa... |
71,608 | <p>How do you set up your .NET development tree? I use a structure like this:</p>
<pre><code>-projectname
--config (where I put the configuration files)
--doc (where I put all the document concerning the project: e-mails, documentation)
--tools (all the tools I use: Nunit, Moq)
--lib (all the libraries used by ... | [
{
"answer_id": 71676,
"author": "Steven Murawski",
"author_id": 1233,
"author_profile": "https://Stackoverflow.com/users/1233",
"pm_score": 3,
"selected": false,
"text": "<p>Check out these other StackOverflow questions...</p>\n\n<ul>\n<li><a href=\"https://stackoverflow.com/questions/16... | 2008/09/16 | [
"https://Stackoverflow.com/questions/71608",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4093/"
] | How do you set up your .NET development tree? I use a structure like this:
```
-projectname
--config (where I put the configuration files)
--doc (where I put all the document concerning the project: e-mails, documentation)
--tools (all the tools I use: Nunit, Moq)
--lib (all the libraries used by the solution: ... | We use a very similar layout as covered in JP Boodhoo's blog post titled [Directory Structure For Projects](http://blog.developwithpassion.com/2007/10/01/directory-structure-for-projects/). |
71,625 | <p>I have just found a static nested interface in our code-base.</p>
<pre><code>class Foo {
public static interface Bar {
/* snip */
}
/* snip */
}
</code></pre>
<p>I have never seen this before. The original developer is out of reach. Therefore I have to ask SO:</p>
<p>What are the semantics beh... | [
{
"answer_id": 71654,
"author": "Clinton Dreisbach",
"author_id": 6262,
"author_profile": "https://Stackoverflow.com/users/6262",
"pm_score": 3,
"selected": false,
"text": "<p>An inner interface has to be static in order to be accessed. The interface isn't associated with instances of th... | 2008/09/16 | [
"https://Stackoverflow.com/questions/71625",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1870/"
] | I have just found a static nested interface in our code-base.
```
class Foo {
public static interface Bar {
/* snip */
}
/* snip */
}
```
I have never seen this before. The original developer is out of reach. Therefore I have to ask SO:
What are the semantics behind a static interface? What woul... | The static keyword in the above example is redundant (a nested interface is automatically "static") and can be removed with no effect on semantics; I would recommend it be removed. The same goes for "public" on interface methods and "public final" on interface fields - the modifiers are redundant and just add clutter t... |
71,643 | <p>Currently I monitoring a particular file with a simple shell one-liner:</p>
<pre><code>filesize=$(ls -lah somefile | awk '{print $5}')
</code></pre>
<p>I'm aware that Perl has some nice modules to deal with Excel files so the idea is to, let's say, run that check daily, perhaps with cron, and write the result on ... | [
{
"answer_id": 71668,
"author": "Aristotle Pagaltzis",
"author_id": 9410,
"author_profile": "https://Stackoverflow.com/users/9410",
"pm_score": 3,
"selected": false,
"text": "<p>You can use <a href=\"http://p3rl.org/-X\" rel=\"nofollow noreferrer\">the <code>-s</code> operator</a> to obt... | 2008/09/16 | [
"https://Stackoverflow.com/questions/71643",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6992/"
] | Currently I monitoring a particular file with a simple shell one-liner:
```
filesize=$(ls -lah somefile | awk '{print $5}')
```
I'm aware that Perl has some nice modules to deal with Excel files so the idea is to, let's say, run that check daily, perhaps with cron, and write the result on a spreadsheet for further ... | You can check the size of the file using the -s operator.
```
use strict;
use warnings;
use File::Slurp qw(read_file write_file);
use Spreadsheet::ParseExcel;
use Spreadsheet::ParseExcel::SaveParser;
use Spreadsheet::WriteExcel;
my $file = 'path_to_file';
my $size_file = 'path_to_file_keeping_the_size';
my $... |
71,692 | <p>I'm building small web site in Java (Spring MVC with JSP views) and am trying to find best solution for making and including few reusable modules (like "latest news" "upcoming events"...).</p>
<p>So the question is: Portlets, tiles or some other technology?</p>
| [
{
"answer_id": 71737,
"author": "sblundy",
"author_id": 4893,
"author_profile": "https://Stackoverflow.com/users/4893",
"pm_score": 2,
"selected": false,
"text": "<p>Tiles can be a pain. Vast improvement over what came before (i.e. nothing), but rather limiting. </p>\n\n<p><a href=\"http... | 2008/09/16 | [
"https://Stackoverflow.com/questions/71692",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11890/"
] | I'm building small web site in Java (Spring MVC with JSP views) and am trying to find best solution for making and including few reusable modules (like "latest news" "upcoming events"...).
So the question is: Portlets, tiles or some other technology? | If you are using Spring MVC, then I would recommend using Portlets. In Spring, portlets are just lightweight controllers since they are only responsible for a fragment of the whole page, and are very easy to write. If you are using Spring 2.5, then you can enjoy all the benefits of the new annotation support, and they ... |
71,694 | <p>Is there an api to bring the vista side bar to the front (Win+Space) programatically and to do the reverse (send it to the back ground).</p>
| [
{
"answer_id": 71785,
"author": "Cory",
"author_id": 11870,
"author_profile": "https://Stackoverflow.com/users/11870",
"pm_score": 1,
"selected": false,
"text": "<p>Probably using SetWindowPos you can change it to be placed the top / bottom of the z-order or even as the top-most window. ... | 2008/09/16 | [
"https://Stackoverflow.com/questions/71694",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11930/"
] | Is there an api to bring the vista side bar to the front (Win+Space) programatically and to do the reverse (send it to the back ground). | Probably using SetWindowPos you can change it to be placed the top / bottom of the z-order or even as the top-most window. You would need to find the handle to the sidebar using FindWindow or an application like WinSpy.
But after that something like.
Sets the window on top, but not top most.
```
SetWindowPos(sidebar... |
71,766 | <p>In Delphi, I want to be able to create an private object that's associated with a class, and access it from all instances of that class. In Java, I'd use:</p>
<pre><code>public class MyObject {
private static final MySharedObject mySharedObjectInstance = new MySharedObject();
}
</code></pre>
<p>Or, if MyShare... | [
{
"answer_id": 71811,
"author": "CL.",
"author_id": 11654,
"author_profile": "https://Stackoverflow.com/users/11654",
"pm_score": 0,
"selected": false,
"text": "<p>Before version 7, Delphi didn't have static variables, you'd have to use a global variable.</p>\n\n<p>To make it as private ... | 2008/09/16 | [
"https://Stackoverflow.com/questions/71766",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11961/"
] | In Delphi, I want to be able to create an private object that's associated with a class, and access it from all instances of that class. In Java, I'd use:
```
public class MyObject {
private static final MySharedObject mySharedObjectInstance = new MySharedObject();
}
```
Or, if MySharedObject needed more complic... | Here is how I'll do that using a class variable, a class procedure and an initialization block:
```
unit MyObject;
interface
type
TMyObject = class
private
class var FLogger : TLogLogger;
public
class procedure SetLogger(value:TLogLogger);
class procedure FreeLogger;
end;
implementation
cl... |
71,775 | <p>I have to read data from some files and insert the data into different tables in a database. Is Unix shell script powerful enough to do the job?</p>
<p>Is it easy to do the job in shell script or should I go about doing this in Java?</p>
| [
{
"answer_id": 71789,
"author": "Josti",
"author_id": 11231,
"author_profile": "https://Stackoverflow.com/users/11231",
"pm_score": 0,
"selected": false,
"text": "<p>Can't test it right now, but something like:</p>\n\n<pre class=\"lang-sh prettyprint-override\"><code>echo \"INSERT INTO f... | 2008/09/16 | [
"https://Stackoverflow.com/questions/71775",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/184/"
] | I have to read data from some files and insert the data into different tables in a database. Is Unix shell script powerful enough to do the job?
Is it easy to do the job in shell script or should I go about doing this in Java? | If the data you are trying to import is in a reasonable format -- comma-delimited, for example -- and your database server has reasonable command line utilities, this should be no problem. MySQL has the "mysqlimport" command-line tool that will accept various arguments describing the format of the file:
```sh
mysqlimp... |
71,776 | <p>I have 16,000 jpg's from a webcan screeb grabber that I let run for a year pointing into the back year. I want to find a way to grab every 4th image so that I can then put them into another directory so I can later turn them into a movie. Is there a simple bash script or other way under linux that I can do this.</p>... | [
{
"answer_id": 71798,
"author": "Pat",
"author_id": 238,
"author_profile": "https://Stackoverflow.com/users/238",
"pm_score": 1,
"selected": false,
"text": "<p>An easy way in perl (probably easily adaptable to bash) is to glob the filenames in an array then get the sequence number and re... | 2008/09/16 | [
"https://Stackoverflow.com/questions/71776",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11950/"
] | I have 16,000 jpg's from a webcan screeb grabber that I let run for a year pointing into the back year. I want to find a way to grab every 4th image so that I can then put them into another directory so I can later turn them into a movie. Is there a simple bash script or other way under linux that I can do this.
They ... | One simple way is:
```
$ touch a b c d e f g h i j k l m n o p q r s t u v w x y z
$ mv $(ls | awk '{nr++; if (nr % 4 == 0) print $0}') destdir
``` |
71,788 | <p>I'm writing an Emacs major mode for an APL dialect I use at work. I've gotten
basic font locking to work, and after setting comment-start and
comment-start-skip, comment/uncomment region and fill paragraph also
work.</p>
<p>However, comment blocks often contain javadoc style comments and i
would like fill-paragraph... | [
{
"answer_id": 72637,
"author": "Allen",
"author_id": 6043,
"author_profile": "https://Stackoverflow.com/users/6043",
"pm_score": 1,
"selected": false,
"text": "<p>There's other modes that have less complex functions used for <code>fill-paragraph-function</code>. Browsing through my inst... | 2008/09/16 | [
"https://Stackoverflow.com/questions/71788",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11978/"
] | I'm writing an Emacs major mode for an APL dialect I use at work. I've gotten
basic font locking to work, and after setting comment-start and
comment-start-skip, comment/uncomment region and fill paragraph also
work.
However, comment blocks often contain javadoc style comments and i
would like fill-paragraph to avoid ... | The problem was that the paragraph-start regexp has to match the entire line to work, including the actual comment character. The following elisp works for the example I gave:
```
(setq paragraph-start "^\\s-*\\#\\s-*\\\\\\(arg\\|ret\\).*$")
```
Here a page that has an example regexp for php-mode that does this:
<ht... |
71,817 | <p>The problem: I have a class which contains a template method <code>execute</code> which calls another method <code>_execute</code>. Subclasses are supposed to overwrite <code>_execute</code> to implement some specific functionality. This functionality should be documented in the docstring of <code>_execute</code>.
... | [
{
"answer_id": 72126,
"author": "John Montgomery",
"author_id": 5868,
"author_profile": "https://Stackoverflow.com/users/5868",
"pm_score": 0,
"selected": false,
"text": "<p>Well the doc-string is stored in <code>__doc__</code> so it wouldn't be too hard to re-assign it based on the doc-... | 2008/09/16 | [
"https://Stackoverflow.com/questions/71817",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11992/"
] | The problem: I have a class which contains a template method `execute` which calls another method `_execute`. Subclasses are supposed to overwrite `_execute` to implement some specific functionality. This functionality should be documented in the docstring of `_execute`.
Advanced users can create their own subclasses ... | Well, if you don't mind copying the original method in the subclass, you can use the following technique.
```
import new
def copyfunc(func):
return new.function(func.func_code, func.func_globals, func.func_name,
func.func_defaults, func.func_closure)
class Metaclass(type):
def __new__... |
71,820 | <p>I need a function called <code>SizeOfPipe()</code> which should return the size of a pipe - I only want to know how much data is in the pipe and not actually read data off the pipe itself. </p>
<p>I thought the following code would work:</p>
<pre><code>fseek (pPipe, 0 , SEEK_END);
*pBytes = ftell (pPipe);
rewind (... | [
{
"answer_id": 71870,
"author": "moonshadow",
"author_id": 11834,
"author_profile": "https://Stackoverflow.com/users/11834",
"pm_score": 2,
"selected": false,
"text": "<p>It's not in general possible to know the amount of data you can read from a pipe just from the pipe handle alone. The... | 2008/09/16 | [
"https://Stackoverflow.com/questions/71820",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I need a function called `SizeOfPipe()` which should return the size of a pipe - I only want to know how much data is in the pipe and not actually read data off the pipe itself.
I thought the following code would work:
```
fseek (pPipe, 0 , SEEK_END);
*pBytes = ftell (pPipe);
rewind (pPipe);
```
but `fseek()` does... | Depending on your unix implementation ioctl/FIONREAD might do the trick
```
err = ioctl(pipedesc, FIONREAD, &bytesAvailable);
```
Unless this returns the error code for "invalid argument" (or any other error) bytesAvailable contains the amount of data available for unblocking read operations at that time. |
71,853 | <p>I'm using an Xml field in my Sql Server database table. I'm trying to search a word using the XQuery <strong>contains</strong> method but it seems to search <strong>only</strong> in case sensitive mode. The lower method isn't implemented on Sql Server XQuery implementation also.
¿Is there a simple solution to this p... | [
{
"answer_id": 71908,
"author": "aku",
"author_id": 1196,
"author_profile": "https://Stackoverflow.com/users/1196",
"pm_score": 0,
"selected": false,
"text": "<p><em><a href=\"http://www.google.ru/search?complete=1&hl=en&newwindow=1&client=firefox-a&rls=org.mozilla%3Aen-U... | 2008/09/16 | [
"https://Stackoverflow.com/questions/71853",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm using an Xml field in my Sql Server database table. I'm trying to search a word using the XQuery **contains** method but it seems to search **only** in case sensitive mode. The lower method isn't implemented on Sql Server XQuery implementation also.
¿Is there a simple solution to this problem? | If you're using SQL Server 2005, I'm afraid you're out of luck.
If you're using SQL Server 2008, you can use the upper-case function like this :
```
DECLARE @x xml = N'abcDEF!@4';
SELECT @x.value('fn:upper-case(/text()[1])', 'nvarchar(10)');
```
Here's a link on MSDN for the upper-case syntax and a couple search ex... |
71,864 | <p>I want to delete all but the 4 newest directories in my parent directory. How would you do this in Bash?</p>
| [
{
"answer_id": 71891,
"author": "Leigh Caldwell",
"author_id": 3267,
"author_profile": "https://Stackoverflow.com/users/3267",
"pm_score": 4,
"selected": true,
"text": "<pre><code>ls -atrd */ | head --lines=-4 | xargs rm -rf\n</code></pre>\n\n<p><strong>Edit:</strong> added 'a' argument ... | 2008/09/16 | [
"https://Stackoverflow.com/questions/71864",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12015/"
] | I want to delete all but the 4 newest directories in my parent directory. How would you do this in Bash? | ```
ls -atrd */ | head --lines=-4 | xargs rm -rf
```
**Edit:** added 'a' argument to ls |
71,913 | <p>Here is a sample from Kernighan & Ritchie's "The C Programming Language":</p>
<pre><code>int getline(char s[], int lim)
{
int c, i = 0;
while (--lim > 0; && (c=getchar()) !=EOF && c !='\n')
{
s[i++] = c;
}
if (c =='\n')
{
s[i++] = c;
}
s[i] = '\0';
... | [
{
"answer_id": 71935,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "<p>You do that just to exit the while loop on new line. Else you would have to check it in while body and use break.</p>\n"
}... | 2008/09/16 | [
"https://Stackoverflow.com/questions/71913",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11972/"
] | Here is a sample from Kernighan & Ritchie's "The C Programming Language":
```
int getline(char s[], int lim)
{
int c, i = 0;
while (--lim > 0; && (c=getchar()) !=EOF && c !='\n')
{
s[i++] = c;
}
if (c =='\n')
{
s[i++] = c;
}
s[i] = '\0';
return i;
}
```
Why do we should ch... | The functions reads characters from the standard input until either EOF or a newline characters is found.
The second check ensures that the only newline character is put into the char array. EOF shouldn't occur in a proper c-string. Also, if the character isn't newline that means that we might have filled up our c-st... |
71,932 | <p>I'm missing the boat on something here, kids. This keeps rearing its head and I don't know what's going on with it, so I hope my homeys here can help.</p>
<p>When working in Silverlight, when I create bindings in my c# code, they never hold up when the application is running. The declarative bindings from my xaml... | [
{
"answer_id": 72129,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 3,
"selected": false,
"text": "<p>I've just tried the exact code you just posted and it worked fine, with some changes. I believe the problem is the element y... | 2008/09/16 | [
"https://Stackoverflow.com/questions/71932",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/93/"
] | I'm missing the boat on something here, kids. This keeps rearing its head and I don't know what's going on with it, so I hope my homeys here can help.
When working in Silverlight, when I create bindings in my c# code, they never hold up when the application is running. The declarative bindings from my xaml seem ok, bu... | It looks like as of Silverlight 3.1, at least, this is no longer an issue. I can't reproduce it, at any rate. |
71,944 | <p>I am using <code><input type="file" id="fileUpload" runat="server"></code> to upload a file in an ASP.NET application. I would like to limit the file type of the upload (example: limit to .xls or .xlsx file extensions). </p>
<p>Both JavaScript or server-side validation are OK (as long as the server side valid... | [
{
"answer_id": 71987,
"author": "Chris Roberts",
"author_id": 475,
"author_profile": "https://Stackoverflow.com/users/475",
"pm_score": 1,
"selected": false,
"text": "<p>Well - you won't be able to do it server-side on post-back as the file will get submitted (uploaded) during the post-b... | 2008/09/16 | [
"https://Stackoverflow.com/questions/71944",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51/"
] | I am using `<input type="file" id="fileUpload" runat="server">` to upload a file in an ASP.NET application. I would like to limit the file type of the upload (example: limit to .xls or .xlsx file extensions).
Both JavaScript or server-side validation are OK (as long as the server side validation would take place befo... | Seems like you are going to have limited options since you want the check to occur before the upload. I think the best you are going to get is to use javascript to validate the extension of the file. You could build a hash of valid extensions and then look to see if the extension of the file being uploaded existed in t... |
71,959 | <p>I have my own class inside the file "Particles.h" and the class's implementation is inside "Particles.cpp"</p>
<p>I want the file "Load.h" to recognize my classes inside there, so I've added the line</p>
<pre><code>#include "Particles.h"
</code></pre>
<p>and the file doesn't recognize it and in the past everythin... | [
{
"answer_id": 71984,
"author": "mrgroucho",
"author_id": 10870,
"author_profile": "https://Stackoverflow.com/users/10870",
"pm_score": 2,
"selected": false,
"text": "<p>It sounds like your include path - the list of directories that the compiler scans in order to locate files that you #... | 2008/09/16 | [
"https://Stackoverflow.com/questions/71959",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have my own class inside the file "Particles.h" and the class's implementation is inside "Particles.cpp"
I want the file "Load.h" to recognize my classes inside there, so I've added the line
```
#include "Particles.h"
```
and the file doesn't recognize it and in the past everything was OK (I haven't made any chan... | It sounds like your include path - the list of directories that the compiler scans in order to locate files that you #include - is set incorrectly. Which compiler are you using? |
71,985 | <p>How can I copy a line 10 times easily in Emacs? I can't find a copy-line shortcut or function. I can use C-aC-spcC-eM-w to laboriously copy the line but how can I then paste it more than once?</p>
<p>Any ideas before I go and write my own functions.</p>
| [
{
"answer_id": 72008,
"author": "mmattax",
"author_id": 1638,
"author_profile": "https://Stackoverflow.com/users/1638",
"pm_score": 0,
"selected": false,
"text": "<p>You will want to kill the line: C-a C-k, and then C-y or ?</p>\n"
},
{
"answer_id": 72039,
"author": "ljs",
... | 2008/09/16 | [
"https://Stackoverflow.com/questions/71985",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9831/"
] | How can I copy a line 10 times easily in Emacs? I can't find a copy-line shortcut or function. I can use C-aC-spcC-eM-w to laboriously copy the line but how can I then paste it more than once?
Any ideas before I go and write my own functions. | **Copying**:
If you frequently work with lines, you might want to make copy (`kill-ring-save`) and cut (`kill-region`) work on lines when no region is selected:
```
(defadvice kill-ring-save (before slickcopy activate compile)
"When called interactively with no active region, copy a single line instead."
(interac... |
72,010 | <p>Given the following example, why do I have to explicitly use the statement <code>b->A::DoSomething()</code> rather than just <code>b->DoSomething()</code>?</p>
<p>Shouldn't the compiler's overload resolution figure out which method I'm talking about?</p>
<p>I'm using Microsoft VS 2005. (Note: using virtual d... | [
{
"answer_id": 72075,
"author": "Konrad Rudolph",
"author_id": 1968,
"author_profile": "https://Stackoverflow.com/users/1968",
"pm_score": 6,
"selected": true,
"text": "<p>The two “overloads” aren't in the same scope. By default, the compiler only considers the smallest possible name sco... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72010",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12083/"
] | Given the following example, why do I have to explicitly use the statement `b->A::DoSomething()` rather than just `b->DoSomething()`?
Shouldn't the compiler's overload resolution figure out which method I'm talking about?
I'm using Microsoft VS 2005. (Note: using virtual doesn't help in this case.)
```
class A
{
p... | The two “overloads” aren't in the same scope. By default, the compiler only considers the smallest possible name scope until it finds a name match. Argument matching is done *afterwards*. In your case this means that the compiler sees `B::DoSomething`. It then tries to match the argument list, which fails.
One solutio... |
72,014 | <p>What are some important practices to follow when creating a .NET assembly that is going to be embedded to SQL Server 2005?</p>
<p>I am brand new to this, and I've found that there are significant method attributes like:</p>
<pre><code>[SqlFunction(FillRowMethodName = "FillRow", TableDefinition = "letter nchar(1)")... | [
{
"answer_id": 72113,
"author": "chakrit",
"author_id": 3055,
"author_profile": "https://Stackoverflow.com/users/3055",
"pm_score": 3,
"selected": true,
"text": "<p>Some that I remember:</p>\n\n<ul>\n<li>Keep its usage to a minimum, only use it when T-SQL proved too complex.</li>\n<li>Av... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72014",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11947/"
] | What are some important practices to follow when creating a .NET assembly that is going to be embedded to SQL Server 2005?
I am brand new to this, and I've found that there are significant method attributes like:
```
[SqlFunction(FillRowMethodName = "FillRow", TableDefinition = "letter nchar(1)")]
```
I'm also look... | Some that I remember:
* Keep its usage to a minimum, only use it when T-SQL proved too complex.
* Avoid pointers/cursors at all costs because a for loop is so easily abusable in CLR context.
* Only use the SQL-Server native data types unless totally necessary.
Can't remember where I've found the information, but thos... |
72,048 | <p>I admit I know enough about COM and IE architecture only to be dangerous. I have a working C# .NET ActiveX control similar to this:</p>
<pre><code>using System;
using System.Runtime.InteropServices;
using BrowseUI;
using mshtml;
using SHDocVw;
using Microsoft.Win32;
namespace CTI
{
public interfac... | [
{
"answer_id": 75086,
"author": "jlew",
"author_id": 7450,
"author_profile": "https://Stackoverflow.com/users/7450",
"pm_score": 2,
"selected": false,
"text": "<p>First, your interface needs ComVisible(true) in order to be seen by the calling script (this is probably causing the error). ... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72048",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I admit I know enough about COM and IE architecture only to be dangerous. I have a working C# .NET ActiveX control similar to this:
```
using System;
using System.Runtime.InteropServices;
using BrowseUI;
using mshtml;
using SHDocVw;
using Microsoft.Win32;
namespace CTI
{
public interface CTIActiveXInt... | First, your interface needs ComVisible(true) in order to be seen by the calling script (this is probably causing the error).
Second, add a .NETreference in your project to "Microsoft.mshtml". This will import the COM interfaces for various IE-related things (windows, HTML documents, etc.)
Then, you need to add a pro... |
72,057 | <p>I would like to have a Guile script, which implements functions, which output test result messages according to the TAP protocol.</p>
| [
{
"answer_id": 72272,
"author": "Omer Zak",
"author_id": 11886,
"author_profile": "https://Stackoverflow.com/users/11886",
"pm_score": 2,
"selected": false,
"text": "<p>The following script, to be named guiletap.scm, implements the frequently-needed functions for using the TAP protocol w... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72057",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11886/"
] | I would like to have a Guile script, which implements functions, which output test result messages according to the TAP protocol. | The following script, to be named guiletap.scm, implements the frequently-needed functions for using the TAP protocol when running tests.
```
; Define functions for running Guile-written tests under the TAP protocol.
; Copyright © 2008 by Omer Zak
; Released under the GNU LGPL 2.1 or (at your option) any later version... |
72,070 | <p>I'm executing stored procedures using SET FMTONLY ON, in order to emulate what our code generator does. However, it seems that the results are cached when executed like this, as I'm still getting a <em>Conversion failed</em> error from a proc that I have just dropped! This happens even when I execute the proc witho... | [
{
"answer_id": 72094,
"author": "Curt Hagenlocher",
"author_id": 533,
"author_profile": "https://Stackoverflow.com/users/533",
"pm_score": 0,
"selected": false,
"text": "<ol>\n<li><p>This sounds like a client-side error. Do you get the same message when running through SQL Management St... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72070",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8741/"
] | I'm executing stored procedures using SET FMTONLY ON, in order to emulate what our code generator does. However, it seems that the results are cached when executed like this, as I'm still getting a *Conversion failed* error from a proc that I have just dropped! This happens even when I execute the proc without SET FMTO... | Some statements will still be executed, even with **`SET FMTONLY ON`**. You "Conversion failed" error could be from something as simple as a `set variable` statement in the stored proc. For example, this returns the metadata for the first query, but throws an exception when it runs the last statement:
```
SET FMTONLY ... |
72,090 | <p>I'm trying to modify my GreaseMonkey script from firing on window.onload to window.DOMContentLoaded, but this event never fires.</p>
<p>I'm using FireFox 2.0.0.16 / GreaseMonkey 0.8.20080609</p>
<p><a href="https://stackoverflow.com/questions/59205/enhancing-stackoverflow-user-experience">This</a> is the full scri... | [
{
"answer_id": 72245,
"author": "Sam Hasler",
"author_id": 2541,
"author_profile": "https://Stackoverflow.com/users/2541",
"pm_score": 6,
"selected": true,
"text": "<p>So I googled <a href=\"http://www.google.com/search?q=greasemonkey%20dom%20ready\" rel=\"noreferrer\">greasemonkey dom r... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72090",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/394/"
] | I'm trying to modify my GreaseMonkey script from firing on window.onload to window.DOMContentLoaded, but this event never fires.
I'm using FireFox 2.0.0.16 / GreaseMonkey 0.8.20080609
[This](https://stackoverflow.com/questions/59205/enhancing-stackoverflow-user-experience) is the full script that I'm trying to modify... | So I googled [greasemonkey dom ready](http://www.google.com/search?q=greasemonkey%20dom%20ready) and the [first result](http://www.sitepoint.com/article/beat-website-greasemonkey/) seemed to say that the greasemonkey script is actually running at "DOM ready" so you just need to remove the onload call and run the script... |
72,098 | <p>When using MediaWiki's markup language, the only thing that I hate is creating numbered lists. The only way I know to create a list is to do something like this:</p>
<pre><code>#Item1
#Item2
</code></pre>
<p>However, if I want to add spaces or some other text between those lines, the numbering gets lost. For examp... | [
{
"answer_id": 72140,
"author": "finnw",
"author_id": 12048,
"author_profile": "https://Stackoverflow.com/users/12048",
"pm_score": 5,
"selected": false,
"text": "<p>Like this:</p>\n\n<pre><code>#Item1\n#:Somestuff\n#Item2\n</code></pre>\n"
},
{
"answer_id": 72222,
"author": ... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72098",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | When using MediaWiki's markup language, the only thing that I hate is creating numbered lists. The only way I know to create a list is to do something like this:
```
#Item1
#Item2
```
However, if I want to add spaces or some other text between those lines, the numbering gets lost. For example, the following will cre... | Like this:
```
#Item1
#:Somestuff
#Item2
``` |
72,103 | <p>I'm using a winforms webbrowser control to display some content in a windows forms app. I'm using the DocumentText property to write the generated HTML. That part is working spectacularly. Now I want to use some images in the markup. (I also would prefer to use linked CSS and JavaScript, however, that can be wor... | [
{
"answer_id": 72339,
"author": "Ken Wootton",
"author_id": 7357,
"author_profile": "https://Stackoverflow.com/users/7357",
"pm_score": 4,
"selected": true,
"text": "<p>Here's what we do, although I should mention that we use a custom web browser to remove such things as the ability to r... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72103",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5496/"
] | I'm using a winforms webbrowser control to display some content in a windows forms app. I'm using the DocumentText property to write the generated HTML. That part is working spectacularly. Now I want to use some images in the markup. (I also would prefer to use linked CSS and JavaScript, however, that can be worked aro... | Here's what we do, although I should mention that we use a custom web browser to remove such things as the ability to right-click and see the good old IE context menu:
```
public class HtmlFormatter
{
/// <summary>
/// Indicator that this is a URI referencing the local
/// file path.
/// </summary>
... |
72,116 | <p>I understand about race conditions and how with multiple threads accessing the same variable, updates made by one can be ignored and overwritten by others, but what if each thread is writing the same value (not different values) to the same variable; can even this cause problems? Could this code:</p>
<p>GlobalVar.p... | [
{
"answer_id": 72147,
"author": "Laurie Young",
"author_id": 7473,
"author_profile": "https://Stackoverflow.com/users/7473",
"pm_score": 1,
"selected": false,
"text": "<p>I would expect the result to be undetermined. As in it would vary from compiler to complier, langauge to language and... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72116",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I understand about race conditions and how with multiple threads accessing the same variable, updates made by one can be ignored and overwritten by others, but what if each thread is writing the same value (not different values) to the same variable; can even this cause problems? Could this code:
GlobalVar.property = ... | The problem comes when you read that state back, and do something about it. Writing is a red herring - it is true that as long as this is a single word most environments guarantee the write will be atomic, but that doesn't mean that a larger piece of code that includes this fragment is thread-safe. Firstly, presumably ... |
72,121 | <p>Let me use the following example to explain my question:</p>
<pre class="lang-csharp prettyprint-override"><code>public string ExampleFunction(string Variable) {
return something;
}
string WhatIsMyName = "Hello World";
string Hello = ExampleFunction(WhatIsMyName);
</code></pre>
<p>When I pass the vari... | [
{
"answer_id": 72139,
"author": "Gishu",
"author_id": 1695,
"author_profile": "https://Stackoverflow.com/users/1695",
"pm_score": -1,
"selected": true,
"text": "<p><strong>No.</strong> I don't think so.</p>\n<p>The variable name that you use is for your convenience and readability. The c... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72121",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/383/"
] | Let me use the following example to explain my question:
```csharp
public string ExampleFunction(string Variable) {
return something;
}
string WhatIsMyName = "Hello World";
string Hello = ExampleFunction(WhatIsMyName);
```
When I pass the variable `WhatIsMyName` to the `ExampleFunction`, I want to be able to ge... | **No.** I don't think so.
The variable name that you use is for your convenience and readability. The compiler doesn't need it & just chucks it out if I'm not mistaken.
If it helps, you could define a new class called `NamedParameter` with attributes `Name` and `Param`. You then pass this object around as parameters. |
72,125 | <p>Lets say that you have websites www.xyz.com and www.abc.com.</p>
<p>Lets say that a user goes to www.abc.com and they get authenticated through the normal ASP .NET membership provider. </p>
<p>Then, from that site, they get sent to (redirection, linked, whatever works) site www.xyz.com, and the intent of site www.... | [
{
"answer_id": 72149,
"author": "Marc Gear",
"author_id": 6563,
"author_profile": "https://Stackoverflow.com/users/6563",
"pm_score": 0,
"selected": false,
"text": "<p>Not sure what you'd use for .NET but ordinarily I'd use <a href=\"http://www.danga.com/memcached/\" rel=\"nofollow noref... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72125",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7952/"
] | Lets say that you have websites www.xyz.com and www.abc.com.
Lets say that a user goes to www.abc.com and they get authenticated through the normal ASP .NET membership provider.
Then, from that site, they get sent to (redirection, linked, whatever works) site www.xyz.com, and the intent of site www.abc.com was to pa... | Try using FormAuthentication by setting the web.config authentication section like so:
```
<authentication mode="Forms">
<forms name=".ASPXAUTH" requireSSL="true"
protection="All"
enableCrossAppRedirects="true" />
</authentication>
```
Generate a machine key. Example: [Easiest way to generate Machine... |
72,151 | <p>I'm using OLEDB provider for ADO.Net connecting to an Oracle database. In my loop, I am doing an insert:</p>
<pre><code>insert into ps_tl_compleave_tbl values('2626899', 0, TO_DATE('01/01/2002', 'MM/DD/YYYY'), 'LTKN', 'LTKN', '52', TO_DATE('01/01/2002', 'MM/DD/YYYY'), 16.000000, 24.000)insert into ps_tl_compleave_... | [
{
"answer_id": 72165,
"author": "metadave",
"author_id": 7237,
"author_profile": "https://Stackoverflow.com/users/7237",
"pm_score": 2,
"selected": false,
"text": "<p>semi colon after the first insert?</p>\n"
},
{
"answer_id": 72170,
"author": "ShoeLace",
"author_id": 382... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72151",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10589/"
] | I'm using OLEDB provider for ADO.Net connecting to an Oracle database. In my loop, I am doing an insert:
```
insert into ps_tl_compleave_tbl values('2626899', 0, TO_DATE('01/01/2002', 'MM/DD/YYYY'), 'LTKN', 'LTKN', '52', TO_DATE('01/01/2002', 'MM/DD/YYYY'), 16.000000, 24.000)insert into ps_tl_compleave_tbl values('432... | To me it seems you're missing a `;` between the two statements:
`insert into ps_tl_compleave_tbl values('2626899', 0, TO_DATE('01/01/2002', 'MM/DD/YYYY'), 'LTKN', 'LTKN', '52', TO_DATE('01/01/2002', 'MM/DD/YYYY'), 16.000000, 24.000)`
**`;`**
`insert into ps_tl_compleave_tbl values('4327142', 0, TO_DATE('03/23/... |
72,153 | <p>How can I construct a MSBuild ItemGroup to exclude .svn directories and all files within (recursively). I've got:</p>
<pre><code><ItemGroup>
<LibraryFiles Include="$(LibrariesReleaseDir)\**\*.*" Exclude=".svn" />
</ItemGroup>
</code></pre>
<p>At the moment, but this does not exclude anythin... | [
{
"answer_id": 72536,
"author": "Kieran Benton",
"author_id": 5777,
"author_profile": "https://Stackoverflow.com/users/5777",
"pm_score": 7,
"selected": true,
"text": "<p>Thanks for your help, managed to sort it as follows:</p>\n\n<pre><code><ItemGroup>\n <LibraryFiles Inclu... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72153",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5777/"
] | How can I construct a MSBuild ItemGroup to exclude .svn directories and all files within (recursively). I've got:
```
<ItemGroup>
<LibraryFiles Include="$(LibrariesReleaseDir)\**\*.*" Exclude=".svn" />
</ItemGroup>
```
At the moment, but this does not exclude anything! | Thanks for your help, managed to sort it as follows:
```
<ItemGroup>
<LibraryFiles Include="$(LibrariesReleaseDir)\**\*.*"
Exclude="$(LibrariesReleaseDir)\**\.svn\**" />
</ItemGroup>
```
Turns out the pattern matching basically runs on files, so you have to exclude everything BELOW the `.svn... |
72,167 | <p>How do I find out which sound files the user has configured in the control panel?</p>
<p>Example: I want to play the sound for "Device connected".</p>
<p>Which API can be used to query the control panel sound settings?</p>
<p>I see that there are some custom entries made by third party programs in the control pan... | [
{
"answer_id": 72250,
"author": "titanae",
"author_id": 2387,
"author_profile": "https://Stackoverflow.com/users/2387",
"pm_score": 5,
"selected": true,
"text": "<p><a href=\"https://learn.microsoft.com/en-us/previous-versions/ms712879(v=vs.85)\" rel=\"nofollow noreferrer\"><code>PlaySou... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72167",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1810/"
] | How do I find out which sound files the user has configured in the control panel?
Example: I want to play the sound for "Device connected".
Which API can be used to query the control panel sound settings?
I see that there are some custom entries made by third party programs in the control panel dialog, so there has ... | [`PlaySound`](https://learn.microsoft.com/en-us/previous-versions/ms712879(v=vs.85)) is the API.
Also see [Play System Sounds](https://learn.microsoft.com/en-us/windows/win32/multimedia/using-playsound-to-play-system-sounds). |
72,176 | <p>While there are 100 ways to solve the conversion problem, I am focusing on performance.</p>
<p>Give that the string only contains binary data, what is the fastest method, in terms of performance, of converting that data to a byte[] (not char[]) under C#?</p>
<p>Clarification: This is not ASCII data, rather binary... | [
{
"answer_id": 72191,
"author": "user7116",
"author_id": 7116,
"author_profile": "https://Stackoverflow.com/users/7116",
"pm_score": 2,
"selected": false,
"text": "<p><a href=\"http://msdn.microsoft.com/en-us/library/system.text.utf8encoding.getbytes.aspx\" rel=\"nofollow noreferrer\">UT... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72176",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12113/"
] | While there are 100 ways to solve the conversion problem, I am focusing on performance.
Give that the string only contains binary data, what is the fastest method, in terms of performance, of converting that data to a byte[] (not char[]) under C#?
Clarification: This is not ASCII data, rather binary data that happens... | I'm not sure ASCIIEncoding.GetBytes is going to do it, because it only supports the [range 0x0000 to 0x007F](https://learn.microsoft.com/en-us/dotnet/api/system.text.asciiencoding).
You tell the string contains only bytes. But a .NET string is an array of chars, and 1 char is 2 bytes (because a .NET stores strings as... |
72,198 | <p>This seemed like an easy thing to do. I just wanted to pop up a text window and display two columns of data -- a description on the left side and a corresponding value displayed on the right side. I haven't worked with Forms much so I just grabbed the first control that seemed appropriate, a TextBox. I thought using... | [
{
"answer_id": 72282,
"author": "Nicholas Mancuso",
"author_id": 8945,
"author_profile": "https://Stackoverflow.com/users/8945",
"pm_score": -1,
"selected": false,
"text": "<p>Don't the text boxes allow HTML usage? If that is the case, just use HTML to format the text into a table. Other... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72198",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12058/"
] | This seemed like an easy thing to do. I just wanted to pop up a text window and display two columns of data -- a description on the left side and a corresponding value displayed on the right side. I haven't worked with Forms much so I just grabbed the first control that seemed appropriate, a TextBox. I thought using ta... | If you want, you can translate this VB.Net code to C#. The theory here is that you change the size of a tab in the control.
```
Private Declare Function SendMessage _
Lib "user32" Alias "SendMessageA" _
(ByVal handle As IntPtr, ByVal wMsg As Integer, _
ByVal wParam As Integer, ByRef lParam As Integer) As Integer... |
72,204 | <p>Has anyone used <a href="http://www.ayende.com/Blog/archive/2007/09/03/Rhino-Igloo-ndash-MVC-Framework-for-Web-Forms.aspx" rel="nofollow noreferrer">Rhino igloo</a> in a non-trivial project? I am curious if it's worth, what are its drawbacks, does it enhance testability a lot, is it easy to use. How would you compar... | [
{
"answer_id": 72282,
"author": "Nicholas Mancuso",
"author_id": 8945,
"author_profile": "https://Stackoverflow.com/users/8945",
"pm_score": -1,
"selected": false,
"text": "<p>Don't the text boxes allow HTML usage? If that is the case, just use HTML to format the text into a table. Other... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72204",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1801/"
] | Has anyone used [Rhino igloo](http://www.ayende.com/Blog/archive/2007/09/03/Rhino-Igloo-ndash-MVC-Framework-for-Web-Forms.aspx) in a non-trivial project? I am curious if it's worth, what are its drawbacks, does it enhance testability a lot, is it easy to use. How would you compare it to a pure MVC framework (ASP.NET MV... | If you want, you can translate this VB.Net code to C#. The theory here is that you change the size of a tab in the control.
```
Private Declare Function SendMessage _
Lib "user32" Alias "SendMessageA" _
(ByVal handle As IntPtr, ByVal wMsg As Integer, _
ByVal wParam As Integer, ByRef lParam As Integer) As Integer... |
72,220 | <p>I'm a Java-developer toying with Ruby, and loving it. I have understood that because of Ruby's metaprogramming facilities my unit-tests become much cleaner and I don't need nasty mocking frameworks. I have a class which needs the <code>File</code> class's services and in my test I don't want to touch my real filesys... | [
{
"answer_id": 72248,
"author": "Brian Phillips",
"author_id": 7230,
"author_profile": "https://Stackoverflow.com/users/7230",
"pm_score": 4,
"selected": false,
"text": "<p>Mocha (<a href=\"http://mocha.rubyforge.org/\" rel=\"noreferrer\">http://mocha.rubyforge.org/</a>) is a very good m... | 2008/09/16 | [
"https://Stackoverflow.com/questions/72220",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4110/"
] | I'm a Java-developer toying with Ruby, and loving it. I have understood that because of Ruby's metaprogramming facilities my unit-tests become much cleaner and I don't need nasty mocking frameworks. I have a class which needs the `File` class's services and in my test I don't want to touch my real filesystem. In Java I... | Mocha (<http://mocha.rubyforge.org/>) is a very good mocking library for ruby. Depending on what you're actually wanting to test (i.e. if you want to just fake out the File.new call to avoid the file system dependency or if you want to verify that the correct arguments are passed into File.new) you could do something l... |