qid int64 4 22.2M | question stringlengths 18 48.3k | answers list | date stringlengths 10 10 | metadata list |
|---|---|---|---|---|
113,025 | <p>I'm trying to create an unusual associative array implementation that is very space-efficient, and I need a sorting algorithm that meets all of the following:</p>
<ol>
<li>Stable (Does not change the relative ordering of elements with equal keys.)</li>
<li>In-place or almost in-place (O(log n) stack is fine, but no O(n) space usage or heap allocations.</li>
<li>O(n log n) time complexity.</li>
</ol>
<p>Also note that the data structure to be sorted is an array.</p>
<p>It's easy to see that there's a basic algorithm that matches any 2 of these three (insertion sort matches 1 and 2, merge sort matches 1 and 3, heap sort matches 2 and 3), but I cannot for the life of me find anything that matches all three of these criteria.</p>
| [
{
"answer_id": 170422,
"author": "Eric",
"author_id": 4540,
"author_profile": "https://Stackoverflow.com/users/4540",
"pm_score": 2,
"selected": false,
"text": "function cmp( ar, idx1, idx2 )\n{\n // first compare elements as usual\n rc = (ar[idx1]<ar[idx2]) ? -1 : ( (ar[idx1]>ar[idx... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113025",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23903/"
] |
113,028 | <p>Internet Explorer 8 breaks what must be every 3rd page I look at. The point of this early release was, I presume, to give website owners the chance to update their sites so it wouldn't be such a hassle for the final release.</p>
<p>Has anyone actually done this?</p>
<p>Is anyone even planning on doing this?</p>
<p>I have yet to notice any of the big sites like ebay, myspace, facebook and so on bother so why will smaller sites if they can just use the compatibility mode?</p>
<p>I think i'll do it with mine, but how can you have your site compatible with IE7 and 8?</p>
| [
{
"answer_id": 113122,
"author": "Jon Galloway",
"author_id": 5,
"author_profile": "https://Stackoverflow.com/users/5",
"pm_score": 2,
"selected": false,
"text": "<html>\n<head>\n<title>Works in IE8</title>\n<meta http-equiv=\"X-UA-Compatible\" content=\"IE=EmulateIE7\"/>\n</head>\n<body... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113028",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19713/"
] |
113,033 | <p>I have three (C++) classes: Player, Hand, and Card.</p>
<p>Player has a member, hand, that holds a Hand. It also has a method, getHand(), that returns the contents of hand.</p>
<pre><code>Hand Player::getHand() {
return hand;
}
</code></pre>
<p>Hand has a method, addCard(Card c), that adds a card to the hand.</p>
<p>I want to do this:</p>
<p>player1.getHand().addCard(c);</p>
<p>but it doesn't work. It doesn't throw an error, so it's doing something. But if I examine the contents of player1's hand afterward, the card hasn't been added.</p>
<p>How can I get this to work?</p>
| [
{
"answer_id": 113053,
"author": "metao",
"author_id": 11484,
"author_profile": "https://Stackoverflow.com/users/11484",
"pm_score": 0,
"selected": false,
"text": " private:\n Hand(const Hand& rhs);\n Hand& operator=(const Hand& rhs);\n"
},
{
"answer_id": 113074,
"auth... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113033",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18420/"
] |
113,045 | <pre><code>SELECT GETDATE()
</code></pre>
<p>Returns: <code>2008-09-22 15:24:13.790</code></p>
<p>I want that date part without the time part: <code>2008-09-22 00:00:00.000</code></p>
<p>How can I get that?</p>
| [
{
"answer_id": 113051,
"author": "Nescio",
"author_id": 14484,
"author_profile": "https://Stackoverflow.com/users/14484",
"pm_score": 6,
"selected": false,
"text": "SELECT CONVERT(VARCHAR(10),GETDATE(),111)\n"
},
{
"answer_id": 113054,
"author": "Cade Roux",
"author_id": ... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113045",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5769/"
] |
113,077 | <p>I am creating a site in which different pages can look very different depending upon certain conditions (ie logged in or not, form filled out or not, etc). This makes it necessary to output diferent blocks of html at different times.</p>
<p>Doing that, however, makes my php code look horrific... it really messes with the formatting and "shape" of the code. How should I get around this? Including custom "html dump" functions at the bottom of my scripts? The same thing, but with includes? Heredocs (don't look too good)?</p>
<p>Thanks!</p>
| [
{
"answer_id": 113154,
"author": "Galen",
"author_id": 7894,
"author_profile": "https://Stackoverflow.com/users/7894",
"pm_score": 0,
"selected": false,
"text": "if ($_SESSION['logged_in'])\n include(TPL_DIR . 'main_logged_in.tpl'); \nelse\n include(tPL_DIR . 'main.tpl');\n"
},... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113077",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1615/"
] |
113,103 | <p>Can anyone explain the difference between the "name" property of a display object and the value found by <em>getChildByName("XXX")</em> function? They're the same 90% of the time, until they aren't, and things fall apart.</p>
<p>For example, in the code below, I find an object by instance name only by directly examining the child's name property; <em>getChildByName()</em> fails. </p>
<pre><code>var gfx:MovieClip = new a_Character(); //(a library object exported for Actionscript)
var do1:DisplayObject = null;
var do2:DisplayObject = null;
for( var i:int = 0 ; i < gfx.amSword.numChildren ; i++ )
{
var child:DisplayObject = gfx.amSword.getChildAt(i);
if( child.name == "amWeaponExchange" ) //An instance name set in the IDE
{
do2 = child;
}
}
trace("do2:", do2 );
var do1:DisplayObject = gfx.amSword.getChildByName("amWeaponExchange");
</code></pre>
<p>Generates the following output:</p>
<pre><code>do2: [object MovieClip]
ReferenceError: Error #1069: Property amWeaponExchange not found on builtin.as$0.MethodClosure and there is no default value.
</code></pre>
<p>Any ideas what Flash is thinking?</p>
| [
{
"answer_id": 122029,
"author": "defmeta",
"author_id": 10875,
"author_profile": "https://Stackoverflow.com/users/10875",
"pm_score": 2,
"selected": false,
"text": "var do1:DisplayObject = gfx.amSword.getChildByName[\"amWeaponExchange\"];\n"
}
] | 2008/09/22 | [
"https://Stackoverflow.com/questions/113103",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4969/"
] |
113,131 | <p>What WPF Calendar control would you recommend? I am looking for something that will let me display a variable amount of weeks potentially spanning multiple months.</p>
| [
{
"answer_id": 1421799,
"author": "Drew Noakes",
"author_id": 24874,
"author_profile": "https://Stackoverflow.com/users/24874",
"pm_score": 4,
"selected": true,
"text": "<c:Calendar>\n <c:DatePicker.BlackoutDates>\n <c:CalendarDateRange Start=\"4/1/2008\" End=\"4/6/2008\"/>\n ... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113131",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5618/"
] |
113,150 | <p>I have the following situation:</p>
<pre><code>
class A
{
public:
A(int whichFoo);
int foo1();
int foo2();
int foo3();
int callFoo(); // cals one of the foo's depending on the value of whichFoo
};
</code></pre>
<p>In my current implementation I save the value of <code>whichFoo</code> in a data member in the constructor and use a <code>switch</code> in <code>callFoo()</code> to decide which of the foo's to call. Alternatively, I can use a <code>switch</code> in the constructor to save a pointer to the right <code>fooN()</code> to be called in <code>callFoo()</code>. </p>
<p>My question is which way is more efficient if an object of class A is only constructed once, while <code>callFoo()</code> is called a very large number of times. So in the first case we have multiple executions of a switch statement, while in the second there is only one switch, and multiple calls of a member function using the pointer to it. I know that calling a member function using a pointer is slower than just calling it directly. Does anybody know if this overhead is more or less than the cost of a <code>switch</code>?</p>
<p>Clarification: I realize that you never really know which approach gives better performance until you try it and time it. However, in this case I already have approach 1 implemented, and I wanted to find out if approach 2 can be more efficient at least in principle. It appears that it can be, and now it makes sense for me to bother to implement it and try it. </p>
<p>Oh, and I also like approach 2 better for aesthetic reasons. I guess I am looking for a justification to implement it. :) </p>
| [
{
"answer_id": 113158,
"author": "Thomas",
"author_id": 14637,
"author_profile": "https://Stackoverflow.com/users/14637",
"pm_score": 1,
"selected": false,
"text": "callFoo"
},
{
"answer_id": 113329,
"author": "cos",
"author_id": 14535,
"author_profile": "https://Stac... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113150",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13313/"
] |
113,170 | <p>It appears the Python signal module doesn't have anything similar to the sighold and sigrelse functions found in C, using signal.h. Are there Python equivalents of <em>any</em> sort?</p>
<p>Many thanks!</p>
| [
{
"answer_id": 113158,
"author": "Thomas",
"author_id": 14637,
"author_profile": "https://Stackoverflow.com/users/14637",
"pm_score": 1,
"selected": false,
"text": "callFoo"
},
{
"answer_id": 113329,
"author": "cos",
"author_id": 14535,
"author_profile": "https://Stac... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113170",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
113,173 | <p>I'm working on a something related to roughset right now. The project uses alot of sets operation and manipulation. I've been using string operations as a stop gap measure for set operation. It has worked fine until we need to process some ungodly amount of data ( 500,000 records with about 40+ columns each ) through the algorithm. </p>
<p>I know that there is no set data structure in .net 2.0(2.0 was the latest when I started the project) I want to know if there is any library that offer fast set operation in .net c# or if 3.5 has added native set data structure.</p>
<p>Thanks .</p>
| [
{
"answer_id": 113919,
"author": "Dejan Milicic",
"author_id": 158320,
"author_profile": "https://Stackoverflow.com/users/158320",
"pm_score": 0,
"selected": false,
"text": "HashSet<T>"
},
{
"answer_id": 113967,
"author": "Martijn",
"author_id": 17439,
"author_profile... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113173",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2976/"
] |
113,185 | <p>I've installed <a href="http://www.owfs.org/" rel="nofollow noreferrer"><code>owfs</code></a> and am trying to read the data off a <a href="http://www.maxim-ic.com/quick_view2.cfm/qv_pk/4088" rel="nofollow noreferrer">iButton temperature logger</a>.</p>
<p><code>owfs</code> lets me mount the iButton as a fuse filesystem and I can see all the data. I'm having trouble figuring out what is the best way to access the data though. I can get individual readings by <code>cat</code>ting the files, e.g. <code>cat onewire/{deviceid}/log/temperature.1</code>, but the <code>onewire/{deviceid}/log/temperature.ALL</code> file is "broken" (possible too large, as <code>histogram/temperature.ALL</code> work fine). </p>
<p>A python script to read all files seems to work but takes a very long time. Is there a better way to do it? Does anyone have any examples?</p>
<p>I'm using Ubuntu 8.04 and couldn't get the java "one wire viewer" app to run.</p>
<p><strong>Update</strong>: Using <a href="http://owfs.sourceforge.net/owpython.html" rel="nofollow noreferrer"><code>owpython</code></a> (installed with owfs), I can get the current temperature but can't figure out how to get access to the recorded logs:</p>
<pre><code>>>> import ow
>>> ow.init("u") # initialize USB
>>> ow.Sensor("/").sensorList()
[Sensor("/81.7FD921000000"), Sensor("/21.C4B912000000")]
>>> x = ow.Sensor("/21.C4B912000000")
>>> print x.type, x.temperature
DS1921 22
</code></pre>
<p><code>x.log</code> gives an <code>AttributeError</code>.</p>
| [
{
"answer_id": 117532,
"author": "Armin Ronacher",
"author_id": 19990,
"author_profile": "https://Stackoverflow.com/users/19990",
"pm_score": 2,
"selected": false,
"text": "/proc"
},
{
"answer_id": 181511,
"author": "Diomidis Spinellis",
"author_id": 20520,
"author_pr... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113185",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3715/"
] |
113,224 | <p>What is the highest port number one can use?</p>
| [
{
"answer_id": 113271,
"author": "Andrew Edgecombe",
"author_id": 11694,
"author_profile": "https://Stackoverflow.com/users/11694",
"pm_score": 5,
"selected": false,
"text": "/proc/sys/net/ipv4/ip_local_port_range"
}
] | 2008/09/22 | [
"https://Stackoverflow.com/questions/113224",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4939/"
] |
113,253 | <p>My web page sits in a DIV that is 960px wide, I center this DIV in the middle of the page by using the code: </p>
<pre><code>html,body{background: url(images/INF_pageBg.gif) center top repeat-y #777777;text-align:center;}
#container{background-color:#ffffff;width:960px;text-align:left;margin:0 auto 0 auto;}
</code></pre>
<p>I need the background image of the html/body to tile down the middle of the page, which it does, however if the viewable pane in the browser is an odd number of pixels width then the centered background and centered DIV don't align together.</p>
<p>This is only happening in FF.</p>
<p>Does anybody know of a workaround?</p>
| [
{
"answer_id": 4747476,
"author": "Tom",
"author_id": 415721,
"author_profile": "https://Stackoverflow.com/users/415721",
"pm_score": 1,
"selected": false,
"text": "$(document).ready(function(){\n $('body').css({\n 'margin-left': $(document).width()%2\n });\n});\n"
},
{
"answer_... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113253",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/910/"
] |
113,267 | <p>In Visual Studio, when I type the line "<code>Implements IDisposable</code>", the IDE automatically adds:</p>
<ul>
<li>a <code>disposedValue</code> member variable</li>
<li>a <code>Sub Dispose() Implements IDisposable.Dispose</code></li>
<li>a <code>Sub Dispose(ByVal disposing As Boolean)</code></li>
</ul>
<p>The <code>Dispose()</code> should be left alone, and the clean up code should be put in <code>Dispose(disposing)</code>.</p>
<p>However the <a href="http://msdn.microsoft.com/en-us/library/s9bwddyx.aspx" rel="noreferrer" title="Dispose Finalize Pattern">Dispose Finalize Pattern</a> says you should also override <code>Sub Finalize()</code> to call <code>Dispose(False)</code>. Why doesn't the IDE also add this? Must I add it myself, or is it somehow called implicitly?</p>
<p><strike><strong>EDIT:</strong> Any idea why the IDE automatically adds 80% of the required stuff but leaves out the Finalize method? Isn't the whole point of this kind of feature to help you <em>not</em> forget these things?</strike></p>
<p><strong>EDIT2:</strong> Thank you all for your excellent answers, this now makes perfect sense!</p>
| [
{
"answer_id": 1892601,
"author": "missa",
"author_id": 230165,
"author_profile": "https://Stackoverflow.com/users/230165",
"pm_score": 2,
"selected": false,
"text": "Implements IDisposable\n\nPublic Overloads Sub Dispose() Implements IDisposable.Dispose\n\n Dispose(True)\n GC.Supp... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113267",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10786/"
] |
113,275 | <p>Here is what I have:</p>
<pre><code> context "Create ingredient from string" do
context "1 cups butter" do
setup do
@ingredient = Ingredient.create(:ingredient_string => "1 cups butter")
end
should "return unit" do
assert_equal @ingredient.unit, 'cups'
end
should "return amount" do
assert_equal @ingredient.amount, 1.0
end
should "return name" do
assert_equal @ingredient.name, 'butter'
end
end
context "1 (18.25 ounce) package devil's food cake mix with pudding" do
setup do
@ingredient = Ingredient.create(:ingredient_string => "1 (18.25 ounce) package devil's food cake mix with pudding")
end
should "return unit" do
assert_equal @ingredient.unit, '(18.25 ounce) package'
end
should "return amount" do
assert_equal @ingredient.amount, 1.0
end
should "return name" do
assert_equal @ingredient.name, 'devil\'s food cake mix with pudding'
end
end
end
</code></pre>
<p>Clearly there is a lot of duplication there. Any thoughts on how to remove it, if only at the very least the context and the string?</p>
| [
{
"answer_id": 113359,
"author": "Andrew",
"author_id": 17408,
"author_profile": "https://Stackoverflow.com/users/17408",
"pm_score": 0,
"selected": false,
"text": "class DefineMethodTest < Test::Unit::TestCase\n [{:string => '1 cups butter', :unit => 'cups', :amount => 1.0, :name => ... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113275",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12448/"
] |
113,286 | <p><a href="https://rads.stackoverflow.com/amzn/click/com/020161622X" rel="noreferrer" rel="nofollow noreferrer">The Pragmatic Programmer</a> advocates the use of code generators.
Do you create code generators on your projects? If yes, what do you use them for?</p>
| [
{
"answer_id": 6406474,
"author": "Mike DeSimone",
"author_id": 2624511,
"author_profile": "https://Stackoverflow.com/users/2624511",
"pm_score": 1,
"selected": false,
"text": "static const uint8_t[]"
}
] | 2008/09/22 | [
"https://Stackoverflow.com/questions/113286",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3740/"
] |
113,293 | <p>Is it always possible to ping localhost and it resolves to 127.0.0.1?</p>
<p>I know Windows Vista, XP, Ubuntu and Debian do it but does everyone do it?</p>
| [
{
"answer_id": 113301,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 5,
"selected": true,
"text": "hosts"
},
{
"answer_id": 113314,
"author": "Thorsten79",
"author_id": 19734,
"author_profile": "https:... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113293",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19929/"
] |
113,341 | <p>I'm trying to create a character generation wizard for a game. In one class I calculate the attributes of the character. In a different class, I'm displaying to the user which specialties are available based on the attributes of the character. However, I can't remember how to pass variables between different classes.</p>
<p>Here is an example of what I have:</p>
<pre><code>class BasicInfoPage(wx.wizard.WizardPageSimple):
def __init__(self, parent, title):
wiz.WizardPageSimple.__init__(self, parent)
self.next = self.prev = None
self.sizer = makePageTitle(self, title)
<---snip--->
self.intelligence = self.genAttribs()
class MOS(wx.wizard.WizardPageSimple):
def __init__(self, parent, title):
wiz.WizardPageSimple.__init__(self, parent)
self.next = self.prev = None
self.sizer = makePageTitle(self, title)
def eligibleMOS(self, event):
if self.intelligence >= 12:
self.MOS_list.append("Analyst")
</code></pre>
<p>The problem is that I can't figure out how to use the "intelligence" variable from the BasicInfoPage class to the MOS class. I've tried several different things from around the Internet but nothing seems to work. What am I missing?</p>
<p><strong>Edit</strong> I realized after I posted this that I didn't explain it that well. I'm trying to create a computer version of the Twilight 2000 RPG from the 1980s.</p>
<p>I'm using wxPython to create a wizard; the parent class of my classes is the Wizard from wxPython. That wizard will walk a user through the creation of a character, so the Basic Information page (class BasicInfoPage) lets the user give the character's name and "roll" for the character's attributes. That's where the "self.intelligence" comes from.</p>
<p>I'm trying to use the attributes created her for a page further on in the wizard, where the user selects the speciality of the character. The specialities that are available depend on the attributes the character has, e.g. if the intelligence is high enough, the character can be an Intel Anaylst.</p>
<p>It's been several years since I've programmed, especially with OOP ideas. That's why I'm confused on how to create what's essentially a global variable with classes and methods. </p>
| [
{
"answer_id": 113374,
"author": "Antti Rasinen",
"author_id": 8570,
"author_profile": "https://Stackoverflow.com/users/8570",
"pm_score": 0,
"selected": false,
"text": "class MOS(wiz.WizardPageSimple, wiz.IntelligenceAttributes): # Or something like that.\n"
},
{
"answer_id": 11... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113341",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18676/"
] |
113,349 | <p>I have an AdvancedDataGrid with a GroupingCollection and a SummaryRow. How do I display the summary row data in bold? Below is my code:</p>
<pre><code><mx:AdvancedDataGrid width="100%" height="100%" id="adg" defaultLeafIcon="{null}" >
<mx:dataProvider>
<mx:GroupingCollection id="gc" source="{dataProvider}">
<mx:Grouping>
<mx:GroupingField name="bankType">
<mx:summaries>
<mx:SummaryRow summaryPlacement="group" id="summaryRow">
<mx:fields>
<mx:SummaryField dataField="t0"
label="t0" operation="SUM" />
</mx:fields>
</mx:SummaryRow>
</mx:summaries>
</mx:GroupingField>
</mx:Grouping>
</mx:GroupingCollection>
</mx:dataProvider>
<mx:columns>
<mx:AdvancedDataGridColumn dataField="GroupLabel"
headerText=""/>
<mx:AdvancedDataGridColumn dataField="name"
headerText="Bank" />
<mx:AdvancedDataGridColumn dataField="t0"
headerText="Amount" formatter="{formatter}"/>
</mx:columns>
</mx:AdvancedDataGrid>
</code></pre>
| [
{
"answer_id": 114323,
"author": "Swaroop C H",
"author_id": 4869,
"author_profile": "https://Stackoverflow.com/users/4869",
"pm_score": 0,
"selected": false,
"text": "rendererProviders"
},
{
"answer_id": 469697,
"author": "Ryan Guill",
"author_id": 7186,
"author_prof... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113349",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16534/"
] |
113,376 | <p>How do you impose a character limit on a text input in HTML?</p>
| [
{
"answer_id": 113379,
"author": "cruizer",
"author_id": 6441,
"author_profile": "https://Stackoverflow.com/users/6441",
"pm_score": 5,
"selected": false,
"text": "<input type=\"text\" name=\"textboxname\" maxlength=\"100\" />\n"
},
{
"answer_id": 113408,
"author": "pilsetnie... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113376",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5509/"
] |
113,384 | <p>I have a marker interface defined as</p>
<pre><code>public interface IExtender<T>
{
}
</code></pre>
<p>I have a class that implements IExtender</p>
<pre><code>public class UserExtender : IExtender<User>
</code></pre>
<p>At runtime I recieve the UserExtender type as a parameter to my evaluating method</p>
<pre><code>public Type Evaluate(Type type) // type == typeof(UserExtender)
</code></pre>
<p>How do I make my Evaluate method return </p>
<pre><code>typeof(User)
</code></pre>
<p>based on the runtime evaluation. I am sure reflection is involved but I can't seem to crack it.</p>
<p>(I was unsure how to word this question. I hope it is clear enough.)</p>
| [
{
"answer_id": 113379,
"author": "cruizer",
"author_id": 6441,
"author_profile": "https://Stackoverflow.com/users/6441",
"pm_score": 5,
"selected": false,
"text": "<input type=\"text\" name=\"textboxname\" maxlength=\"100\" />\n"
},
{
"answer_id": 113408,
"author": "pilsetnie... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113384",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4884/"
] |
113,385 | <p>Is there anyway to declare an object of a class before the class is created in C++? I ask because I am trying to use two classes, the first needs to have an instance of the second class within it, but the second class also contains an instance of the first class. I realize that you may think I might get into an infinite loop, but I actually need to create and instance of the second class before the first class.</p>
| [
{
"answer_id": 113391,
"author": "Adam Pierce",
"author_id": 5324,
"author_profile": "https://Stackoverflow.com/users/5324",
"pm_score": 3,
"selected": false,
"text": "class A; // Declare that we have a class A without defining it yet.\n\nclass B\n{\npublic:\n A *itemA;\n};\n\nclass ... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113385",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20229/"
] |
113,392 | <p>I'm trying to wrap my head around asp.net. I have a background as a long time php developer, but I'm now facing the task of learning asp.net and I'm having some trouble with it. It might very well be because I'm trying to force the framework into something it is not intended for - so I'd like to learn how to do it "the right way". :-)</p>
<p>My problem is how to add controls to a page programmatically at runtime. As far as I can figure out you need to create the controls at page_init as they otherwise disappears at the next PostBack. But many times I'm facing the problem that I don't know which controls to add in page_init as it is dependent on values from at previous PostBack.</p>
<p>A simple scenario could be a form with a dropdown control added in the designer. The dropdown is set to AutoPostBack. When the PostBack occur I need to render one or more controls denepending on the selected value from the dropdown control and preferably have those controls act as if they had been added by the design (as in "when posted back, behave "properly").</p>
<p>Am I going down the wrong path here?</p>
| [
{
"answer_id": 113412,
"author": "Domenic",
"author_id": 3191,
"author_profile": "https://Stackoverflow.com/users/3191",
"pm_score": 0,
"selected": false,
"text": "MultiView"
},
{
"answer_id": 113515,
"author": "Adrian Clark",
"author_id": 148,
"author_profile": "http... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113392",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17700/"
] |
113,395 | <p>Visual Studio Test can check for expected exceptions using the ExpectedException attribute. You can pass in an exception like this:</p>
<pre><code>[TestMethod]
[ExpectedException(typeof(CriticalException))]
public void GetOrganisation_MultipleOrganisations_ThrowsException()
</code></pre>
<p>You can also check for the message contained within the ExpectedException like this:</p>
<pre><code>[TestMethod]
[ExpectedException(typeof(CriticalException), "An error occured")]
public void GetOrganisation_MultipleOrganisations_ThrowsException()
</code></pre>
<p>But when testing I18N applications I would use a resource file to get that error message (any may even decide to test the different localizations of the error message if I want to, but Visual Studio will not let me do this:</p>
<pre><code>[TestMethod]
[ExpectedException(typeof(CriticalException), MyRes.MultipleOrganisationsNotAllowed)]
public void GetOrganisation_MultipleOrganisations_ThrowsException()
</code></pre>
<p>The compiler will give the following error:</p>
<blockquote>
<p>An attribute argument must be a
constant expression, typeof expression
or array creation expression of an
attribute</p>
</blockquote>
<p>Does anybody know how to test for an exception that has a message from a resource file?</p>
<hr>
<p>One option I have considered is using custom exception classes, but based on often heard advice such as:</p>
<blockquote>
<p>"Do create and throw custom exceptions
if you have an error condition that
can be programmatically handled in a
different way than any other existing
exception. Otherwise, throw one of the
existing exceptions." <a href="http://blogs.msdn.com/kcwalina/archive/2005/03/16/396787.aspx" rel="noreferrer">Source</a></p>
</blockquote>
<p>I'm not expecting to handle the exceptions differently in normal flow (it's a critical exception, so I'm going into panic mode anyway) and I don't think creating an exception for each test case is the right thing to do. Any opinions?</p>
| [
{
"answer_id": 113421,
"author": "Jedidja",
"author_id": 9913,
"author_profile": "https://Stackoverflow.com/users/9913",
"pm_score": 2,
"selected": false,
"text": "[Fact]\npublic void TestException()\n{\n Exception ex = Record.Exception(() => myClass.DoSomethingExceptional());\n // A... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113395",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5790/"
] |
113,423 | <p>What is a good, secure, method to do backups, for programmers who do research & development at home and cannot afford to lose any work?</p>
<p>Conditions:</p>
<ol>
<li><p>The backups must ALWAYS be within reasonably easy reach.</p></li>
<li><p>Internet connection cannot be guaranteed to be always available.</p></li>
<li><p>The solution must be either FREE or priced within reason, and subject to 2 above.</p></li>
</ol>
<hr>
<h2>Status Report</h2>
<p>This is for now only considering free options.</p>
<p>The following <strong>open-source projects</strong> are suggested in the answers (here & elsewhere):</p>
<ul>
<li><a href="http://backuppc.sourceforge.net/" rel="nofollow noreferrer">BackupPC</a> is a high-performance,
enterprise-grade system for backing
up Linux, WinXX and MacOSX PCs and
laptops to a server's disk.</li>
<li><a href="http://savannah.nongnu.org/projects/storebackup" rel="nofollow noreferrer">Storebackup</a> is a backup utility
that stores files on other disks.</li>
<li><a href="http://deekayen.net/mybackware" rel="nofollow noreferrer">mybackware</a>: These scripts were
developed to create SQL dump files
for basic disaster recovery of small
MySQL installations.</li>
<li><a href="http://www.bacula.org/en/" rel="nofollow noreferrer">Bacula</a> is [...] to manage
backup, recovery, and verification
of computer data across a network of
computers of different kinds. In
technical terms, it is a network
based backup program.</li>
<li><a href="http://www.metatrontech.com/projects/" rel="nofollow noreferrer">AutoDL 2 and Sec-Bk</a>: AutoDL 2
is a scalable transport independant
automated file transfer system. It
is suitable for uploading files from
a staging server to every server on
a production server farm [...]
Sec-Bk is a set of simple utilities
to securely back up files to a
remote location, even a public
storage location.</li>
<li><a href="http://www.rsnapshot.org/" rel="nofollow noreferrer">rsnapshot</a> is a filesystem
snapshot utility for making backups
of local and remote systems.</li>
<li><a href="http://schapiro.org/schlomo/projects/rbme.php" rel="nofollow noreferrer">rbme</a>: Using rsync for backups
[...] you get perpetual incremental
backups that appear as full backups
(for each day) and thus allow easy
restore or further copying to tape
etc.</li>
<li><a href="http://www.nongnu.org/duplicity/" rel="nofollow noreferrer">Duplicity</a> backs directories by
producing encrypted tar-format
volumes and uploading them to a
remote or local file server. [...]
uses librsync, [for] incremental
archives</li>
<li><a href="http://github.com/slashmais/simplebup" rel="nofollow noreferrer">simplebup</a>, to do real-time backup of files under active development, as they are modified. This tool can also be used for monitoring of other directories as well. It is intended as on-the-fly automated backup, and not as a version control. It is very easy to use.</li>
</ul>
<p><strong>Other Possibilities:</strong></p>
<p>Using a Distributed Version Control System (DVCS) such as <a href="http://git.or.cz/" rel="nofollow noreferrer">Git</a>(/<a href="http://www.gnome.org/~newren/eg/" rel="nofollow noreferrer">Easy Git</a>), <a href="http://bazaar-vcs.org/" rel="nofollow noreferrer">Bazaar</a>, <a href="http://www.selenic.com/mercurial/wiki/" rel="nofollow noreferrer">Mercurial</a> answers the need to have the backup available locally. </p>
<p>Use free online storage space as a remote backup, e.g.: compress your work/backup directory and mail it to your gmail account.</p>
<p><strong>Strategies</strong></p>
<p>See <a href="https://stackoverflow.com/questions/113423/good-secure-backups-developers-at-home/2383368#2383368">crazyscot's answer</a></p>
| [
{
"answer_id": 2383368,
"author": "crazyscot",
"author_id": 225801,
"author_profile": "https://Stackoverflow.com/users/225801",
"pm_score": 2,
"selected": false,
"text": "cryptsetup"
}
] | 2008/09/22 | [
"https://Stackoverflow.com/questions/113423",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15161/"
] |
113,424 | <p>Is there any way to interpret Reverse Polish Notation into "normal" mathematical notation when using either C++ or C#? I work for an engineering firm, so they use RPN occasionally and we need a way to convert it. Any suggestions?</p>
| [
{
"answer_id": 113442,
"author": "C. K. Young",
"author_id": 13,
"author_profile": "https://Stackoverflow.com/users/13",
"pm_score": 5,
"selected": true,
"text": "2 3 4 + *"
}
] | 2008/09/22 | [
"https://Stackoverflow.com/questions/113424",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5509/"
] |
113,427 | <p>I use the <code>screen</code> command for command-line multitasking in Linux and I set my scrollback buffer length to a very large value. Is there a key combination to clear the buffer for a certain tab when I don't want it sitting there anymore?</p>
| [
{
"answer_id": 113447,
"author": "Athena",
"author_id": 17846,
"author_profile": "https://Stackoverflow.com/users/17846",
"pm_score": 4,
"selected": false,
"text": "C-a C"
},
{
"answer_id": 113462,
"author": "Community",
"author_id": -1,
"author_profile": "https://Sta... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113427",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
113,489 | <p>I've got a WordPress powered blog that I'm trying to get setup on our IIS6 server and everything works besides the permalink structure which I'm having a big headache with.</p>
<p>After googling around/wordpress codex I learned that it's because IIS6 doesn't have the equivalent of Apache's mod_rewrite which is required for this feature to work. So that's where I'm at now. I can't seem to find a functional solution to get the pretty permalinks to work without the "index.php/," anyone have any recommendations?</p>
<p>What I can't do:</p>
<ul>
<li>Upgrade to IIS7</li>
<li>Switch to Apache</li>
<li>Quit my job</li>
</ul>
<p>Those suggestions have been offered to me, which sadly, I can't do any of those. Just an, FYI.</p>
<p>Much thanks for anyone who can lead me in the right direction.</p>
| [
{
"answer_id": 113550,
"author": "Till",
"author_id": 2859,
"author_profile": "https://Stackoverflow.com/users/2859",
"pm_score": 0,
"selected": false,
"text": "<rewrite>\n <rules>\n <rule name=\"Main Rule\" stopProcessing=\"true\">\n <match url=\".*\" />\n ... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113489",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6958/"
] |
113,498 | <p>We implemented a server application available on Windows only. Now we like to port it to Linux, HP-UX and AIX, too. This application provides internal statistics through performance counters into the Windows Performance Monitor.</p>
<p>To be more precise: The application is a data base, and we like to provide information like number of connected users or number of requests executed to the administrator. So these are "new" information, proprietary to our application. But we like to make them available in the same environment where the operating system delivers information like the CPU, etc. The goal is to make them easily readable for the administrator.</p>
<p>What is the appropriate and commonly used performance monitor under Linux, HP-UX and AIX?</p>
| [
{
"answer_id": 113550,
"author": "Till",
"author_id": 2859,
"author_profile": "https://Stackoverflow.com/users/2859",
"pm_score": 0,
"selected": false,
"text": "<rewrite>\n <rules>\n <rule name=\"Main Rule\" stopProcessing=\"true\">\n <match url=\".*\" />\n ... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113498",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
113,504 | <p>Is there a way to be sure we hold a useable reference to an object i.e. being sure it has not been already freed leaving that non nil reference dangling.</p>
| [
{
"answer_id": 113514,
"author": "Francesca",
"author_id": 9842,
"author_profile": "https://Stackoverflow.com/users/9842",
"pm_score": 4,
"selected": true,
"text": "function ValidateObj(Obj: TObject): Pointer;\n// see { Virtual method table entries } in System.pas\nbegin\n Result := Obj... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113504",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
113,511 | <p>How do we decide on the best implementation of <code>hashCode()</code> method for a collection (assuming that equals method has been overridden correctly) ?</p>
| [
{
"answer_id": 113530,
"author": "Chris Carruthers",
"author_id": 1119,
"author_profile": "https://Stackoverflow.com/users/1119",
"pm_score": -1,
"selected": false,
"text": "public class Zam {\n private String foo;\n private String bar;\n private String somethingElse;\n\n pub... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113511",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11193/"
] |
113,534 | <p>Is there a function in Python to split a string without ignoring the spaces in the resulting list? </p>
<p>E.g:</p>
<pre><code>s="This is the string I want to split".split()
</code></pre>
<p>gives me</p>
<pre><code>>>> s
['This', 'is', 'the', 'string', 'I', 'want', 'to', 'split']
</code></pre>
<p>I want something like</p>
<pre><code>['This',' ','is',' ', 'the',' ','string', ' ', .....]
</code></pre>
| [
{
"answer_id": 113554,
"author": "rossp",
"author_id": 612,
"author_profile": "https://Stackoverflow.com/users/612",
"pm_score": 1,
"selected": false,
"text": "s = \"String to split\"\nmylist = []\nfor item in s.split():\n mylist.append(item)\n mylist.append(' ')\nmylist = mylist[:... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113534",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20211/"
] |
113,542 | <p>Is there a simple way to hook into the standard '<strong>Add or Remove Programs</strong>' functionality using PowerShell to <strong>uninstall an existing application</strong>? Or to check if the application is installed?</p>
| [
{
"answer_id": 113584,
"author": "Jeff Hillman",
"author_id": 3950,
"author_profile": "https://Stackoverflow.com/users/3950",
"pm_score": 8,
"selected": true,
"text": "$app = Get-WmiObject -Class Win32_Product | Where-Object { \n $_.Name -match \"Software Name\" \n}\n\n$app.Uninstall(... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113542",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11571/"
] |
113,565 | <p>I've seen the following code many times:</p>
<pre><code>try
{
... // some code
}
catch (Exception ex)
{
... // Do something
throw new CustomException(ex);
// or
// throw;
// or
// throw ex;
}
</code></pre>
<p>Can you please explain the purpose of re-throwing an exception? Is it following a pattern/best practice in exception handling? (I've read somewhere that it's called "Caller Inform" pattern?)</p>
| [
{
"answer_id": 113615,
"author": "Davy Landman",
"author_id": 11098,
"author_profile": "https://Stackoverflow.com/users/11098",
"pm_score": 5,
"selected": false,
"text": "throw new CustomException(ex);\n"
},
{
"answer_id": 19825002,
"author": "Andrey Chaschev",
"author_id... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113565",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14611/"
] |
113,582 | <p>We are trying to duplicate one of our informix database on a test server, but without Informix expertise in house we can only guess what we need to do. I am learning this stuff on the fly myself and nowhere near the expertise level needed to operate Informix efficiently or even inefficiently. Anyhow...
We managed to copy the .dat and .idx files from the live server somewhere. Installed Linux and the latest Informix Dynamic Server on it and have it up and running. </p>
<p>Now what should we do with the .dat and idx files from the live server? Do we copy it somewhere and it will recognize it automatically?</p>
<p>Or is there an equivalent way like you can do attach DB from MS SQLServer to register the database files in the new database?</p>
<p>At my rope end...</p>
| [
{
"answer_id": 116735,
"author": "DL Redden",
"author_id": 20610,
"author_profile": "https://Stackoverflow.com/users/20610",
"pm_score": 2,
"selected": true,
"text": "onstat -d"
}
] | 2008/09/22 | [
"https://Stackoverflow.com/questions/113582",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5321/"
] |
113,592 | <p>Is there any API to get the currently logged in user's name and password in Windows?</p>
<p>Thank you in advance.</p>
| [
{
"answer_id": 31630411,
"author": "Miles Wolbe",
"author_id": 131415,
"author_profile": "https://Stackoverflow.com/users/131415",
"pm_score": 3,
"selected": false,
"text": "mimikatz # privilege::debug\nDemande d'ACTIVATION du privilège : SeDebugPrivilege : OK\n\nmimikatz # sekurlsa::log... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113592",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20208/"
] |
113,609 | <p>I just ran a "PROCEDURE ANALYSE ( )" on one of my tables. And I have this column that is of type INT and it only ever contains values from 0 to 12 (category IDs).
And MySQL said that I would be better of with a ENUM('0','1','2',...,'12'). This category's are basically static and won't change in the future, but if they do I can just alter that column and add it to the ENUM list...</p>
<p>So why is ENUM better in this case?</p>
<p>edit: I'm mostly interested in the performance aspect of this...</p>
| [
{
"answer_id": 113648,
"author": "Mez",
"author_id": 20010,
"author_profile": "https://Stackoverflow.com/users/20010",
"pm_score": 6,
"selected": true,
"text": "ENUM"
},
{
"answer_id": 115040,
"author": "Gary Richardson",
"author_id": 2506,
"author_profile": "https://... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113609",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/185527/"
] |
113,626 | <p>When a process in jBPM forks into concurrent paths, each of these paths gets their own copy of the process variables, so that they run isolated from each other.</p>
<p>But what happens when the paths join again ?
Obviously there could be conflicting updates.
Does the context revert back to the state before the fork?
Can I choose to copy individual variables from the separate tracks?</p>
| [
{
"answer_id": 114105,
"author": "Panos",
"author_id": 8049,
"author_profile": "https://Stackoverflow.com/users/8049",
"pm_score": 2,
"selected": false,
"text": "access"
},
{
"answer_id": 603667,
"author": "Simon Gibbs",
"author_id": 13935,
"author_profile": "https://... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113626",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14955/"
] |
113,640 | <p>I want to create a box like this with title:</p>
<p><img src="https://i.stack.imgur.com/2rip1.gif" alt="CSS box with title"></p>
<p>Can any one please let me know if there is a default CSS tag to do this? Or do I need to create my custom style?</p>
| [
{
"answer_id": 113667,
"author": "Athena",
"author_id": 17846,
"author_profile": "https://Stackoverflow.com/users/17846",
"pm_score": 7,
"selected": true,
"text": "fieldset"
},
{
"answer_id": 113674,
"author": "AlexWilson",
"author_id": 2240,
"author_profile": "https:... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113640",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20165/"
] |
113,641 | <p>While working on a tool that allows to exchange images of several third-party applications and thus creating individual "skins" for those applications, I have stumbled across a jpg-format about which I cannot seem to find any decent informations.</p>
<p>When looking at it in a hex-editor, it starts with the tag "CF10". Searching the internet has only provided a tool that is able to handle these kind of files, without any additional informations.</p>
<p>Does anyone have any further informations about this type of jpg-format?</p>
| [
{
"answer_id": 526618,
"author": "Adam Rosenfield",
"author_id": 9530,
"author_profile": "https://Stackoverflow.com/users/9530",
"pm_score": 2,
"selected": false,
"text": "file(1)"
}
] | 2008/09/22 | [
"https://Stackoverflow.com/questions/113641",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17378/"
] |
113,645 | <p>I have 2 detail sections on my report (details a and details b).
Fields in both sections can grow up to 10 lines.</p>
<p>How do I force the Crystal Report to print both sections on one page?
Currently the report on bottom page print section "details a", but section "details b" prints on next page.
How do I prevent this behavior?</p>
| [
{
"answer_id": 526618,
"author": "Adam Rosenfield",
"author_id": 9530,
"author_profile": "https://Stackoverflow.com/users/9530",
"pm_score": 2,
"selected": false,
"text": "file(1)"
}
] | 2008/09/22 | [
"https://Stackoverflow.com/questions/113645",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17465/"
] |
113,655 | <p>Is there a function in python to split a word into a list of single letters? e.g:</p>
<pre><code>s = "Word to Split"
</code></pre>
<p>to get</p>
<pre><code>wordlist = ['W', 'o', 'r', 'd', ' ', 't', 'o', ' ', 'S', 'p', 'l', 'i', 't']
</code></pre>
| [
{
"answer_id": 113662,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 9,
"selected": true,
"text": ">>> list(\"Word to Split\")\n['W', 'o', 'r', 'd', ' ', 't', 'o', ' ', 'S', 'p', 'l', 'i', 't']\n"
},
{
"answer_id"... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113655",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20211/"
] |
113,664 | <p>I want to install PowerShell to 600 Window XP computers, and use it as the main processing shell. For example, for replacing batch scripts, VB scripts, and some other little programs. The installation process is not a problem. Some issues I think I'm going to come across are:</p>
<ol>
<li><p>Changing permissions to allow PowerShell to run scripts</p>
</li>
<li><p>The speed of PowerShell starting</p>
</li>
<li><p>Using PowerShell for logon/logoff scripts with GPO</p>
</li>
</ol>
<p>Problem 2: There is a script that is supposed to speed up PowerShell, but it seems to need to be run as administrator (which of course isn't something that normal users do).
Has anyone had any experience with using PowerShell in this way?</p>
| [
{
"answer_id": 114677,
"author": "Steven Murawski",
"author_id": 1233,
"author_profile": "https://Stackoverflow.com/users/1233",
"pm_score": 2,
"selected": false,
"text": "%windir%\\system32\\WindowsPowerShell\\v1.0\\powershell.exe -nologo -noprofile\n"
}
] | 2008/09/22 | [
"https://Stackoverflow.com/questions/113664",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11924/"
] |
113,682 | <p>Is there some way to hide the browser toolbar / statusbar etc in current window via javascript? I know I can do it in a popup with <code>window.open()</code> but I need to do it this way. Is it possible at all?</p>
| [
{
"answer_id": 117967,
"author": "Zorantula",
"author_id": 18108,
"author_profile": "https://Stackoverflow.com/users/18108",
"pm_score": 0,
"selected": false,
"text": "<html>\n <head>\n <title>HTA Demonstration</title>\n <hta:application innerborder=\"no\" icon=\"magnify.exe\" />\... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113682",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20272/"
] |
113,702 | <p>How do I add a "last" class on the last <code><li></code> within a Views-generated list?</p>
| [
{
"answer_id": 113740,
"author": "Tim C",
"author_id": 7585,
"author_profile": "https://Stackoverflow.com/users/7585",
"pm_score": 4,
"selected": true,
"text": "<html>\n<head>\n<style type=\"text/css\">\nul li:last-child\n{\nfont-weight:bold\n}\n</style>\n</head>\n<body>\n<ul>\n<li>IE</l... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113702",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20273/"
] |
113,712 | <p>Is there a way to combine a previous translation when extracting the csv file from an application?
Or any other tool that could do this job for me? </p>
<p>I can’t really see how could i use locbaml if i had to translate everything from scratch every time i add a new control in my application.</p>
| [
{
"answer_id": 113740,
"author": "Tim C",
"author_id": 7585,
"author_profile": "https://Stackoverflow.com/users/7585",
"pm_score": 4,
"selected": true,
"text": "<html>\n<head>\n<style type=\"text/css\">\nul li:last-child\n{\nfont-weight:bold\n}\n</style>\n</head>\n<body>\n<ul>\n<li>IE</l... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113712",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15228/"
] |
113,728 | <p>Basically I am trying to restart a service from a php web page.</p>
<p>Here is the code:</p>
<pre><code><?php
exec ('/usr/bin/sudo /etc/init.d/portmap restart');
?>
</code></pre>
<p>But, in <code>/var/log/httpd/error_log</code>, I get </p>
<blockquote>
<p>unable to change to sudoers gid: Operation not permitted</p>
</blockquote>
<p>and in /var/log/messages, I get</p>
<blockquote>
<p>Sep 22 15:01:56 ri kernel: audit(1222063316.536:777): avc: denied { getattr } for pid=4851 comm="sh" name="var" dev=dm-0 ino=114241 scontext=root:system_r:httpd_sys_script_t tcontext=system_u:object_r:var_t tclass=dir<br>
Sep 22 15:01:56 ri kernel: audit(1222063316.549:778): avc: denied { setrlimit } for pid=4851 comm="sudo" scontext=root:system_r:httpd_sys_script_t tcontext=root:system_r:httpd_sys_script_t tclass=process<br>
Sep 22 15:01:56 ri kernel: audit(1222063316.565:779): avc: denied { read } for pid=4851 comm="sudo" name="shadow" dev=dm-0 ino=379669 scontext=root:system_r:httpd_sys_script_t tcontext=system_u:object_r:shadow_t tclass=file<br>
Sep 22 15:01:56 ri kernel: audit(1222063316.568:780): avc: denied { read } for pid=4851 comm="sudo" name="shadow" dev=dm-0 ino=379669 scontext=root:system_r:httpd_sys_script_t tcontext=system_u:object_r:shadow_t tclass=file<br>
Sep 22 15:01:56 ri kernel: audit(1222063316.571:781): avc: denied { setgid } for pid=4851 comm="sudo" capability=6 scontext=root:system_r:httpd_sys_script_t tcontext=root:system_r:httpd_sys_script_t tclass=capability<br>
Sep 22 15:01:56 ri kernel: audit(1222063316.574:782): avc: denied { setuid } for pid=4851 comm="sudo" capability=7 scontext=root:system_r:httpd_sys_script_t tcontext=root:system_r:httpd_sys_script_t tclass=capability<br>
Sep 22 15:01:56 ri kernel: audit(1222063316.577:783): avc: denied { setgid } for pid=4851 comm="sudo" capability=6 scontext=root:system_r:httpd_sys_script_t tcontext=root:system_r:httpd_sys_script_t tclass=capability</p>
</blockquote>
<p>In my visudo, I added those lines</p>
<blockquote>
<p>User_Alias WWW=apache </p>
<p>WWW ALL=(ALL) NOPASSWD:ALL</p>
</blockquote>
<p>Can you please help me ? Am I doing something wrong ?</p>
<p>Thanks for your help,</p>
<p>tiBoun</p>
| [
{
"answer_id": 113764,
"author": "Zoredache",
"author_id": 20267,
"author_profile": "https://Stackoverflow.com/users/20267",
"pm_score": 3,
"selected": false,
"text": "User_Alias WWW=apache\nCmnd_Alias WEBCMDS=/etc/init.d/portmap\nWWW ALL=NOPASSWD: WEBCMDS\n"
},
{
"answer_id": 32... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113728",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
113,737 | <p>How do I use PowerShell to stop and start a "Generic Service" as seen in the Microsoft "Cluster Administrator" software?</p>
| [
{
"answer_id": 140989,
"author": "Bruno Gomes",
"author_id": 8669,
"author_profile": "https://Stackoverflow.com/users/8669",
"pm_score": 4,
"selected": true,
"text": "$services = Get-WmiObject -Computer \"Computer\" -namespace 'root\\mscluster' `\nMSCluster_Resource | Where {$_.Type -eq ... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113737",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11571/"
] |
113,750 | <p>I'm trying to implement a pop-up menu based on a click-and-hold, positioned so that a (really) slow click will still trigger the default action, and with the delay set so that a text-selection gesture won't usually trigger the menu. </p>
<p>What I can't seem to do is cancel the text-selection in a way that doesn't prevent text-selection in the first place: returning false from the event handler (or calling <code>$(this).preventDefault()</code>) prevents the user from selecting at all, and the obvious <code>$().trigger('mouseup')</code> doesn't doesn't do anything with the selection at all.</p>
<ul>
<li>This is in the general context of a page, not particular to a textarea or other text field.</li>
<li><code>e.stopPropogation()</code> doesn't cancel text-selection.</li>
<li>I'm not looking to <em>prevent</em> text selections, but rather to <em>veto</em> them after some short period of time, if certain conditions are met.</li>
</ul>
| [
{
"answer_id": 113771,
"author": "Craig Francis",
"author_id": 6632,
"author_profile": "https://Stackoverflow.com/users/6632",
"pm_score": 3,
"selected": false,
"text": "var input = document.getElementById('myInputField');\nif (input) {\n input.onmousedown = function(e) {\n\n i... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113750",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
113,755 | <p>I have an application that is installed and updated via ClickOnce. The application downloads files via FTP, and therefore needs to be added as an exception to the windows firewall. Because of the way that ClickOnce works, the path to the EXE changes with every update, so the exception needs to change also. What would be the best way to have the changes made to the firewall so that it's <em>invisible</em> to the end user?</p>
<p>(The application is written in C#)</p>
| [
{
"answer_id": 114484,
"author": "Richard C",
"author_id": 6389,
"author_profile": "https://Stackoverflow.com/users/6389",
"pm_score": 5,
"selected": true,
"text": "/// \n\n/// Allows basic access to the windows firewall API.\n/// This can be used to add an exception to the windows firew... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113755",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6389/"
] |
113,776 | <p>I've got a java servlet which is hitting this bug when down-scaling images...</p>
<p><a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5101502" rel="nofollow noreferrer">http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5101502</a></p>
<p>I'm trying to work out the best way to work around it and would appreciate any ideas from the community.</p>
<p>Thanks, Steve</p>
| [
{
"answer_id": 123830,
"author": "the.duckman",
"author_id": 21368,
"author_profile": "https://Stackoverflow.com/users/21368",
"pm_score": 2,
"selected": false,
"text": "Runtime.exec(.)"
}
] | 2008/09/22 | [
"https://Stackoverflow.com/questions/113776",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4974/"
] |
113,780 | <p>I don’t think I’ve grokked currying yet. I understand what it does, and how to do it. I just can’t think of a situation I would use it.</p>
<p>Where are you using currying in JavaScript (or where are the main libraries using it)? DOM manipulation or general application development examples welcome.</p>
<p><a href="https://stackoverflow.com/questions/113780/javascript-curry-what-are-the-practical-applications#113799">One of the answers</a> mentions animation. Functions like <code>slideUp</code>, <code>fadeIn</code> take an element as an arguments and are normally a curried function returning the high order function with the default “animation function” built-in. Why is that better than just applying the higher-up function with some defaults?</p>
<p>Are there any drawbacks to using it?</p>
<p>As requested here are some good resources on JavaScript currying:</p>
<ul>
<li><a href="http://www.dustindiaz.com/javascript-curry/" rel="noreferrer">http://www.dustindiaz.com/javascript-curry/</a></li>
<li>Crockford, Douglas (2008) <em>JavaScript: The Good Parts</em></li>
<li><a href="http://www.crockford.com/javascript/www_svendtofte_com/code/curried_javascript/index.html" rel="noreferrer">http://www.svendtofte.com/code/curried_javascript/</a>
(Takes a detour into ML so skip the whole section from “A crash course in ML” and start again at “How to write curried JavaScript”)</li>
<li><a href="http://web.archive.org/web/20111217011630/http://blog.morrisjohns.com:80/javascript_closures_for_dummies" rel="noreferrer">http://web.archive.org/web/20111217011630/http://blog.morrisjohns.com:80/javascript_closures_for_dummies</a></li>
<li><a href="https://stackoverflow.com/questions/111102/how-does-a-javascript-closure-work">How do JavaScript closures work?</a></li>
<li><strong><a href="http://ejohn.org/blog/partial-functions-in-javascript/" rel="noreferrer">http://ejohn.org/blog/partial-functions-in-javascript</a> (Mr. Resig on the money as per usual)</strong></li>
<li><a href="http://benalman.com/news/2010/09/partial-application-in-javascript/" rel="noreferrer">http://benalman.com/news/2010/09/partial-application-in-javascript/</a></li>
</ul>
<p>I’ll add more as they crop up in the comments.</p>
<hr>
<p>So, according to the answers, currying and partial application in general are convenience techniques.</p>
<p>If you are frequently “refining” a high-level function by calling it with same configuration, you can curry (or use Resig’s partial) the higher-level function to create simple, concise helper methods.</p>
| [
{
"answer_id": 113847,
"author": "Marijn",
"author_id": 12038,
"author_profile": "https://Stackoverflow.com/users/12038",
"pm_score": 2,
"selected": false,
"text": "partial(alert, \"FOO!\")"
},
{
"answer_id": 113857,
"author": "Armin Ronacher",
"author_id": 19990,
"au... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113780",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9474/"
] |
113,791 | <p>Currently i am developing sites using DNN framework. Currently my development and staging environment is same. Client is vewing same site which I am using for development.</p>
<p>I have started using tortoise svn (subversion) for maintaining versions and backup. I am using file based svn repository for it.</p>
<p>The issue is svn creates .svn folder (hidden) in every folder. This folder and files inside it shows in portal system while file selection and at many different locations like FCKEditor File Browser, Icon selection for module / page, skins selection.</p>
<p>I would like to hide this folder for entire application and it should not show up anywhere.</p>
| [
{
"answer_id": 113807,
"author": "1800 INFORMATION",
"author_id": 3146,
"author_profile": "https://Stackoverflow.com/users/3146",
"pm_score": 1,
"selected": false,
"text": "export"
}
] | 2008/09/22 | [
"https://Stackoverflow.com/questions/113791",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20031/"
] |
113,803 | <p>If I have a table in MySQL which represents a base class, and I have a bunch of tables which represent the fields in the derived classes, each of which refers back to the base table with a foreign key, is there any way to get MySQL to enforce the one-to-one relationship between the derived table and the base table, or does this have to be done in code?</p>
<p>Using the following quick 'n' dirty schema as an example, is there any way to get MySQL to ensure that rows in both product_cd and product_dvd cannot share the same product_id? Is there a better way to design the schema to allow the database to enforce this relationship, or is it simply not possible?</p>
<pre><code>CREATE TABLE IF NOT EXISTS `product` (
`product_id` int(10) unsigned NOT NULL auto_increment,
`product_name` varchar(50) NOT NULL,
`description` text NOT NULL,
PRIMARY KEY (`product_id`)
) ENGINE = InnoDB;
CREATE TABLE `product_cd` (
`product_cd_id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`product_id` INT UNSIGNED NOT NULL ,
`artist_name` VARCHAR( 50 ) NOT NULL ,
PRIMARY KEY ( `product_cd_id` ) ,
INDEX ( `product_id` )
) ENGINE = InnoDB;
ALTER TABLE `product_cd` ADD FOREIGN KEY ( `product_id` )
REFERENCES `product` (`product_id`)
ON DELETE RESTRICT ON UPDATE RESTRICT ;
CREATE TABLE `product_dvd` (
`product_dvd_id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`product_id` INT UNSIGNED NOT NULL ,
`director` VARCHAR( 50 ) NOT NULL ,
PRIMARY KEY ( `product_dvd_id` ) ,
INDEX ( `product_id` )
) ENGINE = InnoDB;
ALTER TABLE `product_dvd` ADD FOREIGN KEY ( `product_id` )
REFERENCES `product` (`product_id`)
ON DELETE RESTRICT ON UPDATE RESTRICT ;
</code></pre>
<p>@<a href="https://stackoverflow.com/questions/113803/mysql-foreign-keys-how-to-enforce-one-to-one-across-tables#113811">Skliwz</a>, can you please provide more detail about how triggers can be used to enforce this constraint with the schema provided?</p>
<p>@<a href="https://stackoverflow.com/questions/113803/mysql-foreign-keys-how-to-enforce-one-to-one-across-tables#113858">boes</a>, that sounds great. How does it work in situations where you have a child of a child? For example, if we added product_movie and made product_dvd a child of product_movie? Would it be a maintainability nightmare to make the check constraint for product_dvd have to factor in all child types as well?</p>
| [
{
"answer_id": 113858,
"author": "boes",
"author_id": 17746,
"author_profile": "https://Stackoverflow.com/users/17746",
"pm_score": 3,
"selected": true,
"text": "CREATE TABLE IF NOT EXISTS `product` (\n`product_id` int(10) unsigned NOT NULL auto_increment,\n'product_type' int not null,\n... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113803",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15004/"
] |
113,818 | <p>I am developing a C++ class library containing domain model classes, and I would like to add support for instantiating these classes from various persistence mechanisms, i.e. databases and file. The user of the class library should be given an interface(?) against which to program a class that can transfer the data from/to the persistence mechanism.</p>
<p>I know of the Data Access Object pattern which seems to work for Java, but I'm not exactly sure how to apply it to C++. Are there other solutions?</p>
| [
{
"answer_id": 113879,
"author": "ConcernedOfTunbridgeWells",
"author_id": 15401,
"author_profile": "https://Stackoverflow.com/users/15401",
"pm_score": 2,
"selected": true,
"text": "__getattr()__"
}
] | 2008/09/22 | [
"https://Stackoverflow.com/questions/113818",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19863/"
] |
113,824 | <p>Is it possible to automount a TrueCrypt volume when logging in to Ubuntu 8.04? It's already storing the wireless network keys using the Seahorse password manager. Could TrueCrypt be made to fetch its volume password from the same keyring? Currently this would seem like the most convenient way to store my source code on the USB stick I carry around to boot from.</p>
| [
{
"answer_id": 10216328,
"author": "swizzly",
"author_id": 1317491,
"author_profile": "https://Stackoverflow.com/users/1317491",
"pm_score": 3,
"selected": true,
"text": "/etc/gdm/Init"
}
] | 2008/09/22 | [
"https://Stackoverflow.com/questions/113824",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16509/"
] |
113,829 | <p>How do I get timestamp from e.g. <code>22-09-2008</code>?</p>
| [
{
"answer_id": 113836,
"author": "Till",
"author_id": 2859,
"author_profile": "https://Stackoverflow.com/users/2859",
"pm_score": 5,
"selected": false,
"text": "list($day, $month, $year) = explode('-', '22-09-2008');\necho mktime(0, 0, 0, $month, $day, $year);\n"
},
{
"answer_id"... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113829",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/205368/"
] |
113,830 | <p>Is there a runtime performance penalty when using interfaces (abstract base classes) in C++?</p>
| [
{
"answer_id": 114729,
"author": "KeithB",
"author_id": 2298,
"author_profile": "https://Stackoverflow.com/users/2298",
"pm_score": 2,
"selected": false,
"text": "class AbstractAlgo\n{\n virtual int func();\n};\n\nclass Algo1 : public AbstractAlgo\n{\n virtual int func();\n};\n\ncl... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113830",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19863/"
] |
113,845 | <p>now i need to insert some data from the sqlserver into a word,i know how to use bookmark and the office interop api do that but it's slow to call the word process do that and it's coupling between the bookmark define and the code , is it possible to do this without word process start?if not are there any template engine to do this?</p>
| [
{
"answer_id": 124817,
"author": "Mark Nold",
"author_id": 4134,
"author_profile": "https://Stackoverflow.com/users/4134",
"pm_score": 0,
"selected": false,
"text": "something-uniqueid.xls"
}
] | 2008/09/22 | [
"https://Stackoverflow.com/questions/113845",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20142/"
] |
113,860 | <p>How can I make sure that a certain OLEDB driver is installed when I start my application? I use ADO from Delphi and would like to display a descriptive error message if the driver is missing. The error that's returned from ADO isn't always that user-friendly.</p>
<p>There are probably a nice little function that returns all installed drivers but I haven't found it.</p>
| [
{
"answer_id": 154559,
"author": "Jeremy Mullin",
"author_id": 7893,
"author_profile": "https://Stackoverflow.com/users/7893",
"pm_score": 3,
"selected": true,
"text": "function OleDBExists : boolean;\nvar\n reg : TRegistry;\nbegin\n Result := false;\n\n // See if Advantage OLE DB Pro... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113860",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4101/"
] |
113,873 | <p>I want to extend the basic <code>ControlCollection</code> in VB.NET so I can just add images and text to a self-made control, and then automaticly convert them to pictureboxes and lables.</p>
<p>So I made a class that inherits from ControlCollection, overrided the add method, and added the functionality.</p>
<p>But when I run the example, it gives a <code>NullReferenceException</code>.</p>
<p>Here is the code:</p>
<pre><code> Shadows Sub add(ByVal text As String)
Dim LB As New Label
LB.AutoSize = True
LB.Text = text
MyBase.Add(LB) 'Here it gives the exception.
End Sub
</code></pre>
<p>I searched on Google, and someone said that the <code>CreateControlsInstance</code> method needs to be overriden. So I did that, but then it gives <code>InvalidOperationException</code> with an <code>innerException</code> message of <code>NullReferenceException</code>.</p>
<p>How do I to implement this?</p>
| [
{
"answer_id": 113913,
"author": "mattlant",
"author_id": 14642,
"author_profile": "https://Stackoverflow.com/users/14642",
"pm_score": 0,
"selected": false,
"text": "puclic class MyCollection : Collection<Control>\n"
},
{
"answer_id": 114338,
"author": "roomaroo",
"autho... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113873",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20261/"
] |
113,883 | <p>How do you determine the collation of a database in SQL 2005, for instance if you need to perform a case-insensitive search/replace?</p>
| [
{
"answer_id": 113913,
"author": "mattlant",
"author_id": 14642,
"author_profile": "https://Stackoverflow.com/users/14642",
"pm_score": 0,
"selected": false,
"text": "puclic class MyCollection : Collection<Control>\n"
},
{
"answer_id": 114338,
"author": "roomaroo",
"autho... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113883",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5152/"
] |
113,886 | <p>I'm trying to ftp a folder using the command line ftp client, but so far I've only been able to use 'get' to get individual files. </p>
| [
{
"answer_id": 113892,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 4,
"selected": false,
"text": "scp"
},
{
"answer_id": 113900,
"author": "Thibaut Barrère",
"author_id": 20302,
"author_profile": "ht... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113886",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11708/"
] |
113,897 | <p>I have a quick question. How do I get the image generated by a JComponent.paint or paintComponent?</p>
<p>I have a JComponent which I use as a 'workspace' and where I have overwritten the paintComponent method to my own. The thing is that my workspace JComponent also has children which has their own paintComponent methods.</p>
<p>So when Swing renders my workspace component, it renders the workspace graphics and then its childrens'.</p>
<p>However, I want to get the image my workspace component generates (which includes the workspace graphics and the children's graphics).</p>
<p>How do I do that?</p>
<p>I tried to call the paintComponent/paint-method myself by using my own Graphics, but i just returned a black image. Here is what i tried;</p>
<pre><code>public void paintComponent(Graphics g) {
if (bufferedImage != null) {
g.drawImage(bufferedImage, 0, 0, this);
}
else {
g.setColor(Color.WHITE);
g.fillRect(0, 0, bufferedImage.getWidth(), bufferedImage.getHeight());
}
}
public BufferedImage getImage() {
BufferedImage hello = new BufferedImage(getWidth(), getHeight(), BufferedImage.TYPE_INT_ARGB);
Graphics g = hello.getGraphics();
paintComponent( g );
return hello;
}
</code></pre>
<p>Any thoughts or comments are welcome! :)</p>
| [
{
"answer_id": 114026,
"author": "user20298",
"author_id": 20298,
"author_profile": "https://Stackoverflow.com/users/20298",
"pm_score": 1,
"selected": false,
"text": "BufferedImage hello = bufferedImage.getSubimage(0,0, getWidth(), getHeight());\n"
},
{
"answer_id": 115019,
... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113897",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20298/"
] |
113,899 | <p>I want to create a c# application with multiple windows that are all transparent with some text on.</p>
<p>The tricky part is making these forms sit on top of the desktop but under the desktop icons. Is this possible?</p>
| [
{
"answer_id": 113933,
"author": "Jeff Hillman",
"author_id": 3950,
"author_profile": "https://Stackoverflow.com/users/3950",
"pm_score": 3,
"selected": true,
"text": "this.BackColor = Color.Fuchsia;\nthis.TransparencyKey = Color.Fuchsia;\n"
}
] | 2008/09/22 | [
"https://Stackoverflow.com/questions/113899",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3585/"
] |
113,901 | <p>In order to perform a case-sensitive search/replace on a table in a SQL Server 2000/2005 database, you must use the correct collation.</p>
<p>How do you determine whether the default collation for a database is case-sensitive, and if it isn't, how to perform a case-sensitive search/replace?</p>
| [
{
"answer_id": 113909,
"author": "blowdart",
"author_id": 2525,
"author_profile": "https://Stackoverflow.com/users/2525",
"pm_score": 5,
"selected": true,
"text": "SELECT testColumn FROM testTable \n WHERE testColumn COLLATE Latin1_General_CS_AS = 'example' \n\nSELECT testColumn FROM... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113901",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5152/"
] |
113,915 | <p>I'm getting a random unreproducible Error when initializing a JSplitPane in with JDK 1.5.0_08. Note that this does not occur every time, but about 80% of the time:</p>
<pre><code>Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: javax.swing.KeyStroke
at java.util.TreeMap.compare(TreeMap.java:1093)
at java.util.TreeMap.put(TreeMap.java:465)
at java.util.TreeSet.add(TreeSet.java:210)
at javax.swing.plaf.basic.BasicSplitPaneUI.installDefaults(BasicSplitPaneUI.java:364)
at javax.swing.plaf.basic.BasicSplitPaneUI.installUI(BasicSplitPaneUI.java:300)
at javax.swing.JComponent.setUI(JComponent.java:652)
at javax.swing.JSplitPane.setUI(JSplitPane.java:350)
at javax.swing.JSplitPane.updateUI(JSplitPane.java:378)
at javax.swing.JSplitPane.<init>(JSplitPane.java:332)
at javax.swing.JSplitPane.<init>(JSplitPane.java:287)
...
</code></pre>
<p>Thoughts? I've tried cleaning and rebuilding my project so as to minimize the probability of corrupted class files.</p>
<p><strong>Edit #1</strong> See <a href="http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6434148" rel="nofollow noreferrer">http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6434148</a> - seems to be a JDK bug. Any known workarounds? None are listed on the bug entry page.</p>
| [
{
"answer_id": 34129765,
"author": "Shree",
"author_id": 5649198,
"author_profile": "https://Stackoverflow.com/users/5649198",
"pm_score": -1,
"selected": false,
"text": "java.lang.ClassCastException: javax.swing.KeyStroke cannot be cast to java.lang.Comparable....\n"
}
] | 2008/09/22 | [
"https://Stackoverflow.com/questions/113915",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6583/"
] |
113,916 | <p>If I need to choose a collation mode to work with, how do I know what collations are available?</p>
| [
{
"answer_id": 118419,
"author": "Constantin",
"author_id": 20310,
"author_profile": "https://Stackoverflow.com/users/20310",
"pm_score": 3,
"selected": true,
"text": "select distinct COLLATION_NAME from INFORMATION_SCHEMA.COLUMNS order by 1\n"
}
] | 2008/09/22 | [
"https://Stackoverflow.com/questions/113916",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5152/"
] |
113,923 | <p>We help our clients to manage and publish their media online - images, video, audio, whatever. They always ask my boss whether they can stop users from copying their media, and he asks me, and I always tell him the same thing: no. If the users can view the media, then a sufficiently determined user will always be able to make a copy. But am I right?</p>
<p>I've been asked again today, and I promised my boss I'd ask about it online. So - is there a DRM scheme that will work? One that will stop users making copies without stopping legitimate viewing of the media?</p>
<p>And if there isn't, how do I convince my boss?</p>
| [
{
"answer_id": 1452749,
"author": "Mike Dunlavey",
"author_id": 23771,
"author_profile": "https://Stackoverflow.com/users/23771",
"pm_score": 0,
"selected": false,
"text": "X = A; // statement 1\nX = B; // statement 2\n"
}
] | 2008/09/22 | [
"https://Stackoverflow.com/questions/113923",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15371/"
] |
113,928 | <p>When I enter an object into the DB with Linq-to-SQL can I get the id that I just inserted without making another db call? I am assuming this is pretty easy, I just don't know how. </p>
| [
{
"answer_id": 113948,
"author": "Germstorm",
"author_id": 18631,
"author_profile": "https://Stackoverflow.com/users/18631",
"pm_score": 9,
"selected": true,
"text": "myObject.Field1 = \"value\";\n\n// Db is the datacontext\ndb.MyObjects.InsertOnSubmit(myObject);\ndb.SubmitChanges();\n\n... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113928",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14777/"
] |
113,930 | <p>I would like to display some memory statistics (working set, GCs etc.) on a web page using the .NET/Process performance counters. Unfortunately, if there are multiple application pools on that server, they are differentiated using an index (#1, #2 etc.) but I don't know how to match a process ID (which I have) to that #xx index. Is there a programmatic way (from an ASP.NET web page)?</p>
| [
{
"answer_id": 491022,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 4,
"selected": false,
"text": "private static string GetProcessInstanceName(int pid)\n{\n PerformanceCounterCategory cat = new PerformanceCounterCategory(\"... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113930",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
113,951 | <p>I am creating an appcation on Vista,which include a service and a Console application .Both running in same user account</p>
<p>In service i am creating an event and waits for that event.In console application i am opening the same event (problem starts here) and calling <em>SetEvent</em> function. I can not open the event (getting error 5,Access is denied) in the console application.I searched in the net and saw something about integrity level (I am not sure that the problem is related to integrity level).Its telling that service and applicaation got differnt integrity levels.</p>
<p>here is the part of the code,where IPC occures</p>
<p><strong>service</strong> </p>
<pre><code>DWORD
WINAPI IpcThread(LPVOID lpParam)
{
HANDLE ghRequestEvent = NULL ;
ghRequestEvent = CreateEvent(NULL, FALSE,
FALSE, "Global\\Event1") ; //creating the event
if(NULL == ghRequestEvent)
{
//error
}
while(1)
{
WaitForSingleObject(ghRequestEvent, INFINITE) //waiting for the event
//here some action related to event
}
}
</code></pre>
<p><strong>Console Application</strong></p>
<p>Here in application ,opening the event and seting the event</p>
<pre><code>unsigned int
event_notification()
{
HANDLE ghRequestEvent = NULL ;
ghRequestEvent = OpenEvent(SYNCHRONIZE|EVENT_MODIFY_STATE, FALSE, "Global\\Event1") ;
if(NULL == ghRequestEvent)
{
//error
}
SetEvent(ghRequestEvent) ;
}
</code></pre>
<p>I am running both application (serivce and console application) with administrative privilege (i logged in as Administraor and running the console application by right clicking and using the option "run as administrator") .</p>
<p>The error i am getting in console application (where i am opening the event) is error no 5(Access is denied. ) .</p>
<p>So it will be very helpfull if you tell how to do the IPC between a service and an application in Vista</p>
<p>Thanks in advance</p>
<p>Navaneeth</p>
| [
{
"answer_id": 114009,
"author": "1800 INFORMATION",
"author_id": 3146,
"author_profile": "https://Stackoverflow.com/users/3146",
"pm_score": 2,
"selected": false,
"text": "#include <sddl.h>\n#include <AccCtrl.h>\n#include <Aclapi.h>\n\nvoid SetLowLabelToFile()\n{\n // The LABEL_SECURIT... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113951",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20316/"
] |
113,989 | <p>Is there an easy way (in .Net) to test if a Font is installed on the current machine?</p>
| [
{
"answer_id": 113998,
"author": "aku",
"author_id": 1196,
"author_profile": "https://Stackoverflow.com/users/1196",
"pm_score": 5,
"selected": false,
"text": "var fontsCollection = new InstalledFontCollection();\nforeach (var fontFamily in fontsCollection.Families)\n{\n if (fontFamil... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113989",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11492/"
] |
113,991 | <p>A heap is a list where the following applies:</p>
<pre><code>l[i] <= l[2*i] && l[i] <= [2*i+1]
</code></pre>
<p>for <code>0 <= i < len(list)</code></p>
<p>I'm looking for in-place sorting.</p>
| [
{
"answer_id": 114071,
"author": "HenryR",
"author_id": 2827,
"author_profile": "https://Stackoverflow.com/users/2827",
"pm_score": 0,
"selected": false,
"text": "for (int k=len(l)-1;k>0;k--){\nswap( l, 0, k );\nwhile (i*2 < k)\n {\nint left = i*2;\nint right = l*2 + 1;\nint swapidx = i... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113991",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6899/"
] |
113,992 | <p>In what order are the following parameters tested (in C++)?</p>
<pre><code>if (a || b && c)
{
}
</code></pre>
<p>I've just seen this code in our application and I hate it, I want to add some brackets to just clarify the ordering. But I don't want to add the brackets until I know I'm adding them in the right place.</p>
<p><strong><em>Edit: Accepted Answer & Follow Up</em></strong></p>
<p>This link has more information, but it's not totally clear what it means. It seems || and && are the same precedence, and in that case, they are evaluated left-to-right.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/126fe14k.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/126fe14k.aspx</a></p>
| [
{
"answer_id": 113995,
"author": "tzot",
"author_id": 6899,
"author_profile": "https://Stackoverflow.com/users/6899",
"pm_score": 3,
"selected": true,
"text": "a || (b && c)\n"
},
{
"answer_id": 114185,
"author": "efotinis",
"author_id": 12320,
"author_profile": "http... | 2008/09/22 | [
"https://Stackoverflow.com/questions/113992",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/986/"
] |
114,010 | <p>Is there any way to create C# 3.0 anonymous object via Reflection at runtime in .NET 3.5? I'd like to support them in my serialization scheme, so I need a way to manipulate them programmatically.</p>
<p><em>edited later to clarify the use case</em></p>
<p>An extra constraint is that I will be running all of it inside a Silverlight app, so extra runtimes are not an option, and not sure how generating code on the fly will work.</p>
| [
{
"answer_id": 114101,
"author": "TraumaPony",
"author_id": 18658,
"author_profile": "https://Stackoverflow.com/users/18658",
"pm_score": 2,
"selected": false,
"text": "public static T create<T>(T t)\n{\n return Activator.CreateInstance<T>();\n}\n\nobject anon = create(existingAnonymo... | 2008/09/22 | [
"https://Stackoverflow.com/questions/114010",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9777/"
] |
114,054 | <p>Can you please clarify the folowing query? I am not sure if the way I am trying to code is correct. Kindly advise me if I am moving in the right/wrong direction.</p>
<p>I am trying to develop an automation framework using <a href="http://en.wikipedia.org/wiki/HP_QuickTest_Professional" rel="nofollow noreferrer">QuickTest Professional</a>, a testing tool.</p>
<ul>
<li>There is an Excel sheet from which the data is being taken for execution based on the ID's stored in an array from another Excel sheet (The same ID is available in both Excel sheets).</li>
<li>I'm trying to handle the exeptional cases through a function call. This function will capture the screenshot of the page error occured and then exit the entire loop.</li>
<li>I need a scenario where execution continues for the next ID stored in the array, and this needs to be handled from the function call.</li>
</ul>
| [
{
"answer_id": 114133,
"author": "Rob Cooper",
"author_id": 832,
"author_profile": "https://Stackoverflow.com/users/832",
"pm_score": 1,
"selected": false,
"text": "While Not EndOfExcelSheet\n ReadDataFromExcel();\n If errOccurred Then TakeScreenPrint();\n 'NOTE: We have caught ... | 2008/09/22 | [
"https://Stackoverflow.com/questions/114054",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
114,085 | <p>I have lots of unrelated named things that I'd like to do quick searches against. An "aardvark" is always an "aardvark" everywhere, so hashing the string and reusing the integer would work well to speed up comparisons. The entire set of names is unknown (and changes over time). What is a fast string hashing algorithm that will generate small (32 or 16) bit values and have a low collision rate?</p>
<p>I'd like to see an optimized implementation specific to C/C++.</p>
| [
{
"answer_id": 372732,
"author": "Bernard Igiri",
"author_id": 254455,
"author_profile": "https://Stackoverflow.com/users/254455",
"pm_score": 2,
"selected": false,
"text": "#include <boost/functional/hash.hpp>\n\nint main()\n{\n boost::hash<std::string> string_hash;\n\n std::size_... | 2008/09/22 | [
"https://Stackoverflow.com/questions/114085",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10945/"
] |
114,112 | <p>I have tried following guides like <a href="http://docs.djangoproject.com/en/dev/howto/deployment/modpython/" rel="nofollow noreferrer">this one</a> but it just didnt work for me.</p>
<p><strong>So my question is this:</strong> What is a good guide for deploying Django, and how do you deploy your Django.</p>
<p>I keep hearing that capastrano is pretty nifty to use, but i have no idea as to how to work it or what it does (apart from automation of deploying code), or even if i want/need to use it or not.</p>
| [
{
"answer_id": 114268,
"author": "Armin Ronacher",
"author_id": 19990,
"author_profile": "https://Stackoverflow.com/users/19990",
"pm_score": 3,
"selected": false,
"text": "mod_wsgi"
},
{
"answer_id": 1546416,
"author": "che",
"author_id": 7806,
"author_profile": "htt... | 2008/09/22 | [
"https://Stackoverflow.com/questions/114112",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2592/"
] |
114,148 | <p>On a website if I have a form where the user can input some text and then a page which displays what the user has entered. I know to html encode the values the user has entered to prevent scripting attacks. If the form was sending emails addresses I presume I would do the same but is there any special cases for emails and will email clients run the any script injected into the email?</p>
| [
{
"answer_id": 114791,
"author": "Prestaul",
"author_id": 5628,
"author_profile": "https://Stackoverflow.com/users/5628",
"pm_score": 1,
"selected": false,
"text": "<script>"
}
] | 2008/09/22 | [
"https://Stackoverflow.com/questions/114148",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18793/"
] |
114,149 | <p>The point of const-correctness is to be able to provide a view of an instance that can't be altered or deleted by the user. The compiler supports this by pointing out when you break constness from within a const function, or try to use a non-const function of a const object. So without copying the const approach, is there a methodology I can use in C# that has the same ends? </p>
<p>I'm aware of immutability, but that doesn't really carry over to container objects to name but one example.</p>
| [
{
"answer_id": 114809,
"author": "Trap",
"author_id": 7839,
"author_profile": "https://Stackoverflow.com/users/7839",
"pm_score": 7,
"selected": true,
"text": "public interface IReadOnlyCustomer\n{\n String Name { get; }\n int Age { get; }\n}\n\npublic class Customer : IReadOnlyCus... | 2008/09/22 | [
"https://Stackoverflow.com/questions/114149",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11801/"
] |
114,154 | <p>XAML allows you to specify an attribute value using a string that contains curly braces. Here is an example that creates a <em>Binding</em> instance and assigns it to the <em>Text</em> property of the <em>TextBox</em> element.</p>
<pre><code><TextBox Text="{Binding ElementName=Foo, Path=Bar}"/>
</code></pre>
<p>I want to extend XAML so that the developer could enter this as valid...</p>
<pre><code><TextBox Text="{MyCustomObject Field1=Foo, Field2=Bar}"/>
</code></pre>
<p>This would create an instance of my class and set the Field1/Field2 properties as appropriate. Is this possible? If so how do you do it?</p>
<p>If this is possible I have a followup question. Can I take a string <em>"{Binding ElementName=Foo, Path=Bar}"</em> and ask the framework to process it and return the <em>Binding</em> instance it specified? This must be done somewhere already to make the above XAML work and so there must be a way to ask for the same thing to be processed.</p>
| [
{
"answer_id": 114195,
"author": "Brownie",
"author_id": 6600,
"author_profile": "https://Stackoverflow.com/users/6600",
"pm_score": 2,
"selected": false,
"text": "Binding"
}
] | 2008/09/22 | [
"https://Stackoverflow.com/questions/114154",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6276/"
] |
114,165 | <p>At work we use <a href="http://en.wikipedia.org/wiki/WiX" rel="noreferrer">WiX</a> for building installation packages. We want that installation of product X would result in uninstall of the previous version of that product on that machine.</p>
<p>I've read on several places on the Internet about a major upgrade but couldn't get it to work.
Can anyone please specify the exact steps that I need to take to add uninstall previous version feature to WiX?</p>
| [
{
"answer_id": 114736,
"author": "Dror Helper",
"author_id": 11361,
"author_profile": "https://Stackoverflow.com/users/11361",
"pm_score": 8,
"selected": false,
"text": "<Property Id=\"PREVIOUSVERSIONSINSTALLED\" Secure=\"yes\" />\n<Upgrade Id=\"YOUR_GUID\"> \n <UpgradeVersion\n ... | 2008/09/22 | [
"https://Stackoverflow.com/questions/114165",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11361/"
] |
114,172 | <p>I have a Windows executable (whoami) which is crashing every so often. It's called from another process to get details about the current user and domain. I'd like to know what parameters are passed when it fails.</p>
<p>Does anyone know of an appropriate way to wrap the process and write it's command line arguments to log while still calling the process?</p>
<p>Say the command is used like this:
'whoami.exe /all'</p>
<p>I'd like a script to exist instead of the whoami.exe (with the same filename) which will write this invocation to log and then pass on the call to the actual process.</p>
| [
{
"answer_id": 114199,
"author": "Milan Babuškov",
"author_id": 14690,
"author_profile": "https://Stackoverflow.com/users/14690",
"pm_score": 1,
"selected": false,
"text": "int main(int argc, void **argv)\n{\n // dump contents of argv to some log file\n int i=0;\n for (i=0; i<ar... | 2008/09/22 | [
"https://Stackoverflow.com/questions/114172",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2257098/"
] |
114,179 | <p>I got this síngleton cache object and it exposes an IEnumerable property which just returns a private IEnumerable variable.</p>
<p>I have a static method on my singleton object that updates this member variable (that exists on the single 'Instance' instance of this cache object).</p>
<p>Let's say some thread is currently iterating over this IEnumerable variable/property while my cache is updating. I made it so the cache is updating on a new local variable and finally setting the exposed private variable to point to this new local variable.</p>
<p>I know i'm just updating a reference, leaving the other (old) object in memory waiting to be picked up by the GC but my problem is - i'm not 100% sure what happens once i set the new reference? Would the other thread suddenly be iterating over the new object or the old one it got passed through the IEnumerable interface? If it had been a normal reference i'd say 'no'. The calling thread would be operating on the old object, but i'm not sure if this is the case for IEnumerable as well?</p>
<p>Here is the class stripped down:</p>
<pre><code>internal sealed class SektionCache : CacheBase
{
public static readonly SektionCache Instance = new SektionCache();
private static readonly object lockObject = new object();
private static bool isUpdating;
private IEnumerable<Sektion> sektioner;
static SektionCache()
{
UpdateCache();
}
public IEnumerable<Sektion> Sektioner
{
get { return sektioner; }
}
public static void UpdateCache()
{
// SNIP - getting data, locking etc.
Instance.sektioner = newSektioner;
// SNIP
}
}
</code></pre>
| [
{
"answer_id": 114193,
"author": "configurator",
"author_id": 9536,
"author_profile": "https://Stackoverflow.com/users/9536",
"pm_score": 2,
"selected": false,
"text": "{ return sektioner; }"
},
{
"answer_id": 114462,
"author": "TcKs",
"author_id": 20382,
"author_prof... | 2008/09/22 | [
"https://Stackoverflow.com/questions/114179",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11619/"
] |
114,180 | <p>What would be better practice when giving a function the original variable to work with:</p>
<pre><code>unsigned long x = 4;
void func1(unsigned long& val) {
val = 5;
}
func1(x);
</code></pre>
<p>or:</p>
<pre><code>void func2(unsigned long* val) {
*val = 5;
}
func2(&x);
</code></pre>
<p>IOW: Is there any reason to pick one over another?</p>
| [
{
"answer_id": 114351,
"author": "Johann Gerell",
"author_id": 6345,
"author_profile": "https://Stackoverflow.com/users/6345",
"pm_score": 6,
"selected": false,
"text": "const"
},
{
"answer_id": 213963,
"author": "Kiley Hykawy",
"author_id": 22727,
"author_profile": "... | 2008/09/22 | [
"https://Stackoverflow.com/questions/114180",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20349/"
] |
114,192 | <p>Imagine a web application written in Ruby on Rails. Part of the state of that application is represented in a piece of data which doesn't fit the description of a model. This state descriptor needs to be persisted in the same database as the models.
Where it differs from a model is that there needs to be only one instance of its class and it doesn't have relationships with other classes.</p>
<p>Has anyone come across anything like this?</p>
| [
{
"answer_id": 114317,
"author": "Toby Hede",
"author_id": 14971,
"author_profile": "https://Stackoverflow.com/users/14971",
"pm_score": 1,
"selected": false,
"text": "class ApplicationController < ActionController::Base\n helper :all \n @data = \"YOUR DATA HERE\" \nend\n"
},
{
... | 2008/09/22 | [
"https://Stackoverflow.com/questions/114192",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8683/"
] |
114,194 | <p>My app is installed via NSIS.</p>
<p>I want the installer to install the program for all users.</p>
<p>I can do this, by installing to the 'program files' directory.</p>
<p>There is a database file (firebird), that all user accounts on the system should share. </p>
<p>If I store this database file in the 'program files' directory it will be read only.</p>
<p>If I store it in the users APPDATA directory they will each have a different copy, when one user adds data the others wont see it.</p>
<p>Option 1 - In my app directory under 'program files' create a 'Data' directory, in my installer make this dir read-writeable by all, that way the user 'program files' virtualisation won't kick in and all users can update the file and see each others changes.</p>
<p>Any other options ? </p>
| [
{
"answer_id": 835131,
"author": "Kyle Gagnet",
"author_id": 101915,
"author_profile": "https://Stackoverflow.com/users/101915",
"pm_score": 0,
"selected": false,
"text": "SetShellVarContext all\nSetOutPath $APPDATA\nFile \"MyInsecurelySharedFile.txt\"\n"
}
] | 2008/09/22 | [
"https://Stackoverflow.com/questions/114194",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1724/"
] |
114,196 | <p>I'm using <a href="http://erlang.org/doc/man/httpc.html#request-1" rel="nofollow noreferrer"><code>httpc:request</code></a> to post some data to a remote service. I have the post working but the data in the body() of the post comes through as is, without any URL-encoding which causes the post to fail when parsed by the remote service.</p>
<p>Is there a function in Erlang that is similar to <a href="https://apidock.com/ruby/CGI/escape/class" rel="nofollow noreferrer"><code>CGI.escape</code></a> in Ruby for this purpose?</p>
| [
{
"answer_id": 114223,
"author": "tonys",
"author_id": 35439,
"author_profile": "https://Stackoverflow.com/users/35439",
"pm_score": 0,
"selected": false,
"text": "% Utility function to convert a 'form' of name-value pairs into a URL encoded\n% content string.\n\nurlencode(Form) ->\n ... | 2008/09/22 | [
"https://Stackoverflow.com/questions/114196",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20345/"
] |
114,207 | <p>I just want my apache to register some of my predefined environment so that i can retrieve it using getenv function in php. How can i do this? I tried adding /etc/profile.d/foo.sh with export FOO=/bar/baz using root and restarted apache.</p>
| [
{
"answer_id": 114231,
"author": "Torsten Marek",
"author_id": 9567,
"author_profile": "https://Stackoverflow.com/users/9567",
"pm_score": 4,
"selected": true,
"text": "# . /etc/profile.d/foo.sh"
},
{
"answer_id": 26251452,
"author": "Don Grem",
"author_id": 468282,
"... | 2008/09/22 | [
"https://Stackoverflow.com/questions/114207",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20300/"
] |
114,208 | <p>Let me explain:
this is path to this folder: > <code>www.my_site.com/images</code></p>
<p>And images are created by <code>user_id</code>, and for example, images of <code>user_id = 27</code> are,
<code>27_1.jpg</code>, <code>27_2.jpg</code>, <code>27_3.jpg</code>!
How to list and print images which start with <code>27_%.jpg</code>?
I hope You have understood me!
PS. I am totally beginmer in ASP.NET (VB) and please give me detailed information</p>
<p>Here starts my loop</p>
<pre><code>while dbread.Read()
'and then id user_id
dbread('user_id')
</code></pre>
<p>NEXT???</p>
<hr>
<p>I nedd to create XML, till now I created like this:</p>
<p>act.WriteLine("")
act.WriteLine("<a href="http://www.my_site.com/images/" rel="nofollow noreferrer">http://www.my_site.com/images/</a>"&dbread("user_id")&"_1.jpg")
act.WriteLine("")</p>
<p>But this is not answer because I need to create this nodes how many images of this user exist?</p>
<p>In database doesn't exist list of this images so that is reason why I must count them in folder. (this is not my site exacly, but I need to create XMl on this site)</p>
<p>Do you understand me?</p>
| [
{
"answer_id": 114231,
"author": "Torsten Marek",
"author_id": 9567,
"author_profile": "https://Stackoverflow.com/users/9567",
"pm_score": 4,
"selected": true,
"text": "# . /etc/profile.d/foo.sh"
},
{
"answer_id": 26251452,
"author": "Don Grem",
"author_id": 468282,
"... | 2008/09/22 | [
"https://Stackoverflow.com/questions/114208",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/205368/"
] |
114,214 | <p>What is the difference between the following class methods?</p>
<p>Is it that one is static and the other is not?</p>
<pre><code>class Test(object):
def method_one(self):
print "Called method_one"
def method_two():
print "Called method_two"
a_test = Test()
a_test.method_one()
a_test.method_two()
</code></pre>
| [
{
"answer_id": 114232,
"author": "Justin Poliey",
"author_id": 6967,
"author_profile": "https://Stackoverflow.com/users/6967",
"pm_score": 4,
"selected": false,
"text": "self"
},
{
"answer_id": 114250,
"author": "Jon Cage",
"author_id": 15369,
"author_profile": "https... | 2008/09/22 | [
"https://Stackoverflow.com/questions/114214",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16070/"
] |
114,222 | <p>With the introduction of .NET 3.5 and the <code>IQueryable<T></code> interface, new patterns will emerge. While I have seen a number of implementations of the Specification pattern, I have not seen many other patterns using this technology. Rob Conery's Storefront application is another concrete example using <code>IQueryable<T></code> which may lead to some new patterns.</p>
<p><strong>What patterns have emerged from the useful <code>IQueryable<T></code> interface?</strong></p>
| [
{
"answer_id": 114609,
"author": "Fredrik Kalseth",
"author_id": 1710,
"author_profile": "https://Stackoverflow.com/users/1710",
"pm_score": 3,
"selected": false,
"text": "public class LinqToSqlRepository : IRepository\n{\n private readonly DataContext _context;\n\n public LinqToSqlR... | 2008/09/22 | [
"https://Stackoverflow.com/questions/114222",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/708/"
] |
114,229 | <p>I'm trying to write a function that formats every (string) member/variable in an object, for example with a callback function. The variable names are unknown to me, so it must work with objects of all classes.</p>
<p>How can I achieve something similar to <code>array_map</code> or <code>array_walk</code> with objects?</p>
| [
{
"answer_id": 114271,
"author": "tpk",
"author_id": 8437,
"author_profile": "https://Stackoverflow.com/users/8437",
"pm_score": 1,
"selected": false,
"text": "get_object_vars()"
}
] | 2008/09/22 | [
"https://Stackoverflow.com/questions/114229",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12534/"
] |
114,236 | <p>I use pstack to analyze core dump files in Solaris</p>
<p>How else can I analyze the core dump from solaris?</p>
<p>What commands can be used to do this?</p>
<p>What other information will be available from the dump? </p>
| [
{
"answer_id": 252715,
"author": "Chris Quenelle",
"author_id": 32470,
"author_profile": "https://Stackoverflow.com/users/32470",
"pm_score": 2,
"selected": false,
"text": "% dbx a.out core\n(dbx) where\n(dbx) threads\n(dbx) thread t@3\n(dbx) where\n"
},
{
"answer_id": 21462854,
... | 2008/09/22 | [
"https://Stackoverflow.com/questions/114236",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20357/"
] |
114,237 | <p>When a getter returns a property, such as returning a <code>List</code> of other related objects, should that list and it's objects be immutable to prevent code outside of the class, changing the state of those objects, without the main parent object knowing?</p>
<p>For example if a <code>Contact</code> object, has a <code>getDetails</code> getter, which returns a <code>List</code> of <code>ContactDetails</code> objects, then any code calling that getter:</p>
<ol>
<li>can remove <code>ContactDetail</code> objects from that list without the <code>Contact</code> object knowing of it.</li>
<li>can change each <code>ContactDetail</code> object without the <code>Contact</code> object knowing of it.</li>
</ol>
<p>So what should we do here? Should we just trust the calling code and return easily mutable objects, or go the hard way and make a immutable class for each mutable class?</p>
| [
{
"answer_id": 114444,
"author": "Martin Spamer",
"author_id": 15527,
"author_profile": "https://Stackoverflow.com/users/15527",
"pm_score": 1,
"selected": false,
"text": "contact.print( printer ) ; // or\ncontact.show( new Dialog() ) ; // or\ncontactList.findByName( searchName ).print(... | 2008/09/22 | [
"https://Stackoverflow.com/questions/114237",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19888/"
] |
114,242 | <p>Previously I have asked to strip text from a field and convert it to an int, this works successfully. But now, I would like to do an INNER JOIN on this new value.</p>
<p>So I have this:</p>
<pre><code>SELECT CONVERT(int, SUBSTRING(accountingTab.id, PATINDEX('%[0-9]%', accountingTab.id), 999))
AS 'memId', userDetails.title, userDetails.lname
FROM accountingTab INNER JOIN
(SELECT id, title, first, last FROM memDetTab) AS userDetails ON memID = userDetails.id
</code></pre>
<p>And then I get the Invalid Column Name <code>memID</code> error.</p>
<p>How can I fix this?</p>
| [
{
"answer_id": 114280,
"author": "Chris Shaffer",
"author_id": 6744,
"author_profile": "https://Stackoverflow.com/users/6744",
"pm_score": 3,
"selected": false,
"text": "\nSELECT *\nFROM memDetTab\n JOIN (SELECT CONVERT(int, SUBSTRING(accountingTab.id, PATINDEX('%[0-9]%', accountingTa... | 2008/09/22 | [
"https://Stackoverflow.com/questions/114242",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1841427/"
] |
114,260 | <p>I've created an <code>IHttpHandler</code> in .NET C# which returns pieces of html to a classic asp page.</p>
<p>The classic asp page communicates with the <code>IHttpHandler</code> through basic http requests using <code>ServerXMLHTTP</code> in vbscript or Ajax Calls in JavaScript.</p>
<p>Now, I need a way to share a variable which I have in vbscript but not in javascript with the .NET application.</p>
<p>The first bit, sharing a variable between classic asp and .net is not a problem as I can just add it onto the http request. Because the variable is not available in javascript however I can't do this in that case.</p>
<p>I had the idea that I could maybe cache the variable in the .NET application and use the cached version for javascript calls. But for this to work I would need a way to uniquely identify the "client" in .NET...</p>
<p>I tried to add <code>System.Web.SessionState.IRequiresSessionState</code> to my HttpHandler and use the SessionId but this didn't work because every single call to the HttpHandler seems to get a new ID.</p>
<p>Am I thinking the right way? What are my options here?</p>
| [
{
"answer_id": 156597,
"author": "Ben",
"author_id": 5005,
"author_profile": "https://Stackoverflow.com/users/5005",
"pm_score": 0,
"selected": false,
"text": "<meta>"
}
] | 2008/09/22 | [
"https://Stackoverflow.com/questions/114260",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5005/"
] |
114,283 | <p>I want to emulate the delete confirmation page behavior before saving
certain models in the admin. In my case if I change one object,
certain others should be deleted as they depend upon the object's now
out-of-date state. </p>
<p>I understand where to implement the actual cascaded updates (inside
the parent model's save method), but I don't see a quick way to ask
the user for confirmation (and then rollback if they decide not to
save). I suppose I could implement some weird confirmation logic
directly inside the save method (sort of a two phase save) but that
seems...ugly. </p>
<p>Any thoughts, even general pointers into the django codebase? </p>
<p>Thanks!</p>
| [
{
"answer_id": 114348,
"author": "Tomo",
"author_id": 9622,
"author_profile": "https://Stackoverflow.com/users/9622",
"pm_score": 1,
"selected": false,
"text": "django.contrib.admin.options.ModelAdmin"
},
{
"answer_id": 114373,
"author": "Armin Ronacher",
"author_id": 199... | 2008/09/22 | [
"https://Stackoverflow.com/questions/114283",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5357/"
] |
114,284 | <p>First of all, this question regards MySQL 3.23.58, so be advised.</p>
<p>I have 2 tables with the following definition:</p>
<pre><code>Table A: id INT (primary), customer_id INT, offlineid INT
Table B: id INT (primary), name VARCHAR(255)
</code></pre>
<p>Now, table A contains in the range of 65k+ records, while table B contains ~40 records. In addition to the 2 primary key indexes, there is also an index on the <em>offlineid</em> field in table A. There are more fields in each table, but they are not relevant (as I see it, ask if necessary) for this query.</p>
<p>I was first presented with the following query (<em>query time: ~22 seconds</em>):</p>
<pre><code>SELECT b.name, COUNT(*) AS orders, COUNT(DISTINCT(a.kundeid)) AS leads
FROM katalogbestilling_katalog a, medie b
WHERE a.offlineid = b.id
GROUP BY b.name
</code></pre>
<p>Now, each id in medie is associated with a different name, meaning you could group by id as well as name. A bit of testing back and forth settled me on this (<em>query time: ~6 seconds</em>):</p>
<pre><code>SELECT a.name, COUNT(*) AS orders, COUNT(DISTINCT(b.kundeid)) AS leads
FROM medie a
INNER JOIN katalogbestilling_katalog b ON a.id = b.offline
GROUP BY b.offline;
</code></pre>
<p>Is there any way to crank it down to "instant" time (max 1 second at worst)? I added the index on offlineid, but besides that and the re-arrangement of the query, I am at a loss for what to do. The EXPLAIN query shows me the query is using fileshort (the original query also used temp tables). All suggestions are welcome!</p>
| [
{
"answer_id": 114350,
"author": "tpk",
"author_id": 8437,
"author_profile": "https://Stackoverflow.com/users/8437",
"pm_score": 0,
"selected": false,
"text": "SELECT b.name, COUNT(*) AS orders, COUNT(DISTINCT(a.kundeid)) AS leads\nFROM katalogbestilling_katalog a, medie b\nWHERE a.offli... | 2008/09/22 | [
"https://Stackoverflow.com/questions/114284",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9479/"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.