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 |
|---|---|---|---|---|---|---|
261,663 | <p>Is it possible to define an implicit conversion of enums in c#?</p>
<p>something that could achieve this?</p>
<pre><code>public enum MyEnum
{
one = 1, two = 2
}
MyEnum number = MyEnum.one;
long i = number;
</code></pre>
<p>If not, why not?</p>
| [
{
"answer_id": 261676,
"author": "Ash",
"author_id": 31128,
"author_profile": "https://Stackoverflow.com/users/31128",
"pm_score": 2,
"selected": false,
"text": "<p>If you define the base of the enum as a long then you can perform explicit conversion. I don't know if you can use implicit... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261663",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17540/"
] | Is it possible to define an implicit conversion of enums in c#?
something that could achieve this?
```
public enum MyEnum
{
one = 1, two = 2
}
MyEnum number = MyEnum.one;
long i = number;
```
If not, why not? | There is a solution. Consider the following:
```
public sealed class AccountStatus
{
public static readonly AccountStatus Open = new AccountStatus(1);
public static readonly AccountStatus Closed = new AccountStatus(2);
public static readonly SortedList<byte, AccountStatus> Values = new SortedList<byte, Ac... |
261,709 | <p>I have the following code:</p>
<pre><code>using System;
using System.Linq;
using System.Linq.Expressions;
public class Program
{
public static void Main()
{
Descendant d = new Descendant();
d.TestMethod();
}
}
public class Base
{
protected void FigureItOut<TClass, TMember>(Ex... | [
{
"answer_id": 261742,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 4,
"selected": true,
"text": "<p>How about an extension method that calls the actual (<code>protected internal</code>) implementation? The only down... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261709",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/267/"
] | I have the following code:
```
using System;
using System.Linq;
using System.Linq.Expressions;
public class Program
{
public static void Main()
{
Descendant d = new Descendant();
d.TestMethod();
}
}
public class Base
{
protected void FigureItOut<TClass, TMember>(Expression<Func<TClass... | How about an extension method that calls the actual (`protected internal`) implementation? The only downside is you have to add `this.`.
This works because the `source` parameter (via `this`) infers a type for `TClass`.
```
public class Base
{
protected internal void FigureItOut<TClass, TMember>(Expression<Func<T... |
261,717 | <p>I have a query on my database as such:</p>
<pre><code>SELECT * FROM expenses WHERE user_id = ? AND dated_on = ?
</code></pre>
<p>I have added an index to the table on both the <code>user_id</code> and <code>dated_on</code> columns. When I inspect the indexes using <code>SHOW INDEXES FROM expenses</code>, there ar... | [
{
"answer_id": 261726,
"author": "Ned Batchelder",
"author_id": 14343,
"author_profile": "https://Stackoverflow.com/users/14343",
"pm_score": 3,
"selected": false,
"text": "<p>If your index on user_id and dated_on is really in that order (user_id first), then it will be used for a user_i... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261717",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1174/"
] | I have a query on my database as such:
```
SELECT * FROM expenses WHERE user_id = ? AND dated_on = ?
```
I have added an index to the table on both the `user_id` and `dated_on` columns. When I inspect the indexes using `SHOW INDEXES FROM expenses`, there are two lines -- one with a `seq_in_index` value of 1, the oth... | MySQL can use [any left portion of an index](http://dev.mysql.com/doc/refman/5.0/en/mysql-indexes.html).
In your example `SELECT * FROM expenses WHERE user_id = ?` will use the index but `SELECT * FROM expenses WHERE dated_on = ?` won't.
For a 3-column index A, B, C, `WHERE A = ? AND B = ?` will use an index over A a... |
261,721 | <p>Do you know a way to organize boolean expressions in a database while allowing infinite nesting of the expressions?</p>
<p>Example:</p>
<pre><code>a = 1 AND (b = 1 OR b = 2)
</code></pre>
<p>The expression as a whole shouldn't be stored as varchar to preserve data integrity.</p>
| [
{
"answer_id": 261740,
"author": "Toon Krijthe",
"author_id": 18061,
"author_profile": "https://Stackoverflow.com/users/18061",
"pm_score": 3,
"selected": false,
"text": "<p>An expression is a treelike structure. So you need a way to present the tree in a table.</p>\n\n<p>You can for exa... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261721",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Do you know a way to organize boolean expressions in a database while allowing infinite nesting of the expressions?
Example:
```
a = 1 AND (b = 1 OR b = 2)
```
The expression as a whole shouldn't be stored as varchar to preserve data integrity. | Option 1 would be to use a nested table (a tree with id / parent\_id structure), like Gamecat suggested. This is relatively expensive to do, and requires issuing SQL queries repetitively to build the equivalent of a single nested expression.
Option 2 would be to use a serialized object and store it into a varchar colu... |
261,731 | <p>I've got a large source tree (> 2 GB, WINCE build tree) that I would like to start managing with Subversion. Up to this point, 'versioning' has been managed through keeping multiple copies of the tree, and using Beyond Compare to find differences.</p>
<p>The last big stumbling block I see to using Subversion is tha... | [
{
"answer_id": 261758,
"author": "Peter Parker",
"author_id": 23264,
"author_profile": "https://Stackoverflow.com/users/23264",
"pm_score": 0,
"selected": false,
"text": "<p>Subversion will do the comparsion much quicker than even beyond compare will do..</p>\n\n<p>If you use tortoiseSVN... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261731",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5378/"
] | I've got a large source tree (> 2 GB, WINCE build tree) that I would like to start managing with Subversion. Up to this point, 'versioning' has been managed through keeping multiple copies of the tree, and using Beyond Compare to find differences.
The last big stumbling block I see to using Subversion is that it modif... | There is an svn config option that controls how timestamps are stored in the repository:
```
use-commit-times
```
>
> Normally your working copy files have
> timestamps that reflect the last time
> they were touched by any process,
> whether that be your own editor or by
> some svn subcommand. This is generally... |
261,735 | <p>I'm looking for a dummy SQL statement that will work from a C# SQL connection to check for connectivity.</p>
<p>Basically I need to send a request to the database, I don't care what it returns I just want it to be successful if the database is still there and throw an exception if the database isn't.</p>
<p>The sc... | [
{
"answer_id": 261748,
"author": "paxdiablo",
"author_id": 14860,
"author_profile": "https://Stackoverflow.com/users/14860",
"pm_score": 4,
"selected": true,
"text": "<p>Most SQL databases have a 'table' for this purpose.</p>\n\n<p>In DB2, it's:</p>\n\n<pre><code>select * from sysibm.sys... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261735",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20400/"
] | I'm looking for a dummy SQL statement that will work from a C# SQL connection to check for connectivity.
Basically I need to send a request to the database, I don't care what it returns I just want it to be successful if the database is still there and throw an exception if the database isn't.
The scenario I'm testin... | Most SQL databases have a 'table' for this purpose.
In DB2, it's:
```
select * from sysibm.sysdummy1
```
while Oracle has, from memory,
```
select * from dual
```
It'll depend on the database at the back end. |
261,738 | <p>One of my co-workers has resigned and was made to leave the premises before checking in all of his code to TFS. I have access to the physical files. Is there a way for me to access his workspace and check in some of the changes that are still left unchecked in? From tfs I can see which files he has checked out but n... | [
{
"answer_id": 261823,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 1,
"selected": false,
"text": "<p>This is probably a quick and dirty way of doing it:</p>\n\n<ul>\n<li>Shelve or check-in your own work.</li>\n<li>Copy the r... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261738",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32313/"
] | One of my co-workers has resigned and was made to leave the premises before checking in all of his code to TFS. I have access to the physical files. Is there a way for me to access his workspace and check in some of the changes that are still left unchecked in? From tfs I can see which files he has checked out but no w... | In TFS 2010, there is a new feature called 'Public Workspaces'. This allows multiple people to **share the same workspace folders** on a computer, but authenticating to TFS using their **own** logon.
A TFS administrator can change a workspace to a 'Public Workspace' by running a command like the following:
```
tf wor... |
261,752 | <p>is it somehow possible to call a rails function or to access a rails object from within jQuery?
I'd like to do something like:</p>
<pre><code>jQuery(document).ready(function($) {
$('#mydiv').html("<%= @object.name %>");
});
</code></pre>
<p>OR</p>
<pre><code>jQuery(document).ready(function($) {
$('#mydiv').... | [
{
"answer_id": 261913,
"author": "changelog",
"author_id": 5646,
"author_profile": "https://Stackoverflow.com/users/5646",
"pm_score": 3,
"selected": true,
"text": "<p>You'll have to have a method in the controller that will render what you need, if you want to do that. Another way to do... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261752",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29909/"
] | is it somehow possible to call a rails function or to access a rails object from within jQuery?
I'd like to do something like:
```
jQuery(document).ready(function($) {
$('#mydiv').html("<%= @object.name %>");
});
```
OR
```
jQuery(document).ready(function($) {
$('#mydiv').html("<%= render :partial => "contacts" %>"... | You'll have to have a method in the controller that will render what you need, if you want to do that. Another way to do it is to use view blocks, like in the end of your layout view
```
<script type="text/javascript">
<%= yield :footerjs %>
</script>
```
and in the view do something like:
```
<% content_for :footer... |
261,780 | <p>I'm trying to parse dates using the user's date preferences</p>
<pre><code>[NSDateFormatter setDefaultFormatterBehavior:NSDateFormatterBehavior10_4];
NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease];
[dateFormatter setDateStyle:NSDateFormatterShortStyle];
NSDate *date = [ dateFormatter ... | [
{
"answer_id": 262950,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "<p>This looks correct. In the first output sample, the formatted date string is 7/4/200. In the second, it is 07/04/2008. <... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261780",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14343/"
] | I'm trying to parse dates using the user's date preferences
```
[NSDateFormatter setDefaultFormatterBehavior:NSDateFormatterBehavior10_4];
NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease];
[dateFormatter setDateStyle:NSDateFormatterShortStyle];
NSDate *date = [ dateFormatter dateFromString... | >
> It looks like the NSDateFormatter is insensitive to the change of regions.
>
>
>
No, it is using the locale in both directions.
You can see how the formatter interpreted the date by looking at the date's description (the first `%@` in your `NSLog` format).
With the region as US, the formatter interpreted t... |
261,783 | <p>I am debugging some code and have encountered the following SQL query (simplified version):</p>
<pre><code>SELECT ads.*, location.county
FROM ads
LEFT JOIN location ON location.county = ads.county_id
WHERE ads.published = 1
AND ads.type = 13
AND ads.county_id = 2
OR ads.county_id = 5
OR ads.county_id = 7
OR ads.c... | [
{
"answer_id": 261788,
"author": "Greg",
"author_id": 24181,
"author_profile": "https://Stackoverflow.com/users/24181",
"pm_score": 8,
"selected": true,
"text": "<p>Put parentheses around the \"OR\"s:</p>\n\n<pre><code>SELECT ads.*, location.county \nFROM ads\nLEFT JOIN location ON locat... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261783",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/319/"
] | I am debugging some code and have encountered the following SQL query (simplified version):
```
SELECT ads.*, location.county
FROM ads
LEFT JOIN location ON location.county = ads.county_id
WHERE ads.published = 1
AND ads.type = 13
AND ads.county_id = 2
OR ads.county_id = 5
OR ads.county_id = 7
OR ads.county_id = 9
... | Put parentheses around the "OR"s:
```
SELECT ads.*, location.county
FROM ads
LEFT JOIN location ON location.county = ads.county_id
WHERE ads.published = 1
AND ads.type = 13
AND
(
ads.county_id = 2
OR ads.county_id = 5
OR ads.county_id = 7
OR ads.county_id = 9
)
```
Or even better, use IN:
```
SELE... |
261,801 | <p>I have use IlMerge to merge all the dlls of my projects in one exe. I use a targets file which is referenced in the "import" of the main csproj.</p>
<p>The ExecCommand in the targets is:</p>
<pre><code> <Exec Command="&quot;$(ProgramFiles)\Microsoft\Ilmerge\Ilmerge.exe&quot; /out:@(MainAssembly) &q... | [
{
"answer_id": 266642,
"author": "Marcus Griep",
"author_id": 28645,
"author_profile": "https://Stackoverflow.com/users/28645",
"pm_score": 2,
"selected": false,
"text": "<p>I'd recommend that you check out the ILMerge Task in the <a href=\"http://msbuildtasks.tigris.org/\" rel=\"nofollo... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261801",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31791/"
] | I have use IlMerge to merge all the dlls of my projects in one exe. I use a targets file which is referenced in the "import" of the main csproj.
The ExecCommand in the targets is:
```
<Exec Command=""$(ProgramFiles)\Microsoft\Ilmerge\Ilmerge.exe" /out:@(MainAssembly) "@(IntermediateAssembly)" @(... | My solution has been this:
I put the import in csproj for the Ilmerge targets file which is this:
```
<Project
DefaultTargets="Build"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Target Name="AfterBuild">
<CreateItem Include="@... |
261,807 | <p>we have a old and dying dedicated server. we want a new one at a new datacenter. we have a bunch of sites using the current server and don't have control of all their DNS. is there an easy way to redirect all the traffic from xx.xx.xx.xx to zz.zz.zz.zz without updating DNS records?</p>
<p>Thanks.</p>
| [
{
"answer_id": 261846,
"author": "Corey Trager",
"author_id": 9328,
"author_profile": "https://Stackoverflow.com/users/9328",
"pm_score": 0,
"selected": false,
"text": "<p>Run software on the old and dying server that would forward the traffic to the new one. In other words, via softwar... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261807",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34133/"
] | we have a old and dying dedicated server. we want a new one at a new datacenter. we have a bunch of sites using the current server and don't have control of all their DNS. is there an easy way to redirect all the traffic from xx.xx.xx.xx to zz.zz.zz.zz without updating DNS records?
Thanks. | Judging from the `IIS` tag, I'm assuming you're replacing a web server. If that's the case, look into HTTP redirection. One example is here: <http://www.somacon.com/p145.php>
This has the advantage of "telling" your clients that your page has moved permanently.
If you're not using HTTP, Corey's `iptables` solution is... |
261,809 | <p>If an interface inherits IEquatable the implementing class can define the behavior of the Equals method. Is it possible to define the behavior of == operations?</p>
<pre><code>public interface IFoo : IEquatable
{}
public class Foo : IFoo
{
// IEquatable.Equals
public bool Equals(IFoo other)
... | [
{
"answer_id": 261813,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 4,
"selected": true,
"text": "<p>No - you can't specify operators in interfaces (mostly because operators are static). The compiler determines which ov... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261809",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11367/"
] | If an interface inherits IEquatable the implementing class can define the behavior of the Equals method. Is it possible to define the behavior of == operations?
```
public interface IFoo : IEquatable
{}
public class Foo : IFoo
{
// IEquatable.Equals
public bool Equals(IFoo other)
{
/... | No - you can't specify operators in interfaces (mostly because operators are static). The compiler determines which overload of == to call based purely on their static type (i.e. polymorphism isn't involved) and interfaces can't specify the code to say "return the result of calling X.Equals(Y)". |
261,815 | <p>What is the upper limit for an autoincrement primary key in SQL Server?
What happens when an SQL Server autoincrement primary key reaches its upper limit?</p>
| [
{
"answer_id": 261822,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 2,
"selected": false,
"text": "<p>It depends on the datatype. If you use bigint, you're unlikely to ever overflow. Even a normal int gives you a co... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261815",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/407003/"
] | What is the upper limit for an autoincrement primary key in SQL Server?
What happens when an SQL Server autoincrement primary key reaches its upper limit? | Joel's answer is correct, it is the upper limit of whatever datatype you use.
Here's an example of two of them:
* int: 2^31-1 (2,147,483,647)
* bigint: 2^63-1 (9,223,372,036,854,775,807)
I have actually hit the limit at a job I worked at. The actual error is:
```
Msg 8115, Level 16, State 1, Line 1
Arithme... |
261,829 | <p>I have three closely related applications that are build from the same source code - let's say APP_A, APP_B, and APP_C. APP_C is a superset of APP_B which in turn is a superset of APP_A.</p>
<p>So far I've been using a preprocessor define to specify the application being built, which has worked like this.</p>
<pre... | [
{
"answer_id": 261843,
"author": "JesperE",
"author_id": 13051,
"author_profile": "https://Stackoverflow.com/users/13051",
"pm_score": 1,
"selected": false,
"text": "<p>If you're using C++, shouldn't your A, B, and C applications inherit from a common ancestor? That would be the OO way t... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261829",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1737/"
] | I have three closely related applications that are build from the same source code - let's say APP\_A, APP\_B, and APP\_C. APP\_C is a superset of APP\_B which in turn is a superset of APP\_A.
So far I've been using a preprocessor define to specify the application being built, which has worked like this.
```
// File:... | You don't always have to force inheritance relationships in applications that share a common code base. Really.
There's an old UNIX trick where you tailor the behavior of you application based on argv[0], ie, the application name. If I recall correctly (and it's been 20 years since I looked at it), rsh and rlogin are/... |
261,845 | <p>I want to use jQuery with asp.net webfoms. Do I need to get a special toolkit so the .net controls spit out friendly Control ID's?</p>
<p>Reason being, I don't want to write javascript referencing my html ID's like control_123_asdfcontrol_234.</p>
<p>Has this been addressed in version 3.5? (I remember reading yo... | [
{
"answer_id": 261857,
"author": "kͩeͣmͮpͥ ͩ",
"author_id": 26479,
"author_profile": "https://Stackoverflow.com/users/26479",
"pm_score": 3,
"selected": false,
"text": "<p>You can use <code>myControlId = \"<%= myControl.ClientID %>\";</code> to output the (non-friendly) id used to... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261845",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39677/"
] | I want to use jQuery with asp.net webfoms. Do I need to get a special toolkit so the .net controls spit out friendly Control ID's?
Reason being, I don't want to write javascript referencing my html ID's like control\_123\_asdfcontrol\_234.
Has this been addressed in version 3.5? (I remember reading you have to get so... | The easiest way I've found is just to match on the end of the mangled ID for most controls. The exceptions that Know of are radiobutton lists and checkbox lists - you have to be a little trickier with them.
But if you have this in your .aspx page:
```
<asp:TextBox ID="txtExample" runat="server" />
```
Then your jQu... |
261,867 | <p>I'm unable to make a remote connection to an Oracle XE install (through TOAD / SQL Developer). Here's the deal.</p>
<p>I set up a new server (windows 2003). The goal was to make a new image with several applications preinstalled, Oracle XE being one of them. Got Oracle installed no problem, connected locally, re... | [
{
"answer_id": 263493,
"author": "zendar",
"author_id": 25732,
"author_profile": "https://Stackoverflow.com/users/25732",
"pm_score": 1,
"selected": false,
"text": "<p>Did you check if you have open port 1521 on firewall?</p>\n"
},
{
"answer_id": 263516,
"author": "Manuel Fer... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261867",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34142/"
] | I'm unable to make a remote connection to an Oracle XE install (through TOAD / SQL Developer). Here's the deal.
I set up a new server (windows 2003). The goal was to make a new image with several applications preinstalled, Oracle XE being one of them. Got Oracle installed no problem, connected locally, remotely and ha... | ManuelF relates to access through the web front end, but isn't relevant to local access through the web front end.
You don't say how hostname/address is being handled, or how you are connecting locally.
If you are doing
`SQLPLUS / AS SYSDBA` then you are attaching directly.
If you are doing `SQLPLUS user/pass@XE` the... |
261,873 | <p>Here is my problem. I have a website in ASP.NET / C# which receives some data via GET/POST</p>
<p>This is "user filled" data, but not through a web page, it's a software that contacts my server.</p>
<p>Problem is, this software is sending data encoded in ISO-8859-1 (so Café would be sent as Caf%e9 ) and the rest o... | [
{
"answer_id": 262065,
"author": "tsilb",
"author_id": 11112,
"author_profile": "https://Stackoverflow.com/users/11112",
"pm_score": 1,
"selected": false,
"text": "<p>%e9 is just é but UrlEncoded. Server.UrlDecode your request string.</p>\n"
},
{
"answer_id": 264658,
"author... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261873",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Here is my problem. I have a website in ASP.NET / C# which receives some data via GET/POST
This is "user filled" data, but not through a web page, it's a software that contacts my server.
Problem is, this software is sending data encoded in ISO-8859-1 (so Café would be sent as Caf%e9 ) and the rest of my SW/DB is Uni... | The only thing that worked here was adding the following code to web.config:
```
<configuration>
<system.web>
<globalization requestEncoding="iso-8859-1"/>
</system.web>
</configuration>
```
And then use
```
Request["varName"]
```
Do not use `HttpUtility.UrlDecode` or `HttpUtility.UrlEncode`, those 2 only... |
261,888 | <p>In our office, we regularly enjoy some rounds of foosball / table football after work. I have put together a small java program that generates random 2vs2 lineups from the available players and stores the match results in a database afterwards.</p>
<p>The current prediction of the outcome uses a simple average of a... | [
{
"answer_id": 261901,
"author": "leppie",
"author_id": 15541,
"author_profile": "https://Stackoverflow.com/users/15541",
"pm_score": 2,
"selected": false,
"text": "<p>Why use a neuralnet? Use statistics, probably the correlation between each player would be good measure.</p>\n"
},
{... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261888",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33805/"
] | In our office, we regularly enjoy some rounds of foosball / table football after work. I have put together a small java program that generates random 2vs2 lineups from the available players and stores the match results in a database afterwards.
The current prediction of the outcome uses a simple average of all previou... | Use the TrueSkill algorithm, it is very good at this. I've implemented it for foosball and chess and it works very well. Coworkers have told me that it's almost *too* good at this.
For complete details on how it works as well as a link to my implementation, see my "[Computing Your Skill](http://www.moserware.com/2010/... |
261,904 | <p>I'm playing about with <a href="http://en.wikipedia.org/wiki/Lighttpd" rel="nofollow noreferrer">lighttpd</a> on a small virtual private server. I two domains pointing to the server. I am using the latest version of lighttpd and mod_evhost on Ubuntu 8.10.</p>
<ol>
<li><p>I'm trying to set up a rule such that if any... | [
{
"answer_id": 261940,
"author": "Anders",
"author_id": 25515,
"author_profile": "https://Stackoverflow.com/users/25515",
"pm_score": 1,
"selected": false,
"text": "<p>For your first one, matching <strong>domain.com</strong> and <strong>www.domain.com</strong>: <code>^\\b([wW]{3}\\.)?[\\... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261904",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/135/"
] | I'm playing about with [lighttpd](http://en.wikipedia.org/wiki/Lighttpd) on a small virtual private server. I two domains pointing to the server. I am using the latest version of lighttpd and mod\_evhost on Ubuntu 8.10.
1. I'm trying to set up a rule such that if anyone requests **domain.com** or **www.domain.com** th... | Your regexes seem to be a bit overdone.
Here is what I would use:
```
// regex to match sub.domain.com
$HTTP["host"] =~ "^[^.]+\.[^.]+\.[^.]+$" {
evhost.path-pattern = "/webroot/%0/%3/"
}
// regex to match domain.com
$HTTP["host"] =~ "^[^.]+\.[^.]+$" {
evhost.path-pattern = "/webroot/%0/www/"
}
... |
261,910 | <p>Would you please help me in making a rollover effect using jquery, what i want to do is when someone hover over any of the menu items the text slide down and disappear and a picture slides from the top down to the center (e.g. you could see this effect here <a href="http://www.iviewcom.com/panda" rel="nofollow noref... | [
{
"answer_id": 262200,
"author": "shiftins",
"author_id": 8162,
"author_profile": "https://Stackoverflow.com/users/8162",
"pm_score": 3,
"selected": false,
"text": "<p>Instead of doing it for you, I'll offer some places to start looking.. </p>\n\n<p>Here is an example that could be easil... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261910",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Would you please help me in making a rollover effect using jquery, what i want to do is when someone hover over any of the menu items the text slide down and disappear and a picture slides from the top down to the center (e.g. you could see this effect here [panda](http://www.iviewcom.com/panda) as you can see the pict... | Instead of doing it for you, I'll offer some places to start looking..
Here is an example that could be easily modified to use 'rollover' instead of 'click': <http://css-tricks.com/examples/MenuFader/>
Details on how the above example was put together (the tutorial):
<http://css-tricks.com/learning-jquery-fading-men... |
261,920 | <p>Which method is preferred?</p>
<pre><code>Session.Remove("foo");
Session["foo"] = null;
</code></pre>
<p>Is there a difference?</p>
| [
{
"answer_id": 261946,
"author": "dove",
"author_id": 30913,
"author_profile": "https://Stackoverflow.com/users/30913",
"pm_score": 3,
"selected": false,
"text": "<p>I would go with Remove but can not honestly say if there is a difference. At a guess there may still be an empty key kept... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261920",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2469/"
] | Which method is preferred?
```
Session.Remove("foo");
Session["foo"] = null;
```
Is there a difference? | >
> Is there a difference?
>
>
>
There is.
`Session.Remove(key)` deletes the entry (both key & value) from the dictionary while `Session[key] = null` assigns a value (which happens to be null) to a key. After the former call, the key won't appear in the `Session#Keys` collection. But after the latter, the key can ... |
261,924 | <p>I'll simplify the problem as much as possible:</p>
<p>I have an oracle table:</p>
<pre><code>row_priority, col1, col2, col3
0, .1, 100, {null}
12, {null}, {null}, 3
24, .2, {null}, {null}
</code></pre>
<p>Desired result:</p>
<pre><code>col1, col2, col3
.2, 100, 3
</code></pre>
<p>So according to the priority of... | [
{
"answer_id": 261941,
"author": "Alan",
"author_id": 5878,
"author_profile": "https://Stackoverflow.com/users/5878",
"pm_score": -1,
"selected": false,
"text": "<p>The COALESCE function may be of help to you here. Perhaps like ...</p>\n\n<pre><code>select first_value(coalesce(col1,0) i... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261924",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18941/"
] | I'll simplify the problem as much as possible:
I have an oracle table:
```
row_priority, col1, col2, col3
0, .1, 100, {null}
12, {null}, {null}, 3
24, .2, {null}, {null}
```
Desired result:
```
col1, col2, col3
.2, 100, 3
```
So according to the priority of the row, it overrides previous row values, if given.
I... | You need to put rownum = 1 OUTSIDE the analytical query
```
SELECT *
FROM ( select last_value(col1 ignore nulls) over () col1,
last_value(col2 ignore nulls) over () col2,
last_value(col3 ignore nulls) over () col3
from (select * from TH... |
261,927 | <p>I have been running Apache HTTPD in 64bit mode by stripping out the 32bit architecture from the binary (along with the ppc parts). I did this to make it more compatible for python and mysql.</p>
<p>However I have another machine that needs it to be run in 32bit mode (it has all four original architectures still in ... | [
{
"answer_id": 263200,
"author": "Dave Dribin",
"author_id": 26825,
"author_profile": "https://Stackoverflow.com/users/26825",
"pm_score": 3,
"selected": true,
"text": "<p>You can use the <a href=\"http://developer.apple.com/documentation/Darwin/Reference/ManPages/man1/arch.1.html\" rel=... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261927",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3431280/"
] | I have been running Apache HTTPD in 64bit mode by stripping out the 32bit architecture from the binary (along with the ppc parts). I did this to make it more compatible for python and mysql.
However I have another machine that needs it to be run in 32bit mode (it has all four original architectures still in it). Is it... | You can use the [`arch(1)`](http://developer.apple.com/documentation/Darwin/Reference/ManPages/man1/arch.1.html) command to change the which architecture is used. This will try Intel 32-bit first and then PPC 32-bit:
```
% arch -i386 -ppc /usr/sbin/httpd
``` |
261,938 | <p>If everything that can be accomplished in <a href="http://en.wikipedia.org/wiki/MXML" rel="nofollow noreferrer">MXML</a> can also be accomplished in ActionScript and many things are easier to accomplish in ActionScript (loops, conditionals, etc) why take the time to learn MXML?</p>
<p>The best reasons I have at thi... | [
{
"answer_id": 261961,
"author": "Eric Minkes",
"author_id": 1172,
"author_profile": "https://Stackoverflow.com/users/1172",
"pm_score": 0,
"selected": false,
"text": "<p>Designing UI elements with mxml and the visual designer is much easier than in code, and less error-prone in my opini... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261938",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | If everything that can be accomplished in [MXML](http://en.wikipedia.org/wiki/MXML) can also be accomplished in ActionScript and many things are easier to accomplish in ActionScript (loops, conditionals, etc) why take the time to learn MXML?
The best reasons I have at this point are that the structure of the MXML nice... | It depends on your application's needs, but I generally break my design into visual chunks and use custom MXML components to lay out the main areas and components of my application (data panels, dialog boxes, etc) using mxml based custom components. Then I'll augment that with custom actionscript components where I nee... |
261,963 | <p>I just noticed that you can not use standard math operators on an <code>enum</code> such as <code>++</code> or <code>+=</code>.</p>
<p>So what is the best way to iterate through all of the values in a C++ <code>enum</code>?</p>
| [
{
"answer_id": 261983,
"author": "Corey Trager",
"author_id": 9328,
"author_profile": "https://Stackoverflow.com/users/9328",
"pm_score": 3,
"selected": false,
"text": "<p>You can't with an enum. Maybe an enum isn't the best fit for your situation.</p>\n\n<p>A common convention is to na... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261963",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1366/"
] | I just noticed that you can not use standard math operators on an `enum` such as `++` or `+=`.
So what is the best way to iterate through all of the values in a C++ `enum`? | The typical way is as follows:
```
enum Foo {
One,
Two,
Three,
Last
};
for ( int fooInt = One; fooInt != Last; fooInt++ )
{
Foo foo = static_cast<Foo>(fooInt);
// ...
}
```
Please note, the enum `Last` is meant to be skipped by the iteration. Utilizing this "fake" `Last` enum, you don't have to update... |
261,978 | <p>I have the following JavaScript code to pop up a window in Internet Explorer. The code is executed from a page within a Microsoft CRM modal dialog box. (RequestID is a string that is always the same in the test system - at the moment it contains "abcdefg" - without the quotes).</p>
<pre><code>var cancelUrl = "Cance... | [
{
"answer_id": 262005,
"author": "zendar",
"author_id": 25732,
"author_profile": "https://Stackoverflow.com/users/25732",
"pm_score": 0,
"selected": false,
"text": "<p>This code is simple. Use debugger and see what is going on.</p>\n\n<p>Check that site with FireFox or Chrome, they have ... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261978",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21862/"
] | I have the following JavaScript code to pop up a window in Internet Explorer. The code is executed from a page within a Microsoft CRM modal dialog box. (RequestID is a string that is always the same in the test system - at the moment it contains "abcdefg" - without the quotes).
```
var cancelUrl = "CancelRequest.aspx?... | Ah, I think I got it... missed it in the description...
You are **trying to open a non-modal** window **from a modal dialog** in **IE**.
This AFAIK, should not work.
Try opening another modal window instead.
Effectively you are saying...
on window A, open up modal window B, now open up non-modal window C, which is... |
261,985 | <p>I have the following </p>
<pre><code>var id='123';
newDiv.innerHTML = "<a href=\"#\" onclick=\" TestFunction('"+id+"', false);\"></a>";
</code></pre>
<p>Which renders <code><a href="#" onclick="return Testfunction('123',false);"></a></code> in my HTML.</p>
<p>The problem I have is that I ... | [
{
"answer_id": 261999,
"author": "Greg",
"author_id": 24181,
"author_profile": "https://Stackoverflow.com/users/24181",
"pm_score": 2,
"selected": false,
"text": "<p>You should be using <code>&quot;</code> not <code>\"</code> or <code>\\\"</code> inside an HTML string quoted with dou... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261985",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28871/"
] | I have the following
```
var id='123';
newDiv.innerHTML = "<a href=\"#\" onclick=\" TestFunction('"+id+"', false);\"></a>";
```
Which renders `<a href="#" onclick="return Testfunction('123',false);"></a>` in my HTML.
The problem I have is that I wish to take the call to the method TestFunction, and use as a strin... | Try using " instead of \"
newDiv.innerHTML = "<a href="#"... |
261,998 | <p>I have a list of elements (the <em>X</em> in the following examples) displayed either in a row or in a column of an HTML table.</p>
<p>In HTML code point of view, I have either (horizontal display):</p>
<pre><code><table id="myTable">
<tr>
<td>A</td>
<td>B</td>
<... | [
{
"answer_id": 262083,
"author": "Prestaul",
"author_id": 5628,
"author_profile": "https://Stackoverflow.com/users/5628",
"pm_score": 1,
"selected": false,
"text": "<p>Assuming you are starting with one cell in each row and that each cell has one label and one input then I think that you... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261998",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26457/"
] | I have a list of elements (the *X* in the following examples) displayed either in a row or in a column of an HTML table.
In HTML code point of view, I have either (horizontal display):
```
<table id="myTable">
<tr>
<td>A</td>
<td>B</td>
<td>C</td>
...
</tr>
</table>
```
or (vertical display):
`... | Given the additional information you've provided, I think that this is what you want. It traverses the table moving the cells from every second row into the previous row...
```
var idx = 1;
var row, next;
while((row = $('#myTable tr:nth-child(' + idx++ + ')')).length) {
if((next = $('#myTable tr:nth-child(' + idx ... |
262,012 | <p>I'm just starting to pick up ASP.Net MVC and find myself writing a lot of <%= %> in the views. Intellisense does supply the closing %>, but I find that typing the introductory <%= to be burdensome (they are tough for me to type :-)).</p>
<p>I've dabbled around a bit with Rails and the NetBeans IDE where I wa... | [
{
"answer_id": 262074,
"author": "Tom Ritter",
"author_id": 8435,
"author_profile": "https://Stackoverflow.com/users/8435",
"pm_score": 0,
"selected": false,
"text": "<p>I believe <a href=\"http://www.dotnetjunkies.ddj.com/Article/C95AC204-DE44-4D4A-A2B7-1EB1BE14A8A1.dcik\" rel=\"nofollo... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262012",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7961/"
] | I'm just starting to pick up ASP.Net MVC and find myself writing a lot of <%= %> in the views. Intellisense does supply the closing %>, but I find that typing the introductory <%= to be burdensome (they are tough for me to type :-)).
I've dabbled around a bit with Rails and the NetBeans IDE where I was able to type:
... | This macro function should do it:
The main code will do one of two things, if nothing is selected it will just insert the <%= %> code construct, if you have something currently selected in the editor, it will wrap that code with the construct E.G. <%= selected code here %>
```
Public Sub WrapMVC()
Try
DTE... |
262,015 | <p>I need to modify a (xml-)file from Apache Ant. "loadfile" task allows to load the file's content in a property. But how to store the property's value back to a file after its (property) modification?</p>
<p>Of course I could write custom task to perform this operation but I would like to know if there's some existi... | [
{
"answer_id": 262064,
"author": "sblundy",
"author_id": 4893,
"author_profile": "https://Stackoverflow.com/users/4893",
"pm_score": 5,
"selected": true,
"text": "<p>You can use the <a href=\"http://ant.apache.org/manual/Tasks/echo.html\" rel=\"noreferrer\">echo</a> task.</p>\n\n<pre><co... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262015",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15647/"
] | I need to modify a (xml-)file from Apache Ant. "loadfile" task allows to load the file's content in a property. But how to store the property's value back to a file after its (property) modification?
Of course I could write custom task to perform this operation but I would like to know if there's some existing impleme... | You can use the [echo](http://ant.apache.org/manual/Tasks/echo.html) task.
```
<echo file="${fileName}" message="${xmlProperty}"/>
```
The [echoxml](http://ant.apache.org/manual/Tasks/echoxml.html) task might be of interest to you as well. |
262,043 | <p>I am trying to do something like this:</p>
<pre><code>while @nrOfAuthlevels >= @myAuthLevel
begin
set @myAuthLevel = @myAuthLevel + 1
SELECT Role.name, Role.authorityLevel
FROM [dbo].[Role]
ORDER BY Role.authorityLevel
end
</code></pre>
<p>The result of this stored procedure shall be ... | [
{
"answer_id": 262057,
"author": "Biri",
"author_id": 968,
"author_profile": "https://Stackoverflow.com/users/968",
"pm_score": 1,
"selected": false,
"text": "<p>Create a temp table before the loop and don't select data, but insert data to this temp table:</p>\n\n<pre><code>create table ... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262043",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am trying to do something like this:
```
while @nrOfAuthlevels >= @myAuthLevel
begin
set @myAuthLevel = @myAuthLevel + 1
SELECT Role.name, Role.authorityLevel
FROM [dbo].[Role]
ORDER BY Role.authorityLevel
end
```
The result of this stored procedure shall be a table with all Role.autho... | If you want to keep that current structure, then you would need to insert into a temporary table for every step through the while loop, and outside of that return from the TEMP table.
That said, why not just use a **WHERE** clause to get the expected return results:
```
SELECT Role.Name, Role.AuthorityLevel
FROM ... |
262,075 | <p>The following doesn't work, but something like this is what I'm looking for.</p>
<pre><code>select *
from Products
where Description like (@SearchedDescription + %)
</code></pre>
<p>SSRS uses the @ operator in-front of a parameter to simulate an 'in', and I'm not finding a way to match up a string to a list of str... | [
{
"answer_id": 278959,
"author": "Pulsehead",
"author_id": 2156,
"author_profile": "https://Stackoverflow.com/users/2156",
"pm_score": 0,
"selected": false,
"text": "<p>Have you tried to do:</p>\n\n<p><code>select * from Products where Description like (@SearchedDescription + '%')</code>... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262075",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26938/"
] | The following doesn't work, but something like this is what I'm looking for.
```
select *
from Products
where Description like (@SearchedDescription + %)
```
SSRS uses the @ operator in-front of a parameter to simulate an 'in', and I'm not finding a way to match up a string to a list of strings. | There are a few options on how to use a LIKE operator with a parameter.
OPTION 1
If you add the % to the parameter value, then you can customize how the LIKE filter will be processed. For instance, your query could be:
```
SELECT name
FROM master.dbo.sysobjects
WHERE name LIKE @ReportParameter1
```
For the dat... |
262,106 | <p>What happen when SQL Server 2005 happen to reach the maximum for an IDENTITY column? Does it start from the beginning and start refilling the gap? </p>
<p>What is the behavior of SQL Server 2005 when it happen?</p>
| [
{
"answer_id": 262123,
"author": "xsl",
"author_id": 11387,
"author_profile": "https://Stackoverflow.com/users/11387",
"pm_score": 5,
"selected": true,
"text": "<p><strong>You will get an overflow error when the maximum value is reached</strong>. If you use the bigint datatype with a max... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262106",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24975/"
] | What happen when SQL Server 2005 happen to reach the maximum for an IDENTITY column? Does it start from the beginning and start refilling the gap?
What is the behavior of SQL Server 2005 when it happen? | **You will get an overflow error when the maximum value is reached**. If you use the bigint datatype with a maximum value of `9,223,372,036,854,775,807` this will most likely never be the case.
The error message you will get, will look like this:
```
Msg 220, Level 16, State 2, Line 10
Arithmetic overflow error for ... |
262,108 | <p>I am creating an application which displays some messages and its directions in the DataGridView. I would like to replace some columns content with pictures. For example I would like to replace number 0 which represents the incoming call with a green arrow (some .jpg image).</p>
<p>Does anyone know how this could b... | [
{
"answer_id": 262149,
"author": "Gavin Miller",
"author_id": 33226,
"author_profile": "https://Stackoverflow.com/users/33226",
"pm_score": 0,
"selected": false,
"text": "<p>GridViews have the ability to use an image field as opposed to a data bound field. This sounds like it would do t... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262108",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22996/"
] | I am creating an application which displays some messages and its directions in the DataGridView. I would like to replace some columns content with pictures. For example I would like to replace number 0 which represents the incoming call with a green arrow (some .jpg image).
Does anyone know how this could be achieved... | We stored the images in the resource file as BMP files. Then, we handle the CellFormatting event in the DataGridView like this:
```
private void messageInfoDataGridView_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
{
// Is this the correct column? (It's actually a DataGridViewIma... |
262,110 | <p>Ok, the more I use LINQ, the more I like it! I recently found myself working in some legacy code at work. It is your classic DataSet and DataTable rich application. Well, when adding a bit of functionality I found myself <em>really</em> wanting to just query the rows of a DataTable for the results I was looking for.... | [
{
"answer_id": 262124,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 3,
"selected": false,
"text": "<p>Seems good to me - although I'd try to use a strongly typed data set which makes the LINQ queries look even more plea... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262110",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2595/"
] | Ok, the more I use LINQ, the more I like it! I recently found myself working in some legacy code at work. It is your classic DataSet and DataTable rich application. Well, when adding a bit of functionality I found myself *really* wanting to just query the rows of a DataTable for the results I was looking for.
Let me r... | One other observation; if you aren't using typed datasets, you might also want to know about the `Field<>` extension method:
```
var customerOrderIds = table.Rows.Cast<DataRow>()
.Where(x => x.Field<string>("CUSTOMER_ID") == customerId)
.Select(x => x.Field<string>("CUSTOMER_ORDER_ID"))
.Disti... |
262,116 | <p>The build machine at work has many projects, but we are only experiencing a problem with one. </p>
<p>Two projects are very similar, one builds in debug mode, the other in release mode. They both clear out the projects directory, and then does a full Get from source safe. The debug build gets the source fine and... | [
{
"answer_id": 1730490,
"author": "Pedro",
"author_id": 13188,
"author_profile": "https://Stackoverflow.com/users/13188",
"pm_score": 0,
"selected": false,
"text": "<p>Are the Debug and Release builds running at the same time? If so, I could see one waiting for the other to finish.</p>\n... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262116",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1500/"
] | The build machine at work has many projects, but we are only experiencing a problem with one.
Two projects are very similar, one builds in debug mode, the other in release mode. They both clear out the projects directory, and then does a full Get from source safe. The debug build gets the source fine and fairly quick... | In the end we have switched from SourceSafe to SourceGear Vault (mainly for branching features, but speed and reliability were also large factors).
We have also moved our build machine from an old pc to a server which has a 1Gb/s connection to the source server, rather than 100Mb/s, which has helped considerably.
In ... |
262,141 | <p>I have a image button. I wanted to add a text "Search" on it. I am not able to add it because the "imagebutton" property in VS 2008 does not have text control in it. Can anyone tell me how to add text to a image button?? </p>
<pre><code> <asp:ImageButton ID="Searchbutton" runat="server" AlternateText="Se... | [
{
"answer_id": 262171,
"author": "leppie",
"author_id": 15541,
"author_profile": "https://Stackoverflow.com/users/15541",
"pm_score": 5,
"selected": true,
"text": "<pre><code><button runat=\"server\" \n style=\"background-image:url('/Content/Img/stackoverflow-logo-250.png')\" >\n ... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262141",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a image button. I wanted to add a text "Search" on it. I am not able to add it because the "imagebutton" property in VS 2008 does not have text control in it. Can anyone tell me how to add text to a image button??
```
<asp:ImageButton ID="Searchbutton" runat="server" AlternateText="Search"
CssClass=... | ```
<button runat="server"
style="background-image:url('/Content/Img/stackoverflow-logo-250.png')" >
your text here<br/>and some more<br/><br/> and some more ....
</button>
``` |
262,143 | <p>I have a html string held in memory after transforming to my desired template with XSLT. What is the best mechanism to the send this to the client printer? </p>
<p>In previous projects I have shamelessly cheated and created a print preview screen, which was essentially an ASPX page with white background that I then... | [
{
"answer_id": 262164,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 1,
"selected": false,
"text": "<p>Look at CSS media selectors. You can use them to create a single page the looks how you want on the screen and als... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262143",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11802/"
] | I have a html string held in memory after transforming to my desired template with XSLT. What is the best mechanism to the send this to the client printer?
In previous projects I have shamelessly cheated and created a print preview screen, which was essentially an ASPX page with white background that I then printed u... | I don't think a 'print preview' is cheating at all. Since your string is most likely on the server (ie created in ASP.NET code-behind), you must output it to the client somehow and call window.print() to print. There's no way for a webserver to access a client's printers. However you may be able to streamline things us... |
262,150 | <p>I have a page where my combo box has hundreds of elements which makes it very hard to pick the one item I want. Is there a good Javascript replacement that would do better than</p>
<pre><code><select id="field-component" name="field_component">
<option selected="selected">1</option... | [
{
"answer_id": 262187,
"author": "VonC",
"author_id": 6309,
"author_profile": "https://Stackoverflow.com/users/6309",
"pm_score": 3,
"selected": true,
"text": "<p><img src=\"https://i.stack.imgur.com/TouKN.gif\" alt=\"http://www.dhtmlx.com/images/logo_combo.gif\"><br>\nYou have <a href=\... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262150",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6583/"
] | I have a page where my combo box has hundreds of elements which makes it very hard to pick the one item I want. Is there a good Javascript replacement that would do better than
```
<select id="field-component" name="field_component">
<option selected="selected">1</option><option>2</option>...
</sele... | 
You have [dhtmlCombo](http://www.dhtmlx.com/docs/products/dhtmlxCombo/index.shtml), using ajax to retrieve data when you are filling the input field.
dhtmlxCombo is a cross-browser JavaScript combobox with autocomplete feature.
It... |
262,156 | <p>I try to get rounded corners on a UIImage, what I read so far, the easiest way is to use a mask images. For this I used code from TheElements iPhone Example and some image resize code I found. My problem is that resizedImage is always nil and I don't find the error...</p>
<pre><code>- (UIImage *)imageByScalingPropo... | [
{
"answer_id": 262545,
"author": "Lounges",
"author_id": 8918,
"author_profile": "https://Stackoverflow.com/users/8918",
"pm_score": 0,
"selected": false,
"text": "<p><a href=\"https://stackoverflow.com/questions/205431/rounded-corners-on-uiimage#205643\">See here...</a>\nIMO unless you ... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262156",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23028/"
] | I try to get rounded corners on a UIImage, what I read so far, the easiest way is to use a mask images. For this I used code from TheElements iPhone Example and some image resize code I found. My problem is that resizedImage is always nil and I don't find the error...
```
- (UIImage *)imageByScalingProportionallyToSiz... | The problem was the use of CGImageCreateWithMask which returned an all black image. The solution I found was to use CGContextClipToMask instead:
```
CGContextRef mainViewContentContext;
CGColorSpaceRef colorSpace;
colorSpace = CGColorSpaceCreateDeviceRGB();
// create a bitmap graphics context the size of the image
m... |
262,158 | <p>The simple HTML below displays differently in Firefox and WebKit-based browsers (I checked in Safari, Chrome and iPhone).</p>
<p>In Firefox both border and text have the same color (<code>#880000</code>), but in Safari the text gets a bit lighter (as if it had some transparency applied to it).</p>
<p>Can I somehow f... | [
{
"answer_id": 262478,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "<p>Can you use a button instead of an input?</p>\n\n<pre><code><html xmlns=\"http://www.w3.org/1999/xhtml\">\n<head&g... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262158",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34187/"
] | The simple HTML below displays differently in Firefox and WebKit-based browsers (I checked in Safari, Chrome and iPhone).
In Firefox both border and text have the same color (`#880000`), but in Safari the text gets a bit lighter (as if it had some transparency applied to it).
Can I somehow fix this (remove this trans... | ```
-webkit-text-fill-color: #880000;
opacity: 1; /* required on iOS */
``` |
262,160 | <p>I've got menu items that look like this</p>
<pre><code><ul>
<li>Item1<span class="context-trigger"></span></li>
<li>Item2<span class="context-trigger"></span></li>
<li>Item3<span class="context-trigger"></span></li>
</ul>
</co... | [
{
"answer_id": 262193,
"author": "Huibert Gill",
"author_id": 1254442,
"author_profile": "https://Stackoverflow.com/users/1254442",
"pm_score": 5,
"selected": true,
"text": "<p>try using </p>\n\n<pre><code>white-space: nowrap;\n</code></pre>\n\n<p>in the css definition of your context-tr... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262160",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24197/"
] | I've got menu items that look like this
```
<ul>
<li>Item1<span class="context-trigger"></span></li>
<li>Item2<span class="context-trigger"></span></li>
<li>Item3<span class="context-trigger"></span></li>
</ul>
```
with CSS that turns the above into a horizontal menu, and JS that turns the [spans] into buttons... | try using
```
white-space: nowrap;
```
in the css definition of your context-trigger class.
Edit: I think patmortech is correct though, putting nowrap on the span does not work, because there is no "white space" content. It might also be that sticking the style on the LI element does not work either, because the b... |
262,192 | <p>In our project we have a large number (hundreds) of FLA files created by the artists in CS3, from which we compile SWFs to use in our Flex/AS3 application.</p>
<p>As part of a streamlined build/deploy system, it would be really handy to be able to automate publishing all these FLAs, and ideally deploying the SWFs t... | [
{
"answer_id": 262228,
"author": "AlexGvozden",
"author_id": 34217,
"author_profile": "https://Stackoverflow.com/users/34217",
"pm_score": 2,
"selected": false,
"text": "<p>How you are running Flash CS3 on Linux ? \nyou cannot run JSFL from command line but compiling a FLA file should be... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262192",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13220/"
] | In our project we have a large number (hundreds) of FLA files created by the artists in CS3, from which we compile SWFs to use in our Flex/AS3 application.
As part of a streamlined build/deploy system, it would be really handy to be able to automate publishing all these FLAs, and ideally deploying the SWFs too. I foun... | Execute your JSFL scripts from the command line just like this:
on Windows: `"c:\program files\macromedia\flash 8\flash.exe" myscript.jsfl`
on Mac: `open myscript.jsfl`
I believe older versions of Flash ran on Wine no problem but not as sure about CS3.
To iterate over a batch of local files, try something like this... |
262,201 | <p>How can I write a C++ function returning true if a real number is exactly representable with a double?</p>
<pre><code>bool isRepresentable( const char* realNumber )
{
bool answer = false;
// what goes here?
return answer;
}
</code></pre>
<p>Simple tests:</p>
<pre><code>assert( true==isRepresentable( "0.5... | [
{
"answer_id": 262229,
"author": "Treb",
"author_id": 22114,
"author_profile": "https://Stackoverflow.com/users/22114",
"pm_score": -1,
"selected": false,
"text": "<p>Convert the string into a float with a larger scope than a double. Cast that to a double and see if they match.</p>\n"
... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262201",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15485/"
] | How can I write a C++ function returning true if a real number is exactly representable with a double?
```
bool isRepresentable( const char* realNumber )
{
bool answer = false;
// what goes here?
return answer;
}
```
Simple tests:
```
assert( true==isRepresentable( "0.5" ) );
assert( false==isRepresentable... | Parse the number into the form a + N / (10^k), where a and N are integers, and k is the number of decimal places you have.
Example: 12.0345 -> 12 + 345 / 10^4, a = 12, N = 345, k = 4
Now, 10^k = (2 \* 5) ^ k = 2^k \* 5^k
You can represent your number as exact binary fraction if and only if you get rid of the 5^k te... |
262,219 | <p>I'm trying to get CellID using AT commands, but I dont get any response from the modem, mine code looks like below, I send AT+CCED command, but never get any response.</p>
<pre><code>HANDLE hCom;
char * xpos;
char rsltstr[5];
DWORD returnValue;
DWORD LAC;
DWORD CellId;
int bufpos;
DCB dcb;
COMMTIMEOUTS to;
DWORD nW... | [
{
"answer_id": 274176,
"author": "Shane Powell",
"author_id": 23235,
"author_profile": "https://Stackoverflow.com/users/23235",
"pm_score": 1,
"selected": false,
"text": "<p>I don't know anything about using the AT commands to get the cell id but you can use the RIL interface to get the ... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262219",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31207/"
] | I'm trying to get CellID using AT commands, but I dont get any response from the modem, mine code looks like below, I send AT+CCED command, but never get any response.
```
HANDLE hCom;
char * xpos;
char rsltstr[5];
DWORD returnValue;
DWORD LAC;
DWORD CellId;
int bufpos;
DCB dcb;
COMMTIMEOUTS to;
DWORD nWritten;
DWORD ... | First of all, try **L"COM9:"** for the first parameter of CreateFile.
Check out this page: [Device File Names](http://msdn.microsoft.com/en-us/library/aa930218.aspx) |
262,247 | <p>Let's say there is a report to compare charges with adjustments that outputs to excel, such that each row has the following fields:</p>
<ul>
<li>Account Number</li>
<li>charge date</li>
<li>Original item number</li>
<li>Adjusted Item number</li>
<li>Original Qty</li>
<li>Adjusted Qty</li>
<li>Original amount</li>
<... | [
{
"answer_id": 262332,
"author": "Tomalak",
"author_id": 18771,
"author_profile": "https://Stackoverflow.com/users/18771",
"pm_score": 3,
"selected": true,
"text": "<p>It is a little tricky, but doable. I'm looking into this currently, stand by.</p>\n\n<p>Okay, the idea is this.</p>\n\n<... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262247",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3043/"
] | Let's say there is a report to compare charges with adjustments that outputs to excel, such that each row has the following fields:
* Account Number
* charge date
* Original item number
* Adjusted Item number
* Original Qty
* Adjusted Qty
* Original amount
* Adjusted amount
* Original Post date
* Adjusted Post date
I... | It is a little tricky, but doable. I'm looking into this currently, stand by.
Okay, the idea is this.
You have the following layout:
```
/| A | B | C | D | F |
-+---------+---------+---------+---------+---------+
1| Acc No. | Data1 | Data1' | Data2 | Data2' |
2| 1 | 10... |
262,249 | <p>I have a debug app I've been writing which receives data from a C-based process via UDP. One of the strings sent to me contains a <code>°</code> character - <a href="http://en.wikipedia.org/wiki/Degree_symbol" rel="nofollow noreferrer">Unicode U+00B0</a> (which incidentally breaks the StackOverflow search function!)... | [
{
"answer_id": 262433,
"author": "pdc",
"author_id": 8925,
"author_profile": "https://Stackoverflow.com/users/8925",
"pm_score": 1,
"selected": false,
"text": "<p>I can't say mych about wxPython itself, but I am guessing that it is trying to convert the text to Unicode before displaying ... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262249",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15369/"
] | I have a debug app I've been writing which receives data from a C-based process via UDP. One of the strings sent to me contains a `°` character - [Unicode U+00B0](http://en.wikipedia.org/wiki/Degree_symbol) (which incidentally breaks the StackOverflow search function!). When my wxPython application tries to append that... | pdc got it right, the following works fine (but fails without the `decode`):
```
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import wx
app = wx.PySimpleApp()
app.TopWindow = wx.Frame(None)
field = wx.TextCtrl(app.TopWindow)
field.Value += '°'.decode('ISO8859-1')
app.TopWindow.Show()
app.MainLoop()
``` |
262,254 | <p>How can I use CRTP in C++ to avoid the overhead of virtual member functions?</p>
| [
{
"answer_id": 262270,
"author": "Roger Lipscombe",
"author_id": 8446,
"author_profile": "https://Stackoverflow.com/users/8446",
"pm_score": 1,
"selected": false,
"text": "<p>I had to look up <a href=\"http://en.wikipedia.org/wiki/Curiously_Recurring_Template_Pattern\" rel=\"nofollow nor... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262254",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | How can I use CRTP in C++ to avoid the overhead of virtual member functions? | There are two ways.
The first one is by specifying the interface statically for the structure of types:
```
template <class Derived>
struct base {
void foo() {
static_cast<Derived *>(this)->foo();
};
};
struct my_type : base<my_type> {
void foo(); // required to compile.
};
struct your_type : base<your_ty... |
262,267 | <p>How do I create a toolbar for Excel using an XLA document?</p>
| [
{
"answer_id": 262304,
"author": "Onorio Catenacci",
"author_id": 2820,
"author_profile": "https://Stackoverflow.com/users/2820",
"pm_score": 1,
"selected": false,
"text": "<p>Not sure if this is what you're looking for but I thought this might help you out:</p>\n\n<p><a href=\"http://ww... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262267",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16794/"
] | How do I create a toolbar for Excel using an XLA document? | To make a toolbar, in the onload event, you are going to do something like:
```
Dim myBar As CommandBar, myButt As CommandBarControl
'Delete the toolbar if it already exists'
On Error Resume Next
CommandBars("My Toolbar").Delete
On Error Goto 0
Set myBar = CommandBars.Add(Name:="My Toolbar", _
Position:=mso... |
262,280 | <p>When I get a reference to a <code>System.Diagnostics.Process</code>, how can I know if a process is currently running?</p>
| [
{
"answer_id": 262291,
"author": "Patrick Desjardins",
"author_id": 13913,
"author_profile": "https://Stackoverflow.com/users/13913",
"pm_score": 9,
"selected": true,
"text": "<p>This is a way to do it with the name:</p>\n\n<pre><code>Process[] pname = Process.GetProcessesByName(\"notepa... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262280",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30717/"
] | When I get a reference to a `System.Diagnostics.Process`, how can I know if a process is currently running? | This is a way to do it with the name:
```
Process[] pname = Process.GetProcessesByName("notepad");
if (pname.Length == 0)
MessageBox.Show("nothing");
else
MessageBox.Show("run");
```
You can loop all process to get the ID for later manipulation:
```
Process[] processlist = Process.GetProcesses();
foreach(Proces... |
262,325 | <p>I've been tasked with deploying an application built by a third party on an Oracle Application Server, version 10.1.3.0. I've deployed it on Oracle Application Server version 10.1.2.0 without much difficulty. I'm getting the following error:</p>
<pre><code>javax.naming.NamingException: Lookup error: javax.naming.... | [
{
"answer_id": 262296,
"author": "Lou Franco",
"author_id": 3937,
"author_profile": "https://Stackoverflow.com/users/3937",
"pm_score": 3,
"selected": true,
"text": "<p>Fiddler can do constrained bandwidth and latency simulations.</p>\n"
},
{
"answer_id": 262385,
"author": "m... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262325",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25532/"
] | I've been tasked with deploying an application built by a third party on an Oracle Application Server, version 10.1.3.0. I've deployed it on Oracle Application Server version 10.1.2.0 without much difficulty. I'm getting the following error:
```
javax.naming.NamingException: Lookup error: javax.naming.AuthenticationEx... | Fiddler can do constrained bandwidth and latency simulations. |
262,330 | <p>Is there a common or established algorithm for peer-nodes in a network to decide on a unique "network-channel" (or any other form of semi-secret identifier)?</p>
<p>The environment I'm working in is SecondLife. I am trying to figure out how to get many identical peer scripted objects to agree on a "channel" number... | [
{
"answer_id": 671632,
"author": "Domchi",
"author_id": 29192,
"author_profile": "https://Stackoverflow.com/users/29192",
"pm_score": 1,
"selected": false,
"text": "<p>How would a new object know which network to join (new or existing)? Depending on what exactly you need, there are numbe... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262330",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Is there a common or established algorithm for peer-nodes in a network to decide on a unique "network-channel" (or any other form of semi-secret identifier)?
The environment I'm working in is SecondLife. I am trying to figure out how to get many identical peer scripted objects to agree on a "channel" number which allo... | How would a new object know which network to join (new or existing)? Depending on what exactly you need, there are number of approaches.
First method
------------
You can use less precise timer than every second, for example something like this:
```
integer time = llGetUnixTime();
integer channel = time - (time % 10... |
262,338 | <p>In oracle, I want to create a delete sproc that returns an integer based on the outcome of the deletion.</p>
<p>this is what i have so far.</p>
<pre><code>create or replace
PROCEDURE Testing
(
iKey IN VARCHAR2
)
AS
BEGIN
delete from MyTable WHERE
TheKey = iKey;
END Testing;
</code></pre>
<p>i've tried p... | [
{
"answer_id": 262370,
"author": "Justin Cave",
"author_id": 10397,
"author_profile": "https://Stackoverflow.com/users/10397",
"pm_score": 4,
"selected": false,
"text": "<p>A procedure does not return a value. A function returns a value, but you shouldn't be doing DML in a function (oth... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262338",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21180/"
] | In oracle, I want to create a delete sproc that returns an integer based on the outcome of the deletion.
this is what i have so far.
```
create or replace
PROCEDURE Testing
(
iKey IN VARCHAR2
)
AS
BEGIN
delete from MyTable WHERE
TheKey = iKey;
END Testing;
```
i've tried putting a RETURNS INTEGER in but t... | Use a function and the implicit SQL cursor to determine the number of rows deleted
```
create or replace
FUNCTION Testing
(
iKey IN VARCHAR2
) RETURN INTEGER
AS
BEGIN
delete from MyTable WHERE
TheKey = iKey;
RETURN SQL%ROWCOUNT;
END Testing;
```
That should work |
262,339 | <p>I'd like to use the ADO.NET Entity Framework for data access, extend its objects for my business logic, and bind those objects to controls in my UI.</p>
<p>As explained in <a href="https://stackoverflow.com/questions/260233/how-do-i-extend-adonet-entity-framework-objects-with-partial-classes">the answers to another... | [
{
"answer_id": 262375,
"author": "CubanX",
"author_id": 27555,
"author_profile": "https://Stackoverflow.com/users/27555",
"pm_score": 2,
"selected": false,
"text": "<p>You can architect your solution using (Plain Old C# Objects) POCO's and Managers.</p>\n\n<p>That way you separate the bu... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262339",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/83/"
] | I'd like to use the ADO.NET Entity Framework for data access, extend its objects for my business logic, and bind those objects to controls in my UI.
As explained in [the answers to another question](https://stackoverflow.com/questions/260233/how-do-i-extend-adonet-entity-framework-objects-with-partial-classes), I cann... | You can architect your solution using (Plain Old C# Objects) POCO's and Managers.
That way you separate the business logic from the value objects.
To make it "look pretty", you can mark your methods with the (this) modifier on the parameters so you can then use those methods as extension methods.
An example could ma... |
262,341 | <p>I have a requirement to allow a user of this ASP.NET web application to upload a specifically formatted Excel spreadsheet, fill arrays with data from the spreadsheet, and bind the arrays to a Oracle stored procedure for validation and insertion into the database. I must be able to read the data from the Excel sprea... | [
{
"answer_id": 262353,
"author": "Christian C. Salvadó",
"author_id": 5445,
"author_profile": "https://Stackoverflow.com/users/5445",
"pm_score": 2,
"selected": false,
"text": "<p>Use the FileUpload1.<a href=\"http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.fileupload.f... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262341",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a requirement to allow a user of this ASP.NET web application to upload a specifically formatted Excel spreadsheet, fill arrays with data from the spreadsheet, and bind the arrays to a Oracle stored procedure for validation and insertion into the database. I must be able to read the data from the Excel spreadshe... | I found a great lightweight open source API on Codeplex for doing this called ExcelDataReader.
It can transform an input stream of an excel file into a `System.Data.DataSet` object (probably parsing using BIFF specs).
Here's the link:
>
> <http://www.codeplex.com/ExcelDataReader>
>
>
>
Here's a code sample:
... |
262,351 | <p>I have several identical elements with different attributes that I'm accessing with SimpleXML:</p>
<pre><code><data>
<seg id="A1"/>
<seg id="A5"/>
<seg id="A12"/>
<seg id="A29"/>
<seg id="A30"/>
</data>
</code></pre>
<p>I need to remove a specific <stro... | [
{
"answer_id": 262556,
"author": "Stefan Gehrig",
"author_id": 11354,
"author_profile": "https://Stackoverflow.com/users/11354",
"pm_score": 7,
"selected": true,
"text": "<p>While <a href=\"http://de.php.net/manual/en/book.simplexml.php\" rel=\"noreferrer\">SimpleXML</a> provides <a href... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262351",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33739/"
] | I have several identical elements with different attributes that I'm accessing with SimpleXML:
```
<data>
<seg id="A1"/>
<seg id="A5"/>
<seg id="A12"/>
<seg id="A29"/>
<seg id="A30"/>
</data>
```
I need to remove a specific **seg** element, with an id of "A12", how can I do this? I've tried loopi... | While [SimpleXML](http://de.php.net/manual/en/book.simplexml.php) provides [a way to remove](https://stackoverflow.com/a/16062633/367456) XML nodes, its modification capabilities are somewhat limited. One other solution is to resort to using the [DOM](http://de.php.net/manual/en/book.dom.php) extension. [dom\_import\_s... |
262,361 | <p>I've been trying to design a database schema for a side project but I havent been able to produce anything that I'm comfortable with. I'm using ASP.Net with LINQ for my data access:</p>
<p>I'm going to allow users to specify up to 10 "items" each with 2 numeric properties, and 1 referential property, the item name.... | [
{
"answer_id": 262403,
"author": "Manu",
"author_id": 2133,
"author_profile": "https://Stackoverflow.com/users/2133",
"pm_score": 0,
"selected": false,
"text": "<p>use a single item table: </p>\n\n<p>userId, itemIndex, isReference, numericValue, referenceValue</p>\n\n<p>this way the valu... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262361",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30816/"
] | I've been trying to design a database schema for a side project but I havent been able to produce anything that I'm comfortable with. I'm using ASP.Net with LINQ for my data access:
I'm going to allow users to specify up to 10 "items" each with 2 numeric properties, and 1 referential property, the item name.
If I wer... | I'd recommend the latter design you mention, create one dependent table with five columns:
```
CREATE TABLE Items (
user_id INTEGER NOT NULL,
item_id INTEGER NOT NULL DEFAULT 1,
numeric_property1 INTEGER,
numeric_property2 INTEGER,
referential_property INTEGER,
PRIMARY ... |
262,362 | <p>On Ubuntu Linux with Gnome, running my Swing application by double clicking on the jar file in Gnomes file browser leads to errors because required libraries that are dynamically loaded via the Java Plugin Framework (residing in subdirectories) are not found.</p>
<p>The base libraries for the framework itself are r... | [
{
"answer_id": 262395,
"author": "Steve B.",
"author_id": 19479,
"author_profile": "https://Stackoverflow.com/users/19479",
"pm_score": 0,
"selected": false,
"text": "<p>Java loads jars in order in its classpath, i.e. jar1:jar2:jar3... Most java applications ship with some sort of script... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262362",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25141/"
] | On Ubuntu Linux with Gnome, running my Swing application by double clicking on the jar file in Gnomes file browser leads to errors because required libraries that are dynamically loaded via the Java Plugin Framework (residing in subdirectories) are not found.
The base libraries for the framework itself are resolved co... | I believe if you add to the jar a META-INF/MANIFEST.MF file containing a "Classpath:" attribute, with a value specifying the relative paths to the jars you need (I'm not sure whether they are space or comma separated), that might work. |
262,363 | <p>I'm working on a stripes app that uses a bit of jQuery to make the UI more dynamic/usable.</p>
<p>I set up an Error Resolution, so if an error is thrown, the user is redirected to an error.jsp page.</p>
<p>However, if an error is thrown during a jQuery Ajax call, instead of redirecting to the error.jsp page, I get... | [
{
"answer_id": 262449,
"author": "Craig Stuntz",
"author_id": 7714,
"author_profile": "https://Stackoverflow.com/users/7714",
"pm_score": 3,
"selected": true,
"text": "<pre><code>$(document).ajaxError(function(event, XMLHttpRequest, ajaxOptions, thrownError) {\n // redirect here.\n}\n... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262363",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31172/"
] | I'm working on a stripes app that uses a bit of jQuery to make the UI more dynamic/usable.
I set up an Error Resolution, so if an error is thrown, the user is redirected to an error.jsp page.
However, if an error is thrown during a jQuery Ajax call, instead of redirecting to the error.jsp page, I get html printed to ... | ```
$(document).ajaxError(function(event, XMLHttpRequest, ajaxOptions, thrownError) {
// redirect here.
}
```
I should add that I don't redirect when there is an exception in an Ajax call. Instead, I have the server return an error description in JSON format and display that in the page. |
262,367 | <p>In my spring application context file, I have something like:</p>
<pre><code><util:map id="someMap" map-class="java.util.HashMap" key-type="java.lang.String" value-type="java.lang.String">
<entry key="some_key" value="some value" />
<... | [
{
"answer_id": 262416,
"author": "MetroidFan2002",
"author_id": 8026,
"author_profile": "https://Stackoverflow.com/users/8026",
"pm_score": 9,
"selected": true,
"text": "<p>Well, first of all, you're wasting memory with the new <code>HashMap</code> creation call. Your second line complet... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262367",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37740/"
] | In my spring application context file, I have something like:
```
<util:map id="someMap" map-class="java.util.HashMap" key-type="java.lang.String" value-type="java.lang.String">
<entry key="some_key" value="some value" />
<entry key="some_key_2" value="some value" />
</util:map>
```
In java class, the imp... | Well, first of all, you're wasting memory with the new `HashMap` creation call. Your second line completely disregards the reference to this created hashmap, making it then available to the garbage collector. So, don't do that, use:
```
private Map<String, String> someMap = (HashMap<String, String>)getApplicationConte... |
262,376 | <p>After "check-in" of a <code>.docx</code> file to <code>SharePoint</code> and editing it the <code>RevNum</code> property is set to <code>2</code>.</p>
<p>This does not make sense, can someone explain why this is?</p>
| [
{
"answer_id": 262416,
"author": "MetroidFan2002",
"author_id": 8026,
"author_profile": "https://Stackoverflow.com/users/8026",
"pm_score": 9,
"selected": true,
"text": "<p>Well, first of all, you're wasting memory with the new <code>HashMap</code> creation call. Your second line complet... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262376",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | After "check-in" of a `.docx` file to `SharePoint` and editing it the `RevNum` property is set to `2`.
This does not make sense, can someone explain why this is? | Well, first of all, you're wasting memory with the new `HashMap` creation call. Your second line completely disregards the reference to this created hashmap, making it then available to the garbage collector. So, don't do that, use:
```
private Map<String, String> someMap = (HashMap<String, String>)getApplicationConte... |
262,379 | <p>I've been trying to understand the strict aliasing rules as they apply to the char pointer.</p>
<p><a href="http://cellperformance.beyond3d.com/articles/2006/06/understanding-strict-aliasing.html#cast_to_char_pointer" rel="nofollow noreferrer">Here</a> this is stated:</p>
<blockquote>
<p>It is always presumed th... | [
{
"answer_id": 262401,
"author": "Adam Rosenfield",
"author_id": 9530,
"author_profile": "https://Stackoverflow.com/users/9530",
"pm_score": 2,
"selected": false,
"text": "<p>Correct, the second example is in violation of the strict aliasing rules, so if you compile with the <code>-fstri... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262379",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8123/"
] | I've been trying to understand the strict aliasing rules as they apply to the char pointer.
[Here](http://cellperformance.beyond3d.com/articles/2006/06/understanding-strict-aliasing.html#cast_to_char_pointer) this is stated:
>
> It is always presumed that a char\* may refer to an alias of any object.
>
>
>
Ok so... | Re @Adam Rosenfield: The union will achieve alignment so long as the supplier of the char\* started out doing something similar.
It may be useful to stand back and figure out what this is all about.
The basis for the aliasing rule is the fact that compilers may place values of different simple types on different memo... |
262,392 | <p>In an actionscript function (method) I have access to arguments.caller which returns a Function object but I can't find out the name of the function represented by this Function object.
Its toString() simply returns [Function] and I can't find any other useful accessors that give me that...
Help :-/</p>
| [
{
"answer_id": 280205,
"author": "fenomas",
"author_id": 10651,
"author_profile": "https://Stackoverflow.com/users/10651",
"pm_score": 1,
"selected": false,
"text": "<p>A function is just an object like any other - it doesn't have a \"name\" in and of itself; it only has a name in the se... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262392",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10272/"
] | In an actionscript function (method) I have access to arguments.caller which returns a Function object but I can't find out the name of the function represented by this Function object.
Its toString() simply returns [Function] and I can't find any other useful accessors that give me that...
Help :-/ | I found an answer and I'll paste it below.
@fenomas: yes, you are right of course, functions are just objects and what I'm looking for is a the name of the reference to them (if exists, i.e. the function is not anonymous). You also right that in general this doesn't look like the best way to do programming ;-) But my ... |
262,407 | <p>I need to put the image from an NSProgressIndicator into an NSOutlineView Cell. I have written up code that does this for a determinate indicator and it works just great:</p>
<pre><code>NSProgressIndicator *progressIndicator = [[NSProgressIndicator alloc] initWithFrame:NSMakeRect(0, 0, 16, 16)];
[progressIndicator ... | [
{
"answer_id": 263239,
"author": "Dave Dribin",
"author_id": 26825,
"author_profile": "https://Stackoverflow.com/users/26825",
"pm_score": 4,
"selected": true,
"text": "<p>I've used <a href=\"https://www.harmless.de/cocoa-code.php\" rel=\"nofollow noreferrer\">AMIndeterminateProgressIndi... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262407",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28106/"
] | I need to put the image from an NSProgressIndicator into an NSOutlineView Cell. I have written up code that does this for a determinate indicator and it works just great:
```
NSProgressIndicator *progressIndicator = [[NSProgressIndicator alloc] initWithFrame:NSMakeRect(0, 0, 16, 16)];
[progressIndicator setStyle:NSPro... | I've used [AMIndeterminateProgressIndicatorCell](https://www.harmless.de/cocoa-code.php) for indeterminate progress indicators in cells. It's not a true NSProgressIndicator, as it does it's own drawing, but it's a pretty good replica, IMO.
[](https://i.stack.imgur.com/Kc... |
262,408 | <p>Users are occassionally getting the above error when using our application (VB.Net, Winforms, using v2 of the framework). I'm not able to reproduce it. The callstack is as follows:</p>
<p>: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is... | [
{
"answer_id": 262434,
"author": "Stu Mackellar",
"author_id": 28591,
"author_profile": "https://Stackoverflow.com/users/28591",
"pm_score": 0,
"selected": false,
"text": "<p>It looks like you're using a custom combo box control called AutoCompleteCombo. I would suspect that the WndProc ... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262408",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34248/"
] | Users are occassionally getting the above error when using our application (VB.Net, Winforms, using v2 of the framework). I'm not able to reproduce it. The callstack is as follows:
: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
... | I have a strange non-deterministic feeling with the OutOfMemoryException in your code.
Why do you need that? And if you need it, may this be the cause of your problems? OutOfMemoryExceptions are very rare. If you have these, I would think it is a strong indication something else is wrong. |
262,426 | <p>This is a strange one...
In a windows forms app (VB.NET/VS 2005) I have the need to occasionally check if the application DVD is inserted. <br>In my production machine (and in the majority of our clients) this code takes less than an second to execute. But in some machines, it takes about 8 to 10 seconds. I couldn't... | [
{
"answer_id": 262437,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 0,
"selected": false,
"text": "<ul>\n<li><p>Have you considered network mapped drives? They can be very slow to respond for certain things.</p></li>... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262426",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15528/"
] | This is a strange one...
In a windows forms app (VB.NET/VS 2005) I have the need to occasionally check if the application DVD is inserted.
In my production machine (and in the majority of our clients) this code takes less than an second to execute. But in some machines, it takes about 8 to 10 seconds. I couldn't fin... | Where's the cost in this code? Profiling would really help on a *bad* machine
I'd imagine the cost is somewhere in those DriveInfo calls - looking in reflector at the code behind DriveInfo:
.cctor seems pretty innocuous - just validates letter constraints.
.GetDriveType calls straight down into the equivalent Win32 ... |
262,427 | <p>From the <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map" rel="noreferrer">Mozilla Developer Network</a>:</p>
<pre><code>[1,4,9].map(Math.sqrt)
</code></pre>
<p>will yield:</p>
<pre><code>[1,2,3]
</code></pre>
<p>Why then does this:</p>
<pre><code>['1','2','3'... | [
{
"answer_id": 262468,
"author": "Peter Bailey",
"author_id": 8815,
"author_profile": "https://Stackoverflow.com/users/8815",
"pm_score": 4,
"selected": false,
"text": "<p>I'm going to wager that it's something funky going on with the parseInt's 2nd parameter, the radix. Why it is break... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262427",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/208/"
] | From the [Mozilla Developer Network](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map):
```
[1,4,9].map(Math.sqrt)
```
will yield:
```
[1,2,3]
```
Why then does this:
```
['1','2','3'].map(parseInt)
```
yield this:
```
[1, NaN, NaN]
```
I have tested in Firefox 3.0.... | The callback function in `Array.map` has *three* parameters:
From the same [Mozilla page](https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/map) that you linked to:
>
> callback is invoked with three arguments: the value of the element, the index of the element, and the Array object being ... |
262,439 | <p>I am trying to create wrapper functions for <code>free</code> and <code>malloc</code> in C to help notify me of memory leaks. Does anyone know how to declare these functions so when I call <code>malloc()</code> and <code>free()</code> it will call my custom functions and not the standards lib functions?</p>
| [
{
"answer_id": 262479,
"author": "Roddy",
"author_id": 1737,
"author_profile": "https://Stackoverflow.com/users/1737",
"pm_score": 2,
"selected": false,
"text": "<p>If you define your own functions for malloc() and free() and explicitly link that with your applications, your functions sh... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262439",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am trying to create wrapper functions for `free` and `malloc` in C to help notify me of memory leaks. Does anyone know how to declare these functions so when I call `malloc()` and `free()` it will call my custom functions and not the standards lib functions? | You have a few options:
1. **GLIBC-specific solution (mostly Linux).** If your compilation environment is `glibc` with `gcc`, the preferred way is to use [malloc hooks](http://www.gnu.org/software/libtool/manual/libc/Hooks-for-Malloc.html). Not only it lets you specify custom `malloc` and `free`, but will also identif... |
262,443 | <p>I am having an issue with IEMobile accessing my site. A certain redirect I use has a 302 response code, and the headers (yep, that's app-engine):</p>
<pre>Server Development/1.0 Python/2.5.2
Date Tue, 04 Nov 2008 16:47:02 GMT
Content-Type text/html; charset=utf-8
Cache-Control no-cache
Locatio... | [
{
"answer_id": 262479,
"author": "Roddy",
"author_id": 1737,
"author_profile": "https://Stackoverflow.com/users/1737",
"pm_score": 2,
"selected": false,
"text": "<p>If you define your own functions for malloc() and free() and explicitly link that with your applications, your functions sh... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262443",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/96/"
] | I am having an issue with IEMobile accessing my site. A certain redirect I use has a 302 response code, and the headers (yep, that's app-engine):
```
Server Development/1.0 Python/2.5.2
Date Tue, 04 Nov 2008 16:47:02 GMT
Content-Type text/html; charset=utf-8
Cache-Control no-cache
Location h... | You have a few options:
1. **GLIBC-specific solution (mostly Linux).** If your compilation environment is `glibc` with `gcc`, the preferred way is to use [malloc hooks](http://www.gnu.org/software/libtool/manual/libc/Hooks-for-Malloc.html). Not only it lets you specify custom `malloc` and `free`, but will also identif... |
262,448 | <p>Quick add on requirement in our project. A field in our DB to hold a phone number is set to only allow 10 characters. So, if I get passed "(913)-444-5555" or anything else, is there a quick way to run a string through some kind of special replace function that I can pass it a set of characters to allow?</p>
<p>Re... | [
{
"answer_id": 262466,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 9,
"selected": true,
"text": "<p>Definitely regex:</p>\n\n<pre><code>string CleanPhone(string phone)\n{\n Regex digitsOnly = new Regex(@\"[^\\d]\"... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262448",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/232/"
] | Quick add on requirement in our project. A field in our DB to hold a phone number is set to only allow 10 characters. So, if I get passed "(913)-444-5555" or anything else, is there a quick way to run a string through some kind of special replace function that I can pass it a set of characters to allow?
Regex? | Definitely regex:
```
string CleanPhone(string phone)
{
Regex digitsOnly = new Regex(@"[^\d]");
return digitsOnly.Replace(phone, "");
}
```
or within a class to avoid re-creating the regex all the time:
```
private static Regex digitsOnly = new Regex(@"[^\d]");
public static string CleanPhone(string ... |
262,450 | <p>Why is using '*' to build a view bad ?</p>
<p>Suppose that you have a complex join and all fields may be used somewhere.</p>
<p>Then you just have to chose fields needed.</p>
<pre><code>SELECT field1, field2 FROM aview WHERE ...
</code></pre>
<p>The view "aview" could be <code>SELECT table1.*, table2.* ... FROM ... | [
{
"answer_id": 262472,
"author": "Rich Bradshaw",
"author_id": 16511,
"author_profile": "https://Stackoverflow.com/users/16511",
"pm_score": 2,
"selected": false,
"text": "<p>It's because you don't always need every variable, and also to make sure that you are thinking about what you spe... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262450",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14673/"
] | Why is using '\*' to build a view bad ?
Suppose that you have a complex join and all fields may be used somewhere.
Then you just have to chose fields needed.
```
SELECT field1, field2 FROM aview WHERE ...
```
The view "aview" could be `SELECT table1.*, table2.* ... FROM table1 INNER JOIN table2 ...`
We have a pro... | I don't think there's much in software that is "just bad", but there's plenty of stuff that is misused in bad ways :-)
The example you give is a reason why \* might not give you what you expect, and I think there are others. For example, if the underlying tables change, maybe columns are added or removed, a view that ... |
262,451 | <p>ShellExecute() allows me to perform simple shell tasks, allowing the system to take care of opening or printing files. I want to take a similar approach to sending an email attachment programmatically.</p>
<p>I don't want to manipulate Outlook directly, since I don't want to assume which email client the user uses ... | [
{
"answer_id": 262529,
"author": "TcKs",
"author_id": 20382,
"author_profile": "https://Stackoverflow.com/users/20382",
"pm_score": 2,
"selected": false,
"text": "<p>You can use a standard \"mailto:\" command in windows shell. It will run the default mail client.</p>\n"
},
{
"ans... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262451",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8424/"
] | ShellExecute() allows me to perform simple shell tasks, allowing the system to take care of opening or printing files. I want to take a similar approach to sending an email attachment programmatically.
I don't want to manipulate Outlook directly, since I don't want to assume which email client the user uses by default... | This is my MAPI solution:
```
#include <tchar.h>
#include <windows.h>
#include <mapi.h>
#include <mapix.h>
int _tmain( int argc, wchar_t *argv[] )
{
HMODULE hMapiModule = LoadLibrary( _T( "mapi32.dll" ) );
if ( hMapiModule != NULL )
{
LPMAPIINITIALIZE lpfnMAPIInitialize = NULL;
LPMAPIUNIN... |
262,469 | <p>How is it possible that .NET is finding the wrong 'MyType' in this scenario?</p>
<p>I have a type A.B.C.D.MyType in a project that I'm working on, and I'm referencing a DLL that has a type A.B.MyType? I do not have any 'using A.B;' statements anywhere in my code, and I do have 'using A.B.C.D;'. When I compile, the ... | [
{
"answer_id": 262498,
"author": "Martin",
"author_id": 1529,
"author_profile": "https://Stackoverflow.com/users/1529",
"pm_score": 0,
"selected": false,
"text": "<p>Just a guess: in your project properties, is the \"default namespace\" set to A.B ?</p>\n"
},
{
"answer_id": 26253... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262469",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7529/"
] | How is it possible that .NET is finding the wrong 'MyType' in this scenario?
I have a type A.B.C.D.MyType in a project that I'm working on, and I'm referencing a DLL that has a type A.B.MyType? I do not have any 'using A.B;' statements anywhere in my code, and I do have 'using A.B.C.D;'. When I compile, the compiler t... | Are you working in a namespace that is under A.B namespace? (for example A.B.X) if so the C# namespace resolutions ([ECMA-334 C# Language Specification : 10.8 10.8 Namespace and type names](http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-334.pdf)) says:
>
> ... for each namespace N, starting
> with... |
262,480 | <p>what's the quickest way to extract a 5 digit number from a string in c#. </p>
<p>I've got </p>
<pre><code>string.Join(null, System.Text.RegularExpressions.Regex.Split(expression, "[^\\d]"));
</code></pre>
<p>Any others?</p>
| [
{
"answer_id": 262491,
"author": "Tom Ritter",
"author_id": 8435,
"author_profile": "https://Stackoverflow.com/users/8435",
"pm_score": 2,
"selected": false,
"text": "<p>Do you mean convert a string to a number? Or find the first 5 digit string and then make it a number? Either way, yo... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262480",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9948/"
] | what's the quickest way to extract a 5 digit number from a string in c#.
I've got
```
string.Join(null, System.Text.RegularExpressions.Regex.Split(expression, "[^\\d]"));
```
Any others? | The regex approach is probably the quickest to implement but not the quickest to run. I compared a simple regex solution to the following manual search code and found that the manual search code is ~2x-2.5x faster for large input strings and up to 4x faster for small strings:
```
static string Search(string expression... |
262,493 | <p>What would be the best way of inserting functionality into a binary application (3d party, closed source).</p>
<p>The target application is on OSX and seems to have been compiled using gcc 3+. I can see the listing of functions implemented in the binary and have debugged and isolated one particular function which I... | [
{
"answer_id": 262576,
"author": "Mr Fooz",
"author_id": 25050,
"author_profile": "https://Stackoverflow.com/users/25050",
"pm_score": 0,
"selected": false,
"text": "<p>Interesting problem. If I understand you correctly, you'd like to add the ability to remotely call functions in a runn... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262493",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | What would be the best way of inserting functionality into a binary application (3d party, closed source).
The target application is on OSX and seems to have been compiled using gcc 3+. I can see the listing of functions implemented in the binary and have debugged and isolated one particular function which I would lik... | For those interested in what I've ended up doing, here's a summary:
I've looked at several possibilities. They fall into runtime patching, and static binary file patching.
As far as file patching is concerned, I essentially tried two approaches:
1. modifying the assembly in the code
segments (\_\_TEXT) of the binary... |
262,508 | <p>I am using some code which was originally taken from the Apple sample ViewTransitions to swap two views with each other.</p>
<pre><code>CATransition *animation = [CATransition animation];
[animation setDelegate:self];
[animation setType:kCATransitionFade];
[animation setDuration:0.3f];
[animation setTimingFunction:... | [
{
"answer_id": 262576,
"author": "Mr Fooz",
"author_id": 25050,
"author_profile": "https://Stackoverflow.com/users/25050",
"pm_score": 0,
"selected": false,
"text": "<p>Interesting problem. If I understand you correctly, you'd like to add the ability to remotely call functions in a runn... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262508",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4496/"
] | I am using some code which was originally taken from the Apple sample ViewTransitions to swap two views with each other.
```
CATransition *animation = [CATransition animation];
[animation setDelegate:self];
[animation setType:kCATransitionFade];
[animation setDuration:0.3f];
[animation setTimingFunction:[CAMediaTiming... | For those interested in what I've ended up doing, here's a summary:
I've looked at several possibilities. They fall into runtime patching, and static binary file patching.
As far as file patching is concerned, I essentially tried two approaches:
1. modifying the assembly in the code
segments (\_\_TEXT) of the binary... |
262,510 | <p>Is there a way to search Microsoft Visual SourceSafe 6.0d for all files tagged with a specific label?</p>
| [
{
"answer_id": 272905,
"author": "Axel",
"author_id": 34778,
"author_profile": "https://Stackoverflow.com/users/34778",
"pm_score": 1,
"selected": false,
"text": "<p>I don't think you can search by label, but you can get by label.</p>\n\n<p><a href=\"http://msdn.microsoft.com/en-us/libra... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262510",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2831/"
] | Is there a way to search Microsoft Visual SourceSafe 6.0d for all files tagged with a specific label? | AJ had the right idea, but you just need to use the "dir" command instead of get:
```
ss dir -v"LABEL" $\PROJECT -R
```
This will output each file with version that is at that label in the format of:
```
someFile.c;23
someOtherFile.h;3
<filename>;<version>
```
For those interested if you want to quickly tell what... |
262,527 | <p>I need to programmatically enable READ COMMITTED SNAPSHOT in SQL Server. How can I do that?</p>
| [
{
"answer_id": 262541,
"author": "João Vieira",
"author_id": 2267,
"author_profile": "https://Stackoverflow.com/users/2267",
"pm_score": 4,
"selected": true,
"text": "<pre><code>ALTER DATABASE [dbname] SET READ_COMMITTED_SNAPSHOT ON WITH ROLLBACK AFTER 20 SECONDS \n</code></pre>\n"
},
... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262527",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2267/"
] | I need to programmatically enable READ COMMITTED SNAPSHOT in SQL Server. How can I do that? | ```
ALTER DATABASE [dbname] SET READ_COMMITTED_SNAPSHOT ON WITH ROLLBACK AFTER 20 SECONDS
``` |
262,534 | <p>I want to use the same functionality available when a Panel.AutoScroll is true, but with the scrollbars invisible.</p>
<p>To do so I need to know how can I scroll to left/right up/down using functions in my code.</p>
| [
{
"answer_id": 263590,
"author": "bobwienholt",
"author_id": 24257,
"author_profile": "https://Stackoverflow.com/users/24257",
"pm_score": 4,
"selected": false,
"text": "<p>You should be able to use the VerticalScroll and HorizontalScroll properties of the component:</p>\n\n<pre><code>c.... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262534",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10833/"
] | I want to use the same functionality available when a Panel.AutoScroll is true, but with the scrollbars invisible.
To do so I need to know how can I scroll to left/right up/down using functions in my code. | You should be able to use the VerticalScroll and HorizontalScroll properties of the component:
```
c.HorizontalScroll.Value += 100;
c.VerticalScroll.Value = c.VerticalScroll.Maximum;
``` |
262,535 | <p>In C# some of default name space such as System.Collections are listed without typing in using blah. In visual basic, they are not imports for you. Is there a way to force vb to auto imports some of default name space or VB work differently than C#?</p>
| [
{
"answer_id": 262544,
"author": "John Rudy",
"author_id": 14048,
"author_profile": "https://Stackoverflow.com/users/14048",
"pm_score": 2,
"selected": false,
"text": "<p>I'm not sure what you're asking. I can see potentially two questions there:</p>\n\n<ol>\n<li>Can you change the VB au... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262535",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28647/"
] | In C# some of default name space such as System.Collections are listed without typing in using blah. In visual basic, they are not imports for you. Is there a way to force vb to auto imports some of default name space or VB work differently than C#? | I think the first item posted by John Rudy is what you're looking for- add them in the project properties.
However, VB.Net does also work differently than C#, in that it means a different thing in VB to import a namespace than it does in C#. When you import a namespace in VB, it also brings child namespaces 'in scope'... |
262,555 | <p>You can define a number in various ways in C#,</p>
<pre><code>1F // a float with the value 1
1L // a long with the value 1
1D // a double with the value 1
</code></pre>
<p>personally I'm looking for which would a <code>short</code>, however to make the question a better reference for people, what are all the other... | [
{
"answer_id": 262589,
"author": "Gulzar Nazim",
"author_id": 4337,
"author_profile": "https://Stackoverflow.com/users/4337",
"pm_score": 2,
"selected": false,
"text": "<p>for money:</p>\n\n<pre><code>decimal mon = 1m;\n</code></pre>\n\n<p>for output:</p>\n\n<pre><code>string curr = Stri... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262555",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1610/"
] | You can define a number in various ways in C#,
```
1F // a float with the value 1
1L // a long with the value 1
1D // a double with the value 1
```
personally I'm looking for which would a `short`, however to make the question a better reference for people, what are all the other post-fix's to number literals you ca... | ```
Type Suffix .NET Framework Type
-------------------------------------------------------------------------------------
decimal M or m System.Decimal
double D or d System.Double
float F or f System.Single
int [1] System.Int32
long L or l Syst... |
262,561 | <p>We have built an application that receives several files in different formats, pdf, tiff, jpeg, doc, etc. After received, they are converted to tiff files using a third party printing driver which is installed locally on the server and set up as the default printer. In order to do that we open a System.Diagnostics.P... | [
{
"answer_id": 262601,
"author": "bobwienholt",
"author_id": 24257,
"author_profile": "https://Stackoverflow.com/users/24257",
"pm_score": 0,
"selected": false,
"text": "<p>I'm not sure about the part about MSPaint... but if your app works as a console app but not as a service, chances a... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262561",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | We have built an application that receives several files in different formats, pdf, tiff, jpeg, doc, etc. After received, they are converted to tiff files using a third party printing driver which is installed locally on the server and set up as the default printer. In order to do that we open a System.Diagnostics.Proc... | First thing I'd suggest is to **have the service run under the context of a specific user**. Then log into the server as that user and make sure that the printer is installed, set as the default, etc.
Secondly, **ditch the MS Paint solution** to simplify things. You can load the image in .NET using System.Drawing.Imag... |
262,579 | <p>I have a simple POJO web service published with Axis2 on Tomcat5.5
I try to consume it with ATL C++ client and it fails. Doing the same with a C# client works.
The problem is that ATL client sends soap body which looks like </p>
<pre><code><soap:Body>< xmlns="http://fa.test.com/xsd"></></soap:... | [
{
"answer_id": 274231,
"author": "David Norman",
"author_id": 34502,
"author_profile": "https://Stackoverflow.com/users/34502",
"pm_score": 0,
"selected": false,
"text": "<p>I don't think it has anything to do with UTF-8.</p>\n\n<p>The valid message from C# doesn't have anything inside t... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262579",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a simple POJO web service published with Axis2 on Tomcat5.5
I try to consume it with ATL C++ client and it fails. Doing the same with a C# client works.
The problem is that ATL client sends soap body which looks like
```
<soap:Body>< xmlns="http://fa.test.com/xsd"></></soap:Body></soap:Envelope>
```
Notice t... | ATL Server is entirely capable of generating the request correctly. Looks like there's some issue with the WSDL. My cursory test generates the request:
```
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001... |
262,593 | <pre><code> $('input[type=checkbox]').unbind().click(function(e){
$(this).attr('checked', true)
return false;
});
</code></pre>
<p>I NEED to return false because I have an event on its parent and I don't want to trigger that.
It just WON'T check that checkbox.</p>
| [
{
"answer_id": 262606,
"author": "Gareth",
"author_id": 31582,
"author_profile": "https://Stackoverflow.com/users/31582",
"pm_score": 1,
"selected": false,
"text": "<p>You're missing a ] at the end of your jQuery selector</p>\n"
},
{
"answer_id": 262766,
"author": "eyelidless... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262593",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23810/"
] | ```
$('input[type=checkbox]').unbind().click(function(e){
$(this).attr('checked', true)
return false;
});
```
I NEED to return false because I have an event on its parent and I don't want to trigger that.
It just WON'T check that checkbox. | ```
$('input[type=checkbox]').unbind().click(function(e){
e.stopPropagation();
});
```
Edit: I'm not sure what you need `.unbind()` for, but you should beware that that is canceling any other events you've put on those checkboxes. |
262,597 | <p>I'm new to Linux and have inherited keeping our single linux server running. It's our SVN server so it's relatively important.</p>
<p>Turns out the guy who maintained it before me had a cron task to email him when there are too many svnserve processes running, as they seem to be left dangling instead of terminating... | [
{
"answer_id": 262651,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "<p>Off the top of my head, I would do something like this:</p>\n\n<blockquote>\n <p>ps -fu username | awk '$5 !~ /[0-9]:[0-9]... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262597",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9861/"
] | I'm new to Linux and have inherited keeping our single linux server running. It's our SVN server so it's relatively important.
Turns out the guy who maintained it before me had a cron task to email him when there are too many svnserve processes running, as they seem to be left dangling instead of terminating correctly... | Just for the fun of it (GNU bash, version 3.2.39)
```
ps h -u cvsuser -o pid,start # h - no header, only output pid and start
| grep -v ':' # exclude entries from the last 24 hours
| egrep -o '^\ *[0-9]+' # get the pid (handling possible leading space)
| xargs -i echo kill "{}" # pretend... |
262,603 | <p>See question above.</p>
| [
{
"answer_id": 262622,
"author": "FlySwat",
"author_id": 1965,
"author_profile": "https://Stackoverflow.com/users/1965",
"pm_score": 5,
"selected": false,
"text": "<p>Yes, use IKVM.</p>\n\n<p><a href=\"http://www.ikvm.net/\" rel=\"noreferrer\">http://www.ikvm.net/</a></p>\n\n<p>And it's ... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262603",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | See question above. | Yes, use IKVM.
<http://www.ikvm.net/>
And it's incredibly easy to use:
```
ikvmc myjar.jar
```
outputs myjar.dll |
262,636 | <p>I'm trying to implement the "Writing Information to UserData" section of <a href="http://www.asp.net/LEARN/security/tutorial-03-cs.aspx" rel="nofollow noreferrer">this article</a>, but it doesn't work properly when the cookie is part of the URI.</p>
<p>My code:</p>
<pre><code>// Create the cookie that contains the... | [
{
"answer_id": 264633,
"author": "Stephen M. Redd",
"author_id": 10115,
"author_profile": "https://Stackoverflow.com/users/10115",
"pm_score": 3,
"selected": true,
"text": "<p>I found this to be an interesting problem, so I set about doing some digging, testing, and a little bit of debug... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262636",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12601/"
] | I'm trying to implement the "Writing Information to UserData" section of [this article](http://www.asp.net/LEARN/security/tutorial-03-cs.aspx), but it doesn't work properly when the cookie is part of the URI.
My code:
```
// Create the cookie that contains the forms authentication ticket
HttpCookie authCookie = Forms... | I found this to be an interesting problem, so I set about doing some digging, testing, and a little bit of debugging into the .net framework source.
Basically, what you are trying to do will not work. Anything you put into the Response.Cookies collection will just be ignored if the browser doesn't support cookies. You... |
262,652 | <p>I can't stand HTML intermixed with other code. I'm working on a codebase that has to remain in PHP, and I don't want to touch an HTML template with a proverbial pole. So what I'm currently doing looks like this:</p>
<pre><code><?php
$page = new html_page('My wonderful page');
$page->add_contents(new html_tag('... | [
{
"answer_id": 262672,
"author": "Javier",
"author_id": 11649,
"author_profile": "https://Stackoverflow.com/users/11649",
"pm_score": 1,
"selected": false,
"text": "<p>PHP <em>is</em> a template language. therefore, it's natural that all PHP fans are using template-like design.</p>\n\n<... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262652",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7841/"
] | I can't stand HTML intermixed with other code. I'm working on a codebase that has to remain in PHP, and I don't want to touch an HTML template with a proverbial pole. So what I'm currently doing looks like this:
```
<?php
$page = new html_page('My wonderful page');
$page->add_contents(new html_tag('p', 'It works', arr... | Slightly different, but yet similar. I wrote an [article about using DOM for binding variables to templates](http://www.sitepoint.com/blogs/2008/09/25/dom-vs-template/). You may find it interesting.
Basic use-case:
```
$t = new Domling('<p class="hello"></p>');
$t->capture('hello')->bind("Hello World");
echo $t->re... |
262,675 | <p>We currently use VSS 6, this is not going to change I am afraid.</p>
<p>I am attempting to write a script that will allow a user to quickly copy all files that they have checked out to another directory tree. In order to do this I need to get a list of all the files that the user has checked out, and the directory ... | [
{
"answer_id": 262755,
"author": "Panos",
"author_id": 8049,
"author_profile": "https://Stackoverflow.com/users/8049",
"pm_score": 1,
"selected": false,
"text": "<p>See <a href=\"http://msdn.microsoft.com/en-us/library/d6kac9fd(VS.80).aspx\" rel=\"nofollow noreferrer\">here</a> for the c... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262675",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28882/"
] | We currently use VSS 6, this is not going to change I am afraid.
I am attempting to write a script that will allow a user to quickly copy all files that they have checked out to another directory tree. In order to do this I need to get a list of all the files that the user has checked out, and the directory that the f... | Two links that may be of use:
[VSS CommandLine Commands](http://msdn.microsoft.com/en-us/library/003ssz4z(VS.80).aspx)
[VSS CommandLine Options](http://msdn.microsoft.com/en-us/library/hsxzf2az(VS.80).aspx)
To expand on Panos reply
```
ss.exe Status $/ -R -U<Username>
```
Will get you the files of a particular us... |
262,691 | <p>I feel like I'm missing a fairly fundamental concept to WPF when it comes to databinding, but I can't seem to find the right combination of Google keywords to locate what I'm after, so maybe the SO Community can help. :)</p>
<p>I've got a WPF usercontrol that needs to databind to two separate objects in order to di... | [
{
"answer_id": 262794,
"author": "Todd White",
"author_id": 30833,
"author_profile": "https://Stackoverflow.com/users/30833",
"pm_score": 4,
"selected": true,
"text": "<p>I would probably use a CustomControl with two DependencyProperties. Then the external site that uses your custom cont... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262691",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25968/"
] | I feel like I'm missing a fairly fundamental concept to WPF when it comes to databinding, but I can't seem to find the right combination of Google keywords to locate what I'm after, so maybe the SO Community can help. :)
I've got a WPF usercontrol that needs to databind to two separate objects in order to display prop... | I would probably use a CustomControl with two DependencyProperties. Then the external site that uses your custom control could bind the data that they want to that control, also by using a custom control you can template the way the control looks in different situations.
Custom control code would look something like:
... |
262,740 | <p>Is there a canonical way to set up a JS onHover event with the existing onmouseover, onmouseout and some kind of timers? Or just any method to fire an arbitrary function if and only if user has hovered over element for certain amount of time.</p>
| [
{
"answer_id": 262752,
"author": "eyelidlessness",
"author_id": 17964,
"author_profile": "https://Stackoverflow.com/users/17964",
"pm_score": 4,
"selected": false,
"text": "<p>Can you clarify your question? What is \"ohHover\" in this case and how does it correspond to a delay in hover t... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262740",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29574/"
] | Is there a canonical way to set up a JS onHover event with the existing onmouseover, onmouseout and some kind of timers? Or just any method to fire an arbitrary function if and only if user has hovered over element for certain amount of time. | How about something like this?
```
<html>
<head>
<script type="text/javascript">
var HoverListener = {
addElem: function( elem, callback, delay )
{
if ( delay === undefined )
{
delay = 1000;
}
var hoverTimer;
addEvent( elem, 'mouseover', function()
{
hoverTimer = setTimeout( ... |
262,802 | <p>I'm working on a project and I want to store some easily enumerated information in a table. MySql's enum data type does exactly what I want: <a href="http://dev.mysql.com/doc/refman/5.0/en/enum.html" rel="noreferrer">http://dev.mysql.com/doc/refman/5.0/en/enum.html</a> . Is there an equivalent in SQL Server 2005?<... | [
{
"answer_id": 262812,
"author": "Nikki9696",
"author_id": 456669,
"author_profile": "https://Stackoverflow.com/users/456669",
"pm_score": 6,
"selected": true,
"text": "<p>Does this work for you?</p>\n\n<p>From <a href=\"http://blechie.com/wtilton/archive/2007/08/24/303.aspx\" rel=\"nore... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262802",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30407/"
] | I'm working on a project and I want to store some easily enumerated information in a table. MySql's enum data type does exactly what I want: <http://dev.mysql.com/doc/refman/5.0/en/enum.html> . Is there an equivalent in SQL Server 2005?
I know I could store the possible values in a type table with a key, but I'd rathe... | Does this work for you?
From <http://blechie.com/wtilton/archive/2007/08/24/303.aspx>
Create table...
**MySQL:**
```
ColumnName ENUM('upload', 'open', 'close', 'delete', 'edit', 'add')
DEFAULT 'open'
```
**SQL Server:**
```
ColumnName varchar(10)
CHECK(ColumnName IN ('upload', 'open', 'close', 'delete', '... |
262,826 | <p>A k-ary necklace of length n is an ordered list of length n whose items are drawn from an alphabet of length k, which is the lexicographically first list in a sort of all lists sharing an ordering under rotation.</p>
<p>Example:
(1 2 3) and (1 3 2) are the necklaces of length 3 from the alphabet {1 2 3}.</p>
<p>Mo... | [
{
"answer_id": 263020,
"author": "Andru Luvisi",
"author_id": 5922,
"author_profile": "https://Stackoverflow.com/users/5922",
"pm_score": 0,
"selected": false,
"text": "<p>I would do a two step process. First, find each combination of n elements from the alphabet. Then, for each combin... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | A k-ary necklace of length n is an ordered list of length n whose items are drawn from an alphabet of length k, which is the lexicographically first list in a sort of all lists sharing an ordering under rotation.
Example:
(1 2 3) and (1 3 2) are the necklaces of length 3 from the alphabet {1 2 3}.
More info:
<http:/... | The FKM algorithm for generating necklaces. PLT Scheme. Not so hot on the performance. It'll take anything as an alphabet and maps the internal numbers onto whatever you provided. Seems to be correct; no guarantees. I was lazy when translating the loops, so you get this weird mix of for loops and escape continuations.
... |
262,853 | <p>The following code says that passing the map as <code>const</code> into the <code>operator[]</code> method discards qualifiers:</p>
<pre><code>#include <iostream>
#include <map>
#include <string>
using namespace std;
class MapWrapper {
public:
const int &get_value(const int &key) cons... | [
{
"answer_id": 262863,
"author": "nlativy",
"author_id": 33635,
"author_profile": "https://Stackoverflow.com/users/33635",
"pm_score": 4,
"selected": false,
"text": "<p>You cannot use <code>operator[]</code> on a map that is <code>const</code> as that method is not <code>const</code> as ... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262853",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3594/"
] | The following code says that passing the map as `const` into the `operator[]` method discards qualifiers:
```
#include <iostream>
#include <map>
#include <string>
using namespace std;
class MapWrapper {
public:
const int &get_value(const int &key) const {
return _map[key];
}
private:
map<int, in... | [`std::map`'s `operator []` is not declared as `const`, and cannot be due to its behavior:](http://en.cppreference.com/w/cpp/container/map/operator_at)
>
> T& operator[] (const Key& key)
>
>
> Returns a reference to the value that is mapped to a key equivalent to key, performing insertion if such key does not alrea... |
262,887 | <p>I'm developing a web app with java servlet, I hope to get the user ip info by calling <code>request.getRemoteAddr()</code> from inside <code>processRequest(HttpServletRequest request,HttpServletResponse response)</code>.</p>
<p>But it returns a wrong IP. Since I'm not very knowledgeable about this area, I don't kn... | [
{
"answer_id": 262915,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 4,
"selected": false,
"text": "<p>What IP address is it displaying? My guess is there's some proxy or something changing things. (For instance, that sc... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262887",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32834/"
] | I'm developing a web app with java servlet, I hope to get the user ip info by calling `request.getRemoteAddr()` from inside `processRequest(HttpServletRequest request,HttpServletResponse response)`.
But it returns a wrong IP. Since I'm not very knowledgeable about this area, I don't know what it is displaying, maybe a... | What IP address is it displaying? My guess is there's some proxy or something changing things. (For instance, that script page displayed my ADSL router's IP address - not the one inside my LAN - for obvious reasons.)
EDIT: Now that you've shown that the IP address you're seeing is 127.0.0.1 the answer is fairly clear ... |
262,891 | <p>A PHP array can have arrays for its elements. And those arrays can have arrays and so on and so forth. Is there a way to find out the maximum nesting that exists in a PHP array? An example would be a function that returns 1 if the initial array does not have arrays as elements, 2 if at least one element is an array,... | [
{
"answer_id": 262909,
"author": "KernelM",
"author_id": 22328,
"author_profile": "https://Stackoverflow.com/users/22328",
"pm_score": 1,
"selected": false,
"text": "<p>I don't think there's anything built in. A simple recursive function could easily find out though.</p>\n"
},
{
... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262891",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/572/"
] | A PHP array can have arrays for its elements. And those arrays can have arrays and so on and so forth. Is there a way to find out the maximum nesting that exists in a PHP array? An example would be a function that returns 1 if the initial array does not have arrays as elements, 2 if at least one element is an array, an... | This should do it:
```
<?php
function array_depth(array $array) {
$max_depth = 1;
foreach ($array as $value) {
if (is_array($value)) {
$depth = array_depth($value) + 1;
if ($depth > $max_depth) {
$max_depth = $depth;
}
}
}
return $... |
262,924 | <p>In MySql's interpreter, it's very easy to dump a table to the screen along with its field names. </p>
<p>There seems to be no simple way to export a table to a tab-delimted or CSV outfile <em>including</em> its column headers.</p>
<p>I'm trying to do this using only SQL or the Linux command line, without writing a... | [
{
"answer_id": 263000,
"author": "Vinko Vrsalovic",
"author_id": 5190,
"author_profile": "https://Stackoverflow.com/users/5190",
"pm_score": 5,
"selected": true,
"text": "<p>Piping the query to the commandline client outputs a tab separated list with the column names as the first line</p... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262924",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23929/"
] | In MySql's interpreter, it's very easy to dump a table to the screen along with its field names.
There seems to be no simple way to export a table to a tab-delimted or CSV outfile *including* its column headers.
I'm trying to do this using only SQL or the Linux command line, without writing a program in another lang... | Piping the query to the commandline client outputs a tab separated list with the column names as the first line
```
$ echo "select * from surveys limit 5" | mysql -uroot -pGandalf surveys
phone param1 param2 param3 param4 p0 p1 p2 p3 audio4 code time
XXXXXXXXX 2008-07-02 11:17:... |
262,940 | <p>I'm trying to convert my sites from CF8 to openBD. I have a cfloop in a site that loops over a date range.</p>
<p>In essence, I want to insert a new record into the db for every 2 weeks (step) of a date range (from and to)</p>
<p>my loop looks like this... </p>
<pre><code><cfloop
from = "#form.startDate#"... | [
{
"answer_id": 263254,
"author": "Ben Doom",
"author_id": 12267,
"author_profile": "https://Stackoverflow.com/users/12267",
"pm_score": 0,
"selected": false,
"text": "<p>I can't see your code, but here's my first suggestion:</p>\n\n<pre><code><cfset current = [your begin date]>\n&l... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262940",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26121/"
] | I'm trying to convert my sites from CF8 to openBD. I have a cfloop in a site that loops over a date range.
In essence, I want to insert a new record into the db for every 2 weeks (step) of a date range (from and to)
my loop looks like this...
```
<cfloop
from = "#form.startDate#"
to = "#form.endDate#"
... | Your problem lies in not checking for ambiguous locale dependent date strings from your FORM.
A more robust version would be this:
```
<cfset SetLocale("English (US)")> <!--- set expected input locale here --->
<cfif LSIsDate(form.startDate) and LSIsDate(form.endDate)>
<cfset theStep = 14>
<cfloop
from = ... |
262,949 | <p>I have a RegEx that is working for me but I don't know WHY it is working for me. I'll explain.</p>
<pre><code>RegEx: \s*<in.*="(<?.*?>)"\s*/>\s*
</code></pre>
<p><br>
Text it finds (it finds the white-space before and after the input tag):</p>
<pre><code><td class="style9">
<input name=... | [
{
"answer_id": 262959,
"author": "eyelidlessness",
"author_id": 17964,
"author_profile": "https://Stackoverflow.com/users/17964",
"pm_score": 3,
"selected": false,
"text": "<p><code>.*</code> is greedy. You want <code>.*?</code> to find up to only the first <code>=</code>.</p>\n"
},
... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262949",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16292/"
] | I have a RegEx that is working for me but I don't know WHY it is working for me. I'll explain.
```
RegEx: \s*<in.*="(<?.*?>)"\s*/>\s*
```
Text it finds (it finds the white-space before and after the input tag):
```
<td class="style9">
<input name="guarantor4" id="guarantor4" size="50" type="text" tabindex="10... | You appear to be using 'greedy' matching.
Greedy matching says "eat as much as possible to make this work"
try with
```
<in[^=]*=
```
for starters, that will stop it matching the "=" as part of ".\*"
but in future, you might want to read up on the
```
.*?
```
and
```
.+?
```
notation, which stops a... |