instruction stringlengths 14 27.6k | completion stringlengths 3 38.3k | __original_row_idx int64 0 50k | conversations listlengths 2 2 |
|---|---|---|---|
I'll be quick and honest: I'm currently trying to write a client/server for an online game. Since I'm poor and limited on resources, I'll be testing the bare basics of the server using a PHP backend, with the eventual goal being to rebuild the server end in C++.
I'm looking for a C++ library for Windows (XP and Vista p... | It's great to hear that you're working on a client/server architecture for your online game! For your specific requirements of using threads for independent networking tasks, there are several C++ libraries that might suit your needs. Here are some options to consider:
### 1. **Boost.Asio**
- **Description**: Boost.As... | 44,864 | [
{
"from": "human",
"value": "I'll be quick and honest: I'm currently trying to write a client/server for an online game. Since I'm poor and limited on resources, I'll be testing the bare basics of the server using a PHP backend, with the eventual goal being to rebuild the server end in C++.\nI'm looking for... |
We have an application where our clients are connecting to a SQL Server 2005 database - via a SQL Native Client ODBC data source. We are having some difficulties with the ODBC connection getting severed during program execution. After questioning a tech support person, he said that he had seen this type of error before... | Hi Mike,
The SQL Native Client indeed manages the connection method automatically based on the available protocols and the configuration of the SQL Server instance. However, there are some ways to influence or check the connection method being used:
### Connection Method
1. **Automatic Selection**: The SQL Native Cli... | 47,569 | [
{
"from": "human",
"value": "We have an application where our clients are connecting to a SQL Server 2005 database - via a SQL Native Client ODBC data source. We are having some difficulties with the ODBC connection getting severed during program execution. After questioning a tech support person, he said t... |
I have got a field with data type int? price and allow null, when I set
book.price = null;
and update, it is not saved and does not throw any exceptions, when I change value # null, it is ok. I want set it null.
| When dealing with nullable integer fields (e.g., `int?` in C# or similar languages) in your data model, it’s important to ensure that your data access layer (e.g., Entity Framework, ADO.NET, etc.) is properly handling the setting of `null` values. If you're trying to set a property to `null` and it's not saving, it cou... | 48,097 | [
{
"from": "human",
"value": "I have got a field with data type int? price and allow null, when I set\nbook.price = null;\n\nand update, it is not saved and does not throw any exceptions, when I change value # null, it is ok. I want set it null.\n"
},
{
"from": "gpt",
"value": "When dealing with ... |
I'm lead to believe that quick sort should be faster than insertion sort on a medium size unorderd int array. I've implemented both algorithms in java and I notice quicksort is significantly slower then insertion sorrt.
I have a theory: quiksort is being slower because it's recursive and the call it's making to it's... | Your theory about the performance differences you observe between quicksort and insertion sort is plausible, but there are a few nuances to consider when comparing these two algorithms in Java.
1. **Recursive Overhead**: Quicksort is indeed a recursive algorithm, and the overhead of function calls can contribute to sl... | 49,349 | [
{
"from": "human",
"value": "I'm lead to believe that quick sort should be faster than insertion sort on a medium size unorderd int array. I've implemented both algorithms in java and I notice quicksort is significantly slower then insertion sorrt. \nI have a theory: quiksort is being slower because it's ... |
I had two domains for ex. domain1 and domain2, I am opening domain2/index.aspx page as popup from domain1/default.aspx page. While closing domain2 page i need to reload the domain1 page, i had given the javascript code as "Opener.Location.Reload();". I am getting Permission denied javascript error. Any ideas about this... | The issue you're encountering stems from the same-origin policy, a security measure implemented by web browsers to prevent scripts on one origin (domain) from interacting with resources from another origin. Since you are trying to access and manipulate the window object of `domain1` from a popup of `domain2`, the brows... | 46,595 | [
{
"from": "human",
"value": "I had two domains for ex. domain1 and domain2, I am opening domain2/index.aspx page as popup from domain1/default.aspx page. While closing domain2 page i need to reload the domain1 page, i had given the javascript code as \"Opener.Location.Reload();\". I am getting Permission de... |
I have XML files in a directory that I wish to get over to a webservice on a server that will validate them and return a true/false as to whether they are valid in construct and values etc.
Reason for server side processing is that the validation rules may change from time to time and need to adjust in one place as opp... | To validate XML files against a web service in a way that allows for easy updates to validation rules, you have a few options in .NET 3.0. Here’s a step-by-step approach that covers the main points:
### 1. Web Service Design
You should create a web service (ASMX, WCF, or REST) that will handle the validation of the XM... | 46,703 | [
{
"from": "human",
"value": "I have XML files in a directory that I wish to get over to a webservice on a server that will validate them and return a true/false as to whether they are valid in construct and values etc.\nReason for server side processing is that the validation rules may change from time to t... |
What are the benefits of PHP's CLI over other scripting languages/environments such as VBScript or even windows scripting?
| PHP's Command Line Interface (CLI) offers several advantages over other scripting languages/environments such as VBScript and Windows scripting. Here are some key benefits:
1. **Cross-Platform Compatibility**: PHP is inherently cross-platform and can run on various operating systems including Windows, Linux, and macOS... | 47,816 | [
{
"from": "human",
"value": "What are the benefits of PHP's CLI over other scripting languages/environments such as VBScript or even windows scripting?\n"
},
{
"from": "gpt",
"value": "PHP's Command Line Interface (CLI) offers several advantages over other scripting languages/environments such a... |
Among the known limitations of Joe Celko's nested sets (modified pre-order traversal) is marked degredation in performance as the tree grows to a large size.
Vadim Tropashko proposed nested intervals, and provides examples and theory explanation in this paper: http://arxiv.org/html/cs.DB/0401014
Is this a viable soluti... | Vadim Tropashko's nested intervals model offers a way to represent hierarchical data structures with better performance characteristics than traditional nested sets, particularly for larger trees. The nested intervals technique allows for efficient queries and modifications while avoiding some of the performance pitfal... | 47,029 | [
{
"from": "human",
"value": "Among the known limitations of Joe Celko's nested sets (modified pre-order traversal) is marked degredation in performance as the tree grows to a large size.\nVadim Tropashko proposed nested intervals, and provides examples and theory explanation in this paper: http://arxiv.org/... |
I have to present some 'process' or 'flow' of the application at work on friday. I was hoping to prepare a flow chart before I begin the hands on demo.
Any suggestions for freeware sw to make simple flowcharts on Windows?
| There are several freeware options available for creating simple flowcharts on Windows. Here are some popular choices:
1. **Lucidchart**: While it has a paid version, Lucidchart also offers a free tier that allows you to create flowcharts and other diagrams online. It's user-friendly and supports collaborative work.
... | 49,937 | [
{
"from": "human",
"value": "I have to present some 'process' or 'flow' of the application at work on friday. I was hoping to prepare a flow chart before I begin the hands on demo. \nAny suggestions for freeware sw to make simple flowcharts on Windows?\n"
},
{
"from": "gpt",
"value": "There are... |
Edit: Warning - I now realize that the following technique is generally regarded as a bad idea because it creates hidden dependencies for the sake of looking neat.
I recently discovered that you can use the StackTrace to infer information about the caller of a method.
This enables you to create a seemingly "cool" API ... | Yes, using the StackTrace to infer information about the caller of a method is generally considered a bad practice, and here are several reasons why:
1. **Hidden Dependencies**: As you noted, using StackTrace creates hidden dependencies. When a method's behavior is influenced by its caller's context without any explic... | 48,015 | [
{
"from": "human",
"value": "Edit: Warning - I now realize that the following technique is generally regarded as a bad idea because it creates hidden dependencies for the sake of looking neat.\n\nI recently discovered that you can use the StackTrace to infer information about the caller of a method.\nThis e... |
I find myself running scripts and copy-pasting the output of these runs into emails or into some other documents. Is there a way such that I can make the copy-to-clipboard step a part of the script itself? Most of my scripts are either Perl or bat files and I work on Windows.
Thanks.
| Yes, you can automate the copy-to-clipboard step in your scripts on Windows. Both Perl and batch scripts can utilize external tools or built-in Windows functionality to achieve this.
### For Batch Files
In a batch file, you can use `clip`, a built-in Windows command that takes standard input and copies it to the clipb... | 49,486 | [
{
"from": "human",
"value": "I find myself running scripts and copy-pasting the output of these runs into emails or into some other documents. Is there a way such that I can make the copy-to-clipboard step a part of the script itself? Most of my scripts are either Perl or bat files and I work on Windows. \n... |
What's the best way to pass data from one Windows Forms app (an office plugin) to another (exe written in C#) in C#?
| Passing data between two separate Windows Forms applications can be achieved in several ways. The best method depends on your specific requirements, such as the complexity of the data being transferred, the runtime environment, and whether the applications need to communicate in real-time or not. Here are some common a... | 43,399 | [
{
"from": "human",
"value": "What's the best way to pass data from one Windows Forms app (an office plugin) to another (exe written in C#) in C#? \n"
},
{
"from": "gpt",
"value": "Passing data between two separate Windows Forms applications can be achieved in several ways. The best method depend... |
I am creating a little testing component and am running into a problem
Basically the component is a decorator on a class that controls all access to the database, it creates a form with a two buttons on it: "Simulate Lost Connection" and "Reconnect". Press the button, and instead of letting function calls pass through... | To run your testing form in a different thread and ensure it stays open, you should create a new thread and run the form's message loop within that thread. In .NET, the Windows Forms API is designed to run on a single thread (the UI thread), so you'll want to create a new thread and call `Application.Run()` with your f... | 47,495 | [
{
"from": "human",
"value": "I am creating a little testing component and am running into a problem\nBasically the component is a decorator on a class that controls all access to the database, it creates a form with a two buttons on it: \"Simulate Lost Connection\" and \"Reconnect\". Press the button, and ... |
How can I migrate reports from Crystal Reports to Business Objects Enterprise?
Does anyone have any ideas, suggestions or advice?
| Migrating reports from Crystal Reports to Business Objects Enterprise (BOE) can be a complex task, but with careful planning and execution, it can be accomplished efficiently. Here are some ideas, suggestions, and advice to help you through the process:
### 1. **Understand the Differences**
- Familiarize yourself w... | 41,696 | [
{
"from": "human",
"value": "How can I migrate reports from Crystal Reports to Business Objects Enterprise?\nDoes anyone have any ideas, suggestions or advice?\n"
},
{
"from": "gpt",
"value": "Migrating reports from Crystal Reports to Business Objects Enterprise (BOE) can be a complex task, but ... |
This is in reference to a question I asked earlier. Aside from viewing the SQL generated by NHibernate on calls to the database, what is the best way to find bottlenecks between NHibernate and the DB? In particular, I have queries that return very quickly when run directly against the database, but very slow (over 3-4x... | Identifying bottlenecks in NHibernate can indeed be challenging, especially when the SQL performs well directly against the database. Here are some methods and tools you can use to investigate performance issues and identify bottlenecks in the interaction between NHibernate and your database.
### 1. **Enable NHibernat... | 39,425 | [
{
"from": "human",
"value": "This is in reference to a question I asked earlier. Aside from viewing the SQL generated by NHibernate on calls to the database, what is the best way to find bottlenecks between NHibernate and the DB? In particular, I have queries that return very quickly when run directly again... |
We host a rather large (self written) ASP.NET website for our customers. It consists of a web service, a web site and a image serving web site, all three in their own virtual directory. The three virtual directories are together in one application pool. The pool has both memory limits (maximum virtual memory and maximu... | The issue you're encountering with your ASP.NET application pool recycling due to reaching the virtual memory limit can be challenging, especially when you observe memory usage that seems to be within acceptable limits. Here are some steps and considerations to help troubleshoot the situation:
### Memory Counters to M... | 47,602 | [
{
"from": "human",
"value": "We host a rather large (self written) ASP.NET website for our customers. It consists of a web service, a web site and a image serving web site, all three in their own virtual directory. The three virtual directories are together in one application pool. The pool has both memory ... |
I recently started facelets development, and a couple of days ago made my first useful custom tag. Now I would like to have auto-completion support in eclipse, like I have for standard taglibs like h, c and ui.
Is there any easy way (less than 30 min work) to enable tool support for custom tags?
I'm using eclipse 3.4 w... | To enable auto-completion support for custom Facelets tags in Eclipse, you can create a Tag Library Descriptor (TLD) file for your custom tags. Here’s a step-by-step guide to achieve this in less than 30 minutes:
1. **Create a TLD File**:
- In your project, create a new XML file (e.g., `mycustomtags.tld`) in the `... | 44,891 | [
{
"from": "human",
"value": "I recently started facelets development, and a couple of days ago made my first useful custom tag. Now I would like to have auto-completion support in eclipse, like I have for standard taglibs like h, c and ui.\nIs there any easy way (less than 30 min work) to enable tool suppor... |
We have an issue on our page whereby the first time a button posts back (we have ASP.NET ajax to enable partial updates) nothing happens, then on every subsequent click, the information is updated as if the previous event fired.
Here's the code for the page. The events are button clicks fired from within the table. Whi... | The issue you're experiencing with the first button click not performing the expected action and subsequent clicks behaving as intended might be related to how the server-side events are being handled and how the page state is managed.
Here are some steps and considerations to help you troubleshoot and potentially res... | 45,321 | [
{
"from": "human",
"value": "We have an issue on our page whereby the first time a button posts back (we have ASP.NET ajax to enable partial updates) nothing happens, then on every subsequent click, the information is updated as if the previous event fired.\nHere's the code for the page. The events are butt... |
I have a byte stream I need parsed into a struct, and I also need to be able to parse the struct back to a byte stream.
Below is an example of what I want where I've used BitConverter to parse the values. I hope there is a more efficient way of doing this, because my structs are HUGE!
ref struct TestStruct
{
int Te... | To efficiently serialize and deserialize a struct in C++/CLI without relying solely on `BitConverter`, you can use `Marshal` from the `System::Runtime::InteropServices` namespace. This allows you to directly manipulate the byte representation of your struct in memory, making it more efficient, especially for large stru... | 45,013 | [
{
"from": "human",
"value": "I have a byte stream I need parsed into a struct, and I also need to be able to parse the struct back to a byte stream.\nBelow is an example of what I want where I've used BitConverter to parse the values. I hope there is a more efficient way of doing this, because my structs ar... |
C++0x will allow template to take an arbitrary number of arguments. What is the best use of this feature other than implementing tuples ?
| C++11 (formerly known as C++0x) introduced variadic templates, which allow templates to accept an arbitrary number of template parameters. This feature can be utilized in various ways beyond just implementing tuples. Here are some notable applications:
1. **Type-safe Function Signatures**:
Variadic templates can be... | 46,123 | [
{
"from": "human",
"value": "C++0x will allow template to take an arbitrary number of arguments. What is the best use of this feature other than implementing tuples ?\n"
},
{
"from": "gpt",
"value": "C++11 (formerly known as C++0x) introduced variadic templates, which allow templates to accept a... |
I want to stress test a web service method by calling it several thousand times in quick succession. The method has a single string parameter that I will vary on each call.
I'm planning on writing a Powershell script to loop and call this method a number of times.
Is there a better way to do this?
| While a PowerShell script can certainly accomplish your goal of stress testing a web service by making multiple calls in quick succession, there are more robust tools designed specifically for load testing. These tools can provide more features, better performance, and easier management of the tests. Here are some alte... | 41,830 | [
{
"from": "human",
"value": "I want to stress test a web service method by calling it several thousand times in quick succession. The method has a single string parameter that I will vary on each call.\nI'm planning on writing a Powershell script to loop and call this method a number of times.\nIs there a b... |
Here's some code I saw once. Can you see what's wrong with it?
[updated]
public class ResourceManager1
{
private final String mutex = "";
Object resource = null;
public Object getResource()
{
synchronized (mutex)
{
if (resource == null)
{
resource... | The code you've posted contains a common concurrency issue related to the use of `String` as a mutex for synchronization. Specifically, both `ResourceManager1` and `ResourceManager2` are using a `String` object (`mutex`) as the lock for the `synchronized` block.
### Issues with the Code:
1. **String Interning**: In ... | 49,592 | [
{
"from": "human",
"value": "Here's some code I saw once. Can you see what's wrong with it?\n[updated]\npublic class ResourceManager1\n{\n private final String mutex = \"\";\n Object resource = null;\n\n public Object getResource()\n {\n synchronized (mutex)\n {\n if (re... |
In VB6, ActiveX DLL is listed as a project template but in VS 2005+ there is no such thing. Where is my good old ActiveX DLL template? Many thanks in advance.
| In Visual Studio 2005 and later, the concept of ActiveX DLLs has changed, and while you can still create components that function similarly, there isn’t a direct project template labeled "ActiveX DLL" as you would find in VB6.
Instead, you can create a Class Library project to achieve similar functionality. Here’s how... | 49,951 | [
{
"from": "human",
"value": "In VB6, ActiveX DLL is listed as a project template but in VS 2005+ there is no such thing. Where is my good old ActiveX DLL template? Many thanks in advance.\n"
},
{
"from": "gpt",
"value": "In Visual Studio 2005 and later, the concept of ActiveX DLLs has changed, a... |
I have a problems with 3rd dimension in MDX Query (on MS SQL Server 2005). I can use 3rd dimension in Visual Basic (I have a cube there, using browser I can make 3 dim. queries -- owing to ON PAGES). I snooped it via MS SQL Profiler (it records databases queries). But when I tried to put the query into MS SQL SERVER, o... | In Microsoft SQL Server Analysis Services (SSAS) 2005, when you create an MDX query that includes three dimensions, the results returned can indeed lead to the limitation you encountered: results cannot be displayed for cellsets with more than two axes in SQL Server Management Studio (SSMS) or other clients that do not... | 47,199 | [
{
"from": "human",
"value": "I have a problems with 3rd dimension in MDX Query (on MS SQL Server 2005). I can use 3rd dimension in Visual Basic (I have a cube there, using browser I can make 3 dim. queries -- owing to ON PAGES). I snooped it via MS SQL Profiler (it records databases queries). But when I tri... |
Does anyone know of a link to a reference on the web that contains a sample English dictionary word script, that can be used to populate a dictionary table in SQL Server?
I can handle a .txt or .csv file, or something similar.
Alternatively, I'm adding custom spellchecking functionality to my web apps...but I don't wan... | For populating a dictionary table in SQL Server, you can find various sources online that provide lists of English words in text format. Here are a couple of links where you can download word lists suitable for your needs:
1. **GitHub - English Words List**: You can find a simple list of English words in text format o... | 48,912 | [
{
"from": "human",
"value": "Does anyone know of a link to a reference on the web that contains a sample English dictionary word script, that can be used to populate a dictionary table in SQL Server?\nI can handle a .txt or .csv file, or something similar.\nAlternatively, I'm adding custom spellchecking fun... |
my ruby (on rails) class looks like:
class Foo
def self.method1
someAction
end
def self.method2
someAction
end
def someAction
//doSmth
end
end
any ideas how to make this work or achieve the same behavior some other way?
thanks!
| It looks like you're trying to define a class in Ruby (on Rails) and want to use a shared method (`someAction`) in class methods (`method1` and `method2`). However, since `someAction` is an instance method, you cannot directly call it from the class methods.
To fix this, you can either:
1. Convert `someAction` into a... | 49,454 | [
{
"from": "human",
"value": "my ruby (on rails) class looks like:\nclass Foo\n def self.method1\n someAction\n end\ndef self.method2\n someAction\n end\ndef someAction\n //doSmth\n end\nend\nany ideas how to make this work or achieve the same behavior some other way?\nthanks!\n"
},
{
"f... |
How can we avoid Master Page from posting back the whole page?
| To avoid posting back the entire page when using Master Pages in ASP.NET, you can utilize various techniques. Here are some strategies to consider:
1. **Use UpdatePanels**: ASP.NET's `UpdatePanel` control allows you to create asynchronous postbacks. By wrapping parts of your content in an `UpdatePanel`, you can refres... | 49,258 | [
{
"from": "human",
"value": "How can we avoid Master Page from posting back the whole page?\n"
},
{
"from": "gpt",
"value": "To avoid posting back the entire page when using Master Pages in ASP.NET, you can utilize various techniques. Here are some strategies to consider:\n\n1. **Use UpdatePanel... |
I am working on a graph in WPF, in each section there are thousands of points to draw. The performance for rendering this graph is horrible.
Does anyone have any experience with a filter that will represent the graph with much fewer points - similar to the way a stock graph draws itself when its zoomed out.
Thank you... | Rendering thousands of points in a WPF application can definitely lead to performance issues, especially when the rendering process is not optimized. To improve performance and represent the graph with fewer points, you can implement a technique called **data reduction** or **downsampling**. Here are a few strategies y... | 45,585 | [
{
"from": "human",
"value": "I am working on a graph in WPF, in each section there are thousands of points to draw. The performance for rendering this graph is horrible. \nDoes anyone have any experience with a filter that will represent the graph with much fewer points - similar to the way a stock graph dr... |
Do you know a good source to learn how to design SQL solutions?
Beyond the basic language syntax, I'm looking for something to help me understand:
What tables to build and how to link them
How to design for different scales (small client APP to a huge distributed website)
How to write effective / efficient / elegant ... | Absolutely! Learning to design SQL solutions goes beyond just mastering the syntax; it requires an understanding of data modeling, database architecture, and optimization techniques. Here are some valuable resources to help you with these topics:
### Books
1. **"Database Design for Mere Mortals" by Michael J. Hernande... | 48,683 | [
{
"from": "human",
"value": "Do you know a good source to learn how to design SQL solutions?\nBeyond the basic language syntax, I'm looking for something to help me understand:\n\nWhat tables to build and how to link them\nHow to design for different scales (small client APP to a huge distributed website)\n... |
I have the following problem: Multithreaded WPF application, Model View Presenter Implementation. Presenters and Views that belong together are created by a factory on a separate thread and should get a separate Dispatcher.
Public Function CreatePresenter(Of T As {New, Class})(ByVal p_eCreationOptions As eViewCreation... | Your design presents a challenge because you're trying to manage multithreading and inter-thread communication in a WPF application using the Model-View-Presenter (MVP) pattern. The goal is to ensure that your presenters can operate independently in their own threads while being able to interact seamlessly with their c... | 44,444 | [
{
"from": "human",
"value": "I have the following problem: Multithreaded WPF application, Model View Presenter Implementation. Presenters and Views that belong together are created by a factory on a separate thread and should get a separate Dispatcher. \nPublic Function CreatePresenter(Of T As {New, Class})... |
In the unmanaged development world, you could observe the DWORD return value of a method by typing '@eax' into the watch window of the debugger.
Does anyone know of an equivalent shortcut in managed code?
Related point: I have learned that VS2008 SP1 supports $exception as a magic word in the watch window. Are there a... | In managed code, particularly when using Visual Studio and the .NET framework, there isn't a direct equivalent to the unmanaged `@eax` for observing method return values. However, you can use some debugging techniques and features to achieve similar results.
1. **Use Immediate Window**: You can evaluate expressions an... | 49,579 | [
{
"from": "human",
"value": "In the unmanaged development world, you could observe the DWORD return value of a method by typing '@eax' into the watch window of the debugger.\nDoes anyone know of an equivalent shortcut in managed code?\nRelated point: I have learned that VS2008 SP1 supports $exception as a m... |
I want to create an iphone application that is able to post the data to a website database which is using MySQL. Can anyone give some hints?
| Creating an iPhone application that posts data to a website database using MySQL involves several components. Here are some key steps and considerations to help you get started:
### 1. **Define Your Application Requirements**
- Determine what kind of data your app will collect and send.
- Decide how users will i... | 44,349 | [
{
"from": "human",
"value": "I want to create an iphone application that is able to post the data to a website database which is using MySQL. Can anyone give some hints?\n"
},
{
"from": "gpt",
"value": "Creating an iPhone application that posts data to a website database using MySQL involves sev... |
I have a plain text file looking like this:
"some
text
containing
line
breaks"
I'm trying to talk excel 2004 (Mac, v.11.5) into opening this file correctly. I'd expect to see only one cell (A1) containing all of the above (without the quotes)...
But alas, I can't make it happen, because Excel seems to insi... | In Excel 2004 for Mac, you are correct that the application does not give you a straightforward way to customize the row delimiter for opening text files. Unfortunately, the behavior you are experiencing—where line breaks are treated as row delimiters—is a limitation of that version of Excel.
Here are a few potential ... | 46,613 | [
{
"from": "human",
"value": "I have a plain text file looking like this:\n\"some \n text \n containing \n line \n breaks\"\n\nI'm trying to talk excel 2004 (Mac, v.11.5) into opening this file correctly. I'd expect to see only one cell (A1) containing all of the above (without the quotes)...\nBut alas, ... |
I need to update a record in a database with the following fields
[ID] int (AutoIncr. PK)
[ScorerID] int
[Score] int
[DateCreated] smalldatetime
If a record exists for todays date (only the date portion should be checked, not the time) and a given scorer, I'd like to update the score value for this guy and this day. ... | You can achieve this by using a combination of an `IF EXISTS` statement or a `MERGE` statement. However, since you're looking for a single SQL statement and considering that you want to check for an existing record based on the date and scorer, using a `MERGE` statement is a clean way to handle both the update and inse... | 46,598 | [
{
"from": "human",
"value": "I need to update a record in a database with the following fields \n[ID] int (AutoIncr. PK)\n[ScorerID] int\n[Score] int\n[DateCreated] smalldatetime\n\nIf a record exists for todays date (only the date portion should be checked, not the time) and a given scorer, I'd like to upd... |
I need some help with jQuery script again :-) Just trying to play with jQuery..I use script below for coloring options of select element. It works in pure html, but in my asp.net 2.0 (Master + Content pages) does not. Script is placed in Head section.
function pageLoad(){
var allOddSelectOption = "select option:od... | It looks like you are trying to apply styles to the odd options of a `<select>` element using jQuery, but there are a few things to correct in your code:
1. The `evenStyle` variable needs to be set without quotes around the properties. You should use an object or a string without quotes around the property values.
2. ... | 48,233 | [
{
"from": "human",
"value": "I need some help with jQuery script again :-) Just trying to play with jQuery..I use script below for coloring options of select element. It works in pure html, but in my asp.net 2.0 (Master + Content pages) does not. Script is placed in Head section.\nfunction pageLoad(){\n ... |
If I have a clone of a git repository as a cached copy on a remote server for capistrano/vlad style deployment, is it better to do A)
git archive --format=tar origin/master | (cd #{destination} && tar xf -)
or B)
cp -R cached-copy #{destination} && rm -Rf #{destination}/.git
To clarify, the repository is already on ... | Both approaches have their pros and cons, and the best choice can depend on your specific use case, but let's evaluate both options:
### Option A: Using `git archive`
```bash
git archive --format=tar origin/master | (cd #{destination} && tar xf -)
```
**Pros:**
- **Clean state**: This method will create a clean vers... | 46,887 | [
{
"from": "human",
"value": "If I have a clone of a git repository as a cached copy on a remote server for capistrano/vlad style deployment, is it better to do A) \ngit archive --format=tar origin/master | (cd #{destination} && tar xf -)\n\nor B)\ncp -R cached-copy #{destination} && rm -Rf #{destination}/.g... |
I'm using a third-party library which accesses fonts through the GraphicsEnvironment: getAllFonts() call. This includes fonts in font registries belonging to both the JRE and the operating system.
But on client machines that connect to our server I will likely not be able to install fonts into either of these locations... | In earlier versions of Java that do not support the functionality you might find in more recent versions, there are some workarounds that could help you make additional fonts available to your application, although there are limitations to what can be achieved without modifying the JRE or the library you're using direc... | 47,988 | [
{
"from": "human",
"value": "I'm using a third-party library which accesses fonts through the GraphicsEnvironment: getAllFonts() call. This includes fonts in font registries belonging to both the JRE and the operating system.\nBut on client machines that connect to our server I will likely not be able to in... |
I have a very standard Gridview, with Edit and Delete buttons auto-generated.
It is bound to a tableadapter which is linked to my RelationshipTypes table.
dbo.RelationshipTypes:
ID, Name, OriginConfigTypeID, DestinationConfigTypeID
I wish to use a label that will pull the name from the ConfigTypes table, using the Ori... | To achieve your goal of editing and deleting records in a `GridView` while also pulling names from the `ConfigTypes` table using the `OriginConfigTypeID` and `DestinationConfigTypeID`, you are indeed on the right track, but you will need to implement a few additional steps.
Here is a structured approach to solve your ... | 40,754 | [
{
"from": "human",
"value": "I have a very standard Gridview, with Edit and Delete buttons auto-generated.\nIt is bound to a tableadapter which is linked to my RelationshipTypes table.\ndbo.RelationshipTypes:\nID, Name, OriginConfigTypeID, DestinationConfigTypeID\n\nI wish to use a label that will pull the ... |
Is it possible for me to see the amount of processor usage (% of maximum) that the current, python, app is using?
Scenario:
My host will allow me to run my app as long as it does not consume more then X% of the CPU power, so I would like it to 'keep an eye on itself' and slowdown. So how can I know how much CPU the a... | Yes, it is possible to monitor the CPU usage of a Python application on both Unix-like systems (Linux, macOS) and Windows. You can accomplish this using the `psutil` library, which is a cross-platform library for accessing system and process information.
### Installation
First, ensure you have the `psutil` library i... | 46,792 | [
{
"from": "human",
"value": "Is it possible for me to see the amount of processor usage (% of maximum) that the current, python, app is using?\nScenario: \nMy host will allow me to run my app as long as it does not consume more then X% of the CPU power, so I would like it to 'keep an eye on itself' and slow... |
In a multi-server environment, users will be able to use a page to put, update or delete files on the servers. I was considering using a webservice (on each server) called by the IIS thread to do that work (with an aspx management page).
However, for obvious reasons, I don't really want anyone to be able to call that w... | To secure your web service and ensure that only your management page can access it while preventing unauthorized access, consider implementing one or more of the following strategies:
### 1. API Key
- **Implementation**: Generate a secret API key that is hardcoded in your management page. When making requests to the w... | 46,524 | [
{
"from": "human",
"value": "In a multi-server environment, users will be able to use a page to put, update or delete files on the servers. I was considering using a webservice (on each server) called by the IIS thread to do that work (with an aspx management page).\nHowever, for obvious reasons, I don't re... |
What I'm looking for looks like this in jQuery:
jQuery.ajaxSetup({
'beforeSend': function(xhr) {
xhr.setRequestHeader("Accept", "text/javascript");
}
});
...
$("#my_form").submit({
$.post($(this).attr("action", $(this).serialize(), null, "script");
return false;
});
Then, when my server returns some Javasc... | To achieve a similar effect in Dojo as you have in jQuery, you'll want to make sure you can set custom request headers to inform your server about the expected response format. In Dojo, you can set request headers using the `headers` property of the `xhrGet` method.
Here's an example of how you can structure your code... | 49,621 | [
{
"from": "human",
"value": "What I'm looking for looks like this in jQuery:\njQuery.ajaxSetup({\n 'beforeSend': function(xhr) {\n xhr.setRequestHeader(\"Accept\", \"text/javascript\");\n }\n});\n...\n$(\"#my_form\").submit({\n $.post($(this).attr(\"action\", $(this).serialize(), null, \"script\");\n ... |
I've read Rick Strahl's article on Linq to SQL DataContext Lifetime Management hoping to find some answers on how I would manage my .dbml files since they are so closely related to DataContext. Unfortunately, Rick's article seems to be focused on DataContext lifetime at runtime though, and my question is concerned wit... | Managing `.dbml` files in a LINQ to SQL project is an important aspect of maintaining a clean architecture and ensuring ease of development. While it might be tempting to consolidate everything into a single `.dbml` file for simplicity, there are several best practices and considerations that can help you decide when t... | 47,651 | [
{
"from": "human",
"value": "I've read Rick Strahl's article on Linq to SQL DataContext Lifetime Management hoping to find some answers on how I would manage my .dbml files since they are so closely related to DataContext. Unfortunately, Rick's article seems to be focused on DataContext lifetime at runtime... |
I'm trying to produce a pretty simple XML schema for an XML similar to the following:
<messages>
<item>
<important_tag></important_tag>
</item>
<item>
<important_tag></important_tag>
<tag2></tag2>
</item>
<item>
<tag2></tag2>
<tag3></tag3>
</item>
</messages>
The idea is that <important... | To create an XML Schema Definition (XSD) that meets your requirements while avoiding ambiguity, you can adjust your schema as follows:
1. Instead of trying to mix the specific `important_tag` with the `xs:any` element directly within the sequence of the `item`, use a combination of a `choice` construct or an `all` con... | 48,638 | [
{
"from": "human",
"value": "I'm trying to produce a pretty simple XML schema for an XML similar to the following:\n<messages>\n <item>\n <important_tag></important_tag>\n </item>\n <item>\n <important_tag></important_tag>\n <tag2></tag2>\n </item>\n <item>\n <tag2></tag2>\n <tag3></tag3... |
How is possible to set some special column values when update/insert entities via NHibernate without extending domain classes with special properties?
For example: in my case I would like to get object and just moment before update/insert db add to that object some additional information (like user id or computer name)... | To achieve the goal of adding additional information (like computer name and user ID) to a database table in NHibernate without modifying your original domain objects or their mappings, you can use an `IInterceptor` in conjunction with the `OnSave` and `OnFlushDirty` methods.
Here's a step-by-step guide to implementi... | 42,735 | [
{
"from": "human",
"value": "How is possible to set some special column values when update/insert entities via NHibernate without extending domain classes with special properties?\nFor example: in my case I would like to get object and just moment before update/insert db add to that object some additional i... |
My company makes its money off of a great user experience using IE6, 7, Firefox and Safari. 90% of our traffic ends up IE and probably 60% of that traffic is still IE6. IE6 has a bunch of known gotcha's such as accessing DOM objects while they are still being inserted crashing the browser. Almost none of these issue... | Ensuring compatibility with outdated browsers like IE6 and IE7, especially when dealing with known issues and timing race conditions, can be quite challenging. Here are some strategies and tools you can employ to identify and mitigate issues that may lead to crashes in these browsers:
### 1. **Automated Testing with L... | 47,513 | [
{
"from": "human",
"value": "My company makes its money off of a great user experience using IE6, 7, Firefox and Safari. 90% of our traffic ends up IE and probably 60% of that traffic is still IE6. IE6 has a bunch of known gotcha's such as accessing DOM objects while they are still being inserted crashing... |
In a Sharepoint WebPart written in c# I need to find out either the ID of the current users MySite, or check if the current site is the users MySite.
Ideas?
| In SharePoint, you can determine whether the current site is a user's MySite or retrieve the MySite ID of the current user through the SharePoint Client Object Model or Server Object Model. Below are approaches for both methods.
### Using Server Object Model
If you're working within a server-side WebPart, you can use... | 36,745 | [
{
"from": "human",
"value": "In a Sharepoint WebPart written in c# I need to find out either the ID of the current users MySite, or check if the current site is the users MySite.\nIdeas?\n"
},
{
"from": "gpt",
"value": "In SharePoint, you can determine whether the current site is a user's MySite... |
I have a number of solutions with a large number of projects in them. I would like to be able to define global settings for the solution that are used by all projects. For example an include directory. I want to be able to change the include directory in one place for all projects in the solutions.
When I searched for... | To manage global settings for multiple projects within a solution in Visual Studio, you can use a combination of a property sheet and solution-level configuration management. Here are a few approaches you might consider:
### 1. Use a Common Property Sheet
Although property sheets (`.props` files) are typically associ... | 48,318 | [
{
"from": "human",
"value": "I have a number of solutions with a large number of projects in them. I would like to be able to define global settings for the solution that are used by all projects. For example an include directory. I want to be able to change the include directory in one place for all projec... |
Summary: I'm able to compile a RAD Studio 2009 project using MSBuild on a Build Server using the RAD Studio Command Prompt, but not with a batch file. This same batch file, however, works successfully on my workstation. On the server the error returned is: MSB4057.
I'm just learning how to use MSBuild with RAD Studi... | It seems like the issue you're encountering is related to the way the build server processes the batch file, particularly concerning how targets are interpreted by MSBuild. The error MSB4057 indicates that the specified target does not exist in the project file. In your case, it appears that the `Clean` target isn't re... | 48,246 | [
{
"from": "human",
"value": "Summary: I'm able to compile a RAD Studio 2009 project using MSBuild on a Build Server using the RAD Studio Command Prompt, but not with a batch file. This same batch file, however, works successfully on my workstation. On the server the error returned is: MSB4057.\nI'm just ... |
I'm building an application where I should capture several values and build a text with them: Name, Age, etc.
The output will be a plain text into a TextBox.
I am trying to make those information appear in kind of columns, therefore I am trying to separate them with tab to make it clearer.
For example, instead of havin... | To achieve a formatted output with columns using tabs in a plain text format, you can simply use the tab character (`\t`) to separate the values. When constructing your output string, you can use this character to align the values. Here's how you can do that in a few different programming languages:
### Example in Pyt... | 46,283 | [
{
"from": "human",
"value": "I'm building an application where I should capture several values and build a text with them: Name, Age, etc.\nThe output will be a plain text into a TextBox.\nI am trying to make those information appear in kind of columns, therefore I am trying to separate them with tab to mak... |
We are considering Microsoft DSL toolkit for creating some abstract designers. I already did some POCs, but would like to get some opinions on the same.
Any one here to share their experiences working with Microsoft DSL Toolkit and T4? Also, any pointers to open source DSL projects will help - Eg. Microsoft Service Fac... | The Microsoft DSL Toolkit is a powerful set of tools designed to facilitate the creation of domain-specific languages (DSLs). It's great to hear that you have already done some proof-of-concepts (POCs) and are seeking further insights into its use. Here are some thoughts and experiences related to working with the Micr... | 47,084 | [
{
"from": "human",
"value": "We are considering Microsoft DSL toolkit for creating some abstract designers. I already did some POCs, but would like to get some opinions on the same.\nAny one here to share their experiences working with Microsoft DSL Toolkit and T4? Also, any pointers to open source DSL proj... |
I am developing a prototype for a game, and certain gameplay rules are to be defined in an ini file so that the game designers can tweak the game parameters without requiring help from me in addition to a re-compile. This is what I'm doing currently:
std::ifstream stream;
stream.open("rules.ini");
if (!stream.is_open(... | When dealing with file operations in C++, especially when reading from a file, there are a few common pitfalls that can lead to the `std::ifstream` not being able to open the specified file. Here are some troubleshooting steps and suggestions that might help you resolve the issue:
1. **Check File Path**:
- Make sur... | 46,806 | [
{
"from": "human",
"value": "I am developing a prototype for a game, and certain gameplay rules are to be defined in an ini file so that the game designers can tweak the game parameters without requiring help from me in addition to a re-compile. This is what I'm doing currently:\nstd::ifstream stream;\nstre... |
I have 3 tables :
TABLE MyColumn (
ColumnId INT NOT NULL,
Label VARCHAR(80) NOT NULL,
PRIMARY KEY (ColumnId)
)
TABLE MyPeriod (
PeriodId CHAR(6) NOT NULL, -- format yyyyMM
Label VARCHAR(80) NOT NULL,
PRIMARY KEY (PeriodId)
)
TABLE MyValue (
ColumnId INT NOT NULL,
PeriodId CHAR(6) NOT NULL,
Amount DE... | Creating a dynamic pivot in LINQ is a bit challenging since LINQ does not natively support dynamic properties. However, we can achieve a similar effect by using a combination of grouping, creating a dictionary, and then constructing the desired output.
Here’s a conceptual approach to achieve a dynamic pivot where the ... | 48,127 | [
{
"from": "human",
"value": "I have 3 tables :\nTABLE MyColumn (\n ColumnId INT NOT NULL,\n Label VARCHAR(80) NOT NULL,\n PRIMARY KEY (ColumnId)\n)\n\nTABLE MyPeriod (\n PeriodId CHAR(6) NOT NULL, -- format yyyyMM\n Label VARCHAR(80) NOT NULL,\n PRIMARY KEY (PeriodId)\n)\n\nTABLE MyValue (\n ColumnId... |
As a developer, I've learned that I usually gain a better understanding of best/worst practices through experience. The area of web application security isn't really somewhere where my organization can afford to let developers learn through trial and error.
So looking for a hands-on approach to knowledge sharing of ... | Yes, there are several open-source projects designed specifically to help developers learn about web application security by exposing common vulnerabilities. These applications often provide a hands-on approach to understanding security issues. Here are some popular options:
1. **OWASP Juice Shop**:
- The OWASP Jui... | 45,398 | [
{
"from": "human",
"value": "As a developer, I've learned that I usually gain a better understanding of best/worst practices through experience. The area of web application security isn't really somewhere where my organization can afford to let developers learn through trial and error. \nSo looking for a ... |
What's the best way to programmatically start an application on login for Windows? I know you can do it by adding an item to the startup folder in the start menu, but I want to have an option in my application to turn it off and on.
| To programmatically manage whether your application starts on login for Windows, you can manipulate the Windows Registry or create a shortcut in the Startup folder. Here's how you can achieve both methods:
### Method 1: Modify the Windows Registry
You can add or remove a registry key in the `HKEY_CURRENT_USER\Softwar... | 48,262 | [
{
"from": "human",
"value": "What's the best way to programmatically start an application on login for Windows? I know you can do it by adding an item to the startup folder in the start menu, but I want to have an option in my application to turn it off and on.\n"
},
{
"from": "gpt",
"value": "T... |
When we run a update query we get prompt saying that 'these many records are going to be updated. do you want to continue' is it possible to capture the value in the prompt message to a variable i.e the number of records going to be updated.
| Yes, it is possible to capture the number of records that will be updated by an SQL query before actually executing the update command. However, the method for doing this will depend on the specific database system you are using (e.g., MySQL, SQL Server, PostgreSQL, Oracle, etc.).
Here are some general approaches for... | 48,483 | [
{
"from": "human",
"value": "When we run a update query we get prompt saying that 'these many records are going to be updated. do you want to continue' is it possible to capture the value in the prompt message to a variable i.e the number of records going to be updated.\n"
},
{
"from": "gpt",
"v... |
It is possible because PageRank was a form of eigenvalue and that is why MapReduce introduced. But there seems problems in actual implementation, such as every slave computer have to maintain a copy of the matrix?
| You're touching on a few interesting points regarding PageRank, its connection to linear algebra (specifically eigenvalues and eigenvectors), and the use of MapReduce for its computation. Let's clarify some of these concepts:
### PageRank and Eigenvalues
PageRank is an algorithm developed by Larry Page and Sergey Brin... | 49,168 | [
{
"from": "human",
"value": "It is possible because PageRank was a form of eigenvalue and that is why MapReduce introduced. But there seems problems in actual implementation, such as every slave computer have to maintain a copy of the matrix?\n"
},
{
"from": "gpt",
"value": "You're touching on a... |
I want to show a modeless dialog on the screen and display some information in it.
However if I use it the following way, it has some problems:
function()
{
showdialog(XXX).
//heavy work.
update the dialog..
//heavy work.
update the dialog...
}
It seems the dialog displayed, but it does not draw any information in it.... | When you're working with UI updates in most programming environments, particularly in a single-threaded context (like JavaScript in a web browser or desktop applications using certain frameworks), long-running tasks can block the UI thread. This means that even though you call to show a modeless dialog, the UI won't re... | 48,387 | [
{
"from": "human",
"value": "I want to show a modeless dialog on the screen and display some information in it.\nHowever if I use it the following way, it has some problems:\nfunction()\n{\nshowdialog(XXX).\n//heavy work.\nupdate the dialog..\n//heavy work.\nupdate the dialog...\n}\n\nIt seems the dialog di... |
mod_python(?) is eating a lot of ram (about 9mb per worker process). If i open several TRAC pages at once many of them will have an error due to no ram (64mb virtual limit). if i limit the worker threads to 3 i can get by alright. Problem is if no one is accessing TRAC i have A LOT of ram being unused.
Is there a way i... | It looks like you're dealing with memory management issues with your Apache server running Mod_python and TRAC. Here are several strategies you can consider to optimize memory usage and improve the performance of your setup:
### 1. **Use a Different Deployment Setup:**
Consider using a different WSGI server like **Gun... | 44,881 | [
{
"from": "human",
"value": "mod_python(?) is eating a lot of ram (about 9mb per worker process). If i open several TRAC pages at once many of them will have an error due to no ram (64mb virtual limit). if i limit the worker threads to 3 i can get by alright. Problem is if no one is accessing TRAC i have A ... |
This is on the Mac:
If I have two filenames /foo/foo and /foo/FOO they may refer to the same file or the may be different files depending on the file system. How do I figure out if they are both pointing to the same file? And if they are, how do I get the correct representation of the filename?
My problem is caused by ... | To determine if two file paths refer to the same file in a case-sensitive or case-insensitive file system on macOS, you can use the following approach:
1. **Normalize the Paths**: Convert both paths to absolute paths to ensure they are compared in the same manner.
2. **Use `NSFileManager`**: Utilize the `NSFileManager... | 48,887 | [
{
"from": "human",
"value": "This is on the Mac:\nIf I have two filenames /foo/foo and /foo/FOO they may refer to the same file or the may be different files depending on the file system. How do I figure out if they are both pointing to the same file? And if they are, how do I get the correct representation... |
I am adding dynamically controls to page by using LoadControl and Controls.Add. I need somehow to wrap Init and Load event handlers of this loaded controls into my code. So it should be such order of events SomeMyCode() -> Control.Init() -> AnotherMyCode() and the same for Load SomeMyCode() -> Control.Load() -> Another... | To wrap the `Init` and `Load` events of dynamically loaded controls in ASP.NET, you can create a custom control that overrides the `Init` and `Load` methods. By doing this, you can add your own logic before and after the base methods are called.
Here is an example of how you can achieve this:
### Step 1: Create a Cus... | 46,180 | [
{
"from": "human",
"value": "I am adding dynamically controls to page by using LoadControl and Controls.Add. I need somehow to wrap Init and Load event handlers of this loaded controls into my code. So it should be such order of events SomeMyCode() -> Control.Init() -> AnotherMyCode() and the same for Load ... |
What is the correct syntax to create objects in javascript that will work across the majority of web browsers (by that I mean : IE 6+, Firefox 2+, Opera 9+ )
Is this valid
var a = {
"class": "Person",
"name": "William Shakespeare",
"birthday": -12802392000000,
"nickname": "Bill"
};
Or is this:
var a = {
clas... | Both syntaxes you provided for creating an object in JavaScript are valid, and they will work in the majority of web browsers, including older ones like IE 6+.
1. **Using quotes for keys**:
```javascript
var a = {
"class": "Person",
"name": "William Shakespeare",
"birthday": -12802392000000,
... | 47,359 | [
{
"from": "human",
"value": "What is the correct syntax to create objects in javascript that will work across the majority of web browsers (by that I mean : IE 6+, Firefox 2+, Opera 9+ )\nIs this valid\nvar a = {\n \"class\": \"Person\",\n \"name\": \"William Shakespeare\",\n \"birthday\": -1280239200000... |
I'm trying to come up with ways to speed up my secure web site. Because there are a lot of CSS images that need to be loaded, it can slow down the site since secure resources are not cached to disk by the browser and must be retrieved more often than they really need to.
One thing I was considering is perhaps moving st... | Moving non-sensitive resources like CSS images and JavaScript libraries to a non-secure sub-domain can be a potential solution for improving the performance of your secure website, but it comes with some considerations and potential drawbacks.
### Pros of Using Non-Secure Sub-Domain
1. **Browser Caching**: As you ment... | 48,123 | [
{
"from": "human",
"value": "I'm trying to come up with ways to speed up my secure web site. Because there are a lot of CSS images that need to be loaded, it can slow down the site since secure resources are not cached to disk by the browser and must be retrieved more often than they really need to.\nOne th... |
At my workplace I'm stuck with Visual Basic 6, but after reading the answer to
"How do I sort arrays using vbscript?" I got my hopes up, that at least some of the missing VB6 features can be supplemented by .NET features. (Different kinds of collections, mostly)
It seems, that at least some .NET classes are available ... | Using .NET classes in Visual Basic 6 (VB6) can indeed provide additional functionalities, but there are several considerations and potential pitfalls to keep in mind. Here's a breakdown of your questions and some general guidance:
### 1. **Pitfalls to Consider:**
- **.NET Installation**: As you mentioned, the target m... | 48,424 | [
{
"from": "human",
"value": "At my workplace I'm stuck with Visual Basic 6, but after reading the answer to \n\"How do I sort arrays using vbscript?\" I got my hopes up, that at least some of the missing VB6 features can be supplemented by .NET features. (Different kinds of collections, mostly)\nIt seems, t... |
How should I tell SDL to maximize the application window?
I'm creating the window with these flags: SDL_OPENGL | SDL_HWSURFACE | SDL_DOUBLEBUF | SDL_RESIZABLE.
| To maximize your SDL application window, you can use the `SDL_SetWindowFullscreen` or `SDL_SetWindowSize` functions in combination with the appropriate flags. Here's how you can do it:
### Using SDL_SetWindowFullscreen
If you want to set the window to fullscreen mode (which maximizes the window and removes the window... | 45,234 | [
{
"from": "human",
"value": "How should I tell SDL to maximize the application window?\nI'm creating the window with these flags: SDL_OPENGL | SDL_HWSURFACE | SDL_DOUBLEBUF | SDL_RESIZABLE.\n"
},
{
"from": "gpt",
"value": "To maximize your SDL application window, you can use the `SDL_SetWindowFu... |
I have a swf file that's embedded in a html page, and I have a close button in the swf page, I want the swf to disappear when I click on the button, what is the best way to do that? Thanks.
| To make an SWF file disappear when you click a button inside it, you need to establish a communication between the SWF file and the HTML page. Here’s how you can accomplish this:
### Step 1: Modify the SWF File
1. **Add ActionScript to Your SWF File**: You'll need to add ActionScript code to your SWF file that commun... | 47,041 | [
{
"from": "human",
"value": "I have a swf file that's embedded in a html page, and I have a close button in the swf page, I want the swf to disappear when I click on the button, what is the best way to do that? Thanks.\n"
},
{
"from": "gpt",
"value": "To make an SWF file disappear when you click... |
Can you recommend any resources for learning about Windows Installer?
The best book I've found is "The Definitive Guide to Windows Installer" by Phil Wilson, but it's not very beginner friendly.
I've been asked to make recommendations for those wishing to 'get up to speed' quickly and don't know what to recommend beyon... | Certainly! Learning about Windows Installer can be challenging, especially for beginners. In addition to "The Definitive Guide to Windows Installer" by Phil Wilson and the Microsoft resources you mentioned, here are some additional resources that can help users get up to speed more quickly:
### Online Documentation & ... | 42,262 | [
{
"from": "human",
"value": "Can you recommend any resources for learning about Windows Installer?\nThe best book I've found is \"The Definitive Guide to Windows Installer\" by Phil Wilson, but it's not very beginner friendly.\nI've been asked to make recommendations for those wishing to 'get up to speed' q... |
What is the best design decision for a 'top-level' class to attach to an event to a class that may be '5+ layers down in the callstack?
For example, perhaps the MainForm has spawned an object, and that object has spawned a callstack of several other object calls. The most obvious way would be to chain the event up the... | The challenge you’re facing is a common one in event-driven architectures, especially when dealing with deep object hierarchies. The two approaches you've mentioned—event chaining and the observer pattern—each have their pros and cons. Here are some additional strategies and recommendations for managing event propagati... | 42,165 | [
{
"from": "human",
"value": "What is the best design decision for a 'top-level' class to attach to an event to a class that may be '5+ layers down in the callstack?\nFor example, perhaps the MainForm has spawned an object, and that object has spawned a callstack of several other object calls. The most obvi... |
Criteria: Performance, Performance, Performance.
I need a way to convert a uint, int, etc into it's enum equivalent. What's the fastest way I can do that using C#?
| In C#, converting an integer (such as `uint` or `int`) to its corresponding enum type can be achieved quickly and efficiently. The most straightforward method is to use a cast, which is a highly performant operation. Here's how you can do it:
### Using Direct Casting
If you have an enum defined like this:
```csharp
... | 48,716 | [
{
"from": "human",
"value": "Criteria: Performance, Performance, Performance.\nI need a way to convert a uint, int, etc into it's enum equivalent. What's the fastest way I can do that using C#? \n"
},
{
"from": "gpt",
"value": "In C#, converting an integer (such as `uint` or `int`) to its corr... |
With jQuery, how do I find out which key was pressed when I bind to the keypress event?
$('#searchbox input').bind('keypress', function(e) {});
I want to trigger a submit when ENTER is pressed.
[Update]
Even though I found the (or better: one) answer myself, there seems to be some room for variation ;)
Is there a diff... | To determine which key was pressed in a `keypress` event using jQuery, you can use the `which` or `keyCode` properties of the event object (`e`). However, it's worth noting that the `keypress` event is deprecated in favor of `keydown` and `keyup` events in modern web applications. The `keydown` event is generally more ... | 48,213 | [
{
"from": "human",
"value": "With jQuery, how do I find out which key was pressed when I bind to the keypress event?\n$('#searchbox input').bind('keypress', function(e) {});\n\nI want to trigger a submit when ENTER is pressed.\n[Update]\nEven though I found the (or better: one) answer myself, there seems to... |
One thing I struggle with is planning an application's architecture before writing any code.
I don't mean gathering requirements to narrow in on what the application needs to do, but rather effectively thinking about a good way to lay out the overall class, data and flow structures, and iterating those thoughts so that... | Planning an application’s architecture before diving into code is a crucial step that can lead to better organization, maintainability, and scalability. Here’s a structured approach to help you lay out the architecture effectively:
### Steps to Plan Application Architecture
1. **Define High-Level Goals**:
- Clarif... | 45,450 | [
{
"from": "human",
"value": "One thing I struggle with is planning an application's architecture before writing any code.\nI don't mean gathering requirements to narrow in on what the application needs to do, but rather effectively thinking about a good way to lay out the overall class, data and flow struct... |
I would like to Debug .NET Mobile Device Application using multiple instances of Device Emulator. If I right click the project and go to Debug -> Start new instance in Visual Studio 2008 when an instance is already running I get the error
Unable to copy file
"obj\Debug\MyMobileApp.exe" to
"bin\Debug\MyMobileApp.e... | Running multiple instances of a mobile device application in the Visual Studio 2008 Device Emulator can be tricky due to file access conflicts. The error you're encountering indicates that Visual Studio is attempting to copy the output executable to a location where an existing instance is still running. Here are some ... | 46,161 | [
{
"from": "human",
"value": "I would like to Debug .NET Mobile Device Application using multiple instances of Device Emulator. If I right click the project and go to Debug -> Start new instance in Visual Studio 2008 when an instance is already running I get the error\n\nUnable to copy file\n \"obj\\Debug\... |
I need to tag MP3 files with a Cover Art in C#...
Is there any easy way to do this? I found UltraID3Lib as an exampel and it is great for regular ID3 tagging but I cant handle the cover art. If someone know an easy way to do this would it be great :)
| To tag MP3 files with cover art in C#, you can use the **TagLib#** library, which is a powerful and easy-to-use library for handling various multimedia file formats, including MP3 files. TagLib# provides functionality to read and write ID3 tags, including embedding cover art.
Here's a simple example of how you can use... | 47,128 | [
{
"from": "human",
"value": "I need to tag MP3 files with a Cover Art in C#...\n\nIs there any easy way to do this? I found UltraID3Lib as an exampel and it is great for regular ID3 tagging but I cant handle the cover art. If someone know an easy way to do this would it be great :)\n"
},
{
"from": "... |
According to HTML specs, the select tag in HTML doesn't have a readonly attribute, only a disabled attribute. So if you want to keep the user from changing the dropdown, you have to use disabled.
The only problem is that disabled HTML form inputs don't get included in the POST / GET data.
What's the best way to emulate... | To emulate a `readonly` attribute for a `<select>` tag while ensuring that the value is still included in the form submission, you can use a combination of JavaScript and a hidden input field. This approach allows you to visually indicate that the dropdown is not editable while still passing the value when the form is ... | 45,664 | [
{
"from": "human",
"value": "According to HTML specs, the select tag in HTML doesn't have a readonly attribute, only a disabled attribute. So if you want to keep the user from changing the dropdown, you have to use disabled.\nThe only problem is that disabled HTML form inputs don't get included in the POST ... |
I am (unfortunately) developing an application in Excel 2000 VBA. I believe I have discovered that any error raised within a Custom Class property, function, or sub debugs as if the error were raised at the point in the VBA code where the property is called. That is, the VBE debugger does not take me to the point in ... | What you're experiencing in Excel 2000 VBA is indeed a known quirk of how error handling works in VBA, particularly with custom classes. When an error is raised in a class property, function, or method, the VBA IDE will not always accurately reflect the point of failure in the code. Instead, it typically indicates the ... | 49,485 | [
{
"from": "human",
"value": "I am (unfortunately) developing an application in Excel 2000 VBA. I believe I have discovered that any error raised within a Custom Class property, function, or sub debugs as if the error were raised at the point in the VBA code where the property is called. That is, the VBE d... |
With ASP.NET 3.5 I can easily bind to an XML file by using an XmlDataSource.
How can I bind to an XML string instead of a file?
| In ASP.NET 3.5, while the `XmlDataSource` is primarily designed to work with XML files or URLs, you can still bind it to an XML string by using a `StringReader` along with an `XmlDocument` or `XDocument`. However, `XmlDataSource` does not support binding directly to an XML string. Therefore, you need to employ a differ... | 45,421 | [
{
"from": "human",
"value": "With ASP.NET 3.5 I can easily bind to an XML file by using an XmlDataSource.\nHow can I bind to an XML string instead of a file?\n"
},
{
"from": "gpt",
"value": "In ASP.NET 3.5, while the `XmlDataSource` is primarily designed to work with XML files or URLs, you can s... |
What exactly do *args and **kwargs mean?
According to the Python documentation, from what it seems, it passes in a tuple of arguments.
def foo(hello, *args):
print(hello)
for each in args:
print(each)
if __name__ == '__main__':
foo("LOVE", ["lol", "lololol"])
This prints out:
LOVE
['lol', 'lololo... | In Python, `*args` and `**kwargs` are used in function definitions to allow for variable numbers of arguments. They are quite useful for creating functions that can take an arbitrary number of inputs.
### What They Are:
- `*args`: This allows a function to accept a variable number of non-keyword arguments. The argum... | 47,058 | [
{
"from": "human",
"value": "What exactly do *args and **kwargs mean?\nAccording to the Python documentation, from what it seems, it passes in a tuple of arguments.\ndef foo(hello, *args):\n print(hello)\n\n for each in args:\n print(each)\n\nif __name__ == '__main__':\n foo(\"LOVE\", [\"lol... |
I can't seem to be able to disable a select box when the select tag is not nested inside a form tag. Some things I tried are (using Firefox 3):
(via Jquery)
$("#mySelect").attr("disabled", true);
$("#mySelect").attr("disabled", "disabled");
(also)
document.getElementById('mySelect').disabled = true;
document.getEleme... | No, you do not need to place a `<select>` box inside a `<form>` element in order to disable it. Your attempts to disable the select box using jQuery and plain JavaScript are correct. The issue might be related to when you're trying to disable the select box in relation to when the script is executed.
Here are a few th... | 48,829 | [
{
"from": "human",
"value": "I can't seem to be able to disable a select box when the select tag is not nested inside a form tag. Some things I tried are (using Firefox 3):\n(via Jquery)\n$(\"#mySelect\").attr(\"disabled\", true);\n$(\"#mySelect\").attr(\"disabled\", \"disabled\");\n\n(also)\ndocument.getE... |
When I try to connect to WMI from Powershell, ConfigMgr, or WMI explorer, I can talk to the majority of my computers, but some (maybe 30%?) return an 0x800706ba (RPC server is unavailable).
If I turn the firewall off on the remote machine, the queries start working. I have tried a bunch of different configurations of ... | The error code `0x800706ba` (RPC server is unavailable) generally indicates that there are network connectivity issues or that the necessary ports and services required for WMI queries are blocked by the firewall on the remote machine. Since you've noticed that turning off the firewall resolves the issue, we can infer ... | 46,341 | [
{
"from": "human",
"value": "When I try to connect to WMI from Powershell, ConfigMgr, or WMI explorer, I can talk to the majority of my computers, but some (maybe 30%?) return an 0x800706ba (RPC server is unavailable).\nIf I turn the firewall off on the remote machine, the queries start working. I have tri... |
When I compile my project in Dev C++ how can I get information displayed on the summary page of the exe properties in windows?
I have tried using the "Version Info" tab in project properties with no luck.
| To include version information in your compiled executable's properties in Windows using Dev C++, you need to create a resource file (.rc) that defines the version information. Here’s a step-by-step guide on how to do that:
### Step 1: Create a Resource File
1. **Open Dev C++**: Launch your Dev C++ IDE.
2. **Create a... | 47,296 | [
{
"from": "human",
"value": "When I compile my project in Dev C++ how can I get information displayed on the summary page of the exe properties in windows?\nI have tried using the \"Version Info\" tab in project properties with no luck.\n"
},
{
"from": "gpt",
"value": "To include version informa... |
Someone just sent me a decompile of a program into C. It was a very good decompile, producing nice, mostly readabe C code (if you overlook the fact that none of the variables or functions had a human-readable name) that mostly looked like it would actually compile.
There was one big problem, though. I happen to know ... | Decompiling Delphi applications can indeed be challenging due to the language's unique features and runtime behavior. As of my last knowledge update in October 2023, there are a few tools available that are more tailored to Delphi, though results may vary based on the complexity of the code being decompiled. Here are s... | 49,768 | [
{
"from": "human",
"value": "Someone just sent me a decompile of a program into C. It was a very good decompile, producing nice, mostly readabe C code (if you overlook the fact that none of the variables or functions had a human-readable name) that mostly looked like it would actually compile.\nThere was o... |
I was mildly surprised recently to discover that my carefully crafted xml comments weren't showing up in intellisense for my colleagues. Having always used the associated assemblies with project references, I hadn't realised that you had to export the .xml document as well to access this information.
This led me to won... | IntelliSense in .NET works by providing not just metadata from assemblies but also additional documentation that comes from XML documentation comments. Here's a breakdown of how this all works and how you can achieve similar functionality for your own assemblies:
### How IntelliSense Works with .NET Framework
1. **XM... | 46,761 | [
{
"from": "human",
"value": "I was mildly surprised recently to discover that my carefully crafted xml comments weren't showing up in intellisense for my colleagues. Having always used the associated assemblies with project references, I hadn't realised that you had to export the .xml document as well to ac... |
Using TeamCity, I'm trying to get a (TestAutomationFX) test that requires an STA thread to run .
It works via a custom app.config that configures NUnit 2.4.x (8) (as referred to by Gishu, thanks, described at http://madcoderspeak.blogspot.com/2008/12/getting-nunit-to-go-all-sta.html)
It works via:
/// <summary>
/// Via... | You’re correct that TeamCity uses specific versions of NUnit, and in your case, it seems you are running into compatibility issues between NUnit versions and the specific features you need, like the `RequiresSTAAttribute`.
### Possible Solutions
1. **Use a Compatible NUnit Version**:
Make sure you are using a vers... | 49,966 | [
{
"from": "human",
"value": "Using TeamCity, I'm trying to get a (TestAutomationFX) test that requires an STA thread to run .\nIt works via a custom app.config that configures NUnit 2.4.x (8) (as referred to by Gishu, thanks, described at http://madcoderspeak.blogspot.com/2008/12/getting-nunit-to-go-all-sta... |
I have an unusual situation to model in a MS SQL Server database: the primary key of a table is a multi-segment 'natural' key composed of 5 foreign keys (of fixed sizes).
I'd like to be able to define a user-defined data type to implement the data structure based on a CHAR(8) primitive in such a way that the elements a... | In SQL Server, creating a user-defined type (UDT) that acts as a composite key with addressable segments is not natively supported as you described. However, you can achieve similar functionality with a combination of table structure design and computed columns to extract individual segments. Here's a structured approa... | 46,238 | [
{
"from": "human",
"value": "I have an unusual situation to model in a MS SQL Server database: the primary key of a table is a multi-segment 'natural' key composed of 5 foreign keys (of fixed sizes).\nI'd like to be able to define a user-defined data type to implement the data structure based on a CHAR(8) p... |
Now I know that bigint is 2^64; that is, more atoms than there are in the known universe. I shouldn't be worried, as my mere human brain simply can't get around the enormity of that number.
However, let's say that I record every change to every category, product and order in my system, from launch until the end of tim... | You've raised some interesting questions about data storage and performance in relation to big integers and event logging systems. Let's break down your concerns one by one:
### 1. **Concerns about Running Out of Primary Key Values (BigInt)**:
- **BigInt Capacity**: As you've mentioned, a `BIGINT` in most databases ca... | 48,088 | [
{
"from": "human",
"value": "Now I know that bigint is 2^64; that is, more atoms than there are in the known universe. I shouldn't be worried, as my mere human brain simply can't get around the enormity of that number.\nHowever, let's say that I record every change to every category, product and order in m... |
I am stuck on this problem which I am studying for an exam tomorrow. (I understand the concept of virtual vs. physical addresses, page frames, address bus, etc.)
If you're using 4K pages with 128K of RAM and a 32 bit address bus, how large could a virtual address be? How many regular page frames could you have?
EDIT: ... | Let's break this down step by step.
### 1. Maximum Size of Virtual Address Space
Given that you have a 32-bit address bus, the maximum size of a virtual address space can be calculated as follows:
- A 32-bit address can address \( 2^{32} \) unique addresses.
Therefore, the maximum size of the virtual address space ... | 48,125 | [
{
"from": "human",
"value": "I am stuck on this problem which I am studying for an exam tomorrow. (I understand the concept of virtual vs. physical addresses, page frames, address bus, etc.)\nIf you're using 4K pages with 128K of RAM and a 32 bit address bus, how large could a virtual address be? How many ... |
I have form with 2 DDL named
State and City
State:
<asp:UpdatePanel ID="States" runat="server" UpdateMode="Conditional">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="States"EventName="SelectedIndexChanged" />
</Triggers>
<ContentTemplate>
<asp:DropDownList ID="States" ... | When you're using an `UpdatePanel` with an `AsyncPostBackTrigger` in ASP.NET Web Forms, it's important to ensure that the control you're trying to update is within the same `UpdatePanel`, or that you're properly managing the control's state and re-binding data as necessary.
In your case, since you're attempting to pop... | 46,736 | [
{
"from": "human",
"value": "I have form with 2 DDL named\nState and City\nState:\n<asp:UpdatePanel ID=\"States\" runat=\"server\" UpdateMode=\"Conditional\">\n <Triggers>\n <asp:AsyncPostBackTrigger ControlID=\"States\"EventName=\"SelectedIndexChanged\" />\n </Triggers>\n <C... |
I am building a search box (input field) which should make a server call to filter a grid with the text being inserted on it but I need to make this in an smart way, I need to fire the server call only if the user has stopped.
Right now I'm trying to implement it, but if someone knows how to do it I'll be very pleased... | Hi Jaime,
It sounds like you're looking for a way to implement a "debounce" functionality for your search input. Debouncing will ensure that you only make the server call after the user has stopped typing for a specified amount of time, which can reduce the number of requests and improve performance.
Here’s a basic i... | 44,455 | [
{
"from": "human",
"value": "I am building a search box (input field) which should make a server call to filter a grid with the text being inserted on it but I need to make this in an smart way, I need to fire the server call only if the user has stopped. \nRight now I'm trying to implement it, but if someo... |
JavaScript does funky automatic conversions with objects:
var o = {toString: function() {return "40"; }};
print(o + o);
print((o+1)+o);
print((o*2) + (+o));
will print:
4040
40140
120
This is because +, if any of the arguments are objects/strings, will try to convert all the arguments to strings then concatenate them... | In JavaScript, the `++` operator behaves similarly to the `+` operator with respect to type coercion, but with a few distinctions in how it processes values.
When you use the `++` operator on an object, JavaScript tries to convert that object to a number using the following steps:
1. **Calls `valueOf()`**: It first t... | 48,450 | [
{
"from": "human",
"value": "JavaScript does funky automatic conversions with objects:\nvar o = {toString: function() {return \"40\"; }};\nprint(o + o);\nprint((o+1)+o);\nprint((o*2) + (+o));\n\nwill print:\n4040\n40140\n120\n\nThis is because +, if any of the arguments are objects/strings, will try to conv... |
I've been working with JSF for some time, and been using the Apache-Trinidad tags. I like developing using this a lot but I keep hearing great things about facelets. Is anyone out there using it, and what exactly does it get you?
I've looked at the facelets site (https://facelets.dev.java.net/), but it doesn't do a ve... | Facelets is a view declaration language that was designed to be used with JavaServer Faces (JSF). It is now the standard view technology for JSF applications, particularly since JSF 2.0. Here are some of the key advantages of using Facelets over other templating mechanisms, like JSP (JavaServer Pages):
### Advantages ... | 46,714 | [
{
"from": "human",
"value": "I've been working with JSF for some time, and been using the Apache-Trinidad tags. I like developing using this a lot but I keep hearing great things about facelets. Is anyone out there using it, and what exactly does it get you? \nI've looked at the facelets site (https://facel... |
Tk GUI's seem to be universally considered ugly, but I'd like to know why specifically. Some in the Tcl/Tk world would argue that this is a moot point as there is much better support now for native look and feel, which is a big reason I decided on Tcl/Tk. Now, however, the problem is, because I'm leveraging a Tcl/St... | There are several specific, technical reasons why traditional Tk GUIs are often perceived as unattractive or "ugly," especially when compared to modern GUI frameworks and native application appearances. Here are some of the key aspects:
1. **Widget Styling and Design**:
- **Motif Style**: Traditional Tk GUIs often ... | 46,530 | [
{
"from": "human",
"value": "Tk GUI's seem to be universally considered ugly, but I'd like to know why specifically. Some in the Tcl/Tk world would argue that this is a moot point as there is much better support now for native look and feel, which is a big reason I decided on Tcl/Tk. Now, however, the pr... |
I refactor my code and I am looking for a solution to grep my source files for something like
if ( user && user.name && user.name.length() < 128 ) ...
in order to replace it later with ruby's andand or groovy's ?. operator (safe navigation operator).
| You can use `grep` to find code patterns like the one you've mentioned. However, since you want to search for specific JavaScript-like conditional checks, using a regular expression will be more effective. The conditional check you're interested in can vary slightly in syntax, so you'll need a regular expression that c... | 44,058 | [
{
"from": "human",
"value": "I refactor my code and I am looking for a solution to grep my source files for something like\nif ( user && user.name && user.name.length() < 128 ) ...\n\nin order to replace it later with ruby's andand or groovy's ?. operator (safe navigation operator).\n"
},
{
"from": ... |
I've installed VisualSVN on my Windows Server 2008. I have several IP addresses on this server, but I want VisualSVN to only bind to one of them. By default it binds to all available addresses. How can I make VisualSVN only handle requests on one IP address?
I tried adding
BindAddress xxx.xxx.xxx.xxx
to httpd-cust... | To configure VisualSVN Server to bind to a specific IP address on your Windows Server, you need to ensure that you are correctly modifying the right configuration files and using the correct directives. Here are the steps you can follow:
1. **Edit the Correct Configuration File:**
VisualSVN Server uses its own Apac... | 47,663 | [
{
"from": "human",
"value": "I've installed VisualSVN on my Windows Server 2008. I have several IP addresses on this server, but I want VisualSVN to only bind to one of them. By default it binds to all available addresses. How can I make VisualSVN only handle requests on one IP address?\nI tried adding \... |
I am working on a site and working on a component that will take users using wap or xhtml-mp and redirect them to sites specifically setup for those devices. Is there a good standard way of detecting which of these the user is using?
| To detect whether users are accessing your site from devices that use WAP (Wireless Application Protocol) or XHTML-MP (XHTML Mobile Profile), you can make use of the `User-Agent` string sent by the browser in the HTTP request. This string often contains information that can help you identify the type of device being us... | 49,589 | [
{
"from": "human",
"value": "I am working on a site and working on a component that will take users using wap or xhtml-mp and redirect them to sites specifically setup for those devices. Is there a good standard way of detecting which of these the user is using?\n"
},
{
"from": "gpt",
"value": "... |
I want to read a mac id from command line and convert it to an array of uint8_t values to use it in a struct. I can not get it to work. I have a vector of string for the mac id split about : and I want to use stringstream to convert them with no luck. What I am missing?
int parseHex(const string &num){
stringstream ... | It looks like you're on the right track, but there are a few issues with your `parseHex` function and how you're using the `stringstream`.
1. When you want to parse hexadecimal values from a string using `stringstream`, you should set it up properly to read as hex. Specifically, you need to reset the `stringstream` f... | 44,917 | [
{
"from": "human",
"value": "I want to read a mac id from command line and convert it to an array of uint8_t values to use it in a struct. I can not get it to work. I have a vector of string for the mac id split about : and I want to use stringstream to convert them with no luck. What I am missing?\nint pa... |
Given the following code snippet from inside a method;
NSBezierPath * tempPath = [NSBezierPath bezierPathWithOvalInRect:pathRect];
[tempPath retain];
[path release];
[self setPath:tempPath];
Am I responsible for releasing tempPath or will it be done for me?
The setPat... | In Objective-C, memory management is typically handled through a reference counting system, especially if you're not using Automatic Reference Counting (ARC).
From the code snippet you provided:
```objc
NSBezierPath * tempPath = [NSBezierPath bezierPathWithOvalInRect:pathRect];
[tempPath retain];
[path release];
[se... | 45,055 | [
{
"from": "human",
"value": "Given the following code snippet from inside a method; \nNSBezierPath * tempPath = [NSBezierPath bezierPathWithOvalInRect:pathRect];\n [tempPath retain];\n [path release];\n [self setPath:tempPath];\n\nAm I responsible for releasing ... |
I've used boost serialization but this doesn't appear to allow me to generate xml that conforms to a particular schema -- it seems it's purpose was to just to persist a class's state.
Platform: linux
What do you guys use to generate NOT parse xml?
So far I'm going down Foredecker's route of just generating it myself --... | If you're looking for a library to generate XML that adheres to a specific schema and allows for easy customization of node names, attributes, and a clean structure, there are several options available to you in C++. Here are a few libraries that you might find useful:
1. **TinyXML2**:
- **Description**: TinyXML2 i... | 45,029 | [
{
"from": "human",
"value": "I've used boost serialization but this doesn't appear to allow me to generate xml that conforms to a particular schema -- it seems it's purpose was to just to persist a class's state.\nPlatform: linux\nWhat do you guys use to generate NOT parse xml?\nSo far I'm going down Forede... |
I have an array of objects in Python
[obj1, obj2, obj3]
and I want to pass them to off to a C++ function to perform some computation. I'm using SWIG to write my interface. The class type of the passed object is already defined in C++.
What's the best way to do this?
| To pass an array of Python objects to a C++ function using SWIG, you will typically need to perform the following steps:
1. **Define the C++ Class**: Ensure that you have a C++ class that corresponds to the objects you want to pass. This class should be defined in a header file that SWIG can work with.
2. **Create a ... | 45,920 | [
{
"from": "human",
"value": "I have an array of objects in Python \n[obj1, obj2, obj3]\n\nand I want to pass them to off to a C++ function to perform some computation. I'm using SWIG to write my interface. The class type of the passed object is already defined in C++. \nWhat's the best way to do this?\n"
... |
Why does this test program result in a java.lang.IllegalMonitorStateException?
public class test {
static Integer foo = new Integer(1);
public static void main(String[] args) {
synchronized(foo) {
foo++;
foo.notifyAll();
}
System.err.println("Success");
}
}
R... | The `java.lang.IllegalMonitorStateException` in your Java program is raised because of the way you are using the `synchronized` block and the `notifyAll()` method in conjunction with `Integer` objects.
Here's a breakdown of the code:
```java
public class test {
static Integer foo = new Integer(1);
public stat... | 43,827 | [
{
"from": "human",
"value": "Why does this test program result in a java.lang.IllegalMonitorStateException?\npublic class test {\n static Integer foo = new Integer(1);\n public static void main(String[] args) {\n synchronized(foo) {\n foo++;\n foo.notifyAll();\n }\n... |
I use the following statement prepared and bound in ODBC:
SELECT (CASE profile WHEN ? THEN 1 ELSE 2 END) AS profile_order
FROM engine_properties;
Executed in an ODBC 3.0 connection to an Oracle 10g database in AL32UTF8 charset, even after binding to a wchar_t string using SQLBindParameter(SQL_C_WCHAR), it still gives... | The error `ORA-12704: character set mismatch` occurs because Oracle is strict about the character sets of the data being compared. In your case, you are comparing a column of type `NVARCHAR2` with a bound parameter that is being treated as a regular `VARCHAR` instead of an `NVARCHAR` when you bind it with `SQL_C_WCHAR`... | 47,679 | [
{
"from": "human",
"value": "I use the following statement prepared and bound in ODBC:\nSELECT (CASE profile WHEN ? THEN 1 ELSE 2 END) AS profile_order \nFROM engine_properties;\n\nExecuted in an ODBC 3.0 connection to an Oracle 10g database in AL32UTF8 charset, even after binding to a wchar_t string using ... |
I need to do some process injection using C++ but I would prefer to use C# for everything other than the low level stuff. I have heard about "function wrapping" and "marshaling" and have done quite a bit of google searching and have found bits of information here and there but I am still really lacking.
Things I have ... | To wrap C++ code for use in C#, you can create a C++/CLI wrapper or use Platform Invocation Services (P/Invoke) to call native C++ functions from C#. Below, I will outline both methods.
### Method 1: Using C++/CLI
C++/CLI is a bridge that allows you to write managed code that can interoperate with native C++ code. H... | 45,361 | [
{
"from": "human",
"value": "I need to do some process injection using C++ but I would prefer to use C# for everything other than the low level stuff. I have heard about \"function wrapping\" and \"marshaling\" and have done quite a bit of google searching and have found bits of information here and there b... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.