instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>Any idea how I express 'implements' in UML?
I'm trying to write some actionscript classes in starUML with the help of this handy little template tool:
<a href="http://blog.flashmech.net/2008/09/generate-actionscript-3-with-staruml/" rel="nofollow noreferrer">http://blog.flashmech.net/2008/09/generate-actionscript-3... | <p>Here is a starUML tutorial that should help - <a href="http://cnx.org/content/m15092/latest/" rel="nofollow noreferrer"><a href="http://cnx.org/content/m15092/latest/" rel="nofollow noreferrer">http://cnx.org/content/m15092/latest/</a></a></p>
| <p>Here is a starUML tutorial that should help - <a href="http://cnx.org/content/m15092/latest/" rel="nofollow noreferrer"><a href="http://cnx.org/content/m15092/latest/" rel="nofollow noreferrer">http://cnx.org/content/m15092/latest/</a></a></p>
| 44,405 |
<p>I have data loaded and various transformations on the data complete, the problem is there is a parent/child relationship managed in the data - best explained by an example</p>
<p>each row has (column names are made up)</p>
<pre><code>row_key parent_row_key row_name parent_row_name
</code></pre>
<p>some ro... | <p>Can you not just split the data using a multicast and then do a merge-join against itself?</p>
| <p>You could write your data to a temp table in your database, a raw file destination or recordset destination (depending on the size of your dataset). Then you could run through you data again and query your temp data and find the correct parent.</p>
| 22,129 |
<p>What is the difference between a <a href="http://msdn.microsoft.com/en-us/library/system.text.regularexpressions.group.aspx" rel="nofollow noreferrer">Group</a> and a <a href="http://msdn.microsoft.com/en-us/library/system.text.regularexpressions.match.aspx" rel="nofollow noreferrer">Match</a> in .NET's RegEx?</p>
| <p>A <a href="http://msdn.microsoft.com/en-us/library/system.text.regularexpressions.match.aspx" rel="noreferrer">Match</a> is an object that indicates a particular regular expression matched (a portion of) the target text. A <a href="http://msdn.microsoft.com/en-us/library/system.text.regularexpressions.group.aspx" re... | <p>A Match is a part of a string that matches the regular expression, and there could therefore be multiple matches within a string.</p>
<p>Inside a Match you can define groups, either anonymous or named, to make it easier to split up a match. A simple example is to create a regex to search for URLs, and then use grou... | 4,875 |
<p>What is the best way to create a fixed width file in C#. I have a bunch of fields with lengths to write out. Say 20,80.10,2 etc all left aligned. Is there an easy way to do this? </p>
| <p>You can use string.Format to easily pad a value with spaces
e.g.</p>
<pre><code>string a = String.Format("|{0,5}|{1,5}|{2,5}", 1, 20, 300);
string b = String.Format("|{0,-5}|{1,-5}|{2,-5}", 1, 20, 300);
// 'a' will be equal to "| 1| 20| 300|"
// 'b' will be equal to "|1 |20 |300 |"
</code></pre>
| <p>Can't you use standard text file? You can read back data line by line.</p>
| 11,190 |
<p>I want to plan a data access layer and I thought to use Linq.
I read that linq has its problems with performance and that you could use stored procedures with linq.
Should I use stored procedures with linq when planning my data access layer? Is it crucial for the performance? When should I use them?
I know that sto... | <p>From what I have read, the server caches execution plans of queries generated through LinqToSql, so these queries will perform roughly the same way as would equivalent stored procedures. And if you use stored procedures, then you lose the advantages that you get by using LinqToSql, since your query logic will stay i... | <p>I would recommend going with LINQ or stored procedures, but not both - there is no real reason to combine the two and you won't win in terms of performance. LINQ would be useful for smaller-scale web apps, stored procedures for a larger scale web-app or for better scaleability</p>
<p>The problem is not only perform... | 43,665 |
<p>I do some minor programming and web work for a local community college. Work that includes maintaining a very large and soul destroying website that consists of a hodge podge of VBScript, javascript, Dreamweaver generated cruft and a collection of add-ons that various conmen have convinced them to buy over the years... | <p>Stefan's iframe solution works, but if that's not elegant enough, I find the following JavaScript also solves it:</p>
<pre><code>window.onunload = function(){};
</code></pre>
<p>That is, if your menu is JavaScript, then you might prefer to solve this issue with JavaScript too.</p>
<p>The unload event handler defi... | <p>Had the same problem on iPad.</p>
<p>Not that beautiful but it works :). How it works.</p>
<p>I realised that on iPad Safari, the page was not reloaded when the back button was pressed. I put a counter every second on the page and I save the current timestamp.</p>
<p>When the page is loaded the counter and time a... | 4,384 |
<p>I create a web application (WAR) and deploy it on Tomcat. In the <em>webapp</em> there is a page with a form where an administrator can enter some configuration data. I don't want to store this data in an DBMS, but just in an XML file on the file system. Where to put it?</p>
<p>I would like to put the file somewher... | <p>What we do is to put it in a separate directory on the server (you could use something like /config, /opt/config, /root/config, /home/username/config, or anything you want). When our servlets start up, they read the XML file, get a few things out of it (most importantly DB connection information), and that's it.</p>... | <p>If it is your custom config WEB-INF is a good place for it. But some libraries may require configs to reside in WEB-INF/classes.</p>
| 12,182 |
<p>In ASP.NET, if I databind a gridview with a array of objects lets say , how can I retrieve and use foo(index) when the user selects the row?</p>
<p>i.e.</p>
<pre><code>dim fooArr() as foo;
gv1.datasource = fooArr;
gv1.databind();
</code></pre>
<p>On Row Select</p>
<pre><code>Private Sub gv1_RowCommand(ByVal sen... | <p>If you can be sure the order of items in your data source has not changed, you can use the CommandArgument property of the CommandEventArgs.</p>
<p>A more robust method, however,is to use the DataKeys/SelectedDataKey properties of the GridView. The only caveat is that your command must be of type "Select" (so, by ... | <p>in theory the index of the row, should be the index of foo (maybe +1 for header row, you'll need to test). so, you should be able to do something along these lines</p>
<pre><code>dim x as object = foo(e.row.selectedIndex)
</code></pre>
<p>The other alternative is to find a way to databind the index to the commandA... | 15,464 |
<p>I want to learn how to create <strong>truly</strong> robust applications in .net - ones that are fault tolerant and are capable of withstanding unexpected situations. Where can I find literature/guidance on this subject? So far, I am not having much luck.</p>
| <p>I'm aware of at least a couple resources. First, there's a very useful article on MSDN titled <a href="http://msdn.microsoft.com/en-us/magazine/cc163716.aspx" rel="nofollow noreferrer">Keep Your Code Running with the Reliability Features of the .NET Framework</a>.</p>
<p>Chris Brumme also had a <a href="http://blo... | <p>If you are looking from a software implementation perspective, then it may be worth looking into <a href="http://en.wikipedia.org/wiki/Design_by_contract" rel="nofollow noreferrer">Design by Contract (DbC)</a></p>
<p>According to <a href="http://archive.eiffel.com/doc/manuals/technology/contract/" rel="nofollow nor... | 46,042 |
<p>This error message appears on a colleague's machine when he tries to launch a Windows application he's working on:</p>
<blockquote>
<p>An unhandled non-continuable exception was thrown during process load</p>
</blockquote>
<p>What does this mean, and how does one go about investigating what is causing it?</p>
<... | <p>Is there more information in the error message, maybe in the debug console? If there's a stack trace available, it might point you to the problem application, or better yet, the DLL that's causing the problem. The next step would be to see if there's an update available for that DLL.</p>
| <p>I had the same issue and it turned out that a DLL compiled for x64 in a x86 project was the culprit. Replacing the DLL with the x86 version resolved the issue.</p>
| 28,942 |
<p>I've been developing Winforms applications in C# for a few years now and have been interested in moving future development toward WPF, mainly because of the positive things I've been hearing about it. But, I'm wondering what sort of hurdles others have had to overcome as they migrated to WPF. Was there a significa... | <p>I'm not sure I can give you just one hurdle, because it is a complete departure from WinForms. My suggestion is get Adam Nathan's WPF Unleashed, forget everything you know about building UI's with any previous technology (Winforms, MFC, Java) and begin again at square one. </p>
<p>If you try and do it any other w... | <p>Well, for me it was the fact that controls in WPF behave rather different from those in WPF (for example, when it comes to positioning in the form). You have to understand the difference as soon as possible to use it successfully and productively.</p>
| 13,486 |
<p>How can I get rid of: </p>
<pre><code><input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="..."/>
</code></pre>
<p>Completely !</p>
| <p>You need to add the EnableViewState="false" to the @Page directive in the Default.aspx file.</p>
<pre><code><%@ Page Language="C#" AutoEventWireup="true"
Codebehind="Default.aspx.cs" Inherits="Sample._Default"
EnableViewState="false" %>
</code></pre>
<p>Then, add the following code to the Default.aspx.cs fil... | <pre><code>#region Disable ViewState
protected override void SavePageStateToPersistenceMedium(object state)
{
}
protected override object LoadPageStateFromPersistenceMedium()
{
return null;
}
#endregion
</code></pre>
<p>This is awesome.However, just to let everyone know it's still rendering an empty viewstate hidd... | 37,077 |
<p>i want the result of an equation rounded to the nearest integer.
e.g. </p>
<pre><code>137 * (3/4) = 103
</code></pre>
<p>Consider the following incorrect code. </p>
<pre><code>int width1 = 4;
int height1 = 3;
int width2 = 137;
int height2 = width2 * (height1 / width1);
</code></pre>
<p>What is the proper way to... | <p>As said above, you should do the multiplication before the division.
Anyway you could write your expression with casting only the divisor:</p>
<pre><code>int height2 = (int)Math.Round(width2 * (height1 / (float)width1));
</code></pre>
| <p>The elaborate on Jeffery's message, since you generally a better chance of truncated needed decimals than you have of overflowing a 32-bit integer (and because multiplication & division is commutative), you should generally do multiplication before division.</p>
| 38,300 |
<p>I am using Eclipse 3.3 ("Europa"). Periodically, Eclipse takes an inordinately long time (perhaps forever) to start up. The only thing I can see in the Eclipse log is:</p>
<pre>
!ENTRY org.eclipse.core.resources 2 10035 2008-10-16 09:47:34.801
!MESSAGE The workspace exited with unsaved changes in the previo... | <p>This may not be an exact solution for your issue, but in my case, I tracked the files that Eclipse was polling against with <a href="http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx" rel="noreferrer">SysInternals Procmon</a>, and found that Eclipse was constantly polling a fairly large snapshot file for... | <p>I had no snap files. Going through the help menu installation list, at least 90% of my plugins had the uninstall button deactivated so I could not handle it through there. Under startup/shutdown most of plugins were not listed. Instead, I had to manually remove items from my plugins folder. Wow, the startup time... | 25,478 |
<p>I have a small web application which uses themes. The themes work on host, so on preinit, if the host = a, load x theme, if the host = b, load y theme. </p>
<p>In my code this looks like: </p>
<p>If request.url.host.contains("a") Then
Page.Theme = x
Else
request.url.host.contains("b") Then
Page.Theme = y </p>
... | <p>Are you setting the Theme early enough in your code? A Theme must be applied to a page very early in the request lifecycle, in the PreInit event, if you do it in code-behind.</p>
| <p>Yep, it is on page preinit.</p>
<p>I think it is to do with forms authentication. If I view (not debug) the login page, it picks up the localhost theme and everything is displayed correctly. The login control is in the middle of the page, as it should be, etc.</p>
<p>But if I debug the page and, as you'd expect, t... | 40,771 |
<p>It is not uncommon for me (or likely anyone else) to have a list of objects I need to iterate through and then interact with a list of properties. I use a nested loop, like this:</p>
<pre><code>IList<T> listOfObjects;
IList<TProperty> listOfProperties;
foreach (T dataObject in listOfObjects)
{
fore... | <p>Looks like you are trying to cartesian join two lists, and apply a where clause. Here's a simple example showing the Linq syntax for doing this, which I think is what you are looking for. list1 and list2 can be any IEnumerable, your where clause can contain more detailed logic, and in your select clause you can ya... | <p>In such a scenario, we often start by filtering the pieces we're interested in.
your block dosomethingclever() usually starts in</p>
<pre><code>foreach (T dataObject in listOfObjects)
{
foreach (TProperty property in listOfProperties)
{
if (property.something == "blah")
{ // OK, we found the pi... | 47,697 |
<p>Is there a utility that will generate html or css for blocks of code (.net c#) when you post it on a website? </p>
<p>I have seen several websites with very nicely formatted code and I dont believe they do this manually.</p>
| <p>Google prettify -</p>
<p><a href="http://code.google.com/p/google-code-prettify/" rel="noreferrer">http://code.google.com/p/google-code-prettify/</a></p>
| <p>An even better solution, if you don't want to bother installing anything, is to just use the little web app I wrote called BlogTrog CodeWindow:</p>
<p><a href="http://www.blogtrog.com" rel="nofollow noreferrer">http://www.blogtrog.com</a></p>
<p>It's easy to use. Just paste your code and embed the results.</p>
| 20,904 |
<p>I'm implementing a comment control that uses an ASP.Repeater to display each comment. The comment itself is currently displayed using a table to divide up some images to display the comment in a bubble.</p>
<p>I know that tables are supposed to be the epitome of evil for design layout, and really expensive to disp... | <p>The best resource I've seen for creating rounded corners using DIV elements was an article on "A List Apart" - see <a href="http://alistapart.com/articles/customcorners/" rel="nofollow noreferrer">http://alistapart.com/articles/customcorners/</a>. If you're looking to use DIV elements to layout your entire site, th... | <p>In short you would want something like this:</p>
<pre><code><style>
.start { background-image: url("topofbubble.png"); height: <heightofimage>; }
.end { background-image: url("bottomofbubble.png"); height: <heightofimage>; }
.body {background-image: url("sliceofbubblemiddle.png"); }
</sty... | 11,834 |
<p>ASP.NET 1.1 - I have a DataGrid on an ASPX page that is databound and displays a value within a textbox. The user is able to change this value, then click on a button where the code behind basically iterates through each DataGridItem in the grid, does a FindControl for the ID of the textbox then assigns the .Text va... | <p>Are you able to manage permissions on this database? Would adding a separate user who only has read access to a database be sufficient for this type of scenario? This could be a read-only user on the main database, but is only effectively used on the snapshot db.</p>
<p>i.e. Add a new user, readerMan5000 who is o... | <p>You can't change permissions after you take the snapshot, but here's one workaround: instead of having them access the tables directly, require them to use views instead. If the views are used only for reporting, then you can set tight security on them in the original database, and then have the users hit those vie... | 10,426 |
<p>I am using sfOpenID plugin for Symfony, which doesn't support OpenID 2.0. That means, for example, that people using Yahoo! OpenID can't login to my site.</p>
<p>There is an OpenID 2.0 plugin that works with sfGuard, but I am not using nor planning to use sfGuard. Plus, it requires to install Zend framework, too, w... | <p>I think you've covered all your options with sfOpenID and taOpenIDsfGuardPlugin for Symfony's plugins.</p>
<p>Without studying OpenID's specs in detail though, you could try one of those PHP libraries (<a href="http://wiki.openid.net/Libraries" rel="noreferrer">http://wiki.openid.net/Libraries</a>) by dropping it i... | <p>There is an easier way. JanRain offers OpenID (and facebook) as a service <a href="http://rpxnow.com" rel="nofollow noreferrer">http://rpxnow.com</a> . Vastly easier/quicker than going native with the libraries.</p>
| 34,840 |
<p>I'm developing a Linux application that has its own file format. I want my app to open when you double-click on those files.</p>
<p>How can I register a file extension and associate it with my application on Linux? I'm looking for a way that is standard (works with GNOME and KDE based systems) and can be done autom... | <p>Use <code>xdg-utils</code> from <a href="http://portland.freedesktop.org/wiki/" rel="noreferrer">freedesktop.org Portland</a>.</p>
<p>Register the icon for the MIME type:</p>
<pre class="lang-sh prettyprint-override"><code>xdg-icon-resource install --context mimetypes --size 48 myicon-file-type.png x-application-myt... | <p>This is all existing answers combined, completed and corrected into a single bash script.</p>
<pre class="lang-bash prettyprint-override"><code>#!/bin/bash
set -e # stop on error
APP=my-app
EXT=my-app
COMMENT=Comment
EXEC=/usr/bin/my-app
LOGO=./logo.png
xdg-icon-resource install --context mimetypes --size 48 $LOGO... | 5,078 |
<p>I understand that a hxs file is a compiled help file, a replacement for .chm files, but I can't seem to open them.</p>
<p>I've read that you read them with the help explorer, dexplore.exe found here:
C:\Program Files\Common Files\microsoft shared\Help 9\dexplore.exe</p>
<p>When I try opening the file with dexplore... | <p>Not sure if you want to look through them programmatically or with some tool, but Help Explorer can open hxs files and extract contents. CHM files (the precursor to hxs) were a custom binary format with indexing and other data at the beginning of the file, and a zip archive in the rest. </p>
<p>You can also decompi... | <p>After a bit more research, it looks like these files must be installed into the IDE when you install 3rd party tools. There is a diagnostic tool called Namespace#. You can see details about it here:</p>
<p><a href="http://code.msdn.microsoft.com/NamespaceSharp" rel="nofollow noreferrer">http://code.msdn.microsoft... | 21,757 |
<p>What is the simplest way (least error-prone, least lines of code, however you want to interpret it) to open a file in C and read its contents into a string (char*, char[], whatever)?</p>
| <p>I tend to just load the entire buffer as a raw memory chunk into memory and do the parsing on my own. That way I have best control over what the standard lib does on multiple platforms.</p>
<p>This is a stub I use for this. you may also want to check the error-codes for fseek, ftell and fread. (omitted for clarity)... | <p>easy and neat(assuming contents in the file are less than 10000):</p>
<pre><code>void read_whole_file(char fileName[1000], char buffer[10000])
{
FILE * file = fopen(fileName, "r");
if(file == NULL)
{
puts("File not found");
exit(1);
}
char c;
int idx=0;
while (fscanf(fil... | 21,036 |
<p>What is the largest heap you have personally used in a managed environment such as Java or .NET? What were some of the performance issues you ran into, and did you end up getting a diminishing returns the larger the heap was? </p>
| <p>I work on a 64-bit .Net system that typically uses 9-12 GB, and sometimes as much as 20GB. I have not seen any performance problems even while garbage collecting, and I have been looking hard as I was not expecting it to work so well.</p>
<p>An earlier version hung on to some objects for too long resulting in occas... | <p>I am unsure what you mean by heap, but if you mean memory used, I have used quite a bit, 2GB+. I have a web app that does image processing and it requires loading 2 large scan files into memory to do analysis.</p>
<p>There were performance issues. Windows would swap out lots of ram, and then that would create a lo... | 22,442 |
<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>
| <p>Assuming the following table structure:</p>
<pre><code>CREATE TABLE tbl_1 (
pk_1 int,
field_1 varchar(25),
field_2 varchar(25)
);
CREATE TABLE tbl_2 (
pk_2 int,
fk_1 int,
field_3 varchar(25),
field_4 varchar(25)
);
</code></pre>
<p>You could use the following:</p>
<pre><code>SELECT t1... | <p>I'm not 100% sure I understand your question.</p>
<p>Is the following true:</p>
<p>Your first table is imported from somewhere else.
You are only importing some columns.
You want to build a query which references a column which you haven't imported.</p>
<p>If this is true, it's just not possible. As far as the A... | 35,522 |
<p>I'm looking at stdint.h and given that it has uint16_t and uint_fast16_t, what is the use for uint_least16_t what might you want that couldn't be done equally well with one of the other two?</p>
| <p>Say you're working on a compiler with:</p>
<ul>
<li><code>unsigned char</code> is 8 bits</li>
<li><code>unsigned short</code> is 32 bits</li>
<li><code>unsigned int</code> is 64 bits</li>
</ul>
<p>And unsigned int is the 'fastest'. On that platform:</p>
<ul>
<li><code>uint16_t</code> would <em>not</em> be availa... | <p>It's part of the c standard. It doesn't need a good use case. :P</p>
<p>See <a href="http://www.opengroup.org/onlinepubs/009695399/basedefs/stdint.h.html" rel="nofollow noreferrer">this</a> page and look for the section titled "Minimum-width integer types".</p>
| 31,017 |
<p>There are several very high quality web frameworks out there today, and everyone seems to be able to find one that becomes their favorite. Then, they have nothing but good things to say about the framework in question, and they relate their personal experiences on how the framework has made web development more enjo... | <p>With ASP.NET the only thing I dislike is that MS often encourages quick and dirty style development with too many drag and drop controls and datasets over better thought through not so quick, but much less dirty, solutions.</p>
| <p>I'll post an answer to my own question by admitting that my favorite framework, <a href="http://www.stripesframework.org" rel="nofollow noreferrer">Stripes</a>, <em>could</em> use some improvement in the flexibility of its localization mechanism. While the mechanism is quite useable, it should be easier for develope... | 26,729 |
<p>I am looking to determine from a large code base, what files are actually being used over a period of time. I need to know about CFM pages and CFCs as well as any included CFM files etc. </p>
<p>I know I can get <em>some</em> of this info using logging in application.cfm, or by using IIS, but I will still be missin... | <p>Hmmm, I think you'll need to turn on debugging and create a custom debug template.</p>
<p>The debug templates are in: [coldfusiondir]/wwwroot/WEB-INF/debug</p>
<p>Have a look at the code which <code>classic.cfm</code> uses to display Templates to screen, and then create some similar code which logs each template r... | <p>The approach using the debug templates will work, but will only work if you have debugging enabled. If the code base is large an unwieldy and the only place you have to collect this info is live then make sure those templates aren't outputting anything.</p>
<p>Additionally your CFC calls will slow down quite a bit... | 48,110 |
<p>I have read that to send email in Java I need to obtain my ISP's SMTP address, but if I am intending to host my web app online, will this be my hosts ISP SMTP address?</p>
<p>EDIT: So I need to find out my clients ISP's SMTP address and send via this?</p>
| <p>No, unless your webhost is the same as your ISP or your webhost also offers SMTP services.</p>
<p>In response to your edit, yes you need your ISP's SMTP address by the sound of things.</p>
| <p>It will be the SMTP address you want to forward email through.</p>
<p>If you want to send email through your ISP account then it will be that SMTP.</p>
| 38,542 |
<p>I want to use the standard ADO connection string dialog box in MS Access.
How can I do that?</p>
| <p>If not already selected, check the following references in the References dialog:</p>
<p>Microsoft OLE DB Service Component 1.0 Type Library</p>
<p>Microsoft ActiveX Data Objects 2.7 Library</p>
<p>The following code will open the dialog box and set a connection object to the parameters provided in the Data Link ... | <p>See <a href="http://support.microsoft.com/kb/281998" rel="nofollow noreferrer">How to bind Microsoft Access forms to ADO recordsets</a></p>
| 45,866 |
<p>I am preparing a project proposal for a client who wants to publish video in his website. I need to define which video formats will be allowed, which video sizes, as well as the necessary tools for conversion and preparation. </p>
<p>I have no experience with embedding video in websites so which markup do I need to... | <p>You could embed them using a flash player, like Youtube for example.</p>
<p>A quick way to do this is using some already made player, like the excellent <a href="http://www.jeroenwijering.com/?item=JW_FLV_Player" rel="nofollow noreferrer">JW FLV Player</a>, free for non-commercial projects and very cheap for commer... | <p>For what it's worth here is a example of embedding video using the media player plugin.</p>
<p><code><embed src="http://aaa/bbb/ccc/myVideo.wmv" type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" name="MediaPlayer" autostart="1" showcontrols="1" showstatusbar="0" autorewind... | 37,859 |
<p>Currently running Server 2003 but am looking at reinstalling in the near future due to a change of direction with the domains. Should I take this opportunity to install Windows Server 2008 instead?
I would love to play with new technology and the server is only for a small home business so downtime/performance issue... | <p>I am no expert on Windows server revisions, but the only new feature of Server 2008 I can think of is Hyper-V. But I would try Server 2008 just for Hyper-V, as this VM hypervisor is supposedly much faster than VMware and Virtual PC, and is compatible with Virtual PC virtual disks.</p>
| <p>There is no Exchange Server 2008. Exchange has always been tightly integrated with IIS which tends to bind it to a specific version of Windows. However, Exchange Server 2007 SP1 can be installed on Windows Server 2008.</p>
<p>Exchange Server 2003, however, cannot run on Windows Server 2008 and I do not believe ther... | 19,467 |
<p>I am migrating an application from .NET 1.1 to .NET 2.0. Should I remove all uses of CollectionBase? If so, what is the best strategy for migration?</p>
| <p>Yes, the best classes to look at are in System.Collections.Generic.<br>
I usually use List.</p>
<p>There are two approaches you can use either:</p>
<p><strong>A</strong></p>
<pre><code>public class MyClass
{
public List<MyItem> Items;
}
</code></pre>
<p><strong>B</strong></p>
<pre><code>public class MyI... | <p>I prefer Mark Ingrams A) approach, possibly with a base class you write yourself.</p>
<p>There is another issue with migrating to generics; converting has a tendency to have a certain viral effect. You may find it impossible to stop before you're all the way through. If you THOUGHT you were going to spend a couple ... | 40,104 |
<p>I have a website where we use Javascript to submit the login form. On Firefox it prompts the user to remember their password, when they login, but on IE7 it doesn't.</p>
<p>After doing some research it looks like the user is only prompted in IE7 when the form is submitted via a Submit control. I've created some s... | <p>Why not try hooking the form submission this way?</p>
<pre><code><html>
<head>
<title>test autocomplete</title>
<script type="text/javascript">
function submitForm()
{
return true;
}
</script>
... | <p>Did you try putting in url in the href and attaching a click event handler to submit the form and returning false from the click handler so that the url does not get navigates to.</p>
<p>Alternatively hidden submit button triggered via javascript?</p>
| 19,161 |
<p>We have an issue using the <code>PEAR</code> libraries on <code>Windows</code> from <code>PHP</code>.</p>
<p>Pear contains many classes, we are making use of a fair few, one of which is the Mail class found in <code>Mail.php</code>. We use PEAR on the path, rather than providing the full explicit path to individual... | <p>As it's an OS level thing, I don't believe there's an easy way of doing this.</p>
<p>You could try changing your include from <code>include('Mail.php');</code> to <code>include('./Mail.php');</code>, but I'm not certain if that'll work on a Windows box (not having one with PHP to test on).</p>
| <p>If you are using PHP 4, you can take advantage of <a href="http://bugs.php.net/bug.php?id=43821" rel="nofollow noreferrer">this</a> bug. Off course that is a messy solution...</p>
<p>Or you could just rename your mail.php file to something else...</p>
| 8,902 |
<p>I need my code to do different things based on the operating system on which it gets compiled. I'm looking for something like this:</p>
<pre><code>#ifdef OSisWindows
// do Windows-specific stuff
#else
// do Unix-specific stuff
#endif
</code></pre>
<p>Is there a way to do this? Is there a better way to do the same ... | <p>The <strong><a href="https://sourceforge.net/p/predef/wiki/OperatingSystems/" rel="noreferrer">Predefined Macros for OS</a></strong> site has a very complete list of checks. Here are a few of them, with links to where they're found:</p>
<h2><a href="http://msdn.microsoft.com/en-us/library/b0084kay(VS.80).aspx" rel="... | <p>I wrote an <a href="https://github.com/abranhe/os.c" rel="nofollow noreferrer">small library</a> to get the operating system you are on, it can be installed using <a href="https://clibs.org" rel="nofollow noreferrer">clib</a> (The C package manager), so it is really simple to use it as a dependency for your projects... | 17,224 |
<p>I've never used CI tools before, but from what I've read, I'm not sure it would provide any benefit to a solo developer that isn't writing code every day.</p>
<p>First - what benefits does CI provide to any project?</p>
<p>Second - who should use CI? Does it benefit all developers?</p>
| <p>The basic concept of CI is that you have a system that builds the code and runs automated tests everytime someone makes a commit to the version control system. These tests would include unit and functional tests, or even behavior driven tests.</p>
<p>The benefit is that you know - immediately - when someone has br... | <p>CI benefits a solo developer in the sense that you're aware if you forgot to check something in (because the build will be broken). The integration value of it is diminished when there are no other developers, though.</p>
| 15,860 |
<p>I would like to be able to add custom commands/script to be executed during a print.</p>
<p>For example I would like to write some software to take a picture check the print hasn't moved off the bead between layers. </p>
<p>Does anyone know if any of the available software/firmware allows custom scripts or calling... | <p>One of the solutions could be adding a layer change script (simplifi3d has that out of the box) and then using marlin firmware you could set a value to digital pin that could triger external actions.</p>
<blockquote>
<p><a href="https://forum.simplify3d.com/viewtopic.php?t=1959" rel="nofollow noreferrer">Layer C... | <p>I saw this 3 years ago, this is a <a href="https://www.youtube.com/watch?time_continue=33&v=L-_5KsAOVko" rel="nofollow noreferrer">closed loop control</a>, I think is better that taking a photo then analyze it with a kind of optical recognition software which needs some of possible failures.</p>
<p>The video ha... | 877 |
<p>Does anyone have an idea how long it will take before "almost all" widely used Python libraries work with Python 3.0?</p>
<p>I am planning to stay on 2.X for a while because I don't want to start porting stuff over and then find that some library I already rely on or a new library I might start using doesn't work y... | <p>The examples you have listed will probably be ported very quickly, as they are so widely used.</p>
<p>I would be surprised if BeautifulSoup takes more than a month (In fact, I'm surprised it hasn't been ported already using the py3k betas), more complex things like numpy may take a big longer, especially because 2t... | <p>The libraries you mention will be ported once someone puts some serious time into porting them.</p>
<p>In the specific case of NumPy/SciPy, a large part of the code is written as C extensions. There is no 2to3 tool for C extensions and so it will take a large amount of man hours to port the code over to the format... | 20,577 |
<p>I want to move a legacy Java web application (J2EE) to a scripting language - any scripting language - in order to improve programming efficiency.</p>
<p>What is the easiest way to do this? Are there any automated tools that can convert the bulk of the business logic?</p>
| <p>Here's what you have to do.</p>
<p>First, be sure you can walk before you run. Build something simple, possibly tangentially related to your main project.</p>
<p><strong>DO NOT</strong> build a piece of the final project and hope it will "evolve" into the final project. This never works out well. Why? You'll m... | <p>A lot of the recommendations being given here are assuming you -- and just you -- are doing a full rewrite of the application. This is probably not the case, and it changes the answer quite a bit</p>
<p>If you've already got J2EE kicking around, the correct answer is Grails. It simply is: you probably already hav... | 24,324 |
<p>I'm building a function to extend the <code>Enum.Parse</code> concept that</p>
<ul>
<li>Allows a default value to be parsed in case that an Enum value is not found</li>
<li>Is case insensitive</li>
</ul>
<p>So I wrote the following:</p>
<pre><code>public static T GetEnumFromString<T>(string value, T defaultVal... | <h2>This feature is finally supported in C# 7.3!</h2>
<p>The following snippet (from <a href="https://github.com/dotnet/samples/blob/3ee82879284e3f4755251fd33c3b3e533f7b3485/snippets/csharp/keywords/GenericWhereConstraints.cs#L180-L190" rel="noreferrer">the dotnet samples</a>) demonstrates how:</p>
<pre><code>public st... | <p>Just for completeness, the following is a Java solution. I am certain the same could be done in C# as well. It avoids having to specify the type anywhere in code - instead, you specify it in the strings you are trying to parse.</p>
<p>The problem is that there isn't any way to know which enumeration the String mi... | 10,450 |
<p>I'm an avid vim user and have started to write some SQL code recently. I like to write my SQL statements in CAPS and sometimes forget to switch <kbd>CapsLock</kbd> 'off' and I then quickly wreak havoc on my code before I realise what's happening.</p>
<p>I have so far not found any way to tell whether the <kbd>CapsL... | <p><s>The best I can give you is to have vim toggle the background color whenever the CAPSLOCK
key is hit in vim.</s></p>
<p>Vim can't detect the CAPSLOCK key alone. What I can give you is a mapping so you can use some other key (in this example, F3) to act like the CAPSLOCK key for insert mode, and change the backgr... | <p>Why not have a filetype plugin for .sql files that contain imap commands to convert all your keystrokes to caps. That way, you never have to toggle the actual capslock key on the keyboard and things will be fine when you go back to code.</p>
<p>Add the following in the file $VIM/vimfiles/ftplugin/sql_too.vim :</p>
... | 36,892 |
<p>I have a C/C++ source file with conditional compilation. Before I ship it to customers I want to remove most of the #if statements, so that my customers do not need to worry about passing the right -D options to the compiler.</p>
<p>I have this implemented and working in Python, but it only handles #ifdef and #ifn... | <p>As <a href="https://stackoverflow.com/questions/287379/parsing-c-preprocessor-if-statements#287405">KeithB said</a>, you could just let the preprocessor do this for you. </p>
<p>But if you're not trying to hide things (ie., there may be stuff in the conditionally compiled code that you don't want or aren't permitte... | <p>The GCC preprocessor is typicallly a stand-alone program, typically called <code>cpp</code>. That will probably also strip off your comments, of course.</p>
| 36,555 |
<p>How do I make a GUI for my python program because now it only runs in Idle and a command line and what software packages can I use and where can I get them? Thanks.</p>
| <p>The <a href="http://wiki.python.org/moin/GuiProgramming" rel="nofollow noreferrer">GuiProgramming</a> page in the Python wiki has a good overview of the different options you have.</p>
| <p>We started down the path of wxPython a few years ago and found it to be quite easy to do for simple, quick and dirty app. However, you are not going to get something you can put on the modern desktop. So we switched to WinForms and Python.Net and haven't looked back since. It's fairly easy to get going and you ge... | 35,358 |
<p>I am trying to find all matches in a string that begins with <code>| |</code>. </p>
<p>I have tried: <code>if ($line =~ m/^\\\|\s\\\|/)</code> which didn't work. </p>
<p>Any ideas?</p>
| <p>You are escaping the pipe one time too many, effectively escaping the backslash instead.</p>
<pre><code>print "YES!" if ($line =~ m/^\|\s\|/);
</code></pre>
| <p>What about:</p>
<pre><code>m/^\|\s*\|/
</code></pre>
| 22,074 |
<p>If you're using Opera 9.5x you may notice that our client-side <a href="http://docs.jquery.com/Plugins/Validation" rel="noreferrer">JQuery.Validate</a> code is disabled here at Stack Overflow.</p>
<pre><code>function initValidation() {
if (navigator.userAgent.indexOf("Opera") != -1) return;
$("#post-text").... | <p>turns out the problem was in the</p>
<pre><code>{ debug : true }
</code></pre>
<p>option for the JQuery.Validate initializer. <strong>With this removed, things work fine in Opera.</strong> Thanks to Jörn Zaefferer for helping us figure this out!</p>
<p>Oh, and the $50 will be donated to the JQuery project. :)</p>... | <p>I can't seem to reproduce this bug. Can you give more details?</p>
<p>I have my copy of Opera masquerading as Firefox so the validation should be executing:</p>
<pre><code>>>> $.browser.opera
false
</code></pre>
<p>When I go to the edit profile page and enter a malformed date, the red text comes up and ... | 3,014 |
<p>What's the easiest way to increase or decrease indentation for a large block of code in vi?</p>
| <p>In vim (not sure if this applies to you too), you use <code>>></code> to indent one line. As with nearly every command in vim, type in a number before the command to perform is multiple times. So to indent the next 50 lines, type <code>50>></code>.</p>
| <p>use two angle-brackets ("<<" or ">>") for one line left or right by shiftwidth characters. You can do this with the common line-range indicators - ":m,n", brace/bracket/paren matching, etc.</p>
<p>Or "<", then a motion indicator, then another "<".</p>
<p>Or "<12<" shifts the next 12 lines left.</... | 31,446 |
<p>For a university project I programmed a Internet Explorer Browser Helper Object to process web document information while browsing. It were running successful on Windows XP with IE6 and IE7.</p>
<p>Now I have the issue that under Windows Vista the same BHO needs administrator rights to run. Browser and BHO running... | <p>Not sure if your problem is related to custom actions in your installer but the following two links should help you.</p>
<ul>
<li><p>Building a BHO with the UAC in mind - <a href="http://simonguest.com/2006/11/20/building-browser-helper-objects-using-managed-code/" rel="nofollow noreferrer">http://simonguest.com/bl... | <p>You should use a debugger to determine <em>why</em> the addon is crashing. Chances are good that you're attempting to write to a protected location, and when that fails, your code fails to check for an error result.</p>
<p>Using Process Monitor and watching for Access_Denied returns is often helpful, but using a fu... | 19,074 |
<p>Why does the SQLite C/C++ API return <code>unsigned char *</code>s for text values as opposed to the more de-facto <code>char *</code> type?</p>
<p>This is somewhat related to <a href="https://stackoverflow.com/questions/75191/unsigned-char">the unsigned char</a> question, except that the SQLite API's decision seem... | <p>From the <a href="http://www.sqlite.org/capi3ref.html#sqlite3_column_blob" rel="noreferrer">SQLite documentation</a>:</p>
<blockquote>
<p>(H13821) The sqlite3_column_text(S,N) interface converts the Nth column in the current row of the result set for the prepared statement S into a zero-terminated UTF-8 string an... | <p>At a wild guess I'd say that it has something to do with supporting UTF-8 encoding. Signed char values only make sense in a 7-bit ASCII environment where everything above 0x7f is open to interpretation. In UTF-8 everything between 0x00 and 0xFF can be used equally.</p>
| 41,356 |
<p>In php I need to get the contents of a url (source) search for a string "maybe baby love you" and if it does not contain this then do x.</p>
| <p>Just read the contents of the page as you would read a file. PHP does the connection stuff for you. Then just look for the string via regex or simple string comparison.</p>
<pre><code>$url = 'http://my.url.com/';
$data = file_get_contents( $url );
if ( strpos( 'maybe baby love you', $data ) === false )
{
// d... | <p>Assuming fopen URL Wrappers are on ...</p>
<pre><code>$string = file_get_contents('http://example.com/file.html');
if(strpos ('maybe baby love you', $string) === false){
//do X
}
</code></pre>
| 34,880 |
<p>When I call CreateProcess in Windows, the new process doesn't seem to inherit the console of the calling process. I made a test program that runs "ruby xtest", xtest being a script that writes "hello" to standard output. I ran this test program from Emacs, and get no output. I also tried the following code callin... | <p>I know, this thread is rather old, however, I just ran into the same problem.</p>
<p>Just as for the TS, the console handle was inherited and working fine under Cygwin, but not on a Windows console. Instead, the output on stdout was neither shown, nor any error was reported. Inherited Pipe handles worked still fine... | <p>I've done this by passing in pipes for <code>hStdInput</code>, <code>hStdOutput</code>, and <code>hStdError</code> and manually routing data from the <code>hStdOutput</code> and <code>hStdError</code> pipes to the console.</p>
| 44,221 |
<p>We're developing an EPiServer-based website and trying to deploy our latest build onto a WinXP IIS6 box.</p>
<p>When browsing to site, we're getting the following stack trace</p>
<pre><code>[ClassFactoryException: ClassFactory not initialized]
EPiServer.BaseLibrary.ClassFactory.get_Instance() +123
EPiServer.... | <p>The configuration file is written for IIS7 but you build in webserver in Studio want a IIS6 sonfig file.
I have wrote abut this in ny EPiServer notes
<a href="http://epiwiki.se/troubleshooting/classfactory-not-initialized" rel="nofollow noreferrer">http://epiwiki.se/troubleshooting/classfactory-not-initialized</a> ... | <p>I am going out on a limb and guessing here, but did you by chance do development on EPiServer 5 SP 2 and deploy on EPiServer 5 SP 3?</p>
<p>In EPiServer 5 SP3 there was some remodelling in how a EPiServer handles the initialization of the application. These changes made it so that it's not possible to hook into the... | 25,014 |
<p>When objects from a CallList intersect the near plane I get a flicker..., what can I do?</p>
<p>Im using OpenGL and SDL.</p>
<p>Yes it is double buffered.</p>
| <p>It sounds like you're getting z-fighting.</p>
<p>"Z-fighting is a phenomenon in 3D rendering that occurs when two or more primitives have similar values in the z-buffer, and is particularly prevalent with coplanar polygons. The effect causes pseudo-random pixels to be rendered with the color of one polygon or anoth... | <p>Ah, you meant the <em>near</em> plane. :)</p>
<p>Well...another thing when drawing polygons in the same plane is to use <a href="http://www.cs.sfu.ca/~haoz/teaching/htmlman/polygonoffset.html" rel="nofollow noreferrer">glPolygonOffset</a></p>
<p>From the description</p>
<pre><code> glPolygonOffset is useful for ... | 7,903 |
<p>I have a Excel macro that generates a this error whenever it gets input of a specific format. Does anyone knows <strong>in general</strong> what an <em>advise flag</em> is OR where can I find information on this type of error? Thanks</p>
<blockquote>
<p>Runtime error -2147221503
(80040001): Automation error, In... | <p>I don't put in comments like that, the source control system already maintains that history and I am already able to log the history of a file.</p>
<p>I do put in comments that describe why something non-obvious is being done though. So if the bug fix makes the code less predictable and clear, then I explain why.</... | <p>To locate ones specific comment we use <strong>DKBUGBUG</strong> - which means David Kelley's fix and reviewer can easily identity, Ofcourse we will add Date and other VSTS bug tracking number etc along with this. </p>
| 15,075 |
<p>There's this program, pdftotext, that can convert a pdf file to a text file. To use it directly on the linux console:</p>
<pre><code>pdftotext file.pdf
</code></pre>
<p>That will generate a file.txt on the same directory as the pdf file. I was looking for a way to do it from inside a php program, and after some go... | <p>It's probably a permissions issue, but try this instead:</p>
<pre><code><?php
system('pdftotext file.pdf 2>&1');
?>
</code></pre>
<p>The <code>2>&1</code> redirects stderr to stdout, so any error messages will be printed. It should be pretty easy to fix from then on.</p>
| <p>PHP has a build in PDF function library, that should be able to give you what you need:<br>
<a href="http://nl3.php.net/pdf" rel="nofollow noreferrer">http://nl3.php.net/pdf</a></p>
| 42,013 |
<p>The website works with Wemf and Google Analytics, but they are giving me very different results; WEMF counts 10 - 30 % more page views than Google Analytics... Why can this be?</p>
<p>Google Analytics works only with JavaScript enabled, yes - but I don't think that's the reason for this difference. The site which s... | <p>Don't know much about WEMF. Could it be that Google Analytics does a better job at detecting and not counting search engine spider traffic?</p>
| <p>Yes!!! I googled a little bit for "Google Analytics search engine spider" and it really seems as Google Analytics doesn't count those...</p>
<p>Thank you very much for that info, helped a lot!</p>
| 24,027 |
<p>I'm not entirely sure if this is possible in Ruby, but hopefully there's an easy way to do this. I want to declare a variable and later find out the name of the variable. That is, for this simple snippet:</p>
<pre><code>foo = ["goo", "baz"]
</code></pre>
<p>How can I get the name of the array (here, "foo") back? I... | <p>What if you turn your problem around? Instead of trying to get names from variables, get the variables from the names:</p>
<pre><code>["foo", "goo", "bar"].each { |param_name|
param = eval(param_name)
if param.class != Array
puts "#{param_name} wasn't an Array. It was a/an #{param.class}"
return "Error:... | <p>You can't, you need to go back to the drawing board and re-engineer your solution.</p>
| 8,282 |
<p>I recently ran across some 3rd party C# code which does the following:</p>
<pre><code>public int RecvByteDataFromPrinter(ref byte[] byteData)
{
byte[] recvdata = new byte[1024];
///...fills recvdata array...
byteData = recvdata;
return SUCCESS;
}
</code></pre>
<p>What does the line "<code>... | <p>Yes, because of ref - it does modify the reference passed.
Stick around? you mean - not destroyed? Yes, it will not be GC'd because of a new reference. The old array (passed) might be GC'd though after this assignment if no more references...</p>
<p>Array.Copy will actually copy elements, then you don't need "ref",... | <p>The byteData reference will now be pointing at the recvdata array, giving it a root. It will "stick around" until all of its roots are gone (i.e. the called gets rid of the byteData object passed in) and it becomes a collection candidate. The original array object passed is is a candidate for collection as soon as... | 38,937 |
<p>Typical scenario. We use old-school XML Web Services <em><code>internally</code></em> for communicating between a server farm and several distributed <em>and</em> local clients. No third parties involved, only our applications used by ourselves and our customers.</p>
<p>We're currently pondering moving from <code>X... | <p>In my experience DTOs are most useful for:</p>
<ol>
<li>Strictly defining what will be sent over the wire and having a type specifically devoted to that definition.</li>
<li>Isolating the rest of your application, client and server, from future changes.</li>
<li>Interoperability with non-.Net systems. DTOs certain... | <p>Having worked with both approaches (shared domain objects and DTOs) I'd say the big problem with shared domain objects is when you don't control all clients, but from my past experiences I'd usually use DTOs unless it development speed were of the essence.</p>
<p>If there's any chance that you won't always be in co... | 4,496 |
<p>If I can do this, how do I call Java code (methods for instance) from within JavaScript code, in Wicket. </p>
| <p>erk. The correct answer would be ajax call backs. You can either manually code the js to hook into the wicket js, or you can setup the callbacks from wicket components in java.
For example, from AjaxLazyLoadPanel:</p>
<pre><code> component.add( new AbstractDefaultAjaxBehavior() {
@Override
p... | <p>Assuming you mean JavaScript running on the client - you cause an HTTP redirect to be made to the server, and have your servlet react to the request for the given URL.</p>
<p>This is known as <a href="http://www.jibbering.com/2002/4/httprequest.html" rel="nofollow noreferrer">Ajax</a>, and there are a <a href="http... | 19,699 |
<p>My mouse, in my virtual server virtual machine is all jittery, and not working smoothly.<br>
Outside the virtual machine it is fine.</p>
<p>My mouse is set to use the VMWare Pointing Device, which it says is working properly.
I've tried the sample rate in 100 and 200 reports/second and it makes no difference.</p>
... | <p>Install VMware Tools and enable Full Acceleration in Display Properties -> Advanced -> Troubleshoot Tab on the VMware machine.</p>
| <p>Also, make sure the mouse is using VMware drivers. Sometimes it reverts to general PS/2 drivers, which can cause very irritating lag.</p>
| 23,293 |
<p>I have a K280 3D printer with a MKS V1.5 and Repetier firmware.</p>
<p><a href="https://i.stack.imgur.com/yCoXM.jpg" rel="nofollow noreferrer" title="Damaged transistor associated with E0 (3rd one on the right)"><img src="https://i.stack.imgur.com/yCoXM.jpg" alt="Damaged transistor associated with E0 (3rd one on th... | <p>If you go through the <a href="https://www.repetier.com/firmware/v100/index.php" rel="nofollow noreferrer">Repetier-Firmware configuration tool for version 1.0.2</a> you can select the E1 stepper for the E0 extruder (or whatever stepper you want to use for it) in the tools tab sheet. I'm not familiar with Repetier, ... | <p>You can try editing the gcodes by searching and replacing E0 for E1, so this way the extruder E1 will be enabled.</p>
<p>Other way is setting the Slicer to use 2 extruders but everything for printing on E1 like: Perimeter, Infill, Solid, Support/raft/skirt, Support / raft interface.</p>
<p>The third one, Switch th... | 771 |
<p>How to check if a folder (directory) exists in Cocoa using Objective-C?</p>
| <p>Use <code>NSFileManager</code>'s <code>fileExistsAtPath:isDirectory:</code> method. See Apple's docs <a href="https://developer.apple.com/documentation/foundation/nsfilemanager/1410277-fileexistsatpath?language=objc" rel="nofollow noreferrer">here</a>.</p>
| <p>If your have a <code>NSURL</code> object as <code>path</code>, it's better to use path to convert it into <code>NSString</code>.</p>
<pre><code>NSFileManager*fm = [NSFileManager defaultManager];
NSURL* path = [[[fm URLsForDirectory:NSDocumentDirectory
inDomains:NSUserDomainMask] objectA... | 12,462 |
<p>Say I have the following string:</p>
<pre><code>"I am the most foo h4ck3r ever!!"
</code></pre>
<p>I'm trying to write a makeSpecial(foo) function where the foo substring would be wrapped in a new span element, resulting in:</p>
<pre><code>"I am the most <span class="special">foo></span> h4ck3r eve... | <p>How about this:</p>
<pre><code>Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> def makeSpecial(mystring, special_substr):
... return mystring.replace(special_substr, '<span class="special... | <p>If you wanted to do it with javascript/jQuery, take a look at this question: <a href="https://stackoverflow.com/questions/119441/highlight-a-word-with-jquery">Highlight a word with jQuery</a></p>
| 15,207 |
<p>Maybe this is a dumb question, but I have the following behavior in Visual Studio 2005 while designing forms:</p>
<p>1 - Drop a control onto the form (suppose it's a Label, just for discussion)</p>
<p>2 - Drag that label to a specific location (aligning w/other controls, whatever)</p>
<p>3 - Release the mouse but... | <p>Depends what language you're using, but an IP address is usually stored as a 32-bit unsigned integer, at least at the network layer, making comparisons quite fast. Even if it's not, unless you're designing a high performance packet switching application it's not likely to be a performance bottleneck. Avoid premature... | <p>if you receive the IP address as a string, comparing it to a string may be more efficient than converting it to integer representation</p>
<p>but i'd profile both solutions to be certain, if a few milliseconds (nanoseconds!) are going to matter on this operation ;-)</p>
| 19,431 |
<p>I am extending Alfresco Web Client and in one page while expanding panels I get this error. I do not get it always.</p>
<pre><code>JSF : java.lang.IllegalStateException: Client-id : _idJsp35 is duplicated in the faces tree in Alfresco Web Client
</code></pre>
<p>I tried to give every component possible unique id, ... | <p>Whenever I have seen this it has been due to duplicate ids in your JSP.</p>
| <p>Aren't you better off not specifying ids, and let JSF do the work for you?</p>
| 42,044 |
<p>When I need some complex algorithm I first check if there's anything relevant already published on the Internet. 10 times out of 10 I'll find that someone already have figured out a solution much smarter than what I would have thought of.</p>
<p>Apart from a generic Google search, I use:</p>
<ul>
<li><strong><a hr... | <p>Google’s <a href="http://code.google.com/edu/curriculumsearch/" rel="nofollow noreferrer">CS Curriculum Search</a> might be useful. It's a Google web search restricted to the CS departments of universities. It categorises the results into “Lectures”, “Assignments” and “Reference”.</p>
<p>Also <a href="http://www.s... | <p>There are fantastic mathematical libraries around for which you pay modest cost and get the <em>whole</em> library, in executable form, already ported to your platform. NAG - Numerical Algorithms Group, is by far the best well known, but there are others.</p>
| 22,824 |
<p>How would I return multiple values (say, a number and a string) from a user-defined function in SQL Server?</p>
| <p>Change it to a table-valued function</p>
<p>Please refer to the following <a href="http://technet.microsoft.com/en-us/library/ms191165.aspx" rel="noreferrer">link</a>, for example.</p>
| <h3>Example of using a stored procedure with multiple out parameters</h3>
<p>As User <code>Mr. Brownstone</code> suggested you can use a <a href="http://msdn.microsoft.com/en-us/library/ms345415.aspx" rel="nofollow noreferrer">stored procedure</a>; to make it easy for all i created a minimalist example. First <a href=... | 35,238 |
<p>I'd like to build a query string based on values taken from 5 groups of radio buttons.</p>
<p>Selecting any of the groups is optional so you could pick set A or B or both. How would I build the querystring based on this? I'm using VB.NET 1.1</p>
<p>The asp:Radiobuttonlist control does not like null values so I'm r... | <p>The easiest way would be to use a non-server-side <form> tag with the method="get" then when the form was submitted you would automatically get the querystring you are after (and don't forget to add <label> tags and associate them with your radio buttons):</p>
<pre><code><form action="..." method="ge... | <p>You could use StringBuilder instead of creating those three different strings. You can help it out by preallocating about how much memory you need to store your string. You could also use String.Format instead.</p>
<p>If this is all your submit button is doing why make it a .Net page at all and instead just have a ... | 10,735 |
<p>I'm binding a datatable to a gridview control, and when I format each column I need to format the data based on whether that column has a particular custom attribute. In this case, a column can represent:</p>
<ul>
<li>a text box (in which case I just display the text from the textbox in the gridview), </li>
<li>a c... | <p>Okay- I added extended properties to the DataTable columns with the proper data type and checked them on the GridView's RowDataBound event in a loop from 1..numColumns:</p>
<p>myProperty=e.Row.DataItem.dataview.table.columns(i).extendedproperties("TYPE")</p>
<p>and set the value (e.Row.Cells(i).Text) based on the... | <p>I'm okay with templatefields; what I don't know is how to add metadata to my datatable columns that I can read during GridView databinding. E.g. when I'm binding to a column that has checkbox data, I want to put the word "Checked" or "Unchecked" in the column, but I need to somehow annotate my data table so it conta... | 34,324 |
<p>I'd like to slice and dice large datafiles, up to a gig, in a fairly quick and efficient manner. If I use something like UNIX's "CUT", it's extremely fast, even in a CYGWIN environment. </p>
<p>I've tried developing and benchmarking various Ruby scripts to process these files, and always end up with glacial result... | <p>This question reminds me of Tim Bray's <a href="http://www.tbray.org/ongoing/When/200x/2007/09/20/Wide-Finder" rel="nofollow noreferrer">Wide Finder project</a>. The fastest way he could read an Apache logfile using Ruby and figure out which articles have been fetched the most was with this script:</p>
<pre><code>c... | <p>I doubt the problem is that ruby is reading the whole file in memory. Look at the memory and disk usage while running the command to verify.</p>
<p>I'd guess the main reason is because cut is written in C and is only doing one thing, so it has probably be compiled down to the very metal. It's probably not doing a l... | 15,092 |
<p>I'll try to explain my scenario as best i can;</p>
<p>At each application <em>tick</em> I query the current state of the keyboard and mouse and wrap them in individual classes and data structures. For the keyboard it's an array of my <em>Keys</em> enum (one item for each of the keys that are currently pressed) and ... | <p>Why are you querying the state of the keyboard and mouse with each tick? A much better and traditional solution would be to capture events fired from the keyboard and mouse. That way you only need to update the state when you HAVE to.</p>
| <p>You should fire events and capture the arguments. That would be the easiest, and most efficient way to handle this.</p>
<pre><code>class YourClass
{
//data members ...
public void OnKeyboardPress(object sender, EventArgs args)
{
//handle your logic capturing the state here
}
}
//elsewh... | 30,119 |
<p>I have a threading issue,</p>
<p>I'm setting the <code>ThreadPool.SetMaxThreads(maxThreads, System.Environment.ProcessorCount)</code> to 10.</p>
<p>But when I check how many are avaliable <code>ThreadPool.GetAvailableThreads()</code> it says there are (maxThreads - 1) so 9, but then goes on to use 10 threads.</p>
... | <p>In an ideal world, we would have 1 thread/physical core. That way, we would no longer have context switches, which are rather costly operations. But until we have processors with hundreds of cores, that won't be practical. </p>
<p>Anyway, as Marc suggested, you shouldn't mess with the ThreadPool parameters unless y... | <p>One of the threadpool threads is monitoring the wait operations of the other threads in the thread pool. That should explain the maxthreads - 1 result.</p>
<p>I am not sure why it would appear to use all 10 threads then. It might be that it is using 9 for your work, 1 for monitoring and queuing the other.</p>
| 41,455 |
<p>I have a few controls that inherit from <code>ASP.NET buttons</code> and use <code>onserverclick</code>.</p>
<p>If the user clicks twice, the button fires two server side events. How can I prevent this?</p>
<p>I tried setting <code>this.disabled='true'</code> after the click (in the <code>onclick</code> attribute)... | <p>See this example for disabling control on postback. It should help you do what you're trying to achieve.</p>
<p><a href="http://encosia.com/2007/04/17/disable-a-button-control-during-postback/" rel="noreferrer">http://encosia.com/2007/04/17/disable-a-button-control-during-postback/</a></p>
| <p>You can also try for example btnSave.Enable = false; when the button is hit and before the processing for the button is done in the Click Event routine. If you need it to be reset to allow it to be enabled have a separate button that resets the button for reuse. </p>
<p>Another method is to set the button with ve... | 7,323 |
<p>I've problem with sending HTML mails with <a href="http://phpmailer.worxware.com/index.php?pg=phpmailer" rel="nofollow noreferrer">PHPMailer</a>. I make a <a href="http://en.wikipedia.org/wiki/Smarty" rel="nofollow noreferrer">Smarty</a> template and I got all the HTML code from it. But when I send mail, I got the m... | <p>There's is a way...</p>
<pre><code> $body = <<< YOUR_HTML_WITH_CSS_STYLE_TAGS
<html>
<head>
<style>
body * {width:1px;}
#adiv {padding:2px;}
.aclass {margin:3px;}
</style>
</head>
<body>
<div>
some html
</div>... | <p>How is your stylesheet referenced?</p>
<p>For email you will either have to provide an absolute path to your stylesheet or include the styles in the head of the template</p>
| 46,786 |
<p>On large files (~200+ MB), I get the 503 error when I read the stream.</p>
<pre><code>ftp = (FtpWebRequest)WebRequest.Create(new Uri(address.AbsoluteUri + @"/" + file.Name));
ftp.Credentials = new NetworkCredential(username, password);
ftp.Method = WebRequestMethods.Ftp.DownloadFile;
response = (FtpWebResponse)ftp... | <p>Do you receive the 503 after every attempt or only subsequent attempts?</p>
<p>Have you tried setting the disabling KeepAlive?</p>
<pre><code>ftp.KeepAlive = false;
</code></pre>
<p>I would try a more rubust ftp client library, a basic free one can be at <a href="http://sourceforge.net/projects/dotnetftpclient/" ... | <p>In my case, the server (belonging to a client) had been changed to only accept TLS (SSL) requests. They didn't tell us this of course and the 503 error message was not helpful!</p>
<p>So we needed to use <code>.EnableSsl</code> like this:</p>
<pre><code> var ftp = WebRequest.Create(uri) as FtpWebRequest;
... | 31,467 |
<p>I'm looking at building basic CMS functionality into our web product and am researching tips and design ideas for versioning content. I'm specifically looking for database schemas in use today.</p>
<p>What are you using for content versioning? What patterns apply if you have different types of content that need ver... | <p>Literature uses a 5 dimensional model for this:</p>
<ul>
<li>version (wanting to change)</li>
<li>status (life cycle: creating, testing, deploy, retire)</li>
<li>view (html, pdf, file system, derivability)</li>
<li>hierarchy (page, section, paragraph)</li>
<li>variant (largely similar, describing the differences, p... | <p>My gut instinct is that the best thing for this is (in order of bestitude):</p>
<ol>
<li>A ready version control system. <a href="http://en.wikipedia.org/wiki/List_of_revision_control_software" rel="nofollow noreferrer">A nice list here.</a></li>
<li>Storing diffs. <a href="http://en.wikipedia.org/wiki/Diff" rel="n... | 34,027 |
<p>I find it annoying that I can't clear a list. In this example:</p>
<pre><code>a = []
a.append(1)
a.append(2)
a = []
</code></pre>
<p>The second time I initialize a to a blank list, it creates a new instance of a list, which is in a different place in memory, so I can't use it to reference the first, not to mentio... | <p>You are looking for:</p>
<pre><code>del L[:]
</code></pre>
| <p><strong><em>this can help you::)</em></strong></p>
<pre><code>L[:] = []
</code></pre>
| 20,103 |
<p>Found some old code, circa VS 2003. Now I have just VS 2008 (SP1) installed. When I try opening the *.sln file, it tries converting the projects. The report notifies me it was done successfully, but the solution is empty, marked with "project file was unloaded".
VS 2008 doesn't even include opening a *.vcproj file.<... | <p>I suggest manually converting the project by creating a new proj. If you are having trouble now then there will be no way that you can be certain later by trying some other import method.</p>
<p>On a side note- I am on vs2005 and I often get 2008 projects handed to me. I go into the sln and proj files and rename ... | <p>Maybe you could first convert your solution from VS2003 to VS2005 and then do one more conversion from VS2005 to VS2008 ??? </p>
| 37,302 |
<p>I have no frame of reference in terms of what's considered "fast"; I'd always wondered this but have never found a straight answer...</p>
| <p>OpenStreetMap seems to have <a href="http://munin.openstreetmap.org/openstreetmap/puff.openstreetmap-lighttpd_accesses.html" rel="noreferrer">10-20 per second</a></p>
<p>Wikipedia seems to be <a href="http://toolserver.org/~leon/stats/reqstats/reqstats-weekly.png" rel="noreferrer">30000 to 70000 per second</a> spre... | <p>I have a customer that uses our software on a commercial web app servers. The software runs on 40 servers. The software is a 10 year old Java API.</p>
<p>4000 TPS.</p>
| 48,788 |
<p>I'm starting a project that will be public facing using asp.net mvc. I know there are about a billion php, python, and ruby html sanitizers out there, but does anyone have some pointers to anything good in .net? What are your experiences with what is out there? I know stackoverflow is a site done in asp.net that all... | <h3><a href="http://www.nuget.org/packages/HtmlSanitizer/" rel="noreferrer">HtmlSanitizer</a></h3>
<p>Source: <a href="https://github.com/mganss/HtmlSanitizer" rel="noreferrer">https://github.com/mganss/HtmlSanitizer</a></p>
<p>A fairly robust sanitizer. It understands and can clean inline styles, but doesn't have a pa... | <p>We can also use</p>
<p>AntiXss.GetSafeHtmlFragments </p>
<p>sanitize input by parsing the HTML fragment,to use this sanitizer for rich content to ensure that it does not content any harmful script and it is safe to be displayed on the browser.For the text input(not rich content) to use AntiXss.HtmlEncode or any ot... | 44,434 |
<p>Looking for a toolkit/SDK for general Blackberry development or application toolkits. Anything like an MVC framework?</p>
| <p>My understanding is that blackberry's OS is Java ME - based, and that there's a decent development kit for them. I presume you have already <a href="http://na.blackberry.com/eng/developers/" rel="noreferrer">looked over everything here</a>... you can find a lot of information, including the development kit download... | <p>I'm not sure exactly what you are looking for beyond the standard SDKs, but you could check out Plazmic's Content Developer Kit:</p>
<p><a href="http://www.plazmic.com/en/index.shtml" rel="nofollow noreferrer">http://www.plazmic.com/en/index.shtml</a></p>
| 24,265 |
<p>Just after a bit of confirmation really:</p>
<p>Does XP SP3 implement the User Interface Privilege Isolation (UIPI) mechanism found in Vista?</p>
<p>Back story for human interest :)
I've recently been handed the C++ source to a fairly large application. Sadly the sole developer of this application, since its incep... | <p>No, XP SP3 doesn't implement any of the Vista security changes, at least not any related to the window manager. You don't really give much background to help, but what sort of error do you get that's associated with SendMessage()?</p>
<p>SendMessage() is a very widely used routine that simply dispatches a Windows m... | <p>UIPI doesn't report errors on SendMessage - if you're getting an error returned, then it's something else. And the other commenters are right, UIPI is on Vista only, and you wouldn't get bit by this <em>anyways</em> unless you were trying to send a message to a service, for example.</p>
| 34,244 |
<p>I've been reading some tutorials on how to get started using Rails 2.0.</p>
<p>(Time out: genius website name idea conceived from a typo I just made: "tutoRAILS." Sorry, back to my question.)</p>
<p>In most of the tutorials I've been reading, it seems to encourage using MySQL instead of sqlite3. Is there a reason ... | <p>SQLite is a good engine, but it's still an <em>in process</em> (or desktop) style engine. In process engines have inherent weaknesses in terms of concurrency that make them a fundamentally poor choice over server-based engines like MySQL for web sites or other scenarios with the potential for a lot of simultaneous... | <p>Note that Sqlite is the default engine for the <a href="http://redhanded.hobix.com/bits/campingAMicroframework.html" rel="nofollow noreferrer">Camping</a> framework. Makes sense since both are aimed at small and fast, not big and enterprisey</p>
| 46,564 |
<p>Is there an IDE that I can load on a Blackberry, E71, or an iPhone?</p>
| <p>Apple released iPhone SDK for XCode a while back, check out developer.apple.com and Nokia also release their own SDK check out forum.nokia.com</p>
<p>But for pure Java Midlet goodness, i would recommend Netbeans (netbeans.org) their netbeans mobile application editor is a gem, second to none.</p>
<p>To answer your... | <p>Not that I know of, typically you'll develop apps on a desktop machine (PC/MAC whatever) and download/control the application on the phone. Also I don't think Java is available on a standard (non-cracked) iPhone.</p>
| 6,213 |
<p>i am working on a simple web app which has a user model and role model (among others), and an admin section that contains many controllers. i would like to use a before_filter to check that the user of the user in the session has a 'can_access_admin' flag.</p>
<p>i have this code in the application.rb:</p>
<p>def ... | <p>just a guess but it seems that your session[:user] is just storing the id, you need to do:</p>
<pre><code>@user = User.find(session[:user])
</code></pre>
<p>or something along those lines to fetch the user from the database (along with its associations). </p>
<p>It's good to do the above in a before filter too.</... | <p>Is session[:user] holding the user? or the user_id? You may need a lookup before you call .role.</p>
| 17,116 |
<p>The project I am working on were are trying to come up with a solution for having the database and code be agile and be able to be built and deployed together.</p>
<p>Since the application is a combination of code plus the database schema, and database code tables, you can not truly have a full build of the applica... | <p>You need a build process that constructs the database schema and adds any necessary bootstrapping data. If you're using an O/R tool that supports schema generation, most of that work is done for you. Whatever is not tool-generated, keep in scripts.</p>
<p>For continuous integration, ideally a "build" should inclu... | <p>Make sure that your O/R-Mapping tool is able to build the necessary tables out of the default configuration it has and also add missing columns. This should cover 90% of your cases.</p>
<p>The other 10% are</p>
<ul>
<li>coping with missing values for columns that where added after the data was inserted</li>
<li>wr... | 47,574 |
<p>I came across a controller in an older set of code (Rails 1.2.3) that had the following in a controller:</p>
<pre><code>class GenericController > ApplicationController
# filters and such
model :some_model
</code></pre>
<p>Although the name of the model does not match the name of the model, is there any ... | <p>This had to do with dependency injection. I don't recall the details.</p>
<p>By now it's just a glorified <code>require</code>, which you don't need because rails auto-requires files for missing constants.</p>
| <p>Yes, that is something that has disappeared in later versions of Rails. There is no need to specify it.</p>
| 11,965 |
<p>I can't be sure if my code is sucking, or if it's just that the browsers haven't caught up with the spec yet.</p>
<p>My goal is to simulate list markers using generated content, so as to get e.g. continuation of the counters from list to list in pure CSS.</p>
<p>So the code below, which I <em>think</em> is correct... | <p>Apparently marker was introduced as a value in CSS 2 but did not make it to CSS 2.1 because of lacking browser support.
I suppose that didn’t help its popularity …</p>
<p>Source: <a href="http://de.selfhtml.org/css/eigenschaften/positionierung.htm#display" rel="nofollow noreferrer">http://de.selfhtml.org/css/eigens... | <p>Oh ouch, did not know that :-|. That probably seals its case, then. Because mostly I was under the assumption that such a basic CSS2 property should definitely be supported in modern browsers, but if it didn't make it into CSS 2.1, then it makes a lot more sense that it isn't.</p>
<p>For future reference, it doesn'... | 7,289 |
<p>Is there a way of getting all required assemblies (excluding the .net framework) for a .net project into a folder ready to be packaged into an <a href="http://nsis.sourceforge.net/Main_Page" rel="nofollow noreferrer">nsis</a> as setup file?</p>
<p>I've tried writing a small console app that uses reflection to get a... | <p>In Visual Studio (2005 at least - what I'm using right now), each reference that you have associated to a project has a property called "Copy Local", this can be set to true/false. When true it will copy the dll's for you into the current configuration directory.</p>
| <p><a href="http://www.dependencywalker.com" rel="nofollow noreferrer">Dependency Walker</a> is what you need. Or maybe <a href="http://www.netomatix.com/Development/DependsNet.aspx" rel="nofollow noreferrer">Depends.Net</a></p>
| 7,525 |
<p>I have some products that belongs to the some category.</p>
<p>Each category can have different properties.</p>
<p>For example, </p>
<ul>
<li>category <em>cars</em> has properties <em>color</em>,
power, ... </li>
<li>category <em>pets</em> have properties <em>weight</em>, <em>age</em>, ...</li>
</ul>
<p>Number ... | <p>The classic design approach would be (the star denotes the primary key column):</p>
<pre><code>Product
ProductId*
CategoryId: FK to Category.CategroyId
Name
Category
CategoryId*
Name
Property
PropertyId*
Name
Type
CategoryProperty
CategoryId*: FK to Category.CategoryId
PropertyId*: FK to Prop... | <p>If you want to be flexible on your categories and properties, you should create following tables:</p>
<ul>
<li>product: ProductID</li>
<li>category: CategoryID, ProductID</li>
<li>property: PropertyID, CategoryID</li>
</ul>
<p>when you want to share a category over mroe than one product, you have to create a link ... | 27,319 |
<p>Currently Tomcat's login support redirects users back to where they initially were when the application figured out they weren't logged in.</p>
<p>For this particular application I need to force them to always go back to <code>index.jsp</code>.</p>
<p>I'm pretty sure this is a simple configuration option in the WA... | <p>A better solution would probably be to use a servlet filter.
You could then check for j_username / j_password, and a successful login and redirect them where you wanted them to go.</p>
| <p>It's something you can't configure in web.xml as it is not part of the standard. For Tomcat (tested on version 6.0.14) you can force users back to index.jsp by adding the next code on top of your login.jsp. It redirects every request that does not have a parameter with the name 'login' in the url to the /index.jsp?l... | 16,254 |
<p>If I have .Net Form with a component/object such as a textbox that I need to access from a parent or other form I obviously need to "upgrade" the modifier to this component to an Internal or Public level variable.</p>
<p>Now, if I were providing a public variable of an int or string type etc. in my form class I wou... | <p>"<em>However, the VS designer doesn't seem to implement such Getters/Setters for those public objects that are components on a form (and therefore does not comply with good programming practice).</em>"</p>
<p>If you mean the controls you're dragging and dropping onto the form, these are marked as private instance m... | <p>I always do that, and if you ARE following an MVP design creating getter/setters for your view components would be a design requirement.</p>
<p>I do not understand what you mean by "does not comply with good programming practice". Microsoft violates <em>a lot</em> of good programming practices to make it easier to ... | 2,785 |
<p>I would like to programatically shutdown a Windows Mobile device using Compact framework 2.0, Windows mobile 5.0 SDK.</p>
<p>Regards,</p>
| <p>It probably not a great idea to do it from your app - the device has a power button for a reason and shutting down the app can cause user confusion and frustration.</p>
<p>If you must do it, and you are using Windows Mobile 5.0 or later, you can P/Invoke <a href="http://msdn.microsoft.com/en-us/library/bb416523.asp... | <p>The "normal" Windows API has ExitWindowsEx() function. You might want to check this out.
It appears however that it is <a href="http://www.themssforum.com/Compact/ExitWindowsEx/" rel="nofollow noreferrer">OEM dependant</a>.</p>
| 25,431 |
<p>I know how to set up a local webserver using xampp on windows... I enter my alias and target on the hosts file (c:\windows\system32\drivers\etc\hosts) and then add a respective entry on my apache vhosts config file. This way, assuming that my webserver is listening to port 80, I can for example map <code>example.com... | <p>Internet Junkbuster (a proxy server) can do this using its <a href="http://www.junkbuster.com/ijbman.html#o_f" rel="nofollow noreferrer">forwarding</a> functionality.</p>
<p>Just add a line like</p>
<pre><code>example.com:8080 localhost:80 . .
</code></pre>
<p>to <code>sforward.ini</code>, and uncomment the... | <p>Can you confirm if 8080 port is listening on webserver? use the command "netstat -na" to see if the port 8080 is listening.</p>
<p>Did you add 8080 port on apache config file as the same as the default 80 port?</p>
<p>Once you add port 8080 on apache config file to make it listen and double check if 8080 port is l... | 43,099 |
<p>I'm writing a website in JSP using Struts and Hibernate. I'm looking for a way to implement a rich UI where you can have more than just buttons. For examples, drag and drops, drop down lists that updates itself in real time as you type more letters out etc. Is there a way to use something like Swing with Struts and ... | <p>As far as I know, there's not going to be a 100% foolproof solution, as not all email clients or gateways preserve or respect all headers.</p>
<p>However, you'll get a pretty high hit rate with the following:</p>
<ul>
<li><p>Every email message should have a unique "Message-ID" field. Find this, and keep a... | <p>As far as I know, there's not going to be a 100% foolproof solution, as not all email clients or gateways preserve or respect all headers.</p>
<p>However, you'll get a pretty high hit rate with the following:</p>
<ul>
<li><p>Every email message should have a unique "Message-ID" field. Find this, and keep a... | 36,763 |
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/255470/what-are-the-different-doctypes-in-html-and-what-do-they-mean">What are the different doctypes in html and what do they mean?</a> </p>
</blockquote>
<p>Being fairly inexperienced with certain aspects of ... | <p>John Resig (jQuery) <a href="http://ejohn.org/blog/html5-doctype/" rel="nofollow noreferrer">has a say</a> in that matter. Additionally, a DocType helps make MSIE6 <a href="http://msdn.microsoft.com/en-us/library/bb250395.aspx#cssenhancements_topic2" rel="nofollow noreferrer">use the right box model</a>, and it also... | <p>Disregarding all good practices, the biggest reason people use a DOCTYPE such as XHTML 1.0 Transitional is to switch the CSS box model in IE to be the same as the rest of the browsers. This circumvents much frustration with CSS layout. It is explained here in more detail: <a href="http://css.maxdesign.com.au/listama... | 33,418 |
<p>In other languages you can use strings as keys -</p>
<p>PHP:</p>
<pre><code>$array['string'] = 50;
$array['anotherstring'] = 150;
</code></pre>
<p>Is this possible in VBA?</p>
| <p>In VBA you can create a Collection object. Items in the collection can be accessed by index (Long integer) or by a string key.</p>
| <p>I haven't used VBA in a long time, but those are not arrays, they are <a href="http://www.perl.com/pub/a/2006/11/02/all-about-hashes.html" rel="nofollow noreferrer">hashes</a> (in perl) and <a href="http://www.onlamp.com/pub/a/php/2001/06/21/php_foundations.html" rel="nofollow noreferrer">associative arrays</a> (in ... | 41,161 |
<p>I find System.Monitor very confusing, although I understand threading, locks, deadlocks, race conditions, dining philosophers and all that jazz. Normally I use a ManualResetEvent() to do inter-thread co-ordination, but I know that that's a heavyweight kernel object, and that System.Monitor (Enter/Pulse, etc.) is mu... | <p>Here's a very simple example; the call to <code>Wait</code> releases the lock (allowing <code>Worker</code> to obtain it) and adds the <code>Main</code> thread to the lock-object's pending queue. <code>Worker</code> then obtains the lock, and calls <code>Pulse</code>: this moves the <code>Main</code> thread into the... | <p>See if <a href="http://pobox.com/~skeet/csharp/threads/deadlocks.shtml" rel="nofollow noreferrer">this part of my threading article</a> helps... (the second half of that page). It implements a producer/consumer queue: when the producer produces something in the queue (and finds it was empty - as an optimisation), it... | 28,335 |
<p>Is it possible to create a multithreading application in VC6 with boost library?
If it is possible, what are some relevant tutorials.</p>
| <p>Yes, I have done this successfully, but with Boost v1.30.0. So if you have trouble with the latest versions of the Boost libraries, you might want to go back a year or five. I recall I started getting all sorts of internal compiler errors, <em>et al.</em>, when trying to upgrade Boost -- so I didn't, but rather went... | <p>A quick google for "boost thread example" turns up lots of good hits.</p>
| 35,425 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.