instruction stringlengths 14 27.6k | completion stringlengths 3 38.3k | __original_row_idx int64 0 50k | conversations listlengths 2 2 |
|---|---|---|---|
Our logging class, when initialised, truncates the log file to 500,000 bytes. From then on, log statements are appended to the file.
We do this to keep disk usage low, we're a commodity end-user product.
Obviously keeping the first 500,000 bytes is not useful, so we keep the last 500,000 bytes.
Our solution has some se... | Truncating a log file to keep only the last 500,000 bytes can lead to performance issues, particularly if you're doing it inefficiently. Here are some suggestions for how to implement this efficiently:
### 1. **Use a Circular Buffer in Memory**
Instead of manipulating the log file directly each time a log statement is... | 49,363 | [
{
"from": "human",
"value": "Our logging class, when initialised, truncates the log file to 500,000 bytes. From then on, log statements are appended to the file.\nWe do this to keep disk usage low, we're a commodity end-user product.\nObviously keeping the first 500,000 bytes is not useful, so we keep the l... |
So for viewing a current object's state at runtime, I really like what the Visual Studio Immediate window gives me. Just doing a simple
? objectname
Will give me a nicely formatted 'dump' of the object.
Is there an easy way to do this in code, so I can do something similar when logging?
| Yes, you can achieve similar object inspection functionality in your logging by leveraging the .NET framework's built-in capabilities or by using libraries that provide reflection and serialization functionalities. Here are a few approaches you can consider:
### 1. Using `JsonSerializer`
If you want to log the state ... | 44,716 | [
{
"from": "human",
"value": "So for viewing a current object's state at runtime, I really like what the Visual Studio Immediate window gives me. Just doing a simple\n? objectname\n\nWill give me a nicely formatted 'dump' of the object. \nIs there an easy way to do this in code, so I can do something simil... |
What's a good way to serialize a Delphi object tree to XML--using RTTI and not custom code?
I would have loved to find that this feature is already built into Delphi, but it doesn't seem to be.
I've found a few components (posted, below) that seem like they might perform this function. Have you used any of them or som... | In Delphi, serializing objects to XML using RTTI (Run-Time Type Information) is not directly built into the language, but there are several libraries and components that can help with this. Here are some options you might consider:
### 1. **XMLDoc and RTTI**
You can use the built-in `XMLDoc` unit to create XML structu... | 45,806 | [
{
"from": "human",
"value": "What's a good way to serialize a Delphi object tree to XML--using RTTI and not custom code?\nI would have loved to find that this feature is already built into Delphi, but it doesn't seem to be.\nI've found a few components (posted, below) that seem like they might perform this ... |
Is there a control like System.Windows.Controls.GroupBox that can hide its contents and show only the name and an expander button?
| Yes, you can create a custom control in WPF that behaves similarly to a `GroupBox` but with the added functionality of hiding its contents while displaying only the title and an expander button.
You can achieve this by using a `ToggleButton` along with a `ContentPresenter` to display the content of the control. Here's... | 38,816 | [
{
"from": "human",
"value": "Is there a control like System.Windows.Controls.GroupBox that can hide its contents and show only the name and an expander button?\n"
},
{
"from": "gpt",
"value": "Yes, you can create a custom control in WPF that behaves similarly to a `GroupBox` but with the added f... |
Hi I'm using System.Net.Mail to send some HTML formatted emails.
What is the correct method for inserting css into the email message?
I know I can apply formatting to each item, but I'ld rather use style sheets..
EDIT
I should have mentioned that this is for an internal application, and I expect 99% of users to be usin... | When sending HTML formatted emails using `System.Net.Mail` in .NET, including CSS styles can be a bit tricky because many email clients, especially Outlook, have limited support for CSS stylesheets. For internal applications where most users are on Outlook or similar clients, it's generally recommended to use inline CS... | 46,533 | [
{
"from": "human",
"value": "Hi I'm using System.Net.Mail to send some HTML formatted emails.\nWhat is the correct method for inserting css into the email message?\nI know I can apply formatting to each item, but I'ld rather use style sheets..\nEDIT\nI should have mentioned that this is for an internal appl... |
I have project solutions developed in VS2005. It is bound to TFS (Team Foundation Server). I want to convert the solution to VS2008 version, keeping the binding as is, however I am getting an error while converting.
Error message:
Solution file "C:\abc\abc.sln" cannot be converted because it cannot be modified. To co... | The error message you are encountering indicates that the Visual Studio solution file (`abc.sln`) cannot be modified due to insufficient file permissions. To resolve this issue, you need to ensure that your user account has the appropriate permissions to modify the file. Here’s how you can check and change the file per... | 48,355 | [
{
"from": "human",
"value": "I have project solutions developed in VS2005. It is bound to TFS (Team Foundation Server). I want to convert the solution to VS2008 version, keeping the binding as is, however I am getting an error while converting.\nError message: \n\nSolution file \"C:\\abc\\abc.sln\" cannot b... |
How do you associate a -mouseUp: event with the -add: method of a NSArrayController? The -mouseUp: event lives in a different object but is #import'ed and instantiated in the object that holds the array being controlled.
Usually, with an NSButton you command-drag from the button to the NSArrayController's -add: method... | No worries! It sounds like you're working through some of the nuances of Cocoa and Objective-C, especially concerning the Model-View-Controller (MVC) paradigm and how to handle events.
Let’s clarify how you can connect your `-mouseUp:` event from your `Canvas` object to the `-add:` method of your `NSArrayController`. ... | 46,332 | [
{
"from": "human",
"value": "How do you associate a -mouseUp: event with the -add: method of a NSArrayController? The -mouseUp: event lives in a different object but is #import'ed and instantiated in the object that holds the array being controlled.\nUsually, with an NSButton you command-drag from the butt... |
I'm new to this JSF world, please bear with me if I'm asking some silly thing
i'm using UI tags for my application and I have a scenario that I need to generate a calendar control to make the user to select the date I followed the ui tags documentation and wrote the code like this:
<table width="100%">
<tr>
<... | It looks like you're trying to implement a calendar control using UI tags in JSF, but you're encountering some issues with how the calendar component is rendered on your page. Here are some steps to troubleshoot and correct the issue.
### 1. Check Dependencies
First, ensure that you have included the necessary librari... | 49,748 | [
{
"from": "human",
"value": "I'm new to this JSF world, please bear with me if I'm asking some silly thing\ni'm using UI tags for my application and I have a scenario that I need to generate a calendar control to make the user to select the date I followed the ui tags documentation and wrote the code like t... |
If i SELECT a row for updating in MS SQL Server, and want to have it locked till i either update or cancel, which option is better :-
1) Use a query hint like UPDLOCK
2) Use REPEATABLE READ isolation level for the transaction
3) any other option.
Thanks,
Chak.
| To ensure that a row is locked until you either update or cancel the operation in SQL Server, both options you mentioned are valid, but they serve slightly different purposes and have different implications. Let's examine both options:
### 1. Using `UPDLOCK` Hint
The `UPDLOCK` hint can be used to acquire an update loc... | 48,523 | [
{
"from": "human",
"value": "If i SELECT a row for updating in MS SQL Server, and want to have it locked till i either update or cancel, which option is better :-\n1) Use a query hint like UPDLOCK \n2) Use REPEATABLE READ isolation level for the transaction\n3) any other option.\nThanks,\nChak.\n"
},
{
... |
I have a new ASP.NET MVC project (my first), and I had been running fine with 1 controller, view, and model. After I added a new controller and view, my first view started throwing this error message when I try to run the project:
Description: An error occurred during the parsing of a resource required to service this ... | It looks like your ASP.NET MVC project has a mix of Web Forms and MVC views, which can lead to confusion. The error message indicates that your ASPX page is trying to inherit from `System.Web.UI.Page`, which is a typical behavior in ASP.NET Web Forms applications.
Here are some steps you can take to troubleshoot and f... | 47,539 | [
{
"from": "human",
"value": "I have a new ASP.NET MVC project (my first), and I had been running fine with 1 controller, view, and model. After I added a new controller and view, my first view started throwing this error message when I try to run the project:\nDescription: An error occurred during the parsi... |
I'm a bit stuck here, I have a .net 3.5 sp1 application that I want to deploy locally to other machines on my network using ClickOnce.
On installation they get a warning message saying that this application is from an unknown publisher etc.
My boss does not want to buy a verisgn certificate. He just want's it to instal... | Yes, there are ways to configure your ClickOnce deployment to reduce or eliminate security prompts, but it's important to note that completely bypassing security warnings is not recommended due to security risks. However, if you are deploying an internal application and understand the risks, here are some options you c... | 46,553 | [
{
"from": "human",
"value": "I'm a bit stuck here, I have a .net 3.5 sp1 application that I want to deploy locally to other machines on my network using ClickOnce.\nOn installation they get a warning message saying that this application is from an unknown publisher etc.\nMy boss does not want to buy a veris... |
I'm creating an Interface Builder plugin for an NSView subclass. I've been following the Interface Builder Plug-in Programming Guide but it's not answer all my questions. My class has one NSString property and 4 NSColor properties which I want to create bindings for at design time.
I can't figure out where the bindings... | To specify bindings for your custom NSView subclass in an Interface Builder plugin, you'll need to work with the `.classdescription` file and the relevant properties of your class. While it's true that the bindings are not explicitly defined in the `.classdescription` file, you can enable binding support through the at... | 47,647 | [
{
"from": "human",
"value": "I'm creating an Interface Builder plugin for an NSView subclass. I've been following the Interface Builder Plug-in Programming Guide but it's not answer all my questions. My class has one NSString property and 4 NSColor properties which I want to create bindings for at design ti... |
I'm a beginner with SQL and am working on one of my first databases. I am trying to create a very cut-down shopping cart and am currently working on getting the database together before I start coding the site.
One of the things I am struggling with is how to structure the products portion of the database. If all my pr... | Designing a database to accommodate both individual products and product packages is a common challenge when setting up a shopping cart system. Fortunately, there are best practices that can help you create a flexible and efficient schema for your products. Here’s a common approach to structuring your database tables:
... | 47,961 | [
{
"from": "human",
"value": "I'm a beginner with SQL and am working on one of my first databases. I am trying to create a very cut-down shopping cart and am currently working on getting the database together before I start coding the site.\nOne of the things I am struggling with is how to structure the prod... |
I need to build full-text search functionality into our knowledge base system using C#. How do I start?
| Building a full-text search functionality into a knowledge base system using C# can be an exciting and rewarding project. Below, you'll find a step-by-step guide to help you get started.
### Step 1: Define Your Requirements
Before you start coding, you should clearly define what you want your full-text search to acco... | 44,295 | [
{
"from": "human",
"value": "I need to build full-text search functionality into our knowledge base system using C#. How do I start? \n"
},
{
"from": "gpt",
"value": "Building a full-text search functionality into a knowledge base system using C# can be an exciting and rewarding project. Below,... |
I tried to make a dynamic 2D array of char as follow:
char** ppMapData = (char**)malloc(sizeof(char*)*iMapHeight);
for (int i=0; i< iMapHeight; i++)
{
ppMapData[i] = (char*)malloc(sizeof(char)*iMapWidth);
//do something
}
// do something
for (int i=0; i<iMapHeight; i++)
free(ppMapData[i]);
free(ppMapData)... | The code you've provided appears to be correctly allocating and freeing a dynamic 2D array of `char`. However, there are a few potential issues that could lead to a crash at runtime. Here are some common pitfalls to check:
1. **Memory Allocation Failure**: Always check if the memory allocation succeeded. If `malloc` f... | 49,605 | [
{
"from": "human",
"value": "I tried to make a dynamic 2D array of char as follow:\nchar** ppMapData = (char**)malloc(sizeof(char*)*iMapHeight);\nfor (int i=0; i< iMapHeight; i++)\n{\n ppMapData[i] = (char*)malloc(sizeof(char)*iMapWidth);\n //do something\n}\n\n// do something\n\nfor (int i=0; i<iMapH... |
I am using a program that talks to my COMM port, but I have made another program that I want to "sniff" the comm port messages and perform it's own actions against those messages in addition. Is this possible in .NET c#?
| Yes, it is possible to "sniff" or monitor the communications on a COM port in .NET C#. However, directly intercepting communications from another application that is using the same COM port is not straightforward due to the way serial communication works—once a port is opened by an application, other applications canno... | 47,404 | [
{
"from": "human",
"value": "I am using a program that talks to my COMM port, but I have made another program that I want to \"sniff\" the comm port messages and perform it's own actions against those messages in addition. Is this possible in .NET c#?\n"
},
{
"from": "gpt",
"value": "Yes, it is... |
I'm working on a large scale performance critical asp web application with a pretty much denormalized database (lots of data is duplicated across tables for performance reasons). The application is highly performance critical and large. There is almost no sense of any kind of n-tiered design. I can't touch the database... | You're definitely on the right track by considering the repository pattern and LinqToSql for your project. Here are some insights and recommendations to help you navigate your current situation:
### 1. Repository Pattern
- **Purpose**: The repository pattern is a great way to abstract your data access layer, which imp... | 48,660 | [
{
"from": "human",
"value": "I'm working on a large scale performance critical asp web application with a pretty much denormalized database (lots of data is duplicated across tables for performance reasons). The application is highly performance critical and large. There is almost no sense of any kind of n-... |
I am trying to port some data over from my production database to my sandbox using a query like this:
INSERT `dbsandbox`.`SomeTable`(Field1, Field2, Field3)
SELECT t.Field1, t.Field2, t.Field3
FROM `dbprod`.`SomeTable` t;
When I attempt this cross-database join I get the following error:
ERROR 1142 (42000): SELECT com... | The error you're encountering indicates that your MySQL user does not have the necessary permissions to execute the `SELECT` command on the `SomeTable` in the `dbprod` database. Even if you have permissions for `dbsandbox`, the user must also have explicit permissions for `dbprod`.
Here are some steps you can take to ... | 49,756 | [
{
"from": "human",
"value": "I am trying to port some data over from my production database to my sandbox using a query like this:\nINSERT `dbsandbox`.`SomeTable`(Field1, Field2, Field3)\nSELECT t.Field1, t.Field2, t.Field3\nFROM `dbprod`.`SomeTable` t;\n\nWhen I attempt this cross-database join I get the f... |
Has anyone an idea how the type inference problem
E > hd (cons 1 nil) : α0
with the typing environment
E={
hd : list(α1 ) → α1 ,
cons : α2 → list(α2 ) → list(α2 ),
nil : list(α3 ),
1 : int
}
can be transferred... | To transfer the type inference problem into a unification problem, we need to analyze the expression `hd (cons 1 nil)` and determine its type given the typing environment \( E \).
### Step 1: Analyze the expression `hd (cons 1 nil)`
1. **Inside the expression `cons 1 nil`:**
- According to the typing environment:
... | 46,662 | [
{
"from": "human",
"value": "Has anyone an idea how the type inference problem \nE > hd (cons 1 nil) : α0\n\nwith the typing environment\n E={\n hd : list(α1 ) → α1 ,\n cons : α2 → list(α2 ) → list(α2 ),\n nil : list(α3 ),\n ... |
We are working with some new Cutting Tools that can have it's hardware parameters altered through the serial port instead of just a control panel.
When the hardware parameters are altered the hardware will take a few seconds to reconfigure itself and then signal that it is ready to be used.
Our setup before this invol... | To enhance the responsiveness of your application when working with hardware through serial ports in a Win32 or .NET environment, here are some strategies you can implement:
### 1. Asynchronous Communication
Using asynchronous communication with the serial port can help prevent blocking the main UI thread.
- **.NET:*... | 47,898 | [
{
"from": "human",
"value": "We are working with some new Cutting Tools that can have it's hardware parameters altered through the serial port instead of just a control panel. \nWhen the hardware parameters are altered the hardware will take a few seconds to reconfigure itself and then signal that it is rea... |
My application is receiving email through SMTP server. There are one or more attachments in the email and email attachment return as byte[] (using sun javamail api).
I am trying to zip the attachment files on the fly without writing them to disk first.
What is/are possible way to achieve this outcome?
| You can zip the email attachments on the fly without writing them to disk by using Java's `ByteArrayOutputStream` in conjunction with `java.util.zip.ZipOutputStream`. Below is a step-by-step example of how to achieve this:
1. **Read the attachments**: Assuming you already have the attachments in `byte[]` format.
2. *... | 45,824 | [
{
"from": "human",
"value": "My application is receiving email through SMTP server. There are one or more attachments in the email and email attachment return as byte[] (using sun javamail api).\nI am trying to zip the attachment files on the fly without writing them to disk first.\nWhat is/are possible way... |
We have a custom section in my app.config file related to our IoC container class. How can I get intellisense when editing the config file for this section, as well as getting rid of the compiler messages informing me of the missing schema.
I found this question here: app.config configSections custom settings can not f... | To enable IntelliSense for a custom configuration section in your `app.config` file in Visual Studio, you need to create an XML schema file (XSD) for your custom section and reference that schema in your configuration file. This will help Visual Studio recognize your custom XML elements and attributes and provide Intel... | 49,643 | [
{
"from": "human",
"value": "We have a custom section in my app.config file related to our IoC container class. How can I get intellisense when editing the config file for this section, as well as getting rid of the compiler messages informing me of the missing schema.\nI found this question here: app.confi... |
In C# if I want to create a "Custom Event" you do something like this:
private EventHandler _MyEvent;
Public Event EventHandler MyEvent
{
add{ _MyEvent += value; }
remove{ _MyEvent -= Value; }
}
protected void RaiseMyEvent()
{
if(_MyEvent != nul)
_MyEvent(this, EventArgs.Empty);
}
In VB this is not so ... | Creating a custom event in VB.NET is slightly different than in C#, but it can definitely be done. The typical pattern for defining events in VB.NET involves using the `Event` keyword along with `AddHandler` and `RemoveHandler`. However, the way to store the event handlers can be different as well.
Here’s a working e... | 49,635 | [
{
"from": "human",
"value": "In C# if I want to create a \"Custom Event\" you do something like this:\nprivate EventHandler _MyEvent;\nPublic Event EventHandler MyEvent \n{\n add{ _MyEvent += value; }\n remove{ _MyEvent -= Value; }\n}\nprotected void RaiseMyEvent()\n{\n if(_MyEvent != nul)\n _MyE... |
Assume you have some objects which have several fields they can be compared by:
public class Person {
private String firstName;
private String lastName;
private String age;
/* Constructors */
/* Methods */
}
So in this example, when you ask if:
a.compareTo(b) > 0
you might be asking if a's las... | To enable multiple comparison criteria in a clean and efficient way, you can leverage the Strategy design pattern along with Java's `Comparator` interface. This allows you to define different comparison strategies without cluttering your `Person` class with multiple compare methods. Here's how you can implement this:
... | 47,102 | [
{
"from": "human",
"value": "Assume you have some objects which have several fields they can be compared by:\npublic class Person {\n\n private String firstName;\n private String lastName;\n private String age;\n\n /* Constructors */\n\n /* Methods */\n\n}\n\nSo in this example, when you ask ... |
I'm an old (but not too old) Java programmer, that decided to learn C++. But I have seen that much of C++ programming style, is... well, just damn ugly!
All that stuff of putting the class definition in a header file, and the methods in a different source file- Calling functions out of nowhere, instead of using methods... | It's great to hear that you're diving into C++ from a Java background! Your concerns about C++ programming styles, especially the use of header and source files, are common among those transitioning from Java, where the syntax and structure might seem more straightforward. However, there are several reasons for the con... | 46,218 | [
{
"from": "human",
"value": "I'm an old (but not too old) Java programmer, that decided to learn C++. But I have seen that much of C++ programming style, is... well, just damn ugly!\nAll that stuff of putting the class definition in a header file, and the methods in a different source file- Calling function... |
How do I ping a website or IP address with Python?
| Pinging a website or IP address in Python can be accomplished using several methods. One common approach is to use the `subprocess` module to call the system's ping command. Alternatively, you can use libraries such as `ping3` or `scapy`. Below are examples of both methods:
### Method 1: Using `subprocess`
This metho... | 49,817 | [
{
"from": "human",
"value": "How do I ping a website or IP address with Python?\n"
},
{
"from": "gpt",
"value": "Pinging a website or IP address in Python can be accomplished using several methods. One common approach is to use the `subprocess` module to call the system's ping command. Alternati... |
If you started a new Java EE project today which is to be finished in about a year, which application server would you choose and why?
Part of your answer should include your arguments for your decision. And also how much experience you have with the Java EE server you choose and with the other available servers on the... | If I were to start a new Java EE project today with a timeline of about a year, I would choose **Payara Server** as the application server. My choice would be based on several factors, including stability, community support, features, and ease of use.
### Reasons for Choosing Payara Server:
1. **Compatibility and Sta... | 47,709 | [
{
"from": "human",
"value": "If you started a new Java EE project today which is to be finished in about a year, which application server would you choose and why?\nPart of your answer should include your arguments for your decision. And also how much experience you have with the Java EE server you choose a... |
I have a requirement of creating an Image slider using Silverlight. I need to display 5 images at first. There will be two buttons previous and next. When I'll click the next button another new 5 images will be shown in place of previously diplayed images. Would it be possible for anyone to tell me the solution for thi... | Creating an image slider in Silverlight with the specifications you've mentioned can be done by using a `ListBox` or `ItemsControl` for displaying the images and buttons for navigation. Below is a simple example of how to create an image slider that shows 5 images at a time and allows you to navigate through them with ... | 41,447 | [
{
"from": "human",
"value": "I have a requirement of creating an Image slider using Silverlight. I need to display 5 images at first. There will be two buttons previous and next. When I'll click the next button another new 5 images will be shown in place of previously diplayed images. Would it be possible f... |
I have an application that runs transactions spanning over multiple databases on the same server. Naturally this involves the Microsoft Distributed Transaction Coordinator and everything works like it is supposed to.
Howver, when I remotely connect to the network where the server is hosted via VPN and run the applicati... | The issue you are experiencing with Microsoft Distributed Transaction Coordinator (MSDTC) while using a VPN connection is not uncommon. Here are several potential causes and solutions that you can consider:
### Potential Issues and Solutions
1. **MSDTC Configuration**:
- Ensure that MSDTC is configured correctly o... | 47,969 | [
{
"from": "human",
"value": "I have an application that runs transactions spanning over multiple databases on the same server. Naturally this involves the Microsoft Distributed Transaction Coordinator and everything works like it is supposed to.\nHowver, when I remotely connect to the network where the serv... |
Let's say I have the following function:
sumAll :: [(Int,Int)] -> Int
sumAll xs = foldr (+) 0 (map f xs)
where f (x,y) = x+y
The result of sumAll [(1,1),(2,2),(3,3)] will be 12.
What I don't understand is where the (x,y) values are coming from. Well, I know they come from the xs variable but I don't understand how. ... | Let's break down your function and clarify how the components interact.
The function `sumAll` takes a list of tuples `[(Int, Int)]`, where each tuple contains two integers. It sums the values in these tuples by first mapping a function over the list and then folding the results.
### Explanation of the Code
Here is y... | 48,242 | [
{
"from": "human",
"value": "Let's say I have the following function:\nsumAll :: [(Int,Int)] -> Int\nsumAll xs = foldr (+) 0 (map f xs)\n where f (x,y) = x+y\n\nThe result of sumAll [(1,1),(2,2),(3,3)] will be 12.\nWhat I don't understand is where the (x,y) values are coming from. Well, I know they come fr... |
I usually use IIS in conjunction with the OutSystems development platform, which does code-generation for web applications.
As it does the compiling and deployment of the applications to IIS, I end up knowing very little on how it really works, and sometimes it is very useful.
Thanks
| It's great that you're using OutSystems in conjunction with IIS for your web applications. Understanding how IIS and OutSystems work together can certainly enhance your ability to troubleshoot, optimize performance, and maintain your applications. Here’s an overview of both technologies and how they interact:
### IIS ... | 44,306 | [
{
"from": "human",
"value": "I usually use IIS in conjunction with the OutSystems development platform, which does code-generation for web applications.\nAs it does the compiling and deployment of the applications to IIS, I end up knowing very little on how it really works, and sometimes it is very useful.\... |
How to truncate and shrink large log files in SQL Server 2005? How to apply truncation at regular intervals?
Is there any difference between truncation and shrinking?
Thanks in advance
| In SQL Server, log files are essential for maintaining data integrity and recovery. However, they can grow large, especially for databases with a high volume of transactions. Here’s how to truncate and shrink large log files in SQL Server 2005, along with an explanation of truncation and shrinking.
### Understanding T... | 49,214 | [
{
"from": "human",
"value": "How to truncate and shrink large log files in SQL Server 2005? How to apply truncation at regular intervals?\nIs there any difference between truncation and shrinking?\nThanks in advance\n"
},
{
"from": "gpt",
"value": "In SQL Server, log files are essential for main... |
I have a site built with MVC Preview 2 and have not got around to upgrading to latest release, mainly because of the number of changes required and I have not had time. Anyway, last night my host installed .NET 3.5 sp1 and it killed my site. It is an identified problem (thats what you get for using pre betas) on this s... | The issue you're encountering with your MVC Preview 2 site after the installation of .NET 3.5 SP1 is known, and it stems from compatibility issues between pre-release versions of ASP.NET MVC and the final release versions of the .NET Framework.
While the specific workaround from the ASP.NET site may no longer be avail... | 46,379 | [
{
"from": "human",
"value": "I have a site built with MVC Preview 2 and have not got around to upgrading to latest release, mainly because of the number of changes required and I have not had time. Anyway, last night my host installed .NET 3.5 sp1 and it killed my site. It is an identified problem (thats wh... |
Does anyone know, or have a link to an article or a step by step tutorial, that would tell me how to distribute a .net MONO application with a minimum install? The full package of Mono is like 75 MB but I know al lot of that is the compiler and libraries that I don't need.
I just want the minimum runtime files.
What fi... | To distribute a .NET application built with Mono while keeping the installation as minimal as possible, you can follow these steps. This guide assumes you're working with a WinForms application and you're targeting the Mono runtime on Windows. Here’s a simplified process to create a self-contained deployment for your "... | 46,004 | [
{
"from": "human",
"value": "Does anyone know, or have a link to an article or a step by step tutorial, that would tell me how to distribute a .net MONO application with a minimum install? The full package of Mono is like 75 MB but I know al lot of that is the compiler and libraries that I don't need.\nI ju... |
I currently have issues in Webkit(Safari and Chrome) were I try to load dynamically (innerHTML) some html into a div, the html contains css rules (...), after the html gets rendered the style definitions are not loaded (so visually I can tell the styles are not there and also if I search with javascript for them no sty... | When dealing with dynamically added HTML and CSS in WebKit (Safari and Chrome), it's important to ensure that the styles are properly applied after you modify the DOM. Here are some strategies you can use to ensure that the styles are applied correctly:
### 1. **Use a Style Tag with InnerHTML**:
Instead of relying sol... | 45,713 | [
{
"from": "human",
"value": "I currently have issues in Webkit(Safari and Chrome) were I try to load dynamically (innerHTML) some html into a div, the html contains css rules (...), after the html gets rendered the style definitions are not loaded (so visually I can tell the styles are not there and also if... |
I have a number of icons used throughout an application - let's take ok/cancel icons as an example. At the moment they might be a tick and a cross (tick.png, cross.png) but I may want to replace them in future. Also, I would like to keep the resource path in one place.
Is this ok:
public class Icons {
public static... | Your approach to managing icons in your application is quite reasonable. By encapsulating the icon paths and creation logic in a single `Icons` class, you make it easier to maintain and potentially update the resources in the future. Here are a few points regarding your implementation:
1. **Final Constants**: Making t... | 46,743 | [
{
"from": "human",
"value": "I have a number of icons used throughout an application - let's take ok/cancel icons as an example. At the moment they might be a tick and a cross (tick.png, cross.png) but I may want to replace them in future. Also, I would like to keep the resource path in one place.\nIs this ... |
I have a C++ application that uses the Win32 API for Windows, and I'm having a problem with GDI+ dithering, when I don't know why it should be.
I have a custom control (custom window). When I receive the WM_PAINT message, I draw some Polygons using FillPolygon on a Graphics device. This Graphics device was created usin... | It sounds like you're running into an issue with how GDI+ handles rendering on Remote Desktop (RDP) versus locally on your machine. When dealing with graphics in a Windows environment, there are several factors that can influence rendering quality, especially when Remote Desktop is involved.
Here are some insights and... | 48,357 | [
{
"from": "human",
"value": "I have a C++ application that uses the Win32 API for Windows, and I'm having a problem with GDI+ dithering, when I don't know why it should be.\nI have a custom control (custom window). When I receive the WM_PAINT message, I draw some Polygons using FillPolygon on a Graphics dev... |
ive got the problem that i dont know how to stop my function with mouseover and restart it with mouseout
first here is my test-code:
<script type="text/javascript">
function fadeEngine(x) {
var total_divs=3; //setze hier die nummer der gewollten divs
var y=x;
if(x==total_... | To achieve the desired behavior of stopping the `fadeEngine` function on mouseover and restarting it on mouseout, you can use JavaScript's `clearTimeout` function to cancel the scheduled execution and use a variable to keep track of the timeout ID.
Here's how you can modify your code to include this functionality:
``... | 48,938 | [
{
"from": "human",
"value": "ive got the problem that i dont know how to stop my function with mouseover and restart it with mouseout\nfirst here is my test-code:\n\n\n <script type=\"text/javascript\">\n\n function fadeEngine(x) {\n\n var total_divs=3; //setze hier die nummer der gewollten divs\n\n ... |
I have been tasked with finding an open source DOM XML parser. The parser must minimally support XPath 1.0. Schema support is desired, but not a deal breaker
The files we are parsing will be small so speed and memory consumption are not a large concern.
Any OO language (C++, C#, Java, etc.).
To clarify, the plan ... | Here are a few open-source XML parsers that support DOM and XPath 1.0 and can be integrated into your application:
### Java
1. **Apache Xerces**:
- **Description**: Apache Xerces is a widely used XML parser that provides support for DOM, SAX, and XPath. It is robust and compliant with the W3C DOM and XPath standard... | 47,401 | [
{
"from": "human",
"value": "I have been tasked with finding an open source DOM XML parser. The parser must minimally support XPath 1.0. Schema support is desired, but not a deal breaker\nThe files we are parsing will be small so speed and memory consumption are not a large concern. \nAny OO language (C+... |
SQL Server 2005
I have 10 million rows in DB, and run a select (with lots of "where" and joints.. pretty complex). The results are presented in grid (think goolge results) and because of that, the user cannot possibly use more then 1000 results.
So I limit my SQL with a TOP 1000.
Problem: User still wants to know that... | You're right that counting rows can be expensive, especially when dealing with large datasets. However, there are ways to optimize the count operation and minimize the performance impact while still providing accurate feedback to users. Here are a few approaches you can consider:
### 1. Use Indexed Views or Aggregated... | 48,904 | [
{
"from": "human",
"value": "SQL Server 2005\nI have 10 million rows in DB, and run a select (with lots of \"where\" and joints.. pretty complex). The results are presented in grid (think goolge results) and because of that, the user cannot possibly use more then 1000 results. \nSo I limit my SQL with a TOP... |
I'd like to skip the tests and create a (default) Makefile.
| Certainly! A Makefile is a build script commonly used in projects that use the `make` tool to automate the build process. Below is a simple example of a default Makefile that includes typical targets for compiling a C program. You can adjust it to fit your specific project structure and requirements.
### Default Makef... | 49,998 | [
{
"from": "human",
"value": "I'd like to skip the tests and create a (default) Makefile.\n"
},
{
"from": "gpt",
"value": "Certainly! A Makefile is a build script commonly used in projects that use the `make` tool to automate the build process. Below is a simple example of a default Makefile that... |
Is it possible to take a DLGTEMPLATE and use it as a CWnd-derived control for placing in any other CWnd?
I have a dialog template that I want to use on one of my CDockablePanes
| Yes, it is possible to use a `DLGTEMPLATE` as a `CWnd`-derived control and embed it into other `CWnd` classes, including `CDockablePane`. However, it involves a few steps to ensure that the dialog template is correctly loaded and displayed within your custom control.
Here’s a high-level approach to achieve this:
1. *... | 46,747 | [
{
"from": "human",
"value": "Is it possible to take a DLGTEMPLATE and use it as a CWnd-derived control for placing in any other CWnd?\nI have a dialog template that I want to use on one of my CDockablePanes\n"
},
{
"from": "gpt",
"value": "Yes, it is possible to use a `DLGTEMPLATE` as a `CWnd`-d... |
A simple stupid "UPDATE table SET something=another WHERE (always true)" in accident will easily destroy everything in the database. It could be a human mistake, an SQL injection/overflow/truncation attack, or a bug in the code who build the WHERE causes.
Are popular databases provide a feature that protect tables by l... | Popular relational databases do not typically include a built-in feature to limit the maximum number of rows that can be updated in a single SQL statement at a configuration level. However, there are several approaches you can consider to help mitigate the risk of inadvertently updating or deleting large numbers of row... | 49,526 | [
{
"from": "human",
"value": "A simple stupid \"UPDATE table SET something=another WHERE (always true)\" in accident will easily destroy everything in the database. It could be a human mistake, an SQL injection/overflow/truncation attack, or a bug in the code who build the WHERE causes.\nAre popular database... |
I'm jealous of the rails guys. They can do this:
<%= javascript_include_tag "all_min" %>
... and I'm stuck doing this:
<script src="/public/javascript/jquery/jquery.js" type="text/javascript"></script>
<script src="/public/javascript/jquery/jquery.tablesorter.js" type="text/javascript"></script>
<script src="/public/j... | Yes, there are several libraries and tools that can help you compress, combine, and manage your JavaScript and CSS files effectively, similar to what you can do with Rails' `javascript_include_tag`. Here are some popular options:
### JavaScript and CSS Asset Management Libraries
1. **Webpack**:
- Webpack is a powe... | 49,765 | [
{
"from": "human",
"value": "I'm jealous of the rails guys. They can do this:\n<%= javascript_include_tag \"all_min\" %>\n\n... and I'm stuck doing this:\n<script src=\"/public/javascript/jquery/jquery.js\" type=\"text/javascript\"></script>\n<script src=\"/public/javascript/jquery/jquery.tablesorter.js\" t... |
I have to dump a large database over a network pipe that doesn't have that much bandwidth and other people need to use concurrently. If I try it it soaks up all the bandwidth and latency soars and everyone else gets messed up.
I'm aware of the --compress flag to mysqldump which help somewhat.
How can I do this without ... | If you need to transfer a large database over a limited bandwidth network without overwhelming it, here are several strategies you can employ:
1. **Throttling with `ionice` and `nice`**:
- On the machine where you're running `mysqldump`, you can use the `ionice` command to give your dump process a lower I/O priorit... | 49,532 | [
{
"from": "human",
"value": "I have to dump a large database over a network pipe that doesn't have that much bandwidth and other people need to use concurrently. If I try it it soaks up all the bandwidth and latency soars and everyone else gets messed up.\nI'm aware of the --compress flag to mysqldump which... |
So far I've only tried Hunchentoot and heard about AllegroServe, ABCLweb, though I wouldn't know how they compare in performance. I was wondering, what is currently the best option for deploying a Common Lisp web app in a production environment?
| When considering the best option for deploying a Common Lisp web application in a production environment, there are several popular web servers and frameworks available, including Hunchentoot, AllegroServe, and ABCLweb. Each has its own strengths and weaknesses, and the choice depends on your specific needs and context... | 48,952 | [
{
"from": "human",
"value": "So far I've only tried Hunchentoot and heard about AllegroServe, ABCLweb, though I wouldn't know how they compare in performance. I was wondering, what is currently the best option for deploying a Common Lisp web app in a production environment?\n"
},
{
"from": "gpt",
... |
So I am following this guide: http://technotes.1000lines.net/?p=23 and I am going through the steps. I have a VPN (slicehost.com) with Debian Etch, serving a website (static so far) with nginx. I used wget to download FastCGI and I did the usual make make install routine.
So I guess since FastCGI can't normally run CG... | It sounds like you're trying to set up FastCGI with a Perl wrapper and are encountering issues with the socket file that FastCGI is trying to bind to. The error message `bind/listen: No such file or directory` typically indicates that FastCGI is trying to create or connect to a socket file that does not exist, which ca... | 48,036 | [
{
"from": "human",
"value": "So I am following this guide: http://technotes.1000lines.net/?p=23 and I am going through the steps. I have a VPN (slicehost.com) with Debian Etch, serving a website (static so far) with nginx. I used wget to download FastCGI and I did the usual make make install routine. \nSo I... |
I am modifying a SQL table through C# code and I need to drop a NOT NULL constraint if it exists. How do I check to see if it exists first?
| To check if a `NOT NULL` constraint exists on a column in a SQL table before dropping it, you can query the information schema views in SQL Server. Specifically, you can use the `INFORMATION_SCHEMA` views or `sys` catalog views to find constraints related to a specific column.
Here’s an example of how you can do this ... | 49,158 | [
{
"from": "human",
"value": "I am modifying a SQL table through C# code and I need to drop a NOT NULL constraint if it exists. How do I check to see if it exists first?\n"
},
{
"from": "gpt",
"value": "To check if a `NOT NULL` constraint exists on a column in a SQL table before dropping it, you... |
I have an asp page that uses jQuery ajax to load member counts into a bunch of divs after a page is loaded.
It works perfectly well in FireFox, and with clients that have a small number of groups.
For the small number of clients that have many groups (500+), I am getting an error in IE. The ajax calls seem to be runni... | The issue you're experiencing with Internet Explorer (IE) seems to relate to how it manages asynchronous requests and how it might be locking up the main thread while processing a high volume of Ajax requests. Even though you've set `async: true`, IE can behave differently compared to other browsers like Firefox, espec... | 44,900 | [
{
"from": "human",
"value": "I have an asp page that uses jQuery ajax to load member counts into a bunch of divs after a page is loaded.\nIt works perfectly well in FireFox, and with clients that have a small number of groups.\nFor the small number of clients that have many groups (500+), I am getting an er... |
I was hacking away the source code for plink to make it compatible with unison.
If you don't know, unison is a file synchronization tool, it runs an "ssh" command to connect to a remote server, but there's no ssh.exe for windows; there's plink, which is very close but not close enough (it doesn't behave like unison exp... | The issues you're encountering stem from the way console input and output are handled in Windows, particularly with respect to standard handles and console input buffers.
### Understanding STD_INPUT_HANDLE vs. CONIN$
1. **STD_INPUT_HANDLE**:
- This is a predefined constant in Windows that represents the standard ... | 48,434 | [
{
"from": "human",
"value": "I was hacking away the source code for plink to make it compatible with unison.\nIf you don't know, unison is a file synchronization tool, it runs an \"ssh\" command to connect to a remote server, but there's no ssh.exe for windows; there's plink, which is very close but not clo... |
What are the things that you would consider when defining indexes, clustered and non-clustered, for SQL Server? Are there any anti-patterns that DB newbies should be aware of? Please explain the "Why" or provide references if possible.
| When defining indexes in SQL Server, especially when distinguishing between clustered and non-clustered indexes, several factors should be considered to ensure optimal performance and avoid common pitfalls. Here's a breakdown of what to consider and the anti-patterns to watch out for:
### Considerations for Index Desi... | 45,699 | [
{
"from": "human",
"value": "What are the things that you would consider when defining indexes, clustered and non-clustered, for SQL Server? Are there any anti-patterns that DB newbies should be aware of? Please explain the \"Why\" or provide references if possible.\n"
},
{
"from": "gpt",
"valu... |
Related to this question. Any advice on fixing the problem below?
After a lot of experimentation with the program, I have discovered several things.
It crashes relatively consistently (90% of the time or so) upon running the line of code, Set Message = New CAPICOM.EncryptedData. Note that the line above this is mere... | It sounds like you're dealing with a complex issue often associated with the interaction of legacy software, system libraries, and the specifics of the operating environment. Here are several strategies that could help you troubleshoot and potentially resolve the access violation you're encountering in your VB6 applica... | 47,734 | [
{
"from": "human",
"value": "Related to this question. Any advice on fixing the problem below?\nAfter a lot of experimentation with the program, I have discovered several things.\n\nIt crashes relatively consistently (90% of the time or so) upon running the line of code, Set Message = New CAPICOM.Encrypted... |
I've noticed on bank websites, etc, my user IDs aren't saved (they don't appear in a dropdown like other commonly entered stuff does) and there's no prompt for it to remember your password. How is this done? How do the sites notify the browser that they are in 'special' or else exceptions? Just curious.
| Websites can control how browsers handle user IDs and passwords through a combination of HTML attributes, HTTP headers, and security policies. Here are some common methods used to prevent browsers from saving credentials:
1. **HTML Input Attributes**:
- Websites can use the `autocomplete` attribute in HTML forms. F... | 49,837 | [
{
"from": "human",
"value": "I've noticed on bank websites, etc, my user IDs aren't saved (they don't appear in a dropdown like other commonly entered stuff does) and there's no prompt for it to remember your password. How is this done? How do the sites notify the browser that they are in 'special' or else ... |
Keeping performance on a mobile device in mind, what do you think is the best approach with an SQLCE Connection. Keep it open for the duration of the application or let it close whenever a call to the database is needed.
Obviously this depends a little on the nature of your application however I'm curious to hear what ... | When dealing with SQL Server Compact Edition (SQL CE) in a mobile application, the approach to managing your database connection can significantly affect performance, resource utilization, and overall user experience. Here are some considerations regarding whether to keep the connection open for the duration of the app... | 48,553 | [
{
"from": "human",
"value": "Keeping performance on a mobile device in mind, what do you think is the best approach with an SQLCE Connection. Keep it open for the duration of the application or let it close whenever a call to the database is needed.\nObviously this depends a little on the nature of your app... |
How can I create a Sidebar form in delphi.
I try the ScreenSnap and Align properties but I need that the form stay visible even if the user maximize other forms, without been on top. Just like the windows sidebar do.
Update: From the comments: if a window is maximized, it maximizes next to the window, not in front of o... | Creating a sidebar form in Delphi that stays visible when other forms are maximized (without being on top of other forms) can be done by using a combination of the `TForm` properties and Windows API functions. Here’s a step-by-step guide on how to achieve that behavior:
### Step 1: Create the Sidebar Form
1. **Create... | 47,909 | [
{
"from": "human",
"value": "How can I create a Sidebar form in delphi.\nI try the ScreenSnap and Align properties but I need that the form stay visible even if the user maximize other forms, without been on top. Just like the windows sidebar do.\nUpdate: From the comments: if a window is maximized, it maxi... |
I have a unmanaged DLL (the scilexer.dll of Scintilla code editor, used by Scintilla.Net from CodePlex) that is loaded from a managed application trough the Scintilla.Net component. The windows managed application runs without problem on both 32 and 64 bit environments, but I need to create different installations that... | Yes, you can achieve this by configuring your managed application to load the appropriate version of the `scilexer.dll` depending on the runtime architecture (32-bit or 64-bit). Here are a few strategies you can use to accomplish this:
### 1. Use Configuration Files
You can specify the correct DLL to load in a config... | 48,504 | [
{
"from": "human",
"value": "I have a unmanaged DLL (the scilexer.dll of Scintilla code editor, used by Scintilla.Net from CodePlex) that is loaded from a managed application trough the Scintilla.Net component. The windows managed application runs without problem on both 32 and 64 bit environments, but I ne... |
I have a class which has a private member $content. This is wrapped by a get-method:
class ContentHolder
{
private $content;
public function __construct()
{
$this->content = "";
}
public function getContent()
{
return $this->content;
}
}
$c = new ContentHolder();
$foo = arra... | In your code, `$foo['c']` does not actually hold a reference to the `$content` variable of the `ContentHolder` class; rather, it holds a copy of the value returned by the `getContent` method.
Here's a breakdown of how it works:
1. The `ContentHolder` class has a private member variable `$content` which is initialized... | 49,841 | [
{
"from": "human",
"value": "I have a class which has a private member $content. This is wrapped by a get-method:\nclass ContentHolder\n{\n private $content;\n public function __construct()\n {\n $this->content = \"\";\n }\n\n public function getContent()\n {\n return $this->... |
The VS2008 SP1 documentation talks about std::tr1::mem_fun.
So why, when I try and use std::tr1::mem_fun, why do I get this compile error?:
'mem_fun' : is not a member of 'std::tr1'
At the same time, I can use std::tr1::function without problems.
Here is the sample code I am trying to compile, which is supposed to cal... | The issue you're encountering stems from the fact that you're trying to use `std::tr1::mem_fun`, which indeed does not exist in the TR1 library as you discovered. The correct function to use is `std::tr1::mem_fn`. However, even after correcting this, there are additional considerations when using `std::tr1::bind`.
Her... | 49,820 | [
{
"from": "human",
"value": "The VS2008 SP1 documentation talks about std::tr1::mem_fun.\nSo why, when I try and use std::tr1::mem_fun, why do I get this compile error?:\n'mem_fun' : is not a member of 'std::tr1'\n\nAt the same time, I can use std::tr1::function without problems.\nHere is the sample code I ... |
There has to be a way to do this, I was googling information but I can't seem to get it to work. The sites I checked out said to do something along the lines of
start /B %WINDIR%\Microsoft.NET\Framework\v2.0.50727\webdev.webserver.exe /path:"D:\MyFolder" /vpath:/HelloWorldWebSite
In a batch file. However, none of my... | It looks like you're trying to start a local ASP.NET development server using the `webdev.webserver.exe` command. This utility is commonly used for hosting web applications during development, but it was included with older versions of the .NET Framework, which can sometimes lead to confusion about its location.
In .N... | 46,116 | [
{
"from": "human",
"value": "There has to be a way to do this, I was googling information but I can't seem to get it to work. The sites I checked out said to do something along the lines of \nstart /B %WINDIR%\\Microsoft.NET\\Framework\\v2.0.50727\\webdev.webserver.exe /path:\"D:\\MyFolder\" /vpath:/HelloW... |
I have an Excel file that has a bunch of VBA and macro code in it. When I open the file in Excel I can choose not to 'enable' them - so the values in the fields all stay as they were during the last save. I need to manipulate the values as they were last saved - so I don't want the macros (which look at the current d... | To open an Excel file with macros disabled programmatically in .NET, you need to set the `DisplayAlerts` property and change the macro settings for the Excel application instance. Unfortunately, there isn't a direct property in the `Excel.Application` object that allows you to disable macros when opening a file. Howeve... | 47,101 | [
{
"from": "human",
"value": "I have an Excel file that has a bunch of VBA and macro code in it. When I open the file in Excel I can choose not to 'enable' them - so the values in the fields all stay as they were during the last save. I need to manipulate the values as they were last saved - so I don't wan... |
I have some educational flash games for Windows (legally bought), that I would like for my daughter to be able to use on her OLPC.
I know that some users have been able to run them under Linux by using wine, but that is really not an option on the OLPC as they need the cd in the drive to run, and the OLPC does not have... | It sounds like you're making good progress on trying to run the educational games on the OLPC by analyzing the structure of the files. Since you've identified that the executable is a projector that calls for additional files, and you've encountered the file-not-found error when trying to access activities, there are a... | 49,903 | [
{
"from": "human",
"value": "I have some educational flash games for Windows (legally bought), that I would like for my daughter to be able to use on her OLPC.\nI know that some users have been able to run them under Linux by using wine, but that is really not an option on the OLPC as they need the cd in th... |
I've built the x86 Boost libraries many times, but I can't seem to build x64 libraries. I start the "Visual Studio 2005 x64 Cross Tools Command Prompt" and run my usual build:
bjam --toolset=msvc --build-type=complete --build-dir=c:\build install
But it still produces x86 .lib files (I verified this with dumpbin /head... | When trying to build Boost libraries for x64 using the Visual Studio 2005 x64 Cross Tools Command Prompt, there are a few things to check and configure to ensure that the build system produces the x64 versions of the libraries. Here are some steps and considerations that may help resolve your issue:
1. **Toolset Speci... | 48,735 | [
{
"from": "human",
"value": "I've built the x86 Boost libraries many times, but I can't seem to build x64 libraries. I start the \"Visual Studio 2005 x64 Cross Tools Command Prompt\" and run my usual build:\nbjam --toolset=msvc --build-type=complete --build-dir=c:\\build install\n\nBut it still produces x86... |
Is there a way to use Zend_Search_Lucene to search/index PDF documents?
| Yes, you can use Zend_Search_Lucene to index and search PDF documents, but you will need to use an additional library to extract text content from PDF files since Zend_Search_Lucene itself does not natively support PDF parsing.
Here's a general approach on how to achieve this:
1. **Extract Text from PDF**: You can us... | 46,305 | [
{
"from": "human",
"value": "Is there a way to use Zend_Search_Lucene to search/index PDF documents?\n"
},
{
"from": "gpt",
"value": "Yes, you can use Zend_Search_Lucene to index and search PDF documents, but you will need to use an additional library to extract text content from PDF files since... |
OK, deploying ASP.NET MVC seems to be painful. I want to deploy my ASP.NET MVC application on Windows XP (IIS 5.1), but can't seem to find how to do it. When I type the application name into the web browser address bar I get a "website not available" message.
There are workarounds for IIS 6.0, but what about IIS 5.1? ... | Deploying an ASP.NET MVC application on Windows XP with IIS 5.1 presents some challenges, primarily because IIS 5.1 has limited support for modern ASP.NET features and is quite outdated. Here are some steps you can take to try to get your ASP.NET MVC application running in this environment:
### Prerequisites
1. **Fram... | 40,548 | [
{
"from": "human",
"value": "OK, deploying ASP.NET MVC seems to be painful. I want to deploy my ASP.NET MVC application on Windows XP (IIS 5.1), but can't seem to find how to do it. When I type the application name into the web browser address bar I get a \"website not available\" message. \nThere are worka... |
Greetings,
I have problems (when trying to print from c# to certain printers that do not have large print areas. Is there a way to shrink to printable area (like Adobe Acrobat do)? Thanks!
| Yes, when you're working with printing in C# and need to adjust content to fit within a printer's printable area, you can manipulate the scaling of your printed content. While the .NET Framework does not have a built-in method exactly like Adobe Acrobat's "shrink to fit," you can achieve a similar effect using the `Pri... | 41,759 | [
{
"from": "human",
"value": "Greetings,\nI have problems (when trying to print from c# to certain printers that do not have large print areas. Is there a way to shrink to printable area (like Adobe Acrobat do)? Thanks!\n"
},
{
"from": "gpt",
"value": "Yes, when you're working with printing in C#... |
I want to build a parser for a C like language. The interesting aspect about it is that I want to build it in such a way that someone who has access to the source can easily modified it to extend the language (a new expression type of instance) with the extensions being runtime configurable (they can be turned on and o... | Creating a configurable parser for a C-like language with extensible production rules is an interesting challenge. You've outlined a few important considerations, including extension mechanics, production conflicts, and extension hierarchy. Here are some suggestions on how to address these concerns while keeping your s... | 44,373 | [
{
"from": "human",
"value": "I want to build a parser for a C like language. The interesting aspect about it is that I want to build it in such a way that someone who has access to the source can easily modified it to extend the language (a new expression type of instance) with the extensions being runtime ... |
I'm going to propose to a client that I build some batch jobs in Java that will run on their mainframe and/or AS/400s (sorry System z and System i). Both platforms are up to date system software wise. I'm wondering if anyone has done this and can provide any pointer or gotchas to watch out for.
The motivation is to hav... | Building batch jobs in Java for mainframe (System z) and AS/400 (System i) environments can be a great way to leverage the power of Java's libraries while still working within these traditional platforms. Here are some pointers and potential gotchas to consider as you prepare your proposal and work on implementation:
... | 47,616 | [
{
"from": "human",
"value": "I'm going to propose to a client that I build some batch jobs in Java that will run on their mainframe and/or AS/400s (sorry System z and System i). Both platforms are up to date system software wise. I'm wondering if anyone has done this and can provide any pointer or gotchas t... |
Let's say I have a simple chunck of XML:-
<root>
<item forename="Fred" surname="Flintstone" />
<item forename="Barney" surname="Rubble" />
</root>
Having fetched this XML in Silverlight I would like to bind it with XAML of this ilke:-
<ListBox x:Name="ItemList" Style="{StaticResource Items}">
<ListBox.ItemTe... | To bind XML data directly in XAML without creating a dedicated class, you can utilize `XmlDataProvider` in Silverlight. This allows you to bind to the XML elements and attributes directly in your XAML. You can also handle the two-way binding for editing user input directly in the `TextBox`.
Here's how you can achieve ... | 47,397 | [
{
"from": "human",
"value": "Let's say I have a simple chunck of XML:-\n<root>\n <item forename=\"Fred\" surname=\"Flintstone\" />\n <item forename=\"Barney\" surname=\"Rubble\" />\n</root>\n\nHaving fetched this XML in Silverlight I would like to bind it with XAML of this ilke:-\n<ListBox x:Name=\"Item... |
I found that SQL stored procedures are very interesting and useful. I have written stored procedures but i want to write well crafted, good performance tuned and concise SPs for any sort of requirement and also would love to learn about any tricks or good practices for stored procedures. How do i move from the beginner... | Moving from a beginner to an advanced level in writing SQL stored procedures involves mastering various concepts, best practices, and performance tuning techniques. Below are some tips, tricks, and good practices that can help you craft well-optimized stored procedures:
### 1. **Use Meaningful Naming Conventions**
... | 45,168 | [
{
"from": "human",
"value": "I found that SQL stored procedures are very interesting and useful. I have written stored procedures but i want to write well crafted, good performance tuned and concise SPs for any sort of requirement and also would love to learn about any tricks or good practices for stored pr... |
I am writing a console program in C#.
Is there a way I can use a Console.Clear() to only clear certain things on the console screen?
Here's my issue:
I have a logo (I put it on screen using Console.WriteLine()) and a 2d array which I want to keep constant and clear everything below it.
| In a console application, `Console.Clear()` will clear the entire console screen, which makes it difficult to maintain static content like your logo or any constant elements. To achieve your goal of keeping the logo and a 2D array constant while clearing everything below it, you'll have to implement a workaround.
Here... | 49,298 | [
{
"from": "human",
"value": "I am writing a console program in C#.\nIs there a way I can use a Console.Clear() to only clear certain things on the console screen?\nHere's my issue:\nI have a logo (I put it on screen using Console.WriteLine()) and a 2d array which I want to keep constant and clear everything... |
I'm trying to submit a form who is rendered in a SimpleModal dialog, but my submit is never called when I'm using FF3 & Opera (Chrome, Safari and IE works). I use the following code:
function ShowModal(rendercontainerid, modalcontainerid, url) {
if (url == '')
return;
$.get(url, function(data) {
... | It sounds like you're experiencing issues with form submission in a modal dialog using jQuery, particularly in Firefox 3 and Opera. Let's go through a few potential issues and solutions.
### Possible Issues and Solutions:
1. **Event Handling**: Ensure that you are preventing the default form submission behavior corre... | 46,077 | [
{
"from": "human",
"value": "I'm trying to submit a form who is rendered in a SimpleModal dialog, but my submit is never called when I'm using FF3 & Opera (Chrome, Safari and IE works). I use the following code:\nfunction ShowModal(rendercontainerid, modalcontainerid, url) {\n if (url == '')\n ret... |
I have two arrays containing the same elements, but in different orders, and I want to know the extent to which their orders differ.
The method I tried, didn't work. it was as follows:
For each list I built a matrix which recorded for each pair of elements whether they were above or below each other in the list. I then... | You're on the right track in considering that the Pearson correlation coefficient might not be the best fit for measuring the similarity in the order of elements in two lists. There are several alternative methods that can provide a more appropriate measure of similarity or dissimilarity based on the ordering of elemen... | 49,717 | [
{
"from": "human",
"value": "I have two arrays containing the same elements, but in different orders, and I want to know the extent to which their orders differ.\nThe method I tried, didn't work. it was as follows:\nFor each list I built a matrix which recorded for each pair of elements whether they were ab... |
Recently there has been quite some hype around all the different mocking frameworks in the .NET world. I still haven't quite grasped what is so great about them. It doesn't seem to be to hard to write the mocking objects I need myself. Especially with the help of Visual Studio I quickly can write a class that implement... | You bring up an interesting point regarding the use of mocking frameworks in .NET and the idea of manually creating mock objects. While it is indeed possible to create your own mock objects quickly, there are several reasons why developers often prefer to use mocking frameworks:
### 1. **Reduced Boilerplate Code**:
Wh... | 48,522 | [
{
"from": "human",
"value": "Recently there has been quite some hype around all the different mocking frameworks in the .NET world. I still haven't quite grasped what is so great about them. It doesn't seem to be to hard to write the mocking objects I need myself. Especially with the help of Visual Studio I... |
Is it possible to extend the "Send to" menu in Office (not the Windows one; I know how to do that). I would like to launch my own application with the source document as the target.
Update: I am looking for a non-VSTO based solution.
| Extending the "Send To" menu in Microsoft Office applications (like Word, Excel, etc.) without using VSTO (Visual Studio Tools for Office) can be somewhat limited, but there are a few approaches you could consider. Here are some options:
### 1. **Add-In Approach with Office Add-ins:**
While you specified not wanting V... | 49,784 | [
{
"from": "human",
"value": "Is it possible to extend the \"Send to\" menu in Office (not the Windows one; I know how to do that). I would like to launch my own application with the source document as the target.\nUpdate: I am looking for a non-VSTO based solution.\n"
},
{
"from": "gpt",
"value... |
I have exported a COM+ application proxy, which generates MSI and CAB files, and I have successfully installed them on a few different Win XP and Vista machines. However, I have a WinXP box that isn't playing nicely. When I try and run the MSI it gives me the following error message:
"Error registering COM+ Application... | When encountering the "Error registering COM+ Application" message during the installation of a COM+ application proxy on Windows XP, it usually indicates that there is an issue with dependencies or the environment. Here are some steps you can take to troubleshoot the problem:
### Troubleshooting Steps
1. **Event Vie... | 44,410 | [
{
"from": "human",
"value": "I have exported a COM+ application proxy, which generates MSI and CAB files, and I have successfully installed them on a few different Win XP and Vista machines. However, I have a WinXP box that isn't playing nicely. When I try and run the MSI it gives me the following error mes... |
Can you program/configure Visual Studio to produce custom intellisense for your own server controls.
eg can you get it to do this:
alt text http://www.yart.com.au/test/vs.gif
for a tag of your own like:
<MyCompany:MyTag ...
| Yes, you can configure Visual Studio to provide custom IntelliSense for your own server controls. This involves several steps, including creating a custom control, providing a schema for IntelliSense, and possibly using a combination of attributes and XML comments. Here's how you can achieve this:
### Step 1: Create Y... | 48,282 | [
{
"from": "human",
"value": "Can you program/configure Visual Studio to produce custom intellisense for your own server controls.\neg can you get it to do this:\nalt text http://www.yart.com.au/test/vs.gif\nfor a tag of your own like:\n<MyCompany:MyTag ...\n\n"
},
{
"from": "gpt",
"value": "Yes,... |
I have a set of radio buttons where a selection is required. In addition, there is an optional text box that shows up next to one of the selections.
What would be the best way to make it clear what is required and what is optional?
<strong>User Availability:</strong><br>
<input value="Available" type="radio"> Availabl... | To clearly communicate the requirement for radio button selection and the optional nature of the date input, you can use a combination of visual cues, labeling, and layout adjustments. Here are some suggestions:
### 1. Visual Hierarchy and Grouping
- **Use Clear Headings**: Start with a strong heading that indicates t... | 48,965 | [
{
"from": "human",
"value": "I have a set of radio buttons where a selection is required. In addition, there is an optional text box that shows up next to one of the selections.\nWhat would be the best way to make it clear what is required and what is optional?\n<strong>User Availability:</strong><br>\n<in... |
I understand that you can now create MVC-specific user controls, but will my existing standard ASCX user controls work in an MVC view?
I understand that MVC pages have a completely different lifecycle but will, for example, a Page_Load method be invoked as normal when the control is sitting in a view?
| In ASP.NET MVC, traditional Web Forms user controls (ASCX files) do not work out of the box like they do in Web Forms applications. The MVC framework has a different architecture and lifecycle compared to Web Forms, which affects how user controls are handled.
Here are a few important points regarding the integration ... | 47,953 | [
{
"from": "human",
"value": "I understand that you can now create MVC-specific user controls, but will my existing standard ASCX user controls work in an MVC view? \nI understand that MVC pages have a completely different lifecycle but will, for example, a Page_Load method be invoked as normal when the cont... |
Can I use Update panel in masterpage to wrap nested pages so that when browsing from one page to the other client only gets a partial refresh (MasterPage doesn't get reloaded).
If so - how? Do I Just put an update panel around the ContentPlaceholder in the Master Page?
Any help appreciated!
| Yes, you can use an UpdatePanel in a Master Page to achieve a partial page refresh when navigating between nested pages (content pages). By wrapping the `ContentPlaceHolder` in an `UpdatePanel`, only the content of that panel will be refreshed, while the rest of the Master Page remains intact.
Here's how you can imple... | 45,335 | [
{
"from": "human",
"value": "Can I use Update panel in masterpage to wrap nested pages so that when browsing from one page to the other client only gets a partial refresh (MasterPage doesn't get reloaded).\nIf so - how? Do I Just put an update panel around the ContentPlaceholder in the Master Page? \nAny he... |
Is Structured Exception Handling bad? What is the right way to handle exceptions?
EDIT: Exception Handling in .NET using C#.
I usually have a set of specific exception classes (DivideByZeroException, ArrayTypeMismatchException) and don't have a generic "catch (Exception ex)".
The thinking behind this is that I expect c... | Structured Exception Handling (SEH) in .NET, particularly in C#, can be a powerful feature if used appropriately. It's not inherently "bad," but like any tool, it must be used with care to avoid common pitfalls. Here’s a breakdown of best practices and thoughts on your approach to exception handling:
### General Princ... | 47,666 | [
{
"from": "human",
"value": "Is Structured Exception Handling bad? What is the right way to handle exceptions?\nEDIT: Exception Handling in .NET using C#.\nI usually have a set of specific exception classes (DivideByZeroException, ArrayTypeMismatchException) and don't have a generic \"catch (Exception ex)\"... |
WSPBuilder
Version: 0.9.8.0830
Created by Carsten Keutmann
GPL License 2007
Install and deploying [MYDLL]
Unable to deploy solution
Inner exception(1): This solution contains one or more assemblies targeted for the global assembly cache. You should use a strong name for any assembly that will be in the global assembly ... | The error message you're encountering indicates that the solution you're trying to deploy contains one or more assemblies that are intended to be deployed to the Global Assembly Cache (GAC), but these assemblies are not strong-named. In .NET, assemblies that need to be placed in the GAC must be strongly named for versi... | 48,300 | [
{
"from": "human",
"value": "WSPBuilder\nVersion: 0.9.8.0830\nCreated by Carsten Keutmann\nGPL License 2007\nInstall and deploying [MYDLL]\nUnable to deploy solution\nInner exception(1): This solution contains one or more assemblies targeted for the global assembly cache. You should use a strong name for an... |
I am new to C++ on MacOS.
I got an error when I used kbhit() in my program.
I used #include<conio.h> but got error too, so I searched and test with #include<curses.h> but error is still remained.
| The function `kbhit()` is a non-standard function primarily used in Windows programming, which checks if a keyboard hit (key press) is available. The header file `<conio.h>` is also specific to DOS and Windows systems, so it is not available on macOS or other UNIX-like systems.
On macOS, if you want to detect keyboard... | 49,879 | [
{
"from": "human",
"value": "I am new to C++ on MacOS.\nI got an error when I used kbhit() in my program.\nI used #include<conio.h> but got error too, so I searched and test with #include<curses.h> but error is still remained.\n"
},
{
"from": "gpt",
"value": "The function `kbhit()` is a non-stan... |
Question: 1
I am a beginner to WCF , I have taken a web application and hosted on IIS(with some port(250) and added a new WCF file, added an operation contract and tried to call the WCF service from the client web app through javascript, i was not able to get the jsdebug file itself to check wheteher proxy is created o... | ### Answer to Question 1:
A 404 error when trying to invoke a WCF service often indicates that the endpoint you're trying to reach cannot be found. Here are some steps to help diagnose and resolve the issue:
1. **Check the URL**: Make sure that the URL you are using to call the WCF service is correct. The URL should ... | 45,463 | [
{
"from": "human",
"value": "Question: 1\nI am a beginner to WCF , I have taken a web application and hosted on IIS(with some port(250) and added a new WCF file, added an operation contract and tried to call the WCF service from the client web app through javascript, i was not able to get the jsdebug file i... |
I'm working on a simple application to start learning my way around WPF. I created a vector graphic in Microsoft Expression Design at 400px by 400px, mainly because I thought it would be easier to create it on a bigger canvas.
I've exported the image to a XAML file as a series of objects within a 400px square canvas. A... | To achieve your goal of scaling a vector graphic (XAML) created in Microsoft Expression Design and using it in your WPF application, you have a few options. Here’s a step-by-step guide on how you can do this effectively.
### Option 1: Using `Viewbox`
One of the easiest ways to scale a vector graphic in WPF is to wrap... | 48,220 | [
{
"from": "human",
"value": "I'm working on a simple application to start learning my way around WPF. I created a vector graphic in Microsoft Expression Design at 400px by 400px, mainly because I thought it would be easier to create it on a bigger canvas.\nI've exported the image to a XAML file as a series ... |
The question, in brief:
In MVC, how do you distinguish between a checkbox click (or a selectbox or listbox change) from a human meaning "Controller, modify the model", and a checkbox click (or a selectbox or listbox change) from the Controller meaning "I'm updating the view because the model has changed"?
The example:... | You've done a great job of unpacking your initial problem and arriving at a more refined understanding of the MVC pattern and how to manage events effectively in your application. Here’s a summary of the approach you arrived at, along with some additional considerations to further enhance your implementation:
### Key ... | 46,874 | [
{
"from": "human",
"value": "The question, in brief:\nIn MVC, how do you distinguish between a checkbox click (or a selectbox or listbox change) from a human meaning \"Controller, modify the model\", and a checkbox click (or a selectbox or listbox change) from the Controller meaning \"I'm updating the view ... |
I have a user control with a ComboBox and a TextBox. Everything is working great except I noticed that from my user control's instance object, I can access those two controls. They shouldn't be accessible except via my own exposed properties.
| To encapsulate your controls properly within a user control in WPF (or similar frameworks), you can set the visibility of the controls to `private` or `protected`, and expose properties that provide controlled access to them. This ensures that the internal implementation details are hidden and users of your user contro... | 49,529 | [
{
"from": "human",
"value": "I have a user control with a ComboBox and a TextBox. Everything is working great except I noticed that from my user control's instance object, I can access those two controls. They shouldn't be accessible except via my own exposed properties.\n"
},
{
"from": "gpt",
... |
I have to choose a platform for our product. I have to decide between The Qt Framework and Adobe's AIR. I am well versed with Qt as I have worked for the last two years. I looked up at the Adobe's site but all the info about flex, flash, ability to coding in HTML/ActionScript is overwhelming and confusing. I cannot und... | Adobe AIR and the associated development ecosystem can be quite different from what you're used to in Qt. Below, I'll address your questions regarding Adobe AIR:
1. **What language do I use for coding my application?**
Yes, you primarily use ActionScript for coding the functionality of your application in Adobe AIR... | 49,530 | [
{
"from": "human",
"value": "I have to choose a platform for our product. I have to decide between The Qt Framework and Adobe's AIR. I am well versed with Qt as I have worked for the last two years. I looked up at the Adobe's site but all the info about flex, flash, ability to coding in HTML/ActionScript is... |
I'm attempting to set up a symbol proxy using symproxy.dll from Debugging Tools for Windows. When I issue ".reload /f" from the debugger, none of the symbol files can be found. It looks like Symproxy isn't going out to the Microsoft Symbol Server to actually get the symbols. I see nothing in Wireshark, for example.
SYM... | It sounds like you're dealing with some common issues when setting up a symbol proxy using `symproxy.dll`. Here are several troubleshooting steps and checks you can perform to resolve the issue where `symproxy` is not fetching symbols from the Microsoft Symbol Server.
1. **Check Symproxy Configuration**:
- Make sur... | 49,627 | [
{
"from": "human",
"value": "I'm attempting to set up a symbol proxy using symproxy.dll from Debugging Tools for Windows. When I issue \".reload /f\" from the debugger, none of the symbol files can be found. It looks like Symproxy isn't going out to the Microsoft Symbol Server to actually get the symbols. I... |
I've a question about KConfig usage. I'm able to write and read settings in my .kde4/share/config/_appname_rc configuration file like that
KConfig basicconf;
KConfigGroup conf = KConfigGroup(basicconf.group("Settings"));
conf.writeEntry("filepath",QString("/path/"));
basicconf.sync();
But I don't understand how to... | To handle default configuration settings using KConfig without the need for KConfig XT, you can follow a simple approach. The idea is to create a default configuration file that your application can read when it starts for the first time or when you want to reset the settings.
Here's a step-by-step guide:
### Step 1:... | 47,935 | [
{
"from": "human",
"value": "I've a question about KConfig usage. I'm able to write and read settings in my .kde4/share/config/_appname_rc configuration file like that\n KConfig basicconf;\n KConfigGroup conf = KConfigGroup(basicconf.group(\"Settings\"));\n conf.writeEntry(\"filepath\",QString(\"/path/\"));... |
I have a system that creates an order and that order can be billed to a house account, sent Cash on Delivery (COD), or charged to a credit card. I've created the following tables:
ORDERS
order_id
billingoption_id
BILLINGOPTIONS
billingoption_id
I'm unsure of how the next table should be built for the billing data. Sh... | In designing your database schema for the different billing options, you have a couple of viable approaches. The choice largely depends on the specific requirements of your system and how complex the billing data will be for each option. Here are two common approaches, each with its pros and cons:
### Option 1: Separa... | 47,919 | [
{
"from": "human",
"value": "I have a system that creates an order and that order can be billed to a house account, sent Cash on Delivery (COD), or charged to a credit card. I've created the following tables:\nORDERS\norder_id\nbillingoption_id\nBILLINGOPTIONS\nbillingoption_id\nI'm unsure of how the next ... |
How can I detect, or be notified, when windows is logging out in python?
Edit:
Martin v. Löwis' answer is good, and works for a full logout but it does not work for a 'fast user switching' event like pressing win+L which is what I really need it for.
Edit: im not using a gui this is running as a service
| Detecting user sessions, especially in the context of events like logging out or fast user switching, can be a bit tricky when running a Python script as a service, particularly on Windows. For a typical use case, you might want to use the Windows API to listen for specific system events. Here’s how you can approach it... | 45,260 | [
{
"from": "human",
"value": "How can I detect, or be notified, when windows is logging out in python?\nEdit:\nMartin v. Löwis' answer is good, and works for a full logout but it does not work for a 'fast user switching' event like pressing win+L which is what I really need it for.\nEdit: im not using a gui ... |
How do I connect to Gmail and determine which messages have attachments? I then want to download each attachment, printing out the Subject: and From: for each message as I process it.
| To connect to Gmail and determine which messages have attachments, you'll typically use the Gmail API. Below, I’ll outline the steps to accomplish this task using Python. Make sure you have the necessary libraries installed. You will primarily need `google-auth`, `google-auth-oauthlib`, `google-auth-httplib2`, and `goo... | 43,332 | [
{
"from": "human",
"value": "How do I connect to Gmail and determine which messages have attachments? I then want to download each attachment, printing out the Subject: and From: for each message as I process it.\n"
},
{
"from": "gpt",
"value": "To connect to Gmail and determine which messages ... |
I'm adding some functionality to my site so that users can upload their own profile pictures, so I was wondering about whether to store them in the database as a BLOB, or put them in the file system.
I found a question similar to this here: Storing images in DB: Yea or Nay, but the answers given were geared more toward... | When deciding whether to store user-uploaded profile pictures as BLOBs in a database or in the filesystem, there are several factors to consider, even with a small number of images like the scenario you described (up to a few thousand images).
### Pros and Cons of Storing Images in a Database (BLOBs)
**Pros:**
1. **D... | 41,789 | [
{
"from": "human",
"value": "I'm adding some functionality to my site so that users can upload their own profile pictures, so I was wondering about whether to store them in the database as a BLOB, or put them in the file system.\nI found a question similar to this here: Storing images in DB: Yea or Nay, but... |
I am using LINQ to SQl and using TransactionScopre I am inserting the data in SQL .
_context.tblDataContainer.InsertOnSubmit(migrationData);
using (TransactionScope ts = new TransactionScope())
{
_context.SubmitChanges();
ts.Complete();
}
doing this, does linq execute any delete statements on SQL. i have chec... | When you use LINQ to SQL and wrap your `SubmitChanges` call within a `TransactionScope`, LINQ to SQL will generate the necessary SQL statements to execute the changes you've made to your context. In the code you've provided, you're only inserting a record into the `tblDataContainer`. Since your context log shows no del... | 49,104 | [
{
"from": "human",
"value": "I am using LINQ to SQl and using TransactionScopre I am inserting the data in SQL .\n_context.tblDataContainer.InsertOnSubmit(migrationData);\n\nusing (TransactionScope ts = new TransactionScope())\n{\n _context.SubmitChanges();\n ts.Complete();\n}\n\ndoing this, does linq... |
I have a generic function which gets a interface as a type, now in one condition I have to create a new class depending on the interface. I have been thinking about it and a way to solve it would be to use an IoC but I was hoping there would be an other way because an IoC seems a bit like an overkill.
below is an atte... | To achieve the functionality you desire without resorting to an IoC container or copying code multiple times, you can use a combination of generics and a method that maps the type `T` to the appropriate creation logic based on its interface. Since C# does not allow specifying multiple interface constraints directly (li... | 49,155 | [
{
"from": "human",
"value": "I have a generic function which gets a interface as a type, now in one condition I have to create a new class depending on the interface. I have been thinking about it and a way to solve it would be to use an IoC but I was hoping there would be an other way because an IoC seems ... |
I need to bind labels or items in a toolstrip to variables in Design Mode.
I don't use the buit-in resources not the settings, so the section Data is not useful. I am taking the values out from an XML that I map to a class.
I know there are many programs like:
http://www.jollans.com/tiki/tiki-index.php?page=Multilang... | Binding labels or items in a ToolStrip to variables in Design Mode, especially when you're using XML for localization or for managing text, can be a bit tricky since the default capabilities of WinForms and Design Mode don't support custom data sources directly. However, you have a few options to create a more optimize... | 44,500 | [
{
"from": "human",
"value": "I need to bind labels or items in a toolstrip to variables in Design Mode. \nI don't use the buit-in resources not the settings, so the section Data is not useful. I am taking the values out from an XML that I map to a class.\nI know there are many programs like: \nhttp://www.jo... |
I am using a ResourceDictionary, but I would like to be able to look up the value or the key with the other item. Each is always unique, so that is not a problem. Is there a type that has this double sided lookup feature?
| Yes, you can achieve a double-sided lookup (i.e., looking up a key by its value and vice versa) using a custom data structure. One common approach is to use a two-way dictionary, which maintains both key-value pairs and value-key pairs.
Here’s an example implementation in C# of a two-way dictionary:
```csharp
using ... | 45,780 | [
{
"from": "human",
"value": "I am using a ResourceDictionary, but I would like to be able to look up the value or the key with the other item. Each is always unique, so that is not a problem. Is there a type that has this double sided lookup feature?\n"
},
{
"from": "gpt",
"value": "Yes, you c... |
I run a subprocess using:
p = subprocess.Popen("subprocess",
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
stdin=subprocess.PIPE)
This subprocess could either exit immediately with an error on stderr, or keep running. I want to detect either o... | The issue you're encountering is due to the way you've set up your `Popen` command and the use of the `select` function. In your code snippet, you're not correctly handling the subprocess's standard output and standard error streams.
Here are a few points to consider:
1. **Stream Handling**: The `stdout` and `stderr`... | 47,789 | [
{
"from": "human",
"value": "I run a subprocess using:\n p = subprocess.Popen(\"subprocess\", \n stdout=subprocess.PIPE, \n stderr=subprocess.PIPE, \n stdin=subprocess.PIPE)\n\nThis subprocess could either exit immediately with an error on s... |
Im a newbie programmer in Delphi. I need help, I have a small project which I need to display all kind of image format.
Please suggest what should I do or any component in delphi that support all image format? thanks for the help in advance.
| Welcome to Delphi programming! To display a wide variety of image formats in a Delphi application, you can use a few different approaches depending on the specific formats you need to support. Here are some options:
### 1. **Using TImage with Delphi's Built-in Support**
Delphi's `TImage` component can handle a variety... | 49,222 | [
{
"from": "human",
"value": "Im a newbie programmer in Delphi. I need help, I have a small project which I need to display all kind of image format.\nPlease suggest what should I do or any component in delphi that support all image format? thanks for the help in advance.\n"
},
{
"from": "gpt",
"... |
I implemented a save-draft trick using an update panel whereby I handle the updatepanel's asynch postback on the server side and then to avoid resending the same html data I throw an exception with the current datetime as message and then capture it on the client side where i do some transformation and html injection ... | What you've described is an interesting approach to handling asynchronous postbacks with ASP.NET UpdatePanels. While your current implementation works, there are cleaner and more maintainable ways to achieve similar functionality without throwing exceptions to handle the state of your application.
Here are some sugges... | 49,206 | [
{
"from": "human",
"value": "I implemented a save-draft trick using an update panel whereby I handle the updatepanel's asynch postback on the server side and then to avoid resending the same html data I throw an exception with the current datetime as message and then capture it on the client side where i d... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.