instruction stringlengths 14 27.6k | completion stringlengths 3 38.3k | __original_row_idx int64 0 50k | conversations listlengths 2 2 |
|---|---|---|---|
I need to at run time change the font of a List Control so as to used a fixed width font. I have seen some examples which suggest I should trap the NM_CUSTOMDRAW message, but I was wondering if there was a better way of doing it.
Thanks.
| To change the font of a List Control at runtime in a Win32 application, using the `NM_CUSTOMDRAW` message is one method, but there are indeed more straightforward ways to achieve this without delving into custom drawing, especially if your goal is simply to set a fixed-width font.
Here's a simple approach using the `S... | 36,705 | [
{
"from": "human",
"value": "I need to at run time change the font of a List Control so as to used a fixed width font. I have seen some examples which suggest I should trap the NM_CUSTOMDRAW message, but I was wondering if there was a better way of doing it.\nThanks.\n"
},
{
"from": "gpt",
"valu... |
I have resharper installed and I use the todo list functionality pretty often.
My question is, apart from doing a screenshot of the list is there a way to export the current list and so I can email it or communicate it to developers. Am not using team system and so cannot propogate changes/todo etc to other developers ... | As of my last knowledge update in October 2023, ReSharper does not provide a direct built-in feature to export the TODO list to a file for sharing. However, there are a few alternative methods you can consider to share your TODO items with other developers:
1. **Copy-Paste from the TODO List**:
- Open the TODO list... | 38,295 | [
{
"from": "human",
"value": "I have resharper installed and I use the todo list functionality pretty often.\nMy question is, apart from doing a screenshot of the list is there a way to export the current list and so I can email it or communicate it to developers. Am not using team system and so cannot propo... |
I have a Queue object that I need to ensure is thread-safe. Would it be better to use a lock object like this:
lock(myLockObject)
{
//do stuff with the queue
}
Or is it recommended to use Queue.Synchronized like this:
Queue.Synchronized(myQueue).whatever_i_want_to_do();
From reading the MSDN docs it says I should use... | You're raising an important point about thread safety when working with collections in a multithreaded environment. Let's clarify a few aspects about using `Queue.Synchronized` versus using manual locking.
1. **Queue.Synchronized**: This method creates a thread-safe wrapper around the `Queue` object. It ensures that t... | 40,076 | [
{
"from": "human",
"value": "I have a Queue object that I need to ensure is thread-safe. Would it be better to use a lock object like this:\nlock(myLockObject)\n{\n//do stuff with the queue\n}\n\nOr is it recommended to use Queue.Synchronized like this:\nQueue.Synchronized(myQueue).whatever_i_want_to_do();\... |
I am using several NSButtonCell objects in an NSTableView. They are simple square buttons with custom images on them.
These buttons draw properly when they are not highlighted: all that is visible is the image, and the rest of the button rectangle is transparent. However, when I click on them, the entire button rectang... | To achieve the effect you want—where only the image on your `NSButtonCell` is inverted when the button is clicked, while keeping the transparent parts transparent—you can customize the drawing of the button cell. Here’s a way to do it:
1. **Subclass NSButtonCell**: Create a subclass of `NSButtonCell` to customize how ... | 36,948 | [
{
"from": "human",
"value": "I am using several NSButtonCell objects in an NSTableView. They are simple square buttons with custom images on them.\nThese buttons draw properly when they are not highlighted: all that is visible is the image, and the rest of the button rectangle is transparent. However, when ... |
I've been frustrated by this for the entire weekend, plus a day or two, so any help would be significantly appreciated.
I'm trying to write a program that can programmatically go into a SharePoint 2007 doc library, open a file, change the contents of the file, then put the file back. I've gotten all but the last part o... | To programmatically upload a modified file back to a SharePoint 2007 document library after modifying it with the Open XML SDK, you will need to save the changes to a new stream and then use SharePoint's object model to upload that stream back to the document library. Here’s a step-by-step guide to achieving that:
1. ... | 35,887 | [
{
"from": "human",
"value": "I've been frustrated by this for the entire weekend, plus a day or two, so any help would be significantly appreciated.\nI'm trying to write a program that can programmatically go into a SharePoint 2007 doc library, open a file, change the contents of the file, then put the file... |
I have a virtual host setup on Apache 2 like so (simplified):
<VirtualHost *>
ServerName domain.com
ServerAlias *.domain.com
DocumentRoot /var/www/domain.com/html
</VirtualHost>
<VirtualHost sub1.domain.com>
ServerName sub1.domain.com
DocumentRoot /var/www/sub1.domain.com/html
</VirtualHost>
<VirtualHost su... | The issue you are experiencing is due to how Apache handles Virtual Hosts. When configuring multiple virtual hosts, Apache will prioritize more specific matches over general ones. In your configuration, the `<VirtualHost sub1.domain.com>` and `<VirtualHost sub2.domain.com>` blocks are more specific than your general wi... | 36,979 | [
{
"from": "human",
"value": "I have a virtual host setup on Apache 2 like so (simplified):\n<VirtualHost *>\n ServerName domain.com\n ServerAlias *.domain.com\n DocumentRoot /var/www/domain.com/html\n</VirtualHost>\n\n<VirtualHost sub1.domain.com>\n ServerName sub1.domain.com\n DocumentRoot /var/www/su... |
>rails -v
Rails 1.2.6
>ruby -v
ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32]
When I run a test fixture (that tests a rails model class) like this, it takes 20-30 secs to start executing these tests (show the "Loaded suite..."). What gives?
>ruby test\unit\category_test.rb
require File.dirname(__FILE__) + '/../... | There are a few potential reasons why your Rails tests are taking a long time to start executing, especially given that you are using Rails 1.2.6 and Ruby 1.8.6, which are both quite old. Here are some possible factors and suggestions to help you troubleshoot and improve the speed of your tests:
### Possible Reasons f... | 38,069 | [
{
"from": "human",
"value": ">rails -v\nRails 1.2.6\n\n>ruby -v\nruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32]\n\nWhen I run a test fixture (that tests a rails model class) like this, it takes 20-30 secs to start executing these tests (show the \"Loaded suite...\"). What gives?\n>ruby test\\unit\\cate... |
How can I get a list of the IP addresses or host names from a local network easily in Python?
It would be best if it was multi-platform, but it needs to work on Mac OS X first, then others follow.
Edit: By local I mean all active addresses within a local network, such as 192.168.xxx.xxx.
So, if the IP address of my com... | To get a list of active IP addresses or hostnames within a local network in Python, you can use the `scapy` library, which is a powerful packet manipulation tool. However, `scapy` may require elevated privileges (root access) to run some operations, particularly when performing network scans.
Here's a step-by-step gu... | 31,625 | [
{
"from": "human",
"value": "How can I get a list of the IP addresses or host names from a local network easily in Python?\nIt would be best if it was multi-platform, but it needs to work on Mac OS X first, then others follow.\nEdit: By local I mean all active addresses within a local network, such as 192.1... |
What is the best OS for Java development? People from Sun are pushing the Solaris, yes Solaris have some extra features included in itself such as (dTrace, possibility for Performance tuning the JVM, etc.. ). Some friends of mine, had port their application on solaris, and they said to me that the performances was bril... | Choosing the best operating system (OS) for Java development often depends on your specific needs, preferences, and the environment in which you are working. Here's a breakdown of some popular OS options for Java development, along with their strengths and weaknesses:
### 1. **Linux**
- **Strengths:**
- Wide variety... | 34,057 | [
{
"from": "human",
"value": "What is the best OS for Java development? People from Sun are pushing the Solaris, yes Solaris have some extra features included in itself such as (dTrace, possibility for Performance tuning the JVM, etc.. ). Some friends of mine, had port their application on solaris, and they ... |
Java is nearing version 7. It occurs to me that there must be plenty of textbooks and training manuals kicking around that teach methods based on older versions of Java, where the methods taught, would have far better solutions now.
What are some boilerplate code situations, especially ones that you see people implemen... | As Java continues to evolve, there are indeed many areas where boilerplate code can be improved or simplified using newer features introduced in recent versions. Here are some common situations where older methods might be refactored to take advantage of more modern Java practices:
1. **Enhanced for-loop vs. Tradition... | 31,949 | [
{
"from": "human",
"value": "Java is nearing version 7. It occurs to me that there must be plenty of textbooks and training manuals kicking around that teach methods based on older versions of Java, where the methods taught, would have far better solutions now.\nWhat are some boilerplate code situations, es... |
If I make two iPhone applications, how can/should I share custom data (not contacts and stuff like that) among them?
Thanks!
| When creating two iPhone applications that need to share custom data, you have several options to consider. The best choice will depend on your specific use case, the amount of data you need to share, and whether the apps are developed by the same developer account. Here are some methods to facilitate data sharing betw... | 36,914 | [
{
"from": "human",
"value": "If I make two iPhone applications, how can/should I share custom data (not contacts and stuff like that) among them?\nThanks!\n"
},
{
"from": "gpt",
"value": "When creating two iPhone applications that need to share custom data, you have several options to consider. ... |
I'm not looking for a general discussion on if math is important or not for programming.
Instead I'm looking for real world scenarios where you have actually used some branch of math to solve some particular problem during your career as a software developer.
In particular, I'm looking for concrete examples.
| Certainly! Here are some concrete examples of how different branches of mathematics have been utilized in real-world software development scenarios:
1. **Graph Theory in Social Network Analysis**:
- **Scenario**: While developing a feature for a social media platform, we needed to analyze user connections and recom... | 38,651 | [
{
"from": "human",
"value": "I'm not looking for a general discussion on if math is important or not for programming. \nInstead I'm looking for real world scenarios where you have actually used some branch of math to solve some particular problem during your career as a software developer.\nIn particular, I... |
Why don't databases automatically index tables based on query frequency? Do any tools exist to analyze a database and the queries it is receiving, and automatically create, or at least suggest which indexes to create?
I'm specifically interested in MySQL, but I'd be curious for other databases as well.
| Databases do not automatically index tables based solely on query frequency for several reasons:
1. **Complexity of Queries**: Queries can vary significantly in structure and complexity. While certain queries may be frequent, they may not necessarily benefit from a straightforward indexing strategy. Automatically inde... | 35,898 | [
{
"from": "human",
"value": "Why don't databases automatically index tables based on query frequency? Do any tools exist to analyze a database and the queries it is receiving, and automatically create, or at least suggest which indexes to create?\nI'm specifically interested in MySQL, but I'd be curious fo... |
I use Eclipse with "external" projects - i.e. projects created from existing source.
Poking around in the workspace files, I cannot find any reference to these projects. My question is: how does Eclipse keep track of these projects?
I'd like to be able to add such a project to the workspace automatically (by generating... | In Eclipse, projects created from existing sources (often called "external projects") have a specific structure, but the workspace itself does not maintain a database or file that directly lists them. Instead, Eclipse tracks project metadata through project-specific files located within each project's root directory. H... | 31,380 | [
{
"from": "human",
"value": "I use Eclipse with \"external\" projects - i.e. projects created from existing source.\nPoking around in the workspace files, I cannot find any reference to these projects. My question is: how does Eclipse keep track of these projects?\nI'd like to be able to add such a project ... |
I'm running an SQL query against a mainframe DB2 database using the OdbcDataReader class and ExecuteReader() method. This code is in production and has been running fine for months.
The query normally takes 1-2 minutes to execute. This past Friday, the query encountered a ThreadAbortException. Below is the formatted s... | The `ThreadAbortException` you're encountering is typically thrown when a thread is forcibly terminated, usually due to a call to `Thread.Abort()` or, in the case of ASP.NET, when a request is being aborted by the server (for example, when a client disconnects or a timeout occurs).
Here are some common reasons that mi... | 36,716 | [
{
"from": "human",
"value": "I'm running an SQL query against a mainframe DB2 database using the OdbcDataReader class and ExecuteReader() method. This code is in production and has been running fine for months.\nThe query normally takes 1-2 minutes to execute. This past Friday, the query encountered a Thre... |
I am calling a batch file from Javascript in this fashion:
function runBatch(){
var exe = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile);
exe.initWithPath("C:\\test.bat");
var run = Components.classes['@mozilla.org/process/util;1'].createInstance(Component... | When calling external executables such as batch files or command prompts in a way that doesn't show a visible command window, you typically encounter this behavior because the process is being run in a "hidden" state. In your case, it appears that you're using the `nsIProcess` interface from XULRunner, which by default... | 37,561 | [
{
"from": "human",
"value": "I am calling a batch file from Javascript in this fashion:\nfunction runBatch(){\n var exe = Components.classes['@mozilla.org/file/local;1'].createInstance(Components.interfaces.nsILocalFile);\n exe.initWithPath(\"C:\\\\test.bat\");\n var run = Components.classes['@mozi... |
How can I see which file extensions are related to which kind of syntax highlighting? Unfortunately, Tools -> Options -> Text Editor -> File Extensions lists only those entered manually, no default ones. And I didn't manage to find it on my own via Google or other means.
My particular problem is, I want to have .inc h... | To see which file extensions are related to which kind of syntax highlighting in Visual Studio, there are a couple of approaches you can take:
### 1. **Check the Registry:**
Visual Studio stores some of its configurations, including file type associations, in the Windows registry. You can check the following registry ... | 37,909 | [
{
"from": "human",
"value": "How can I see which file extensions are related to which kind of syntax highlighting? Unfortunately, Tools -> Options -> Text Editor -> File Extensions lists only those entered manually, no default ones. And I didn't manage to find it on my own via Google or other means. \nMy pa... |
The data sources have the same structure, but different data. One would be used for rows that are saved (view mode), and the other one would be for rows that are being added or edited (edit/new rows). How can that be acomplished?
I have a standard foreign key column that references a standard lookup table which has an ... | To address your scenario where you have two data sources (one for viewing saved rows and another for adding or editing rows), you can use a combination of data management techniques in your application. The key challenge you're facing is maintaining a consistent state for a combo box that uses a lookup table, especiall... | 36,403 | [
{
"from": "human",
"value": "The data sources have the same structure, but different data. One would be used for rows that are saved (view mode), and the other one would be for rows that are being added or edited (edit/new rows). How can that be acomplished?\nI have a standard foreign key column that refere... |
I have created a class to dynamically put together SQL function statements within a project. I have found this class to be pretty useful and would like to incorporate into future projects
namespace connectionClass
{
public class connClass
{
NpgsqlConnection conn = new NpgsqlConnection(projectName.Propert... | To create a class that allows you to dynamically set the project name, you can modify your existing `connClass` to accept the project name as a parameter in the constructor. This way, the connection string can be constructed based on the provided project name.
Here’s a way to achieve this by using reflection to access... | 36,724 | [
{
"from": "human",
"value": "I have created a class to dynamically put together SQL function statements within a project. I have found this class to be pretty useful and would like to incorporate into future projects\nnamespace connectionClass\n{\n public class connClass\n\n { \n\n NpgsqlConnection... |
Is there a way to only load child nodes when the parent node is expanded? The problem that I’m running into is that the “expand” icon doesn’t show up if a node doesn’t have any children. Since I don’t want to load the children until the icon is clicked, I’m left with a bit of a catch 22.
| The scenario you're describing is a common challenge when implementing hierarchical data structures, such as trees, where you want to load child nodes dynamically when a parent node is expanded. There are several strategies to handle this situation effectively. Here are some approaches you might consider:
### 1. Place... | 36,855 | [
{
"from": "human",
"value": "Is there a way to only load child nodes when the parent node is expanded? The problem that I’m running into is that the “expand” icon doesn’t show up if a node doesn’t have any children. Since I don’t want to load the children until the icon is clicked, I’m left with a bit of a ... |
I have a <select>. Using JavaScript, I need to get a specific <option> from the list of options, and all I know is the value of the option. The option may or may not be selected.
Here's the catch: there are thousands of options and I need to do this a few hundred times in a loop. Right now I loop through the "options"... | If you need to find an option in a `<select>` element based on its value and you are doing this multiple times (especially when dealing with thousands of options), looping through the options can indeed become inefficient.
A more efficient approach would be to store the options in a Map (or an object) when you initial... | 37,260 | [
{
"from": "human",
"value": "I have a <select>. Using JavaScript, I need to get a specific <option> from the list of options, and all I know is the value of the option. The option may or may not be selected.\nHere's the catch: there are thousands of options and I need to do this a few hundred times in a lo... |
I am writing a Clone method using reflection. How do I detect that a property is an indexed property using reflection? For example:
public string[] Items
{
get;
set;
}
My method so far:
public static T Clone<T>(T from, List<string> propertiesToIgnore) where T : new()
{
T to = new T();
Type myType = fro... | To determine if a property is an indexed property using reflection in C#, you can inspect the `GetIndexParameters()` method of the `PropertyInfo` class. If this method returns an array with a length greater than zero, it indicates that the property is indexed.
Here's how you can modify your `Clone` method to include t... | 38,501 | [
{
"from": "human",
"value": "I am writing a Clone method using reflection. How do I detect that a property is an indexed property using reflection? For example:\npublic string[] Items\n{\n get;\n set;\n}\n\nMy method so far:\npublic static T Clone<T>(T from, List<string> propertiesToIgnore) where T : n... |
Obviously it gets updated during a write operation, but are there any non-destructive operations that also force an update? Basically looking to be able to do the equivalent of the *nix touch command, but in C# programmatically.
| In C#, if you want to update the timestamp of a file (similar to the Unix `touch` command) without actually modifying the content of the file, you can achieve this by using the `File.SetLastWriteTime` method. This allows you to update the last write time of the file without making any changes to the file's content.
He... | 39,947 | [
{
"from": "human",
"value": "Obviously it gets updated during a write operation, but are there any non-destructive operations that also force an update? Basically looking to be able to do the equivalent of the *nix touch command, but in C# programmatically.\n"
},
{
"from": "gpt",
"value": "In C... |
Is there a better free TreeView control that exists for Visual Studio 2008 / .NET 3.5?
I believe I need something a little more powerful than the out-of-the box version. I'm not exactly sure for what yet but I thought I'd ask quickly before I get too far in to my project.
| If you're looking for a more powerful TreeView control for Visual Studio 2008 / .NET 3.5, there are several options available that you can explore, some of which are free or open source. Here are a few suggestions:
1. **TreeViewAdv (from ActiPro Software)**:
- ActiPro provides a more advanced TreeView control that ... | 37,980 | [
{
"from": "human",
"value": "Is there a better free TreeView control that exists for Visual Studio 2008 / .NET 3.5?\nI believe I need something a little more powerful than the out-of-the box version. I'm not exactly sure for what yet but I thought I'd ask quickly before I get too far in to my project.\n"
... |
Has anybody succeeded in customizing the Places Bar for VS 2008? My customizations from VS 2005 did not transfer to 2008 (obviously), and no matter what I do with the registry, I cannot make my custom places appear on the Open dialogs. I have read and applied the relevant MS KB article, to no avail.
This used to work f... | Customizing the Places Bar in Visual Studio 2008 can indeed be a bit tricky, especially if you're used to the previous methods in Visual Studio 2005. Here are some steps you can follow to try and customize the Places Bar in VS 2008:
1. **Registry Edits**: You can customize the Places Bar by modifying the Windows Regis... | 36,597 | [
{
"from": "human",
"value": "Has anybody succeeded in customizing the Places Bar for VS 2008? My customizations from VS 2005 did not transfer to 2008 (obviously), and no matter what I do with the registry, I cannot make my custom places appear on the Open dialogs. I have read and applied the relevant MS KB ... |
I'm using a RichTextBox in WinForms 3.5 and I found that when I programmatically edit the contained text, those changes are no longer available to the built in undo functionality.
Is there a way to make it so these changes are available for undo/redo?
| In WinForms, the `RichTextBox` control has built-in support for undo and redo operations, but programmatically changing the text does not automatically register as an undoable action. However, you can manually notify the `RichTextBox` that a change has been made by using the `BeginUpdate()` and `EndUpdate()` methods, o... | 38,505 | [
{
"from": "human",
"value": "I'm using a RichTextBox in WinForms 3.5 and I found that when I programmatically edit the contained text, those changes are no longer available to the built in undo functionality.\nIs there a way to make it so these changes are available for undo/redo?\n"
},
{
"from": "g... |
I'm looking for a .NET library that will allow creation of a Word document. I need to export HTML based content to a Word doc (97-2003 format, not docx).
I know that there are the Microsoft Office Automation libraries and Office interop, but as far as I can tell, they require that you have office actually installed an... | If you're looking for a .NET library that can create Word documents (specifically in the older `.doc` format for Word 97-2003) without requiring Microsoft Office to be installed, you have a few options. Here are some libraries that can help you with this task:
### 1. **NPOI**
- **Description**: NPOI is a .NET library ... | 36,873 | [
{
"from": "human",
"value": "I'm looking for a .NET library that will allow creation of a Word document. I need to export HTML based content to a Word doc (97-2003 format, not docx).\nI know that there are the Microsoft Office Automation libraries and Office interop, but as far as I can tell, they require ... |
We're usually 1-4 developers / art directors / copywriters on each project at my firm, what methodology would you recommend use to use? Agile? XP? Scrum? Something else? (I know they are all variations of essentially the same concept, yes)
| Given that you typically have a small team of 1-4 developers, art directors, and copywriters working on projects, I recommend using **Scrum** as your methodology. Here are a few reasons why Scrum might be a good fit:
1. **Simplicity and Structure**: Scrum provides a clear structure and roles (Scrum Master, Product Own... | 38,871 | [
{
"from": "human",
"value": "We're usually 1-4 developers / art directors / copywriters on each project at my firm, what methodology would you recommend use to use? Agile? XP? Scrum? Something else? (I know they are all variations of essentially the same concept, yes)\n"
},
{
"from": "gpt",
"val... |
How can I prevent the image tag that calls the associated image from displaying if no image is associated with the record?
<%= image_tag @agent.avatar.url %>
...gives me the text "Missing" if there is no image associated with that agent. I want to test to see there is an image available first, then render the above t... | To prevent the `image_tag` from displaying when there is no associated image, you can check if the image URL exists before rendering the tag. If there is no associated image, you can either render nothing or a default image.
Here are two common approaches:
### Approach 1: Conditional Rendering with Default Image
You... | 37,780 | [
{
"from": "human",
"value": "How can I prevent the image tag that calls the associated image from displaying if no image is associated with the record?\n<%= image_tag @agent.avatar.url %>\n\n...gives me the text \"Missing\" if there is no image associated with that agent. I want to test to see there is an ... |
Nested If or single if with And operator, which is better approach?
Single If with And
if (txtPackage.Text != string.Empty && txtPackage.Text == "abc")
{
//
}
Nested If
if (txtPackage.Text != string.Empty)
{
if (txtPackage.Text == "abc")
{
//
}
}
| Choosing between using a single `if` statement with the `&&` operator or nested `if` statements generally depends on readability, clarity, and maintainability of the code. Both approaches achieve the same logical result, but there are some considerations that can help you decide which one to use in your specific contex... | 38,549 | [
{
"from": "human",
"value": "Nested If or single if with And operator, which is better approach?\nSingle If with And \nif (txtPackage.Text != string.Empty && txtPackage.Text == \"abc\")\n{\n //\n}\n\nNested If \nif (txtPackage.Text != string.Empty)\n{ \n if (txtPackage.Text == \"abc\")\n {\n //\n ... |
Suppose A.css styles B.html. What tools/techniques are there to programmatically reduce the size of A.css while holding its styling effects on B.html constant? Here are some techniques I would imagine such a tool using:
Remove redundancies in A.css. For example, if the same class is defined twice you can remove the se... | Reducing the size of a CSS file while maintaining its styling effects on a specific HTML document can be a challenging task, but there are several tools and techniques available to help you achieve this. Here’s a more detailed breakdown of strategies and tools that can be useful in your scenario:
### Techniques for Re... | 33,886 | [
{
"from": "human",
"value": "Suppose A.css styles B.html. What tools/techniques are there to programmatically reduce the size of A.css while holding its styling effects on B.html constant? Here are some techniques I would imagine such a tool using:\n\nRemove redundancies in A.css. For example, if the same c... |
function AddTheatres() {
Services.AdminWebServices.AddTheatresSVC(oTheatres, OnSuccessTheatres, OnError, OnTimeOut);
}
function OnSuccessTheatres(result1) {
Services.AdminWebServices.AddTicketPricesSVC(oTicketPrices, OnSuccessTicketPrices, OnError, OnTimeOut); //working
}
function OnSuccessTicketPrices(result2) {... | Based on the code you provided and your description of the problem, it seems that the `OnSuccessTicketPrices` function, where the alert is supposed to be called, is not being executed, even though you mentioned that the `AddTicketPricesSVC` function is returning the correct value.
Here are several reasons why `alert(r... | 37,025 | [
{
"from": "human",
"value": "function AddTheatres() {\n Services.AdminWebServices.AddTheatresSVC(oTheatres, OnSuccessTheatres, OnError, OnTimeOut);\n}\n\nfunction OnSuccessTheatres(result1) {\n Services.AdminWebServices.AddTicketPricesSVC(oTicketPrices, OnSuccessTicketPrices, OnError, OnTimeOut); //workin... |
I implement common error handling by using IHttpModule. Locally on my machine with WinXP it works like a charm. Once I upload solution on our test server, which is W2003 it doesn't work. Once an error occurs it displays directly in an asp.net error page. It doesn't process using my error module.
Any suggestion most wel... | When you're experiencing issues with your `IHttpModule` not working correctly on the test server, while it works fine locally, there are a few potential reasons and solutions to consider:
1. **Error Handling Settings**: Make sure that your web application’s error handling settings are correctly configured on the test ... | 37,226 | [
{
"from": "human",
"value": "I implement common error handling by using IHttpModule. Locally on my machine with WinXP it works like a charm. Once I upload solution on our test server, which is W2003 it doesn't work. Once an error occurs it displays directly in an asp.net error page. It doesn't process using... |
When @RadioServiceGroup is set to NULL, I want to return all the records from the sbi_l_radioservicecodes table which has about 120 records. However, when I execute the following procedure and set the @RadioServiceGroup to NULL, it returns no records. Here is the stored proc:
CREATE PROCEDURE [dbo].[GetRadioServiceCo... | The issue you're encountering is due to how you're checking for `NULL` in your stored procedure. In SQL Server, the expression `@RadioServiceGroup = NULL` will always evaluate to `FALSE` because `NULL` is not equal to anything, not even `NULL`. Instead, you should use the `IS NULL` condition to check if the parameter i... | 39,533 | [
{
"from": "human",
"value": "When @RadioServiceGroup is set to NULL, I want to return all the records from the sbi_l_radioservicecodes table which has about 120 records. However, when I execute the following procedure and set the @RadioServiceGroup to NULL, it returns no records. Here is the stored proc:\... |
What is the best way to call C/C++ from other languages such as Java, Python, Perl, PHP, etc?
| Calling C/C++ code from other programming languages can be done in several ways, each with its own benefits and trade-offs. Below are some common methods for calling C/C++ from languages like Java, Python, Perl, and PHP:
### 1. **Java: JNI (Java Native Interface)**
- **Description:** JNI allows Java code to interac... | 33,060 | [
{
"from": "human",
"value": "What is the best way to call C/C++ from other languages such as Java, Python, Perl, PHP, etc?\n"
},
{
"from": "gpt",
"value": "Calling C/C++ code from other programming languages can be done in several ways, each with its own benefits and trade-offs. Below are some c... |
There are several people about (myself being one of them) who have been developing RIA for a while now using Flex and AJAX. However Silverlight is now on the scene and worth picking up.
Question is, as someone who has never looked at .NET before, should I just dive in Silverlight and try and make up the bits I'm missi... | Diving into Silverlight without a prior understanding of .NET can be challenging, as Silverlight is built on top of the .NET framework and leverages many of its concepts and technologies. Here are a few considerations to help you decide:
### 1. **Understanding .NET Basics**:
- **Core Concepts**: Familiarizing yours... | 35,929 | [
{
"from": "human",
"value": "There are several people about (myself being one of them) who have been developing RIA for a while now using Flex and AJAX. However Silverlight is now on the scene and worth picking up.\nQuestion is, as someone who has never looked at .NET before, should I just dive in Silverli... |
Here is a nice underhand lob pitch to you guys.
So basically I've got my content table with unique primary key IDs and I've got my tag table with unique primary key IDs.
I've got a table that has an identity column as a primary key but the two other columes are the contentID and tagID. What do I need to do to the tab... | To ensure that each combination of `contentID` and `tagID` is unique in your junction table (which connects your `content` and `tag` tables), you need to create a composite unique constraint on the two columns `contentID` and `tagID`.
Here’s how you can do this, depending on your database system. Below are examples f... | 38,251 | [
{
"from": "human",
"value": "Here is a nice underhand lob pitch to you guys.\nSo basically I've got my content table with unique primary key IDs and I've got my tag table with unique primary key IDs. \nI've got a table that has an identity column as a primary key but the two other columes are the contentID ... |
Any list of Testing frameworks for ActionScript 2.0/3.0 around there?
| Certainly! While ActionScript has become less commonly used in recent years, there are still some frameworks that were popular for testing in ActionScript 2.0 and 3.0. Here’s a list of some testing frameworks you might find useful:
### For ActionScript 3.0:
1. **FlexUnit**: This is the most popular testing framework ... | 38,663 | [
{
"from": "human",
"value": "Any list of Testing frameworks for ActionScript 2.0/3.0 around there?\n"
},
{
"from": "gpt",
"value": "Certainly! While ActionScript has become less commonly used in recent years, there are still some frameworks that were popular for testing in ActionScript 2.0 and 3... |
I try Request.Form.Set(k, v) but it's throwing exception
Collection is read-only
| The exception "Collection is read-only" indicates that you're trying to modify a collection that cannot be changed. In the context of `Request.Form` in ASP.NET, `Request.Form` is a read-only collection, which means you cannot add, remove, or modify its items directly.
### Understanding the Request.Form Collection
- T... | 37,919 | [
{
"from": "human",
"value": "I try Request.Form.Set(k, v) but it's throwing exception \n\nCollection is read-only\n\n"
},
{
"from": "gpt",
"value": "The exception \"Collection is read-only\" indicates that you're trying to modify a collection that cannot be changed. In the context of `Request.Fo... |
I'm working with C and through a socket I will be receiving a message with one space in it, I need to split the string into parts at the space. How would I go about doing this?
| In C, you can split a string into parts at a space character using the `strtok` function from the C standard library. This function allows you to tokenize a string based on specified delimiters.
Here's a simple example of how you can use `strtok` to split a string at the first space:
```c
#include <stdio.h>
#include ... | 37,925 | [
{
"from": "human",
"value": "I'm working with C and through a socket I will be receiving a message with one space in it, I need to split the string into parts at the space. How would I go about doing this?\n"
},
{
"from": "gpt",
"value": "In C, you can split a string into parts at a space charac... |
What would be the most efficient data type to store a UUID/GUID in databases that do not have a native UUID/GUID data type? 2 BIGINTs?
And what would be the most efficient code (C# preferred) to convert to and from a GUID to that type?
Thanks.
| When working with databases that do not have a native UUID or GUID type, one efficient way to store a UUID is to use two `BIGINT` columns. A UUID (Universally Unique Identifier) is typically represented as a 128-bit number, which can be effectively split into two 64-bit numbers (2 `BIGINT`s) for storage.
### Storing U... | 37,596 | [
{
"from": "human",
"value": "What would be the most efficient data type to store a UUID/GUID in databases that do not have a native UUID/GUID data type? 2 BIGINTs?\nAnd what would be the most efficient code (C# preferred) to convert to and from a GUID to that type?\nThanks.\n"
},
{
"from": "gpt",
... |
I want to pause input in a shell script, and prompt the user for choices.
The standard Yes, No, or Cancel type question.
How do I accomplish this in a typical bash prompt?
| In a bash script, you can prompt the user for choices such as Yes, No, or Cancel by using the `read` command. Below is an example of how to accomplish this, including handling the user's input accordingly.
```bash
#!/bin/bash
# Function to ask a Yes/No/Cancel question
ask_user() {
while true; do
read -p "... | 37,804 | [
{
"from": "human",
"value": "I want to pause input in a shell script, and prompt the user for choices.\nThe standard Yes, No, or Cancel type question.\nHow do I accomplish this in a typical bash prompt?\n"
},
{
"from": "gpt",
"value": "In a bash script, you can prompt the user for choices such a... |
I have a couple of hobby C programming projects that I would like to start. I am looking for an open source library that has a liberal license (I want credit, but pretty much anybody can use). The library needs to have strings better than the C standard library and some portable threading primitives.
I am considering... | Both GLib and the Apache Portable Runtime (APR) are well-established libraries that provide enhanced functionalities over the standard C library, especially for strings and threading primitives. Here's a comparison of the two, along with some other alternatives you might consider:
### GLib
**Overview:**
- Part of the ... | 38,482 | [
{
"from": "human",
"value": "I have a couple of hobby C programming projects that I would like to start. I am looking for an open source library that has a liberal license (I want credit, but pretty much anybody can use). The library needs to have strings better than the C standard library and some portab... |
I'm trying to figure the best strategy about how to organize DataContexts. The typical DB we work has between 50 and 100 tables usually in third-normal form and with many relations between them. I think we have two options:
Put all tables in a single context. This will ensure that anything we do will be committed in t... | When organizing `DataContext` instances, especially in a scenario with a database schema that contains between 50 and 100 tables with numerous relationships, there are several considerations to keep in mind. Here are some recommended practices that can help you manage this complexity while ensuring that your architectu... | 32,176 | [
{
"from": "human",
"value": "I'm trying to figure the best strategy about how to organize DataContexts. The typical DB we work has between 50 and 100 tables usually in third-normal form and with many relations between them. I think we have two options:\n\nPut all tables in a single context. This will ensure... |
Lets say you have a property like:
Person person1;
public Person Captin{
get{
return person1;
}
set{
person1 = value;
}
}
public void SomeFunction(){
Captin.name = "Hook"
}
In this case if you set the name on the property we know that the new name of Hook will get applied to the ... | In the situation you've described, it's important to understand how property getters and setters work in C#. When you access a property, the getter is called, and when you assign a value to a property, the setter is called.
### Scenario Breakdown
In your original code:
```csharp
public Person Captin {
get {
... | 38,472 | [
{
"from": "human",
"value": "Lets say you have a property like:\nPerson person1;\n\n\npublic Person Captin{\n get{\n return person1;\n }\n set{\n person1 = value;\n }\n}\n\npublic void SomeFunction(){\n Captin.name = \"Hook\"\n}\n\nIn this case if you set the name on the propert... |
From what I understand, if you have multiple web servers, then you need some kind of load balancer that will split the traffic amongst your web servers.
Does this mean that the load balancer is the main connecting point on the network? ie. the load balancer has the IP address of the domain name?
If this is the case, it... | Yes, you are correct in your understanding of load balancers and their role in a multi-server architecture. Here are some clarifications regarding your points:
1. **Load Balancer as the Main Connecting Point**: Yes, in many cases, the load balancer acts as the main entry point for incoming traffic. It has its own IP a... | 40,096 | [
{
"from": "human",
"value": "From what I understand, if you have multiple web servers, then you need some kind of load balancer that will split the traffic amongst your web servers.\nDoes this mean that the load balancer is the main connecting point on the network? ie. the load balancer has the IP address o... |
I'm new to PHP and I'm trying to do something that may be bad practise and may well be impossible. I'm basically just hacking something together to test my knowledge and see what PHP can do.
I have one webpage with a form that collects data. That is submited to a PHP script that does a bunch of processing - but doesn't... | You're on the right track in terms of PHP functionality. When you use `header('Location: page.php');`, you perform a redirect, and unfortunately, you cannot directly pass POST data during a redirection using the `Location` header. Redirects are always done using the HTTP GET method.
Here are a few common ways to handl... | 37,728 | [
{
"from": "human",
"value": "I'm new to PHP and I'm trying to do something that may be bad practise and may well be impossible. I'm basically just hacking something together to test my knowledge and see what PHP can do.\nI have one webpage with a form that collects data. That is submited to a PHP script tha... |
I need to determine the number of pages in a specified PDF file using C# code (.NET 2.0). The PDF file will be read from the file system, and not from an URL. Does anyone have any idea on how this could be done? Note: Adobe Acrobat Reader is installed on the PC where this check will be carried out.
| To determine the number of pages in a PDF file using C# in .NET 2.0, you can use a library called **iTextSharp**. This library allows you to manipulate PDF files, including retrieving the number of pages in a PDF document.
Here are the steps you can follow:
1. **Download and Reference iTextSharp**: Since you're using... | 38,419 | [
{
"from": "human",
"value": "I need to determine the number of pages in a specified PDF file using C# code (.NET 2.0). The PDF file will be read from the file system, and not from an URL. Does anyone have any idea on how this could be done? Note: Adobe Acrobat Reader is installed on the PC where this che... |
I am using axis 2 webservice client.
The first https call to the webservice throws a exception with the message: "Message did not contain a valid Security Element".
I think that the problem could be the security mode: maybe it has to be message level security. In this case, how can I configure it in axis?.
The code:
Sy... | The error message "Message did not contain a valid Security Element" suggests that the web service you're calling is expecting a specific security configuration, which is likely to be WS-Security for message-level security.
To configure message-level security in an Axis2 client, you'll need to include the appropriate ... | 33,073 | [
{
"from": "human",
"value": "I am using axis 2 webservice client.\nThe first https call to the webservice throws a exception with the message: \"Message did not contain a valid Security Element\".\nI think that the problem could be the security mode: maybe it has to be message level security. In this case, ... |
Seems like as really simple thing to do, but I just can't track it down in the help or online.
I know how to change the XAML to set the StartPoint and EndPoint of a LinearGradient brush, but I don't know how you do it using the IDE in Expression Blend - does anyone know the keyboard/mouse actions that you use to do thi... | In Expression Blend, you can change the StartPoint and EndPoint of a LinearGradientBrush using the following steps:
1. **Select the Element**: First, select the UI element that you want to apply the LinearGradientBrush to. This could be a Rectangle, Button, or any other control that supports brushes.
2. **Open the Pr... | 38,085 | [
{
"from": "human",
"value": "Seems like as really simple thing to do, but I just can't track it down in the help or online.\nI know how to change the XAML to set the StartPoint and EndPoint of a LinearGradient brush, but I don't know how you do it using the IDE in Expression Blend - does anyone know the key... |
I am building a ASP.NET website, and when I click the START DEBUGGING icon, it runs Internet Explorer as the account that I ran Visual Studio with.
I would like to run IE as a different user when debugging.
| Running Internet Explorer (IE) as a different user while debugging an ASP.NET application in Visual Studio can be accomplished by creating a custom start action that allows you to specify the user account under which IE should run. Here’s how you can set that up:
### Option 1: Using `runas` Command
1. **Create a Shor... | 37,812 | [
{
"from": "human",
"value": "I am building a ASP.NET website, and when I click the START DEBUGGING icon, it runs Internet Explorer as the account that I ran Visual Studio with. \nI would like to run IE as a different user when debugging.\n"
},
{
"from": "gpt",
"value": "Running Internet Explore... |
Inspired by this question and answer, how do I create a generic permutations algorithm in F#? Google doesn't give any useful answers to this.
EDIT: I provide my best answer below, but I suspect that Tomas's is better (certainly shorter!)
| Creating a generic permutations algorithm in F# can be quite elegant. Below is a simple implementation of a generic permutation function that works for any list of items. This implementation uses recursion and leverages the functional programming paradigms that F# embraces.
Here's a straightforward implementation:
``... | 38,218 | [
{
"from": "human",
"value": "Inspired by this question and answer, how do I create a generic permutations algorithm in F#? Google doesn't give any useful answers to this.\nEDIT: I provide my best answer below, but I suspect that Tomas's is better (certainly shorter!)\n"
},
{
"from": "gpt",
"val... |
When I was learning Java coming from a background of some 20 years of procedural programming with basic, Pascal, COBOL and C, I thought at the time that the hardest thing about it was wrapping my head around the OOP jargon and concepts. Now with about 8 years of solid Java under my belt, I have come to the conclusion ... | You've touched on a critical challenge in modern software development. Writing reliable, maintainable, and performant multi-threaded applications is indeed one of the more difficult aspects of programming. Here are some approaches and methodologies that can help mitigate issues like deadlocks, race conditions, and stal... | 35,252 | [
{
"from": "human",
"value": "When I was learning Java coming from a background of some 20 years of procedural programming with basic, Pascal, COBOL and C, I thought at the time that the hardest thing about it was wrapping my head around the OOP jargon and concepts. Now with about 8 years of solid Java unde... |
I'm building a simple ASP.NET web application in VS 2008 with a SQL 2005 database. I'm working on Vista and I'd prefer not to install IIS (I'd rather just us Cassini for local testing). Here's what I've tried:
FrontPage Server Extensions. I installed these on my server, but they broke my default web site and I still c... | Hi Jim,
You're in a bit of a tricky situation with your setup. Here are a few alternative methods you might consider for deploying your ASP.NET application without installing IIS or dealing with the complications of FTP and FrontPage Server Extensions:
### 1. **Web Deploy (MSDeploy)**
While Web Deploy is generally m... | 35,067 | [
{
"from": "human",
"value": "I'm building a simple ASP.NET web application in VS 2008 with a SQL 2005 database. I'm working on Vista and I'd prefer not to install IIS (I'd rather just us Cassini for local testing). Here's what I've tried:\n\nFrontPage Server Extensions. I installed these on my server, but t... |
This is related to some other questions, such as: this, and some of my other questions.
In this question, and others, we see we can declare and initialise string arrays in one nice step, for example:
const char* const list[] = {"zip", "zam", "bam"}; //from other question
This can be done in the implementation of a fun... | In C++, you cannot directly initialize an array as a class member with initializer syntax (like `{"Name1", "Name2", "Name3"}`) in the class definition itself. This is because C++ does not allow non-static data members to be initialized with non-constexpr values in the class definition.
However, you can work around thi... | 33,239 | [
{
"from": "human",
"value": "This is related to some other questions, such as: this, and some of my other questions.\nIn this question, and others, we see we can declare and initialise string arrays in one nice step, for example:\nconst char* const list[] = {\"zip\", \"zam\", \"bam\"}; //from other question... |
I'm quite confused by something. I've got 2 select lists, and if you choose an option in the first, I then load the 2nd with a certain set of options. I clear this out and repopulate it every time you change the selection in the first select element. Now, on postback, I need to know the value of the option that was ... | It sounds like you're experiencing an issue where the value of the second select element (dropdown) is not being retained after a postback. This is a common problem when dynamically changing the options of a select element based on another select element. Here are several things to check and consider to resolve this is... | 33,697 | [
{
"from": "human",
"value": "I'm quite confused by something. I've got 2 select lists, and if you choose an option in the first, I then load the 2nd with a certain set of options. I clear this out and repopulate it every time you change the selection in the first select element. Now, on postback, I need ... |
I am writing a multi-threaded Windows application in Microsoft Visual C# 2008 Express Edition. Recently, the debugger has been acting strangely.
While I am Stepping Over lines of code using the F10, sometimes it will interpret my Step Over (F10) command just like a Continue command (F5) and then the program will resum... | The behavior you're experiencing with the Visual Studio debugger in C# can be frustrating, and there are a few potential reasons for this issue. Here are some suggestions and possible explanations:
1. **Debugger Settings**: First, check your debugger settings to ensure they are correctly configured. Sometimes, setting... | 37,353 | [
{
"from": "human",
"value": "I am writing a multi-threaded Windows application in Microsoft Visual C# 2008 Express Edition. Recently, the debugger has been acting strangely.\nWhile I am Stepping Over lines of code using the F10, sometimes it will interpret my Step Over (F10) command just like a Continue co... |
I have some HTML and jQuery that slides a div up and down to show or hide` it when a link is clicked:
<ul class="product-info">
<li>
<a href="#">YOU CLICK THIS TO SHOW/HIDE</a>
<div class="toggle">
<p>CONTENT TO SHOW/HIDE</p>
</div>
</li>
</ul>
$('div.toggle').hide();
$('ul.product-info li a').cl... | The issue you're experiencing with `preventDefault()` not being recognized is likely due to not calling it on the event object that is passed to the event handler. You need to pass the `event` parameter to the function and then call `preventDefault()` on that parameter.
Here's how to modify your jQuery code to use `p... | 38,673 | [
{
"from": "human",
"value": "I have some HTML and jQuery that slides a div up and down to show or hide` it when a link is clicked:\n<ul class=\"product-info\">\n <li>\n <a href=\"#\">YOU CLICK THIS TO SHOW/HIDE</a>\n <div class=\"toggle\">\n <p>CONTENT TO SHOW/HIDE</p>\n </div>\n </li>\n</ul... |
What are the best practices and rules-of-thumb to follow while maintaining code? Is it good practice to have only the production ready code in the development branch, or should untested latest code be available in the development branch?
How do you guys maintain your development code and production code?
Edit - Supple... | Maintaining code effectively is crucial for the long-term success and health of any software project. Here are some best practices and rules-of-thumb to follow while maintaining code:
### Best Practices for Code Maintenance
1. **Code Reviews**: Regular code reviews help catch bugs and improve code quality. It's benef... | 34,581 | [
{
"from": "human",
"value": "What are the best practices and rules-of-thumb to follow while maintaining code? Is it good practice to have only the production ready code in the development branch, or should untested latest code be available in the development branch?\nHow do you guys maintain your developme... |
After getting the objectEnumerator in the following code, the set1 retain count goes to 3. I was surprised to see that because I didn't expect it to change. I searched the documentation and can't find where this effect is explained.
I assume the extra retains are probably set to autorelease by the Cocoa enumeration log... | In Objective-C, retain counts can sometimes be a confusing aspect of memory management, especially when dealing with collections like `NSMutableSet`. Let's break down the situation you're describing:
### Retain Count Behavior
When you call `[set1 objectEnumerator]`, the `NSMutableSet` implementation retains the set in... | 38,743 | [
{
"from": "human",
"value": "After getting the objectEnumerator in the following code, the set1 retain count goes to 3. I was surprised to see that because I didn't expect it to change. I searched the documentation and can't find where this effect is explained.\nI assume the extra retains are probably set t... |
In GWT, what is the best way to convert a JavaScriptObject overlay type into a JSON string?
I currently have
public final String toJSON() {
return new JSONObject(this).toString();
}
Which seems to work fine. I would like to know if there are any better approaches.
| In Google Web Toolkit (GWT), converting a `JavaScriptObject` overlay type to a JSON string using the `JSONObject` approach you've provided is a common and effective method. However, there are a few things you might consider for improvement or alternative approaches, depending on your specific needs.
Here are some pote... | 33,227 | [
{
"from": "human",
"value": "In GWT, what is the best way to convert a JavaScriptObject overlay type into a JSON string?\nI currently have\npublic final String toJSON() { \n return new JSONObject(this).toString();\n}\n\nWhich seems to work fine. I would like to know if there are any better approache... |
How do I get a human-readable file size in bytes abbreviation using .NET?
Example:
Take input 7,326,629 and display 6.98 MB
| You can create a method in .NET to convert a byte size into a human-readable format with an appropriate abbreviation (e.g., KB, MB, GB). Below is an example of how to achieve this in C#.
```csharp
using System;
public class Program
{
public static void Main()
{
long fileSizeInBytes = 7326629; // Examp... | 39,668 | [
{
"from": "human",
"value": "How do I get a human-readable file size in bytes abbreviation using .NET?\nExample:\nTake input 7,326,629 and display 6.98 MB\n"
},
{
"from": "gpt",
"value": "You can create a method in .NET to convert a byte size into a human-readable format with an appropriate abbr... |
any idea which is the command for publish in msbuild corresponding to the one in VS2008?
What I want is the resulting output to be the same, without that _PublishedWebSites subdirectory.
Is this achievable from command line or I should use a build file?
Thanks.
| To publish a web application using MSBuild in a way that mirrors the behavior of Visual Studio 2008, you can use the `/p:DeployOnBuild=true` and `/p:PublishProfile=<ProfileName>` options.
However, if you're looking to avoid the creation of the `_PublishedWebSites` subdirectory, you'll need to set the `PublishUrl` prop... | 36,437 | [
{
"from": "human",
"value": "any idea which is the command for publish in msbuild corresponding to the one in VS2008?\nWhat I want is the resulting output to be the same, without that _PublishedWebSites subdirectory.\nIs this achievable from command line or I should use a build file?\nThanks.\n"
},
{
... |
first off, I know that this question could be borderline-duplicate to this one, and yes, it is a bit ironic that I am asking a question for something that I even answered myself.
Now, I am talking about ASP.net Profiles. I am building an application using MVC if that matters, and I believe that the built-in Profile Pro... | It sounds like you're at a crossroads regarding how to handle user profiles in your ASP.NET MVC application, and it's great that you're considering the trade-offs between using built-in providers versus rolling your own solution. Here are some considerations to help guide your decision:
### Custom Profile Provider vs.... | 37,996 | [
{
"from": "human",
"value": "first off, I know that this question could be borderline-duplicate to this one, and yes, it is a bit ironic that I am asking a question for something that I even answered myself.\nNow, I am talking about ASP.net Profiles. I am building an application using MVC if that matters, a... |
Original Question
I am writting a logging class where the goal is to be able to do this:
// thread one
Logger() << "Some string" << std::ios::hex << 45;
// thread two
Logger() << L"Some wide string" << std::endl;
Currently my Logger header looks something like this:
#pragma once;
#include <ostream>
class Logger
{
... | Your revised `Logger` class is on the right track, and I'll help you refine it further by addressing your goals and adding some enhancements. Below is a complete implementation of the `Logger` class that fulfills your requirements while maintaining thread safety, proper handling of manipulators, and special conversion ... | 34,909 | [
{
"from": "human",
"value": "Original Question\nI am writting a logging class where the goal is to be able to do this:\n// thread one\nLogger() << \"Some string\" << std::ios::hex << 45;\n// thread two\nLogger() << L\"Some wide string\" << std::endl;\n\nCurrently my Logger header looks something like this:\... |
At what point would you create your own exception class vs. using java.lang.Exception? (All the time? Only if it will be used outside the package? Only if it must contain advanced logic? etc...)
| Creating your own exception class in Java is a design decision that should be made based on the specific needs of your application and the clarity you want to achieve in your error handling. Here are some guidelines to help you determine when to create a custom exception class versus using `java.lang.Exception` or othe... | 36,269 | [
{
"from": "human",
"value": "At what point would you create your own exception class vs. using java.lang.Exception? (All the time? Only if it will be used outside the package? Only if it must contain advanced logic? etc...)\n"
},
{
"from": "gpt",
"value": "Creating your own exception class in Ja... |
Anything would be good. Exemples, best practices, samples, etc.
| Absolutely! It seems like you're looking for a variety of examples, best practices, and samples. I'll cover a few different areas: writing, project management, and general productivity tips. If you have a specific topic in mind, let me know!
### Writing
#### Best Practices
1. **Know Your Audience**: Tailor your conten... | 33,305 | [
{
"from": "human",
"value": "Anything would be good. Exemples, best practices, samples, etc.\n"
},
{
"from": "gpt",
"value": "Absolutely! It seems like you're looking for a variety of examples, best practices, and samples. I'll cover a few different areas: writing, project management, and genera... |
I understand that BigDecimal is recommended best practice for representing monetary values in Java. What do you use? Is there a better library that you prefer to use instead?
| In Java, `BigDecimal` is indeed the recommended way to represent monetary values because it provides control over precision and rounding, which is crucial for financial calculations. Here are some reasons why `BigDecimal` is preferred:
1. **Precision**: `BigDecimal` allows for arbitrary-precision numbers, which is ess... | 38,248 | [
{
"from": "human",
"value": "I understand that BigDecimal is recommended best practice for representing monetary values in Java. What do you use? Is there a better library that you prefer to use instead?\n"
},
{
"from": "gpt",
"value": "In Java, `BigDecimal` is indeed the recommended way to repr... |
I've tried downloading the Rails package and installing it on Windows, but have no idea to make it work.
I have had some experience with this commbination:
PHP 4.x + 5.x (Windows)
LIGHTTPD (Windows)
Connecting to a Firebird Database (Windows)
Can anybody enlighten me?
| Getting Ruby on Rails to work on Windows can be a bit tricky, especially if you're coming from a PHP background. Here’s a step-by-step guide to help you set up Ruby on Rails on a Windows environment:
### Step 1: Install Ruby
1. **Download RubyInstaller**: Go to the [RubyInstaller website](https://rubyinstaller.org/) ... | 36,554 | [
{
"from": "human",
"value": "I've tried downloading the Rails package and installing it on Windows, but have no idea to make it work.\nI have had some experience with this commbination:\n\nPHP 4.x + 5.x (Windows)\nLIGHTTPD (Windows)\nConnecting to a Firebird Database (Windows)\n\nCan anybody enlighten me?\n... |
An XML attribute declared as xs:boolean can acceptable be "true", "false", "0" or "1". However, in .NET, Boolean.Parse() will only accept "true" or "false". If it sees a "0" or "1", it throws a "Bad Format" exception.
So, given that, what's the best way to parse such a value into a Boolean?
(Unfortunately, I'm limited... | In .NET 2.0, since `Boolean.Parse()` only accepts "true" or "false", you can implement a simple parsing function that handles the additional cases of "0" and "1". This custom method will check the input string and convert it into a `bool` accordingly. Here's an example implementation:
```csharp
public static bool Pars... | 38,196 | [
{
"from": "human",
"value": "An XML attribute declared as xs:boolean can acceptable be \"true\", \"false\", \"0\" or \"1\". However, in .NET, Boolean.Parse() will only accept \"true\" or \"false\". If it sees a \"0\" or \"1\", it throws a \"Bad Format\" exception.\nSo, given that, what's the best way to pa... |
We have a Linux application that makes use of OpenSSL's Python bindings and I suspect it is causing random crashes. Occasionally, we see it crash with the message:
Python Fatal Error: GC Object already tracked
which would appear to be either a programming error on the part of the library, or a symptom of memory corr... | When dealing with a crash in a Python application that is utilizing C extensions (like OpenSSL's bindings), obtaining the last line of Python source code executed can be challenging, especially if the stack trace involves compiled bytecode. However, there are several strategies you can employ to get more information ab... | 35,944 | [
{
"from": "human",
"value": "We have a Linux application that makes use of OpenSSL's Python bindings and I suspect it is causing random crashes. Occasionally, we see it crash with the message: \n\nPython Fatal Error: GC Object already tracked\n\nwhich would appear to be either a programming error on the par... |
We have two branches:
1. HEAD - the latest version (AKA Trunc)
2. PROD - the released version
When you fix bugs in the released version, which of these do you do:
Fix it in PROD, then merge to HEAD
Fix it in HEAD, then merge to PROD
The advantage of (1) is that this way you absolutely cannot harm the released version... | Your reasoning for preferring the first approach—fixing bugs in the PROD branch and then merging those fixes back to the HEAD branch—makes a lot of sense, especially in a stable release management context. Here are some considerations for both approaches:
### Approach 1: Fix in PROD, then Merge to HEAD
**Advantages:**... | 36,358 | [
{
"from": "human",
"value": "We have two branches:\n1. HEAD - the latest version (AKA Trunc)\n2. PROD - the released version\nWhen you fix bugs in the released version, which of these do you do:\n\nFix it in PROD, then merge to HEAD\nFix it in HEAD, then merge to PROD\n\nThe advantage of (1) is that this wa... |
In C# which is more memory efficient: Option #1 or Option #2?
public void TestStringBuilder()
{
//potentially a collection with several hundred items:
string[] outputStrings = new string[] { "test1", "test2", "test3" };
//Option #1
StringBuilder formattedOutput = new StringBuilder();
foreach (strin... | To evaluate the memory efficiency of Option #1 and Option #2 in your C# code, let's analyze how the `StringBuilder` is being used in each option.
### Option #1
```csharp
StringBuilder formattedOutput = new StringBuilder();
foreach (string outputString in outputStrings)
{
formattedOutput.Append("prefix ");
form... | 34,245 | [
{
"from": "human",
"value": "In C# which is more memory efficient: Option #1 or Option #2?\npublic void TestStringBuilder()\n{\n //potentially a collection with several hundred items:\n string[] outputStrings = new string[] { \"test1\", \"test2\", \"test3\" };\n\n //Option #1\n StringBuilder for... |
I guess I'm really after an aid to help people who forget, Cruise Control sends out the details of commits to everyone, so people are keen to add a meaningful comment, but sometimes forget.
| It sounds like you're looking for a solution to help team members remember to include meaningful comments in their commit messages. Here are some ideas that could serve as an aid:
### 1. **Pre-Commit Hooks**
Implement a pre-commit hook in your version control system (like Git) that prompts the user for a meaningful... | 37,632 | [
{
"from": "human",
"value": "I guess I'm really after an aid to help people who forget, Cruise Control sends out the details of commits to everyone, so people are keen to add a meaningful comment, but sometimes forget.\n"
},
{
"from": "gpt",
"value": "It sounds like you're looking for a solution... |
I'm still getting used to the sizers in wxWidgets, and as such can't seem to make them do what I want.
I want a large panel that will contain a list of other panels/boxes, which each then contain a set of text fields
----------------------
| label text box |
| label2 text box2 |
----------------------
-----------... | You're on the right track with using sizers in wxWidgets, but there are a few adjustments that can help you achieve the desired behavior for your panel and dynamic item management. Let's break down your requirements step by step.
### Step 1: Creating a Scrollable Panel
To ensure that your dynamic list of items can be... | 29,198 | [
{
"from": "human",
"value": "I'm still getting used to the sizers in wxWidgets, and as such can't seem to make them do what I want.\nI want a large panel that will contain a list of other panels/boxes, which each then contain a set of text fields\n----------------------\n| label text box |\n| label2 t... |
If I have a windows xp computer with a single license (the one dell gave me), if I have 2-3 vm's setup (using vmware) for development purposes, do I have to have licenses for all of them?
| Yes, you would need separate licenses for each instance of Windows XP running in your virtual machines (VMs). The license you received from Dell typically allows you to use Windows XP on that specific physical machine only.
When you install Windows XP on a virtual machine, it is considered a separate installation and... | 40,539 | [
{
"from": "human",
"value": "If I have a windows xp computer with a single license (the one dell gave me), if I have 2-3 vm's setup (using vmware) for development purposes, do I have to have licenses for all of them?\n"
},
{
"from": "gpt",
"value": "Yes, you would need separate licenses for each... |
I just realized from an article in CACM that Doxygen works with Java (and several other languages) too. But Java has already the Javadoc tool. Can someone explain what are the pros and cons of either approach? Are they mutually exclusive? Is there a Maven plugin for Doxygen?
| Both Doxygen and Javadoc are documentation generation tools, but they have different features, advantages, and use cases. Here’s a comparison of the two, including their pros and cons:
### Doxygen
**Pros:**
1. **Multi-Language Support**: Doxygen supports a variety of programming languages, including C++, C, Java, Obj... | 37,243 | [
{
"from": "human",
"value": "I just realized from an article in CACM that Doxygen works with Java (and several other languages) too. But Java has already the Javadoc tool. Can someone explain what are the pros and cons of either approach? Are they mutually exclusive? Is there a Maven plugin for Doxygen?\n"
... |
How do you set the timeout for blocking operations on a Ruby socket?
| In Ruby, you can set a timeout for blocking operations on a socket by using the `Socket#recv_nonblock` method in conjunction with a timeout block. The `recv_nonblock` method allows you to attempt to read from the socket without blocking, and you can use Ruby's built-in timeout functionality to handle cases where the op... | 37,886 | [
{
"from": "human",
"value": "How do you set the timeout for blocking operations on a Ruby socket?\n"
},
{
"from": "gpt",
"value": "In Ruby, you can set a timeout for blocking operations on a socket by using the `Socket#recv_nonblock` method in conjunction with a timeout block. The `recv_nonblock... |
I need to test a function that needs to query a page on an external server using urllib.urlopen (it also uses urllib.urlencode). The server could be down, the page could change; I can't rely on it for a test.
What is the best way to control what urllib.urlopen returns?
| When writing tests that rely on external resources such as a web server, it's best to avoid actual network calls. Instead, you can use mocking to simulate the behavior of `urllib.urlopen` without making real network requests. The `unittest.mock` module in Python provides tools to help you do this.
Here's an example of... | 38,117 | [
{
"from": "human",
"value": "I need to test a function that needs to query a page on an external server using urllib.urlopen (it also uses urllib.urlencode). The server could be down, the page could change; I can't rely on it for a test.\nWhat is the best way to control what urllib.urlopen returns?\n"
},
... |
Exact duplicate of this question.
When you get an error in .Net application we got an a Stack Trace.
For example
[ADOException: cannot open connection]
NHibernate.Impl.SessionFactoryImpl.OpenConnection() +153
Hibernate.AdoNet.ConnectionManager.GetConnection() +119
NHibernate.Impl.SessionImpl.get_Connection() +4... | In a .NET application stack trace, the numbers that appear at the end of each line represent the following:
1. **Method Call (Class.Method)**: Each line starts with the method being called, in the format `Class.Method()`. This indicates which method is currently executing or has been executed in the call stack.
2. **... | 39,803 | [
{
"from": "human",
"value": "Exact duplicate of this question.\nWhen you get an error in .Net application we got an a Stack Trace.\nFor example\n [ADOException: cannot open connection]\n NHibernate.Impl.SessionFactoryImpl.OpenConnection() +153\n Hibernate.AdoNet.ConnectionManager.GetConnection() +119\n ... |
I need to write some methods for loading/saving some classes to and from a binary file. However I also want to be able to accept the binary data from other places, such as a binary string.
In c++ I could do this by simply making my class methods use std::istream and std::ostream which could be a file, a stringstream, t... | Yes, Python provides a versatile system for handling input and output that is somewhat similar to C++'s `std::istream` and `std::ostream`. You can utilize Python's built-in `io` module to work with streams of data, whether they come from files or in-memory objects such as strings.
In particular, you can use the `io.By... | 37,092 | [
{
"from": "human",
"value": "I need to write some methods for loading/saving some classes to and from a binary file. However I also want to be able to accept the binary data from other places, such as a binary string.\nIn c++ I could do this by simply making my class methods use std::istream and std::ostrea... |
A moebius strip is a surface with one side.
How would one define such an object in XAML/WPF?
How could such an object be manipulated in 3D, scaled up and down and rotated using C#?
| Creating a Möbius strip in XAML/WPF and manipulating it in 3D requires some understanding of 3D graphics in WPF. Below are the steps and code snippets to help you get started.
### Step 1: Define a Möbius Strip in XAML
First, you can use the `Model3D` and `GeometryModel3D` classes to define a Möbius strip. A Möbius st... | 13,637 | [
{
"from": "human",
"value": "A moebius strip is a surface with one side. \nHow would one define such an object in XAML/WPF?\nHow could such an object be manipulated in 3D, scaled up and down and rotated using C#? \n"
},
{
"from": "gpt",
"value": "Creating a Möbius strip in XAML/WPF and manipula... |
In either a Windows or Mac OS X terminal if you type...
nslookup -type=SRV _xmpp-server._tcp.gmail.com
... (for example) you will receive a bunch of SRV records relating to different google chat servers..
Does anyone have any experience in this area and possibly know how to service this information (hostname, port, we... | To retrieve and parse SRV records in an iOS application, you'll need to perform DNS queries programmatically. Unfortunately, there is no built-in API in the iPhone SDK that directly handles SRV record queries like `nslookup`. However, you can use third-party libraries or perform raw DNS queries to get SRV records.
###... | 31,040 | [
{
"from": "human",
"value": "In either a Windows or Mac OS X terminal if you type...\nnslookup -type=SRV _xmpp-server._tcp.gmail.com\n\n... (for example) you will receive a bunch of SRV records relating to different google chat servers..\nDoes anyone have any experience in this area and possibly know how to... |
I have a 5GB database and a 20GB transaction log (SQL Server 2005). Not sure why it is so large or what happened to make it that large, it used to be around 1/2 the size of the DB. DB grows about 1GB/month.
Are there any guidelines to how how big your transaction log should be relative to your database file size?
EDI... | The size of your transaction log relative to your database can vary widely depending on a number of factors, including your database workload, recovery model, and how you manage your backups. Here are some considerations and guidelines to help you understand and manage the size of your transaction log:
### Factors Aff... | 37,130 | [
{
"from": "human",
"value": "I have a 5GB database and a 20GB transaction log (SQL Server 2005). Not sure why it is so large or what happened to make it that large, it used to be around 1/2 the size of the DB. DB grows about 1GB/month. \nAre there any guidelines to how how big your transaction log should be... |
If you have a situation where you need to know where a boolean value wasn't set (for example if that unset value should inherit from a parent value) the Java boolean primitive (and the equivalent in other languages) is clearly not adequate.
What's the best practice to achieve this? Define a new simple class that is ca... | In situations where you need to represent a boolean value that can be in three distinct states (true, false, and unset/nil), using the Java `Boolean` class or defining a new class are both valid approaches, but each has its own advantages and disadvantages. Here's a breakdown to help you decide which method is best for... | 37,356 | [
{
"from": "human",
"value": "If you have a situation where you need to know where a boolean value wasn't set (for example if that unset value should inherit from a parent value) the Java boolean primitive (and the equivalent in other languages) is clearly not adequate.\nWhat's the best practice to achieve t... |
I would like to know if there is available any Java library to read a Microsoft Media Server (MMS) stream.
Thanks,
Douglas
| As of my last knowledge update in October 2023, there are a few Java libraries and frameworks that you might consider for handling streaming protocols, including MMS (Microsoft Media Server). However, MMS itself is not as widely supported as other streaming protocols (like HTTP Live Streaming or RTMP).
Here are some ... | 36,867 | [
{
"from": "human",
"value": "I would like to know if there is available any Java library to read a Microsoft Media Server (MMS) stream.\nThanks,\nDouglas\n"
},
{
"from": "gpt",
"value": "As of my last knowledge update in October 2023, there are a few Java libraries and frameworks that you might ... |
I create a DropDown with the Html.DropDownList(string NameSelectListInViewData) method.
This generates a valid Select input with the correct values. And all is well.
Upon submit however, the value in the source SelectList is not bound.
Case:
ViewData.SearchBag.FamilyCodes:
public SelectList FamilyCodes { get; set; }
... | The issue you're experiencing with the dropdown not binding correctly to the `SearchBag` model is likely due to the way the model binding works in ASP.NET MVC. When you create a dropdown using `Html.DropDownList`, it expects the name attribute of the select element to match the property name of the model exactly.
### ... | 36,963 | [
{
"from": "human",
"value": "I create a DropDown with the Html.DropDownList(string NameSelectListInViewData) method.\nThis generates a valid Select input with the correct values. And all is well.\nUpon submit however, the value in the source SelectList is not bound. \nCase:\nViewData.SearchBag.FamilyCodes:... |
Other than Visual Studio, what tool have you found best to create, edit, maintain, and possibly debug your XSLT files?
I work on a fairly big project and we have tons of XSLT files and they have grown quite complex in their implementation.
The language seems so brittle. It would be nice to navigate and identify errors ... | When working with complex XSLT files, it's essential to use tools that provide good editing, debugging, and maintenance features. Here are some popular tools that can enhance your experience with XSLT development beyond Visual Studio:
1. **Oxygen XML Editor**:
- A powerful and comprehensive XML editor that provides... | 36,971 | [
{
"from": "human",
"value": "Other than Visual Studio, what tool have you found best to create, edit, maintain, and possibly debug your XSLT files?\nI work on a fairly big project and we have tons of XSLT files and they have grown quite complex in their implementation.\nThe language seems so brittle. It wou... |
I have a Lotus Domino server with a truly astounding number of Domino databases on it, arranged in various folders.
Is there some means of exporting a list of all these databases, with their titles and creators' names, in a spreadsheet format of some kind? I have the Domino Admin and Domino Designer software, and I ha... | Yes, you can easily export a list of all databases on your Lotus Domino server, including their titles and creators' names, into a spreadsheet format. Below is a step-by-step guide on how to achieve this using LotusScript or by utilizing the Domino Administrator client.
### Method 1: Using LotusScript
1. **Open Lotus... | 33,236 | [
{
"from": "human",
"value": "I have a Lotus Domino server with a truly astounding number of Domino databases on it, arranged in various folders. \nIs there some means of exporting a list of all these databases, with their titles and creators' names, in a spreadsheet format of some kind? I have the Domino Ad... |
My application uses both NetTcpBinding and BasicHttpBinding but each of them will expose a subset of my service class. I have created the service as below.
The problem is that even though I just added 3 of my contracts to the Mex binding, all of the contracts are shown when I want to add the service to my project.
m_S... | The issue you're experiencing with the MEX endpoint exposing all of your service contracts instead of just the ones you want is likely related to how WCF (Windows Communication Foundation) works. By default, WCF's metadata exchange (MEX) endpoint will expose all contracts defined in the service host, regardless of whic... | 32,741 | [
{
"from": "human",
"value": "My application uses both NetTcpBinding and BasicHttpBinding but each of them will expose a subset of my service class. I have created the service as below. \nThe problem is that even though I just added 3 of my contracts to the Mex binding, all of the contracts are shown when I ... |
I have a CSS class called grid which I place on my tables. I want to Zebra strip my even rows so I use the following jQuery code
$(".grid tr:nth-child(even)").addClass("even");
This basically says "Apply the css class even to any tr tag which has a parent (at any level) with a class of grid." The problem with this is ... | To apply the `.even` class only to `<tr>` elements that are direct descendants of a table with the class `.grid`, while avoiding nested tables, you can modify your jQuery selector to use the `>` (child combinator) selector. This way, you specifically target only the `<tr>` elements that are direct children of the `<tab... | 40,229 | [
{
"from": "human",
"value": "I have a CSS class called grid which I place on my tables. I want to Zebra strip my even rows so I use the following jQuery code\n$(\".grid tr:nth-child(even)\").addClass(\"even\");\n\nThis basically says \"Apply the css class even to any tr tag which has a parent (at any level)... |
How would you handle cross database queries in different environments. For example, db1-development and db2-development, db1-production and db2-production.
If I want to do a cross-database query in development from db2 to db1 I could use the fully qualified name, [db1-development].[schema].[table]. But how do I main... | Handling cross-database queries across different environments while ensuring maintainability and consistency can be challenging, especially when the database names differ between environments. Here are several strategies you can consider to address this challenge in SQL Server 2005:
### 1. Use Synonyms
You can create... | 37,253 | [
{
"from": "human",
"value": "How would you handle cross database queries in different environments. For example, db1-development and db2-development, db1-production and db2-production. \nIf I want to do a cross-database query in development from db2 to db1 I could use the fully qualified name, [db1-develop... |
Say I have two lists:
var list1 = new int[] {1, 2, 3};
var list2 = new string[] {"a", "b", "c"};
Is it possible to write a LINQ statement that will generate the following list:
var result = new []{
new {i = 1, s = "a"},
new {i = 1, s = "b"},
new {i = 1, s = "c"},
new {i = 2, s = "a"},
new {i = 2, ... | Yes, you can achieve this using LINQ's `SelectMany` method, which is perfect for this scenario where you want to create a Cartesian product of the two lists. Your current approach is on the right track. Here’s the complete code snippet that generates the desired output:
```csharp
var list1 = new int[] { 1, 2, 3 };
var... | 39,276 | [
{
"from": "human",
"value": "Say I have two lists:\nvar list1 = new int[] {1, 2, 3};\nvar list2 = new string[] {\"a\", \"b\", \"c\"};\n\nIs it possible to write a LINQ statement that will generate the following list:\nvar result = new []{ \n new {i = 1, s = \"a\"},\n new {i = 1, s = \"b\"},\n new {... |
I would like to add a method to a built-in type (e.g. Double), so that I can use an infix operator. Is that possible?
| In Swift, you cannot directly add methods to built-in types (like `Double`) or change their behavior, as these types are part of the standard library. However, you can achieve a similar effect by creating a custom extension that defines an infix operator.
Here's a step-by-step guide on how to do this:
1. **Define a n... | 39,106 | [
{
"from": "human",
"value": "I would like to add a method to a built-in type (e.g. Double), so that I can use an infix operator. Is that possible?\n"
},
{
"from": "gpt",
"value": "In Swift, you cannot directly add methods to built-in types (like `Double`) or change their behavior, as these types... |
I am using Borland Builder C++ 2009. I want to add a button to a form that allows the user to open a file in Excel that I specify. I can't think of how to do this. I know how to link with other code and executables -- is there a Microsoft Excel executable that I could use? How could I specify the file then? Any hints o... | To open a specific Excel file using Borland C++ Builder 2009, you can use the `ShellExecute` function from the Windows API. This function allows you to launch an executable with specific parameters—in your case, the executable is Excel, and the parameters will be the path to the file you want to open.
Here’s how you c... | 36,448 | [
{
"from": "human",
"value": "I am using Borland Builder C++ 2009. I want to add a button to a form that allows the user to open a file in Excel that I specify. I can't think of how to do this. I know how to link with other code and executables -- is there a Microsoft Excel executable that I could use? How c... |
I would like to generate documentation for a RESTful web service API that is written in Python. Ideally it would look like Yahoo's RESTful web service docs. Does anyone have any ideas or references?
| Creating documentation for a RESTful web service API is crucial for both usability and maintainability. To achieve documentation similar to Yahoo's RESTful web service docs, consider the following steps and tools:
### Steps to Create API Documentation
1. **Define Your API Endpoints**:
- List all the endpoints of y... | 34,596 | [
{
"from": "human",
"value": "I would like to generate documentation for a RESTful web service API that is written in Python. Ideally it would look like Yahoo's RESTful web service docs. Does anyone have any ideas or references?\n"
},
{
"from": "gpt",
"value": "Creating documentation for a RESTfu... |
Is it possible in plain JPA or JPA+Hibernate extensions to declare a composite key, where an element of the composite key is a sequence?
This is my composite class:
@Embeddable
public class IntegrationEJBPk implements Serializable {
//...
@ManyToOne(cascade = {}, fetch = FetchType.EAGER)
@JoinColumn(name... | In JPA and Hibernate, it's generally not possible to directly use `@GeneratedValue` for a property that is part of an `@Embeddable` composite key, as the `@GeneratedValue` strategy is typically intended for primary key fields of entities, not for fields that are part of a composite key. The reason is that the values fo... | 37,392 | [
{
"from": "human",
"value": "Is it possible in plain JPA or JPA+Hibernate extensions to declare a composite key, where an element of the composite key is a sequence?\nThis is my composite class:\n@Embeddable\npublic class IntegrationEJBPk implements Serializable {\n\n //...\n\n\n @ManyToOne(cascade = ... |
I have a windows service connecting to a SqlServer database on the local box. This works fine most all the time. At a large customer, however, the database connectivity gets corrupted for some rare and unknown reason. When this happens, calls to DbDataAdapter.Fill return a DataSet with a different number of columns ... | The issue you're encountering where `DbDataAdapter.Fill` returns a `DataSet` with an unexpected number of columns is indeed perplexing and can be caused by a variety of factors. Here are some potential causes and solutions you can explore to troubleshoot and resolve the problem:
1. **Connection Pooling Issues**:
-... | 34,164 | [
{
"from": "human",
"value": "I have a windows service connecting to a SqlServer database on the local box. This works fine most all the time. At a large customer, however, the database connectivity gets corrupted for some rare and unknown reason. When this happens, calls to DbDataAdapter.Fill return a Da... |
I'm regularly creating an XSD schema by transforming a proprietary data model of a legacy system. This works out pretty good. However, the legacy system only allows me to specify very basic attributes of a parameter, such as the data type (int, string etc.).
I would like to enhance the XSL transformation with a mechani... | Yes, it is definitely possible to include metadata in your XSLT transformation to enhance the output schema. You can achieve this by utilizing a structured way of incorporating metadata in a separate XML file or by embedding it within your existing data model. Below, I'll explain how you can do this using a separate me... | 33,244 | [
{
"from": "human",
"value": "I'm regularly creating an XSD schema by transforming a proprietary data model of a legacy system. This works out pretty good. However, the legacy system only allows me to specify very basic attributes of a parameter, such as the data type (int, string etc.).\nI would like to enh... |
Why use a GlobalClass? What are they for? I have inherited some code (shown below) and as far as I can see there is no reason why strUserName needs this. What is all for?
public static string strUserName
{
get { return m_globalVar; }
set { m_globalVar = value; }
}
Used later as:
GlobalClass.str... | In the context of the code you've provided, `GlobalClass` seems to be a class that is designed to hold global state or global variables, in this case, a single string variable called `strUserName`. Let's break down the reasons for using such a construct and the potential motivations behind it.
### Reasons for Using a ... | 36,952 | [
{
"from": "human",
"value": "Why use a GlobalClass? What are they for? I have inherited some code (shown below) and as far as I can see there is no reason why strUserName needs this. What is all for?\npublic static string strUserName\n {\n get { return m_globalVar; }\n set { m_globalVar = v... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.