qid int64 4 19.1M | question stringlengths 18 48.3k | answers list | date stringlengths 10 10 | metadata list |
|---|---|---|---|---|
20,722 | <p>How can I efficiently and effectively detect the version and, for that matter, any available information about the instance of <a href="http://silverlight.net/" rel="nofollow noreferrer">Silverlight</a> currently running on the browser?</p>
| [
{
"answer_id": 20745,
"author": "Bryan Roth",
"author_id": 299,
"author_profile": "https://Stackoverflow.com/users/299",
"pm_score": 2,
"selected": false,
"text": "Silverlight.isInstalled = function(d)\n{\n var c = false, a = null;\n try\n {\n var b = null;\n if(Si... | 2008/08/21 | [
"https://Stackoverflow.com/questions/20722",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/375/"
] |
20,731 | <p>I've tried several things already,</p>
<pre><code>std::stringstream m;
m.empty();
m.clear();
</code></pre>
<p>both of which don't work.</p>
| [
{
"answer_id": 20732,
"author": "CodingWithoutComments",
"author_id": 25,
"author_profile": "https://Stackoverflow.com/users/25",
"pm_score": 5,
"selected": false,
"text": "m.str(\"\");\n"
},
{
"answer_id": 20792,
"author": "Wilka",
"author_id": 1367,
"author_profile"... | 2008/08/21 | [
"https://Stackoverflow.com/questions/20731",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25/"
] |
20,744 | <p>Using the viewer control for display of SQL Reporting Services reports on web page (Microsoft.ReportViewer.WebForms), can you move the View Report button? It defaults to the very right side of the report, which means you have to scroll all the way across before the button is visible. Not a problem for reports that fit the window width, but on very wide reports that is quickly an issue.</p>
| [
{
"answer_id": 886149,
"author": "Liron Yahdav",
"author_id": 62,
"author_profile": "https://Stackoverflow.com/users/62",
"pm_score": 3,
"selected": true,
"text": "function getRepViewBtn() {\n return document.getElementsByName(\"ReportViewer1$ctl00$ctl00\")[0];\n}\n\nfunction hideViewRe... | 2008/08/21 | [
"https://Stackoverflow.com/questions/20744",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1215/"
] |
20,762 | <p>Is there any easy/general way to clean an XML based data source prior to using it in an XmlReader so that I can gracefully consume XML data that is non-conformant to the hexadecimal character restrictions placed on XML?</p>
<p>Note: </p>
<ul>
<li>The solution needs to handle XML
data sources that use character
encodings other than UTF-8, e.g. by
specifying the character encoding at
the XML document declaration. Not
mangling the character encoding of
the source while stripping invalid
hexadecimal characters has been a
major sticking point.</li>
<li>The removal of invalid hexadecimal characters should only remove hexadecimal encoded values, as you can often find href values in data that happens to contains a string that would be a string match for a hexadecimal character.</li>
</ul>
<p><em>Background:</em></p>
<p>I need to consume an XML-based data source that conforms to a specific format (think Atom or RSS feeds), but want to be able to consume data sources that have been published which contain invalid hexadecimal characters per the XML specification.</p>
<p>In .NET if you have a Stream that represents the XML data source, and then attempt to parse it using an XmlReader and/or XPathDocument, an exception is raised due to the inclusion of invalid hexadecimal characters in the XML data. My current attempt to resolve this issue is to parse the Stream as a string and use a regular expression to remove and/or replace the invalid hexadecimal characters, but I am looking for a more performant solution.</p>
| [
{
"answer_id": 20777,
"author": "Eugene Katz",
"author_id": 1533,
"author_profile": "https://Stackoverflow.com/users/1533",
"pm_score": 7,
"selected": true,
"text": "/// <summary>\n/// Removes control characters and other non-UTF-8 characters\n/// </summary>\n/// <param name=\"inString\"... | 2008/08/21 | [
"https://Stackoverflow.com/questions/20762",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2029/"
] |
20,778 | <p>I have binary data in a file that I can read into a byte array and process with no problem. Now I need to send parts of the data over a network connection as elements in an XML document. My problem is that when I convert the data from an array of bytes to a String and back to an array of bytes, the data is getting corrupted. I've tested this on one machine to isolate the problem to the String conversion, so I now know that it isn't getting corrupted by the XML parser or the network transport.</p>
<p>What I've got right now is</p>
<pre><code>byte[] buffer = ...; // read from file
// a few lines that prove I can process the data successfully
String element = new String(buffer);
byte[] newBuffer = element.getBytes();
// a few lines that try to process newBuffer and fail because it is not the same data anymore
</code></pre>
<p>Does anyone know how to convert binary to String and back without data loss?</p>
<p>Answered: Thanks Sam. I feel like an idiot. I had this answered yesterday because my SAX parser was complaining. For some reason when I ran into this seemingly separate issue, it didn't occur to me that it was a new symptom of the same problem.</p>
<p>EDIT: Just for the sake of completeness, I used the <a href="http://commons.apache.org/codec/apidocs/org/apache/commons/codec/binary/Base64.html" rel="noreferrer">Base64</a> class from the <a href="http://commons.apache.org/" rel="noreferrer">Apache Commons</a> <a href="http://commons.apache.org/codec/" rel="noreferrer">Codec</a> package to solve this problem.</p>
| [
{
"answer_id": 20860,
"author": "McDowell",
"author_id": 304,
"author_profile": "https://Stackoverflow.com/users/304",
"pm_score": 5,
"selected": false,
"text": "byte[] bytes = loadFile(file); \n//all chars in encoded are guaranteed to be 7-bit ASCII\nbyte[] encoded = Base64.enc... | 2008/08/21 | [
"https://Stackoverflow.com/questions/20778",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1288/"
] |
20,787 | <p>In what situation would it be more appropriate for me to use a bitset (STL container) to manage a set of flags rather than having them declared as a number of separate (bool) variables?</p>
<p>Will I get a significant performance gain if I used a bitset for 50 flags rather than using 50 separate bool variables?</p>
| [
{
"answer_id": 20916,
"author": "Herms",
"author_id": 1409,
"author_profile": "https://Stackoverflow.com/users/1409",
"pm_score": 2,
"selected": false,
"text": "struct MyBitset {\n bool firstOption:1;\n bool secondOption:1;\n bool thirdOption:1;\n int fourBitNumber:4;\n};\n MyBitset ... | 2008/08/21 | [
"https://Stackoverflow.com/questions/20787",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/381/"
] |
20,794 | <p>If I call <code>os.stat()</code> on a broken <code>symlink</code>, python throws an <code>OSError</code> exception. This makes it useful for finding them. However, there are a few other reasons that <code>os.stat()</code> might throw a similar exception. Is there a more precise way of detecting broken <code>symlinks</code> with Python under Linux?</p>
| [
{
"answer_id": 20843,
"author": "dlamblin",
"author_id": 459,
"author_profile": "https://Stackoverflow.com/users/459",
"pm_score": 2,
"selected": false,
"text": "find . -type f -exec test \\{} -ef /path/to/file \\; -print man test -L -h head -0 FILE1 0 1"
},
{
"answer_id": 20845,... | 2008/08/21 | [
"https://Stackoverflow.com/questions/20794",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1892/"
] |
20,797 | <p>I have a byte array in memory, read from a file. I would like to split the byte array at a certain point (index) without having to just create a new byte array and copy each byte at a time, increasing the in memory foot print of the operation. What I would like is something like this:</p>
<pre><code>byte[] largeBytes = [1,2,3,4,5,6,7,8,9];
byte[] smallPortion;
smallPortion = split(largeBytes, 3);
</code></pre>
<p><code>smallPortion</code> would equal 1,2,3,4<br>
<code>largeBytes</code> would equal 5,6,7,8,9</p>
| [
{
"answer_id": 20826,
"author": "Stu",
"author_id": 414,
"author_profile": "https://Stackoverflow.com/users/414",
"pm_score": 0,
"selected": false,
"text": "std::vector<int> IEnumerable<>"
},
{
"answer_id": 20949,
"author": "Michał Piaskowski",
"author_id": 1534,
"aut... | 2008/08/21 | [
"https://Stackoverflow.com/questions/20797",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1048/"
] |
20,840 | <p>Why should I or shouldn't I use dirty reads:</p>
<pre><code>set transaction isolation level read uncommitted
</code></pre>
<p>in SQL Server?</p>
| [
{
"answer_id": 34477845,
"author": "K ROHAN",
"author_id": 5719882,
"author_profile": "https://Stackoverflow.com/users/5719882",
"pm_score": -1,
"selected": false,
"text": "Select * from table_name with(nolock) \n"
}
] | 2008/08/21 | [
"https://Stackoverflow.com/questions/20840",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/357/"
] |
20,850 | <p>I'm a bit newbieish when it comes to the deeper parts of OSX configuration and am having to put up with a fairly irritating niggle which while I can put up with it, I know under Windows I could have sorted in minutes.</p>
<p>Basically, I have an external disk with two volumes: </p>
<p>One is an HFS+ volume which I use for TimeMachine backups.
The other, an NTFS volume that I use for general file copying etc on Mac and Windows boxes.</p>
<p>So what happens is that whenever I plug in the disk into my Mac USB, OSX goes off and mounts both volumes and shows an icon on the desktop for each. The thing is that to remove the disk you have to eject the volume and in this case do it for both volumes, which causes an annoying warning dialog to be shown every time. </p>
<p>What I'd prefer is some way to prevent the NTFS volume from auto-mounting altogether. I've done some hefty googling and here's a list of things I've tried so far:</p>
<ul>
<li>I've tried going through options in Disk Utility</li>
<li>I've tried setting AutoMount to No in /etc/hostconfig but that is a bit too global for my liking.</li>
<li>I've also tried the suggested approach to putting settings in fstab but it appears the OSX (10.5) is ignoring these settings.</li>
</ul>
<p>Any other suggestions would be welcomed. Just a little dissapointed that I can't just tick a box somewhere (or untick).</p>
<p>EDIT: Thanks heaps to hop for the answer it worked a treat. For the record it turns out that it wasn't OSX not picking up the settings I actually had "msdos" instead of "ntfs" in the fs type column.</p>
| [
{
"answer_id": 36907,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 3,
"selected": true,
"text": "/etc/fstab LABEL=VolumeName none ntfs noauto\n /etc/fstab.hd diskarbitrationd"
}
] | 2008/08/21 | [
"https://Stackoverflow.com/questions/20850",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1120/"
] |
20,852 | <p>I'd like to be able to track file read/writes of specific program invocations. No information about the actual transactions is required, just the file names involved.</p>
<p>Is there a cross platform solution to this? <br />
What are various platform specific methods? <br />
On Linux I know there's strace/ptrace (if there are faster methods that'd be good too). <br />I think on mac os there's ktrace. <br />
What about Windows?</p>
<p>Also, it would be amazing if it would be possible to block (stall out) file accesses until some later time.</p>
<p>Thanks!</p>
| [
{
"answer_id": 21269,
"author": "Mat Noguchi",
"author_id": 1799,
"author_profile": "https://Stackoverflow.com/users/1799",
"pm_score": 1,
"selected": false,
"text": "ReadDirectoryChangesW"
}
] | 2008/08/21 | [
"https://Stackoverflow.com/questions/20852",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1164871/"
] |
20,856 | <p>I've heard of a few ways to implement tagging; using a mapping table between TagID and ItemID (makes sense to me, but does it scale?), adding a fixed number of possible TagID columns to ItemID (seems like a bad idea), Keeping tags in a text column that's comma separated (sounds crazy but could work). I've even heard someone recommend a sparse matrix, but then how do the tag names grow gracefully?</p>
<p>Am I missing a best practice for tags?</p>
| [
{
"answer_id": 20871,
"author": "Yaakov Ellis",
"author_id": 51,
"author_profile": "https://Stackoverflow.com/users/51",
"pm_score": 10,
"selected": true,
"text": "Table: Item\nColumns: ItemID, Title, Content\n\nTable: Tag\nColumns: TagID, Title\n\nTable: ItemTag\nColumns: ItemID, TagID\... | 2008/08/21 | [
"https://Stackoverflow.com/questions/20856",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/459/"
] |
20,876 | <p>I'm new to SQL Server Reporting Services, and was wondering the best way to do the following:</p>
<blockquote>
<ul>
<li>Query to get a list of popular IDs</li>
<li>Subquery on each item to get properties from another table</li>
</ul>
</blockquote>
<p>Ideally, the final report columns would look like this:</p>
<pre><code>[ID] [property1] [property2] [SELECT COUNT(*)
FROM AnotherTable
WHERE ForeignID=ID]
</code></pre>
<p>There may be ways to construct a giant SQL query to do this all in one go, but I'd prefer to compartmentalize it. Is the recommended approach to write a VB function to perform the subquery for each row? Thanks for any help.</p>
| [
{
"answer_id": 20914,
"author": "Carlton Jenke",
"author_id": 1215,
"author_profile": "https://Stackoverflow.com/users/1215",
"pm_score": 0,
"selected": false,
"text": "select *,\n (select count(*) from tbl2 t2 where t2.tbl1ID = t1.tbl1ID) as cnt\nfrom tbl1 t1\n declare @tbl1 table\n(\n ... | 2008/08/21 | [
"https://Stackoverflow.com/questions/20876",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/109/"
] |
20,882 | <p>Some things look strange to me:</p>
<ul>
<li>What is the distinction between 0.0.0.0, 127.0.0.1, and [::]?</li>
<li>How should each part of the foreign address be read (part1:part2)?</li>
<li>What does a state Time_Wait, Close_Wait mean?</li>
<li>etc.</li>
</ul>
<p>Could someone give a quick overview of how to interpret these results?</p>
| [
{
"answer_id": 2247948,
"author": "PlanetUnknown",
"author_id": 179521,
"author_profile": "https://Stackoverflow.com/users/179521",
"pm_score": 2,
"selected": false,
"text": "TCP Connection States SYN_SEND SYN_RECEIVED ESTABLISHED LISTEN TIMED_WAIT CLOSE_WAIT FIN_WAIT_2 LAST_ACK CLOSED"
... | 2008/08/21 | [
"https://Stackoverflow.com/questions/20882",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1946/"
] |
20,910 | <p>My company develops several types of applications. A lot of our business comes from doing multimedia-type apps, typically done in Flash. However, now that side of the house is starting to migrate towards doing Flex development.</p>
<p>Most of our other development is done using .NET. I'm trying to make a push towards doing Silverlight development instead, since it would take better advantage of the .NET developers on staff. I prefer the Silverlight platform over the Flex platform for the simple fact that Silverlight is all .NET code. We have more .NET developers on staff than Flash/Flex developers, and most of our Flash/Flex developers are graphic artists (not real programmers). Only reason they push towards Flex right now is because it seems like the logical step from Flash.</p>
<p>I've done development using both, and I honestly believe Silverlight is easier to work with. But I'm trying to convince people who are only Flash developers. </p>
<p>So here's my question: If I'm going to go into a meeting to praise Silverlight, why would a company want to go with Silverlight instead of Flex? Other than the obvious "not everyone has Silverlight", what are the pros and cons for each?</p>
| [
{
"answer_id": 1508585,
"author": "Akash Kava",
"author_id": 85597,
"author_profile": "https://Stackoverflow.com/users/85597",
"pm_score": 4,
"selected": false,
"text": "e.g.\n// this is possible in flex..\n// but not in silverlight\n<mx:TextBox id=\"firstName\"/>\n<mx:TextBox id=\"lastN... | 2008/08/21 | [
"https://Stackoverflow.com/questions/20910",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1226/"
] |
20,912 | <p>I'm trying to do a file system backup of a RedHat Enterprise Linux v4 server using Symantec Backup Exec 11d (Rev 7170). The backup server is Windows Server 2003.</p>
<p>I can browse the target server to create a selection list, and when I do a test run it completes successfully.</p>
<p>However, when I run a real backup, the job fails immediately during the "processing" phase with the error: </p>
<p><em>e000fe30 - A communications failure has occured.</em></p>
<p>I've tried opening ports (10000, 1025-9999), etc. But no joy. Any ideas?</p>
| [
{
"answer_id": 30982,
"author": "Tyler Gooch",
"author_id": 1372,
"author_profile": "https://Stackoverflow.com/users/1372",
"pm_score": 0,
"selected": false,
"text": "[root@MYSERVER ~]# service iptables status \nTable: filter \nChain INPUT (policy ACCEPT) \ntarget prot opt source ... | 2008/08/21 | [
"https://Stackoverflow.com/questions/20912",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1372/"
] |
20,923 | <p>I need to script the creation of app pools and websites on IIS 6.0. I have been able to create these using adsutil.vbs and iisweb.vbs, but don't know how to set the version of ASP.NET for the sites I have just created to 2.0.50727.0.</p>
<p>Ideally I would like to adsutil.vbs to update the metabase. How do I do this?</p>
| [
{
"answer_id": 20953,
"author": "Chris Miller",
"author_id": 206,
"author_profile": "https://Stackoverflow.com/users/206",
"pm_score": 2,
"selected": false,
"text": "'******************************************************************************************\n' Name: SetASPDotNetVersion\n... | 2008/08/21 | [
"https://Stackoverflow.com/questions/20923",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/636/"
] |
20,926 | <p>Today I was working on a tab navigation for a webpage. I tried the <a href="http://www.alistapart.com/articles/slidingdoors2/" rel="noreferrer">Sliding Doors</a> approach which worked fine. Then I realized that I must include an option to delete a tab (usually a small X in the right corner of each tab). </p>
<p>I wanted to use a nested anchor, which didn't work because it is <a href="http://www.w3.org/TR/html4/struct/links.html#h-12.2.2" rel="noreferrer">not</a> allowed. Then I saw the tab- navigation at <a href="http://www.pageflakes.com" rel="noreferrer">Pageflakes</a>, which was actually working (including nested hyperlinks). Why?</p>
| [
{
"answer_id": 20944,
"author": "Yaakov Ellis",
"author_id": 51,
"author_profile": "https://Stackoverflow.com/users/51",
"pm_score": 4,
"selected": true,
"text": "<a class=\"page_tab page_tab\">\n <div class=\"page_title\" title=\"Click to rename this page.\">Click & Type Page Name</div... | 2008/08/21 | [
"https://Stackoverflow.com/questions/20926",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2078/"
] |
20,927 | <p>I've got two models: Message and Attachment. Each attachment is attached to a specific message, using a ForeignKey on the Attachment model. Both models have an auto_now DateTimeField called updated. I'm trying to make it so that when any attachment is saved, it also sets the updated field on the associated message to now. Here's my code:</p>
<pre><code>def save(self):
super(Attachment, self).save()
self.message.updated = self.updated
</code></pre>
<p>Will this work, and if you can explain it to me, why? If not, how would I accomplish this?</p>
| [
{
"answer_id": 72359,
"author": "zgoda",
"author_id": 12138,
"author_profile": "https://Stackoverflow.com/users/12138",
"pm_score": 1,
"selected": false,
"text": "save()"
},
{
"answer_id": 33449486,
"author": "Serjik",
"author_id": 546822,
"author_profile": "https://S... | 2008/08/21 | [
"https://Stackoverflow.com/questions/20927",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1914/"
] |
20,952 | <p>I'm trying to unit test a custom ConfigurationSection I've written, and I'd like to load some arbitrary configuration XML into a <a href="http://msdn.microsoft.com/en-us/library/system.configuration.configuration.aspx" rel="noreferrer">System.Configuration.Configuration</a> for each test (rather than put the test configuration xml in the Tests.dll.config file. That is, I'd like to do something like this:</p>
<pre><code>Configuration testConfig = new Configuration("<?xml version=\"1.0\"?><configuration>...</configuration>");
MyCustomConfigSection section = testConfig.GetSection("mycustomconfigsection");
Assert.That(section != null);
</code></pre>
<p>However, it looks like <a href="http://msdn.microsoft.com/en-us/library/system.configuration.configurationmanager.aspx" rel="noreferrer">ConfigurationManager</a> will only give you Configuration instances that are associated with an EXE file or a machine config. Is there a way to load arbitrary XML into a Configuration instance?</p>
| [
{
"answer_id": 704817,
"author": "Oliver Pearmain",
"author_id": 334395,
"author_profile": "https://Stackoverflow.com/users/334395",
"pm_score": 5,
"selected": true,
"text": "public class MyXmlCustomConfigSection : MyCustomConfigSection\n{\n public MyXmlCustomConfigSection (string con... | 2008/08/21 | [
"https://Stackoverflow.com/questions/20952",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2338/"
] |
20,958 | <p>I'm designing a database table and asking myself this question: <em>How long should the firstname field be?</em></p>
<p>Does anyone have a list of reasonable lengths for the most common fields, such as first name, last name, and email address?</p>
| [
{
"answer_id": 10103305,
"author": "Micheal Mouner Mikhail Youssif",
"author_id": 1119452,
"author_profile": "https://Stackoverflow.com/users/1119452",
"pm_score": 2,
"selected": false,
"text": "+------------+---------------+---------------------------------+\n| Field | Length (Char... | 2008/08/21 | [
"https://Stackoverflow.com/questions/20958",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/437/"
] |
20,959 | <p>How can I determine all of the assemblies that my .NET desktop application has loaded? I'd like to put them in the about box so I can query customers over the phone to determine what version of XYZ they have on their PC.</p>
<p>It would be nice to see both managed and unmanaged assemblies. I realize the list will get long but I plan to slap an incremental search on it.</p>
| [
{
"answer_id": 20970,
"author": "Nick",
"author_id": 1490,
"author_profile": "https://Stackoverflow.com/users/1490",
"pm_score": 0,
"selected": false,
"text": "AppDomain.CurrentDomain.GetAssemblies();"
},
{
"answer_id": 20974,
"author": "Greg Hurlman",
"author_id": 35,
... | 2008/08/21 | [
"https://Stackoverflow.com/questions/20959",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1490/"
] |
20,993 | <p>When creating a web application, and lets say you have a User object denoting a single user, what do you think is the best way to store that the user has logged in?</p>
<p>Two ways I've thought about have been:</p>
<ul>
<li>Stored the user database id in a session variable</li>
<li>Stored the entire user object in a session variable</li>
</ul>
<p>Any better suggestions, any issues with using the above ways? Perhaps security issues or memory issues, etc, etc.</p>
| [
{
"answer_id": 21344,
"author": "tghw",
"author_id": 2363,
"author_profile": "https://Stackoverflow.com/users/2363",
"pm_score": 3,
"selected": false,
"text": "|Session |UserID | |--------+-------| |a1d4e...+ 12345 | |--------+-------| |c64b2...+ 23456 | |--------+-------|"
}
] | 2008/08/21 | [
"https://Stackoverflow.com/questions/20993",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1610/"
] |
20,998 | <p>When I try to create a SQL Server Login by saying</p>
<pre><code>CREATE LOGIN [ourdomain\SQLAccessGroup] FROM WINDOWS;
</code></pre>
<p>I get this error</p>
<blockquote>
<p>The server principal 'ourdomain\SQLAccessGroup' already exists.</p>
</blockquote>
<p>However, when I try this code</p>
<pre><code>DROP LOGIN [ourdomain\SQLAccessGroup]
</code></pre>
<p>I get this error</p>
<blockquote>
<p>Cannot drop the login 'ourdomain\SQLAccessGroup', because it does not exist or you do not have permission.</p>
</blockquote>
<p>The user that I am executing this code as is a sysadmin. Additionally, the user <code>ourdomain\SQLAccessGroup</code> does not show up in this query</p>
<pre><code>select * from sys.server_principals
</code></pre>
<p>Does anyone have any ideas?</p>
| [
{
"answer_id": 21074,
"author": "Pete",
"author_id": 76,
"author_profile": "https://Stackoverflow.com/users/76",
"pm_score": 4,
"selected": true,
"text": "The login already has an account under a different user name.\n"
},
{
"answer_id": 21115,
"author": "jonezy",
"author... | 2008/08/21 | [
"https://Stackoverflow.com/questions/20998",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/76/"
] |
21,027 | <p>Is it possible to change how <kbd>Ctrl</kbd> + <kbd>Tab</kbd> and <kbd>Shift</kbd> + <kbd>Ctrl</kbd> + <kbd>Tab</kbd> work in Visual Studio? I have disabled the popup navigator window, because I only want to switch between items in the tab control. My problem is the inconsistency of what switching to the next and previous document do.</p>
<p>Every other program that uses a tab control for open document I have seen uses <kbd>Ctrl</kbd> + <kbd>Tab</kbd> to move from left to right and <kbd>Shift</kbd> + <kbd>Ctrl</kbd> + <kbd>Tab</kbd> to go right to left. Visual Studio breaks this with its jump to the last tab selected. You can never know what document you will end up on, and it is never the same way twice. </p>
<p>It is very counterintuitive. Is this a subtle way to encourage everyone to only ever have two document open at once?</p>
<hr>
<p>Let's say I have a few files open. I am working in one, and I need to see what is in the next tab to the right. In every other single application on the face of the Earth, <kbd>Ctrl</kbd> + <kbd>Tab</kbd> will get me there. But in Visual Studio, I have no idea which of the other tabs it will take me to. If I only ever have two documents open, this works great. As soon as you go to three or more, all bets are off as to what tab Visual Studio has decided to send you to. </p>
<p>The problem with this is that I shouldn't have to think about the tool, it should fade into the background, and I should be thinking about the task. The current tab behavior keeps pulling me out of the task and makes me have to pay attention to the tool.</p>
| [
{
"answer_id": 21092,
"author": "PabloG",
"author_id": 394,
"author_profile": "https://Stackoverflow.com/users/394",
"pm_score": -1,
"selected": false,
"text": "#IfWinActive Microsoft Excel (application specific remapping)\n\n; Printing area in Excel (@ Ctrl+Alt+A)\n^!a::\nSend !ade\nret... | 2008/08/21 | [
"https://Stackoverflow.com/questions/21027",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2277/"
] |
21,052 | <p>When I'm working with DataBound controls in ASP.NET 2.0 such as a Repeater, I know the fastest way to retrieve a property of a bound object (instead of using Reflection with the Eval() function) is to cast the DataItem object to the type it is and then use that object natively, like the following:</p>
<pre><code><%#((MyType)Container.DataItem).PropertyOfMyType%>
</code></pre>
<p>The problem is, if this type is in a namespace (which is the case 99.99% of the time) then this single statement because a lot longer due to the fact that the ASP page has no concept of class scope so all of my types need to be fully qualified.</p>
<pre><code><%#((RootNamespace.SubNamespace1.SubNamspace2.SubNamespace3.MyType)Container.DataItem).PropertyOfMyType%>
</code></pre>
<p>Is there any kind of <code>using</code> directive or some equivalent I could place somewhere in an ASP.NET page so I don't need to use the full namespace every time?</p>
| [
{
"answer_id": 21056,
"author": "Shawn",
"author_id": 26,
"author_profile": "https://Stackoverflow.com/users/26",
"pm_score": 7,
"selected": true,
"text": "<%@ Import Namespace=\"RootNamespace.SubNamespace1\" %> \n"
}
] | 2008/08/21 | [
"https://Stackoverflow.com/questions/21052",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/392/"
] |
21,060 | <p>I'm tired of being in the middle of typing something, having a pop-up with a question appear, and hitting enter before reading it... (it also happens with some windows that are not pop-ups)</p>
<p>Do you know if there's some setting I could touch for this not to happen?</p>
| [
{
"answer_id": 21056,
"author": "Shawn",
"author_id": 26,
"author_profile": "https://Stackoverflow.com/users/26",
"pm_score": 7,
"selected": true,
"text": "<%@ Import Namespace=\"RootNamespace.SubNamespace1\" %> \n"
}
] | 2008/08/21 | [
"https://Stackoverflow.com/questions/21060",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1782/"
] |
21,078 | <p>What's the most efficient way to concatenate strings?</p>
| [
{
"answer_id": 21084,
"author": "TheSmurf",
"author_id": 1975282,
"author_profile": "https://Stackoverflow.com/users/1975282",
"pm_score": 2,
"selected": false,
"text": "StringBuilder sb = new StringBuilder();\nsb.Append(\"string1\");\nsb.Append(\"string2\");\n...etc...\nString strResult... | 2008/08/21 | [
"https://Stackoverflow.com/questions/21078",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2358/"
] |
21,091 | <p>Programming languages had several (r)evolutionary steps in their history. Some people argue that model-driven approaches will be The Next Big Thing. There are tools like openArchitectureWare, AndroMDA, Sculptor/Fornax Platform etc. that promise incredible productivity boosts. However, I made the experience that it is either rather easy in the beginning to get started but as well to get stuck at some point when you try something that was unanticipated or pretty hard to find enough information that tells you how to start your project because there may be a lot of things to consider.</p>
<p>I think an important insight to get anything out of model-driven something is to understand that the model is not necessarily a set of nice pictures or tree model or UML, but may as well be a textual description (e.g. a state machine, business rules etc.).</p>
<p>What do you think and what does your experience tell you? Is there a future for model-driven development (or whatever you may want to call it)?</p>
<p><strong>Update:</strong> There does not seem to be a lot of interest in this topic. Please let me know, if you have any (good or bad) experience with model-driven approaches or why you think it's not interesting at all.</p>
| [
{
"answer_id": 320316,
"author": "jbandi",
"author_id": 32749,
"author_profile": "https://Stackoverflow.com/users/32749",
"pm_score": 3,
"selected": false,
"text": "class Firm < ActiveRecord::Base\n has_many :clients\n has_one :account\n belongs_to :conglomorate\nend\n"
}
] | 2008/08/21 | [
"https://Stackoverflow.com/questions/21091",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1793/"
] |
21,133 | <p>What's the easiest way to profile a PHP script?</p>
<p>I'd love tacking something on that shows me a dump of all function calls and how long they took but I'm also OK with putting something around specific functions.</p>
<p>I tried experimenting with the <a href="http://php.net/microtime" rel="noreferrer">microtime</a> function:</p>
<pre><code>$then = microtime();
myFunc();
$now = microtime();
echo sprintf("Elapsed: %f", $now-$then);
</code></pre>
<p>but that sometimes gives me negative results. Plus it's a lot of trouble to sprinkle that all over my code.</p>
| [
{
"answer_id": 21139,
"author": "Eric Lamb",
"author_id": 538,
"author_profile": "https://Stackoverflow.com/users/538",
"pm_score": 3,
"selected": false,
"text": "microtime() get_memory_usage() get_peak_memory_usage()"
},
{
"answer_id": 21189,
"author": "Vincent",
"author... | 2008/08/21 | [
"https://Stackoverflow.com/questions/21133",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/305/"
] |
21,184 | <p>I've got a System.Generic.Collections.List(Of MyCustomClass) type object.</p>
<p>Given integer varaibles pagesize and pagenumber, how can I query only any single page of MyCustomClass objects?</p>
| [
{
"answer_id": 21389,
"author": "Espo",
"author_id": 2257,
"author_profile": "https://Stackoverflow.com/users/2257",
"pm_score": 6,
"selected": true,
"text": "var pageNum = 3;\nvar pageSize = 20;\nquery = query.Skip((pageNum - 1) * pageSize).Take(pageSize);\n query.Page(2,50)\n"
},
{... | 2008/08/21 | [
"https://Stackoverflow.com/questions/21184",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/83/"
] |
21,207 | <p>I'm currently trying out db4o (the java version) and I pretty much like what I see. But I cannot help wondering how it does perform in a real live (web-)environment. Does anyone have any experiences (good or bad) to share about running db4o? </p>
| [
{
"answer_id": 24499,
"author": "Judah Gabriel Himango",
"author_id": 536,
"author_profile": "https://Stackoverflow.com/users/536",
"pm_score": 7,
"selected": true,
"text": "// C# syntax for \"Find all MyFoos with Bar == 23\".\n// (Note the Java syntax is more verbose using the Predicate... | 2008/08/21 | [
"https://Stackoverflow.com/questions/21207",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1562/"
] |
21,232 | <p>I've got a System.Generic.Collections.List(Of MyCustomClass) type object.</p>
<p>Given integer varaibles pagesize and pagenumber, how can I collect only any single page of <code>MyCustomClass</code> objects?</p>
<p>This is what I've got. How can I improve it?</p>
<pre><code>'my given collection and paging parameters
Dim AllOfMyCustomClassObjects As System.Collections.Generic.List(Of MyCustomClass) = GIVEN
Dim pagesize As Integer = GIVEN
Dim pagenumber As Integer = GIVEN
'collect current page objects
Dim PageObjects As New System.Collections.Generic.List(Of MyCustomClass)
Dim objcount As Integer = 1
For Each obj As MyCustomClass In AllOfMyCustomClassObjects
If objcount > pagesize * (pagenumber - 1) And count <= pagesize * pagenumber Then
PageObjects.Add(obj)
End If
objcount = objcount + 1
Next
'find total page count
Dim totalpages As Integer = CInt(Math.Floor(objcount / pagesize))
If objcount Mod pagesize > 0 Then
totalpages = totalpages + 1
End If
</code></pre>
| [
{
"answer_id": 21267,
"author": "FlySwat",
"author_id": 1965,
"author_profile": "https://Stackoverflow.com/users/1965",
"pm_score": 1,
"selected": false,
"text": "List<int> lolInts = new List<int>();\n\nfor (int i = 0; i <= 100; i++)\n{\n lolInts.Add(i);\n}\n\nList<int> page1 = lolInt... | 2008/08/21 | [
"https://Stackoverflow.com/questions/21232",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/83/"
] |
21,265 | <p>What is the best method for comparing IEEE floats and doubles for equality? I have heard of several methods, but I wanted to see what the community thought.</p>
| [
{
"answer_id": 21277,
"author": "DrPizza",
"author_id": 2131,
"author_profile": "https://Stackoverflow.com/users/2131",
"pm_score": 4,
"selected": true,
"text": "bool is_nan(float f)\n{\n return (*reinterpret_cast<unsigned __int32*>(&f) & 0x7f800000) == 0x7f800000 && (*reinterpret_cas... | 2008/08/21 | [
"https://Stackoverflow.com/questions/21265",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2328/"
] |
21,280 | <p>I seem to be missing something about LINQ. To me, it looks like it's taking some of the elements of SQL that I like the least and moving them into the C# language and using them for other things.</p>
<p>I mean, I could see the benefit of using SQL-like statements on things other than databases. But if I wanted to write SQL, well, why not just write SQL and keep it out of C#? What am I missing here?</p>
| [
{
"answer_id": 21292,
"author": "FlySwat",
"author_id": 1965,
"author_profile": "https://Stackoverflow.com/users/1965",
"pm_score": 6,
"selected": true,
"text": "foreach (int number in list1)\n{\n foreach (int number2 in list2)\n {\n if (number2 == number)\n {\n ... | 2008/08/21 | [
"https://Stackoverflow.com/questions/21280",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2147/"
] |
21,288 | <p>Which C#/.NET Dependency Injection frameworks are worth looking into?
And what can you say about their complexity and speed.</p>
| [
{
"answer_id": 227012,
"author": "Glenn Block",
"author_id": 18419,
"author_profile": "https://Stackoverflow.com/users/18419",
"pm_score": 6,
"selected": false,
"text": "Spring.NET Castle Windsor Structure Map Autofac Ninject Unity"
}
] | 2008/08/21 | [
"https://Stackoverflow.com/questions/21288",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2011/"
] |
21,294 | <p>How can you reliably and dynamically load a JavaScript file? This will can be used to implement a module or component that when 'initialized' the component will dynamically load all needed JavaScript library scripts on demand.</p>
<p>The client that uses the component isn't required to load all the library script files (and manually insert <code><script></code> tags into their web page) that implement this component - just the 'main' component script file.</p>
<p><strong>How do mainstream JavaScript libraries accomplish this (Prototype, jQuery, etc)?</strong> Do these tools merge multiple JavaScript files into a single redistributable 'build' version of a script file? Or do they do any dynamic loading of ancillary 'library' scripts?</p>
<p>An addition to this question: <strong>is there a way to handle the event after a dynamically included JavaScript file is loaded?</strong> Prototype has <code>document.observe</code> for document-wide events. Example:</p>
<pre><code>document.observe("dom:loaded", function() {
// initially hide all containers for tab content
$$('div.tabcontent').invoke('hide');
});
</code></pre>
<p><strong>What are the available events for a script element?</strong></p>
| [
{
"answer_id": 21297,
"author": "Adam",
"author_id": 1341,
"author_profile": "https://Stackoverflow.com/users/1341",
"pm_score": 3,
"selected": false,
"text": " function include(url)\n {\n var s = document.createElement(\"script\");\n s.setAttribute(\"type\", \"text/javascript\")... | 2008/08/21 | [
"https://Stackoverflow.com/questions/21294",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1341/"
] |
21,303 | <p>VC++ makes functions which are implemented within the class declaration inline functions.</p>
<p>If I declare a class <code>Foo</code> as follows, then are the CONSTRUCTOR and DESTRUCTOR inline functions?</p>
<pre><code>class Foo
{
int* p;
public:
Foo() { p = new char[0x00100000]; }
~Foo() { delete [] p; }
};
{
Foo f;
(f);
}
</code></pre>
| [
{
"answer_id": 21326,
"author": "Wilka",
"author_id": 1367,
"author_profile": "https://Stackoverflow.com/users/1367",
"pm_score": 5,
"selected": false,
"text": "class Foo \n{\n int* p;\npublic:\n Foo();\n ~Foo();\n};\n\ninline Foo::Foo() \n{ \n p = new char[0x00100000]; \n}\n... | 2008/08/21 | [
"https://Stackoverflow.com/questions/21303",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1556/"
] |
21,388 | <p>I have a collection of objects in a database. Images in a photo gallery, products in a catalog, chapters in a book, etc. Each object is represented as a row. I want to be able to arbitrarily order these images, storing that ordering in the database so when I display the objects, they will be in the right order.</p>
<p>For example, let's say I'm writing a book, and each chapter is an object. I write my book, and put the chapters in the following order:</p>
<blockquote>
<p>Introduction, Accessibility, Form vs. Function, Errors, Consistency, Conclusion, Index</p>
</blockquote>
<p>It goes to the editor, and comes back with the following suggested order:</p>
<blockquote>
<p>Introduction, Form, Function, Accessibility, Consistency, Errors, Conclusion, Index</p>
</blockquote>
<p>How can I store this ordering in the database in a robust, efficient way?</p>
<p>I've had the following ideas, but I'm not thrilled with any of them:</p>
<ol>
<li><p>Array. Each row has an ordering ID, when order is changed (via a removal followed by an insertion), the order IDs are updated. This makes retrieval easy, since it's just <code>ORDER BY</code>, but it seems easy to break.</p>
<blockquote>
<p><code>// REMOVAL</code><br>
<code>UPDATE ... SET orderingID=NULL WHERE orderingID=removedID</code><br>
<code>UPDATE ... SET orderingID=orderingID-1 WHERE orderingID > removedID</code><br>
<code>// INSERTION</code><br>
<code>UPDATE ... SET orderingID=orderingID+1 WHERE orderingID > insertionID</code><br>
<code>UPDATE ... SET orderID=insertionID WHERE ID=addedID</code></p>
</blockquote></li>
<li><p>Linked list. Each row has a column for the id of the next row in the ordering. Traversal seems costly here, though there may by some way to use <code>ORDER BY</code> that I'm not thinking of.</p></li>
<li><p>Spaced array. Set the orderingID (as used in #1) to be large, so the first object is 100, the second is 200, etc. Then when an insertion happens, you just place it at <code>(objectBefore + objectAfter)/2</code>. Of course, this would need to be rebalanced occasionally, so you don't have things too close together (even with floats, you'd eventually run into rounding errors).</p></li>
</ol>
<p>None of these seem particularly elegant to me. Does anyone have a better way to do it?</p>
| [
{
"answer_id": 53794303,
"author": "Chris Conlan",
"author_id": 6073802,
"author_profile": "https://Stackoverflow.com/users/6073802",
"pm_score": 0,
"selected": false,
"text": "INSERT INSERT INSERT DELETE DELETE CharField() max_length INSERT JOIN"
}
] | 2008/08/21 | [
"https://Stackoverflow.com/questions/21388",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2363/"
] |
21,437 | <p>What are some effective strategies for preventing the use of my proprietary images?</p>
<p>I'm talking about saving them, direct linking to them etc...</p>
<p>Presently I have a watermark on the image, but I'd rather not.</p>
<p>.NET platform preferred, but if there's a strategy that's on another platform that integrates with my existing application that'd be a bonus.</p>
| [
{
"answer_id": 11382754,
"author": "mridul4c",
"author_id": 1509915,
"author_profile": "https://Stackoverflow.com/users/1509915",
"pm_score": 0,
"selected": false,
"text": " <div style=”float: left;”>\n<img src=”your-image.jpg” style=”width: 200px;height: 200px;”/>\n<img src=”the-dumm... | 2008/08/21 | [
"https://Stackoverflow.com/questions/21437",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1975/"
] |
21,448 | <p>I have an SSIS package that exports data to a couple of Excel files for transfer to a third party. To get this to run as a scheduled job on a 64-bit server I understand that I need to set the step as a CmdExec type and call the 32-bit version of DTExec. But I don't seem to be able to get the command right to pass in the connection string for the Excel files.</p>
<p>So far I have this: </p>
<pre><code>DTExec.exe /SQL \PackageName /SERVER OUR2005SQLSERVER /CONNECTION
LETTER_Excel_File;\""Provider=Microsoft.Jet.OLEDB.4.0";"Data
Source=""C:\Temp\BaseFiles\LETTER.xls";"Extended Properties=
""Excel 8.0;HDR=Yes"" /MAXCONCURRENT " -1 " /CHECKPOINTING OFF /REPORTING E
</code></pre>
<p>This gives me the error: <strong><code>Option "Properties=Excel 8.0;HDR=Yes" is not valid.</code></strong></p>
<p>I've tried a few variations with the Quotation marks but have not been able to get it right yet.</p>
<p>Does anyone know how to fix this?</p>
<p><strong><code>UPDATE:</code></strong></p>
<p>Thanks for your help but I've decided to go with CSV files for now, as they seem to just work on the 64-bit version.</p>
| [
{
"answer_id": 22093,
"author": "Marek Grzenkowicz",
"author_id": 95,
"author_profile": "https://Stackoverflow.com/users/95",
"pm_score": 2,
"selected": false,
"text": "\"Data Source=\" + @[User::FilePath] + \";Provider=Microsoft.Jet.OLEDB.4.0;Extended Properties=dBASE IV;\""
},
{
... | 2008/08/21 | [
"https://Stackoverflow.com/questions/21448",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2375/"
] |
21,449 | <p>What is the difference between the following types of endianness?</p>
<ul>
<li>byte (8b) invariant big and little endianness</li>
<li>half-word (16b) invariant big and little endianness</li>
<li>word (32b) invariant big and little endianness</li>
<li>double-word (64b) invariant big and little endianness</li>
</ul>
<p>Are there other types/variations?</p>
| [
{
"answer_id": 21455,
"author": "James A. Rosen",
"author_id": 1190,
"author_profile": "https://Stackoverflow.com/users/1190",
"pm_score": -1,
"selected": false,
"text": "1010 0011\n 0011 1010\n 1100 0101\n"
},
{
"answer_id": 21531,
"author": "dguaraglia",
"author_id": 23... | 2008/08/21 | [
"https://Stackoverflow.com/questions/21449",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2045/"
] |
21,454 | <p>How do I go about specifying and using an ENUM in a Django model?</p>
| [
{
"answer_id": 21468,
"author": "fulmicoton",
"author_id": 446497,
"author_profile": "https://Stackoverflow.com/users/446497",
"pm_score": 7,
"selected": false,
"text": "MAYBECHOICE = (\n ('y', 'Yes'),\n ('n', 'No'),\n ('u', 'Unknown'),\n)\n married = models.CharField(max_length... | 2008/08/21 | [
"https://Stackoverflow.com/questions/21454",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2019/"
] |
21,461 | <pre><code>#if SYMBOL
//code
#endif
</code></pre>
<p>what values does C# predefine for use?</p>
| [
{
"answer_id": 21467,
"author": "Nick",
"author_id": 1490,
"author_profile": "https://Stackoverflow.com/users/1490",
"pm_score": 2,
"selected": false,
"text": "Visual Studio DEBUG"
},
{
"answer_id": 21479,
"author": "Frank Krueger",
"author_id": 338,
"author_profile":... | 2008/08/21 | [
"https://Stackoverflow.com/questions/21461",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1343/"
] |
21,489 | <p>SQL Experts,</p>
<p>Is there an efficient way to group runs of data together using SQL?<br>
Or is it going to be more efficient to process the data in code. </p>
<p>For example if I have the following data:</p>
<pre><code>ID|Name
01|Harry Johns
02|Adam Taylor
03|John Smith
04|John Smith
05|Bill Manning
06|John Smith
</code></pre>
<p>I need to display this:</p>
<pre><code>Harry Johns
Adam Taylor
John Smith (2)
Bill Manning
John Smith
</code></pre>
<p>@Matt: Sorry I had trouble formatting the data using an embedded html table it worked in the preview but not in the final display.</p>
| [
{
"answer_id": 21492,
"author": "Matt Hamilton",
"author_id": 615,
"author_profile": "https://Stackoverflow.com/users/615",
"pm_score": 0,
"selected": false,
"text": "select Name, count(*)\nfrom MyTable\ngroup by Name\n select Name + ' (' + cast(count(*) as varchar) + ')'\nfrom MyTable\n... | 2008/08/22 | [
"https://Stackoverflow.com/questions/21489",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2281/"
] |
21,514 | <p>Within c#, I need to be able to</p>
<ul>
<li>Connect to a remote system, specifying username/password as appropriate</li>
<li>List the members of a localgroup on that system</li>
<li>Fetch the results back to the executing computer</li>
</ul>
<p>So for example I would connect to \SOMESYSTEM with appropriate creds, and fetch back a list of local administrators including SOMESYSTEM\Administrator, SOMESYSTEM\Bob, DOMAIN\AlanH, "DOMAIN\Domain Administrators".</p>
<p>I've tried this with system.directoryservices.accountmanagement but am running into problems with authentication. Sometimes I get:</p>
<p><em>Multiple connections to a server or shared resource by the same user, using more than one user name, are not allowed. Disconnect all previous connections to the server or shared resource and try again. (Exception from HRESULT: 0x800704C3)</em></p>
<p>The above is trying because there will be situations where I simply cannot unmap existing drives or UNC connections.</p>
<p>Other times my program gets UNKNOWN ERROR and the security log on the remote system reports an error 675, code 0x19 which is KDC_ERR_PREAUTH_REQUIRED.</p>
<p>I need a simpler and less error prone way to do this!</p>
| [
{
"answer_id": 24075,
"author": "quux",
"author_id": 2383,
"author_profile": "https://Stackoverflow.com/users/2383",
"pm_score": 2,
"selected": false,
"text": "SELECT PartComponent FROM Win32_GroupUser WHERE GroupComponent = \"Win32_Group.Domain='thehostname',Name='thegroupname'\"\n publ... | 2008/08/22 | [
"https://Stackoverflow.com/questions/21514",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2383/"
] |
21,547 | <p>I've spent a good amount of time coming up with solution to this problem, so in the spirit of <a href="https://stackoverflow.com/questions/21245/questions-vs-conveying-information">this post</a>, I'm posting it here, since I think it might be useful to others. </p>
<p>If anyone has a better script, or anything to add, please post it.</p>
<p>Edit: Yes guys, I know how to do it in Management Studio - but I needed to be able to do it from within another application.</p>
| [
{
"answer_id": 21551,
"author": "Blorgbeard",
"author_id": 369,
"author_profile": "https://Stackoverflow.com/users/369",
"pm_score": 5,
"selected": false,
"text": "declare @schema varchar(100), @table varchar(100)\nset @schema = 'dbo' -- set schema name here\nset @table = 'MyTable' -- se... | 2008/08/22 | [
"https://Stackoverflow.com/questions/21547",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/369/"
] |
21,558 | <p>I want to know what a "<em>virtual base class</em>" is and what it means.</p>
<p>Let me show an example:</p>
<pre><code>class Foo
{
public:
void DoSomething() { /* ... */ }
};
class Bar : public virtual Foo
{
public:
void DoSpecific() { /* ... */ }
};
</code></pre>
| [
{
"answer_id": 21607,
"author": "OJ.",
"author_id": 611,
"author_profile": "https://Stackoverflow.com/users/611",
"pm_score": 10,
"selected": true,
"text": "class A { public: void Foo() {} };\nclass B : public A {};\nclass C : public A {};\nclass D : public B, public C {};\n A\n / \\\n... | 2008/08/22 | [
"https://Stackoverflow.com/questions/21558",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1556/"
] |
21,564 | <p>I ended up writing a quick little script for this in Python, but I was wondering if there was a utility you could feed text into which would prepend each line with some text -- in my specific case, a timestamp. Ideally, the use would be something like:</p>
<pre><code>cat somefile.txt | prepend-timestamp
</code></pre>
<p>(Before you answer sed, I tried this:</p>
<pre><code>cat somefile.txt | sed "s/^/`date`/"
</code></pre>
<p>But that only evaluates the date command once when sed is executed, so the same timestamp is incorrectly prepended to each line.)</p>
| [
{
"answer_id": 21602,
"author": "jj33",
"author_id": 430,
"author_profile": "https://Stackoverflow.com/users/430",
"pm_score": 5,
"selected": false,
"text": "cat somefile.txt | perl -pne 'print scalar(localtime()), \" \";'\n tail -f /path/to/log | perl -pne 'print scalar(localtime()), \"... | 2008/08/22 | [
"https://Stackoverflow.com/questions/21564",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/156/"
] |
21,574 | <p>I'm not clear on the differences between the "current" version of Ruby (1.8) and the "new" version (1.9). Is there an "easy" or a "simple" explanation of the differences and why it is so different?</p>
| [
{
"answer_id": 21621,
"author": "Tim Sullivan",
"author_id": 722,
"author_profile": "https://Stackoverflow.com/users/722",
"pm_score": 8,
"selected": true,
"text": "irb(main):001:0> ?c\n=> \"c\"\n irb(main):001:0> ?c\n=> 99\n irb(main):001:0> \"cat\"[1]\n=> \"a\"\n irb(main):001:0> \"cat... | 2008/08/22 | [
"https://Stackoverflow.com/questions/21574",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/757/"
] |
21,583 | <p>This past summer I was developing a basic ASP.NET/SQL Server CRUD app, and unit testing was one of the requirements. I ran into some trouble when I tried to test against the database. To my understanding, unit tests should be:</p>
<ul>
<li>stateless</li>
<li>independent from each other</li>
<li>repeatable with the same results i.e. no persisting changes</li>
</ul>
<p>These requirements seem to be at odds with each other when developing for a database. For example, I can't test Insert() without making sure the rows to be inserted aren't there yet, thus I need to call the Delete() first. But, what if they aren't already there? Then I would need to call the Exists() function first.</p>
<p>My eventual solution involved very large setup functions (yuck!) and an empty test case which would run first and indicate that the setup ran without problems. This is sacrificing on the independence of the tests while maintaining their statelessness.</p>
<p>Another solution I found is to wrap the function calls in a transaction which can be easily rolled back, like <a href="http://weblogs.asp.net/rosherove/archive/2004/10/05/238201.aspx" rel="noreferrer">Roy Osherove's XtUnit</a>. This work, but it involves another library, another dependency, and it seems a little too heavy of a solution for the problem at hand.</p>
<p>So, what has the SO community done when confronted with this situation?</p>
<hr>
<p>tgmdbm said:</p>
<blockquote>
<p>You typically use your favourite
automated unit testing framework to
perform integration tests, which is
why some people get confused, but they
don't follow the same rules. You are
allowed to involve the concrete
implementation of many of your classes
(because they've been unit tested).
You are testing <strong>how your concrete
classes interact with each other and
with the database</strong>.</p>
</blockquote>
<p>So if I read this correctly, there is really no way to <em>effectively</em> unit-test a Data Access Layer. Or, would a "unit test" of a Data Access Layer involve testing, say, the SQL/commands generated by the classes, independent of actual interaction with the database?</p>
| [
{
"answer_id": 23297120,
"author": "Mustafa Ekici",
"author_id": 687817,
"author_profile": "https://Stackoverflow.com/users/687817",
"pm_score": 1,
"selected": false,
"text": " [TestFixture]\n public class TrannsactionScopeTests\n {\n private TransactionScope trans = null... | 2008/08/22 | [
"https://Stackoverflow.com/questions/21583",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1266/"
] |
21,589 | <p>I did some tests a while ago and never figured out how to make this work. </p>
<p><strong>The ingredients:</strong></p>
<ul>
<li>COM+ transactional object (developed in VB6) </li>
<li>.Net web application (with transaction) in IIS that...<br>
makes a call to the COM+ component<br>
updates a row in a SQL database</li>
</ul>
<p><strong>Testing:</strong> </p>
<p>Run the .Net application and force an exception. </p>
<p><strong>Result:</strong> </p>
<p>The update made from the .Net application rolls back.<br>
The update made by the COM+ object does not roll back.</p>
<p>If I call the COM+ object from an old ASP page the rollback works.</p>
<p>I know some people may be thinking "what?! COM+ and .Net you must be out of your mind!", but there are some places in this world where there still are a lot of COM+ components. I was just curious if someone ever faced this and if you figured out how to make this work.</p>
| [
{
"answer_id": 66513,
"author": "Euro Micelli",
"author_id": 2230,
"author_profile": "https://Stackoverflow.com/users/2230",
"pm_score": 3,
"selected": true,
"text": "void SomeMethod()\n{\n EnterpriseServicesInteropOption e = EnterpriseServicesInteropOption.Full;\n using (Transacti... | 2008/08/22 | [
"https://Stackoverflow.com/questions/21589",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1328/"
] |
21,593 | <p>What is the difference between using angle brackets and quotes in an <code>include</code> directive?</p>
<ul>
<li><code>#include <filename></code></li>
<li><code>#include "filename"</code></li>
</ul>
| [
{
"answer_id": 21594,
"author": "quest49",
"author_id": 2399,
"author_profile": "https://Stackoverflow.com/users/2399",
"pm_score": 11,
"selected": false,
"text": "#include <filename> #include \"filename\""
},
{
"answer_id": 41538,
"author": "Community",
"author_id": -1,
... | 2008/08/22 | [
"https://Stackoverflow.com/questions/21593",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2399/"
] |
21,635 | <p>I have a product which has been traditionally shipped as an MSI file. It is deployed through some sort of SMS push to thousands of desktops by our various clients. The software we use to create these installers is getting long in the tooth and we are looking to replace it. We have already standardized on InstallAnywhere for most of our products as we support many operating systems. Unfortunately InstallAnywhere cannot produce MSI files. </p>
<p>I am wondering if it is required that SMS use MSI files or if it can handle other installer types (.exe). If not, are there any open source programmes for creating MSI files? </p>
| [
{
"answer_id": 21650,
"author": "Chris",
"author_id": 2134,
"author_profile": "https://Stackoverflow.com/users/2134",
"pm_score": 2,
"selected": false,
"text": "MSI WiX 3.0 Dark"
},
{
"answer_id": 21726,
"author": "saschabeaumont",
"author_id": 592,
"author_profile": ... | 2008/08/22 | [
"https://Stackoverflow.com/questions/21635",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/361/"
] |
21,640 | <p>Is there a simple way in .NET to quickly get the current protocol, host, and port? For example, if I'm on the following URL:</p>
<p><code>http://www.mywebsite.com:80/pages/page1.aspx</code></p>
<p>I need to return:</p>
<p><code>http://www.mywebsite.com:80</code></p>
<p>I know I can use <code>Request.Url.AbsoluteUri</code> to get the complete URL, and I know I can use <code>Request.Url.Authority</code> to get the host and port, but I'm not sure of the best way to get the protocol without parsing out the URL string.</p>
<p>Any suggestions?</p>
| [
{
"answer_id": 21653,
"author": "Dale Ragan",
"author_id": 1117,
"author_profile": "https://Stackoverflow.com/users/1117",
"pm_score": 5,
"selected": false,
"text": "Uri url = Request.Url;\nstring protocol = url.Scheme;\n"
},
{
"answer_id": 22361,
"author": "Rick",
"autho... | 2008/08/22 | [
"https://Stackoverflow.com/questions/21640",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2076253/"
] |
21,647 | <p>The following <strong>C++</strong> code uses a <strong>ifstream</strong> object to read integers from a text file (which has one number per line) until it hits <strong>EOF</strong>. Why does it read the integer on the last line twice? How to fix this?</p>
<p><strong>Code:</strong></p>
<pre><code>#include <iostream>
#include <fstream>
using namespace std;
int main()
{
ifstream iFile("input.txt"); // input.txt has integers, one per line
while (!iFile.eof())
{
int x;
iFile >> x;
cerr << x << endl;
}
return 0;
}
</code></pre>
<p><strong>input.txt</strong>:</p>
<pre><code>10
20
30
</code></pre>
<p><strong>Output</strong>:</p>
<pre><code>10
20
30
30
</code></pre>
<p><strong>Note</strong>: I've skipped all error checking code to keep the code snippet small. The above behaviour is seen on Windows (Visual C++), cygwin (gcc) and Linux (gcc).</p>
| [
{
"answer_id": 21656,
"author": "wilhelmtell",
"author_id": 456,
"author_profile": "https://Stackoverflow.com/users/456",
"pm_score": 8,
"selected": true,
"text": "while (true) {\n int x;\n iFile >> x;\n if( iFile.eof() ) break;\n cerr << x << endl;\n}\n"
},
{
"answer... | 2008/08/22 | [
"https://Stackoverflow.com/questions/21647",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1630/"
] |
21,652 | <p>I have some code that gives a user id to a utility that then send email to that user.</p>
<pre><code>emailUtil.sendEmail(userId, "foo");
public void sendEmail(String userId, String message) throws MailException {
/* ... logic that could throw a MailException */
}
</code></pre>
<p><code>MailException</code> could be thrown for a number of reasons, problems with the email address, problems with the mail template etc.</p>
<p>My question is this: do you create a new Exception type for every one of these exceptions and then deal with them individually or do you create one MailException and then store something in the exception (something computer-readable, not the description text) that allows us to do different things based on what actually happened.</p>
<p><strong>Edit:</strong> As a clarification, the exceptions aren't for logs and what-not, this relates to how code reacts to them. To keep going with the mail example, let's say that when we send mail it could fail because you don't have an email address, or it could because you don't have a <strong>valid</strong> email address, or it could fail.. etc.</p>
<p>My code would want to react differently to each of these issues (mostly by changing the message returned to the client, but actual logic as well).</p>
<p>Would it be best to have an exception implementation for each one of these issues or one umbrella exception that had something internal to it (an enum say) that let the code distinguish what kind of issue it was.</p>
| [
{
"answer_id": 21858,
"author": "niklasfi",
"author_id": 2275,
"author_profile": "https://Stackoverflow.com/users/2275",
"pm_score": -1,
"selected": false,
"text": "throw new exception(\"WhatCausedIt\")\n"
},
{
"answer_id": 138532,
"author": "Mnementh",
"author_id": 21005... | 2008/08/22 | [
"https://Stackoverflow.com/questions/21652",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1666/"
] |
21,669 | <p>I didn't get the answer to this anywhere. What is the runtime complexity of a Regex match and substitution?</p>
<p>Edit: I work in python. But would like to know in general about most popular languages/tools (java, perl, sed).</p>
| [
{
"answer_id": 766514,
"author": "jpalecek",
"author_id": 51831,
"author_profile": "https://Stackoverflow.com/users/51831",
"pm_score": 3,
"selected": false,
"text": "O(m*n+m) m n m O(m) O(m^2+n) O(2^m) O(n^2*m) a*a*"
},
{
"answer_id": 63529950,
"author": "Peter Franek",
... | 2008/08/22 | [
"https://Stackoverflow.com/questions/21669",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1448/"
] |
21,697 | <p>I'm currently writing an ASP.Net app from the UI down. I'm implementing an MVP architecture because I'm sick of Winforms and wanted something that had a better separation of concerns.</p>
<p>So with MVP, the Presenter handles events raised by the View. Here's some code that I have in place to deal with the creation of users:</p>
<pre><code>public class CreateMemberPresenter
{
private ICreateMemberView view;
private IMemberTasks tasks;
public CreateMemberPresenter(ICreateMemberView view)
: this(view, new StubMemberTasks())
{
}
public CreateMemberPresenter(ICreateMemberView view, IMemberTasks tasks)
{
this.view = view;
this.tasks = tasks;
HookupEventHandlersTo(view);
}
private void HookupEventHandlersTo(ICreateMemberView view)
{
view.CreateMember += delegate { CreateMember(); };
}
private void CreateMember()
{
if (!view.IsValid)
return;
try
{
int newUserId;
tasks.CreateMember(view.NewMember, out newUserId);
view.NewUserCode = newUserId;
view.Notify(new NotificationDTO() { Type = NotificationType.Success });
}
catch(Exception e)
{
this.LogA().Message(string.Format("Error Creating User: {0}", e.Message));
view.Notify(new NotificationDTO() { Type = NotificationType.Failure, Message = "There was an error creating a new member" });
}
}
}
</code></pre>
<p>I have my main form validation done using the built in .Net Validation Controls, but now I need to verify that the data sufficiently satisfies the criteria for the Service Layer.</p>
<p>Let's say the following Service Layer messages can show up:</p>
<ul>
<li>E-mail account already exists (failure)</li>
<li>Refering user entered does not exist (failure)</li>
<li>Password length exceeds datastore allowed length (failure)</li>
<li>Member created successfully (success)</li>
</ul>
<p>Let's also say that more rules will be in the service layer that the UI cannot anticipate.</p>
<p>Currently I'm having the service layer throw an exception if things didn't go as planned. Is that a sufficent strategy? Does this code smell to you guys? If I wrote a service layer like this would you be annoyed at having to write Presenters that use it in this way? Return codes seem too old school and a bool is just not informative enough.</p>
<hr>
<blockquote>
<p><strong>Edit not by OP: merging in follow-up comments that were posted as answers by the OP</strong></p>
</blockquote>
<hr>
<p>Cheekysoft, I like the concept of a ServiceLayerException. I already have a global exception module for the exceptions that I don't anticipate. Do you find making all these custom exceptions tedious? I was thinking that catching base Exception class was a bit smelly but wasn't exactly sure how progress from there.</p>
<p>tgmdbm, I like the clever use of the lambda expression there!</p>
<hr>
<p>Thanks Cheekysoft for the follow-up. So I'm guessing that would be the strategy if you don't mind the user being displayed a separate page (I'm primarily a web developer) if the Exception is not handled.</p>
<p>However, if I want to return the error message in the same view where the user submitted the data that caused the error, I would then have to catch the Exception in the Presenter?</p>
<p>Here's what the CreateUserView looks like when the Presenter has handled the ServiceLayerException:</p>
<p><img src="https://i.stack.imgur.com/HOJU7.png" alt="Create a user"></p>
<p>For this kind of error, it's nice to report it to the same view. </p>
<p>Anyways, I think we're going beyond the scope of my original question now. I'll play around with what you've posted and if I need further details I'll post a new question.</p>
| [
{
"answer_id": 22043,
"author": "Cheekysoft",
"author_id": 1820,
"author_profile": "https://Stackoverflow.com/users/1820",
"pm_score": 5,
"selected": true,
"text": "try {\n // call service etc.\n // handle success to view\n} \ncatch (AccountAlreadyExistsException) {\n // set the messa... | 2008/08/22 | [
"https://Stackoverflow.com/questions/21697",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1894/"
] |
21,698 | <p>I'm trying to write a RegEx for a code generator (in C#) to determine a proper class or package name of an AS3 class.</p>
<p>I know that class names</p>
<ul>
<li>must start with a letter (capital or otherwise)</li>
<li>any other digit can be alphanumeric</li>
<li>cannot have spaces</li>
</ul>
<p>Is there anything else?</p>
| [
{
"answer_id": 22290,
"author": "Matt MacLean",
"author_id": 22,
"author_profile": "https://Stackoverflow.com/users/22",
"pm_score": 1,
"selected": false,
"text": "public class $Test {}\npublic class _Test {}\npublic class test {}\n"
},
{
"answer_id": 72319,
"author": "Iain",... | 2008/08/22 | [
"https://Stackoverflow.com/questions/21698",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1306/"
] |
21,715 | <p>Prior to C# generics, everyone would code collections for their business objects by creating a collection base that implemented IEnumerable</p>
<p>IE:</p>
<pre><code>public class CollectionBase : IEnumerable
</code></pre>
<p>and then would derive their Business Object collections from that.</p>
<pre><code>public class BusinessObjectCollection : CollectionBase
</code></pre>
<p>Now with the generic list class, does anyone just use that instead? I've found that I use a compromise of the two techniques:</p>
<pre><code>public class BusinessObjectCollection : List<BusinessObject>
</code></pre>
<p>I do this because I like to have strongly typed names instead of just passing Lists around.</p>
<p>What is <strong>your</strong> approach?</p>
| [
{
"answer_id": 21722,
"author": "Scott Muc",
"author_id": 1894,
"author_profile": "https://Stackoverflow.com/users/1894",
"pm_score": 2,
"selected": false,
"text": "public class BusinessObjectCollection : List<BusinessObject> {}\n public IEnumerable<BusinessObject> GetBusinessObjects();\... | 2008/08/22 | [
"https://Stackoverflow.com/questions/21715",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1965/"
] |
21,725 | <p>What are your favorite (G)Vim plugins/scripts?</p>
| [
{
"answer_id": 26092,
"author": "Konrad Rudolph",
"author_id": 1968,
"author_profile": "https://Stackoverflow.com/users/1968",
"pm_score": 4,
"selected": false,
"text": "ctags"
},
{
"answer_id": 58846,
"author": "Dominic Dos Santos",
"author_id": 5379,
"author_profile... | 2008/08/22 | [
"https://Stackoverflow.com/questions/21725",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2386/"
] |
21,749 | <p>I have a Delphi 7 application that has two views of a document (e.g. a WYSIWYG HTML edit might have a WYSIWYG view and a source view - not my real application). They can be opened in separate windows, or docked into tabs in the main window.</p>
<p>If I open a modal dialog from one of the separate forms, the main form is brought to the front, and is shown as the selected window in the windows taskbar. Say the main form is the WYSIWYG view, and the source view is poped out. You go to a particular point in the source view and insert an image tag. A dialog appears to allow you to select and enter the properties you want for the image. If the WYSIWYG view and the source view overlap, the WYSIWYG view will be brought to the front and the source view is hidden. Once the dialog is dismissed, the source view comes back into sight.</p>
<p>I've tried setting the owner and the ParentWindow properties to the form it is related to:</p>
<blockquote><code>dialog := TDialogForm.Create( parentForm );<br>
dialog.ParentWindow := parentForm.Handle;
</code></blockquote>
<p>How can I fix this problem? What else should I be trying?</p>
<p>Given that people seem to be stumbling on my example, perhaps I can try with a better example: a text editor that allows you to have more than one file open at the same time. The files you have open are either in tabs (like in the Delphi IDE) or in its own window. Suppose the user brings up the spell check dialog or the find dialog. What happens, is that if the file is being editing in its own window, that window is sent to below the main form in the z-order when the modal dialog is shown; once the dialog is closed, it is returned to its original z-order.</p>
<p><b>Note</b>: If you are using Delphi 7 and looking for a solution to this problem, see my answer lower down on the page to see what I ended up doing.</p>
| [
{
"answer_id": 21978,
"author": "Marius",
"author_id": 1008,
"author_profile": "https://Stackoverflow.com/users/1008",
"pm_score": 4,
"selected": true,
"text": "dialog := TDialogForm.Create( parentForm );\ndialog.PopupParent := parentForm;\ndialog.PopupMode := pmExplicit; \ndialog.Show... | 2008/08/22 | [
"https://Stackoverflow.com/questions/21749",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2219/"
] |
21,817 | <p>The topic says the most of it - what is the reason for the fact that static methods can't be declared in an interface?</p>
<pre><code>public interface ITest {
public static String test();
}
</code></pre>
<p>The code above gives me the following error (in Eclipse, at least): "Illegal modifier for the interface method ITest.test(); only public & abstract are permitted".</p>
| [
{
"answer_id": 21823,
"author": "Kyle Cronin",
"author_id": 658,
"author_profile": "https://Stackoverflow.com/users/658",
"pm_score": 4,
"selected": false,
"text": "Math.add(2, 3);\n"
},
{
"answer_id": 21845,
"author": "FlySwat",
"author_id": 1965,
"author_profile": "... | 2008/08/22 | [
"https://Stackoverflow.com/questions/21817",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2238/"
] |
21,848 | <p>There may be more than one way to ask this question, so here's a desciption of the problem. I was working on master and committed some stuff and then decided I wanted to put that work on hold. I backed up a few commits and then branched from before I started my crap work. Practically this works fine, I just now have a different branch as my main development branch. I'm wondering how I could change things around so I'm working on master again but it doesn't have my junk work and said work is on a different branch.</p>
<p>Some ways this could be asked/solved:
How do I rename my master branch to something else and then rename something else to master?
How do I back up master and then cause all commits I've backed up past to be on a different branch?</p>
<p>Thanks for all the (quick) answers! They're all good.</p>
| [
{
"answer_id": 21897,
"author": "olliej",
"author_id": 784,
"author_profile": "https://Stackoverflow.com/users/784",
"pm_score": 3,
"selected": false,
"text": "git checkout -b fake_master master # fake_master now points to the same commit as master\ngit branch -D master # g... | 2008/08/22 | [
"https://Stackoverflow.com/questions/21848",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2427/"
] |
21,877 | <p>What I want to achieve is this. I want to give the user the ability to upload an image file, store the image in BLOB in SQL Server, and then use this image as a logo in other pages of the site. </p>
<p>I have done this by using </p>
<pre><code> Response.Clear();
Response.ContentType = "image/pjpeg";
Response.BinaryWrite(imageConents);
Response.End();
</code></pre>
<p>but to do this, I use a User control in the place where I want to show the image. I want to do it if possible using an asp:Image control, or even a pure old html image control. Is this possible?</p>
| [
{
"answer_id": 21885,
"author": "FlySwat",
"author_id": 1965,
"author_profile": "https://Stackoverflow.com/users/1965",
"pm_score": 3,
"selected": false,
"text": "using System;\nusing System.Web;\n\nnamespace Example\n{ \n public class GetImage : IHttpHandler\n {\n\n public... | 2008/08/22 | [
"https://Stackoverflow.com/questions/21877",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/932/"
] |
21,879 | <p>I'm trying to reteach myself some long forgotten math skills. This is part of a much larger project to effectively "teach myself software development" from the ground up (the details are <a href="http://www.appscanadian.ca/archives/cs-101-introduction-to-computer-science/" rel="noreferrer">here</a> if you're interested in helping out). </p>
<p>My biggest stumbling block so far has been math - how can I learn about algorithms and asymptotic notation without it??</p>
<p>What I'm looking for is some sort of "dependency tree" showing what I need to know. Is calculus required before discrete? What do I need to know before calculus (read: components to the general "pre-calculus" topic)? What can I cut out to fast track the project ("what can I go back for later")?</p>
<p>Thank!</p>
| [
{
"answer_id": 21962,
"author": "Mark Harrison",
"author_id": 116,
"author_profile": "https://Stackoverflow.com/users/116",
"pm_score": 4,
"selected": true,
"text": "base:\n algebra\n trigonometry\n analytic geometry\n\ntrack 1 track 2 track 3... | 2008/08/22 | [
"https://Stackoverflow.com/questions/21879",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1588/"
] |
21,908 | <p>I'm working on a web application that needs to prints silently -- that is without user involvement. What's the best way to accomplish this? It doesn't like it can be done with strictly with Javascript, nor Flash and/or AIR. The closest I've seen involves a Java applet.</p>
<p>I can understand why it would a Bad Idea for just any website to be able to do this. This specific instance is for an internal application, and it's perfectly acceptable if the user needs to add the URL to a trusted site list, install an addon, etc.</p>
| [
{
"answer_id": 21924,
"author": "Espo",
"author_id": 2257,
"author_profile": "https://Stackoverflow.com/users/2257",
"pm_score": 3,
"selected": false,
"text": "<script>\nfunction Print() {\n alert (\"THUD.. another tree bites the dust!\")\n if (document.layers)\n {\n window.print()... | 2008/08/22 | [
"https://Stackoverflow.com/questions/21908",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/181/"
] |
21,934 | <p>Python uses the reference count method to handle object life time. So an object that has no more use will be immediately destroyed.</p>
<p>But, in Java, the GC(garbage collector) destroys objects which are no longer used at a specific time.</p>
<p>Why does Java choose this strategy and what is the benefit from this?</p>
<p>Is this better than the Python approach?</p>
| [
{
"answer_id": 22219,
"author": "Eli Courtwright",
"author_id": 1694,
"author_profile": "https://Stackoverflow.com/users/1694",
"pm_score": 4,
"selected": false,
"text": "def parse_some_attrs(fname):\n return open(fname).read().split(\"~~~\")[2:4]\n def parse_some_attrs(fname):\n w... | 2008/08/22 | [
"https://Stackoverflow.com/questions/21934",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1556/"
] |
21,938 | <p>Whilst analysing some legacy code with FXCop, it occurred to me is it really that bad to catch a general exception error within a try block or should you be looking for a specific exception. Thoughts on a postcard please.</p>
| [
{
"answer_id": 21942,
"author": "Philippe",
"author_id": 920,
"author_profile": "https://Stackoverflow.com/users/920",
"pm_score": 3,
"selected": false,
"text": "IOException NullPointerException Exception"
},
{
"answer_id": 21950,
"author": "John",
"author_id": 2168,
... | 2008/08/22 | [
"https://Stackoverflow.com/questions/21938",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1731/"
] |
21,956 | <p>I have two arrays of <code>System.Data.DataRow</code> objects which I want to compare. </p>
<p>The rows have two columns A and B. Column A is a key and I want to find out which rows have had their B column changed and which rows have been added or deleted. </p>
<p><strong>How do I do this in PowerShell?</strong></p>
| [
{
"answer_id": 48471891,
"author": "Dongminator",
"author_id": 1178960,
"author_profile": "https://Stackoverflow.com/users/1178960",
"pm_score": 1,
"selected": false,
"text": "foreach ($property in ($row1 | Get-Member -MemberType Property)) {\n $pName = $property.Name\n\n if ($row1... | 2008/08/22 | [
"https://Stackoverflow.com/questions/21956",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/966/"
] |
21,961 | <pre><code>>>> import time
>>> time.strptime("01-31-2009", "%m-%d-%Y")
(2009, 1, 31, 0, 0, 0, 5, 31, -1)
>>> time.mktime((2009, 1, 31, 0, 0, 0, 5, 31, -1))
1233378000.0
>>> 60*60*24 # seconds in a day
86400
>>> 1233378000.0 / 86400
14275.208333333334
</code></pre>
<p><code>time.mktime</code> should return the number of seconds since the epoch. Since I'm giving it a time at midnight and the epoch is at midnight, shouldn't the result be evenly divisible by the number of seconds in a day?</p>
| [
{
"answer_id": 21973,
"author": "Anders Eurenius",
"author_id": 1421,
"author_profile": "https://Stackoverflow.com/users/1421",
"pm_score": 2,
"selected": false,
"text": "mktime(...)\n mktime(tuple) -> floating point number\n\n Convert a time tuple in local time to seconds since th... | 2008/08/22 | [
"https://Stackoverflow.com/questions/21961",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2427/"
] |
21,987 | <p>I am developing an application that controls an Machine.<br/>
When I receive an error from the Machine the users should be able to directly notice it, one way that is done is Flashing the tray on the taskbar. When the machine clears the error the tray should stop flashing.</p>
<p>There's one little annoyance using the <code>FlashWindowEx</code> function, when I clear the flashing of the window, it stays (in my case WinXP) orange (not flashing).</p>
<p><a href="https://i.stack.imgur.com/GOS2r.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/GOS2r.gif" alt="" /></a></p>
<pre><code>[Flags]
public enum FlashMode {
/// <summary>
/// Stop flashing. The system restores the window to its original state.
/// </summary>
FLASHW_STOP = 0,
/// <summary>
/// Flash the window caption.
/// </summary>
FLASHW_CAPTION = 1,
/// <summary>
/// Flash the taskbar button.
/// </summary>
FLASHW_TRAY = 2,
/// <summary>
/// Flash both the window caption and taskbar button.
/// This is equivalent to setting the FLASHW_CAPTION | FLASHW_TRAY flags.
/// </summary>
FLASHW_ALL = 3,
/// <summary>
/// Flash continuously, until the FLASHW_STOP flag is set.
/// </summary>
FLASHW_TIMER = 4,
/// <summary>
/// Flash continuously until the window comes to the foreground.
/// </summary>
FLASHW_TIMERNOFG = 12
}
public static bool FlashWindowEx(IntPtr hWnd, FlashMode fm) {
FLASHWINFO fInfo = new FLASHWINFO();
fInfo.cbSize = Convert.ToUInt32(Marshal.SizeOf(fInfo));
fInfo.hwnd = hWnd;
fInfo.dwFlags = (UInt32)fm;
fInfo.uCount = UInt32.MaxValue;
fInfo.dwTimeout = 0;
return FlashWindowEx(ref fInfo);
}
[StructLayout(LayoutKind.Sequential)]
public struct FLASHWINFO {
public UInt32 cbSize;
public IntPtr hwnd;
public UInt32 dwFlags;
public UInt32 uCount;
public UInt32 dwTimeout;
}
</code></pre>
<p>In my case I use <code>FLASHW_TRAY</code> to start flashing and <code>FLASHW_STOP</code> to stop the flashing.</p>
<p>Am I doing something wrong or is this a known bug of WinXP and is there a fix for it?</p>
| [
{
"answer_id": 23285,
"author": "TheSmurf",
"author_id": 1975282,
"author_profile": "https://Stackoverflow.com/users/1975282",
"pm_score": 4,
"selected": true,
"text": "FLASHW_STOP"
},
{
"answer_id": 37615,
"author": "Stormenet",
"author_id": 2090,
"author_profile": "... | 2008/08/22 | [
"https://Stackoverflow.com/questions/21987",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2090/"
] |
21,992 | <p>I'm looking for (arguably) the correct way to return data from a <code>XmlHttpRequest</code>. Options I see are:</p>
<ul>
<li><p><strong>Plain HTML</strong>. Let the request format the data and return it in a usable format.<br>
<em>Advantage</em>: easy to consume by the calling page.<br><em>Disadvantage</em>: Very rigid, stuck with a fixed layout.</p></li>
<li><p><strong>XML</strong>. Let the request return XML, format it using XSLT on the calling page.<br><em>Advantage</em>: the requested service is easily consumed by other sources.<br><em>Disadvantage</em>: Is browser support for XSLT good enough?</p></li>
<li><p><strong>JSON</strong>. Let the request return JSON, consume it using javascript, render HTML accordingly.<br><em>Advantage</em>: easier to 'OO-ify' the javascript making the request. <br><em>Disadvantage</em>: Probably not as easy to use as the previous two options.</p></li>
</ul>
<p>I've also thought about going for option one while abstracting the view logic in the called service in such a way that switching in and out different layouts would be trivial. Personally I think this option is the best out of three, for compatibility reasons.</p>
<p>While typing this, I got another insight. Would it be a good idea to allow all three response formats, based on a parameter added to the request?</p>
| [
{
"answer_id": 22002,
"author": "Hrvoje Hudo",
"author_id": 1407,
"author_profile": "https://Stackoverflow.com/users/1407",
"pm_score": 0,
"selected": false,
"text": "JSON OO js"
}
] | 2008/08/22 | [
"https://Stackoverflow.com/questions/21992",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/909/"
] |
21,999 | <p>Anti aliasing <a href="http://forums.msdn.microsoft.com/en-US/wpf/thread/1ad9a62a-d1a4-4ca2-a950-3b7bf5240de5" rel="noreferrer">cannot be turned off</a> in WPF. But I want to remove the blurred look of WPF fonts when they are small. </p>
<p>One possibility would be to use a .net 2.0 component. This looks like it would lose the transparency capability and Blend support. Never tried it though.</p>
<p>Anyone has a solution for this? Any drawbacks from it?</p>
<p>Thank you</p>
| [
{
"answer_id": 6943415,
"author": "Wolkenjaeger",
"author_id": 408659,
"author_profile": "https://Stackoverflow.com/users/408659",
"pm_score": 3,
"selected": false,
"text": "TextOptions.TextFormattingMode=\"Display\"\n"
}
] | 2008/08/22 | [
"https://Stackoverflow.com/questions/21999",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1013/"
] |
22,000 | <p>I've created a map system for a game that runs on the principle of drawing the picture of the map from tiles. There are many reasons for this which I won't go into here but if you really want to know then I'm sure you can find out how to contact me ;)</p>
<p>I have <a href="http://woarl.com/board/rob.php?mode=map&x=-1&y=9&w=2&h=2" rel="noreferrer">made the latest version live</a> so you can see exactly where the problem lies and the source. The issue is the line between the top 2 tiles and the bottom 2 tiles, I can't figure out why it's gone like this and any help would be appreciated.</p>
<p>In the source is a marker called "stackoverflow", if you search for "stackoverflow" when viewing source then it should take you to the table in question.</p>
<p>I have also uploaded an <a href="http://woarl.com/badMap.png" rel="noreferrer">image of the issue</a>.</p>
| [
{
"answer_id": 22013,
"author": "samjudson",
"author_id": 1908,
"author_profile": "https://Stackoverflow.com/users/1908",
"pm_score": 2,
"selected": false,
"text": "<img> </td> <td>\n <img src=\"image.jpg\"/>\n</td>\n <td><img src=\"image.jpg\"/></td>\n"
},
{
"answer_id": 22016,
... | 2008/08/22 | [
"https://Stackoverflow.com/questions/22000",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1384652/"
] |
22,001 | <p>I'm learning objective-C and Cocoa. In the Apple tutorial I'm working through there's a side note that says: </p>
<blockquote>
<p><code>IBOutlet</code> is a null-defined macro, which the C preprocessor removes at compile time.</p>
</blockquote>
<p>I'm curious - what's a null-defined macro?</p>
| [
{
"answer_id": 22003,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 3,
"selected": false,
"text": "#define IBOutlet\n"
},
{
"answer_id": 22455,
"author": "Matt Dillard",
"author_id": 863,
"author_profi... | 2008/08/22 | [
"https://Stackoverflow.com/questions/22001",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
22,012 | <p>My application dynamically loads assemblies at runtime from specific subfolders. These assemblies are compiled with dependencies to other assemblies. The runtime trys to load these from the application directory. But I want to put them into the modules directory.</p>
<p>Is there a way to tell the runtime that the dlls are in a seperate subfolder?</p>
| [
{
"answer_id": 22022,
"author": "samjudson",
"author_id": 1908,
"author_profile": "https://Stackoverflow.com/users/1908",
"pm_score": 2,
"selected": false,
"text": "<probing> <configuration>\n <runtime>\n <assemblyBinding xmlns=\"urn:schemas-microsoft-com:asm.v1\">\n <probing privat... | 2008/08/22 | [
"https://Stackoverflow.com/questions/22012",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2374/"
] |
22,106 | <p>In Linux, what is the difference between <code>/dev/ttyS0</code> and <code>/dev/ttys0</code>?</p>
<p>I know that the first is a serial port, but what about the second, with the small <code>s</code>?</p>
| [
{
"answer_id": 22124,
"author": "Espo",
"author_id": 2257,
"author_profile": "https://Stackoverflow.com/users/2257",
"pm_score": 0,
"selected": false,
"text": "3 char Pseudo-TTY slaves\n 0 = /dev/ttyp0 First PTY slave\n 1 = /dev/ttyp1 Second PTY slave\n ...\n ... | 2008/08/22 | [
"https://Stackoverflow.com/questions/22106",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1585/"
] |
22,115 | <p>I am writing a Java utility that helps me to generate loads of data for performance testing. It would be <em>really</em> cool to be able to specify a regex for Strings so that my generator spits out things that match this.</p>
<p>Is something out there already baked that I can use to do this? Or is there a library that gets me most of the way there?</p>
| [
{
"answer_id": 22133,
"author": "Cheekysoft",
"author_id": 1820,
"author_profile": "https://Stackoverflow.com/users/1820",
"pm_score": 7,
"selected": true,
"text": "dk.brics.automaton"
},
{
"answer_id": 245381,
"author": "J Wynia",
"author_id": 1124,
"author_profile":... | 2008/08/22 | [
"https://Stackoverflow.com/questions/22115",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2455/"
] |
22,135 | <p>I am trying to implement NTLM authentication on one of our internal sites and everything is working. The one piece of the puzzle I do not have is how to take the information from NTLM and authenticate with Active Directory.</p>
<p>There is a <a href="http://www.innovation.ch/personal/ronald/ntlm.html" rel="nofollow noreferrer">good description of NTLM</a> and the <a href="http://us1.samba.org/samba/docs/man/Samba-Developers-Guide/pwencrypt.html" rel="nofollow noreferrer">encryption used for the passwords</a>, which I used to implement this, but I am not sure of how to verify if the user's password is valid.</p>
<p>I am using ColdFusion but a solution to this problem can be in any language (Java, Python, PHP, etc).</p>
<p>Edit:</p>
<p>I am using ColdFusion on Redhat Enterprise Linux. Unfortunately we cannot use IIS to manage this and instead have to write or use a 3rd party tool for this.</p>
<hr>
<p><strong>Update</strong> - <em>I got this working and here is what I did</em></p>
<p>I went with the <a href="http://jcifs.samba.org/" rel="nofollow noreferrer">JCIFS library from samba.org.</a></p>
<blockquote>
<p>Note that the method below will only work with NTLMv1 and <strong>DOES NOT</strong> work with NTLMv2. If you are unable to use NTLMv1 you can try <a href="http://www.ioplex.com/jespa.html" rel="nofollow noreferrer">Jespa</a>, which supports NTLMv2 but is not open source, or you can use <a href="http://spnego.sourceforge.net" rel="nofollow noreferrer">Kerberos/SPNEGO.</a></p>
</blockquote>
<p>Here is my web.xml:</p>
<pre><code><web-app>
<display-name>Ntlm</display-name>
<filter>
<filter-name>NtlmHttpFilter</filter-name>
<filter-class>jcifs.http.NtlmHttpFilter</filter-class>
<init-param>
<param-name>jcifs.http.domainController</param-name>
<param-value>dc01.corp.example.com</param-value>
</init-param>
<init-param>
<param-name>jcifs.smb.client.domain</param-name>
<param-value>CORP.EXAMPLE.COM</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>NtlmHttpFilter</filter-name>
<url-pattern>/admin/*</url-pattern>
</filter-mapping>
</web-app>
</code></pre>
<p>Now all URLs matching <code>/admin/*</code> will require NTLM authentication.</p>
| [
{
"answer_id": 464096,
"author": "user8134",
"author_id": 8134,
"author_profile": "https://Stackoverflow.com/users/8134",
"pm_score": 4,
"selected": false,
"text": "yum install samba-winbind yum install mod_auth_ntlm_winbind"
}
] | 2008/08/22 | [
"https://Stackoverflow.com/questions/22135",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/309844/"
] |
22,140 | <p>As part of our product release we ship Apache HTTP Server binaries that we have compiled on our (UNIX) development machine.</p>
<p>We tell our clients to install the binaries (on their UNIX servers) under the same directory structure that we compiled it under. For some clients this is not appropriate, e.g. where there are restrictions on where they can install software on their servers and they don't want to compile Apache themselves.</p>
<p>Is there a way of compiling Apache HTTP Server so its installation location(s) can be specified dynamically using environment variables ?</p>
<p>I spent a few days trying to sort this out and couldn't find a way to do it. It led me to believe that the Apache binaries were hard coding some directory paths at compilation preventing the portability we require.</p>
<p>Has anyone managed to do this ?</p>
| [
{
"answer_id": 27644,
"author": "wvdschel",
"author_id": 2018,
"author_profile": "https://Stackoverflow.com/users/2018",
"pm_score": 0,
"selected": false,
"text": "/opt/my_apache2/"
},
{
"answer_id": 27902,
"author": "Hissohathair",
"author_id": 2997,
"author_profile"... | 2008/08/22 | [
"https://Stackoverflow.com/questions/22140",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/381/"
] |
22,156 | <p>I've been using user controls extensively but never use a HttpHandler and was wondering if I am doing something suboptimal or wrong</p>
| [
{
"answer_id": 22171,
"author": "Vaibhav",
"author_id": 380,
"author_profile": "https://Stackoverflow.com/users/380",
"pm_score": 0,
"selected": false,
"text": "Asp.Net HttpHandler public class Page : TemplateControl, IHttpHandler\n"
}
] | 2008/08/22 | [
"https://Stackoverflow.com/questions/22156",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2385/"
] |
22,165 | <p>I have a need to create a "transactional" process using an external API that does not support COM+ or .NET transactions (Sharepoint to be exact)</p>
<p>What I need to do is to be able to perform a number of processes in a sequence, but any failure in that sequence means that I will have to manually undo all of the previous steps. In my case there are only 2 types of step, both af which are fairly easy to undo/roll back.</p>
<p>Does anyony have any suggestions for design patterns or structures that could be usefull for this ?</p>
| [
{
"answer_id": 22220,
"author": "vitule",
"author_id": 1287,
"author_profile": "https://Stackoverflow.com/users/1287",
"pm_score": 3,
"selected": true,
"text": "Update() SPList.Update() SPWeb.Update()"
}
] | 2008/08/22 | [
"https://Stackoverflow.com/questions/22165",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/983/"
] |
22,181 | <p>I have a very simple mapping function called "BuildEntity" that does the usual boring "left/right" coding required to dump my reader data into my domain object. (shown below) My question is this - If I don't bring back every column in this mapping as is, I get the "System.IndexOutOfRangeException" exception and wanted to know if ado.net had anything to correct this so I don't need to bring back every column with each call into SQL ... </p>
<p>What I'm really looking for is something like "IsValidColumn" so I can keep this 1 mapping function throughout my DataAccess class with all the left/right mappings defined - and have it work even when a sproc doesn't return every column listed ...</p>
<pre><code>Using reader As SqlDataReader = cmd.ExecuteReader()
Dim product As Product
While reader.Read()
product = New Product()
product.ID = Convert.ToInt32(reader("ProductID"))
product.SupplierID = Convert.ToInt32(reader("SupplierID"))
product.CategoryID = Convert.ToInt32(reader("CategoryID"))
product.ProductName = Convert.ToString(reader("ProductName"))
product.QuantityPerUnit = Convert.ToString(reader("QuantityPerUnit"))
product.UnitPrice = Convert.ToDouble(reader("UnitPrice"))
product.UnitsInStock = Convert.ToInt32(reader("UnitsInStock"))
product.UnitsOnOrder = Convert.ToInt32(reader("UnitsOnOrder"))
product.ReorderLevel = Convert.ToInt32(reader("ReorderLevel"))
productList.Add(product)
End While
</code></pre>
| [
{
"answer_id": 22189,
"author": "Matt Hamilton",
"author_id": 615,
"author_profile": "https://Stackoverflow.com/users/615",
"pm_score": 0,
"selected": false,
"text": "reader.GetOrdinal GetOrdinal IndexOutOfRangeException Dictionary<string, int> ContainsKey"
},
{
"answer_id": 2219... | 2008/08/22 | [
"https://Stackoverflow.com/questions/22181",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
22,187 | <p>What libraries exist for other programming languages to provide an Erlang-style concurrency model (processes, mailboxes, pattern-matching receive, etc.)?</p>
<p>Note: I am specifically interested in things that are intended to be similar to Erlang, not just any threading or queueing library.</p>
| [
{
"answer_id": 22285,
"author": "jcsalterego",
"author_id": 1416,
"author_profile": "https://Stackoverflow.com/users/1416",
"pm_score": 4,
"selected": true,
"text": "#define N 100000\nint main(int argc, char *argv[])\n{\n int i, a[N];\n #pragma omp parallel for\n for (i=0;i<N;i++) \n ... | 2008/08/22 | [
"https://Stackoverflow.com/questions/22187",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1175/"
] |
22,239 | <p>(I'm using Visual C++ 2008) I've always heard that main() is <em>required</em> to return an integer, but here I didn't put in <code>return 0;</code> and and it compiled with 0 errors and 0 warnings! In the debug window it says the program has exited with code 0. If this function is named anything other than main(), the compiler complains saying 'blah' must return a value. Sticking a <code>return;</code> also causes the error to appear. But leaving it out completely, it compiles just fine.</p>
<pre><code>#include <iostream>
using namespace std;
int main()
{
cout << "Hey look I'm supposed to return an int but I'm not gonna!\n";
}
</code></pre>
<p>Could this be a bug in VC++?</p>
| [
{
"answer_id": 22262,
"author": "sparkes",
"author_id": 269,
"author_profile": "https://Stackoverflow.com/users/269",
"pm_score": 7,
"selected": true,
"text": "main int int main() { /* ... */ }\n int main(int argc, char* argv[]) {\n/* ... */\n}\n return main exit main"
},
{
"answ... | 2008/08/22 | [
"https://Stackoverflow.com/questions/22239",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2222/"
] |
22,245 | <p>I have multiple projects in a couple of different workspaces. However, it seems like I can never figure out how to change my current workspace. The result is that files that I have checked out on my machine are shown to be checked out by somebody else and are not accessible.</p>
| [
{
"answer_id": 58591630,
"author": "Vishal Sareen",
"author_id": 12285975,
"author_profile": "https://Stackoverflow.com/users/12285975",
"pm_score": 0,
"selected": false,
"text": "File -> Source Control -> Advanced -> Workspace"
}
] | 2008/08/22 | [
"https://Stackoverflow.com/questions/22245",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
22,259 | <p>I want to allow users to upload avatar-type images in a variety of formats (<strong>GIF, JPEG, and PNG at least</strong>), but to save them all as <strong>PNG database BLOBs</strong>. If the images are oversized, pixelwise, I want to resize them before DB-insertion.</p>
<p><strong>What is the best way to use GD to do the resizing and PNG conversion?</strong></p>
<p>Edit: Sadly, only <a href="http://php.net/manual/en/book.image.php" rel="nofollow noreferrer">GD</a> is available on the server I need to use, no <a href="http://www.imagemagick.org/script/index.php" rel="nofollow noreferrer">ImageMagick</a>.</p>
| [
{
"answer_id": 22333,
"author": "Andy",
"author_id": 1993,
"author_profile": "https://Stackoverflow.com/users/1993",
"pm_score": 2,
"selected": false,
"text": "\n<?php\n //Input file\n $file = \"myImage.png\";\n $img = ImageCreateFromPNG($file);\n\n //Dimensions\n $width = imag... | 2008/08/22 | [
"https://Stackoverflow.com/questions/22259",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1820/"
] |
22,269 | <p>I'm trying to build a C# console application to automate grabbing certain files from our website, mostly to save myself clicks and - frankly - just to have done it. But I've hit a snag that for which I've been unable to find a working solution.</p>
<p>The website I'm trying to which I'm trying to connect uses ASP.Net forms authorization, and I cannot figure out how to authenticate myself with it. This application is a complete hack so I can hard code my username and password or any other needed auth info, and the solution itself doesn't need to be something that is viable enough to release to general users. In other words, if the only possible solution is a hack, I'm fine with that.</p>
<p>Basically, I'm trying to use HttpWebRequest to pull the site that has the list of files, iterating through that list and then downloading what I need. So the actual work on the site is fairly trivial once I can get the website to consider me authorized.</p>
| [
{
"answer_id": 22333,
"author": "Andy",
"author_id": 1993,
"author_profile": "https://Stackoverflow.com/users/1993",
"pm_score": 2,
"selected": false,
"text": "\n<?php\n //Input file\n $file = \"myImage.png\";\n $img = ImageCreateFromPNG($file);\n\n //Dimensions\n $width = imag... | 2008/08/22 | [
"https://Stackoverflow.com/questions/22269",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/111/"
] |
22,322 | <p>I've got a problem similar to,but subtly different from, that described <a href="https://stackoverflow.com/questions/22012/loading-assemblies-and-its-dependencies">here</a> (Loading assemblies and their dependencies).</p>
<p>I have a C++ DLL for 3D rendering that is what we sell to customers. For .NET users we will have a CLR wrapper around it. The C++ DLL can be built in both 32 and 64bit versions, but I think this means we need to have two CLR wrappers since the CLR binds to a specific DLL? </p>
<p>Say now our customer has a .NET app that can be either 32 or 64bit, and that it being a pure .NET app it leaves the CLR to work it out from a single set of assemblies. The question is how can the app code dynamically choose between our 32 and 64bit CLR/DLL combinations at run-time?</p>
<p>Even more specifically, is the suggested answer to the aforementioned question applicable here too (i.e. create a ResolveEvent handler)?</p>
| [
{
"answer_id": 479664,
"author": "Greg Whitfield",
"author_id": 2102,
"author_profile": "https://Stackoverflow.com/users/2102",
"pm_score": 4,
"selected": true,
"text": "static void Main(String[] argv)\n {\n // Create a new AppDomain, but with the base directory set to either the 32... | 2008/08/22 | [
"https://Stackoverflow.com/questions/22322",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2102/"
] |
22,326 | <p>I am trying to <strong>replace the current selection in Word (2003/2007)</strong> by some <strong>RTF string</strong> stored in a variable.</p>
<p>Here is the current code:</p>
<pre><code>Clipboard.SetText(strRTFString, TextDataFormat.Rtf)
oWord.ActiveDocument.ActiveWindow.Selection.PasteAndFormat(0)
</code></pre>
<p>Is there any way to do the same thing without going through the clipboard. Or is there any way to push the clipboard data to a safe place and restore it after?</p>
| [
{
"answer_id": 22335,
"author": "samjudson",
"author_id": 1908,
"author_profile": "https://Stackoverflow.com/users/1908",
"pm_score": -1,
"selected": false,
"text": "RichTextBox r = new RichTextBox();\nr.Rtf = strRTFString;\nConsole.WriteLine(r.Text);\n"
},
{
"answer_id": 27425,
... | 2008/08/22 | [
"https://Stackoverflow.com/questions/22326",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1508/"
] |
22,354 | <p>I am working on a SharePoint application that supports importing multiple documents in a single operation. I also have an ItemAdded event handler that performs some basic maintenance of the item metadata. This event fires for both imported documents and manually created ones. The final piece of the puzzle is a batch operation feature that I implemented to kick off a workflow and update another metadata field.</p>
<p>I am able to cause a COMException 0x81020037 by extracting the file data of a SPListItem. This file is just an InfoPath form/XML document. I am able to modify the XML and sucessfully push it back into the SPListItem. When I fire off the custom feature immediately afterwards and modify metadata, it occassionally causes the COM error.</p>
<p>The error message basically indicates that the file was modified by another thread. It would seem that the ItemAdded event is still writing the file back to the database while the custom feature is changing metadata. I have tried putting in delays and error catching loops to try to detect that the SPListItem is safe to modify with little success.</p>
<p>Is there a way to tell if another thread has a lock on a document?</p>
| [
{
"answer_id": 22703,
"author": "vitule",
"author_id": 1287,
"author_profile": "https://Stackoverflow.com/users/1287",
"pm_score": 1,
"selected": false,
"text": "ItemAdded ItemUpdated ItemAdded() ItemAdded() private static object myLock = new object();\npublic override void ItemAdded(SPI... | 2008/08/22 | [
"https://Stackoverflow.com/questions/22354",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2470/"
] |
22,356 | <p>I find that the .NET event model is such that I'll often be raising an event on one thread and listening for it on another thread. I was wondering what the cleanest way to marshal an event from a background thread onto my UI thread is.</p>
<p>Based on the community suggestions, I've used this:</p>
<pre><code>// earlier in the code
mCoolObject.CoolEvent+=
new CoolObjectEventHandler(mCoolObject_CoolEvent);
// then
private void mCoolObject_CoolEvent(object sender, CoolObjectEventArgs args)
{
if (InvokeRequired)
{
CoolObjectEventHandler cb =
new CoolObjectEventHandler(
mCoolObject_CoolEvent);
Invoke(cb, new object[] { sender, args });
return;
}
// do the dirty work of my method here
}
</code></pre>
| [
{
"answer_id": 22387,
"author": "Konrad Rudolph",
"author_id": 1968,
"author_profile": "https://Stackoverflow.com/users/1968",
"pm_score": 4,
"selected": false,
"text": "private void mCoolObject_CoolEvent(object sender, CoolObjectEventArgs args)\n{\n if (InvokeRequired)\n {\n ... | 2008/08/22 | [
"https://Stackoverflow.com/questions/22356",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1490/"
] |
22,358 | <p>Is there any way to tinker with the iPhone SDK on a Windows machine? Are there plans for an iPhone SDK version for Windows?</p>
<p>The only other way I can think of doing this is to run a Mac VM image on a <strong>VMWare</strong> server running on Windows, although I'm not too sure how legal this is.</p>
| [
{
"answer_id": 1532802,
"author": "Keith Adler",
"author_id": 135952,
"author_profile": "https://Stackoverflow.com/users/135952",
"pm_score": 4,
"selected": false,
"text": "Adobe Flash CS 5 iPhone Windows"
},
{
"answer_id": 6022718,
"author": "priamos",
"author_id": 75629... | 2008/08/22 | [
"https://Stackoverflow.com/questions/22358",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2454/"
] |
22,379 | <p>I'm wondering how you can implement a program similar to <code>tail -f</code> in C/C++, a program that watches for and processes new lines added to a log file?</p>
| [
{
"answer_id": 22399,
"author": "jj33",
"author_id": 430,
"author_profile": "https://Stackoverflow.com/users/430",
"pm_score": 4,
"selected": true,
"text": "wembley 0 /home/jj33/swap >#> cat p\nmy $f = shift;\nopen(I, \"<$f\") || die \"Couldn't open $f: $!\\n\";\n\nwhile (1) {\n seek(I,... | 2008/08/22 | [
"https://Stackoverflow.com/questions/22379",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/486/"
] |
22,401 | <p>I'm looking at the <a href="http://www.php.net/manual/en/" rel="noreferrer">PHP Manual</a>, and I'm not seeing a section on data structures that most languages have, such as lists and sets. Am I just blind or does PHP not have anything like this built in?</p>
| [
{
"answer_id": 22405,
"author": "Konrad Rudolph",
"author_id": 1968,
"author_profile": "https://Stackoverflow.com/users/1968",
"pm_score": 3,
"selected": false,
"text": "$lst = array(1, 2, 3);\n$hsh = array(1 => \"This\", 2 => \"is a\", 3 => \"test\");\n"
},
{
"answer_id": 22412,... | 2008/08/22 | [
"https://Stackoverflow.com/questions/22401",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/572/"
] |
22,409 | <p>I have a need to convert images from CMYK to RGB - not necessarily back again, but hey, if it can be done...</p>
<p>With the release of ColdFusion 8, we got the <a href="http://cfquickdocs.com/cf8/?getDoc=cfimage" rel="nofollow noreferrer">CFImage</a> tag, but it doesn't support this conversion; and nor does <a href="http://x.com" rel="nofollow noreferrer">Image.cfc</a>, or <a href="http://x.com" rel="nofollow noreferrer">Alagad's Image Component</a>.</p>
<p>However, it should be possible in Java; which we can leverage through CF. For example, here's how you might create a Java thread to sleep a process:</p>
<pre><code><cfset jthread = createObject("java", "java.lang.Thread")/>
<cfset jthread.sleep(5000)/>
</code></pre>
<p>I would guess a similar method could be used to leverage java to do this image conversion, but not being a Java developer, I don't have a clue where to start. Can anyone lend a hand here?</p>
| [
{
"answer_id": 848533,
"author": "Randy Stegbauer",
"author_id": 34301,
"author_profile": "https://Stackoverflow.com/users/34301",
"pm_score": 4,
"selected": true,
"text": "package cmyk;\n\nimport java.awt.color.ColorSpace;\nimport java.awt.image.BufferedImage;\nimport java.awt.image.Col... | 2008/08/22 | [
"https://Stackoverflow.com/questions/22409",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/751/"
] |
22,417 | <p>Say I have a Student table, it's got an int ID. I have a fixed set of 10 multiple choice questions with 5 possible answers. I have a normalized answer table that has the question id, the Student.answer (1-5) and the Student.ID</p>
<p>I'm trying to write a single query that will return all scores over a certain pecentage. To this end I wrote a simple UDF that accepts the Student.answers and the correct answer, so it has 20 parameters.</p>
<p>I'm starting to wonder if it's better to denormalize the answer table, bring it into my applcation and let my application do the scoring.</p>
<p>Anyone ever tackle something like this and have insight? </p>
| [
{
"answer_id": 22448,
"author": "Dave Ward",
"author_id": 60,
"author_profile": "https://Stackoverflow.com/users/60",
"pm_score": 3,
"selected": true,
"text": "select student_name, score\nfrom students\n join (select student_answers.student_id, count(*) as score\n from student_an... | 2008/08/22 | [
"https://Stackoverflow.com/questions/22417",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1975/"
] |
22,429 | <p>Is it possible to embed an inline search box into a web page which provides similar functionality to the <a href="http://www.ie7pro.com/inline-search.html" rel="noreferrer">IE7Pro Inline Search</a> or similar plugins for Firefox/Safari?</p>
| [
{
"answer_id": 22448,
"author": "Dave Ward",
"author_id": 60,
"author_profile": "https://Stackoverflow.com/users/60",
"pm_score": 3,
"selected": true,
"text": "select student_name, score\nfrom students\n join (select student_answers.student_id, count(*) as score\n from student_an... | 2008/08/22 | [
"https://Stackoverflow.com/questions/22429",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2418/"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.