qid int64 4 22.2M | question stringlengths 18 48.3k | answers list | date stringlengths 10 10 | metadata list |
|---|---|---|---|---|
280,449 | <p>I have a page on which I must load controls dynamically based on the user selection.
Let's say that I have something like this:</p>
<pre><code>public static readonly Dictionary<string, string> DynamicControls = new Dictionary<string, string>
{
{ "UserCtrl1", "~/Controls/UserCtrl1.ascx" },
{ "UserCtrl2", "~/Controls/UserCtrl2.ascx" },
{ "UserCtrl3", "~/Controls/UserCtrl3.ascx" },
{ "UserCtrl4", "~/Controls/UserCtrl4.ascx"}
};
</code></pre>
<p>Now let's say than on the page where the controls are loaded the code is something like this:</p>
<pre><code>protected void Page_Load(object sender, EventArgs e)
{
SomePanel.Controls.Add(GetControl());
}
private Control GetControl()
{
string dynamicCtrl = CurrentItem.DynamicControl;
string path = SomeClass.DynamicControls[dynamicCtrl];
Control ctrl = null;
//TODO: find a better way to load the controls
switch (dynamicCtrl)
{
case "UserCtrl1":
{
ctrl = (UserCtrl1)LoadControl(path);
}
break;
case "UserCtrl2":
{
ctrl = (UserCtrl2)LoadControl(path);
}
break;
case "UserCtrl3":
{
ctrl = (UserCtrl3)LoadControl(path);
}
break;
default:
{
throw new ApplicationException("Invalid dynamic control added.");
}
}
return ctrl;
}
</code></pre>
<p>The page has the required registered statements. Any idea how I can get rid of this ugly switch statement?</p>
| [
{
"answer_id": 280470,
"author": "Magnus",
"author_id": 4184,
"author_profile": "https://Stackoverflow.com/users/4184",
"pm_score": 4,
"selected": true,
"text": "private Control GetControl()\n{\n string dynamicCtrl = CurrentItem.DynamicControl;\n string path = SomeClass.DynamicCont... | 2008/11/11 | [
"https://Stackoverflow.com/questions/280449",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2099426/"
] |
280,457 | <p>I have a game in which you can score from -40 to +40 on each match.
Users are allowed to play any number of matches.
I want to calculate a total score that implicitly takes into account the number of matches played.</p>
<p>Calculating only the average is not fair.
For example, if Peter plays four games and gets 40 points on each match, he will have the same total
score as Janne who played only one match with 40 points.</p>
<p>Adding up the match scores isn't fair either.
Peter plays 2 games (40 points on each match), total score 80.
Janne plays 8 games (10 points on each match), total score 80.</p>
<p>Is there a (simple) and fair way to calculate the total score?
I have read about the Elo & Glicko system for chess ratings, but both are based upon
a players rating history and the opponents rating. </p>
| [
{
"answer_id": 281407,
"author": "dreeves",
"author_id": 4234,
"author_profile": "https://Stackoverflow.com/users/4234",
"pm_score": 2,
"selected": false,
"text": "SE = sqrt((ss - s^2/n) / (n-1) / n)\n"
}
] | 2008/11/11 | [
"https://Stackoverflow.com/questions/280457",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
280,472 | <p>I need to make some changes to a ClickOnce application that I haven't touched for over a year and therefore the certificate has expired.</p>
<p>I've read that publishing with a new certificate will make the application fail, because it will be signed with a different key.</p>
<p>Therefore I think I need to use the same certificate but not sure how to renew it.</p>
| [
{
"answer_id": 54120387,
"author": "Sogger",
"author_id": 579234,
"author_profile": "https://Stackoverflow.com/users/579234",
"pm_score": 3,
"selected": false,
"text": " [DllImport(\"crypt32.dll\", CharSet = CharSet.Auto)]\n- internal static extern int CertNameToStr(X509Encoding d... | 2008/11/11 | [
"https://Stackoverflow.com/questions/280472",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11989/"
] |
280,485 | <p>We have a DLL which is produced in house, and for which we have the associated static LIB of stubs.</p>
<p>We also have an EXE which uses this DLL using the simple method of statically linking to the DLL's LIB file (ie, not manually using LoadLibrary).</p>
<p>When we deploy the EXE we'd like the DLL file name to be changed for obfuscation reasons (at customer's request).</p>
<p><strong>How can we do this so that our EXE still finds the DLL automagically?</strong></p>
<p>I have tried renaming the DLL and LIB files (after they were built to their normal name), then changing the EXE project settings to link with the renamed LIB. This fails at runtime, as I guess the name of the DLL is baked into the LIB file, and not simply guessed at by the linker replacing ".lib" with ".dll".</p>
<p>In general, we do not want to apply this obfuscation to all uses of the DLL, so we'd like to keep the current DLL project output files are they are.</p>
<p>I'm hoping that there will be a method whereby we can edit the DLL's LIB file, and replace the hardcoded name of the DLL file with something else. In which case this could be done entirely within the EXE project (perhaps as a pre-build step).</p>
<hr>
<p><strong>Update</strong>: I find that Delay Loading does not work, as my DLL contains exported C++ classes.
See <a href="http://www.tech-archive.net/Archive/VC/microsoft.public.vc.language/2004-09/0377.html" rel="noreferrer">this article</a>.</p>
<p>Are there any alternatives?</p>
| [
{
"answer_id": 280567,
"author": "wimh",
"author_id": 33499,
"author_profile": "https://Stackoverflow.com/users/33499",
"pm_score": 4,
"selected": false,
"text": "dumpbin /exports ws2_32.dll"
},
{
"answer_id": 281011,
"author": "QAZ",
"author_id": 14260,
"author_profi... | 2008/11/11 | [
"https://Stackoverflow.com/questions/280485",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/755/"
] |
280,488 | <p>I'm looking to convert the following <code>mod_rewrite</code> rule to the <a href="http://wiki.codemongers.com/NginxHttpRewriteModule" rel="noreferrer">Nginx equivalent</a>:</p>
<pre><code>RewriteRule ^foo/(.*)$ /bar/index.php?title=$1 [PT,L,QSA]
RewriteRule ^foo/*$ /bar/index.php [L,QSA]
</code></pre>
<p>So far I have:</p>
<pre><code>rewrite ^foo/(.*)$ /bar/index.php?title=$1&$query_string last;
rewrite ^foo/?$ /bar/index.php?$query_string break;
</code></pre>
<p>The problem is (I think!) that the query string doesn't get appended. I haven't found a way to port the <code>QSA</code> argument to Nginx.</p>
| [
{
"answer_id": 282437,
"author": "jumoel",
"author_id": 1555170,
"author_profile": "https://Stackoverflow.com/users/1555170",
"pm_score": 4,
"selected": true,
"text": "rewrite ^/foo/([^?]*)(?:\\?(.*))? /bar/index.php?title=$1&$2;\nrewrite ^/foo /bar/index.php;\n"
}
] | 2008/11/11 | [
"https://Stackoverflow.com/questions/280488",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1555170/"
] |
280,494 | <p>I have a group by clause in a sql statement and need to use an aggregate function to minus all the values in each group instead of adding like the Sum() function.</p>
<p>i.e. </p>
<pre><code>SELECT Sum(A)
FROM (
SELECT 2 AS A
UNION
SELECT 1) AS t1
</code></pre>
<p>..so will evaluate 2+1 and return 3.</p>
<p>I need some way of doing 2-1 to return 1.</p>
<p>Hope this makes sense. Only way I can think of doing this would be to use CLR integration to make my own aggregate function.</p>
<p>Any other ideas?</p>
| [
{
"answer_id": 280496,
"author": "Unsliced",
"author_id": 2902,
"author_profile": "https://Stackoverflow.com/users/2902",
"pm_score": 2,
"selected": false,
"text": "SUM()"
},
{
"answer_id": 280503,
"author": "FlySwat",
"author_id": 1965,
"author_profile": "https://Sta... | 2008/11/11 | [
"https://Stackoverflow.com/questions/280494",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11989/"
] |
280,495 | <p>When browsing ASP.NET MVC source code in <a href="http://www.codeplex.com/aspnet/SourceControl/FileView.aspx?itemId=266503&changeSetId=17272" rel="noreferrer">codeplex</a>, I found it is common to have a class explicitly implementing interface. The explicitly implemented method/property then invoke another "protected virtual" method/property with same name.</p>
<p>For example, </p>
<pre><code>public class MvcHandler : IHttpHandler, IRequiresSessionState
{
protected virtual bool IsReusable
{
get
{
return false;
}
}
bool IHttpHandler.IsReusable
{
get
{
return IsReusable;
}
}
}
</code></pre>
<p>I'm now sure what's the benefit of this kind of programming. For me, I prefer to just implicitly implement the interface IHttpHandler.</p>
<p>I guess the author just don't want <strong>MvcHandler</strong> has a public property <strong>IsResuable</strong>. The property <strong>IsReusable</strong> can only be used when instance of <strong>MvcHandler</strong> is treated as a <strong>IHttpHandler</strong>. Still, I'm not sure why the author what this way.</p>
<p>Anybody know more benefits about this style of interface implementation?</p>
| [
{
"answer_id": 280505,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 5,
"selected": true,
"text": "ICloneable"
},
{
"answer_id": 12096386,
"author": "Mohammad Nikravan",
"author_id": 252229,
"autho... | 2008/11/11 | [
"https://Stackoverflow.com/questions/280495",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26349/"
] |
280,497 | <p>I am having a peculiar problem with the order in which FlowLayoutPanels are added in to the form's <strong>controls</strong> property. This is what I tried,</p>
<p>I added 7 FlowLayoutPanels in to a C# window application from left to right in vertical strips. Then I tagged the flow layouts as 1, 2, 3, ... 7 again from left to right. Now in the load handler of the form, I wrote the following snippet,</p>
<pre><code> foreach (FlowLayoutPanel aDaysControl in this.Controls)
{
MessageBox.Show(aDaysControl.Tag.ToString());
}
</code></pre>
<p>I expected messages to appear in the order of <strong>1, 2, ... 7</strong>. But I got it in the reverse order (7, 6, ...1). Could some one help me out with the mistake I did ??</p>
<p>Reason behind preserving the order,</p>
<blockquote>
<p>I am trying to make a calendar control
with each row representing a day. If a
month starts from Wednesday, then I
need to add a empty label to the
first(Monday) and the second(Tuesday)
row. So the order matters a bit</p>
</blockquote>
| [
{
"answer_id": 280517,
"author": "Steve Morgan",
"author_id": 5806,
"author_profile": "https://Stackoverflow.com/users/5806",
"pm_score": 0,
"selected": false,
"text": "FlowLayoutPanel[] panels = new FlowLayoutPanel[7];\n\nforeach(FlowLayoutPanel panel in this.Controls)\n{\n panels[(i... | 2008/11/11 | [
"https://Stackoverflow.com/questions/280497",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
280,515 | <p>I need to implement a queue using table.
The business requirement is to have a single queue which will be accessed by 5-10 boxes to get the next job/jobs. There will not be more than 5000 jobs per day. Also, a batch of jobs should be "dequeued" at one time.</p>
<p>Just wondering what are the problem areas and issues I might run into as I havent done it before. If anyone has faced this/done this before, can you please point me to a design/sample implementation or issues that need to be taken care of.</p>
<p>Thanks</p>
| [
{
"answer_id": 280738,
"author": "Vegard Larsen",
"author_id": 1606,
"author_profile": "https://Stackoverflow.com/users/1606",
"pm_score": 2,
"selected": false,
"text": "UPDATE tblQueue SET mark = <unique application id> WHERE mark IS NULL ORDER BY timestamp ASC LIMIT 1\nSELECT * FROM tb... | 2008/11/11 | [
"https://Stackoverflow.com/questions/280515",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36494/"
] |
280,539 | <p>As far as I understand, if I want to get my database under source control then I need to be checking in change scripts for each change and then running them from some revision to get the correct DB.</p>
<p>I am trying to make a batch file that will be checked in too, that allows other developers on the team to re-build the DB locally without too much trouble. I believe sqlcmd is the way to achieve this. I have it setup to enumerate all files in the dir of .sql files and run sqlcmd for each.</p>
<p>My question is who has done this before and do you have an advice on the best way to achieve this? Is the way I intend to do this the best way or is there a better way?</p>
<p>Hope that's not too vague.</p>
<p>Thanks in advance,</p>
<p>Martin.</p>
| [
{
"answer_id": 280547,
"author": "kristof",
"author_id": 3241,
"author_profile": "https://Stackoverflow.com/users/3241",
"pm_score": 0,
"selected": false,
"text": ":: Parameters Required:\n:: %1 UserID\n:: %2 Password\n:: %3 Server\n:: %4 Database\n:: %5 file with scripted object\n::\nec... | 2008/11/11 | [
"https://Stackoverflow.com/questions/280539",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
280,542 | <p>I'm regularly creating an XSD schema by transforming a proprietary data model of a legacy system. This works out pretty good. However, the legacy system only allows me to specify very basic attributes of a parameter, such as the data type (<code>int</code>, <code>string</code> etc.).</p>
<p>I would like to enhance the XSL transformation with a mechanism that allows me to add meta data in order to provide more details for the transformation. I thought of something like the Java properties notation to assign attributes to an XPath. </p>
<p>Imagine the following example:</p>
<p><strong>legacy system data model</strong> (actually that neat, but best suited for demonstration purposes)</p>
<pre><code><datamodel>
<customer>
<firstName type="string"/>
<lastName type="string"/>
<age type="int">
<customer>
</datamodel>
</code></pre>
<p><strong>meta data</strong></p>
<pre><code>customer/firstName/@nillable=false
customer/lastName/@nillable=false
customer/age/@nillable=true
customer/firstName/@minOccurs=1
customer/firstName/@maxOccurs=1
customer/lastName/@minOccurs=1
customer/lastName/@maxOccurs=1
</code></pre>
<p><strong>resulting XSD schema</strong></p>
<pre><code>...
<xs:complexType name="customerType">
<xs:sequence>
<xs:element name="firstName" type="xs:string" nillable="false" minOccurs="1" maxOccurs="1"/>
<xs:element name="lastName" type="xs:string" nillable="false" minOccurs="1" maxOccurs="1"/>
<xs:element name="age" type="xs:int" nillable="true"/>
</xs:sequence>
</xs:complexType>
...
</code></pre>
<p>What do you think of that? Is there a way to include meta data into an XSL stylesheet?</p>
| [
{
"answer_id": 286272,
"author": "Dimitre Novatchev",
"author_id": 36305,
"author_profile": "https://Stackoverflow.com/users/36305",
"pm_score": 3,
"selected": true,
"text": "<datamodel xmlns:nm=\"my:new.meta\">\n <customer>\n <firstName type=\"string\"\n nm:n... | 2008/11/11 | [
"https://Stackoverflow.com/questions/280542",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25842/"
] |
280,551 | <p>I try get the <a href="http://flash-mp3-player.net/players/js/" rel="nofollow noreferrer">mp3 flash player</a> to work with my javascript on all browsers. All went well for first, but fast realized that my code doesn't work on MSIE.</p>
<p>After trying to find out I found this in the reference code:</p>
<pre><code><!--[if IE]>
<script type="text/javascript" event="FSCommand(command,args)" for="myFlash">
eval(args);
</script>
<![endif]-->
</code></pre>
<p>How to turn this into a javascript or jquery clause that I could stuff it where it belongs to (in audio.js)?</p>
| [
{
"answer_id": 4434557,
"author": "Troels",
"author_id": 541245,
"author_profile": "https://Stackoverflow.com/users/541245",
"pm_score": 1,
"selected": false,
"text": "<script type=\"text/javascript\" event=\"FSCommand(command,args)\" for=\"myFlash\">\n eval(args);\n</script>\n"
},
... | 2008/11/11 | [
"https://Stackoverflow.com/questions/280551",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21711/"
] |
280,559 | <p>This is probably easy but I am getting stuck: when I build a solution in Visual Studio - how do extract the exact cmd line for the current build command in order to be able to do the same build from VisualStudio console? </p>
<p>In the output window I can see the single projects in the solution build commands but not the one for the whole solution.</p>
<p>I am on VS2005.</p>
<p>Any help would be appreciated</p>
| [
{
"answer_id": 280584,
"author": "kenny",
"author_id": 3225,
"author_profile": "https://Stackoverflow.com/users/3225",
"pm_score": 5,
"selected": true,
"text": "%comspec% /k \"\"C:\\Program Files\\Microsoft Visual Studio 8\\VC\\vcvarsall.bat\"\"x86\"\n"
},
{
"answer_id": 281356,
... | 2008/11/11 | [
"https://Stackoverflow.com/questions/280559",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1311500/"
] |
280,563 | <p>Has anybody got any real world stories build mobile web sites with NetBiscuits?</p>
<p>Someone told me it was the next big thing in mobile development (<a href="http://www.netbiscuits.com/home" rel="nofollow noreferrer">http://www.netbiscuits.com/home</a>) and it looks pretty good from their site. Just wondered if anybody (besides them) has actually used it.</p>
| [
{
"answer_id": 280584,
"author": "kenny",
"author_id": 3225,
"author_profile": "https://Stackoverflow.com/users/3225",
"pm_score": 5,
"selected": true,
"text": "%comspec% /k \"\"C:\\Program Files\\Microsoft Visual Studio 8\\VC\\vcvarsall.bat\"\"x86\"\n"
},
{
"answer_id": 281356,
... | 2008/11/11 | [
"https://Stackoverflow.com/questions/280563",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36503/"
] |
280,566 | <p>Is there any clever method out there to make my executeEveryDayMethod() execute once a day, without having to involve the Windows TaskScheduler?</p>
| [
{
"answer_id": 280592,
"author": "Vinko Vrsalovic",
"author_id": 5190,
"author_profile": "https://Stackoverflow.com/users/5190",
"pm_score": 2,
"selected": false,
"text": "using System;\nusing System.Timers;\n\npublic class Timer1\n{\n private static Timer aTimer = new System.Timers.T... | 2008/11/11 | [
"https://Stackoverflow.com/questions/280566",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36504/"
] |
280,571 | <p>I am confused about how popen() redirects stdin, stdout and stderr of the child process in unix. The man page on popen() is not very clear in this regard. The call</p>
<pre><code>FILE *p = popen("/usr/bin/foo", "w");
</code></pre>
<p>forks a child process and executes a shell with arguments "-c", "/usr/bin/foo", and redirects stdin of this shell (which is redirected stdin of foo), stdout to p. But what happens with stderr? What is the general principle behind it?</p>
<p>I noticed that, if I open a file in foo (using fopen, socket, accept etc.), and the parent process has no stdout, it gets assigned the next available file number, which is 1 and so on. This delivers unexpected results from calls like fprintf(stderr, ...).</p>
<p>It can be avoided by writing</p>
<pre><code>FILE *p = popen("/usr/bin/foo 2>/dev/null", "w");
</code></pre>
<p>in the parent program, but are their better ways?</p>
| [
{
"answer_id": 280587,
"author": "Johannes Schaub - litb",
"author_id": 34509,
"author_profile": "https://Stackoverflow.com/users/34509",
"pm_score": 3,
"selected": false,
"text": "FILE * file = popen(\"/bin/cat\", \"w\");\nfwrite(\"hello\", 5, file);\npclose(file);\n"
},
{
"answ... | 2008/11/11 | [
"https://Stackoverflow.com/questions/280571",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31330/"
] |
280,578 | <p>I have got some code to load an assembly and get all types, which implement a certain interface, like this (assume asm is a valid and loaded assembly).</p>
<pre><code>var results = from type in asm.GetTypes()
where typeof(IServiceJob).IsAssignableFrom(type)
select type;
</code></pre>
<p>Now I'm stuck: I need to create instances of these objects and invoke methods and properties on the object. And I need to store the references to the created objects in an array for later usage.</p>
| [
{
"answer_id": 280591,
"author": "Matt Hamilton",
"author_id": 615,
"author_profile": "https://Stackoverflow.com/users/615",
"pm_score": 5,
"selected": true,
"text": "private static IEnumerable<T> InstancesOf<T>() where T : class\n{\n var type = typeof(T);\n return from t in type.A... | 2008/11/11 | [
"https://Stackoverflow.com/questions/280578",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16440/"
] |
280,579 | <p>How do I pass a value from a child back to the parent form? I have a string that I would like to pass back to the parent.</p>
<p>I launched the child using:</p>
<pre><code>FormOptions formOptions = new FormOptions();
formOptions.ShowDialog();
</code></pre>
| [
{
"answer_id": 280586,
"author": "Mitch Wheat",
"author_id": 16076,
"author_profile": "https://Stackoverflow.com/users/16076",
"pm_score": 6,
"selected": false,
"text": "FormOptions"
},
{
"answer_id": 280630,
"author": "stiduck",
"author_id": 35398,
"author_profile": ... | 2008/11/11 | [
"https://Stackoverflow.com/questions/280579",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
280,597 | <p>We have a problem affecting the production environment only.</p>
<p>We have a VB6/ASP website that allows for data in a database table to be hand edited.</p>
<p>It looks alot like an editable datagrid.</p>
<p>One of the editable columns is a date and when the record is saved dates day/month are being reversed.</p>
<p>03/11/2008 becomes 11/03/2008, if you were to resave the record the date is again 03/11/2008. </p>
<p>I have checked the DB value and it is indeed being reversed however the same identical code on the test systems does not do this.</p>
<p>So i'm very confident i'm looking for an environment change. The test system has the DB and Site hosted locally and in the live setup we have a separate web site server and database server. Where do you suggest I start looking for this problem. I've checked the regional settings on the servers and they are set to United Kingdom and the OS date format is correct.</p>
<p>This is SQL Server 2000. hit me with some ideas!. </p>
<p>Thanks :)</p>
| [
{
"answer_id": 280633,
"author": "Tomalak",
"author_id": 18771,
"author_profile": "https://Stackoverflow.com/users/18771",
"pm_score": 2,
"selected": true,
"text": "SET DATEFORMAT"
}
] | 2008/11/11 | [
"https://Stackoverflow.com/questions/280597",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27412/"
] |
280,624 | <p>I'm writing an image processing program to perform real time processing of video frames. It's in C# using the Emgu.CV library (C#) that wraps the OpenCV library dll (unmanaged C++). Now I have to write my own special algorithm and it needs to be as fast as possible. </p>
<p>Which will be a faster implementation of the algorithm?</p>
<ol>
<li><p>Writing an 'unsafe' function in C#</p></li>
<li><p>Adding the function to the OpenCV library and calling it through Emgu.CV</p></li>
</ol>
<p>I'm guessing C# unsafe is slower because it goes throught the JIT compiler, but would the difference be significant?</p>
<p>Edit:</p>
<p>Compiled for .NET 3.5 under VS2008</p>
| [
{
"answer_id": 319726,
"author": "Tom Barta",
"author_id": 29839,
"author_profile": "https://Stackoverflow.com/users/29839",
"pm_score": 2,
"selected": false,
"text": "malloc()"
}
] | 2008/11/11 | [
"https://Stackoverflow.com/questions/280624",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31045/"
] |
280,634 | <p>How can I check if a string ends with a particular character in JavaScript?</p>
<p>Example: I have a string </p>
<pre><code>var str = "mystring#";
</code></pre>
<p>I want to know if that string is ending with <code>#</code>. How can I check it?</p>
<ol>
<li><p>Is there a <code>endsWith()</code> method in JavaScript?</p></li>
<li><p>One solution I have is take the length of the string and get the last character and check it.</p></li>
</ol>
<p>Is this the best way or there is any other way?</p>
| [
{
"answer_id": 280644,
"author": "Phillip B Oldham",
"author_id": 30478,
"author_profile": "https://Stackoverflow.com/users/30478",
"pm_score": 7,
"selected": false,
"text": "if( \"mystring#\".substr(-1) === \"#\" ) {}"
},
{
"answer_id": 280651,
"author": "duckyflip",
"au... | 2008/11/11 | [
"https://Stackoverflow.com/questions/280634",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15177/"
] |
280,658 | <p>I'm currently running into some issues resizing images using GD.</p>
<p>Everything works fine until i want to resize an animated gif, which delivers the first frame on a black background.</p>
<p>I've tried using <code>getimagesize</code> but that only gives me dimensions and nothing to distinguish between just any gif and an animated one.</p>
<p>Actual resizing is not required for animated gifs, just being able to skip them would be enough for our purposes.</p>
<p>Any clues?</p>
<p>PS. I don't have access to imagemagick.</p>
<p>Kind regards,</p>
<p>Kris</p>
| [
{
"answer_id": 280705,
"author": "Davide Gualano",
"author_id": 28582,
"author_profile": "https://Stackoverflow.com/users/28582",
"pm_score": 5,
"selected": true,
"text": "imagecreatefromgif()"
},
{
"answer_id": 280743,
"author": "Kris",
"author_id": 18565,
"author_pr... | 2008/11/11 | [
"https://Stackoverflow.com/questions/280658",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18565/"
] |
280,672 | <p>I have let's say two pc's.PC-a and PC-b which both have the same application installed with java db support.I want from time to time to copy the data from the database on PC-a to database to PC-b and vice-versa so the two PC's to have the same data all the time.
Is there an already implemented API in the database layer for this(i.e 1.export-backup database from PC-a 2.import-merge databases to PC-b) or i have to do this in the sql layer(manually)?</p>
| [
{
"answer_id": 1235367,
"author": "Chris K",
"author_id": 51789,
"author_profile": "https://Stackoverflow.com/users/51789",
"pm_score": 2,
"selected": true,
"text": "Customer: \n SiteCode varchar,\n CustomerID varchar, \n .... \n primary key(siteCode, CustomerID) \n"
}
] | 2008/11/11 | [
"https://Stackoverflow.com/questions/280672",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36525/"
] |
280,680 | <pre><code>$images = array();
$images[0][0] = "boxes/blue.jpg";
$images[0][1] = "blah.html";
$images[1][0] = "boxes/green.jpg";
$images[1][1] = "blah.html";
$images[2][0] = "boxes/orange.jpg";
$images[2][1] = "blah.html";
$images[3][0] = "boxes/pink.jpg";
$images[3][1] = "blah.html";
$images[4][0] = "boxes/purple.jpg";
$images[4][1] = "blah.html";
$images[5][0] = "boxes/red.jpg";
$images[5][1] = "blah.html";
$images[6][0] = "boxes/yellow.jpg";
$images[6][1] = "blah.html";
$i = 0;
*echo "<a href='" . $images[0][1] . "'><img src='" . $images[0][0] . "' /></a>";
$boxes = array();
while($i<5)
{
$rand = rand(0,(sizeof($images)-1));
//echo $rand;
$slice = array_splice($images, $rand);
$boxes[$i] = $slice;
$i++;
}*
</code></pre>
<p>I am trying to get a random image picker to choose from a list of images provided by the $images array. However, I am unable to fill the $boxes array with anything other than "Array". Can anyone tell me why? Any help is much appreciated</p>
<p>UPDATE</p>
<p>I am now using the code below and it breaks whenever it comes across an empty element. Unless i am very much mistaken, shouldn't splice patch up holes like that?</p>
<pre><code>$rand = rand(0,(sizeof($images)));
array_splice($images, $rand);
$i = 0;
while($i<5)
{
echo "<a href='" . $images[$i][1] . "'><img src='" . $images[$i][0] . "' /></a>";
$i++;
}
</code></pre>
| [
{
"answer_id": 280686,
"author": "Davide Gualano",
"author_id": 28582,
"author_profile": "https://Stackoverflow.com/users/28582",
"pm_score": 0,
"selected": false,
"text": "while($i<5)\n{\n $rand = rand(0,(sizeof($images)-1));\n $boxes[$i] = $images[$rand];\n $i++;\n... | 2008/11/11 | [
"https://Stackoverflow.com/questions/280680",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31677/"
] |
280,684 | <p>Do web browsers send the file size in the http header when uploading a file to the server? And if that is the case, then, is it possible to refuse the file just by reading the header and not wait for the whole upload process to finish?</p>
| [
{
"answer_id": 280750,
"author": "vincent",
"author_id": 34871,
"author_profile": "https://Stackoverflow.com/users/34871",
"pm_score": 2,
"selected": false,
"text": "enctype=\"multipart/form-data\""
}
] | 2008/11/11 | [
"https://Stackoverflow.com/questions/280684",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36529/"
] |
280,687 | <p>I am trying to change the rows output by PHP in a table to links. I have added the a href tags to the example below, however it results in an unexpected <code>T_VARIABLE</code>. I have tried it without the extra quotes, but this displays a blank table. I am not sure what the flaw in the logic is.</p>
<pre><code>while($row = mysql_fetch_row($result))
{
echo "<tr>";
// $row is array... foreach( .. ) puts every element
// of $row to $cell variable
foreach($row as $cell)
echo "<td><a href="$cell"</a></td>";
echo "</tr>\n";
}
</code></pre>
| [
{
"answer_id": 280750,
"author": "vincent",
"author_id": 34871,
"author_profile": "https://Stackoverflow.com/users/34871",
"pm_score": 2,
"selected": false,
"text": "enctype=\"multipart/form-data\""
}
] | 2008/11/11 | [
"https://Stackoverflow.com/questions/280687",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1246613/"
] |
280,690 | <p>I'm developing an application that is so far using HttpListener to provide a small standalone http server. However, I've recently discovered that HttpListener needs to be run as Administrator, which is not always going to be possible.</p>
<p>What would the best alternative be? I need http GET and POST, both of which are not simply reading/writing files on the filesystem, they need to run custom .Net code.</p>
<p>My research so far has brought up Cassini, but as far as I can tell, I would have to write a custom version. Is there anything else? In partiular something with the same interface as HttpListener, but that does not require Administrator privileges would be amazing!</p>
| [
{
"answer_id": 9666157,
"author": "ctrlplusb",
"author_id": 350933,
"author_profile": "https://Stackoverflow.com/users/350933",
"pm_score": 2,
"selected": false,
"text": "netsh http add urlacl url=http://+:8346/ user=\"NTAuthority\\Authenticated Users\" sddl=\"D:(A;;GX;;;AU)\"\n"
},
... | 2008/11/11 | [
"https://Stackoverflow.com/questions/280690",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6448/"
] |
280,692 | <p>I am creating a form within InfoPath which is to be integrated into a SharePoint 2007 Portal. Within this form there will be a textfield into which a user can enter the Name of a Person. </p>
<p>How can I validate whether this Person exists or not?</p>
<p>Instead of validating the user, is there a way to fill a dropdown List with <em>all</em> usernames of the portal? (which of cause would be users from the Active Directory)</p>
| [
{
"answer_id": 415000,
"author": "oillio",
"author_id": 4354,
"author_profile": "https://Stackoverflow.com/users/4354",
"pm_score": 0,
"selected": false,
"text": "string ADName = System.Environment.UserName;\n IXMLDOMDocument3 UserQuery = (IXMLDOMDocument3)thisXDocument.GetDOM(\"G... | 2008/11/11 | [
"https://Stackoverflow.com/questions/280692",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25428/"
] |
280,706 | <p>I've been thinking of ways of providing syntactic sugar for a framework I have been working on. I want to deal with Immitable objects exclusively.</p>
<h3>Say I have an immutable object and wish to create a modified version of it. Would, in your view, a non-instantiable class with a single static factory method break OO principles ?</h3>
<br>
<blockquote>
<p>As an example using a String:</p>
<pre><code>public final class LOWERCASE {
private LOWERCASE() {}
public static String string( final String STRING ) {
return STRING.toLowerCase();
}
}
</code></pre>
<p>Therefore from this example I could write:</p>
<pre><code>String lowercaseString = LOWERCASE.string( targetString );
</code></pre>
<p>Which I find very readable.</p>
</blockquote>
<br>
<h3>Any provisos against such an approach?</h3>
| [
{
"answer_id": 280752,
"author": "bruno conde",
"author_id": 31136,
"author_profile": "https://Stackoverflow.com/users/31136",
"pm_score": 1,
"selected": false,
"text": "public final class Lowercase {\n\n private Lowercase() {}\n\n public static String string( final String string ) {\n... | 2008/11/11 | [
"https://Stackoverflow.com/questions/280706",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4857/"
] |
280,712 | <p>There should be something akin to <code>\w</code> that can match any code-point in Letters or Marks category (not just the ASCII ones), and hopefully have filters like [[P*]] for punctuation, etc.</p>
| [
{
"answer_id": 280762,
"author": "Tomalak",
"author_id": 18771,
"author_profile": "https://Stackoverflow.com/users/18771",
"pm_score": 8,
"selected": false,
"text": "u"
},
{
"answer_id": 8933546,
"author": "mgibsonbr",
"author_id": 520779,
"author_profile": "https://S... | 2008/11/11 | [
"https://Stackoverflow.com/questions/280712",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
280,713 | <p>Does the "for…in" loop in Javascript loop through the hashtables/elements in the order they are declared? Is there a browser which doesn't do it in order?<br>
The object I wish to use will be declared <em>once</em> and will never be modified.</p>
<p>Suppose I have:</p>
<pre><code>var myObject = { A: "Hello", B: "World" };
</code></pre>
<p>And I further use them in:</p>
<pre><code>for (var item in myObject) alert(item + " : " + myObject[item]);
</code></pre>
<p>Can I expect 'A : "Hello"' to always come before 'B : "World"' in most decent browsers?</p>
| [
{
"answer_id": 280734,
"author": "Tomalak",
"author_id": 18771,
"author_profile": "https://Stackoverflow.com/users/18771",
"pm_score": 5,
"selected": false,
"text": "for .. in"
},
{
"answer_id": 280861,
"author": "Borgar",
"author_id": 27388,
"author_profile": "https:... | 2008/11/11 | [
"https://Stackoverflow.com/questions/280713",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3055/"
] |
280,729 | <p>I am trying to use the following code to write data into an excel file</p>
<pre><code> Dim objexcel As Excel.Application
Dim wbexcel As Excel.Workbook
Dim wbExists As Boolean
Set objexcel = CreateObject("excel.Application")
objexcel.Visible = True
On Error GoTo Openwb
wbExists = False
Set wbexcel = objexcel.Documents.Open("C:\Documents and Settings\TAYYAPP\Desktop\test folder\ERROR REPORT2.xls")
wbExists = True
Openwb:
On Error GoTo 0
If Not wbExists Then
Set wbexcel = objexcel.Workbook.Add
End If
</code></pre>
<p>but I'm getting an </p>
<blockquote>
<p>runtime error object doesn't support property or method</p>
</blockquote>
<p>in the line</p>
<pre><code>Set wbexcel = objexcel.Workbook.Add
</code></pre>
<p>I have referenced the Excel object library.</p>
| [
{
"answer_id": 280758,
"author": "Fionnuala",
"author_id": 2548,
"author_profile": "https://Stackoverflow.com/users/2548",
"pm_score": 4,
"selected": true,
"text": " Set wbexcel = objexcel.WorkBooks.Open( _\n \"C:\\Documents and Settings\\TAYYAPP\\Desktop\\test folder\\ERROR REPORT2.x... | 2008/11/11 | [
"https://Stackoverflow.com/questions/280729",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31132/"
] |
280,748 | <p>I have a T4 template that generates classes from an xml file. </p>
<p>How can I add a dependency between the xml file and the template file so that when the xml file is modified the template is rerun automatically without choosing "Run custom tool" from the context menu?</p>
| [
{
"answer_id": 280827,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 2,
"selected": false,
"text": "<Exec ... />"
}
] | 2008/11/11 | [
"https://Stackoverflow.com/questions/280748",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4685/"
] |
280,749 | <p>I have some directories that are bundled with my installer and I need to access them from within a custom action. I have done some research and seen that the SourceDir can be used to obtain the currently executing dir location. However I cannot find any examples of how to obtain this property? Or another way to obtain the current directory?</p>
<p>Can anyone advise or point me to anything other than the unhelpful Microsoft site?</p>
| [
{
"answer_id": 282465,
"author": "w4g3n3r",
"author_id": 36745,
"author_profile": "https://Stackoverflow.com/users/36745",
"pm_score": 1,
"selected": false,
"text": "strSourceDir = Session.Property(\"SourceDir\")\n"
},
{
"answer_id": 1004783,
"author": "Chris",
"author_id... | 2008/11/11 | [
"https://Stackoverflow.com/questions/280749",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
280,751 | <p>I have a large c# solution file (~100 projects), and I am trying to improve build times. I think that "Copy Local" is wasteful in many cases for us, but I am wondering about best practices.</p>
<p>In our .sln, we have application A depending on assembly B which depends on assembly C. In our case, there are dozens of "B" and a handful of "C". Since these are all included in the .sln, we're using project references. All assemblies currently build into $(SolutionDir)/Debug (or Release).</p>
<p>By default, Visual Studio marks these project references as "Copy Local", which results in every "C" being copied into $(SolutionDir)/Debug once for every "B" that builds. This seems wasteful. What can go wrong if I just turn "Copy Local" off? What do other people with large systems do?</p>
<p>FOLLOWUP:</p>
<p>Lots of responses suggest breaking up the build into smaller .sln files... In the example above, I would build the foundation classes "C" first, followed by the bulk of the modules "B", and then a few applications, "A". In this model, I need to have non-project references to C from B. The problem I run into there is that "Debug" or "Release" gets baked into the hint path and I wind up building my Release builds of "B" against debug builds of "C". </p>
<p>For those of you that split the build up into multiple .sln files, how do you manage this problem?</p>
| [
{
"answer_id": 280804,
"author": "Aleksandar",
"author_id": 29511,
"author_profile": "https://Stackoverflow.com/users/29511",
"pm_score": 1,
"selected": false,
"text": "<developmentMode developerInstallation=\"true\" />"
},
{
"answer_id": 283808,
"author": "Bruno Shine",
... | 2008/11/11 | [
"https://Stackoverflow.com/questions/280751",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6996/"
] |
280,759 | <p>I am using the <strong><a href="http://en.wikipedia.org/wiki/JQuery" rel="noreferrer">jQuery</a> validation plugin</strong>. Great stuff! I want to migrate my existing ASP.NET solution to use jQuery instead of the ASP.NET validators. I am missing a replacement for the <strong>regular expression</strong> validator. I want to be able to do something like this:</p>
<pre><code>$("Textbox").rules("add", { regularExpression: "^[a-zA-Z'.\s]{1,40}$" })
</code></pre>
<p>How do I <strong>add a custom rule</strong> to achieve this?</p>
| [
{
"answer_id": 280952,
"author": "redsquare",
"author_id": 6440,
"author_profile": "https://Stackoverflow.com/users/6440",
"pm_score": 6,
"selected": false,
"text": "$.validator.addMethod('postalCode', function (value) { \n return /^((\\d{5}-\\d{4})|(\\d{5})|([A-Z]\\d[A-Z]\\s\\d[A-Z]\... | 2008/11/11 | [
"https://Stackoverflow.com/questions/280759",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36546/"
] |
280,767 | <p>After years of programming it's still some of the simple things that keep tripping me up.</p>
<p>Is there a commonly agreed definition of filename ?</p>
<p>Even the <a href="http://en.wikipedia.org/wiki/Filename" rel="noreferrer">wikipedia article</a> confuses the two interpretations.</p>
<p>It starts by defining it as 'a special kind of string used to uniquely identify a file stored on the file system of a computer'. That seems clear enough, and suggests that a filename is a fully qualified filename, specifying the complete path to the file.</p>
<p>However, it then goes on to:</p>
<ul>
<li>talk about basename and extension (so basename would contain an absolute path ?)</li>
<li>says that the length of a filename in DOS is limited to 8.3</li>
<li>says that a filename without a path part is assumed to be a file in the current working directory (so the filename does not uniquely identify a file)</li>
</ul>
<p>So, simple questions:</p>
<ul>
<li>what is a correct definition of 'filename' (include references)</li>
<li>how should I unambiguously name variables for:
<ul>
<li>a path to a file (which can be absolute/full or relative)</li>
<li>a path to a resource that can be a file/directory/socket</li>
</ul></li>
</ul>
| [
{
"answer_id": 280785,
"author": "Adam Liss",
"author_id": 29157,
"author_profile": "https://Stackoverflow.com/users/29157",
"pm_score": 3,
"selected": false,
"text": "path"
}
] | 2008/11/11 | [
"https://Stackoverflow.com/questions/280767",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2900/"
] |
280,769 | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/2246772/whats-the-difference-between-not-exists-vs-not-in-vs-left-join-where-is-null">What's the difference between NOT EXISTS vs. NOT IN vs. LEFT JOIN WHERE IS NULL?</a> </p>
</blockquote>
<p>I need to wite a query that will retrieve the records from Table A , provided that the key in Table A does not exist in Table B.</p>
<p>Any help will be appreciated.</p>
<p>Thanks</p>
| [
{
"answer_id": 280775,
"author": "Galwegian",
"author_id": 3201,
"author_profile": "https://Stackoverflow.com/users/3201",
"pm_score": 3,
"selected": true,
"text": "SELECT *\nFROM A\nWHERE ID NOT IN\n (SELECT ID FROM B)\n"
},
{
"answer_id": 280778,
"author": "CubanX",
... | 2008/11/11 | [
"https://Stackoverflow.com/questions/280769",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
280,787 | <p>I need to suppress autoplay for the mass storage devices.
This needs to be achieved programatically through a service/deamon running in the background.</p>
<p>I know it can be done by an application which opens a window and handles the "queryCancelAutoPlay" message sent by windows.</p>
<p>Can this be done without GUI.I have the guid/pid/vid for the device whose autoplay needs to be disabled.</p>
| [
{
"answer_id": 280813,
"author": "Robert Gamble",
"author_id": 25222,
"author_profile": "https://Stackoverflow.com/users/25222",
"pm_score": 0,
"selected": false,
"text": "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer \n"
}
] | 2008/11/11 | [
"https://Stackoverflow.com/questions/280787",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
280,793 | <p>I need to highlight, case insensitively, given keywords in a JavaScript string.</p>
<p>For example:</p>
<ul>
<li><code>highlight("foobar Foo bar FOO", "foo")</code> should return <code>"<b>foo</b>bar <b>Foo</b> bar <b>FOO</b>"</code></li>
</ul>
<p>I need the code to work for any keyword, and therefore using a hardcoded regular expression like <code>/foo/i</code> is not a sufficient solution.</p>
<p>What is the easiest way to do this?</p>
<p>(This an instance of a more general problem detailed in the title, but I feel that it's best to tackle with a concrete, useful example.)</p>
| [
{
"answer_id": 280805,
"author": "okoman",
"author_id": 35903,
"author_profile": "https://Stackoverflow.com/users/35903",
"pm_score": 7,
"selected": true,
"text": "function preg_quote (str, delimiter) {\n // discuss at: https://locutus.io/php/preg_quote/\n // original by: booeyOH\n /... | 2008/11/11 | [
"https://Stackoverflow.com/questions/280793",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
280,797 | <p>When you use the POISSON function in Excel (or in OpenOffice Calc), it takes two arguments:</p>
<ul>
<li>an integer</li>
<li>an 'average' number</li>
</ul>
<p>and returns a float.</p>
<p>In Python (I tried RandomArray and NumPy) it returns an array of random poisson numbers.
What I really want is the percentage that this event will occur (it is a constant number and the array has every time different numbers - so is it an average?).</p>
<p>for example:</p>
<pre><code>print poisson(2.6,6)
</code></pre>
<p>returns <code>[1 3 3 0 1 3]</code> (and every time I run it, it's different).</p>
<p>The number I get from calc/excel is 3.19 (<code>POISSON(6,2.16,0)*100</code>).</p>
<p>Am I using the python's poisson wrong (no pun!) or am I missing something?</p>
| [
{
"answer_id": 280843,
"author": "Alex Coventry",
"author_id": 1941213,
"author_profile": "https://Stackoverflow.com/users/1941213",
"pm_score": 5,
"selected": false,
"text": "scipy"
},
{
"answer_id": 280862,
"author": "Ned Batchelder",
"author_id": 14343,
"author_pro... | 2008/11/11 | [
"https://Stackoverflow.com/questions/280797",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
280,798 | <p>I'm trying to make a class that will execute any one of a number of stored procedures with any amount of variables</p>
<p>Im using php and mysqli</p>
<ul>
<li>My class enumerates an array and constructs a string based on the number of elements if any</li>
<li>giving something like this <code>CALL spTestLogin(?,?)</code> for example</li>
<li><p>I now need to bind the input from my array using somethin like this:</p>
<p>$stmt->bind_param($this->paramTypes,$this->paramValues);//paramValues is my array</p></li>
</ul>
<p>Then if that works I can work on getting my results</p>
<p>Any ideas</p>
| [
{
"answer_id": 280829,
"author": "Stefan Gehrig",
"author_id": 11354,
"author_profile": "https://Stackoverflow.com/users/11354",
"pm_score": 2,
"selected": false,
"text": "$params=array_merge(\n array($this->paramTypes), \n $this->paramValues\n);\ncall_user_func_array(array($stmt, ... | 2008/11/11 | [
"https://Stackoverflow.com/questions/280798",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11394/"
] |
280,801 | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/16991/what-ruby-ide-do-you-prefer">What Ruby IDE do you prefer?</a> </p>
</blockquote>
<p>I'm making a <strong>simple</strong> script using ruby on a Windows 2003 Server.
My questions are:</p>
<ul>
<li>How can I connect to a database through ODBC? I will be connecting to both <strong>Sybase on Solaris</strong> and <strong>MSSQL Server</strong>.</li>
<li>How can I send emails through an Exchange Server 2003?</li>
</ul>
<hr>
<h2>Update</h2>
<ul>
<li>What's the best simple IDE for Ruby scripting? I currently use SciTE (which comes with Ruby)</li>
</ul>
| [
{
"answer_id": 280857,
"author": "Tomalak",
"author_id": 18771,
"author_profile": "https://Stackoverflow.com/users/18771",
"pm_score": 2,
"selected": false,
"text": "require 'DBI'\n\n# make an ODBC connection\nconn = DBI.connect('DBI:ODBC:datasource','your_username','your_password')\n\n#... | 2008/11/11 | [
"https://Stackoverflow.com/questions/280801",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15884/"
] |
280,818 | <p>I'm developing a small utility application that needs to detect whether another one has one of its MDI child windows open (it's an off-the-shelf Win32 business application over which I have neither source code nor control).
From my app, I would like to be able to poll or detect when a particular MDI Child window is open.</p>
<p>In .Net, it's easy to iterate over running processes, but I haven't found an easy way to iterate through the (sub)windows and controls of a given Win32 process from .Net.</p>
<p>Any ideas?</p>
<p><strong>Update</strong><br>
Thanks for the answers they got me on the right path.<br>
I found an <a href="http://www.vbaccelerator.com/home/NET/Code/Libraries/Windows/Enumerating_Windows/article.asp" rel="nofollow noreferrer">article with a test project</a> that uses both <code>EnumWindows</code>and <code>EnumChidWindows</code> and other API calls to get extended information on controls.</p>
| [
{
"answer_id": 280878,
"author": "Robert Vuković",
"author_id": 438025,
"author_profile": "https://Stackoverflow.com/users/438025",
"pm_score": 4,
"selected": true,
"text": ""
},
{
"answer_id": 43541456,
"author": "Peter Talbot",
"author_id": 7901147,
"author_profile"... | 2008/11/11 | [
"https://Stackoverflow.com/questions/280818",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3811/"
] |
280,819 | <p>My WCF service involves the sending of a dataset (in csv format) data between client and service. This dataset must be encrypted so that the data cannot be intercepted. I'm using wshttpbinding and trying to encrypt the message by using the following settings in web.config:</p>
<pre><code><wsHttpBinding>
<binding name="wsHttp">
<reliableSession enabled="true" />
<security mode="Message">
<message clientCredentialType="UserName" algorithmSuite="TripleDes" />
</security>
</binding>
</wsHttpBinding>
</code></pre>
<p>When I try and generate a client proxy I get a long error messagebox (which cannot be completely read because it goes off the bottom of the screen!). The error message does mention something about a "service certificate not being provided".</p>
<p>How do I encrypt a message? Do I need a certificate? I should mention that this service will be used over the internet from different domains so I'm not sure whether using "Username" security is the best option (?)</p>
<p>Basically I'm confused!</p>
| [
{
"answer_id": 280890,
"author": "Martin",
"author_id": 1529,
"author_profile": "https://Stackoverflow.com/users/1529",
"pm_score": 3,
"selected": true,
"text": "makecert -sr LocalMachine -ss My -pe -n CN=subject-name -eku 1.3.6.1.5.5.7.3.1 -sky exchange\n"
}
] | 2008/11/11 | [
"https://Stackoverflow.com/questions/280819",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/445/"
] |
280,834 | <p>I would like to know if it is possible, to select certain columns from one table, and another column from a second table, which would relate to a non imported column in the first table. I have to obtain this data from access, and do not know if this is possible with Access, or SQL in general.</p>
| [
{
"answer_id": 280848,
"author": "Noah Goodrich",
"author_id": 20178,
"author_profile": "https://Stackoverflow.com/users/20178",
"pm_score": 4,
"selected": true,
"text": "CREATE TABLE tbl_1 (\n pk_1 int,\n field_1 varchar(25),\n field_2 varchar(25)\n);\n\nCREATE TABLE tbl_2 (\n ... | 2008/11/11 | [
"https://Stackoverflow.com/questions/280834",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1246613/"
] |
280,846 | <p><strong>Mark Up</strong></p>
<pre><code><%@ Page Language="C#" AutoEventWireup="true" CodeBehind="test.aspx.cs" Inherits="Zuhaib.test" %>
<!-- Put IE into quirks mode -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head runat="server">
<title></title>
<link href="css/general.css" rel="stylesheet" type="text/css" />
<link href="css/outbound.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server" class="wrapper">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div id="left">
</div>
<div id="right">
</div>
</form>
</body>
</html>
</code></pre>
<p><strong>CSS</strong></p>
<pre><code>html, body
{
margin:0;
padding:0;
border:0;
overflow:hidden;
width:100%;
height:100%;
}
* html body
{
height:100%;
width:100%;
}
*{
margin:0;
padding:0;
}
.wrapper
{
position:fixed;
top:0px;
bottom:0px;
left:0px;
right:0px;
height:100%;
width:100%;
}
* html .wrapper
{
width:100%;
height:100%;
}
#left{
float:left;
height:100%;
width:100px;
overflow:hidden;
background-color:Blue;
}
* html #left{
height:100%;
width:100px;
}
#right{
margin-left:100px;
height:100%;
background-color:Red;
}
* html #right{
height:100%;
}
</code></pre>
<p><strong>Result in IE && FF</strong><br>
<a href="http://img139.imageshack.us/img139/9871/ie3pxgapnl4.jpg" rel="nofollow noreferrer">Resutls in IE & FF http://img139.imageshack.us/img139/9871/ie3pxgapnl4.jpg</a><br>
The result is same with both IE 6 & 7. How can I remove the gap between the divs?</p>
<p><strong>Udate</strong><br>
I have two divs each with 100% height. the left div is a fixed width floating div. Even after giving correct margin-left to the right div, there remains a gap (3px) between the two divs. Where as in firefox it renders correctly.</p>
<p>The reason I have used quirk mode is to able to get 100% height for the divs</p>
<p>Can this gap be eliminated? Or is there a better way to do two column 100% height layout with pure css?</p>
| [
{
"answer_id": 280947,
"author": "phihag",
"author_id": 35070,
"author_profile": "https://Stackoverflow.com/users/35070",
"pm_score": 4,
"selected": true,
"text": "#right{\n position: absolute;\n left: 100px;\n padding-left: -100px;\n width: 100%;\n ...\n}\n"
},
{
"answer_id... | 2008/11/11 | [
"https://Stackoverflow.com/questions/280846",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25138/"
] |
280,864 | <p>Does anyone know of an open source web service/wcf service that can stream media content to clients? In particular I am looking for something that could access my music collection and stream it to a client (could be a client browser, win mobile app or even iphone application).</p>
<p>I guess it would have to be WCF based as I'm not sure that webservices do streaming really well. Also Windows Media Streaming Services is not the best way to go as the service should operate from a vista/xp machine (preferably). </p>
<p>If not, does anyone know the best way to start going about creating something like this - I'm not sure I know where to start with this one, although I can see many many uses for such a service!</p>
| [
{
"answer_id": 280947,
"author": "phihag",
"author_id": 35070,
"author_profile": "https://Stackoverflow.com/users/35070",
"pm_score": 4,
"selected": true,
"text": "#right{\n position: absolute;\n left: 100px;\n padding-left: -100px;\n width: 100%;\n ...\n}\n"
},
{
"answer_id... | 2008/11/11 | [
"https://Stackoverflow.com/questions/280864",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/445/"
] |
280,872 | <p>I'm trying to write a <a href="/questions/tagged/vba" class="post-tag" title="show questions tagged 'vba'" rel="tag">vba</a> macro for a group tha</p>
<ul>
<li>has one workbook where they daily create new worksheets, and also have</li>
<li><em>Sheet 1</em>, <em>Sheet 2</em> and <em>Sheet 3</em> at the end of their long list of sheets. </li>
</ul>
<p>I need to create a external cell reference in a new column in a different workbook where this information is being summarized.</p>
<p>So I need to know how to get the <strong>last non-empty sheet</strong> so I can grab this data and place it appropriately in the summary.</p>
| [
{
"answer_id": 280979,
"author": "dbb",
"author_id": 25675,
"author_profile": "https://Stackoverflow.com/users/25675",
"pm_score": 4,
"selected": true,
"text": "Function GetLastNonEmptySheetName() As String\nDim i As Long\nFor i = Worksheets.Count To 1 Step -1\n If Sheets(i).UsedRange.C... | 2008/11/11 | [
"https://Stackoverflow.com/questions/280872",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26140/"
] |
280,879 | <p>In some existing code there is a test to see if the user is running IE, by checking if the object Browser.Engine.trident is defined and returns true.</p>
<p>But how can I determine if the user is running IE6 (or earlier) or IE7 (or later)?</p>
<p>The test is needed inside a JavaScript function so a conditional comment doesn't seem suitable.</p>
| [
{
"answer_id": 280886,
"author": "Nick Berardi",
"author_id": 17,
"author_profile": "https://Stackoverflow.com/users/17",
"pm_score": 2,
"selected": false,
"text": "if (jQuery.browser.msie == true) { \nif (jQuery.browser.version == 7.0)\n // .. do something for 7.0\nelse \n // .. do so... | 2008/11/11 | [
"https://Stackoverflow.com/questions/280879",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
280,891 | <p>I've decided to reimplement the datetime picker, as a standard datetime picker isn't nullable. The user wants to start with a blank field and type (not select) the date.</p>
<p>I've created a user control to do just that, but if the user control is near the edge of the form, it will be cut off on the form boundry. The standard datetime picker doesn't suffer from this problem.</p>
<p>Here is a picture showing the problem. My user control is on the left, the standard datetimepicker is on the right:</p>
<p><a href="http://img50.imageshack.us/img50/9104/datetimepickervu6.jpg">alt text http://img50.imageshack.us/img50/9104/datetimepickervu6.jpg</a></p>
<p>As you can see, the standard control will display over the form AND application boundry. How do I get the month picker in my control to do the same thing?</p>
<p>Thanks!</p>
| [
{
"answer_id": 280932,
"author": "Bruno Shine",
"author_id": 28294,
"author_profile": "https://Stackoverflow.com/users/28294",
"pm_score": 1,
"selected": false,
"text": "SafeNativeMethods.SetWindowPos"
},
{
"answer_id": 282008,
"author": "Robert Rossney",
"author_id": 194... | 2008/11/11 | [
"https://Stackoverflow.com/questions/280891",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29830/"
] |
280,892 | <p>I'm looking to write a small proxy server for kicks and giggles.</p>
<p>Apart from the options in libWWW, can anyone recommend any opensource options for the HTTP server and client code? Thinking of a library of some kind similar to libWWW.</p>
<p>Chosen language is C/C++ but open to Java, C#, Python... etc. :-)</p>
| [
{
"answer_id": 280932,
"author": "Bruno Shine",
"author_id": 28294,
"author_profile": "https://Stackoverflow.com/users/28294",
"pm_score": 1,
"selected": false,
"text": "SafeNativeMethods.SetWindowPos"
},
{
"answer_id": 282008,
"author": "Robert Rossney",
"author_id": 194... | 2008/11/11 | [
"https://Stackoverflow.com/questions/280892",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
280,894 | <p>I have an access database, with a query made. I need to automate it so that each night this query can run and export to a tab delimited csv file. It is not possible to export a query to a csv file from within access. My question is, are there any tools that can select certain tables, or perform an sql query on an mdb file, and export to a csv file?</p>
| [
{
"answer_id": 280900,
"author": "Fionnuala",
"author_id": 2548,
"author_profile": "https://Stackoverflow.com/users/2548",
"pm_score": 2,
"selected": false,
"text": " Sub TransferCSV()\n\n DoCmd.TransferText acExportDelim, , \"PutNameOfQueryHere\", \"C:\\PutPathAnd\\FilenameHere.csv\"... | 2008/11/11 | [
"https://Stackoverflow.com/questions/280894",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1246613/"
] |
280,896 | <p>I seem to be in the minority, but to be honest I am not comfortable with linq and don't see any benefits in my personal development (not to say there are no benefits, just a personal opinion based on my situation).</p>
<p>I build web applications (.net, .net mvc) and I love having part of my data layer in stored procedures. One thing I love about sprocs is that I can generate the entire db to script, then scan my queries, <b>readable queries</b> I might add, at a high level.</p>
<p>For those of you who don't like linq, what is your reason? Is it just lack of knowledge/learning curve or is there a business case for not using it?</p>
| [
{
"answer_id": 280954,
"author": "b1tsn4ck",
"author_id": 36481,
"author_profile": "https://Stackoverflow.com/users/36481",
"pm_score": 1,
"selected": false,
"text": "foreach"
}
] | 2008/11/11 | [
"https://Stackoverflow.com/questions/280896",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
280,904 | <p>I hope this is a simple enough question for any SQL people out there...</p>
<p>We have a table which hold system configuration data, and this is tied to a history table via triggers so we can track who changed what, and when. </p>
<p>I have a requirement to add another value in to this table, but it is one that will change frequently from code, and has a requirement that we don't track it's history (we don't want to clog the table with many thousands of updates per day.</p>
<p>At present, our trigger is a little like this...</p>
<pre><code>CREATE TRIGGER
[dbo].[SystemParameterInsertUpdate]
ON
[dbo].[SystemParameter]
FOR INSERT, UPDATE
AS
BEGIN
SET NOCOUNT ON
INSERT INTO SystemParameterHistory
(
Attribute,
ParameterValue,
ParameterDescription,
ChangeDate
)
SELECT
Attribute,
ParameterValue,
ParameterDescription,
ChangeDate
FROM Inserted AS I
END
</code></pre>
<p>I'd like to be able to add some logic to stop it creating the record if an Attribute colum value is prefixed with a specific string (e.g. "NoHist_")</p>
<p>Given that I have almost no experience working with triggers, I was wondering how it would be best to implement this... I have tried a where clause like the following</p>
<pre><code>where I.Attribute NOT LIKE 'NoHist_%'
</code></pre>
<p>but it doesn't seem to work. The value is still copied over into the history table.</p>
<p>Any help you could offer would be appreciated.</p>
<hr>
<p>OK - as predicted by Cade Roux, this fail spectacularly on multiple updates. I'm going to have to take a new approach to this. Does anyone have any other suggestions, please?</p>
<hr>
<p>Guys - Please educate me here... Why would LEFT() be preferable to LIKE in this scenario? I know I've accepted the answer, but I'd like to know for my own education. </p>
| [
{
"answer_id": 280956,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 7,
"selected": true,
"text": "CREATE TRIGGER \n [dbo].[SystemParameterInsertUpdate]\nON \n [dbo].[SystemParameter]\nFOR INSERT, UPDATE \nAS\n ... | 2008/11/11 | [
"https://Stackoverflow.com/questions/280904",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/377/"
] |
280,909 | <p>Is there a programmatic method to set CPU affinity for a process in c/c++ for the Linux operating system?</p>
| [
{
"answer_id": 280924,
"author": "Alnitak",
"author_id": 6782,
"author_profile": "https://Stackoverflow.com/users/6782",
"pm_score": 7,
"selected": true,
"text": "sched_setaffinity(2)"
},
{
"answer_id": 280996,
"author": "thAAAnos",
"author_id": 36557,
"author_profile... | 2008/11/11 | [
"https://Stackoverflow.com/questions/280909",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7362/"
] |
280,940 | <p>I am programming in C against a third party library (in HP/Mercury Loadrunner) that allows a varargs-style variable size argument list for one of it's functions. I want to call this function but I do not know up front how many arguments I will have. </p>
<p>There is a function made by one of my predecessors that serves somewhat but the problem here is that this function assumes the worst case scenario (over 3000 arguments) and hand-codes for that.</p>
<p>To illuminate, here's the (beginning of) the code. The function we call is <code>web_submit_data()</code>. It will HTTP post a set of form data. This implementation came about when dealing with dynamically generated forms with an arbitrary number of fields.
(Cleaned up a fair bit from the original, which hand coded indexes by hand as well..)</p>
<hr>
<pre><code>web_submit_data_buffer_gazillion_items( const char *bufferName, const char *bufferValue)
{
const int size = 129;
int i = 0;
int j = 11;
web_submit_data(&bufferName[i++ * size], //"some form"
&bufferName[i++ * size], //"Action=https://blah.blah/form");
&bufferName[i++ * size], //"Method=POST");
&bufferName[i++ * size], //"TargetFrame=");
&bufferName[i++ * size], //"RecContentType=text/html");
&bufferName[i++ * size], //"Referer=https://blah.blah/index.html");
&bufferName[i++ * size], //"Snapshot=t1.inf");
&bufferName[i++ * size], //"Mode=HTML");
ITEMDATA, // missing in action: indexes 8 through 10
&bufferName[j * size],&bufferValue[j++ * size], ENDITEM,
&bufferName[j * size],&bufferValue[j++ * size], ENDITEM,
&bufferName[j * size],&bufferValue[j++ * size], ENDITEM,
..
(repeat the last 3 lines ad nauseum)
..
&bufferName[j * size],&bufferValue[j++ * size], ENDITEM,
&bufferName[j * size]);
}
</code></pre>
<p>Now I have found an external library that might work (<a href="http://www.dyncall.org" rel="noreferrer">http://www.dyncall.org</a>) but I would much rather not a) be completely processor dependant and b) attempt to teach Loadrunner about linking in external sources..</p>
<p>Edit:
The original function used hardcoded indexes instead of using a variable. Can still revert to that if it turns out to be too unpredictable. However, as I am unlikely to run this with a different compiler or hardware / OS I doubt that really is worth it.</p>
<p>Also: I don't have control over the implementation of web_submit_data(). So just pushing the problem down one level isn't going to cut it..</p>
<p>Another thing to note: The spec for <code>web_submit_data()</code> uses a constant called LAST to mark the end of the argument list. The original implementation doesn't use it. Presumably the callsite does ..</p>
| [
{
"answer_id": 281029,
"author": "pnkfelix",
"author_id": 36585,
"author_profile": "https://Stackoverflow.com/users/36585",
"pm_score": 1,
"selected": false,
"text": "web_submit_data"
},
{
"answer_id": 281055,
"author": "Ben Collins",
"author_id": 3279,
"author_profil... | 2008/11/11 | [
"https://Stackoverflow.com/questions/280940",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36574/"
] |
280,948 | <p>I am setting-up my DataGridView like this:</p>
<pre><code> jobs = new List<DisplayJob>();
uxJobList.AutoGenerateColumns = false;
jobListBindingSource.DataSource = jobs;
uxJobList.DataSource = jobListBindingSource;
int newColumn;
newColumn = uxJobList.Columns.Add("Id", "Job No.");
uxJobList.Columns[newColumn].DataPropertyName = "Id";
uxJobList.Columns[newColumn].DefaultCellStyle.Format = Global.JobIdFormat;
uxJobList.Columns[newColumn].DefaultCellStyle.Font = new Font(uxJobList.DefaultCellStyle.Font, FontStyle.Bold);
uxJobList.Columns[newColumn].AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
uxJobList.Columns[newColumn].Width = 62;
uxJobList.Columns[newColumn].Resizable = DataGridViewTriState.False;
uxJobList.Columns[newColumn].SortMode = DataGridViewColumnSortMode.Automatic;
:
:
</code></pre>
<p>where the DisplayJob class looks like:</p>
<pre><code> public class DisplayJob
{
public DisplayJob(int id)
{
Id = id;
}
public DisplayJob(JobEntity job)
{
Id = job.Id;
Type = job.JobTypeDescription;
CreatedAt = job.CreatedAt;
StartedAt = job.StartedAt;
ExternalStatus = job.ExternalStatus;
FriendlyExternalStatus = job.FriendlyExternalStatus;
ExternalStatusFriendly = job.ExternalStatusFriendly;
CustomerName = job.Customer.Name;
CustomerKey = job.Customer.CustomerKey;
WorkAddress = job.WorkAddress;
CreatedBy = job.CreatedBy;
CancelledAt = job.CancelledAt;
ClosedAt = job.ClosedAt;
ReasonWaiting = job.ReasonWaiting;
CancelledBy = job.CancelledBy;
CancelledReason = job.CancelledReason;
DisplayCreator = Global.GetDisplayName(CreatedBy);
ActionRedoNeeded = job.ActionRedoNeeded;
if (job.Scheme != null)
{
SchemeCode = job.Scheme.Code;
}
}
public int Id { get; private set; }
public string Type { get; private set; }
public DateTime CreatedAt { get; private set; }
public DateTime? StartedAt { get; private set; }
public string ExternalStatus { get; private set; }
public string FriendlyExternalStatus { get; private set; }
public string ExternalStatusFriendly { get; private set; }
public string CustomerName { get; private set; }
public string CustomerKey { get; private set; }
public string WorkAddress { get; private set; }
public string CreatedBy { get; private set; }
public DateTime? CancelledAt { get; private set; }
public DateTime? ClosedAt { get; private set; }
public string CancelledBy { get; private set; }
public string ReasonWaiting { get; private set; }
public string DisplayCreator { get; private set; }
public string CancelledReason { get; private set; }
public string SchemeCode { get; private set; }
public bool ActionRedoNeeded { get; private set; }
}
</code></pre>
<p>However the column sorting does not work. What is the best way to get this working?</p>
| [
{
"answer_id": 280958,
"author": "Bruno Shine",
"author_id": 28294,
"author_profile": "https://Stackoverflow.com/users/28294",
"pm_score": 1,
"selected": false,
"text": "IComparable"
},
{
"answer_id": 280992,
"author": "Patrick Desjardins",
"author_id": 13913,
"author... | 2008/11/11 | [
"https://Stackoverflow.com/questions/280948",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18349/"
] |
280,953 | <p>Could anyboby help me with the alternative solution in C# regarding <strong>AddressOf operator in VB6</strong>? AddressOf returns a long value. What way can I get the output in C#?</p>
| [
{
"answer_id": 280959,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 3,
"selected": false,
"text": "<delegate> += <function>;"
},
{
"answer_id": 280967,
"author": "TcKs",
"author_id": 20382,
"author... | 2008/11/11 | [
"https://Stackoverflow.com/questions/280953",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
280,969 | <p>I need to grab the folder name of a currently executing batch file. I have been trying to loop over the current directory using the following syntax (which is wrong at present):</p>
<pre><code>set mydir = %~p0
for /F "delims=\" %i IN (%mydir%) DO @echo %i
</code></pre>
<p>Couple of issues in that I cannot seem to pass the 'mydir' variable value in as the search string. It only seems to work if I pass in commands; I have the syntax wrong and cannot work out why.</p>
<p>My thinking was to loop over the folder string with a '\' delimiter but this is causing problems too. If I set a variable on each loop then the last value set will be the current folder name. For example, given the following path:</p>
<blockquote>
<p>C:\Folder1\Folder2\Folder3\Archive.bat</p>
</blockquote>
<p>I would expect to parse out the value 'Folder3'.</p>
<p>I need to parse that value out as its name will be part of another folder I am going to create further down in the batch file.</p>
<p>Many thanks if anyone can help. I may be barking up the wrong tree completely so any other approaches would be greatly received also.</p>
| [
{
"answer_id": 281073,
"author": "Patrick Cuff",
"author_id": 7903,
"author_profile": "https://Stackoverflow.com/users/7903",
"pm_score": 4,
"selected": true,
"text": "@echo OFF\nset mydir=\"%~p0\"\nSET mydir=%mydir:\\=;%\n\nfor /F \"tokens=* delims=;\" %%i IN (%mydir%) DO call :LAST_FOL... | 2008/11/11 | [
"https://Stackoverflow.com/questions/280969",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31412/"
] |
280,971 | <p>Within my InfoPath form (which has to be loaded within a SharePoint Portal by the browser)I have a repeating table containing multiple fields. Now I would like to make the first textfield autoincrement starting by 1. How exactly can I do this?</p>
<p>I have already heard of a way by using the "count" function but this produces errors or in best case a static number which unfortunately does not count.
The function I have added for the field is "count(.) + 1"</p>
<p>Any suggestions?</p>
| [
{
"answer_id": 281227,
"author": "Alex",
"author_id": 35999,
"author_profile": "https://Stackoverflow.com/users/35999",
"pm_score": 2,
"selected": true,
"text": "count(/my:myFields/my:item)\n"
}
] | 2008/11/11 | [
"https://Stackoverflow.com/questions/280971",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25428/"
] |
280,990 | <p>I have a snippet looking something like the below.</p>
<pre><code>string bodyTypeAssemblyQualifiedName = "XXX.XX.XI.CustomerPayment.Schemas.r1.CustomerPayments_v01, XXX.XX.XI.CustomerPaym" +
"ent.Schemas.r1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ac564f277cd4488" +
"e";
</code></pre>
<p>I'd like use regular expression in C# to get it to: </p>
<pre><code>string bodyTypeAssemblyQualifiedName = null;
</code></pre>
<p>I've tried using a RegEx like the below but it doesn't match the newlines ...</p>
<pre><code>bodyTypeAssemblyQualifiedName\s=\s(?<location>.*?);
</code></pre>
| [
{
"answer_id": 281014,
"author": "Tomalak",
"author_id": 18771,
"author_profile": "https://Stackoverflow.com/users/18771",
"pm_score": 0,
"selected": false,
"text": "bodyTypeAssemblyQualifiedName\\s=\\s(?<location>[.\\n]*?);\n"
},
{
"answer_id": 281183,
"author": "Alan Moore"... | 2008/11/11 | [
"https://Stackoverflow.com/questions/280990",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
280,991 | <p>I have been working on splitting up the app tier and web tier of a web application. In the app tier, I managed to separate the business logic into a bunch of services exposed using WCF proxies. The problem is that these services talk to another legacy application that uses a large CLR object as its primary means of communication. To keep things quick, I had been keeping a copy of this object in the session after I created it the first time. Now I know that WCF can do sessions, but the session storage is per service whereas my business logic is now split into multiple services (as it should be). </p>
<p>Now the questions:</p>
<ol>
<li>Is there a way to share session storage between WCF services hosted on the same host? </li>
<li>Is this even something I should be doing? </li>
<li>If not, then what are the best practices here? </li>
</ol>
<p>This is probably not the first time somebody’s had a large business object on the server. Unfortunately for me, I really do need to cache this object per user (hence the session).</p>
<p>It’s possible the answer is obvious and I'm just not seeing it. Help please!</p>
| [
{
"answer_id": 12067200,
"author": "Niels Brinch",
"author_id": 392362,
"author_profile": "https://Stackoverflow.com/users/392362",
"pm_score": 0,
"selected": false,
"text": "System.Web.Caching"
}
] | 2008/11/11 | [
"https://Stackoverflow.com/questions/280991",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16671/"
] |
281,015 | <p>Hi would like to send an email alert after checking the result of a query which will return the numbers of rows in a table. Does anyone have any ideas how I could do this in SQL Server 2000 in 2005 I would use a maintenence plan but not sure how in 2000?</p>
| [
{
"answer_id": 281083,
"author": "Valerion",
"author_id": 16156,
"author_profile": "https://Stackoverflow.com/users/16156",
"pm_score": 1,
"selected": false,
"text": "-- @From varchar(100) ,\n -- @To varchar(100) ,\n -- @Subject varchar(100)=\" \",\n --@Body varchar(4000) =\" \"\n/... | 2008/11/11 | [
"https://Stackoverflow.com/questions/281015",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
281,017 | <p>(Warning - asp newbie) I have an aspx file with the tag</p>
<pre><code> <%@ Page Language=VB ... %>
</code></pre>
<p>right at the beginning of the file.</p>
<p>When calling this from my IIS server (<a href="http://localhost/myservice/default.aspx" rel="noreferrer">http://localhost/myservice/default.aspx</a>), this gives me the error </p>
<blockquote>
<p>This page contains the following
errors: </p>
<p>error on line 1 at column 2:
StartTag: invalid element name<br>
Below is a rendering of the page up to
the first error.</p>
</blockquote>
<p>What am I doing wrong?</p>
| [
{
"answer_id": 65036058,
"author": "Victor Muñoz",
"author_id": 8325863,
"author_profile": "https://Stackoverflow.com/users/8325863",
"pm_score": 0,
"selected": false,
"text": " - < tag > text < / tag > ---> wrong\n\n - <tag> text </tag> ----> good.\n\n"
}
] | 2008/11/11 | [
"https://Stackoverflow.com/questions/281017",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6583/"
] |
281,020 | <p>I want to call some RESTful web services from a J2ME client running on a MIDP enabled mobile device. I read the MIDP api for HTTPConnections and thought this is just crying out for a simple wrapper to hide all those unpleasant byte arrays and such like. Before I write my own I wondered whether there was a good open source library already available.</p>
<p>-FE- </p>
| [
{
"answer_id": 287057,
"author": "darius",
"author_id": 5896,
"author_profile": "https://Stackoverflow.com/users/5896",
"pm_score": 4,
"selected": true,
"text": "* Asynchronous versions of HTTP Get and Post\n* HTTP Basic Authentication\n* Multipart MIME (sender only)\n* Progress listener... | 2008/11/11 | [
"https://Stackoverflow.com/questions/281020",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32747/"
] |
281,034 | <p>Under visual studio if you run a web project by pressing the <kbd>Go</kbd> button on the Debugging toolbar, then stop it by pressing the <kbd>Stop</kbd> button on the debugging toolbar, Internet Explorer is opened and closed by the IDE.</p>
<p>Is there a way to prevent the IDE from closing Internet Explorer when stopping debugging? I want to do this to allow myself to refer to the content of the pages in IE while editing my code.</p>
| [
{
"answer_id": 281063,
"author": "Bruno Shine",
"author_id": 28294,
"author_profile": "https://Stackoverflow.com/users/28294",
"pm_score": 4,
"selected": true,
"text": "Detach All"
}
] | 2008/11/11 | [
"https://Stackoverflow.com/questions/281034",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36591/"
] |
281,036 | <p>Are "out" parameters a bad thing in .NET? Any good articles/discussions on this topic?</p>
| [
{
"answer_id": 281049,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 7,
"selected": true,
"text": "out"
},
{
"answer_id": 281077,
"author": "Simon",
"author_id": 15371,
"author_profile": "https://Stac... | 2008/11/11 | [
"https://Stackoverflow.com/questions/281036",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36590/"
] |
281,041 | <p>I am not that hot at regular expressions and it has made my little mind melt some what.</p>
<p>I am trying to find all the tables names in a query. So say I have the query:</p>
<pre><code>SELECT one, two, three FROM table1, table2 WHERE X=Y
</code></pre>
<p>I would like to pull out "table1, table2" or "table1" and "table2"</p>
<p>But what if there is no where statement. It could be the end of the file, or there could be a group by or an order by etc. I know "most" of the time this will not be an issue but I don't like the idea of coding for "most" situations and knowing I have left a hole that could cause things to go wrong later.</p>
<p>Is this a doable Regex expression? Am I being a Regex pleb?</p>
<p>(P.S. this will be done in C# but presume that doesn't matter much).</p>
| [
{
"answer_id": 281053,
"author": "LeppyR64",
"author_id": 16592,
"author_profile": "https://Stackoverflow.com/users/16592",
"pm_score": 1,
"selected": false,
"text": "select\n *\nfrom\n A\n join (\n select\n top 5 *\n from\n B)\n on B.ID = A.ID\nwhere\n A.ID in (\... | 2008/11/11 | [
"https://Stackoverflow.com/questions/281041",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6486/"
] |
281,045 | <p>This is a question that was sparked by <a href="https://stackoverflow.com/users/3631/rob-walker">Rob Walker</a>'s answer <a href="https://stackoverflow.com/questions/36455/alignment-restrictions-for-mallocfree#36466">here</a>.</p>
<p>Suppose I declare a class/struct like so:</p>
<pre><code>struct
{
char A;
int B;
char C;
int D;
};
</code></pre>
<p>Is it safe to assume that these members will be declared in exactly that order in memory, or is this a compiler dependent thing? I'm asking because I had always assumed that the compiler can do whatever it wants with them.</p>
<p>This leads into my next question. If the above example causes memory alignment issues, why can the compiler not just turn that into something like this implicitly:</p>
<pre><code>struct
{
char A;
char C;
int B;
int D;
};
</code></pre>
<p>(I'm primarily asking about C++, but I'd be interested to hear the C answer as well)</p>
<h3>Related topics</h3>
<ul>
<li><a href="https://stackoverflow.com/questions/118068/why-doesnt-gcc-optimize-structs">Why doesn't GCC optimize structs?</a></li>
</ul>
| [
{
"answer_id": 281154,
"author": "Jason Baker",
"author_id": 2147,
"author_profile": "https://Stackoverflow.com/users/2147",
"pm_score": 0,
"selected": false,
"text": "struct foo{};\n"
}
] | 2008/11/11 | [
"https://Stackoverflow.com/questions/281045",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2147/"
] |
281,095 | <p>I would like to retrieve at runtime the values for the "dialect" and "connection.driver_class" properties specified in the configuration file.</p>
<p>Do you know how to do that?</p>
<p>Many thanks,
Nicola</p>
| [
{
"answer_id": 289528,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 4,
"selected": false,
"text": " public static Dialect GetDialect(ISession session)\n {\n Dialect dialect = session.GetSessionImplementation().Fa... | 2008/11/11 | [
"https://Stackoverflow.com/questions/281095",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
281,101 | <p>When building a application that accesses a MySQL database on linux using C/C++ i have to dynamically link into the mysql client library. Is there a way in which i can statically link the application so that the mysql client libraries are no longer required?</p>
<p>What is the best practice, with regards to C\C++ development, to include rather long queries in the application but outside the code? Using stored procedures an not possible as the database runs on a MySQL 4 server.</p>
| [
{
"answer_id": 294919,
"author": "AndrewR",
"author_id": 2994,
"author_profile": "https://Stackoverflow.com/users/2994",
"pm_score": 0,
"selected": false,
"text": "gcc -I/usr/include/mysql -c mysql.c\ngcc -o mysql mysql.o -static -lmysqlclient -static-libgcc -lm -lz -lpthread\n"
}
] | 2008/11/11 | [
"https://Stackoverflow.com/questions/281101",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7362/"
] |
281,108 | <p>I have a compiled AppleScript application which I have moved to my windows server. I'd like to then insert a text file into the application (which looks like a zip file on windows):</p>
<pre><code>myapplescript.app/Contents/Resources/MyNewDir/MyTxtFile.txt
</code></pre>
<p>So, I've precompiled the AppleScript to try to read from this text file and get the contents as a string. This is what I do:</p>
<pre><code>set theFolder to POSIX path of (the path to me)
set theFile to theFolder & "Contents/Resources/MyNewDir/MyTxtFile.txt"
open for access theFile
set fileContents to (read theFile)
close access theFile
</code></pre>
<p>but this is the error I get:</p>
<blockquote>
<p>Can't make
"/Users/mike/Desktop/myapplescript.app/Contents/Resources/MyNewDir/MyTxtFile.txt"
into type file</p>
</blockquote>
| [
{
"answer_id": 284311,
"author": "Mike Blandford",
"author_id": 28643,
"author_profile": "https://Stackoverflow.com/users/28643",
"pm_score": 3,
"selected": true,
"text": "set theFile to (POSIX file (theFolder & \"Contents/Resources/MyNewDir/MyTxtFile.txt\"))\n"
},
{
"answer_id":... | 2008/11/11 | [
"https://Stackoverflow.com/questions/281108",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28643/"
] |
281,111 | <p>How do I replace text from one file with text from another file using vbscript?</p>
<p>The text being replaced is somewhere in the middle of the file. </p>
| [
{
"answer_id": 281138,
"author": "Svante Svenson",
"author_id": 19707,
"author_profile": "https://Stackoverflow.com/users/19707",
"pm_score": 2,
"selected": false,
"text": "Dim oFSO\nDim sFileAContents\nDim sFileBContents\nDim sFileCContents\nDim sResult\nSet oFSO = CreateObject(\"Script... | 2008/11/11 | [
"https://Stackoverflow.com/questions/281111",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
281,119 | <p>Has anyone written a version of .Net's generic Queue that implements INotifyCollectionChanged, or is there one hidden deep in the .Net framework somewhere already?</p>
| [
{
"answer_id": 281148,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 2,
"selected": true,
"text": "// this isn't the best code ever; refactor as desired\nprotected void OnCollectionChanged( NotifyCollectionChangedEventArgs cce... | 2008/11/11 | [
"https://Stackoverflow.com/questions/281119",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5548/"
] |
281,121 | <p>The default generated hashCode and equals implementations are ugly at best.</p>
<p>Is it possible to make eclipse generate ones from HashCodeBuilder and EqualsBuilder, and perhaps even a toString with ToStringBuilder?</p>
| [
{
"answer_id": 281179,
"author": "bruno conde",
"author_id": 31136,
"author_profile": "https://Stackoverflow.com/users/31136",
"pm_score": 2,
"selected": false,
"text": " public boolean equals(Object o) {\n boolean result = false;\n\n if (this == o) {\n result... | 2008/11/11 | [
"https://Stackoverflow.com/questions/281121",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11858/"
] |
281,123 | <p>I have a loop (for item in @dataset) and I want, in each iteration, to get different data from another table and make some operations that will be printed in the view. I cant't get this data from the dataset used in the loop.</p>
<p>How can I do this according to MVC? I can put the code into the loop, in the view, but I think it's horrible.</p>
<p>Must I use a helper for do this, and call the function from the view? </p>
| [
{
"answer_id": 282109,
"author": "Orion Edwards",
"author_id": 234,
"author_profile": "https://Stackoverflow.com/users/234",
"pm_score": 7,
"selected": true,
"text": "has_many"
},
{
"answer_id": 6857064,
"author": "Nadeem Yasin",
"author_id": 867188,
"author_profile":... | 2008/11/11 | [
"https://Stackoverflow.com/questions/281123",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36599/"
] |
281,132 | <p>Is there any difference between a <code>volatile</code> Object reference and <code>AtomicReference</code> in case I would just use <code>get()</code> and <code>set()</code>-methods from <code>AtomicReference</code>?</p>
| [
{
"answer_id": 281163,
"author": "pgras",
"author_id": 12719,
"author_profile": "https://Stackoverflow.com/users/12719",
"pm_score": 8,
"selected": true,
"text": "java.util.concurrent.atomic"
},
{
"answer_id": 497150,
"author": "Peter Lawrey",
"author_id": 57695,
"aut... | 2008/11/11 | [
"https://Stackoverflow.com/questions/281132",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4110/"
] |
281,133 | <p>What would be the easiest way to move the mouse around (and possibly click) using Python on OS X? </p>
<p>This is just for rapid prototyping, it doesn't have to be elegant.</p>
| [
{
"answer_id": 281330,
"author": "Ben",
"author_id": 36522,
"author_profile": "https://Stackoverflow.com/users/36522",
"pm_score": 4,
"selected": true,
"text": "#include <ApplicationServices/ApplicationServices.h>\n\nint to(int x, int y)\n{\n CGPoint newloc;\n CGEventRef eventRef;\... | 2008/11/11 | [
"https://Stackoverflow.com/questions/281133",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36522/"
] |
281,144 | <p>I am having some trouble grasping some concepts behind the MVC framework. I am doing a very simple application which categorizes products.</p>
<p>The Creation screen will simply use a dropdown list showing the list of categories, the name of the product and submit.</p>
<p>On a normal .Net app, I would databind a server dropdownlist in the Page_Load, but in a MVC app, what is the best way to retrieve my categories from the database and add them to the dropdown list?</p>
<p>(Sorry, my question is extremely noobish but unfortunately resources are spare on MVC, and examples are often broken due to early changes)</p>
| [
{
"answer_id": 281211,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "public class LogEvent{\n public string Title {get;set;}\n public string Date {get;set;}\n public string Message {get;set;}\... | 2008/11/11 | [
"https://Stackoverflow.com/questions/281144",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5789/"
] |
281,167 | <p>I've got a particular SQL statement which takes about 30 seconds to perform, and I'm wondering if anyone can see a problem with it, or where I need additional indexing.</p>
<p>The code is on a subform in Access, which shows results dependent on the content of five fields in the master form. There are nearly 5000 records in the table that's being queried. The Access project is stored and run from a terminal server session on the actual SQL server, so I don't think it's a network issue, and there's another form which is very similar that uses the same type of querying...</p>
<p>Thanks</p>
<p>PG</p>
<pre><code>SELECT TabDrawer.DrawerName, TabDrawer.DrawerSortCode, TabDrawer.DrawerAccountNo, TabDrawer.DrawerPostCode, QryAllTransactons.TPCChequeNumber, tabdrawer.drawerref
FROM TabDrawer LEFT JOIN QryAllTransactons ON TabDrawer.DrawerRef=QryAllTransactons.tpcdrawer
WHERE (Forms!FrmSearchCompany!SearchName Is Null
Or [drawername] Like Forms!FrmSearchCompany!SearchName & "*")
And (Forms!FrmSearchCompany.SearchPostcode Is Null
Or [Drawerpostcode] Like Forms!FrmSearchCompany!Searchpostcode & "*")
And (Forms!FrmSearchCompany!SearchSortCode Is Null
Or [drawersortcode] Like Forms!FrmSearchCompany!Searchsortcode & "*")
And (Forms!FrmSearchCompany!Searchaccount Is Null
Or [draweraccountno] Like Forms!FrmSearchCompany!Searchaccount & "*")
And (Forms!FrmSearchCompany!Searchcheque Is Null
Or [tpcchequenumber] Like Forms!FrmSearchCompany!Searchcheque & "*");
");
</code></pre>
<hr>
<p><strong>EDIT</strong></p>
<p>The Hold up seems to be in the union query that forms the QryAllTransactons query.</p>
<pre><code>SELECT
"TPC" AS Type,
TabTPC.TPCRef,
TabTPC.TPCBranch,
TabTPC.TPCDate,
TabTPC.TPCChequeNumber,
TabTPC.TPCChequeValue,
TabTPC.TPCFee,
TabTPC.TPCAction,
TabTPC.TPCMember,
tabtpc.tpcdrawer,
TabTPC.TPCUser,
TabTPC.TPCDiscount,
tabcustomers.*
FROM
TabTPC
INNER JOIN TabCustomers ON TabTPC.TPCMember = TabCustomers.CustomerID
UNION ALL
SELECT
"CTP" AS Type,
TabCTP.CTPRef,
TabCTP.CTPBranch,
TabCTP.CTPDate,
TabCTP.CTPChequeNumb,
TabCTP.CTPAmount,
TabCTP.CTPFee,
TabCTP.CTPAction,
TabCTP.CTPMember,
0 as CTPXXX,
TabCTP.CTPUser,
TabCTP.CTPDiscount,
TABCUSTOMERS.*
FROM
TabCTP
INNER JOIN TabCustomers ON Tabctp.ctpMember = TabCustomers.CustomerID;
</code></pre>
<p>I've done a fair bit of work with simple union queries, but never had this before...</p>
| [
{
"answer_id": 281214,
"author": "Tomalak",
"author_id": 18771,
"author_profile": "https://Stackoverflow.com/users/18771",
"pm_score": 1,
"selected": false,
"text": "WHERE\n [drawername] Like Nz(Forms!FrmSearchCompany!SearchName, \"\") & \"*\"\n And \n [Drawerpostcode] Like Nz(Forms!F... | 2008/11/11 | [
"https://Stackoverflow.com/questions/281167",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30140/"
] |
281,170 | <p>I have an installer that deploys web services to IIS. After this has finshed a custom action fires that updates the database with the scripts required by the webservices. The scripts are currently deploying to IIS aswell because they are part of the .net project. How can I configure the installation process so the scripts arn't part of the project and get un-packed from the MSI so my custom action can access them?</p>
| [
{
"answer_id": 281364,
"author": "CheGueVerra",
"author_id": 17787,
"author_profile": "https://Stackoverflow.com/users/17787",
"pm_score": 0,
"selected": false,
"text": "<Binary Id=\"webServiceScript.sql\" src=\"[DirectoryToFile]\\webServiceDataScript.sql\" />\n"
}
] | 2008/11/11 | [
"https://Stackoverflow.com/questions/281170",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
281,177 | <p>Is it a good practice to comment code that is removed? For example:</p>
<pre><code>// Code to do {task} was removed by Ajahn on 10/10/08 because {reason}.
</code></pre>
<p>Someone in my developer group during a peer review made a note that we should comment the lines of code to be removed. I thought this was a terrible suggestion, since it clutters the code with useless comments. Which one of us is right?</p>
| [
{
"answer_id": 281206,
"author": "andy.gurin",
"author_id": 22388,
"author_profile": "https://Stackoverflow.com/users/22388",
"pm_score": 2,
"selected": false,
"text": "// removed because of this and that\n/* \n removed this stuff because my left leg...\n*/\n doSomething();\n// this... | 2008/11/11 | [
"https://Stackoverflow.com/questions/281177",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5831/"
] |
281,210 | <p>We have scalar functions in our database for returning things like "number of tasks for a customer" or "total invoice amount for a customer". </p>
<p>We are experimenting and looking to try to do this w/o stored procedures ... normally we would just call this function in our stored procedure and return it as a single value. </p>
<p>Is there a way to use or access scalar functions with LINQ to SQL? If so, I would be interested in see an example of how to ... if not, how would it be best to handle this type of situation ... if it is even doable.</p>
| [
{
"answer_id": 281224,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 4,
"selected": true,
"text": "[Function(..., IsComposable=true)]"
}
] | 2008/11/11 | [
"https://Stackoverflow.com/questions/281210",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1768/"
] |
281,246 | <p>I have to add either an embed tag for Firefox or an object tag for Internet Explorer with JavaScript to address the appropriate ActiveX / Plugin depending on the browser. The plugin could be missing and needs to get downloaded in this case. The dynamically added embed tag for Firefox works as expected. The dynamically added object tag for Internet Explorer seems to do nothing at all. The object tag needs the following attributes to function properly.</p>
<p><code>id ="SomeId"
classid = "CLSID:{GUID}"
codebase = "http://www.MyActicexSource.com/MyCuteActivex.CAB#Version=2,0,0,1"</code></p>
<p>Even a general working idea or method would be nice.</p>
<p>Thanks!</p>
| [
{
"answer_id": 281280,
"author": "Jason Bunting",
"author_id": 1790,
"author_profile": "https://Stackoverflow.com/users/1790",
"pm_score": 5,
"selected": true,
"text": "// something akin to this:\ndocument.getElementById(myDivId).innerHTML = \"<OBJECT id='foo' classid='CLSID:22d6f312-b0f... | 2008/11/11 | [
"https://Stackoverflow.com/questions/281246",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1890/"
] |
281,247 | <p>I'm relatively new to NHibernate, but have been using it for the last few programs and I'm in love. I've come to a situation where I need to aggregate data from 4-5 databases into a single database. Specifically it is serial number data. Each database will have its own mapping file, but ultimately the entities all share the same basic structure (Serial class).</p>
<p>I understand NHibernate wants a mapping per class, and so my initial thought was to have a base Serial Class and then inherit from it for each different database and create a unique mapping file (the inherited class would have zero content). This should work great for grabbing all the data and populating the objects. What I would then like to do is save these inherited classes (not sure what the proper term is) to the base class table using the base class mapping.</p>
<p>The problem is I have no idea how to force NHIbernate to use a specific mapping file for an object. Casting the inherited class to the base class does nothing when using 'session.save()' (it complains of no mapping).</p>
<p>Is there a way to explicitly specify which mapping to use? Or is there just some OOP principal I am missing to more specifically cast an inherited class to base class? Or is this idea just a bad one.</p>
<p>All of the inheritance stuff I could find with regards to NHibernate (Chapter 8) doesn't seem to be totally applicable to this function, but I could be wrong (the table-per-concrete-class looks maybe useful, but I can't wrap my head around it totally with regards to how NHibernate figures out what to do).</p>
| [
{
"answer_id": 291994,
"author": "anonymous",
"author_id": 36602,
"author_profile": "https://Stackoverflow.com/users/36602",
"pm_score": 0,
"selected": false,
"text": "public class Serial\n{\n public string SerialNumber {get; set;}\n public string ItemNumber {get; set;}\n public... | 2008/11/11 | [
"https://Stackoverflow.com/questions/281247",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36602/"
] |
281,257 | <p>In an earlier question about <a href="https://stackoverflow.com/questions/280579/c-beginner-help-how-do-i-pass-a-value-from-a-child-back-to-the-parent-form">how to return a string from a dialog window</a>, <strong>yapiskan</strong> suggested <a href="https://stackoverflow.com/questions/280579/c-beginner-help-how-do-i-pass-a-value-from-a-child-back-to-the-parent-form#280731">overloading the child form's ShowDialog() method</a> to include an out parameter.</p>
<p>My question is whether or not this is a good approach in C#.</p>
<p>Here is some example code, based on yapiskan's suggestion. In the child form (in this example, it's a form with a textbox on it), you just need to add the ShowDialog overload and assign UI values to the out parameter:</p>
<pre><code>public DialogResult ShowDialog(out string s)
{
DialogResult result = this.ShowDialog();
s = this.textBox1.Text;
return result;
}
</code></pre>
<p>And to show the form and retrieve the entered text, you do this:</p>
<pre><code>using (CustomDialog frm = new CustomDialog())
{
string s;
if (frm.ShowDialog(out s) == DialogResult.OK)
{
// do something with s
}
}
</code></pre>
<p>One advantage I can think of is that this approach forces the user of the CustomDialog form to get the information it contains through the form's ShowDialog method (rather than from a who-knows-what-it's-called method like GetMyData() or something).</p>
| [
{
"answer_id": 281953,
"author": "Robert Rossney",
"author_id": 19403,
"author_profile": "https://Stackoverflow.com/users/19403",
"pm_score": 2,
"selected": false,
"text": "MyDialog d = new MyDialog();\nd.ShowDialog(\n"
},
{
"answer_id": 281976,
"author": "Erik Forbes",
"... | 2008/11/11 | [
"https://Stackoverflow.com/questions/281257",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14606/"
] |
281,258 | <p>Suppose I have one html page with frames. The left frame is simply a list of links, which will be displayed in the right frame. Is it possible, using javascript, to generate the contents of the left frame when the page loads?</p>
| [
{
"answer_id": 281953,
"author": "Robert Rossney",
"author_id": 19403,
"author_profile": "https://Stackoverflow.com/users/19403",
"pm_score": 2,
"selected": false,
"text": "MyDialog d = new MyDialog();\nd.ShowDialog(\n"
},
{
"answer_id": 281976,
"author": "Erik Forbes",
"... | 2008/11/11 | [
"https://Stackoverflow.com/questions/281258",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34329/"
] |
281,264 | <p>How do I remove empty elements from an array in JavaScript? </p>
<p>Is there a straightforward way, or do I need to loop through it and remove them manually?</p>
| [
{
"answer_id": 281288,
"author": "Matty",
"author_id": 26241,
"author_profile": "https://Stackoverflow.com/users/26241",
"pm_score": -1,
"selected": false,
"text": "function removeEmptyElem(ary) {\n for (var i = ary.length - 1; i >= 0; i--) {\n if (ary[i] == undefined) {\n ... | 2008/11/11 | [
"https://Stackoverflow.com/questions/281264",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8954/"
] |
281,275 | <p>I have two STL containers that I want to merge, removing any elements that appear more than once. For example:</p>
<pre><code>typedef std::list<int> container;
container c1;
container c2;
c1.push_back(1);
c1.push_back(2);
c1.push_back(3);
c2.push_back(2);
c2.push_back(3);
c2.push_back(4);
container c3 = unique_merge(c1, c2);
// c3 now contains the following 4 elements:
// 1, 2, 3, 4
</code></pre>
<p>std::unique seems to be for adjacent elements only, and in my case the containers could be in any order. I could do some <strong>std::set</strong> trickery I guess:</p>
<pre><code>container unique_merge(const container& c1, const container& c2)
{
std::set<container::value_type> s;
BOOST_FOREACH(const container::value_type& val, c1)
s.insert(val);
BOOST_FOREACH(const container::value_type& val, c2)
s.insert(val);
return container(s.begin(), s.end());
}
</code></pre>
<p>Is there a better way or have I missed something bleeding obvious?</p>
| [
{
"answer_id": 281296,
"author": "Eclipse",
"author_id": 8701,
"author_profile": "https://Stackoverflow.com/users/8701",
"pm_score": 4,
"selected": true,
"text": "set_union"
},
{
"answer_id": 281326,
"author": "Chris Morley",
"author_id": 36034,
"author_profile": "htt... | 2008/11/11 | [
"https://Stackoverflow.com/questions/281275",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9236/"
] |
281,276 | <p>Here's an open ended question. I work on a lot of mssql files, and I like to have a date stamp on each. This is so I can know just by looking at the source of a stored procedure whether it's up to date or not.</p>
<p>I'd like to have a shortcut autocomplete key, that, if i type say, d-tab-tab, I get the current date printed to the file. And yes, I am that lazy. :)</p>
<p>So the question is:</p>
<ol>
<li>Is there any way of getting around this problem entirely?</li>
<li>If not, how would you suggest solving it?</li>
</ol>
<p>Clever ideas welcome.</p>
| [
{
"answer_id": 281354,
"author": "Alex B",
"author_id": 6180,
"author_profile": "https://Stackoverflow.com/users/6180",
"pm_score": 0,
"selected": false,
"text": "$Date: $"
}
] | 2008/11/11 | [
"https://Stackoverflow.com/questions/281276",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40352/"
] |
281,300 | <p>I have a collection of items that the user needs to group/categorize in several ways. For the sake of an example, let's say it's a collection of cars and the user wants to categorize them in the following ways:</p>
<ul>
<li>Color (red, silver, blue, black, etc.)</li>
<li>Body shape (hatch, sedan, coupe, stationwagon, etc.)</li>
<li>Seats (2, 4, 5, 6, etc.)</li>
<li>etc.</li>
</ul>
<p>Have you ever come across a particularly elegant way of doing this that allows the user full freedom to define their own categories and values?</p>
<p>Obviously, there will many be trade-offs to make in any design. For example, a learnable design might not be efficient, and vice versa. Or some designs may be more demanding of real estate than others. And some will take significantly longer to develop than others.</p>
<p>Regardless, if you've seen -- or designed -- a good pattern for this, I'd be interested to hear about it. If you have screenshots, all the better.</p>
<p><strong>Attempt at clarification</strong>: tags are indeed a great way of categorizing things, but in all implmentations I've seen, there's only ever one level of tagging. The user doesn't generally get to define a category/property and the item's value <em>in that category</em>. To use the example above and StackOverflow's tagging, you'd tag a car as "blue", "sedan", "4", and so on. StackOverflow would have no inherent knowledge that an item couldn't be tagged as both "sedan" and "coupe".</p>
<p>The interface I'm thinking of would need to know that kind of thing, so the user-defined attributes suggestion is more along the lines of what I'm thinking. I'm just keen to find a concrete example of how that kind of system could be elegantly implemented (in a desktop app, if that makes a difference).</p>
<p>Is that any clearer? If not, leave a comment and I'll try to clarify again. :)</p>
| [
{
"answer_id": 281319,
"author": "Bob",
"author_id": 45,
"author_profile": "https://Stackoverflow.com/users/45",
"pm_score": 1,
"selected": false,
"text": "TagType { Color, Seats, BodyType, Seats }\nTabSubType { Color-Red, Color-Blue, Color-Green, Seats-2, Seats-4, ... }\n"
},
{
... | 2008/11/11 | [
"https://Stackoverflow.com/questions/281300",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8705/"
] |
281,323 | <p>I am attempting to insert a copy of a row from one table into another table with the same schema, with the addition of one column (a timestamp) to provide a "history" of the first table in MS Sql Server 2005.</p>
<p>So, my query, without the additional column would be:</p>
<pre><code>"SELECT INTO [WebsiteHistory] FROM [Website]"
</code></pre>
<p>I want to populate the timestamp column as well, but am not sure how to best do this. I'd like to do something like:</p>
<pre><code>"SELECT Website.*, '" + DateTime.Now.ToShortDateString() + "' INTO [WebsiteHistory] FROM [Website]"
</code></pre>
<p>But that shouldn't work, especially if the timestamp column is not the last one. Is there any way to do this?</p>
| [
{
"answer_id": 281336,
"author": "Tomalak",
"author_id": 18771,
"author_profile": "https://Stackoverflow.com/users/18771",
"pm_score": 5,
"selected": true,
"text": "INSERT\n WebsiteHistory\nSELECT\n *,\n GETDATE()\nFROM\n Website\nWHERE\n Id = @WebsiteId\n"
}
] | 2008/11/11 | [
"https://Stackoverflow.com/questions/281323",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2327/"
] |
281,334 | <p>I have a UL that looks like this:</p>
<pre><code><ul class="popular-pages">
<li><a href="region/us/california/">California</a></li>
<li><a href="region/us/michigan/">Michigan</a></li>
<li><a href="region/us/missouri/">Missouri</a></li>
<li><a href="region/us/new-york/">New York</a></li>
<li><a href="region/us/oregon/">Oregon</a></li>
<li><a href="region/us/oregon-washington/">Oregon; Washington</a></li>
<li><a href="region/us/pennsylvania/">Pennsylvania</a></li>
<li><a href="region/us/texas/">Texas</a></li>
<li><a href="region/us/virginia/">Virginia</a></li>
<li><a href="region/us/washington/">Washington</a></li>
</ul>
</code></pre>
<p>And CSS that looks like this:</p>
<pre><code>ul.popular-pages li a {
display:block;
float:left;
border-right:1px solid #b0b0b0;
border-bottom:1px solid #8d8d8d;
padding:10px;
background-color:#ebf4e0;
margin:2px; color:#526d3f
}
ul.popular-pages li a:hover {
text-decoration:none;
border-left:1px solid #b0b0b0;
border-top:1px solid #8d8d8d;
border-right:none;
border-bottom:none;
}
</code></pre>
<p>So it's working fine in modern browsers, but it's looking like this in IE6. Any suggestions?
<img src="https://thecleverest.com/Picture_26.png" alt="alt text"></p>
| [
{
"answer_id": 281360,
"author": "Arief",
"author_id": 34096,
"author_profile": "https://Stackoverflow.com/users/34096",
"pm_score": 0,
"selected": false,
"text": "*html ul.popular-pages li a { \n display:block; \n float:left; \n border-right:1px solid #b0b0b0; \n border-bott... | 2008/11/11 | [
"https://Stackoverflow.com/questions/281334",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
281,339 | <p>So for the second day in a row, someone has wiped out an entire table of data as opposed to the one row they were trying to delete because they didn't have the qualified where clause.</p>
<p>I've been all up and down the mgmt studio options, but can't find a confirm option. I know other tools for other databases have it.</p>
| [
{
"answer_id": 281344,
"author": "Galwegian",
"author_id": 3201,
"author_profile": "https://Stackoverflow.com/users/3201",
"pm_score": 3,
"selected": false,
"text": "BEGIN TRANSACTION"
},
{
"answer_id": 281392,
"author": "Dave DuPlantis",
"author_id": 8174,
"author_pr... | 2008/11/11 | [
"https://Stackoverflow.com/questions/281339",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36614/"
] |
281,350 | <p>Our windows deliverable has different sets of config files and binary assets for different customers. Right now the configuring is done by hand before packaging and its error prone. What do you think of using branches for each customer, and having the package build/script automerge the customer's branch with trunk?</p>
<p>I'm less concerned with scalability than I am of getting this automated ASAP.</p>
<p>The entire packag contents is in SVN, but SVN branching and merging is so delicate that I don't trust it to work consistently when its automated. If you guys like the idea I might try to use git-svn for this, because it will hopefully make merging less delicate. We don't necessarily have to merge the assets, because they are organized so the installer can just skip inappropriate directory trees, but configuration is not so simple.</p>
| [
{
"answer_id": 281575,
"author": "Brian Schmitt",
"author_id": 30492,
"author_profile": "https://Stackoverflow.com/users/30492",
"pm_score": 0,
"selected": false,
"text": "#If FirstCustomer Then\n ' <code specific to the FirstCustomer version>.\n#ElseIf SecondCustomer Then\n ' <code ... | 2008/11/11 | [
"https://Stackoverflow.com/questions/281350",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20003/"
] |
281,363 | <p>I am using WinCVS as client and CVSNT as my source control server. Some of the files I wanted to add to my CVS repo, were added as Unicode files. Now, I want to recommit the same as ANSI (aka ASCII) files. However, despite deleting the old files from the repo, every time I add the file with the same name, it automatically assigns Unicode encoding to the file. </p>
<p>Is there a way out? Or in other words, can I change the encoding of a file, once it is added to CVS?</p>
| [
{
"answer_id": 281802,
"author": "Ken Gentle",
"author_id": 8709,
"author_profile": "https://Stackoverflow.com/users/8709",
"pm_score": 0,
"selected": false,
"text": "CVSNT"
},
{
"answer_id": 282726,
"author": "Oliver Giesen",
"author_id": 9784,
"author_profile": "htt... | 2008/11/11 | [
"https://Stackoverflow.com/questions/281363",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/382974/"
] |
281,365 | <p>If I have the following code,</p>
<pre><code>Foo *f = new Foo();
vector<Foo*> vect;
vect.push_back(f);
// do stuff
vect.erase(f);
</code></pre>
<p>Did I create a memory leak?
I guess so, but the word <em>erase</em> gives the feeling that it is deleting it. </p>
<p>Writing this, I am wondering if it is not a mistake to put a pointer in a STL vector. What do you think?</p>
| [
{
"answer_id": 281385,
"author": "Johannes Schaub - litb",
"author_id": 34509,
"author_profile": "https://Stackoverflow.com/users/34509",
"pm_score": 4,
"selected": true,
"text": "{ \n boost::shared_ptr<foo> f(new foo);\n\n std::vector< boost::shared_ptr<foo> > v;\n v.push_back(... | 2008/11/11 | [
"https://Stackoverflow.com/questions/281365",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20986/"
] |
281,372 | <p>How do I set up a shell script to execute from the Mac OSX dock? It seems that simply creating a shortcut will open the file in my editor. Is there a flag I need to set somewhere to tell it to run instead of opening it for editing?</p>
| [
{
"answer_id": 281389,
"author": "Jeremy",
"author_id": 1114,
"author_profile": "https://Stackoverflow.com/users/1114",
"pm_score": 6,
"selected": false,
"text": "Example"
},
{
"answer_id": 281455,
"author": "dbr",
"author_id": 745,
"author_profile": "https://Stackove... | 2008/11/11 | [
"https://Stackoverflow.com/questions/281372",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5291/"
] |
281,373 | <p>I am looking for a query that will work on Sharepoint 2003 to show me all the documents created/touched by a given userID.</p>
<p>I have found tables with the documents (Docs) and tables for users (UserInfo, UserData)
but the relationship between seems a bit odd - there are 99,000 records in our userdata table, and 12,000 records in userinfo - we have 400 users!</p>
<p>I suppose I was expecting a simple 1 to many relationship with a user table having 400 records and joining that to the documents table, but I see thats not the case.</p>
<p>Any help would be appreciated.</p>
<p>Edit:
Thanks Bjorn,
I have translated that query back to the Sharepoint 2003 structure:</p>
<pre><code>select
d.* from
userinfo u join userdata d
on u.tp_siteid = d.tp_siteid
and
u.tp_id = d.tp_author
where
u.tp_login = 'userid'
and
d.tp_iscurrent = 1
</code></pre>
<p>This gets me a list of siteid/listid/tp_id's I'll have to see if I can trace those back to a filename / path.
All: any additional help is still appreciated!</p>
| [
{
"answer_id": 283290,
"author": "Bjørn Stærk",
"author_id": 36164,
"author_profile": "https://Stackoverflow.com/users/36164",
"pm_score": 2,
"selected": true,
"text": "select d.* from userinfo u \njoin alluserdata d on u.tp_siteid = d.tp_siteid \nand u.tp_id = d.tp_author \nwhere u.tp_l... | 2008/11/11 | [
"https://Stackoverflow.com/questions/281373",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33186/"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.