qid
int64
4
22.2M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
167,502
<p>This is the page that I'm having. But the resize part in the section does not seem to be working. I copied most of the code from the <a href="http://www.asp.net/ajax/ajaxcontroltoolkit/samples/UpdatePanelAnimation/UpdatePanelAnimation.aspx" rel="nofollow noreferrer">Ajax site</a>. I placed a alert() in the tag (line 108) to find the value of 'b._originalHeight' and it shows up as '44'. I have also tried the code in the above-said tutorial (line 132) and that did not work either. (I'm not sure where it is getting this value from. But I need it to show all the controls on the form.</p> <pre><code>&lt;%@ Control Language="C#" AutoEventWireup="true" CodeBehind="AddEditContest.ascx.cs" Inherits="TMPInternational.Spawn2DotComAdmin.Contest.UserControls.AddEditContest" %&gt; &lt;%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="uc" %&gt; &lt;%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI" TagPrefix="asp" %&gt; &lt;%@ Register TagPrefix="ew" Assembly="eWorld.UI, Version=1.9.0.0, Culture=neutral, PublicKeyToken=24d65337282035f2" Namespace="eWorld.UI" %&gt; &lt;h1 style="margin-left:8px"&gt;Add/Edit Contest&lt;/h1&gt; &lt;asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true" /&gt; &lt;div style="text-align:left;width:500px; margin-left:8px"&gt; &lt;div id="PanelContainer"&gt; &lt;asp:UpdatePanel ID="AddEditContestUpdatePanel" runat="server" UpdateMode="Always"&gt; &lt;ContentTemplate&gt; &lt;div id="background" style="text-align:left; height: 44px;"&gt; &lt;asp:Panel ID="ContestList" runat="server"&gt; &lt;asp:datagrid AllowSorting="false" id="ContestGrid" GridLines="None" CellPadding="5" Width="100%" AutoGenerateColumns="False" AlternatingItemStyle-BackColor="#cccccc" HeaderStyle-Font-Size="15px" HeaderStyle-Font-Bold="true" HeaderStyle-BackColor="#888f9b" Runat="server" AllowPaging="True" PageSize="10" PagerStyle-NextPageText="Next &gt;&gt;" PagerStyle-PrevPageText="&lt;&lt; Back" &gt; &lt;Columns&gt; &lt;asp:HyperLinkColumn DataNavigateUrlField="ContestID" DataNavigateUrlFormatString="../?Load=AddEditContest&amp;Type=Edit&amp;ContestID={0}" DataTextField="Title" ItemStyle-width="30%" headertext="Contest Title" /&gt; &lt;asp:BoundColumn DataField="StartDate" ItemStyle-Width="35%" HeaderText="Start Date" /&gt; &lt;asp:BoundColumn DataField="EndDate" ItemStyle-Width="35%" HeaderText="End Date" /&gt; &lt;/Columns&gt; &lt;/asp:datagrid&gt; &lt;div style="text-align:right;"&gt; &lt;asp:ImageButton ID="AddContest" runat="server" ImageUrl="~/Contest/Images/Add.png" AlternateText="Add Contest" onclick="AddContest_Click" /&gt; &lt;/div&gt; &lt;/asp:Panel&gt; &lt;asp:Panel ID="FieldsPanel" runat="server"&gt; &lt;p /&gt;&lt;b&gt;Title&lt;/b&gt; &lt;br /&gt; &lt;asp:TextBox Runat="server" id="TitleText" /&gt; &lt;asp:RequiredFieldValidator id="TitleValidator" runat="server" ForeColor="Red" ErrorMessage="Please add a title" ControlToValidate="TitleText"&gt;*&lt;/asp:RequiredFieldValidator&gt; &lt;p /&gt;&lt;b&gt;Contest Description&lt;/b&gt; &lt;br /&gt; Use HTML tags to format this area. Start paragraphs with &amp;lt;p /&amp;gt; tag, bold items with &amp;lt;b&amp;gt;&amp;lt;/b&amp;gt; tags. Create a line-break between lines with one &amp;lt;br /&amp;gt; tag.&lt;br /&gt; &lt;asp:TextBox Runat="server" ID="DescriptionText" TextMode="MultiLine" Width="400" Height="200" /&gt; &lt;asp:RequiredFieldValidator id="DescriptionValidator" runat="server" ErrorMessage="Please add a description" ControlToValidate="DescriptionText" ForeColor="Red"&gt;*&lt;/asp:RequiredFieldValidator&gt; &lt;p /&gt; &lt;b&gt;Contest Start Date&lt;/b&gt; &lt;br /&gt; &lt;ew:CalendarPopup id="StartDate" runat="server" Text="Change Date" Width="75px" MonthYearArrowImageUrl="~/Images/monthchange.gif" CalendarLocation="Left" ControlDisplay="TextBoxImage" ImageUrl="~/Images/calendar.gif" MonthYearPopupApplyText="Select" CalendarWidth="150" UseExternalResource="True" ExternalResourcePath="~/Scripts/CalendarPopup.js" Nullable="False"&gt; &lt;WeekdayStyle Font-Names="Arial" ForeColor="Black" BackColor="White" Font-Size="9pt" /&gt; &lt;MonthHeaderStyle Font-Size="9pt" Font-Names="Arial" Font-Bold="True" ForeColor="White" BackColor="#669AC1" /&gt; &lt;OffMonthStyle ForeColor="Gray" BackColor="White" Font-Size="9pt" /&gt; &lt;GoToTodayStyle Font-Names="Arial" ForeColor="Black" BackColor="White"/&gt; &lt;TodayDayStyle Font-Bold="True" ForeColor="#669AC1" BackColor="White" /&gt; &lt;DayHeaderStyle Font-Size="9pt" Font-Names="Arial" Font-Bold="True" ForeColor="Blue" BackColor="White" /&gt; &lt;WeekendStyle Font-Names="Arial" ForeColor="Blue" BackColor="LightGray" Font-Size="9pt" /&gt; &lt;SelectedDateStyle Font-Bold="True" ForeColor="White" BackColor="#669AC1" Font-Size="9pt"/&gt; &lt;HolidayStyle Font-Names="Arial" ForeColor="Black" BackColor="White" /&gt; &lt;/ew:CalendarPopup&gt; &amp;nbsp; &lt;ew:TimePicker id="StartTime" runat="server" ControlDisplay="TextboxImage" Text="Change Time" ImageUrl="~/Images/clock.gif" NumberOfColumns="4" Scrollable="True" Width="75px"&gt; &lt;TimeStyle ForeColor="Blue" BackColor="White" Font-Size="9pt" /&gt; &lt;SelectedTimeStyle ForeColor="Blue" BackColor="Gray" /&gt; &lt;/ew:TimePicker&gt; &lt;p/&gt;&lt;b&gt;Contest End Date&lt;/b&gt; &lt;br /&gt; &lt;ew:CalendarPopup id="EndDate" runat="server" Text="Change Date" Width="75px" MonthYearArrowImageUrl="~/Images/monthchange.gif" CalendarLocation="Left" ControlDisplay="TextBoxImage" ImageUrl="~/Images/calendar.gif" MonthYearPopupApplyText="Select" CalendarWidth="150" UseExternalResource="True" ExternalResourcePath="~/Scripts/CalendarPopup.js" Nullable="False"&gt; &lt;WeekdayStyle Font-Names="Arial" ForeColor="Black" BackColor="White" Font-Size="9pt" /&gt; &lt;MonthHeaderStyle Font-Size="9pt" Font-Names="Arial" Font-Bold="True" ForeColor="White" BackColor="#669AC1" /&gt; &lt;OffMonthStyle ForeColor="Gray" BackColor="White" Font-Size="9pt" /&gt; &lt;GoToTodayStyle Font-Names="Arial" ForeColor="Black" BackColor="White"/&gt; &lt;TodayDayStyle Font-Bold="True" ForeColor="#669AC1" BackColor="White" /&gt; &lt;DayHeaderStyle Font-Size="9pt" Font-Names="Arial" Font-Bold="True" ForeColor="Blue" BackColor="White" /&gt; &lt;WeekendStyle Font-Names="Arial" ForeColor="Blue" BackColor="LightGray" Font-Size="9pt" /&gt; &lt;SelectedDateStyle Font-Bold="True" ForeColor="White" BackColor="#669AC1" Font-Size="9pt"/&gt; &lt;HolidayStyle Font-Names="Arial" ForeColor="Black" BackColor="White" /&gt; &lt;/ew:CalendarPopup&gt; &amp;nbsp; &lt;ew:TimePicker id="EndTime" runat="server" ControlDisplay="TextboxImage" Text="Change Time" ImageUrl="~/Images/clock.gif" NumberOfColumns="4" Scrollable="True" Width="75px"&gt; &lt;TimeStyle ForeColor="Blue" BackColor="White" Font-Size="9pt" /&gt; &lt;SelectedTimeStyle ForeColor="Blue" BackColor="Gray" /&gt; &lt;/ew:TimePicker&gt; &lt;p /&gt; &lt;asp:ImageButton ID="SaveContestButton" runat="server" AlternateText="Confirm" ImageUrl="~/Contest/Images/Confirm.png" onclick="SaveContestButton_Click" /&gt; &lt;/asp:Panel&gt; &lt;br /&gt; &lt;asp:Label ID="MessageLabel" runat="server" /&gt; &lt;/div&gt; &lt;/ContentTemplate&gt; &lt;Triggers&gt; &lt;asp:AsyncPostBackTrigger ControlID="SaveContestButton" EventName="Click" /&gt; &lt;/Triggers&gt; &lt;/asp:UpdatePanel&gt; &lt;/div&gt; &lt;uc:UpdatePanelAnimationExtender ID="upae" BehaviorID="animation" runat="server" TargetControlID="AddEditContestUpdatePanel"&gt; &lt;Animations&gt; &lt;OnUpdating&gt; &lt;Sequence&gt; &lt;%-- Store the original height of the panel --%&gt; &lt;ScriptAction Script="var b = $find('animation'); b._originalHeight = b._element.offsetHeight;" /&gt; &lt;%-- Disable all the controls --%&gt; &lt;Parallel duration="0"&gt; &lt;EnableAction AnimationTarget="SaveDefaultDescriptionButton" Enabled="false" /&gt; &lt;/Parallel&gt; &lt;StyleAction Attribute="overflow" Value="hidden" /&gt; &lt;%-- Do each of the selected effects --%&gt; &lt;Parallel duration=".25" Fps="30"&gt; &lt;FadeOut AnimationTarget="PanelContainer" minimumOpacity=".2" /&gt; &lt;Resize Height="0px" /&gt; &lt;/Parallel&gt; &lt;/Sequence&gt; &lt;/OnUpdating&gt; &lt;OnUpdated&gt; &lt;Sequence&gt; &lt;%-- Do each of the selected effects --%&gt; &lt;Parallel duration=".25" Fps="30"&gt; &lt;FadeIn AnimationTarget="PanelContainer" minimumOpacity=".2" /&gt; &lt;Length duration="2" fps="40" Property="style" PropertyKey="height" StartValue="10" EndValueScript="$get('animation').offsetHeight" AnimationTarget="animation" /&gt; &lt;%--Also tried the below &lt;Resize HeightScript="$find('animation')._originalHeight" /&gt; --%&gt; &lt;/Parallel&gt; &lt;%-- Enable all the controls --%&gt; &lt;Parallel duration="0"&gt; &lt;EnableAction AnimationTarget="SaveDefaultDescriptionButton" Enabled="true" /&gt; &lt;/Parallel&gt; &lt;/Sequence&gt; &lt;/OnUpdated&gt; &lt;/Animations&gt; &lt;/uc:UpdatePanelAnimationExtender&gt; &lt;/div&gt; </code></pre>
[ { "answer_id": 167501, "author": "Joel Coehoorn", "author_id": 3043, "author_profile": "https://Stackoverflow.com/users/3043", "pm_score": 5, "selected": false, "text": "DECLARE @MyDate datetime\n\n-- ... set your datetime's initial value ...'\n\nDATEADD(d, 1, @MyDate)\n" }, { "a...
2008/10/03
[ "https://Stackoverflow.com/questions/167502", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2894/" ]
167,509
<p>I have a GridView where one column is bound to an object property containing a nullable integer. I set SortExpression to the name of the property, and sorting works perfectly as long as all rows contain a value. If any rows contain null, however, I get an exception:</p> <p>System.InvalidOperationException : Failed to compare two elements in the array. Object reference not set to an instance of an object.</p> <p>How do I customize the sorting or comparison logic to handle the null case?</p>
[ { "answer_id": 167519, "author": "Seth Petry-Johnson", "author_id": 23632, "author_profile": "https://Stackoverflow.com/users/23632", "pm_score": 3, "selected": true, "text": "gridview.Sorting += new GridViewSortEventHandler(gridView_Sorting);\n\nprotected void gridView_Sorting(object se...
2008/10/03
[ "https://Stackoverflow.com/questions/167509", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23632/" ]
167,533
<p>We have some raw voice audio that we need to distribute over the internet. We need decent quality, but it doesn't need to be of musical quality. Our main concern is usability by the consumer (i.e. what and where they can play it) and size of the download. My experience has shown that mp3s do not produce the best compression numbers for voice audio, but I am at a loss for what the best alternatives are. Ultimately we would like to automate the conversion process to allow the consumer to choose the quality vs. size level that they would like.</p>
[ { "answer_id": 25394260, "author": "hochl", "author_id": 589206, "author_profile": "https://Stackoverflow.com/users/589206", "pm_score": 3, "selected": false, "text": "ffmpeg -i x.wav -b:a 32k x.opus\n" } ]
2008/10/03
[ "https://Stackoverflow.com/questions/167533", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7819/" ]
167,542
<p>I'm trying to create a table with two columns comprising the primary key in MySQL, but I can't figure out the syntax. I understand single-column PKs, but the syntax isn't the same to create a primary key with two columns.</p>
[ { "answer_id": 167553, "author": "Galwegian", "author_id": 3201, "author_profile": "https://Stackoverflow.com/users/3201", "pm_score": 1, "selected": false, "text": " CREATE TABLE `synthesis`.`INV_MasterItemList` (\n `MasterItemList_ID` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,\n `Cu...
2008/10/03
[ "https://Stackoverflow.com/questions/167542", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1266/" ]
167,562
<p>How can I know if a device is supported on a running Linux and if so, which device driver controls it? For instance, <code>lspci</code> on a server (PowerEdge 2900) gives:</p> <pre class="lang-none prettyprint-override"><code>00:00.0 Host bridge: Intel Corporation 5000X Chipset Memory Controller Hub (rev 12) 00:02.0 PCI bridge: Intel Corporation 5000 Series Chipset PCI Express x4 Port 2 (rev 12) 00:03.0 PCI bridge: Intel Corporation 5000 Series Chipset PCI Express x4 Port 3 (rev 12) 00:04.0 PCI bridge: Intel Corporation 5000 Series Chipset PCI Express x4 Port 4 (rev 12) 00:05.0 PCI bridge: Intel Corporation 5000 Series Chipset PCI Express x4 Port 5 (rev 12) 00:06.0 PCI bridge: Intel Corporation 5000 Series Chipset PCI Express x8 Port 6-7 (rev 12) 00:07.0 PCI bridge: Intel Corporation 5000 Series Chipset PCI Express x4 Port 7 (rev 12) 00:08.0 System peripheral: Intel Corporation 5000 Series Chipset DMA Engine (rev 12) 00:10.0 Host bridge: Intel Corporation 5000 Series Chipset FSB Registers (rev 12) 00:10.1 Host bridge: Intel Corporation 5000 Series Chipset FSB Registers (rev 12) 00:10.2 Host bridge: Intel Corporation 5000 Series Chipset FSB Registers (rev 12) 00:11.0 Host bridge: Intel Corporation 5000 Series Chipset Reserved Registers (rev 12) 00:13.0 Host bridge: Intel Corporation 5000 Series Chipset Reserved Registers (rev 12) 00:15.0 Host bridge: Intel Corporation 5000 Series Chipset FBD Registers (rev 12) 00:16.0 Host bridge: Intel Corporation 5000 Series Chipset FBD Registers (rev 12) 00:1c.0 PCI bridge: Intel Corporation 631xESB/632xESB/3100 Chipset PCI Express Root Port 1 (rev 09) 00:1d.0 USB Controller: Intel Corporation 631xESB/632xESB/3100 Chipset UHCI USB Controller #1 (rev 09) 00:1d.1 USB Controller: Intel Corporation 631xESB/632xESB/3100 Chipset UHCI USB Controller #2 (rev 09) 00:1d.2 USB Controller: Intel Corporation 631xESB/632xESB/3100 Chipset UHCI USB Controller #3 (rev 09) 00:1d.3 USB Controller: Intel Corporation 631xESB/632xESB/3100 Chipset UHCI USB Controller #4 (rev 09) 00:1d.7 USB Controller: Intel Corporation 631xESB/632xESB/3100 Chipset EHCI USB2 Controller (rev 09) 00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev d9) 00:1f.0 ISA bridge: Intel Corporation 631xESB/632xESB/3100 Chipset LPC Interface Controller (rev 09) 00:1f.1 IDE interface: Intel Corporation 631xESB/632xESB IDE Controller (rev 09) 00:1f.2 IDE interface: Intel Corporation 631xESB/632xESB/3100 Chipset SATA IDE Controller (rev 09) 01:00.0 PCI bridge: Intel Corporation 80333 Segment-A PCI Express-to-PCI Express Bridge 01:00.2 PCI bridge: Intel Corporation 80333 Segment-B PCI Express-to-PCI Express Bridge 02:0e.0 RAID bus controller: Dell PowerEdge Expandable RAID controller 5 04:00.0 PCI bridge: Broadcom EPB PCI-Express to PCI-X Bridge (rev c3) 05:00.0 Ethernet controller: Broadcom Corporation NetXtreme II BCM5708 Gigabit Ethernet (rev 12) 06:00.0 PCI bridge: Intel Corporation 6311ESB/6321ESB PCI Express Upstream Port (rev 01) 06:00.3 PCI bridge: Intel Corporation 6311ESB/6321ESB PCI Express to PCI-X Bridge (rev 01) 07:00.0 PCI bridge: Intel Corporation 6311ESB/6321ESB PCI Express Downstream Port E1 (rev 01) 07:01.0 PCI bridge: Intel Corporation 6311ESB/6321ESB PCI Express Downstream Port E2 (rev 01) 08:00.0 PCI bridge: Broadcom EPB PCI-Express to PCI-X Bridge (rev c3) 09:00.0 Ethernet controller: Broadcom Corporation NetXtreme II BCM5708 Gigabit Ethernet (rev 12) 0b:02.0 Multimedia audio controller: Creative Labs SB Audigy (rev 03) 0b:02.1 Input device controller: Creative Labs SB Audigy Game Port (rev 03) 0b:02.2 FireWire (IEEE 1394): Creative Labs SB Audigy FireWire Port 10:0d.0 VGA compatible controller: ATI Technologies Inc ES1000 (rev 02) </code></pre> <p>How can I find:</p> <ol> <li>which device driver (kernel module) controls each device?</li> <li>which device is controlled by a device driver compiled <em>in</em> the kernel (and not as a module)</li> <li>which device doesn't have a device driver (compiled in or as a module)?</li> </ol> <p>This script (adapted from another in "Linux Kernel in a Nutshell") partially resolves #1:</p> <pre class="lang-bash prettyprint-override"><code>#!/bin/bash for i in $(find /sys/ -name modalias); do echo "----------------------------------" modalias=$(cat $i) echo "$(dirname $i) --&gt; $modalias" /sbin/modprobe --config /dev/null --show-depends $(cat $i) 2&gt;&amp;1 done </code></pre> <p>But there are some problems with it:</p> <ol> <li><p>I don't know of an <em>automated way</em> to convert <code>/sys/devices/pci0000:00/0000:00:1e.0/0000:10:0d.0 --&gt; pci:v00001002d0000515Esv00001028sd000001B1bc03sc00i00</code> to <code>10:0d.0 VGA compatible controller: ATI Technologies Inc ES1000 (rev 02)</code></p></li> <li><p>In some cases the devices are internal to the MB and I don't even know a way to find the real name of the device. For example:</p></li> </ol> <pre class="lang-none prettyprint-override"><code>/sys/devices/platform/dcdbas --&gt; platform:dcdbas /sys/devices/platform/iTCO_wdt --&gt; platform:iTCO_wdt /sys/devices/LNXSYSTM:00 --&gt; acpi:LNXSYSTM: /sys/devices/LNXSYSTM:00/device:00/PNP0C33:00 --&gt; acpi:PNP0C33:PNP0C01: /sys/devices/LNXSYSTM:00/device:00/PNP0A08:00 --&gt; acpi:PNP0A08:PNP0A03: /sys/devices/LNXSYSTM:00/device:00/PNP0A08:00/device:0d/PNP0200:00 --&gt; acpi:PNP0200: </code></pre> <p>and many others.</p> <ol start="3"> <li>When the device driver is <em>compiled in</em> (or doesn't exist) the response is <code>FATAL: Module _XXXX_ not found.</code> Indicating there is no module for the device.</li> </ol> <p>In some cases the driver is compiled in (e.g.)</p> <pre><code>/sys/devices/platform/serial8250 --&gt; platform:serial8250 FATAL: Module platform:serial8250 not found. /sys/devices/platform/i8042 --&gt; platform:i8042 FATAL: Module platform:i8042 not found. </code></pre> <p>In other cases, the driver just doesn't exist. But I don't know a way to tell the difference.</p> <p>Does anyone know?</p>
[ { "answer_id": 167606, "author": "Alex B", "author_id": 23643, "author_profile": "https://Stackoverflow.com/users/23643", "pm_score": 2, "selected": false, "text": "nvidia" }, { "answer_id": 168731, "author": "ypnos", "author_id": 21974, "author_profile": "https://Sta...
2008/10/03
[ "https://Stackoverflow.com/questions/167562", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8013/" ]
167,567
<p>I have been asked to write a testing application that needs to test a new stored procedure on multiple rows in a database, in essence I want to do something like this:</p> <pre><code>[Test] public void TestSelect() { foreach(id in ids) { DataTable old = Database.call(&quot;old_stored_proc&quot;,id); DataTable new_ = Database.call(&quot;new_stored_proc&quot;,id); Assert.AreEqual(old.Rows[0][&quot;column&quot;],ne_.Rows[0][&quot;column&quot;]); } } </code></pre> <p>When I run this test, if 1 row doesn't match the other, the entire test fails; instead I would like to count how many times the assertion was passed and how many times it has failed. Is there a way to do this with NUnit?</p> <p>I realize that NUnit might be overkill and this is a simple task without it...I just wanted to learn it. ;)</p>
[ { "answer_id": 167598, "author": "Ilya Kochetov", "author_id": 15329, "author_profile": "https://Stackoverflow.com/users/15329", "pm_score": 1, "selected": false, "text": "Assert.Greater" }, { "answer_id": 167619, "author": "akmad", "author_id": 1314, "author_profile"...
2008/10/03
[ "https://Stackoverflow.com/questions/167567", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1638/" ]
167,576
<p>I would like this to be the ultimate discussion on how to check if a table exists in SQL Server 2000/2005 using SQL Statements.</p> <p>Here are two possible ways of doing it. Which one is the standard/best way of doing it?</p> <p>First way:</p> <pre><code>IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE TABLE' AND TABLE_NAME='mytablename') SELECT 1 AS res ELSE SELECT 0 AS res; </code></pre> <p>Second way:</p> <pre><code>IF OBJECT_ID (N'mytablename', N'U') IS NOT NULL SELECT 1 AS res ELSE SELECT 0 AS res; </code></pre> <p><strong>MySQL</strong> provides the simple</p> <pre><code>SHOW TABLES LIKE '%tablename%'; </code></pre> <p>statement. I am looking for something similar.</p>
[ { "answer_id": 167610, "author": "Bob King", "author_id": 6897, "author_profile": "https://Stackoverflow.com/users/6897", "pm_score": 8, "selected": false, "text": "OBJECT_ID" }, { "answer_id": 167680, "author": "akmad", "author_id": 1314, "author_profile": "https://S...
2008/10/03
[ "https://Stackoverflow.com/questions/167576", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1508/" ]
167,577
<p>I am working on a project that requires reliable access to historic feed entries which are not necessarily available in the current feed of the website. I have found several ways to access such data, but none of them give me all the characteristics I need.</p> <p>Look at this as a brainstorm. I will tell you how much I have found and you can contribute if you have any other ideas.</p> <ol> <li><p><a href="http://code.google.com/apis/ajaxfeeds/" rel="nofollow noreferrer">Google AJAX Feed API</a> - will limit you to 250 items</p></li> <li><p><a href="http://www.niallkennedy.com/blog/2005/12/google-reader-api.html" rel="nofollow noreferrer">Unofficial Google Reader API</a> - Perfect but unofficial and therefore unreliable (and perhaps quasi-illegal?). Also, the authentication seems to be tricky.</p></li> <li><p><a href="http://spinn3r.com/" rel="nofollow noreferrer">Spinn3r</a> - Costs a lot of money</p></li> <li><p>Spidering the <a href="http://www.archive.org" rel="nofollow noreferrer">internet archive</a> at the site of the feed - Lots of complexity, spotty coverage, only useful as a last resort</p></li> <li><p><a href="http://www.niallkennedy.com/blog/2005/12/my-yahoo-feed-a.html" rel="nofollow noreferrer">Yahoo! Feed API</a> or <a href="http://developer.yahoo.com/search/boss/" rel="nofollow noreferrer">Yahoo! Search BOSS</a> - The first looks more like an aggregator, meaning I'd need a different registration for each feed and the second should give more access to Yahoo's data but I can find no mention of feeds.</p></li> <li><p>(thanks to Lou Franco) <a href="http://www.bloglines.com/services/api/sync" rel="nofollow noreferrer">Bloglines Sync API</a> - Besides the problem of needing an account and being designed more as an aggregator, it does not have a way to add feeds to the account. So no retrieval of arbitrary feeds. You need to manually add them through the reader first.</p></li> <li><p>Other search engines/blog search/whatever?</p></li> </ol> <p>This is a really irritating problem as we are talking about semantic information that was once out there, is still (usually) valid, yet is difficult to access reliably, freely and without limits. Anybody know any alternative sources for feed entry goodness?</p>
[ { "answer_id": 167610, "author": "Bob King", "author_id": 6897, "author_profile": "https://Stackoverflow.com/users/6897", "pm_score": 8, "selected": false, "text": "OBJECT_ID" }, { "answer_id": 167680, "author": "akmad", "author_id": 1314, "author_profile": "https://S...
2008/10/03
[ "https://Stackoverflow.com/questions/167577", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24461/" ]
167,587
<p>I'm trying to load assemblies in a separate app domain, but am running into a very strange problem. Here's some code:</p> <pre><code> public static void LoadAssembly(string assemblyPath) { string pathToDll = Assembly.GetCallingAssembly().CodeBase; AppDomainSetup domainSetup = new AppDomainSetup { PrivateBinPath = pathToDll }; AppDomain newDomain = AppDomain.CreateDomain("AssemblyLoader",null,domainSetup); AssemblyLoader loader = (AssemblyLoader)newDomain.CreateInstanceFromAndUnwrap( pathToDll, typeof(AssemblyLoader).FullName); } </code></pre> <p>AssemblyLoader is another class in the same assembly as this one, and it inherits from MarshalByRef, however for some strange reason, I get a cast exception every time I try to run this. I even hardcoded the path to the DLL instead of using GetCallingAssembly().CodeBase yet I keep getting this exception. </p> <p>I understand it's hard to answer a question like this without actually seeing it and having more information, but maybe someone has run into a similar situation and would know the common "gotchas" and what I should look out for.</p> <p>EDIT: The reason I don't want to load it directly is because this is just part of the code. The ultimate goal is that this class will have a method that load assemblies, gets their GUID and some other info about them and stores them in a database for a project I'm working on. Therefore, if I load this assembly in a separate app domain, I can load the others there too and then unload the app domain. No point in having all these assemblies loaded for the duration of the app, if I only need that data.</p>
[ { "answer_id": 167658, "author": "TheXenocide", "author_id": 8543, "author_profile": "https://Stackoverflow.com/users/8543", "pm_score": 0, "selected": false, "text": "AssemblyLoader loader = (AssemblyLoader)newDomain.CreateInstanceFromAndUnwrap(\n typeof(AssemblyLoader).Assembly....
2008/10/03
[ "https://Stackoverflow.com/questions/167587", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15861/" ]
167,602
<p>I have a class which implements UserControl. In .NET 2005, a Dispose method is automatically created in the MyClass.Designer.cs partial class file that looks like this:</p> <pre><code> protected override void Dispose(bool disposing) { if (disposing &amp;&amp; (components != null)) { components.Dispose(); } base.Dispose(disposing); } </code></pre> <p>If I want to add my own Dispose functionality, where would I put it? Since this file is generated, I don't want to add code here and risk it getting blown away.</p>
[ { "answer_id": 167627, "author": "akmad", "author_id": 1314, "author_profile": "https://Stackoverflow.com/users/1314", "pm_score": 3, "selected": false, "text": "Dispose" }, { "answer_id": 167642, "author": "Michael Damatov", "author_id": 23372, "author_profile": "htt...
2008/10/03
[ "https://Stackoverflow.com/questions/167602", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22252/" ]
167,622
<p>What are the major difference between bindable LINQ and continuous LINQ?</p> <p>•Bindable LINQ: www.codeplex.com/bindablelinq</p> <p>•Continuous LINQ: www.codeplex.com/clinq</p> <p>One more project was added basing on the provided feedback:</p> <p>•Obtics: obtics.codeplex.com</p>
[ { "answer_id": 174924, "author": "KyleLanser", "author_id": 12923, "author_profile": "https://Stackoverflow.com/users/12923", "pm_score": 6, "selected": true, "text": "from item in theSource select item ;\n" }, { "answer_id": 606571, "author": "Community", "author_id": -1...
2008/10/03
[ "https://Stackoverflow.com/questions/167622", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19268/" ]
167,628
<p>We are managing our development with Subversion over HTTPS, Bugzilla, and Mediawiki. Some of our developers have expressed an interest in migrating to Trac, so I have to evaluate what the cost of doing so would be. </p> <p>For both the wiki and bugzilla, we would need to either migrate the existing data into Trac or a way to integrate with trac. Having two apps to create wiki pages or log bugs would not be acceptable. Also, currently each of these applications requires a separate sign on so we would need to map each of these accounts into Trac.</p> <p>So know of any easy methods of importing or integrating these systems with Trac and/or a tutorial for doing so?</p>
[ { "answer_id": 174924, "author": "KyleLanser", "author_id": 12923, "author_profile": "https://Stackoverflow.com/users/12923", "pm_score": 6, "selected": true, "text": "from item in theSource select item ;\n" }, { "answer_id": 606571, "author": "Community", "author_id": -1...
2008/10/03
[ "https://Stackoverflow.com/questions/167628", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9940/" ]
167,635
<p>Let's say I 've added a library foo.so.1.1.1 to a path that is included in <code>/etc/ld.so.conf</code> When I run ldconfig on the system I get the links foo.so.1.1 and foo.so.1 to foo.so.1.1.1</p> <p>How can I change the behavior to also get the foo.so link to foo.so.1.1.1?</p>
[ { "answer_id": 167702, "author": "bmdhacks", "author_id": 14032, "author_profile": "https://Stackoverflow.com/users/14032", "pm_score": 3, "selected": false, "text": "ln -s /usr/lib/foo.so.1.1.1 /usr/lib/foo.so\n" } ]
2008/10/03
[ "https://Stackoverflow.com/questions/167635", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6403/" ]
167,643
<p>How do I write the SQL code to INSERT (or UPDATE) an array of values (with probably an attendant array of fieldnames, or with a matrix with them both) without simple iteration?</p>
[ { "answer_id": 167738, "author": "Ilya Kochetov", "author_id": 15329, "author_profile": "https://Stackoverflow.com/users/15329", "pm_score": 1, "selected": false, "text": "INSERT SELECT" }, { "answer_id": 196104, "author": "xnagyg", "author_id": 2622295, "author_profi...
2008/10/03
[ "https://Stackoverflow.com/questions/167643", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13295/" ]
167,657
<p>When IE8 is released, will the following code work to add a conditional stylesheet?</p> <pre><code>&lt;!--[if IE 8]&gt; &lt;link rel="stylesheet" type="text/css" href="ie-8.0.css" /&gt; &lt;![endif]--&gt; </code></pre> <p>I've read conflicting reports as to whether this works with the beta. I'm hoping someone can share their experience. Thanks.</p>
[ { "answer_id": 168131, "author": "scunliffe", "author_id": 6144, "author_profile": "https://Stackoverflow.com/users/6144", "pm_score": 5, "selected": false, "text": "http://127.0.0.1/mysite/mypage.php <-- IE8 by default (updated!)\nhttp://localhost/mysite/mypage.php <-- IE8 by default ...
2008/10/03
[ "https://Stackoverflow.com/questions/167657", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13850/" ]
167,697
<p>We're working with a semi-centralized git repository here where I work. Each developer has their own subtree in the central git repository, so it looks something like this:</p> <pre>master alice/branch1 alice/branch2 bob/branch1 michael/feature release/1.0 release/1.1</pre> <p>Working locally in my tree I have <code>topic/feature</code>, which corresponds to <code>michael/feature</code> in the central tree.</p> <p>I've been using</p> <pre><code>git push origin topic/feature:michael/feature </code></pre> <p>to push my changes to the remote tree. However, this is cumbersome and prone to mistakes (e.g. omitting the developer name, misspelling the feature name, etc.).</p> <p>I'm looking for a cleaner way to do this. For instance, "<code>git push</code>". I suspect that setting a different remote with a modified fetch refspec will do it, but I'm not sure how exactly to do it. I'm also not sure how to modify my current branch definitions to use the different remote.</p> <p>My current <code>.git/config</code> looks something like:</p> <pre>[remote "origin"] url = git://central/git/project fetch = +refs/heads/*:refs/remotes/origin/* [branch "topic/feature"] remote = origin merge = refs/heads/michael/project</pre> <p><strong>Edit:</strong> I'd also like to apply this to pulls/fetches. But does the <code>branch.&lt;name&gt;.merge</code> take care of that?</p> <p>I'll continue to research this and post here if I find something, but I'm hoping to get some other good ideas.</p> <p><strong>Edit 2:</strong> I've decided I'll keep local and remote branch names the same. It appears it will be the least work and least prone to future problems.</p>
[ { "answer_id": 169110, "author": "webmat", "author_id": 6349, "author_profile": "https://Stackoverflow.com/users/6349", "pm_score": 2, "selected": false, "text": "push = refs/heads/master:master\npush = refs/heads/topic/feature:michael/feature\n" }, { "answer_id": 169777, "au...
2008/10/03
[ "https://Stackoverflow.com/questions/167697", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17688/" ]
167,705
<p>How do I load the edited <code>.emacs</code> file without restarting Emacs?</p>
[ { "answer_id": 7116603, "author": "tkf", "author_id": 264050, "author_profile": "https://Stackoverflow.com/users/264050", "pm_score": 3, "selected": false, "text": "*scratch*" }, { "answer_id": 9501113, "author": "Shantanu", "author_id": 1056532, "author_profile": "ht...
2008/10/03
[ "https://Stackoverflow.com/questions/167705", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8522/" ]
167,735
<p>I am looking for a pseudo random number generator which would be specialized to work fast when it is given a seed before generating each number. Most generators I have seen so far assume you set seed once and then generate a long sequence of numbers. The only thing which looks somewhat similar to I have seen so far is Perlin Noise, but it generates too "smooth" data - for similar inputs it tends to produce similar results.</p> <p>The declaration of the generator should look something like:</p> <pre><code>int RandomNumber1(int seed); </code></pre> <p>Or:</p> <pre><code>int RandomNumber3(int seedX, int seedY, int seedZ); </code></pre> <p>I think having good RandomNumber1 should be enough, as it is possible to implement RandomNumber3 by hashing its inputs and passing the result into the RandomNumber1, but I wrote the 2nd prototype in case some implementation could use the independent inputs.</p> <p>The intended use for this generator is to use it for procedural content generator, like generating a forest by placing trees in a grid and determining a random tree species and random spatial offsets for each location.</p> <p>The generator needs to be very efficient (below 500 CPU cycles), because the procedural content is created in huge quantities in real time during rendering.</p>
[ { "answer_id": 167764, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 5, "selected": true, "text": "uint32_t hash( uint32_t a)\n a = (a ^ 61) ^ (a >> 16);\n a = a + (a << 3);\n a = a ^ (a >> 4);\n a = a * 0x27d4eb2d...
2008/10/03
[ "https://Stackoverflow.com/questions/167735", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16673/" ]
167,740
<p>I recently began profiling an osgi java application that I am writing using VisualVM. One thing I have noticed is that when the application starts sending data to a client (over JMS), the number of loaded classes starts increasing at a steady rate. The Heap size and the PermGen size remains constant, however. The number of classes never falls, even after it stops sending data. Is this a memory leak? I think it is, because the loaded classes have to be stored somewhere, however the heap and permgen never increase even after I run the application for several hours.</p> <p>For the screenshot of my profiling application go <a href="http://sites.google.com/site/javaperformacescreenshot/Home/profile.png" rel="noreferrer">here</a></p>
[ { "answer_id": 167971, "author": "Kyle", "author_id": 3335, "author_profile": "https://Stackoverflow.com/users/3335", "pm_score": 4, "selected": true, "text": "JAXBContext context = JAXBContext.newInstance(this.getClass());\n" }, { "answer_id": 168056, "author": "ddimitrov", ...
2008/10/03
[ "https://Stackoverflow.com/questions/167740", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3335/" ]
167,743
<p>What's a simple way to implement a c++ Win32 program to...<br /> - display an 800x600x24 uncompressed bitmap image<br /> - in a window without borders (the only thing visible is the image)<br /> - that closes after ten seconds<br /> - and doesn't use MFC</p>
[ { "answer_id": 167918, "author": "efotinis", "author_id": 12320, "author_profile": "https://Stackoverflow.com/users/12320", "pm_score": 2, "selected": false, "text": "_" } ]
2008/10/03
[ "https://Stackoverflow.com/questions/167743", "https://Stackoverflow.com", "https://Stackoverflow.com/users/191808/" ]
167,746
<p>I am trying to write a Windows Form and ASP.NET C# front-end and MSAccess backend for a pretty small database concept I have. </p> <p>I have written this application once before in just MSAccess but I now need the app and database to be in different places. I have now figured out (thanks to a StackOverflow user) that ADO will be a bad choice because it has to have a connection open all of the time. </p> <p>I bought Microsoft ADO.Net 2.0 Step-by-Step and I have read through some of it and understand (I think) the basic concepts at play in ADO.NET. (Datasets and the like)</p> <p>Where I get confused is the actual implementation. What I want to know is do any of you know of a C# project that has a database backend which is open source that I can go look at the code and see how they did it. I find I learn better that way. The book has a CD with code examples that I may turn to, but I would rather see real code in a real app. </p>
[ { "answer_id": 167918, "author": "efotinis", "author_id": 12320, "author_profile": "https://Stackoverflow.com/users/12320", "pm_score": 2, "selected": false, "text": "_" } ]
2008/10/03
[ "https://Stackoverflow.com/questions/167746", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19802/" ]
167,752
<p>I would like to add a typing speed indicator just below the textarea we use on our contact form. It is just for fun and to give the user some interactivity with the page while they are completing the form.</p> <p>It should display the average speed while typing and keep the last average when the keystrokes are idle. When they leave the textarea the last average should stick.</p> <p>Ideally I would like to have a jQuery plugin if it is available.</p> <p>[Edit] this was originally for just a few of my websites. But after I posted the question it struck me how this would be a neat feature for SO. If you agree <a href="http://stackoverflow.uservoice.com/pages/general/suggestions/32755" rel="noreferrer">vote here</a></p>
[ { "answer_id": 167828, "author": "Jared", "author_id": 1980, "author_profile": "https://Stackoverflow.com/users/1980", "pm_score": -1, "selected": false, "text": "var lastrun = new Date();\ntextarea.onkeyup = function() {\n var words = textarea.value.split(' ');\n var minutes_since...
2008/10/03
[ "https://Stackoverflow.com/questions/167752", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3747/" ]
167,760
<p>I have a class holding complex scientific computations. It is set up to only allow a user to create a properly instantiated case. To properly test the code, however, requires setting internal state variables directly, since the reference documents supply this data in their test cases. Done improperly, however, it can invalidate the state.<p> So I must have the ability, a member function, to set internal variables from the unit test programs. But I want to <b>strongly discourage</b> normal users from calling this function. (Yes, a determined user can muck with anything... but I don't want to <i>advertise</i> that there is a way to do something <i>wrong</i>.)<p> It would be nice to be able to tell Intellisense to not show the function, for instance.<p> The best solution I have at the moment is to just name the function something like: DangerousSet().<p> What other options do I have?<P> <b>Follow-Up</b><p> I found Amy B's answer most useful to my situation. Thanks!<br> Mufasa's suggestion to use reflection was great, but harder to implement (for me).<br> Chris' suggestion of using a decorator was good, but didn't pan out.<br> BFree's suggestion on XML is also good, and was already in use, but doesn't really solve the problem.<p> Finally, BillTheLizard's suggestion that the problem is in the source documents is not something I can control. International experts publish highly technical books and journal articles for use by their community. The fact that they don't address my particular needs is a fact of life. There simply are no alternative documents.</p>
[ { "answer_id": 167767, "author": "cfeduke", "author_id": 5645, "author_profile": "https://Stackoverflow.com/users/5645", "pm_score": 4, "selected": false, "text": "DangerousSet" }, { "answer_id": 167769, "author": "Ryan", "author_id": 17917, "author_profile": "https:/...
2008/10/03
[ "https://Stackoverflow.com/questions/167760", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10722/" ]
167,761
<p>I'd like to be able to add a class to images that adds a border that makes them look like a stack of photos. Anyone know how to do this?</p> <p>Clarifications: Ideally something like the stack shown <a href="http://designreviver.com/tutorials/create-an-interactive-stack-of-photos/" rel="nofollow noreferrer">here</a> but it doesn't need to be interactive and only needs to work for a single photo. I also don't mind using javascript if needed (jQuery would be preferred though).</p>
[ { "answer_id": 167798, "author": "Mikezx6r", "author_id": 5382, "author_profile": "https://Stackoverflow.com/users/5382", "pm_score": 0, "selected": false, "text": "<div class=\"img-shadow\"><img ...></div>\n\n.img-shadow {style.css (line 456)\nbackground-color:#505050;\nfloat:left;\nmar...
2008/10/03
[ "https://Stackoverflow.com/questions/167761", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12842/" ]
167,772
<p>I have a Ruby on Rails application that I'm writing where a user has the option to edit an invoice. They need to be able to reassign the order of the rows. Right now I have an index column in the db which is used as the default sort mechanism. I just exposed that and allowed the user to edit it. </p> <p>This is not very elegant. I'd like the user to be able to drag and drop table rows. I've used Scriptaculous and Prototype a bit and am familiar with them. I've done drag and drop lists, but haven't done table rows quite like this. Anyone have any suggestions for not only reordering but capturing the reorder efficiently?</p> <p>Also, the user can dynamically create a new row in JS right now, so that row has to be reorderable as well. </p> <p>Bonus points if it can be done with RJS instead of direct JavaScript.</p>
[ { "answer_id": 167905, "author": "Ates Goral", "author_id": 23501, "author_profile": "https://Stackoverflow.com/users/23501", "pm_score": 2, "selected": false, "text": "sortables.addItems(node);\n" }, { "answer_id": 167993, "author": "Mark S.", "author_id": 13968, "au...
2008/10/03
[ "https://Stackoverflow.com/questions/167772", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13968/" ]
167,808
<p>I have created a user control to handle adding comments to certain business entities, like contacts and customers. Works great ... except for one issue.</p> <p>I am using a ListView control to edit and delete comments, and a separate area, on the same user control to add a new comment. All of this is wrapped in an UpdatePanel.</p> <p><img src="https://farm4.static.flickr.com/3239/2909377399_888d42b595.jpg?v=0" alt="Screenshot"></p> <p>Here is my scenario ... the user adds a new comment ... the page does a postback, the data is successfully saved, and the ListView control is updated to show the new comment. Now, if the user <strong>refreshes</strong> the browser, it will naturally postback again and will add another duplicate record. </p> <p>Any ideas on how best to prevent this?</p>
[ { "answer_id": 167832, "author": "matt b", "author_id": 4249, "author_profile": "https://Stackoverflow.com/users/4249", "pm_score": 0, "selected": false, "text": "Page.IsPostBack" } ]
2008/10/03
[ "https://Stackoverflow.com/questions/167808", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1768/" ]
167,827
<p>Friends/family/etc ask me what I do and it always causes me pause while I think of how to explain it. They know what a software developer is but how can I explain what SCM is in 10 words?</p>
[ { "answer_id": 167992, "author": "John Ferguson", "author_id": 8312, "author_profile": "https://Stackoverflow.com/users/8312", "pm_score": 2, "selected": true, "text": "from many good parts:\none programme on your PC;\nlose track, get winter\n" } ]
2008/10/03
[ "https://Stackoverflow.com/questions/167827", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24881/" ]
167,844
<p>Disclaimer: I am new to Winforms.</p> <p>I need to declare a datatable that I can load with data when the main form loads. I then want to be able to reference the datatable from within events like when a button is clicked etc.</p> <p>Where/how should I declare this?</p>
[ { "answer_id": 168019, "author": "Saif Khan", "author_id": 23667, "author_profile": "https://Stackoverflow.com/users/23667", "pm_score": 0, "selected": false, "text": "Public \n\nClass Form3\n\nPrivate myTable as New DataTable\n\nPrivate Sub Button1_Click(ByVal sender As System.Object, B...
2008/10/03
[ "https://Stackoverflow.com/questions/167844", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
167,852
<p>I am hosting a WCF service in a Windows Service on one of our servers. After making it work in basicHttpBinding and building a test client in .NET (which finally worked) I went along and try to access it from PHP using the SoapClient class. The final consumer will be a PHP site so I need to make it consumable in PHP.</p> <p>I got stumped when I had to enter the WSDL url in the constructor of the SoapClient class in the PHP code. Where is the WSDL? All I have is :</p> <p><a href="http://172.27.7.123:8000/WordService" rel="noreferrer">http://172.27.7.123:8000/WordService</a> and <a href="http://172.27.7.123:8000/WordService/mex" rel="noreferrer">http://172.27.7.123:8000/WordService/mex</a></p> <p>None of these do not expose WSDL.</p> <p>Being a newbie in WCF I might have asked a dumb thing (or I might have a wrong assumption somewhere). Please be gentle :D</p> <p>And no, <a href="http://172.27.7.123:8000/WordService?wsdl" rel="noreferrer">http://172.27.7.123:8000/WordService?wsdl</a> does not show anything different than <a href="http://172.27.7.123:8000/WordService" rel="noreferrer">http://172.27.7.123:8000/WordService</a> :(</p> <p>Am I forced to host it in IIS? Am I forced to use a regular WebService?</p>
[ { "answer_id": 167968, "author": "Kev", "author_id": 419, "author_profile": "https://Stackoverflow.com/users/419", "pm_score": 4, "selected": true, "text": "<system.serviceModel>\n <services>\n\n <service \n <!-- Namespace.ServiceClass implementation -->\n name=\"WcfService...
2008/10/03
[ "https://Stackoverflow.com/questions/167852", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1796/" ]
167,862
<p>One of the vagaries of my development system (Codegear C++Builder) is that some of the auto-generated headers insist on having... </p> <pre><code>using namespace xyzzy </code></pre> <p>...statements in them, which impact on my code when I least want or expect it.</p> <p>Is there a way I can somehow cancel/override a previous "using" statement to avoid this.</p> <p>Maybe...</p> <pre><code>unusing namespace xyzzy; </code></pre>
[ { "answer_id": 168007, "author": "jk.", "author_id": 21284, "author_profile": "https://Stackoverflow.com/users/21284", "pm_score": 6, "selected": false, "text": "using namespace" }, { "answer_id": 168023, "author": "Kasprzol", "author_id": 5957, "author_profile": "htt...
2008/10/03
[ "https://Stackoverflow.com/questions/167862", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1737/" ]
167,888
<p>I need to be able to GZip compress a file in an Excel VBA function. Specifically I need to be able to use the 'deflate' algorithm.</p> <p>Is there a way to do this without having to exec a command line application? With no dependency on external tools the code will be more robust.</p> <p>Ideally the code would make use of pre-installed VBA or COM library functions - I don't want to have to implement this logic myself or install DLLs etc.</p> <p>If possible, I want installation of the function to be as simple as adding a .xla to the available Excel Add-Ins. No DLLs, EXEs, registry entries etc. required.</p> <p><strong>Edit</strong> Can I make use of the .NET GZipStream to do this?</p>
[ { "answer_id": 167907, "author": "JPLemme", "author_id": 1019, "author_profile": "https://Stackoverflow.com/users/1019", "pm_score": 0, "selected": false, "text": "Sub main()\n ActiveWorkbook.Save\n Open \"macrotest.xls\" For Binary Access Read As #1\n Open \"newfile.zip\" For B...
2008/10/03
[ "https://Stackoverflow.com/questions/167888", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4023/" ]
167,904
<p>Say there are two possible solutions to a problem: the first is quick but hacky; the second is preferable but would take longer to implement. You need to solve the problem fast, so you decide to get the hack in place as quickly as you can, planning to start work on the better solution afterwards. The trouble is, as soon as the problem is alleviated, it plummets down the to-do list. You're still planning to put in the better solution at some point, but it's hard to justify implementing it right now. Suddenly you find you've spent five years using the less-than-perfect solution, cursing it the while.</p> <p>Does this sound familiar? I know it's happened more than once where I work. One colleague describes deliberately making a bad GUI so that it wouldn't be accidentally adopted long-term. Do you have a better strategy?</p>
[ { "answer_id": 169836, "author": "mm2001", "author_id": 19506, "author_profile": "https://Stackoverflow.com/users/19506", "pm_score": 1, "selected": false, "text": "HACK" }, { "answer_id": 205054, "author": "johnstok", "author_id": 27929, "author_profile": "https://St...
2008/10/03
[ "https://Stackoverflow.com/questions/167904", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11575/" ]
167,909
<p>I hate Physics, but I love software development. When I go back to school after Thanksgiving, I'll be taking two more quarters of Physics before I'm done with the horrid thing. I am currently reading postings on the F# units of measurement feature, but I've never used a language like F#. Would it be suitable to write applications so I can perhaps learn something about Physics while doing something I like?</p> <p>I'm interested in command-line applications (even those that I can just execute and have spit out an answer without needing inputs) for things like kinematics, planar motion, Newton's Laws, gravitation, work, energy, momentum and impulse, systems of particles, rotational kinematics and dynamics, angular momentum, static equilibrium, oscillatory motion, wave motion, sound, physical optics, electrostatics, Gauss' law, electric field and potential, capacitance, resistance, DC circuits, magnetic field, Ampere's law, and inductance.</p> <p>The reason I'm interested in F# is because of the units of measure functionality that the language provides.</p>
[ { "answer_id": 168110, "author": "Chris Smith", "author_id": 322, "author_profile": "https://Stackoverflow.com/users/322", "pm_score": 5, "selected": true, "text": "let distance : float<meters> = gravity * 3.0<seconds>\n" } ]
2008/10/03
[ "https://Stackoverflow.com/questions/167909", "https://Stackoverflow.com", "https://Stackoverflow.com/users/572/" ]
167,916
<p>I have a few questions about optimizing this type of load.</p> <p>One builds a new table of data to be loaded into a partitioned table and then builds the indexes on this new table. </p> <ol> <li><p>Should you build the index with the COMPUTE STATISTICS option or use the Cascade option of the DBMS_Stats?</p></li> <li><p>Should you gather stats on the table before the swap or on the partition after the swap?</p></li> <li><p>If you do it after the swap and you specify the partition name in the parameter list, what interplay does the granularity parameter have? For instance, if I specify a partition name and then set granularity to 'GLOBAL AND PARTITION' does that do Global at all? Does it do <em>just</em> that one partition?</p></li> </ol>
[ { "answer_id": 168359, "author": "Adam Hawkes", "author_id": 6703, "author_profile": "https://Stackoverflow.com/users/6703", "pm_score": 0, "selected": false, "text": "DBMS_STATS" } ]
2008/10/03
[ "https://Stackoverflow.com/questions/167916", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
167,923
<p>This is a pretty straight forward attempt. I haven't been using python for too long. Seems to work but I am sure I have much to learn. Someone let me know if I am way off here. Needs to find patterns, write the first line which matches, and then add a summary message for remaining consecutive lines which match pattern and return modified string.</p> <p>Just to be clear...regex <code>.*Dog.*</code> would take </p> <pre><code>Cat Dog My Dog Her Dog Mouse </code></pre> <p>and return </p> <pre><code>Cat Dog ::::: Pattern .*Dog.* repeats 2 more times. Mouse #!/usr/bin/env python # import re import types def remove_repeats (l_string, l_regex): """Take a string, remove similar lines and replace with a summary message. l_regex accepts strings and tuples. """ # Convert string to tuple. if type(l_regex) == types.StringType: l_regex = l_regex, for t in l_regex: r = '' p = '' for l in l_string.splitlines(True): if l.startswith('::::: Pattern'): r = r + l else: if re.search(t, l): # If line matches regex. m += 1 if m == 1: # If this is first match in a set of lines add line to file. r = r + l elif m &gt; 1: # Else update the message string. p = "::::: Pattern '" + t + "' repeats " + str(m-1) + ' more times.\n' else: if p: # Write the message string if it has value. r = r + p p = '' m = 0 r = r + l if p: # Write the message if loop ended in a pattern. r = r + p p = '' l_string = r # Reset string to modified string. return l_string </code></pre>
[ { "answer_id": 168009, "author": "tzot", "author_id": 6899, "author_profile": "https://Stackoverflow.com/users/6899", "pm_score": 2, "selected": true, "text": "def rematcher(re_str, iterable):\n\n matcher= re.compile(re_str)\n in_match= 0\n for item in iterable:\n if matc...
2008/10/03
[ "https://Stackoverflow.com/questions/167923", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4527/" ]
167,927
<p>Can someone please provide an implementation of a C function that gets invoked to dump the current stack? It's for a x86 linux system. It can be invoked in 2 ways: explicitly by another function, or after a crash (probably as a trap/int handler). The output can be either to the screen or to a file, as indicated by a parameter (handle). A clear explanation/comments of how the stack is unwound would obviously be very helpful. Thank you.</p>
[ { "answer_id": 2360876, "author": "jschmier", "author_id": 203667, "author_profile": "https://Stackoverflow.com/users/203667", "pm_score": 1, "selected": false, "text": "backtrace()" } ]
2008/10/03
[ "https://Stackoverflow.com/questions/167927", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8638/" ]
167,946
<p>As part of the base class for some extensive unit testing, I am writing a helper function which recursively compares the nodes of one XmlDocument object to another in C# (.NET). Some requirements of this:</p> <ul> <li>The first document is the <strong>source</strong>, e.g. what I want the XML document to look like. Thus the second is the one I want to find differences in and it must not contain <em>extra</em> nodes not in the first document.</li> <li>Must throw an exception when too many significant differences are found, and it should be easily understood by a human glancing at the description.</li> <li>Child element order is important, attributes can be in any order.</li> <li>Some attributes are ignorable; specifically <code>xsi:schemaLocation</code> and <code>xmlns:xsi</code>, though I would like to be able to pass in which ones are.</li> <li>Prefixes for namespaces must match in both attributes and elements.</li> <li>Whitespace between elements is irrelevant.</li> <li>Elements will <em>either</em> have child elements <em>or</em> <code>InnerText</code>, but not both.</li> </ul> <p>While I'm scrapping something together: <strong>has anyone written such code and would it be possible to share it here?</strong></p> <p>On an aside, what would you call the first and second documents? I've been referring to them as "source" and "target", but it feels wrong since the <strong>source</strong> is what I want the <strong>target</strong> to look like, else I throw an exception.</p>
[ { "answer_id": 30056490, "author": "Two Cents", "author_id": 4866984, "author_profile": "https://Stackoverflow.com/users/4866984", "pm_score": 3, "selected": false, "text": "public bool XMLCompare(XElement primary, XElement secondary)\n{\n if (primary.HasAttributes) {\n if (pri...
2008/10/03
[ "https://Stackoverflow.com/questions/167946", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9642/" ]
167,952
<p>Null or empty string -- is one better than the other to represent no data in a table column? (I specifically use MySQL, but I'm thinking this is system-independent.) Are there major advantages/disadvantages to using one over the other, or is it simply programmer preference?</p>
[ { "answer_id": 167981, "author": "James Curran", "author_id": 12725, "author_profile": "https://Stackoverflow.com/users/12725", "pm_score": 1, "selected": false, "text": "select 1 from (select '' as col from dual) where col is null;\n" }, { "answer_id": 167986, "author": "Ad...
2008/10/03
[ "https://Stackoverflow.com/questions/167952", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7596/" ]
167,954
<p>So I build an array of various dates. Birthdays, anniversaries, and holidays. I'd like to order the array by which one is happening next, essentially sort October to September (wrapping to next year)</p> <p>so if my array is </p> <pre><code>$a = ([0]=&gt;"1980-04-14", [1]=&gt;"2007-06-08", [2]=&gt;"2008-12-25", [3]=&gt;"1978-11-03") </code></pre> <p>I'd like to sort it so it is arranged</p> <pre><code>$a = ([0]=&gt;"1978-11-03", [1]=&gt;"2008-12-25", [2]=&gt;"1980-04-14", [3]=&gt;"2007-06-08") </code></pre> <p>because the november 'event' is the one that will happen next (based on it being october right now).</p> <p>I'm trying usort where my cmp function is </p> <pre><code>function cmp($a, $b) { $a_tmp = split("-", $a); $b_tmp = split("-", $b); return strcmp($a_tmp[1], $b_tmp[1]); } </code></pre> <p>I am not sure how to modify this to get my desired effect.</p>
[ { "answer_id": 167995, "author": "cfeduke", "author_id": 5645, "author_profile": "https://Stackoverflow.com/users/5645", "pm_score": -1, "selected": false, "text": "$date1 = split(\"-\", $a);\n$date2 = split(\"-\", $b);\n$seconds1 = mktime(0,0,0,$date1[1],$date1[2],$date1[0]);\n$seconds2...
2008/10/03
[ "https://Stackoverflow.com/questions/167954", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3800/" ]
167,990
<p>I am developing a small web app project (ColdFusion) and I am trying to keep my project split into multiple files during development, but deploy just one file on completion.</p> <p>I have references to external files, for instance:</p> <pre><code>&lt;script type="text/javascript" src="jquery-1.2.6.pack.js"&gt;&lt;/script&gt; &lt;link type="text/css" rel="stylesheet" href="project.css" /&gt; </code></pre> <p>And when I build my project, I want to have the files included and embedded within the single finished product file.</p> <pre><code>&lt;script type="text/javascript"&gt;eval(function(p,a,c,k,e,r) [...]&lt;/script&gt; &lt;style type="text/css"&gt;div{font:normal;} [...]&lt;/style&gt; </code></pre> <p>Anyway, it doesn't look like there is a basic way for Ant to do this. Anyone know?</p>
[ { "answer_id": 169052, "author": "Peter Boughton", "author_id": 9360, "author_profile": "https://Stackoverflow.com/users/9360", "pm_score": 2, "selected": false, "text": "<property\n name=\"filename\"\n value=\"jquery-1.2.6.pack.js\"\n/>\n\n<loadfile\n property=\"contents\"\n ...
2008/10/03
[ "https://Stackoverflow.com/questions/167990", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5918/" ]
168,017
<p>Does any one know how can I convert a BSTR to an int in VC++ 2008</p> <p>Thanks in advance.</p>
[ { "answer_id": 168021, "author": "Scott Hanselman", "author_id": 6380, "author_profile": "https://Stackoverflow.com/users/6380", "pm_score": 3, "selected": false, "text": "VarI4FromStr" }, { "answer_id": 168028, "author": "dalle", "author_id": 19100, "author_profile":...
2008/10/03
[ "https://Stackoverflow.com/questions/168017", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24927/" ]
168,022
<p>I'm implementing a search algorithm (let's call it MyAlg) in a python package. Since the algorithm is super-duper complicated, the package has to contain an auxiliary class for algorithm options. Currently I'm developing the entire package by myself (and I'm not a programmer), however I expect 1-2 programmers to join the project later. This would be my first project that will involve external programmers. Thus, in order to make their lifes easier, how should I name this class: Options, OptionsMyAlg, MyAlgOptions or anything else?</p> <p>What would you suggest me to read in this topic except for <a href="http://www.joelonsoftware.com/articles/Wrong.html" rel="nofollow noreferrer">http://www.joelonsoftware.com/articles/Wrong.html</a> ?</p> <p>Thank you Yuri [cross posted from here: <a href="http://discuss.joelonsoftware.com/default.asp?design.4.684669.0" rel="nofollow noreferrer">http://discuss.joelonsoftware.com/default.asp?design.4.684669.0</a> will update the answers in both places]</p>
[ { "answer_id": 168085, "author": "Eli Courtwright", "author_id": 1694, "author_profile": "https://Stackoverflow.com/users/1694", "pm_score": 2, "selected": false, "text": "Options" }, { "answer_id": 168107, "author": "jblocksom", "author_id": 20626, "author_profile": ...
2008/10/03
[ "https://Stackoverflow.com/questions/168022", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
168,037
<p>I have an application that takes the quality results for a manufacturing process and creates graphs both to show Pareto charts of the bad, and also to show production throughput.</p> <p>To automate the task of testing these statistical procedures I would like to deterministically be able to add records into the database and have the quality tech go to certain graphs and compare to a known good graph. But, I also would like to simulate the results so they would go into the database as if a user was running through the testing process.</p> <p>One idea I have had is to fill a list with i number good, j number bad1, k number bad 2, etc. And then somehow randomly sort the list before insertion into the database.</p> <p>So, my question, is there a standard algorithm to take a sorted list of values and create a randomly sorted list? </p>
[ { "answer_id": 168075, "author": "albertein", "author_id": 23020, "author_profile": "https://Stackoverflow.com/users/23020", "pm_score": 0, "selected": false, "text": "Random rnd = new Random();\nList<int> orderedList = new List<int>();\nList<int> randomList = new List<int>();\nwhile (or...
2008/10/03
[ "https://Stackoverflow.com/questions/168037", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12425/" ]
168,046
<p>I'm maintaining a library that contains compiled objects that need to be linked into a 3rd party executable. sometimes the executable has been compiled for Solaris, sometimes as a 32bit Linux Application, sometimes its a 64bit linux application. What I'd love to do is pass one "path" to the library, and have the application then automatically pick up the right flavor of the library. It'd be OK if it only worked on linux, so that I could just define the path in terms of the OS. </p> <p>this particular case is for a library of PLI/VPI functions I want to link into a verilog simulator.</p> <p>What I have now is</p> <pre><code>root/path/${MYPLILIB_VER}/rootname/${MYPLIFLAVOR}/plilib.so </code></pre> <p>where flavor is one of</p> <pre><code>solaris linux linux64 </code></pre> <p>The flavor depends on the os, and if Linux, if running on a 64bit platform, it also depends on which version 32/64bit of the program I am running. I'm looking for a better way.. </p>
[ { "answer_id": 1005462, "author": "Steve K", "author_id": 121394, "author_profile": "https://Stackoverflow.com/users/121394", "pm_score": 0, "selected": false, "text": "LD_LIBRARY_PATH" } ]
2008/10/03
[ "https://Stackoverflow.com/questions/168046", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6314/" ]
168,073
<p>I'm currently writing a website that allows people to download Excel and text files. Is there a way to redirect to a different page when they click, so that we run javascript and do analytics (i.e. keep download count)? Currently, nothing prevents the user from simply right-clicking and saving. </p> <p>Edit: </p> <p>To be more specific, it would be nice for a single or double click of a file link to redirect to a temporary download page for analytics, then have the file be downloaded.</p>
[ { "answer_id": 168121, "author": "Joe Skora", "author_id": 14057, "author_profile": "https://Stackoverflow.com/users/14057", "pm_score": 0, "selected": false, "text": "redirect(controller:\"book\",action:\"list\")\n" }, { "answer_id": 171574, "author": "mbrevoort", "autho...
2008/10/03
[ "https://Stackoverflow.com/questions/168073", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6833/" ]
168,080
<p>I have a some JPA entities that inherit from one another and uses discriminator to determine what class to be created (untested as of yet).</p> <pre><code>@Entity(name="switches") @DiscriminatorColumn(name="type") @DiscriminatorValue(value="500") public class DmsSwitch extends Switch implements Serializable {} @MappedSuperclass public abstract class Switch implements ISwitch {} @Entity(name="switch_accounts") public class SwitchAccounts implements Serializable { @ManyToOne() @JoinColumn(name="switch_id") DmsSwitch _switch; } </code></pre> <p>So in the SwitchAccounts class I would like to use the base class Switch because I don't know which object will be created until runtime. How can I achieve this?</p>
[ { "answer_id": 168728, "author": "extraneon", "author_id": 24582, "author_profile": "https://Stackoverflow.com/users/24582", "pm_score": 2, "selected": false, "text": "@Entity(name=\"switches\")\n@DiscriminatorColumn(name=\"type\")\n@DiscriminatorValue(value=\"400\")\npublic class Switch...
2008/10/03
[ "https://Stackoverflow.com/questions/168080", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22763/" ]
168,084
<p>Usually pagination queries look like this. Is there a better way instead of making two almost equal methods, one of which executing "select *..." and the other one "count *..."?</p> <pre><code>public List&lt;Cat&gt; findCats(String name, int offset, int limit) { Query q = session.createQuery("from Cat where name=:name"); q.setString("name", name); if (offset &gt; 0) { q.setFirstResult(offset); } if (limit &gt; 0) { q.setMaxResults(limit); } return q.list(); } public Long countCats(String name) { Query q = session.createQuery("select count(*) from Cat where name=:name"); q.setString("name", name); return (Long) q.uniqueResult(); } </code></pre>
[ { "answer_id": 168858, "author": "anjanb", "author_id": 11142, "author_profile": "https://Stackoverflow.com/users/11142", "pm_score": -1, "selected": false, "text": "Query q = sess.createQuery(\"from DomesticCat cat\");\nq.setFirstResult(20);\nq.setMaxResults(10);\nList cats = q.list();\...
2008/10/03
[ "https://Stackoverflow.com/questions/168084", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20128/" ]
168,116
<p>Here's a link to Windows <a href="http://msdn.microsoft.com/en-us/library/ms683218(VS.85).aspx" rel="nofollow noreferrer">documentation</a>.</p> <p>Basically I would like to get similar data, but on Linux. If not all is possible, then at least some parts.</p>
[ { "answer_id": 168123, "author": "dmckee --- ex-moderator kitten", "author_id": 2509, "author_profile": "https://Stackoverflow.com/users/2509", "pm_score": 1, "selected": false, "text": "/proc/<PID>/" }, { "answer_id": 168693, "author": "ypnos", "author_id": 21974, "a...
2008/10/03
[ "https://Stackoverflow.com/questions/168116", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9403/" ]
168,119
<p>I have a pretty unusual problem (for me). I am writing an application that will allow a user to change their system time forward or back either by explicit date (change my date to 6/3/1955) or by increment using buttons (go forward 1 month).</p> <p>I'm writing this to help some of my users test some software that requires jumps like this in order to simulate real world usage of a billing system.</p> <p>Changing the time in Delphi is of course very easy:</p> <pre><code>SetDateTime(2008,05,21,16,07,21,00); </code></pre> <p>But I'm not sure if Delphi (2006) has any built in helpers for date math, which is one of my least favorite things :)</p> <p>Any suggestions for the best way to handle this? I'd prefer to stay native as the winapi datetime calls suck.</p> <p>Thanks!</p>
[ { "answer_id": 190434, "author": "user26293", "author_id": 26293, "author_profile": "https://Stackoverflow.com/users/26293", "pm_score": 3, "selected": false, "text": "procedure SetSystemDateTime(aDateTime: TDateTime);\nvar\n lSystemTime: TSystemTime;\n lTimeZone: TTimeZoneInformation;...
2008/10/03
[ "https://Stackoverflow.com/questions/168119", "https://Stackoverflow.com", "https://Stackoverflow.com/users/172/" ]
168,150
<p>I've been trying to get up to speed on some of the newer features in C# and one of them that I haven't had occasion to use is anonymous types.</p> <p>I understand the usage as it pertains to LINQ queries and I looked at <a href="https://stackoverflow.com/questions/48668/how-should-anonymous-types-be-used-in-c">this SO post</a> which asked a similar question. Most of the examples I've seen on the net are related to LINQ queries, which is cool. I saw some somewhat contrived examples too but not really anything where I saw a lot of value. </p> <p>Do you have a novel use for anonymous types where you think it really provides you some utility?</p>
[ { "answer_id": 168159, "author": "Giovanni Galbo", "author_id": 4050, "author_profile": "https://Stackoverflow.com/users/4050", "pm_score": 2, "selected": false, "text": "var x = new { a = 1, b = 2 };\n" }, { "answer_id": 172629, "author": "Bradley Grainger", "author_id":...
2008/10/03
[ "https://Stackoverflow.com/questions/168150", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7862/" ]
168,169
<p>Has anyone else seen people do this:</p> <pre><code>private string _name; public string Name{ get{ return _name; } set{ _name = value;}}</code></pre> <p>I understand using accessors if you are going to exercise some sort of control over how it gets set or perform some sort of function on it when there is a get. But if you are just going to do this, why not just make the variable public to begin with? Am I missing something?</p>
[ { "answer_id": 168221, "author": "Robert Rossney", "author_id": 19403, "author_profile": "https://Stackoverflow.com/users/19403", "pm_score": 6, "selected": true, "text": "public string Name { get; set; }\n" } ]
2008/10/03
[ "https://Stackoverflow.com/questions/168169", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19038/" ]
168,171
<p>Can someone provide a regular expression for parsing name/value pairs from a string? The pairs are separated by commas, and the value can optionally be enclosed in quotes. For example:</p> <pre><code>AssemblyName=foo.dll,ClassName="SomeClass",Parameters="Some,Parameters" </code></pre>
[ { "answer_id": 168196, "author": "Markus Jarderot", "author_id": 22364, "author_profile": "https://Stackoverflow.com/users/22364", "pm_score": 6, "selected": true, "text": "/([^=,]*)=(\"[^\"]*\"|[^,\"]*)/\n" }, { "answer_id": 168358, "author": "Jonathan Leffler", "author_...
2008/10/03
[ "https://Stackoverflow.com/questions/168171", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2773/" ]
168,173
<p>I have a webpage that pulls information from a database, converts it to .csv format, and writes the file to the HTTPResponse. </p> <pre><code>string csv = GetCSV(); Response.Clear(); Response.ContentType = "text/csv"; Response.Write(csv); </code></pre> <p>This works fine, and the file is sent to the client with no problems. However, when the file is sent to the client, the name of the current page is used, instead of a more friendly name (like "data.csv").</p> <p><img src="https://ktrauberman.files.wordpress.com/2008/10/exportcsv.gif" alt="alt text"></p> <p>My question is, how can I change the name of the file that is written to the output stream without writing the file to disk and redirecting the client to the file's url? </p> <p><strong>EDIT: Thanks for the responses guys. I got 4 of the same response, so I just chose the first one as the answer.</strong></p>
[ { "answer_id": 168182, "author": "Joe Skora", "author_id": 14057, "author_profile": "https://Stackoverflow.com/users/14057", "pm_score": 5, "selected": true, "text": "Response.AddHeader(\"content-disposition\", \"attachment; filename=NewFileName.csv\");\n" }, { "answer_id": 16818...
2008/10/03
[ "https://Stackoverflow.com/questions/168173", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21461/" ]
168,214
<p>What is the easiest way to encode a PHP string for output to a JavaScript variable?</p> <p>I have a PHP string which includes quotes and newlines. I need the contents of this string to be put into a JavaScript variable.</p> <p>Normally, I would just construct my JavaScript in a PHP file, à la:</p> <pre><code>&lt;script&gt; var myvar = "&lt;?php echo $myVarValue;?&gt;"; &lt;/script&gt; </code></pre> <p>However, this doesn't work when <code>$myVarValue</code> contains quotes or newlines.</p>
[ { "answer_id": 168255, "author": "Adam", "author_id": 1366, "author_profile": "https://Stackoverflow.com/users/1366", "pm_score": -1, "selected": false, "text": "<script>\n var myvar = {$MyVarValue};\n</script>\n" }, { "answer_id": 168265, "author": "Chris MacDonald", ...
2008/10/03
[ "https://Stackoverflow.com/questions/168214", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13238/" ]
168,218
<p>I was considering creating a separate SQLite database for certain apps on a Django project.<br> However, I did not want to use direct SQLite access if possible. Django-style ORM access to these database would be ideal.<br> Is this possible?</p> <p>Thank you.</p>
[ { "answer_id": 170251, "author": "Jonny Buchanan", "author_id": 6760, "author_profile": "https://Stackoverflow.com/users/6760", "pm_score": 3, "selected": false, "text": "QuerySet" } ]
2008/10/03
[ "https://Stackoverflow.com/questions/168218", "https://Stackoverflow.com", "https://Stackoverflow.com/users/143732/" ]
168,236
<p>I am trying to set attributes for an IFRAME html control from the code-behind aspx.cs file.</p> <p>I came across a <a href="https://web.archive.org/web/20210128094503/http://geekswithblogs.net/ranganh/archive/2005/04/25/37635.aspx" rel="nofollow noreferrer">post</a> that says you can use FindControl to find the non-asp controls using:</p> <p>The aspx file contains:</p> <pre><code>&lt;iframe id=&quot;contentPanel1&quot; runat=&quot;server&quot; /&gt; </code></pre> <p>and then the code-behind file contains:</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { HtmlControl contentPanel1 = (HtmlControl)this.FindControl(&quot;contentPanel1&quot;); if (contentPanel1 != null) contentPanel1.Attributes[&quot;src&quot;] = &quot;http://www.stackoverflow.com&quot;; } </code></pre> <p>Except that it's not finding the control, contentPanel1 is null.</p> <hr /> <p><strong>Update 1</strong></p> <p>Looking at the rendered html:</p> <pre><code>&lt;iframe id=&quot;ctl00_ContentPlaceHolder1_contentPanel1&quot;&gt;&lt;/iframe&gt; </code></pre> <p>i tried changing the code-behind to:</p> <pre><code>HtmlControl contentPanel1 = (HtmlControl)this.FindControl(&quot;ctl00_ContentPlaceHolder1_contentPanel1&quot;); if (contentPanel1 != null) contentPanel1.Attributes[&quot;src&quot;] = &quot;http://www.clis.com&quot;; </code></pre> <p>But it didn't help.</p> <p>i am using a MasterPage.</p> <hr /> <p><strong>Update 2</strong></p> <p>Changing the aspx file to:</p> <pre><code>&lt;iframe id=&quot;contentPanel1&quot; name=&quot;contentPanel1&quot; runat=&quot;server&quot; /&gt; </code></pre> <p>also didn't help</p> <hr /> <p><strong>Answer</strong></p> <p>The answer is obvious, and unworthy of even asking the original question. If you have the aspx code:</p> <pre><code>&lt;iframe id=&quot;contentPanel1&quot; runat=&quot;server&quot; /&gt; </code></pre> <p>and want to access the iframe from the code-behind file, you just access it:</p> <pre><code>this.contentPanel1.Attributes[&quot;src&quot;] = &quot;http://www.stackoverflow.com&quot;; </code></pre>
[ { "answer_id": 168286, "author": "Joe Ratzer", "author_id": 4092, "author_profile": "https://Stackoverflow.com/users/4092", "pm_score": 1, "selected": false, "text": "this.Master.FindControl(\"ContentId\").FindControl(\"controlId\")\n" }, { "answer_id": 168306, "author": "Rya...
2008/10/03
[ "https://Stackoverflow.com/questions/168236", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12597/" ]
168,249
<p>Let's say I have a multithreaded C++ program that handles requests in the form of a function call to <code>handleRequest(string key)</code>. Each call to <code>handleRequest</code> occurs in a separate thread, and there are an arbitrarily large number of possible values for <code>key</code>.</p> <p>I want the following behavior:</p> <ul> <li>Simultaneous calls to <code>handleRequest(key)</code> are serialized when they have the same value for <code>key</code>.</li> <li>Global serialization is minimized.</li> </ul> <p>The body of <code>handleRequest</code> might look like this:</p> <pre><code>void handleRequest(string key) { KeyLock lock(key); // Handle the request. } </code></pre> <p><b>Question:</b> How would I implement <code>KeyLock</code> to get the required behavior?</p> <p>A naive implementation might start off like this:</p> <pre><code>KeyLock::KeyLock(string key) { global_lock-&gt;Lock(); internal_lock_ = global_key_map[key]; if (internal_lock_ == NULL) { internal_lock_ = new Lock(); global_key_map[key] = internal_lock_; } global_lock-&gt;Unlock(); internal_lock_-&gt;Lock(); } KeyLock::~KeyLock() { internal_lock_-&gt;Unlock(); // Remove internal_lock_ from global_key_map iff no other threads are waiting for it. } </code></pre> <p>...but that requires a global lock at the beginning and end of each request, and the creation of a separate <code>Lock</code> object for each request. If contention is high between calls to <code>handleRequest</code>, that might not be a problem, but it could impose a lot of overhead if contention is low.</p>
[ { "answer_id": 168282, "author": "coppro", "author_id": 16855, "author_profile": "https://Stackoverflow.com/users/16855", "pm_score": 2, "selected": false, "text": "std::map<std::string, MutexType>" }, { "answer_id": 169106, "author": "Constantin", "author_id": 20310, ...
2008/10/03
[ "https://Stackoverflow.com/questions/168249", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24923/" ]
168,280
<p>I want to allow an Excel report to be viewed embedded in a WebPage... is there a way?</p> <ul> <li><p>I don't want to use an ActiveX, or OWC (Office Web Components), I just want to open an existing file from the internet explorer application.</p></li> <li><p>I don't want users to download and then open it.</p></li> </ul> <p>Using an iframe wouldn't be a problem, but my preliminary tests weren't successful</p> <p>Any ideas? Is it at all possible?</p>
[ { "answer_id": 168351, "author": "Diodeus - James MacFarlane", "author_id": 12579, "author_profile": "https://Stackoverflow.com/users/12579", "pm_score": -1, "selected": false, "text": "<iframe src=\"file:\\\\yourpath\\yourfile.xls\" width=\"100%\" height=\"500\"></iframe>\n" } ]
2008/10/03
[ "https://Stackoverflow.com/questions/168280", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1782/" ]
168,317
<p>We have a SmartClient built in C# that stubornly remains open when the PC its running on is being restarted. This halts the restart process unless the user first closes the SmartClient or there is some other manual intervention.</p> <p>This is causing problems when the infrastructure team remotely installs new software that requires a machine reboot.</p> <p>Any ideas for getting the SmartClient app to recognize the shutdown/restart event from Windows and gracefully kill itself?</p> <p><strong>UPDATE:</strong> This is a highly threaded application with multiple gui threads. yes, multiple gui threads. Its really a consolidation of many project that in and of themselves could be standalone applications - all of which are launched and managed from a single exe that centralizes those management methods and keeps track of those threads. I don't believe using background threads is an option.</p>
[ { "answer_id": 168365, "author": "Vincent McNabb", "author_id": 16299, "author_profile": "https://Stackoverflow.com/users/16299", "pm_score": 4, "selected": true, "text": "...\nMicrosoft.Win32.SystemEvents.SessionEnded +=new\n Microsoft.Win32.SessionEndedEventHandler(shutdownHandler);\n...
2008/10/03
[ "https://Stackoverflow.com/questions/168317", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24179/" ]
168,369
<p>After working for a few days with Eclipse Java I totally got addicted to pressing <kbd>Ctrl</kbd> and clicking on an identifier to go to its definition. Since then I've been looking for a way to achieve this in Visual Studio as well.</p> <p>I realize VS has right click, Go to definition, and that <kbd>F12</kbd> does the same. I also realize that Visual Assist does something similar with <kbd>Alt</kbd> + <kbd>G</kbd>. Yet none of these are as perfect as <kbd>Ctrl</kbd> + click. </p> <p>I've actually tried my luck for a few hours trying to write a VS plugin to do it but didn't get anywhere in the time frame I thought reasonable for this.</p> <p>Does anyone know how this could be achieved? A ready plugin? A macro of some kind?</p>
[ { "answer_id": 33536128, "author": "Se Song", "author_id": 3458608, "author_profile": "https://Stackoverflow.com/users/3458608", "pm_score": 6, "selected": false, "text": "Go To Definition" } ]
2008/10/03
[ "https://Stackoverflow.com/questions/168369", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9611/" ]
168,396
<p>Is there a way to use .NET reflection to capture the values of all parameters/local variables?</p>
[ { "answer_id": 168425, "author": "RyanFetz", "author_id": 23776, "author_profile": "https://Stackoverflow.com/users/23776", "pm_score": 0, "selected": false, "text": "System.Diagnostics.StackTrace sTrace = new System.Diagnostics.StackTrace(true);\nfor (Int32 frameCount = 0; frameCount < ...
2008/10/03
[ "https://Stackoverflow.com/questions/168396", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7529/" ]
168,402
<p>I have run across an XML Schema with the following definition:</p> <pre><code>&lt;xs:simpleType name="ClassRankType"&gt; &lt;xs:restriction base="xs:integer"&gt; &lt;xs:totalDigits value="4"/&gt; &lt;xs:minInclusive value="1"/&gt; &lt;xs:maxInclusive value="9999"/&gt; &lt;/xs:restriction&gt; &lt;/xs:simpleType&gt; </code></pre> <p>However, it seems to me that <code>totalDigits</code> is redundant. I am somewhat new to XML Schema, and want to make sure I'm not missing something.</p> <p>What is the actual behavior of <code>totalDigits</code> vs. <code>maxInclusive</code>?</p> <p>Can <code>totalDigits</code> always be represented with a combination of <code>minInclusive</code> and <code>MaxInclusive</code>? </p> <p>How does <code>totalDigits</code> affect negative numbers?</p>
[ { "answer_id": 168466, "author": "ConroyP", "author_id": 2287, "author_profile": "https://Stackoverflow.com/users/2287", "pm_score": 4, "selected": true, "text": "minInclusive" } ]
2008/10/03
[ "https://Stackoverflow.com/questions/168402", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24954/" ]
168,408
<p>It looks like I had a fundamental misunderstanding about C++ :&lt;</p> <p>I like the polymorphic container solution. Thank you SO, for bringing that to my attention :)</p> <hr> <p>So, we have a need to create a relatively generic container type object. It also happens to encapsulate some business related logic. However, we need to store essentially arbitrary data in this container - everything from primitive data types to complex classes.</p> <p>Thus, one would immediately jump to the idea of a template class and be done with it. However, I have noticed C++ polymorphism and templates do not play well together. Being that there is some complex logic that we are going to have to work, I would rather just stick with either templates OR polymorphism, and not try to fight C++ by making it do both.</p> <p>Finally, given that I want to do one or the other, I would prefer polymorphism. I find it much easier to represent constraints like "this container contains Comparable types" - a la java.</p> <p>Bringing me to the topic of question: At the most abstract, I imagine that I could have a "Container" pure virtual interface that has something akin to "push(void* data) and pop(void* data)" (for the record, I am not actually trying to implement a stack).</p> <p>However, I don't really like void* at the top level, not to mention the signature is going to change every time I want to add a constraint to the type of data a concrete container can work with.</p> <p>Summarizing: We have relatively complex containers that have various ways to retrieve elements. We want to be able to vary the constraints on the elements that can go into the containers. Elements should work with multiple kinds of containers (so long as they meet the constraints of that particular container).</p> <p>Edit: I should also mention that the containers themselves need to be polymorphic. That is my primary reason for not wanting to use templated C++.</p> <p>So - should I drop my love for Java type interfaces and go with templates? Should I use void* and statically cast everything? Or should I go with an empty class definition "Element" that declares nothing and use that as my top level class in the "Element" hierarchy?</p> <p>One of the reasons why I love stack overflow is that many of the responses provide some interesting insight on other approaches that I hadn't not have even considered. So thank you in advance for your insights and comments.</p>
[ { "answer_id": 168442, "author": "Lev", "author_id": 7224, "author_profile": "https://Stackoverflow.com/users/7224", "pm_score": 3, "selected": false, "text": "void push(T* new_element)" }, { "answer_id": 168451, "author": "Dima", "author_id": 13313, "author_profile":...
2008/10/03
[ "https://Stackoverflow.com/questions/168408", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14621/" ]
168,409
<p>What is the best way to get a list of all files in a directory, sorted by date [created | modified], using python, on a windows machine?</p>
[ { "answer_id": 168424, "author": "Jay", "author_id": 20840, "author_profile": "https://Stackoverflow.com/users/20840", "pm_score": 8, "selected": false, "text": "import glob\nimport os\n\nsearch_dir = \"/mydir/\"\n# remove anything from the list that is not a file (directories, symlinks)...
2008/10/03
[ "https://Stackoverflow.com/questions/168409", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24953/" ]
168,415
<p>For my current project, I need to request XML data over a tcp/ip socket connection. For this, I am using the TcpClient class:</p> <pre><code>Dim client As New TcpClient() client.Connect(server, port) Dim stream As NetworkStream = client.GetStream() stream.Write(request) stream.Read(buffer, 0, buffer.length) // Output buffer and return results... </code></pre> <p>Now this works fine and dandy for small responses. However, when I start receiving larger blocks of data, it appears that the data gets pushed over the socket connection in bursts. When this happens, the stream.Read call only reads the first burst, and thus I miss out on the rest of the response. </p> <p>What's the best way to handle this issue? Initially I tried to just loop until I had a valid XML document, but I found that in between stream.Read calls the underlying stream would sometimes get shut down and I would miss out on the last portion of the data.</p>
[ { "answer_id": 168418, "author": "Sunny Milenov", "author_id": 8220, "author_profile": "https://Stackoverflow.com/users/8220", "pm_score": 3, "selected": true, "text": "int bytes_read = 0;\nwhile (bytes_read < buffer.Length)\n bytes_read += stream.Read(buffer, bytes_read, buffer.length...
2008/10/03
[ "https://Stackoverflow.com/questions/168415", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1574/" ]
168,423
<p>I have a personal wiki that I take notes on. The wiki's pages are in a subversion working copy directory, "pages", and I set their permissions to 664, owned by www-data:www-data. My username is in the "www-data" group, so I can checkin and mess with the pages manually.</p> <p>For a while, I had an issue because every time I ran a checkin, the files would be owned by me:www-data instead of www-data:www-data, and I would no longer be able to change the wiki files through my web interface! I solved the issue by flipping the setgid bit on the "pages" directory, but I'm still confused as to why this happened in the first place:</p> <p>Every time I check something into subversion, it appears as if svn deletes it and recreates it. Why? Does this behavior support some functionality that I'm not aware of? Is there a way to change it?</p> <p>Thanks!</p>
[ { "answer_id": 178496, "author": "Kent Fredric", "author_id": 15614, "author_profile": "https://Stackoverflow.com/users/15614", "pm_score": 3, "selected": true, "text": "find -type d -exec chgrp www-data {} + \nfind -type d -exec chmod g+s {} + \n" } ]
2008/10/03
[ "https://Stackoverflow.com/questions/168423", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16034/" ]
168,427
<p>Which of <a href="http://en.wikipedia.org/wiki/Crystal_Reports" rel="noreferrer">Crystal Reports</a> and <a href="http://en.wikipedia.org/wiki/SQL_Server_Reporting_Services" rel="noreferrer">SSRS</a> (SQL Server Reporting Services) is better to use?</p>
[ { "answer_id": 171536, "author": "Peter Wone", "author_id": 1715673, "author_profile": "https://Stackoverflow.com/users/1715673", "pm_score": 7, "selected": false, "text": "SELECT COUNT(*) FROM SOMETABLE WHERE 1=0" } ]
2008/10/03
[ "https://Stackoverflow.com/questions/168427", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14299/" ]
168,438
<p>I'm trying to parse objects to XML in Delphi, so I read about calling the object's ClassInfo method to get its RTTI info.</p> <p>The thing is, this apparently only works for TPersistent objects. Otherwise, I have to specifically add a compiler directive {$M+} to the source code for the compiler to generate RTTI info.</p> <p>So I happily added the directive, only to find that, even if it did return something from the ClassInfo call (it used to return nil), now I cannot retrieve the class' properties, fields or methods from it. It's like it created the object empty.</p> <p>Any idea what am I missing here? Thanks!</p>
[ { "answer_id": 168476, "author": "gabr", "author_id": 4997, "author_profile": "https://Stackoverflow.com/users/4997", "pm_score": 4, "selected": true, "text": "published" }, { "answer_id": 46253778, "author": "Edgar Pavão", "author_id": 8527033, "author_profile": "htt...
2008/10/03
[ "https://Stackoverflow.com/questions/168438", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16732/" ]
168,455
<p>How do you post data to an iframe?</p>
[ { "answer_id": 168488, "author": "Dylan Beattie", "author_id": 5017, "author_profile": "https://Stackoverflow.com/users/5017", "pm_score": 10, "selected": true, "text": "target=\"\"" }, { "answer_id": 11131626, "author": "kapil", "author_id": 980571, "author_profile":...
2008/10/03
[ "https://Stackoverflow.com/questions/168455", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24958/" ]
168,464
<p>Since <em>length</em> is a JavaScript property, does it matter whether I use</p> <pre><code>for( var i = 0; i &lt; myArray.length; i++ ) </code></pre> <p>OR</p> <pre><code>var myArrayLength = myArray.length; for( var i = 0; i &lt; myArrayLength ; i++ ) </code></pre> <p>­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­</p>
[ { "answer_id": 168473, "author": "Grant Wagner", "author_id": 9254, "author_profile": "https://Stackoverflow.com/users/9254", "pm_score": 3, "selected": false, "text": "for(var i = 0, iLen = myArray.length; i < iLen; i++)\n" }, { "answer_id": 168479, "author": "AnthonyWJones"...
2008/10/03
[ "https://Stackoverflow.com/questions/168464", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
168,486
<p>For my customer I occasionally do work in their live database in order to fix a problem they have created for themselves, or in order to fix bad data that my product's bugs created. Much like Unix root access, it's just dangerous. What lessons should I learn ahead of time?</p> <p>What is the #1 thing you do to be careful about operating on live data?</p>
[ { "answer_id": 168508, "author": "bdukes", "author_id": 2688, "author_profile": "https://Stackoverflow.com/users/2688", "pm_score": 2, "selected": false, "text": "WHERE" }, { "answer_id": 168529, "author": "Paul Tomblin", "author_id": 3333, "author_profile": "https://...
2008/10/03
[ "https://Stackoverflow.com/questions/168486", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10906/" ]
168,528
<p>I know I can get this to technically work but I'd like to implement the cleanest possible solution. Here's the situation:</p> <p>I have a managed library which wraps an unmanaged C-style library. The C-style library functionality I'm currently wrapping does some processing involving a list of strings. The library's client code can provide a delegate, such that during the list processing, if an "invalid" scenario is encountered, the library can callback to the client via this delegate and allow them to choose the strategy to use (throw an exception, replace the invalid characters, etc.)</p> <p>What I'd ideally like to have is all of the managed C++ isolated in one function, and then be able to call a separate function which takes only unmanaged parameters so that all of the native C++ and unmanaged code is isolated at that one point. Providing the callback mechanism to this unmanaged code is proving to be the sticking point for me.</p> <pre><code> #pragma managed public delegate string InvalidStringFilter(int lineNumber, string text); ... public IList&lt;Result&gt; DoListProcessing(IList&lt;string&gt; listToProcess, InvalidStringFilter filter) { // Managed code goes here, translate parameters etc. } #pragma unmanaged // This should be the only function that actually touches the C-library directly std::vector&lt;NativeResult&gt; ProcessList(std::vector&lt;char*&gt; list, ?? callback); </code></pre> <p>In this snippet, I want to keep all of the C-library access within ProcessList, but during the processing, it will need to do callbacks, and this callback is provided in the form of the InvalidStringFilter delegate which is passed in from some client of my managed library.</p>
[ { "answer_id": 168604, "author": "Rob Walker", "author_id": 3631, "author_profile": "https://Stackoverflow.com/users/3631", "pm_score": 2, "selected": false, "text": "\n#pragma managed\npublic delegate string InvalidStringFilter(int lineNumber, string text);\n\n...\nstatic InvalidStringF...
2008/10/03
[ "https://Stackoverflow.com/questions/168528", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24965/" ]
168,531
<p>I have a very large file that looks like this (see below). I have two basic choices of regex to use on it (I know there may be others but I'm really trying to compare Greedy and Negated Char Class) methods.</p> <pre><code>ftp: [^\D]{1,} ftp: (\d)+ ftp: \d+ </code></pre> <p><strong><em>Note: what if I took off the parense around the \d?</em></strong></p> <p>Now + is greedy which forces backtracking but the Negated Char Class require a char-by-char comparison. Which is more efficient? Assume the file is very-very large so minute differences in processor usage will become exaggerated due to the length of the file.</p> <p>Now that you've answered that, What if my Negated Char Class was very large, say 18 different characters? Would that change your answer?</p> <p>Thanks.</p> <blockquote> <p>ftp: 1117 bytes<br> ftp: 5696 bytes<br> ftp: 3207 bytes<br> ftp: 5696 bytes<br> ftp: 7200 bytes</p> </blockquote>
[ { "answer_id": 168563, "author": "Markus Jarderot", "author_id": 22364, "author_profile": "https://Stackoverflow.com/users/22364", "pm_score": 2, "selected": false, "text": "\\d+?\n" }, { "answer_id": 168570, "author": "thelsdj", "author_id": 163, "author_profile": "h...
2008/10/03
[ "https://Stackoverflow.com/questions/168531", "https://Stackoverflow.com", "https://Stackoverflow.com/users/730/" ]
168,550
<p>How can I display a tooltip over a button using <a href="http://en.wikipedia.org/wiki/Windows_Forms" rel="noreferrer">Windows Forms</a>?</p>
[ { "answer_id": 168555, "author": "Fry", "author_id": 23553, "author_profile": "https://Stackoverflow.com/users/23553", "pm_score": -1, "selected": false, "text": "ToolTip t = new ToolTip();\n" }, { "answer_id": 168585, "author": "DaveK", "author_id": 4244, "author_pro...
2008/10/03
[ "https://Stackoverflow.com/questions/168550", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
168,559
<p><a href="http://www.python.org/doc/2.5.2/lib/module-tempfile.html" rel="noreferrer">tempfile.mkstemp()</a> returns:</p> <blockquote> <p>a tuple containing an OS-level handle to an open file (as would be returned by os.open()) and the absolute pathname of that file, in that order.</p> </blockquote> <p>How do I convert that OS-level handle to a file object?</p> <p>The <a href="http://www.python.org/doc/2.5.2/lib/os-fd-ops.html" rel="noreferrer">documentation for os.open()</a> states: </p> <blockquote> <p>To wrap a file descriptor in a "file object", use fdopen().</p> </blockquote> <p>So I tried:</p> <pre><code>&gt;&gt;&gt; import tempfile &gt;&gt;&gt; tup = tempfile.mkstemp() &gt;&gt;&gt; import os &gt;&gt;&gt; f = os.fdopen(tup[0]) &gt;&gt;&gt; f.write('foo\n') Traceback (most recent call last): File "&lt;stdin&gt;", line 1, in ? IOError: [Errno 9] Bad file descriptor </code></pre>
[ { "answer_id": 168584, "author": "Peter Hoffmann", "author_id": 720, "author_profile": "https://Stackoverflow.com/users/720", "pm_score": 7, "selected": true, "text": "os.write(tup[0], \"foo\\n\")\n" }, { "answer_id": 168705, "author": "Alex Coventry", "author_id": 194121...
2008/10/03
[ "https://Stackoverflow.com/questions/168559", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4766/" ]
168,560
<p>What is the best way to perform a couple of tasks together and if one task fails then the next tasks should not be completed? I know if it were the database operations then I should have used Transactions but I am talking about different types of operations like the following: </p> <p>All tasks must pass: </p> <p>SendEmail ArchiveReportsInDatabase CreateAFile</p> <p>In the above scenario all the tasks must pass or else the whole batch operation must be rollback. </p>
[ { "answer_id": 168605, "author": "easeout", "author_id": 10906, "author_profile": "https://Stackoverflow.com/users/10906", "pm_score": 1, "selected": false, "text": "try {\n task1();\n task2();\n task3();\n ...\n taskN();\n}\ncatch (TaskFailureException e) {\n dealWith(...
2008/10/03
[ "https://Stackoverflow.com/questions/168560", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3797/" ]
168,589
<p>I can do this:</p> <pre><code>$ find . . ./b ./b/foo ./c ./c/foo </code></pre> <p>And this:</p> <pre><code>$ find . -type f -exec cat {} \; This is in b. This is in c. </code></pre> <p>But not this:</p> <pre><code>$ find . -type f -exec cat &gt; out.txt {} \; </code></pre> <p>Why not?</p>
[ { "answer_id": 168595, "author": "Commodore Jaeger", "author_id": 4659, "author_profile": "https://Stackoverflow.com/users/4659", "pm_score": 6, "selected": true, "text": "$ find . -type f -exec cat {} \\; > out.txt\n" }, { "answer_id": 168603, "author": "Jay", "author_id...
2008/10/03
[ "https://Stackoverflow.com/questions/168589", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22917/" ]
168,594
<p>I am creating some build scripts that interact with Perforce and I would like to mark for delete a few files. What exactly is the P4 syntax using the command line?</p>
[ { "answer_id": 168614, "author": "JR Lawhorne", "author_id": 22917, "author_profile": "https://Stackoverflow.com/users/22917", "pm_score": 4, "selected": true, "text": "p4 delete filename\n" }, { "answer_id": 168617, "author": "Swati", "author_id": 12682, "author_prof...
2008/10/03
[ "https://Stackoverflow.com/questions/168594", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4872/" ]
168,596
<p>When an Event is triggered by a user in IE, it is set to the <code>window.event</code> object. The only way to see what triggered the event is by accessing the <code>window.event</code> object (as far as I know)</p> <p>This causes a problem in ASP.NET validators if an event is triggered programmatically, like when triggering an event through jQuery. In this case, the <code>window.event</code> object stores the last user-triggered event.</p> <p>When the <code>onchange</code> event is fired programmatically for a text box that has an ASP.NET validator attached to it, the validation breaks because it is looking at the element that fired last event, which is not the element the validator is for.</p> <p>Does anyone know a way around this? It seems like a problem that is solvable, but from looking online, most people just find ways to ignore the problem instead of solving it.</p> <hr> <p><strong>To explain what I'm doing specifically:</strong><br> I'm using a jQuery time picker plugin on a text box that also has 2 ASP.NET validators associated with it. When the time is changed, I'm using an update panel to post back to the server to do some things dynamically, so I need the onchange event to fire in order to trigger the postback for that text box.</p> <p>The jQuery time picker operates by creating a hidden unordered list that is made visible when the text box is clicked. When one of the list items is clicked, the "change" event is fired programmatically for the text box through jQuery's <code>change()</code> method.</p> <p>Because the trigger for the event was a list item, IE sees the <em>list item</em> as the source of the event, not the text box, like it should.</p> <p>I'm not too concerned with this ASP.NET validator working as soon as the text box is changed, I just need the "<code>change</code>" event to be processed so my postback event is called for the text box. The problem is that the validator throws an exception in IE which stops any event from being triggered.</p> <p>Firefox (and I assume other browsers) don't have this issue. Only IE due to the different event model. Has anyone encountered this and seen how to fix it?</p> <hr> <p>I've found this problem reported several other places, but they offer no solutions: </p> <ul> <li><a href="http://groups.google.com/group/jquery-en/browse_thread/thread/a8902f2774edc05a/d119026f561ca528?lnk=raot" rel="noreferrer">jQuery's forum, with the jQuery UI Datepicker and an ASP.NET Validator</a></li> <li><a href="http://forums.asp.net/t/1326208.aspx" rel="noreferrer">ASP.NET forums, bug with ValidatorOnChange() function</a></li> </ul>
[ { "answer_id": 371396, "author": "quark", "author_id": 46680, "author_profile": "https://Stackoverflow.com/users/46680", "pm_score": 3, "selected": false, "text": "jQuery.fn.extend({\n fire: function(evttype){ \n el = this.get(0);\n if (document.createEvent) {\n ...
2008/10/03
[ "https://Stackoverflow.com/questions/168596", "https://Stackoverflow.com", "https://Stackoverflow.com/users/392/" ]
168,610
<p>I have a PHP web application on an intranet that can extract the IP and host name of the current user on that page, but I was wondering if there is a way to get/extract their Active Directory/Windows username as well. Is this possible?</p>
[ { "answer_id": 168626, "author": "Dylan Beattie", "author_id": 5017, "author_profile": "https://Stackoverflow.com/users/5017", "pm_score": 7, "selected": true, "text": "AUTH_USER" }, { "answer_id": 168675, "author": "hangy", "author_id": 11963, "author_profile": "http...
2008/10/03
[ "https://Stackoverflow.com/questions/168610", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10708/" ]
168,621
<p>I'm having trouble with my php code not indenting correctly...</p> <p>I would like my code to look like this</p> <pre><code>if (foo) { print "i am indented"; } </code></pre> <p>but it always looks like this:</p> <pre><code>if (foo) { print "i am not indented correctly"; } </code></pre> <p>I tired googling for similar things and tried adding the following to my .emacs, but it didn't work at all.</p> <p>Any thoughts?</p> <pre><code> (add-hook 'php-mode-hook (function (lambda () ;; GNU style (setq php-indent-level 4 php-continued-statement-offset 4 php-continued-brace-offset 0 php-brace-offset 0 php-brace-imaginary-offset 0 php-label-offset -4)))) </code></pre>
[ { "answer_id": 171798, "author": "troelskn", "author_id": 18180, "author_profile": "https://Stackoverflow.com/users/18180", "pm_score": 1, "selected": false, "text": "(defun my-build-tab-stop-list (width)\n (let ((num-tab-stops (/ 80 width))\n (counter 1)\n (ls nil))\n ...
2008/10/03
[ "https://Stackoverflow.com/questions/168621", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
168,639
<p>In Java, suppose I have a String variable S, and I want to search for it inside of another String T, like so:</p> <pre><code> if (T.matches(S)) ... </code></pre> <p>(note: the above line was T.contains() until a few posts pointed out that that method does not use regexes. My bad.)</p> <p>But now suppose S may have unsavory characters in it. For instance, let S = "[hi". The left square bracket is going to cause the regex to fail. Is there a function I can call to escape S so that this doesn't happen? In this particular case, I would like it to be transformed to "\[hi".</p>
[ { "answer_id": 168662, "author": "Aaron", "author_id": 19130, "author_profile": "https://Stackoverflow.com/users/19130", "pm_score": 0, "selected": false, "text": " String S = \"\\\\[hi\"\n" }, { "answer_id": 168884, "author": "Michael Myers", "author_id": 13531, "a...
2008/10/03
[ "https://Stackoverflow.com/questions/168639", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24973/" ]
168,659
<p>I found this via google: <a href="http://www.mvps.org/access/api/api0008.htm" rel="nofollow noreferrer">http://www.mvps.org/access/api/api0008.htm</a></p> <pre class="lang-vb prettyprint-override"><code>'******************** Code Start ************************** ' This code was originally written by Dev Ashish. ' It is not to be altered or distributed, ' except as part of an application. ' You are free to use it in any application, ' provided the copyright notice is left unchanged. ' ' Code Courtesy of ' Dev Ashish ' Private Declare Function apiGetUserName Lib "advapi32.dll" Alias _ "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long Function fOSUserName() As String ' Returns the network login name Dim lngLen As Long, lngX As Long Dim strUserName As String strUserName = String$(254, 0) lngLen = 255 lngX = apiGetUserName(strUserName, lngLen) If ( lngX &gt; 0 ) Then fOSUserName = Left$(strUserName, lngLen - 1) Else fOSUserName = vbNullString End If End Function '******************** Code End ************************** </code></pre> <p>Is this the best way to do it?</p>
[ { "answer_id": 168682, "author": "bugBurger", "author_id": 13337, "author_profile": "https://Stackoverflow.com/users/13337", "pm_score": 1, "selected": false, "text": "For Each strComputer In arrComputers\n Set objWMIService = GetObject(\"winmgmts:\\\\\" & strComputer & \"\\root\\cimv...
2008/10/03
[ "https://Stackoverflow.com/questions/168659", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2462/" ]
168,661
<p>I have a table with one column and about ten rows. The first column has rows with text as row headers, "header 1", "header 2". The second column contains fields for the user to type data (<em>textboxes</em> and <em>checkboxes</em>). </p> <p>I want to have a button at the top labelled "<em>Add New...</em>", and have it create a third column, with the same fields as the first column. If the user clicks it again, it will create another blank column with fields (as in the second column).</p> <p>Does anyone know of an effective way to manipulate the DOM to achieve this?</p> <p>I'm experimenting with <code>div</code>'s and <code>TABLES</code> but i'm on my third day of doing this, and it feels harder than it should be.</p>
[ { "answer_id": 168670, "author": "Tom Ritter", "author_id": 8435, "author_profile": "https://Stackoverflow.com/users/8435", "pm_score": 2, "selected": false, "text": "function(table)\n{\n for(var i=0;i<table.rows.length;i++)\n {\n newcell = table.rows[i].cells[0].cloneNode(true);\n ...
2008/10/03
[ "https://Stackoverflow.com/questions/168661", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
168,664
<p>Given a table or a temp table, I'd like to run a procedure that will output a SQL script (i.e. a bunch of INSERT statements) that would populate the table. Is this possible in MS SQL Server 2000?</p>
[ { "answer_id": 168670, "author": "Tom Ritter", "author_id": 8435, "author_profile": "https://Stackoverflow.com/users/8435", "pm_score": 2, "selected": false, "text": "function(table)\n{\n for(var i=0;i<table.rows.length;i++)\n {\n newcell = table.rows[i].cells[0].cloneNode(true);\n ...
2008/10/03
[ "https://Stackoverflow.com/questions/168664", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17997/" ]
168,672
<p>I have a table on SQL2000 with a numeric column and I need the select to return a 01, 02, 03...</p> <p>It currently returns 1,2,3,...10,11...</p> <p>Thanks.</p>
[ { "answer_id": 168689, "author": "John Millikin", "author_id": 3560, "author_profile": "https://Stackoverflow.com/users/3560", "pm_score": 4, "selected": true, "text": "SELECT REPLACE(STR(mycolumn, 2), ' ', '0')\n" }, { "answer_id": 168739, "author": "Patrick Szalapski", ...
2008/10/03
[ "https://Stackoverflow.com/questions/168672", "https://Stackoverflow.com", "https://Stackoverflow.com/users/212/" ]
168,691
<p>If I'm deep in a nest of loops I'm wondering which of these is more efficient:</p> <pre><code>if (!isset($array[$key])) $array[$key] = $val; </code></pre> <p>or</p> <pre><code>$array[$key] = $val; </code></pre> <p>The second form is much more desirable as far as readable code goes. In reality the names are longer and the array is multidimensional. So the first form ends up looking pretty gnarly in my program.</p> <p>But I'm wondering if the second form might be slower. Since the code is in one of the most frequently-executed functions in the program, I'd like to use the faster form.</p> <p>Generally speaking this code will execute many times with the same value of "$key". So in most cases $array[$key] will already be set, and the isset() will return FALSE.</p> <p>To clarify for those who fear that I'm treating non-identical code as if it were identical: as far as this part of the program is concerned, $val is a constant. It isn't known until run-time, but it's set earlier in the program and doesn't change here. So both forms produce the same result. And this is the most convenient place to get at $val.</p>
[ { "answer_id": 168820, "author": "hangy", "author_id": 11963, "author_profile": "https://Stackoverflow.com/users/11963", "pm_score": 2, "selected": false, "text": "$array[$key]" }, { "answer_id": 168824, "author": "Robert K", "author_id": 24950, "author_profile": "htt...
2008/10/03
[ "https://Stackoverflow.com/questions/168691", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8722/" ]
168,727
<p>A lot of useful features in Python are somewhat "hidden" inside modules. Named tuples (new in <a href="http://docs.python.org/whatsnew/2.6.html" rel="nofollow noreferrer">Python 2.6</a>), for instance, are found in the <a href="http://docs.python.org/library/collections.html" rel="nofollow noreferrer">collections</a> module. </p> <p>The <a href="http://docs.python.org/library/" rel="nofollow noreferrer">Library Documentation page</a> will give you all the modules in the language, but newcomers to Python are likely to find themselves saying "Oh, I didn't know I could have done it <em>this way</em> using Python!" unless the important features in the language are pointed out by the experienced developers.</p> <p>I'm <strong>not</strong> specifically looking for new modules in Python 2.6, but modules that can be found in this latest release.</p>
[ { "answer_id": 168768, "author": "Eli Courtwright", "author_id": 1694, "author_profile": "https://Stackoverflow.com/users/1694", "pm_score": 4, "selected": false, "text": "multiprocessing" }, { "answer_id": 168795, "author": "Dan Lenski", "author_id": 20789, "author_p...
2008/10/03
[ "https://Stackoverflow.com/questions/168727", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8669/" ]
168,732
<p>.NET has System.Uri for Uris and System.IO.FileInfo for file paths. I am looking for classes which are traditionally object oriented in that they specify both meaning and behavior for the string which is used in the object's construction. What other useful string encapsulation classes exist?</p> <p>Things such as regular expressions and StringBuilders are useful for the gross manipulation of strings but they aren't what I'm looking for.</p>
[ { "answer_id": 168782, "author": "hangy", "author_id": 11963, "author_profile": "https://Stackoverflow.com/users/11963", "pm_score": 2, "selected": false, "text": "using (System.Security.SecureString password = new System.Security.SecureString())\n{\n password.AppendChar('s');\n pa...
2008/10/03
[ "https://Stackoverflow.com/questions/168732", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9251/" ]
168,736
<p>How do you set a default value for a MySQL Datetime column?</p> <p>In SQL Server it's <code>getdate()</code>. What is the equivalant for MySQL? I'm using MySQL 5.x if that is a factor.</p>
[ { "answer_id": 168832, "author": "sebthebert", "author_id": 24820, "author_profile": "https://Stackoverflow.com/users/24820", "pm_score": 11, "selected": true, "text": "mysql> create table test (str varchar(32), ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP);\nQuery OK, 0 rows affected (0.00 se...
2008/10/03
[ "https://Stackoverflow.com/questions/168736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3747/" ]
168,738
<p>I am building the diagram component in JavaScript. It has two layers rendered separately: foreground and background.</p> <p>To determine the required size of the background:</p> <ol> <li>render the foreground </li> <li>measure the height of the result</li> <li>render the foreground and the background together</li> </ol> <p>In code it looks like this:</p> <pre><code>var foreground = renderForegroundIntoString(); parentDiv.innerHTML = foreground; var height = parentDiv.children[0].clientHeight; var background = renderBackgroundIntoString(height); parentDiv.innerHTML = foreground + background; </code></pre> <p>Using IE7, this is a piece of cake. However, Firefox2 is not really willing to render the <code>parentDiv.innerHTML</code> right away, therefore I cannot read out the foreground height.</p> <p>When does Firefox execute the rendering and how can I delay my background generation till foreground rendering is completed, or is there any alternative way to determine the height of my foreground elements?</p> <p>[Appended after testing Dan's answer (thanx Dan)]</p> <p>Within the body of the callback method (called back by <code>setTimeout(...))</code> I can see, the rendering of the <code>innerHTML</code> is still not complete. </p>
[ { "answer_id": 168767, "author": "Dan", "author_id": 17121, "author_profile": "https://Stackoverflow.com/users/17121", "pm_score": 2, "selected": false, "text": "setTimeout(renderBackground, 0)\n" } ]
2008/10/03
[ "https://Stackoverflow.com/questions/168738", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24451/" ]
168,798
<p>I've exposed several web services in our product using Java and WS-Security. One of our customers wants to consume the web service using ColdFusion. Does ColdFusion support WS-Security? Can I get around it by writing a Java client and using that in ColdFusion?</p> <p>(I don't know much about ColdFusion).</p>
[ { "answer_id": 178131, "author": "Jason", "author_id": 3242, "author_profile": "https://Stackoverflow.com/users/3242", "pm_score": 4, "selected": true, "text": "<cfset local.soapHeader = xmlNew()>\n<cfset local.soapHeader.TheSoapHeader = xmlElemNew(local.soapHeader, \"http://someurl.com/...
2008/10/03
[ "https://Stackoverflow.com/questions/168798", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1310/" ]
168,826
<p>In ASP.net 2.0, the PreviousPage property of a web page does not have a ViewState collection. I want to use this collection to transfer information between pages.</p>
[ { "answer_id": 168888, "author": "Keith Walton", "author_id": 22448, "author_profile": "https://Stackoverflow.com/users/22448", "pm_score": 0, "selected": false, "text": "<%@ previouspagetype virtualpath=\"~/firstpage.aspx\" %>\n" }, { "answer_id": 6609609, "author": "jekcom"...
2008/10/03
[ "https://Stackoverflow.com/questions/168826", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22448/" ]
168,833
<p>I wish to perform an experiment many different times. After every trial, I am left with a "large" set of output statistics -- let's say, 1000. I would like to store the outputs of my experiments in a table, but what's the best way...?</p> <h3>Option 1</h3> <p>Have a table with 1000 columns. Seems like a bad idea. What if the number of statistics one day exceeds the maximum number of columns?</p> <h3>Option 2</h3> <p>Have a table with three columns. Let's say, ID, StatisticType, and StatisticValue. That way, you can have as many statistics as you want. However, reading a single experiments statistics becomes more complicated. Moreover, what if different statistics are different data types??</p> <p>Any suggestions?</p>
[ { "answer_id": 168850, "author": "matli", "author_id": 23896, "author_profile": "https://Stackoverflow.com/users/23896", "pm_score": 0, "selected": false, "text": "SELECT * FROM table WHERE Experiment = 5;" } ]
2008/10/03
[ "https://Stackoverflow.com/questions/168833", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10675/" ]
168,838
<p>I am trying to visualize some values on a form. They range from 0 to 200 and I would like the ones around 0 be green and turn bright red as they go to 200. </p> <p>Basically the function should return color based on the value inputted. Any ideas ?</p>
[ { "answer_id": 168846, "author": "Peter Parker", "author_id": 23264, "author_profile": "https://Stackoverflow.com/users/23264", "pm_score": 3, "selected": false, "text": "red = (float)val / 200 * 255;\n\ngreen = (float)(200 - val) / 200 * 255;\n\nblue = 0;\n\nreturn red << 16 + green << ...
2008/10/03
[ "https://Stackoverflow.com/questions/168838", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4694/" ]
168,886
<p>I'm looking for a homegrown way to scramble production data for use in development and test. I've built a couple of scripts that make random social security numbers, shift birth dates, scramble emails, etc. But I've come up against a wall trying to scramble customer names. I want to keep real names so we can still use or searches so random letter generation is out. What I have tried so far is building a temp table of all last names in the table then updating the customer table with a random selection from the temp table. Like this:</p> <pre><code>DECLARE @Names TABLE (Id int IDENTITY(1,1),[Name] varchar(100)) /* Scramble the last names (randomly pick another last name) */ INSERT @Names SELECT LastName FROM Customer ORDER BY NEWID(); WITH [Customer ORDERED BY ROWID] AS (SELECT ROW_NUMBER() OVER (ORDER BY NEWID()) AS ROWID, LastName FROM Customer) UPDATE [Customer ORDERED BY ROWID] SET LastName=(SELECT [Name] FROM @Names WHERE ROWID=Id) </code></pre> <p>This worked well in test, but completely bogs down dealing with larger amounts of data (>20 minutes for 40K rows)</p> <p>All of that to ask, how would you scramble customer names while keeping real names and the weight of the production data?</p> <p><strong>UPDATE:</strong> Never fails, you try to put all the information in the post, and you forget something important. This data will also be used in our sales &amp; demo environments which are publicly available. Some of the answers are what I am attempting to do, to 'switch' the names, but my question is literally, how to code in T-SQL?</p>
[ { "answer_id": 807426, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 1, "selected": false, "text": "DECLARE TABLE #Names \n(Id int IDENTITY(1,1),[Name] varchar(100))\n" }, { "answer_id": 38973047, "author": "AUR", ...
2008/10/03
[ "https://Stackoverflow.com/questions/168886", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24991/" ]
168,891
<p>If I have a sorted list (say quicksort to sort), if I have a lot of values to add, is it better to suspend sorting, and add them to the end, then sort, or use binary chop to place the items correctly while adding them. Does it make a difference if the items are random, or already more or less in order?</p>
[ { "answer_id": 168934, "author": "Ihar Bury", "author_id": 18001, "author_profile": "https://Stackoverflow.com/users/18001", "pm_score": 0, "selected": false, "text": "List<T>" }, { "answer_id": 169424, "author": "hazzen", "author_id": 5066, "author_profile": "https:/...
2008/10/03
[ "https://Stackoverflow.com/questions/168891", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22712/" ]
168,897
<p>Is it more performant to have a bidimensional array (<code>type[,]</code>) or an array of arrays (<code>type[][]</code>) in C#?</p> <p>Particularly for initial allocation and item access</p>
[ { "answer_id": 169958, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 4, "selected": true, "text": "Size 1000, Repeat 1000\n int[,] set: 3460\n int[,] get: 4036 (chk=1304808064)\n int[][] set: 2441\n int[][...
2008/10/03
[ "https://Stackoverflow.com/questions/168897", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1782/" ]
168,901
<pre><code>private IEnumerable&lt;string&gt; Tables { get { yield return "Foo"; yield return "Bar"; } } </code></pre> <p>Let's say I want iterate on those and write something like processing #n of #m. </p> <p>Is there a way I can find out the value of m without iterating before my main iteration?</p> <p>I hope I made myself clear.</p>
[ { "answer_id": 168922, "author": "Mendelt", "author_id": 3320, "author_profile": "https://Stackoverflow.com/users/3320", "pm_score": 10, "selected": true, "text": "IEnumerable" }, { "answer_id": 168954, "author": "Joel Coehoorn", "author_id": 3043, "author_profile": "...
2008/10/03
[ "https://Stackoverflow.com/questions/168901", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23893/" ]
168,912
<p>I need to show only one element at a time when a link is clicked on. Right now I'm cheating by hiding everything again and then toggling the element clicked on. This works, unless i want EVERYTHING to disappear again. Short of adding a "Hide All" button/link what can i do? I would like to be able to click on the link again, and hide it's content.</p> <p>EDIT: Pseudo's code would have worked, but the html here mistakenly led you to believe that all the links were in one div. instead of tracking down where they all were, it is easier to call them by their ID.</p> <p>Here's what I have so far:</p> <pre><code>$(document).ready(function(){ //hides everything $("#infocontent *").hide(); //now we show them by which they click on $("#linkjoedhit").click(function(event){ $("#infocontent *").hide(); $("#infojoedhit").toggle(); return false; }); $("#linkgarykhit").click(function(event){ $("#infocontent *").hide(); $("#infogarykhit").toggle(); return false; }); }); </code></pre> <p>and the html looks like:</p> <pre><code>&lt;div id="theircrappycode"&gt; &lt;a id="linkjoedhit" href=""&gt;Joe D&lt;/a&gt;&lt;br/&gt; &lt;a id="linkgarykhit" href=""&gt;Gary K&lt;/a&gt; &lt;/div&gt; &lt;div id="infocontent"&gt; &lt;p id="infojoedhit"&gt;Information about Joe D Hitting.&lt;/p&gt; &lt;p id="infogarykhit"&gt;Information about Gary K Hitting.&lt;/p&gt; &lt;/div </code></pre> <p>there are about 20 links like this. Because I am not coding the actual html, I have no control over the actual layout, which is horrendous. Suffice to say, this is the only way to organize the links/info.</p>
[ { "answer_id": 169036, "author": "micahwittman", "author_id": 11181, "author_profile": "https://Stackoverflow.com/users/11181", "pm_score": 3, "selected": true, "text": "$(\"#linkgarykhit\").click(function(){\n if($(\"#infogarykhit\").css('display') != 'none'){\n $(\"#infogarykhit...
2008/10/03
[ "https://Stackoverflow.com/questions/168912", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50/" ]