input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Silverlight Hosted in Winforms <p>I would like to host a silverlight control in winforms via a winforms browser, but for it to work I need some way for the forms to talk to the silverlight, and also the other way around. Would it be possible to somehow have the two interact with each other using JavaScript as a middle... | <p>I think using the Windows Forms WebBrowser control is your best bet. To do this, you'll need your Silverlight app on a webpage, then you point your WebBrowser at the page's URI.</p>
<p>To keep your WebBrowser control from acting like IE, I'd recommend setting the following:</p>
<pre><code>webBrowser.AllowNavigati... |
How to get a random number in Ruby <p>How do I generate a random number between <code>0</code> and <code>n</code>?</p>
| <p>What is wrong with <a href="http://www.ruby-doc.org/core-2.1.3/Kernel.html#method-i-rand"><code>rand(range)</code></a>?</p>
<p>From <a href="http://www.codeodor.com/index.cfm/2007/3/25/Ruby-random-numbers/1042">Ruby Random Numbers</a>:</p>
<blockquote>
<p>If you needed a random integer to simulate a roll of a si... |
How to best prevent CSRF attacks in a GAE app? <p>So, what is the best way to prevent an XSRF attack for a GAE application? Imagine the following:</p>
<ol>
<li>Anyone can see a user's public object, and the db.Model id is used in the request to figure out which object to show. Malicious user now has the id.</li>
<li... | <p>When you generate the page that lets the user delete an object, generate a random token and include it in a hidden form field. Also set a HTTP-only cookie with that value. When you receive a delete request, check that the random token from the form and the value from the cookie match.</p>
<p>Your random token shoul... |
What are optimal settings for Recycling of Application Pools in IIS7 in shared environment? <p>What are optimal settings for Recycling of Application Pools in IIS7 in a shared environment?</p>
<p><img src="http://i.stack.imgur.com/RNQo8.png" alt="enter image description here"></p>
| <p>As a Hoster, you definitely want to recycle on Memory & Time, potentially Request limits and CPU. You want to be pretty aggressive about these limits, but make sure you publish them to your clients.</p>
<p><a href="https://technet.microsoft.com/en-us/library/cc725749(v=ws.10).aspx" rel="nofollow"><strong>Memor... |
Multiple Data Tables in PHP/MySQL? <p>In asp.net, you can retrieve MULTIPLE datatables from a single call to the database. Can you do the same thing in php?</p>
<p>Example:</p>
<pre><code>$sql ="select * from t1; select * from t2;";
$result = SomeQueryFunc($sql);
print_r($result[0]); // dump results for t1
print_r($... | <p>This is called "multi-query." The mysql extension in PHP does not have any means to enable multi-query. The mysqli extension does allow you to use multi-query, but only through the multi_query() method. See <a href="http://php.net/manual/en/mysqli.multi-query.php" rel="nofollow">http://php.net/manual/en/mysqli.mu... |
JQuery Select Box and Loop Help <p>Thanks for reading. I'm a bit new to jQuery, and am trying to make a script I can include in all my websites to solve a problem that always drives me crazy...</p>
<p>The problem:
Select boxes with long options get cut off in Internet Explorer. For example, these select boxes:
<a href... | <p>To modify each select, try this:</p>
<pre><code>$('select').each(function(){
$('option', this).each(function() {
// your normalizing script here
})
});
</code></pre>
<p>The second parameter (this) on the second jQuery call scopes the selecter ('option'), so it is essentially 'all option elements within ... |
ColdFusion web.xml? <p>Is there a ColdFusion analog for the deployment descriptor/web.xml file found in a J2EE web container? I know CF is running on top of JRun and that I could just tweak the JRun dd, but what about an application-specific configuration file? Is there something like this that I'm not aware of or do y... | <p>ColdFusion 8 has several application-specific configurations that can be set in the application.cfc file</p>
<p>application.cfc also implements several "general events" which occur during application execution. </p>
|
DoubleRenderError in restful_authentication with acts_as_state_machine when activating users <p>In a project which uses <code>restful_authentication</code> with <code>acts_as_state_machine</code> and email activation, I get a double render error whenever a user does the activation action from the email link.</p>
<p>I'... | <p>Acts As State Machine will sometimes have some odd behavior where the saved record written to the database will be out of sync with the object in memory. I bet you have a situation where the ruby object corresponding to the newly activated user is not being updated even though the field in the db is being set (of vi... |
Does Google Maps respect the <BalloonStyle> definition in KML? <p>I'm using the GGeoXml object to overlay KML on an embedded Google Map. I need to customize the popup balloon for placemarks, so I'm trying to use the <a href="http://code.google.com/apis/kml/documentation/kmlreference.html#balloonstyle" rel="nofollow"><c... | <p>This is now documented here (2009/04):</p>
<p><a href="http://code.google.com/apis/kml/documentation/kmlelementsinmaps.html" rel="nofollow">http://code.google.com/apis/kml/documentation/kmlelementsinmaps.html</a></p>
<ul>
<li>< BalloonStyle > no</li>
</ul>
<p>(When did you ask this ? This forum/service needs a... |
How can I add an image to my Run for a RichTextBlock? <p>I wrote a small WPF app where I like to prepend text into a RichTextBox, so that the newest stuff is on top. I wrote this, and it works: </p>
<pre><code> /// <summary>
/// Prepends the text to the rich textbox
/// </summary>
/// <param name="te... | <p>Try the following:</p>
<pre><code>BitmapImage bi = new BitmapImage(new Uri(@"C:\SimpleImage.jpg"));
Image image = new Image();
image.Source = bi;
InlineUIContainer container = new InlineUIContainer(image);
Paragraph paragraph = new Paragraph(container);
RichTextBoxOutput.Document.Blocks.Add(paragraph);... |
Is it possible to initialize a const struct without using a function? <p>I have a fairly simple const struct in some C code that simply holds a few pointers and would like to initialize it statically if possible. Can I and, if so, how?</p>
| <p>You can, if the pointers point to global objects:</p>
<pre><code>// In global scope
int x, y;
const struct {int *px, *py; } s = {&x, &y};
</code></pre>
|
How to detect what .NET Framework versions and service packs are installed? <p>A similar question was asked <a href="http://stackoverflow.com/questions/198931/how-do-i-tell-if-net-35-sp1-is-installed">here</a>, but it was specific to .NET 3.5. Specifically, I'm looking for the following:</p>
<ol>
<li>What is the corre... | <p>The registry is <a href="https://msdn.microsoft.com/en-us/library/hh925568(v=vs.110).aspx">the official way</a> to detect if a specific version of the Framework is installed. </p>
<p><img src="http://i.stack.imgur.com/hiLch.png" alt="enter image description here"></p>
<p>Which registry keys are needed change depen... |
How do I increase the /proc/pid/cmdline 4096 byte limit? <p>For my Java apps with very long classpaths, I cannot see the main class specified near the end of the arg list when using ps. I think this stems from my Ubuntu system's size limit on /proc/pid/cmdline. How can I increase this limit?</p>
| <p>For looking at Java processes <a href="http://download.oracle.com/javase/6/docs/technotes/tools/share/jps.html">jps</a> is very useful.</p>
<p>This will give you the main class and jvm args:</p>
<pre><code>jps -vl | grep <pid>
</code></pre>
|
Is there any way to get python omnicomplete to work with non-system modules in vim? <p>The only thing I can get python omnicomplete to work with are system modules. I get nothing for help with modules in my site-packages or modules that I'm currently working on.</p>
| <p>Once I generated ctags for one of my site-packages, it started working for that package -- so I'm guessing that the omnicomplete function depends on ctags for non-sys modules.</p>
<p>EDIT: Not true at all.</p>
<p>Here's the problem -- poor testing on my part -- omnicomplete WAS working for parts of my project, jus... |
How do I reverse a UTF-8 string in place? <p>Recently, someone asked about an <a href="http://stackoverflow.com/questions/198199/how-do-you-reverse-a-string-in-place-in-c-or-c">algorithm for reversing a string in place in C</a>. Most of the proposed solutions had troubles when dealing with non single-byte strings. So, ... | <p>I'd make one pass reversing the bytes, then a second pass that reverses the bytes in any multibyte characters (which are easily detected in UTF8) back to their correct order.</p>
<p>You can definitely handle this in line in a single pass, but I wouldn't bother unless the routine became a bottleneck.</p>
|
What's the best way to embed IronPython inside my C# App? <p>I have an application used by pretty tech-savey people and they want small island of programmability so I've used embedded Iron Python.</p>
<p>However, since IronPython 2.0 Eval() doesn't work any more. Specifically I can't both load modules and inject local... | <p>Could you be a little more specific about the problem, and maybe provide a code example? The "eval"-style functionality is definitely still present, though as you've noticed, the hosting interface has changed considerably since 1.0.</p>
<p>This works in beta 5:</p>
<pre><code>ScriptEngine engine = Python.CreateEn... |
Whats the main difference between int.Parse() and Convert.ToInt32 <p>I am using C#,and wanted to know the main difference between the two and which one is preferred to use while coding. </p>
| <ul>
<li><p>If you've got a string, and you expect it to always be an integer (say, if some web service is handing you an integer in string format), you'd use <a href="http://msdn.microsoft.com/en-us/library/system.int32.parse.aspx"><strong><code>Int32.Parse()</code></strong></a>. </p></li>
<li><p>If you're collecting... |
Code review for VS <p>looking for a good code review tool that plugs in nicely to Visual Studio. Would be nice if it could diff from different source control providers, like Source Safe, The Vault, and/or Subversion.</p>
| <p>I have used <a href="http://www.smartbear.com/codecollab.php" rel="nofollow">code collaborator</a> in the past. It is not integrated with Visual Studio but I would not let that stop you. </p>
<p>All our Windows developers had no problem using it and since the reviews is done online, you are not using the IDE during... |
I've never encountered a well written business layer. Any advice? <p>I look around and see some great snippets of code for defining rules, validation, business objects (entities) and the like, but I have to admit to having never seen a great and well-written business layer in its entirety.</p>
<p>I'm left knowing what... | <blockquote>
<p>Iâve never encountered a well written business layer.</p>
</blockquote>
<p>Here is <a href="http://thedailywtf.com/Articles/The-Mythical-Business-Layer.aspx">Alex Papadimoulis's take on this</a>:</p>
<blockquote>
<p><em>[...] If you think about it, virtually every line of code in a software
ap... |
Get last answer <p>In many symbolic math systems, such as Matlab or Mathematica, you can use a variable like <code>Ans</code> or <code>%</code> to retrieve the last computed value. Is there a similar facility in the Python shell?</p>
| <p>Underscore.</p>
<pre><code>>>> 5+5
10
>>> _
10
>>> _ + 5
15
>>> _
15
</code></pre>
|
Suggestions for a Web application for a group project <p>I am doing 2nd year computer science and we have a software engineering group project. There are 5 people in the group and we would like to build a web application in php. Please suggest some ideas for me </p>
| <p>Have a look a Paul Graham's list of "Startup Ideas We'd Like to Fund" - lots more ideas and the CMS has been done to death.</p>
<p><a href="http://ycombinator.com/ideas.html">http://ycombinator.com/ideas.html</a></p>
<p>The list in short:</p>
<ol>
<li>A cure for the disease of which the RIAA is a symptom.</li>
<l... |
How do you convert a C++ string to an int? <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/194465/how-to-parse-a-string-to-an-int-in-c">How to parse a string to an int in C++?</a> </p>
</blockquote>
<p>How do you convert a C++ string to an int?</p>
<p>Assume... | <pre><code>#include <sstream>
// st is input string
int result;
stringstream(st) >> result;
</code></pre>
|
How do I convert CSV into an HTML table using Perl? <p>In my code, I want to view all data from a CSV in table form, but it only displays the last line. How about lines 1 and 2? Here's the data:</p>
<pre><code>1,HF6,08-Oct-08,34:22:13,df,jhj,fh,fh,ffgh,gh,g,rt,ffgsaf,asdf,dd,yoawa,DWP,tester,Pattern
2,hf35,08-Oct-08,3... | <p>You need to output the table rows <em>inside</em> the while loop, as that's where you are reading the lines.</p>
<p>So change the code so that it</p>
<ul>
<li>outputs table headers</li>
<li>reads the file line by line outputting table rows</li>
<li>outputs table footer</li>
</ul>
<p>Here's how your loop might loo... |
Apache commons httpclient - disable debugging / lower debuglevel <p>i am using the apache commons httpclient in a lotus notes java agent and it works fine. BUT when establishing a proxy connection the log will be spamed with the following line :</p>
<pre><code>[INFO] AuthChallengeProcessor - basic authentication schem... | <p>you should be able to set the logging level to something less spammy. there are a few default <a href="http://hc.apache.org/httpclient-3.x/logging.html" rel="nofollow">logging options</a>, so it depends on the logging method you chose.</p>
<p>it sounds like your logging level is set to "debug" or "info" and should ... |
Can you use an alias in the WHERE clause in mysql? <p>I need to use an alias in the WHERE clause, but It keeps telling me that its an unknown column. Is there any way to get around this issue? I need to select records that have a rating higher than x. Rating is calculated as the following alias:</p>
<pre><code>sum(rev... | <p>You could use a HAVING clause, which <em>can</em> see the aliases, e.g.</p>
<pre><code> HAVING avg_rating>5
</code></pre>
<p>but in a where clause you'll need to repeat your expression, e.g. </p>
<pre><code> WHERE (sum(reviews.rev_rating)/count(reviews.rev_id))>5
</code></pre>
<p>BUT! Not all expressions w... |
How do I remove a cookie that I've set on someone's computer? <p>I've got a web system where users log in, and it stores a cookie of their session. When they log in as someone else or log out I want to remove that original cookie that I stored. What's the best way to do that?
I'm using Python and Apache, though I suppo... | <p>Set the cookie again, as if you hadn't set it the first time, but specify an expiration date that is in the past.</p>
|
What is the technical term for C# or Java type languages? <p>This is probably a very simple question, but what is the technical term for this class of language? </p>
<p>They use an "intermediate" assembly type language which is sent through the JVM or CLR. They both are object oriented and they both depend on an int... | <p>A key difference between C++ and .NET/Java is the automatic reclaiming of memory that is no longer required. This is known as <strong>garbage collection</strong>. For this property, they are known as <strong>managed</strong> platforms.</p>
<p>Both Java/.NET delay the compilation of bytecode into native code until... |
Removing one Installer from another installer <p>I have created a custom intall dll & everything is working fine.I just want to call another installer's Uninstall method from my current installation.When i do this i get error code 1618(signifies another installer is already running).However when i call the uninstal... | <p>AFAIK calling an installer (either to install or uninstall) from another installer is not supported. It was supported in earlier versions of Windows Installer, but is now deprecated, and even then I'm not sure uninstallation of an other product was supported.
The recommended way now is to use a bootstrapper to check... |
Are there design patterns on modelling a structure containing Teams, Roles and Skills? <p>I need to model a system where by there will be a team who will consist of users who perform roles in the team and have skills assigned to them.</p>
<p><em>i.e. a team A 5 members, one performs the team leader role, all perform t... | <p>I Googled this, so take it with a grain of salt. I found this <a href="http://www.riehle.org/computer-science/research/1997/ubilab-tr-1997-1-1.pdf" rel="nofollow">paper</a> on Role Modeling and Objects. On page 30 there is a Role Pattern. Hopefully this is not a wild goose chase for you. Here is the summary</p>
... |
Please recommend me a professional keepalive solution for our monitoring server <p>I'm looking for a tool that can be installed on our monitoring server and which allows us to perform scheduled requests to our web sites in order to keep them from shutting down (asp.net).</p>
<p>I don't want to use a web service since ... | <p>What about using <a href="http://users.ugent.be/~bpuype/wget/" rel="nofollow">wget for Windows</a> and a scheduled task?</p>
|
Update column from another table - mySQL 3.5.2 <p>I've tried a couple of approaches to update a column in a mySQL database table from another table but am not having any luck. </p>
<p>I read somewhere that version 3.5.2 does not support multi-table updates and I need a code-based solution - is that correct?</p>
<p>If... | <p>When I used to use MySQL that did not support either subqueries or multi-table updates, I used a trick to do what you're describing. Run a query whose results are themselves SQL statements, and then save the output and run that as an SQL script.</p>
<pre><code>SELECT CONCAT(
'UPDATE products SET products_ordere... |
Style sheet images aren't reloaded by Firefox or Safari <p>We have found out that Firefox (at least v3) and Safari don't properly cache images referenced from a css file. The images are cached, but they are never refreshed, even if you change them on the server. Once Firefox has the image in the cache, it will never ch... | <p>I would just add a querystring value to the image url. I usually just create a "version number" and increment it every time the image changes:</p>
<pre><code>div#news {
background: url(images/newsitem_background.jpg?v=00001) no-repeat;
...
}
</code></pre>
|
To which kind of problem is functional programming well suited? <p>Functional programming seems to be a paradigm in computer science which has more and more echo.</p>
<p>I wonder which kind of problems are better solved with a functional programming approach rather than with a more traditional object oriented approach... | <p>This is close to these other questions.</p>
<p><a href="http://stackoverflow.com/questions/36504/why-functional-languages">Why functional languages?</a></p>
<p><a href="http://stackoverflow.com/questions/128057/what-are-the-benefits-of-functional-programming">What are the benefits of functional programming?</a></p... |
Trapping messages in MFC - Whats the difference? <p>I was just wondering what (if any) the difference was between the following two message traps in MFC for the function, OnSize(..).</p>
<h1>1 - Via Message map:</h1>
<pre><code>BEGIN_MESSAGE_MAP(CClassWnd, CBaseClassWnd)
...
ON_WM_SIZE()
..
END_MESSAGE_MAP()
</co... | <p>Both parts are necessary to add a message handler to a class. The message map should be declared inside your class, together with declarations for any message handler functions (e.g, <code>OnSize</code>).</p>
<pre><code>class CClassWnd : public CBaseClassWnd {
...
afx_msg void OnSize(UINT nType, int cx, int... |
Are PHP short tags acceptable to use? <p>Here's the information <a href="http://www.php.net/manual/en/language.basic-syntax.php">according to the official documentation</a>:</p>
<blockquote>
<p>There are four different pairs of
opening and closing tags which can be
used in PHP. Two of those, <code><?php ?>... | <p>They're not recommended because it's a PITA if you ever have to move your code to a server where it's not supported (and you can't enable it). As you say, lots of shared hosts <em>do</em> support shorttags but "lots" isn't all of them. If you want to share your scripts, it's best to use the full syntax.</p>
<p>I ag... |
How can I do access control via an SQL table? <p>I'm trying to create an access control system. </p>
<p>Here's a stripped down example of what the table I'm trying to control access to looks like:</p>
<pre><code>things table:
id group_id name
1 1 thing 1
2 1 thing 2
3 1 thing 3... | <p>I just read a paper last night on this. It has some ideas on how to do this. If you can't use the link on the title try using Google Scholar on <a href="http://portal.acm.org/citation.cfm?id=1316701" rel="nofollow">Limiting Disclosure in Hippocratic Databases.</a></p>
|
How to dynamically set which properties get bound to a DataGridView? <p>My DataGridView needs to support a number of types and these types may have any number of public properties, not all of which I want to display.</p>
<p>Can anyone suggest a way to dynamically customise a DataGridView's columns when binding a class... | <p>By default (with auto column generation enabled), it will simply obtain (via ComponentModel) the <code>[Browsable(true)]</code> properties, (or those that omit this attribute).</p>
<p>If this is the <em>only</em> use of binding for this data, you could add <code>[Browsable(false)]</code> to the properties you don't... |
Can an Adobe AIR Application run via the command line output to console? <p>I have an AIR application that takes command-line arguments via onInvoke. All is good, but I cannot figure out how to print some status messages back to the user (to stdout / console, so to speak). Is it possible?</p>
<p>Even a default log fil... | <p>Take a look at <a href="http://www.mikechambers.com/blog/2008/01/17/commandproxy-net-air-integration-proof-of-concept/" rel="nofollow">CommandProxy</a>. It is a low level wrapper around your AIR application that lets you send command from AS3 back to the proxy for communicating with the underlying OS. You should be ... |
ASP.NET: Popup browser windows and session cookies <p>SUMMARY: When browsing an ASP.NET website using Windows Explorer, popup windows do not "borrow" the session cookie from the parent window.</p>
<p>DETAILS:</p>
<p>I'm working on an ASP.NET website (.NET 2.0). I use FormsAuthentication. It is a requirement to use co... | <p>My suspicion here is that when opened from Windows Explorer (not that I fully understand what you mean by this), the session cookie that is being sent back is not stored anywhere and thus not available for the pop up window to include with its request. I don't see how you can get around this. Is it not possible to... |
Retrieving values in reflected types from reflected properties <p>I need to access some members marked internal that are declared in a third party assembly.</p>
<p>I would like to return a value from a particular internal property in a class. Then I'd like to retrieve a value from a property on that returned value. Ho... | <p>You just keep digging on the returned value (or the PropertyType of the PropertyInfo):</p>
<p>u</p>
<pre><code>sing System;
using System.Reflection;
public class Foo
{
public Foo() {Bar = new Bar { Name = "abc"};}
internal Bar Bar {get;set;}
}
public class Bar
{
internal string Name {get;set;}
}
static... |
Embedding Intellisense Xml Documentation in Assembly? <p>I have an assembly containing very thorough XML-based documentation, which is used through Sandcastle to generate the help-files for the product. We also use the output XML files for providing proper Intellisense in Visual Studio when programmers use the assembly... | <p>Unfortunately you will need to supply both as Visual Studio only knows to look at XML documents for Intellisense.</p>
|
Find all storage devices attached to a Linux machine <p>I have a need to find all of the writable storage devices attached to a given machine, <strong>whether or not</strong> they are mounted.</p>
<p>The dopey way to do this would be to <em>try</em> every entry in <code>/dev</code> that corresponds to a writable devic... | <p><code>/proc/partitions</code> will list all the block devices and partitions that the system recognizes. You can then try using <code>file -s <device></code> to determine what kind of filesystem is present on the partition, if any.</p>
|
How to decode a CSR File? <p>I ran accross a CSR file (Certificate Signing Request) and I need to extract some information from it.</p>
<p>There's a way to decode it using .NET Framework?</p>
| <p>It's not .NET, but for interactive use, try the OpenSSL utilities. Specifically:</p>
<pre><code>openssl req -text -in request.csr
</code></pre>
|
Be notified when visual/logical child added/removed <p>I am currently looking for a way to be notified when a child is added to the visual or logical children.</p>
<p>I am aware of the Visual::OnVisualChildrenChanged method, but it does not apply to me since I can't always inherit and override this function. I am loo... | <p>Isn't it easier to extend </p>
<pre><code>System.Windows.Controls.UIElementCollection
</code></pre>
<p>to do the notification and use</p>
<pre><code>protected override UIElementCollection CreateUIElementCollection(FrameworkElement logicalParent)
</code></pre>
<p>?</p>
|
Mounting/Unmounting USB disks on Windows <p>On Windows Server, by default, external USB disks don't always get mounted. I'd like my program (written in C#) to be able to detect external USB disks, identify them, and then mount them.</p>
<p>When it's finished, it should do whatever the programmatic equivalent of "Safel... | <p>This article at The Code Project may help:</p>
<p><a href="http://www.codeproject.com/KB/system/DriveDetector.aspx" rel="nofollow">http://www.codeproject.com/KB/system/DriveDetector.aspx</a></p>
|
Is it possible to host a TCP endpoint in an IIS6 hosted service? <p>I created a wcf service based on ServiceHostFactory, and i'm hosting it in IIS6.
If i use a HTTP endpoint everything works just fine, but when i try to switch to TCP it goes bad.</p>
<p>Is it even possible to do this in II6?</p>
<p>I have a more spec... | <p>IIS 5.1 and IIS 6 can only host HTTP bindings. IIS7 has WAS (Windows Activation Service) which allows hosting of endpoints bound to any transport protocol... so it would be capable of TCP.</p>
<p>If you must host with IIS 6, then you're stuck with the HTTP bindings. If not, consider self-hosting in a Windows Serv... |
What is the most efficient way to handle en expired session with ASP.NET 2.0 <p>On the site we are building. We need to be able to redirect the user to a default page when his session has ended.</p>
<p>At first sight we used the Session_End with a Response.Redirect to do this job.</p>
<pre><code>Sub Session_End(ByVal... | <p>We added the following code to the global.asax.cs file: </p>
<pre><code> private void IsAuthenticated()
{
string vFileName = Path.GetFileName(HttpContext.Current.Request.Path);
string vExt = Path.GetExtension(vFileName).ToLower();
if ((vFileName != "Login.aspx") && (vExt == ".as... |
C# Inheritance <p>I had a coworker see this the other day and I'm not quite sure why this happened. Can anyone explain it?</p>
<p>We have class A:</p>
<pre><code>using System;
using System.Data;
public class A
{
protected DataTable _table;
public A()
{
}
}
</code></pre>
<p>We have class B that inherits fr... | <p>This is not a language issue - if anything, you could call it an IDE issue, for not adding the using statement when creating the new class. Even then, the IDE does not know you will be accessing this member, and I prefer to keep my "usings" as minimal as possible. In any case, the fact that B extends A does not t... |
Visual Studio debugger tips & tricks for .NET <p>I've been working for years with VS's debugger, but every now and then I come across a feature I have never noticed before, and think "Damn! How could I have missed that? It's <strong>so</strong> useful!"</p>
<p>[Disclaimer: These tips work in VS 2005 on a C# project, n... | <pre><code>try {
// do something big
}
catch {
// breakpoint set here:
throw CantHappenException("something horrible happened that should never happen.");
}
</code></pre>
<p>How do you see the exception that was originally thrown? In a watch window, enter $exception</p>
|
How can I code desktop monitoring software? <p>I have to develop a tool for monitoring helpdesk agents. I can figure out how to capture keyboard events and mouse events; however I need to capture the control that emitted/consumed the event too. Is it possible to find that out?</p>
| <p>You need windows hooks to pick up the events. These are really the province of native code. Try asking again with Win32 tag replacing the C# tag.</p>
|
How should I add multiple identical elements to a div with jQuery <p>I need to add multiple empty divs to a container element using jQuery.</p>
<p>At the moment I am generating a string containing the empty html using a loop</p>
<pre><code>divstr = '<div></div><div></div>...<div></div... | <p>If you want IE to be fast - or generally consider speed, then you'll want to build up a DOM fragment first before inserting it.</p>
<p>John Resig explains the technique and includes a performance benchmark:</p>
<p><a href="http://ejohn.org/blog/dom-documentfragments/">http://ejohn.org/blog/dom-documentfragments/</... |
Identifying COM components in a .NET application <p>I've inherited a .NET application that pulls together about 100 dlls built by two teams or purchased from vendors. I would like to quickly identify whether a given dll is a .NET assembly or a COM component. I realize that I could just invoke ildasm on each dll individ... | <p>You can always try to add the "Assembly Version" column to the Explorer Window, and note which ones are blank to find the non-.NET assemblies.</p>
|
How do I un-escape XML entities easily in .NET <p>I have some code which returns InnerXML for a XMLNode.</p>
<p>The node can contain just some text (with HTML) or XML.</p>
<p>For example:</p>
<pre><code><XMLNode>
Here is some &lt;strong&gt;HTML&lt;/strong&gt;
<XMLNode>
</code></pre>
... | <p>why not inserting them as &lt; and &gt; ? you avoid mixing xml and custom markup stuff with this...</p>
|
How to integrate Geronimo's transaction manager in Tomcat? <p>Does Geronimo provides a standalone transaction manager?
And if it does, is it possible to use it in Tomcat?</p>
| <p><a href="http://openejb.apache.org/" rel="nofollow">Apache OpenEJB</a> is embedded implementation of Geronimo EJB container that includes Transaction Manager. OpenEJB can be embedded into Tomcat which is one of its intended usages.</p>
|
How do I create a named log in $TOMCAT_HOME/logs for my servlet? <p>I'm currently logging via the simplest of methods within my servlet using Tomcat. I use the ServletConfig.getServletContext().log to record activity. This writes to the localhost.YYYY-MM-DD.log in $TOMCAT_HOME/logs.</p>
<p>I don't want to get away f... | <p>For Tomcat 6.x, you can change the logging configuration in conf/logging.properties.</p>
<p>But I prefer a separate configuration with Log4j...</p>
|
Where can I find examples of element heavy web forms? <p>I would like to look at some examples of some good form layouts (web-based) that have a lot of input fields. I do a lot of web application development and a lot of my forms are input element heavy so I am always looking for good ideas on how to display my forms. ... | <p>I always like visiting <a href="http://wufoo.com/gallery/">Wufoo</a> whenever I need some form inspiration.</p>
|
Do you know of any IDEs that are localized to Spanish? <p>I have a buddy that's having a hard time with the language barrier. I tried to think of any IDEs that are also available in Spanish, but couldn't think of any. Any ideas?</p>
| <p>Microsoft Visual Studio is avaible in spanish<br />
<a href="http://en.wikipedia.org/wiki/Microsoft_Visual_Studio" rel="nofollow">http://en.wikipedia.org/wiki/Microsoft_Visual_Studio</a><br />
<a href="http://msdn.microsoft.com/en-gb/vstudio/default.aspx" rel="nofollow">http://msdn.microsoft.com/en-gb/vstudio/defaul... |
Linq to SQL: .FirstOrDefault() not applicable to select new { ... } <p>I just asked <a href="http://stackoverflow.com/questions/201686/linq-to-sql-select-optimization">this question</a>. Which lead me to a new question :)</p>
<p>Up until this point, I have used the following pattern of selecting stuff with Linq to SQL... | <p>Why can you keep doing the samething? Is it giving you an error?</p>
<pre><code>var person = (from p in [DataContextObject].Persons
where p.PersonsID == 1
select new { p.PersonsID, p.PersonsAdress, p.PersonsZipcode }).FirstOrDefault();
if (person == null) {
// handle 0 "rows" r... |
How do I solve "index unique_schema_migrations already exists" in Rails? <p>Running <code>rake db:migrate</code> followed by <code>rake test:units</code> yields the following:</p>
<pre><code>rake test:functionals
(in /projects/my_project)
rake aborted!
SQLite3::SQLException: index unique_schema_migrations already exis... | <p>In SQLite, index name uniqueness is enforced at the database level. In MySQL, uniqueness is enforced only at the table level. That's why your migrations work in the latter and not the former: you have two indexes with the same name on different tables.</p>
<p>Rename the index, or find and rename the other <code>u... |
Using server-side XML Parser to generate HTML content <p>Is it possible using a server side XML parser to have it create an HTML blob that is then included in an existing HTML page?</p>
| <p>Is the existing HTML page already being served by the same server? If so, then yes - arguably that's a rough description of what almost all web frameworks do, to a greater or lesser extent: insert some dynamic content within a static template.</p>
<p>Which bit are you concerned about?</p>
|
can realloc Array, then Why use pointers? <p>This was an job placement interview I faced. They asked whether we can realloc Array, I told yes. Then They asked - then why we need pointers as most of the people give reason that it wastes memory space. I could not able to give satisfactory answer. If any body can give any... | <p>You can only reallocate an array that was allocated dynamically. If it was allocated statically, it cannot be reallocated [safely].*</p>
<p>Pointers hold addresses of data in memory. They can be allocated, deallocated, and reallocated dynamically using the new/delete operators in C++ and malloc/free in C.</p>
<p>I... |
How can I determine the last time any record changed in a specific Sql Server 2000 database? <p>I have a SQL Server 2000 database instance that is rarely updated. I also have a database table which has no columns holding each row's created date or modified date. </p>
<p>Is there any way that I can determine the last... | <p>The database's log file may have some information that is useful to your quest. AFAIK, the database itself doesn't store a "last updated" date.</p>
|
How do I set up a timer to prevent overlapping ajax calls? <p>I have a page where search resuts are shown both in a grid and on a map (using KML generated on the fly, overlaid on an embedded Google map). I've wired this up to work as the user types; here's the skeleton of my code, which works:</p>
<pre><code>$(functio... | <p>Instead of calling <code>update()</code> directly, call a wrapper that checks to see if there are any pending delayed updates:</p>
<pre><code>$('input.Search').bind("keyup", delayedUpdate);
function delayedUpdate() {
if (updatePending) {
clearTimeout(updatePending);
}
updatePending = setTimeou... |
Run a XNA compiled game from DVD or CD on XBOX 360? <p>Is it possible to run a XNA game compiled for XBOX 360 from a DVD or CD, or does it have to be copied onto the HD?</p>
<p>Is it possible to include a library which is not a part of the .net compact framework in a XBOX 360 project?</p>
| <p>XNA games must be copied to the 360 using the XNA game launcher. They can not be loaded off a CD/DVD.</p>
<p>You can use other libraries on the 360, but they have to be compiled using the XBox's .net libraries. So unless you have access to source code, or are willing to decompile and change all references to frame... |
What's a nice way of building a wParam or lParam in C#? (Something friendlier than shift operators?) <p>When the WIN32 docs says something like:</p>
<pre><code>wParam
The low-order word specifies the edit control identifier.
The high-order word specifies the notification message.
</code></pre>
<p>What's a nic... | <pre><code>public static ushort LowWord(uint val)
{
return (ushort)val;
}
public static ushort HighWord(uint val)
{
return (ushort)(val >> 16);
}
public static uint BuildWParam(ushort low, ushort high)
{
return ((uint)high << 16) | (uint)low;
}
</code></pre>
|
Is there a convenient way to wrap std::pair as a new type? <p>Often times I find myself using std::pair to define logical groupings of two related quantities as function arguments/return values. Some examples: row/col, tag/value, etc.</p>
<p>Often times I should really be rolling my own class instead of just using std... | <p>This is what <a href="http://www.boost.org/doc/libs/1_36_0/libs/tuple/doc/tuple_users_guide.html" rel="nofollow">Boost.Tuple</a> was made for.</p>
<p>But you should probably be using <a href="http://en.cppreference.com/w/cpp/utility/tuple" rel="nofollow">std::tuple</a> now...</p>
|
ASP.NET MVC Preview 5 on Mono <p>Does anyone have any information about getting the current versions of ASP.NET MVC (Preview 5) working on Mono 2.0? There was info on the old versions (Preview 2, maybe Preview 3), but I've seen no details about making Preview 5 actually work.</p>
<p>The <a href="http://www.mono-projec... | <p>Well a potential is that RewritePath to / has some sort of bug, so just avoid that. Changing the RewritePath(Request.ApplicationPath) to:</p>
<pre><code>HttpContext.Current.RewritePath("/Home/Index");
</code></pre>
<p>Seems to fix the problem, and at least the demo works so far. </p>
|
How hard is it to incorporate full text search with SQL Server? <p>I am building a C#/ASP.NET app with an SQL backend. I am on deadline and finishing up my pages, out of left field one of my designers incorporated a full text search on one of my pages. My "searches" up until this point have been filters, being able to ... | <p>First off, you need to enabled Full text Searching indexing on the production servers, so if thats not in scope, your not going to want to go with this.</p>
<p>However, if that's already ready to go, full text searching is relatively simple.</p>
<p>T-SQL has 4 predicates used for full text search:</p>
<ul>
<li>FR... |
Does Windows Powershell have a Try/Catch or other error handling mechanism? <p>In a script, when a command-let or other executable statement errors out, is there a try/catch type of mechanism to recover from these errors? I haven't run across one in the documentation.</p>
| <p>You use a <code>Trap [exception-type] {}</code> block before the code you want to handle exceptions for.</p>
|
Calling a C# web service from with PHP with a long parameter <p>We have a customer that is trying to call our web service written in C# from PHP code. The web service call takes a long as parameter.</p>
<p>This call works fine for other customers calling from C# or Java but this customer is getting an error back from ... | <p>Most PHP installations won't support 64 bit integers - 32 is the max. You can check this by reading the PHP_INT_SIZE constant (4 = 32bit, 8 = 64bit) or read the PHP_INT_MAX value.</p>
<pre><code><?php
echo PHP_INT_SIZE, "\n", PHP_INT_MAX;
?>
</code></pre>
<p>If the web service class he is using is trying ... |
When should I write Static Methods? <p>So I understand what a static method or field is, I am just wondering when to use them. That is, when writing code what design lends itself to using static methods and fields. </p>
<p>One common pattern is to use static methods as a static factory, but this could just as easily b... | <p>Static methods are usually useful for operations that don't require any data from an instance of the class (from <code>this</code>) and can perform their intended purpose solely using their arguments.<br />
A simple example of this would be a method <code>Point::distance(Point a, Point b);</code> that calculates the... |
How do I reuse a command in bash with different parameters? <p>I have two scripts that often need to be run with the same parameter:</p>
<pre><code>$ populate.ksh 9241 && check.ksh 9241
</code></pre>
<p>When I need to change the parameter (<strong>9241</strong> in this example), I can go back and edit the lin... | <p>In bash:</p>
<pre><code>!!:gs/9241/9243/
</code></pre>
<p>Yes, it uses <code>gs///</code>, not <code>s///g</code>. :-)</p>
<p>(zigdon's answer uses the last command starting with <code>pop</code>, such as <code>populate.sh</code>. My answer uses the last command, full stop. Choose which works for you.)</p>
|
How do I detect a null reference in C#? <p>How do I determine if an object reference is null in C# w/o throwing an exception if it is null?</p>
<p>i.e. If I have a class reference being passed in and I don't know if it is null or not.</p>
| <p>testing against null will never* throw an exception</p>
<pre><code>void DoSomething( MyClass value )
{
if( value != null )
{
value.Method();
}
}
</code></pre>
<hr>
<p>* never as in <em>should never</em>. As @Ilya Ryzhenkov points out, an <em>incorrect</em> implementation of the != operator for... |
What causes error 4063 - Database ...databasename... has not been opened yet <p>I have an scheduled agent that is trying to access a database on another server. When it runs I get an error 4063 - Database ...databasename... has not been opened yet.</p>
<p>The servers is listed in the ACL as manager.</p>
<p>What are ... | <p>Does the other server trust the server executing the agent? Check the server document -> Security -> Trusted servers.</p>
|
Web Apps for Source Code Discussion <p>Are there any web apps that allow for source code collaboration? I'm thinking of something that could look at an SVN repo/local folder/etc. and publish the code with support for threaded discussions under each file or class. Ideally I want to find something that I could deploy/hos... | <p>Look at Attlassian Crucible (<a href="http://www.atlassian.com/software/crucible/">http://www.atlassian.com/software/crucible/</a>)</p>
<p>And no, I am not associated with Atlassian in any way :)</p>
|
Is there a way to set timeouts in tomcat? <p>Can I set timeouts for JSP pages in tomcat either on a per page or server level?</p>
| <p>In the Tomcat server.xml file, the Connector element also has a connectionTimeout attribute in milliseconds.</p>
|
Is there a human readable programming language? <p>I mean, is there a coded language with human style coding?
For example:</p>
<pre><code>Create an object called MyVar and initialize it to 10;
Take MyVar and call MyMethod() with parameters. . .
</code></pre>
<p>I know it's not so useful, but it can be interesting to ... | <p>How about <a href="http://lolcode.com/home">LOLCODE</a>?</p>
<pre><code>HAI
CAN HAS STDIO?
VISIBLE "HAI WORLD!"
KTHXBYE
</code></pre>
<p>Simplicity itself!</p>
|
DOCTYPE RSS & HTML entities <p>I have an <strong>"ldquo"</strong>, <strong>"rdquo"</strong> and several other entities under my RSS feed. Seems like if I add</p>
<pre><code><!DOCTYPE rss [
<!ENTITY % HTMLspec PUBLIC
"-//W3C//ENTITIES Latin 1 for XHTML//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml-special.ent... | <p>it doesn't seem likely that many feed readers will know what to do with that. i would recommend sticking with numbered entity references. for example, change <code>&ldquo;</code> to <code>&#8220;</code>. you can get the full entity reference <a href="http://www.w3.org/TR/REC-html40/sgml/entities.html" rel... |
Flash AS2.0 - Increase Label's Font Size <p>I know this sounds like a really obvious question, but it's proving harder to figure out than I thought. I'm developing in Flash 8/ActionScript 2.0.</p>
<p>I have a label component, and I'm dynamically assigning it text from an xml document. For example:</p>
<pre><code>labe... | <p>When you say "label component", do you mean a Flex 2 label, or a TextField?</p>
<p>In the latter case, the font tag should work just fine. will set the font to 24px text for example. If it doesn't, you can use the stylesheet class to specify a font size and then assign it to the TextField.</p>
<p>In the case of o... |
Unit tests framework for databases <p>I´m looking for a unit tests framework for database development. I´m currently developing for SQL Server 2000, 2005 and 2008. Do you know of any good frameworks with similar functionality as JUnit and NUnit?<br />
Perhaps it´s better to ask, what do you use to unit test your st... | <p>There is TSQLUnit... Link here: <a href="http://tsqlunit.sourceforge.net/" rel="nofollow">http://tsqlunit.sourceforge.net/</a></p>
|
Is there really no way to follow up dataset parent relation in xaml binding? <p>Suppose I have a dataset with those two immortal tables: Employee & Order <br/>
<strong>Emp</strong> -> ID, Name <br/>
<strong>Ord</strong> -> Something, Anotherthing, EmpID <br/>
And relation <strong>Rel</strong>: Ord (EmpID) -> Emp (I... | <p>If you want to synchronize the contents of multiple controls, you will need to have them share the same binding source through the <strong>DataContext</strong> set on a common parent control. Here is an example:</p>
<pre><code><StackPanel>
<StackPanel.Resources>
<ObjectDataProvider x:Key=... |
Best way to list files in Java, sorted by Date Modified? <p>I want to get a list of files in a directory, but I want to sort it such that the oldest files are first. My solution was to call File.listFiles and just resort the list based on File.lastModified, but I was wondering if there was a better way.</p>
<p>Edit: ... | <p>I think your solution is the only sensible way. The only way to get the list of files is to use <a href="http://java.sun.com/javase/6/docs/api/java/io/File.html#listFiles%28%29">File.listFiles()</a> and the documentation states that this makes no guarantees about the order of the files returned. Therefore you need... |
Anybody know why SQL Server 2005 throws "'SQLOLEDB' failed with no error message available, result code: E_FAIL(0x80004005). "? <p>We've got a web system running SQL Server 2005 for the back end, and ASP.Net for the front end (using .net 2.0).</p>
<p>Every now and then, the system barfs out the error in the title: 'SQ... | <p>Firstly, it's probably not SQL Server throwing out the error, and if it is, it's probably not while running the SQL statement itself, but if it is, it's almost certainly going to be peculiar to a login that doesn't have permissions, not the SQL command itself.</p>
<p>The 0x80004005 error is a general permissions fa... |
Best way of doing an SVn checkout/update on a web hosting package <p>I want to deploy my site on my web hosting package by doing a checkout through subversion. I do not have SSH access to my hosting package, which is just a basic LAMP web hosting package, but I do know that there is an SVN client installed on the web s... | <p>I would hesitate to manage your site on your web host with Subversion unless you have shell access. When performing Subversion operations, there might be things that require your interactive attention which you wouldn't be able to provide through a script interface.</p>
<p>What I might suggest instead, is to mainta... |
How to get current datetime on Windows command line, in a suitable format for using in a filename? <p><strong>EDIT</strong>: Now that it's 2016 I'd use powershell for this unless there's a really compelling backwards-compatible reason for it, particularly because of the regional settings issue with using <code>date</co... | <p>See <a href="http://www.tech-recipes.com/rx/956/windows-batch-file-bat-to-get-current-date-in-mmddyyyy-format/">Windows Batch File (.bat) to get current date in MMDDYYYY format.</a>:</p>
<pre><code>@echo off
For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set mydate=%%c-%%a-%%b)
For /f "tokens=1-2 delims=/:" %... |
compiling only part of the source tree with ant <p>Say I have my sources in my src/ tree (and possibly in my test/ tree). Say I would like to compile only <em>part</em> of that tree. The reasons why I might want to do that are various. Just as an example, I might want to create the smallest possible jar (without includ... | <p>Why are you excluding as well as including? If you have at least one include, then files are only compiled if they're explicitly included. So this should work:</p>
<pre><code><javac srcdir="${src.dir}" destdir="${build.dir}" classpathref="classpath"
includes="src/path/to/MyClass.java" />
</code></pre>... |
Undo changes to SQL Server 2005 database <p>I've ran some "ALTER" scripts on the database [SQL Server Server 2005], and overwrote some sprocs. Is there any way to undo changes and get my old sprocs back?</p>
<p>Is there a way to get the scripts that were executed out of the .LDf file? That way i can re-run my initial ... | <p>FIRST: DO NOT TAKE ANY BACKUPS JUST YET.</p>
<p>There are several tools on the market to do this sort of thing. </p>
<p>You might try this one:</p>
<p><a href="http://www.apexsql.com/sql_tools_log.asp" rel="nofollow">ApexSQL Log</a></p>
|
JQuery: Current, Well-Formatted, Printable Documentation? <p>I'm looking for a current (1.2), well-formatted, printable version of the jQuery documentation. I've checked the alternative resources page and see the PDF versions from CF and Java, but both are out of date.</p>
<p>The jQuery site has the API browser with ... | <p>take a look at <a href="http://charupload.wordpress.com/2007/12/07/jquery-documentation-chm/" rel="nofollow">this page</a>.</p>
<p>it has compiled html help file (CHM) for latest jQuery 1.3.</p>
<p>that guy also compiles another useful CHM manuals.</p>
|
How do I discriminate between data binding and user actions on WinForm controls <p>I have what must be a typical catch-22 problem. I have a .NET WinForm control that contains a textbox and a checkbox. Both controls are data bound to properties on a data class instance. The textbox is for price, the check box to indi... | <p>I would suggest not handling the logic in the form code, but rather in the data class. All you need in the form is a couple of lines to set up the data binding. The data class can then take care of the rest:</p>
<p>Form</p>
<pre><code>Private _dc As DataClass
Private Sub Form1_Load(ByVal sender As Object, ByVal e... |
Include directory in VS 2003 <p>Where is the setting in Visual Studio 2003 to set the include path for individual projects? I know about the VC Directories option in Tools>Options but that is machine specific and won't help when I hand this off to other developers. </p>
| <p><img src="http://www.lemurproject.org/images/VS_Net_AdditionalIncludes.jpg" alt="alt text" /></p>
|
How to make a bilingual site without creating a separate ASP page for each language? <p>I need ideas on how to go about table layout problem.
I want to set different width of the columns dependent on the picked language.</p>
| <p>You can have language specific CSS, and then simply load the appropriate CSS based on language.</p>
<p>In the CSS you can add styles to your table for defining the layout.</p>
|
Why do my XSL transformed links come out relative to the base? <pre><code><a>
<xsl:attribute name="href">
<xsl:value-of select="link" />
</xsl:attribute>
<xsl:attribute name="target">new</xsl:attribute>
<xsl:value-of select="title" />
</a>
</code></pre>
<p>Thats my... | <p>It seems to me that the problem must be with HttpUtility.UrlEncode. Have you checked the contents of the xml that you're creating? The XSL looks correct to me, although it could be written more tersely as:</p>
<pre><code><a href="{@link}" target="new">
<xsl:value-of select="title"/>
</a>
</code>... |
What is the best datatype to use for storing moderate amounts of text in SQL Server (2005)? <p>What is the best datatype to use for storing moderate amounts of text in SQL Server (2005)?</p>
<p>For example, imagine a table, storing information on downloads available on a website.
I want a title for the download which ... | <p>The PAD (Portable Application Description) specification highest character limit for program description is 2000 chars *see Program Descriptions section.</p>
<p><a href="http://www.asp-shareware.org/pad/spec/spec.php" rel="nofollow">http://www.asp-shareware.org/pad/spec/spec.php</a></p>
<p>Download site submission... |
Memory in SWF (Flash Player) <p>Are there any limitations on the amount of memory that the flash player can use? If you have a swf that over time gets a lot of data from the server, then more and more data will be kept in memory... Is there a limitation on this?</p>
<p>Thx, Lieven Cardoen</p>
| <p>Not in any version of Flash that runs on desktop PCs. As long as your application keeps using more memory, desktop Flash will keep requesting it from the OS, until the OS runs out of memory or something crashes. Of course you the developer should limit your memory usage as appropriate, but Flash won't force you to d... |
Creating sine or square wave in C# <p>How do I generate an audio sine or square wave of a given frequency?</p>
<p>I am hoping to do this to calibrate equipment, so how precise would these waves be?</p>
| <p>You can use <a href="http://codeplex.com/naudio" rel="nofollow">NAudio</a> and create a derived WaveStream that outputs sine or square waves which you could output to the soundcard or write to a <a href="http://en.wikipedia.org/wiki/WAV" rel="nofollow">WAV</a> file. If you used 32-bit floating point samples you coul... |
C# streaming sockets, how to separate messages? <p>Kinda long title, but anyways...</p>
<p>I've been looking at these examples, specifically on the parts on writing and reading the size of the message to the byte streams<br />
<a href="http://doc.trolltech.com/4.4/network-fortuneclient-client-cpp.html" rel="nofollow">... | <p>Generally you would send the length first. Both ends should agree on what a length looks like - for example, you might be happy to use fixed 4-byte length prefix as binary:</p>
<pre><code> byte[] data = ...
int len = data.Length;
byte[] prefix = Bitconverter.GetBytes(len);
stream.Write(prefix, 0, prefix.Leng... |
How to manage a simple PHP session using C++ cURL (libcurl) <p>I'm writing a C++ client which is using libcurl for communicating with a PHP script.</p>
<p>The communication should be session based, and thus the first task is to login and make the PHP script set up a session.</p>
<p>I'm not used to working with sessio... | <p>As far as I understand it, CURL will handle session cookies automatically for you if you enable cookies, as long as you reuse your CURL handle for each request in the session:</p>
<pre><code>CURL *Handle = curl_easy_init();
// Read cookies from a previous session, as stored in MyCookieFileName.
curl_easy_setopt( H... |
getting the last modified date of a html file <p>how can i figure out the last modified date of a html file im importing into my web app?</p>
<p>The html file is on another server and different users can make updates, when i retrieve the page i want to be able see when it was last updated so i can label the updated da... | <p>Use the <code>document.lastModified</code> Javascript property.</p>
<p>quirksmode has a nice function to format the date too: <a href="http://www.quirksmode.org/js/lastmod.html">http://www.quirksmode.org/js/lastmod.html</a></p>
|
What should I call a REBOL function that does list comprehensions? <p>REBOL has no built-in way to perform list comprehensions. However, REBOL has a powerful facility (known as <code>parse</code>) that can be used to create domain-specific languages (DSLs). I've used <code>parse</code> to create such a mini-DSL for lis... | <p>How about <code>select</code>?</p>
<p><code>select [(a * b) for a in 1x100 for b in 4x10 where (all [odd? a odd? b])]</code></p>
|
MSSQL2000: get list of role members <p>I know a role name and want to find all users in this role.
How do I acheive this in SQL Server 2000 (in the SQL script, not in Management Studio or other tool)?</p>
| <p>You can use the following stored procedures:</p>
<p>For fixed server roles, the stored procedure is <a href="http://msdn.microsoft.com/en-us/library/ms188772.aspx" rel="nofollow">sp_helpsrvrolemember</a>:</p>
<pre><code>exec sp_helpsrvrolemember 'role'
</code></pre>
<p>For general roles, the stored procedure is <... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.