instruction stringlengths 14 27.6k | completion stringlengths 3 38.3k | __original_row_idx int64 0 50k | conversations listlengths 2 2 |
|---|---|---|---|
I'd like to hear from people who are using distributed version control (aka distributed revision control, decentralized version control) and how they are finding it. What are you using, Mercurial, Darcs, Git, Bazaar? Are you still using it? If you've used client/server rcs in the past, are you finding it better, worse ... | Distributed version control systems (DVCS) have gained popularity for various reasons, and experiences can vary based on individual needs and workflows. Here's an overview of insights from users who have transitioned from centralized systems like Subversion (SVN) to DVCS, focusing on some of the most popular options: G... | 6,572 | [
{
"from": "human",
"value": "I'd like to hear from people who are using distributed version control (aka distributed revision control, decentralized version control) and how they are finding it. What are you using, Mercurial, Darcs, Git, Bazaar? Are you still using it? If you've used client/server rcs in th... |
I'm using the ProgressBar control in a WPF application and I'm getting this old, Windows 3.1 ProgressBlocks thing. In VB6, there was a property to show a smooth ProgressBar. Is there such a thing for WPF?
| In WPF, the default `ProgressBar` control has a property called `IsIndeterminate` that allows you to show an animated progress bar, which can resemble the "smooth" effect you might remember from VB6's smooth ProgressBar. However, it doesn't have a native "smooth" style for determinate progress bars like VB6 does.
If y... | 10,316 | [
{
"from": "human",
"value": "I'm using the ProgressBar control in a WPF application and I'm getting this old, Windows 3.1 ProgressBlocks thing. In VB6, there was a property to show a smooth ProgressBar. Is there such a thing for WPF?\n"
},
{
"from": "gpt",
"value": "In WPF, the default `Progress... |
So this post talked about how to actually implement url rewriting in an ASP.NET application to get "friendly urls". That works perfect and it is great for sending a user to a specific page, but does anyone know of a good solution for creating "Friendly" URLs inside your code when using one of the tools referenced?
For... | To create "friendly URLs" dynamically in your ASP.NET application while using URL rewriting, you can build a generic solution that maps your unfriendly URLs to friendly ones based on the rewriting rules you've set up. Here's a basic approach you can take.
### Step 1: Create a URL Rewriting Logic
Firstly, ensure you h... | 7,712 | [
{
"from": "human",
"value": "So this post talked about how to actually implement url rewriting in an ASP.NET application to get \"friendly urls\". That works perfect and it is great for sending a user to a specific page, but does anyone know of a good solution for creating \"Friendly\" URLs inside your cod... |
What are the best practices for using Java's @Override annotation and why?
It seems like it would be overkill to mark every single overridden method with the @Override annotation. Are there certain programming situations that call for using the @Override and others that should never use the @Override?
| Using the `@Override` annotation in Java is a best practice for several reasons, and it can greatly enhance code readability and maintainability. Here are the best practices for using the `@Override` annotation and the rationale behind them:
### Best Practices for Using `@Override` Annotation:
1. **Always Use `@Overr... | 11,301 | [
{
"from": "human",
"value": "What are the best practices for using Java's @Override annotation and why? \nIt seems like it would be overkill to mark every single overridden method with the @Override annotation. Are there certain programming situations that call for using the @Override and others that sh... |
Why doesn't have the c standard a memswap function, which would probably look like:
int memswap(void *ptr1, void *ptr2, size_t nbytes)?
I know it'd be easy to write, but i think the libc could do some awesome tricks to speed it up like some implementations do it for memcpy.
| The C standard library does not include a `memswap` function, and there are several reasons for this:
1. **Complexity of Implementation**: Swapping memory contents requires careful handling of overlapping memory areas. The standard library already has `memcpy` and `memmove`, and introducing a function that could poten... | 10,674 | [
{
"from": "human",
"value": "Why doesn't have the c standard a memswap function, which would probably look like:\nint memswap(void *ptr1, void *ptr2, size_t nbytes)?\n\nI know it'd be easy to write, but i think the libc could do some awesome tricks to speed it up like some implementations do it for memcpy.\... |
I'm starting to learn how to use PHPUnit to test the website I'm working on. The problem I'm running into is that I have five different user types defined and I need to be able to test every class with the different types. I currently have a user class and I would like to pass this to each function but I can't figure... | Using PHPUnit, you can achieve the goal of testing different user types by utilizing data providers. Data providers allow you to run the same test with different sets of input data, which in your case would be different instances of the user class representing different user types.
Here's a general outline of how you... | 6,768 | [
{
"from": "human",
"value": "I'm starting to learn how to use PHPUnit to test the website I'm working on. The problem I'm running into is that I have five different user types defined and I need to be able to test every class with the different types. I currently have a user class and I would like to pass... |
I have some domain logic implemented in a number of POJOs. I want to write a Swing user interface to allow the user to initiate and see the results of various domain actions.
What's the best pattern/framework/library for communications between the UI and the domain? This boils down into:
the UI being able to convert a... | When building a Swing user interface that interacts with domain logic implemented in POJOs, you can consider a few architectural patterns and frameworks that can help streamline the communication between the UI and the domain. While MVC is a widely known pattern, there are specific ways to implement it effectively in S... | 8,745 | [
{
"from": "human",
"value": "I have some domain logic implemented in a number of POJOs. I want to write a Swing user interface to allow the user to initiate and see the results of various domain actions.\nWhat's the best pattern/framework/library for communications between the UI and the domain? This boils ... |
I assume that char* = "string" is the same to char* = new char[6]. I believe these strings are created on the heap instead of the stack. So do I need to destroy them or free their memory when I'm done using them or do they get destroyed by themselves?
| The confusion between the two types of string initialization in C++ is common, so let's clarify how they work in terms of memory allocation and deallocation.
1. **String Literal**: When you write `char* str = "string";`, you're actually creating a pointer to a string literal. String literals are stored in a read-only ... | 12,654 | [
{
"from": "human",
"value": "I assume that char* = \"string\" is the same to char* = new char[6]. I believe these strings are created on the heap instead of the stack. So do I need to destroy them or free their memory when I'm done using them or do they get destroyed by themselves?\n"
},
{
"from": "... |
in short: is there any way to find the current directory full path of a xul application?
long explanation:
I would like to open some html files in a xul browser application. The path to the html files should be set programmatically from the xul application. The html files reside outside the folder of my xul application... | In XUL applications, there's no direct method to obtain the current directory of the application since the environment is more sandboxed and abstracted compared to standard desktop applications. However, you can still determine the application path using some workarounds. Here's how you can find the full path of your X... | 8,997 | [
{
"from": "human",
"value": "in short: is there any way to find the current directory full path of a xul application?\nlong explanation:\nI would like to open some html files in a xul browser application. The path to the html files should be set programmatically from the xul application. The html files resi... |
Outlook saves its client-side rule definitions in a binary blob in a hidden message in the Inbox folder of the default store for a profile. The hidden message is named "Outlook Rules Organizer" with a message class IPM.RuleOrganizer. The binary blob is saved in property 0x6802. The same binary blob is written to the ex... | As of my last update, the layout of the binary blob used by Outlook to store rule definitions in the "Outlook Rules Organizer" message is not publicly documented by Microsoft. However, some details about how Outlook rules are structured can be inferred from reverse engineering efforts and community discussions.
The bi... | 10,235 | [
{
"from": "human",
"value": "Outlook saves its client-side rule definitions in a binary blob in a hidden message in the Inbox folder of the default store for a profile. The hidden message is named \"Outlook Rules Organizer\" with a message class IPM.RuleOrganizer. The binary blob is saved in property 0x6802... |
I am looking for a CSS-based web page template where the main content div occupies the full height of the view port (minus header and footer heights) when its content has few lines. The footer should be at the bottom of the viewport, rather than right below content, where it's more in the middle of the viewport. Conten... | To create a CSS-based web page template that meets your requirements, we can use a combination of CSS for layout and JavaScript to ensure the footer sticks to the bottom when the content is short. Below is a sample code that illustrates this layout.
### HTML Structure
```html
<!DOCTYPE html>
<html lang="en">
<head>
... | 6,961 | [
{
"from": "human",
"value": "I am looking for a CSS-based web page template where the main content div occupies the full height of the view port (minus header and footer heights) when its content has few lines. The footer should be at the bottom of the viewport, rather than right below content, where it's m... |
Does anyone happen to remember the function name used to generate sequential row number built-in SQL Server 2000.
| In SQL Server 2000, there isn't a built-in function to directly generate sequential row numbers like there are in later versions of SQL Server with the `ROW_NUMBER()` function. However, you can achieve similar functionality using a combination of common SQL techniques.
One common approach is to use a temporary table o... | 11,025 | [
{
"from": "human",
"value": "Does anyone happen to remember the function name used to generate sequential row number built-in SQL Server 2000.\n"
},
{
"from": "gpt",
"value": "In SQL Server 2000, there isn't a built-in function to directly generate sequential row numbers like there are in later ... |
Anyone have a good rule of thumb for choosing between different implementations of Java Collection interfaces like List, Map, or Set?
For example, generally why or in what cases would I prefer to use a Vector or an ArrayList, a Hashtable or a HashMap?
| When choosing between different implementations of Java Collection interfaces, it's important to consider various factors, including performance, thread-safety, and specific use-case requirements. Here are some general rules of thumb for selecting between common implementations of `List`, `Map`, and `Set`:
### List Im... | 6,279 | [
{
"from": "human",
"value": "Anyone have a good rule of thumb for choosing between different implementations of Java Collection interfaces like List, Map, or Set?\nFor example, generally why or in what cases would I prefer to use a Vector or an ArrayList, a Hashtable or a HashMap?\n"
},
{
"from": "g... |
Could someone write-up a step by step guide to developing a C++ based plugin for FireFox on Windows?
The links and examples on http://www.mozilla.org/projects/plugins/ are all old and inaccurate - the "NEW" link was added to the page in 2004.
The example could be anything, but I was thinking a plugin that lets JavaSc... | Developing a C++ based plugin for Firefox is a complex process, especially since Mozilla has significantly shifted away from traditional NPAPI plugins in favor of WebExtensions and other modern web standards. However, if you're looking to create a native application that integrates with the browser and allows two-way c... | 2,147 | [
{
"from": "human",
"value": "Could someone write-up a step by step guide to developing a C++ based plugin for FireFox on Windows? \nThe links and examples on http://www.mozilla.org/projects/plugins/ are all old and inaccurate - the \"NEW\" link was added to the page in 2004.\nThe example could be anything,... |
I am completely on board with the ideas behind TDD, Refactoring and Patterns however it does seem like there is a huge gaping whole in these ideas, mainly that they are great for dev teams of 1, but when you start refactoring code that 10 people are working on you start getting merge conflicts all over the place and mo... | Refactoring in a collaborative environment can indeed be challenging, especially with multiple developers working on the same codebase. However, there are strategies and practices you can adopt to minimize merge conflicts and make the process smoother for everyone involved. Here are some approaches:
### 1. **Communica... | 8,832 | [
{
"from": "human",
"value": "I am completely on board with the ideas behind TDD, Refactoring and Patterns however it does seem like there is a huge gaping whole in these ideas, mainly that they are great for dev teams of 1, but when you start refactoring code that 10 people are working on you start getting ... |
Are there any libraries (3rd party or built-in) in PHP to calculate text diffs?
| Yes, there are several libraries in PHP that can help you calculate text diffs. Here are some popular options:
### Built-in Libraries
PHP does not have a built-in library specifically for calculating text diffs, but you can use the `xdiff` extension, which provides functions to compute differences between strings or f... | 10,136 | [
{
"from": "human",
"value": "Are there any libraries (3rd party or built-in) in PHP to calculate text diffs?\n"
},
{
"from": "gpt",
"value": "Yes, there are several libraries in PHP that can help you calculate text diffs. Here are some popular options:\n\n### Built-in Libraries\nPHP does not hav... |
Could anybody explain in plain words how Cloud computing works?
I have read the Wikipedia article, but still not sure that I understand how cloud actually works.
| Sure! Let’s break it down into simple terms.
**What is Cloud Computing?**
Cloud computing is like using someone else's computer and storage over the internet instead of relying solely on your own computer. Instead of keeping everything on your own device, you can access and store information on remote servers that are... | 8,493 | [
{
"from": "human",
"value": "Could anybody explain in plain words how Cloud computing works?\nI have read the Wikipedia article, but still not sure that I understand how cloud actually works.\n"
},
{
"from": "gpt",
"value": "Sure! Let’s break it down into simple terms.\n\n**What is Cloud Computi... |
How can you measure the amount of time a function will take to execute?
This is a relatively short function and the execution time would probably be in the millisecond range.
This particular question relates to an embedded system, programmed in C or C++.
| Measuring the execution time of a function in an embedded system programmed in C or C++ can be done in several ways, depending on the tools and libraries available for your specific platform. Here are a few methods you can use:
### 1. **Using a High-Resolution Timer**
Most embedded systems come equipped with hardware... | 5,460 | [
{
"from": "human",
"value": "How can you measure the amount of time a function will take to execute? \nThis is a relatively short function and the execution time would probably be in the millisecond range.\nThis particular question relates to an embedded system, programmed in C or C++.\n"
},
{
"from... |
This is in reference to my other question Auto Clearing Textbox.
If I choose to derive a new TextBox control from TextBox instead of implement a user control just containing my Textbox, how would I include that in the toolbox.
| To include a derived `TextBox` control in the Visual Studio toolbox, you need to follow a few steps. Here's how to create a custom `TextBox` control and add it to the toolbox:
### Step 1: Create a New Custom Control
1. **Create a New Class Library**:
- Open Visual Studio and create a new Class Library project.
... | 6,433 | [
{
"from": "human",
"value": "This is in reference to my other question Auto Clearing Textbox.\nIf I choose to derive a new TextBox control from TextBox instead of implement a user control just containing my Textbox, how would I include that in the toolbox.\n"
},
{
"from": "gpt",
"value": "To inc... |
Is it possible to use BackGroundWorker thread in ASP.NET 2.0 for the following scenario, so that the user at the browser's end does not have to wait for long time?
Scenario
The browser requests a page, say SendEmails.aspx
SendEmails.aspx page creates a BackgroundWorker thread, and supplies the thread with enough conte... | Using `BackgroundWorker` in an ASP.NET web application, especially ASP.NET 2.0, is not suitable for your scenario for several reasons. Here’s a detailed explanation:
### Key Issues with BackgroundWorker in ASP.NET:
1. **ASP.NET Request Life Cycle**:
- In an ASP.NET application, the request life cycle is tied to th... | 9,359 | [
{
"from": "human",
"value": "Is it possible to use BackGroundWorker thread in ASP.NET 2.0 for the following scenario, so that the user at the browser's end does not have to wait for long time?\nScenario\n\nThe browser requests a page, say SendEmails.aspx\nSendEmails.aspx page creates a BackgroundWorker thre... |
What mysql functions are there (if any) to trim leading zeros from an alphanumeric text field?
Field with value "00345ABC" would need to return "345ABC".
| In MySQL, you can use the `TRIM()` function in combination with the `LEADING` and `FROM` keywords to remove leading characters, including zeros, from a string. However, since `TRIM()` is designed to work with specific characters and does not operate directly on numeric patterns, a more reliable method for your case wou... | 10,089 | [
{
"from": "human",
"value": "What mysql functions are there (if any) to trim leading zeros from an alphanumeric text field? \nField with value \"00345ABC\" would need to return \"345ABC\".\n"
},
{
"from": "gpt",
"value": "In MySQL, you can use the `TRIM()` function in combination with the `LEAD... |
I'm getting a random unreproducible Error when initializing a JSplitPane in with JDK 1.5.0_08. Note that this does not occur every time, but about 80% of the time:
Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: javax.swing.KeyStroke
at java.util.TreeMap.compare(TreeMap.java:1093)
at java.u... | It appears that you are encountering a known issue with the Java Swing library in JDK 1.5.0_08 that involves the `JSplitPane` and a `ClassCastException` related to the handling of `KeyStroke` objects within the `BasicSplitPaneUI`. Since this is happening unreproducibly, it can indeed be quite frustrating.
While the bu... | 8,446 | [
{
"from": "human",
"value": "I'm getting a random unreproducible Error when initializing a JSplitPane in with JDK 1.5.0_08. Note that this does not occur every time, but about 80% of the time:\nException in thread \"AWT-EventQueue-0\" java.lang.ClassCastException: javax.swing.KeyStroke\n at java.util.Tre... |
What are in your opinion big differences between areas of usage for "Astoria" (ADO.NET data services) and SQL Server Data Services?
| "Astoria" (officially known as ADO.NET Data Services) and SQL Server Data Services (SSDS) serve different purposes in the realm of data management and access, particularly in the context of web and cloud applications. Here are some key differences in their areas of usage:
### 1. **Purpose and Scope**:
- **Astoria (... | 7,858 | [
{
"from": "human",
"value": "What are in your opinion big differences between areas of usage for \"Astoria\" (ADO.NET data services) and SQL Server Data Services?\n"
},
{
"from": "gpt",
"value": "\"Astoria\" (officially known as ADO.NET Data Services) and SQL Server Data Services (SSDS) serve di... |
I am working on a winforms application using LINQ to SQL - and am building the app using a SQL Express instance on my workstation. The final installation of the project will be on a proper SQL Server 2005.
The database has the same name, and all tables are identical but the hostname is different.
The only way I have... | You can definitely change the connection string in your WinForms application without needing to reopen Visual Studio or modify your LINQ to SQL `.mdbl` file. Here's how to approach it:
### Step 1: Modify the Connection String in `app.config`
1. **Locate `app.config` File**: Your WinForms application has an `app.confi... | 10,050 | [
{
"from": "human",
"value": "I am working on a winforms application using LINQ to SQL - and am building the app using a SQL Express instance on my workstation. The final installation of the project will be on a proper SQL Server 2005. \nThe database has the same name, and all tables are identical but the h... |
Is there a way of comparing two bitmasks in Transact-SQL to see if any of the bits match? I've got a User table with a bitmask for all the roles the user belongs to, and I'd like to select all the users that have any of the roles in the supplied bitmask. So using the data below, a roles bitmask of 6 (designer+programme... | You can compare two bitmasks in Transact-SQL (T-SQL) using the bitwise AND operator (`&`). If the result of the bitwise AND operation is greater than 0, then there is at least one bit that matches between the two bitmasks.
In your case, to select all users whose roles bitmask matches any of the bits in a supplied bitm... | 11,736 | [
{
"from": "human",
"value": "Is there a way of comparing two bitmasks in Transact-SQL to see if any of the bits match? I've got a User table with a bitmask for all the roles the user belongs to, and I'd like to select all the users that have any of the roles in the supplied bitmask. So using the data below,... |
Background:
Some time ago, I built a system for recording and categorizing application crashes for one of our internal programs. At the time, I used a combination of frequency and aggregated lost time (the time between the program launch and the crash) for prioritizing types of crashes. It worked reasonably well.
Now, ... | Calculating the real-world cost of application crashes is indeed a challenging task, but there are established methods and approaches that can help you arrive at a reasonable estimate. Here are some strategies and considerations for quantifying the cost of application crashes:
### 1. **Direct Costs**:
- **Lost Prod... | 9,692 | [
{
"from": "human",
"value": "Background:\nSome time ago, I built a system for recording and categorizing application crashes for one of our internal programs. At the time, I used a combination of frequency and aggregated lost time (the time between the program launch and the crash) for prioritizing types of... |
How do I create class (i.e. static) variables or methods in Python?
| In Python, class variables and methods are created within a class definition and can be accessed using the class name or an instance of the class. Here’s how to create and use class (static) variables and methods:
### Class Variables
Class variables are variables that are shared among all instances of a class. They a... | 4,901 | [
{
"from": "human",
"value": "How do I create class (i.e. static) variables or methods in Python?\n"
},
{
"from": "gpt",
"value": "In Python, class variables and methods are created within a class definition and can be accessed using the class name or an instance of the class. Here’s how to creat... |
I really like the mp3 player on 8tracks.com and was wondering how they manage to keep the mp3 playing even when I change pages?
For example, listen to the track here http://8tracks.com/mixes?q=Aztec+Camera and click on one of the links to another page. The music cuts out for 1/4 of a second and then comes back in at ex... | The seamless playback you’re experiencing on 8tracks.com is likely due to the use of web technologies that manage audio playback without interruption, typically involving JavaScript and HTML5 audio, rather than relying on Flash.
Here's how it generally works:
1. **Single Page Application (SPA) Framework**: Many mode... | 12,081 | [
{
"from": "human",
"value": "I really like the mp3 player on 8tracks.com and was wondering how they manage to keep the mp3 playing even when I change pages?\nFor example, listen to the track here http://8tracks.com/mixes?q=Aztec+Camera and click on one of the links to another page. The music cuts out for 1/... |
I'm trying to put together a blog, and have gone with SubText and I've just installed SyntaxHighlighter but it doesn't seem to work properly. SubText or FCKEditor seems to tamper with the HTMl, inlineing everything in the pre tags and placing line-breaks at the end of each line.
Bad times!
Anyone know how to stop this... | It sounds like you're encountering issues with how FCKEditor (now known as CKEditor) handles your HTML, especially when it comes to preserving formatting and preventing it from modifying your code. Here are some steps you can take to resolve these issues with SyntaxHighlighter in SubText:
1. **Check CKEditor's Configu... | 9,356 | [
{
"from": "human",
"value": "I'm trying to put together a blog, and have gone with SubText and I've just installed SyntaxHighlighter but it doesn't seem to work properly. SubText or FCKEditor seems to tamper with the HTMl, inlineing everything in the pre tags and placing line-breaks at the end of each line... |
I've always wondered this - why can't you declare variables after a case label in a switch statement? In C++ you can declare variables pretty much anywhere (and declaring them close to first use is obviously a good thing) but the following still won't work:
switch (val)
{
case VAL:
// This won't work
int new... | The behavior you're encountering is related to the way that the C++ language defines the scope and flow of control in a `switch` statement. The key points to understand are related to how cases in a `switch` statement are structured and how variable declarations work in terms of scoping.
### 1. **Control Flow and Fall... | 8,264 | [
{
"from": "human",
"value": "I've always wondered this - why can't you declare variables after a case label in a switch statement? In C++ you can declare variables pretty much anywhere (and declaring them close to first use is obviously a good thing) but the following still won't work:\nswitch (val) \n{ ... |
I wrote a simple Windows Forms program in C#. I want to be able to input a windows user name and password and when I click a login button to run code run as the user I've entered as input.
| Running code as another user in a Windows Forms application typically involves using the Windows API to create a process with the credentials of that user. You can achieve this using the `LogonUser` function and then creating a process with those credentials.
Here's a simplified example of how you can implement this i... | 6,793 | [
{
"from": "human",
"value": "I wrote a simple Windows Forms program in C#. I want to be able to input a windows user name and password and when I click a login button to run code run as the user I've entered as input.\n"
},
{
"from": "gpt",
"value": "Running code as another user in a Windows For... |
I was wondering if there was a way to use "find_by_sql" within a named_scope. I'd like to treat custom sql as named_scope so I can chain it to my existing named_scopes. It would also be good for optimizing a sql snippet I use frequently.
| In Rails, you can't directly use `find_by_sql` within a `named_scope` (or what is now known as a `scope` in Rails 3 and later). However, you can achieve similar functionality by defining a custom scope using `ActiveRecord::Relation` and raw SQL. This allows you to create more complex queries that can be chained with ot... | 10,790 | [
{
"from": "human",
"value": "I was wondering if there was a way to use \"find_by_sql\" within a named_scope. I'd like to treat custom sql as named_scope so I can chain it to my existing named_scopes. It would also be good for optimizing a sql snippet I use frequently.\n"
},
{
"from": "gpt",
"val... |
Try loading this normal .jpg file in Internet Explorer 6.0. I get an error saying the picture won't load. Try it in any other browser and it works fine. What's wrong? The .jpg file is just a normal picture sitting on the web server. I can even create a simple web page:
<a href="http://www.zodiacwheels.com/images/wheels... | There are several potential reasons why a JPEG image might not load correctly in Internet Explorer 6, even though it works fine in other modern browsers. Here are some possibilities to consider:
1. **Compatibility Issues**: Internet Explorer 6 is an outdated browser that may not handle certain modern web server config... | 5,708 | [
{
"from": "human",
"value": "Try loading this normal .jpg file in Internet Explorer 6.0. I get an error saying the picture won't load. Try it in any other browser and it works fine. What's wrong? The .jpg file is just a normal picture sitting on the web server. I can even create a simple web page:\n<a href=... |
Seriously. On a 22" monitor, it only covers maybe a quarter of the screen. I need some ammo to axe down this rule.
I'm not saying that there shouldn't be a limit; I'm just saying, 80 characters is very small.
| It's a common concern that the 80-character limit can feel restrictive, especially on larger monitors where it can occupy only a fraction of the available screen space. Here are some points you can use to argue for a more flexible line length:
1. **Screen Real Estate**: Modern monitors come in various sizes and resolu... | 8,820 | [
{
"from": "human",
"value": "Seriously. On a 22\" monitor, it only covers maybe a quarter of the screen. I need some ammo to axe down this rule.\n\nI'm not saying that there shouldn't be a limit; I'm just saying, 80 characters is very small.\n"
},
{
"from": "gpt",
"value": "It's a common concern... |
I'm attempting to use TinyXML to read and save from memory, instead of only reading and saving files to disk.
It seems that the documnent's parse function can load a char *. But then I need to save the document to a char * when I'm done with it. Does anyone know about this?
Edit: The printing & streaming functions aren... | In TinyXML, you can indeed parse XML from a `char*` and also save the document back to a `char*`. However, you'll need to handle the memory allocation yourself, as TinyXML does not provide a direct function to get the XML content as a `char*`.
Here’s how you can achieve this:
1. **Parsing from `char*`**: You can pars... | 8,528 | [
{
"from": "human",
"value": "I'm attempting to use TinyXML to read and save from memory, instead of only reading and saving files to disk.\nIt seems that the documnent's parse function can load a char *. But then I need to save the document to a char * when I'm done with it. Does anyone know about this?\nEd... |
We've got a .net CMS running on IIS 6 which uses XSLT templates. It seems to be running XPath 1.0 (as we can't use any 2.0 functionality).
How do we go about installing or specifying that IIS should use XPath 2.0? Is it installed per server, or can we specify which version to use on a per-application pool or per-site b... | IIS 6 does not natively support XPath 2.0, as it primarily relies on the .NET Framework for its server-side processing. The .NET Framework (up to version 4.0) and its associated libraries (including those for XSLT and XPath) primarily support XPath 1.0.
XPath 2.0 is part of the W3C's XPath 2.0 Recommendation, but it ... | 10,326 | [
{
"from": "human",
"value": "We've got a .net CMS running on IIS 6 which uses XSLT templates. It seems to be running XPath 1.0 (as we can't use any 2.0 functionality).\nHow do we go about installing or specifying that IIS should use XPath 2.0? Is it installed per server, or can we specify which version to u... |
I'm creating a web site where all pages hang off a database-driven tree-hierarchy.
All but one node has a parent node. Nodes may have role-based read permissions. Some nodes may have special rules (such as: don't display within navigation menus).
Nodes may represent links to other nodes (like a shortcut in Windows). ... | To design your nodes database in Microsoft SQL Server for use with LINQ to SQL, consider the following options, along with their pros and cons:
### 1. Many Lightweight Tables with Minimal Nullable Fields
**Pros:**
- Separation of concerns: Each table can be focused on a specific aspect of the data.
- Flexibility: Eas... | 6,062 | [
{
"from": "human",
"value": "I'm creating a web site where all pages hang off a database-driven tree-hierarchy.\nAll but one node has a parent node. Nodes may have role-based read permissions. Some nodes may have special rules (such as: don't display within navigation menus).\nNodes may represent links to... |
We need to reliably get the Quick Launch folder for both All and Current users under both Vista and XP. I'm developing in C++, but this is probably more of a general Windows API question.
For reference, here is code to get the Application Data folder under both systems:
HRESULT hres;
CString basePath;
hre... | To reliably obtain the Quick Launch folder for both Windows XP and Windows Vista (and later versions), you can indeed use the `SHGetSpecialFolderPath` function with the `CSIDL_APPDATA` constant. You've correctly identified the structure of the paths for each operating system.
### Code Implementation
Here's a complete... | 8,268 | [
{
"from": "human",
"value": "We need to reliably get the Quick Launch folder for both All and Current users under both Vista and XP. I'm developing in C++, but this is probably more of a general Windows API question.\nFor reference, here is code to get the Application Data folder under both systems:\n H... |
How do I make Log4net only log Info level logs? Is that even possible? Can you only set a threshold?
This is what I have, and it logs Info and above as I would expect. Is there anything i can do to make it only log info?
<logger name="BrokerCollection.Model.XmlDocumentCreationTask">
<appender-ref ref="SubmissionAppe... | In Log4net, the logging levels are hierarchical, which means that setting a logger to `Info` will also include all higher levels of logging (i.e., `Info`, `Warn`, `Error`, and `Fatal`). If you want to **only** log `Info` level messages and exclude all other levels, you need to implement a custom filter.
Log4net does n... | 4,798 | [
{
"from": "human",
"value": "How do I make Log4net only log Info level logs? Is that even possible? Can you only set a threshold? \nThis is what I have, and it logs Info and above as I would expect. Is there anything i can do to make it only log info?\n<logger name=\"BrokerCollection.Model.XmlDocumentCreati... |
I have a bunch (hundreds) of files that are supposed to have Unix line endings. I strongly suspect that some of them have Windows line endings, and I want to programmatically figure out which ones do.
I know I can just run flip -u or something similar in a script to convert everything, but I want to be able to identify... | To identify files with Windows line endings (CRLF) versus Unix line endings (LF), you can use a combination of command line tools like `grep`, `find`, or `awk`. Here are a few methods you could use:
### Method 1: Using `grep`
You can use `grep` to search for the carriage return character (`\r`), which is present in W... | 10,346 | [
{
"from": "human",
"value": "I have a bunch (hundreds) of files that are supposed to have Unix line endings. I strongly suspect that some of them have Windows line endings, and I want to programmatically figure out which ones do.\nI know I can just run flip -u or something similar in a script to convert eve... |
Well i am currently working on a project doing some UI mockups when certain users wanted to have two logo on the top left ot the website.
One is to indicate what is the website about then another is to indicate that this website is actually belong to this particular sector.
I thought that UI design wise this is very ba... | Your concern about using two logos in the top left corner of a website is valid. Here are some points to consider regarding UI design and user experience:
1. **Clarity and Functionality**: The top left corner is a key area for branding and navigation. Having two logos can confuse users, especially if they don't have c... | 9,520 | [
{
"from": "human",
"value": "Well i am currently working on a project doing some UI mockups when certain users wanted to have two logo on the top left ot the website.\nOne is to indicate what is the website about then another is to indicate that this website is actually belong to this particular sector.\nI ... |
Why does the following method hang?
public void pipe(Reader in, Writer out) {
CharBuffer buf = CharBuffer.allocate(DEFAULT_BUFFER_SIZE);
while( in.read(buf) >= 0 ) {
out.append(buf.flip());
}
}
| The method you've posted is intended to read data from a `Reader` and write it to a `Writer`. However, it may hang due to a couple of issues with how the `CharBuffer` is being handled.
### Potential Issues:
1. **Buffer Not Flipped or Cleared Properly**: When you read from a `Reader` into a `CharBuffer`, you need to m... | 10,781 | [
{
"from": "human",
"value": "Why does the following method hang?\n\npublic void pipe(Reader in, Writer out) {\n CharBuffer buf = CharBuffer.allocate(DEFAULT_BUFFER_SIZE);\n while( in.read(buf) >= 0 ) {\n out.append(buf.flip());\n }\n}\n\n"
},
{
"from": "gpt",
"value": "The method y... |
Seems like a simple enough question but I can't seem to find the answer. And hey, dead simple questions like this with dead simple answers is what Joel and Jeff want SO to be all about, right?
| Absolutely! Simple questions often lead to straightforward answers, and that’s a great way to foster helpful discussions. What’s your question? I’m here to help! | 15,046 | [
{
"from": "human",
"value": "Seems like a simple enough question but I can't seem to find the answer. And hey, dead simple questions like this with dead simple answers is what Joel and Jeff want SO to be all about, right?\n"
},
{
"from": "gpt",
"value": "Absolutely! Simple questions often lead t... |
What is the best available tool to monitor the memory usage of my C#/.Net windows service over a long period of time. As far as I know, tools like perfmon can monitor the memory usage over a short period of time, but not graphically over a long period of time. I need trend data over days, not seconds.
To be clear, I ... | To monitor the memory usage of a C#/.NET Windows service over a long period of time with fine granularity and visual graphs, you have several options. Here are some tools that can meet your requirements:
1. **Application Insights**:
- This is a part of Azure Monitor and can be integrated into your .NET application.... | 9,966 | [
{
"from": "human",
"value": "What is the best available tool to monitor the memory usage of my C#/.Net windows service over a long period of time. As far as I know, tools like perfmon can monitor the memory usage over a short period of time, but not graphically over a long period of time. I need trend dat... |
I'd be leading a new project soon. And I've been pondering over what are the basic infrastructure for a software project. These are the stuff that I think every project should have:
-Coding style conventions
-Naming conventions
-Standard project directory structure(eg maven standard dir layout, etc)
-Project management... | You have a solid list of essential infrastructure components for a software project. Here are a few additional elements and considerations that can help ensure your project's success:
1. **Version Control System**:
- Implement a version control system (e.g., Git, Subversion) for tracking changes in your codebase an... | 10,294 | [
{
"from": "human",
"value": "I'd be leading a new project soon. And I've been pondering over what are the basic infrastructure for a software project. These are the stuff that I think every project should have:\n-Coding style conventions\n-Naming conventions\n-Standard project directory structure(eg maven s... |
So you know a lot of Mac apps use "bundles": It looks like a single file to your application, but it's actually a folder with many files inside.
For a version control system to handle this, it needs to:
check out all the files in a directory, so the app can modify them as necessary
at checkin,
commit files which ha... | Managing application bundles in version control systems can be challenging due to their nature as directories containing multiple files. However, several existing version control systems have features that can help handle bundles effectively. Here are some options and strategies to consider:
### Version Control System... | 8,623 | [
{
"from": "human",
"value": "So you know a lot of Mac apps use \"bundles\": It looks like a single file to your application, but it's actually a folder with many files inside.\nFor a version control system to handle this, it needs to:\n\ncheck out all the files in a directory, so the app can modify them as... |
I've got a Fitnesse RowFixture that returns a list of business objects. The object has a field which is a float representing a percentage between 0 and 1. The consumer of the business object will be a web page or report that comes from a designer, so the formatting of the percentage will be up to the designer rather ... | In FitNesse, you can customize how data is presented in your fixtures, including how floats are formatted. Since you want to display the percentage value as a formatted string (e.g., converting `0.5` to `50%`), you can achieve this without altering your business object by overriding the `getCell()` method in your RowFi... | 9,064 | [
{
"from": "human",
"value": "I've got a Fitnesse RowFixture that returns a list of business objects. The object has a field which is a float representing a percentage between 0 and 1. The consumer of the business object will be a web page or report that comes from a designer, so the formatting of the perc... |
Problem
My current project requires me to do different things based on different HTTP request headers for nearly every action.
Currently, I have one massive Controller (all for the same resource type), and every action method has an ActionName attribute (so that I can have multiple versions of the same action that take... | To achieve the desired behavior of routing HTTP requests to different controllers based on the `Accept` header, you can implement a custom routing mechanism using ASP.NET MVC. You can create a custom `IHttpRouteHandler` or utilize attribute routing with a custom `ActionFilterAttribute` to inspect the request headers an... | 4,925 | [
{
"from": "human",
"value": "Problem\nMy current project requires me to do different things based on different HTTP request headers for nearly every action.\nCurrently, I have one massive Controller (all for the same resource type), and every action method has an ActionName attribute (so that I can have mul... |
I'm calling GetProperty on a org.freedesktop.Hal.Device from my handler during a PropertyNotified signal. I'm only calling GetProperty on properties that have been added or changed.
When I call GetProperty during property adds, I'm getting a org.freedesktop.Hal.NoSuchProperty exception. I'm also worried that during c... | When working with signals like `PropertyNotified` in a D-Bus system, particularly with the `org.freedesktop.Hal.Device`, it's important to understand the timing and state of properties when you receive these notifications. Here's how you should approach this to avoid race conditions and errors like `org.freedesktop.Hal... | 7,974 | [
{
"from": "human",
"value": "I'm calling GetProperty on a org.freedesktop.Hal.Device from my handler during a PropertyNotified signal. I'm only calling GetProperty on properties that have been added or changed.\nWhen I call GetProperty during property adds, I'm getting a org.freedesktop.Hal.NoSuchProperty ... |
Possible Duplicate:
What is the best way to parse html in C#?
I would like to extract the structure of the HTML document - so the tags are more important than the content. Ideally, it would be able to cope reasonably with badly-formed HTML to some extent also.
Anyone know of a reliable and efficient parser?
| To parse HTML in C#, particularly when you want to extract the structure of the document and cope with poorly formed HTML, you can use libraries designed for HTML parsing. Here are a few popular options:
1. **HtmlAgilityPack**:
- HtmlAgilityPack is a powerful library for parsing and manipulating HTML documents. It ... | 8,319 | [
{
"from": "human",
"value": "\nPossible Duplicate:\nWhat is the best way to parse html in C#? \n\nI would like to extract the structure of the HTML document - so the tags are more important than the content. Ideally, it would be able to cope reasonably with badly-formed HTML to some extent also.\nAnyone kn... |
Never used a cache like this before. The problem is that I want to load 500,000 + records out of a database and do some selecting/filtering wicked fast.
I'm thinking about using a cache, and preliminarily found EHCache and OSCache, any opinions?
| When considering a caching solution for fast retrieval and filtering of a large number of records from a database, there are several factors to weigh. Both EHCache and OSCache are established caching libraries in the Java ecosystem, but they have some differences that may influence your choice. Below are some insights ... | 10,393 | [
{
"from": "human",
"value": "Never used a cache like this before. The problem is that I want to load 500,000 + records out of a database and do some selecting/filtering wicked fast.\nI'm thinking about using a cache, and preliminarily found EHCache and OSCache, any opinions?\n"
},
{
"from": "gpt",
... |
We prototype a design, GUI, just to analyze a particular problem, proof of concept, etc. Sometimes we throw away the prototype, and sometimes it ends up in the production code. We use different languages, technologies, strategies, and styles to prototype.
What are the different situations you prototype usually and how ... | Prototyping is a critical phase in the design and development process, especially when addressing complex problems or validating concepts. It allows teams to visualize ideas, test functionality, and gather feedback before committing to a full-scale implementation. Here are some common situations where prototyping is be... | 7,579 | [
{
"from": "human",
"value": "We prototype a design, GUI, just to analyze a particular problem, proof of concept, etc. Sometimes we throw away the prototype, and sometimes it ends up in the production code. We use different languages, technologies, strategies, and styles to prototype.\nWhat are the different... |
I am new to any scripting language. But, still I worked on scripting a bit like tailoring other scripts to work for my purpose. For me, what is the best online resource to learn Perl?
| Welcome to the world of scripting! Perl is a powerful language with a rich set of features. Here are some great online resources to help you learn Perl:
1. **Perl Official Documentation**:
- [Perl Documentation](https://www.perldoc.org/): The official Perl documentation is a comprehensive resource for learning abou... | 9,585 | [
{
"from": "human",
"value": "I am new to any scripting language. But, still I worked on scripting a bit like tailoring other scripts to work for my purpose. For me, what is the best online resource to learn Perl?\n"
},
{
"from": "gpt",
"value": "Welcome to the world of scripting! Perl is a power... |
I have a macro which refreshes all fields in a document (the equivalent of doing an F9 on the fields). I'd like to fire this macro automatically when the user saves the document.
Under options I can select "update fields when document is printed", but that's not what I want. In the VBA editor I only seem to find events... | In Word 97, there is no direct `Document_Save()` event available in the VBA environment, as it is in later versions. However, you can work around this limitation by using a combination of the `Document_BeforeClose` and `Document_Open` events in your document module. While this won't be exactly the same as firing on sav... | 9,599 | [
{
"from": "human",
"value": "I have a macro which refreshes all fields in a document (the equivalent of doing an F9 on the fields). I'd like to fire this macro automatically when the user saves the document.\nUnder options I can select \"update fields when document is printed\", but that's not what I want. ... |
Does IPsec in Windows XP Sp3 support AES-256 encryption?
Update:
Windows IPsec FAQ says that it's not supported in Windows XP, but maybe they changed it in Service Pack 3?
http://www.microsoft.com/technet/network/ipsec/ipsecfaq.mspx
Question: Is Advanced Encryption Standard (AES) encryption supported?
origamigumby,... | IPsec in Windows XP SP3 does not support AES-256 encryption natively. While Windows XP SP2 introduced support for AES encryption in general, it was limited to AES-128 and AES-192. The lack of support for AES-256 was confirmed in various Microsoft documentation, including the IPsec FAQ you referenced.
To use AES-256 wi... | 14,162 | [
{
"from": "human",
"value": "Does IPsec in Windows XP Sp3 support AES-256 encryption?\nUpdate:\n\nWindows IPsec FAQ says that it's not supported in Windows XP, but maybe they changed it in Service Pack 3?\n\nhttp://www.microsoft.com/technet/network/ipsec/ipsecfaq.mspx\n\nQuestion: Is Advanced Encryption Sta... |
If you had a differential of either venturing into Delphi land or Qt land which would you choose? I know they are not totally comparable. I for one have Windows development experience with Builder C++ (almost Delphi) and MFC (almost Qt), with a bit more time working with Builder C++. Please take out the cross platform ... | When deciding between Delphi and Qt (specifically using Qt for C++ development), there are several factors to consider, especially given your background in Builder C++ and MFC. Here’s a comparison based on various aspects:
### 1. Language and Syntax:
- **Delphi**: Uses Object Pascal, which is often considered straight... | 7,555 | [
{
"from": "human",
"value": "If you had a differential of either venturing into Delphi land or Qt land which would you choose? I know they are not totally comparable. I for one have Windows development experience with Builder C++ (almost Delphi) and MFC (almost Qt), with a bit more time working with Builder... |
Before I jump headlong into C#...
I've always felt that C, or maybe C++, was best for developing drivers on Windows. I'm not keen on the idea of developing a driver on a .NET machine.
But .NET seems to be the way MS is heading for applications development, and so I'm now wondering:
Are people are using C# to develop ... | It's great that you're exploring your options for driver development on Windows! However, there are some important considerations when it comes to using C# for this purpose. Here's a breakdown of your questions:
### 1. Are people using C# to develop drivers?
No, C# is not typically used for developing Windows drivers... | 7,686 | [
{
"from": "human",
"value": "Before I jump headlong into C#...\nI've always felt that C, or maybe C++, was best for developing drivers on Windows. I'm not keen on the idea of developing a driver on a .NET machine.\nBut .NET seems to be the way MS is heading for applications development, and so I'm now wond... |
In a .net 2 winforms application, what's a good way to set the culture for the entire application?
Setting CurrentThread.CurrentCulture for every new thread is repetitive and error-prone.
Ideally I'd like to set it when the app starts and forget about it.
| In a .NET WinForms application, you can set the culture for the entire application in a centralized manner, which avoids the need to set `CurrentThread.CurrentCulture` for every thread. This can be done in the `Main` method of your application. By doing this, you ensure that the culture is set before any forms are crea... | 9,899 | [
{
"from": "human",
"value": "In a .net 2 winforms application, what's a good way to set the culture for the entire application?\nSetting CurrentThread.CurrentCulture for every new thread is repetitive and error-prone.\nIdeally I'd like to set it when the app starts and forget about it.\n"
},
{
"from... |
I've done many web apps where the first thing you do is make a user table with usernames, passwords, names, e-mails and all of the other usual flotsam. My current project presents a situation where non-users records need to function similarly to users, but do not need to the ability to be a first order user.
Is it r... | Creating separate tables for users and non-user records can be a reasonable approach, especially when your application has different requirements for user accounts and other types of entities (e.g., customers, clients, or other non-authenticated entities). Here are some considerations, strategies, and potential drawbac... | 9,594 | [
{
"from": "human",
"value": "I've done many web apps where the first thing you do is make a user table with usernames, passwords, names, e-mails and all of the other usual flotsam. My current project presents a situation where non-users records need to function similarly to users, but do not need to the ab... |
In a C# .NET 3.5 app (a mix of WinForms and WPF) I want to let the user select a folder to import a load of data from. At the moment, it's using System.Windows.Forms.FolderBrowserDialog but that's a bit lame. Mainly because you can't type the path into it (so you need to map a network drive, instead of typing a UNC pat... | In .NET Framework 3.5, you don't have a built-in dialog similar to `OpenFileDialog` that allows for folder selection with the ability to type in a path. However, you can create a custom solution to enhance the user experience by combining both a folder browser and a text box for path input. Here’s a straightforward app... | 4,973 | [
{
"from": "human",
"value": "In a C# .NET 3.5 app (a mix of WinForms and WPF) I want to let the user select a folder to import a load of data from. At the moment, it's using System.Windows.Forms.FolderBrowserDialog but that's a bit lame. Mainly because you can't type the path into it (so you need to map a n... |
Our web services are distributed across different servers for various reasons (such as decreasing latency to the client), and they're not always all up-to-date. Rather than throwing an exception when a method doesn't exist because the particular web service is too old, it would be nicer if we could have the client chec... | Yes, there are several strategies you can employ to check if a service responds to a given method before attempting to call it. Below are some approaches you can consider:
### 1. **Using Reflection** (If the service is exposed as an object)
If your service exposes its methods in a way that you can invoke reflection (f... | 9,398 | [
{
"from": "human",
"value": "Our web services are distributed across different servers for various reasons (such as decreasing latency to the client), and they're not always all up-to-date. Rather than throwing an exception when a method doesn't exist because the particular web service is too old, it would ... |
What do you consider the most rapid RAD environment for a working prototype? Not for debate.
language
platform
IDE
DB
(personal note)
Thank you.
P.S.1 I was pretty happy with PERL for back-end prototyping... I get stuck when dealing with the UI... it doesn't seem to come as easy...
| For rapid application development (RAD) of a working prototype, I would recommend the following stack:
**Language:** Python
Python is known for its simplicity and readability, making it ideal for quickly writing and iterating on code.
**Platform:** Flask (for web applications) or Django (if you need more built-in f... | 11,856 | [
{
"from": "human",
"value": "What do you consider the most rapid RAD environment for a working prototype? Not for debate. \n\nlanguage\nplatform\nIDE\nDB \n(personal note)\n\nThank you.\nP.S.1 I was pretty happy with PERL for back-end prototyping... I get stuck when dealing with the UI... it doesn't seem... |
I was given a task to display when a record in the database was added, however the previous developers never made a field for this, and I can't go back and make up dates for all the existing records. Is there an easy way to extract out a record Creation date from a SQL server 2000 query.
SELECT RECORD_CREATED_DATE FRO... | In SQL Server 2000, there isn't a built-in function to retrieve the creation date of a record if that information isn't stored in a dedicated column within the table. However, there are a couple of approaches you can consider:
1. **Using Triggers for Future Records**: If you need to start tracking when records are add... | 10,133 | [
{
"from": "human",
"value": "I was given a task to display when a record in the database was added, however the previous developers never made a field for this, and I can't go back and make up dates for all the existing records. Is there an easy way to extract out a record Creation date from a SQL server 20... |
What built-in PHP functions are useful for web scraping? What are some good resources (web or print) for getting up to speed on web scraping with PHP?
| When it comes to web scraping with PHP, there are several built-in functions and libraries that can be very useful. Below are some important functions and libraries along with resources to help you get started.
### Useful Built-in PHP Functions
1. **`file_get_contents()`**: This function is used to read the entire co... | 7,459 | [
{
"from": "human",
"value": "What built-in PHP functions are useful for web scraping? What are some good resources (web or print) for getting up to speed on web scraping with PHP?\n"
},
{
"from": "gpt",
"value": "When it comes to web scraping with PHP, there are several built-in functions and l... |
What I want is lots of nodes which can expand making a mind map.
I'd ideally like to expand and collapse nodes. I would like to be able to navigate by either dragging around the page, or by following expanded nodes.
| To create a mind map application that allows for expandable and collapsible nodes, along with the ability to navigate by dragging and following nodes, you can utilize a combination of web technologies. Below are some suggestions and libraries that can help you achieve this:
### Libraries and Frameworks
1. **D3.js**:
... | 3,439 | [
{
"from": "human",
"value": "What I want is lots of nodes which can expand making a mind map.\nI'd ideally like to expand and collapse nodes. I would like to be able to navigate by either dragging around the page, or by following expanded nodes.\n"
},
{
"from": "gpt",
"value": "To create a mind ... |
My company recently purchased TFS and I have started looking into the code analysis tools to help drive up code quality and noticed a good looking metric "maintainability index". Is anyone using this metric for code reviews/checkins/etc? If so, what is an acceptable index for developers to work toward?
| The Maintainability Index is a software metric that provides a numerical measure of how maintainable a piece of code is. It takes into account factors such as lines of code (LOC), cyclomatic complexity, and Halstead volume. The index typically ranges from 0 to 100, where higher values indicate better maintainability.
... | 5,280 | [
{
"from": "human",
"value": "My company recently purchased TFS and I have started looking into the code analysis tools to help drive up code quality and noticed a good looking metric \"maintainability index\". Is anyone using this metric for code reviews/checkins/etc? If so, what is an acceptable index fo... |
Occasionally I come accross a unit test that doesn't Assert anything. The particular example I came across this morning was testing that a log file got written to when a condition was met. The assumption was that if no error was thrown the test passed.
I personally don't have a problem with this, however it seems to be... | Your observation touches on a common debate in software testing, particularly regarding unit tests and their purpose. Here are some considerations:
### The Purpose of Unit Tests
1. **Assertions**: The primary role of a unit test is to verify that a piece of code behaves as expected. Assertions are the mechanism that p... | 10,481 | [
{
"from": "human",
"value": "Occasionally I come accross a unit test that doesn't Assert anything. The particular example I came across this morning was testing that a log file got written to when a condition was met. The assumption was that if no error was thrown the test passed.\nI personally don't have a... |
I have a SQL table with news stories and Unix timestamps. I'd like to only keep the 50 newest stories. How would I write an SQL statement to delete any amount of older stories?
| To delete older stories from your SQL table while keeping only the 50 newest stories, you can use a Common Table Expression (CTE) along with the `DELETE` statement. Here’s how you can do this:
Assuming your table is named `news_stories` and the column storing the Unix timestamps is named `timestamp`, you can write the... | 12,102 | [
{
"from": "human",
"value": "I have a SQL table with news stories and Unix timestamps. I'd like to only keep the 50 newest stories. How would I write an SQL statement to delete any amount of older stories?\n"
},
{
"from": "gpt",
"value": "To delete older stories from your SQL table while keeping... |
I have a list of addresses from a Database for which I'd like to put markers on a Yahoo Map. The addMarker() method on YMap takes a YGeoPoint, which requires a latitude and longitude. However, Yahoo Maps must know how to convert from addresses because drawZoomAndCenter(LocationType,ZoomLevel) can take an address. I cou... | Yes, you can convert addresses to latitude and longitude without needing to use the `drawZoomAndCenter()` method, which involves rendering a map. Instead, you can utilize the Yahoo Geocoding API to directly convert addresses into geographical coordinates.
Here's a general outline of how you can achieve this:
1. **Use... | 9,482 | [
{
"from": "human",
"value": "I have a list of addresses from a Database for which I'd like to put markers on a Yahoo Map. The addMarker() method on YMap takes a YGeoPoint, which requires a latitude and longitude. However, Yahoo Maps must know how to convert from addresses because drawZoomAndCenter(LocationT... |
I can never remember the number. I need a memory rule.
| Sure! To help you remember a number, you can use several memory techniques. Here are a few:
1. **Chunking**: Break the number into smaller groups. For example, if you need to remember 123456789, you could think of it as 123-456-789.
2. **Visual Association**: Create a vivid mental image related to each digit. For exa... | 13,094 | [
{
"from": "human",
"value": "I can never remember the number. I need a memory rule.\n"
},
{
"from": "gpt",
"value": "Sure! To help you remember a number, you can use several memory techniques. Here are a few:\n\n1. **Chunking**: Break the number into smaller groups. For example, if you need to r... |
I have a project with a bunch of external sounds to a SWF. I want to play them, but any time I attempt load a new URL into the sound object it fails with either,
Error #2068: Invalid Sound
or raises an ioError with
Error #2032 Stream Error
// Tried with path prefixed with "http://.." "file://.." "//.." and "..")
... | The errors you're encountering when trying to load external sounds into a SWF file can stem from several issues. Let's break down the potential causes and solutions for `Error #2068: Invalid Sound` and `Error #2032: Stream Error`.
### Troubleshooting Steps
1. **Check the URL**:
Ensure that the URL is correctly for... | 8,792 | [
{
"from": "human",
"value": "I have a project with a bunch of external sounds to a SWF. I want to play them, but any time I attempt load a new URL into the sound object it fails with either,\n\nError #2068: Invalid Sound\n\nor raises an ioError with \n\nError #2032 Stream Error\n\n// Tried with path prefix... |
I already found this article:
http://www.dotnetcurry.com/ShowArticle.aspx?ID=181&AspxAutoDetectCookieSupport=1
But I've got a different situation. I am embedding some hiddenFields inside of the master page and trying to store the position of the dragPanel in those.
I am using javascript to store the position of the dr... | When dealing with ASP.NET Web Forms and page navigation, the values stored in hidden fields do not persist across different page requests unless handled correctly. In your case, you're trying to retain the position of a draggable panel by storing its coordinates in a hidden field, but after navigating to a new page (li... | 8,616 | [
{
"from": "human",
"value": "I already found this article:\nhttp://www.dotnetcurry.com/ShowArticle.aspx?ID=181&AspxAutoDetectCookieSupport=1\nBut I've got a different situation. I am embedding some hiddenFields inside of the master page and trying to store the position of the dragPanel in those. \nI am usin... |
How do you connect to Oracle using PHP on MAC OS X?
| To connect to an Oracle database using PHP on macOS, you need to follow several steps to ensure you have the necessary PHP extensions and Oracle client installed. Here’s a step-by-step guide to help you get set up:
### Step 1: Install the Oracle Instant Client
1. **Download Oracle Instant Client**:
- Visit the [Or... | 6,230 | [
{
"from": "human",
"value": "How do you connect to Oracle using PHP on MAC OS X?\n"
},
{
"from": "gpt",
"value": "To connect to an Oracle database using PHP on macOS, you need to follow several steps to ensure you have the necessary PHP extensions and Oracle client installed. Here’s a step-by-st... |
Using C#, I want to get the total amount of RAM that my computer has.
With the PerformanceCounter I can get the amount of Available ram, by setting:
counter.CategoryName = "Memory";
counter.Countername = "Available MBytes";
But I can't seem to find a way to get the total amount of memory. How would I go about doing t... | To retrieve the total amount of RAM in your computer using C#, you have a couple of options. The `PerformanceCounter` class will not directly provide the total physical memory, but you can use the `Microsoft.VisualBasic.Devices` namespace, which provides an easier way to access system information, including total memor... | 8,954 | [
{
"from": "human",
"value": "Using C#, I want to get the total amount of RAM that my computer has.\nWith the PerformanceCounter I can get the amount of Available ram, by setting:\ncounter.CategoryName = \"Memory\";\ncounter.Countername = \"Available MBytes\";\n\nBut I can't seem to find a way to get the tot... |
How can I detect, using php, if the machine has oracle (oci8 and/or pdo_oci) installed?
I'm working on a PHP project where some developers, such as myself, have it installed, but there's little need for the themers to have it. How can I write a quick function to use in the code so that my themers are able to work on t... | You can use PHP's built-in functions to check for the presence of the OCI8 and PDO_OCI extensions. Here's a simple function that you can use to detect if these extensions are installed:
```php
function checkOracleExtensions() {
$extensions = [
'oci8' => extension_loaded('oci8'),
'pdo_oci' => extens... | 11,566 | [
{
"from": "human",
"value": "How can I detect, using php, if the machine has oracle (oci8 and/or pdo_oci) installed?\nI'm working on a PHP project where some developers, such as myself, have it installed, but there's little need for the themers to have it. How can I write a quick function to use in the cod... |
I need to have a script read the files coming in and check information for verification.
On the first line of the files to be read is a date but in numeric form. eg: 20080923
But before the date is other information, I need to read it from position 27. Meaning line 1 position 27, I need to get that number and see if ... | To read a specific position in a line and check if it's greater than a given number, you can use a combination of shell commands like `awk` or `cut`, in addition to `grep`. Below is a sample shell script that demonstrates how to achieve this.
### Shell Script
```bash
#!/bin/bash
# Specify the threshold number
THRESH... | 9,884 | [
{
"from": "human",
"value": "I need to have a script read the files coming in and check information for verification.\nOn the first line of the files to be read is a date but in numeric form. eg: 20080923 \nBut before the date is other information, I need to read it from position 27. Meaning line 1 positio... |
In WPF, how would I apply multiple styles to a FrameworkElement? For instance, I have a control which already has a style. I also have a separate style which I would like to add to it without blowing away the first one. The styles have different TargetTypes, so I can't just extend one with the other.
| In WPF (Windows Presentation Foundation), you can apply multiple styles to a `FrameworkElement` by using different techniques, as styles are generally applied in a singular way. However, if your styles have different `TargetTypes`, you can make use of various approaches such as using `Style.Triggers`, setting propertie... | 6,283 | [
{
"from": "human",
"value": "In WPF, how would I apply multiple styles to a FrameworkElement? For instance, I have a control which already has a style. I also have a separate style which I would like to add to it without blowing away the first one. The styles have different TargetTypes, so I can't just e... |
I have determined that my JSON, coming from the server, is valid (making the ajax call manually), but I would really like to use JQuery. I have also determined that the "post" URL, being sent to the server, is correct, using firebug. However, the error callback is still being triggered (parse error). I also tried datat... | It seems like you're facing an issue with your AJAX call in jQuery, specifically related to parsing the JSON response. Here are some suggestions to troubleshoot and fix the problem:
1. **Correct `dataType` Option**: Make sure you are using the correct option name. The option should be `dataType` (case-sensitive), not ... | 8,409 | [
{
"from": "human",
"value": "I have determined that my JSON, coming from the server, is valid (making the ajax call manually), but I would really like to use JQuery. I have also determined that the \"post\" URL, being sent to the server, is correct, using firebug. However, the error callback is still being ... |
If you were writing a new application from scratch today, and wanted it to scale to all the cores you could throw at it tomorrow, what parallel programming model/system/language/library would you choose? Why?
I am particularly interested in answers along these axes:
Programmer productivity / ease of use (can mortals ... | When considering the design of a new application with an eye toward future scalability and parallelism, I would recommend using **Rust with the Tokio library** for asynchronous programming. Below is an analysis based on your specified axes.
### Programmer Productivity / Ease of Use
- **Rust's Language Features:** Rust... | 10,273 | [
{
"from": "human",
"value": "If you were writing a new application from scratch today, and wanted it to scale to all the cores you could throw at it tomorrow, what parallel programming model/system/language/library would you choose? Why?\nI am particularly interested in answers along these axes:\n\nProgram... |
I'd like to add the HttpOnly flag to JSF/richfaces cookies, especially the session cookie, to up the level of security on my web app. Any ideas?
| To enhance the security of your JSF/RichFaces web application by adding the HttpOnly flag to cookies, particularly for session cookies, you can configure your web application in a few different ways depending on the JavaServer Faces version, the server you are using, and how you manage session cookies. Below are some a... | 6,482 | [
{
"from": "human",
"value": "I'd like to add the HttpOnly flag to JSF/richfaces cookies, especially the session cookie, to up the level of security on my web app. Any ideas? \n"
},
{
"from": "gpt",
"value": "To enhance the security of your JSF/RichFaces web application by adding the HttpOnly fla... |
I have two insert statements, almost exactly the same, which run in two different schemas on the same Oracle instance. What the insert statement looks like doesn't matter - I'm looking for a troubleshooting strategy here.
Both schemas have 99% the same structure. A few columns have slightly different names, other than ... | It sounds like you have already made significant progress in identifying the underlying issues causing the performance disparity between the two insert statements. However, for others who may face a similar situation, I'll outline a comprehensive troubleshooting strategy that can be applied to such scenarios.
### Tro... | 8,872 | [
{
"from": "human",
"value": "I have two insert statements, almost exactly the same, which run in two different schemas on the same Oracle instance. What the insert statement looks like doesn't matter - I'm looking for a troubleshooting strategy here.\nBoth schemas have 99% the same structure. A few columns ... |
I know of the US GIS TIGER file format from years ago, but have never used it.
I'm very shortly going to need to very quickly implement simple geocoding and vector graphics of roads and other features.
Where do I go for information - are there tutorials, example queries, etc?
Are there other ways to include geocoding... | Certainly, Adam! Here are some steps and resources to help you with your requirements for geocoding and vector graphics, as well as some alternatives for offline mapping.
### Working with TIGER Files
1. **Understanding TIGER Files**: The Topologically Integrated Geographic Encoding and Referencing (TIGER) database pro... | 8,656 | [
{
"from": "human",
"value": "I know of the US GIS TIGER file format from years ago, but have never used it.\nI'm very shortly going to need to very quickly implement simple geocoding and vector graphics of roads and other features.\n\nWhere do I go for information - are there tutorials, example queries, etc... |
I have a crash dump of an application that is supposedly leaking GDI. The app is running on XP and I have no problems loading it into WinDbg to look at it. Previously we have use the Gdikdx.dll extension to look at Gdi information but this extension is not supported on XP or Vista.
Does anyone have any pointers for ... | To analyze GDI object usage in an application running on Windows XP, especially since Gdikdx.dll is not supported on that OS, you can use several approaches with WinDbg and other tools. Here are some suggestions:
### Analyzing a Crash Dump with WinDbg
1. **Using !gdi Usage:**
In WinDbg, you can use the built-in `!... | 8,895 | [
{
"from": "human",
"value": "I have a crash dump of an application that is supposedly leaking GDI. The app is running on XP and I have no problems loading it into WinDbg to look at it. Previously we have use the Gdikdx.dll extension to look at Gdi information but this extension is not supported on XP or V... |
Looking for a way to read the unique ID / serial# of a USB thumb drive;
please note that
- I am looking for the value of the manufacturer, not the one Windows allocates for it.
- I need to support multiple OS (Windows, Unix, Mac), thus needs to be a Java solution
The idea is to be able to distinguish between different ... | To read the unique ID (serial number) of a USB thumb drive in a cross-platform way using Java, you can utilize a third-party library called **libusb**. However, this requires some additional setup and may not be directly supported out-of-the-box in Java. Instead, you can leverage Java Native Access (JNA) or Runtime.exe... | 8,334 | [
{
"from": "human",
"value": "Looking for a way to read the unique ID / serial# of a USB thumb drive;\nplease note that\n- I am looking for the value of the manufacturer, not the one Windows allocates for it.\n- I need to support multiple OS (Windows, Unix, Mac), thus needs to be a Java solution\nThe idea is... |
I have written some code in my VB.NET application to send an HTML e-mail (in this case, a lost password reminder).
When I test the e-mail, it gets eaten by my spam filter. One of the things that it's scoring badly on is because of the following problem:
MIME_QP_LONG_LINE RAW: Quoted-printable line longer than 76 char... | The issue you are facing, `MIME_QP_LONG_LINE`, indicates that your HTML email is using the Quoted-Printable encoding, and it's generating lines longer than the 76 characters that the MIME specification allows. While breaking the lines manually is a good approach, the email sending library you are using may be responsib... | 6,342 | [
{
"from": "human",
"value": "I have written some code in my VB.NET application to send an HTML e-mail (in this case, a lost password reminder).\nWhen I test the e-mail, it gets eaten by my spam filter. One of the things that it's scoring badly on is because of the following problem:\nMIME_QP_LONG_LINE RAW... |
For example if I have an Enum with two cases, does it make take more memory than a boolean? Languages: Java, C++
| In both Java and C++, an `enum` with two cases typically takes more memory than a boolean. Let's break down the reasons for each language.
### Java
In Java, an `enum` is more than just a simple type; it is a full-fledged class. Each enum constant is an instance of the enum type. In Java, enums can have methods, field... | 11,503 | [
{
"from": "human",
"value": "For example if I have an Enum with two cases, does it make take more memory than a boolean? Languages: Java, C++\n"
},
{
"from": "gpt",
"value": "In both Java and C++, an `enum` with two cases typically takes more memory than a boolean. Let's break down the reasons f... |
I am using VirtualPc 2007 more and more, the one annoyance is "Alt-Tab".
What I want is to be able to use alt-tab to iterate through all of the applications in the host pc and virtual(s) as if they were one long list. Is there a setting or program to do this?
| Unfortunately, Virtual PC 2007 does not natively support integrating the task switching behavior (like Alt-Tab) between the host and the virtual machine in the way you described. When you press Alt-Tab, it only cycles through the applications on the currently active system (either host or guest), and not both.
However... | 10,289 | [
{
"from": "human",
"value": "I am using VirtualPc 2007 more and more, the one annoyance is \"Alt-Tab\".\nWhat I want is to be able to use alt-tab to iterate through all of the applications in the host pc and virtual(s) as if they were one long list. Is there a setting or program to do this?\n"
},
{
... |
I want to be able to generate PDF output from my (native) C++ Windows application. Are there any free/open source libraries available to do this?
I looked at the answers to this question, but they mostly relate to .Net.
| Yes, there are several free and open-source libraries available for generating PDF output from a native C++ Windows application. Here are some popular options you can consider:
1. **libharu**: This is a free, open-source library for creating PDF files. It is written in C and has a simple API that can be used in C++ ap... | 6,469 | [
{
"from": "human",
"value": "I want to be able to generate PDF output from my (native) C++ Windows application. Are there any free/open source libraries available to do this?\nI looked at the answers to this question, but they mostly relate to .Net.\n"
},
{
"from": "gpt",
"value": "Yes, there ar... |
If you are writing a simple little loop, what should you name the counter?
Provide example loops!
| When writing loops, it's important to choose meaningful and conventional names for the counter variable to enhance code readability. Here are a few common naming conventions and examples of loops using those conventions:
### Common Counter Names
1. `i` - A common choice for a simple integer counter.
2. `j` - Often use... | 10,985 | [
{
"from": "human",
"value": "If you are writing a simple little loop, what should you name the counter?\nProvide example loops!\n"
},
{
"from": "gpt",
"value": "When writing loops, it's important to choose meaningful and conventional names for the counter variable to enhance code readability. He... |
Erasing programs such as Eraser recommend overwriting data maybe 36 times.
As I understand it all data is stored on a hard drive as 1s or 0s.
If an overwrite of random 1s and 0s is carried out once over the whole file then why isn't that enough to remove all traces of the original file?
| The process of overwriting data on a hard drive is based on how data is physically stored on magnetic or solid-state media. Here's a breakdown of why multiple overwrites have been traditionally recommended, and why a single overwrite may not be sufficient:
### Understanding Data Storage
1. **Magnetic Storage**: In tr... | 8,779 | [
{
"from": "human",
"value": "Erasing programs such as Eraser recommend overwriting data maybe 36 times.\nAs I understand it all data is stored on a hard drive as 1s or 0s.\nIf an overwrite of random 1s and 0s is carried out once over the whole file then why isn't that enough to remove all traces of the orig... |
I've set up Passenger in development (Mac OS X) and it works flawlessly. The only problem came later: now I have a custom GEM_HOME path and ImageMagick binaries installed in "/usr/local". I can put them in one of the shell rc files that get sourced and this solves the environment variables for processes spawned from th... | When using Passenger with Ruby applications, it can sometimes be tricky to ensure that the correct environment variables, including `GEM_HOME`, are set correctly for the Passenger processes. Here are several steps you can take to ensure that Passenger picks up your custom `GEM_HOME` and other environment variables:
##... | 8,324 | [
{
"from": "human",
"value": "I've set up Passenger in development (Mac OS X) and it works flawlessly. The only problem came later: now I have a custom GEM_HOME path and ImageMagick binaries installed in \"/usr/local\". I can put them in one of the shell rc files that get sourced and this solves the environm... |
When trying to use libxml2 as myself I get an error saying the package cannot be found. If I run as as super user I am able to import fine.
I have installed python25 and all libxml2 and libxml2-py25 related libraries via fink and own the entire path including the library. Any ideas why I'd still need to sudo?
| It sounds like you're encountering a permissions issue related to where the `libxml2` package is installed or how Python is configured to access it. Here are several things you could check to resolve the issue:
1. **Check Python Paths**: When you run Python as a regular user and as a superuser, the environment variabl... | 9,510 | [
{
"from": "human",
"value": "When trying to use libxml2 as myself I get an error saying the package cannot be found. If I run as as super user I am able to import fine.\nI have installed python25 and all libxml2 and libxml2-py25 related libraries via fink and own the entire path including the library. Any i... |
I use the Eclipse IDE to develop, compile, and run my Java projects. Today, I'm trying to use the java.io.Console class to manage output and, more importantly, user input.
The problem is that System.console() returns null when an application is run "through" Eclipse. Eclipse run the program on a background process, rat... | You are correct that when running Java applications inside the Eclipse IDE, the `System.console()` method often returns `null` because the application is running in a context without an attached console, such as the background process you're describing.
Unfortunately, you cannot configure Eclipse to run your program i... | 8,976 | [
{
"from": "human",
"value": "I use the Eclipse IDE to develop, compile, and run my Java projects. Today, I'm trying to use the java.io.Console class to manage output and, more importantly, user input.\nThe problem is that System.console() returns null when an application is run \"through\" Eclipse. Eclipse ... |
I've been hearing conflicting facts about this topic. What is correct?
| I’d be happy to help clarify any topic you have questions about! Please provide me with more specific details about the topic or the conflicting facts you’ve encountered. | 15,151 | [
{
"from": "human",
"value": "I've been hearing conflicting facts about this topic. What is correct?\n"
},
{
"from": "gpt",
"value": "I’d be happy to help clarify any topic you have questions about! Please provide me with more specific details about the topic or the conflicting facts you’ve encou... |
Does anybody have any pointers to what SWD files are in Flash 9, why Flash Player wants to download them sometimes, how to make ones, how to make use of them? Didn't manage to dig anything useful myself yet.
Update
I know roughly what are swd files used in Flash8, and there is even a way to make them, but Flash 9 doesn... | SWD files, which stand for "Small Web Debugger" files, are used primarily in conjunction with Adobe Flash for debugging purposes. Here are some key points to consider regarding SWD files in Flash 9:
### What are SWD files?
- **Debugging Information**: SWD files contain debugging information for Flash applications. The... | 11,084 | [
{
"from": "human",
"value": "Does anybody have any pointers to what SWD files are in Flash 9, why Flash Player wants to download them sometimes, how to make ones, how to make use of them? Didn't manage to dig anything useful myself yet.\nUpdate\nI know roughly what are swd files used in Flash8, and there is... |
I'd like to use regular expressions in selecting elements using the match function. I'd prefer not to use an external library (such as saxon) to do this.
| If you're looking to use regular expressions within an XPath context for selecting elements and you prefer not to rely on external libraries like Saxon, you'll need to keep in mind that standard XPath 1.0 does not support regular expressions directly.
However, if you're using XPath 2.0 or higher, you can utilize the `... | 9,715 | [
{
"from": "human",
"value": "I'd like to use regular expressions in selecting elements using the match function. I'd prefer not to use an external library (such as saxon) to do this. \n"
},
{
"from": "gpt",
"value": "If you're looking to use regular expressions within an XPath context for sele... |
I have two tables I would like to complare. One of the columns is type CLOB. I would like to do something like this:
select key, clob_value source_table
minus
select key, clob_value target_table
Unfortunately, Oracle can't perform minus operations on clobs. How can I do this?
| In Oracle, you cannot directly use the `MINUS` operator with `CLOB` data types. However, you can achieve your goal by converting the `CLOB` data to a datatype that is compatible with `MINUS`, such as `VARCHAR2`. The trick is to limit the length of the `CLOB` to ensure that the data fits within the `VARCHAR2` limits.
... | 5,070 | [
{
"from": "human",
"value": "I have two tables I would like to complare. One of the columns is type CLOB. I would like to do something like this:\nselect key, clob_value source_table\nminus\nselect key, clob_value target_table\n\nUnfortunately, Oracle can't perform minus operations on clobs. How can I do... |
When using a browser to transform XML (Google Chrome or IE7) is it possible to pass a parameter to the XSLT stylesheet through the URL?
example:
data.xml
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="sample.xsl"?>
<root>
<document type="resume">
<author>John Doe</author>
... | In standard web browsers, there is no built-in way to directly pass parameters to an XSLT stylesheet from the URL when transforming XML. The parameters defined in the XSLT using `<xsl:param>` require a specific value to be set before the transformation takes place, and this isn't something that is typically supported v... | 5,381 | [
{
"from": "human",
"value": "When using a browser to transform XML (Google Chrome or IE7) is it possible to pass a parameter to the XSLT stylesheet through the URL?\nexample:\ndata.xml\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<?xml-stylesheet type=\"text/xsl\" href=\"sample.xsl\"?>\n<root>\n <documen... |
I would like to replace only the group in parenthesis in this expression :
my_string.gsub(/<--MARKER_START-->(.)*<--MARKER_END-->/, 'replace_text')
so that I get : <--MARKER_START-->replace_text<--MARKER_END-->
I know I could repeat the whole MARKER_START and MARKER_END blocks in the substitution expression but I thou... | Certainly! To achieve this without repeating the entire pattern, you can use a capturing group in your regular expression. You can capture the content between the markers and then replace it with your desired text. Here's how you can do it:
```ruby
my_string.gsub(/(<--MARKER_START-->)(.*?)(<--MARKER_END-->)/, '\1repla... | 12,723 | [
{
"from": "human",
"value": "I would like to replace only the group in parenthesis in this expression :\nmy_string.gsub(/<--MARKER_START-->(.)*<--MARKER_END-->/, 'replace_text')\n\nso that I get : <--MARKER_START-->replace_text<--MARKER_END-->\nI know I could repeat the whole MARKER_START and MARKER_END blo... |
There's an MSDN article here, but I'm not getting very far:
p = 139;
g = 5;
CRYPT_DATA_BLOB pblob;
pblob.cbData = sizeof( ULONG );
pblob.pbData = ( LPBYTE ) &p;
CRYPT_DATA_BLOB gblob;
gblob.cbData = sizeof( ULONG );
gblob.pbData = ( LPBYTE ) &g;
HCRYPTKEY hKey;
if ( ::CryptGenKey( m_hCryptoProvider, CALG_DH_SF,
... | The issue you're facing with the `NTE_BAD_DATA` error in the `CryptSetKeyParam` function is likely due to the format of the parameters that you're providing for the Diffie-Hellman (DH) key exchange.
When using the `CryptSetKeyParam` function to set the parameters for a Diffie-Hellman key, the data blob for `KP_P` (wh... | 10,157 | [
{
"from": "human",
"value": "There's an MSDN article here, but I'm not getting very far:\np = 139;\ng = 5;\n\nCRYPT_DATA_BLOB pblob;\npblob.cbData = sizeof( ULONG );\npblob.pbData = ( LPBYTE ) &p;\n\nCRYPT_DATA_BLOB gblob;\ngblob.cbData = sizeof( ULONG );\ngblob.pbData = ( LPBYTE ) &g;\n\nHCRYPTKEY hKey;\ni... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.