instruction stringlengths 14 27.6k | completion stringlengths 3 38.3k | __original_row_idx int64 0 50k | conversations listlengths 2 2 |
|---|---|---|---|
Let's say there's a.gz, and b.gz.
$ gzip_merge a.gz b.gz -output c.gz
I'd like to have this program. Of course,
$ cat a.gz b.gz > c.gz
doesn't work. Because the final DEFLATE block of a.gz has BFINAL, and the GZIP header of b.gz. (Refer to RFC1951, RFC1952) But if you unset BFINAL, throw away the second GZIP header and... | It sounds like you're interested in creating a tool to merge multiple gzipped files, which can be quite useful for handling log files or similar use cases. While there isn't a widely-known tool specifically for merging gzipped files as you described, there are a few options to consider:
1. **Implement the Program Your... | 30,321 | [
{
"from": "human",
"value": "Let's say there's a.gz, and b.gz.\n$ gzip_merge a.gz b.gz -output c.gz\nI'd like to have this program. Of course,\n$ cat a.gz b.gz > c.gz\ndoesn't work. Because the final DEFLATE block of a.gz has BFINAL, and the GZIP header of b.gz. (Refer to RFC1951, RFC1952) But if you unset ... |
Is it possible to implement autoboxing for your own classes?
To illustrate my example, this is what I might want to write:
Foo foo = "lolcat";
And this is what Java would do (as per my own definitions, somewhere, somehow), under the hood:
Foo foo = new Foo();
foo.setLolcat("lolcat");
So, is this possible somehow, or ... | In Java, autoboxing is a feature that allows automatic conversion between primitive types and their corresponding wrapper classes. However, when it comes to user-defined classes, you cannot directly implement autoboxing in the same way. Autoboxing is a JVM feature specifically designed for the predefined wrapper classe... | 28,017 | [
{
"from": "human",
"value": "Is it possible to implement autoboxing for your own classes?\nTo illustrate my example, this is what I might want to write:\nFoo foo = \"lolcat\";\n\nAnd this is what Java would do (as per my own definitions, somewhere, somehow), under the hood:\nFoo foo = new Foo();\nfoo.setLol... |
Is there a server implementation of DBus for Java? There's a lib for clients and services (not servers).
| Yes, there are implementations of D-Bus for Java that support server functionality. One notable library is **dbus-java** (also known as **dbus-java-server**). This library allows you to create D-Bus services in Java, enabling your Java applications to expose methods and receive messages on the D-Bus.
### dbus-java
- ... | 30,185 | [
{
"from": "human",
"value": "Is there a server implementation of DBus for Java? There's a lib for clients and services (not servers).\n"
},
{
"from": "gpt",
"value": "Yes, there are implementations of D-Bus for Java that support server functionality. One notable library is **dbus-java** (also kn... |
I've got a workspace with multiple RCP plugin projects.
We've set the target platform, so we can build against a standard set of plugins, but are not able to see source code and Javadoc for all the platform plugins.
The Windows -> Preferences -> Plug-in Development -> Target Platform -> Source Code Locations page doesn... | To successfully attach source code and Javadoc to your Eclipse target platform in an RCP project, you'll need to ensure that the source jars are properly recognized in your target platform definition. Here are the steps you can follow to achieve that:
### Attaching Source Jars to the Target Platform
1. **Create or Ed... | 27,445 | [
{
"from": "human",
"value": "I've got a workspace with multiple RCP plugin projects.\nWe've set the target platform, so we can build against a standard set of plugins, but are not able to see source code and Javadoc for all the platform plugins.\nThe Windows -> Preferences -> Plug-in Development -> Target P... |
I'm using the code below to save a password to the registry, how do I convert it back? The code below isn't mine but it encrypts well.
Thanks
using System.Security.Cryptography;
public static string EncodePasswordToBase64(string password)
{ byte[] bytes = Encoding.Unicode.GetBytes(password);
byte[] dst = new... | The code you provided appears to be intended to hash a password using SHA1 and then convert that hash into a Base64-encoded string. However, it is important to note that this approach does not allow you to "convert it back" to the original password, because hashing is a one-way operation.
In cryptographic terms, hash... | 28,855 | [
{
"from": "human",
"value": "I'm using the code below to save a password to the registry, how do I convert it back? The code below isn't mine but it encrypts well.\nThanks\nusing System.Security.Cryptography;\n\npublic static string EncodePasswordToBase64(string password)\n{ byte[] bytes = Encoding.Unico... |
Can someone give me step by step instructions or point to the correct references in the correct order
so that I can determine the root cause of this issue?
| Certainly! To determine the root cause of an issue, you can follow a structured problem-solving approach. Here’s a step-by-step guide:
### Step 1: Define the Problem
1. **Identify Symptoms**: Clearly articulate what the issue is. Gather data on when it occurs, its frequency, and any specific errors or outcomes.
2. **D... | 26,506 | [
{
"from": "human",
"value": "Can someone give me step by step instructions or point to the correct references in the correct order \nso that I can determine the root cause of this issue?\n"
},
{
"from": "gpt",
"value": "Certainly! To determine the root cause of an issue, you can follow a structu... |
I'm completely new to AIR but what I'm trying to do feels like it should be quite easy.
I want my AIR app to execute (launch) an SWF in the standalone Flash Player (just like if I were to double click it).
Please note that I don't want the AIR app to embed the SWF. Just run it.
Can this be done?
| Yes, you can launch an SWF file in the standalone Flash Player from an AIR application. This can be accomplished by using the `Process` class from the `flash.desktop` package, which allows you to run external applications.
Here's a step-by-step guide to get you started:
### Step 1: Setting Up Your AIR Application
1.... | 26,225 | [
{
"from": "human",
"value": "I'm completely new to AIR but what I'm trying to do feels like it should be quite easy.\nI want my AIR app to execute (launch) an SWF in the standalone Flash Player (just like if I were to double click it). \nPlease note that I don't want the AIR app to embed the SWF. Just run i... |
I have a class that implements multiple interfaces.
I would like to register these interfaces via XML.
All I've found is documentation for the new Fluent Interface.
Is this option supported via XML?
What would be involved in adding this feature?
| In a typical dependency injection (DI) container that supports XML configuration, you can register multiple interfaces for a single implementation class. Although many modern DI containers have shifted to using Fluent Interfaces, XML configuration is still supported by many of them for backward compatibility and ease o... | 30,394 | [
{
"from": "human",
"value": "I have a class that implements multiple interfaces.\nI would like to register these interfaces via XML.\nAll I've found is documentation for the new Fluent Interface. \nIs this option supported via XML?\nWhat would be involved in adding this feature?\n"
},
{
"from": "gpt... |
Say I have a fairly hefty JavaScript file, packed down to roughly 100kb or so. By file I mean it’s an external file that would be linked in via <script src="...">, not pasted into the HTML itself.
Where’s the best place to put this in the HTML?
<html>
<head>
<!-- here? -->
<link rel="stylesheet" href="stylez.cs... | The placement of your `<script src="...">` tag in your HTML document can indeed affect the loading and rendering of your page. Let's consider the different options you provided:
1. **In the `<head>` section**:
```html
<head>
<link rel="stylesheet" href="stylez.css" type="text/css" />
<script sr... | 28,141 | [
{
"from": "human",
"value": "Say I have a fairly hefty JavaScript file, packed down to roughly 100kb or so. By file I mean it’s an external file that would be linked in via <script src=\"...\">, not pasted into the HTML itself.\nWhere’s the best place to put this in the HTML?\n<html>\n<head>\n <!-- here?... |
How can I transform a String value into an InputStreamReader?
| In Java, you can transform a `String` into an `InputStreamReader` by first converting the `String` into a byte array and then creating a `ByteArrayInputStream` from that byte array. Finally, you can wrap the `ByteArrayInputStream` with an `InputStreamReader`. Here is how you can do it:
```java
import java.io.ByteArray... | 29,510 | [
{
"from": "human",
"value": "How can I transform a String value into an InputStreamReader?\n"
},
{
"from": "gpt",
"value": "In Java, you can transform a `String` into an `InputStreamReader` by first converting the `String` into a byte array and then creating a `ByteArrayInputStream` from that by... |
I have SQL data that looks like this:
events
id name capacity
1 Cooking 10
2 Swimming 20
3 Archery 15
registrants
id name
1 Jimmy
2 Billy
3 Sally
registrant_event
registrant_id event_id
1 3
2 3
3 2
I would like to select all of... | You can achieve this by using a SQL query that combines the `events`, `registrant_event`, and potentially the `registrants` table (if you want additional registrant details) with an aggregate function and a `LEFT JOIN`. The `LEFT JOIN` will help include all events, even if they have no registrants. The aggregate functi... | 28,671 | [
{
"from": "human",
"value": "I have SQL data that looks like this:\nevents\nid name capacity\n1 Cooking 10\n2 Swimming 20\n3 Archery 15\n\nregistrants\nid name\n1 Jimmy\n2 Billy\n3 Sally\n\nregistrant_event\nregistrant_id event_id\n 1 3\n 2 ... |
And by donut caching, I'm refering to Scott Guthrie's blog post which is awesome.
Does anyone know if that works properly?
| Scott Guthrie's blog post on donut caching discusses a caching technique designed to improve the efficiency of web applications by allowing for better use of cache while minimizing the load on the server. The concept of donut caching involves caching the entire response for a web page except for parts that change frequ... | 32,244 | [
{
"from": "human",
"value": "And by donut caching, I'm refering to Scott Guthrie's blog post which is awesome.\nDoes anyone know if that works properly?\n"
},
{
"from": "gpt",
"value": "Scott Guthrie's blog post on donut caching discusses a caching technique designed to improve the efficiency of... |
I have a flash app in my page, and when a user interacts with the flash app, the browser/html/javascript stops receiving keyboard input.
For example, in Firefox control-t no longer opens a new tab.
However, if I click on part of the page that isn't flash, the browser starts receiving these events again.
Is there anyw... | The issue you're encountering is a common one with Flash content, as it tends to take focus away from the browser when users interact with it. Unfortunately, there is no direct way to programmatically shift focus back to the browser using Flash or JavaScript because of the inherent focus management in the browser.
Ho... | 29,076 | [
{
"from": "human",
"value": "I have a flash app in my page, and when a user interacts with the flash app, the browser/html/javascript stops receiving keyboard input. \nFor example, in Firefox control-t no longer opens a new tab.\nHowever, if I click on part of the page that isn't flash, the browser starts ... |
Up until now I have been using std::string in my C++ applications for embedded system (routers, switches, telco gear, etc.).
For the next project, I am considering to switch from std::string to std::wstring for Unicode support. This would, for example, allow end-users to use Chinese characters in the command line inter... | Switching from `std::string` to `std::wstring` in your C++ embedded applications for Unicode support can indeed enable you to handle international strings, but it does come with its own set of complications and considerations. Here are some of the major issues you might encounter:
### 1. **Compatibility with Third-Par... | 27,032 | [
{
"from": "human",
"value": "Up until now I have been using std::string in my C++ applications for embedded system (routers, switches, telco gear, etc.).\nFor the next project, I am considering to switch from std::string to std::wstring for Unicode support. This would, for example, allow end-users to use Ch... |
Please forgive my long question. I have an idea for a design that I could use some comments on. Is it a good idea to do this? And what are the pit falls I should be aware of? Are there other similar implementations that are better?
My situation is as follows:
I am working on a rewrite of a windows forms application tha... | Your design idea of splitting the database into a master database and several child databases for each construction is an interesting approach, especially given the scale of your data and the performance issues you are encountering. However, there are several considerations, potential pitfalls, and alternative strategi... | 26,952 | [
{
"from": "human",
"value": "Please forgive my long question. I have an idea for a design that I could use some comments on. Is it a good idea to do this? And what are the pit falls I should be aware of? Are there other similar implementations that are better?\nMy situation is as follows:\nI am working on a... |
I got this error when trying to update an image.
It was a cross-thread update, but I used .Invoke(), so that shouldn't be the problem, should it.
| If you are encountering a cross-thread update error despite using `.Invoke()`, there are a few things you should check:
1. **Ensure Proper Use of `.Invoke()`:** Make sure you're using `.Invoke()` correctly. It should look something like this:
```csharp
if (yourControl.InvokeRequired)
{
yourControl.Inv... | 28,406 | [
{
"from": "human",
"value": "I got this error when trying to update an image.\nIt was a cross-thread update, but I used .Invoke(), so that shouldn't be the problem, should it.\n"
},
{
"from": "gpt",
"value": "If you are encountering a cross-thread update error despite using `.Invoke()`, there ar... |
If I import a library to use a method, would it be worth it? Does importing take up a lot of memory?
| Importing a library in a programming language typically allows you to use a wide range of pre-built functions, classes, and methods, which can save you significant time and effort compared to writing the code from scratch. Whether it is worth it depends on several factors:
1. **Functionality**: Libraries often provide... | 30,442 | [
{
"from": "human",
"value": "If I import a library to use a method, would it be worth it? Does importing take up a lot of memory?\n"
},
{
"from": "gpt",
"value": "Importing a library in a programming language typically allows you to use a wide range of pre-built functions, classes, and methods, ... |
I was wondering what would be the best approach you guys would take to relocate an entire Eclipse workspace? Assuming it's either versioned and exported, what would you do? Import the file? Checkout the whole thing from the repo? Thanks much in advance!
| Relocating an Eclipse workspace, especially one that's versioned and exported, requires careful consideration to ensure that all settings, projects, and configurations are preserved. Here’s a step-by-step approach that you could take:
### Step 1: Backup Your Current Workspace
Before making any changes, it’s a good ide... | 29,476 | [
{
"from": "human",
"value": "I was wondering what would be the best approach you guys would take to relocate an entire Eclipse workspace? Assuming it's either versioned and exported, what would you do? Import the file? Checkout the whole thing from the repo? Thanks much in advance!\n"
},
{
"from": "... |
I have an IList of type Breadcrumb which is just a lightweight class that has NavigationTitle, NavigationUrl and IsCurrent properties. It is cached on the webserver. I have a method that builds out the current breadcrumb trail up until the first Breadcrumb that has IsCurrent set to true... using the code below. Its ver... | Certainly! Your current approach can be refactored using LINQ to make it more concise and readable. The goal is to find and collect all `Breadcrumb` items up to (but not including) the first one that has the `IsCurrent` property set to true. Here's a way to do that using LINQ:
```csharp
IList<Breadcrumb> crumbs = cach... | 31,184 | [
{
"from": "human",
"value": "I have an IList of type Breadcrumb which is just a lightweight class that has NavigationTitle, NavigationUrl and IsCurrent properties. It is cached on the webserver. I have a method that builds out the current breadcrumb trail up until the first Breadcrumb that has IsCurrent set... |
I have quickly read over the Microsoft Lambda Expression documentation.
This kind of example has helped me to understand better, though:
delegate int del(int i);
del myDelegate = x => x * x;
int j = myDelegate(5); //j = 25
Still, I don't understand why it's such an innovation. It's just a method that dies when the "m... | You're correct in observing that a lambda expression can be viewed as a concise way to write a method. However, there are several key reasons why lambda expressions are considered a significant innovation in languages like C# and many others:
### 1. **Conciseness and Readability**
Lambda expressions allow you to defin... | 27,069 | [
{
"from": "human",
"value": "I have quickly read over the Microsoft Lambda Expression documentation.\nThis kind of example has helped me to understand better, though: \ndelegate int del(int i);\ndel myDelegate = x => x * x;\nint j = myDelegate(5); //j = 25\n\nStill, I don't understand why it's such an innov... |
What is the purpose of the colon before a block in Python?
Example:
if n == 0:
print "The end"
| In Python, a colon (`:`) is used to indicate the start of an indented block of code that belongs to a control structure (like `if`, `for`, `while`, `def`, `class`, etc.). It serves as a syntactical marker that signals to the interpreter that the following lines will be part of the block associated with that control str... | 31,106 | [
{
"from": "human",
"value": "What is the purpose of the colon before a block in Python?\nExample:\nif n == 0:\n print \"The end\"\n\n"
},
{
"from": "gpt",
"value": "In Python, a colon (`:`) is used to indicate the start of an indented block of code that belongs to a control structure (like `i... |
I'm playing around with LinqToSQL using an existing multi-lingual database, but I'm running into issues mapping a fairly important one-to-one relationship, so I suspect I am using the feature incorrectly for my database design.
Assume two tables, Category and CategoryDetail. Category contains the CategoryId (PK), Paren... | You're correct in your observation that the relationship in your LinqToSQL model is not properly reflecting your database design, which can lead to complications in filtering by `LanguageId` and accessing `CategoryDetail` data.
In your case, since a `Category` has a one-to-one relationship with a `CategoryDetail` (for... | 22,304 | [
{
"from": "human",
"value": "I'm playing around with LinqToSQL using an existing multi-lingual database, but I'm running into issues mapping a fairly important one-to-one relationship, so I suspect I am using the feature incorrectly for my database design.\nAssume two tables, Category and CategoryDetail. Ca... |
I'm interested in knowing how many developers use each of the major languages/platforms, but I haven't been able to find any good recent surveys. If you know of any good data, please provide a link along with a brief synopsis of the survey's methodology (who they surveyed and how etc.) and its conclusions (16% of deve... | While I can't provide real-time data or specific surveys conducted after October 2023, I can summarize some well-known surveys from that period that might be useful for understanding the distribution of developers across various programming languages and platforms.
### 1. Stack Overflow Developer Survey 2023
- **Metho... | 28,093 | [
{
"from": "human",
"value": "I'm interested in knowing how many developers use each of the major languages/platforms, but I haven't been able to find any good recent surveys. If you know of any good data, please provide a link along with a brief synopsis of the survey's methodology (who they surveyed and h... |
Can anyone recommend some useful performance analysis tools for PHP scripts? Anything that could help me find problematic or unusually slow blocks of code, details about execution time, etc. would be really helpful. I know there are tools out there, but I'm wondering what people recommend as being the most useful and w... | Certainly! There are several performance analysis tools that can help you analyze and optimize your PHP scripts. Here are some of the most popular and well-designed options:
1. **Xdebug**:
- Xdebug is a powerful PHP extension that provides debugging and profiling capabilities. It allows you to profile your PHP scr... | 26,019 | [
{
"from": "human",
"value": "Can anyone recommend some useful performance analysis tools for PHP scripts? Anything that could help me find problematic or unusually slow blocks of code, details about execution time, etc. would be really helpful. I know there are tools out there, but I'm wondering what people... |
It seems that the decision to make your objects fully cognizant of their roles within the system, and still avoid having too many dependencies within the domain model on the database, and service layers?
For example: Say that I've got an entity with a revision history, and several "lookup tables" that the data referenc... | Your concerns about the design and complexity of your domain model are quite valid. Striking the right balance between making objects aware of their responsibilities and keeping them decoupled from the underlying data access layer is essential for maintainability and clarity. Here are some guiding principles and design... | 25,662 | [
{
"from": "human",
"value": "It seems that the decision to make your objects fully cognizant of their roles within the system, and still avoid having too many dependencies within the domain model on the database, and service layers?\nFor example: Say that I've got an entity with a revision history, and seve... |
I'm programming an online game for two reasons, one to familiarize myself with server/client requests in a realtime environment (as opposed to something like a typical web browser, which is not realtime) and to actually get my hands wet in that area, so I can proceed to actually properly design one.
Anywho, I'm doing t... | You're on the right track by considering multithreading for your game networking logic. In C++, especially on Windows, you can effectively manage concurrency with threads and use synchronization primitives to avoid issues such as race conditions. Here’s a structured way to implement your idea:
### Using Threads and Ev... | 22,421 | [
{
"from": "human",
"value": "I'm programming an online game for two reasons, one to familiarize myself with server/client requests in a realtime environment (as opposed to something like a typical web browser, which is not realtime) and to actually get my hands wet in that area, so I can proceed to actually... |
I have a small financial application with PHP as the front end and MySQL as the back end. I have ancient prejudices, and I store money values in MySQL as an integer of cents. My HTML forms allow input of dollar values, like "156.64" and I use PHP to convert that to cents and then I store the cents in the database.
I ha... | The issue you are experiencing with the conversion from dollar values to cents using `($dollars * 100)` is due to how floating-point arithmetic works in computers. Specifically, floating-point numbers cannot represent all decimal fractions exactly, which leads to precision errors when you perform arithmetic operations ... | 28,663 | [
{
"from": "human",
"value": "I have a small financial application with PHP as the front end and MySQL as the back end. I have ancient prejudices, and I store money values in MySQL as an integer of cents. My HTML forms allow input of dollar values, like \"156.64\" and I use PHP to convert that to cents and t... |
I'll preface this by saying that I usually work in C#/.Net.
Normally, I use a naming scheme that puts common, reusable components into a namespace that reflects our organization and project-specific components into a namespace tied to the project. One of the reasons I do this is that I sometimes share my components wi... | Your approach to naming namespaces is well thought out and reflects a solid understanding of both organizational structure and the potential need for code reuse. Given your situation, where the project in question may be used beyond your immediate department and could be marketed externally, here are some suggestions a... | 27,121 | [
{
"from": "human",
"value": "I'll preface this by saying that I usually work in C#/.Net.\nNormally, I use a naming scheme that puts common, reusable components into a namespace that reflects our organization and project-specific components into a namespace tied to the project. One of the reasons I do this ... |
I need to store log files and configuration files for my application. Where is the best place to store them?
Right now, I'm just using the current directory, which ends up putting them in the Program Files directory where my program lives.
The log files will probably be accessed by the user somewhat regularly, so %APPD... | When deciding where to store log files and configuration files for your application on Windows, it is essential to consider user accessibility, platform compatibility, and best practices for software development. Here are some recommended locations based on your requirements:
### Configuration Files
For configuration ... | 28,974 | [
{
"from": "human",
"value": "I need to store log files and configuration files for my application. Where is the best place to store them?\nRight now, I'm just using the current directory, which ends up putting them in the Program Files directory where my program lives.\nThe log files will probably be access... |
I would like to know if someone triend exporting data from MySQL to an ODF format ?
Any information / documentation would be very much appreciated.
I am going to try to export a MySQL result set to ODF spreadsheet if possible.
| Exporting data from MySQL to an ODF (Open Document Format) spreadsheet can be accomplished using various methods and tools. Here’s a general overview of approaches you can take:
### Method 1: Using a Programming Language (Python)
You can use Python with libraries such as `pandas` and `odfpy` or `pyexcel-ods`. This me... | 29,082 | [
{
"from": "human",
"value": "I would like to know if someone triend exporting data from MySQL to an ODF format ?\nAny information / documentation would be very much appreciated.\nI am going to try to export a MySQL result set to ODF spreadsheet if possible.\n"
},
{
"from": "gpt",
"value": "Expor... |
In MS SQL 2005 or T-SQL, you can do something like:
SELECT T.NAME, T.DATE
FROM (SELECT * FROM MyTable WHERE ....) AS T
I failed to try the similar SQL on Oracle 9i DB. In MS SQL, the nested SQL is treated as a temporary/dynamic view created on fly and destroyed afterward. How can I do the similar thing in Oracle? I... | In Oracle, you can achieve similar functionality using a subquery in the `FROM` clause, just like in SQL Server. This allows you to treat a result set as a temporary table for the scope of your query. Here’s how you can structure your query in Oracle:
```sql
SELECT T.NAME, T.DATE
FROM (SELECT * FROM MyTable WHERE <yo... | 32,499 | [
{
"from": "human",
"value": "In MS SQL 2005 or T-SQL, you can do something like:\nSELECT T.NAME, T.DATE \n FROM (SELECT * FROM MyTable WHERE ....) AS T\n\nI failed to try the similar SQL on Oracle 9i DB. In MS SQL, the nested SQL is treated as a temporary/dynamic view created on fly and destroyed afterward... |
I am having trouble deploying an ASP.NET MVC app to IIS7.
I have an MVC project created with ASP.NET MVC Beta 1. It consists of nothing more than the default template unmodified.
The app runs just fine within VS2008, but when I publish it to a local IIS7 website (http://localhost), I get the following server error:
... | It sounds like you’re experiencing common issues when deploying an ASP.NET MVC application to IIS. Here are some steps to troubleshoot and fix the "The incoming request does not match any route" error:
1. **Check Your Application's URL Rewrite**:
Make sure your `web.config` file has the necessary configuration for ... | 26,835 | [
{
"from": "human",
"value": "I am having trouble deploying an ASP.NET MVC app to IIS7. \nI have an MVC project created with ASP.NET MVC Beta 1. It consists of nothing more than the default template unmodified. \nThe app runs just fine within VS2008, but when I publish it to a local IIS7 website (http://loca... |
I'm perhaps being a bit lazy asking this here, but I'm just getting started with LINQ and I have a function that I am sure can be turned into two LINQ queries (or one nested query) rather than a LINQ and a couple of foreach statements. Any LINQ gurus care to refactor this one for me as an example?
The function itself l... | Sure! You can use LINQ to simplify your function and eliminate the need for the `foreach` loops. Instead of using the `yield return` statement, you can directly project the file paths into a single collection and return it as an `IEnumerable<string>`. Here's a refactored version of your function:
```csharp
static IEnu... | 32,464 | [
{
"from": "human",
"value": "I'm perhaps being a bit lazy asking this here, but I'm just getting started with LINQ and I have a function that I am sure can be turned into two LINQ queries (or one nested query) rather than a LINQ and a couple of foreach statements. Any LINQ gurus care to refactor this one fo... |
Possible Duplicate:
Upload files directly to Amazon S3 from ASP.NET application
My ASP.NET MVC application will take a lot of bandwidth and storage space. How can I setup an ASP.NET upload page so the file the user uploaded will go straight to Amazon S3 without using my web server's storage and bandwidth?
| To allow users to upload files directly to Amazon S3 without going through your ASP.NET MVC application's server, you can implement a direct upload mechanism using AWS SDK for JavaScript and Amazon S3. Here’s a step-by-step guide to achieve this:
### Prerequisites:
1. **AWS Account**: Make sure you have an AWS accoun... | 21,493 | [
{
"from": "human",
"value": "\nPossible Duplicate:\nUpload files directly to Amazon S3 from ASP.NET application \n\nMy ASP.NET MVC application will take a lot of bandwidth and storage space. How can I setup an ASP.NET upload page so the file the user uploaded will go straight to Amazon S3 without using my w... |
i'm trying to change the number of rows in a TableLayoutPanel programatically (sometimes it needs to be four, sometimes five, and rarely six).
Unfortunatly changing the number of rows does not keep the RowStyles collection in sync, so you are then not able to set the height of the newly added rows. The following test c... | When you change the `RowCount` property of a `TableLayoutPanel` programmatically, the `RowStyles` collection does not automatically update to match the new row count. To maintain synchronization between the number of rows and the `RowStyles`, you need to manually adjust the `RowStyles` collection after changing `RowCou... | 27,009 | [
{
"from": "human",
"value": "i'm trying to change the number of rows in a TableLayoutPanel programatically (sometimes it needs to be four, sometimes five, and rarely six).\nUnfortunatly changing the number of rows does not keep the RowStyles collection in sync, so you are then not able to set the height of ... |
I'm building an application using the Supervising Controller pattern (Model View Presenter) and I am facing a difficulty. In my page I have a repeater control that will display each item of a collection I am passing to it. The reapeater item contains 2 dropdown list that allow the user to select a particular value. Whe... | In the Supervising Controller pattern (a variation of Model-View-Presenter), the goal is to keep the responsibilities of your components separate and maintain a clear communication flow between the View, Presenter, and Model. In your case, you're working with a repeater control that contains dropdowns, and you want to ... | 28,561 | [
{
"from": "human",
"value": "I'm building an application using the Supervising Controller pattern (Model View Presenter) and I am facing a difficulty. In my page I have a repeater control that will display each item of a collection I am passing to it. The reapeater item contains 2 dropdown list that allow t... |
I am trying this in my Form Load Event
cmdCancel.Attributes.Add("onClick", "document.forms[0].reset();return false;")
but it doesn't clear my form. My form is a "ContentPage", part of a masterpage.
Am I missing something?
| It looks like you're trying to reset a form when a button (cmdCancel) is clicked, but you are not seeing the expected results. Here are a few points to check and some suggestions to help you troubleshoot and resolve the issue:
1. **Ensure that `cmdCancel` is a button**: Confirm that the `cmdCancel` control is indeed a... | 27,612 | [
{
"from": "human",
"value": "I am trying this in my Form Load Event\n\ncmdCancel.Attributes.Add(\"onClick\", \"document.forms[0].reset();return false;\")\n\nbut it doesn't clear my form. My form is a \"ContentPage\", part of a masterpage.\nAm I missing something?\n"
},
{
"from": "gpt",
"value": ... |
I guess this is a multi-part question. I am building a membership site and want to have the accounts as international as possible.
What is the best way to collect phone numbers on a form that allows for international numbers? I'm not worried about storing them, just collection and validation. What I have now is a d... | Building an international membership site with proper handling of phone numbers and addresses is an excellent idea, as it enhances user experience and ensures that you can interact effectively with your members globally. Below are some suggestions and resources for both phone number and address collection:
### Phone N... | 28,529 | [
{
"from": "human",
"value": "I guess this is a multi-part question. I am building a membership site and want to have the accounts as international as possible.\n\nWhat is the best way to collect phone numbers on a form that allows for international numbers? I'm not worried about storing them, just collect... |
The event returns a standardized timestamp in the format of "Sat Oct 25 21:55:29 +0000 2008"
How can I compare this with the current time in PHP so that it gives me the result in a form like "It has been 15 minutes!" or "It has been three days!" Also, how can I get the current time?
| To compare a standardized timestamp like "Sat Oct 25 21:55:29 +0000 2008" with the current time in PHP and produce a human-readable difference (like "It has been 15 minutes!" or "It has been three days!"), you can use the `DateTime` class. Here's how you can do this:
1. Parse the standardized timestamp into a `DateTim... | 26,954 | [
{
"from": "human",
"value": "The event returns a standardized timestamp in the format of \"Sat Oct 25 21:55:29 +0000 2008\"\nHow can I compare this with the current time in PHP so that it gives me the result in a form like \"It has been 15 minutes!\" or \"It has been three days!\" Also, how can I get the cu... |
Is there a way to define a macro that contains a #include
directive in its body?
If I just put
the "#include", it gives the error
C2162: "expected macro formal parameter"
since here I am not using # to concatenate strings.
If I use "\# include", then I receive the following two errors:
error C2017: illegal escape seq... | In C and C++ preprocessor macros, the `#include` directive cannot be included directly in the body of a macro. The preprocessor does not allow `#include` within macro definitions, which is why you're encountering errors.
Instead of trying to include a file through a macro, the typical way to handle includes is to use ... | 31,598 | [
{
"from": "human",
"value": "Is there a way to define a macro that contains a #include\ndirective in its body?\nIf I just put\nthe \"#include\", it gives the error\nC2162: \"expected macro formal parameter\"\n\nsince here I am not using # to concatenate strings.\nIf I use \"\\# include\", then I receive th... |
I have a class that subclasses NSMutableArray.
I init it using:
MyClass class = [MyClass arrayWithContentsOfFile:path];
When i try to access any of my subclass methods the app crashes with this error:
-[NSCFArray loadCards]: unrecognized selector sent to instance 0x454a30
* Terminating app due to uncaught exceptio... | You're correct in your assumption that the issue arises from how `arrayWithContentsOfFile:` behaves. The method `arrayWithContentsOfFile:` returns an instance of `NSArray` (or a subclass like `NSCFArray`), which does not know about your custom methods defined in your `MyClass`. As a result, when you try to call a metho... | 27,034 | [
{
"from": "human",
"value": "I have a class that subclasses NSMutableArray.\nI init it using:\n\nMyClass class = [MyClass arrayWithContentsOfFile:path];\n\nWhen i try to access any of my subclass methods the app crashes with this error:\n\n-[NSCFArray loadCards]: unrecognized selector sent to instance 0x454... |
I have a class which extends DefaultTableCellRenderer, which renders strings in a monospace font, with a particular color. By default, it appears that tabs are not rendered at all (0 spaces). How can I set the tab size and/or cause them to be rendered?
edits:
By "tabs" I mean tab characters, which I would just like to ... | In Swing, the `DefaultTableCellRenderer` does not automatically render tab characters as spaces, which is why you see them as blank. To achieve the effect you want, you have a couple of options:
1. **Override the `getTableCellRendererComponent` method**: This method allows you to modify the string before rendering. Yo... | 25,788 | [
{
"from": "human",
"value": "I have a class which extends DefaultTableCellRenderer, which renders strings in a monospace font, with a particular color. By default, it appears that tabs are not rendered at all (0 spaces). How can I set the tab size and/or cause them to be rendered?\nedits:\nBy \"tabs\" I mea... |
we have a old and dying dedicated server. we want a new one at a new datacenter. we have a bunch of sites using the current server and don't have control of all their DNS. is there an easy way to redirect all the traffic from xx.xx.xx.xx to zz.zz.zz.zz without updating DNS records?
Thanks.
| If you want to redirect traffic from your old dedicated server (with IP address `xx.xx.xx.xx`) to the new server (with IP address `zz.zz.zz.zz`) without updating DNS records, you can achieve this by setting up a reverse proxy on the old server. Here's a general approach using Nginx or Apache as a reverse proxy:
### Us... | 27,670 | [
{
"from": "human",
"value": "we have a old and dying dedicated server. we want a new one at a new datacenter. we have a bunch of sites using the current server and don't have control of all their DNS. is there an easy way to redirect all the traffic from xx.xx.xx.xx to zz.zz.zz.zz without updating DNS recor... |
This is a problem I've had on my mind for a long time. Being the son of a teacher and a programmer, it occurred to me early on... but I still haven't found a solution for it.
So this is the problem. One needs to create a time schedule for a school, using some constraints. These are generally divided in two categories:
... | The problem you've described is indeed similar to a well-known NP-hard problem called the "School Timetabling Problem" (STP). In the STP, you need to assign teachers and subjects to time slots in a way that satisfies various constraints (sanity checks and preferences). This problem shares characteristics with other sch... | 23,055 | [
{
"from": "human",
"value": "This is a problem I've had on my mind for a long time. Being the son of a teacher and a programmer, it occurred to me early on... but I still haven't found a solution for it.\nSo this is the problem. One needs to create a time schedule for a school, using some constraints. These... |
I'm working on a programming problem which boils down to a set of an equation and inequality:
x[0]*a[0] + x[1]*a[1] + ... x[n]*a[n] >= D
x[0]*b[0] + x[1]*b[1] + ... x[n]*b[n] = C
I want to solve for the values of X that will give the absolute minimum of C, given the input D and lists and A and B consisting of a[0 - n... | To solve the problem of minimizing \( C \) under the constraints provided, you can formulate this as a linear programming problem. Specifically, you want to minimize \( C \) subject to the constraints of an inequality and an equation, with the additional restriction that the variables \( x[i] \) are non-negative intege... | 23,495 | [
{
"from": "human",
"value": "I'm working on a programming problem which boils down to a set of an equation and inequality:\nx[0]*a[0] + x[1]*a[1] + ... x[n]*a[n] >= D\nx[0]*b[0] + x[1]*b[1] + ... x[n]*b[n] = C\n\nI want to solve for the values of X that will give the absolute minimum of C, given the input ... |
I've been writing a lot recently about Parallel computing and programming and I do notice that there are a lot of patterns that come up when it comes to parallel computing. Noting that Microsoft already has released a library along with the Microsoft Visual C++ 2010 Community Technical Preview (named Parallel Patterns ... | Parallel programming involves several common patterns and idioms that help to simplify the process of writing concurrent code and managing the complexities associated with it. Here are some well-established patterns and practices that you might find useful as you work with parallel computing in C++:
### 1. **Map-Reduc... | 27,185 | [
{
"from": "human",
"value": "I've been writing a lot recently about Parallel computing and programming and I do notice that there are a lot of patterns that come up when it comes to parallel computing. Noting that Microsoft already has released a library along with the Microsoft Visual C++ 2010 Community Te... |
we need reports in our web application and there is the free ReportViewer Control from microsoft (normally used, to display reports from the reporting services). I like the fact, that the Report Format (.RDL-Format) from the ReportViewer is a documented XML-Format. But the functionality is somewhat limited, when the Re... | If you're looking for an alternative to the Microsoft ReportViewer Control that is compatible with the RDL format and offers more flexibility, you have a few options to consider. Here are some recommended alternatives that you can explore for your ASP.NET web application:
### 1. **Microsoft Power BI Report Server**
... | 26,742 | [
{
"from": "human",
"value": "we need reports in our web application and there is the free ReportViewer Control from microsoft (normally used, to display reports from the reporting services). I like the fact, that the Report Format (.RDL-Format) from the ReportViewer is a documented XML-Format. But the funct... |
I'm looking for a method to reliably extract the host name from a URL string in Ruby.
e.g.
http://www.mglenn.com/directory = www.mglenn.com
OR
http://www.mglenn.com?param=x = www.mglenn.com
| You can reliably extract the host name from a URL string in Ruby by using the `URI` module, which is part of Ruby's standard library. The `URI` module provides a way to parse a URL into its components, including the host.
Here's how you can do it:
```ruby
require 'uri'
def extract_host_name(url)
uri = URI.parse(ur... | 31,813 | [
{
"from": "human",
"value": "I'm looking for a method to reliably extract the host name from a URL string in Ruby.\ne.g. \nhttp://www.mglenn.com/directory = www.mglenn.com\nOR\nhttp://www.mglenn.com?param=x = www.mglenn.com\n"
},
{
"from": "gpt",
"value": "You can reliably extract the host name ... |
What program can I use to decompile a class file? Will I actually get Java code, or is it just JVM assembly code?
On Java performance questions on this site I often see responses from people who have "decompiled" the Java class file to see how the compiler optimizes certain things.
| To decompile a Java class file back into Java source code, you can use several popular tools. Here are a few of the most commonly used Java decompilers:
1. **JD-GUI**: This is a graphical utility that lets you browse the reconstructed source code of Java class files. You can also save the decompiled code to .java file... | 30,764 | [
{
"from": "human",
"value": "What program can I use to decompile a class file? Will I actually get Java code, or is it just JVM assembly code?\nOn Java performance questions on this site I often see responses from people who have \"decompiled\" the Java class file to see how the compiler optimizes certain t... |
This maybe a stupid question, but as I can not easily undo my change if I decide to do it, I think i'd ask here first:
I got a Sharepoint 2007 Server. Pretty standard stuff: Windows 2003 (32-Bit), IIS 6, Sharepoint 2007, .net 3.0.
At the moment, I use Visual Studio 2005 with .net 3.0 as my target. However, I'd like to ... | Your question is not stupid at all! It's great that you're being cautious about making changes to your SharePoint 2007 environment.
1. **Installing .NET Framework 3.5 SP1**: You can install .NET Framework 3.5 SP1 on your Windows Server 2003 (which is running SharePoint 2007) without major issues. .NET 3.5 is designed ... | 26,623 | [
{
"from": "human",
"value": "This maybe a stupid question, but as I can not easily undo my change if I decide to do it, I think i'd ask here first:\nI got a Sharepoint 2007 Server. Pretty standard stuff: Windows 2003 (32-Bit), IIS 6, Sharepoint 2007, .net 3.0.\nAt the moment, I use Visual Studio 2005 with .... |
I have implemented a simple file upload-download mechanism. When a user clicks a file name, the file is downloaded with these HTTP headers:
HTTP/1.1 200 OK
Date: Tue, 30 Sep 2008 14:00:39 GMT
Server: Microsoft-IIS/6.0
Content-Disposition: attachment; filename=filename.doc;
Content-Type: application/octet-stream
Content... | The issue you're encountering with the long file names and the specific characters (like the dot) seems to be related to how various browsers handle `Content-Disposition` headers and URL encoding.
### Key Points to Consider:
1. **Browser Behavior**: Different browsers have different ways of interpreting file names in... | 27,395 | [
{
"from": "human",
"value": "I have implemented a simple file upload-download mechanism. When a user clicks a file name, the file is downloaded with these HTTP headers:\nHTTP/1.1 200 OK\nDate: Tue, 30 Sep 2008 14:00:39 GMT\nServer: Microsoft-IIS/6.0\nContent-Disposition: attachment; filename=filename.doc;\n... |
I have the following snippet of code, changeTextArea is a TextArea object.
changeTextArea.addKeyboardListener(new KeyboardListenerAdapter()
public void onKeyPress( Widget sender, char keyCode, int modifier){
//do something
//I WISH TO STOP THE EVENT THAT MAPS TO THIS KEYPRESS FROM BUBBLING ANY FURTHER
}
}
... | To stop the event that maps to the key press from bubbling up from the `changeTextArea` to its parent widgets, you need to use the `Event.cancelBubble()` method. In the context of GWT (Google Web Toolkit), you can achieve this by making a slight adjustment to your event handling method.
Here’s how you can modify your ... | 30,589 | [
{
"from": "human",
"value": "I have the following snippet of code, changeTextArea is a TextArea object.\nchangeTextArea.addKeyboardListener(new KeyboardListenerAdapter()\n public void onKeyPress( Widget sender, char keyCode, int modifier){\n //do something\n //I WISH TO STOP THE EVENT THAT MAPS TO TH... |
I have this ListBox which is bound to an ObservableCollection. Each object in the list implements an interface called ISelectable
public interface ISelectable : INotifyPropertyChanged
{
event EventHandler IsSelected;
bool Selected { get; set; }
string DisplayText { get; }
}
I want to keep track of which o... | It sounds like you're trying to keep the selection state of your objects in sync with the `ListBox`, but you're running into an issue where the `ListBox` does not reflect programmatic changes to the selection state.
To achieve the desired behavior, you can utilize the `ListBox`'s `SelectedItem` property to directly b... | 28,253 | [
{
"from": "human",
"value": "I have this ListBox which is bound to an ObservableCollection. Each object in the list implements an interface called ISelectable \npublic interface ISelectable : INotifyPropertyChanged\n{\n event EventHandler IsSelected;\n bool Selected { get; set; }\n string DisplayTe... |
How do I enable assembly bind failure logging (Fusion) in .NET?
| Enabling assembly bind failure logging, commonly referred to as Fusion logging, is a useful way to diagnose issues related to assembly binding in .NET applications. You can enable Fusion logging by modifying the registry settings or using the Fusion Log Viewer tool. Here are the steps for both methods:
### Method 1: U... | 27,030 | [
{
"from": "human",
"value": "How do I enable assembly bind failure logging (Fusion) in .NET?\n"
},
{
"from": "gpt",
"value": "Enabling assembly bind failure logging, commonly referred to as Fusion logging, is a useful way to diagnose issues related to assembly binding in .NET applications. You c... |
I am currently working on my first website. I have no idea where to start on the CSS page, or if there are any standards that I should be following.
I would appreciate any links or first-hand advise.
| Congratulations on starting your first website! CSS (Cascading Style Sheets) is an essential part of web development that allows you to control the presentation and layout of your website. Here are some guidelines and resources to help you get started with CSS:
### Basic CSS Concepts
1. **Selectors**: Select the HTML... | 26,470 | [
{
"from": "human",
"value": "I am currently working on my first website. I have no idea where to start on the CSS page, or if there are any standards that I should be following.\nI would appreciate any links or first-hand advise.\n"
},
{
"from": "gpt",
"value": "Congratulations on starting your... |
I'm trying to read variables from a batch file for later use in the batch script, which is a Java launcher. I'd ideally like to have the same format for the settings file on all platforms (Unix, Windows), and also be a valid Java Properties file. That is, it should look like this:
setting1=Value1
setting2=Value2
...
I... | You can read variables from a properties file in a batch script while maintaining a consistent file format across platforms. However, batch files (Windows) do not have built-in support for parsing properties files directly. You can achieve your goal by using a simple utility that reads the properties file and sets the ... | 28,515 | [
{
"from": "human",
"value": "I'm trying to read variables from a batch file for later use in the batch script, which is a Java launcher. I'd ideally like to have the same format for the settings file on all platforms (Unix, Windows), and also be a valid Java Properties file. That is, it should look like thi... |
In Visual Studio I have set up a DetailsView and an ObjectDataSource which connects with my BLL.
<asp:DetailsView runat="server" ID="UserProfileview" DataSourceID="UserData" AutoGenerateRows="False">
<asp:ObjectDataSource ID="UserData" runat="server" TypeName="UoM.Business.Core.UserAccount" SelectMethod="Read">
<Sele... | To automatically generate the fields for your `DetailsView` in Visual Studio from your `ObjectDataSource`, you typically want to set the `DataSource` of the `DetailsView` to your `ObjectDataSource` and ensure that the `AutoGenerateRows` property is set to `true`. This will allow the `DetailsView` to automatically gener... | 29,166 | [
{
"from": "human",
"value": "In Visual Studio I have set up a DetailsView and an ObjectDataSource which connects with my BLL.\n<asp:DetailsView runat=\"server\" ID=\"UserProfileview\" DataSourceID=\"UserData\" AutoGenerateRows=\"False\">\n\n\n<asp:ObjectDataSource ID=\"UserData\" runat=\"server\" TypeName=\... |
What's the best way to use NaNs in C++?
I found std::numeric_limits<double>::quiet_NaN() and std::numeric_limits<double>::signaling_NaN(). I'd like to use signaling_NaN to represent an uninitialized variable as follows:
double diameter = std::numeric_limits<double>::signaling_NaN();
This, however, signals (raises an ... | In C++, the behavior of `signaling_NaN` (sNaN) is defined in such a way that it signals an exception when an operation is performed on it, not necessarily when it is assigned. However, the specifics of exception handling and floating-point behavior can depend on your compiler, architecture, and settings.
The key behav... | 24,582 | [
{
"from": "human",
"value": "What's the best way to use NaNs in C++?\nI found std::numeric_limits<double>::quiet_NaN() and std::numeric_limits<double>::signaling_NaN(). I'd like to use signaling_NaN to represent an uninitialized variable as follows:\ndouble diameter = std::numeric_limits<double>::signaling... |
So I've created a custom RenderingTemplate and deployed it to CONTROLTEMPLATES\MyControlTemplates\
It basically dictates how a custom content type that i've created should be rendered when displayed. For that I've added this:
<FormTemplates xmlns="http://schemas.microsoft.com/sharepoint/v3/contenttype/forms">
<Displ... | When working with SharePoint and custom RenderingTemplates, it can indeed be frustrating if the system does not behave as expected. According to the documentation, SharePoint should be able to find RenderingTemplates in subdirectories under `CONTROLTEMPLATES`. However, there are a few nuances that might lead to the iss... | 22,705 | [
{
"from": "human",
"value": "So I've created a custom RenderingTemplate and deployed it to CONTROLTEMPLATES\\MyControlTemplates\\ \nIt basically dictates how a custom content type that i've created should be rendered when displayed. For that I've added this:\n<FormTemplates xmlns=\"http://schemas.microsoft.... |
Is there a dialect of XML for defining the tables, indexes and relations of a relational database, and a "compiler" or stylesheet to transform that definition into SQL CREATE statements (DDL)?
EG, something that might look like:
<Table Name="orders">
<Column Name="order_id" Type="varchar" Size="20"/>
... etc ..... | Yes, there is a way to define database schema in an XML format, and while there isn't a universally adopted XML dialect for relational databases, several tools and frameworks allow you to define database schemas using XML and then transform them into SQL DDL statements.
One of the more widely known approaches is thro... | 23,963 | [
{
"from": "human",
"value": "Is there a dialect of XML for defining the tables, indexes and relations of a relational database, and a \"compiler\" or stylesheet to transform that definition into SQL CREATE statements (DDL)?\nEG, something that might look like:\n<Table Name=\"orders\">\n <Column Name=\"or... |
I have a windows mobile 5.0 app, written in C++ MFC, with lots of dialogs. One of the devices I'm currently targetting does not have a tab key, so I would like to use another key to move between controls. This is fine for buttons but not edit controls or combo boxes. I have looked at a similar question but the answe... | To achieve custom navigation between controls in a Windows Mobile 5.0 application using MFC, particularly when dealing with `CEdit` and `CComboBox`, there are a few approaches you can consider:
### Option 1: Override the Dialog's PreTranslateMessage
Instead of overriding the `OnKeyDown` method, you can override `PreT... | 23,919 | [
{
"from": "human",
"value": "I have a windows mobile 5.0 app, written in C++ MFC, with lots of dialogs. One of the devices I'm currently targetting does not have a tab key, so I would like to use another key to move between controls. This is fine for buttons but not edit controls or combo boxes. I have l... |
Curious to know how people set up their personal and/or work development environment, in terms of:
Do you just have all of your developer tools (for example Visual Studio, SSMS, etc.) installed on your main operating system;
Do you use Virtual Machines to have a separate "clean" dev environment that consists only of th... | Setting up a personal or work development environment can vary significantly based on individual preferences, project requirements, and organizational policies. Here's a breakdown of various approaches people take, including their advantages and disadvantages:
### 1. **Single OS Installation**
- **Description**: Al... | 25,207 | [
{
"from": "human",
"value": "Curious to know how people set up their personal and/or work development environment, in terms of:\nDo you just have all of your developer tools (for example Visual Studio, SSMS, etc.) installed on your main operating system;\nDo you use Virtual Machines to have a separate \"cle... |
Is there a better way to implement copy construcor for matlab for a handle derived class other than adding a constructor with one input and explicitly copying its properties?
obj.property1 = from.property1;
obj.property2 = from.property2;
etc.
Thanks,
Dani
| In MATLAB, when dealing with handle classes (which are reference types), implementing a copy constructor can be a bit different than for value classes. Since handle classes do not automatically create a copy of the object when you assign it to another variable, you usually implement a custom copy method.
However, sinc... | 30,421 | [
{
"from": "human",
"value": "Is there a better way to implement copy construcor for matlab for a handle derived class other than adding a constructor with one input and explicitly copying its properties?\nobj.property1 = from.property1; \nobj.property2 = from.property2;\n\netc.\nThanks,\nDani\n"
},
{
... |
I'm currently running Visual Studio 2008 Standard Edition and one of the items they cut out for that edition is the unit testing capability. As a result, when I open up example projects like the MVC commerce test, one of the projects just won't load since it doesn't know to open that type of project.
I know I can just ... | Visual Studio 2008 Standard Edition does indeed have some limitations compared to the Professional Edition, particularly with regard to built-in unit testing capabilities. Here are a few options you can consider for running unit tests in Visual Studio 2008 Standard Edition:
1. **NUnit**: While Visual Studio 2008 does ... | 29,674 | [
{
"from": "human",
"value": "I'm currently running Visual Studio 2008 Standard Edition and one of the items they cut out for that edition is the unit testing capability. As a result, when I open up example projects like the MVC commerce test, one of the projects just won't load since it doesn't know to open... |
I am facing a performance issue on a multi-core (8+) architecture with software written in C++ / VistualStudio / WindowsXP.
Suddenly I realized that I have no idea of the performances of my L1 and L2 cache and CPU->to->Memory bandwidth.
I have tested several tools (including VTune, Glowcode, etc, etc) but all of them f... | Performance analysis on multi-core architectures can indeed be challenging, especially when using tools that may not fully support the complexities of modern hardware. Here are several options you can consider for assessing L1/L2 cache performance and memory bandwidth:
### Tools
1. **PerfMon**:
- Windows Performan... | 23,924 | [
{
"from": "human",
"value": "I am facing a performance issue on a multi-core (8+) architecture with software written in C++ / VistualStudio / WindowsXP.\nSuddenly I realized that I have no idea of the performances of my L1 and L2 cache and CPU->to->Memory bandwidth.\nI have tested several tools (including V... |
I would like to use Linq to Xml to get a single XElement from a .xml file by attribute name, similar to how you retrieve single objects in Linq to Sql by Id below:
var singleDog = context.Dogs.Single(p => p.Id == int.Parse(Id));
Is this possible?
| Yes, you can use LINQ to XML to retrieve a single `XElement` from an XML file based on an attribute value, similar to how you retrieve a single object in LINQ to SQL. Below is an example of how to do this:
### Example XML File (`dogs.xml`)
```xml
<Dogs>
<Dog Id="1" Name="Buddy" />
<Dog Id="2" Name="Max" />
... | 28,491 | [
{
"from": "human",
"value": "I would like to use Linq to Xml to get a single XElement from a .xml file by attribute name, similar to how you retrieve single objects in Linq to Sql by Id below:\nvar singleDog = context.Dogs.Single(p => p.Id == int.Parse(Id));\n\nIs this possible?\n"
},
{
"from": "gpt... |
For instance in the snippet below - how do I access the h1 element knowing the ID of parent element (header-inner div)?
<div id='header-inner'>
<div class='titlewrapper'>
<h1 class='title'>
Some text I want to change
</h1>
</div>
</div>
Thanks!
| To access the `<h1>` element using the ID of the parent element (`header-inner`), you can use JavaScript to navigate the DOM. Here's how you can do it:
```javascript
// Get the parent element by its ID
var headerInner = document.getElementById('header-inner');
// Find the <h1> element within the parent element
var h1... | 31,038 | [
{
"from": "human",
"value": "For instance in the snippet below - how do I access the h1 element knowing the ID of parent element (header-inner div)?\n<div id='header-inner'> \n <div class='titlewrapper'> \n <h1 class='title'> \n Some text I want to change\n </h1> \n </div> \n</div>\n\nTha... |
Currently there are 2 pages in a jsp file: one of them displays the data and the second one is used for pagination. The task is to include exactly the same paginator table above the data table. Sorry, couldn't resist to draw it :)
|-----------------------------------------|
| Page 2 of 200 < > |
|... | To avoid code duplication when including the paginator in both sections of your JSP file, you can create a reusable JSP fragment for the paginator and then include that fragment where necessary. This way, you maintain a single instance of the paginator code that can be reused, making it easier to manage and update.
##... | 27,944 | [
{
"from": "human",
"value": "Currently there are 2 pages in a jsp file: one of them displays the data and the second one is used for pagination. The task is to include exactly the same paginator table above the data table. Sorry, couldn't resist to draw it :)\n|-----------------------------------------|\n| ... |
I have been having some problems trying to get my PHP running. When I try and run any scripts they appear in the source and do not run properly. This is the htaccess file:
# Use PHP5 as default
AddHandler application/x-httpd-php5 .php
AddType x-mapp-php5 .php
AddHandler x-mapp-php5 .php
Could this be the error?
| The issue you're experiencing, where your PHP code appears as plain text in the browser instead of executing, is commonly due to the server not processing the PHP code correctly. From the `.htaccess` file you provided, here are a few things to consider:
### 1. Verify PHP Installation
Make sure that PHP is actually ins... | 26,804 | [
{
"from": "human",
"value": "I have been having some problems trying to get my PHP running. When I try and run any scripts they appear in the source and do not run properly. This is the htaccess file:\n# Use PHP5 as default\nAddHandler application/x-httpd-php5 .php\nAddType x-mapp-php5 .php\nAddHandler x-ma... |
Our application is well structured (well we did our best!) and we have split the Model from the View, Now, we need to let some information to our client with a web access. We would like to build something small with IIS and some webform.
Here some information you might think are useful:
Our controller have Thread of d... | Moving from a WinForms application to a web-based application using IIS and web forms involves several key considerations and steps. Given the details you've provided, here are some suggestions to help you navigate this transition:
### 1. Technology Stack
- **Web Framework**: Given that you are working with C# 2.0, AS... | 22,834 | [
{
"from": "human",
"value": "Our application is well structured (well we did our best!) and we have split the Model from the View, Now, we need to let some information to our client with a web access. We would like to build something small with IIS and some webform.\nHere some information you might think ar... |
If your data change after the application is deployed, how do you keep the database up to date?
I mean, you can add or remove table, thats a simple task. Altering an existing table can be trivial too. But if you change the structure often, how do you keep that under a control?
I used to keep a table with a current dat... | Managing database schema changes in a controlled and systematic way is crucial for maintaining data integrity and ensuring smooth application upgrades. Your current approach, using a version-controlled migration system with SQL files, is a solid foundation, but here are some strategies to improve it and address the iss... | 28,516 | [
{
"from": "human",
"value": "If your data change after the application is deployed, how do you keep the database up to date? \nI mean, you can add or remove table, thats a simple task. Altering an existing table can be trivial too. But if you change the structure often, how do you keep that under a control?... |
I want to transform /foo/bar/.. to /foo
Is there a bash command which does this?
Edit: in my practical case, the directory does exist.
| Yes, you can achieve this by using the `dirname` command in bash, which is designed to return the parent directory of a specified path. In your case, you can use it as follows:
```bash
dirname "/foo/bar/.."
```
This command will output `/foo`.
If you want to handle it in a script or from the command line and ensure ... | 32,530 | [
{
"from": "human",
"value": "I want to transform /foo/bar/.. to /foo\nIs there a bash command which does this?\n\nEdit: in my practical case, the directory does exist.\n"
},
{
"from": "gpt",
"value": "Yes, you can achieve this by using the `dirname` command in bash, which is designed to return t... |
If I have a method such as:
public void MyMethod(int arg1, string arg2)
How would I go about getting the actual names of the arguments?
I can't seem to find anything in the MethodInfo which will actually give me the name of the parameter.
I would like to write a method which looks like this:
public static string GetPa... | In C#, when you use reflection to inspect a method, the `MethodInfo` class provides access to parameter information through the `GetParameters` method, which returns an array of `ParameterInfo` objects. Each `ParameterInfo` object contains information about a parameter, including its name.
However, it is important to ... | 29,260 | [
{
"from": "human",
"value": "If I have a method such as:\npublic void MyMethod(int arg1, string arg2)\n\nHow would I go about getting the actual names of the arguments?\nI can't seem to find anything in the MethodInfo which will actually give me the name of the parameter.\nI would like to write a method whi... |
I'm just starting out playing around with Linq Expressions and I've hit a wall. I need to create an Expression Tree from an Action. Unfortunetly I can't get the Action as an Expression, this is basically what I've got to work with:
public void Something(Action action){}
I need access to the body of the Action to ext... | Creating an expression tree from an `Action` can be a bit tricky because an `Action` is a delegate and does not have the information available in the form of an expression tree by default. However, you can achieve this by using `Expression<Action>`.
Here's a way to modify your `Something` method to accept an `Express... | 29,951 | [
{
"from": "human",
"value": "I'm just starting out playing around with Linq Expressions and I've hit a wall. I need to create an Expression Tree from an Action. Unfortunetly I can't get the Action as an Expression, this is basically what I've got to work with:\npublic void Something(Action action){}\n\nI ... |
Basically, what I want to is be able to explore an ActiveX DLL.
I normally fire up VB 6, add the DLL to the "References" of the project, and use Object Explorer.
However, in this particular machine I can't install VB / VS.
I'm sure there's a tool out there that does this. Does anyone know of one?
Thanks
| Yes, there are several tools that can help you explore ActiveX DLLs without requiring Visual Basic 6 or Visual Studio. Here are a few options:
1. **OLE/COM Object Viewer**:
- This tool comes with the Windows SDK and allows you to view and explore ActiveX components. You can use it to see the interfaces, classes, an... | 29,320 | [
{
"from": "human",
"value": "Basically, what I want to is be able to explore an ActiveX DLL.\nI normally fire up VB 6, add the DLL to the \"References\" of the project, and use Object Explorer.\nHowever, in this particular machine I can't install VB / VS.\nI'm sure there's a tool out there that does this. D... |
Are there any implementations of all the nifty Selenium on Rails methods like wait_for_visible, assert_not_text_present, ... for the ruby driver of Selenium RC?
If not, how would I go about implementing something like wait_for_visible?
| The methods you mentioned (like `wait_for_visible` and `assert_not_text_present`) are part of the original Selenium for Ruby on Rails (often referred to as Selenium on Rails) and are not directly available in the newer Selenium WebDriver (Ruby Driver for Selenium) implementations. However, you can create similar functi... | 30,751 | [
{
"from": "human",
"value": "Are there any implementations of all the nifty Selenium on Rails methods like wait_for_visible, assert_not_text_present, ... for the ruby driver of Selenium RC?\nIf not, how would I go about implementing something like wait_for_visible?\n"
},
{
"from": "gpt",
"value... |
I like Steve Yegge's Prototype Pattern example and decided to whip up a quick proof of concept example.
However, I didn't really think things through. While it is great for dynamically specifying the behaviour of objects and is an easy solution to Steve's opinionated elf example, I'm still trying to work out the best ... | Your scenario highlights a common challenge when working with prototype-based inheritance, especially when dealing with shared instance variables. In your case, both `AwesomeDragon` and `AwesomeDragonImmuneToFire` share the same instance of `position`, which leads to unintended side effects when one object's properties... | 25,897 | [
{
"from": "human",
"value": "I like Steve Yegge's Prototype Pattern example and decided to whip up a quick proof of concept example.\nHowever, I didn't really think things through. While it is great for dynamically specifying the behaviour of objects and is an easy solution to Steve's opinionated elf examp... |
In C# is there any real difference (other than syntax) under the hood between:
myButton.Click += new EventHandler(myMemberMethod);
and
myButton.Click += myMemberMethod;
?
| In C#, there is no real difference under the hood between these two lines of code that you provided. Both lines effectively achieve the same outcome: they subscribe the `myMemberMethod` to the `Click` event of `myButton`.
Here's a breakdown of the two approaches:
1. **Using `new EventHandler(...)`**:
```csharp
... | 30,675 | [
{
"from": "human",
"value": "In C# is there any real difference (other than syntax) under the hood between:\nmyButton.Click += new EventHandler(myMemberMethod);\n\nand\nmyButton.Click += myMemberMethod;\n\n?\n"
},
{
"from": "gpt",
"value": "In C#, there is no real difference under the hood betwe... |
I have routes like "x/{*path}" where the path parameter is used by the controller to navigate a tree structure to end up with a resource which is served to the client.
I would now like to extend this scheme in an orthogonal fashion with other controllers that provide other "aspects" of the resource such as meta-data or... | It sounds like you're trying to create a flexible routing system that allows for additional controllers to handle different aspects of a resource without requiring the main controller to be aware of those extensions. This is a common challenge in designing RESTful APIs.
Here are a few suggestions to achieve your goal ... | 20,755 | [
{
"from": "human",
"value": "I have routes like \"x/{*path}\" where the path parameter is used by the controller to navigate a tree structure to end up with a resource which is served to the client.\nI would now like to extend this scheme in an orthogonal fashion with other controllers that provide other \"... |
This is really two questions, but they are so similar, and to keep it simple, I figured I'd just roll them together:
Firstly: Given an established Perl project, what are some decent ways to speed it up beyond just plain in-code optimization?
Secondly: When writing a program from scratch in Perl, what are some good wa... | Improving the performance of a Perl project can be approached through various strategies that go beyond in-code optimizations. Let's break down each question accordingly.
### For an Established Perl Project
1. **Profiling the Application:**
- Before making changes, use a profiler (e.g., `Devel::NYTProf`) to analyz... | 23,870 | [
{
"from": "human",
"value": "This is really two questions, but they are so similar, and to keep it simple, I figured I'd just roll them together:\n\nFirstly: Given an established Perl project, what are some decent ways to speed it up beyond just plain in-code optimization?\nSecondly: When writing a program... |
How do I truncate output in BASH?
For example, if I "du file.name" how do I just get the numeric value and nothing more?
later addition:
all solutions work perfectly. I chose to accept the most enlightning "cut" answer because I prefer the simplest approach in bash files others are supposed to be able to read.
| To truncate the output of a command in BASH and get just the numeric value from the output of `du file.name`, you can use several different methods. Here are a few common approaches:
### Using `cut`
You can use `cut` to extract just the first column from the output of `du`, which is the size in bytes:
```bash
du file... | 26,284 | [
{
"from": "human",
"value": "How do I truncate output in BASH? \nFor example, if I \"du file.name\" how do I just get the numeric value and nothing more?\nlater addition:\nall solutions work perfectly. I chose to accept the most enlightning \"cut\" answer because I prefer the simplest approach in bash files... |
Functional programming seems to be a paradigm in computer science which has more and more echo.
I wonder which kind of problems are better solved with a functional programming approach rather than with a more traditional object oriented approach.
Thank you.
| Functional programming (FP) and object-oriented programming (OOP) are two distinct paradigms, each with its strengths and weaknesses. The choice between them often depends on the nature of the problem being solved, the specific requirements of the project, and personal or team preferences. Here are some types of proble... | 27,804 | [
{
"from": "human",
"value": "Functional programming seems to be a paradigm in computer science which has more and more echo.\nI wonder which kind of problems are better solved with a functional programming approach rather than with a more traditional object oriented approach.\nThank you.\n"
},
{
"fr... |
In a PHP project I'm working on we need to create some DAL extensions to support multiple database platforms. The main pitfall we have with this is that different platforms have different syntaxes - notable MySQL and MSSQL are quite different.
What would be the best solution to this?
Here are a couple we've discussed:
... | Creating a Data Access Layer (DAL) that supports multiple database platforms is indeed a challenging task due to the differences in SQL syntax and behavior across different databases like MySQL and MSSQL. Here are some approaches you could consider, along with their pros and cons:
### 1. Class-based SQL Building
**Pr... | 21,526 | [
{
"from": "human",
"value": "In a PHP project I'm working on we need to create some DAL extensions to support multiple database platforms. The main pitfall we have with this is that different platforms have different syntaxes - notable MySQL and MSSQL are quite different.\nWhat would be the best solution to... |
I am new to Hudson, perhaps someone knows the solution:
I am trying to checkout the parent pom from the VSS in Hudson (vss plugin installed) and now I get class cast exception:
FATAL: hudson.maven.MavenModuleSetBuild cannot be cast to hudson.model.Build
java.lang.ClassCastException: hudson.maven.MavenModuleSetBuild ca... | The `ClassCastException` you are encountering in Hudson (Jenkins) indicates that there is an issue with type casting between `MavenModuleSetBuild` and `Build`. This error often arises when the code assumes that a specific build type will be returned when it may not be, particularly if the build is of a different type t... | 29,749 | [
{
"from": "human",
"value": "I am new to Hudson, perhaps someone knows the solution: \nI am trying to checkout the parent pom from the VSS in Hudson (vss plugin installed) and now I get class cast exception:\nFATAL: hudson.maven.MavenModuleSetBuild cannot be cast to hudson.model.Build\njava.lang.ClassCastEx... |
Automated tests MUST be fast to reflect real time project state. The idea is that:
after any commit to repository automated build is performed (as fast as it can be done).
if build succeeded automated tests are started. MUST be fast.
This is the best way i know to find out if your changes break anything.
At first it ... | Optimizing the automated testing phase, especially for integration tests in complex environments, can be quite challenging. However, there are several strategies and best practices that can help reduce setup time and improve overall testing efficiency:
### 1. **Service Virtualization**
- Instead of relying on live ... | 26,129 | [
{
"from": "human",
"value": "Automated tests MUST be fast to reflect real time project state. The idea is that:\n\nafter any commit to repository automated build is performed (as fast as it can be done).\nif build succeeded automated tests are started. MUST be fast.\n\nThis is the best way i know to find ou... |
What is the first thing you do when you install Visual Studio? I am talking about anything customization-wise (so we don't get answers based on 'I create a new project').
Do you have a favorite font?
Do you have a must have extension you couldn't possibly live without?
Do you have a keyboard shortcut you like to set?... | When installing Visual Studio, many developers like to customize their environment to improve their workflow and comfort. Here are some common customization steps and preferences:
### Font
- **Favorite Font:** A popular choice is **Consolas** for its readability and programming-friendly design. Some developers also pr... | 30,397 | [
{
"from": "human",
"value": "What is the first thing you do when you install Visual Studio? I am talking about anything customization-wise (so we don't get answers based on 'I create a new project').\nDo you have a favorite font? \nDo you have a must have extension you couldn't possibly live without? \nDo y... |
Im looking to build a thread manager for an application.
I have already started threading and it works entirely fine but I would like to be able to programatically kill them or get information on them.
Does anyone have ideas?
| To build a thread manager that allows you to programmatically control threads, including the ability to kill them or retrieve information about them, you can follow these ideas and concepts, assuming you're working with Python's `threading` module or similar threading capabilities in another language.
### Basic Concep... | 25,051 | [
{
"from": "human",
"value": "Im looking to build a thread manager for an application.\nI have already started threading and it works entirely fine but I would like to be able to programatically kill them or get information on them.\nDoes anyone have ideas?\n"
},
{
"from": "gpt",
"value": "To bui... |
Is it good practice to have a class constructor that uses default parameters, or should I use separate overloaded constructors? For example:
// Use this...
class foo
{
private:
std::string name_;
unsigned int age_;
public:
foo(const std::string& name = "", const unsigned int age = 0) :
name_(name... | Both approaches you presented for defining constructors in C++ have their own merits, and the best choice often depends on the context of your code and the specific needs of your project. Here’s a breakdown of the two approaches:
### 1. Constructor with Default Parameters
```cpp
class foo
{
private:
std::string... | 26,065 | [
{
"from": "human",
"value": "Is it good practice to have a class constructor that uses default parameters, or should I use separate overloaded constructors? For example:\n// Use this...\nclass foo \n{\nprivate:\n std::string name_;\n unsigned int age_;\npublic:\n foo(const std::string& name = \"\... |
When should I put ... at the end of a menu item? I seem to remember reading some rules but can't for the life of me find them.
For context - I'm adding a properties option to a right click menu and am wondering if it is appropriate to add them.
| The use of ellipses ("...") at the end of menu items in user interfaces typically indicates that selecting that item will open a dialog or another window for additional input or information. Here are some guidelines regarding their use:
1. **Use Ellipses When:**
- The action will lead to further interaction or a ne... | 32,000 | [
{
"from": "human",
"value": "When should I put ... at the end of a menu item? I seem to remember reading some rules but can't for the life of me find them.\nFor context - I'm adding a properties option to a right click menu and am wondering if it is appropriate to add them.\n"
},
{
"from": "gpt",
... |
I have two projects in CPP. One defines a function which I'd like to invoke from the other.
I added a reference to the first project.
I still get the message of "identifier not found".
Assuming that the CPP file in the first project doesn't have a header, how do I make the second project know about its functions?
| To invoke a function defined in a C++ project from another project, you need to ensure that the function is declared in a header file that can be included in your second project. If the first project doesn't have a header file, you can create one. Here’s a step-by-step guide on how to do this:
### Step 1: Create a Hea... | 23,408 | [
{
"from": "human",
"value": "I have two projects in CPP. One defines a function which I'd like to invoke from the other.\nI added a reference to the first project.\nI still get the message of \"identifier not found\".\nAssuming that the CPP file in the first project doesn't have a header, how do I make the ... |
I'm working on a simple javascript login for a site, and have come up with this:
<form id="loginwindow">
<strong>Login to view!</strong>
<p><strong>User ID:</strong>
<input type="text" name="text2">
</p>
<p><strong>Password:</strong>
<input type="password" name="text1"><br>
<input type="button" value="Check In" nam... | To ensure that your JavaScript validation works when pressing the "Enter" key, you can listen for the `keypress` event on your form and call the `validate` function if the user presses the Enter key.
Here is an improved version of your code, including an event listener for form submission and using the correct method... | 26,912 | [
{
"from": "human",
"value": "I'm working on a simple javascript login for a site, and have come up with this:\n<form id=\"loginwindow\">\n<strong>Login to view!</strong>\n<p><strong>User ID:</strong>\n <input type=\"text\" name=\"text2\">\n</p>\n<p><strong>Password:</strong>\n<input type=\"password\" name=... |
I have a composite control that contains a ListBox child control. On postback, the items for the ListBox disappear. I have a property for the ListBox that initializes it, and I add it to the controls collection in CreateChildControls. Am I doing something wrong? Do I need to be doing something else to properly handle t... | When dealing with composite controls in ASP.NET, particularly when you have child controls like a `ListBox`, you need to ensure that you're properly managing the view state of the control. The reason your `ListBox` items might be disappearing on postback could be due to several factors, including how and when you're in... | 25,172 | [
{
"from": "human",
"value": "I have a composite control that contains a ListBox child control. On postback, the items for the ListBox disappear. I have a property for the ListBox that initializes it, and I add it to the controls collection in CreateChildControls. Am I doing something wrong? Do I need to be ... |
I have an ActiveRecord model that I would like to convert to xml, but I do not want all the properties rendered in xml. Is there a parameter I can pass into the render method to keep a property from being rendered in xml?
Below is an example of what I am talking about.
def show
@person = Person.find(params[:id])
r... | In Rails, to control the attributes that are included in the XML representation of your ActiveRecord model, you can use the `to_xml` method with an options hash that specifies which attributes to include or exclude.
Here's how you can modify your `show` action to exclude the `phone` attribute:
```ruby
def show
@per... | 32,477 | [
{
"from": "human",
"value": "I have an ActiveRecord model that I would like to convert to xml, but I do not want all the properties rendered in xml. Is there a parameter I can pass into the render method to keep a property from being rendered in xml? \nBelow is an example of what I am talking about.\ndef sh... |
I have a site that users upload images to. Those images are resized to various dimensions. I currently do that on my server, but was thinking of processing that on AWS or something similar. Is that a good idea?
| Using AWS (or a similar cloud service) for image processing can be a good idea for several reasons:
1. **Scalability**: AWS allows you to scale your image processing capabilities based on demand. If you have spikes in uploads (like during certain events), you can easily scale up resources to handle the load.
2. **Cos... | 27,266 | [
{
"from": "human",
"value": "I have a site that users upload images to. Those images are resized to various dimensions. I currently do that on my server, but was thinking of processing that on AWS or something similar. Is that a good idea?\n"
},
{
"from": "gpt",
"value": "Using AWS (or a similar... |
Assuming a table of tags like the stackoverflow question tags:
TagID (bigint), QuestionID (bigint), Tag (varchar)
What is the most efficient way to get the 25 most used tags using LINQ? In SQL, a simple GROUP BY will do:
SELECT Tag, COUNT(Tag) FROM Tags GROUP BY Tag
I've written some LINQ that works:
var groups = f... | Your current LINQ query works, but it can indeed be streamlined a bit to make it more concise and clear. You can use method syntax instead of query syntax, which tends to be more compact. Here's a simplified version of your code using method syntax to get the 25 most used tags:
```csharp
var topTags = DataContext.Tags... | 28,626 | [
{
"from": "human",
"value": "Assuming a table of tags like the stackoverflow question tags:\n\nTagID (bigint), QuestionID (bigint), Tag (varchar)\n\nWhat is the most efficient way to get the 25 most used tags using LINQ? In SQL, a simple GROUP BY will do:\nSELECT Tag, COUNT(Tag) FROM Tags GROUP BY Tag\n\nI... |
Let's say we have defined a CSS class that is being applied to various elements on a page.
colourful
{
color: #DD00DD;
background-color: #330033;
}
People have complained about the colour, that they don't like pink/purple. So you want to give them the ability to change the style as they wish, and they can pick... | To allow users to change the styles of elements with the class `colourful` based on their color picker selection, you can use JavaScript to modify the CSS styles of those elements dynamically. The `changeColourful` function will take two parameters: `colorRGB` for the text color and `backgroundColorRGB` for the backgro... | 29,854 | [
{
"from": "human",
"value": "Let's say we have defined a CSS class that is being applied to various elements on a page.\ncolourful\n{\n color: #DD00DD;\n background-color: #330033;\n}\n\nPeople have complained about the colour, that they don't like pink/purple. So you want to give them the ability to ... |
I’m building a system that generates “work items” that are queued up for back-end processing. I recently completed a system that had the same requirements and came up with an architecture that I don’t feel is optimal and was hoping for some advice for this new system.
Work items are queued up centrally and need to be ... | It sounds like you're dealing with a complex set of requirements for your work item processing system. You're correct that SQL Server has its own advantages and disadvantages, particularly in terms of potential deadlocks and complexity in managing stored procedures. Let's explore some alternative architectures and tech... | 23,553 | [
{
"from": "human",
"value": "I’m building a system that generates “work items” that are queued up for back-end processing. I recently completed a system that had the same requirements and came up with an architecture that I don’t feel is optimal and was hoping for some advice for this new system.\nWork ite... |
I recently installed the Eclipse Metrics Plugin and have exported the data for one of our projects.
It's all very good having these nice graphs but I'd really like to understand more in depth what they all mean. The definitions of the metrics only go so far to telling you what it really means.
Does anyone know of any g... | Understanding software metrics can greatly improve your ability to analyze code quality and maintainability. Here are some resources and concepts to help you dive deeper into metrics like Efferent Coupling, Cyclomatic Complexity, and others.
### Books
1. **"Code Complete" by Steve McConnell**: This book provides a com... | 21,512 | [
{
"from": "human",
"value": "I recently installed the Eclipse Metrics Plugin and have exported the data for one of our projects.\nIt's all very good having these nice graphs but I'd really like to understand more in depth what they all mean. The definitions of the metrics only go so far to telling you what ... |
How do I generate friendly URLs within the ASP.NET MVC Framework? For example, we've got a URL that looks like this:
http://site/catalogue/BrowseByStyleLevel/1
The 1 is Id of the study level (Higher in this case) to browse, but I'l like to reformat the URL in the same way StackOverflow does it.
For example, these two U... | Generating friendly URLs (or slugs) in the ASP.NET MVC Framework involves setting up your routing configuration and using a controller to convert your IDs into more human-readable strings. Here’s how to do that step-by-step:
### Step 1: Modify Your Route Configuration
You can define custom routes in the `RouteConfig.... | 24,047 | [
{
"from": "human",
"value": "How do I generate friendly URLs within the ASP.NET MVC Framework? For example, we've got a URL that looks like this:\nhttp://site/catalogue/BrowseByStyleLevel/1\nThe 1 is Id of the study level (Higher in this case) to browse, but I'l like to reformat the URL in the same way Stac... |
I work for an R&D company in the energy business. We've developed some successful products, but now seem to be spending all our time fixing issues relating to those products. We don't seem to have any time to work on developing new products.
Does anyone have any good ideas on how to both handle problems arising with ... | Hi Fred,
Balancing the demands of maintaining existing products while developing new ones can be challenging, but there are several strategies you might consider to help your R&D team manage this effectively:
1. **Prioritize and Categorize Issues**: Implement a system to categorize issues based on their severity and ... | 27,895 | [
{
"from": "human",
"value": "I work for an R&D company in the energy business. We've developed some successful products, but now seem to be spending all our time fixing issues relating to those products. We don't seem to have any time to work on developing new products.\nDoes anyone have any good ideas on... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.