instruction stringlengths 14 27.6k | completion stringlengths 3 38.3k | __original_row_idx int64 0 50k | conversations listlengths 2 2 |
|---|---|---|---|
In my program I have one array with 25 double values 0.04
When I try to sum these values in a loop I get following results:
0.0 + 0.04 = 0.04
0.04 + 0.04 = 0.08
0.08 + 0.04 = 0.12
0.12 + 0.04 = 0.16
0.16 + 0.04 = 0.2
0.2 + 0.04 = 0.24000000000000002
0.24000000000000002 + 0.04 = 0.28
0.28 + 0.04 = 0.32
0.32 + 0.04 = 0.3... | The phenomenon you're experiencing is a common issue when dealing with floating-point arithmetic in programming languages. It is primarily due to how floating-point numbers are represented in binary. Here’s a detailed explanation of the issue:
### Floating-Point Representation
1. **Binary System**: Computers use a bin... | 45,023 | [
{
"from": "human",
"value": "In my program I have one array with 25 double values 0.04\nWhen I try to sum these values in a loop I get following results:\n0.0 + 0.04 = 0.04\n0.04 + 0.04 = 0.08\n0.08 + 0.04 = 0.12\n0.12 + 0.04 = 0.16\n0.16 + 0.04 = 0.2\n0.2 + 0.04 = 0.24000000000000002\n0.24000000000000002 +... |
As Knuth said,
We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil.
This is something which often comes up in Stack Overflow answers to questions like "which is the most efficient loop mechanism", "SQL optimisation techniques?" (and so on). The standard... | Knuth's assertion about premature optimization highlights the importance of focusing on clarity and maintainability in code over minor performance tweaks, especially when those tweaks are based on assumptions rather than empirical data. It emphasizes that before diving into optimizations, it's crucial to assess whether... | 48,095 | [
{
"from": "human",
"value": "As Knuth said,\n\nWe should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil.\n\nThis is something which often comes up in Stack Overflow answers to questions like \"which is the most efficient loop mechanism\", \"SQL opt... |
I have searched high and low and cannot find a Samsung Omnia SDK.
I know its possible to use the .net framework for development , but i want more , specifically being able to access the motion sensor and maybe the GPS as well.
Any idea or directions are welcome.
| If you're looking to develop applications for the Samsung Omnia, specifically for accessing features like the motion sensor and GPS, you're likely referring to the Windows Mobile platform since many Samsung Omnia devices ran on Windows Mobile.
Here are some steps and resources that may help you:
1. **Windows Mobile S... | 48,937 | [
{
"from": "human",
"value": "I have searched high and low and cannot find a Samsung Omnia SDK.\nI know its possible to use the .net framework for development , but i want more , specifically being able to access the motion sensor and maybe the GPS as well.\nAny idea or directions are welcome.\n"
},
{
... |
I'm creating a function where I need to pass an object so that it can be modified by the function. What is the difference between:
public void myFunction(ref MyClass someClass)
and
public void myFunction(out MyClass someClass)
Which should I use and why?
| The main difference between using `ref` and `out` in C# has to do with how the parameter is treated when passed to the function.
### `ref` Keyword
- When you use the `ref` keyword, it means that you are passing the reference of an existing object to the method. The object must be initialized before it is passed to the... | 49,247 | [
{
"from": "human",
"value": "I'm creating a function where I need to pass an object so that it can be modified by the function. What is the difference between:\npublic void myFunction(ref MyClass someClass)\n\nand\npublic void myFunction(out MyClass someClass)\n\nWhich should I use and why?\n"
},
{
... |
I could do this myself given time but does anyone have a nice asp.net implementation of an a-z list coming from a sql query. I would like it to come in the form:
A
aardvark
anagram
apple
B
barry
brown....
That is with each entry being a link.
| Certainly! Below is a simple implementation of an A-Z list in ASP.NET that retrieves data from a SQL database and displays it in the format you specified. This example assumes that you have a SQL database with a table that contains the items you want to list.
### 1. Database Setup
Assume you have a SQL table called `... | 43,815 | [
{
"from": "human",
"value": "I could do this myself given time but does anyone have a nice asp.net implementation of an a-z list coming from a sql query. I would like it to come in the form:\nA\naardvark\nanagram\napple\nB\nbarry\nbrown....\nThat is with each entry being a link.\n"
},
{
"from": "gpt... |
Visual studio 2005 comes with a project that lets you use the asp.net membership provider to look up, add, edit, and delete users and roles. It unfortunaltly can't be used online, and in order to have an adminiistration area in your site, it appears that you have to code your own admin interface.
Is there an opensourc... | Yes, there are several open-source and free projects that can provide an online administration interface for managing users and roles with ASP.NET Membership Provider functionality. Here are a few options you can consider:
1. **ASP.NET Identity**: Although this is not a direct replacement for the classic ASP.NET Membe... | 49,356 | [
{
"from": "human",
"value": "Visual studio 2005 comes with a project that lets you use the asp.net membership provider to look up, add, edit, and delete users and roles. It unfortunaltly can't be used online, and in order to have an adminiistration area in your site, it appears that you have to code your ow... |
I have a header node in which four child nodes reside.
None have borders, padding nor margins.
All four of them have the width:25%; css rule.
In Opera it works just fine, in IE the last block flips to the next line sometimes depending on the width of the window.
I can solve it by giving one block a width of 24.8%, but ... | To create a layout with four child nodes that each take up 25% of their parent node's width without causing the last block to wrap to the next line, you can use a combination of CSS techniques. Here are a few solutions that might help:
### Solution 1: Flexbox
Using Flexbox is a modern approach that can help achieve th... | 43,973 | [
{
"from": "human",
"value": "I have a header node in which four child nodes reside.\nNone have borders, padding nor margins.\nAll four of them have the width:25%; css rule.\nIn Opera it works just fine, in IE the last block flips to the next line sometimes depending on the width of the window.\nI can solve ... |
I have to support an application that uses an access database. My development machine is running Windows XP 64 bit, which is fine, except Windowx XP 64 doesn't have an adodb driver installed, so anytime I write scripts to update the access database I have to move the database and the scripts to a 32 bit machine, RDP in... | Using an Access database with Windows XP 64-bit can indeed present challenges, especially when it comes to the availability of the necessary drivers for ADO (ActiveX Data Objects). However, there are a few potential solutions you can consider that might simplify your workflow:
### 1. Install the 32-bit Access Database... | 47,580 | [
{
"from": "human",
"value": "I have to support an application that uses an access database. My development machine is running Windows XP 64 bit, which is fine, except Windowx XP 64 doesn't have an adodb driver installed, so anytime I write scripts to update the access database I have to move the database an... |
Is it possible to replace Microsoft Cardspace UI with your own? Or use Cardspace without any UI?
| Microsoft CardSpace, which was introduced as a part of Windows Communication Foundation (WCF) in .NET Framework, is primarily designed to facilitate identity management and provide a secure way for users to share their identity information with online services. However, customizing the CardSpace UI or using it without ... | 48,998 | [
{
"from": "human",
"value": "Is it possible to replace Microsoft Cardspace UI with your own? Or use Cardspace without any UI?\n"
},
{
"from": "gpt",
"value": "Microsoft CardSpace, which was introduced as a part of Windows Communication Foundation (WCF) in .NET Framework, is primarily designed to... |
How do I use an app.config file for the .Net part when calling a .Net dll from C++ and the data in the config-file must be read at the .Net runtime startup.
If I use have a foo.dll.config that I call from ConfigurationManager.OpenExeConfiguration("foo.dll") I can access application settings. What I would like to do tho... | When you're working with a .NET DLL that is invoked from a native C++ application, managing configuration settings through an `app.config` file can be a bit tricky, especially for modifying settings in `<system.data>`.
### Understanding Configuration Files in .NET
1. **Default Config Behavior**: In a typical .NET app... | 42,842 | [
{
"from": "human",
"value": "How do I use an app.config file for the .Net part when calling a .Net dll from C++ and the data in the config-file must be read at the .Net runtime startup.\nIf I use have a foo.dll.config that I call from ConfigurationManager.OpenExeConfiguration(\"foo.dll\") I can access appli... |
Those of us with iPhone apps (released or unreleased) are able to send out limited beta builds using ad-hoc distribution. While the Apple docs for this have a few holes in them, there are a number of blogs, postings and other articles out there on "the net" that fill the gaps.
However, one thing I haven't seen anyone m... | When it comes to beta testing iOS applications, the decision about whether to use the same App ID for your beta build as your released app involves weighing the pros and cons based on your specific testing goals.
### Using the Same App ID
**Pros:**
1. **Shared Data**: If your beta app uses the same App ID as the rele... | 44,676 | [
{
"from": "human",
"value": "Those of us with iPhone apps (released or unreleased) are able to send out limited beta builds using ad-hoc distribution. While the Apple docs for this have a few holes in them, there are a number of blogs, postings and other articles out there on \"the net\" that fill the gaps.... |
I am building a small wpf app in C#. When a button gets clicked a third
party dll function constructs a tree like object. This object is bound
to a treeview. This works fine but takes a bit of time to load. As the
dll function constructs the object it prints progress info to the
console. I want to redirect this int... | The issue you're encountering is likely related to the UI thread being blocked during the execution of the long-running DLL function. In WPF, the UI does not update if the main thread is busy, and since your console messages are being written during this time, they do not get reflected in the UI until after the long-ru... | 46,914 | [
{
"from": "human",
"value": "I am building a small wpf app in C#. When a button gets clicked a third \nparty dll function constructs a tree like object. This object is bound \nto a treeview. This works fine but takes a bit of time to load. As the \ndll function constructs the object it prints progress info ... |
I have an iterator to a map element, and I would like gdb to show me the values of the "first" and "second" elements of that iterator.
For example:
std::map<int,double> aMap;
...fill map...
std::map<int,double>::const_iterator p = aMap.begin();
I can use p.first and p.second in the code, but can't see them in gdb. For... | In GDB, when working with C++ STL containers like `std::map`, you can access the values in the iterator directly. However, the internal structure of the iterator isn't always straightforward because it is often encapsulated and uses private members.
Here's how you can access the `first` and `second` values of the iter... | 46,310 | [
{
"from": "human",
"value": "I have an iterator to a map element, and I would like gdb to show me the values of the \"first\" and \"second\" elements of that iterator.\nFor example:\nstd::map<int,double> aMap;\n...fill map...\nstd::map<int,double>::const_iterator p = aMap.begin();\n\nI can use p.first and p... |
I have a java String that contains the unicode character U+9996 (that's what I get if I do codePointAt()).
If I look at it in the debugger expressions panel (in eclipse) then all is well and it looks like "首". However if I print it out to the console I get simply "?". It doesn't seem to be the font that's the proble... | It seems like you've already made great progress in diagnosing and resolving the issues you were facing with Unicode characters in Java, Eclipse, and MySQL. Let’s summarize the key points and provide further insights into the challenges you encountered:
1. **Unicode Character Display**:
- The character U+9996 (首) m... | 47,248 | [
{
"from": "human",
"value": "I have a java String that contains the unicode character U+9996 (that's what I get if I do codePointAt()). \nIf I look at it in the debugger expressions panel (in eclipse) then all is well and it looks like \"首\". However if I print it out to the console I get simply \"?\". It... |
I'm looking at starting a project in C++ using the Qt 4 framework (a cross-platform GUI is required). I've heard great things about the Boost libraries from friends and online. I've started reading up on both and wanted to ask a cursory question before I got too deep: Are these two development "systems" mutually excl... | Using both Qt and Boost in the same C++ project is certainly possible and often a good idea, as they complement each other well and can enhance your development experience. Here are some points to consider regarding their integration:
### Benefits of Using Both
1. **Rich Feature Set**: Qt provides a comprehensive set... | 44,644 | [
{
"from": "human",
"value": "I'm looking at starting a project in C++ using the Qt 4 framework (a cross-platform GUI is required). I've heard great things about the Boost libraries from friends and online. I've started reading up on both and wanted to ask a cursory question before I got too deep: Are thes... |
I am reorganizing my source files into a single solution with a single project, due to various reasons:
a paranoic configured antivirus software;
Advices on partitioning code through .NET assemblies
Control component dependencies to gain clean architecture
Benefit from the C# and VB.NET compilers perf
This leaves me ... | Organizing multiple files across multiple namespaces within a single project can indeed be a challenge, especially when adhering to clean architecture principles and maintaining a clear structure. Here are some strategies that can help you effectively organize your source files in a single project while using meaningfu... | 43,627 | [
{
"from": "human",
"value": "I am reorganizing my source files into a single solution with a single project, due to various reasons:\n\na paranoic configured antivirus software;\nAdvices on partitioning code through .NET assemblies\nControl component dependencies to gain clean architecture\nBenefit from the... |
I am working on a web application that is designed to display a bunch of data that is updated periodically with AJAX. The general usage scenario would be that a user would leave it open all day and take a glance at it now and then.
I am encountering a problem where the browsers memory footprint is growing slowly over... | Memory leaks in web applications can be a common challenge, especially when handling frequent AJAX calls and dynamically updating the DOM. Since you've already identified that the issue is related to a JavaScript graphing library, here are some general tips and approaches to help mitigate memory leaks, whether with the... | 44,828 | [
{
"from": "human",
"value": "I am working on a web application that is designed to display a bunch of data that is updated periodically with AJAX. The general usage scenario would be that a user would leave it open all day and take a glance at it now and then.\nI am encountering a problem where the browse... |
Good morning,
I work in a small shop (only two of us) and we currently manage more .vbs scripts that we would like to (we would like to manage zero). One of the nice things about these scripts is that it's quick to make changes (as necessary) and go back to our day jobs.
That's all nice and good until we decide that... | Good morning, Alan!
It sounds like you’re looking for a more robust and maintainable way to handle scripting tasks compared to using VBScript. There are several options available in the .NET ecosystem that can offer improved functionality, easier debugging, and better maintainability. Here are some suggestions:
### 1... | 46,891 | [
{
"from": "human",
"value": "Good morning,\nI work in a small shop (only two of us) and we currently manage more .vbs scripts that we would like to (we would like to manage zero). One of the nice things about these scripts is that it's quick to make changes (as necessary) and go back to our day jobs. \nTh... |
I have configured Tomcat 6 to serve Perl CGI scripts. That part is well documented and works ok for me.
But, when a browser requests an image from this CGI dir, Tomcat's CGI servlet refuses to serve the image, displaying instead merely the url of the image. I believe this is a security feature to prevent users from se... | To configure Tomcat to serve static files (like images) from a directory that is also used for CGI scripts, you will need to adjust your configuration to prevent the CGI servlet from intercepting requests for static content.
Here's how you can do this:
### 1. Configure the Web.xml file
You will need to modify the `w... | 46,705 | [
{
"from": "human",
"value": "I have configured Tomcat 6 to serve Perl CGI scripts. That part is well documented and works ok for me.\nBut, when a browser requests an image from this CGI dir, Tomcat's CGI servlet refuses to serve the image, displaying instead merely the url of the image. I believe this is a... |
Let's say I have a class like this:
class ApplicationDefs{
public static final String configOption1 = "some option";
public static final String configOption2 = "some other option";
public static final String configOption3 = "yet another option";
}
Many of the other classes in my application are using these options. No... | In Java, `public static final` fields are considered compile-time constants if they are initialized with a constant expression (like a string literal). When other classes reference these constants, the Java compiler may inline them, meaning it replaces usages of the constant with the actual value at compile time. This ... | 49,188 | [
{
"from": "human",
"value": "Let's say I have a class like this:\nclass ApplicationDefs{\npublic static final String configOption1 = \"some option\";\npublic static final String configOption2 = \"some other option\";\npublic static final String configOption3 = \"yet another option\";\n}\n\nMany of the other... |
How to query to get count of matching words in a field, specifically in MySQL.
simply i need to get how many times a "search terms"appear in the field value.
for example, the value is "one two one onetwo" so when i search for word "one" it should give me 3
is it possible? because currently i just extract the value out ... | Yes, it's possible to count the occurrences of a specific word in a text field using MySQL. You can achieve this using a combination of string functions. Here's a method you can use to count how many times a specific word appears in a text field.
### Query to Count Word Occurrences
You can use the following SQL query... | 49,205 | [
{
"from": "human",
"value": "How to query to get count of matching words in a field, specifically in MySQL.\nsimply i need to get how many times a \"search terms\"appear in the field value.\nfor example, the value is \"one two one onetwo\" so when i search for word \"one\" it should give me 3\nis it possibl... |
I have a simple WCF service:
public Order[] GetOrdersByStatus(int statusid)
{
OrderService os = new OrderService();
TList<Order> orders = os.GetByOrderStateID(statusid);
return orders.ToArray();
}
when this returns it throws a StackOverflowException in mscorlib. Any idea what could be causing this?
The O... | A `StackOverflowException` occurring in a WCF service when returning data can be attributed to several potential issues, especially when working with entity objects generated by tools like NetTiers. Here are some common reasons that might cause this exception:
1. **Circular References**: If the `Order` object has prop... | 46,848 | [
{
"from": "human",
"value": "I have a simple WCF service:\npublic Order[] GetOrdersByStatus(int statusid)\n{\n OrderService os = new OrderService();\n TList<Order> orders = os.GetByOrderStateID(statusid);\n\n return orders.ToArray();\n}\n\nwhen this returns it throws a StackOverflowException in msc... |
I'm trying to store the names of some variables inside strings. For example:
Dim Foo1 as Integer
Dim Foo1Name as String
' -- Do something to set Foo1Name to the name of the other variable --
MessageBox.Show(Foo1Name & " is the variable you are looking for.")
' Outputs:
' Foo1 is the variable you are looking for.
Thi... | In VB.NET, you cannot directly obtain the name of a variable as a string at runtime. However, you can achieve similar functionality by using a convention or a helper function that maps variable names to their values.
Here's a common approach where you can create a method that accepts a variable name as a string and a ... | 49,157 | [
{
"from": "human",
"value": "I'm trying to store the names of some variables inside strings. For example:\nDim Foo1 as Integer\nDim Foo1Name as String\n\n' -- Do something to set Foo1Name to the name of the other variable --\n\nMessageBox.Show(Foo1Name & \" is the variable you are looking for.\")\n' Outputs... |
NHibernatians!
I have a table [dbo].[Wibble] and another table [dbo].[WibbleExtended].
[Wibble] is the main table and [WibbleExtended] is an optional table where some other fields are stored. There are far fewer entries in the [WibbleExtended] table than the main [Wibble] table. I think this was done back in the day ... | It looks like you've found a solution to your issue by adjusting your mapping strategy and consolidating the properties of the `WibbleExtended` table into the `Wibble` table's mapping. This approach is indeed more suitable for your scenario, especially since you cannot change the schema and need to ensure compatibility... | 49,493 | [
{
"from": "human",
"value": "NHibernatians!\nI have a table [dbo].[Wibble] and another table [dbo].[WibbleExtended].\n[Wibble] is the main table and [WibbleExtended] is an optional table where some other fields are stored. There are far fewer entries in the [WibbleExtended] table than the main [Wibble] tab... |
I'm using a 3rd party DLL written in unmanaged C++ that controls some hardware we have.
Unfortunately this DLL crashes now and then and I've been tasked to make it "reload" automagically. I'm not too sure about how to proceed to get best results.
My project uses C++.Net 2.0 (2005). I'm wrapping the 3rd party stuff in a... | Working with unmanaged C++ libraries from a .NET application can be quite challenging, especially when dealing with crashes and memory management issues. Here are some approaches you might consider for handling the situation, along with a few pointers:
### 1. Process Isolation:
Instead of trying to reload the DLL with... | 46,470 | [
{
"from": "human",
"value": "I'm using a 3rd party DLL written in unmanaged C++ that controls some hardware we have.\nUnfortunately this DLL crashes now and then and I've been tasked to make it \"reload\" automagically. I'm not too sure about how to proceed to get best results.\nMy project uses C++.Net 2.0 ... |
Not a programming question per se, but interesting for people who do commercial web development.
How do you track all of your clients' hosting, domain registration, and SSL certificate expiry dates?
Do you just keep a spreadsheet or is there some useful piece of software for this?
I've searched extensively and can't fi... | Tracking hosting, domain registration, and SSL certificate expiry dates for a large number of clients can indeed become a challenging task if you rely on ad hoc methods. Here are some popular approaches to managing this effectively, including both software solutions and best practices:
### 1. **Dedicated Management So... | 46,682 | [
{
"from": "human",
"value": "Not a programming question per se, but interesting for people who do commercial web development.\nHow do you track all of your clients' hosting, domain registration, and SSL certificate expiry dates?\nDo you just keep a spreadsheet or is there some useful piece of software for t... |
I'm trying to run an interactive command through paramiko. The cmd execution tries to prompt for a password but I do not know how to supply the password through paramiko's exec_command and the execution hangs. Is there a way to send values to the terminal if a cmd execution expects input interactively?
ssh = paramiko... | To interact with a command that expects input interactively (like entering a password in your case), you can use `paramiko`'s `invoke_shell` method instead of `exec_command`. The `exec_command` method is suitable for commands that do not require interactive input.
Here's how you can use `invoke_shell` to achieve this:... | 46,883 | [
{
"from": "human",
"value": "I'm trying to run an interactive command through paramiko. The cmd execution tries to prompt for a password but I do not know how to supply the password through paramiko's exec_command and the execution hangs. Is there a way to send values to the terminal if a cmd execution ex... |
In XP/2003 I had become accustomed to writing my MessageBox.Show(..) code like this :
MessageBox.Show("Title", "Sorry an error has occured!\n" +
"You may want to try one of the following:\n\n" +
"1. Reboot your machine\n" +
"2. Buy a new machi... | When working with `MessageBox.Show()` in a Windows Forms application, the formatting of the message can be inconsistent across different Windows versions due to variations in how the operating system renders message boxes. Here are some best practices and recommendations to achieve better consistency across XP, Vista, ... | 43,920 | [
{
"from": "human",
"value": "In XP/2003 I had become accustomed to writing my MessageBox.Show(..) code like this :\nMessageBox.Show(\"Title\", \"Sorry an error has occured!\\n\" +\n \"You may want to try one of the following:\\n\\n\" +\n \"1. Reboot your machi... |
In order to avoid delegating XRI resolution to an XRI resolver proxy like xri.net, is there an open source .NET implementation of an XRI resolver?
There is an xri4j library that might be ported to .NET, and in fact I started on that effort, but it looked like there was a lot of code in there that could be ripped out si... | As of my last update in October 2023, there isn’t a widely known open-source .NET implementation of an XRI resolver that matches the capabilities of xri4j. However, here are some approaches you could consider:
1. **Porting xri4j**: As you mentioned, you started porting xri4j to .NET. While it may seem like a lot of wo... | 48,961 | [
{
"from": "human",
"value": "In order to avoid delegating XRI resolution to an XRI resolver proxy like xri.net, is there an open source .NET implementation of an XRI resolver?\nThere is an xri4j library that might be ported to .NET, and in fact I started on that effort, but it looked like there was a lot of... |
I am a Web developer who spends 99% of his time in Linux, but I need to develop a super simple application with VB or possibly C# (.Net). The only version of Visual Studio I have is the most current free ones. There MIGHT be a copy of 2001 lying around somewhere. Anyways, the machine I need to develop this for is ru... | Developing an application for Windows NT 4.0 with the .NET Framework 1.1 presents a few challenges, mainly because modern versions of Visual Studio and the .NET Framework are not compatible with such an old operating system. However, you can take a few steps to create a compatible application.
### Option 1: Use Visual... | 46,142 | [
{
"from": "human",
"value": "I am a Web developer who spends 99% of his time in Linux, but I need to develop a super simple application with VB or possibly C# (.Net). The only version of Visual Studio I have is the most current free ones. There MIGHT be a copy of 2001 lying around somewhere. Anyways, the... |
If I have two objects, one being the list of items, and the other having a property storing the selected item of the other list, is it possible to update the selected item through binding in WPF?
Lets say I have these two data structures:
public class MyDataList
{
public ObservableCollection<Guid> Data { get; set; ... | Yes, it is definitely possible to bind a `ListBox` in WPF to the list of items in `MyDataList` while simultaneously updating the `ChosenItem` property in an instance of `MyDataStructure` based on the selected item in the `ListBox`.
To achieve this, you will need to ensure a few things:
1. **Implement INotifyProperty... | 43,682 | [
{
"from": "human",
"value": "If I have two objects, one being the list of items, and the other having a property storing the selected item of the other list, is it possible to update the selected item through binding in WPF?\nLets say I have these two data structures:\npublic class MyDataList\n{\n public... |
I have got this error when using Enterprise Library 3.1 May 2007 version. We are developing a product and have a common lib directory beneath the Subversion Trunk directory
<>\Trunk\Lib\ into which we put all the third party DLLs. Inside this we have Microsoft\EnterpriseLibrary\v3.1 in which we have copied all the dll... | The error message you're encountering indicates that there is a mismatch between the version of the `Microsoft.Practices.EnterpriseLibrary.Data` assembly that your project is referencing and the version that is actually being loaded at runtime. This can happen for a number of reasons, especially in a scenario where mul... | 42,802 | [
{
"from": "human",
"value": "I have got this error when using Enterprise Library 3.1 May 2007 version. We are developing a product and have a common lib directory beneath the Subversion Trunk directory\n<>\\Trunk\\Lib\\ into which we put all the third party DLLs. Inside this we have Microsoft\\EnterpriseLi... |
I need to use one logical PGM based multicast address in application while enable such application "seamlessly" running across several different geo-locations (i.e. think US/Europe/Australia).
Application is quite throughput (several million biz. messages a day) and latency demanding whith a lot of small but very frequ... | When considering the multicast communication architecture for your application across multiple geographical locations, there are several factors to keep in mind, including latency, throughput, reliability, and the nature of your messaging pattern. Here’s a breakdown of the options you’ve considered, along with recommen... | 43,476 | [
{
"from": "human",
"value": "I need to use one logical PGM based multicast address in application while enable such application \"seamlessly\" running across several different geo-locations (i.e. think US/Europe/Australia).\nApplication is quite throughput (several million biz. messages a day) and latency d... |
I'm attempting to find the best methodology for finding a specific pattern and then
replace the ending portion of the pattern. Here is a quick example (in C#):
//Find any year value starting with a bracket or underscore
string patternToFind = "[[_]2007";
Regex yearFind = new Regex(patternToFind);
//I want to change... | To achieve your goal of replacing a specific year value in your text while retaining the original character (either a bracket or underscore), you can indeed use the `Regex.Replace()` method in C#. The key here is to use a capturing group in your regex pattern. Capturing groups allow you to reference parts of the matche... | 46,879 | [
{
"from": "human",
"value": "I'm attempting to find the best methodology for finding a specific pattern and then \nreplace the ending portion of the pattern. Here is a quick example (in C#):\n//Find any year value starting with a bracket or underscore\nstring patternToFind = \"[[_]2007\";\n\nRegex yearFind... |
In my python linux console application I use curses to handle displaying of data. At the same time I'd like to have an input line to enter commands, pretty much in good ol' irssi-style. With default curses getch() I'd have to do a lot of coding just to get the basic funcionality of raw_input function - arrow keys to mo... | To implement a command line input similar to `irssi` with `curses`, you'll need to manage the cursor position, handle key events (like arrow keys), and maintain a history of commands. While this may involve a bit of coding, you can certainly achieve this functionality. Below is a basic example that demonstrates how you... | 42,052 | [
{
"from": "human",
"value": "In my python linux console application I use curses to handle displaying of data. At the same time I'd like to have an input line to enter commands, pretty much in good ol' irssi-style. With default curses getch() I'd have to do a lot of coding just to get the basic funcionality... |
I'm writing Application A and DLL B, both in C#.NET. How do I do the following:
A calls function in B
Want B to use delegate/callback to update status in UI of A
This is not about BackgroundWorker...that part works fine in A. What I can't see is how to let B know what function to call in A.
| To allow your Application A to use a delegate/callback to update the UI from DLL B, you will want to define a delegate in DLL B that Application A will use to provide the function that should be called for the updates. Here's a step-by-step guide on how to achieve this:
### Step 1: Define a Delegate in DLL B
In your ... | 44,827 | [
{
"from": "human",
"value": "I'm writing Application A and DLL B, both in C#.NET. How do I do the following: \n\nA calls function in B \nWant B to use delegate/callback to update status in UI of A \n\nThis is not about BackgroundWorker...that part works fine in A. What I can't see is how to let B know wh... |
Can jQuery be extended so that I can use the above syntax?
I can't figure out how to prototype whatever it is $() returns, so that I can call $().$()
Thanks.
| Yes, you can extend jQuery to add custom methods that can be invoked with the `$(...)` syntax. jQuery returns an object that is an instance of `jQuery`, which you can prototype to add your own methods.
To add a custom method that can be invoked as `$(...).$()`, you can extend the jQuery prototype like this:
```javas... | 49,153 | [
{
"from": "human",
"value": "Can jQuery be extended so that I can use the above syntax?\nI can't figure out how to prototype whatever it is $() returns, so that I can call $().$()\nThanks.\n"
},
{
"from": "gpt",
"value": "Yes, you can extend jQuery to add custom methods that can be invoked with ... |
What are the differences between MyISAM and Inno DB types in MySql?
| MyISAM and InnoDB are two different storage engines used in MySQL. Each has its own characteristics, advantages, and disadvantages. Here are the main differences between MyISAM and InnoDB:
### 1. **Transaction Support**
- **InnoDB**: Supports transactions, meaning that it can handle multiple statements as a single uni... | 46,612 | [
{
"from": "human",
"value": "What are the differences between MyISAM and Inno DB types in MySql?\n"
},
{
"from": "gpt",
"value": "MyISAM and InnoDB are two different storage engines used in MySQL. Each has its own characteristics, advantages, and disadvantages. Here are the main differences betw... |
I started using NetBeans for Python development, and so far it looks pretty good. One thing that bothers me is that when I highlight a few lines of text and hit the Tab key, it doesn't do what almost every other editor does, but rather just adds four spaces at the end of the block.
I know NetBeans has a block indent ac... | It's great to hear that you're using NetBeans for Python development! The behavior you've encountered with the Tab key is indeed a bit different from what many other editors do, and it can be frustrating.
To address your issue of binding the Tab key to indenting selected lines, you might need to create a custom key bi... | 49,275 | [
{
"from": "human",
"value": "I started using NetBeans for Python development, and so far it looks pretty good. One thing that bothers me is that when I highlight a few lines of text and hit the Tab key, it doesn't do what almost every other editor does, but rather just adds four spaces at the end of the blo... |
I am writing both sides of an ASP-webpage to ASP-webpage conversation in which the originating webpage pushes information to the receiving webpage which then processes it and sends back a response. The originating webpage must use the code below to start the converstation:
url = "www.receivingwebsite.com\asp\receivingw... | When you set the `Content-Type` to `text/xml`, the data you send in your request is expected to be formatted as XML, and thus, it won't appear in the `Request.Form` or `Request.QueryString` collections. Instead, you will need to read the raw request body directly. Here's how to process the XML data in your receiving AS... | 46,395 | [
{
"from": "human",
"value": "I am writing both sides of an ASP-webpage to ASP-webpage conversation in which the originating webpage pushes information to the receiving webpage which then processes it and sends back a response. The originating webpage must use the code below to start the converstation:\nurl ... |
I know the use of server-side controls is a no-no in ASP.NET MVC, however we have a long list of crystal reports that the company has already produced for a previous application that I would like to utilize for our new ASP.NET MVC application.
Is there an appropriate way to use crystal reports in ASP.NET MVC? If so, h... | While it is true that ASP.NET MVC encourages a clear separation between the presentation layer and the business logic, it is still possible to integrate Crystal Reports into an ASP.NET MVC application. Here’s how you can do it effectively:
### Step 1: Add Crystal Reports to Your Project
1. **Install the Crystal Repor... | 43,961 | [
{
"from": "human",
"value": "I know the use of server-side controls is a no-no in ASP.NET MVC, however we have a long list of crystal reports that the company has already produced for a previous application that I would like to utilize for our new ASP.NET MVC application.\nIs there an appropriate way to use... |
I am having a postgres production database in production (which contains a lot of Data). now I need to modify the model of the tg-app to add couple of new tables to the database.
How do i do this? I am using sqlAlchemy.
| To modify your existing PostgreSQL database schema and add new tables while using SQLAlchemy, you can follow these general steps. This process involves creating the new tables in your SQLAlchemy model, generating a migration script, and then applying that migration to the database. Here’s how to do it:
### Step 1: Upd... | 41,913 | [
{
"from": "human",
"value": "I am having a postgres production database in production (which contains a lot of Data). now I need to modify the model of the tg-app to add couple of new tables to the database. \nHow do i do this? I am using sqlAlchemy.\n"
},
{
"from": "gpt",
"value": "To modify yo... |
Assuming following definition:
/// <summary>
/// Replaces each occurrence of sPattern in sInput with sReplace. This is done
/// with the CLR:
/// new RegEx(sPattern, RegexOptions.Multiline).Replace(sInput, sReplace).
/// The result of the replacement is the return value.
/// </summary>
[SqlFunction(IsDeterministic =... | The issue you're encountering stems from SQL Server's handling of string data types, particularly with user-defined functions (UDFs) returning `nvarchar` values. When a UDF returns a `SqlString`, SQL Server implicitly treats this return type as `nvarchar(4000)` by default, unless you specify otherwise.
To ensure that ... | 46,351 | [
{
"from": "human",
"value": "Assuming following definition:\n/// <summary>\n/// Replaces each occurrence of sPattern in sInput with sReplace. This is done \n/// with the CLR: \n/// new RegEx(sPattern, RegexOptions.Multiline).Replace(sInput, sReplace). \n/// The result of the replacement is the return value.... |
2^15 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26.
What is the sum of the digits of the number 2 power of 1000 (2^1000)?
Can anyone provide the solution or algorithm for this problem in java?
| To find the sum of the digits of \(2^{1000}\), we can break down the problem into a few manageable steps in Java. Here’s a simple approach:
1. Calculate \(2^{1000}\). Since \(2^{1000}\) is a very large number, it can't be represented directly using standard integer types (like `int` or `long`). We will use `BigInteger... | 48,647 | [
{
"from": "human",
"value": "2^15 = 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26.\nWhat is the sum of the digits of the number 2 power of 1000 (2^1000)?\nCan anyone provide the solution or algorithm for this problem in java?\n"
},
{
"from": "gpt",
"value": "To find the sum of the di... |
I have an embedded broker completely configured through java code (no deployable xml files). When I point my browser to the web console I just get a 404, and an lsof shows that nothing is listening on 8161. Is it possible to use the web console with only java code? I'm fine with using the webserver that comes with Acti... | Yes, it is possible to configure the ActiveMQ web console entirely through Java code, but you must ensure that you are correctly setting up the necessary components to enable the web console. If you're getting a 404 error and no service is listening on port 8161, it suggests that the web console may not be correctly in... | 46,158 | [
{
"from": "human",
"value": "I have an embedded broker completely configured through java code (no deployable xml files). When I point my browser to the web console I just get a 404, and an lsof shows that nothing is listening on 8161. Is it possible to use the web console with only java code? I'm fine with... |
I wish to store a single variable in my application that will be saved between runs. This will be a version number that will be used to trigger an update option and so will change only rarely.
Does anyone have suggestions on the best way of implementing this? Considering it's such a simple requirement I am interested i... | For storing a single variable like a version number that persists between runs of your application, you have a few simple and effective options. Here are some common approaches you can consider:
### 1. **Text File**
You can store the version number in a plain text file. This is simple and straightforward.
**Example i... | 45,893 | [
{
"from": "human",
"value": "I wish to store a single variable in my application that will be saved between runs. This will be a version number that will be used to trigger an update option and so will change only rarely.\nDoes anyone have suggestions on the best way of implementing this? Considering it's s... |
How can I convert an std::string to a char* or a const char*?
| In C++, you can convert an `std::string` to a `char*` or a `const char*` using the `c_str()` member function of the `std::string` class. Here's how you can do this:
1. **To get a `const char*`:**
You can use the `c_str()` method, which returns a pointer to a null-terminated character array (C-style string) that repre... | 44,907 | [
{
"from": "human",
"value": "How can I convert an std::string to a char* or a const char*?\n"
},
{
"from": "gpt",
"value": "In C++, you can convert an `std::string` to a `char*` or a `const char*` using the `c_str()` member function of the `std::string` class. Here's how you can do this:\n\n1. *... |
Does anyone know how I could go about doing something like :
Html.ActionLink(c => c.SomeAction(new MessageObject { Id = 1 } ))
This should output a link with the url of "/Controller/SomeAction/1", pointing at an ActionMethod along the lines of:
public Controller : Controller
{
public ActionResult SomeMethod(MessageOb... | To achieve the desired functionality of generating a URL with `Html.ActionLink` that uses an object to create the route, you can utilize the route values in a more manual way. While `Html.ActionLink` doesn't directly support passing an object for route values, you can construct the route values using an anonymous type ... | 46,197 | [
{
"from": "human",
"value": "Does anyone know how I could go about doing something like :\nHtml.ActionLink(c => c.SomeAction(new MessageObject { Id = 1 } ))\nThis should output a link with the url of \"/Controller/SomeAction/1\", pointing at an ActionMethod along the lines of:\npublic Controller : Controlle... |
Is it possible to reflectively instantiate a generic type in Java? Using the technique described here I get an error because class tokens cannot be generic. Take the example below. I want to instantiate some subclass of Creator that implements Creator. The actual class name is passed in as a command line argument. The ... | In Java, generics are erased at runtime due to type erasure, which means that the generic type information (like `Creator<String>`) is not available in the runtime type system. Therefore, you cannot directly instantiate a generic type or check its generic parameters at runtime in the way you're trying to do.
However, ... | 47,893 | [
{
"from": "human",
"value": "Is it possible to reflectively instantiate a generic type in Java? Using the technique described here I get an error because class tokens cannot be generic. Take the example below. I want to instantiate some subclass of Creator that implements Creator. The actual class name is p... |
I've been trying to refactor a "bit" of code that I'd previously developed. Basically, the project was my response to not knowing how to use XSLT effectively, so I developed an XML transformation system in PHP. The program reads through the tags of an XML file and does something along these lines to convert it to HTML:... | It sounds like you're making good progress in refactoring your code, but you’re encountering performance issues due to the way files are being included repeatedly. Here are several strategies that can help improve performance while still maintaining modularity and readability.
### 1. Use Autoloading with Function Defi... | 44,452 | [
{
"from": "human",
"value": "I've been trying to refactor a \"bit\" of code that I'd previously developed. Basically, the project was my response to not knowing how to use XSLT effectively, so I developed an XML transformation system in PHP. The program reads through the tags of an XML file and does somethi... |
How do I implement Mutex lock in Nant? The reason why I need this feature is because I register COM components in order to get my build working. Then at the end of the build
I un-register the COM components.
Without mutex lock, different version of COM are registered and face some issues.
So, it would be better if w... | Implementing a mutex lock in NAnt to ensure that only one build process can register or unregister COM components at a time is a useful approach to prevent conflicts between builds. However, NAnt does not provide a built-in mechanism for mutex locks. Instead, you can use a workaround that leverages file locking.
Here'... | 44,442 | [
{
"from": "human",
"value": "How do I implement Mutex lock in Nant? The reason why I need this feature is because I register COM components in order to get my build working. Then at the end of the build \nI un-register the COM components.\nWithout mutex lock, different version of COM are registered and fa... |
I have a need to populate a Word 2007 document from code, including repeating table sections - currently I use an XML transform on the document.xml portion of the docx, but this is extremely time consuming to setup (each time you edit the template document, you have to recreate the transform.xsl file, which can take up... | Yes, there are better ways to populate a Word document programmatically without the need for XML transformations or running Microsoft Word in the background. Here are some options you can consider:
### 1. **Open XML SDK**
The Open XML SDK allows you to manipulate Word documents (as well as Excel and PowerPoint) withou... | 40,472 | [
{
"from": "human",
"value": "I have a need to populate a Word 2007 document from code, including repeating table sections - currently I use an XML transform on the document.xml portion of the docx, but this is extremely time consuming to setup (each time you edit the template document, you have to recreate ... |
I'm pretty new to the iPhone platform, so I'm wondering what the best way to switch between OpenGL rendering and a UIView might be?
Any comments much appreciated!
| Welcome to the iPhone platform! If you're working with OpenGL and want to switch between OpenGL rendering and a `UIView`, you typically do this using a combination of an `EAGLContext`, a `GLKView` or `CAEAGLLayer`, and a regular UIView.
Here’s a high-level overview of how you can set this up:
### 1. Setting Up OpenGL... | 45,601 | [
{
"from": "human",
"value": "I'm pretty new to the iPhone platform, so I'm wondering what the best way to switch between OpenGL rendering and a UIView might be?\nAny comments much appreciated!\n"
},
{
"from": "gpt",
"value": "Welcome to the iPhone platform! If you're working with OpenGL and want... |
I have a string I need to feed to a com object that has a LoadFromStream method accepting "object Data". I'm guessing this should be a byte[].
Rather basic question:
I got my MemoryStream all filled and ready to go. What's the best way to convert it to binary[]?
Should I manually read it into the array one by one or is... | You're correct that the `LoadFromStream` method likely expects a byte array (`byte[]`). If you already have your `MemoryStream` filled, you can easily convert it to a byte array without needing to manually read it one byte at a time. The `MemoryStream` class provides a built-in method for this purpose.
Here's how you ... | 48,146 | [
{
"from": "human",
"value": "I have a string I need to feed to a com object that has a LoadFromStream method accepting \"object Data\". I'm guessing this should be a byte[].\nRather basic question:\nI got my MemoryStream all filled and ready to go. What's the best way to convert it to binary[]?\nShould I ma... |
Please advise if you can.
I am building an SMS web service API that will allow people to send SMS to their desired cellphone numbers. A request will be sent to the interface, we then process that request based on the account details provided and credits available on their account.
We have two proposed XML structures fo... | When comparing the two XML structures for your SMS web service API, it's essential to consider factors such as clarity, extensibility, industry standards, and ease of parsing. Below are some observations and recommendations for both structures.
### Interface A
**Structure:**
```xml
<?xml version="1.0" encoding="UTF-8... | 39,612 | [
{
"from": "human",
"value": "Please advise if you can.\nI am building an SMS web service API that will allow people to send SMS to their desired cellphone numbers. A request will be sent to the interface, we then process that request based on the account details provided and credits available on their accou... |
How to create a project in WebLogic Workshop (version 10.3) with support for JPA entity beans?
I am trying create a separate EJB and EJBClient projects in Workshop and EJB3 session beans work just fine, but I am having problems with JPA entity beans.
It seems that when creating a new project you can add support for JP... | Creating a project in WebLogic Workshop (version 10.3) with support for JPA entity beans while separating EJB and web components can be a bit tricky, but it's certainly doable. Here’s a step-by-step guide on how to achieve that:
### Step 1: Create EJB Project
1. **Open WebLogic Workshop**.
2. **Create a New EJB Proje... | 39,591 | [
{
"from": "human",
"value": "How to create a project in WebLogic Workshop (version 10.3) with support for JPA entity beans?\nI am trying create a separate EJB and EJBClient projects in Workshop and EJB3 session beans work just fine, but I am having problems with JPA entity beans. \nIt seems that when creati... |
I have a microcontroller that must download a large file from a PC serial port (115200 baud) and write it to serial flash memory over SPI (~2 MHz). The flash writes must be in 256 byte blocks preceded by a write command and page address. The total RAM available on the system is 1 kB with an 80 byte stack size.
This is ... | Your approach to using ring buffers and interrupt-driven communication for both UART and SPI is a good one, especially given the constraints of your microcontroller’s limited RAM. To further optimize the system and ensure smooth data flow between the UART and the SPI flash memory, here are some strategies to consider:
... | 44,335 | [
{
"from": "human",
"value": "I have a microcontroller that must download a large file from a PC serial port (115200 baud) and write it to serial flash memory over SPI (~2 MHz). The flash writes must be in 256 byte blocks preceded by a write command and page address. The total RAM available on the system is ... |
There are many usability evaluation techniques that have been developed over the history of software development. But it seems to me that they are rarely used in practice.
Why aren't usability evaluation tools and methods actually used much?
Or are they used more than I've been led to believe?
| Usability evaluation techniques are indeed an integral part of the software development process, but their use can vary significantly based on several factors. Here are some reasons why these techniques may not be widely adopted in practice:
1. **Time and Resource Constraints**: Conducting thorough usability evaluatio... | 49,106 | [
{
"from": "human",
"value": "There are many usability evaluation techniques that have been developed over the history of software development. But it seems to me that they are rarely used in practice.\nWhy aren't usability evaluation tools and methods actually used much?\nOr are they used more than I've be... |
I have a page with this HTML:
<p>
<img src="images/ih01.jpg" width="80" height="110" align="left" />
This course overs basic human anatomy and physiology, including the major
body systems and their functions. When you have completed this course you
will be able to identify major body components and thei... | The issue you're experiencing with Internet Explorer not wrapping text around the image could be due to several factors. Here are some potential solutions you can try to resolve the problem:
### 1. Use `float` Instead of `align`
Using the `align` attribute is an older method and may not work consistently across differ... | 49,051 | [
{
"from": "human",
"value": "I have a page with this HTML:\n<p>\n <img src=\"images/ih01.jpg\" width=\"80\" height=\"110\" align=\"left\" />\n This course overs basic human anatomy and physiology, including the major\n body systems and their functions. When you have completed this course you\n w... |
I'm struggling with the following problem. I use the jQuery autocomplete plugin to get a list of suggested values from the server. The list would look like this:
Username1|UserId1
Username2|UserId2
So if I start typing "U", a list of "Username1" and "Username2" pops up, as expected. I could chose the first item and t... | You can achieve your goal by using a custom formatter for your jQuery Autocomplete plugin. Instead of just displaying the usernames, you can store the user IDs in the underlying data. When a user selects a username, you can extract the associated user ID from the data and send it to the server.
Here’s how you can do i... | 45,910 | [
{
"from": "human",
"value": "I'm struggling with the following problem. I use the jQuery autocomplete plugin to get a list of suggested values from the server. The list would look like this:\n\nUsername1|UserId1\nUsername2|UserId2\n\nSo if I start typing \"U\", a list of \"Username1\" and \"Username2\" pops... |
I have a small program to order and sort email messages, outputting to a textfile using $msg->decoded->string. The perl program outputs to stdout, and I redirect it to a txt file. However, gedit is unable to open this text file because of a character set problem, and I would like to know how to restore or set a charact... | It sounds like the issue you're encountering with gedit is related to character encoding. If your Perl script outputs non-UTF-8 characters to the file, gedit may struggle to interpret the file correctly, while other editors like vi might be more lenient.
To ensure that your Perl program writes to the file using a spec... | 45,067 | [
{
"from": "human",
"value": "I have a small program to order and sort email messages, outputting to a textfile using $msg->decoded->string. The perl program outputs to stdout, and I redirect it to a txt file. However, gedit is unable to open this text file because of a character set problem, and I would lik... |
I have created a Custom Server Control (Inherited from GridView).
On the page, the GridView is DataBound to a DataSet, so I do not know at design time what columns will be present in my GridView.
Now, what I want to do is, to add a textbox in every Cell for the GridView Header row, and those textboxes will control colu... | In ASP.NET Web Forms, controls are typically created and initialized during the page lifecycle, and it's important to ensure that they are recreated on every postback to maintain their state. If you dynamically create controls like textboxes for filtering in the GridView header, you have to follow a specific approach t... | 37,795 | [
{
"from": "human",
"value": "I have created a Custom Server Control (Inherited from GridView).\nOn the page, the GridView is DataBound to a DataSet, so I do not know at design time what columns will be present in my GridView.\nNow, what I want to do is, to add a textbox in every Cell for the GridView Header... |
Let's say I have download links for files on my site.
When clicked these links send an AJAX request to the server which returns the URL with the location of the file.
What I want to do is direct the browser to download the file when the response gets back. Is there a portable way to do this?
| Yes, you can achieve this by handling the AJAX response and then programmatically creating a link element to trigger the file download. Below is a portable way to do it using JavaScript:
1. When the download link is clicked, you will send an AJAX request to the server.
2. Upon receiving the response with the file URL,... | 45,793 | [
{
"from": "human",
"value": "Let's say I have download links for files on my site. \nWhen clicked these links send an AJAX request to the server which returns the URL with the location of the file. \nWhat I want to do is direct the browser to download the file when the response gets back. Is there a portabl... |
A few years ago I worked on a system where a numeric primary key was stored in a [SQL Server] varchar column, so I quickly came unstuck when querying with a BETWEEN operator:
SELECT ID FROM MyTable WHERE ID BETWEEN 100 AND 110;
Results:
100
102
103
109
110
11
This was simply bad design. However, I'm working on an 3rd... | You are indeed facing a common issue that arises when alphanumeric fields are used for numeric data, particularly in situations where the database design cannot be easily altered. Your solution of using length checks is straightforward and should work reasonably well, but let's consider a few points regarding its effec... | 45,547 | [
{
"from": "human",
"value": "A few years ago I worked on a system where a numeric primary key was stored in a [SQL Server] varchar column, so I quickly came unstuck when querying with a BETWEEN operator:\nSELECT ID FROM MyTable WHERE ID BETWEEN 100 AND 110;\n\nResults:\n100\n102\n103\n109\n110\n11\n\nThis w... |
Which method makes the most sense for importing a module in python that is version specific? My use case is that I'm writing code that will be deployed into a python 2.3 environment and in a few months be upgraded to python 2.5. This:
if sys.version_info[:2] >= (2, 5):
from string import Template
else:
from our... | Both methods you've proposed will work for handling version-specific imports in Python, but they have different implications in terms of readability, maintainability, and explicitness.
Let's examine each approach:
### 1. Conditional Import Based on `sys.version_info`:
```python
if sys.version_info[:2] >= (2, 5):
... | 47,480 | [
{
"from": "human",
"value": "Which method makes the most sense for importing a module in python that is version specific? My use case is that I'm writing code that will be deployed into a python 2.3 environment and in a few months be upgraded to python 2.5. This:\nif sys.version_info[:2] >= (2, 5):\n fro... |
I've been using a local git repository interacting with my group's CVS repository for several months, now. I've made an almost neurotic number of branches, most of which have thankfully merged back into my trunk. But naming is starting to become an issue. If I have a task easily named with a simple label, but I acco... | Naming branches in Git is essential for maintaining a clear and organized workflow, especially when collaborating with others or when working on multiple tasks simultaneously. Here are some best practices for naming Git branches:
### 1. **Use a Consistent Naming Convention**
- Choose a standard format and stick wit... | 44,108 | [
{
"from": "human",
"value": "I've been using a local git repository interacting with my group's CVS repository for several months, now. I've made an almost neurotic number of branches, most of which have thankfully merged back into my trunk. But naming is starting to become an issue. If I have a task eas... |
When using the CHECKSUM column type to artificially create a hash index, is the lookup actually O(1) or is it still O(lg n) like it is for a clustered index? I have a table from which I will select based on its ID column and I need the lookup to be as fast as possible, so is the clustered index the fastest possible opt... | The CHECKSUM column type in a database is typically used to store a hash value derived from other columns. While using a checksum might help in reducing the size of the index and potentially speeding up lookups, it's important to clarify a few points regarding lookup performance and indexing strategies.
1. **O(1) vs. ... | 46,667 | [
{
"from": "human",
"value": "When using the CHECKSUM column type to artificially create a hash index, is the lookup actually O(1) or is it still O(lg n) like it is for a clustered index? I have a table from which I will select based on its ID column and I need the lookup to be as fast as possible, so is the... |
I'm sure this sounds like a n00b question, but how do I add sub items programmically while populating a TreeView list in VB.NET 3.5? I have the following code, but haven't been able to figure out how to add the sub items for each of the folders/files I'm populating the TreeView with:
Private Sub AddToList(ByVal target... | To create a TreeView that resembles the Windows Explorer structure in VB.NET, you need to use the `TreeNode` class to represent each node in the TreeView, including subnodes for files and directories.
Here's how you can modify your existing code to add sub-items (i.e., child nodes) to the TreeView:
1. Use `TreeNode` ... | 45,247 | [
{
"from": "human",
"value": "I'm sure this sounds like a n00b question, but how do I add sub items programmically while populating a TreeView list in VB.NET 3.5? I have the following code, but haven't been able to figure out how to add the sub items for each of the folders/files I'm populating the TreeView... |
I see in a header that I didn't write myself the following:
class MonitorObjectString: public MonitorObject {
// some other declarations
friend inline bool operator==(MonitorObjectString& lhs, MonitorObjectString& rhs) { return(lhs.fVal==rhs.fVal); }
I can't understand why this method is declared as friend. I t... | The `friend` declaration for the operator overload in the context you've provided serves a specific purpose, even if the function is defined inline within the class definition. Here's a breakdown of the situation:
1. **Friend Function Purpose**: By declaring the function as a `friend`, you allow that function to acces... | 47,627 | [
{
"from": "human",
"value": "I see in a header that I didn't write myself the following: \nclass MonitorObjectString: public MonitorObject {\n // some other declarations\n friend inline bool operator==(MonitorObjectString& lhs, MonitorObjectString& rhs) { return(lhs.fVal==rhs.fVal); }\n\nI can't underst... |
A strange thing happened after a supplier changed the XML header a bit. I used to be able to read stuff using xpath, but now I can't even get a reply with
$xml->xpath('/');
They changed it from this...
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE NewsML SYSTEM "http://www.newsml.org/dl.php?fn=NewsML/1.2/speci... | The issue you are experiencing is likely due to the introduction of XML namespaces in the new XML document. In XML, when elements are defined within a namespace, you must include the namespace in your XPath queries to correctly select those elements.
In your original XML structure, there were no namespaces, so you cou... | 46,655 | [
{
"from": "human",
"value": "A strange thing happened after a supplier changed the XML header a bit. I used to be able to read stuff using xpath, but now I can't even get a reply with\n$xml->xpath('/');\n\nThey changed it from this...\n<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n<!DOCTYPE NewsML SYSTEM... |
Greetings!
I have a DropDownList within a FormView which are bound to XmlDataSources:
<asp:FormView ID="MyFormView" runat="server" DataSourceID="MyXmlDataSource">
<ItemTemplate>
<h1><%# XPath("SomeNode")%></h1>
<asp:Label ID="MyLabel" runat="server" AssociatedControlID="MyDdl" Text='<%# XPath("SomeO... | The issue you're facing is due to the scope of the `FindControl` method and the context in which you're trying to access the DropDownList. Since the DropDownList is inside the FormView's ItemTemplate, you cannot use `FindControl` on the page or the FormView directly to locate the DropDownList. Instead, you should use t... | 46,575 | [
{
"from": "human",
"value": "Greetings!\nI have a DropDownList within a FormView which are bound to XmlDataSources:\n<asp:FormView ID=\"MyFormView\" runat=\"server\" DataSourceID=\"MyXmlDataSource\">\n <ItemTemplate>\n <h1><%# XPath(\"SomeNode\")%></h1>\n <asp:Label ID=\"MyLabel\" runat=\"s... |
In the case when I want to check, if a certain entry in the database exists I have two options.
I can create an sql query using COUNT() and then check, if the result is >0...
...or I can just retrieve the record(s) and then count the number of rows in the returned rowset. For example with $result->num_rows;
What's bett... | When deciding between using `COUNT()` in an SQL query or retrieving records and then counting them in your application code (using `$result->num_rows`), there are several factors to consider in terms of performance and efficiency.
### Using `COUNT()`
```sql
SELECT COUNT(*) FROM your_table WHERE condition;
```
**Adva... | 45,991 | [
{
"from": "human",
"value": "In the case when I want to check, if a certain entry in the database exists I have two options.\nI can create an sql query using COUNT() and then check, if the result is >0...\n...or I can just retrieve the record(s) and then count the number of rows in the returned rowset. For ... |
I have a simple function in which an array is declared with size
depending on the parameter which is int.
void f(int n){
char a[n];
};
int main() {
return 0;
}
This piece of code compiles fine on GNU C++, but not on MSVC 2005.
I get the following compilation errors:
.\main.cpp(4) :... | The issue you're encountering is related to the fact that the declaration of the array `char a[n]` uses Variable Length Arrays (VLAs), which are a feature of C99 and later, but not part of C++. The GNU C++ compiler provides some support for VLAs as an extension, while MSVC 2005 does not.
To make this code portable acr... | 49,435 | [
{
"from": "human",
"value": "I have a simple function in which an array is declared with size\ndepending on the parameter which is int.\n void f(int n){\n char a[n];\n };\n\n int main() {\n return 0;\n }\n\nThis piece of code compiles fine on GNU C++, but not on MSVC 2005.\nI get t... |
What is the best way to interop with NHibernate 2.0 and ASP.NET 3.5? How can I easily develop a CRUD application?
Is the ObjectDataSource the way to go?
Thank you.
| Interoperating with NHibernate 2.0 in an ASP.NET 3.5 application can be achieved effectively with a few considerations. For developing a CRUD application, the ObjectDataSource can indeed be a good approach, but there are other strategies you can use to facilitate this process as well. Here’s a concise guide to get you ... | 44,145 | [
{
"from": "human",
"value": "What is the best way to interop with NHibernate 2.0 and ASP.NET 3.5? How can I easily develop a CRUD application?\nIs the ObjectDataSource the way to go?\nThank you.\n"
},
{
"from": "gpt",
"value": "Interoperating with NHibernate 2.0 in an ASP.NET 3.5 application can... |
I have a class named Page with a private property currently called _pageData which stores all the information (such as title, content, keywords etc).
However, this to me doesn't look so good when I refer to it $this->_pageData. I want to think of a better name, and I'd imagine there would probably be a standard or 'be... | It's a common challenge to name private properties in a way that is both clear and future-proof. Here are some considerations and suggestions for naming your `_pageData` property, aiming for clarity and potential extensibility:
### Naming Considerations:
1. **Clarity**: The name should convey what kind of data is bein... | 47,736 | [
{
"from": "human",
"value": "I have a class named Page with a private property currently called _pageData which stores all the information (such as title, content, keywords etc). \nHowever, this to me doesn't look so good when I refer to it $this->_pageData. I want to think of a better name, and I'd imagine... |
I have a project to recognize the footprint of animals. It is similar to facial recognition.
There is a need to store footprint images in a database and compare them with images captured by camera.
What is the appropriate programming language to do this?
| For a project focused on recognizing animal footprints, which involves image processing and machine learning, several programming languages can be suitable. Here are some of the most commonly used languages for such tasks, along with their benefits:
1. **Python**:
- **Libraries**: Python has powerful libraries for ... | 42,176 | [
{
"from": "human",
"value": "I have a project to recognize the footprint of animals. It is similar to facial recognition.\nThere is a need to store footprint images in a database and compare them with images captured by camera.\nWhat is the appropriate programming language to do this?\n"
},
{
"from"... |
I'm trying to get information like OS version, hard disk space, disk space available, and installed RAM on a Linux system in C++. I know I can use system() to run different Linux commands and capture their output (which is what I'm currently doing) but I was wondering if there's a better way? Is there something in th... | In C++, the standard library does not provide direct functions to query system-specific information like OS version, hard disk space, or installed RAM. However, you can still obtain this information using various methods in C++ without relying heavily on the `system()` command.
### Getting System Information in C++
1... | 42,911 | [
{
"from": "human",
"value": "I'm trying to get information like OS version, hard disk space, disk space available, and installed RAM on a Linux system in C++. I know I can use system() to run different Linux commands and capture their output (which is what I'm currently doing) but I was wondering if there'... |
In ASP.NET MVC, the ActionResult class, which is the base for all results returned by action methods from a controller, is defined as an abstract class with the single method (© Microsoft):
public abstract void ExecuteResult(ControllerContext context);
Can you think of any specific reasons for this design? Specificall... | The design choice to use an abstract class (`ActionResult`) instead of an interface (`IActionResult`) in ASP.NET MVC has several implications, advantages, and reasons rooted in the framework's architectural goals:
1. **Default Behavior**: An abstract class allows the framework to provide default behavior that can be i... | 48,470 | [
{
"from": "human",
"value": "In ASP.NET MVC, the ActionResult class, which is the base for all results returned by action methods from a controller, is defined as an abstract class with the single method (© Microsoft):\npublic abstract void ExecuteResult(ControllerContext context);\n\nCan you think of any s... |
I'm building a database that will store information on a range of objects (such as scientific papers, specimens, DNA sequences, etc.) that all have a presence online and can be identified by a URL, or an identifier such as a DOI. Using these GUIDs as the primary key for the object seems a reasonable idea, and I've foll... | Using MD5 hashes of GUIDs (like URLs or DOIs) as primary keys in your database is a valid approach, and it comes with both pros and cons. Here are some considerations to help you weigh the merits of this method:
### Pros:
1. **Consistency**: Using a hash derived from the GUID ensures that the primary key remains cons... | 42,077 | [
{
"from": "human",
"value": "I'm building a database that will store information on a range of objects (such as scientific papers, specimens, DNA sequences, etc.) that all have a presence online and can be identified by a URL, or an identifier such as a DOI. Using these GUIDs as the primary key for the obje... |
If I have a function that needs to work with a shared_ptr, wouldn't it be more efficient to pass it a reference to it (so to avoid copying the shared_ptr object)?
What are the possible bad side effects?
I envision two possible cases:
1) inside the function a copy is made of the argument, like in
ClassA::take_copy_of_sp... | Your intuition about passing `shared_ptr` by reference to avoid unnecessary copies is generally correct, but let's break down the scenarios you mentioned and discuss the implications of each approach.
### Case 1: Copying the shared_ptr
In the first scenario, you have a function that takes a reference to a `shared_ptr`... | 45,162 | [
{
"from": "human",
"value": "If I have a function that needs to work with a shared_ptr, wouldn't it be more efficient to pass it a reference to it (so to avoid copying the shared_ptr object)?\nWhat are the possible bad side effects?\nI envision two possible cases:\n1) inside the function a copy is made of t... |
I am using a ListView to display the main screen of my application.
The main screen is essentially a menu to get into the different sections of application. Currently, I have the ListView whose contents are added programmatically in the onCreate method.
Here is the code snippet that does this:
String[] mainItems = {... | To create a more customized ListView item layout with an `ImageView` and a `TextView`, you will need to create a custom adapter that extends `ArrayAdapter`. This will allow you to control how each item in the ListView is displayed, including setting images and text.
Here's a step-by-step guide on how to do this:
1. *... | 43,543 | [
{
"from": "human",
"value": "I am using a ListView to display the main screen of my application.\nThe main screen is essentially a menu to get into the different sections of application. Currently, I have the ListView whose contents are added programmatically in the onCreate method. \nHere is the code sni... |
I know it's possible to use CSS to add page breaks to web pages, for when they're printed.
I also know CSS support in HTML emails is poor.
So, is there a way to generate a page break when an HTML email is printed? Or given the variety of email clients out there, is that just a daft question?
| It's a valid question, but unfortunately, achieving consistent page breaks in printed HTML emails can be quite challenging due to the varying levels of CSS support across different email clients. Unlike web browsers, email clients often strip out CSS or only partially support certain CSS properties.
### What You Need ... | 48,786 | [
{
"from": "human",
"value": "I know it's possible to use CSS to add page breaks to web pages, for when they're printed.\nI also know CSS support in HTML emails is poor.\nSo, is there a way to generate a page break when an HTML email is printed? Or given the variety of email clients out there, is that just ... |
i`m getting NoClassDefintion found error in my application even though i had the associated jars in my lin folder of my ear the error is
java.rmi.RemoteException: EJB Exception: ; nested exception is:
java.lang.NoClassDefFoundError: com/sun/rave/web/ui/model/Option
Note i had added the same user library to my ... | The `NoClassDefFoundError` you're encountering indicates that the Java Virtual Machine (JVM) could not find the definition of the class `com.sun.rave.web.ui.model.Option` at runtime, even though it was available at compile time. This is a common issue when there are discrepancies between the build environment and the r... | 45,473 | [
{
"from": "human",
"value": "i`m getting NoClassDefintion found error in my application even though i had the associated jars in my lin folder of my ear the error is \njava.rmi.RemoteException: EJB Exception: ; nested exception is:\n java.lang.NoClassDefFoundError: com/sun/rave/web/ui/model/Option\nN... |
I was wondering how a window opened through ShowDialog is treated in the Visual Tree.
For example, Window A opens Window B through a ShowDialog. When firing a routed command on Window B, Window A does not receieve the command (even though it is listening for it).
Is there any way to make this work?
Thanks!
Jon
| In WPF, when you open a window modally using `ShowDialog`, the modal window (Window B in your case) takes focus and becomes the active window. This means that the routed events and commands within the visual tree are limited to Window B and its child elements.
Since Window B is a modal dialog, it effectively isolates... | 44,047 | [
{
"from": "human",
"value": "I was wondering how a window opened through ShowDialog is treated in the Visual Tree.\nFor example, Window A opens Window B through a ShowDialog. When firing a routed command on Window B, Window A does not receieve the command (even though it is listening for it).\nIs there any... |
For the umpteenth time my laptop just shut down in the middle of my game because my power cable had disconnected without me noticing it.
Now I want to write a little C# program that detects when my power cable disconnects and then emits a nice long System beep. What API could I use for that?
| To create a C# program that detects when the power cable is disconnected, you can use the Windows Management Instrumentation (WMI) API. WMI allows you to monitor various system events, including power events like battery status changes.
Here's a basic example that shows how you can use WMI to listen for power status c... | 44,845 | [
{
"from": "human",
"value": "For the umpteenth time my laptop just shut down in the middle of my game because my power cable had disconnected without me noticing it.\nNow I want to write a little C# program that detects when my power cable disconnects and then emits a nice long System beep. What API could I... |
I was intending to have a play with git, and was wondering if anyone had used the git plugin for eclipse
I see it's at version 0.3.1, and was wondering if anyone knew how stable it was / any gotchas?
Update:
If you are using a recent version of Eclipse, your Help menu has an 'Eclipse Marketplace...' link.
Enter 'git'... | It sounds like you're referring to the EGit plugin for Eclipse, which is a very popular choice for integrating Git support directly into the IDE. Here are some key points regarding its stability and usage:
1. **Version Stability**: EGit has been in active development and receives regular updates. The version you menti... | 47,863 | [
{
"from": "human",
"value": "I was intending to have a play with git, and was wondering if anyone had used the git plugin for eclipse\nI see it's at version 0.3.1, and was wondering if anyone knew how stable it was / any gotchas?\n\nUpdate:\nIf you are using a recent version of Eclipse, your Help menu has a... |
I was wondering if anyone knows of a quick way or if anyone has written a reflection tool to tell which objects in a solution are not marked as serializable. I'm switching a site over to a StateServer and i need to have all objects marked as serializable. I don't want to miss any.
Also, second part do enums have to b... | To identify which objects in your ASP.NET 1.1 solution are not marked as `[Serializable]`, you can create a simple reflection-based tool that scans through your assemblies. Here’s a quick way to implement such a tool in C#:
### Reflection Tool to Identify Non-Serializable Classes
You can create a console application ... | 45,396 | [
{
"from": "human",
"value": "I was wondering if anyone knows of a quick way or if anyone has written a reflection tool to tell which objects in a solution are not marked as serializable. I'm switching a site over to a StateServer and i need to have all objects marked as serializable. I don't want to miss ... |
So I've got a form in my Rails app which uses a custom FormBuilder to give me some custom field tags
<% form_for :staff_member, @staff_member, :builder => MyFormBuilder do |f| %>
[...]
<%= render :partial => "staff_members/forms/personal_details", :locals => {:f => f, :skill_groups => @skill_groups, :staff_member =... | Yes, you can absolutely use your custom `FormBuilder` object in a partial that is rendered as part of an AJAX response. To achieve this, you need to ensure that you're passing the `FormBuilder` instance to the partial when rendering it in the AJAX callback.
Here's how you can modify your controller action that handles... | 48,006 | [
{
"from": "human",
"value": "So I've got a form in my Rails app which uses a custom FormBuilder to give me some custom field tags\n<% form_for :staff_member, @staff_member, :builder => MyFormBuilder do |f| %>\n[...]\n <%= render :partial => \"staff_members/forms/personal_details\", :locals => {:f => f, :... |
Right now we've got web pages that show UI elements, and web pages that just process form submissions, and then redirect back to the UI pages. They do this using PHP's header() function:
header("Location: /other_page.php");
This causes a 302 Found response to be sent; according to the HTTP 1.1 spec, 302 is for cases ... | You are correct in your understanding of the HTTP status codes, and it’s great that you’re considering the semantics of the status codes in your application. Let’s explore the difference between the 302 and 303 status codes and see why using 303 could be more appropriate in your situation.
### Understanding Status Cod... | 46,267 | [
{
"from": "human",
"value": "Right now we've got web pages that show UI elements, and web pages that just process form submissions, and then redirect back to the UI pages. They do this using PHP's header() function:\nheader(\"Location: /other_page.php\");\n\nThis causes a 302 Found response to be sent; acc... |
Here is the current architecture of my transaction scope source code. The third insert throws an .NET exception (Not a SQL Exception) and it is not rolling back the two previous insert statements. What I am doing wrong?
EDIT: I removed the try/catch from insert2 and insert3. I also removed the exception handling ut... | The issue you are experiencing with the transaction not rolling back could stem from a few different factors related to how transactions are managed with ADO.NET and the usage of `TransactionScope`. Here are some points to consider to resolve the problem:
### Key Points to Check and Update
1. **Ensure Proper Connecti... | 40,615 | [
{
"from": "human",
"value": "Here is the current architecture of my transaction scope source code. The third insert throws an .NET exception (Not a SQL Exception) and it is not rolling back the two previous insert statements. What I am doing wrong?\nEDIT: I removed the try/catch from insert2 and insert3.... |
...I have read a few threads on here that have discussed various methods and was just looking for some feedback on a proposed solution we came up with. In one of the threads a comment was posted recommending a public/private key which sounded great, this is what we were thinking...
Client Side -
1. Key is stored insid... | Your proposed solution provides a basic level of security for managing high scores in a Flash game, but there are several important considerations and potential vulnerabilities to be aware of:
### Client-Side Security
1. **Key Storage in Flash SWF**: Storing the key inside the Flash SWF is inherently insecure. An atta... | 44,004 | [
{
"from": "human",
"value": "...I have read a few threads on here that have discussed various methods and was just looking for some feedback on a proposed solution we came up with. In one of the threads a comment was posted recommending a public/private key which sounded great, this is what we were thinkin... |
Given an ASP.NET MVC view that generates a table of entries using a "for" loop, what is the best way to add a "delete" link for each of the table rows? My first intuition would be to use jQuery to make an AJAX call to delete the row, then refresh the table. It seems like there should be an easier way though. Maybe m... | You have a couple of viable approaches for adding a "delete" functionality to your ASP.NET MVC view. Both the AJAX method and the traditional POST method with a redirect have their own merits. Let’s review both options:
### Option 1: AJAX Call
Using jQuery to send an AJAX request to delete an item can provide a smoot... | 39,852 | [
{
"from": "human",
"value": "Given an ASP.NET MVC view that generates a table of entries using a \"for\" loop, what is the best way to add a \"delete\" link for each of the table rows? My first intuition would be to use jQuery to make an AJAX call to delete the row, then refresh the table. It seems like t... |
We are in the process of writing code to generate check constraints with all valid values from our enumeration mappings. Some of our enumerations are inside composite-elements through mapped set collections (see below):
<set name="Addresses" table="[Addresses$]" access="field.camelcase-underscore">
<key column="Per... | To retrieve column information from mapped sets in NHibernate, especially when dealing with composite elements (like your `Address` class), you'll need to utilize the NHibernate mapping model to navigate through the collection and its elements. Here are some steps and considerations to help you access the column inform... | 45,024 | [
{
"from": "human",
"value": "We are in the process of writing code to generate check constraints with all valid values from our enumeration mappings. Some of our enumerations are inside composite-elements through mapped set collections (see below):\n<set name=\"Addresses\" table=\"[Addresses$]\" access=\"fi... |
The iPhone SDK docs claim fopen() is a supported method of file access but I am unable to get it to return a FILE handle. I am accessing a directory which is included in my project. I have tried fopen "filename","dir/filename","./filename","./dir/filename","/dir/filename" all returning with a null pointer. Some peop... | When using `fopen()` in an iOS application, it's important to understand that the file paths are often different from what you might expect, especially when it comes to accessing files included in your project. Here are some steps and tips to help you troubleshoot the issue:
1. **Accessing Bundle Resources**:
Files... | 47,525 | [
{
"from": "human",
"value": "The iPhone SDK docs claim fopen() is a supported method of file access but I am unable to get it to return a FILE handle. I am accessing a directory which is included in my project. I have tried fopen \"filename\",\"dir/filename\",\"./filename\",\"./dir/filename\",\"/dir/filen... |
I have an external program that will generate an xml document out from the db and pass it to BizTalk. Is it possible to create a transaction id or something(the id the message as in the DB) so I can keep track of the message in BizTalk, and store information in a BizTalk custom Pipeline to the database with the given t... | Yes, it is definitely possible to create a transaction ID or similar identifier in your XML documents to keep track of messages in BizTalk. Here’s an outline of how you can achieve this and some considerations for tracking the processing status of messages:
### 1. Generate a Unique Transaction ID
- You can modify the ... | 45,028 | [
{
"from": "human",
"value": "I have an external program that will generate an xml document out from the db and pass it to BizTalk. Is it possible to create a transaction id or something(the id the message as in the DB) so I can keep track of the message in BizTalk, and store information in a BizTalk custom ... |
I met with a strange problem about sqlite3. I obtained different connections of the same database file using open() method. connection 1 begins a transaction, and connection 2 begins another transaction, which is to update several records of a table. Then connection 1 commit the transaction, followed by connection 2 co... | The issue you are experiencing with SQLite and multiple connections to the same database file is likely due to how SQLite handles transactions and locking.
SQLite uses a locking mechanism to ensure that only one write operation can occur at a time, while read operations can happen concurrently. Here's a breakdown of w... | 47,778 | [
{
"from": "human",
"value": "I met with a strange problem about sqlite3. I obtained different connections of the same database file using open() method. connection 1 begins a transaction, and connection 2 begins another transaction, which is to update several records of a table. Then connection 1 commit the... |
I'm playing around with Rhino Mocks and am trying to set some dummy results on my mocked objects so when they are called in my factory methods I don't have to worry about the data.
But I've hit a snag, the methods I want to have the dummy results for are causing exceptions because they aren't virtual.
I've got code lik... | In Rhino Mocks, for a method to be mocked, it typically needs to be virtual. This is because mocking frameworks, including Rhino Mocks, utilize a technique called "dynamic proxy generation" to create a proxy object that overrides the behavior of the method being mocked. If the method is not marked as virtual (or if it'... | 45,487 | [
{
"from": "human",
"value": "I'm playing around with Rhino Mocks and am trying to set some dummy results on my mocked objects so when they are called in my factory methods I don't have to worry about the data.\nBut I've hit a snag, the methods I want to have the dummy results for are causing exceptions beca... |
Are there any good, free (or at least reasonably cheap)
profilers for at least native C++ that can integrate with
Visual Studio 2008 Professional?
I looked at DevPartner community edition but they
seem to only support Visual Studio 2003 and Visual Studio 2005.
Failing that are there any good free/cheap profilers in ... | There are a few profiling options you can consider that are compatible with Visual Studio 2008 and are either free or relatively inexpensive. Here are some suggestions:
1. **Visual Studio Performance Profiler**:
- If you have Visual Studio 2008 Professional, it comes with a built-in performance profiler. You can ac... | 45,448 | [
{
"from": "human",
"value": "Are there any good, free (or at least reasonably cheap) \nprofilers for at least native C++ that can integrate with \nVisual Studio 2008 Professional?\nI looked at DevPartner community edition but they \nseem to only support Visual Studio 2003 and Visual Studio 2005.\nFailing th... |
This is always a pain, no matter what source control system I have used (Visual SourceSafe, CVS, ClearCase, etc.). The binary .frx files always cause a problem when merging Visual Basic forms.
I know...I know...why are you using Visual Basic...because there are lots of legacy applications still written using it and alt... | You're definitely not alone in facing challenges with binary files in source control systems, especially with legacy Visual Basic applications that use .frx files. These files, which store the resources associated with forms (like images and other binary data), can complicate version control because they can't be merge... | 47,986 | [
{
"from": "human",
"value": "This is always a pain, no matter what source control system I have used (Visual SourceSafe, CVS, ClearCase, etc.). The binary .frx files always cause a problem when merging Visual Basic forms.\nI know...I know...why are you using Visual Basic...because there are lots of legacy a... |
In what situations should one catch java.lang.Error on an application?
| In Java, `java.lang.Error` is a subclass of `Throwable` that represents serious problems that a reasonable application should not try to catch. Errors are typically conditions that cannot be handled programmatically and indicate serious issues that may lead to the termination of the application, such as `OutOfMemoryErr... | 46,617 | [
{
"from": "human",
"value": "In what situations should one catch java.lang.Error on an application?\n"
},
{
"from": "gpt",
"value": "In Java, `java.lang.Error` is a subclass of `Throwable` that represents serious problems that a reasonable application should not try to catch. Errors are typicall... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.