instruction stringlengths 14 27.6k | completion stringlengths 3 38.3k | __original_row_idx int64 0 50k | conversations listlengths 2 2 |
|---|---|---|---|
I have always been interested in algorithms, sort, crypto, binary trees, data compression, memory operations, etc.
I read Mark Nelson's article about permutations in C++ with the STL function next_perm(), very interesting and useful, after that I wrote one class method to get the next permutation in Delphi, since that ... | Certainly! The problem you're dealing with is generating permutations of a sequence with constraints on consecutive repetitions. While there isn't a standard algorithm that directly handles this specific case, you can create a custom approach to generate valid permutations by utilizing backtracking.
Here's a conceptua... | 49,046 | [
{
"from": "human",
"value": "I have always been interested in algorithms, sort, crypto, binary trees, data compression, memory operations, etc.\nI read Mark Nelson's article about permutations in C++ with the STL function next_perm(), very interesting and useful, after that I wrote one class method to get t... |
Using Linq to SQL:
if(!parentlist.childlist.Contains(row1))
parentlist.childlist.Add(row1);
else
How do I update the required childlist row with row1? Each row of the child list has a unique id.
parentlist implements IEnumerable and childlist is IList.
| To update a specific child in the `childlist` when the child already exists, you can use LINQ to find the existing child by its unique identifier. Assuming each child has a property called `Id`, you can update the existing child with the values from `row1`. Here’s how you can implement this:
```csharp
// Check if the ... | 49,834 | [
{
"from": "human",
"value": "Using Linq to SQL: \nif(!parentlist.childlist.Contains(row1))\n parentlist.childlist.Add(row1);\nelse\n\nHow do I update the required childlist row with row1? Each row of the child list has a unique id.\nparentlist implements IEnumerable and childlist is IList.\n"
},
{
... |
I need to extract some bitmaps from an .msstyles file (the Windows XP visual style files) and I'm not sure where to start. I can't seem to find any documentation on how to do it, and the file format seems to be binary and not easily parsed. I have been able to extract the bitmap by itself using:
IntPtr p = LoadLibrary(... | Extracting bitmaps and related metadata from a `.msstyles` file, which is a binary format used by Windows themes, requires understanding its internal structure. The `.msstyles` file contains different resources such as bitmaps, as well as data about the visual styles such as margins, padding, and other UI metrics.
###... | 41,243 | [
{
"from": "human",
"value": "I need to extract some bitmaps from an .msstyles file (the Windows XP visual style files) and I'm not sure where to start. I can't seem to find any documentation on how to do it, and the file format seems to be binary and not easily parsed. I have been able to extract the bitmap... |
There are several (very good) rich text web editors written in Javascript (eg FCKeditor, YUI Texteditor and many many others).
However I couldn't find any tutorial on how to build such a component. Something that would explain both high-level considerations (architecture) and/or more details in low-level "critical" poi... | Building a WYSIWYG (What You See Is What You Get) editor from scratch can be a complex yet rewarding project. Here are some key concepts, architectural considerations, and critical implementation points to guide you in developing your own rich text editor.
### High-Level Architecture
1. **Core Structure**:
- **Co... | 42,984 | [
{
"from": "human",
"value": "There are several (very good) rich text web editors written in Javascript (eg FCKeditor, YUI Texteditor and many many others).\nHowever I couldn't find any tutorial on how to build such a component. Something that would explain both high-level considerations (architecture) and/o... |
Say I have three classes:
class X{};
class Y{};
class Both : public X, public Y {};
I mean to say I have two classes, and then a third class which extends both (multiple-inheritance).
Now say I have a function defined in another class:
void doIt(X *arg) { }
void doIt(Y *arg) { }
and I call this function with an insta... | In C++, ambiguity in function calls can occur in several scenarios, particularly when dealing with function overloading and multiple inheritance. Here are the key cases that can lead to ambiguity, along with explanations of how the C++ compiler determines that the call is ambiguous:
### 1. **Function Overloading with ... | 48,117 | [
{
"from": "human",
"value": "Say I have three classes:\nclass X{};\nclass Y{};\nclass Both : public X, public Y {};\n\nI mean to say I have two classes, and then a third class which extends both (multiple-inheritance).\nNow say I have a function defined in another class:\nvoid doIt(X *arg) { }\nvoid doIt(Y ... |
Example: an Order object (aggregate root) has a collection of OrderLine objects (child entities). What's the URL add an OrderLine to an Order? Take into consideration the difference between using the aggregate roots' controller and having a separate controller for the child entity.
1: http://example.com/orders/add-orde... | The choice between the two URL designs depends on how you want to model the relationship between the `Order` and `OrderLine` entities in your API.
1. **Using the aggregate root's controller** (first option):
```
http://example.com/orders/add-orderline?order-id=42&product-id=12&quantity=2
```
This approach ... | 46,377 | [
{
"from": "human",
"value": "Example: an Order object (aggregate root) has a collection of OrderLine objects (child entities). What's the URL add an OrderLine to an Order? Take into consideration the difference between using the aggregate roots' controller and having a separate controller for the child enti... |
Greetings!
I'm creating a User Control that will display data in a GridView control. We are using n-tier architecture and the data in question is retrieved from our database and returned to us as a ReadOnlyCollection. OurNewObject is a class containing several properties and an empty constructor that takes no paramet... | It looks like you're on the right track with using an `ObjectDataSource` to bind data to a `GridView` in your ASP.NET Web Forms User Control. However, the error message indicates that the `ObjectDataSource` is unable to locate the `GetTopUsers` method.
### Issues Identified:
1. **TypeName Mismatch**: The `TypeName` p... | 45,438 | [
{
"from": "human",
"value": "Greetings!\nI'm creating a User Control that will display data in a GridView control. We are using n-tier architecture and the data in question is retrieved from our database and returned to us as a ReadOnlyCollection. OurNewObject is a class containing several properties and ... |
Given Microsoft FORTRAN 5.1 and Microsoft C/C++ 14.0, along with the linker that comes with that version of FORTRAN (that must be used for other dependencies) how do I create a C function and call it from the FORTRAN application?
| To call a C function from a FORTRAN application using Microsoft FORTRAN 5.1 and Microsoft C/C++ 14.0, you need to ensure proper name mangling, calling conventions, and data type compatibility. Below are the steps to create a simple example of a C function and call it from a FORTRAN application.
### Step 1: Create the ... | 43,064 | [
{
"from": "human",
"value": "Given Microsoft FORTRAN 5.1 and Microsoft C/C++ 14.0, along with the linker that comes with that version of FORTRAN (that must be used for other dependencies) how do I create a C function and call it from the FORTRAN application? \n"
},
{
"from": "gpt",
"value": "To... |
I have a problem with Crystal Reports 8. When exporting a report from my application, Crystal Reports sometimes freezes. The progress windows just stays, saying X of X records exported.
Smaller reports with less data are more likley to freeze.
Faster workstations (P4, Core2) tend to freeze much more often, sometimes e... | It sounds like you're encountering a frustrating issue with Crystal Reports 8. Here are some steps and troubleshooting strategies you can try to minimize the chances of freezing when exporting reports:
1. **Update Crystal Reports**: Make sure you have the latest service packs and patches for Crystal Reports 8. If poss... | 42,951 | [
{
"from": "human",
"value": "I have a problem with Crystal Reports 8. When exporting a report from my application, Crystal Reports sometimes freezes. The progress windows just stays, saying X of X records exported.\n\nSmaller reports with less data are more likley to freeze.\nFaster workstations (P4, Core2)... |
I have a field in my form labeled "Name" that will contain both the First & Last name.
Our existing dynamic server (to which the form is being POSTed to), expects two separate fields (first name, last name).
Can I use Javascript to split the user input into two separate variables before the form is posted to the serve... | Yes, you can use JavaScript to split the user input from a "Name" field into separate variables for first name and last name before the form is submitted. You can achieve this by listening for the form's `submit` event, processing the input, and then modifying the form to include the separate fields.
Here's a simple e... | 45,761 | [
{
"from": "human",
"value": "I have a field in my form labeled \"Name\" that will contain both the First & Last name.\nOur existing dynamic server (to which the form is being POSTed to), expects two separate fields (first name, last name). \nCan I use Javascript to split the user input into two separate var... |
I found the Computational Geometry Algorithms Library in my search for an algorithm to decompose a concave polygon into the minimum number of convex components. Links off the site and numerous google results indicate there are python bindings for it, which would be really handy, but all the links are dead! What happe... | The Computational Geometry Algorithms Library (CGAL) is a well-known library in the field of computational geometry, and while it primarily provides C++ functionality, there have been various efforts to create Python bindings for it. However, the availability of these bindings can be inconsistent, and it seems like the... | 47,077 | [
{
"from": "human",
"value": "I found the Computational Geometry Algorithms Library in my search for an algorithm to decompose a concave polygon into the minimum number of convex components. Links off the site and numerous google results indicate there are python bindings for it, which would be really handy... |
I'd like to change the pricing column on my DataGridView based upon currency a user selected currency ComboBox.
Currently, the price column is formatted to "C2". This defaults to look like "$1.00".
However, if my user were to switch the currency to be Great British Pound, I'd like to display the Great British Pound s... | To change the currency symbol in a `DataGridView` based on a selected currency from a `ComboBox`, you need to handle the formatting of the price column dynamically according to the user's choice.
Here are the steps you can follow to implement this:
1. **Set up your ComboBox**: Populate the ComboBox with the currenci... | 45,591 | [
{
"from": "human",
"value": "I'd like to change the pricing column on my DataGridView based upon currency a user selected currency ComboBox.\nCurrently, the price column is formatted to \"C2\". This defaults to look like \"$1.00\". \nHowever, if my user were to switch the currency to be Great British Pound... |
I have an application where, in the course of using the application, a user might click from
virginia.usa.com
to
newyork.usa.com
Since I'd rather not create a new session each time a user crosses from one subdomain to another, what's a good way to share session info across multiple subdomains?
| To share session information across multiple subdomains, you can use cookies with a common parent domain. Here are the steps you can follow:
### 1. Set the Cookie Domain
When creating the session cookie, set the cookie's domain to the parent domain of your subdomains. For instance, if your subdomains are `virginia.us... | 44,431 | [
{
"from": "human",
"value": "I have an application where, in the course of using the application, a user might click from\nvirginia.usa.com\n\nto\nnewyork.usa.com\n\nSince I'd rather not create a new session each time a user crosses from one subdomain to another, what's a good way to share session info acro... |
I want to redirect URLs from an old site that used raw URL requests to my new site which I have implemented in CodeIgniter. I simply want to redirect them to my index page. I also would like to get rid of "index.php" in my URLs so that my URLs can be as simple as example.com/this/that. So, this is the .htaccess file... | It looks like you're trying to set up your `.htaccess` file for a CodeIgniter application with a few specific rules, and you're running into issues with URL rewriting. Let's walk through your current `.htaccess` configuration and adjust it to achieve the desired results.
Here’s an updated version of your `.htaccess` f... | 48,258 | [
{
"from": "human",
"value": "I want to redirect URLs from an old site that used raw URL requests to my new site which I have implemented in CodeIgniter. I simply want to redirect them to my index page. I also would like to get rid of \"index.php\" in my URLs so that my URLs can be as simple as example.com... |
I know many:many isn't supported in Linq2Sql but I am working on a workaround
I am working with my little SO clone and I have a table with Questions and a table with Tags and a linking table QuestionTag so I have a classic many:many relationship between Questions and Tags.
To display the list of Questions on the front... | In LINQ to SQL, while many-to-many relationships are not natively supported, you can achieve your goal by using a combination of two queries and some transformations. Below, I will demonstrate how you can retrieve the questions and their associated tags, effectively creating the `ListQuestion` objects you need.
Here's... | 45,691 | [
{
"from": "human",
"value": "I know many:many isn't supported in Linq2Sql but I am working on a workaround\nI am working with my little SO clone and I have a table with Questions and a table with Tags and a linking table QuestionTag so I have a classic many:many relationship between Questions and Tags. \nTo... |
I am using path-based authentication with svnserve, but it is giving me permission errors if I specify a repository. However, if I just specify a path then it authenticates.
In my authz file, if I do this it works:
[/my/path]
my_username = r
If I do this, it does not work:
[svn:/my/path]
my_username = r
I'm fairly ce... | In SVN (Subversion), the format of the entries in your `authz` file is important to ensure that the permission rules are applied correctly. When using path-based authentication with `svnserve`, the paths in your `authz` file need to match how you access the repository.
### Understanding Repository Names and Access Pat... | 48,860 | [
{
"from": "human",
"value": "I am using path-based authentication with svnserve, but it is giving me permission errors if I specify a repository. However, if I just specify a path then it authenticates.\nIn my authz file, if I do this it works:\n[/my/path]\nmy_username = r\n\nIf I do this, it does not work:... |
IVR Systems are so expensive and proprietary.
The vendor systems I've used are all pretty weak... What is a good alternative to Genesys, Intervoice, etc.?
| If you're looking for alternatives to traditional, expensive IVR systems like Genesys and Intervoice, consider the following options, which can provide flexible, cost-effective, and often open-source solutions:
1. **Twilio**: Twilio provides a cloud-based platform for communication that includes programmable voice and... | 46,416 | [
{
"from": "human",
"value": "IVR Systems are so expensive and proprietary. \nThe vendor systems I've used are all pretty weak... What is a good alternative to Genesys, Intervoice, etc.?\n"
},
{
"from": "gpt",
"value": "If you're looking for alternatives to traditional, expensive IVR systems li... |
First, let me explain what I am doing. I need to take an order, which is split up into different databases, and print out this very large order. What I need from the orders is about 100 or so columns from different databases. The way I was doing in was querying with a join and assigning all of the column values to a va... | Your question touches on an important design consideration in software architecture and object-relational mapping (ORM) practices. Let's break down your situation:
### 1. **Single Class vs. Multiple Classes**:
Having a single class with 100 or more attributes can become unwieldy and difficult to manage. If your `Order... | 46,587 | [
{
"from": "human",
"value": "First, let me explain what I am doing. I need to take an order, which is split up into different databases, and print out this very large order. What I need from the orders is about 100 or so columns from different databases. The way I was doing in was querying with a join and a... |
Every time that I change a value in the designer after saving it, the .designer.cs file will be deleted.
Can anyone tell me how can I fix this problem?
| If your `.designer.cs` file is getting deleted every time you change a value in the designer, it usually indicates an issue with your development environment or project configuration. Here are several potential solutions to help you resolve this problem:
### 1. **Check File Properties**
Ensure that the `.designer.cs` ... | 45,985 | [
{
"from": "human",
"value": "Every time that I change a value in the designer after saving it, the .designer.cs file will be deleted. \nCan anyone tell me how can I fix this problem?\n"
},
{
"from": "gpt",
"value": "If your `.designer.cs` file is getting deleted every time you change a value in ... |
I am currently trying to build on TeamCity, which uses Microsoft.Office.Interop dll. This will build and work fine locally as I have Office installed, however when trying to build it on TeamCity it fails as it has no reference.
I can't install the PIA distributable as I get an error message saying the Office 2003 is r... | When working with Microsoft Office Interop and TeamCity (or any CI/CD environment), the requirement for Office to be installed can indeed complicate the build process. Since you want to avoid installing Office on the build server, here are several potential approaches you can take:
### 1. Use a Different Library
Inste... | 47,275 | [
{
"from": "human",
"value": "I am currently trying to build on TeamCity, which uses Microsoft.Office.Interop dll. This will build and work fine locally as I have Office installed, however when trying to build it on TeamCity it fails as it has no reference. \nI can't install the PIA distributable as I get an... |
I am trying to sort a list of movie reviews in chronological order. We have two options users can choose from, chronological and alphabetical. The page defaults to alphabetical, but when people click on the chronological option, nothing happens.
Here is the code we have right now:
// category 3 is 'reviews', category 1... | It sounds like you want to allow users to sort the reviews either chronologically or alphabetically, while also limiting the number of items displayed on the page. To achieve this, we need to ensure that your sorting logic is based on user input, and we also need to implement pagination or a limit on the number of item... | 49,169 | [
{
"from": "human",
"value": "I am trying to sort a list of movie reviews in chronological order. We have two options users can choose from, chronological and alphabetical. The page defaults to alphabetical, but when people click on the chronological option, nothing happens.\nHere is the code we have right n... |
We have a need to leverage client side resources for lists containing tasks.
The client needs to:
be notified of updates to the list
be able to re-order/filter the list (requesting an update from the server with tasks that the client does not know of/have in cache)
The problem comes on initial load or large list upda... | Your use case involves managing client-side resources efficiently while handling tasks with the ability to notify clients of updates and support filtering or reordering of the tasks. Here are some considerations and potential solutions:
### 1. Caching Mechanisms
**Service Workers**:
Using Service Workers can help cac... | 44,700 | [
{
"from": "human",
"value": "We have a need to leverage client side resources for lists containing tasks.\nThe client needs to:\n\nbe notified of updates to the list\nbe able to re-order/filter the list (requesting an update from the server with tasks that the client does not know of/have in cache)\n\nThe p... |
This seems to me to be the kind of issue that would crop up all the time with SQL/database development, but then I'm new to all this, so forgive my ignorance.
I have 2 tables:
CREATE TABLE [dbo].[Tracks](
[TrackStringId] [bigint] NOT NULL,
[Id] [bigint] IDENTITY(1,1) NOT NULL,
[Time] [datetime] NOT NULL,
C... | To achieve this, you need to perform two separate insert operations: one for the `TrackStrings` table and one for the `Tracks` table. After inserting the new entry in the `TrackStrings` table, you will retrieve the generated `Id` of that entry, and then use it to insert into the `Tracks` table.
Here’s a step-by-step ... | 48,914 | [
{
"from": "human",
"value": "This seems to me to be the kind of issue that would crop up all the time with SQL/database development, but then I'm new to all this, so forgive my ignorance.\nI have 2 tables:\nCREATE TABLE [dbo].[Tracks](\n [TrackStringId] [bigint] NOT NULL,\n [Id] [bigint] IDENTITY(1,1)... |
We have been asked to look into a fully open source solution for a big project, they want the project be as near to 100% Open Source as possible, mainly because as it's a community project there may be very little money available in the future except for the running of a host. Using OS software saves on licence costs a... | It's great that you're exploring open source solutions for your project. Understanding the flexibility of .NET in relation to server environments is an important aspect of this decision.
### Overview of .NET
1. **.NET Framework vs. .NET Core/.NET 5+**:
- The traditional **.NET Framework** was primarily designed fo... | 47,867 | [
{
"from": "human",
"value": "We have been asked to look into a fully open source solution for a big project, they want the project be as near to 100% Open Source as possible, mainly because as it's a community project there may be very little money available in the future except for the running of a host. U... |
SSEPlus is an open source library from AMD for unified handling of SSE processor extensions.
I'm considering to use this library for my next small project and would like to know, if anybody have experience with it? Can I use it on Intel machines? Any performance issues in comparison to direct SSE calls? Any issues on 6... | SSEPlus is indeed an open-source library designed to facilitate the use of SSE (Streaming SIMD Extensions) across different platforms, particularly for AMD processors. Here are some considerations based on your questions:
1. **Experience**: While not as widely adopted as some other libraries, those who have used SSEPl... | 49,387 | [
{
"from": "human",
"value": "SSEPlus is an open source library from AMD for unified handling of SSE processor extensions.\nI'm considering to use this library for my next small project and would like to know, if anybody have experience with it? Can I use it on Intel machines? Any performance issues in compa... |
I am looking for a regex statement that will let me extract the HTML content from just between the body tags from a XHTML document.
The XHTML that I need to parse will be very simple files, I do not have to worry about JavaScript content or <![CDATA[ tags, for example.
Below is the expected structure of the HTML file i... | Using regex to parse HTML or XHTML content can be quite tricky, as HTML is not a regular language and does not lend itself well to regex parsing. However, for simple cases, you can certainly use regex to match content between specific tags. Given your requirements and the example you've provided, here’s a regex pattern... | 45,820 | [
{
"from": "human",
"value": "I am looking for a regex statement that will let me extract the HTML content from just between the body tags from a XHTML document.\nThe XHTML that I need to parse will be very simple files, I do not have to worry about JavaScript content or <![CDATA[ tags, for example.\nBelow i... |
I'd like to know whether this approach is correct or if their are better ways of doing this.
I have what is basically a Person class which has a number of other classes as variables, each of the custom classes is instantiated by passing the Person ID and then that class retrieves the data it needs using that ID. I expo... | Your approach to lazy loading the variable classes in the `Person` class is a common and effective strategy in object-oriented programming. By instantiating these variable classes only when they're accessed for the first time, you can reduce the initial overhead of creating a `Person` instance, which is particularly us... | 45,730 | [
{
"from": "human",
"value": "I'd like to know whether this approach is correct or if their are better ways of doing this.\nI have what is basically a Person class which has a number of other classes as variables, each of the custom classes is instantiated by passing the Person ID and then that class retriev... |
I'm looking to automate the backup of a Windows XP file structure (a wiki) into CVS.
Through repeated calls to cvs commit and cvs add I can identify and commit changed files and newly added files, but I can't see a cvs command that would let me know a local file has been deleted.
One possibility would be to update a ... | Automating the backup of a file structure into CVS, especially in a way that detects deletions can be a bit tricky since CVS does not inherently track deletions in the same way as additions or modifications. However, you can utilize a couple of approaches to handle this efficiently.
### Approach 1: Use `cvs status` an... | 46,198 | [
{
"from": "human",
"value": "I'm looking to automate the backup of a Windows XP file structure (a wiki) into CVS.\nThrough repeated calls to cvs commit and cvs add I can identify and commit changed files and newly added files, but I can't see a cvs command that would let me know a local file has been delete... |
I wonder if there is a less verbose way to do Input Verification in my methods. For example, i commonly write stuff like this:
public string SomeFunction(string param1, int param2)
{
if(string.IsNullOrEmpty(param1)){
throw new ArgumentException("bla", "param1");
}
if(param2 < 0 || param2 > 100 || pa... | In .NET, especially in earlier versions like .NET 3.0 and 3.5, there are no built-in language features to enforce contracts or constraints directly on method parameters in the way you might be hoping for. However, there are several approaches you could consider to reduce verbosity and improve input verification in your... | 45,617 | [
{
"from": "human",
"value": "I wonder if there is a less verbose way to do Input Verification in my methods. For example, i commonly write stuff like this:\npublic string SomeFunction(string param1, int param2)\n{\n if(string.IsNullOrEmpty(param1)){\n throw new ArgumentException(\"bla\", \"param1\... |
I Use Jacob (JAVA COM Bridge) on a 64 Bit Machine and want to load COM Objects from a 32 bit DLL. How can I do that?
| To use COM objects from a 32-bit DLL on a 64-bit machine using Java and the Jacob (Java COM Bridge) library, you must ensure that both your Java application and the Jacob library are running in a 32-bit environment. This is because a 64-bit process cannot directly load 32-bit DLLs.
Here are the steps you can follow to... | 44,406 | [
{
"from": "human",
"value": "I Use Jacob (JAVA COM Bridge) on a 64 Bit Machine and want to load COM Objects from a 32 bit DLL. How can I do that?\n"
},
{
"from": "gpt",
"value": "To use COM objects from a 32-bit DLL on a 64-bit machine using Java and the Jacob (Java COM Bridge) library, you must... |
I have a XML with a structure similar to this:
<category>
<subCategoryList>
<category>
</category>
<category>
<!--and so on -->
</category>
</subCategoryList>
</category>
I have a Category class that has a subcategory list (List<Category>). I'm trying to parse this XML file with... | To parse your XML structure using XPath, you can navigate through the nodes in the XML to extract the subcategories. Below is a simple approach to achieve this using XPath in languages like Java, Python, or C#. For illustration, I'll provide an example in Python using the `lxml` library.
### Example XML Structure
```x... | 48,457 | [
{
"from": "human",
"value": "I have a XML with a structure similar to this:\n<category>\n <subCategoryList>\n <category>\n\n </category>\n <category>\n <!--and so on -->\n </category>\n </subCategoryList>\n</category>\n\nI have a Category class that has a subcategory list (Li... |
Why doesnt TestDriven.Net work with my gallio/mbunit tests?
I've used TDD.Net with MbUnit v2 and not had any problems, but with the new gallio release on my new pc, it does nothing.
From the tdd right click menu in solution explorer, if i do "test with debugger" i get "0 passed, 0 failed, 0 skipped" in the VS status ba... | It seems you are facing compatibility issues between TestDriven.Net and Gallio/MbUnit tests after upgrading to a new version of Gallio. This can sometimes happen when versions of test frameworks, test runners, and development environments don't align correctly. Here are some steps you can try to troubleshoot and potent... | 49,314 | [
{
"from": "human",
"value": "Why doesnt TestDriven.Net work with my gallio/mbunit tests?\nI've used TDD.Net with MbUnit v2 and not had any problems, but with the new gallio release on my new pc, it does nothing.\nFrom the tdd right click menu in solution explorer, if i do \"test with debugger\" i get \"0 pa... |
When I am trying to cast Object obj to Type T, if it can not be cast then there is something wrong.
And after I cast the object I will be looking for working with the cast object.
Rather I will be expecting to get an exception at the place where I will be casting it than say where I will be using that object.
In this s... | In VB.NET, `DirectCast` and `TryCast` serve different purposes when it comes to casting objects, and choosing between them depends on your specific requirements and expectations regarding type safety and error handling.
### `DirectCast`
- **Functionality**: `DirectCast` is used to cast an object to a specific type and... | 48,224 | [
{
"from": "human",
"value": "When I am trying to cast Object obj to Type T, if it can not be cast then there is something wrong.\nAnd after I cast the object I will be looking for working with the cast object.\nRather I will be expecting to get an exception at the place where I will be casting it than say w... |
I have a few users setup in the web.config of an asp.net site to handle authentication. Without getting into details I'm not using the full membership/role provider and would rather not have to implement it at the moment do to time constraints. However I do need the ability to assign a role to a user so that securityTr... | In ASP.NET, if you're not using the Membership and Role Provider systems and you need a simple way to manage roles for security trimming, you can implement a custom solution using your own user and role management.
While you can't directly assign roles within the `<credentials>` section of the `web.config`, you can cr... | 47,184 | [
{
"from": "human",
"value": "I have a few users setup in the web.config of an asp.net site to handle authentication. Without getting into details I'm not using the full membership/role provider and would rather not have to implement it at the moment do to time constraints. However I do need the ability to a... |
I have a problem.
I need to host grid with controls in ScrollViewer to prevent textbox from being either truncated or collapsed to zero-with at the UI. Also I want the with of textbox to be expanded when user change windows width.
I'm setting Window's content to following code
<DockPanel>
<TreeView DockPanel.Dock="... | To limit the maximum width of the `TextBox` while still allowing it to expand when the user resizes the window, you can utilize a combination of `MaxWidth` and a `Grid` property to control the layout. Here's how you can modify your existing XAML code to achieve the desired behavior:
```xml
<DockPanel>
<TreeView Do... | 48,444 | [
{
"from": "human",
"value": "I have a problem.\nI need to host grid with controls in ScrollViewer to prevent textbox from being either truncated or collapsed to zero-with at the UI. Also I want the with of textbox to be expanded when user change windows width.\nI'm setting Window's content to following code... |
when a System.Web.HttpResponse.End() is called a System.Thread.Abort is being fired, which i'm guessing is (or fires) an exception? I've got some logging and this is being listed in the log file...
A first chance
exception of type 'System.Threading.ThreadAbortException' occurred in mscorlib.dll
12/14/2008 01:09:31::
E... | The behavior you're observing is indeed by design in ASP.NET. When you call `System.Web.HttpResponse.End()`, it internally calls `Thread.Abort()` to terminate the execution of the current thread, which results in a `ThreadAbortException`. This exception can be confusing because it may not be caught, and it effectively ... | 45,376 | [
{
"from": "human",
"value": "when a System.Web.HttpResponse.End() is called a System.Thread.Abort is being fired, which i'm guessing is (or fires) an exception? I've got some logging and this is being listed in the log file...\nA first chance \nexception of type 'System.Threading.ThreadAbortException' occur... |
I am testing a couple of workflows for their workflow history cleanup time intervals. The workflow History needs to be retained for a specific number of days. I have implemented the solutions recommended here
My problem is that, now I need to test my code to see if the workflow history is getting cleaned up after the ... | It looks like you're facing an issue with the "Workflow Auto Cleanup" timer job not running as expected in your SharePoint environment. The message you're seeing in the logs, "Upgrade job definition already exists, waiting for the existing upgrade to complete," indicates that there is an ongoing upgrade job that might ... | 46,475 | [
{
"from": "human",
"value": "I am testing a couple of workflows for their workflow history cleanup time intervals. The workflow History needs to be retained for a specific number of days. I have implemented the solutions recommended here \nMy problem is that, now I need to test my code to see if the workflo... |
private static final GridLayout layout = new GridLayout( 3, 1, 1, 0 );
in this line of code what do the numbers represent and how do you use them to arrange the checkboxes and buttons in the window?
| In the line of code you've provided, `new GridLayout(3, 1, 1, 0)`, the parameters in the `GridLayout` constructor represent the following:
1. **Rows**: The first parameter (`3` in this case) specifies the number of rows in the grid layout.
2. **Columns**: The second parameter (`1` in this case) specifies the number of... | 47,600 | [
{
"from": "human",
"value": "private static final GridLayout layout = new GridLayout( 3, 1, 1, 0 );\n\nin this line of code what do the numbers represent and how do you use them to arrange the checkboxes and buttons in the window?\n"
},
{
"from": "gpt",
"value": "In the line of code you've provi... |
I am a big fan of jQuery and I use it for 95% of all my Javascript needs. However, I am a loading a live page using a COMET method; where in Javascript I retreive the data using AJAX at the point where req.readyState == 3. I was curious if it's possible to do this with jQuery $.ajax too (I couldn't find anything in the... | Yes, you can achieve similar functionality using jQuery's AJAX methods. Although jQuery's `$.ajax()` function doesn't expose the `readyState` directly in the way that raw XMLHttpRequest does, you can utilize the `xhr` option to get access to the XMLHttpRequest object and handle the `readystatechange` events yourself.
... | 49,133 | [
{
"from": "human",
"value": "I am a big fan of jQuery and I use it for 95% of all my Javascript needs. However, I am a loading a live page using a COMET method; where in Javascript I retreive the data using AJAX at the point where req.readyState == 3. I was curious if it's possible to do this with jQuery $.... |
Optimization of PHP code via runtime benchmarking is straight forward. Keep track of $start and $end times via microtime() around a code block - I am not looking for an answer that involves microtime() usage.
What I would like to do is measure the time it takes PHP to get prepared to run it's code - code-parse/op-code... | Measuring the time it takes for PHP to parse and prepare code for execution (excluding execution time) is indeed a more challenging task than simply measuring the time it takes to execute the code itself. Here are a few approaches to achieve this measurement, especially since you specified that you don't want to use `m... | 47,522 | [
{
"from": "human",
"value": "Optimization of PHP code via runtime benchmarking is straight forward. Keep track of $start and $end times via microtime() around a code block - I am not looking for an answer that involves microtime() usage.\nWhat I would like to do is measure the time it takes PHP to get prep... |
I am not understanding the point of using .def files with DLLs.
It seems that it replaces the need to use explicit exports within your DLL code (ie. explicit __declspec(dllexport)) however I am unable to generate a lib file when not using these which then creates linker issues later when using the DLL.
So how do you u... | Using `.def` (module definition) files with DLLs in Windows programming can be a bit confusing, especially when transitioning from using `__declspec(dllexport)` to a more traditional approach. Here’s an overview of how `.def` files work and how they relate to the linking process of DLLs and client applications.
### Wh... | 47,096 | [
{
"from": "human",
"value": "I am not understanding the point of using .def files with DLLs.\nIt seems that it replaces the need to use explicit exports within your DLL code (ie. explicit __declspec(dllexport)) however I am unable to generate a lib file when not using these which then creates linker issues ... |
I'm writing a Greasemonkey script to connect two company-internal webpages. One is SSL, and the other is insecure and can only be accessed via a POST request. If I create a hidden form on the secure page and submit it via an onclick() in an <a>, it works fine, but FF gives a warning:
Although this page is encrypted,... | When dealing with mixed content and the associated warnings in modern browsers, there are limited options to avoid the warnings you are encountering. The primary reason for the warning is the inherent security risk involved in submitting information from a secure (HTTPS) page to an insecure (HTTP) page.
Unfortunately,... | 45,941 | [
{
"from": "human",
"value": "I'm writing a Greasemonkey script to connect two company-internal webpages. One is SSL, and the other is insecure and can only be accessed via a POST request. If I create a hidden form on the secure page and submit it via an onclick() in an <a>, it works fine, but FF gives a w... |
I have been working on this for the greater part of the day and I cant seem to make this part of my code work. The intent of the code is to allow the user to input a set of values in order to calculate the missing value. As an additional feature I placed a CheckBox on the form to allow the user to do further calculatio... | Hi Greg,
It looks like you have a good start on your implementation, but there are a few points that might be causing issues with your calculations when the "Motor Load" checkbox is checked. Let’s go through the code step by step to identify potential problems:
### Issues to Consider:
1. **Parsing the Checkbox Value... | 47,672 | [
{
"from": "human",
"value": "I have been working on this for the greater part of the day and I cant seem to make this part of my code work. The intent of the code is to allow the user to input a set of values in order to calculate the missing value. As an additional feature I placed a CheckBox on the form t... |
How can I blur a whole page using CSS?
Other elements such as images are allowed.
| To blur a whole page using CSS while allowing certain elements (like images) to remain unaffected, you can use a combination of CSS properties, specifically the `filter` property for blurring the background and applying styles selectively to elements that should not be blurred.
Here's a basic example of how to achieve... | 48,579 | [
{
"from": "human",
"value": "How can I blur a whole page using CSS?\nOther elements such as images are allowed.\n"
},
{
"from": "gpt",
"value": "To blur a whole page using CSS while allowing certain elements (like images) to remain unaffected, you can use a combination of CSS properties, specifi... |
<style type="text/css">
body {
font-family:Helvetica, sans-serif;
font-size:12px;
}
p,
h1,
form,
button {
border: 0;
margin: 0;
padding: 0;
}
.spacer {
clear: both;
height: 1px;
}
/* ----------- My Form ----------- */
.myform {
margin: 0 auto;
width: 400px;
padding: 14px;
}
/* -------... | It seems like you're encountering issues with the layout of the radio buttons in your form. The default behavior of radio buttons is to display inline, which can sometimes disrupt the layout, especially if they are not properly aligned with labels.
To improve the layout and styling of the radio buttons, we can make a ... | 28,703 | [
{
"from": "human",
"value": "<style type=\"text/css\">\nbody {\n font-family:Helvetica, sans-serif; \n font-size:12px;\n}\np,\nh1,\nform,\nbutton {\n border: 0;\n margin: 0;\n padding: 0;\n}\n.spacer {\n clear: both;\n height: 1px;\n}\n/* ----------- My Form ----------- */\n.myform {\n margin:... |
Thanks to a library upgrade (easymock 2.2 -> 2.4), we're having tests that have started locking up. I'd like to have a time out on individual tests, all of them. The idea is to identify the locked up tests - we're currently guessing - and fix them.
Is this possible, preferably on a suite-wide level? We have 400 tests, ... | Yes, you can set a timeout on a suite-wide level when using JUnit. This will help you identify tests that are locking up without having to modify each individual test method. You can achieve this by using a custom test runner or setting a timeout for the entire test suite.
Here are a few approaches you can take:
### ... | 43,921 | [
{
"from": "human",
"value": "Thanks to a library upgrade (easymock 2.2 -> 2.4), we're having tests that have started locking up. I'd like to have a time out on individual tests, all of them. The idea is to identify the locked up tests - we're currently guessing - and fix them.\nIs this possible, preferably ... |
I wrote a program out, which was all in one file, and the methods were forward declared in a header. The program initially worked perfectly when it was in one file. But when I separated the program, I kept getting random occurrences for the destructor of one of the classes which was declared in the header file.
I h... | The issue you're encountering with the static variable used to count instances of your class can arise due to several factors, particularly when dealing with multiple translation units (i.e., multiple source files). Here's a breakdown of how to properly manage the static variable `count` in your classes to ensure it be... | 46,721 | [
{
"from": "human",
"value": "I wrote a program out, which was all in one file, and the methods were forward declared in a header. The program initially worked perfectly when it was in one file. But when I separated the program, I kept getting random occurrences for the destructor of one of the classes whi... |
Can you store an Array ( that contains another two subarrays one being a string and another another array) into a single MutableArray object?
| Yes, you can store an array that contains subarrays in a single mutable array in programming languages that support such data structures. Below, I'll provide an example in Swift, which uses `NSMutableArray`, and in Objective-C, which also uses `NSMutableArray`.
### Swift Example
```swift
import Foundation
// Creatin... | 45,727 | [
{
"from": "human",
"value": "Can you store an Array ( that contains another two subarrays one being a string and another another array) into a single MutableArray object?\n"
},
{
"from": "gpt",
"value": "Yes, you can store an array that contains subarrays in a single mutable array in programming... |
I've been playing around with Qt for a few hours now. I found that qmake produces Xcode project files on Mac OS X instead of good ol' makefiles. I don't want to launch Xcode every time I want to build "Hello, world".
How do I make qmake generate regular makefiles or, if that's something that cannot be done on the Mac, ... | If you're using Qt on macOS and prefer to generate regular Makefiles instead of Xcode project files, you can use the `-spec` option with `qmake`. This allows you to specify the build system you want to use. For Makefiles, you can specify the `macx-g++` spec like this:
```bash
qmake -spec macx-g++ myProject.pro
```
Af... | 49,411 | [
{
"from": "human",
"value": "I've been playing around with Qt for a few hours now. I found that qmake produces Xcode project files on Mac OS X instead of good ol' makefiles. I don't want to launch Xcode every time I want to build \"Hello, world\".\nHow do I make qmake generate regular makefiles or, if that'... |
I'm looking for material on persistent data structures that can be used to implement a relational model.
Persistence in the meaning of immutable data structures.
Anyone know of some good resources, books, papers and such?
(I already have the book Purely Functional Data Structures, which is a good example of what I'm lo... | Persistent data structures are indeed a fascinating topic, especially in the context of functional programming and immutable data structures. Since you already have "Purely Functional Data Structures" by Chris Okasaki, here are some additional resources you might find helpful:
### Books:
1. **"Functional Programming i... | 45,249 | [
{
"from": "human",
"value": "I'm looking for material on persistent data structures that can be used to implement a relational model.\nPersistence in the meaning of immutable data structures.\nAnyone know of some good resources, books, papers and such?\n(I already have the book Purely Functional Data Struct... |
I need a Java library to convert PDFs to TIFF images. The PDFs are faxes, and I will be converting to TIFF so that I can then do barcode recognition on the image. Can anyone recommend a good free open source library for conversion from PDF to TIFF?
| For converting PDFs to TIFF images in Java, there are several libraries that you can consider. Here are a couple of good open-source options:
1. **Apache PDFBox**:
- PDFBox is a widely used Java library for working with PDF documents. It can be used to extract images and render pages to images, which you can then ... | 47,588 | [
{
"from": "human",
"value": "I need a Java library to convert PDFs to TIFF images. The PDFs are faxes, and I will be converting to TIFF so that I can then do barcode recognition on the image. Can anyone recommend a good free open source library for conversion from PDF to TIFF? \n"
},
{
"from": "gpt"... |
I am working on a WPF application that opens and displays XPS documents. When the application closes, the specification is the application should delete the opened XPS document for clean up. However, when opening a certain XPS document, the application throws an exception that the file is still in use when it tries to ... | The issue you're encountering with the specific XPS document may arise due to how the `XpsDocument` object is being handled and the timing of when you're closing it. When you open an XPS document and set it to the `DocumentViewer`, it's essential to manage the lifecycle of that document carefully, especially in the con... | 41,545 | [
{
"from": "human",
"value": "I am working on a WPF application that opens and displays XPS documents. When the application closes, the specification is the application should delete the opened XPS document for clean up. However, when opening a certain XPS document, the application throws an exception that t... |
in my spare time I'm engaged with writing a little game using Microsofts XNA framework. Reviewing the very first prototype which I wrote to get aquainted with XNA, I found it annoying that there is no possibility to structure my (drawable) game components in a hierarchical manner. I was close to implement a kind of Com... | In the XNA framework, structuring game components hierarchically can indeed be a challenge since the framework does not provide built-in support for hierarchical relationships among `DrawableGameComponent` instances. However, implementing a composite pattern is a common and effective approach to achieve this. Here are ... | 46,234 | [
{
"from": "human",
"value": "in my spare time I'm engaged with writing a little game using Microsofts XNA framework. Reviewing the very first prototype which I wrote to get aquainted with XNA, I found it annoying that there is no possibility to structure my (drawable) game components in a hierarchical manne... |
We'll soon be embarking on the development of a new mobile application. This particular app will be used for heavy searching of text based fields. Any suggestions from the group at large for what sort of database engine is best suited to allowing these types of searches on a mobile platform?
Specifics include Windows M... | For a mobile application that involves heavy searching of text-based fields on Windows Mobile 6, especially considering the limitations of SQL Server Compact Edition (SQL CE), you might consider the following options:
1. **SQLite with Full-Text Search (FTS)**:
- **Description**: SQLite is a lightweight, self-contai... | 48,817 | [
{
"from": "human",
"value": "We'll soon be embarking on the development of a new mobile application. This particular app will be used for heavy searching of text based fields. Any suggestions from the group at large for what sort of database engine is best suited to allowing these types of searches on a mob... |
My Situation
I have a N rectangles
The rectangles all have the same shape (for example 2 inches wide x 1 inch tall) - Let's refer to this size as Sw and Sh for the width and height
I want to position these rectangles in a grid such that the rects completely on top and next to each other - like what you would see in a ... | To solve your problem of arranging `N` rectangles of fixed size `Sw` (width) and `Sh` (height) into the most square-like grid possible, we can adopt a systematic approach based on the following observations:
1. **Grid Dimensions**: We need to determine the number of columns (`C`) and rows (`R`) such that the product `... | 43,679 | [
{
"from": "human",
"value": "My Situation\n\nI have a N rectangles\nThe rectangles all have the same shape (for example 2 inches wide x 1 inch tall) - Let's refer to this size as Sw and Sh for the width and height\nI want to position these rectangles in a grid such that the rects completely on top and next ... |
In through php_info() where the WSDL cache is held (/tmp), but I don't necessarily know if it is safe to delete all files starting with WSDL.
Yes, I should be able to just delete everything from /tmp, but I don't know what else this could effect if I delete any all WSDL files.
| The WSDL (Web Services Description Language) cache in PHP is used to store the compiled WSDL files that are used in SOAP services. This cache can help improve performance by reducing the need to repeatedly parse the WSDL files from their source.
### Key Points Regarding WSDL Cache:
1. **Temporary Storage**: The WSDL... | 45,548 | [
{
"from": "human",
"value": "In through php_info() where the WSDL cache is held (/tmp), but I don't necessarily know if it is safe to delete all files starting with WSDL. \nYes, I should be able to just delete everything from /tmp, but I don't know what else this could effect if I delete any all WSDL files.... |
I recently purchased a 2D Barcode reader. When scanning a U.P.S. barcode, I get about half of the information I want, and about half of it looks to be encrypted in some way. I have heard there is a UPS DLL.
Example - Everything in bold seems to be encrypted, while the non-bold text contains valuable, legitimate data.
[... | It sounds like you are scanning a UPS barcode that contains encoded information, which may include both readable and encrypted data. The portion of the data that appears encrypted is likely encoded using a format that is not immediately human-readable but may still be standard information for UPS tracking and logistics... | 48,063 | [
{
"from": "human",
"value": "I recently purchased a 2D Barcode reader. When scanning a U.P.S. barcode, I get about half of the information I want, and about half of it looks to be encrypted in some way. I have heard there is a UPS DLL.\nExample - Everything in bold seems to be encrypted, while the non-bold ... |
A follow up to an earlier question, showing the part that fails when I try to get the error message from my target library:
require 'gt4r'
@@test_environment = "INCLUDE=C:\\graphtalk\\env\\aiadev\\config\\aiadev.ini"
@@normal_user = "BMCHARGUE"
describe Gt4r do
it 'initializes' do
rv = Gt4r.gTD_initialize @@n... | It looks like you are trying to retrieve an error message from a C extension using Ruby. The segmentation fault you are encountering suggests that there is a problem with how you are passing the variable to the C function.
In Ruby, particularly with C extensions, you need to pass the parameters in the correct format ... | 41,565 | [
{
"from": "human",
"value": "A follow up to an earlier question, showing the part that fails when I try to get the error message from my target library:\nrequire 'gt4r'\n\n@@test_environment = \"INCLUDE=C:\\\\graphtalk\\\\env\\\\aiadev\\\\config\\\\aiadev.ini\"\n@@normal_user = \"BMCHARGUE\"\n\ndescribe Gt4... |
We currently send an email notification in plain text or html format. Our environment is C#/.NET/SQL Server.
I'd like to know if anyone recommends a particular solution. I see two ways of doing this:
dynamically convert current email to pdf using a third party library and sending the pdf as an attachment
or
use S... | Both options you are considering for sending email notifications in PDF format have their advantages and use cases, and your choice might depend on your specific requirements, existing infrastructure, and future plans. Here's a closer look at both approaches:
### Option 1: Dynamic PDF Generation with a Third-Party Lib... | 45,416 | [
{
"from": "human",
"value": "We currently send an email notification in plain text or html format. Our environment is C#/.NET/SQL Server.\nI'd like to know if anyone recommends a particular solution. I see two ways of doing this:\n\ndynamically convert current email to pdf using a third party library and ... |
Say I have a git repository and I've been working on master, can I retroactively create a branch. For example:
A - B - C - A1 - D - A2 - E
I want to make it look like this:
A - A1 - A2
\ \
B - C - D - E
The specific use case is when I've cherry-picked a bunch of commits into an old version branch and ... | Yes, you can retroactively create a branch from a specific point in the commit history of your Git repository. You can achieve the desired structure by creating a new branch from the commit where you want the new branch to start and then effectively rebase or manipulate your commits to create the history you want.
Her... | 45,157 | [
{
"from": "human",
"value": "Say I have a git repository and I've been working on master, can I retroactively create a branch. For example:\nA - B - C - A1 - D - A2 - E\nI want to make it look like this:\nA - A1 - A2 \n\\ \\ \nB - C - D - E\n\nThe specific use case is when I've cherry-picked ... |
I'm writing a CLR stored procedure to take XML data in the form of a string, then use the data to execute certain commands etc.
The problem that I'm running into is that whenever I try to send XML that is longer than 4000 characters, I get an error, as the XmlDocument object can't load the XML as a lot of the closing ... | When dealing with XML data in a SQL Server CLR stored procedure, the issue of string truncation at 4000 characters can arise because the default mapping for string parameters is indeed `nvarchar(4000)`. To overcome this limitation, you can use `nvarchar(max)` in your stored procedure signature, which allows for a large... | 48,215 | [
{
"from": "human",
"value": "I'm writing a CLR stored procedure to take XML data in the form of a string, then use the data to execute certain commands etc. \nThe problem that I'm running into is that whenever I try to send XML that is longer than 4000 characters, I get an error, as the XmlDocument object c... |
I have two sqlite connections and execute like below(CMyDatabase is a derived class of sqlite3):
CMyDatabase* dbConnection1 = new CMyDatabase;
dbConnection1->OpenDataBase(CQCommon::GetModulePath() + L"test.db");
CMyDatabase* dbConnection2 = new CMyDatabase;
dbConnection2->OpenDataBase(CQCommon::GetModulePath() + L"tes... | The error message "Unable to close due to unfinalised statements" typically occurs in SQLite when there are still open statements associated with the database connection that haven't been finalized. In your case, since you have two separate connections (`dbConnection1` and `dbConnection2`), the problem arises from the ... | 46,753 | [
{
"from": "human",
"value": "I have two sqlite connections and execute like below(CMyDatabase is a derived class of sqlite3):\nCMyDatabase* dbConnection1 = new CMyDatabase;\ndbConnection1->OpenDataBase(CQCommon::GetModulePath() + L\"test.db\");\n\nCMyDatabase* dbConnection2 = new CMyDatabase;\ndbConnection2... |
I have a large set of data (a data cube of 250,000 X 1,000 doubles, about a 4 gig file) and I want to manipulate it using a previous set of OOP classes I have written in Python. Currently the data set is already so large that to read into my machine memory I have to at least split it in half so computing overhead is a... | When considering the overhead of creating objects in a generic object-oriented programming (OOP) language like Python and C++, several factors come into play:
### Memory Overhead
1. **Python**:
- **Object Overhead**: Each object in Python has an inherent overhead due to the way Python handles object storage. Each ... | 45,987 | [
{
"from": "human",
"value": "I have a large set of data (a data cube of 250,000 X 1,000 doubles, about a 4 gig file) and I want to manipulate it using a previous set of OOP classes I have written in Python. Currently the data set is already so large that to read into my machine memory I have to at least sp... |
Good day,
I have about 4GB of data, separated in about 10 different tables. Each table has a lot of columns, and each column can be a search criteria in a query. I'm not a DBA at all, and I don't know much about indexes, but I want to speed up the search as much as possible. The important point is, there won't be any u... | Good day!
When it comes to optimizing search performance in a database, especially with the characteristics you mentioned (read-heavy workload, no updates, inserts, or deletes), creating indexes can indeed help speed up query performance. However, creating an index on every single column may not be the best approach f... | 44,929 | [
{
"from": "human",
"value": "Good day,\nI have about 4GB of data, separated in about 10 different tables. Each table has a lot of columns, and each column can be a search criteria in a query. I'm not a DBA at all, and I don't know much about indexes, but I want to speed up the search as much as possible. Th... |
I often find linq being problematic when working with custom collection object.
They are often defened as
The base collection
abstract class BaseCollection<T> : List<T> { ... }
the collections is defined as
class PruductCollection : BaseCollection<Product> { ... }
Is there a better way to add results from a linq expe... | It's common to run into issues when working with LINQ and custom collection types, especially if those collections inherit from generic collections like `List<T>`. While your approach using `AddRange` is a typical solution, you are right that it can feel inefficient due to needing to enumerate the collection multiple t... | 48,298 | [
{
"from": "human",
"value": "I often find linq being problematic when working with custom collection object.\nThey are often defened as\nThe base collection\nabstract class BaseCollection<T> : List<T> { ... }\n\nthe collections is defined as\nclass PruductCollection : BaseCollection<Product> { ... }\n\nIs t... |
I am putting together an architecture for a mid sized company who want to introduce a BPM (Business Process Management) tool. I understand that this would be helpful and want to introduce it but stuggle to find its appropriate place within the architecture.
I want to know when and how you should use a BPM tool, how do... | Implementing a Business Process Management (BPM) tool can greatly enhance the efficiency of processes within a mid-sized company. Understanding its appropriate place within the architecture, as well as differentiating between business processes and application workflows, is essential for a successful implementation.
... | 44,959 | [
{
"from": "human",
"value": "I am putting together an architecture for a mid sized company who want to introduce a BPM (Business Process Management) tool. I understand that this would be helpful and want to introduce it but stuggle to find its appropriate place within the architecture. \nI want to know when... |
Currently, I am splitting all my tests by package (projects). So if I have 12 projects, I will create 1 more project for Unit Test with 12 classes that will test all my package.
Do you do the same way or do you have 1 testing class by class? How do you organize all your test?
| Organizing tests effectively is crucial for maintaining a robust and scalable codebase. While the approach you described—having a single test class for each project that tests all the packages—can work, it might not be the most effective way to structure your tests for several reasons:
### Recommended Approach: One Te... | 45,159 | [
{
"from": "human",
"value": "Currently, I am splitting all my tests by package (projects). So if I have 12 projects, I will create 1 more project for Unit Test with 12 classes that will test all my package. \nDo you do the same way or do you have 1 testing class by class? How do you organize all your test?\... |
All I'm trying to do is display a separator (I've tried images & stylesheets) between the primary navigation menu items in Sharepoint. Here is what I want it to look like:
Home | Menu1 | Menu2 | Menu3
When I attempt to use the StaticTopSeparatorImageUrl (using a bar image) it results in the following:
Home | Menu1 | ... | Creating a custom navigation menu in SharePoint that includes a separator between items can be tricky, but it is possible to achieve the desired outcome. Here are some potential solutions that you can try:
### 1. Using CSS with the Default SharePoint Navigation
You can style the navigation items with CSS to achieve t... | 49,026 | [
{
"from": "human",
"value": "All I'm trying to do is display a separator (I've tried images & stylesheets) between the primary navigation menu items in Sharepoint. Here is what I want it to look like:\nHome | Menu1 | Menu2 | Menu3\n\nWhen I attempt to use the StaticTopSeparatorImageUrl (using a bar image) ... |
a question that a co-interviewer asked in interviews. I always thought it was a silly question.
Assume single processor and not dual core.
| It sounds like you're referring to a type of question often used in interviews to assess a candidate's understanding of concurrency, scheduling, or resource management in computing, particularly in a single-processor context. A common example of such a question might be:
"Imagine you have multiple tasks or processes t... | 47,879 | [
{
"from": "human",
"value": "a question that a co-interviewer asked in interviews. I always thought it was a silly question. \nAssume single processor and not dual core.\n"
},
{
"from": "gpt",
"value": "It sounds like you're referring to a type of question often used in interviews to assess a ca... |
Any idea why the following code doesn't print the amount of characters in the input?
I've taken this straight from the K&R book. Learning C at the moment and this is really confusing, looks to me like I'm never reaching EOF. If that's the case then why would this be used as an example?
#include <stdio.h>
main()
{
... | The code you've provided is meant to count the number of characters read from the input until EOF (end-of-file) is encountered. However, there are a couple of points to consider regarding its implementation:
1. **Return Type of `main`:** The `main` function should return an `int`. Change the declaration from `main()` ... | 49,449 | [
{
"from": "human",
"value": "Any idea why the following code doesn't print the amount of characters in the input?\nI've taken this straight from the K&R book. Learning C at the moment and this is really confusing, looks to me like I'm never reaching EOF. If that's the case then why would this be used as an ... |
I am trying to wrap my head around canoo webtest
I setup a simple groovy webtest.
I have even made and run the xml equivalent and I get the same error when it tries to encode the url.
I get an error when I use a context root.
I don't get an error when I just use the url with out the context root. ie."http://somesi... | The error you're encountering while using Canoo Webtest typically arises from the underlying HTML parser trying to decode a response that is not correctly formatted, often due to unexpected characters or encoding issues in the URL you're trying to invoke.
### Possible Reasons and Solutions:
1. **Encoding Issues**:
... | 46,528 | [
{
"from": "human",
"value": "I am trying to wrap my head around canoo webtest\nI setup a simple groovy webtest.\nI have even made and run the xml equivalent and I get the same error when it tries to encode the url.\nI get an error when I use a context root.\n I don't get an error when I just use the url ... |
I'm using couchdbx v. 0.8.1 and datamapper 0.9.8. I've written a few simple views, copied some from other examples. If I query the views with a browser they return id's. If I query them using datamapper in ruby I get no id's. I've googled for days, been on IRC and looked through the couch and datamapper google groups. ... | It sounds like you're experiencing issues with querying views in CouchDB using DataMapper in Ruby, especially since your views return IDs correctly when accessed directly via a browser. Here are some steps you can take to troubleshoot the problem:
1. **Check View Definitions**: Ensure that the views you created in Cou... | 46,828 | [
{
"from": "human",
"value": "I'm using couchdbx v. 0.8.1 and datamapper 0.9.8. I've written a few simple views, copied some from other examples. If I query the views with a browser they return id's. If I query them using datamapper in ruby I get no id's. I've googled for days, been on IRC and looked through... |
So if I have:
public class ChildClass : BaseClass
{
public new virtual string TempProperty { get; set; }
}
public class BaseClass
{
public virtual string TempProperty { get; set; }
}
How can I use reflection to see that ChildClass is hiding the Base implementation of TempProperty?
I'd like the answer to be ag... | To determine whether a property in a derived class is hiding a base class property using reflection, you can inspect the metadata of the classes involved. The key points to check for hiding are the presence of the `new` keyword in the derived class and whether the base class property is overridden.
Here’s how you can ... | 46,124 | [
{
"from": "human",
"value": "So if I have:\npublic class ChildClass : BaseClass\n{\n public new virtual string TempProperty { get; set; }\n}\n\npublic class BaseClass\n{\n public virtual string TempProperty { get; set; }\n}\n\nHow can I use reflection to see that ChildClass is hiding the Base implemen... |
We have 3 developers all using the same version (VS 2008 SP1) and we all use large VB projects (windows forms). From time to time, the IDE will have all sorts of issues such as locking up, crashing, and even not being able to drag a form object around or it will just instantly disappear.
On the largest of our projects ... | Yes, many developers have reported similar issues with Visual Studio 2008, particularly when working with large projects. Here are some common problems and potential solutions that might help alleviate the issues you're experiencing:
### Common Issues
1. **Performance Problems**: Visual Studio 2008, especially when n... | 46,977 | [
{
"from": "human",
"value": "We have 3 developers all using the same version (VS 2008 SP1) and we all use large VB projects (windows forms). From time to time, the IDE will have all sorts of issues such as locking up, crashing, and even not being able to drag a form object around or it will just instantly d... |
I know that MSTest doesn't support RowTest and similar tests.
What do MSTests users do? How is it possible to live without RowTest support?
I've seen DataDriven test features but sounds like too much overhead, is there any 3rd party patch or tool which allow me to do RowTest similar tests in MSTest?
| MSTest does not natively support the `RowTest` attribute found in some other testing frameworks like NUnit, which can be a limitation for users who want to easily run parameterized tests. However, there are several strategies that MSTest users can employ to achieve similar functionality without needing the `RowTest` fe... | 44,389 | [
{
"from": "human",
"value": "I know that MSTest doesn't support RowTest and similar tests.\nWhat do MSTests users do? How is it possible to live without RowTest support? \nI've seen DataDriven test features but sounds like too much overhead, is there any 3rd party patch or tool which allow me to do RowTest ... |
I have some unicode text that I want to clean up using regular expressions. For example I have cases where u'(2'. This exists because for formatting reasons the closing paren ends up in an adjacent html cell. My initial solution to this problem was to look ahead at the contents of the next cell and using a string fu... | You're on the right track in trying to define a regular expression that specifically targets the case of a single opening parenthesis followed by a single digit, and nothing else. To clarify your goal, you want to match strings that consist exactly of `(` followed by a digit and nothing else.
Based on your requirement... | 46,034 | [
{
"from": "human",
"value": "I have some unicode text that I want to clean up using regular expressions. For example I have cases where u'(2'. This exists because for formatting reasons the closing paren ends up in an adjacent html cell. My initial solution to this problem was to look ahead at the conten... |
I'm currently designing a database for a project. Now I'm debating with myself whether I have to create a look-up table for example 'civil status' data which can only contain fixed values like Single, Married, Separated, Widow/Widower. I'm pretty sure that no other values will be added in the future. Should I put these... | When deciding whether to create a separate lookup table for fixed values like "civil status" or to hardcode these values in your program code, consider the following factors:
### Advantages of Using a Lookup Table:
1. **Data Integrity**: A lookup table enforces data integrity. By having a separate table, you ensure t... | 47,923 | [
{
"from": "human",
"value": "I'm currently designing a database for a project. Now I'm debating with myself whether I have to create a look-up table for example 'civil status' data which can only contain fixed values like Single, Married, Separated, Widow/Widower. I'm pretty sure that no other values will b... |
I have two directories in the same parent directory. Call the parent directory base and the children directories alpha and bravo. I want to replace alpha with bravo. The simplest method is:
rm -rf alpha
mv bravo alpha
The mv command is atomic, but the rm -rf is not. Is there a simple way in bash to atomically repl... | To atomically replace the `alpha` directory with the `bravo` directory in a way that minimizes the risk of `alpha` disappearing during the process, you can use a temporary directory. The idea is to create a temporary directory, move the contents of `bravo` there, and then rename it to `alpha`. This way, if something go... | 47,858 | [
{
"from": "human",
"value": "I have two directories in the same parent directory. Call the parent directory base and the children directories alpha and bravo. I want to replace alpha with bravo. The simplest method is:\nrm -rf alpha\nmv bravo alpha\n\nThe mv command is atomic, but the rm -rf is not. Is ... |
I've already written a generator that does the trick, but I'd like to know the best possible way to implement the off-side rule.
Shortly: Off-side rule means in this context that indentation is getting recognized as a syntactic element.
Here is the offside rule in pseudocode for making tokenizers that capture indentati... | Your implementation of the off-side rule using a layout tokenizer is quite solid, and your approach of managing indentation levels with a stack is a commonly accepted practice for handling indentation-sensitive languages. The outlined approach allows you to effectively capture and manipulate indentation changes through... | 45,589 | [
{
"from": "human",
"value": "I've already written a generator that does the trick, but I'd like to know the best possible way to implement the off-side rule.\nShortly: Off-side rule means in this context that indentation is getting recognized as a syntactic element.\nHere is the offside rule in pseudocode f... |
I have a gallery I quickly coded up for a small site, and under Firefox 3 and Safari 3 works fine. But when I test on my old best friend IE7, it seems to not fire the imageVar.onload = function() { // code here }.. which I want to use to stop the load effect and load the image.
Please bear in mind...
I know the thum... | It's great that you're diving into JavaScript and exploring new techniques! IE7 can be quite finicky, especially with image loading. Let's address your issue with the `onload` event and provide some general tips to improve your code.
### Common Issues with Image Loading in IE7
1. **Image Preloading**: In older versio... | 46,870 | [
{
"from": "human",
"value": "I have a gallery I quickly coded up for a small site, and under Firefox 3 and Safari 3 works fine. But when I test on my old best friend IE7, it seems to not fire the imageVar.onload = function() { // code here }.. which I want to use to stop the load effect and load the image.... |
I've setup a reverse ssh tunnel, using PuTTY, to allow me to VNC into a home computer without having to enable NAT port forwarding. Works great, no problem.
I would like to set the tunnel up as a "persistent service" that will connect on boot up and reconnect when dropped. PS. this is on Windows.
Exhaustive googling ... | Creating a persistent SSH tunnel on Windows can indeed be a bit tricky, especially when you want it to automatically reconnect on boot and handle disconnections. Here are a few options to achieve that, including using some of the tools you've mentioned and alternatives that are well-regarded.
### Options for Persisten... | 45,963 | [
{
"from": "human",
"value": "I've setup a reverse ssh tunnel, using PuTTY, to allow me to VNC into a home computer without having to enable NAT port forwarding. Works great, no problem.\nI would like to set the tunnel up as a \"persistent service\" that will connect on boot up and reconnect when dropped. ... |
Is there a way to cast a user control as a specific user control so I have access to it's public properties? Basicly I'm foreaching through a placeholder's controls collection and I'm trying to access the user control's public properties.
foreach(UserControl uc in plhMediaBuys.Controls)
{
uc.PulblicPropertyIWantAcc... | Yes, you can cast a user control to a specific type if you know the type at compile time. However, you'll need to make sure that the user controls in the `plhMediaBuys.Controls` collection are indeed of that specific type. If they are, you can perform a cast using either a direct cast or the `as` operator, which is saf... | 41,724 | [
{
"from": "human",
"value": "Is there a way to cast a user control as a specific user control so I have access to it's public properties? Basicly I'm foreaching through a placeholder's controls collection and I'm trying to access the user control's public properties.\nforeach(UserControl uc in plhMediaBuys.... |
With my jquery I'm trying to make the transition from a message to a loading function easy on the eyes by animate the opasity of the message out, inserting the loading.gif and animating the opacity back in. It fails.
$('#powerSearchSubmitButton').click(function(ev) {
startLoad();
return false;
});
function star... | The issue you’re experiencing is due to the fact that you’re trying to animate the opacity of an image that is being added to the HTML after the opacity of the `.message` element is set to 0. When you insert new HTML with `$(this).html()`, the new content does not inherit the animation state properly because it is adde... | 46,493 | [
{
"from": "human",
"value": "With my jquery I'm trying to make the transition from a message to a loading function easy on the eyes by animate the opasity of the message out, inserting the loading.gif and animating the opacity back in. It fails.\n$('#powerSearchSubmitButton').click(function(ev) {\n start... |
Does anyone have experience working with Oracle User management? Any idea if it can be easily used to register users and roles into Oracle OID? And how I can use the defined roles in my application (i.e. should I hard code them)?
| Yes, many organizations use Oracle User Management in conjunction with Oracle Internet Directory (OID) for user and role management. Here’s some guidance on registering users and roles in OID and using those roles in your applications.
### Registering Users and Roles in Oracle OID
1. **OID and User Management**: Orac... | 46,189 | [
{
"from": "human",
"value": "Does anyone have experience working with Oracle User management? Any idea if it can be easily used to register users and roles into Oracle OID? And how I can use the defined roles in my application (i.e. should I hard code them)?\n"
},
{
"from": "gpt",
"value": "Yes,... |
I've got two Django projects on the same server. The first launched several months ago, and has since collected hundreds of user accounts. The second project is launching in a few days, and we'd like the second project to allow users of the first app to authenticate using the same credentials.
At first, I was going t... | Django does not natively support switching database connections on a per-request basis out of the box. However, you can achieve the desired outcome with a custom approach by implementing a multi-database setup. Here’s a step-by-step guide to help you set this up.
### Step 1: Configure Multi-Database Settings
In your ... | 44,535 | [
{
"from": "human",
"value": "I've got two Django projects on the same server. The first launched several months ago, and has since collected hundreds of user accounts. The second project is launching in a few days, and we'd like the second project to allow users of the first app to authenticate using the ... |
So I don't do a lot of Win32 calls, but recently I have had to use the GetFileTime() and SetFileTime() functions. Now although Win98 and below are not officially supported in my program people do use it there anyway, and I try to keep it as usable as possible. I was just wondering what will happen as those functions do... | The functions `GetFileTime()` and `SetFileTime()` are part of the Windows API that was introduced with Windows NT. Therefore, they are not available on Windows 95, 98, or ME systems. If you try to call these functions on pre-NT systems, your program will likely fail to execute those calls, and you may encounter an erro... | 45,360 | [
{
"from": "human",
"value": "So I don't do a lot of Win32 calls, but recently I have had to use the GetFileTime() and SetFileTime() functions. Now although Win98 and below are not officially supported in my program people do use it there anyway, and I try to keep it as usable as possible. I was just wonderi... |
Does Office 2007 PIA also require Office 2007 to be installed?
Can I deploy Office 2007 PIA with VSTO 3.0 (without having Office 2007 installed)?
EDIT: I have a windows application that generates MS Word files. I have added the Office 2007 PIA as custom pre-requisite in the setup, but Office 2007 PIA needs MS Office 20... | The Office Primary Interop Assemblies (PIAs) for Office 2007 are designed to work with Office 2007 and require that Office 2007 is installed on the machine where your application will run. The PIAs are essentially wrappers that allow .NET applications to interact with the Office object model, and they rely on the actua... | 49,994 | [
{
"from": "human",
"value": "Does Office 2007 PIA also require Office 2007 to be installed?\nCan I deploy Office 2007 PIA with VSTO 3.0 (without having Office 2007 installed)?\nEDIT: I have a windows application that generates MS Word files. I have added the Office 2007 PIA as custom pre-requisite in the se... |
I've never found an "ideal" layout for coding in Visual Studio. I have a three-monitor setup, but it seems that the solution explorer/properties/output/errors/whatever panes are always getting in the way or hogging screen space. It's a bit open-ended, sure, but do you have an "ideal" layout with the myriad of floating/... | Creating an ideal layout for coding in Visual Studio, especially with a multi-monitor setup, can greatly enhance your productivity and overall experience. Here’s a suggestion for an effective layout that balances coding space with easy access to necessary tools:
### Suggested Layout for a Three-Monitor Setup
#### Mon... | 45,845 | [
{
"from": "human",
"value": "I've never found an \"ideal\" layout for coding in Visual Studio. I have a three-monitor setup, but it seems that the solution explorer/properties/output/errors/whatever panes are always getting in the way or hogging screen space. It's a bit open-ended, sure, but do you have an ... |
I inherited an application which uses a java properties file to define configuration parameters such as database name.
There is a class called MyAppProps that looks like this:
public class MyAppProps {
protected static final String PROP_FILENAME = "myapp.properties";
protected static Properties myAppProps = nu... | You raise valid points about the design and implementation of the `MyAppProps` class. Let's address them one by one.
### Initialization
1. **Static Initialization Block**: You're correct in saying that it's often preferable to avoid the need for an explicit initialization method. A static initialization block can be ... | 48,049 | [
{
"from": "human",
"value": "I inherited an application which uses a java properties file to define configuration parameters such as database name. \nThere is a class called MyAppProps that looks like this:\npublic class MyAppProps {\n\n protected static final String PROP_FILENAME = \"myapp.properties\";... |
What does it mean to say that a parameter is passed "by reference" or "by value"? How do such parameters differ?
| In programming, the terms "passed by reference" and "passed by value" refer to two different ways of passing arguments to functions or methods.
### Passed by Value:
When a parameter is passed by value, a copy of the actual value is made and passed to the function. This means that any changes made to the parameter insi... | 46,780 | [
{
"from": "human",
"value": "What does it mean to say that a parameter is passed \"by reference\" or \"by value\"? How do such parameters differ?\n"
},
{
"from": "gpt",
"value": "In programming, the terms \"passed by reference\" and \"passed by value\" refer to two different ways of passing argu... |
I have a Git repository which contains a number of subdirectories. Now I have found that one of the subdirectories is unrelated to the other and should be detached to a separate repository.
How can I do this while keeping the history of the files within the subdirectory?
I guess I could make a clone and remove the unwa... | To detach a subdirectory from an existing Git repository while preserving its history and creating a separate repository, you can follow these steps:
1. **Create a new repository for the subdirectory:**
First, create a new directory for the new repository (for example, `ABC/`), and initialize it as a Git repository... | 44,124 | [
{
"from": "human",
"value": "I have a Git repository which contains a number of subdirectories. Now I have found that one of the subdirectories is unrelated to the other and should be detached to a separate repository.\nHow can I do this while keeping the history of the files within the subdirectory?\nI gue... |
I'd like to implement a bloom filter using MySQL (other a suggested alternative).
The problem is as follows:
Suppose I have a table that stores 8 bit integers, with these following values:
1: 10011010
2: 00110101
3: 10010100
4: 00100110
5: 00111011
6: 01101010
I'd like to find all results that are bitwise AND to this:... | Implementing a Bloom filter-like structure using MySQL (or another database) can be quite different from a traditional Bloom filter, as the latter is typically used for membership queries without needing to store the actual items. However, based on your use case—performing a bitwise AND operation against n-bit integers... | 47,490 | [
{
"from": "human",
"value": "I'd like to implement a bloom filter using MySQL (other a suggested alternative).\nThe problem is as follows:\nSuppose I have a table that stores 8 bit integers, with these following values:\n1: 10011010\n2: 00110101\n3: 10010100\n4: 00100110\n5: 00111011\n6: 01101010\n\nI'd lik... |
I'm looking for a standard file format that used by systems needing to store currencies and also provide currency exchange (so we need both the buy and sell rates)
I looked online and found the .cex but have not been able to find it's format.
Where do I get the format of this file?
Is there another file format I shoul... | The `.cex` file format you've come across is not widely standardized, and documentation on it may be scarce. It's possible that it is a proprietary format used by specific software or systems for storing currency exchange data. If you need to work with this file format, your best option might be to contact the software... | 48,347 | [
{
"from": "human",
"value": "I'm looking for a standard file format that used by systems needing to store currencies and also provide currency exchange (so we need both the buy and sell rates)\nI looked online and found the .cex but have not been able to find it's format. \nWhere do I get the format of this... |
Im trying to do a dialog box with jquery. In this dialog box Im going to have terms and conditions. The problem is that the dialog box is only displayed for the FIRST TIME.
This is the code.
JavaScript:
function showTOC()
{
$("#TOC").dialog({
modal: true,
overlay: {
opacity: 0.7,
... | It looks like you're trying to create a dialog box using jQuery UI to display Terms and Conditions, but you're facing an issue where the dialog box only appears the first time due to the underlying HTML element being removed from the DOM when the dialog is closed.
By default, jQuery UI dialogs are not destroyed on cl... | 49,445 | [
{
"from": "human",
"value": "Im trying to do a dialog box with jquery. In this dialog box Im going to have terms and conditions. The problem is that the dialog box is only displayed for the FIRST TIME.\nThis is the code.\nJavaScript:\nfunction showTOC()\n{\n $(\"#TOC\").dialog({ \n modal: true, \n... |
Okay, I've asked on the Community Server Forums and was totally ignored. So I'll ask here. The OpenID provider (presumably janrain) for CommunityServer does not work with an SSL OpenID endpoint. I really don't know of a non SSL OpenID endpoint and even if I did...I'm not sure if I'd want to use it.
I have a community s... | It sounds like you're experiencing challenges with OpenID support in your CommunityServer installation, particularly when it comes to SSL endpoints. Here are a few suggestions to help address the issue:
1. **Check CommunityServer Configuration**: Ensure that your CommunityServer installation is properly configured to ... | 48,612 | [
{
"from": "human",
"value": "Okay, I've asked on the Community Server Forums and was totally ignored. So I'll ask here. The OpenID provider (presumably janrain) for CommunityServer does not work with an SSL OpenID endpoint. I really don't know of a non SSL OpenID endpoint and even if I did...I'm not sure if... |
I do not have problem as such but I am quite new to Ruby. I have the following 3 repeatable bits of code in one method and I would like to know how a true Rubyist would first of all remove the duplication and secondly make it more reusable.
Here is the code in question:
file = File.new( destination)
doc = REXML::Docum... | To remove duplication and improve reusability in your Ruby code, you can create a method that encapsulates the repeated logic of modifying attributes for the specified XML elements. Below is a refactored version of your code that achieves this:
```ruby
require 'rexml/document'
def update_attributes(doc, xpath, new_at... | 47,027 | [
{
"from": "human",
"value": "I do not have problem as such but I am quite new to Ruby. I have the following 3 repeatable bits of code in one method and I would like to know how a true Rubyist would first of all remove the duplication and secondly make it more reusable.\nHere is the code in question:\nfile ... |
I have a problem with a many-to-many relation in my tables, which is between an employee and instructor who work in a training centre. I cannot find the link between them, and I don't know how to get it. The employee fields are:
employee no.
employee name
company name
department job title
business area
mobile number
e... | In a many-to-many relationship between two entities (in your case, employees and instructors), you need an associative or junction table to connect them. This table will hold the foreign keys referencing both the `employee` and `instructor` entities, enabling you to establish the link between them.
### Step 1: Identif... | 45,065 | [
{
"from": "human",
"value": "I have a problem with a many-to-many relation in my tables, which is between an employee and instructor who work in a training centre. I cannot find the link between them, and I don't know how to get it. The employee fields are:\n\nemployee no.\nemployee name\ncompany name\ndepa... |
Let's say we have
public interface ITimestampProvider
{
DateTime GetTimestamp();
}
and a class which consumes it
public class Timestamped
{
private ITimestampProvider _timestampProvider
public Timestamped(ITimestampProvider timestampProvider)
{
// arg null check
_timestampProvider = t... | Introducing a parameterless constructor that defaults to a specific implementation (in this case, `SystemTimestampProvider`) can have both advantages and disadvantages. Here's a breakdown of the potential benefits and drawbacks:
### Benefits
1. **Convenience**: It allows for easier instantiation of the `Timestamped` ... | 49,551 | [
{
"from": "human",
"value": "Let's say we have\npublic interface ITimestampProvider\n{\n DateTime GetTimestamp();\n}\n\nand a class which consumes it\npublic class Timestamped\n{\n private ITimestampProvider _timestampProvider\n\n public Timestamped(ITimestampProvider timestampProvider)\n {\n ... |
I am making a Color class, and provide a standard constructor like
Color(int red, int green, int blue)
And then I want to provide an easy way to get the most common colors, like
Color.Blue, Color.Red. I see two possible options:
public static readonly Color Red = new Color(255, 0, 0);
public static Color Red { get { ... | Your reasoning is mostly correct, and you've touched on some important considerations when designing your `Color` class. Let’s break down the two approaches and their implications:
### 1. `public static readonly Color Red = new Color(255, 0, 0);`
- **Single Instance**: This approach creates a single instance of the `... | 42,472 | [
{
"from": "human",
"value": "I am making a Color class, and provide a standard constructor like\nColor(int red, int green, int blue)\n\nAnd then I want to provide an easy way to get the most common colors, like\nColor.Blue, Color.Red. I see two possible options:\npublic static readonly Color Red = new Color... |
I am a newbie for Visual Basic 6 project. I downloaded some tutorials for testing; however, I am not able to drag, move, or edit the UI form designer objects in those projects.
Does anybody know there is an object lock function in VB6?
If there is, how can I unlock it?
| In Visual Basic 6, there isn't a specific "lock" feature for form objects that would prevent you from moving or editing them directly. However, there are a few reasons why you might be experiencing issues with the form designer. Here are some troubleshooting steps and potential solutions:
1. **Check for Locked Propert... | 42,953 | [
{
"from": "human",
"value": "I am a newbie for Visual Basic 6 project. I downloaded some tutorials for testing; however, I am not able to drag, move, or edit the UI form designer objects in those projects.\nDoes anybody know there is an object lock function in VB6?\nIf there is, how can I unlock it?\n"
}... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.