instruction stringlengths 14 27.6k | completion stringlengths 3 38.3k | __original_row_idx int64 0 50k | conversations listlengths 2 2 |
|---|---|---|---|
Recently, someone asked about an algorithm for reversing a string in place in C. Most of the proposed solutions had troubles when dealing with non single-byte strings. So, I was wondering what could be a good algorithm for dealing specifically with utf-8 strings.
I came up with some code, which I'm posting as an answer... | Reversing a UTF-8 string in place is indeed a more complex task than reversing a simple ASCII string, primarily due to the multi-byte nature of UTF-8 encoding and the presence of combining characters. Below, I will outline an algorithm that handles UTF-8 strings while taking into consideration the aforementioned comple... | 27,426 | [
{
"from": "human",
"value": "Recently, someone asked about an algorithm for reversing a string in place in C. Most of the proposed solutions had troubles when dealing with non single-byte strings. So, I was wondering what could be a good algorithm for dealing specifically with utf-8 strings.\nI came up with... |
Can anyone tell me, where on the web I can find an explanation for Bron-Kerbosch algorithm for clique finding or explain here how it works?
I know it was published in "Algorithm 457: finding all cliques of an undirected graph" book, but I can't find free source that will describe the algorithm.
I don't need a source co... | The Bron-Kerbosch algorithm is a classic algorithm for finding all maximal cliques in an undirected graph. Let's break down how the algorithm works step by step.
### What is a Clique?
A **clique** in a graph is a subset of vertices such that every two vertices in the subset are connected by an edge. A **maximal clique... | 26,654 | [
{
"from": "human",
"value": "Can anyone tell me, where on the web I can find an explanation for Bron-Kerbosch algorithm for clique finding or explain here how it works?\nI know it was published in \"Algorithm 457: finding all cliques of an undirected graph\" book, but I can't find free source that will desc... |
Let's say that I have the following code in application_helper.rb:
def do_something
if action_name == 'index'
'do'
else
'dont'
end
end
which will do something if called within index action.
Q: How do I rewrite the helper spec for this in application_helper_spec.rb to simulate a call from 'index' action?
desc... | To simulate a call from the 'index' action in your `application_helper_spec.rb`, you can stub or define the `action_name` method to return 'index' before calling `do_something`. Here’s how you can rewrite your specs to achieve that:
```ruby
require 'rails_helper'
RSpec.describe ApplicationHelper, type: :helper do
d... | 33,258 | [
{
"from": "human",
"value": "Let's say that I have the following code in application_helper.rb:\ndef do_something\n if action_name == 'index'\n 'do'\n else\n 'dont'\n end\nend\n\nwhich will do something if called within index action. \nQ: How do I rewrite the helper spec for this in application_helper_s... |
At work, we have a testing tool that is used to send queries to a data source. The tool takes in input as XML files. The XML files were simple and easy to parse as long as the data structures we tried to represent were one layer deep. But now these data structures are more complex and representing them in XML is gettin... | It's understandable that as your data structures become more complex, XML can become unwieldy. Here are a few alternatives you can consider for representing complex data structures, with a focus on their pros and cons:
### 1. JSON (JavaScript Object Notation)
**Pros:**
- More human-readable than XML, especially for ne... | 26,120 | [
{
"from": "human",
"value": "At work, we have a testing tool that is used to send queries to a data source. The tool takes in input as XML files. The XML files were simple and easy to parse as long as the data structures we tried to represent were one layer deep. But now these data structures are more compl... |
I am working on a project which uses an import
#import "progid:Blah.blah.retrieve" rename_namespace("Blah")
but I would really perfer not to register the dll which is I believe what is missing to allow this to work. I don't want to register the dll because our build system will not be able to build multiple instances... | The `#import` directive in C++ is used to import type libraries for COM objects, allowing you to access and utilize the types defined in those libraries directly in your C++ code. When using `#import`, a few things happen:
1. **Type Definitions**: The classes, interfaces, and types defined in the type library are gene... | 30,823 | [
{
"from": "human",
"value": "I am working on a project which uses an import\n#import \"progid:Blah.blah.retrieve\" rename_namespace(\"Blah\")\n\nbut I would really perfer not to register the dll which is I believe what is missing to allow this to work. I don't want to register the dll because our build sys... |
I want to user Role based security through the authorization section in the web.config file.
Using Membership, my application will allow for new Roles to be created, and thus, the pages they can access need to be set dynamically.
Can I programatically alter this section in the web.config to manage this? If so, how?
| Yes, you can programmatically modify the `web.config` file to manage roles and authorization settings in an ASP.NET application. However, modifying the `web.config` file directly at runtime should be done with caution, as it can lead to application restarts and potential issues if not handled properly.
Here's how you ... | 30,646 | [
{
"from": "human",
"value": "I want to user Role based security through the authorization section in the web.config file.\nUsing Membership, my application will allow for new Roles to be created, and thus, the pages they can access need to be set dynamically.\nCan I programatically alter this section in the... |
What's the best cross platform Java Swing browser component at least able to play nicely in a swing interface (lightweight component ?) and able to run on MacOSX and Windows ?
Things like : FlyingSaucer, JDIC, maybe others ?
| When looking for a cross-platform Java Swing browser component that integrates well with Swing and works on both macOS and Windows, you have a few options to consider:
1. **JavaFX WebView**:
- **Overview**: Although technically not part of Swing, you can embed JavaFX components in a Swing application using JFXPanel... | 30,064 | [
{
"from": "human",
"value": "What's the best cross platform Java Swing browser component at least able to play nicely in a swing interface (lightweight component ?) and able to run on MacOSX and Windows ?\nThings like : FlyingSaucer, JDIC, maybe others ?\n"
},
{
"from": "gpt",
"value": "When loo... |
Suppose I have the following two strings containing regular expressions. How do I coalesce them? More specifically, I want to have the two expressions as alternatives.
$a = '# /[a-z] #i';
$b = '/ Moo /x';
$c = preg_magic_coalesce('|', $a, $b);
// Desired result should be equivalent to:
// '/ \/[a-zA-Z] |Moo/'
Of cours... | Coalescing two regex patterns from different sources and ensuring their compatibility can be quite challenging, especially when the patterns may have different delimiters and modifiers. While PHP does not offer a built-in regex class that directly supports coalescing, you can manually construct a coalesced regex patter... | 25,783 | [
{
"from": "human",
"value": "Suppose I have the following two strings containing regular expressions. How do I coalesce them? More specifically, I want to have the two expressions as alternatives.\n$a = '# /[a-z] #i';\n$b = '/ Moo /x';\n$c = preg_magic_coalesce('|', $a, $b);\n// Desired result should be equ... |
How can I monitor the memory being used by a native C DLL that is being called from Java via JNI? Using standard Java monitoring tools and options I can see the Java memory space, but I cannot view any memory used by the C DLL. Java is using ~70MB, but the task in the Task Manager shows 200Mb+, and I'd like to see w... | Monitoring the memory usage of a native C DLL called from Java via the Java Native Interface (JNI) can be challenging, as the standard Java monitoring tools primarily focus on the Java Virtual Machine (JVM) memory space. However, there are several methods and tools you can use to gain insights into the memory used by t... | 28,300 | [
{
"from": "human",
"value": "How can I monitor the memory being used by a native C DLL that is being called from Java via JNI? Using standard Java monitoring tools and options I can see the Java memory space, but I cannot view any memory used by the C DLL. Java is using ~70MB, but the task in the Task Ma... |
Like most developers here and in the entire world, I have been developing software systems using object-oriented programming (OOP) techniques for many years. So when I read that aspect-oriented programming (AOP) addresses many of the problems that traditional OOP doesn't solve completely or directly, I pause and think,... | Aspect-oriented programming (AOP) is a programming paradigm that aims to improve code modularity by allowing the separation of cross-cutting concerns. Cross-cutting concerns are aspects of a program that affect multiple modules but are typically difficult to modularize using traditional object-oriented programming (OOP... | 28,706 | [
{
"from": "human",
"value": "Like most developers here and in the entire world, I have been developing software systems using object-oriented programming (OOP) techniques for many years. So when I read that aspect-oriented programming (AOP) addresses many of the problems that traditional OOP doesn't solve c... |
I'm trying to traverse through all the subdirectories of the current directory in Perl, and get data from those files. I'm using grep to get a list of all files and folders in the given directory, but I don't know which of the values returned is a folder name and which is a file with no file extention.
How can I tell ... | In Perl, you can distinguish between files and directories using the `File::Glob` module or the `Cwd` and `File::Spec` modules in combination with the `-d` and `-f` file test operators. Here's how you can traverse through all subdirectories and differentiate between files and directories:
1. Use the `File::Find` modul... | 30,326 | [
{
"from": "human",
"value": "I'm trying to traverse through all the subdirectories of the current directory in Perl, and get data from those files. I'm using grep to get a list of all files and folders in the given directory, but I don't know which of the values returned is a folder name and which is a file... |
I am new to Applescripts and Excel 08? I want to write one that colors arbitrarily preselected cells in Excel 08 specific colors. I can get it to write want in an preselected cell and even bold the font...but for some reason it will not change the color of the cell...
print("Tell application "Microsoft Excel"
activat... | It looks like you are trying to change the interior color of a cell in Excel 2008 using AppleScript, but there are a few syntax issues and structure problems in your code. Here's how you can modify your script to successfully change the background color of the active cell.
Here's the revised AppleScript:
```applescri... | 33,150 | [
{
"from": "human",
"value": "I am new to Applescripts and Excel 08? I want to write one that colors arbitrarily preselected cells in Excel 08 specific colors. I can get it to write want in an preselected cell and even bold the font...but for some reason it will not change the color of the cell...\nprint(\... |
A couple of recent questions discuss strategies for naming columns, and I was rather surprised to discover the concept of embedding the notion of foreign and primary keys in column names. That is
select t1.col_a, t1.col_b, t2.col_z
from t1 inner join t2 on t1.id_foo_pk = t2.id_foo_fk
I have to confess I have never wor... | Your question touches on a fundamental aspect of database design and naming conventions, and indeed, the decision to include hints about primary and foreign keys in column names can spark differing opinions among developers and database designers. Here are some benefits and arguments for this naming strategy, as well a... | 28,951 | [
{
"from": "human",
"value": "A couple of recent questions discuss strategies for naming columns, and I was rather surprised to discover the concept of embedding the notion of foreign and primary keys in column names. That is\nselect t1.col_a, t1.col_b, t2.col_z\nfrom t1 inner join t2 on t1.id_foo_pk = t2.id... |
How do you answer the following questions from managers, testers and other people in your team:
In what build is bug #829 fixed? What tasks have been completed in our current test build?
So simply put, how do you achieve traceability of your requirements, tasks and bugs right from them being reported reporting through ... | Achieving traceability of requirements, tasks, and bugs from reporting through to deployment is crucial for effective project management and quality assurance. Here’s how you can address the questions from your team members and maintain traceability:
### 1. **Use of Tools**
- **Issue Tracking System**: Utilize tool... | 29,060 | [
{
"from": "human",
"value": "How do you answer the following questions from managers, testers and other people in your team:\nIn what build is bug #829 fixed? What tasks have been completed in our current test build?\nSo simply put, how do you achieve traceability of your requirements, tasks and bugs right ... |
So there seems to be this problem with GNU Make's $(wildcard) function keeping a directory open on Windows. See (unasnwered) post "make is holding a directory open". Google does not provide much information on the topic.
In short: the Makefile uses the $(wildcard) function at some point, and keeps a directory open, whi... | The issue you're encountering with `$(wildcard)` in GNU Make on Windows seems to stem from how certain filesystems and tools handle directory access and file locks. In your case, it appears that `$(wildcard)` is holding a reference to the directory, which can interfere with file deletion during the `make clean` process... | 29,615 | [
{
"from": "human",
"value": "So there seems to be this problem with GNU Make's $(wildcard) function keeping a directory open on Windows. See (unasnwered) post \"make is holding a directory open\". Google does not provide much information on the topic.\nIn short: the Makefile uses the $(wildcard) function at... |
Are modal windows/dialogs considered a good practice for websites? One of the things that concerns me about using a modal window is that it is so much like a pop-up window and it could cause user frustration or cause users to simply close it because it's intrusive. Do you know of any studies that talk about user prefe... | Modal windows or dialogs can be both beneficial and detrimental, depending on their design, context, and implementation. Let's break down your questions and concerns:
### General Concerns about Modal Windows
1. **User Experience**: Modal dialogs can be intrusive if not used judiciously. If they interrupt the user's fl... | 29,174 | [
{
"from": "human",
"value": "Are modal windows/dialogs considered a good practice for websites? One of the things that concerns me about using a modal window is that it is so much like a pop-up window and it could cause user frustration or cause users to simply close it because it's intrusive. Do you know ... |
I'm trying to play a sound file from an iPhone program.
Here's the code:
NSString *path = [[NSBundle mainBundle] pathForResource:@"play" ofType:@"caf"];
NSFileHandle *bodyf = [NSFileHandle fileHandleForReadingAtPath:path];
NSData *body = [bodyf availableData];
NSLog( @"length of play.caf %d",[body length] );
NSURL *url... | It looks like you're trying to play a sound file using the `AudioServicesCreateSystemSoundID` function. The error code `-1500` typically indicates that there is something wrong with the provided URL or the format of the sound file.
### Here are a few things to check:
1. **File Format**: Ensure that the `play.caf` fil... | 30,220 | [
{
"from": "human",
"value": "I'm trying to play a sound file from an iPhone program.\nHere's the code:\nNSString *path = [[NSBundle mainBundle] pathForResource:@\"play\" ofType:@\"caf\"];\nNSFileHandle *bodyf = [NSFileHandle fileHandleForReadingAtPath:path];\nNSData *body = [bodyf availableData];\nNSLog( @\... |
I'm creating a new theme for the jCarousel component that I'll be
using for my web site and the dimension for this component will be:
width:485px , height:161px including the two arrows and what i want is
to have 3 items per cycle each having the a dimension of 140X100
(width X height) with 5px margin, and 3/4 of the s... | To create a jCarousel component with the specified dimensions and layout, you will need to carefully structure your CSS to ensure that all elements fit as intended. Here's a general outline of how to approach this:
### CSS Structure
1. **Container Setup**: Set the dimensions of the jCarousel container.
2. **Item Styl... | 27,857 | [
{
"from": "human",
"value": "I'm creating a new theme for the jCarousel component that I'll be\nusing for my web site and the dimension for this component will be:\nwidth:485px , height:161px including the two arrows and what i want is\nto have 3 items per cycle each having the a dimension of 140X100\n(widt... |
Sorry, if this is a noobish question, but I'm just getting started with Rails and jQuery. I have the following scenario:
I have 3 classes: contacts, companies and contact_company_joins (ccj).
For all three classes I created models, controller and views. Obviously, contacts and
companies are connected via the join-tab... | Hi Sebastian,
Your question makes perfect sense, and it's great that you're exploring Rails and jQuery! The scenario you're describing is common when dealing with AJAX requests and dynamically updating parts of the DOM.
### Solution Overview
You want to update different parts of the page based on whether the request ... | 27,460 | [
{
"from": "human",
"value": "Sorry, if this is a noobish question, but I'm just getting started with Rails and jQuery. I have the following scenario:\nI have 3 classes: contacts, companies and contact_company_joins (ccj). \nFor all three classes I created models, controller and views. Obviously, contacts an... |
I know the file needs to be where the getClass().getResource(filename) can find it, but I don't know where that is.
I'm interested both in where to put the files on the filesystem itself, and how to go about using Eclipse's functionality to set up the resources.
| In a Java project, particularly when using Eclipse, resources such as images, configuration files, or any other non-code files should be placed in a location where they can be easily accessed by your code using the `getClass().getResource(filename)` method. Here's how you can do this:
### 1. File System Location
**Pl... | 29,642 | [
{
"from": "human",
"value": "I know the file needs to be where the getClass().getResource(filename) can find it, but I don't know where that is.\nI'm interested both in where to put the files on the filesystem itself, and how to go about using Eclipse's functionality to set up the resources.\n"
},
{
... |
I am making a game that uses XNA. I would like to add things to the game such as buttons, textboxes, labels, tooltip texts, and other stuff that comes with system.windows.forms. How do I merge system.windows.forms with XNA? Are there any API's or DLL's that I could implement to get this to work?
Thanks,
BenShums
| Integrating `System.Windows.Forms` (WinForms) with XNA can be a bit tricky because XNA is primarily designed for game development and does not directly support UI elements like WinForms. However, it is possible to combine them to some extent. Here are some methods and approaches to achieve this:
### 1. Use a WinForms ... | 30,469 | [
{
"from": "human",
"value": "I am making a game that uses XNA. I would like to add things to the game such as buttons, textboxes, labels, tooltip texts, and other stuff that comes with system.windows.forms. How do I merge system.windows.forms with XNA? Are there any API's or DLL's that I could implement to ... |
How are arrays manipulated in D?
| In the D programming language, arrays are a fundamental data structure that can be manipulated in several ways. Here’s an overview of how arrays are managed and manipulated in D:
### 1. Array Declaration
You can declare an array in D using the following syntax:
```d
int[] myArray; // Dynamic array of integers
```
##... | 28,409 | [
{
"from": "human",
"value": "How are arrays manipulated in D?\n"
},
{
"from": "gpt",
"value": "In the D programming language, arrays are a fundamental data structure that can be manipulated in several ways. Here’s an overview of how arrays are managed and manipulated in D:\n\n### 1. Array Declar... |
I recently started learning Python and I was rather surprised to find a 1000 deep recursion limit (by default). If you set it high enough, about 30000, it crashes with a segmentation fault just like C. Although, C seems to go quite a lot higher.
(The Python folks are quick to point out that you can always convert rec... | Recursion is a common programming construct, and different languages handle it in various ways, especially regarding stack depth and memory usage. Here's a brief overview of how some languages you mentioned handle recursion and whether they optimize for tail recursion:
### PHP
- **Recursion Limit**: PHP has a recursio... | 28,785 | [
{
"from": "human",
"value": "I recently started learning Python and I was rather surprised to find a 1000 deep recursion limit (by default). If you set it high enough, about 30000, it crashes with a segmentation fault just like C. Although, C seems to go quite a lot higher.\n(The Python folks are quick to... |
We have built a custom application, for internal use, that accesses TFS. We use the Microsoft libraries for this (e.g Microsoft.TeamFoundation.dll).
When this application is deployed to PCs that already have Team Explorer or VS installed, everything is fine. When it’s deployed to PCs that don’t have this installed, i... | The error you're encountering—"Common Language Runtime detected an invalid program"—indicates that the .NET runtime is having issues loading or executing the code in the Microsoft Team Foundation libraries. This is a common issue when trying to use certain assemblies that may depend on other components or specific conf... | 19,693 | [
{
"from": "human",
"value": "We have built a custom application, for internal use, that accesses TFS. We use the Microsoft libraries for this (e.g Microsoft.TeamFoundation.dll).\nWhen this application is deployed to PCs that already have Team Explorer or VS installed, everything is fine. When it’s deploye... |
I have Visual Studio setup with a VSTO word project, and when I hit run it runs fine.
But, how do I setup a word document to use my code without having Visual Studio running?
| To use your VSTO (Visual Studio Tools for Office) add-in in Word without having Visual Studio running, you'll need to ensure that the add-in is properly installed and registered with Microsoft Word. Here are the general steps you can follow:
### Step 1: Build the Project
1. **Build your project** in Visual Studio by ... | 30,207 | [
{
"from": "human",
"value": "I have Visual Studio setup with a VSTO word project, and when I hit run it runs fine.\nBut, how do I setup a word document to use my code without having Visual Studio running?\n"
},
{
"from": "gpt",
"value": "To use your VSTO (Visual Studio Tools for Office) add-in i... |
I am using CaptureMouse() during a drag and drop operation to make sure I don't miss the MouseUp event, but this seems to prevent any mouse events reaching any other objects on my Canvas. This means that my IsMouseOver based triggers don't work, but I need them to indicate valid locations where the object can be droppe... | When you call `CaptureMouse()` during a drag and drop operation in a WPF application, it indeed captures the mouse input for that specific control, preventing other elements on the canvas from receiving mouse events. This is why your `IsMouseOver` based triggers aren't functioning as expected.
To allow other elements... | 30,495 | [
{
"from": "human",
"value": "I am using CaptureMouse() during a drag and drop operation to make sure I don't miss the MouseUp event, but this seems to prevent any mouse events reaching any other objects on my Canvas. This means that my IsMouseOver based triggers don't work, but I need them to indicate valid... |
FreeMarker templates support an if-statement with the following syntax
<#if hot>
It's hot.
</#if>
I've looked in the documentation and can't find any support for an if-else statement. Of course, I could achieve the same result with:
<#if hot>
It's hot.
</#if>
<#if !hot>
It's not hot.
</#if>
Is there su... | Yes, FreeMarker does support an `if-else` statement. You can use the `<#elseif>` directive to create an if-else structure. Here's how you can write an if-else statement in FreeMarker:
```freemarker
<#if hot>
It's hot.
<#elseif !hot>
It's not hot.
</#if>
```
In this example, if `hot` is true, it will output "It's... | 34,790 | [
{
"from": "human",
"value": "FreeMarker templates support an if-statement with the following syntax\n<#if hot> \n It's hot.\n</#if> \n\nI've looked in the documentation and can't find any support for an if-else statement. Of course, I could achieve the same result with:\n<#if hot> \n It's hot.\n</#if> \... |
Simply moving the file to ~/.Trash/ will not work, as if the file os on an external drive, it will move the file to the main system drive..
Also, there are other conditions, like files on external drives get moved to /Volumes/.Trash/501/ (or whatever the current user's ID is)
Given a file or folder path, what is the co... | In macOS, the Trash directory for files can indeed vary depending on whether the file resides on the main system drive or an external drive. To determine the correct Trash location for a given file or folder path in Python, you can follow these steps:
1. **Check if the file is on the main system drive or an external d... | 31,695 | [
{
"from": "human",
"value": "Simply moving the file to ~/.Trash/ will not work, as if the file os on an external drive, it will move the file to the main system drive..\nAlso, there are other conditions, like files on external drives get moved to /Volumes/.Trash/501/ (or whatever the current user's ID is)\n... |
Howdy. Consider the following:
SQL> DECLARE
2 b1 BOOLEAN;
3 b2 BOOLEAN;
4 FUNCTION checkit RETURN BOOLEAN IS
5 BEGIN
6 dbms_output.put_line('inside checkit');
7 RETURN TRUE;
8 END checkit;
9
10 PROCEDURE outp(n VARCHAR2, p BOOLEAN) IS
11 BEGIN
12 ... | In PL/SQL, as in many programming languages, the short-circuit evaluation of logical expressions is a standard behavior. When you use the `OR` operator, PL/SQL evaluates expressions from left to right and stops evaluating as soon as it encounters a value that can determine the overall result.
In your example:
```sql... | 30,355 | [
{
"from": "human",
"value": "Howdy. Consider the following:\nSQL> DECLARE\n 2 b1 BOOLEAN;\n 3 b2 BOOLEAN;\n 4 FUNCTION checkit RETURN BOOLEAN IS\n 5 BEGIN\n 6 dbms_output.put_line('inside checkit');\n 7 RETURN TRUE;\n 8 END checkit;\n 9 \n 10 PROCEDURE outp... |
I have custom coded several enterprise applications for mid to large organizations to use internally (some with a minimal external footprint). I now have plans for a web project that may (hopefully) see a large userbase with more daily traffic than my previous projects have ever attained. Obviously I want my design t... | When it comes to designing a scalable and maintainable physical layout for servers and VMs, there are several resources that can help you navigate the complexities involved. Here’s a list of recommended books, websites, and resources that can provide valuable insights into scalable physical design:
### Books
1. **"Si... | 26,406 | [
{
"from": "human",
"value": "I have custom coded several enterprise applications for mid to large organizations to use internally (some with a minimal external footprint). I now have plans for a web project that may (hopefully) see a large userbase with more daily traffic than my previous projects have eve... |
I am using the following code to determine free space on a volume.
The folder was provided using NSOpenPanel. The item selected was a mounted volume and the path returned is \Volumes\Name
NSDictionary* fileAttributes = [[NSFileManager defaultManager] fileSystemAttributesAtPath:folder];
unsigned long long size = [[fil... | You're correct in stating that using `fileSystemAttributesAtPath:` to obtain the free space on a mounted volume is a valid approach in Cocoa. The only caveat is ensuring that the path you provide points directly to the mounted volume rather than its parent directory (like `/Volumes`), which would not give you the desir... | 31,301 | [
{
"from": "human",
"value": "I am using the following code to determine free space on a volume.\nThe folder was provided using NSOpenPanel. The item selected was a mounted volume and the path returned is \\Volumes\\Name\nNSDictionary* fileAttributes = [[NSFileManager defaultManager] fileSystemAttributesAtP... |
I have implemented some table-per-type inheritance in my data model (basically have a BaseEntity type with all the base information for my items and a Employer type that inherits from the BaseEntity item). Everything appears to be set up correctly and when using the Entities (either via ADO.net Data Services or via Li... | When working with table-per-type (TPT) inheritance in Entity Framework, the derived types (like `Employer`) are stored in separate tables, but they share a common table for their base type (like `BaseEntity`). It looks like you're facing some issues when trying to add a new `Employer` entity to your context.
Here are ... | 30,907 | [
{
"from": "human",
"value": "I have implemented some table-per-type inheritance in my data model (basically have a BaseEntity type with all the base information for my items and a Employer type that inherits from the BaseEntity item). Everything appears to be set up correctly and when using the Entities (e... |
I am interested in getting some Python code talking to some Ruby code on Windows, Linux and possibly other platforms. Specificlly I would like to access classes in Ruby from Python and call their methods, access their data, create new instances and so on.
An obvious way to do this is via something like XML-RPC or maybe... | Integrating Python and Ruby code can be achieved through various methods, each with its own advantages and use cases. Here are some common approaches that developers have used to allow Python and Ruby code to communicate, both locally and over a network.
### 1. **Inter-Process Communication (IPC)**
#### a. **Sockets*... | 28,944 | [
{
"from": "human",
"value": "I am interested in getting some Python code talking to some Ruby code on Windows, Linux and possibly other platforms. Specificlly I would like to access classes in Ruby from Python and call their methods, access their data, create new instances and so on.\nAn obvious way to do t... |
Can anyone please tell me the procedure to bring two images from different servers in Silverlight 2?
| In Silverlight 2, to bring two images from different servers, you'll need to take advantage of the `WebClient` class to handle the asynchronous loading of images. However, there are important considerations regarding cross-domain access. Each server you are requesting images from must have a proper cross-domain policy ... | 29,558 | [
{
"from": "human",
"value": "Can anyone please tell me the procedure to bring two images from different servers in Silverlight 2?\n"
},
{
"from": "gpt",
"value": "In Silverlight 2, to bring two images from different servers, you'll need to take advantage of the `WebClient` class to handle the as... |
I prefer to keep our SSIS packages in a solution on the server, not in sql. By default, sensitive data is encrypted with a user key. Since the sql server agent uses a service account to run jobs, we have to change this encryption method to something else. I like encrypting with a password.
The problem is whenever I set... | When working with SSIS packages and sensitive data, especially when using SQL Server Agent, it’s important to handle sensitive information securely and effectively. You're right to consider the implications of using user key encryption, as it can lead to issues when the SQL Server Agent runs the job using a different a... | 31,970 | [
{
"from": "human",
"value": "I prefer to keep our SSIS packages in a solution on the server, not in sql. By default, sensitive data is encrypted with a user key. Since the sql server agent uses a service account to run jobs, we have to change this encryption method to something else. I like encrypting with ... |
I have inherited a middle tier system with some multi-Threading issues.
Two different threads, running in the same method of the same instance of a class, are making the same calls to a .Net Remoting server...
Does the proxy on the client side know how to route the return values from the remoting server to the correc... | When dealing with .NET Remoting, the behavior you're asking about with respect to multi-threading and proxy handling is an important consideration.
1. **Single Proxy Instance**: When you create a proxy for a remote object in .NET Remoting, you're essentially creating a reference to that object. If you have one instanc... | 31,293 | [
{
"from": "human",
"value": "I have inherited a middle tier system with some multi-Threading issues.\nTwo different threads, running in the same method of the same instance of a class, are making the same calls to a .Net Remoting server... \nDoes the proxy on the client side know how to route the return va... |
If I add an after_save callback to an ActiveRecord model, and on that callback I use update_attribute to change the object, the callback is called again, and so a 'stack overflow' occurs (hehe, couldn't resist).
Is it possible to avoid this behavior, maybe disabling the callback during it's execution? Or is there anoth... | In ActiveRecord, when you call a method that modifies the object (like `update_attribute` or `update_attributes`) within an `after_save` callback, it triggers the callback again, leading to a stack overflow as you've described. To avoid this situation, you can use the following strategies:
### 1. Use `update_column` i... | 32,552 | [
{
"from": "human",
"value": "If I add an after_save callback to an ActiveRecord model, and on that callback I use update_attribute to change the object, the callback is called again, and so a 'stack overflow' occurs (hehe, couldn't resist).\nIs it possible to avoid this behavior, maybe disabling the callbac... |
Does anyone know the root cause of this error? I am feeding known good data to the fmt:parseDate tag (its db driven data controlled by us), and yet this error randomly pops up. I can't seem to find a way to replicate what causes this exception.
| It sounds like you're experiencing an intermittent issue with the `fmt:parseDate` tag in your application, and since it's not consistently reproducible, debugging can be quite challenging. Here are some potential root causes and troubleshooting steps you might consider:
1. **Date Format Mismatch**: Ensure that the inp... | 31,128 | [
{
"from": "human",
"value": "Does anyone know the root cause of this error? I am feeding known good data to the fmt:parseDate tag (its db driven data controlled by us), and yet this error randomly pops up. I can't seem to find a way to replicate what causes this exception.\n"
},
{
"from": "gpt",
... |
This works (prints, for example, “3 arguments”):
to run argv
do shell script "echo " & (count argv) & " arguments"
end run
This doesn't (prints only “Argument 3: three”, and not the previous two arguments):
to run argv
do shell script "echo " & (count argv) & " arguments"
repeat with i from 1 to (count ar... | The issue you're encountering stems from how the `do shell script` command works in AppleScript. Specifically, the `do shell script` command captures any output that it generates, and if that output includes single quotes (as you are using in your `echo` command), it can interfere with the proper functioning of the she... | 31,468 | [
{
"from": "human",
"value": "This works (prints, for example, “3 arguments”):\nto run argv\n do shell script \"echo \" & (count argv) & \" arguments\"\nend run\n\nThis doesn't (prints only “Argument 3: three”, and not the previous two arguments):\nto run argv\n do shell script \"echo \" & (count argv)... |
We have a 50 projects solution in VS 2005.
Is any way to get incremental build if nothing was changed?
It is kind of doing it now, but it executes all prebuild and post build events for each project.
Is any way to prevent it?
| In Visual Studio 2005, the build system is set up to handle incremental builds, meaning it only recompiles projects that have changed since the last build. However, you may encounter situations where pre-build and post-build events still execute even if no files have changed. Here are a few ways to optimize your build ... | 25,814 | [
{
"from": "human",
"value": "We have a 50 projects solution in VS 2005. \nIs any way to get incremental build if nothing was changed? \nIt is kind of doing it now, but it executes all prebuild and post build events for each project. \nIs any way to prevent it?\n"
},
{
"from": "gpt",
"value"... |
I'm involved with updating an Access solution. It has a good amount of VBA, a number of queries, a small amount of tables, and a few forms for data entry & report generation. It's an ideal candidate for Access.
I want to make changes to the table design, the VBA, the queries, and the forms. How can I track my change... | Tracking changes in an Access database, particularly when it involves VBA code, queries, and forms, can indeed be challenging due to the nature of the `.mdb` or `.accdb` file as a binary file. Here are some strategies to effectively implement version control while minimizing the risk of getting your code out of sync:
... | 24,489 | [
{
"from": "human",
"value": "I'm involved with updating an Access solution. It has a good amount of VBA, a number of queries, a small amount of tables, and a few forms for data entry & report generation. It's an ideal candidate for Access.\nI want to make changes to the table design, the VBA, the queries,... |
I have an app with the following basic architecture:
A windows service (Service) that registers a .NET type (RemoteObject) for remote access (.NET Remoting). RemoteObject creates non-ThreadPool threads that use the ThreadPool to do IO processing. The size of the ThreadPool must be restricted to a limit for a particula... | It sounds like you're experiencing a deadlock or contention issue related to your architecture. When dealing with .NET Remoting and threading, the following points can help you understand and diagnose the hanging issue you're facing:
### Understanding Threading in .NET Remoting
1. **Synchronization Context**: When th... | 29,395 | [
{
"from": "human",
"value": "I have an app with the following basic architecture:\nA windows service (Service) that registers a .NET type (RemoteObject) for remote access (.NET Remoting). RemoteObject creates non-ThreadPool threads that use the ThreadPool to do IO processing. The size of the ThreadPool must... |
I'm no UNIX Guru, but I've had to set up a handful of slices for various web projects. I've used the articles on there to set up users, a basic firewall, nginx or apache, and other bits and pieces of a basic web server.
I foresee more slice administration in my future. Is there a more efficient way to set up users, pe... | Absolutely, there are several ways to automate the setup of users, permissions, and software on a clean server (often referred to as a "slice"). Here are a few approaches that can help streamline your server administration:
### 1. **Configuration Management Tools**
These tools allow you to define your server configura... | 29,020 | [
{
"from": "human",
"value": "I'm no UNIX Guru, but I've had to set up a handful of slices for various web projects. I've used the articles on there to set up users, a basic firewall, nginx or apache, and other bits and pieces of a basic web server. \nI foresee more slice administration in my future. Is ther... |
I'm trying to compile a program called ngrep, and when I ran configure, things seemed to go well, but when I run make, I get:
ngrep.c: In function ‘process’:
ngrep.c:544: error: ‘struct udphdr’ has no member named ‘source’
ngrep.c:545: error: ‘struct udphdr’ has no member named ‘dest’
make: *** [ngrep.o] Error 1 ... | The errors you are encountering during the compilation of `ngrep` suggest that the code is trying to access fields in the `udphdr` structure that do not exist in the version of the headers you are using. The `udphdr` structure is defined in `<netinet/udp.h>` on most Unix-like systems, and the fields `source` and `dest`... | 28,225 | [
{
"from": "human",
"value": "I'm trying to compile a program called ngrep, and when I ran configure, things seemed to go well, but when I run make, I get:\nngrep.c: In function ‘process’:\nngrep.c:544: error: ‘struct udphdr’ has no member named ‘source’\nngrep.c:545: error: ‘struct udphdr’ has no member nam... |
For a particular application, I need the screen saver to be disabled while it's running. The operator COULD manually turn it off, and then back on later, but the easiest thing to do would be to just keep the screen saver at bay while the application is running.
How do I do this? I've found code for actually turning of... | To prevent the screensaver from activating while your application is running, you can use a method called "power management". Specifically, you can use the `SetThreadExecutionState` function in the Windows API. This function can be used to inform the system that the application is actively running and that it should no... | 28,290 | [
{
"from": "human",
"value": "For a particular application, I need the screen saver to be disabled while it's running. The operator COULD manually turn it off, and then back on later, but the easiest thing to do would be to just keep the screen saver at bay while the application is running.\nHow do I do thi... |
The Winform application is release with ClickOnce in our Intranet. We store personal preference for the GUI in the Isolated Storage. All works pretty fine :)
The problem is when we have a new version of the application, we publish... all preferences are lost! User need to setup their preference over and over each versi... | Yes, you can manage isolated storage in your WinForms application in a way that allows user preferences to persist across application updates when using ClickOnce. By default, ClickOnce applications use isolated storage scoped to the version of the application, which is why user preferences are lost when a new version ... | 30,260 | [
{
"from": "human",
"value": "The Winform application is release with ClickOnce in our Intranet. We store personal preference for the GUI in the Isolated Storage. All works pretty fine :)\nThe problem is when we have a new version of the application, we publish... all preferences are lost! User need to setup... |
Inside a visual studio project I have the following folders (for example)
foo/
bar/
LongFolderName/
When I open up a file in LongFolderName/ the tab gets labeled with LongFolderName/L...me.ascx when I'd prefer LongFileName.ascx (omitting the name of the folder). Any way to set Visual Studio to ignore the folder name... | Visual Studio does not have a built-in option to customize the tab labels to exclude folder names, which can indeed lead to the issue you’re experiencing with tab clutter when working with longer file paths. However, here are a few workarounds you can consider to improve your experience:
### 1. **Use Shorter Folder Na... | 33,453 | [
{
"from": "human",
"value": "Inside a visual studio project I have the following folders (for example)\n\nfoo/ \nbar/\nLongFolderName/\n\nWhen I open up a file in LongFolderName/ the tab gets labeled with LongFolderName/L...me.ascx when I'd prefer LongFileName.ascx (omitting the name of the folder). Any way... |
I recently build myself a semi beef up PC (Q9450, 8GB DDR2 1066, 1TB HDD, Dual 8600GT, Vista Ultimate and Dual 22' Monitors) and I'm evaluating whether i should develop on a VPC/VMWare session on top of Vista or not?
One benefit I can see is that I can run the same VM on my Vista laptop so my development environment is... | It sounds like you've built a solid setup for development! Running a virtual machine (VM) on your Vista Ultimate system can provide several benefits, especially since you're looking to maintain consistency across different machines. Here are some considerations to help you evaluate whether to go with a VPC/VMWare setup... | 29,420 | [
{
"from": "human",
"value": "I recently build myself a semi beef up PC (Q9450, 8GB DDR2 1066, 1TB HDD, Dual 8600GT, Vista Ultimate and Dual 22' Monitors) and I'm evaluating whether i should develop on a VPC/VMWare session on top of Vista or not?\nOne benefit I can see is that I can run the same VM on my Vis... |
I have an ASP.NET web site dedicated to reporting on PBX extension stats. It comprises many report pages, with HTML generated almost purely by code-behind (setting a Label control's Text property instead of using Response.Write), using un-parameterised string literal SQL queries that populate By Reference DataTable pa... | Cleaning up a legacy ASP.NET web application is an important task that can significantly enhance maintainability, performance, and security. Here are several steps and considerations to help you through this process:
### 1. **Implement Parameterized Queries**
- **Why**: To prevent SQL Injection attacks, which can lea... | 25,797 | [
{
"from": "human",
"value": "I have an ASP.NET web site dedicated to reporting on PBX extension stats. It comprises many report pages, with HTML generated almost purely by code-behind (setting a Label control's Text property instead of using Response.Write), using un-parameterised string literal SQL querie... |
I would like to be able to set "Extend my Windows desktop onto this monitor" via code. A PowerShell script would be ideal. WMI seems the way forward but I have zero knowledge in WMI.
| To extend your Windows desktop onto another monitor using PowerShell, you can use the `DisplaySwitch.exe` utility available in Windows. However, there is no direct WMI command or simple PowerShell command to set the display mode to "Extend" specifically.
Instead, you can use PowerShell to call `DisplaySwitch.exe` with... | 33,530 | [
{
"from": "human",
"value": "I would like to be able to set \"Extend my Windows desktop onto this monitor\" via code. A PowerShell script would be ideal. WMI seems the way forward but I have zero knowledge in WMI.\n"
},
{
"from": "gpt",
"value": "To extend your Windows desktop onto another monit... |
I've been teaching OOP and was trying to convey to my students the important difference between inheritance and the creation of a subtype relation between two types. For example, in C++, I could use private inheritance to ensure that nobody outside sees the subtyping relation.
However, while I can think of a lot of sit... | The distinction between inheritance and subtype relation is indeed a crucial concept in object-oriented programming, and it’s great that you're emphasizing this to your students. While inheritance is often thought of as creating an "is-a" relationship that is visible to the outside world, private inheritance allows you... | 26,867 | [
{
"from": "human",
"value": "I've been teaching OOP and was trying to convey to my students the important difference between inheritance and the creation of a subtype relation between two types. For example, in C++, I could use private inheritance to ensure that nobody outside sees the subtyping relation.\n... |
I like to generate a thread dump programmatically. I've learned that there a basically two ways to do it:
Use the "Java Virtual Machine Tool Interface" JVM-TI
Use the higher abstracted "Java Debugger Interface" JDI
For the JVM-TI I was able to find some useful information, but I would have to write a JNI-DLL which, a... | Generating a thread dump using the Java Debug Interface (JDI) can indeed be complex, but it's manageable with the right approach. Here are the steps to help you get started, along with resources that may be useful.
### Steps to Generate a Thread Dump with JDI
1. **Setup Your Environment**:
Ensure you have the nece... | 26,371 | [
{
"from": "human",
"value": "I like to generate a thread dump programmatically. I've learned that there a basically two ways to do it:\n\nUse the \"Java Virtual Machine Tool Interface\" JVM-TI\nUse the higher abstracted \"Java Debugger Interface\" JDI\n\nFor the JVM-TI I was able to find some useful informa... |
F# declared namespace is not available in the c# project or visible through the object browser.
I have built a normal F# library project, but even after i build the project and reference it to my C# project, I am unable to access the desired namespace.
I am also unable to see it in the object browser, i get an error te... | It sounds like you're encountering a few different issues when trying to integrate your F# library with a C# project. Let's walk through some troubleshooting steps to address the problems you've described:
### 1. Ensure Proper Build Configuration
Make sure your F# project is correctly built:
- Right-click on your F# p... | 30,140 | [
{
"from": "human",
"value": "F# declared namespace is not available in the c# project or visible through the object browser.\nI have built a normal F# library project, but even after i build the project and reference it to my C# project, I am unable to access the desired namespace.\nI am also unable to see ... |
I have an SQL Server DB with a table with these fields:
A bit with the default value 1, NOT NULL.
A smalldatetime with the default value gettime(), NOT NULL.
An int with no default value, IDENTITY, NOT NULL.
When I generate Linq to SQL for this table, the following happens:
The bit is given no special treatment.
The... | You're correct in your assessment of the behavior of Linq to SQL with regard to your SQL Server table structure. Let's summarize the issues you're facing and look at potential solutions:
1. **The `bit` field with a default value**: In Linq to SQL, this field does not get the default value from the database when insert... | 27,282 | [
{
"from": "human",
"value": "I have an SQL Server DB with a table with these fields:\n\nA bit with the default value 1, NOT NULL.\nA smalldatetime with the default value gettime(), NOT NULL.\nAn int with no default value, IDENTITY, NOT NULL.\n\nWhen I generate Linq to SQL for this table, the following happe... |
We are trying to make a project template, but the documentation on this is spotty or non-existent.
Doing some reverse-engineering on some template files, we have come up with the following. However, it doen't actually work!
First of all, we have figured out that project templates should be installed inside:
~/Library/... | Creating custom project templates for Xcode can be quite challenging, especially when it comes to ensuring that both file names and content are properly substituted. You've already done a lot of good groundwork, but there are some nuances to the `TemplateInfo.plist` that can make or break the template's behavior.
### ... | 18,742 | [
{
"from": "human",
"value": "We are trying to make a project template, but the documentation on this is spotty or non-existent.\nDoing some reverse-engineering on some template files, we have come up with the following. However, it doen't actually work!\nFirst of all, we have figured out that project templ... |
I have a COM+ data service that is configured to use object pooling with a min and max pool size of 1. So I have a singleton. In some scenarios my Object count (the number of clients that have a reference to this instance) goes beyond 1 and steadily increases.
The instance creation and the one call to its method is wra... | The situation you’re encountering indicates a problem with how your COM+ object is being managed, particularly with regard to its lifecycle and instance management. The fact that the object count is increasing beyond the expected single instance suggests that there may be additional instances being created or that inst... | 28,636 | [
{
"from": "human",
"value": "I have a COM+ data service that is configured to use object pooling with a min and max pool size of 1. So I have a singleton. In some scenarios my Object count (the number of clients that have a reference to this instance) goes beyond 1 and steadily increases.\nThe instance crea... |
When I debug a C# program and I get an exception throwed (either thrown by code OR thrown by the framework), the IDE stops and get me to the corresponding line in my code.
Everything is fine for now.
I then press "F5" to continue. From this moment, it seams like I'm in an infinite loop. The IDE always get me back to th... | The behavior you're experiencing when debugging a C# application in an IDE like Visual Studio is often related to how exceptions are handled in your code or the configuration of the debugging settings. Here are some common causes and potential solutions:
### 1. Exception Handling:
- **Uncaught Exceptions**: When an ex... | 30,540 | [
{
"from": "human",
"value": "When I debug a C# program and I get an exception throwed (either thrown by code OR thrown by the framework), the IDE stops and get me to the corresponding line in my code.\nEverything is fine for now.\nI then press \"F5\" to continue. From this moment, it seams like I'm in an in... |
I installed Python 2.6 for one user on Windows Vista. Python works okay, but when I try: import Tkinter, it says the side-by-side configuration has errors. I've tried tinkering with the Visual Studio runtime, with no good results. Any ideas on how to resolve this?
| The error related to "side-by-side configuration" often indicates an issue with the Visual C++ runtime libraries that are required by some of the components of Python or Tkinter. Here's a series of steps you can follow to try to resolve the issue:
1. **Check Visual C++ Redistributables**: Make sure you have the correc... | 28,598 | [
{
"from": "human",
"value": "I installed Python 2.6 for one user on Windows Vista. Python works okay, but when I try: import Tkinter, it says the side-by-side configuration has errors. I've tried tinkering with the Visual Studio runtime, with no good results. Any ideas on how to resolve this?\n"
},
{... |
Why is using '*' to build a view bad ?
Suppose that you have a complex join and all fields may be used somewhere.
Then you just have to chose fields needed.
SELECT field1, field2 FROM aview WHERE ...
The view "aview" could be SELECT table1.*, table2.* ... FROM table1 INNER JOIN table2 ...
We have a problem if 2 fields... | Using `*` (the asterisk) in SQL to build views or queries can lead to several potential issues beyond just the problem of ambiguous column names. Here are some important considerations:
1. **Ambiguity with Column Names**: As you noted, if multiple tables have columns with the same name, using `*` will result in a conf... | 31,665 | [
{
"from": "human",
"value": "Why is using '*' to build a view bad ?\nSuppose that you have a complex join and all fields may be used somewhere.\nThen you just have to chose fields needed.\nSELECT field1, field2 FROM aview WHERE ...\n\nThe view \"aview\" could be SELECT table1.*, table2.* ... FROM table1 INN... |
I created a project using the default tab-controller project. I am using interface builder to edit the .xib file and add images and buttons. I hook them up to the FirstViewController object in interface builder (that I created and set it's class to the same as the code file). I hooked everything up using IBoutlets and ... | It sounds like you're facing a few intertwined issues with your Interface Builder setup and how it interacts with your view controllers. Let's break down the problem and explore potential solutions.
### 1. Multiple Referencing Outlets
When you say that hooking up your button to the "Selected First View Controller" lea... | 31,437 | [
{
"from": "human",
"value": "I created a project using the default tab-controller project. I am using interface builder to edit the .xib file and add images and buttons. I hook them up to the FirstViewController object in interface builder (that I created and set it's class to the same as the code file). I ... |
I've got nutch and lucene setup to crawl and index some sites and I'd like to use a .net website instead of the JSP site that comes with nutch.
Can anyone recommend some solutions?
I've seen solutions where there was an app running on the index server which the .Net site used remoting to connect to.
Speed is a consider... | It's great to hear that you've settled on using Solr with your ASP.NET site! Solr is a powerful search platform that works well with Lucene and offers a robust solution for indexing and searching through large volumes of data. Here are some additional points and recommendations regarding your implementation:
1. **Solr... | 32,174 | [
{
"from": "human",
"value": "I've got nutch and lucene setup to crawl and index some sites and I'd like to use a .net website instead of the JSP site that comes with nutch.\nCan anyone recommend some solutions?\nI've seen solutions where there was an app running on the index server which the .Net site used ... |
VB.Net2005
Simplified Code:
MustInherit Class InnerBase(Of Inheritor)
End Class
MustInherit Class OuterBase(Of Inheritor)
Class Inner
Inherits InnerBase(Of Inner)
End Class
End Class
Class ChildClass
Inherits OuterBase(Of ChildClass)
End Class
Class ChildClassTwo
Inherits OuterBase(Of ChildC... | The issue you're facing stems from the fact that in VB.NET, type parameters cannot be used as qualifiers in the way you're attempting with `Member.Inner`. This restriction applies to inner classes (or nested classes) because the compiler does not have enough information at compile time to resolve what `Member.Inner` sh... | 30,238 | [
{
"from": "human",
"value": "VB.Net2005\nSimplified Code:\n MustInherit Class InnerBase(Of Inheritor)\nEnd Class\n\nMustInherit Class OuterBase(Of Inheritor)\n Class Inner\n Inherits InnerBase(Of Inner)\n End Class\nEnd Class\n\nClass ChildClass\n Inherits OuterBase(Of ChildClass)\nEnd Class... |
Does anyone know of a way to store values as NVARCHAR in a manually created query in ColdFusion using the querynew() function? I have multiple parts of a largish program relying on using a query as an input point to construct an excel worksheet (using Ben's POI) so it's somewhat important I can continue to use it as a... | In ColdFusion, the `queryNew()` function can be used to create a new query object. However, when it comes to data types, ColdFusion does not explicitly support specifying column types such as NVARCHAR directly within the `queryNew()` function. The data types for the query are inferred based on the values you insert int... | 32,132 | [
{
"from": "human",
"value": "Does anyone know of a way to store values as NVARCHAR in a manually created query in ColdFusion using the querynew() function? I have multiple parts of a largish program relying on using a query as an input point to construct an excel worksheet (using Ben's POI) so it's somewha... |
I recently downloaded Mono 2 for my new MacBook. I'm trying to figure out how to compile Visual Studio solutions with xbuild, which is included in Mono. Any ideas?
| Certainly! To compile Visual Studio solutions using `xbuild`, which is a part of the Mono framework, you can follow these steps:
1. **Install Mono**: Make sure you have Mono installed on your Mac. You can download it from the [Mono Project website](https://www.mono-project.com/download/stable/).
2. **Open Terminal**:... | 31,510 | [
{
"from": "human",
"value": "I recently downloaded Mono 2 for my new MacBook. I'm trying to figure out how to compile Visual Studio solutions with xbuild, which is included in Mono. Any ideas?\n"
},
{
"from": "gpt",
"value": "Certainly! To compile Visual Studio solutions using `xbuild`, which ... |
It there any article/book that defines upper bounded design limits for WS timeouts? Do you timeout at the server or recommend the client specific timeouts too?
Is there a common best practice like "never design WS that can take longer than 60 seconds, use an asynchronous token pattern"
I am interested in knowing what y... | When it comes to designing web services (WS) and handling timeouts, there are indeed best practices and recommendations based on industry experience, though they may not be strictly defined in a single article or book. Here's an overview of common practices, including timeout design considerations and some insights int... | 30,971 | [
{
"from": "human",
"value": "It there any article/book that defines upper bounded design limits for WS timeouts? Do you timeout at the server or recommend the client specific timeouts too?\nIs there a common best practice like \"never design WS that can take longer than 60 seconds, use an asynchronous token... |
From C#, I want to do the equivalent of the following:
arp -a |findstr 192.168.1.254
Alternatively, the answer could call the SendARP function and get the results.
This will allow my application to do some other processing that requires the MAC address.
| You can achieve the equivalent of the command `arp -a | findstr 192.168.1.254` in C# by executing the ARP command and filtering the output for the desired IP address. You can also use the `SendARP` function to directly obtain the MAC address corresponding to an IP address without parsing the command output.
Here's how... | 28,130 | [
{
"from": "human",
"value": "From C#, I want to do the equivalent of the following:\narp -a |findstr 192.168.1.254\n\nAlternatively, the answer could call the SendARP function and get the results.\nThis will allow my application to do some other processing that requires the MAC address.\n"
},
{
"fro... |
If the Mono project is successful it will pave the way for commercial software on non-Windows platforms.
I am interested in the prospect of writing and selling commercial software for the Mono platform along the lines of our existing Smoke Vector Graphics (OCaml) and F# for Visualization (.NET) products. Are any commer... | The Mono project has indeed provided a viable platform for developing and running .NET applications on non-Windows systems, which has attracted interest from commercial software developers. Several companies and developers have successfully built libraries and applications using Mono, and some have reported profitabili... | 33,584 | [
{
"from": "human",
"value": "If the Mono project is successful it will pave the way for commercial software on non-Windows platforms.\nI am interested in the prospect of writing and selling commercial software for the Mono platform along the lines of our existing Smoke Vector Graphics (OCaml) and F# for Vis... |
I googled around and coulnd't really find an answer.
How do I open an audio input device (namely a microphone) as a stream (preferably) on a CE/WinMobile device using Compact Framework?
I looked at WindowsMobile.DirectX, at various classes that contained Audio in their name and nothing seemed to do the trick.
What I wa... | Streaming audio from a microphone on a Windows Mobile or CE device using the Compact Framework can be a bit challenging, as the APIs are limited compared to desktop versions of .NET. However, you can accomplish this by leveraging the capabilities of the Windows Mobile platform along with some native code if necessary.
... | 29,570 | [
{
"from": "human",
"value": "I googled around and coulnd't really find an answer.\nHow do I open an audio input device (namely a microphone) as a stream (preferably) on a CE/WinMobile device using Compact Framework?\nI looked at WindowsMobile.DirectX, at various classes that contained Audio in their name an... |
I am having a great deal of trouble getting named queries to work with nHibernate. My latest problem is getting the error message "could not execute query" with no additional information. Are there any complete examples I can download from somewhere because all the tutorials and documentation examples provide code snip... | It looks like you're working with NHibernate named queries but are facing issues due to the error message "could not execute query". This can be tricky, especially if there are no additional details provided in the exception. Here are some troubleshooting steps and a more complete example that could help you resolve th... | 26,267 | [
{
"from": "human",
"value": "I am having a great deal of trouble getting named queries to work with nHibernate. My latest problem is getting the error message \"could not execute query\" with no additional information. Are there any complete examples I can download from somewhere because all the tutorials a... |
Forgive my ignorance - still learning here.
I am using Eclipse Ganymede (Java 1.5) and have been experimenting with web services - I have mangaged to get a simple web service up and running and the nice wizard you get in Eclipse generates all the necessary bits and pieces e.g. wsdl file etc - and you can test the servi... | It's great that you're experimenting with web services! Let's clarify how the Apache Axis library is integrated into your web service and how it works with Apache Tomcat.
### 1. Axis Dependency
When you create a web service in Eclipse Ganymede and use the Axis wizard, Eclipse generates the necessary files and configu... | 29,929 | [
{
"from": "human",
"value": "Forgive my ignorance - still learning here.\nI am using Eclipse Ganymede (Java 1.5) and have been experimenting with web services - I have mangaged to get a simple web service up and running and the nice wizard you get in Eclipse generates all the necessary bits and pieces e.g. ... |
I want to create a trigger to check what is being deleted against business rules and then cancel the deletion if needed. Any ideas?
The solution used the Instead of Delete trigger. The Rollback tran stopped the delete. I was afraid that I would have a cascade issue when I did the delete but that didn't seem to happen. ... | Creating an `INSTEAD OF DELETE` trigger can indeed be a suitable way to implement business rules that check for conditions before allowing a deletion in a SQL Server database. The good news is that an `INSTEAD OF DELETE` trigger will prevent the default delete action from happening and will give you full control over t... | 28,877 | [
{
"from": "human",
"value": "I want to create a trigger to check what is being deleted against business rules and then cancel the deletion if needed. Any ideas?\nThe solution used the Instead of Delete trigger. The Rollback tran stopped the delete. I was afraid that I would have a cascade issue when I did t... |
I use FTP on a daily basis to work on multiple websites, but when I try to work from home, my darned satellite internet has a latency of about 1000ms. (Its craptastic service, I know, but there are no alternatives where I live.) Thus, I was wondering if there is a way that I can connect to my web server and transfer fi... | Using FTP over high-latency connections can be quite frustrating due to the protocol's reliance on a series of requests and acknowledgments for each file transfer. Here are several approaches you can take to improve your experience:
### 1. **Use SFTP or SCP**
- **SFTP (Secure File Transfer Protocol)** and **SCP (Secur... | 31,402 | [
{
"from": "human",
"value": "I use FTP on a daily basis to work on multiple websites, but when I try to work from home, my darned satellite internet has a latency of about 1000ms. (Its craptastic service, I know, but there are no alternatives where I live.) Thus, I was wondering if there is a way that I can... |
I have 3 divs where only one is visible by default, they each contain information about a product. Below this divs is a list of 3 images which are images of the products. By default of course the 1st list item is selected and has class="selected". When a different product image is clicks then class="selected" moves to ... | You can achieve the functionality you're looking for using a combination of HTML, CSS, and JavaScript. Below is a simple example that demonstrates how to create this product display system where you can click on product images to switch between the different product information.
### HTML
```html
<!DOCTYPE html>
<html ... | 29,152 | [
{
"from": "human",
"value": "I have 3 divs where only one is visible by default, they each contain information about a product. Below this divs is a list of 3 images which are images of the products. By default of course the 1st list item is selected and has class=\"selected\". When a different product imag... |
When doing TDD, how to tell "that's enough tests for this class / feature"?
I.e. when could you tell that you completed testing all edge cases?
| Determining when you've written "enough" tests for a class or feature in Test-Driven Development (TDD) can be a nuanced decision, as it often depends on several factors including complexity, risk, and project requirements. Here are some guidelines to help you assess whether you've covered the necessary edge cases:
###... | 27,074 | [
{
"from": "human",
"value": "When doing TDD, how to tell \"that's enough tests for this class / feature\"?\nI.e. when could you tell that you completed testing all edge cases?\n"
},
{
"from": "gpt",
"value": "Determining when you've written \"enough\" tests for a class or feature in Test-Driven ... |
How can I have a view render a partial (user control) from a different folder?
With preview 3 I used to call RenderUserControl with the complete path, but whith upgrading to preview 5 this is not possible anymore.
Instead we got the RenderPartial method, but it's not offering me the functionality I'm looking for.
| In ASP.NET MVC, when you want to render a partial view (also known as a user control) from a different folder, you can use the `RenderPartial` or `Partial` method. However, starting from ASP.NET Core, the method signatures and the way you reference views might change.
If you're using ASP.NET Core, you generally cannot... | 32,423 | [
{
"from": "human",
"value": "How can I have a view render a partial (user control) from a different folder?\nWith preview 3 I used to call RenderUserControl with the complete path, but whith upgrading to preview 5 this is not possible anymore.\nInstead we got the RenderPartial method, but it's not offering ... |
I want to run a background task that reads input from a TextReader and processes it a line at a time. I want the background task to block until the user types some text into a field and clicks the submit button. Is there some flavour of TextReader that will block until text is available and lets you somehow add more te... | Creating a blocking input stream that waits for user input can be a bit tricky, especially if you're trying to design a plug-in architecture that behaves like old-fashioned console applications. However, you can achieve the desired functionality using a combination of `BlockingCollection<string>` for managing input lin... | 25,692 | [
{
"from": "human",
"value": "I want to run a background task that reads input from a TextReader and processes it a line at a time. I want the background task to block until the user types some text into a field and clicks the submit button. Is there some flavour of TextReader that will block until text is a... |
I need to write the content of a map (key is ID of int, value is of self-defined struct) into a file, and load it from the file later on. Can I do it in MFC with CArchive?
Thank you!
| Yes, you can definitely use MFC's `CArchive` class to serialize and deserialize a `std::map` or similar container with a custom struct as the value. Here’s a basic example to illustrate how to achieve this:
### Step 1: Define Your Custom Struct
First, define your custom struct and make it serializable by implementing... | 28,013 | [
{
"from": "human",
"value": "I need to write the content of a map (key is ID of int, value is of self-defined struct) into a file, and load it from the file later on. Can I do it in MFC with CArchive?\nThank you!\n"
},
{
"from": "gpt",
"value": "Yes, you can definitely use MFC's `CArchive` class... |
How can I get Environnment variables and if something is missing, set the value?
| You can get environment variables in various programming languages, and if a specific environment variable is missing, you can set a default value. Below are examples in Python, JavaScript (Node.js), and Bash.
### Python
In Python, you can use the `os` module to access environment variables. Here's how you can do it:... | 31,001 | [
{
"from": "human",
"value": "How can I get Environnment variables and if something is missing, set the value?\n"
},
{
"from": "gpt",
"value": "You can get environment variables in various programming languages, and if a specific environment variable is missing, you can set a default value. Below... |
I have this doubt, I've searched the web and the answers seem to be diversified. Is it better to use mysql_pconnect over mysql_connect when connecting to a database via PHP? I read that pconnect scales much better, but on the other hand, being a persistent connection... having 10 000 connections at the same time, all p... | When considering whether to use `mysql_pconnect` (persistent connection) or `mysql_connect` (normal connection) in PHP, there are several factors to weigh. It's important to note that both of these functions are deprecated as of PHP 5.5.0 and removed as of PHP 7.0.0. Therefore, if you're using a more recent version of ... | 31,657 | [
{
"from": "human",
"value": "I have this doubt, I've searched the web and the answers seem to be diversified. Is it better to use mysql_pconnect over mysql_connect when connecting to a database via PHP? I read that pconnect scales much better, but on the other hand, being a persistent connection... having 1... |
What is the best way to create several scrollable regions in an ActionScript 3 visualization that extends flash.display.Sprite and makes use of hierarchy of of low level DisplayObjects (Sprite'a, Shape's, TextField)?
I have tried to use three mx.containers.Canvas objects added as children of the main Sprite and have a... | Creating scrollable regions in ActionScript 3 can be effectively done using a combination of Sprites and a scrolling mechanism. It seems like you're trying to use `mx.containers.Canvas` from Flex, which might introduce complexity, particularly when dealing with the display list and how Flash Player handles its renderin... | 24,493 | [
{
"from": "human",
"value": "What is the best way to create several scrollable regions in an ActionScript 3 visualization that extends flash.display.Sprite and makes use of hierarchy of of low level DisplayObjects (Sprite'a, Shape's, TextField)? \nI have tried to use three mx.containers.Canvas objects added... |
When a web site is licensed under Creative Commons, I use the rel-license microformat. When a web site is licensed under regular copyright, I have a boring paragraph element.
<p id="copyright">© 2008 Example Corporation</p>
That id attribute on there is just for CSS styling purposes. I'm wondering if there's some... | Using semantic HTML is a good way to improve accessibility and SEO, and there are indeed better ways to mark up copyright information than a simple paragraph tag. While Dublin Core is one option for metadata, a simpler approach can be employed directly in the HTML document.
Here are a couple of semantic options you ca... | 30,984 | [
{
"from": "human",
"value": "When a web site is licensed under Creative Commons, I use the rel-license microformat. When a web site is licensed under regular copyright, I have a boring paragraph element.\n<p id=\"copyright\">© 2008 Example Corporation</p>\n\nThat id attribute on there is just for CSS s... |
In my database I have tables that define types for example
Table: Publication Types
ID | Type
----------
1 | Article
2 | Abstract
3 | Book
....
Which is related through the ID key to a publication tables which has the field TypeID.
I then create a PublicationTable data table my .NET application which I want to fi... | You're on the right track with your `countPublications` function, but there are a few ways you can improve or refactor your code to make it more maintainable and clear. Here are some approaches you might consider:
### 1. Use Enum for Publication Types
Using an enum is a clean and effective way to manage publication t... | 25,876 | [
{
"from": "human",
"value": "In my database I have tables that define types for example\nTable: Publication Types\n\n\nID | Type\n----------\n1 | Article\n2 | Abstract\n3 | Book\n....\n\nWhich is related through the ID key to a publication tables which has the field TypeID.\nI then create a PublicationTa... |
I've been searching around and haven't found any reference to tools that can create Safari's webarchive format.
Does anyone have pointers to code for creating this format, or at least a format reference documentation?
Ideally I'd like to build a tool that takes a directory and splits out a webarchive, for loading into ... | Creating a `.webarchive` file, the format used by Safari to store web pages along with their resources (like images, stylesheets, etc.), can be a bit challenging since Apple hasn't officially documented the format. However, you can still create `.webarchive` files using certain programming libraries and tools.
Here ar... | 30,762 | [
{
"from": "human",
"value": "I've been searching around and haven't found any reference to tools that can create Safari's webarchive format.\nDoes anyone have pointers to code for creating this format, or at least a format reference documentation?\nIdeally I'd like to build a tool that takes a directory and... |
Scenario: I have a function that I need to tweak in some way (example; make it work slightly different in different places). For some reason I end up having to add something ugly to the code, either in the function or at existing call sites. Assume that the sum total "ugly" is the same in both cases.
The question is wh... | When deciding between encapsulating the "ugly" part of a function or extracting it, there are several factors to consider. Here's a breakdown of how the situation you've described might influence the choice:
### 1. **Function Cleanliness and Maintainability**
- **If the function is clean and generic right now**: You w... | 29,879 | [
{
"from": "human",
"value": "Scenario: I have a function that I need to tweak in some way (example; make it work slightly different in different places). For some reason I end up having to add something ugly to the code, either in the function or at existing call sites. Assume that the sum total \"ugly\" is... |
i have a class with a static public property called "Info".
via reflection i want to get this properties value, so i call:
PropertyInfo pi myType.GetProperty("Info");
string info = (string) pi.GetValue(null, null);
this works fine as long as the property is of type string. but actually my property is of type IPluginI... | When you're using reflection to access a static property that returns a non-primitive type (like your `IPluginInfo`), the approach you've provided should generally work correctly. However, there are a few things you might want to check to ensure you're getting the expected result.
1. **Property Name:** Ensure that the... | 30,305 | [
{
"from": "human",
"value": "i have a class with a static public property called \"Info\". \nvia reflection i want to get this properties value, so i call:\nPropertyInfo pi myType.GetProperty(\"Info\");\nstring info = (string) pi.GetValue(null, null);\n\nthis works fine as long as the property is of type st... |
I have db table with parent child relationship as:
NodeId NodeName ParentId
------------------------------
1 Node1 0
2 Node2 0
3 Node3 1
4 Node4 1
5 Node5 3
6 Node6 5
7 Node7 2
Here parentId = 0 means that it is a r... | To retrieve all child nodes for a given parent node (including nested children) in a SQL Server environment, you can use a Common Table Expression (CTE). However, please note that CTEs were introduced in SQL Server 2005, so they are suitable for this case.
The following SQL query uses a recursive CTE to get all the ch... | 31,978 | [
{
"from": "human",
"value": "I have db table with parent child relationship as:\nNodeId NodeName ParentId\n------------------------------\n1 Node1 0\n2 Node2 0\n3 Node3 1\n4 Node4 1\n5 Node5 3\n6 Node6 5\n7 Nod... |
After becoming somewhat estranged open source, and spending some years developing web applications in ASP.NET, I'm going to start doing quite a lot of PHP / MySQL development.
I've quite painlessly installed WampServer to get a development environment up and running on my Windows machine, but the platform I'll be targe... | Developing PHP/MySQL applications on a Windows environment using WampServer is a great way to get started. However, there are several factors to consider when targeting a Linux production environment:
### Potential Issues:
1. **Case Sensitivity**:
- Linux filesystems are case-sensitive, whereas Windows filesystems ... | 24,070 | [
{
"from": "human",
"value": "After becoming somewhat estranged open source, and spending some years developing web applications in ASP.NET, I'm going to start doing quite a lot of PHP / MySQL development.\nI've quite painlessly installed WampServer to get a development environment up and running on my Windo... |
Recently I've been doing lots of weekend coding, and have began to really need a bugtracker as things are gaining speed. This is probably the worst case scenario because I basically have to let things cool down over the week,so I simply can't remember the bugs in my head. So far I've been using a text file to jot down ... | It's great to hear that you've been actively coding and are looking for a better way to manage your bugs! Here are some bug tracking tools that are user-friendly, quick to set up, and work well on macOS (and other platforms):
### 1. **GitHub Issues**
- **Overview**: If you are already using GitHub for version control,... | 29,162 | [
{
"from": "human",
"value": "Recently I've been doing lots of weekend coding, and have began to really need a bugtracker as things are gaining speed. This is probably the worst case scenario because I basically have to let things cool down over the week,so I simply can't remember the bugs in my head. So far... |
I have this problem:
The text "ABCD\r\nEFGHJ" loaded from a file is matched with java regex "EFGH". Matcher object of course says start of the matched string is in position 6. The matcher counts \r \n as two positions.
I put the original text in a AWT TextArea Component and then call select(6,10) to highlight the area ... | The issue you are encountering arises from the way the `TextArea` component interprets newlines versus how your regular expression matcher counts positions in the string.
### Problem Breakdown:
1. **Matcher Position Counting**: The Java `Matcher` counts the `\r` and `\n` characters as separate characters, meaning that... | 28,885 | [
{
"from": "human",
"value": "I have this problem:\nThe text \"ABCD\\r\\nEFGHJ\" loaded from a file is matched with java regex \"EFGH\". Matcher object of course says start of the matched string is in position 6. The matcher counts \\r \\n as two positions.\nI put the original text in a AWT TextArea Componen... |
Every time you start Visual Studio, the first time you click "Add Reference" to add a DLL reference to a project, by default, the .NET tab on that dialog box is selected. As most people reading this have probably noticed, it can take a long time -- often more than 30 seconds -- for the full list of .NET components to ... | Unfortunately, Visual Studio does not provide a built-in option to change the default tab that appears in the "Add Reference" dialog when you click it for the first time. The default behavior is to always open to the ".NET" tab, and there are no direct settings to modify this.
However, there are a few workarounds and ... | 28,669 | [
{
"from": "human",
"value": "Every time you start Visual Studio, the first time you click \"Add Reference\" to add a DLL reference to a project, by default, the .NET tab on that dialog box is selected. As most people reading this have probably noticed, it can take a long time -- often more than 30 seconds ... |
We have a 3D application that retrieves keyboard presses via the IDirectInputDevice8. Is there any way, when we retrive keyboard events via the win32 API winproc loop back that we can send these commands to the DirectInputDevice?
| Yes, it is possible to capture keyboard events in a Win32 application using the WinProc message loop and then send those keyboard events to a DirectInput device like `IDirectInputDevice8`. However, you will need to manually translate the Win32 keyboard messages into DirectInput keyboard state updates. Below are the ste... | 25,831 | [
{
"from": "human",
"value": "We have a 3D application that retrieves keyboard presses via the IDirectInputDevice8. Is there any way, when we retrive keyboard events via the win32 API winproc loop back that we can send these commands to the DirectInputDevice?\n"
},
{
"from": "gpt",
"value": "Yes,... |
Sql Server Management Studio 2008 is not scripting table permissions even when I select the option to script object level permissions. Is this a bug or is there another way to do this?
It is creating permissions for stored procs, but not for tables. I am a sysadmin.
If it doesn't work, are there free sql server tools t... | The issue you're facing with SQL Server Management Studio (SSMS) 2008 not scripting table permissions can be attributed to a couple of factors. SSMS, particularly older versions like 2008, has known limitations and bugs, and sometimes certain features do not work as expected.
### Possible Reasons:
1. **Version Limitat... | 30,167 | [
{
"from": "human",
"value": "Sql Server Management Studio 2008 is not scripting table permissions even when I select the option to script object level permissions. Is this a bug or is there another way to do this?\nIt is creating permissions for stored procs, but not for tables. I am a sysadmin.\nIf it does... |
After having looked at each of these two projects, it seems that both are VERY similar. Both run on top of the CLI, both have python style syntax, both use .NET instead of the standard python libraries.
So, what are the differences between them and advantages of each?
| It seems you are comparing two projects that utilize CLI (Command Line Interface), Python-like syntax, and .NET instead of standard Python libraries. While the projects share some similarities, there are likely to be key differences that distinguish them. Below are some general aspects that can help compare and contras... | 30,134 | [
{
"from": "human",
"value": "After having looked at each of these two projects, it seems that both are VERY similar. Both run on top of the CLI, both have python style syntax, both use .NET instead of the standard python libraries.\nSo, what are the differences between them and advantages of each?\n"
},
... |
How is Silverlight going to change the internet in the next 10 years?
Is this going to be a scene changer or just another blip?
| Silverlight, a platform developed by Microsoft for building rich internet applications, has already seen a decline in relevance and usage over the past several years. As of my last knowledge update in October 2023, Microsoft officially ended support for Silverlight in October 2021. Consequently, its influence on the fu... | 32,579 | [
{
"from": "human",
"value": "How is Silverlight going to change the internet in the next 10 years?\nIs this going to be a scene changer or just another blip?\n"
},
{
"from": "gpt",
"value": "Silverlight, a platform developed by Microsoft for building rich internet applications, has already seen ... |
Is there a way to change the available elements based on a previous element value?
I have some lookup 'Cause' codes but some of these only belong to certain 'Products'.
I therefore want to create each products lookup cause code enumeration and let this only be available based on the product selection.
Is this possible ... | Yes, it is definitely possible to change the available options for one element based on the value selected in another element. This technique is often referred to as "dependent dropdowns" or "cascading dropdowns". The implementation can vary depending on the technologies and frameworks you are using (such as HTML, Java... | 26,427 | [
{
"from": "human",
"value": "Is there a way to change the available elements based on a previous element value?\nI have some lookup 'Cause' codes but some of these only belong to certain 'Products'.\nI therefore want to create each products lookup cause code enumeration and let this only be available based ... |
In my Winforms application, I want to export the data from my DataGridView to a Excel spreadsheet.
Is it simply a job of looping and outputting the results comma seperated?
| Exporting data from a `DataGridView` to an Excel spreadsheet can be done in several ways, and while you could output the results in a comma-separated format (CSV), a more straightforward and versatile approach would be to use a library that can directly interact with Excel. This will allow you to create actual Excel fi... | 26,591 | [
{
"from": "human",
"value": "In my Winforms application, I want to export the data from my DataGridView to a Excel spreadsheet.\nIs it simply a job of looping and outputting the results comma seperated?\n"
},
{
"from": "gpt",
"value": "Exporting data from a `DataGridView` to an Excel spreadsheet... |
Our company runs a web site (oursite.com) with affiliate partners who send us traffic. In some cases, we set up our affiliates with their own subdomain (affiliate.oursite.com), and they display selected content from our site on their site (affiliate.com) using an iframe.
Example of a page on their site:
<html>
<head></... | To effectively track your `affiliate.oursite.com` traffic through Google Analytics while the content is served in an iframe on `affiliate.com`, you'll need to address the issues caused by cross-domain tracking and third-party cookie restrictions. Here are some approaches to consider:
### 1. Use Cross-Domain Tracking
... | 19,703 | [
{
"from": "human",
"value": "Our company runs a web site (oursite.com) with affiliate partners who send us traffic. In some cases, we set up our affiliates with their own subdomain (affiliate.oursite.com), and they display selected content from our site on their site (affiliate.com) using an iframe.\nExampl... |
I have a std::multimap where key is a custom class. Something like this:
Class X {
public:
std::string s;
int x;
operator <(const X& other) const { return s < other.s; }
};
std::multimap<X, int> mymap;
Now, I'd like to use upper_bound and lower_bound to iterate over all elements with the same value of "s".... | In your implementation of the class `X`, you have defined the less-than operator (`operator<`), which is sufficient for the `std::multimap` to manage ordering of the keys based on `s`. However, for using `upper_bound` and `lower_bound`, you do not need to implement an equality operator (`operator==`) specifically.
`st... | 31,497 | [
{
"from": "human",
"value": "I have a std::multimap where key is a custom class. Something like this:\nClass X {\npublic:\n std::string s;\n int x;\n operator <(const X& other) const { return s < other.s; }\n};\nstd::multimap<X, int> mymap;\n\nNow, I'd like to use upper_bound and lower_bound to ite... |
For performance reasons, I draw the strings for my UITableViewCell in a custom view that overrides its drawRect method to draw strings directly in the view rectangle using NSString:drawInRect. This is similar to Apple's TableViewSuite Example 5-CustomTableViewCell.
However, when I invoke setEditing on the cell to bring... | When you override the `drawRect:` method for custom drawing in a `UIView` that is used in a `UITableViewCell`, and then use `setEditing:animated:` to trigger the editing mode, the layout might get disrupted due to the layout process. The issue you are experiencing with the "squeezed" appearance could stem from how UIKi... | 32,553 | [
{
"from": "human",
"value": "For performance reasons, I draw the strings for my UITableViewCell in a custom view that overrides its drawRect method to draw strings directly in the view rectangle using NSString:drawInRect. This is similar to Apple's TableViewSuite Example 5-CustomTableViewCell.\nHowever, whe... |
I know about "class having a single reason to change". Now, what is that exactly? Are there some smells/signs that could tell that class does not have a single responsibility? Or could the real answer hide in YAGNI and only refactor to a single responsibility the first time your class changes?
| The principle of "a class having a single reason to change" is a fundamental concept in software design, often articulated in the context of the **Single Responsibility Principle (SRP)**, which is one of the five SOLID principles of object-oriented design. The idea is that a class should only have one reason to change,... | 28,440 | [
{
"from": "human",
"value": "I know about \"class having a single reason to change\". Now, what is that exactly? Are there some smells/signs that could tell that class does not have a single responsibility? Or could the real answer hide in YAGNI and only refactor to a single responsibility the first time yo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.