qid int64 4 22.2M | question stringlengths 18 48.3k | answers list | date stringlengths 10 10 | metadata list |
|---|---|---|---|---|
261,580 | <p>This declaration causes an overflow in VBA:</p>
<pre><code>Const OVERFLOWS As Long = 10 * 60 * 60
</code></pre>
<p>whereas setting the value directly is fine:</p>
<pre><code>Const COMPILES_OK As Long = 36000
</code></pre>
<p>How do you persuade VBA to treat literal integers as longs?</p>
<p>Thanks</p>
| [
{
"answer_id": 261615,
"author": "xsl",
"author_id": 11387,
"author_profile": "https://Stackoverflow.com/users/11387",
"pm_score": 5,
"selected": true,
"text": "long"
},
{
"answer_id": 261680,
"author": "dbb",
"author_id": 25675,
"author_profile": "https://Stackoverfl... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261580",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1518/"
] |
261,591 | <p>I'm currently writing a C# application that does a lot of digital signal processing, which involves a lot of small fine-tuned memory xfer operations. I wrote these routines using unsafe pointers and they seem to perform much better than I first thought. However, I want the app to be as fast as possible.</p>
<p>Would I get any performance benefit from rewriting these routines in C or C++ or should I stick to unsafe pointers? I'd like to know what unsafe pointers brings to the table in terms of performance, compared to C/C++.</p>
<p>EDIT: I'm not doing anything special inside these routines, just the normal DSP stuff: cache friendly data transfers from one array to the other with a lot of multiplications, additions, bit shiftings etc. in the way. I'd expect the C/C++ routines to look pretty much the same (if not identical) as their C# counterparts.</p>
<p>EDIT: Thanks a lot to everyone for all the clever answers. What I've learned is that I won't get any significant boost in performance just by doing a direct port, unless some sort of SSE optimization takes place. Assuming that all modern C/C++ compilers can take advantage of it I'm looking forward to give it a try. If someone is interested in the results just let me know and I'll post them somewhere. (May take a while though).</p>
| [
{
"answer_id": 261819,
"author": "Andreas Magnusson",
"author_id": 5811,
"author_profile": "https://Stackoverflow.com/users/5811",
"pm_score": 3,
"selected": false,
"text": "for each n do t´[n] = h(g(f(t[n])))\n"
}
] | 2008/11/04 | [
"https://Stackoverflow.com/questions/261591",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7839/"
] |
261,594 | <p>In C# Is there a way of getting a finer granularity with SQL exceptions?</p>
<p>I'm aware that an aweful lot can go wrong but I want to deal with certain cases differently and parsing the Error message doesn't seem to be very elegant.</p>
<p>Also Are the error messages created by the framework or are they db specific?</p>
<p>For example If i have a primary key violation on INSERT is the error message going to always be:</p>
<p>Violation of PRIMARY KEY constraint 'PK_tblProduct'. Cannot insert duplicate key in object 'dbo.tblProduct'.</p>
<p>or is that SQLServer specific.</p>
<p><strong>Update</strong></p>
<p>I looks like I'm after the error number, any idea where I can get the various error numbers?</p>
<p>best I can do with a quick google is:
18456: Logon Failed
18488: Password Expired</p>
| [
{
"answer_id": 261608,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 2,
"selected": true,
"text": "SqlException"
}
] | 2008/11/04 | [
"https://Stackoverflow.com/questions/261594",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20400/"
] |
261,599 | <p>This code always works, even in different browsers:</p>
<pre><code>function fooCheck() {
alert(internalFoo()); // We are using internalFoo() here...
return internalFoo(); // And here, even though it has not been defined...
function internalFoo() { return true; } //...until here!
}
fooCheck();
</code></pre>
<p>I could not find a single reference to why it should work, though.
I first saw this in John Resig's presentation note, but it was only mentioned. There's no explanation there or anywhere for that matter.</p>
<p>Could someone please enlighten me?</p>
| [
{
"answer_id": 261682,
"author": "bobince",
"author_id": 18936,
"author_profile": "https://Stackoverflow.com/users/18936",
"pm_score": 9,
"selected": true,
"text": "function"
},
{
"answer_id": 262643,
"author": "Andrew Hedges",
"author_id": 11577,
"author_profile": "h... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261599",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21648/"
] |
261,601 | <p>I need to hide a Windows form from the taskbar but I can't use <code>WS_EX_TOOLWINDOW</code> because I need the system menu and min/max buttons on the form's title bar. </p>
<p>If I switch the form to a tool window at runtime the form skinning is stuffed up. From searching on the Web I see that VB has a ShowInTaskbar property and I'm wondering if this would do what I want, and whether it can be implemented in Delphi 2006. Also this project is a COM server and has no MainForm, etc.</p>
| [
{
"answer_id": 261619,
"author": "Toon Krijthe",
"author_id": 18061,
"author_profile": "https://Stackoverflow.com/users/18061",
"pm_score": 1,
"selected": false,
"text": "procedure TForm1.FormCreate(Sender: TObject);\nbegin\n ShowWindow(Application.Handle, SW_HIDE);\n SetWindowLong(App... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261601",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
261,622 | <p>Is it possible to replace the standard broken image via CSS or using another technique? All my images are the same size and my have transparency.</p>
<p>I've tried to wrap all images with a div's background:</p>
<pre><code><div class="no_broken">
<img src="http://www.web.com/found.gif"/>
</div>
<div class="no_broken">
<img src="http://www.web.com/notfound.gif"/>
</div>
</code></pre>
<p>CSS:</p>
<pre><code>div.no_broken {
background-image: url(standard.gif);
}
div.no_broken, div.no_broken img {
width: 32px;
height: 32px;
display: block;
}
</code></pre>
<p>But this will display two images on top of each other if the IMG is transparent.</p>
| [
{
"answer_id": 261651,
"author": "schnaader",
"author_id": 34065,
"author_profile": "https://Stackoverflow.com/users/34065",
"pm_score": 7,
"selected": true,
"text": "<img src=\"some.jpg\" onerror=\"this.src='alternative.jpg';\">\n"
},
{
"answer_id": 22946052,
"author": "broo... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261622",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28150/"
] |
261,625 | <p>I am using ehCache to store larges amount of data.
This cache is accessed about 3 times every second and must be kept up to date.
I have a thread that runs which retrieves all the data i need for the cache from the database every minute into a different cache(different cachemanager also).
What i want to do is copy the contents of the data from the new cache into the cache which is being accessed every second in a quick, reliable and synchronized manner. (e.g. call a replace method passing in the existing cache, and the new cache and update the new cache quickly and safely)</p>
<p>Is there any way off hand to do this in ehCache?</p>
<p>Any help is greatly appreciated.</p>
<p>Thanks
Damien</p>
| [
{
"answer_id": 261871,
"author": "Ken Gentle",
"author_id": 8709,
"author_profile": "https://Stackoverflow.com/users/8709",
"pm_score": 0,
"selected": false,
"text": "CacheFactory"
}
] | 2008/11/04 | [
"https://Stackoverflow.com/questions/261625",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11612/"
] |
261,638 | <p>I am developing a piece of software in Python that will be distributed to my employer's customers. My employer wants to limit the usage of the software with a time-restricted license file.</p>
<p>If we distribute the <code>.py</code> files or even <code>.pyc</code> files it will be easy to (decompile and) remove the code that checks the license file.</p>
<p>Another aspect is that my employer does not want the code to be read by our customers, fearing that the code may be stolen or at least the "novel ideas".</p>
<p>Is there a good way to handle this problem?</p>
| [
{
"answer_id": 261797,
"author": "dbr",
"author_id": 745,
"author_profile": "https://Stackoverflow.com/users/745",
"pm_score": 3,
"selected": false,
"text": ".pyc"
},
{
"answer_id": 30121460,
"author": "Lmwangi",
"author_id": 458878,
"author_profile": "https://Stackov... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261638",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6759/"
] |
261,648 | <p>I'm developing an application which has a lot of text and also different modules which can be included or not in every build.</p>
<p>For each saved project we generate automatically a report with all the details (i.e. description of algorithms used in that project and so on). Currently we embed all text as strings in the source code and we also support different languages through po and mo files.</p>
<p>The good points of the system is that it is very easy to dynamically generate documentation and report files.
The bad point is that having a lot of text in source code is ugly and the formatting (i.e. with html) is not comfortable, editing of the text is difficult, no easy spell check and terrible to translate.</p>
<p>So, the final question is: whould you rather embed documentation in code or write external documentation files (for example html) for different languages and parse them on runtime? Obviously the core text of the software, such us message boxes will stay in code anyway.</p>
<p>If it matters, I'm working in C++ with wxWidgets.</p>
| [
{
"answer_id": 261720,
"author": "Adam",
"author_id": 1366,
"author_profile": "https://Stackoverflow.com/users/1366",
"pm_score": 1,
"selected": false,
"text": "#textId \"the actual text\"\n"
}
] | 2008/11/04 | [
"https://Stackoverflow.com/questions/261648",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3373/"
] |
261,655 | <p>I have a list of tuples like this:</p>
<pre><code>[
('a', 1),
('a', 2),
('a', 3),
('b', 1),
('b', 2),
('c', 1),
]
</code></pre>
<p>I want to iterate through this keying by the first item, so, for example, I could print something like this:</p>
<pre><code>a 1 2 3
b 1 2
c 1
</code></pre>
<p>How would I go about doing this without keeping an item to track whether the first item is the same as I loop around the tuples? This feels rather messy (plus I have to sort the list to start with)...</p>
| [
{
"answer_id": 261665,
"author": "Ned Batchelder",
"author_id": 14343,
"author_profile": "https://Stackoverflow.com/users/14343",
"pm_score": 7,
"selected": true,
"text": "l = [\n('a', 1),\n('a', 2),\n('a', 3),\n('b', 1),\n('b', 2),\n('c', 1),\n]\n\nd = {}\nfor x, y in l:\n d.setdefau... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261655",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18909/"
] |
261,660 | <p>I have a <code>TreeView</code> windows forms control with an <code>ImageList</code>, and I want some of the nodes to display images, but the others to not have images.</p>
<p>I <em>don't</em> want a blank space where the image should be. I <em>don't</em> want an image that looks like the lines that the TreeView would draw if it didn't have an ImageList. How do I get it to draw images for some items and not others, without resorting to clumsy hacks like that?</p>
| [
{
"answer_id": 262396,
"author": "Martin Brown",
"author_id": 20553,
"author_profile": "https://Stackoverflow.com/users/20553",
"pm_score": 4,
"selected": true,
"text": "ImageKey"
},
{
"answer_id": 1009477,
"author": "John Fischer",
"author_id": 99573,
"author_profile... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261660",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15371/"
] |
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": "public enum MyEnum : long\n{\n one = 1,\n two = 2,\n}\n\nMyEnum number = MyEnum.one;\nlong i = (long)number;\n"
},
{... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261663",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17540/"
] |
261,683 | <p>Does it mean that two threads can't change the underlying data simultaneously? Or does it mean that the given code segment will run with predictable results when multiple threads are executing that code segment?</p>
| [
{
"answer_id": 261729,
"author": "Marcus Downing",
"author_id": 1000,
"author_profile": "https://Stackoverflow.com/users/1000",
"pm_score": 5,
"selected": false,
"text": "StringBuffer"
},
{
"answer_id": 262495,
"author": "Charles Bretana",
"author_id": 32632,
"author_... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261683",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6613/"
] |
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>(Expression<Func<TClass, TMember>> expr)
{
}
}
public class Descendant : Base
{
public void TestMethod()
{
FigureItOut(c => c.Name);
}
public String Name { get; set; }
}
</code></pre>
<p>I get this compiler error message:</p>
<pre><code>The type arguments for method
'Base.FigureItOut<TClass,TMember>
(System.Linq.Expressions.Expression<System.Func<TClass,TMember>>)'
cannot be inferred from the usage. Try specifying the type arguments explicitly.
</code></pre>
<p>If I change the call to FigureItOut to this:</p>
<pre><code>FigureItOut((Descendant c) => c.Name);
</code></pre>
<p>Then it works. Is there a way to get the first example to compile by changing the base class instead?</p>
<p>I know that if I make the entire Base class generic, like this:</p>
<pre><code>public class Base<TDescendant>
{
protected void FigureItOut<TMember>(Expression<Func<TDescendant, TMember>> expr)
{
}
}
public class Descendant : Base<Descendant>
{
public void TestMethod()
{
FigureItOut(c => c.Name);
}
public String Name { get; set; }
}
</code></pre>
<p>Then it works, but I'd rather not do that, any other hacks that can be employed, perhaps on the method level (ie. change FigureItOut somehow).</p>
| [
{
"answer_id": 261742,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 4,
"selected": true,
"text": "protected internal"
}
] | 2008/11/04 | [
"https://Stackoverflow.com/questions/261709",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/267/"
] |
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 are two lines -- one with a <code>seq_in_index</code> value of 1, the other with a <code>seq_in_index</code> value of 2.</p>
<p>My question is, if I then submit a query which uses only one of the two WHERE clauses, e.g.:</p>
<pre><code>SELECT * FROM expenses WHERE user_id = ?
</code></pre>
<p>Is there any benefit to creating another index which solely indexes the <code>user_id</code> column, or will the <code>user_id</code>/<code>dated_on</code> index described above be used just as efficiently?</p>
<p>Finally, how about if use the query:</p>
<pre><code>SELECT * FROM expenses WHERE dated_on = ?
</code></pre>
<p>How does the <code>seq_in_index</code> value of 2 affect index use and performance in this situation?</p>
| [
{
"answer_id": 261761,
"author": "Greg",
"author_id": 24181,
"author_profile": "https://Stackoverflow.com/users/24181",
"pm_score": 4,
"selected": true,
"text": "SELECT * FROM expenses WHERE user_id = ?"
}
] | 2008/11/04 | [
"https://Stackoverflow.com/questions/261717",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1174/"
] |
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": 261770,
"author": "Ken Gentle",
"author_id": 8709,
"author_profile": "https://Stackoverflow.com/users/8709",
"pm_score": 2,
"selected": false,
"text": "a"
},
{
"answer_id": 261990,
"author": "Hank Gay",
"author_id": 4203,
"author_profile": "https://Stac... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261721",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
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 that it modifies the file timestamp to be the commit time. This makes Beyond Compare comparisons much more time consuming, because you must do a binary compare to find changes.</p>
<p>I've looked at the <a href="http://svn.haxx.se/users/archive-2006-03/0949.shtml" rel="nofollow noreferrer">meta-data versioning</a> branch of the subversion source tree, but I would prefer to not try to merge that code from 2006 into the current svn source. </p>
<p>Thanks,</p>
<p>Dave</p>
| [
{
"answer_id": 261836,
"author": "Ken Gentle",
"author_id": 8709,
"author_profile": "https://Stackoverflow.com/users/8709",
"pm_score": 3,
"selected": true,
"text": "use-commit-times\n"
}
] | 2008/11/04 | [
"https://Stackoverflow.com/questions/261731",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5378/"
] |
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 scenario I'm testing for is a loss of connectivity to the database, where the SQLConnections State property seems to still be "Open" but there is no connectivity.</p>
| [
{
"answer_id": 261748,
"author": "paxdiablo",
"author_id": 14860,
"author_profile": "https://Stackoverflow.com/users/14860",
"pm_score": 4,
"selected": true,
"text": "select * from sysibm.sysdummy1\n"
},
{
"answer_id": 261771,
"author": "Amy B",
"author_id": 8155,
"au... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261735",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20400/"
] |
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 no way of seeing the exact changes unless very manually. </p>
| [
{
"answer_id": 8878963,
"author": "granth",
"author_id": 11210,
"author_profile": "https://Stackoverflow.com/users/11210",
"pm_score": 4,
"selected": false,
"text": "tf workspace /collection:http://yourserver:8080/tfs/yourCollection WorkspaceName;domain\\CurrentWorkspaceOwner /permission... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261738",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32313/"
] |
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').html("<%= render :partial => "contacts" %>");
});
</code></pre>
<p>At the moment I'm keeping all my jQuery stuff in my application.js, which is included in my layout. Oh yeah....and I'm not using Rails Edge.</p>
<p>Regards,</p>
<p>Sebastian</p>
| [
{
"answer_id": 261913,
"author": "changelog",
"author_id": 5646,
"author_profile": "https://Stackoverflow.com/users/5646",
"pm_score": 3,
"selected": true,
"text": "<script type=\"text/javascript\">\n<%= yield :footerjs %>\n</script>"
},
{
"answer_id": 261987,
"author": "Seba... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261752",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29909/"
] |
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 dateFromString:@"7/4/2008" ];
NSLog(@"string from date %@: %@ for locale %@", date, [dateFormatter stringFromDate:date], [[dateFormatter locale] localeIdentifier]);
</code></pre>
<p>When I set my region (in the International system preferences) to be United States, it prints:</p>
<pre><code>2008-08-14 20:20:31.117 Date Difference17226:10b string from date 2008-07-04 00:00:00 -0400: 7/4/08 for locale en_US
</code></pre>
<p>And when my region is United Kingdom, it prints:</p>
<pre><code>2008-08-14 20:19:23.441 Date Difference17199:10b string from date 2008-04-07 00:00:00 -0400: 07/04/2008 for locale en_GB
</code></pre>
<p>It looks like the NSDateFormatter is insensitive to the change of regions. Notice that the raw printing of the date is properly switching with the region, though.</p>
<p>What do I have to do to get the NSDateFormatter to respect the region setting? </p>
| [
{
"answer_id": 263027,
"author": "Peter Hosey",
"author_id": 30461,
"author_profile": "https://Stackoverflow.com/users/30461",
"pm_score": 2,
"selected": false,
"text": "%@"
}
] | 2008/11/04 | [
"https://Stackoverflow.com/questions/261780",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14343/"
] |
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.county_id = 9
</code></pre>
<p>I'm getting very strange results from the query and I think its because the first OR is negating the AND operators that are found before it.</p>
<p>This results in getting results back for ads of all types and not just for the type 13. </p>
<p>Each time the query is called there may be a differnt amount of county entities that need to be looked up.</p>
<p>Any help on the correct way to go about this would be appreciated. </p>
| [
{
"answer_id": 261788,
"author": "Greg",
"author_id": 24181,
"author_profile": "https://Stackoverflow.com/users/24181",
"pm_score": 8,
"selected": true,
"text": "SELECT ads.*, location.county \nFROM ads\nLEFT JOIN location ON location.county = ads.county_id\nWHERE ads.published = 1 \nAND... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261783",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/319/"
] |
261,793 | <p>i have a server - client application that runs on java 1.3; i want to change to java 1.6 step by step, meaning first few clients, than rest of the clients and finally server...
i was wondering could you direct me to some common problems that can come along and what should i look after?</p>
| [
{
"answer_id": 261803,
"author": "Yuval",
"author_id": 2819,
"author_profile": "https://Stackoverflow.com/users/2819",
"pm_score": 2,
"selected": false,
"text": "enum"
},
{
"answer_id": 261814,
"author": "Mnementh",
"author_id": 21005,
"author_profile": "https://Stack... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261793",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15878/"
] |
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) &quot;@(IntermediateAssembly)&quot; @(IlmergeAssemblies->'&quot;%(FullPath)&quot;', ' ')" />
</code></pre>
<p>This works. </p>
<p>But then I have a Setup Project, when it builds, it ignores the "import" and it doesn't merge the dlls. How can I use the targets file with the Setup Project?</p>
<p>I have tried writing this same code for Ilmerge in the Post-build event (in properties of the project) of the main project but it gives me error code 1.</p>
| [
{
"answer_id": 271959,
"author": "netadictos",
"author_id": 31791,
"author_profile": "https://Stackoverflow.com/users/31791",
"pm_score": 2,
"selected": true,
"text": "<Project \n DefaultTargets=\"Build\" \n xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n\n <Import Proje... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261801",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31791/"
] |
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": 261847,
"author": "kͩeͣmͮpͥ ͩ",
"author_id": 26479,
"author_profile": "https://Stackoverflow.com/users/26479",
"pm_score": -1,
"selected": false,
"text": "208.69.34.231"
},
{
"answer_id": 261926,
"author": "Adam Liss",
"author_id": 29157,
"author_profil... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261807",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34133/"
] |
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)
{
// Compare by value here...
}
}
</code></pre>
<p>To check that two IFoo references are equal by comparing their values: </p>
<pre><code>IFoo X = new Foo();
IFoo Y = new Foo();
if (X.Equals(Y))
{
// Do something
}
</code></pre>
<p>Is it possible to make <code>if (X == Y)</code> use the Equals method on Foo?</p>
| [
{
"answer_id": 261838,
"author": "Luc Touraille",
"author_id": 20984,
"author_profile": "https://Stackoverflow.com/users/20984",
"pm_score": 0,
"selected": false,
"text": "abstract class IFoo : IEquatable<IFoo> \n{\n public static bool operator ==(IFoo i1, IFoo i2) { return i1.Equals(... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261809",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11367/"
] |
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": 261840,
"author": "Fred",
"author_id": 33630,
"author_profile": "https://Stackoverflow.com/users/33630",
"pm_score": 0,
"selected": false,
"text": "BIGINT Integer data from -2^63 through 2^63 - 1\n\nINT Integer data from -2^31 through 2^31 - 1\n\nSMALLINT Integer... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261815",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/407003/"
] |
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><code>// File: app_defines.h
#define APP_A 0
#define APP_B 1
#define APP_C 2
</code></pre>
<p>My IDE build options then specify (for example)</p>
<pre><code>#define APPLICATION APP_B
</code></pre>
<p>... and in source code, I will have things like</p>
<pre><code>#include "app_defines.h"
#if APPLICATION >= APP_B
// extra features for APPB and APP_C
#endif
</code></pre>
<p>However, I shot myself in the foot this morning and wasted far to much time by simply omitting the line to #include "app_defines.h" from one file. Everything compiled fine, but the application crashed with AVs at startup.</p>
<p>I'd like to know what a better way of handling this would be. Previously, This would normally one of the few times when I'd consider #define could be used (in C++, anyway), but I still goofed up badly and the compiler didn't protect me. </p>
| [
{
"answer_id": 261893,
"author": "Pieter",
"author_id": 5822,
"author_profile": "https://Stackoverflow.com/users/5822",
"pm_score": 1,
"selected": false,
"text": "namespace AppA {\n // application A specific\n}\n\nnamespace AppB {\n // application B specific\n}\n"
},
{
"an... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261829",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1737/"
] |
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 you have to get some special dll that makes ID's friendly).</p>
| [
{
"answer_id": 261857,
"author": "kͩeͣmͮpͥ ͩ",
"author_id": 26479,
"author_profile": "https://Stackoverflow.com/users/26479",
"pm_score": 3,
"selected": false,
"text": "myControlId = \"<%= myControl.ClientID %>\";"
},
{
"answer_id": 261917,
"author": "ullmark",
"author_id... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261845",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39677/"
] |
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, remotely and had access to the web interface - the one found at <a href="http://127.0.0.1:8081/apex" rel="noreferrer">http://127.0.0.1:8081/apex</a> (Note: I changed the port of the web interface manually as we are running our Tomcat dev environment on 8080). </p>
<p>So, everything is going swimmingly, I create the image, wipe the machine and put the newly created image on there. Everything works except Oracle. After much digging, I update the tnsnames.ora file, add environment variables ORACLE_HOME and ORACLE_SID, so I can connect locally. <b>I still can't connect remotely and have completely lost access to the web interface. I've spent 2 days on google and I'm all out of ideas. Please HELP!</b></p>
| [
{
"answer_id": 263673,
"author": "Gary Myers",
"author_id": 25714,
"author_profile": "https://Stackoverflow.com/users/25714",
"pm_score": 2,
"selected": false,
"text": "SQLPLUS / AS SYSDBA"
},
{
"answer_id": 19714307,
"author": "perlyking",
"author_id": 1073262,
"auth... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261867",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34142/"
] |
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 of my SW/DB is Unicode</p>
<p>Also the data gets completely mangled, making recovery of what has been sent impossible :/</p>
<p>What would be the best way to deal with this?</p>
<p>I tried setting Request.ContentEncoding (before reading), but no avail.</p>
| [
{
"answer_id": 264658,
"author": "Georg",
"author_id": 30776,
"author_profile": "https://Stackoverflow.com/users/30776",
"pm_score": 1,
"selected": false,
"text": "<configuration>\n <system.web>\n <globalization\n fileEncoding=\"utf-8\"\n requestEncoding=\"utf-8\"\n re... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261873",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
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 anyone requests <strong>domain.com</strong> or <strong>www.domain.com</strong> they get served from <em>/webroot/domain.com/www/</em></p></li>
<li><p>Similarly, if anyone requests <strong>sub.domain.com</strong> they get served from <em>/webroot/domain.com/sub/</em></p></li>
<li><p>If people requests <strong>fake.domain.com</strong> (where <em>/webroot/domain.com/fake/</em> does not exist) I would like them served from <em>/webroot/domain.com/www/</em></p></li>
</ol>
<p>The third requirement isn't quite so important, I can deal with people requesting subdomains that don't exist being served from the server document root of <em>/webroot/server.com/www/</em> even if they requested <strong>fake.domain.com</strong></p>
<p>I've included the relevant parts of my lighttpd.conf file below:</p>
<pre><code>server.document-root = "/webroot/server.com/www/"
// regex to match sub.domain.com
$HTTP["host"] =~ "\b[a-zA-Z]\w*\.\b[a-zA-Z]\w*\.\b[a-zA-Z]\w*" {
evhost.path-pattern = "/webroot/%0/%3/"
}
// regex to match domain.com
$HTTP["host"] =~ "\b[a-zA-Z]\w*\.\b[a-zA-Z]\w*" {
evhost.path-pattern = "/webroot/%0/www/"
}
</code></pre>
<p>So where am I going wrong? At the moment, all requests to <strong>*.domain.com</strong> and <strong>domain.com</strong> are being served from <em>/webroot/domain.com/www/</em></p>
<p>I'd appreciate any help you guys could offer and if I've left anything relevant out please tell me!</p>
<p>Cheers,
Rob</p>
| [
{
"answer_id": 261940,
"author": "Anders",
"author_id": 25515,
"author_profile": "https://Stackoverflow.com/users/25515",
"pm_score": 1,
"selected": false,
"text": "^\\b([wW]{3}\\.)?[\\w\\d]*\\.com\\b$"
},
{
"answer_id": 261955,
"author": "Tomalak",
"author_id": 18771,
... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261904",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/135/"
] |
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": 261980,
"author": "splattne",
"author_id": 6461,
"author_profile": "https://Stackoverflow.com/users/6461",
"pm_score": 4,
"selected": false,
"text": "Session.Remove"
},
{
"answer_id": 262095,
"author": "Buu",
"author_id": 17815,
"author_profile": "https... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261920",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2469/"
] |
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 the row, it overrides previous row values, if given.</p>
<p>I'm attempting to work out a solution using analytical functions over the table, but it just isn't behaving...</p>
<p>I try:</p>
<pre><code>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 THE_TABLE order by row_priority)
where rownum = 1
</code></pre>
<p>or the inverse:</p>
<pre><code>select first_value(col1 ignore nulls) over () col1,
first_value(col2 ignore nulls) over () col2,
first_value(col3 ignore nulls) over () col3
from (select * from THE_TABLE order by row_priority desc)
where rownum = 1
</code></pre>
<p>And neither seem to ignore nulls. Any hints?</p>
| [
{
"answer_id": 261941,
"author": "Alan",
"author_id": 5878,
"author_profile": "https://Stackoverflow.com/users/5878",
"pm_score": -1,
"selected": false,
"text": "select first_value(coalesce(col1,0) ignore nulls) over () col1,\n first_value(coalesce(col2,0) ignore nulls) over () col... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261924",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18941/"
] |
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 it). Is it possible to make sure that it is running in 32 bit mode and that anything compiled against it uses said mode.</p>
<p>Are my options limited to stripping it, or are there start up optiosn that I do not know about.</p>
| [
{
"answer_id": 263200,
"author": "Dave Dribin",
"author_id": 26825,
"author_profile": "https://Stackoverflow.com/users/26825",
"pm_score": 3,
"selected": true,
"text": "arch(1)"
},
{
"answer_id": 726389,
"author": "Michael Cramer",
"author_id": 1496728,
"author_profil... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261927",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3431280/"
] |
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 this point are that the structure of the MXML nicely matches the visual hierarchy of the UI components and that the lines of code to initialize the UI are reduced. On the other hand real-world UIs are often dynamic, implemented as a simple static structure and then filled in dynamically based on runtime conditions (in which case UI updates are in ActionScript anyway). It would also be possible to reduce the <a href="http://en.wikipedia.org/wiki/Source_lines_of_code" rel="nofollow noreferrer">SLOC</a> needed for ActionScript with the creation of a few helper methods.</p>
| [
{
"answer_id": 522572,
"author": "Matt Guest",
"author_id": 62230,
"author_profile": "https://Stackoverflow.com/users/62230",
"pm_score": 4,
"selected": false,
"text": "<mx:Panel xmlns:mx=\"http://www.adobe.com/2006/mxml\" layout=\"absolute\" width=\"290\" height=\"148\" title=\"Login\">... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261938",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
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": 261986,
"author": "andreas buykx",
"author_id": 19863,
"author_profile": "https://Stackoverflow.com/users/19863",
"pm_score": 9,
"selected": true,
"text": "enum Foo {\n One,\n Two,\n Three,\n Last\n};\n\nfor ( int fooInt = One; fooInt != Last; fooInt++ )\n{\n Foo foo... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261963",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1366/"
] |
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 = "CancelRequest.aspx?RequestID=" + RequestID;
alert("About to open a window.\n\n" + cancelUrl);
window.open(cancelUrl);
alert("Window opened");
</code></pre>
<p>I expect to see a message telling me that I am about to open a window. I then expect to see a window open and get another message about the window having been opened. I don't really care about the order of the last two events; the alerts are there so I know the code has been executed.</p>
<p>I have two PCs and a virtual PC. All running IE7. On the Windows 2003 VPC, the messages and pop-up appear every time without fail.</p>
<p>On the Vista PC and WinXP PC, the messages appear but the pop-up only appears intermittently. (I think this may be the case on the Vista PC too).</p>
<p>All three have identical settings in IE. All have the IE pop-up blocker disabled and have no other pop-up blockers installed.</p>
<p>Can anyone shed any light on this?</p>
| [
{
"answer_id": 262005,
"author": "zendar",
"author_id": 25732,
"author_profile": "https://Stackoverflow.com/users/25732",
"pm_score": 0,
"selected": false,
"text": "window.open()"
}
] | 2008/11/04 | [
"https://Stackoverflow.com/questions/261978",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21862/"
] |
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 wish to take the call to the method TestFunction, and use as a string parameter in my function StepTwo(string, boolean), which would ideally end up in live HTML as shown...</p>
<pre><code><a href="#" onclick="StepTwo("TestFunction('123',false)",true)"></a>
</code></pre>
<p>notice how the TestFunction is a string here (it is executed within StepTwo using eval).</p>
<p>I have tried to format my JS as by :</p>
<pre><code>newDiv.innerHTML = "<a href=\"#\" onclick=\"StepTwo(\"TestFunction('"+id+"', false);\",true)\"></a>";
</code></pre>
<p>but while this appears to me correct in my IDE, in the rendered HTML, it as garbelled beyond belief.</p>
<p>Would appreciate if anyone could point me in the right direction. Thanks!</p>
| [
{
"answer_id": 261999,
"author": "Greg",
"author_id": 24181,
"author_profile": "https://Stackoverflow.com/users/24181",
"pm_score": 2,
"selected": false,
"text": """
},
{
"answer_id": 262010,
"author": "Gareth",
"author_id": 31582,
"author_profile": "https://Stac... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261985",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28871/"
] |
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>
<td>C</td>
...
</tr>
</table>
</code></pre>
<p>or (vertical display):</p>
<pre><code><table id="myTable">
<tr>
<td>A</td>
</tr>
<tr>
<td>B</td>
</tr>
<tr>
<td>C</td>
</tr>
...
</table>
</code></pre>
<p>This HTML code is generated by a JSF component (called <code><h:selectManyCheckboxes/></code>), and thus, I have no control on this HTML code.</p>
<p>However, I want to display my list of elements in 2 columns.
In others words, the HTML code of my table will be something like that:</p>
<pre><code><table id="myTable">
<tr>
<td>A</td>
<td>B</td>
</tr>
<tr>
<td>C</td>
<td>D</td>
</tr>
...
</table>
</code></pre>
<p>How can I do that using jQuery?</p>
<p>Thanks in advance for your help.</p>
<p>ps: If you need to know, the X are in fact an input and a label, i.e.:</p>
<pre><code><td><input .../><label .../></td>
</code></pre>
| [
{
"answer_id": 262083,
"author": "Prestaul",
"author_id": 5628,
"author_profile": "https://Stackoverflow.com/users/5628",
"pm_score": 1,
"selected": false,
"text": "$('#myTable tr').each(function() {\n $('<td/>').append( \n $(this).find('td input') \n ).appendTo(this);\n });\... | 2008/11/04 | [
"https://Stackoverflow.com/questions/261998",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26457/"
] |
262,000 | <p>What would be the best way to check that a <code>std::vector</code> is sorted? Is there something faster than a loop checking that <code>v[i]<=v[i+1]</code>? Is it faster/cleaner with iterators? Or is it actually better to just call <code>sort</code> every time (though the "v is already sorted" case is quite common)?</p>
<p>We can safely assume the vector only contains PODs, usually <code>float</code>s and sometimes <code>double</code>s and <code>int</code>s.</p>
<p>The size of the vector is non-trivial (usually a few thousands items) but not extreme (not gigabyte-sized).</p>
<ul>
<li>in some instances we'll sort the vector immediately afterwards, however there are other instances where we don't (it's an error case of our algorithm).</li>
<li>we already use a flag "IsSorted" whenever possible.</li>
</ul>
| [
{
"answer_id": 262088,
"author": "ShreevatsaR",
"author_id": 4958,
"author_profile": "https://Stackoverflow.com/users/4958",
"pm_score": 5,
"selected": false,
"text": "std::is_sorted"
},
{
"answer_id": 262105,
"author": "endian",
"author_id": 25462,
"author_profile": ... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262000",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20055/"
] |
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 was able to type:</p>
<pre><code>r<tab> - which would expand to <% %>
</code></pre>
<p>and</p>
<pre><code>re<tab> - which would expand to <%= %>
</code></pre>
<p>Can something similar be done in the Visual Studio 2008 IDE?</p>
| [
{
"answer_id": 262262,
"author": "plinth",
"author_id": 20481,
"author_profile": "https://Stackoverflow.com/users/20481",
"pm_score": 0,
"selected": false,
"text": "Imports System\nImports EnvDTE\nImports EnvDTE80\nImports EnvDTE90\nImports System.Diagnostics\n\nPublic Module Module1\n\n... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262012",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7961/"
] |
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 existing implementation.</p>
| [
{
"answer_id": 262064,
"author": "sblundy",
"author_id": 4893,
"author_profile": "https://Stackoverflow.com/users/4893",
"pm_score": 5,
"selected": true,
"text": "<echo file=\"${fileName}\" message=\"${xmlProperty}\"/>\n"
},
{
"answer_id": 9478786,
"author": "Jarekczek",
... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262015",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15647/"
] |
262,022 | <p>Is there a website I can create an HTML final four bracket?</p>
<p>Or is there just HTML out there that will create it automatically and I can just fill in the specifics?</p>
| [
{
"answer_id": 262584,
"author": "Brad",
"author_id": 26130,
"author_profile": "https://Stackoverflow.com/users/26130",
"pm_score": 3,
"selected": false,
"text": "table.bracket {\n border-collapse: collapse;\n border: none;\n}\n\n.bracket td {\n vertical-align: middle;\n widt... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262022",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26130/"
] |
262,024 | <p>Is it possible to obtain the maximum column length for a VARCHAR, CHAR etc?</p>
| [
{
"answer_id": 262060,
"author": "TcKs",
"author_id": 20382,
"author_profile": "https://Stackoverflow.com/users/20382",
"pm_score": 1,
"selected": false,
"text": "select max_length from sys.columns as c inner join sys.objects o on c.object_id = o.object_id where o.name = 'myTable' and c.... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262024",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
262,025 | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/176775/big-integers-in-c-sharp">Big integers in C#</a> </p>
</blockquote>
<p>I want to be able to process arbitrarily large numbers in C#.<br>
I can live with just integers. </p>
<p>Are there established algorithms for this kind of thing?<br>
Or is there a good 3rd-party library? </p>
<p>I might consider changing language if there really is no good way to do it in C#. </p>
<p>Thanks for any help / suggestions. </p>
| [
{
"answer_id": 262041,
"author": "kͩeͣmͮpͥ ͩ",
"author_id": 26479,
"author_profile": "https://Stackoverflow.com/users/26479",
"pm_score": 1,
"selected": false,
"text": "long"
}
] | 2008/11/04 | [
"https://Stackoverflow.com/questions/262025",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7211/"
] |
262,026 | <p>I have an application which get copied and run on client machines. The program is in the form of an Adobe Projector file. I want to write a process that checks when the program starts running whether or not the license is still active, and if not, delete the entire program. </p>
<p>The program itself knows the real date that it was installed, and since we install the program ourselves for the clients, we can ensure that at install time the date on the client's computer matches. Every time they start up the program, it compares the current date with the date they last ran the program. If today's date is after that date, it subtracts the number of elapsed dates from the number of days remaining. If the date is before the date it was last run, it penalizes the client by a constant number of days (this is to discourage the client from trying to reset the date on the computer and have their license never expire).</p>
<p>If they were to copy the entire directory over to a new machine, the installation date inside the program would not match the created date on any of the files in the directory, and it would treat this case like an expired license.</p>
<p>My question is this: is there a simple way to script this to run every time they start the application? We currently create a shortcut which could be pointed to a batch job, but what do you put in the batch job? Or is this approach for licensing completely wrong? People who buy this program will only buy time-limited licenses, and the program is run by copying and pasting a directory onto the target machine.</p>
| [
{
"answer_id": 262041,
"author": "kͩeͣmͮpͥ ͩ",
"author_id": 26479,
"author_profile": "https://Stackoverflow.com/users/26479",
"pm_score": 1,
"selected": false,
"text": "long"
}
] | 2008/11/04 | [
"https://Stackoverflow.com/questions/262026",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23249/"
] |
262,036 | <p>Just wondering where is best to put functionality in an MFC application that is triggered when the whole window is resized. I was thinking mainfrm but I couldn't seem to capture any OnSize messages... </p>
<p>Can someone tell me what I am doing wrong?</p>
| [
{
"answer_id": 262260,
"author": "Shog9",
"author_id": 811,
"author_profile": "https://Stackoverflow.com/users/811",
"pm_score": 3,
"selected": true,
"text": "WM_SIZE"
}
] | 2008/11/04 | [
"https://Stackoverflow.com/questions/262036",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18664/"
] |
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 a table with all Role.authorityLevel below my own. But this generates several tables.</p>
| [
{
"answer_id": 262057,
"author": "Biri",
"author_id": 968,
"author_profile": "https://Stackoverflow.com/users/968",
"pm_score": 1,
"selected": false,
"text": "create table #tmp (\n Name type,\n authorityLevel type\n)\n\nwhile @nrOfAuthlevels >= @myAuthLevel\nbegin\n set @myAuthLev... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262043",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
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 strings.</p>
| [
{
"answer_id": 278959,
"author": "Pulsehead",
"author_id": 2156,
"author_profile": "https://Stackoverflow.com/users/2156",
"pm_score": 0,
"selected": false,
"text": "select * from Products where Description like (@SearchedDescription + '%')"
},
{
"answer_id": 296817,
"author"... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262075",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26938/"
] |
262,090 | <p>Calling all PHP gurus!</p>
<p>I understand that you can use getimagesize() to get the actual pixel height and width of an image in PHP. However, if you open an image in photoshop and look at the image size dialog, you notice that there is a resolution value that determines the print size of the image.</p>
<p>Given an arbitrary jpg image file, I need to use PHP to determine this resolution number. It appears that this information is stored in the jpg file somewhere, so how do I get to it?</p>
<p>One other requirement - I only have gdlib available to me. I need to do this without the use of other php libraries (imagemagick, etc.)</p>
<p>Thanks for the help!</p>
| [
{
"answer_id": 262393,
"author": "Rafe",
"author_id": 27497,
"author_profile": "https://Stackoverflow.com/users/27497",
"pm_score": 2,
"selected": false,
"text": "<?php\n\ninclude_once(\"./JPEG.php\");\ninclude_once(\"./JFIF.php\");\n\n$image_header = get_jpeg_header_data(\"./myImage.jpg... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262090",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27497/"
] |
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": "9,223,372,036,854,775,807"
}
] | 2008/11/04 | [
"https://Stackoverflow.com/questions/262106",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24975/"
] |
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 be achieved?</p>
<p>Thanks!</p>
| [
{
"answer_id": 813815,
"author": "JJO",
"author_id": 99141,
"author_profile": "https://Stackoverflow.com/users/99141",
"pm_score": 2,
"selected": true,
"text": " private void messageInfoDataGridView_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)\n {\n /... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262108",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22996/"
] |
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.</p>
<p>Let me repeat that... instead of looping and adding to a temp collection, I just wanted to ask the Rows collection for what I needed. No looping, no temp variables, just give me what I want.</p>
<pre><code>var customerOrderIds = table.Rows.Cast<DataRow>()
.Where(x => (string)x["CUSTOMER_ID"] == customerId)
.Select(x => (string)x["CUSTOMER_ORDER_ID"])
.Distinct();
</code></pre>
<p><strong>My question is whether or not this is a good thing, or am getting carried away with LINQ?</strong> It does seem to me that this declarative style of pulling a subset of data out of a collection is a good thing and more readable in the end. But then again, maybe I'm just smitten :)</p>
| [
{
"answer_id": 262167,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 5,
"selected": true,
"text": "Field<>"
},
{
"answer_id": 1245464,
"author": "Community",
"author_id": -1,
"author_profile": "htt... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262110",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2595/"
] |
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="Search"
CssClass="bluebutton"
ImageUrl="../Graphics/bluebutton.gif" Width="110px"
onclick="Searchbutton_Click"/>
</code></pre>
| [
{
"answer_id": 262171,
"author": "leppie",
"author_id": 15541,
"author_profile": "https://Stackoverflow.com/users/15541",
"pm_score": 5,
"selected": true,
"text": "<button runat=\"server\" \n style=\"background-image:url('/Content/Img/stackoverflow-logo-250.png')\" >\n your text here<b... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262141",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
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 printed using <code>Window.print()</code>.</p>
<p>Cheers</p>
| [
{
"answer_id": 262199,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 3,
"selected": true,
"text": ".showwhenprinting {position:absolute; display:none;}\n@media print\n{\n .hidewhenprinting {position:absolute; display:none;}\n... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262143",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11802/"
] |
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><option>2</option>...
</select>
</code></pre>
<p>Is there something with "Intellisense"-like auto-complete?</p>
| [
{
"answer_id": 263654,
"author": "Kornel",
"author_id": 27009,
"author_profile": "https://Stackoverflow.com/users/27009",
"pm_score": 3,
"selected": false,
"text": "<input type=text list=listid>\n<datalist id=listid>\n <select><option>1<option>2</select>\n</datalist>\n"
},
{
"an... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262150",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6583/"
] |
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 *)imageByScalingProportionallyToSize:(CGSize)targetSize
{
CGSize imageSize = [self size];
float width = imageSize.width;
float height = imageSize.height;
// scaleFactor will be the fraction that we'll
// use to adjust the size. For example, if we shrink
// an image by half, scaleFactor will be 0.5. the
// scaledWidth and scaledHeight will be the original,
// multiplied by the scaleFactor.
//
// IMPORTANT: the "targetHeight" is the size of the space
// we're drawing into. The "scaledHeight" is the height that
// the image actually is drawn at, once we take into
// account the ideal of maintaining proportions
float scaleFactor = 0.0;
float scaledWidth = targetSize.width;
float scaledHeight = targetSize.height;
CGPoint thumbnailPoint = CGPointMake(0,0);
// since not all images are square, we want to scale
// proportionately. To do this, we find the longest
// edge and use that as a guide.
if ( CGSizeEqualToSize(imageSize, targetSize) == NO )
{
// use the longeset edge as a guide. if the
// image is wider than tall, we'll figure out
// the scale factor by dividing it by the
// intended width. Otherwise, we'll use the
// height.
float widthFactor = targetSize.width / width;
float heightFactor = targetSize.height / height;
if ( widthFactor < heightFactor )
scaleFactor = widthFactor;
else
scaleFactor = heightFactor;
// ex: 500 * 0.5 = 250 (newWidth)
scaledWidth = width * scaleFactor;
scaledHeight = height * scaleFactor;
// center the thumbnail in the frame. if
// wider than tall, we need to adjust the
// vertical drawing point (y axis)
if ( widthFactor < heightFactor )
thumbnailPoint.y = (targetSize.height - scaledHeight) * 0.5;
else if ( widthFactor > heightFactor )
thumbnailPoint.x = (targetSize.width - scaledWidth) * 0.5;
}
CGContextRef mainViewContentContext;
CGColorSpaceRef colorSpace;
colorSpace = CGColorSpaceCreateDeviceRGB();
// create a bitmap graphics context the size of the image
mainViewContentContext = CGBitmapContextCreate (NULL, targetSize.width, targetSize.height, 8, 0, colorSpace, kCGImageAlphaPremultipliedLast);
// free the rgb colorspace
CGColorSpaceRelease(colorSpace);
if (mainViewContentContext==NULL)
return NULL;
//CGContextSetFillColorWithColor(mainViewContentContext, [[UIColor whiteColor] CGColor]);
//CGContextFillRect(mainViewContentContext, CGRectMake(0, 0, targetSize.width, targetSize.height));
CGContextDrawImage(mainViewContentContext, CGRectMake(thumbnailPoint.x, thumbnailPoint.y, scaledWidth, scaledHeight), self.CGImage);
// Create CGImageRef of the main view bitmap content, and then
// release that bitmap context
CGImageRef mainViewContentBitmapContext = CGBitmapContextCreateImage(mainViewContentContext);
CGContextRelease(mainViewContentContext);
CGImageRef maskImage = [[UIImage imageNamed:@"Mask.png"] CGImage];
CGImageRef resizedImage = CGImageCreateWithMask(mainViewContentBitmapContext, maskImage);
CGImageRelease(mainViewContentBitmapContext);
// convert the finished resized image to a UIImage
UIImage *theImage = [UIImage imageWithCGImage:resizedImage];
// image is retained by the property setting above, so we can
// release the original
CGImageRelease(resizedImage);
// return the image
return theImage;
}
</code></pre>
| [
{
"answer_id": 262545,
"author": "Lounges",
"author_id": 8918,
"author_profile": "https://Stackoverflow.com/users/8918",
"pm_score": 0,
"selected": false,
"text": "- (void)drawRect:(CGRect)rect \n{\n // Drawing code\n [backgroundImage drawInRect:rect];\n [buttonOverlay drawInRec... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262156",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23028/"
] |
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 fix this (remove this transparency in Safari)?</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code><html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<style type="text/css">
input:disabled{
border:solid 1px #880000;
background-color:#ffffff;
color:#880000;
}
</style>
</head>
<body>
<form action="">
<input type="text" value="disabled input box" disabled="disabled"/>
</form>
</body>
</html></code></pre>
</div>
</div>
</p>
| [
{
"answer_id": 262478,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n<head>\n <title></title>\n <style type=\"text/css\">\n button:disabled... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262158",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34187/"
] |
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>
</code></pre>
<p>with CSS that turns the above into a horizontal menu, and JS that turns the [spans] into buttons that bring up contextual menus. Vaguely like this:</p>
<pre>
Item1^ Item2^ Item3^
</pre>
<p>If the menu gets too wide for the browser width, it wraps, which is what I want. The problem is that sometimes it's putting in line-breaks before the [spans]. I only want it to break between [li]s. Any ideas?</p>
| [
{
"answer_id": 262193,
"author": "Huibert Gill",
"author_id": 1254442,
"author_profile": "https://Stackoverflow.com/users/1254442",
"pm_score": 5,
"selected": true,
"text": "white-space: nowrap;\n"
},
{
"answer_id": 262209,
"author": "patmortech",
"author_id": 19090,
... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262160",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24197/"
] |
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 too. I found some ways to do the batch publishing from CS3 using JSFL, but was surprised to discover CS3 doesn't apparently have any command-line functionality for this?</p>
<p>This is on a Linux system for what it's worth, I don't have experience with JSFL to know if you can run scripts from the command line somehow?</p>
<p><strong>note</strong>: I should have said "Linux is preferred"... I don't use Linux but our server/build PC is Linux... I didn't realise CS3 was not compatible so I guess we can do this part on Windows.</p>
| [
{
"answer_id": 488306,
"author": "D. Starr",
"author_id": 1144394,
"author_profile": "https://Stackoverflow.com/users/1144394",
"pm_score": 3,
"selected": false,
"text": "\"c:\\program files\\macromedia\\flash 8\\flash.exe\" myscript.jsfl"
}
] | 2008/11/04 | [
"https://Stackoverflow.com/questions/262192",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13220/"
] |
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" ) );
assert( false==isRepresentable( "0.1" ) );
</code></pre>
| [
{
"answer_id": 262236,
"author": "Richard Poole",
"author_id": 26003,
"author_profile": "https://Stackoverflow.com/users/26003",
"pm_score": 0,
"selected": false,
"text": "bool isRepresentable(const char *realNumber)\n{\n double value = strtod(realNumber, NULL);\n\n char test[20];\... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262201",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15485/"
] |
262,211 | <p>GNU gcc 4.3 partially supports the upcoming c++0x standard: among the implemented features the rvalue reference. By means of the rvalue reference it should be possible to move a non-copyable object or return it from a function. </p>
<p>Are std::streams already movable <strong>by means of rvalue reference</strong> or does the current library implementation lack something?</p>
| [
{
"answer_id": 263435,
"author": "Nicola Bonelli",
"author_id": 19630,
"author_profile": "https://Stackoverflow.com/users/19630",
"pm_score": 1,
"selected": false,
"text": "struct noncopyable\n{\n noncopyable()\n {}\n\n // move constructor\n noncopyable(noncopyable &&)\n {... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262211",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19630/"
] |
262,215 | <p>I have read about a technique involving writing to disk a rendered dynamic page and using that when it exists using mod_rewrite. I was thinking about cleaning out the cached version every X minutes using a cron job.</p>
<p>I was wondering if this was a viable option or if there were better alternatives that I am not aware of.</p>
<p>(Note that I'm on a shared machine and mod_cache is not an option.)</p>
| [
{
"answer_id": 262345,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 1,
"selected": false,
"text": "php index.php > (location of static file)"
}
] | 2008/11/04 | [
"https://Stackoverflow.com/questions/262215",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32141/"
] |
262,217 | <p>How would you design a content voting mechanism that could be applied polymorphically to multiple models / classes. (in a ruby on rails context preferably, but others are fine)</p>
<p>Given that instances of these classes can be voted on:
- Article
- Question
- Product</p>
<p>Voters should not be required to register.</p>
<p>Best effort should be made to limit voters to one vote per object. (1 vote for a particular article and one vote for a particular question, etc.). I.e. use ip detection, cookies, etc.</p>
| [
{
"answer_id": 268857,
"author": "Ian Terrell",
"author_id": 9269,
"author_profile": "https://Stackoverflow.com/users/9269",
"pm_score": 1,
"selected": false,
"text": "create_table :orders do |t|\n t.string :votable_type\n t.integer :votable_id\n t.integer :vote\n t.timestamps\nend\n... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262217",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34210/"
] |
262,232 | <p>I am trying to come up with the best data structure for use in a high throughput C++ server. The data structure will be used to store anything from a few to several million objects, and no sorting is required (though a unique sort key can be provided very cheaply).</p>
<p>The requirements are that it can support efficient insert, ideally O(1), moderately efficient removal, and efficient traversal. It doesn't need to support a find operation (other than might be needed for removal).</p>
<p>The twist is that it must be thread safe with respect to modifications while other threads are enumerating the data structure. This means that a simple red-black tree doesn't work, since one thread can't insert an element (and perform the necessary tree rotations) without messing up any cursors held by other threads.</p>
<p>It is <strong>not</strong> acceptable to use a read/write lock and defer the write operations until all readers have finished, since read operations may be long lived. It doesn't matter if inserts that happen while there is a reader are visible to that reader or not.</p>
<p>Memory footprint is also very important, and small is obviously better!</p>
<p>What suggestions are there?</p>
<p><strong>Response to comments:</strong></p>
<p>Thanks for the answers.</p>
<p>No, inserts cannot invalidate existing iterators. Iterators may or may not see the new insert, but they must see everything that they would have seen if the insert hadn't occurred.</p>
<p>Deletion is required, however due to higher level rules I can guarantee that a iterator will never be stopped on an item that is available for deletion.</p>
<p>Locking per node for a cursor would have too great an impact on performance. There may be a number of threads reading at once, and any kind of memory hot spot that multiple threads are using in a lock kills memory bandwidth (as we discovered the hard way!). Even a simple count of readers with multiple threads calling InterlockedIncrement fails to scale cleanly. </p>
<p>I agree a linked list is likely the best approach. Deletes are rare, so paying the memory penalty for the back pointers to support O(1) delete is costly and we may compute those separately on demand and since deletes tend to be batch operations.</p>
<p>Fortunately insertion into a linked list doesn't require any locking for readers, as long as the pointers are updated in the inserted node before the head pointer is changed.</p>
<p>The lock-copy-unlock idea is interesting. The amount of data involved is too large for this to work as the default for readers, but it could be used for writers when they collide with readers. A read/write lock would protect the whole structure, and the write would clone the data structure if it collides with a reader. Writes are much rarer than reads.</p>
| [
{
"answer_id": 262564,
"author": "coppro",
"author_id": 16855,
"author_profile": "https://Stackoverflow.com/users/16855",
"pm_score": 3,
"selected": false,
"text": "std::list"
},
{
"answer_id": 1678486,
"author": "Kiril",
"author_id": 28760,
"author_profile": "https:/... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262232",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3631/"
] |
262,238 | <p>I have a <code>contacts</code> table which contains fields such as <code>postcode</code>, <code>first name</code>, <code>last name</code>, <code>town</code>, <code>country</code>, <code>phone number</code> etc, all of which are defined as <code>VARCHAR(255)</code> even though none of these fields will ever come close to having 255 characters. (If you're wondering, it's this way because Ruby on Rails migrations map String fields to <code>VARCHAR(255)</code> by default and I never bothered to override it). </p>
<p>Since VARCHAR will only store the number of actual characters of the field (along with the field length), is there any distinct advantage (performance or otherwise) to using, say, <code>VARCHAR(16)</code> over <code>VARCHAR(255)</code>? </p>
<p>Additionally, most of these fields have indexes on them. Does a larger VARCHAR size on the field affect the size or performance of the index at all? </p>
<p>FYI I'm using MySQL 5.</p>
| [
{
"answer_id": 262476,
"author": "Bill Karwin",
"author_id": 20860,
"author_profile": "https://Stackoverflow.com/users/20860",
"pm_score": 8,
"selected": true,
"text": "VARCHAR(255)"
}
] | 2008/11/04 | [
"https://Stackoverflow.com/questions/262238",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1174/"
] |
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!). When my wxPython application tries to append that string to a text box I get a <code>UnicodeDecodeError</code>.</p>
<p>My first attempt to fix the issue simply caught that error (because the app apparently does send <em>some</em> bad messages. The problem is that the app also uses the character to report various temperatures around the unit and that's something we really need to log. Changing the source app is out of my control, so how can I detect and decode those symbols into something the <code>wxTextCtrl</code> can display?</p>
| [
{
"answer_id": 262433,
"author": "pdc",
"author_id": 8925,
"author_profile": "https://Stackoverflow.com/users/8925",
"pm_score": 1,
"selected": false,
"text": "'123\\xB0'"
},
{
"answer_id": 263330,
"author": "Toni Ruža",
"author_id": 6267,
"author_profile": "https://S... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262249",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15369/"
] |
262,254 | <p>How can I use CRTP in C++ to avoid the overhead of virtual member functions?</p>
| [
{
"answer_id": 262276,
"author": "user23167",
"author_id": 23167,
"author_profile": "https://Stackoverflow.com/users/23167",
"pm_score": -1,
"selected": false,
"text": "template <class Derived> struct Base\n{\n void interface()\n {\n // ...\n static_cast<Derived*>(thi... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262254",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
262,264 | <p>I have a list of cities, states/provinces, and countries and I need to find their respective timezones easily. Specifically, I need to know which Windows TimeZone they map to. So far this has been a difficult process, because there's no easy way to pass a city to something and get a timezone back (a timezone being an offset and whether or not the timezone supports Daylight Savings Time). </p>
<p>The current flow is to use <a href="http://www.batchgeocode.com" rel="noreferrer">http://www.batchgeocode.com</a> to get the latitude/longitude of the city (which really calls a Yahoo service) and then call <a href="http://www.EarthTools.org" rel="noreferrer">http://www.EarthTools.org</a> to get a timezone letter, which maps to an offset. The problem is the yahoo service will sometimes return a bad longitude/latitude, and earthtools.org doesn't know a lot about DST info so mapping to the correct TimeZone Id is a tedious manual process.</p>
<p>I can't be the first person who has done this- does anybody know of a better way, or some list out there which has the info I need?</p>
<p>Thanks.</p>
| [
{
"answer_id": 40160417,
"author": "Anestis Kivranoglou",
"author_id": 850980,
"author_profile": "https://Stackoverflow.com/users/850980",
"pm_score": 2,
"selected": false,
"text": "CountryName\n2LetterIsoCountryCode\n3LetterIsoCountryCode\nIANATimezones\nWindowsTimezones\n"
}
] | 2008/11/04 | [
"https://Stackoverflow.com/questions/262264",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30881/"
] |
262,267 | <p>How do I create a toolbar for Excel using an XLA document?</p>
| [
{
"answer_id": 262319,
"author": "BradC",
"author_id": 21398,
"author_profile": "https://Stackoverflow.com/users/21398",
"pm_score": 3,
"selected": true,
"text": "Dim myBar As CommandBar, myButt As CommandBarControl \n\n'Delete the toolbar if it already exists'\nOn Error Resume Next \nCo... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262267",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16794/"
] |
262,273 | <p>In the iPhone is there a way I can use JavaScript to close the browser and return to the home screen? After the last page a wizard I am calling out to another iPhone app (ex: maps) and I do NOT what the user to come back to the browser screen when they are done. My backup plan is to have a "Complete" page but that is not the best experience for the client.</p>
| [
{
"answer_id": 262356,
"author": "Anders",
"author_id": 25515,
"author_profile": "https://Stackoverflow.com/users/25515",
"pm_score": 0,
"selected": false,
"text": "javascript:self.close();\nwindow.close();\n"
},
{
"answer_id": 262374,
"author": "sblundy",
"author_id": 48... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262273",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30099/"
] |
262,279 | <p>Model Driven Software Development.</p>
<p>As I understand it it raises the abstraction level of the design to better reflect the domain the software will attempt to run in. That's alot to say in just one sentence.</p>
<p>The communication between the domain experts (customer) and the developers is crucial to make this methodology work. What I want to know is if there is a tool suite or set of best practices that will help in the initial thrust of MDSD? Once the domain is fleshed out what about mapping that model to an ORM (or whatever)? </p>
<p>I am just diving into the realm of MDSD and DSL so any constructive ideas or comments will be appriciated.</p>
| [
{
"answer_id": 320332,
"author": "jbandi",
"author_id": 32749,
"author_profile": "https://Stackoverflow.com/users/32749",
"pm_score": 1,
"selected": false,
"text": "class Firm < ActiveRecord::Base\n has_many :clients\n has_one :account\n belongs_to :conglomorate\nend\n"
}
] | 2008/11/04 | [
"https://Stackoverflow.com/questions/262279",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2894/"
] |
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": "Process[] pname = Process.GetProcessesByName(\"notepad\");\nif (pname.Length == 0)\n MessageBox.Show(\"nothing\... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262280",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30717/"
] |
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 which allows them to form a network, without interfering with other existing networks of the same kind of objects.</p>
<p>All objects get instantiated at roughly the same time, and have access to the (common) system time.</p>
<p>Approaches I've thought of:</p>
<ol>
<li><p>Time-of-instantiation based. Channel is derived (by md5) from the unix time. Problem is the "<strong>roughly</strong> the same time" part. They may get instantiated right on the cusp of a new second.</p></li>
<li><p>Random wait. Make objects wait a random amount, and announce a (randomly generated) channel number decided upon by the first one to wake. Problem is, the system has a low time granularity, and more than one object can wake before the announcement was processed.</p></li>
<li><p>Combine 1 and 2. Announce a high-res timestamp after waiting a random amount, and derive channel from the lowest announced timestamp.</p></li>
</ol>
<p>This has to be something smarter people than me have thought about. Any better way of doing this?</p>
| [
{
"answer_id": 671632,
"author": "Domchi",
"author_id": 29192,
"author_profile": "https://Stackoverflow.com/users/29192",
"pm_score": 1,
"selected": false,
"text": "integer time = llGetUnixTime();\ninteger channel = time - (time % 1000);\n"
},
{
"answer_id": 1029730,
"author"... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262330",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
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 putting a RETURNS INTEGER in but the sproc won't compile.</p>
| [
{
"answer_id": 262370,
"author": "Justin Cave",
"author_id": 10397,
"author_profile": "https://Stackoverflow.com/users/10397",
"pm_score": 4,
"selected": false,
"text": "CREATE OR REPLACE PROCEDURE test_proc (\n p_iKey IN VARCHAR2,\n p_retVal OUT INTEGER\n)\nAS\nBEGIN\n DELETE FROM... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262338",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21180/"
] |
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 question</a>, I cannot extend ADO.NET Entity Framework objects with partial classes and use my custom methods in LINQ queries.</p>
<p><a href="http://img221.imageshack.us/img221/7329/clientsq0.gif" rel="nofollow noreferrer">ADO.NET Entity Framework partial class http://img221.imageshack.us/img221/7329/clientsq0.gif</a></p>
<p>I don't want methods showing up in the Intellisense that are going to create run-time errors! How should I architect my application to avoid this problem?</p>
<p><a href="http://img83.imageshack.us/img83/1580/iswashingtongn0.gif" rel="nofollow noreferrer">VB.NET LINQ with custom method http://img83.imageshack.us/img83/1580/iswashingtongn0.gif</a></p>
<p>Do I need a data access Client class and also a business logic Client class? It seems like that will get confusing.</p>
| [
{
"answer_id": 262375,
"author": "CubanX",
"author_id": 27555,
"author_profile": "https://Stackoverflow.com/users/27555",
"pm_score": 2,
"selected": false,
"text": "public class Location\n{\n public string City { get; set; }\n public string State { get; set; }\n}\n"
}
] | 2008/11/04 | [
"https://Stackoverflow.com/questions/262339",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/83/"
] |
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 spreadsheet without being able to save it to the web server's hard disk. This is the part I cannot figure out how to do. Here's a simple code example.</p>
<pre><code><%--ASP.NET Declarative--%>
<asp:FileUpload ID="FileUpload1" runat="server" />
<asp:Button ID="Button1" runat="server" Text="Send File" OnClick="Button1_Click" />
// C# Code-Behind
protected void Button1_Click(object sender, EventArgs e) {
var postedFile = FileUpload1.PostedFile;
// ... Read file in memory and put in format to send to stored procedure ...
}
</code></pre>
<p>Can anyone help me with this? I appreciate anyone's consideration.</p>
<p>thx,<br />
gabe</p>
| [
{
"answer_id": 262646,
"author": "hearn",
"author_id": 30096,
"author_profile": "https://Stackoverflow.com/users/30096",
"pm_score": 0,
"selected": false,
"text": "Workbook.Load(stream)"
},
{
"answer_id": 269515,
"author": "gabe",
"author_id": 34315,
"author_profile":... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262341",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
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 <strong>seg</strong> element, with an id of "A12", how can I do this? I've tried looping through the <strong>seg</strong> elements and <em>unset</em>ting the specific one, but this doesn't work, the elements remain.</p>
<pre><code>foreach($doc->seg as $seg)
{
if($seg['id'] == 'A12')
{
unset($seg);
}
}
</code></pre>
| [
{
"answer_id": 262556,
"author": "Stefan Gehrig",
"author_id": 11354,
"author_profile": "https://Stackoverflow.com/users/11354",
"pm_score": 7,
"selected": true,
"text": "SimpleXMLElement"
},
{
"answer_id": 345872,
"author": "Community",
"author_id": -1,
"author_profi... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262351",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33739/"
] |
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.</p>
<p>If I were to put this entry into 1 row, it would easily equal out to some 30+ columns (minimum), e.g.
item_1_name (ref)
item_1_weight
item_1_volume
item_2_name... etc...</p>
<p>And I can't simply turn these columns into referential tables as each property can essentially range from 1 to 400+.</p>
<p>I also figured that if a user only decides to put 1 item into their entry, the method of which I create the object for that data will be static as with LINQ I'd have to check whether the properties and whatnot are NULL and work accordingly. Also, if I ever wanted to increase the number of items allowed in an entry, it'd be a headache to work with.</p>
<p>The other option I've thought of is simply creating a row for each item and tying it with an entry id. So I'd essentially never have null entries, but my table would grow astronomically deep but not very wide, as there would only be some 5 odd columns.</p>
<p>Is there something I'm overlooking in my design/is there a much better and efficient way of doing this?</p>
<p>EDIT: When I say that it will grow astronomically, I mean it in this sense: A user can create an entry, and each entry will most likely have a group of items. So say they make 1 entry a day to the site, they could have 3 groups of items, with the max number of items (10), which would equate to 30 items for that sole entry. Make an entry everyday for a week at that rate and you could have 210 rows for that single user.</p>
| [
{
"answer_id": 262412,
"author": "Bill Karwin",
"author_id": 20860,
"author_profile": "https://Stackoverflow.com/users/20860",
"pm_score": 3,
"selected": true,
"text": "CREATE TABLE Items (\n user_id INTEGER NOT NULL,\n item_id INTEGER NOT NULL DEFAULT 1,\n ... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262361",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30816/"
] |
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 resolved correctly, as stated in my executable jar's manifest file.
However, once the framework launches, no plugins (not even the one specifying my platform) are found.</p>
<p>Launching the application from the terminal via</p>
<pre>
java -jar myjar.jar
</pre>
<p>works like a charm, ad does running the application by double-clicking a shell-script.</p>
<p>However, I'd like to avoid a terminal window. (I'm a Windows person, maybe it won't annoy linux people as it does annoy those on windows.)</p>
<p>The problem is reproducible across several Linux systems.
Is there something I need to do so Java resolves the libraries correctly?</p>
| [
{
"answer_id": 262600,
"author": "shyam",
"author_id": 7616,
"author_profile": "https://Stackoverflow.com/users/7616",
"pm_score": 0,
"selected": false,
"text": "Class-Path"
}
] | 2008/11/04 | [
"https://Stackoverflow.com/questions/262362",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25141/"
] |
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 html printed to the page where the result of the call should have been instead.</p>
<p>How do I tell jQuery to redirect if an exception was thrown instead of printing to the page?</p>
<p>An example of the offending Ajax:</p>
<pre><code>$.post("SendStatusEmail.action",
{status: newstatus, id : id },
function(data) {
column.text(data);
column.addClass("redfont");
column.parent().fadeOut(3000, function(){column.parent().remove()});
</code></pre>
| [
{
"answer_id": 262449,
"author": "Craig Stuntz",
"author_id": 7714,
"author_profile": "https://Stackoverflow.com/users/7714",
"pm_score": 3,
"selected": true,
"text": "$(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/"
] |
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" />
<entry key="some_key_2" value="some value" />
</util:map>
</code></pre>
<p>In java class, the implementation looks like:</p>
<pre><code>private Map<String, String> someMap = new HashMap<String, String>();
someMap = (HashMap<String, String>)getApplicationContext().getBean("someMap");
</code></pre>
<p>In Eclipse, I see a warning that says:</p>
<p><strong>Type safety: Unchecked cast from Object to HashMap<String,String></strong></p>
<p>What went wrong?</p>
| [
{
"answer_id": 262416,
"author": "MetroidFan2002",
"author_id": 8026,
"author_profile": "https://Stackoverflow.com/users/8026",
"pm_score": 9,
"selected": true,
"text": "HashMap"
},
{
"answer_id": 262417,
"author": "David M. Karr",
"author_id": 10508,
"author_profile"... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262367",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37740/"
] |
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": "HashMap"
},
{
"answer_id": 262417,
"author": "David M. Karr",
"author_id": 10508,
"author_profile"... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262376",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
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 that a char* may refer to an alias of any object.</p>
</blockquote>
<p>Ok so in the context of socket code, I can do this:</p>
<pre><code>struct SocketMsg
{
int a;
int b;
};
int main(int argc, char** argv)
{
// Some code...
SocketMsg msgToSend;
msgToSend.a = 0;
msgToSend.b = 1;
send(socket, (char*)(&msgToSend), sizeof(msgToSend);
};
</code></pre>
<p>But then there's this statement</p>
<blockquote>
<p>The converse is not true. Casting a char* to a pointer of any type other than a char* and dereferencing it is usually in violation of the strict aliasing rule. </p>
</blockquote>
<p>Does this mean that when I recv a char array, I can't reinterpret cast to a struct when I know the structure of the message:</p>
<pre><code>struct SocketMsgToRecv
{
int a;
int b;
};
int main()
{
SocketMsgToRecv* pointerToMsg;
char msgBuff[100];
...
recv(socket, msgBuff, 100);
// Ommiting make sure we have a complete message from the stream
// but lets assume msgBuff[0] has a complete msg, and lets interpret the msg
// SAFE!?!?!?
pointerToMsg = &msgBuff[0];
printf("Got Msg: a: %i, b: %i", pointerToMsg->a, pointerToMsg->b);
}
</code></pre>
<p>Will this second example not work because the base type is a char array and I'm casting it to a struct? How do you handle this situation in a strictly aliased world?</p>
| [
{
"answer_id": 262401,
"author": "Adam Rosenfield",
"author_id": 9530,
"author_profile": "https://Stackoverflow.com/users/9530",
"pm_score": 2,
"selected": false,
"text": "-fstrict-aliasing"
}
] | 2008/11/04 | [
"https://Stackoverflow.com/questions/262379",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8123/"
] |
262,380 | <p>How to make a shadow to main window widget on windows using Qt?</p>
| [
{
"answer_id": 262401,
"author": "Adam Rosenfield",
"author_id": 9530,
"author_profile": "https://Stackoverflow.com/users/9530",
"pm_score": 2,
"selected": false,
"text": "-fstrict-aliasing"
}
] | 2008/11/04 | [
"https://Stackoverflow.com/questions/262380",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
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": 294462,
"author": "Ran",
"author_id": 10272,
"author_profile": "https://Stackoverflow.com/users/10272",
"pm_score": 2,
"selected": true,
"text": "39: /**\n40: * Checks that cond is true. Use this method to validate that condition\n41: * cond holds.\n42: * If con... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262392",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10272/"
] |
262,425 | <p>In short - How do I translate a NETBIOS domain to a FQDN ?</p>
<p>Details:
Assuming I'm in domain A and I have user credentials for domain B which has a trust relationship with domain A (I can authenticate the credentials).
How do I get domain B's FQDN when all I have are the credentials of some authenticated user from that domain, including the netbios domain name?</p>
<p>I'm coding in C# but a COM/WMI/Win32 solution would be welcomed as well.</p>
| [
{
"answer_id": 2005257,
"author": "Per",
"author_id": 170150,
"author_profile": "https://Stackoverflow.com/users/170150",
"pm_score": 1,
"selected": false,
"text": "DirectoryEntry rootDSE = new DirectoryEntry(\"LDAP://10.11.12.13/rootDSE\", @\"DOMAIN\\Username\", \"Password\");\nConsole.... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262425",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11519/"
] |
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'].map(parseInt)
</code></pre>
<p>yield this:</p>
<pre><code>[1, NaN, NaN]
</code></pre>
<p>I have tested in Firefox 3.0.1 and Chrome 0.3 and just as a disclaimer, I know this is not cross-browser functionality (no IE).</p>
<p>I found out that the following will accomplish the desired effect. However, it still doesn’t explain the errant behavior of <code>parseInt</code>.</p>
<pre><code>['1','2','3'].map(function(i){return +i;}) // returns [1,2,3]
</code></pre>
| [
{
"answer_id": 262468,
"author": "Peter Bailey",
"author_id": 8815,
"author_profile": "https://Stackoverflow.com/users/8815",
"pm_score": 4,
"selected": false,
"text": "// Works fine\nparseInt( 4 );\nparseInt( 9 );\n\n// Breaks! Why?\n[1,4,9].map( parseInt );\n\n// Fixes the problem\... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262427",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/208/"
] |
262,431 | <p>What are the best algorithms for sorting data in C#? </p>
<p>Is there one sorting algorithm that can handle 80% of sorts well? </p>
<p>Please give code examples if applicable.</p>
| [
{
"answer_id": 262464,
"author": "CubanX",
"author_id": 27555,
"author_profile": "https://Stackoverflow.com/users/27555",
"pm_score": 7,
"selected": true,
"text": ".Sort"
},
{
"answer_id": 262604,
"author": "Keltex",
"author_id": 28260,
"author_profile": "https://Stac... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262431",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19020/"
] |
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": 262481,
"author": "Alex B",
"author_id": 23643,
"author_profile": "https://Stackoverflow.com/users/23643",
"pm_score": 6,
"selected": false,
"text": "glibc"
},
{
"answer_id": 262609,
"author": "Raymond Martineau",
"author_id": 33952,
"author_profile": "... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262439",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
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
Location http://localhost/games/edit-game.html?game=110&frame_to_edit=3#input-top
Content-Length 0</pre>
<p>This works fine for most browsers. Enter IEMobile (via Windows Mobile 6.1). Upon receiving this response, IEMobile heads to</p>
<pre>http://localhost/games/edit-game.html?game=110&frame_to_edit=3</pre>
<p>Note the missing <code>#input-top</code>. What can I do?</p>
| [
{
"answer_id": 262481,
"author": "Alex B",
"author_id": 23643,
"author_profile": "https://Stackoverflow.com/users/23643",
"pm_score": 6,
"selected": false,
"text": "glibc"
},
{
"answer_id": 262609,
"author": "Raymond Martineau",
"author_id": 33952,
"author_profile": "... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262443",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/96/"
] |
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>Regex?</p>
| [
{
"answer_id": 262466,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 9,
"selected": true,
"text": "string CleanPhone(string phone)\n{\n Regex digitsOnly = new Regex(@\"[^\\d]\"); \n return digitsOnly.Replace(ph... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262448",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/232/"
] |
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 table1 INNER JOIN table2 ...</code></p>
<p>We have a problem if 2 fields have the same name in table1 and table2.</p>
<p>Is this only the reason why using '*' in a view is bad?</p>
<p>With '*', you may use the view in a different context because the information is there.</p>
<p>What am I missing ?</p>
<p>Regards</p>
| [
{
"answer_id": 262484,
"author": "Amy B",
"author_id": 8155,
"author_profile": "https://Stackoverflow.com/users/8155",
"pm_score": 2,
"selected": false,
"text": "Select * From dbname..tablename\n"
},
{
"answer_id": 262509,
"author": "Bill Karwin",
"author_id": 20860,
... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262450",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14673/"
] |
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 by default. I don't want to send the email directly, as I want the user to have the opportunity to write the email body using their preferred client. Thus, I really want to accomplish exactly what Windows Explorer does when I right click a file and select Send To -> Mail Recipient.</p>
<p>I'm looking for a C++ solution.</p>
| [
{
"answer_id": 264725,
"author": "Jeff Hillman",
"author_id": 3950,
"author_profile": "https://Stackoverflow.com/users/3950",
"pm_score": 4,
"selected": true,
"text": "#include <tchar.h>\n#include <windows.h>\n#include <mapi.h>\n#include <mapix.h>\n\nint _tmain( int argc, wchar_t *argv[]... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262451",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8424/"
] |
262,460 | <p>Is there any way to make a function (the ones I'm thinking of are in the style of the simple ones I've made which generate the fibonnacci sequence from 0 to a point, and all the primes between two points) run indefinitely. E.g. until I press a certain key or until a time has passed, rather than until a number reaches a certain point? </p>
<p>Also, if it is based on time then is there any way I could just extend the time and start it going from that point again, rather than having to start again from 0? I am aware there is a time module, i just don't know much about it.</p>
| [
{
"answer_id": 262474,
"author": "Davide",
"author_id": 25891,
"author_profile": "https://Stackoverflow.com/users/25891",
"pm_score": 1,
"selected": false,
"text": "while True:\n # check what you want and eventually break\n print nextValue()\n"
},
{
"answer_id": 262520,
"au... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262460",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33061/"
] |
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 compiler thinks any naked reference to 'MyType' means 'A.B.MyType'.</p>
<p>I know I could just rename the class or use an alias, but I'm wondering how this is even possible.</p>
<p>Any ideas?</p>
<p>Thanks!</p>
| [
{
"answer_id": 262532,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 3,
"selected": false,
"text": "A.B"
},
{
"answer_id": 262813,
"author": "Pop Catalin",
"author_id": 4685,
"author_profile": "https:... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262469",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7529/"
] |
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": 262501,
"author": "tvanfosson",
"author_id": 12950,
"author_profile": "https://Stackoverflow.com/users/12950",
"pm_score": 3,
"selected": false,
"text": "text"
},
{
"answer_id": 262585,
"author": "Keith",
"author_id": 905,
"author_profile": "https://Sta... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262480",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9948/"
] |
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 would like to remotely call.</p>
<p>Specifically, I would like to call this function - let's call it void <code>zoomByFactor(x,y)</code> - when I receive certain data from a complex HIDevice.</p>
<p>I can easily modify or inject instructions into the binary file itself (ie. the patching does not need to occur only in RAM).</p>
<p>What would you recommend as a way of "nicely" doing this?</p>
<p><strong>Edit:</strong></p>
<p>I do indeed need to entire application. So I can't ditch it and use a library. (For those who need an ethical explanation: this is a proprietary piece of CAD software whose company website hasn't been updated since 2006. I have paid for this product (quite a lot of money for what it is, really) and have project data which I can not easily migrate away from it. The product suits me just fine as it is, but I want to use a new HID which I recently got. I've examined the internals of the application, and I'm fairly confident that I can call the correct function with the relevant data and get it to work properly).</p>
<p>Here's what I've done so far, and it is quite gheto.</p>
<p>I've already modified parts of the application through this process:</p>
<pre>
xxd -g 0 binary > binary.hex
cat binary.hex | awk 'substitute work' > modified.hex
xxd -r modified.hex > newbinary
chmod 777 newbinary
</pre>
<p>I'm doing this kind of jumping through hoops because the binary is almost 100 megs large.</p>
<p>The jist of what I'm thinking is that I'd jmp somewhere in the main application loop, launch a thread, and return to the main function. </p>
<p>Now, the questions are: where can I insert the new code? do I need to modify symbol tables? alternatively, how could I make a dylib load automatically so that the only "hacking" I need to do is inserting a call to a normally loaded dylib into the main function?</p>
| [
{
"answer_id": 275216,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 4,
"selected": false,
"text": "otool -l"
},
{
"answer_id": 23497928,
"author": "jar",
"author_id": 183677,
"author_profile": "https://Sta... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262493",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
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:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]];
[[container layer] addAnimation:animation forKey:@"swap"];
</code></pre>
<p>When my transition executes on the devlice, I sometimes get a single frame flash of the final frame of the transition animation and then the animation plays smoothly. This gives a very jarring effect of the 2nd view which flickers in and then out again before the smooth animation executes.</p>
<p>The main difference between my example and the Apple example is that my views are not full screen, I have a container UIView which contains both sub-views and I am applying my animation to the container layer instead the root view layer. I can not see that this should make much difference though.</p>
<p>This issue does not happen at all in the simulator and is intermittent (about 60-70% of the time) on the device. Is anyone else seeing this behaviour and if so, how did you work around it?</p>
<p><strong>Updated with more information:</strong>
The code was originally part of a multi part animation but I moved it to be triggered by a button to isolate the problem. The issue occurs in both situations.</p>
<p>The animation delegates were implemented but have been removed to try and isolate the problem.</p>
<p>The views are not changing during the animation and in fact <code>[container setUserInteractionEnabled:NO]</code> is being called (but the problem also happens without user interaction being disabled).</p>
<p>I have tried starting the animation from the middle of the transition and ending before the end using <code>setStartProgress</code> and <code>setEndProgress</code>, again the problem persists.</p>
<p>I have tried slowing the animation duration right down as well with no effect.</p>
| [
{
"answer_id": 275216,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 4,
"selected": false,
"text": "otool -l"
},
{
"answer_id": 23497928,
"author": "jar",
"author_id": 183677,
"author_profile": "https://Sta... | 2008/11/04 | [
"https://Stackoverflow.com/questions/262508",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4496/"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.