instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
I have a VB.net test application that clicks a link that opens the Microsoft Word application window and displays the document. How do I locate the Word application window so that I can grab some text from it?
To interact with the Microsoft Word application from a VB.NET application, you can use the `System.Runtime.InteropServices` namespace to work with COM objects. Here’s a step-by-step guide on how to locate the Word application window and grab some text from it. ### Step 1: Add Reference to Microsoft Word Object Library...
2,971
[ { "from": "human", "value": "I have a VB.net test application that clicks a link that opens the Microsoft Word application window and displays the document. How do I locate the Word application window so that I can grab some text from it?\n" }, { "from": "gpt", "value": "To interact with the Mic...
Occasionally, I find that while debugging an ASP.Net application (written in visual studio 2008, running on Vista 64-bit) the local ASP.Net development server (i.e. 'Cassini') stops responding. A message often comes up telling me that "Data Execution Prevention (DEP)" has killed WebDev.WebServer.exe The event logs simp...
Data Execution Prevention (DEP) is a security feature that helps protect your system by preventing malicious code from running in certain areas of memory. When DEP is enabled, it can sometimes interfere with legitimate applications, like the ASP.NET Development Server (Cassini) in your case, particularly if those appli...
3,636
[ { "from": "human", "value": "Occasionally, I find that while debugging an ASP.Net application (written in visual studio 2008, running on Vista 64-bit) the local ASP.Net development server (i.e. 'Cassini') stops responding.\nA message often comes up telling me that \"Data Execution Prevention (DEP)\" has kil...
I'm trying to fully understand all of Haskell's concepts. In what ways are algebraic data types similar to generic types, e.g., in C# and Java? And how are they different? What's so algebraic about them anyway? I'm familiar with universal algebra and its rings and fields, but I only have a vague idea of how Haskell's ...
Great questions! Let's dive into the similarities and differences between algebraic data types (ADTs) in Haskell and generic types in languages like C# and Java, and clarify what "algebraic" means in this context. ### Similarities between Algebraic Data Types and Generic Types 1. **Type Abstraction**: Both ADTs in Ha...
1,756
[ { "from": "human", "value": "I'm trying to fully understand all of Haskell's concepts.\nIn what ways are algebraic data types similar to generic types, e.g., in C# and Java? And how are they different? What's so algebraic about them anyway? \nI'm familiar with universal algebra and its rings and fields, but...
I've used Apache CXF to expose about ten java classes as web services. I've generated clients using CXF, Axis, and .NET. In Axis and CXF a "Service" or "Locator" is generated. From this service you can get a "Port". The "Port" is used to make individual calls to the methods exposed by the web service. In .NET the "Ser...
In the context of web services, particularly when working with frameworks like Apache CXF and Axis, the terms "Service," "Locator," "Port," and "Endpoint" refer to different concepts in the architecture of web service communication. Here's a breakdown of each term and their roles: ### 1. **Service** A **Service** in ...
2,040
[ { "from": "human", "value": "I've used Apache CXF to expose about ten java classes as web services.\nI've generated clients using CXF, Axis, and .NET.\nIn Axis and CXF a \"Service\" or \"Locator\" is generated. \nFrom this service you can get a \"Port\".\nThe \"Port\" is used to make individual calls to the...
The web applications I develop often require co-dependent configuration settings and there are also settings that have to change as we move between each of our environments. All our settings are currently simple key-value pairs but it would be useful to create custom config sections so that it is obvious when two value...
Creating custom configuration sections for your web applications can significantly enhance the clarity and maintainability of your settings, especially when dealing with co-dependent configurations and environment-specific changes. Here's a comprehensive approach to creating custom config sections, along with special c...
1,317
[ { "from": "human", "value": "The web applications I develop often require co-dependent configuration settings and there are also settings that have to change as we move between each of our environments.\nAll our settings are currently simple key-value pairs but it would be useful to create custom config sec...
Task: implement paging of database records suitable for different RDBMS. Method should work for mainstream engines - MSSQL2000+, Oracle, MySql, etc. Please don't post RDBMS specific solutions, I know how to implement this for most of the modern database engines. I'm looking for the universal solution. Only temporary ta...
Implementing a universal paging solution for various RDBMS systems can indeed be challenging due to differences in SQL dialects and features. However, there is a general approach that can be adapted across multiple platforms by using temporary tables or common table expressions (CTEs). Below, I will outline a general S...
3,239
[ { "from": "human", "value": "Task: implement paging of database records suitable for different RDBMS. Method should work for mainstream engines - MSSQL2000+, Oracle, MySql, etc.\nPlease don't post RDBMS specific solutions, I know how to implement this for most of the modern database engines. I'm looking for...
All the articles I've found via google are either obsolete or contradict one another. What's the easiest way to print a form or, say, a richtextbox in c#? I think it's using the PrintDiaglog class by setting the Document, but how does this get converted?
To print a form or a `RichTextBox` in C#, you generally utilize the `PrintDocument` class along with `PrintDialog` for user interaction. The `PrintDocument` class provides methods to handle the actual printing process, and you need to implement the `PrintPage` event to define what will be printed. Here’s a step-by-ste...
2,888
[ { "from": "human", "value": "All the articles I've found via google are either obsolete or contradict one another.\nWhat's the easiest way to print a form or, say, a richtextbox in c#? I think it's using the PrintDiaglog class by setting the Document, but how does this get converted?\n" }, { "from":...
What is the best way to shred XML data into various database columns? So far I have mainly been using the nodes and value functions like so: INSERT INTO some_table (column1, column2, column3) SELECT Rows.n.value('(@column1)[1]', 'varchar(20)'), Rows.n.value('(@column2)[1]', 'nvarchar(100)'), Rows.n.value('(@column3)[1]...
When dealing with large XML data in SQL Server, the method you're using—leveraging the `nodes()` and `value()` functions—can become slow as the size of the XML increases. To improve performance, there are several strategies you might consider: ### 1. Use `OPENXML` If your XML is large, you can use the `OPENXML` funct...
2,936
[ { "from": "human", "value": "What is the best way to shred XML data into various database columns? So far I have mainly been using the nodes and value functions like so:\nINSERT INTO some_table (column1, column2, column3)\nSELECT\nRows.n.value('(@column1)[1]', 'varchar(20)'),\nRows.n.value('(@column2)[1]', ...
I'm designing a database table and asking myself this question: How long should the firstname field be? Does anyone have a list of reasonable lengths for the most common fields, such as first name, last name, and email address?
When designing a database table and defining the lengths of fields such as first name, last name, and email address, it's important to consider both common usage and potential edge cases. Below are some reasonable lengths for these fields based on common practices: ### Recommended Lengths: 1. **First Name**: - **...
3,457
[ { "from": "human", "value": "I'm designing a database table and asking myself this question: How long should the firstname field be?\nDoes anyone have a list of reasonable lengths for the most common fields, such as first name, last name, and email address?\n" }, { "from": "gpt", "value": "When ...
We have several jobs that run concurrently that have to use the same config info for log4j. They are all dumping the logs into one file using the same appender. Is there a way to have each job dynamically name its log file so they stay seperate? Thanks Tom
Yes, you can configure Log4j to create dynamically named log files for each job by using a combination of pattern layouts and environment variables or job-specific identifiers. Below are some general approaches to achieve this with Log4j. ### Option 1: Using Environment Variables If each job sets an environment varia...
3,837
[ { "from": "human", "value": "We have several jobs that run concurrently that have to use the same config info for log4j. They are all dumping the logs into one file using the same appender. Is there a way to have each job dynamically name its log file so they stay seperate?\nThanks\nTom\n" }, { "f...
What method do I call to get the name of a class?
In Python, you can use the `__class__` attribute of an instance to access its class, and then call the `__name__` attribute to get the name of that class. Here's how you can do it: ```python class MyClass: pass instance = MyClass() class_name = instance.__class__.__name__ print(class_name) # Output: MyClass ```...
6,953
[ { "from": "human", "value": "What method do I call to get the name of a class?\n" }, { "from": "gpt", "value": "In Python, you can use the `__class__` attribute of an instance to access its class, and then call the `__name__` attribute to get the name of that class. Here's how you can do it:\n\n...
I've run on a little problem today: I have a JS drop down menu and when I inserted a GoogleMap... the Menu is rendered behind the Google Map... Any ideas on how to chance the z Index of the Google Map? Thanks!
If your dropdown menu is rendering behind the Google Map, it's likely due to the CSS `z-index` property. You can adjust the `z-index` of your Google Map or the dropdown menu to ensure the dropdown appears on top. Here’s how you can do it: 1. **Set the z-index of the Google Map**: You can set a lower z-index for the m...
4,732
[ { "from": "human", "value": "I've run on a little problem today: I have a JS drop down menu and when I inserted a GoogleMap... the Menu is rendered behind the Google Map... Any ideas on how to chance the z Index of the Google Map?\nThanks!\n" }, { "from": "gpt", "value": "If your dropdown menu i...
Is there any way to work with Oracle UDT's with current WCF adaptor?
As of my last knowledge update in October 2023, working with Oracle User-Defined Types (UDTs) in WCF (Windows Communication Foundation) services can be challenging, mainly because WCF and Oracle's .NET Data Provider do not provide out-of-the-box support for UDTs. However, there are some approaches you can consider to ...
3,262
[ { "from": "human", "value": "Is there any way to work with Oracle UDT's with current WCF adaptor?\n" }, { "from": "gpt", "value": "As of my last knowledge update in October 2023, working with Oracle User-Defined Types (UDTs) in WCF (Windows Communication Foundation) services can be challenging, ...
As part of our databuild run a 3rd party program (3D Studio Max) to export a number of assets. Unfortunately if a user is not currently logged in, or the machine is locked, then Max does not run correctly. This can be solved for freshly booted machines by using a method such as TweakUI for automatic login. However when...
To ensure that your Windows Server does not lock or can unlock itself after a Remote Desktop session ends, there are a few methods you can consider. Please note that any method you choose should comply with your organization's IT policies and security standards. ### Method 1: Use Group Policy to Prevent Locking You c...
1,473
[ { "from": "human", "value": "As part of our databuild run a 3rd party program (3D Studio Max) to export a number of assets. Unfortunately if a user is not currently logged in, or the machine is locked, then Max does not run correctly.\nThis can be solved for freshly booted machines by using a method such as...
<xsl:for-each select="./node [position() &lt;= (count(*) div 2)]"> <li>foo</li> </xsl:for-each> <xsl:for-each select="./node [count(*) div 2 &lt; position()]"> <li>bar</li> </xsl:for-each> My list has 12 nodes, but the second list is always 8 and the first is always 4. What's wrong with my selects?
Your XSLT code is attempting to split a list of nodes into two parts using the `count()` function and `position()`. However, there's a misunderstanding in the logic you are using in the selection criteria for the second `<xsl:for-each>` statement. Here's a breakdown of what’s wrong: 1. **Selection Logic**: In your fi...
3,686
[ { "from": "human", "value": "<xsl:for-each select=\"./node [position() &lt;= (count(*) div 2)]\">\n <li>foo</li>\n</xsl:for-each>\n<xsl:for-each select=\"./node [count(*) div 2 &lt; position()]\">\n <li>bar</li>\n</xsl:for-each>\n\nMy list has 12 nodes, but the second list is always 8 and the first is...
In the Full .NET framework you can use the Color.FromArgb() method to create a new color with alpha blending, like this: Color blended = Color.FromArgb(alpha, color); or Color blended = Color.FromArgb(alpha, red, green , blue); However in the Compact Framework (2.0 specifically), neither of those methods are availabl...
The issue you are encountering with the alpha blending not working as expected in the Compact Framework likely arises from the limitations of how the Compact Framework handles colors, particularly regarding alpha blending. In the Compact Framework, the `Color` class implementation may not fully support alpha blending ...
4,133
[ { "from": "human", "value": "In the Full .NET framework you can use the Color.FromArgb() method to create a new color with alpha blending, like this:\nColor blended = Color.FromArgb(alpha, color);\n\nor\nColor blended = Color.FromArgb(alpha, red, green , blue);\n\nHowever in the Compact Framework (2.0 speci...
Many times we find ourselves working on a problem, only to figure out the solution being created is far more complex than the problem requires. Are there controls, best practices, techniques, etc that help you control over complication in your workplace?
Absolutely! Complexity in problem-solving can often arise from overthinking, miscommunication, or unnecessary features. Here are some best practices and techniques to help maintain simplicity and avoid overcomplication in the workplace: 1. **Define the Problem Clearly**: - Spend time understanding and articulating...
4,136
[ { "from": "human", "value": "Many times we find ourselves working on a problem, only to figure out the solution being created is far more complex than the problem requires. Are there controls, best practices, techniques, etc that help you control over complication in your workplace?\n" }, { "from":...
I am developing a GPL-licensed application in Python and need to know if the GPL allows my program to use proprietary plug-ins. This is what the FSF has to say on the issue: If a program released under the GPL uses plug-ins, what are the requirements for the licenses of a plug-in? It depends on how the program invokes...
The issue of using proprietary plug-ins with a GPL-licensed application in Python hinges largely on how those plug-ins interact with your application. As you've noted from the Free Software Foundation (FSF), the key distinction involves how the plug-ins are integrated with your main program. 1. **Fork/Exec Approach**:...
4,472
[ { "from": "human", "value": "I am developing a GPL-licensed application in Python and need to know if the GPL allows my program to use proprietary plug-ins. This is what the FSF has to say on the issue:\n\nIf a program released under the GPL uses plug-ins, what are the requirements for the licenses of a plu...
I've found out how to convert errors into exceptions, and I display them nicely if they aren't caught, but I don't know how to log them in a useful way. Simply writing them to a file won't be useful, will it? And would you risk accessing a database, when you don't know what caused the exception yet?
Logging exceptions in a useful way requires careful consideration, particularly when it comes to the context and severity of the error. Here are some best practices to effectively log exceptions: ### 1. **Structured Logging**: - Use structured logging frameworks (like Serilog, NLog, or Log4j) to log exceptions in a...
2,595
[ { "from": "human", "value": "I've found out how to convert errors into exceptions, and I display them nicely if they aren't caught, but I don't know how to log them in a useful way. Simply writing them to a file won't be useful, will it? And would you risk accessing a database, when you don't know what caus...
Polyglot, or multiple language, solutions allow you to apply languages to problems which they are best suited for. Yet, at least in my experience, software shops tend to want to apply a "super" language to all aspects of the problem they are trying to solve. Sticking with that language come "hell or high water" even ...
There are several reasons why software teams might opt for a "super" language approach rather than implementing polyglot solutions, despite the potential advantages of using different languages for specific tasks: 1. **Complexity and Overhead**: Introducing multiple languages can significantly increase the complexity ...
3,967
[ { "from": "human", "value": "Polyglot, or multiple language, solutions allow you to apply languages to problems which they are best suited for. Yet, at least in my experience, software shops tend to want to apply a \"super\" language to all aspects of the problem they are trying to solve. Sticking with th...
Does anyone know any simple way to retrieve the country from a given IP Address, preferably in ISO_3166-1 format?
Yes, there are several simple ways to retrieve the country from a given IP address in ISO 3166-1 format. Here are some popular methods: 1. **Using an API**: - **ipinfo.io**: You can make a request to the ipinfo API. Here's an example using curl: ```bash curl ipinfo.io/8.8.8.8 ``` - **ip-api.com**:...
3,364
[ { "from": "human", "value": "Does anyone know any simple way to retrieve the country from a given IP Address, preferably in ISO_3166-1 format?\n" }, { "from": "gpt", "value": "Yes, there are several simple ways to retrieve the country from a given IP address in ISO 3166-1 format. Here are some p...
How does one convert a .Net DateTime into a valid HTTP-formatted date string?
To convert a .NET `DateTime` object into a valid HTTP-formatted date string, you can use the `ToString` method with a specific format that matches the HTTP-date format specified by RFC 7231. The correct format is typically "R", which stands for the RFC1123 pattern. Here's how you can do it in C#: ```csharp using Syst...
6,128
[ { "from": "human", "value": "How does one convert a .Net DateTime into a valid HTTP-formatted date string?\n" }, { "from": "gpt", "value": "To convert a .NET `DateTime` object into a valid HTTP-formatted date string, you can use the `ToString` method with a specific format that matches the HTTP-...
I'm looking for a simple algorithm to 'serialize' a directed graph. In particular I've got a set of files with interdependencies on their execution order, and I want to find the correct order at compile time. I know it must be a fairly common thing to do - compilers do it all the time - but my google-fu has been weak t...
The problem you're describing is a classic example of **topological sorting** of a directed acyclic graph (DAG). Topological sorting provides a linear ordering of vertices such that for every directed edge \( u \rightarrow v \), vertex \( u \) comes before vertex \( v \) in the ordering. This is particularly useful for...
4,723
[ { "from": "human", "value": "I'm looking for a simple algorithm to 'serialize' a directed graph. In particular I've got a set of files with interdependencies on their execution order, and I want to find the correct order at compile time. I know it must be a fairly common thing to do - compilers do it all th...
In Ruby, trying to print out the individual elements of a String is giving me trouble. Instead of seeing each character, I'm seeing their ASCII values instead: >> a = "0123" => "0123" >> a[0] => 48 I've looked online but can't find any way to get the original "0" back out of it. I'm a little new to Ruby to I know it ...
In Ruby, when you access an individual character of a string using the bracket notation (like `a[0]`), it returns the ASCII code of that character as an integer. If you want to get the character itself, you should use the `[]` method and ensure that you access it correctly. To print each character of the string `a`, y...
6,135
[ { "from": "human", "value": "In Ruby, trying to print out the individual elements of a String is giving me trouble. Instead of seeing each character, I'm seeing their ASCII values instead: \n>> a = \"0123\"\n=> \"0123\"\n>> a[0]\n=> 48\n\nI've looked online but can't find any way to get the original \"0\" b...
Is there a general procedure for programming extensibility capability into your code? I am wondering what the general procedure is for adding extension-type capability to a system you are writing so that functionality can be extended through some kind of plugin API rather than having to modify the core code of a system...
Adding extensibility capability to your system via a plugin architecture is a well-established approach in software design. While the specific implementation details can vary based on the programming language and the context of the application, there are some general principles and procedures that can guide you through...
1,881
[ { "from": "human", "value": "Is there a general procedure for programming extensibility capability into your code?\nI am wondering what the general procedure is for adding extension-type capability to a system you are writing so that functionality can be extended through some kind of plugin API rather than ...
I'm having some conceptual trouble on figuring out how to best implement this... I want to create a custom Activity class for Windows Workflow. The activity has to call out to a third party library method that itself runs another process asynchronously and may take anywhere from seconds to many hours to complete. Thi...
When dealing with long-running operations in Windows Workflow Foundation (WF), you need to account for the fact that workflows can be paused, persisted, and resumed. This brings some specific considerations when implementing a custom activity that interfaces with a third-party library that performs long-running tasks. ...
1,974
[ { "from": "human", "value": "I'm having some conceptual trouble on figuring out how to best implement this... I want to create a custom Activity class for Windows Workflow. The activity has to call out to a third party library method that itself runs another process asynchronously and may take anywhere fro...
What are some of the best or most popular rule engines? I haven't settled on a programming language, so tell me the rule engine and what programming languages it supports.
There are several popular rule engines available, each with its own features and supported programming languages. Here's a list of some of the best rule engines and the languages they support: 1. **Drools** - **Description**: An open-source business rule management system (BRMS) that uses the Rete algorithm for rul...
1,170
[ { "from": "human", "value": "What are some of the best or most popular rule engines? I haven't settled on a programming language, so tell me the rule engine and what programming languages it supports.\n" }, { "from": "gpt", "value": "There are several popular rule engines available, each with i...
In Ruby, I'm trying to do the following. def self.stats(since) return Events.find(:all, :select => 'count(*) as this_count', :conditions => ['Date(event_date) >= ?', (Time.now - since)]).first.this_count end where "since" is a string representing an amount of time ('1 hour', '1 day', '3 days') and so on. Any suggest...
In Ruby, you can use the `ActiveSupport` library, which is part of Rails, to easily parse time intervals like '1 hour', '1 day', '3 days', etc. Here's how you can modify your `stats` method to handle the `since` string correctly and compute the appropriate time: ```ruby class YourClass def self.stats(since) # Pa...
3,599
[ { "from": "human", "value": "In Ruby, I'm trying to do the following.\ndef self.stats(since)\n return Events.find(:all, :select => 'count(*) as this_count', :conditions => ['Date(event_date) >= ?', (Time.now - since)]).first.this_count\nend\n\nwhere \"since\" is a string representing an amount of time ('1 ...
The HTML standard defines a clear separation of concerns between CSS (presentation) and HTML (semantics or structure). Does anyone use a coding standards document for CSS and XHTML that has clauses which help to maintain this separation? What would be good clauses to include in such a coding standards document?
Creating a coding standards document for CSS and XHTML is a great way to promote best practices and maintain a clear separation of concerns between structure (HTML) and presentation (CSS). Here are some suggested clauses to include in such a document: ### General Principles 1. **Separation of Concerns**: - Clearly...
3,377
[ { "from": "human", "value": "The HTML standard defines a clear separation of concerns between CSS (presentation) and HTML (semantics or structure).\nDoes anyone use a coding standards document for CSS and XHTML that has clauses which help to maintain this separation? What would be good clauses to include in...
Consider the need to develop a lightweight desktop DB application on the Microsoft platforms. It could be done fairly easily with MS Access but I'd like to be able to distribute it to others and I don't want to pay for a runtime license. Requirements: easy distribution to others no runtime licensing issues Consider...
If you're looking for low-cost or free alternatives to MS Access that meet your requirements of easy distribution and no runtime licensing issues, there are several options to consider. Here are some suggestions: ### 1. **LibreOffice Base** - **Overview**: Similar to OpenOffice, LibreOffice Base offers a user-friendly...
3,052
[ { "from": "human", "value": "Consider the need to develop a lightweight desktop DB application on the Microsoft platforms.\nIt could be done fairly easily with MS Access but I'd like to be able to distribute it to others and I don't want to pay for a runtime license. \nRequirements:\n\neasy distribution to...
Is it possible to use gcov for coverage testing of multi-threaded applications? I've set some trivial tests of our code-base up, but it would be nice to have some idea of the coverage we're achieving. If gcov isn't appropriate can anyone recommend an alternative tool (possible oprofile), ideally with some good documen...
Yes, it is possible to use `gcov` for coverage testing of multi-threaded applications, but there are a few considerations to keep in mind. `gcov` works well for measuring code coverage in general, but when it comes to multi-threaded applications, there are some caveats. ### Key Points When Using `gcov` with Multi-thre...
3,737
[ { "from": "human", "value": "Is it possible to use gcov for coverage testing of multi-threaded applications? \nI've set some trivial tests of our code-base up, but it would be nice to have some idea of the coverage we're achieving. If gcov isn't appropriate can anyone recommend an alternative tool (possible...
I use asp.net 3.5 and have also begun looking at 3.5 sp1 I like the clean urls that mvc tends to have but use asp.net webforms for my primary development. I normally use a url rewriter in order to accomplish this type stuff. When I say clean urls I mean like /products to get a list of products and /products/Product_One...
Your questions about displaying data in ASP.NET WebForms and utilizing features like Clean URLs and UpdatePanels highlight the different approaches to building user interfaces in web applications. Here are my thoughts on each of your questions: ### 1) Which is better in your opinion? Both methods have their advantage...
2,820
[ { "from": "human", "value": "I use asp.net 3.5 and have also begun looking at 3.5 sp1\nI like the clean urls that mvc tends to have but use asp.net webforms for my primary development. I normally use a url rewriter in order to accomplish this type stuff. When I say clean urls I mean like /products to get a ...
I am trying to get some accurate runtime comparisons of PHP vs Python (and potentially any other language that I have to include). Timing within a script is not my problem but timing within a script does not account for everything from the moment the request is made to run the script to output. 1) Is it actually worth...
### 1. Is it actually worth taking such things into account? Yes, it is worth taking the entire request-response lifecycle into account when comparing programming languages such as PHP and Python, especially if you're focused on web application performance. Key reasons include: - **Server Overheads**: Different langu...
3,415
[ { "from": "human", "value": "I am trying to get some accurate runtime comparisons of PHP vs Python (and potentially any other language that I have to include). Timing within a script is not my problem but timing within a script does not account for everything from the moment the request is made to run the s...
We have concurrent edits happening on Word documents and I want to make sure that Subversion can handle merging .doc files. Do you know if Subversion handles merges of Word documents well?
Subversion (SVN) is primarily designed for version control of text files, which makes it effective for source code and other text-based documents. However, it is not well-suited for handling binary files, such as Microsoft Word documents (.doc or .docx). When it comes to merging .doc files, Subversion will treat them ...
6,181
[ { "from": "human", "value": "We have concurrent edits happening on Word documents and I want to make sure that Subversion can handle merging .doc files. Do you know if Subversion handles merges of Word documents well?\n" }, { "from": "gpt", "value": "Subversion (SVN) is primarily designed for ve...
I have a small local network. Only one of the machines is available to the outside world (this is not easily changeable). I'd like to be able to set it up such that ssh requests that don't come in on the standard port go to another machine. Is this possible? If so, how? Oh and all of these machines are running either U...
Yes, it is possible to set up your local network such that SSH requests that don't come in on the standard port (22) are redirected to another machine. You can achieve this using `iptables` on the machine that is accessible from the outside, which we'll call the "gateway" machine. ### Overview of the Setup: 1. **Gate...
1,598
[ { "from": "human", "value": "I have a small local network. Only one of the machines is available to the outside world (this is not easily changeable). I'd like to be able to set it up such that ssh requests that don't come in on the standard port go to another machine. Is this possible? If so, how?\nOh and ...
Is there an existing application or library in Java which will allow me to convert a CSV data file to XML file? The XML tags would be provided through possibly the first row containing column headings.
Yes, there are several libraries in Java that can help you convert a CSV file to an XML file, using the first row as the header for XML tags. Here are a few libraries and approaches you can consider: ### 1. **Apache Commons CSV and JAXB** You can use Apache Commons CSV to read the CSV file and JAXB (Java Architecture...
832
[ { "from": "human", "value": "Is there an existing application or library in Java which will allow me to convert a CSV data file to XML file? \nThe XML tags would be provided through possibly the first row containing column headings.\n" }, { "from": "gpt", "value": "Yes, there are several librar...
I find working on the command line in Windows frustrating, primarily because the console window is wretched to use compared to terminal applications on linux and OS X such as "rxvt", "xterm", or "Terminal". Major complaints: No standard copy/paste. You have to turn on "mark" mode and it's only available from a multi...
Yes, there are several alternatives and tricks that can significantly improve your command line experience on Windows. Here are some recommendations: ### 1. **Windows Terminal** Windows Terminal is a modern and powerful terminal application that supports multiple tabs, customization, and improved copy/paste functional...
2,699
[ { "from": "human", "value": "I find working on the command line in Windows frustrating, primarily because the console window is wretched to use compared to terminal applications on linux and OS X such as \"rxvt\", \"xterm\", or \"Terminal\". Major complaints:\n\nNo standard copy/paste. You have to turn on...
Other than self.class.send :method, args..., of course. I'd like to make a rather complex method available at both the class and instance level without duplicating the code. UPDATE: @Jonathan Branam: that was my assumption, but I wanted to make sure nobody else had found a way around. Visibility in Ruby is very dif...
In Ruby, you can indeed define a method that can be accessed at both the class level and the instance level without duplicating the code. One common approach is to define a private method in the class context and then call that private method from both the class method and the instance method. Here's an example of how...
3,212
[ { "from": "human", "value": "Other than self.class.send :method, args..., of course. I'd like to make a rather complex method available at both the class and instance level without duplicating the code.\n\nUPDATE: \n@Jonathan Branam: that was my assumption, but I wanted to make sure nobody else had found a...
Using a configuration file I want to enable myself to turn on and off things like (third party) logging and using a cache in a C# website. The solution should not be restricted to logging and caching in particular but more general, so I can use it for other things as well. I have a configuration xml file in which I can...
You're looking for a flexible approach to enable or disable features (like logging and caching) based on a configuration file in your C# application. The approach you're considering—using conditionals like `if (logging)` or `if (caching)`—is indeed one method, but there are more elegant and maintainable ways to achieve...
4,012
[ { "from": "human", "value": "Using a configuration file I want to enable myself to turn on and off things like (third party) logging and using a cache in a C# website. The solution should not be restricted to logging and caching in particular but more general, so I can use it for other things as well.\nI ha...
One thing I've always wanted to do is develop my very own operating system (not necessarily fancy like Linux or Windows, but better than a simple boot loader which I've already done). I'm having a hard time finding resources/guides that take you past writing a simple "Hello World" OS. I know lots of people will probabl...
It's great to see your enthusiasm for operating system development! Creating your own OS can indeed be a rewarding and challenging project. Here's a more curated list of resources, tutorials, and projects that might help you build upon your existing knowledge and push your OS development skills further: ### Tutorials ...
92
[ { "from": "human", "value": "One thing I've always wanted to do is develop my very own operating system (not necessarily fancy like Linux or Windows, but better than a simple boot loader which I've already done).\nI'm having a hard time finding resources/guides that take you past writing a simple \"Hello Wo...
If you are working in PHP (or I guess any programming language) and using subversion as your source control, is there a way to take your project (for example): C:\Projects\test\.svn C:\Projects\test\docs\ C:\Projects\test\faq.php C:\Projects\test\guestbook.php C:\Projects\test\index.php C:\Projects\test\test...
In Subversion (SVN), there's no built-in functionality that directly allows you to create a snapshot of a project that ignores certain files or directories while still retaining version control. However, you can accomplish your goal by using a combination of SVN commands and a script to automate the process. Here's ho...
4,288
[ { "from": "human", "value": "If you are working in PHP (or I guess any programming language) and using subversion as your source control, is there a way to take your project (for example):\n\nC:\\Projects\\test\\.svn\n C:\\Projects\\test\\docs\\\n C:\\Projects\\test\\faq.php\n C:\\Projects\\test\\guestbo...
So I've done the trivial "warmup" apps with GAE. Now I'd like to build something with a more complex directory structure. Something along the lines of: siteroot/ models/ controllers/ controller1/ controller2/ ... templates/ template1/ template2/ ... ..etc. ...
To create a clean directory structure for your Google App Engine (GAE) application, while ensuring that your controllers can easily access templates stored in a separate directory, you can use a straightforward approach based on Python's built-in capabilities. Here’s a suggested structure for your application: ``` si...
3,323
[ { "from": "human", "value": "So I've done the trivial \"warmup\" apps with GAE. Now I'd like to build something with a more complex directory structure. Something along the lines of:\nsiteroot/\n models/\n controllers/\n controller1/\n controller2/\n ...\n templates/\n ...
What's the best way to programmatically merge a .reg file into the registry? This is for unit testing; the .reg file is a test artifact which will be added then removed at the start and end of testing. Or, if there's a better way to unit test against the registry...
When unit testing applications that interact with the Windows registry, you should approach the situation with caution, as modifying the registry can have side effects on the system. However, if you need to work with a .reg file during your tests, here's a structured approach: ### Method 1: Using `regedit` to Import ....
2,753
[ { "from": "human", "value": "What's the best way to programmatically merge a .reg file into the registry? This is for unit testing; the .reg file is a test artifact which will be added then removed at the start and end of testing.\nOr, if there's a better way to unit test against the registry...\n" }, {...
I have several tables whose only unique data is a uniqueidentifier (a Guid) column. Because guids are non-sequential (and they're client-side generated so I can't use newsequentialid()), I have made a non-primary, non-clustered index on this ID field rather than giving the tables a clustered primary key. I'm wondering ...
Your situation raises some important considerations about database design, particularly regarding primary keys, clustering, and performance. Here are some points to consider: ### 1. Importance of Primary Keys: - **Uniqueness and Integrity**: Every table should have a primary key to ensure each row can be uniquely iden...
3,422
[ { "from": "human", "value": "I have several tables whose only unique data is a uniqueidentifier (a Guid) column. Because guids are non-sequential (and they're client-side generated so I can't use newsequentialid()), I have made a non-primary, non-clustered index on this ID field rather than giving the table...
Im testing an ASP.NEt site. When I execute it, it starts the ASP.NET Development Server and opens up a page. Now I want to test it in the intranet I have. Can I use this server or I need to configure IIS in this machine? Do I need to configure something for it to work? I've changed the localhost to the correct IP ...
You can use the ASP.NET Development Server (also known as Cassini) for testing your application on your intranet, but there are a few considerations to keep in mind. Here’s how you can set it up: ### Using the ASP.NET Development Server: 1. **Change the URL**: As you mentioned, you have already changed `localhost` to...
1,996
[ { "from": "human", "value": "Im testing an ASP.NEt site. When I execute it, it starts the ASP.NET Development Server and opens up a page.\nNow I want to test it in the intranet I have. \n\nCan I use this server or I need to configure IIS in this machine? \nDo I need to configure something for it to work?\n...
I wonder how you guys manage deployment of a database between 2 SQL Servers, specifically SQL Server 2005. Now, there is a development and a live one. As this should be part of a buildscript (standard windows batch, even do with current complexity of those scripts, i might switch to PowerShell or so later), Enterprise ...
Managing database deployments, especially in SQL Server 2005, requires careful consideration of how you handle schema changes, data migrations, and keeping environments in sync. Here are a few strategies and tools you might consider for automating this process: ### 1. Generate SQL Scripts for Deployment Instead of co...
2,734
[ { "from": "human", "value": "I wonder how you guys manage deployment of a database between 2 SQL Servers, specifically SQL Server 2005.\nNow, there is a development and a live one. As this should be part of a buildscript (standard windows batch, even do with current complexity of those scripts, i might swit...
What are the advantages/disadvantages of keeping SQL in your C# source code or in Stored Procs? I've been discussing this with a friend on an open source project that we're working on (C# ASP.NET Forum). At the moment, most of the database access is done by building the SQL inline in C# and calling to the SQL Server DB...
When deciding whether to keep SQL in your C# source code or in stored procedures, it’s essential to weigh the advantages and disadvantages of each approach. Here’s a more comprehensive breakdown to help you in your open-source project. ### Advantages of Inline SQL in C# Code: 1. **Ease of Maintenance**: - Changes ...
592
[ { "from": "human", "value": "What are the advantages/disadvantages of keeping SQL in your C# source code or in Stored Procs? I've been discussing this with a friend on an open source project that we're working on (C# ASP.NET Forum). At the moment, most of the database access is done by building the SQL inli...
I have an object that implements IDisposable that is registered with the Windsor Container and I would like to dispose of it so it's Dispose method is called and next time Resolve is called it fetches a new instance. Does container.Release(obj); automatically call Dispose() immediately? Or do I need to do obj.Dispo...
In Castle Windsor, calling `container.Release(obj)` will indeed automatically call the `Dispose()` method on the `IDisposable` object you release. This means you do not need to explicitly call `obj.Dispose()` before you call `container.Release(obj)`. Here's a brief summary of how `Release` works: - It marks the objec...
4,688
[ { "from": "human", "value": "I have an object that implements IDisposable that is registered with the Windsor Container and I would like to dispose of it so it's Dispose method is called and next time Resolve is called it fetches a new instance.\nDoes \ncontainer.Release(obj); \n\nautomatically call Dispose...
I know that we shouldn't being using the registry to store Application Data anymore, but in updating a Legacy application (and wanting to do the fewest changes), what Registry Hives are non-administrators allowed to use? Can I access all of HKEY_CURRENT_USER (the application currently access HKEY_LOCAL_MACHINE) witho...
Yes, you can access all of the **HKEY_CURRENT_USER** (HKCU) hive without needing Administrator privileges. This registry hive is specifically designed for user-specific settings, meaning that any modifications or access to keys in HKCU can be performed by the user who is currently logged in without requiring elevated p...
6,011
[ { "from": "human", "value": "I know that we shouldn't being using the registry to store Application Data anymore, but in updating a Legacy application (and wanting to do the fewest changes), what Registry Hives are non-administrators allowed to use? \nCan I access all of HKEY_CURRENT_USER (the application ...
I'd like to find the different ways to solve a real life problem I had: imagine to have a contest, or a game, during which the users collect points. You have to build a query to show the list of users with the best "n" scores. I'm making an example to clarify. Let's say that this is the Users table, with the points ea...
Certainly! In SQL Server, there are multiple ways to retrieve the top N scores from a Users table. Below are several different approaches to achieve the result you want: ### 1. Using `ORDER BY` with `TOP` This is the simplest way to get the top N scores. ```sql SELECT UserId, Points FROM Users ORDER BY Points DESC OF...
3,600
[ { "from": "human", "value": "I'd like to find the different ways to solve a real life problem I had: imagine to have a contest, or a game, during which the users collect points. You have to build a query to show the list of users with the best \"n\" scores. \nI'm making an example to clarify. Let's say that...
Inspired by Raymond Chen's post, say you have a 4x4 two dimensional array, write a function that rotates it 90 degrees. Raymond links to a solution in pseudo code, but I'd like to see some real world stuff. [1][2][3][4] [5][6][7][8] [9][0][1][2] [3][4][5][6] Becomes: [3][9][5][1] [4][0][6][2] [5][1][7][3] [6][2][8][4]...
To rotate a 4x4 two-dimensional array (matrix) 90 degrees clockwise, you can follow a straightforward algorithm. Below is the implementation in Python that shows how to do this. Here's the function to rotate the matrix: ```python def rotate_matrix(matrix): n = len(matrix) # First, transpose the matrix fo...
4,315
[ { "from": "human", "value": "Inspired by Raymond Chen's post, say you have a 4x4 two dimensional array, write a function that rotates it 90 degrees. Raymond links to a solution in pseudo code, but I'd like to see some real world stuff.\n[1][2][3][4]\n[5][6][7][8]\n[9][0][1][2]\n[3][4][5][6]\n\nBecomes:\n[3]...
I'm writing an Emacs major mode for an APL dialect I use at work. I've gotten basic font locking to work, and after setting comment-start and comment-start-skip, comment/uncomment region and fill paragraph also work. However, comment blocks often contain javadoc style comments and i would like fill-paragraph to avoid g...
To achieve the behavior you want in your Emacs major mode without writing a completely custom `fill-paragraph` function, you can indeed utilize `paragraph-start` and `paragraph-separate`. Since you're dealing with comment blocks, you want to ensure that the filling operation respects those javadoc-style commands and do...
5,060
[ { "from": "human", "value": "I'm writing an Emacs major mode for an APL dialect I use at work. I've gotten\nbasic font locking to work, and after setting comment-start and\ncomment-start-skip, comment/uncomment region and fill paragraph also\nwork.\nHowever, comment blocks often contain javadoc style commen...
I have thus far avoided the nightmare that is testing multi-threaded code since it just seems like too much of a minefield. I'd like to ask how people have gone about testing code that relies on threads for successful execution, or just how people have gone about testing those kinds of issues that only show up when tw...
Testing multi-threaded code can indeed be challenging due to the inherent complexity of concurrency, race conditions, and timing issues. Here are some strategies and techniques that programmers commonly use to test multi-threaded code effectively: ### 1. **Use Proper Synchronization:** - Ensure that shared resource...
3,572
[ { "from": "human", "value": "I have thus far avoided the nightmare that is testing multi-threaded code since it just seems like too much of a minefield. I'd like to ask how people have gone about testing code that relies on threads for successful execution, or just how people have gone about testing those ...
How can I set, clear, and toggle a bit?
You can set, clear, and toggle bits in a number using bitwise operations in programming. Here's a brief overview of how to perform each operation: 1. **Set a bit**: To set a bit (change it to 1), use the bitwise OR operation (`|`) with a bitmask. The bitmask has the bit you want to set to 1. ```python def set_b...
4,295
[ { "from": "human", "value": "How can I set, clear, and toggle a bit?\n" }, { "from": "gpt", "value": "You can set, clear, and toggle bits in a number using bitwise operations in programming. Here's a brief overview of how to perform each operation:\n\n1. **Set a bit**: To set a bit (change it to...
In other words: Log on as Bert (who is an administrator) Using fast user switching, log on as Ernie (Bert remains logged on) Switch back to Bert Bert logs Ernie off What is the best way to achieve step 4?
To log Ernie off while logged back into Bert's account, you can follow these steps: 1. **Switch back to Bert's account**: Use the fast user switching feature to return to Bert’s account. 2. **Log Ernie off**: - **Windows**: 1. Open the **Task Manager** by right-clicking the taskbar and selecting “Task Manage...
5,429
[ { "from": "human", "value": "In other words:\n\nLog on as Bert (who is an administrator)\nUsing fast user switching, log on as Ernie (Bert remains logged on)\nSwitch back to Bert\nBert logs Ernie off\n\nWhat is the best way to achieve step 4?\n" }, { "from": "gpt", "value": "To log Ernie off whi...
I always tend to forget these built-in Symfony functions for making links.
In Symfony, especially when using Twig for templating, there are several built-in functions that help you generate URLs and links. Here are the most commonly used functions for this purpose: 1. **path()**: This function generates a relative URL for a given route name. For example: ```twig <a href="{{ path('rout...
4,602
[ { "from": "human", "value": "I always tend to forget these built-in Symfony functions for making links.\n" }, { "from": "gpt", "value": "In Symfony, especially when using Twig for templating, there are several built-in functions that help you generate URLs and links. Here are the most commonly u...
I have a function where I need to do something to a string. I need the function to return a boolean indicating whether or not the operation succeeded, and I also need to return the modified string. In C#, I would use an out parameter for the string, but there is no equivalent in Python. I'm still very new to Python...
Yes, returning multiple values in Python using a tuple is a common and accepted practice. In Python, functions can return multiple values, and when they do, they are typically returned as a tuple. This pattern is very Pythonic and is often used in various built-in functions and libraries. Here's an example of how you ...
6,007
[ { "from": "human", "value": "I have a function where I need to do something to a string. I need the function to return a boolean indicating whether or not the operation succeeded, and I also need to return the modified string. \nIn C#, I would use an out parameter for the string, but there is no equivalen...
I am using Adobe Flex/Air here, but as far as I know this applies to all of JavaScript. I have come across this problem a few times, and there must be an easy solution out there! Suppose I have the following XML (using e4x): var xml:XML = <root><example>foo</example></root> I can change the contents of the example nod...
In E4X (ECMAScript for XML), if you want to change the contents of the root node, you can simply replace its child nodes. You can do this by using the `replace` method or by directly assigning a new XML element to it. Here's how you can do it: 1. **Using the `replace` method**: You can replace the child of the root...
3,416
[ { "from": "human", "value": "I am using Adobe Flex/Air here, but as far as I know this applies to all of JavaScript. I have come across this problem a few times, and there must be an easy solution out there!\nSuppose I have the following XML (using e4x):\nvar xml:XML = <root><example>foo</example></root>\n\...
Is Microsoft sort.exe 5.1.2600.0 (xpclient.010817-1148) able to sort UTF-16 (LE) files?
The `sort.exe` utility that comes with Windows XP, including version 5.1.2600.0, primarily handles text files that use the system's current code page. Windows XP's sort utility does not natively support UTF-16 encoding. It is designed to work with ASCII and system-specific encodings, like ANSI. If you're dealing with ...
7,199
[ { "from": "human", "value": "Is Microsoft sort.exe 5.1.2600.0 (xpclient.010817-1148) able to sort UTF-16 (LE) files?\n" }, { "from": "gpt", "value": "The `sort.exe` utility that comes with Windows XP, including version 5.1.2600.0, primarily handles text files that use the system's current code p...
I want to query a number of different databases mainly Oracle and Informix. Can anyone suggest me some tool using which I can do this easily?
There are several tools you can use to query different databases like Oracle and Informix. Here are some popular options that allow you to connect to multiple database types and facilitate querying: 1. **SQL Developer (Oracle)**: - While primarily an Oracle tool, SQL Developer can also connect to other databases us...
3,380
[ { "from": "human", "value": "I want to query a number of different databases mainly Oracle and Informix.\nCan anyone suggest me some tool using which I can do this easily?\n" }, { "from": "gpt", "value": "There are several tools you can use to query different databases like Oracle and Informix. ...
From the Immediate Window in Visual Studio: > Path.Combine(@"C:\x", "y") "C:\\x\\y" > Path.Combine(@"C:\x", @"\y") "\\y" It seems that they should both be the same. The old FileSystemObject.BuildPath() didn't work this way...
The behavior you're observing with `Path.Combine` in C# is due to how it handles the second path parameter when it is specified. This behavior is defined in the .NET Framework, and it's important to understand how `Path.Combine` interprets the components of the paths. 1. **Path.Combine(@"C:\x", "y")**: - The first ...
5,819
[ { "from": "human", "value": "From the Immediate Window in Visual Studio: \n> Path.Combine(@\"C:\\x\", \"y\")\n\"C:\\\\x\\\\y\"\n> Path.Combine(@\"C:\\x\", @\"\\y\")\n\"\\\\y\"\n\nIt seems that they should both be the same. \nThe old FileSystemObject.BuildPath() didn't work this way...\n" }, { "from...
I frequently use git stash and git stash pop to save and restore changes in my working tree. Yesterday, I had some changes in my working tree that I had stashed and popped, and then I made more changes to my working tree. I'd like to go back and review yesterday's stashed changes, but git stash pop appears to remove al...
When you run `git stash pop`, it applies the changes from the stash and then removes the stash entry from the stash list. However, since `git stash` creates a commit in the Git history, that commit still exists in the repository even though the reference to it was removed from the stash. To recover the commit referenc...
5,501
[ { "from": "human", "value": "I frequently use git stash and git stash pop to save and restore changes in my working tree. Yesterday, I had some changes in my working tree that I had stashed and popped, and then I made more changes to my working tree. I'd like to go back and review yesterday's stashed change...
I'm looking at a new computer which will probably have vista on it. But there are so many editions of vista; are there any weird restrictions on what you can run on the various editions? For instance you couldn't run IIS on Windows ME. Can you still run IIS on the home editions of vista?
Windows Vista has several editions, each tailored for different users and use cases. The editions include: 1. **Windows Vista Home Basic** 2. **Windows Vista Home Premium** 3. **Windows Vista Business** 4. **Windows Vista Enterprise** 5. **Windows Vista Ultimate** In terms of running Internet Information Services (II...
7,444
[ { "from": "human", "value": "I'm looking at a new computer which will probably have vista on it. But there are so many editions of vista; are there any weird restrictions on what you can run on the various editions? For instance you couldn't run IIS on Windows ME. Can you still run IIS on the home editio...
Do any editors honer C #line directives with regards to goto line features? Context: I'm working on a code generator and need to jump to a line of the output but the line is specified relative to the the #line directives I'm adding. I can drop them but then finding the input line is even a worse pain
The `#line` directives in C# are used to adjust the line numbers and file names reported by the compiler. This can be particularly useful in scenarios like code generation, where you're dynamically creating code and want to maintain a mapping between the generated code and the source code. However, support for `#line` ...
5,018
[ { "from": "human", "value": "Do any editors honer C #line directives with regards to goto line features?\nContext:\nI'm working on a code generator and need to jump to a line of the output but the line is specified relative to the the #line directives I'm adding.\nI can drop them but then finding the input ...
Does anyone know of anywhere I can find actual code examples of Software Phase Locked Loops (SPLLs) ? I need an SPLL that can track a PSK modulated signal that is somewhere between 1.1 KHz and 1.3 KHz. A Google search brings up plenty of academic papers and patents but nothing usable. Even a trip to the University lib...
Finding practical code examples for Software Phase Locked Loops (SPLLs) can be challenging, especially for specific applications like tracking a PSK modulated signal. However, I can provide you with some guidance on where to look and a basic outline of what your SPLL might look like. ### Resources for Code Examples 1....
587
[ { "from": "human", "value": "Does anyone know of anywhere I can find actual code examples of Software Phase Locked Loops (SPLLs) ? \nI need an SPLL that can track a PSK modulated signal that is somewhere between 1.1 KHz and 1.3 KHz. A Google search brings up plenty of academic papers and patents but nothing...
I've used the PHP MVC framework Symfony to build an on-demand web app. It has an annoying bug - the session expires after about 15-30 minutes of inactivity. There is a config directive to prevent session expiration but it does not work. Even workarounds such as this one did not help me. I intend not to migrate to Symfo...
It sounds like you're dealing with session management issues in your Symfony application. Here are several suggestions to help you troubleshoot and potentially resolve the session expiration problem: ### 1. Check `session.gc_maxlifetime` Make sure that your PHP configuration is correctly set to maintain sessions for a...
3,823
[ { "from": "human", "value": "I've used the PHP MVC framework Symfony to build an on-demand web app.\nIt has an annoying bug - the session expires after about 15-30 minutes of inactivity. There is a config directive to prevent session expiration but it does not work. Even workarounds such as this one did not...
I'm interested in learning some (ideally) database agnostic ways of selecting the nth row from a database table. It would also be interesting to see how this can be achieved using the native functionality of the following databases: SQL Server MySQL PostgreSQL SQLite Oracle I am currently doing something like the fo...
Selecting the nth row from a database table can be done in several ways, depending on the specific database system. Below, I will outline both database-agnostic approaches as well as specific methods for SQL Server, MySQL, PostgreSQL, SQLite, and Oracle. ### Database-Agnostic Approaches 1. **Using Subqueries**: Yo...
1,292
[ { "from": "human", "value": "I'm interested in learning some (ideally) database agnostic ways of selecting the nth row from a database table. It would also be interesting to see how this can be achieved using the native functionality of the following databases: \n\nSQL Server\nMySQL\nPostgreSQL\nSQLite\nOra...
I just started using GNU Emacs as my text editor and I am concerned about getting afflicted with "Emacs Pinky" by having to constantly press the control key with my pinky finger as is required when using Emacs. How can I avoid potentially getting this type of repetitive strain injury?
"Emacs Pinky" is a common concern for new users of GNU Emacs, especially since it requires frequent use of the Control key (often referred to as "C-") for many commands. Here are several strategies to minimize the risk of repetitive strain injury: 1. **Use the Escape Key (Esc):** Instead of pressing Control for comman...
3,601
[ { "from": "human", "value": "I just started using GNU Emacs as my text editor and I am concerned about getting afflicted with \"Emacs Pinky\" by having to constantly press the control key with my pinky finger as is required when using Emacs. How can I avoid potentially getting this type of repetitive strain...
I know there is no "right" heap size, but which heap size do you use in your applications (application type, jdk, os)? The JVM Options -Xms (initial/minimum) and -Xmx (maximum) allow for controlling the heap size. What settings make sense under which circumstances? When are the defaults appropriate?
Choosing the appropriate heap size for a Java application can greatly impact performance, resource utilization, and application responsiveness. While there isn't a one-size-fits-all answer, here are some considerations and guidelines based on different application types, environments, and usage patterns: ### General G...
3,289
[ { "from": "human", "value": "I know there is no \"right\" heap size, but which heap size do you use in your applications (application type, jdk, os)?\nThe JVM Options -Xms (initial/minimum) and -Xmx (maximum) allow for controlling the heap size. What settings make sense under which circumstances? When are t...
I always thought Java uses pass-by-reference. However, I read a blog post which claims that Java uses pass-by-value. I don't think I understand the distinction the author is making. What is the explanation?
The confusion around whether Java uses "pass-by-value" or "pass-by-reference" stems from how it handles variable passing, especially with object references. Here’s a detailed explanation to clarify the distinction: ### Pass-by-Value vs. Pass-by-Reference: 1. **Pass-by-Value**: This means that when you pass a variable...
3,034
[ { "from": "human", "value": "I always thought Java uses pass-by-reference. However, I read a blog post which claims that Java uses pass-by-value. I don't think I understand the distinction the author is making.\nWhat is the explanation?\n" }, { "from": "gpt", "value": "The confusion around wheth...
I was checking out Intel's "whatif" site and their Transactional Memory compiler (each thread has to make atomic commits or rollback the system's memory, like a Database would). It seems like a promising way to replace locks and mutexes but I can't find many testimonials. Does anyone here have any input?
Intel's "whatif" site and their work on Transactional Memory (TM) represent a significant exploration into simplifying concurrent programming by allowing threads to operate in a way that eliminates many of the traditional issues associated with locks and mutexes. Here are some points to consider based on the general un...
2,796
[ { "from": "human", "value": "I was checking out Intel's \"whatif\" site and their Transactional Memory compiler (each thread has to make atomic commits or rollback the system's memory, like a Database would). \nIt seems like a promising way to replace locks and mutexes but I can't find many testimonials. Do...
I am using ASP.NET Dynamic Data for a project and I have a table that has two seperate fields that link to the same foreign key in a different table. This relationship works fine in SQL Server. However, in the LINQ to SQL model in the ASP.NET Dynamic Data model, only the first field's relationship is reflected. If I a...
In ASP.NET Dynamic Data (DD), handling multiple foreign keys from a single table to another can indeed be a bit tricky since LINQ to SQL usually expects each relationship to be unique. Here are some steps you can take to resolve the issue of having multiple foreign key relationships to the same foreign table: ### 1. ...
2,578
[ { "from": "human", "value": "I am using ASP.NET Dynamic Data for a project and I have a table that has two seperate fields that link to the same foreign key in a different table.\nThis relationship works fine in SQL Server.\nHowever, in the LINQ to SQL model in the ASP.NET Dynamic Data model, only the first...
I have a medium sized application that runs as a .net web-service which I do not control, and I want to create a loose pythonic API above it to enable easy scripting. I wanted to know what is the best/most practical solution for using web-services in python. Edit: I need to consume a complex soap WS and I have no contr...
To consume a complex SOAP web service in Python, there are several libraries that can help you create a more Pythonic API to interact with it. Here’s a step-by-step approach using a popular library, as well as some alternatives: ### 1. Use `zeep` **Zeep** is a popular SOAP client for Python that makes it easy to call...
2,405
[ { "from": "human", "value": "I have a medium sized application that runs as a .net web-service which I do not control,\nand I want to create a loose pythonic API above it to enable easy scripting.\nI wanted to know what is the best/most practical solution for using web-services in python.\nEdit:\nI need to ...
I created a view on a machine using the substring function from Firebird, and it worked. When I copied the database to a different machine, the view was broken. This is the way I used it: SELECT SUBSTRING(field FROM 5 FOR 15) FROM table; And this is the output on the machine that does not accept the function: token ...
The issue you're facing with the `SUBSTRING` function in Firebird is likely due to differences in SQL syntax interpretation or compatibility between different versions or configurations. Here are a few troubleshooting steps and considerations to help you address the issue: 1. **Firebird Version Compatibility**: Make ...
2,121
[ { "from": "human", "value": "I created a view on a machine using the substring function from Firebird, and it worked. When I copied the database to a different machine, the view was broken. This is the way I used it:\nSELECT SUBSTRING(field FROM 5 FOR 15) FROM table;\n\nAnd this is the output on the machi...
I'm trying to choose a tool for creating UML diagrams of all flavours. Usability is a major criteria for me, but I'd still take more power with a steeper learning curve and be happy. Free (as in beer) would be nice, but I'd be willing to pay if the tool's worth it. What should I be using?
There are several UML diagramming tools available that cater to various preferences for usability, power, and cost. Here are some options that might fit your criteria: ### Free Tools: 1. **PlantUML**: - **Pros**: Text-based tool, allows you to create UML diagrams using simple scripts, which can be easily version-c...
2,942
[ { "from": "human", "value": "I'm trying to choose a tool for creating UML diagrams of all flavours. Usability is a major criteria for me, but I'd still take more power with a steeper learning curve and be happy. Free (as in beer) would be nice, but I'd be willing to pay if the tool's worth it. What should I...
If you're building an AJA~Xy app, are there any downsides to using JSONP requests/responses even if you're not planning on any cross-domain requests? The only thing I can think of is that there are a couple extra bytes for the callback wrapper... Edit: I found this which also suggests security and error handling as p...
When considering the use of JSONP (JSON with Padding) for an AJAX application, even if you're not planning on any cross-domain requests, there are several downsides and potential issues to be aware of: 1. **Overhead**: As you mentioned, JSONP responses include a callback wrapper, which adds extra bytes. While this may...
3,331
[ { "from": "human", "value": "If you're building an AJA~Xy app, are there any downsides to using JSONP requests/responses even if you're not planning on any cross-domain requests? \nThe only thing I can think of is that there are a couple extra bytes for the callback wrapper... \nEdit:\nI found this which al...
I'm taking the leap: my PHP scripts will ALL fail gracefully! At least, that's what I'm hoping for...` I don't want to wrap (practically) every single line in try...catch statements, so I think my best bet is to make a custom error handler for the beginning of my files. I'm testing it out on a practice page: function c...
The reason your custom error handler is not catching the "call to undefined function" error is that this type of error is considered a **fatal error** in PHP. The custom error handler you created using `set_error_handler()` is designed to catch non-fatal errors (like notices and warnings), but it does not capture fatal...
2,614
[ { "from": "human", "value": "I'm taking the leap: my PHP scripts will ALL fail gracefully!\nAt least, that's what I'm hoping for...`\nI don't want to wrap (practically) every single line in try...catch statements, so I think my best bet is to make a custom error handler for the beginning of my files.\nI'm t...
I'm working on a regular expression in a .NET project to get a specific tag. I would like to match the entire DIV tag and its contents: <html> <head><title>Test</title></head> <body> <p>The first paragraph.</p> <div id='super_special'> <p>The Store paragraph</p> </div> </body> </hea...
Your regular expression is almost correct, but the main issue is that by default, the `.` (dot) in regular expressions does not match newline characters. In order to make the dot match newlines as well, you can use the `RegexOptions.Singleline` option, which allows `.` to match any character, including newline characte...
5,115
[ { "from": "human", "value": "I'm working on a regular expression in a .NET project to get a specific tag. I would like to match the entire DIV tag and its contents:\n<html>\n <head><title>Test</title></head>\n <body>\n <p>The first paragraph.</p>\n <div id='super_special'>\n <p>The Store...
I'm sure most of you are writing lots of automated tests and that you also have run into some common pitfalls when unit testing. My question is do you follow any rules of conduct for writing tests in order to avoid problems in the future? To be more specific: What are the properties of good unit tests or how do you wr...
Absolutely! Writing effective unit tests is crucial to ensuring that your code is reliable, maintainable, and adaptable to change. Here are some best practices and properties of good unit tests, presented in a language-agnostic way: ### 1. **Simplicity and Clarity** - **Readable Tests**: Tests should be as easy to ...
3,018
[ { "from": "human", "value": "I'm sure most of you are writing lots of automated tests and that you also have run into some common pitfalls when unit testing. \nMy question is do you follow any rules of conduct for writing tests in order to avoid problems in the future? To be more specific: What are the prop...
I'm looking for a book/site/tutorial on best practices for relational database design, tuning for performance etc. It turns out this kind of resource is a bit difficult to find; there's a lot of "here's normalization, here's ER diagrams, have at it," but not much in the way of real examples. Anyone have any ideas?
Certainly! There are several books, online resources, and tutorials that focus on best practices for relational database design and performance tuning. Here are some recommendations that may help you find the detailed information you're looking for: ### Books 1. **"Database Design for Mere Mortals" by Michael J. Hern...
2,499
[ { "from": "human", "value": "I'm looking for a book/site/tutorial on best practices for relational database design, tuning for performance etc. It turns out this kind of resource is a bit difficult to find; there's a lot of \"here's normalization, here's ER diagrams, have at it,\" but not much in the way of...
I've used a WordPress blog and a Screwturn Wiki (at two separate jobs) to store private, company-specific KB info, but I'm looking for something that was created to be a knowledge base. Specifically, I'd like to see: Free/low cost Simple method for users to subscribe to KB (or just sections) to get updates Ability to...
There are several knowledge base (KB) solutions that meet many of your criteria, offering a balance between functionality and usability. Below are some options that you might find suitable: ### 1. **MediaWiki** - **Cost**: Free (open-source). - **Subscription**: While it does not have a built-in subscription system, y...
2,413
[ { "from": "human", "value": "I've used a WordPress blog and a Screwturn Wiki (at two separate jobs) to store private, company-specific KB info, but I'm looking for something that was created to be a knowledge base. Specifically, I'd like to see:\n\nFree/low cost\nSimple method for users to subscribe to KB ...
Short version: I want to trigger the Form_Load() event without making the form visible. This doesn't work because Show() ignores the current value of the Visible property: tasksForm.Visible = false; tasksForm.Show(); Long version: I have a WinForms application with two forms: main and tasks. The main form is always di...
To trigger the `Form_Load()` event without displaying the form, you can manually call the logic contained within that event directly from your main form or wherever you need it. However, if you want to ensure that any initialization logic that you have in `Form_Load()` executes, you can extract that logic into a separa...
3,589
[ { "from": "human", "value": "Short version: I want to trigger the Form_Load() event without making the form visible. This doesn't work because Show() ignores the current value of the Visible property:\ntasksForm.Visible = false;\ntasksForm.Show();\n\nLong version: I have a WinForms application with two form...
What's the best way to handle translations for stock text in a SSRS. For instance - if I have a report that shows a grid of contents what's the best way to have the correct translation for the header of that grid show up, assuming the culture of the report is set correctly. Put another way - is it possible to do resour...
In SQL Server Reporting Services (SSRS), handling translations for static text such as report headers can be a bit challenging since SSRS does not natively support resource files like some other development environments. However, there are several strategies you can use to implement translations effectively. ### 1. **...
1,405
[ { "from": "human", "value": "What's the best way to handle translations for stock text in a SSRS. For instance - if I have a report that shows a grid of contents what's the best way to have the correct translation for the header of that grid show up, assuming the culture of the report is set correctly.\nPut...
And, if not, is the only other alternative a blob?
It sounds like you're asking about alternatives to a specific solution or format, but without more context, it's hard to provide a precise answer. The term "blob" could refer to a binary large object, often used in databases to store large amounts of binary data, like images or multimedia files. If you're considering ...
5,733
[ { "from": "human", "value": "And, if not, is the only other alternative a blob?\n" }, { "from": "gpt", "value": "It sounds like you're asking about alternatives to a specific solution or format, but without more context, it's hard to provide a precise answer. The term \"blob\" could refer to a b...
I'm trying to upload an application to the iPhone App Store, but I get this error message from iTunes Connect: The binary you uploaded was invalid. The signature was invalid, or it was not signed with an Apple submission certificate. Note: The details of original question have been removed, as this page has turned i...
The error message you're encountering indicates that there is an issue with the code signature of your application binary. Here are some steps to troubleshoot and resolve the issue: ### 1. Check Your Certificates Ensure you are using the correct **Apple Distribution Certificate**: - Open the **Keychain Access** applic...
4,040
[ { "from": "human", "value": "I'm trying to upload an application to the iPhone App Store, but I get this error message from iTunes Connect:\n\nThe binary you uploaded was invalid. The signature was invalid, or it was not signed with an Apple submission certificate.\n\n\nNote: The details of original questio...
I'm trying to programmatically restrict the memory consumption of plugins running in a .Net AppDomain, but I can't find any setup parameters for this, nor can I find a way to query an AppDomain to figure out how much memory it is consuming. Any ideas?
In .NET, AppDomains are designed to provide isolation for applications, but they do not have built-in features to limit memory usage directly. Instead, you'll have to implement memory management manually. Here are some suggestions on how you can approach this: ### 1. Monitor Memory Usage You can monitor the memory us...
2,409
[ { "from": "human", "value": "I'm trying to programmatically restrict the memory consumption of plugins running in a .Net AppDomain, but I can't find any setup parameters for this, nor can I find a way to query an AppDomain to figure out how much memory it is consuming. Any ideas?\n" }, { "from": "gp...
I was reading googlebooks on chrome, where they talk about why they decided to spin up a process to host browser tab, every time you created a new tab.' So 2 tabs = 2 chrome processes 3 tabs = 3 chrome processes and so on .. right?? But i opened up some 20 or so tabs, but in task manager, i could only find 3 chrome pr...
Yes, you're correct in your observation that Chrome doesn't create a separate process for every single tab. Instead, it uses a multi-process architecture that is designed to balance performance, stability, and resource management. Here's how it works: 1. **Process Model**: Chrome uses a multi-process model where it c...
5,592
[ { "from": "human", "value": "I was reading googlebooks on chrome, where they talk about why they decided to spin up a process to host browser tab, every time you created a new tab.'\nSo \n2 tabs = 2 chrome processes\n3 tabs = 3 chrome processes and so on .. right??\nBut i opened up some 20 or so tabs, but i...
It strikes me that Properties in C# should be use when trying to manipulate a field in the class. But when there's complex calculations or database involved, we should use a getter/setter. Is this correct? When do you use s/getter over properties?
In C#, properties are a common way to encapsulate fields, allowing you to control access and provide additional logic when getting or setting values. They can include logic to validate data, trigger notifications, or perform complex calculations. Here are some points to consider regarding when to use properties vs. exp...
4,089
[ { "from": "human", "value": "It strikes me that Properties in C# should be use when trying to manipulate a field in the class. But when there's complex calculations or database involved, we should use a getter/setter.\nIs this correct?\nWhen do you use s/getter over properties?\n" }, { "from": "gpt"...
I am developing an application that controls an Machine. When I receive an error from the Machine the users should be able to directly notice it, one way that is done is Flashing the tray on the taskbar. When the machine clears the error the tray should stop flashing. There's one little annoyance using the FlashWindowE...
The issue you're encountering with the taskbar button remaining orange after stopping the flashing using `FLASHW_STOP` is indeed a known behavior in Windows XP. This behavior is not an indication that you're using the API incorrectly, but rather a quirk of how Windows XP handles the flashing state of taskbar buttons. ...
3,559
[ { "from": "human", "value": "I am developing an application that controls an Machine.\nWhen I receive an error from the Machine the users should be able to directly notice it, one way that is done is Flashing the tray on the taskbar. When the machine clears the error the tray should stop flashing.\nThere's ...
I'm trying to get only the list of id of object bob for example instead of the list of bob. It's ok with a HQL request, but I would know if it's possible using criteria ? An example : final StringBuilder hql = new StringBuilder(); hql.append( "select bob.id from " ) .append( bob.class.getName() ).append( " bob " ) ...
Yes, you can achieve similar functionality using the Criteria API in Hibernate, which allows for programmatic construction of queries. To fetch only the IDs of objects using Criteria, you can utilize the `Projection` feature. Here's how you can rewrite your HQL query using the Criteria API: ```java import org.hibernat...
5,937
[ { "from": "human", "value": "I'm trying to get only the list of id of object bob for example instead of the list of bob. It's ok with a HQL request, but I would know if it's possible using criteria ?\nAn example :\nfinal StringBuilder hql = new StringBuilder();\nhql.append( \"select bob.id from \" )\n .a...
I am creating an ZIP file with ZipFile in Python 2.5, it works OK so far: import zipfile, os locfile = "test.txt" loczip = os.path.splitext (locfile)[0] + ".zip" zip = zipfile.ZipFile (loczip, "w") zip.write (locfile) zip.close() But I couldn't find how to encrypt the files in the ZIP file. I could use system and cal...
In Python 2.5, the built-in `zipfile` module does not support encryption for ZIP files directly. However, there are some alternatives you can consider: 1. **Use an External Library**: You can use a third-party library such as `pyzipper`, which supports AES encryption and is a fork of the `zipfile` module. You may need...
4,471
[ { "from": "human", "value": "I am creating an ZIP file with ZipFile in Python 2.5, it works OK so far:\nimport zipfile, os\n\nlocfile = \"test.txt\"\nloczip = os.path.splitext (locfile)[0] + \".zip\"\nzip = zipfile.ZipFile (loczip, \"w\")\nzip.write (locfile)\nzip.close()\n\nBut I couldn't find how to encry...
I'm experimenting with creating an add-in for Infopath 2007. The documentation is very skimpy. What I'm trying to determine is what kind of actions an add-in can take while designing a form. Most of the discussion and samples are for when the user is filling out the form. Can I, for example, add a new field to the form...
Creating an add-in for InfoPath 2007, particularly when it comes to form design rather than form filling, is indeed more complex and less documented. In InfoPath 2007, the extensibility model primarily focuses on the runtime experience—meaning actions you can take while users are filling out a form. ### Capabilities o...
4,786
[ { "from": "human", "value": "I'm experimenting with creating an add-in for Infopath 2007. The documentation is very skimpy. What I'm trying to determine is what kind of actions an add-in can take while designing a form. Most of the discussion and samples are for when the user is filling out the form. Can I,...
I'm currently using and enjoying using the Flex MVC framework PureMVC. I have heard some good things about Cairngorm, which is supported by Adobe and has first-to-market momentum. And there is a new player called Mate, which has a good deal of buzz. Has anyone tried two or three of these frameworks and formed an opin...
It's great to hear that you're enjoying using the PureMVC framework! Each of the frameworks you mentioned—PureMVC, Cairngorm, and Mate—has its own strengths and weaknesses, and the choice often comes down to your specific project needs and personal preferences. Here’s a brief comparison of the three: ### PureMVC: - **...
4,812
[ { "from": "human", "value": "I'm currently using and enjoying using the Flex MVC framework PureMVC. I have heard some good things about Cairngorm, which is supported by Adobe and has first-to-market momentum. And there is a new player called Mate, which has a good deal of buzz.\nHas anyone tried two or th...
How do you iterate through every file/directory recursively in standard C++?
To iterate through every file and directory recursively in standard C++, you typically use the filesystem library that was introduced in C++17. The `<filesystem>` header provides a convenient way to work with file systems, allowing you to traverse directories and access their contents. Here's an example of how to recu...
4,622
[ { "from": "human", "value": "How do you iterate through every file/directory recursively in standard C++?\n" }, { "from": "gpt", "value": "To iterate through every file and directory recursively in standard C++, you typically use the filesystem library that was introduced in C++17. The `<filesys...
How can I set the cookies in my PHP apps as HttpOnly cookies?
In PHP, you can set cookies with the `HttpOnly` flag to enhance security and help mitigate the risk of cross-site scripting (XSS) attacks. When a cookie is marked as `HttpOnly`, it cannot be accessed via JavaScript, thus it can only be sent to the server in HTTP requests. To set a cookie as `HttpOnly` in your PHP appl...
4,143
[ { "from": "human", "value": "How can I set the cookies in my PHP apps as HttpOnly cookies?\n" }, { "from": "gpt", "value": "In PHP, you can set cookies with the `HttpOnly` flag to enhance security and help mitigate the risk of cross-site scripting (XSS) attacks. When a cookie is marked as `HttpO...
class Foo { static bool Bar(Stream^ stream); }; class FooWrapper { bool Bar(LPCWSTR szUnicodeString) { return Foo::Bar(??); } }; MemoryStream will take a byte[] but I'd like to do this without copying the data if possible.
To implement the `Bar` function in the `FooWrapper` class so that it uses a `MemoryStream` without copying the data, you can create a `MemoryStream` from the byte array that represents the Unicode string. In C++/CLI, you can convert the `LPCWSTR` (which is a pointer to a wide character string) to a byte array, but if y...
3,661
[ { "from": "human", "value": "class Foo\n{\n static bool Bar(Stream^ stream);\n};\n\nclass FooWrapper\n{\n bool Bar(LPCWSTR szUnicodeString)\n {\n return Foo::Bar(??);\n }\n};\n\nMemoryStream will take a byte[] but I'd like to do this without copying the data if possible.\n" }, { "from"...
Java has a convenient split method: String str = "The quick brown fox"; String[] results = str.split(" "); Is there an easy way to do this in C++?
In C++, there isn't a built-in `split` method like in Java, but you can achieve similar functionality using the `std::string` class along with `std::istringstream` and `std::vector`. Here’s a simple way to split a string based on a delimiter (e.g., space): ```cpp #include <iostream> #include <sstream> #include <string...
5,749
[ { "from": "human", "value": "Java has a convenient split method:\nString str = \"The quick brown fox\";\nString[] results = str.split(\" \");\n\nIs there an easy way to do this in C++?\n" }, { "from": "gpt", "value": "In C++, there isn't a built-in `split` method like in Java, but you can achiev...
I want to find records on a combination of created_on >= some date AND name IN some list of names. For ">=" I'd have to use sql condition. For "IN" I'd have to use a hash of conditions where the key is :name and the value is the array of names. Is there a way to combine the two?
Yes, you can combine both conditions in a single SQL query using the `WHERE` clause. In SQL, you can use the `AND` operator to combine multiple conditions, such as a date condition and an `IN` condition. Here's a general example of how you might structure the SQL query: ```sql SELECT * FROM your_table WHERE created_o...
3,654
[ { "from": "human", "value": "I want to find records on a combination of created_on >= some date AND name IN some list of names.\nFor \">=\" I'd have to use sql condition. For \"IN\" I'd have to use a hash of conditions where the key is :name and the value is the array of names.\nIs there a way to combine th...
What's the simplest-to-use techonlogy available to save an arbitrary Java object graph as an XML file (and to be able to rehydrate the objects later)?
One of the simplest ways to serialize an arbitrary Java object graph to XML and then rehydrate (deserialize) it later is to use **Java Architecture for XML Binding (JAXB)**. JAXB is a part of the Java Standard Edition, which makes it easily accessible without the need for external libraries. ### How to Use JAXB 1. **...
1,812
[ { "from": "human", "value": "What's the simplest-to-use techonlogy available to save an arbitrary Java object graph as an XML file (and to be able to rehydrate the objects later)?\n" }, { "from": "gpt", "value": "One of the simplest ways to serialize an arbitrary Java object graph to XML and the...
This question on Cyclomatic Complexity made me think more about static code analysis. Analyzing code complexity and consistency is occasionally useful, and I'd like to start doing it more. What tools do you recommend (per language) for such analysis? Wikipedia has a large list of tools, but which ones have people tr...
Static code analysis is a great way to assess code quality, complexity, and consistency across various programming languages. Here’s a selection of popular tools categorized by language that are widely used and recommended: ### C/C++ 1. **Cppcheck**: A static analysis tool that focuses on the C/C++ programming languag...
3,342
[ { "from": "human", "value": "This question on Cyclomatic Complexity made me think more about static code analysis. Analyzing code complexity and consistency is occasionally useful, and I'd like to start doing it more. What tools do you recommend (per language) for such analysis? Wikipedia has a large lis...