instruction stringlengths 14 27.6k | completion stringlengths 3 38.3k | __original_row_idx int64 0 50k | conversations listlengths 2 2 |
|---|---|---|---|
My little site should be pooling list of items from a table using the active user's location as a filter. Think Craigslist, where you search for "dvd' but the results are not from all the DB, they are filtered by a location you select. My question has 2 levels:
should I go a-la-craigslist, and ask users to use a city ... | You're tackling a common issue that many online marketplaces face when implementing location-based filtering. Both options you've considered—city-level and ZIP code-level—have their pros and cons. Let's break them down further.
### City-Level Location
**Pros:**
- Easier to implement, as you could use existing city da... | 4,333 | [
{
"from": "human",
"value": "My little site should be pooling list of items from a table using the active user's location as a filter. Think Craigslist, where you search for \"dvd' but the results are not from all the DB, they are filtered by a location you select. My question has 2 levels:\n\nshould I go a... |
I have to restore a database that has been inadvertently DROPped in MySQL 5.0. From checking the backup files, I only seem to have .FRM files to hold the database data.
Can anyone advise whether this is all I need to perform a database restore/import from the backup, or are there other files I should have to hand to c... | To restore a MySQL database that has been inadvertently dropped and only has the `.FRM` files available, it's important to understand the roles of the different files used by MySQL.
1. **.FRM Files**: These files store the table structure (schema) for MySQL tables, but do not contain the actual data if you're using a ... | 9,166 | [
{
"from": "human",
"value": "I have to restore a database that has been inadvertently DROPped in MySQL 5.0. From checking the backup files, I only seem to have .FRM files to hold the database data.\nCan anyone advise whether this is all I need to perform a database restore/import from the backup, or are th... |
How do I capture the event of the clicking the Selected Node of a TreeView?
It doesn't fire the SelectedNodeChanged since the selection has obviously not changed but then what event can I catch so I know that the Selected Node was clicked?
UPDATE:
When I have some time, I'm going to have to dive into the bowels of the ... | To capture the event of clicking the selected node in a TreeView control in Windows Forms, you can subclass the TreeView and override the `OnMouseDown` or `OnMouseClick` event to check if the clicked node is the currently selected one. Here's how you can do this:
1. **Create a Custom TreeView Control:**
You can cre... | 7,365 | [
{
"from": "human",
"value": "How do I capture the event of the clicking the Selected Node of a TreeView?\nIt doesn't fire the SelectedNodeChanged since the selection has obviously not changed but then what event can I catch so I know that the Selected Node was clicked?\nUPDATE:\nWhen I have some time, I'm g... |
If you are sending work/progress reports to the project lead on a daily or weekly basis, I wondered if you would consider using Twitter or similar services for these updates.
Say if you're working remotely or with a distributed team and the project lead has a hard time getting an overview about the topics people are wo... | Using a platform like Twitter or similar services for progress updates in a remote or distributed team can be a practical solution, but it also depends on various factors such as team culture, privacy considerations, and the nature of the work being done.
**Pros of Using Twitter or Similar Services:**
1. **Real-time U... | 12,543 | [
{
"from": "human",
"value": "If you are sending work/progress reports to the project lead on a daily or weekly basis, I wondered if you would consider using Twitter or similar services for these updates.\nSay if you're working remotely or with a distributed team and the project lead has a hard time getting ... |
In follow up to this question, it appears that some numbers cannot be represented by floating point at all, and instead are approximated.
How are floating point numbers stored?
Is there a common standard for the different sizes?
What kind of gotchas do I need to watch out for if I use floating point?
Are they cross-lan... | Floating point numbers are stored in a way that allows for a wide range of values to be represented using a finite number of binary digits (bits). Here's a detailed explanation of how they are stored, along with common standards, potential pitfalls, and cross-language compatibility considerations:
### How Floating Poi... | 5,823 | [
{
"from": "human",
"value": "In follow up to this question, it appears that some numbers cannot be represented by floating point at all, and instead are approximated.\nHow are floating point numbers stored?\nIs there a common standard for the different sizes?\nWhat kind of gotchas do I need to watch out for... |
Just recently started having issues with an SQL Server Agent Job that contains an SSIS package to extract production data and summarize it into a separate reporting database.
I think that some of the Alerts/Notifications settings I tried playing with caused the problem as the job had been running to completion unatten... | SQL Server Agent Jobs and their associated alerts and notifications can be a little tricky to set up, especially if you're new to it. Here's a step-by-step guide to help you configure alerts and notifications for your SQL Server Agent Jobs.
### Step 1: Configure Operators
1. **Create an Operator**:
- In SQL Server... | 5,276 | [
{
"from": "human",
"value": "Just recently started having issues with an SQL Server Agent Job that contains an SSIS package to extract production data and summarize it into a separate reporting database. \nI think that some of the Alerts/Notifications settings I tried playing with caused the problem as the ... |
I'd like know what people think about using RAISERROR in stored procedures to pass back user messages (i.e. business related messages, not error messages) to the application.
Some of the senior developers in my firm have been using this method and catching the SqlException in our C# code to pick up the messages and d... | Using `RAISERROR` in stored procedures to pass back business-related messages (as opposed to actual error messages) is a technique that can be effective in certain scenarios, but it does come with several caveats that make it less than ideal for many developers. Here are some key points to consider regarding this appro... | 7,030 | [
{
"from": "human",
"value": "I'd like know what people think about using RAISERROR in stored procedures to pass back user messages (i.e. business related messages, not error messages) to the application. \nSome of the senior developers in my firm have been using this method and catching the SqlException in... |
I keep hearing that Lisp is a really productive language, and I'm enjoying SICP. Still, I'm missing something useful that would let me replace PHP for server-side database interaction in web applications.
Is there something like PHP's PDO library for Lisp or Arc or Scheme or one of the dialects?
| Yes, there are several libraries and frameworks in various Lisp dialects that can help you interact with databases in a way similar to PHP's PDO (PHP Data Objects). Below are a few options based on the Lisp dialects you mentioned:
### Common Lisp
1. **CL-ORM (Common Lisp Object-Relational Mapper)**:
- **cffi-sqlit... | 11,887 | [
{
"from": "human",
"value": "I keep hearing that Lisp is a really productive language, and I'm enjoying SICP. Still, I'm missing something useful that would let me replace PHP for server-side database interaction in web applications.\nIs there something like PHP's PDO library for Lisp or Arc or Scheme or o... |
I am trying to build gdb for armv6 architecture. I will be compiling this package on a Fedora Linux-Intel x86 box. I read the process of installing the gdb, like
Download the source pachage
run configure -host
make
But I got lost in the process because I was not able to make out what will be the host, target, needed ... | To build GDB for the ARMv6 architecture on an Intel x86 machine running Fedora, you need to understand the concepts of "host," "target," and "build." Here's a brief explanation of these terms:
- **Host**: The architecture on which you are compiling GDB (your current machine).
- **Target**: The architecture for which y... | 8,009 | [
{
"from": "human",
"value": "I am trying to build gdb for armv6 architecture. I will be compiling this package on a Fedora Linux-Intel x86 box. I read the process of installing the gdb, like\n\nDownload the source pachage\nrun configure -host\nmake\n\nBut I got lost in the process because I was not able to ... |
We have a vxWorks application that we would like to deploy either as a kernel module, or as a Real-Time process.
Is there a way to do this from the same source file, or do we have to create one file for the kernel module and another for the RTP?
| In VxWorks, the way you structure your code will largely depend on how you intend to deploy it—either as a kernel module or as a Real-Time Process (RTP). Generally, the architectures for kernel modules and RTPs are different enough that you typically need to make some adjustments to your source code when targeting both... | 11,858 | [
{
"from": "human",
"value": "We have a vxWorks application that we would like to deploy either as a kernel module, or as a Real-Time process.\nIs there a way to do this from the same source file, or do we have to create one file for the kernel module and another for the RTP?\n"
},
{
"from": "gpt",
... |
This one has me stumped regularly while creating top level class diagrams for documentation. Methods and attributes/fields are easy to model.
I usually end up adding a method named EvChanged to indicate a .Net event Changed.
What is the right way to show that a type publishes a specific event?
| In UML (Unified Modeling Language), there are several ways to represent events, particularly when you are documenting classes that publish events. Since events in .NET are essentially a part of the observer pattern, they can be modeled using a combination of UML constructs. Here are a few approaches you can consider:
... | 11,317 | [
{
"from": "human",
"value": "This one has me stumped regularly while creating top level class diagrams for documentation. Methods and attributes/fields are easy to model. \nI usually end up adding a method named EvChanged to indicate a .Net event Changed.\nWhat is the right way to show that a type publishes... |
Here is a snippet of CSS that I need explained:
#section {
width: 860px;
background: url(/blah.png);
position: absolute;
top: 0;
left: 50%;
margin-left: -445px;
}
Ok so it's absolute positioning of an image, obviously.
top is like padding from the top, right?
what does left 50% do?
why is the ... | Sure! Let's break down the CSS rules you've provided and explain how each property works:
1. **`width: 860px;`**: This sets the width of the `#section` element to 860 pixels. The `width` property defines how wide the element will be.
2. **`background: url(/blah.png);`**: This sets the background image of the `#sectio... | 10,248 | [
{
"from": "human",
"value": "Here is a snippet of CSS that I need explained:\n#section {\n width: 860px;\n background: url(/blah.png);\n position: absolute;\n top: 0;\n left: 50%;\n margin-left: -445px;\n}\n\nOk so it's absolute positioning of an image, obviously.\n\ntop is like padding fr... |
When retrieving a lookup code value from a table, some folks do this...
Dim dtLookupCode As New LookupCodeDataTable()
Dim taLookupCode AS New LookupCodeTableAdapter()
Dim strDescription As String
dtLookupCode = taLookupCode.GetDataByCodeAndValue("EmpStatus", "FULL")
strDescription = dtLookupCode.Item(0).Meaning
...ho... | In the context you're describing, using the "chained" method does indeed save on the overhead of creating an explicit `LookupCodeDataTable` object. However, there are a few important nuances to consider:
1. **Underlying Implementation**: When you use the table adapter's `GetDataByCodeAndValue` method directly in a cha... | 11,575 | [
{
"from": "human",
"value": "When retrieving a lookup code value from a table, some folks do this...\nDim dtLookupCode As New LookupCodeDataTable()\nDim taLookupCode AS New LookupCodeTableAdapter()\nDim strDescription As String\n\ndtLookupCode = taLookupCode.GetDataByCodeAndValue(\"EmpStatus\", \"FULL\")\ns... |
In WPF you can setup validation based on errors thrown in your Data Layer during Data Binding using the ExceptionValidationRule or DataErrorValidationRule.
Suppose you had a bunch of controls set up this way and you had a Save button. When the user clicks the Save button, you need to make sure there are no validation ... | In WPF, you can determine if there are any validation errors in your data-bound controls by checking the `Validation.GetErrors` method. This method retrieves a collection of validation errors for a specified element. If the collection is empty, it indicates that there are no validation errors.
Here’s a general approac... | 10,463 | [
{
"from": "human",
"value": "In WPF you can setup validation based on errors thrown in your Data Layer during Data Binding using the ExceptionValidationRule or DataErrorValidationRule.\nSuppose you had a bunch of controls set up this way and you had a Save button. When the user clicks the Save button, you ... |
What factors determine which approach is more appropriate?
| The appropriateness of a particular approach in any given context can depend on a variety of factors. Here are some key considerations:
1. **Objective or Goal**:
- What is the desired outcome? Different goals may require different methodologies or approaches.
2. **Context**:
- The specific situation, environmen... | 11,621 | [
{
"from": "human",
"value": "What factors determine which approach is more appropriate?\n"
},
{
"from": "gpt",
"value": "The appropriateness of a particular approach in any given context can depend on a variety of factors. Here are some key considerations:\n\n1. **Objective or Goal**:\n - What... |
I read everywhere that business logic belongs in the models and not in controller but where is the limit?
I am toying with a personnal accounting application.
Account
Entry
Operation
When creating an operation it is only valid if the corresponding entries are created and linked to accounts so that the operation is ba... | You've raised an interesting question about where to place the business logic in your application, particularly in the context of an accounting application where operations have specific validation and relationship requirements with entries.
### Separation of Concerns
The principle of separation of concerns indeed su... | 6,329 | [
{
"from": "human",
"value": "I read everywhere that business logic belongs in the models and not in controller but where is the limit?\nI am toying with a personnal accounting application. \nAccount\nEntry\nOperation\n\nWhen creating an operation it is only valid if the corresponding entries are created and... |
I'm trying to create a horizontal 100% stacked bar graph using HTML and CSS. I'd like to create the bars using DIVs with background colors and percentage widths depending on the values I want to graph. I also want to have a grid lines to mark an arbitrary position along the graph.
In my experimentation, I've already go... | Creating a horizontal 100% stacked bar graph using HTML and CSS without using float can be accomplished using Flexbox or CSS Grid. Both of these methods will provide a cleaner and more manageable layout compared to using floats. I'll illustrate a simple solution using Flexbox.
Here's how you can create a horizontal 10... | 8,417 | [
{
"from": "human",
"value": "I'm trying to create a horizontal 100% stacked bar graph using HTML and CSS. I'd like to create the bars using DIVs with background colors and percentage widths depending on the values I want to graph. I also want to have a grid lines to mark an arbitrary position along the grap... |
I'm looking to grab cookie values for the same domain within a Flash movie. Is this possible?
Let's see I let a user set a variable foo and I store it using any web programming language. I can access it easily via that language, but I would like to access it via the Flash movie without passing it in via printing it w... | Accessing cookies directly from a Flash movie can be a bit complex due to the security restrictions of Flash Player. However, it is possible to retrieve cookie values using ActionScript in combination with some server-side scripting or JavaScript.
Here are a few approaches you might consider:
### 1. **Using ExternalI... | 7,784 | [
{
"from": "human",
"value": "I'm looking to grab cookie values for the same domain within a Flash movie. Is this possible?\nLet's see I let a user set a variable foo and I store it using any web programming language. I can access it easily via that language, but I would like to access it via the Flash mov... |
I have an application for Tomcat which needs to offer/consume web services. Since Java web services are a nightmare (xml, code generation, etc.) compared with what is possible in Python, I would like to learn from your experience using jython instead of java for offerring/consuming web services.
What I have done so far... | Using Jython to create and consume web services can indeed simplify the process, especially for those who are more comfortable with Python than Java. However, it can come with its own set of challenges, especially when dealing with XML and SOAP. Here are some tips and considerations to help you with your Jython web ser... | 9,245 | [
{
"from": "human",
"value": "I have an application for Tomcat which needs to offer/consume web services. Since Java web services are a nightmare (xml, code generation, etc.) compared with what is possible in Python, I would like to learn from your experience using jython instead of java for offerring/consum... |
What are the major reasons for using WinDbg vs the Visual Studio debugger?
And is it commonly used as a complete replacement for the Visual Studio debugger, or more for when the need arises.
| WinDbg and the Visual Studio debugger both serve the purpose of debugging applications, but they cater to different use cases and user needs. Here are some major reasons for using WinDbg versus the Visual Studio debugger:
### Major Reasons for Using WinDbg:
1. **Advanced Debugging Capabilities:**
- WinDbg offers m... | 9,587 | [
{
"from": "human",
"value": "What are the major reasons for using WinDbg vs the Visual Studio debugger?\nAnd is it commonly used as a complete replacement for the Visual Studio debugger, or more for when the need arises.\n"
},
{
"from": "gpt",
"value": "WinDbg and the Visual Studio debugger both... |
Is there any way to down-format a Subversion repository to avoid messages like this:
svn: Expected format '3' of repository; found format '5'
This happens when you access repositories from more than one machine, and you aren't able to use a consistent version of Subversion across all of those machines.
Worse still,... | Yes, it is possible to "down-format" a Subversion (SVN) repository to a lower format to avoid version-related issues when accessing repositories across different versions of SVN. However, this process involves creating a new repository and dumping the data from the original repository, then loading it into the new repo... | 11,307 | [
{
"from": "human",
"value": "Is there any way to down-format a Subversion repository to avoid messages like this:\n\nsvn: Expected format '3' of repository; found format '5'\n\nThis happens when you access repositories from more than one machine, and you aren't able to use a consistent version of Subversion... |
I am trying to implement a request to an unreliable server. The request is a nice to have, but not 100% required for my perl script to successfully complete. The problem is that the server will occasionally deadlock (we're trying to figure out why) and the request will never succeed. Since the server thinks it is li... | Your approach to implement a request to an unreliable server with an enforced absolute timeout using signals is quite robust. Below, I’ll provide a brief summary of the code you presented and explain the key elements of it, as well as offer some additional insights and refinements.
### Summary of Your Implementation
... | 8,338 | [
{
"from": "human",
"value": "I am trying to implement a request to an unreliable server. The request is a nice to have, but not 100% required for my perl script to successfully complete. The problem is that the server will occasionally deadlock (we're trying to figure out why) and the request will never s... |
I am 90% sure I saw this answer on stackoverflow before, in fact I had never seen the "int?" syntax before seeing it here, but no matter how I search I can't find the previous post, and it's driving me crazy.
It's possible that I've been eating the funny mushrooms by accident, but if I'm not, can someone please point o... | It sounds like you're looking for an explanation of the `int?` syntax in C#. The `int?` type is a shorthand way to define a nullable integer. In C#, by default, a variable of type `int` cannot hold a null value; it can only hold valid integer values. However, sometimes you want to represent the absence of a value, whic... | 11,585 | [
{
"from": "human",
"value": "I am 90% sure I saw this answer on stackoverflow before, in fact I had never seen the \"int?\" syntax before seeing it here, but no matter how I search I can't find the previous post, and it's driving me crazy.\nIt's possible that I've been eating the funny mushrooms by accident... |
I have a file temp.txt, that I want to sort with the sort command in bash.
I want the sorted results to replace the original file.
This doesn't work for example (I get an empty file):
sortx temp.txt > temp.txt
Can this be done in one line without resorting to copying to temporary files?
EDIT: The -o option is very co... | You're right that using a command like `sort temp.txt > temp.txt` leads to an empty file because the shell first creates the output file (`temp.txt`) before the command reads from it.
For the `sort` command specifically, you can indeed use the `-o` option, which allows you to specify an output file. This is the prefe... | 11,884 | [
{
"from": "human",
"value": "I have a file temp.txt, that I want to sort with the sort command in bash.\nI want the sorted results to replace the original file.\nThis doesn't work for example (I get an empty file):\nsortx temp.txt > temp.txt\n\nCan this be done in one line without resorting to copying to te... |
I have a strange problem on a PeopleSoft application. It appears that integration broker messages are being processed out of order. There is another possibility, and that is that the commit is being fired asynchronously, allowing the transactions to complete out of order.
There are many inserts of detail records, f... | It sounds like you're dealing with a challenging and sporadic issue in your PeopleSoft application related to the integration broker and the order of processing messages. Here are some suggestions and possible workarounds you could explore:
1. **Message Sequencing**: Ensure that the message sequencing is maintained. I... | 10,018 | [
{
"from": "human",
"value": "I have a strange problem on a PeopleSoft application. It appears that integration broker messages are being processed out of order. There is another possibility, and that is that the commit is being fired asynchronously, allowing the transactions to complete out of order.\nT... |
On some systems it is UTF-8, on others latin-1. How do you set this? Is it something in php.ini?
(I know you can set the encoding/charset for a given page by setting HTTP headers, but this is not what I am looking for.)
Alex
| To set the default character encoding in PHP, you have a couple of options. One way is to configure it in your `php.ini` file, while another option is to use PHP functions in your scripts.
### 1. Setting Character Encoding in `php.ini`
You can set the default character encoding in the `php.ini` file by modifying the ... | 10,646 | [
{
"from": "human",
"value": "On some systems it is UTF-8, on others latin-1. How do you set this? Is it something in php.ini?\n(I know you can set the encoding/charset for a given page by setting HTTP headers, but this is not what I am looking for.)\nAlex\n"
},
{
"from": "gpt",
"value": "To set ... |
How do I exit a script early, like the die() command in PHP?
| In various programming languages, there are different ways to exit a script early similar to PHP's `die()` command, which stops execution and optionally outputs a message. Here are several ways to achieve this in some common programming languages:
### PHP
In PHP, you can use `die()` or `exit()`:
```php
die("Exiting th... | 10,236 | [
{
"from": "human",
"value": "How do I exit a script early, like the die() command in PHP?\n"
},
{
"from": "gpt",
"value": "In various programming languages, there are different ways to exit a script early similar to PHP's `die()` command, which stops execution and optionally outputs a message. H... |
Say I have the following class
MyComponent : IMyComponent {
public MyComponent(int start_at) {...}
}
I can register an instance of it with castle windsor via xml as follows
<component id="sample" service="NS.IMyComponent, WindsorSample" type="NS.MyComponent, WindsorSample">
<parameters>
<start_at>1</start... | To register an instance of `MyComponent` with Castle Windsor using code instead of XML, you'll want to make use of the `IWindsorContainer` interface. You can use the `Register` method to register your component, along with its constructor parameters.
Here's how you can achieve this in code:
```csharp
using Castle.Mic... | 6,525 | [
{
"from": "human",
"value": "Say I have the following class\nMyComponent : IMyComponent {\n public MyComponent(int start_at) {...}\n}\n\nI can register an instance of it with castle windsor via xml as follows\n<component id=\"sample\" service=\"NS.IMyComponent, WindsorSample\" type=\"NS.MyComponent, Winds... |
I find myself drawn to the Parsing Expression Grammar formalism for describing domain specific languages, but so far the implementation code I've found has been written in languages like Java and Haskell that aren't web server friendly in the shared hosting environment that my organization has to live with.
Does anyone... | Parsing Expression Grammars (PEG) can indeed be a great choice for creating domain-specific languages, and it's understandable that you would prefer implementations that work in a web hosting environment. Below are some libraries and tools in JavaScript and PHP that you can explore:
### JavaScript
1. **PEG.js**:
-... | 8,600 | [
{
"from": "human",
"value": "I find myself drawn to the Parsing Expression Grammar formalism for describing domain specific languages, but so far the implementation code I've found has been written in languages like Java and Haskell that aren't web server friendly in the shared hosting environment that my o... |
I'm using the Apache CXF Web Services stack. When a client times out or disconnects from the server before the operation is complete, the server keeps running the operation until it is complete. I would like to have the server detect when the client disconnects and handle that accordingly.
Is there a way to detect when... | Detecting client disconnections during a web service operation can be a challenging issue, especially in a request/response model where the server typically processes the entire request before sending a response back to the client. However, there are a few approaches you can take with Apache CXF and other Java web serv... | 7,426 | [
{
"from": "human",
"value": "I'm using the Apache CXF Web Services stack. When a client times out or disconnects from the server before the operation is complete, the server keeps running the operation until it is complete. I would like to have the server detect when the client disconnects and handle that a... |
I've been coding alot of web-stuff all my life, rails lately. And i can always find a website to code, but i'm kind of bored with it. Been taking alot of courses of Java and C lately so i've become a bit interested in desktop application programming.
Problem: I can't for the life of me think of a thing to code for desk... | It's great that you're looking to expand your programming skills into desktop applications! Finding a unique project can be challenging, but here are some suggestions that might inspire you:
### 1. Personal Finance Tracker
Create an application that helps users track their income, expenses, and savings goals. Incorpor... | 7,429 | [
{
"from": "human",
"value": "I've been coding alot of web-stuff all my life, rails lately. And i can always find a website to code, but i'm kind of bored with it. Been taking alot of courses of Java and C lately so i've become a bit interested in desktop application programming.\nProblem: I can't for the li... |
Has anyone used ruby in 64-bit environments in various platforms (HP=UX, Solaris, AIX etc.) in a commercial production environment that heavily relies on database.
Have you faced any issues / bugs during these times?
I know that overall things look ok. Compilation, deployment etc.
I would like to know if you encountere... | Ruby can indeed be used in 64-bit environments across various platforms like HP-UX, Solaris, and AIX in commercial production environments, especially when heavily relying on databases. However, while many users report that Ruby works well in these environments, there are several potential "gotchas" and challenges you ... | 8,221 | [
{
"from": "human",
"value": "Has anyone used ruby in 64-bit environments in various platforms (HP=UX, Solaris, AIX etc.) in a commercial production environment that heavily relies on database.\nHave you faced any issues / bugs during these times?\nI know that overall things look ok. Compilation, deployment ... |
Under VS's external tools settings there is a "Use Output Window" check box that captures the tools command line output and dumps it to a VS tab.
The question is: can I get the same processing for my program when I hit F5?
Edit: FWIW I'm in C# but if that makes a difference to your answer then it's unlikely that your a... | In Visual Studio, when you run a C# program by pressing F5, the output is typically directed to the console window (if it's a console application). However, if you want the output to appear in the Visual Studio Output window instead, there isn't a direct way to accomplish this through standard console output redirectio... | 12,044 | [
{
"from": "human",
"value": "Under VS's external tools settings there is a \"Use Output Window\" check box that captures the tools command line output and dumps it to a VS tab.\nThe question is: can I get the same processing for my program when I hit F5?\nEdit: FWIW I'm in C# but if that makes a difference ... |
Right now I have a database (about 2-3 GB) in PostgreSQL, which serves as a data storage to RoR/Python LAMP-like application.
What kind tools are there that are simple and robust enough for replication of the main database to a second machine?
I looked through some packages (Slony-I and etc.) but it would be great to h... | When it comes to replicating a PostgreSQL database, there are several tools and methods available, each with its strengths and considerations. Since you're looking for simplicity and robustness for a database of 2-3 GB, here are some options that you can consider:
### 1. **Streaming Replication**
PostgreSQL's built-in... | 6,499 | [
{
"from": "human",
"value": "Right now I have a database (about 2-3 GB) in PostgreSQL, which serves as a data storage to RoR/Python LAMP-like application.\nWhat kind tools are there that are simple and robust enough for replication of the main database to a second machine?\nI looked through some packages (S... |
Should I expose a strongly typed dataset from a webservice and bind it directly in a client? or are there more sensible ways for asmx web services? I am doing CRUD operations (Create, Read, Update, Delete).
I find working with datasets to be frustrating and difficult to work with when for example when inserting into a... | Using strongly typed datasets as the means of communication between your web service and client can sometimes lead to unnecessary complexity and can become cumbersome, particularly for CRUD operations. Here are some considerations and alternative approaches that you may find more effective:
### 1. Use Objects (DTOs)
I... | 10,210 | [
{
"from": "human",
"value": "Should I expose a strongly typed dataset from a webservice and bind it directly in a client? or are there more sensible ways for asmx web services? I am doing CRUD operations (Create, Read, Update, Delete). \nI find working with datasets to be frustrating and difficult to work w... |
What's the best way to calculate percentile rankings (e.g. the 90th percentile or the median score) in MSSQL 2005?
I'd like to be able to select the 25th, median, and 75th percentiles for a single column of scores (preferably in a single record so I can combine with average, max, and min). So for example, table output... | In SQL Server 2005, calculating percentiles requires a bit of work since it does not have built-in functions for percentile calculations like later versions do. However, you can use the following method to achieve your goal of obtaining the 25th, median (50th), and 75th percentiles along with the minimum, maximum, and ... | 8,765 | [
{
"from": "human",
"value": "What's the best way to calculate percentile rankings (e.g. the 90th percentile or the median score) in MSSQL 2005?\nI'd like to be able to select the 25th, median, and 75th percentiles for a single column of scores (preferably in a single record so I can combine with average, ma... |
I am trying to build an Eclipse application that would work with a linux/motif installation target. However, this seems not to be possible even though the export option is available in the product export wizard.
I've checked the content of the delta pack and indeed, the packages for linux/motif are missing. After che... | Building an Eclipse RCP application targeting Linux/Motif can be quite challenging due to the limited support for that platform and the absence of a proper delta pack. Here are some steps and considerations that might help you in your endeavor:
1. **Testing Version**: As you've noted, the Linux/Motif version of Eclips... | 10,036 | [
{
"from": "human",
"value": "I am trying to build an Eclipse application that would work with a linux/motif installation target. However, this seems not to be possible even though the export option is available in the product export wizard.\nI've checked the content of the delta pack and indeed, the packag... |
I have set up a repository using SVN and uploaded projects. There are multiple users working on these projects. But, not everyone requires access to all projects. I want to set up user permissions for each project.
How can I achieve this?
| Setting up user permissions in an SVN (Subversion) repository allows you to control access to different projects based on user roles and responsibilities. Here are the steps to set up user permissions for each project in your SVN repository:
### Step 1: Create a SVN Auth File
1. **Locate the `svnserve.conf` File**: F... | 6,302 | [
{
"from": "human",
"value": "I have set up a repository using SVN and uploaded projects. There are multiple users working on these projects. But, not everyone requires access to all projects. I want to set up user permissions for each project.\nHow can I achieve this?\n"
},
{
"from": "gpt",
"val... |
I need to put a control to the right of my MenuStrip. The MenuStrip fades in colour away from the BackColor on the left hand side to something whiter on the right, and ideally I would like to make my small control blend in by having the same backColor as the menustrip has on that side. Does anyone know how that colour ... | To match the color of the MenuStrip as it fades from its `BackColor` to a lighter color, you'll need to calculate the interpolated color based on the width of the MenuStrip. The color transition often involves blending the original `BackColor` of the MenuStrip with a lighter color.
Here's a way to compute the interpol... | 11,186 | [
{
"from": "human",
"value": "I need to put a control to the right of my MenuStrip. The MenuStrip fades in colour away from the BackColor on the left hand side to something whiter on the right, and ideally I would like to make my small control blend in by having the same backColor as the menustrip has on tha... |
So, I want to define a singleton method for an object, but I want to do it using a closure.
For example,
def define_say(obj, msg)
def obj.say
puts msg
end
end
o = Object.new
define_say o, "hello world!"
o.say
This doesn't work because defining a singleton method via "def" is not a closure, so I get an excepti... | You can achieve this cleanly using `define_singleton_method` along with a block that captures the variable `msg` in a closure. The block will have access to any variables in its surrounding context, which allows you to define the singleton method with the captured value of `msg`.
Here's how you can implement it:
```r... | 13,880 | [
{
"from": "human",
"value": "So, I want to define a singleton method for an object, but I want to do it using a closure.\nFor example,\ndef define_say(obj, msg)\n def obj.say\n puts msg\n end\nend\n\no = Object.new\ndefine_say o, \"hello world!\"\no.say\n\nThis doesn't work because defining a singleton... |
When using PyWin I can easily load a python file into a fresh interactive shell and I find this quite handy for prototyping and other exploratory tasks.
I would like to use Komodo as my python editor, but I haven't found a replacement for PyWin's ability to restart the shell and reload the current module. How can I d... | To achieve a fresh interactive Python shell with the ability to load your current module in Komodo, you can follow these steps:
### Steps to Set Up a Fresh Python Shell in Komodo
1. **Open the Python Shell**:
- Start by opening the Python shell in Komodo. You can do this by going to `Tools` > `Python Shell`. This ... | 9,873 | [
{
"from": "human",
"value": "When using PyWin I can easily load a python file into a fresh interactive shell and I find this quite handy for prototyping and other exploratory tasks.\nI would like to use Komodo as my python editor, but I haven't found a replacement for PyWin's ability to restart the shell an... |
I've got a git-svn clone of an svn repo, and I want to encourage my colleagues to look at git as an option. The problem is that cloning the repo out of svn takes 3 days, but cloning from my git instance takes 10 minutes.
I've got a script that will allow people to clone my git repo and re-point it at the original SVN, ... | To facilitate the process of sharing your git-svn clone with your colleagues and allowing them to easily re-point it at the original SVN repository, you can create a custom script that retrieves the necessary configuration values from your existing git-svn repository. You can achieve this by creating a simple HTTP endp... | 10,949 | [
{
"from": "human",
"value": "I've got a git-svn clone of an svn repo, and I want to encourage my colleagues to look at git as an option. The problem is that cloning the repo out of svn takes 3 days, but cloning from my git instance takes 10 minutes.\nI've got a script that will allow people to clone my git ... |
I'm trying to write a small class library for a C++ course.
I was wondering if it was possible to define a set of classes in my shared object and then using them directly in my main program that demos the library. Are there any tricks involved? I remember reading this long ago (before I started really programming) that... | Yes, you can definitely define a set of C++ classes in a shared library (typically a dynamic link library, or DLL in Windows, or a shared object, or SO, in Unix-like systems) and use them in your main program. Here are some considerations and best practices to ensure that this works smoothly.
### Steps to Create a Sha... | 9,687 | [
{
"from": "human",
"value": "I'm trying to write a small class library for a C++ course.\nI was wondering if it was possible to define a set of classes in my shared object and then using them directly in my main program that demos the library. Are there any tricks involved? I remember reading this long ago ... |
I have a setup executable that I need to install. When I run it, it launches a msi to do the actual install and then dies immediately. The side effect of this is it will return control back to any console you call it from before the install finishes. Depending on what machine I run it on, it can take from three to ten ... | Yes, you can determine the PID of a process started by another process in a Windows environment, including an MSI installation initiated by a setup executable. The Windows Management Instrumentation (WMI) can be used to monitor the processes, but the basic challenge here is identifying the correct MSI process initiated... | 6,817 | [
{
"from": "human",
"value": "I have a setup executable that I need to install. When I run it, it launches a msi to do the actual install and then dies immediately. The side effect of this is it will return control back to any console you call it from before the install finishes. Depending on what machine I ... |
I have a large GUI project that I'd like to port to Linux.
What is the most recommended framework to utilize for GUI programming in Linux? Are Frameworks such as KDE / Gnome usable for this objective Or is better to use something more generic other than X?
I feel like if I chose one of Gnome or KDE, I'm closing the ma... | When porting a large GUI project to Linux, it's essential to choose a framework that not only provides a good user experience but also addresses the concerns about compatibility across different desktop environments like GNOME and KDE. Here are some options to consider:
### 1. **Qt (with Qt Widgets or Qt Quick)**
- *... | 7,536 | [
{
"from": "human",
"value": "I have a large GUI project that I'd like to port to Linux.\nWhat is the most recommended framework to utilize for GUI programming in Linux? Are Frameworks such as KDE / Gnome usable for this objective Or is better to use something more generic other than X?\nI feel like if I ch... |
I have a text file on my local machine that is generated by a daily Python script run in cron.
I would like to add a bit of code to have that file sent securely to my server over SSH.
| To securely send a file from your local machine to your server over SSH, you can use `scp` (Secure Copy Protocol) or `rsync` in your Python script. Below are the steps and a sample code snippet you can incorporate into your existing Python script.
### Steps
1. **Ensure SSH Access**: Make sure you have SSH access to y... | 8,465 | [
{
"from": "human",
"value": "I have a text file on my local machine that is generated by a daily Python script run in cron. \nI would like to add a bit of code to have that file sent securely to my server over SSH.\n"
},
{
"from": "gpt",
"value": "To securely send a file from your local machine ... |
Why do we need an init() method in servlet? Can't we use the constructor to initialization?
| In Java Servlets, the `init()` method serves a crucial role in the lifecycle of a servlet and is specifically designed for initialization purposes. While it might seem that constructors could be used for this purpose, there are several important reasons for using the `init()` method instead. Here are a few key points:
... | 11,564 | [
{
"from": "human",
"value": "Why do we need an init() method in servlet? Can't we use the constructor to initialization?\n"
},
{
"from": "gpt",
"value": "In Java Servlets, the `init()` method serves a crucial role in the lifecycle of a servlet and is specifically designed for initialization purp... |
I'm looking for a variation on the #save method that will only save
attributes that do not have errors attached to them.
So a model can be updated without being valid overall, and this will
still prevent saving invalid data to the database.
By "valid attributes", I mean those attributes that give nil when calling @m... | To implement a `save_valid_attributes` method that only saves valid attributes while allowing for partial updates on a model instance, you can take advantage of the `errors` hash to identify which attributes are valid. You already have a method for assigning a nicely formatted date, and you can modify your approach sli... | 9,456 | [
{
"from": "human",
"value": "I'm looking for a variation on the #save method that will only save \nattributes that do not have errors attached to them. \nSo a model can be updated without being valid overall, and this will \nstill prevent saving invalid data to the database.\nBy \"valid attributes\", I mean... |
I need to host a WCF service in IIS that exposes a wsHttpBinding. That part is working nicely using the settings of system.serviceModel in my web.config.
What i need now is to setup the configuration (like maxReceivedMessageSize and other options) through a configuration assembly that is also used by the client(s).
How... | You are correct that when hosting a WCF service in IIS, the configuration is typically specified in the `web.config` file, and you don't have the same level of control as you do when hosting a WCF service in a Windows service where you manually create instances of clients and channels.
In an IIS-hosted WCF service, t... | 10,353 | [
{
"from": "human",
"value": "I need to host a WCF service in IIS that exposes a wsHttpBinding. That part is working nicely using the settings of system.serviceModel in my web.config.\nWhat i need now is to setup the configuration (like maxReceivedMessageSize and other options) through a configuration assemb... |
What books or online resource would you recommend for learning how to do advanced charts and dashboard design with Reporting Services?
| For learning advanced charting and dashboard design using SQL Server Reporting Services (SSRS), there are several books and online resources that can help you get started and deepen your understanding. Here are some recommendations:
### Books:
1. **"SQL Server Reporting Services Recipes" by Dusan Petkovic**
- This... | 10,471 | [
{
"from": "human",
"value": "What books or online resource would you recommend for learning how to do advanced charts and dashboard design with Reporting Services? \n"
},
{
"from": "gpt",
"value": "For learning advanced charting and dashboard design using SQL Server Reporting Services (SSRS), th... |
The exact error is as follows
Could not load file or assembly 'Microsoft.SqlServer.Replication,
Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91'
or one of its dependencies. An attempt was made to load a program with
an incorrect format.
I've recently started working on this project again aft... | The error message you're encountering suggests that there is an issue with loading the `Microsoft.SqlServer.Replication` assembly, specifically due to the architecture of the application (32-bit vs. 64-bit) or potentially an issue with the installed version of SQL Server or its components. Here are some steps you can t... | 6,829 | [
{
"from": "human",
"value": "The exact error is as follows\n\nCould not load file or assembly 'Microsoft.SqlServer.Replication,\n Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91'\n or one of its dependencies. An attempt was made to load a program with\n an incorrect format.\n\nI've re... |
We are building a training website where we need to track viewers watching videos and store detailed info about the viewing (when they paused, if they watched the whole video etc)
What should we consider when deciding between the two technologies?
I forgot to add. This is for an in house app. We have complete control o... | When deciding between two technologies for tracking video viewers in an in-house application, you’ll want to consider several technical factors, especially since you have full control over the environment. Here’s a breakdown of key considerations that could help you in making the choice:
### 1. **Performance and Resou... | 8,998 | [
{
"from": "human",
"value": "We are building a training website where we need to track viewers watching videos and store detailed info about the viewing (when they paused, if they watched the whole video etc)\nWhat should we consider when deciding between the two technologies?\nI forgot to add. This is for ... |
How can I iterate over each file in a directory using a for loop?
And how could I tell if a certain entry is a directory or if it's just a file?
| You can iterate over each file in a directory in Python using the `os` module or the `pathlib` module. Below are examples using both methods.
### Using the `os` Module
You can use `os.listdir()` to get a list of entries in the directory and then use `os.path.isfile()` or `os.path.isdir()` to check if the entry is a f... | 11,995 | [
{
"from": "human",
"value": "How can I iterate over each file in a directory using a for loop?\nAnd how could I tell if a certain entry is a directory or if it's just a file?\n"
},
{
"from": "gpt",
"value": "You can iterate over each file in a directory in Python using the `os` module or the `pa... |
How do I do backups in MySQL?
I'm hoping there'll be something better than just running mysqldump every "x" hours.
Is there anything like SQL Server has, where you can take a full backup each day, and then incrementals every hour, so if your DB dies you can restore up to the latest backup?
Something like the DB log, ... | Backing up MySQL databases can indeed be done using `mysqldump`, but there are other more robust options that can provide point-in-time recovery and minimize the impact on performance. Here's a look at some of the methods available:
### 1. **mysqldump**
- **Description**: This is the most common method for creating b... | 7,734 | [
{
"from": "human",
"value": "How do I do backups in MySQL? \nI'm hoping there'll be something better than just running mysqldump every \"x\" hours.\nIs there anything like SQL Server has, where you can take a full backup each day, and then incrementals every hour, so if your DB dies you can restore up to t... |
(Oracle) I have to return all records from last 12 months. How to do that in PL/SQL?
EDIT: Sorry, I forgot to explain, I do have a column of DATA type
| To return all records from the last 12 months in Oracle PL/SQL, you can use a SQL query that filters records based on a date column. Assuming your date column is named `date_column`, here’s how you can do it:
### Example SQL Query
```sql
SELECT *
FROM your_table
WHERE date_column >= ADD_MONTHS(SYSDATE, -12);
```
### ... | 11,194 | [
{
"from": "human",
"value": "(Oracle) I have to return all records from last 12 months. How to do that in PL/SQL?\nEDIT: Sorry, I forgot to explain, I do have a column of DATA type\n"
},
{
"from": "gpt",
"value": "To return all records from the last 12 months in Oracle PL/SQL, you can use a SQL ... |
If I want to manipulate an HTML tag's properties on the server within an aspx page based on a master page i.e.
<a href="#" runat="server" ID="myLink">My Link</a>
For example to give the link a different class depending on the current page i.e.
if (Path.GetFileName(Request.PhysicalPath) == "MyPage")
{
myLink.Attribute... | In ASP.NET Web Forms, when you use `runat="server"` on an HTML element, the ASP.NET server-side runtime changes the element's ID to ensure it is unique across the page. This unique ID is automatically generated to avoid conflicts when rendering multiple instances of the control on a single page.
Unfortunately, there i... | 10,331 | [
{
"from": "human",
"value": "If I want to manipulate an HTML tag's properties on the server within an aspx page based on a master page i.e. \n<a href=\"#\" runat=\"server\" ID=\"myLink\">My Link</a>\n\nFor example to give the link a different class depending on the current page i.e.\nif (Path.GetFileName(Re... |
I have been able to define multiple aspects (one is @Before and another is @Around) using Spring AOP (combined with AspectJ annotations) over a business service class.
Currently they are getting called one by one (in sequence). However I would like to know how the priority of calling the aspects can be defined and wher... | In Spring AOP, aspect precedence (or priority) is determined by the order in which aspects are executed. While Spring AOP itself does not directly provide built-in annotations to specify priority, you can control the order of aspects through the order of bean definitions and by implementing the `Ordered` interface or u... | 10,632 | [
{
"from": "human",
"value": "I have been able to define multiple aspects (one is @Before and another is @Around) using Spring AOP (combined with AspectJ annotations) over a business service class.\nCurrently they are getting called one by one (in sequence). However I would like to know how the priority of c... |
I have a console application that will be kicked off with a scheduler. If for some reason, part of that file is not able to be built I need a GUI front end so we can run it the next day with specific input.
Is there as way pass parameters to the application entry point to start the console application or the GUI appli... | Yes, you can certainly design a system where your application can start either as a console application or a GUI application based on the arguments passed. In this scenario, you would typically have a single entry point that checks for the presence and value of certain command-line arguments to determine how to proceed... | 9,040 | [
{
"from": "human",
"value": "I have a console application that will be kicked off with a scheduler. If for some reason, part of that file is not able to be built I need a GUI front end so we can run it the next day with specific input.\nIs there as way pass parameters to the application entry point to star... |
I'm using .NET 3.5. I have two string arrays, which may share one or more values:
string[] list1 = new string[] { "apple", "orange", "banana" };
string[] list2 = new string[] { "banana", "pear", "grape" };
I'd like a way to merge them into one array with no duplicate values:
{ "apple", "orange", "banana", "pear", "gr... | If you're using .NET 3.5 and want to avoid LINQ for merging two string arrays without duplicates, you can achieve this using a `HashSet`. The `HashSet` data structure is very efficient for this purpose because it automatically handles duplicates for you.
Here's how you can do it:
```csharp
using System;
using System.... | 11,815 | [
{
"from": "human",
"value": "I'm using .NET 3.5. I have two string arrays, which may share one or more values:\nstring[] list1 = new string[] { \"apple\", \"orange\", \"banana\" };\nstring[] list2 = new string[] { \"banana\", \"pear\", \"grape\" };\n\nI'd like a way to merge them into one array with no dup... |
We would like to give access to some of our EJBs from Excel. The goal is to give an API usable from VBA.
Our EJBs are mostly Stateless Session Beans that do simple CRUD operations with POJOs.
Some possible solutions:
Exposing the EJBs as WebServices and create a VB/C# dll wrapping them,
Using Corba to access the EJBs... | Accessing EJBs from Excel using VBA can be approached in various ways, each with its advantages and complexities. Here are some of the solutions you mentioned along with pointers to frameworks and additional ideas:
### 1. Exposing EJBs as Web Services
This is one of the most common approaches for integrating EJBs with... | 10,832 | [
{
"from": "human",
"value": "We would like to give access to some of our EJBs from Excel. The goal is to give an API usable from VBA.\nOur EJBs are mostly Stateless Session Beans that do simple CRUD operations with POJOs.\nSome possible solutions: \n\nExposing the EJBs as WebServices and create a VB/C# dll ... |
Is there a way to emulate the unix cut command on windows XP, without resorting to cygwin or other non-standard windows capabilities?
Example: Use tasklist /v, find the specific task by the window title, then extract the PID from that list to pass to taskkill.
| Yes, you can achieve similar functionality to the Unix `cut` command using built-in Windows command-line tools. In your case, you can use a combination of `tasklist`, `find`, and `for` commands in a Windows batch file or directly in the command prompt to extract the PID from the task list based on the window title. Her... | 10,924 | [
{
"from": "human",
"value": "Is there a way to emulate the unix cut command on windows XP, without resorting to cygwin or other non-standard windows capabilities?\nExample: Use tasklist /v, find the specific task by the window title, then extract the PID from that list to pass to taskkill.\n"
},
{
"... |
So creating a Windows service using Visual Studio is fairly trivial. My question goes a bit deeper as to what actually makes an executable installable as a service & how to write a service as a straight C application. I couldn't find a lot of references on this, but I'm presuming there has to be some interface I can ... | Creating a Windows service in C involves understanding how Windows services operate, as well as utilizing the Windows API to interact with the Service Control Manager (SCM). Below are the main points on how to write a Windows service as a straight C application.
### Key Concepts
1. **Service Control Manager (SCM)**: ... | 7,423 | [
{
"from": "human",
"value": "So creating a Windows service using Visual Studio is fairly trivial. My question goes a bit deeper as to what actually makes an executable installable as a service & how to write a service as a straight C application. I couldn't find a lot of references on this, but I'm presum... |
Using reflection, I need to investigate a user DLL and create an object of a class in it.
What is the simple way of doing it?
| Using reflection in .NET allows you to inspect assemblies and create objects from classes defined within them dynamically. Here's a simple step-by-step guide to load a user DLL, inspect its classes, and create an instance of a specific class.
### Steps to Use Reflection in .NET to Load a User DLL and Create an Object
... | 7,324 | [
{
"from": "human",
"value": "Using reflection, I need to investigate a user DLL and create an object of a class in it.\nWhat is the simple way of doing it?\n"
},
{
"from": "gpt",
"value": "Using reflection in .NET allows you to inspect assemblies and create objects from classes defined within th... |
I want to log in to Stack Overflow with Techorati OpenID hosted at my site.
https://stackoverflow.com/users/login has some basic information.
I understood that I should change
<link rel="openid.delegate" href="http://yourname.x.com" />
to
<link rel="openid.delegate" href="http://technorati.com/people/technorati/USERNA... | To log in to Stack Overflow using your Technorati OpenID, you need to ensure you are using the correct OpenID endpoints. Here's how to set it up correctly:
1. **openid.delegate**: This is where you specify your OpenID provider. The value you mentioned is correct:
```html
<link rel="openid.delegate" href="http://... | 11,096 | [
{
"from": "human",
"value": "I want to log in to Stack Overflow with Techorati OpenID hosted at my site.\nhttps://stackoverflow.com/users/login has some basic information.\nI understood that I should change\n<link rel=\"openid.delegate\" href=\"http://yourname.x.com\" />\n\nto\n<link rel=\"openid.delegate\"... |
I have a string with possible command line arguments (using an Read-Eval-Print-Loop program) and I want it to be parsed similar to the command line arguments when passed to Getopt::Long.
To elaborate:
I have a string
$str = '--infile /tmp/infile_location --outfile /tmp/outfile'
I want it to be parsed by GetOptions so ... | Using `Getopt::Long` is a common and effective way to handle command line options in Perl. Your approach of replacing `@ARGV` is perfectly valid, but there's a cleaner way to achieve this without directly manipulating `@ARGV`.
Instead of modifying `@ARGV`, you can use `Getopt::Long::GetOptionsFromString` which allows... | 11,040 | [
{
"from": "human",
"value": "I have a string with possible command line arguments (using an Read-Eval-Print-Loop program) and I want it to be parsed similar to the command line arguments when passed to Getopt::Long.\nTo elaborate:\nI have a string\n$str = '--infile /tmp/infile_location --outfile /tmp/outfil... |
How can I use JUnit idiomatically to test that some code throws an exception?
While I can certainly do something like this:
@Test
public void testFooThrowsIndexOutOfBoundsException() {
boolean thrown = false;
try {
foo.doStuff();
} catch (IndexOutOfBoundsException e) {
thrown = true;
}... | In JUnit 4, you can use the `@Test` annotation's `expected` parameter to specify the expected exception. This is a cleaner and more idiomatic way to test that a method throws an exception. Here's how you can rewrite your test:
```java
import org.junit.Test;
public class YourTestClass {
@Test(expected = IndexOutO... | 12,812 | [
{
"from": "human",
"value": "How can I use JUnit idiomatically to test that some code throws an exception?\nWhile I can certainly do something like this:\n@Test\npublic void testFooThrowsIndexOutOfBoundsException() {\n\n boolean thrown = false;\n\n try {\n foo.doStuff();\n } catch (IndexOutO... |
As developers and as professional engineers have you been exposed to the tenants of Extreme Programming as defined in the "version 1" by Kent Beck.
Which of those 12 core principles do you feel you have been either allowed to practice or at least be a part of in your current job or others?
* Pair programming[5]
* Plann... | As a language model, I don't have personal experiences or opinions, but I can provide insights based on the principles of Extreme Programming (XP) and the general sentiment among developers and engineers regarding these practices.
Extreme Programming emphasizes collaboration, rapid feedback, and continuous improvement... | 9,239 | [
{
"from": "human",
"value": "As developers and as professional engineers have you been exposed to the tenants of Extreme Programming as defined in the \"version 1\" by Kent Beck.\nWhich of those 12 core principles do you feel you have been either allowed to practice or at least be a part of in your current ... |
I want to write a function in Python that returns different fixed values based on the value of an input index.
In other languages I would use a switch or case statement, but Python does not appear to have a switch statement. What are the recommended Python solutions in this scenario?
| In Python, while there is no direct equivalent of the `switch` or `case` statement found in some other languages, you can achieve similar functionality using various approaches. Here are a few recommended solutions:
### 1. Dictionary Mapping
You can use a dictionary to map keys (your input index) to the corresponding... | 9,727 | [
{
"from": "human",
"value": "I want to write a function in Python that returns different fixed values based on the value of an input index. \nIn other languages I would use a switch or case statement, but Python does not appear to have a switch statement. What are the recommended Python solutions in this ... |
I have a query that originally looks like this:
select c.Id, c.Name, c.CountryCode, c.CustomerNumber, cacc.AccountNumber, ca.Line1, ca.CityName, ca.PostalCode
from dbo.Customer as c
left join dbo.CustomerAddress as ca on ca.CustomerId = c.Id
left join dbo.CustomerAccount as cacc on cacc.CustomerId = c.Id
where c.Count... | To optimize your SQL query using full-text search, you'll need to create full-text indexes on the relevant columns of the tables involved in the query. Since you're already using joins, it may require a bit of reorganization, but full-text search can significantly speed up searches involving wildcard patterns, especial... | 9,192 | [
{
"from": "human",
"value": "I have a query that originally looks like this:\nselect c.Id, c.Name, c.CountryCode, c.CustomerNumber, cacc.AccountNumber, ca.Line1, ca.CityName, ca.PostalCode\nfrom dbo.Customer as c\nleft join dbo.CustomerAddress as ca on ca.CustomerId = c.Id\nleft join dbo.CustomerAccount as ... |
I'm looking for a way to set the default language for visitors comming to a site built in EPiServer for the first time. Not just administrators/editors in the backend, people comming to the public site.
| To set the default language for first-time visitors to a site built in EPiServer (now part of Optimizely), you can follow these general steps:
### 1. Determine User's Language Preference
You will first need to detect the user's language preference. There are several approaches to consider:
- **Browser Language Detec... | 10,607 | [
{
"from": "human",
"value": "I'm looking for a way to set the default language for visitors comming to a site built in EPiServer for the first time. Not just administrators/editors in the backend, people comming to the public site.\n"
},
{
"from": "gpt",
"value": "To set the default language for... |
I'm converting an old app that records folder sizes on a daily basis. The legacy app uses the Scripting.FileSystemObject library:
Set fso = CreateObject("Scripting.FileSystemObject")
Set folderObject = fso.GetFolder(folder)
size = folderObject.Size
There isn't an equivalent mechanism on the System.IO.Directory and Sys... | In .NET, the `System.IO.DirectoryInfo` class does not directly provide a property to get the total size of a directory like the `Scripting.FileSystemObject` does. You are correct that to compute the total size of a folder, you typically have to recursively walk through its files and subdirectories, summing their sizes.... | 10,438 | [
{
"from": "human",
"value": "I'm converting an old app that records folder sizes on a daily basis. The legacy app uses the Scripting.FileSystemObject library:\nSet fso = CreateObject(\"Scripting.FileSystemObject\")\nSet folderObject = fso.GetFolder(folder)\nsize = folderObject.Size\n\nThere isn't an equival... |
I have a large exiting C++ project involving:
4 applications
50+ libraries
20+ third party libraries
It all builds fine on Windows using VS8, Linux using QMake (project uses Qt a lot). I also build it on OS X using QMake but I was wanting to setup an Xcode project to handle it in an IDE. I'm struggling to setup ... | Setting up a large C++ project in Xcode can be a bit challenging, especially when trying to manage dependencies among multiple libraries and third-party frameworks. Here are some steps, tips, and resources to help you get started:
### Setting Up Xcode for a Large C++ Project
1. **Organize Your Project Structure**:
... | 6,950 | [
{
"from": "human",
"value": "I have a large exiting C++ project involving: \n\n4 applications \n50+ libraries \n20+ third party libraries\n\nIt all builds fine on Windows using VS8, Linux using QMake (project uses Qt a lot). I also build it on OS X using QMake but I was wanting to setup an Xcode project t... |
I'm working on an email solution in SQL Server ONLY that will use Database Mail to send out HTML formatted emails. The catch is that the images in the HTML need to be embedded in the outgoing email. This wouldn't be a problem if I were using a .net app to generate & send the emails but, unfortunately, all I have is SQ... | Embedding images directly in emails sent via SQL Server's Database Mail can be a bit tricky since SQL Server doesn't have built-in functionality to directly embed images within HTML emails. However, you can achieve this by using the following approach:
### Using Inline Images with CID
To embed images in your HTML ema... | 9,310 | [
{
"from": "human",
"value": "I'm working on an email solution in SQL Server ONLY that will use Database Mail to send out HTML formatted emails. The catch is that the images in the HTML need to be embedded in the outgoing email. This wouldn't be a problem if I were using a .net app to generate & send the em... |
Is it just that nvarchar supports multibyte characters? If that is the case, is there really any point, other than storage concerns, to using varchars?
| Yes, you're correct that the primary distinction between `varchar` and `nvarchar` in SQL Server (and some other database systems) is related to character encoding.
1. **Character Encoding**:
- **`varchar`**: This data type is used to store non-Unicode characters, typically encoded in a single-byte character set (e... | 12,265 | [
{
"from": "human",
"value": "Is it just that nvarchar supports multibyte characters? If that is the case, is there really any point, other than storage concerns, to using varchars?\n"
},
{
"from": "gpt",
"value": "Yes, you're correct that the primary distinction between `varchar` and `nvarchar` ... |
I would like to change the database files location of MySQL administrator to another drive of my computer. (I run Windows XP SP2 and MySQL Administrator 1.2.8.)
--Under the startup variable --> General Parameters --> I changed Data directory: from C:/Program Files/MySQL/MySQL Server 5.0/data to D:/....., but after I ... | Changing the data directory of a MySQL server can sometimes lead to errors if not done correctly. Here are the steps you can follow to successfully change the data directory and avoid the "Can't open and lock privilege tables" error:
### Steps to Change MySQL Data Directory on Windows XP
1. **Stop the MySQL Service**... | 11,012 | [
{
"from": "human",
"value": "I would like to change the database files location of MySQL administrator to another drive of my computer. (I run Windows XP SP2 and MySQL Administrator 1.2.8.)\n--Under the startup variable --> General Parameters --> I changed Data directory: from C:/Program Files/MySQL/MySQL... |
I've recently installed VS2008. The project I'm working on uses vstest and I have a maddening issue. When I choose to run/debug my tests/a test I frequently get the following error (accompanied by an exclamation mark against the test - test error):
Warning: Test Run deployment issue: The assembly or module 'Cassini' di... | The issues you're experiencing with running tests in Visual Studio 2008 (VS2008) can indeed be quite frustrating. Here are some steps and suggestions that may help you resolve this problem:
### Steps to Troubleshoot
1. **Ensure Correct Version of Visual Studio**:
- Make sure you are using the correct version of Vi... | 8,540 | [
{
"from": "human",
"value": "I've recently installed VS2008. The project I'm working on uses vstest and I have a maddening issue. When I choose to run/debug my tests/a test I frequently get the following error (accompanied by an exclamation mark against the test - test error):\nWarning: Test Run deployment ... |
That's the question: Which library can help me to access data available via WebDAV in my Java-programs? OpenSource is preferred.
| For accessing WebDAV in your Java programs, you can use the following open-source libraries:
1. **Apache Jackrabbit**: Jackrabbit is a powerful JCR (Java Content Repository) implementation that supports WebDAV. It can be used to access content repositories that expose their functionality over WebDAV.
- Website: [A... | 11,789 | [
{
"from": "human",
"value": "That's the question: Which library can help me to access data available via WebDAV in my Java-programs? OpenSource is preferred.\n"
},
{
"from": "gpt",
"value": "For accessing WebDAV in your Java programs, you can use the following open-source libraries:\n\n1. **Apac... |
Anybody found yet a good web site architecture using linq to sql? Any help will be very helpful!
| When designing a web application architecture that uses LINQ to SQL, it's important to structure your application in a way that promotes maintainability, scalability, and separation of concerns. Here’s a suggested architecture and some best practices for using LINQ to SQL in a web application:
### Suggested Architectu... | 9,313 | [
{
"from": "human",
"value": "Anybody found yet a good web site architecture using linq to sql? Any help will be very helpful!\n"
},
{
"from": "gpt",
"value": "When designing a web application architecture that uses LINQ to SQL, it's important to structure your application in a way that promotes ... |
Possible Duplicate:
Why do we usually use || not |, what is the difference?
Title says it all. It's been discussed for other languages, but I haven't seen it for Java yet.
| In Java (and many other programming languages), there is a difference between the single vertical bar `|` and the double vertical bar `||`, primarily in the context of logical operations. Here’s a breakdown of each:
### `|` (Bitwise OR / Logical OR)
- **Bitwise OR:** When used with integral types (like `int`, `byte`, ... | 9,746 | [
{
"from": "human",
"value": "\nPossible Duplicate:\nWhy do we usually use || not |, what is the difference? \n\nTitle says it all. It's been discussed for other languages, but I haven't seen it for Java yet. \n"
},
{
"from": "gpt",
"value": "In Java (and many other programming languages), ther... |
In Oracle I can declare a reference cursor...
TYPE t_spool IS REF CURSOR RETURN spool%ROWTYPE;
...and use it to pass a cursor as the return value...
FUNCTION end_spool
RETURN t_spool
AS
v_spool t_spool;
BEGIN
COMMIT;
OPEN v_spool FOR
SELECT
*
FROM... | In PostgreSQL, you can achieve similar functionality using a combination of **functions**, **RETURNING a cursor**, and **using JDBC** to handle the result. Below are the steps to create a PostgreSQL function that returns a cursor, as well as how to call it using JDBC.
### Step 1: Create the Function in PostgreSQL
In ... | 6,005 | [
{
"from": "human",
"value": "In Oracle I can declare a reference cursor...\nTYPE t_spool IS REF CURSOR RETURN spool%ROWTYPE;\n\n...and use it to pass a cursor as the return value...\nFUNCTION end_spool\n RETURN t_spool\n AS\n v_spool t_spool;\n BEGIN\n COMMIT;\n OPEN v_spool FOR\n ... |
I'm currently using .resx files to manage my server side resources for .NET.
the application that I am dealing with also allows developers to plugin JavaScript into various event handlers for client side validation, etc.. What is the best way for me to localize my JavaScript messages and strings?
Ideally, I would lik... | To effectively localize your JavaScript messages and strings while keeping the resources within your .resx files, you can follow these strategies:
### Approach 1: Generate a JavaScript Localization File
1. **Create a Resource Class**: Use the .resx files to maintain your localized strings. You can create a static cla... | 8,856 | [
{
"from": "human",
"value": "I'm currently using .resx files to manage my server side resources for .NET.\nthe application that I am dealing with also allows developers to plugin JavaScript into various event handlers for client side validation, etc.. What is the best way for me to localize my JavaScript me... |
As a follow up to "What are indexes and how can I use them to optimise queries in my database?" where I am attempting to learn about indexes, what columns are good index candidates? Specifically for an MS SQL database?
After some googling, everything I have read suggests that columns that are generally increasing and u... | When optimizing queries in your MS SQL database through the use of indexes, it's essential to understand which columns are suitable candidates for indexing. Here are some general guidelines to help you identify good index candidates, even when using GUIDs as primary keys:
### 1. **Columns Used in WHERE Clauses**
- ... | 7,357 | [
{
"from": "human",
"value": "As a follow up to \"What are indexes and how can I use them to optimise queries in my database?\" where I am attempting to learn about indexes, what columns are good index candidates? Specifically for an MS SQL database?\nAfter some googling, everything I have read suggests that... |
Given a simple statement, such as:
<statement id="SelectProducts" resultMap="???">
SELECT * FROM Products
</statement>
Is it possible to get a list of dictionary objects where the keys are the column names?
ie.
var list = Mapper.QueryForList<IDictionary<string,string>>("SelectProducts", null);
IDictionary<string, s... | Yes, you can achieve this by using a data access layer that supports returning results as dictionaries. If you're using a technology like Dapper, ADO.NET, or a similar ORM that allows dynamic result mapping, you can generalize your SQL query results to return a list of dictionaries where each dictionary corresponds to ... | 10,214 | [
{
"from": "human",
"value": "Given a simple statement, such as:\n<statement id=\"SelectProducts\" resultMap=\"???\">\n SELECT * FROM Products\n</statement>\n\nIs it possible to get a list of dictionary objects where the keys are the column names?\nie.\nvar list = Mapper.QueryForList<IDictionary<string,stri... |
I understand that they are both supposed to be small, but what are the key differences between the two?
| To provide a more accurate answer, could you please specify what two things you are comparing? This could refer to concepts, objects, animals, or any other categories. | 15,671 | [
{
"from": "human",
"value": "I understand that they are both supposed to be small, but what are the key differences between the two?\n"
},
{
"from": "gpt",
"value": "To provide a more accurate answer, could you please specify what two things you are comparing? This could refer to concepts, objec... |
What would be the most optimal algorithm (performance-wise) to calculate the number of divisors of a given number?
It'll be great if you could provide pseudocode or a link to some example.
EDIT: All the answers have been very helpful, thank you. I'm implementing the Sieve of Atkin and then I'm going to use something si... | To calculate the number of divisors of a given number \( n \) in an optimal manner, you can use a prime factorization approach. This method leverages the property that if you can express \( n \) as a product of its prime factors, the number of divisors can be calculated using those factors.
### Step-by-step Explanatio... | 8,441 | [
{
"from": "human",
"value": "What would be the most optimal algorithm (performance-wise) to calculate the number of divisors of a given number?\nIt'll be great if you could provide pseudocode or a link to some example.\nEDIT: All the answers have been very helpful, thank you. I'm implementing the Sieve of A... |
We've just been tasked with updating an e-commerce application to use PayPal's PayFlow product. The site was originally written in classic ASP except for the credit card processing portion which was a COM component.
Our plan is to replace the COM component with a .NET 2.0 component. I'm looking for tips, gotcha, etc.... | Updating your e-commerce application to use PayPal's PayFlow can be a significant task, especially when transitioning from a legacy system like classic ASP and COM components to a .NET environment. Here are some tips and considerations to help you navigate this process:
### 1. Understand PayPal PayFlow Basics
- **Docu... | 8,545 | [
{
"from": "human",
"value": "We've just been tasked with updating an e-commerce application to use PayPal's PayFlow product. The site was originally written in classic ASP except for the credit card processing portion which was a COM component.\nOur plan is to replace the COM component with a .NET 2.0 comp... |
The following question answers how to get large memory pages on Windows :
"how do i run my app with large pages in windows".
The problem I'm trying to solve is how do I configure it on Vista and 2008 Server.
Normally you just allow a specific user to lock pages in memory and you are done. However on Vista and 2008 this... | To enable the use of large pages in your application on Windows Vista and Windows Server 2008, you need to ensure that the necessary permissions and configurations are set correctly. Here’s a step-by-step guide to achieve this:
### Step 1: User Account Control (UAC) Settings
In Windows Vista and later, User Account Co... | 7,246 | [
{
"from": "human",
"value": "The following question answers how to get large memory pages on Windows :\n\"how do i run my app with large pages in windows\".\nThe problem I'm trying to solve is how do I configure it on Vista and 2008 Server.\nNormally you just allow a specific user to lock pages in memory an... |
Is it possible to change the natural order of columns in Postgres 8.1?
I know that you shouldn't rely on column order - it's not essential to what I am doing - I only need it to make some auto-generated stuff come out in a way that is more pleasing, so that the field order matches all the way from pgadmin through the b... | In PostgreSQL, the order of columns in a table is generally determined by the order in which they were created. In versions prior to PostgreSQL 11, there is no built-in command to directly alter the order of columns in an existing table.
If you want to change the order of the columns in PostgreSQL 8.1, you have a coup... | 11,029 | [
{
"from": "human",
"value": "Is it possible to change the natural order of columns in Postgres 8.1?\nI know that you shouldn't rely on column order - it's not essential to what I am doing - I only need it to make some auto-generated stuff come out in a way that is more pleasing, so that the field order matc... |
I'm experimenting with adding icons to a shell extension. I have this code (sanitized for easy reading), which works:
InsertMenu(hmenu, index, MF_POPUP|MF_BYPOSITION, (UINT)hParentMenu, namestring);
The next step is this code:
HICON hIconLarge, hIconSmall;
ICONINFO oIconInfo;
ExtractIconEx("c:\\progra~1\\winzip\\winzi... | To set the bitmap for a menu item using `SetMenuItemBitmaps`, you need to create a bitmap from the icon you extracted. Since you've already extracted the icon and have its information in `oIconInfo`, the next steps involve converting the icon into a bitmap format that can be used for your menu.
Here's a step-by-step g... | 9,632 | [
{
"from": "human",
"value": "I'm experimenting with adding icons to a shell extension. I have this code (sanitized for easy reading), which works:\nInsertMenu(hmenu, index, MF_POPUP|MF_BYPOSITION, (UINT)hParentMenu, namestring);\n\nThe next step is this code:\nHICON hIconLarge, hIconSmall;\nICONINFO oIconIn... |
Every so often I get an error saying one of my tables "is marked as crashed and should be repaired". I then do a REPAIR TABLE and repair it. What causes them to be marked as crashed and how can I prevent it? I am using MyISAM tables with MySQL 5.0.45.
| Tables marked as "crashed" in MySQL, especially with the MyISAM storage engine, can be a common issue and can arise from a few different causes:
1. **Unexpected Shutdowns**: If the MySQL server crashes or is forcibly shut down while a write operation is occurring, it may leave the table in an inconsistent state. This ... | 9,909 | [
{
"from": "human",
"value": "Every so often I get an error saying one of my tables \"is marked as crashed and should be repaired\". I then do a REPAIR TABLE and repair it. What causes them to be marked as crashed and how can I prevent it? I am using MyISAM tables with MySQL 5.0.45.\n"
},
{
"from": "... |
In Nant, I would like to be able to extract the last name of the directory in a path.
For example, we have the path 'c:\my_proj\source\test.my_dll\'
I would like to pass in that path and extract 'test.my_dll'
Is there a way to easily do this?
| Yes, you can extract the last part of a directory path in Nant by using built-in functions. Specifically, you can use the `Path` class which provides methods for manipulating paths.
Here's a snippet that demonstrates how to extract the last name of the directory from a given path:
```xml
<project name="ExtractLastDir... | 11,705 | [
{
"from": "human",
"value": "In Nant, I would like to be able to extract the last name of the directory in a path.\nFor example, we have the path 'c:\\my_proj\\source\\test.my_dll\\'\nI would like to pass in that path and extract 'test.my_dll'\nIs there a way to easily do this?\n"
},
{
"from": "gpt"... |
In Eclipse 3.3.2, I would like to replace a character (say ',') by a new line in a file.
What should I write in the "Replace with" box in order to do so ?
EDIT : Many answers seems to be for Eclipse 3.4. Is there a solution for Eclipse 3.3.X ?
| In Eclipse 3.3.2, when you want to replace a character with a new line in the "Replace" dialog, you should follow these steps:
1. Open the "Find/Replace" dialog by going to `Edit` > `Find/Replace` or by pressing `Ctrl + F`.
2. In the "Find what" box, enter the character you want to replace (e.g., `,`).
3. In the "Repl... | 12,947 | [
{
"from": "human",
"value": "In Eclipse 3.3.2, I would like to replace a character (say ',') by a new line in a file.\nWhat should I write in the \"Replace with\" box in order to do so ?\nEDIT : Many answers seems to be for Eclipse 3.4. Is there a solution for Eclipse 3.3.X ?\n"
},
{
"from": "gpt",
... |
I like jQuery and I was wondering if anyone have used a good plugin or (non-jQuery) JavaScript library that allows for auto-formatting of structured fields like phone numbers or dates. I know of the jquery-ui-datapicker plugin, and not what I am looking for here. You may type in a phone number as 123 which then becom... | If you're looking for a reliable JavaScript library or plugin for auto-formatting structured fields like phone numbers and dates, there are a few popular options that you might find useful. Here are some recommendations:
### 1. **Cleave.js**
Cleave.js is a lightweight library that allows for formatting input fields wi... | 8,071 | [
{
"from": "human",
"value": "I like jQuery and I was wondering if anyone have used a good plugin or (non-jQuery) JavaScript library that allows for auto-formatting of structured fields like phone numbers or dates. I know of the jquery-ui-datapicker plugin, and not what I am looking for here. You may type ... |
I sometimes use the feature 'Reconcile Offline Work...' found in Perforce's P4V IDE to sync up any files that I have been working on while disconnected from the P4 depot. It launches another window that performs a 'Folder Diff'.
I have files I never want to check in to source control (like ones found in bin folder such... | Yes, Perforce does have a way to ignore certain files or directories similar to Subversion's 'ignore file' feature. You can achieve this by using the `p4 ignore` command, which allows you to specify a set of file patterns that Perforce will ignore when adding files to the depot.
Here's how you can set it up:
1. **Cre... | 9,422 | [
{
"from": "human",
"value": "I sometimes use the feature 'Reconcile Offline Work...' found in Perforce's P4V IDE to sync up any files that I have been working on while disconnected from the P4 depot. It launches another window that performs a 'Folder Diff'.\nI have files I never want to check in to source c... |
As a novice, I've spent time learning a smattering of C and a fair bit of PHP. I've looked at writing desktop applications for Windows, but there seems to be a fair barrier to entry due to complexity of APIs. Is it worth learning this, or will native applications become less common in the future?
The way I see it, the ... | It's great that you're exploring programming and have already learned some C and PHP! Your observations about the prevalence of web applications over traditional desktop applications are indeed reflective of current trends. Here are some points to consider regarding whether to pursue learning desktop application develo... | 8,791 | [
{
"from": "human",
"value": "As a novice, I've spent time learning a smattering of C and a fair bit of PHP. I've looked at writing desktop applications for Windows, but there seems to be a fair barrier to entry due to complexity of APIs. Is it worth learning this, or will native applications become less com... |
As many of us know (and many, many more don't), C++ is currently undergoing final drafting for the next revision of the International Standard, expected to be published in about 2 years. Drafts and papers are currently available from the committee website. All sorts of new features are being added, the biggest being co... | It's great to hear your enthusiasm for the new features being introduced in C++11 (formerly known as C++0x)! Many developers have been eagerly awaiting these enhancements to improve the language's expressiveness and usability. Here are some of the most anticipated features that many in the community have been looking f... | 11,031 | [
{
"from": "human",
"value": "As many of us know (and many, many more don't), C++ is currently undergoing final drafting for the next revision of the International Standard, expected to be published in about 2 years. Drafts and papers are currently available from the committee website. All sorts of new featu... |
I am writing a program to simulate the actual polling data companies like Gallup or Rasmussen publish daily: www.gallup.com and www.rassmussenreports.com
I'm using a brute force method, where the computer generates some random daily polling data and then calculates three day averages to see if the average of the random... | To avoid creating multiple variables for storing your simulation results in each iteration, you can use a list (or a similar data structure, depending on the programming language you are using) to store the results from each iteration. This way, you can easily manage all of your simulation results in a single data stru... | 8,716 | [
{
"from": "human",
"value": "I am writing a program to simulate the actual polling data companies like Gallup or Rasmussen publish daily: www.gallup.com and www.rassmussenreports.com\nI'm using a brute force method, where the computer generates some random daily polling data and then calculates three day av... |
Are there any favorite online references or good introductory and intermediate/advanced books on this topic that you could recommend to me?
I'm a java developer, so I'm looking for something which would be familiar as possible as to me.
| Certainly! If you are a Java developer looking to deepen your knowledge, there are several resources available, both online and in book form, that can cater to introductory as well as intermediate/advanced levels. Here’s a selection tailored for you:
### Online References
1. **Java Documentation (Oracle)**:
- The ... | 8,644 | [
{
"from": "human",
"value": "Are there any favorite online references or good introductory and intermediate/advanced books on this topic that you could recommend to me?\nI'm a java developer, so I'm looking for something which would be familiar as possible as to me.\n"
},
{
"from": "gpt",
"value... |
For std::map, how will insert behave if it has to resize the container and the memory is not available?
| In C++, `std::map` is implemented as a balanced binary tree (often a red-black tree) and manages its own memory for storing key-value pairs. Unlike `std::vector`, which may need to resize by allocating a new contiguous block of memory when it runs out of space, `std::map` generally allocates memory for each element ind... | 9,705 | [
{
"from": "human",
"value": "For std::map, how will insert behave if it has to resize the container and the memory is not available?\n"
},
{
"from": "gpt",
"value": "In C++, `std::map` is implemented as a balanced binary tree (often a red-black tree) and manages its own memory for storing key-va... |
There seems to be no good way to localize a WPF application. MSDN seems to think that littering my XAML with x:Uid's, generating CSV files, and then generating new assemblies (using their sample code!) is the answer. Worse, this process doesn't address how to localize images, binary blobs (say, PDF files), or strings... | Localizing a WPF application can indeed be complex, especially when you have multiple assemblies, non-XAML resources like images and binary files, and strings hardcoded in your code. Here’s a multi-faceted approach to handle localization in such scenarios:
### 1. Resource Files for Strings
For string localization, yo... | 7,419 | [
{
"from": "human",
"value": "There seems to be no good way to localize a WPF application. MSDN seems to think that littering my XAML with x:Uid's, generating CSV files, and then generating new assemblies (using their sample code!) is the answer. Worse, this process doesn't address how to localize images, ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.