instruction stringlengths 14 27.6k | completion stringlengths 3 38.3k | __original_row_idx int64 0 50k | conversations listlengths 2 2 |
|---|---|---|---|
I'm implementing a plugin architecture to implement authentication an external authentication mechanism for a web site. One of the plugins I plan to provide is an ActiveDirectory plugin. I'd like to implement some of the features of a MembershipProvider, including MinRequiredPasswordLength, but don't want to fully im... | In Active Directory, the minimum password length is generally defined through Group Policy Objects (GPOs). Unfortunately, there isn't a direct way to query Active Directory to retrieve the minimum password length setting because it is not stored as a property of user objects but rather as part of the GPO applied to the... | 34,045 | [
{
"from": "human",
"value": "I'm implementing a plugin architecture to implement authentication an external authentication mechanism for a web site. One of the plugins I plan to provide is an ActiveDirectory plugin. I'd like to implement some of the features of a MembershipProvider, including MinRequiredP... |
What win32 calls can be used to detect key press events globally (not just for 1 window, I'd like to get a message EVERY time a key is pressed), from a windows service?
| To detect global key press events in a Windows service, you typically need to use low-level keyboard hooks, which can be achieved with Win32 API calls. However, it is important to note that Windows services run in a different session than the user interface, which complicates capturing keyboard events directly from the... | 37,054 | [
{
"from": "human",
"value": "What win32 calls can be used to detect key press events globally (not just for 1 window, I'd like to get a message EVERY time a key is pressed), from a windows service?\n"
},
{
"from": "gpt",
"value": "To detect global key press events in a Windows service, you typic... |
I'm trying to convert some Xaml to HTML using the .NET XslCompiledTransform and am running into difficulties getting the xslt to match Xaml tags. For instance with this Xaml input:
<FlowDocument PagePadding="5,0,5,0" AllowDrop="True" NumberSubstitution.CultureSource="User" xmlns="http://schemas.microsoft.com/winfx/200... | Yes, the issue you are encountering is indeed due to the XML namespace in your XAML. XAML elements such as `<FlowDocument>` and `<Paragraph>` are in a specific namespace, which must be declared and matched correctly in your XSLT.
Your XAML input has a default namespace defined as `http://schemas.microsoft.com/winfx/20... | 37,286 | [
{
"from": "human",
"value": "I'm trying to convert some Xaml to HTML using the .NET XslCompiledTransform and am running into difficulties getting the xslt to match Xaml tags. For instance with this Xaml input:\n<FlowDocument PagePadding=\"5,0,5,0\" AllowDrop=\"True\" NumberSubstitution.CultureSource=\"User... |
So lets say I'm using Python's ftplib to retrieve a list of log files from an FTP server. How would I parse that list of files to get just the file names (the last column) inside a list? See the link above for example output.
| To retrieve and parse a list of log files from an FTP server using Python's `ftplib`, you can follow these general steps:
1. Connect to the FTP server.
2. Retrieve the list of files using the `nlst()` or `dir()` method.
3. Parse the output to extract just the filenames.
Here's an example code snippet that demonstrate... | 36,418 | [
{
"from": "human",
"value": "So lets say I'm using Python's ftplib to retrieve a list of log files from an FTP server. How would I parse that list of files to get just the file names (the last column) inside a list? See the link above for example output.\n"
},
{
"from": "gpt",
"value": "To retri... |
I'm using Hibernate with Spring in my application. I have been consistently using detached objects and reattaching them whenever I need to make calls to the database. I'm using hibernate template to take care of managing the connections for me.
My data structure is as follows:
classA:
<one-to-many name="classB" inv... | The error you're encountering indicates that Hibernate is trying to save an object that has been marked as deleted, which results in an `ObjectDeletedException`. This typically happens when you are using the `merge()` method with an entity graph that has associations where some of the objects in those associations have... | 33,081 | [
{
"from": "human",
"value": "I'm using Hibernate with Spring in my application. I have been consistently using detached objects and reattaching them whenever I need to make calls to the database. I'm using hibernate template to take care of managing the connections for me.\nMy data structure is as follows:\... |
I'm having a problem adding a reference to a .NET assembly I built. Here's what I did.
I created a .NET assembly (testlib.dll).
I made sure it had a strong name (added a keyfile).
I creates a WiX installation project for that assembly.
I added Assembly='.net' and KeyPath='yes' to the File property for the assembly.
T... | To make your .NET assembly (`testlib.dll`) show up in the Add Reference dialog, especially under the .NET tab, you need to ensure a few things:
1. **Assembly Metadata**: Make sure that your assembly has the appropriate metadata defined in the AssemblyInfo.cs file. You should have attributes like `AssemblyTitle`, `Asse... | 33,796 | [
{
"from": "human",
"value": "I'm having a problem adding a reference to a .NET assembly I built. Here's what I did.\n\nI created a .NET assembly (testlib.dll).\nI made sure it had a strong name (added a keyfile).\nI creates a WiX installation project for that assembly.\nI added Assembly='.net' and KeyPath='... |
I need help writing the following method:
def get_new_location(current_location, target_location, distance_travelled):
...
...
return new_location
where all locations are (lat,long)
I realize that there are different models for the earth (WGS-84, GRS-80, ...) which take into account the fact that the earth... | To achieve what you're looking for, it’s important to understand that directly interpolating between the latitude and longitude of two points as you suggested will generally not give you the shortest path over the surface of a sphere (the great-circle path). Instead, your approach of taking a linear interpolation (the ... | 34,519 | [
{
"from": "human",
"value": "I need help writing the following method:\ndef get_new_location(current_location, target_location, distance_travelled):\n ...\n ...\n return new_location\n\nwhere all locations are (lat,long)\nI realize that there are different models for the earth (WGS-84, GRS-80, ...)... |
How can I get the start and end positions of all matches using the re module? For example given the pattern r'[a-z]' and the string 'a1b2c3d4' I'd want to get the positions where it finds each letter. Ideally, I'd like to get the text of the match back too.
| You can use the `re.finditer()` function from the `re` module in Python to find all matches of a pattern in a string, along with their start and end positions. This function returns an iterator that produces match objects for each match found, from which you can extract the start and end positions, as well as the match... | 34,127 | [
{
"from": "human",
"value": "How can I get the start and end positions of all matches using the re module? For example given the pattern r'[a-z]' and the string 'a1b2c3d4' I'd want to get the positions where it finds each letter. Ideally, I'd like to get the text of the match back too.\n"
},
{
"from... |
We are currently creating an InfoPath 2007 form is deployed in SharePoint 2007. In the form we populate the repeating tables with more than 60 records. However, when we're submitting the form, an error message appears. Does the number of records in the repeating table affects the submitting of the form? Also provide so... | Yes, the number of records in the repeating table can indeed affect the submission of the InfoPath form in SharePoint 2007. InfoPath has certain limitations when it comes to the size of the XML data that can be submitted. If your form contains too much data, it might exceed the limits set by InfoPath or SharePoint, res... | 36,334 | [
{
"from": "human",
"value": "We are currently creating an InfoPath 2007 form is deployed in SharePoint 2007. In the form we populate the repeating tables with more than 60 records. However, when we're submitting the form, an error message appears. Does the number of records in the repeating table affects th... |
Its my understanding that the recommended approach to localization in WPF is to use the LocBaml tool to extract the localizable items into e.g. a csv file, translate the items into the desired language and regenerate a new sattelite assembly from this csv file. However from my experiments this seems to conflict with th... | Your understanding of localization in WPF and the use of LocBaml is correct, but as you've discovered, merging resources from different sources can be challenging. Here’s a recommended approach to help manage localization resources effectively while addressing the conflicts you mentioned:
### Recommended Approach:
1.... | 29,934 | [
{
"from": "human",
"value": "Its my understanding that the recommended approach to localization in WPF is to use the LocBaml tool to extract the localizable items into e.g. a csv file, translate the items into the desired language and regenerate a new sattelite assembly from this csv file. However from my e... |
In Eclipse you can double-click on the tab of the code window and expand it to full size, e.g. if you will be working on just the code awhile and want maximum size on a smaller monitor, etc.
Is there a way to expand the code window in Visual Studio.NET in one click (otherwise I have to collapse Toolbox, Solution Explor... | In Visual Studio, there isn't a direct one-click feature to maximize the code window similar to double-clicking the tab in Eclipse. However, you can use the following methods to achieve a larger code window:
1. **Toggle Full Screen Mode**:
- You can press `Shift + Alt + Enter` to enter or exit full-screen mode. Th... | 37,292 | [
{
"from": "human",
"value": "In Eclipse you can double-click on the tab of the code window and expand it to full size, e.g. if you will be working on just the code awhile and want maximum size on a smaller monitor, etc.\nIs there a way to expand the code window in Visual Studio.NET in one click (otherwise I... |
If I have a date, how do I calculate the week number for that date within that year?
For example, in 2008, January 1st to January 6th are in week 1 and January 7th to the 13th are in week 2, so if my date was January 10th 2008, my week number would be 2.
An algorithm would be great to get me started and sample code wou... | To calculate the week number of a given date within a year, you can follow a simple algorithm that determines how many complete weeks (of 7 days) have elapsed since the beginning of the year.
Here's a basic algorithm to determine the week number:
1. Get the first day of the year.
2. Calculate the difference in days b... | 32,970 | [
{
"from": "human",
"value": "If I have a date, how do I calculate the week number for that date within that year?\nFor example, in 2008, January 1st to January 6th are in week 1 and January 7th to the 13th are in week 2, so if my date was January 10th 2008, my week number would be 2.\nAn algorithm would be ... |
Is there any way to change the entire width of the horizontal scroll bar on a scrolling div (including the nudge arrows and the handle).
EDIT: I only need an IE7 solution - it's for a scrolling DIV on a touch screen terminal
Thanks
Matt
| Changing the entire width of the horizontal scrollbar in Internet Explorer 7 can be quite challenging due to the limited styling options available. However, you can achieve a custom scrollbar look by using a combination of CSS and some JavaScript or by using a workaround with nested elements.
Here’s a general approach... | 33,459 | [
{
"from": "human",
"value": "Is there any way to change the entire width of the horizontal scroll bar on a scrolling div (including the nudge arrows and the handle).\nEDIT: I only need an IE7 solution - it's for a scrolling DIV on a touch screen terminal\nThanks\nMatt\n"
},
{
"from": "gpt",
"val... |
I can't seem to set a ContentTemplate for a ComboBoxItem. There reason I'm trying to do this is I want to have 2 appearances for my data in the combo box. When the combo box is open (menu is down) I want a text box (with the name of the image) and an image control below it. When I select the item I want the combo box t... | To achieve a ComboBox that displays different templates for the selected item and the dropdown items, you can utilize the `ItemTemplate` and `SelectionBoxItemTemplate` properties of the ComboBox.
1. **ItemTemplate**: This is used for the items displayed in the dropdown.
2. **SelectionBoxItemTemplate**: This is used fo... | 33,136 | [
{
"from": "human",
"value": "I can't seem to set a ContentTemplate for a ComboBoxItem. There reason I'm trying to do this is I want to have 2 appearances for my data in the combo box. When the combo box is open (menu is down) I want a text box (with the name of the image) and an image control below it. When... |
What's your preferred way of wrapping lines of code, especially when it comes to long argument lists?
There has been several questions relating to wrapping lines (such as When writing code do you wrap text or not? and Line width formatting standard), but I haven't been able to find one which covers where to wrap a line... | When it comes to wrapping lines of code, especially for long argument lists, there are a few common styles that developers tend to follow. The choice of style often comes down to personal preference, team standards, or the specific coding conventions of a programming language or framework. Here are some recommended app... | 34,867 | [
{
"from": "human",
"value": "What's your preferred way of wrapping lines of code, especially when it comes to long argument lists?\nThere has been several questions relating to wrapping lines (such as When writing code do you wrap text or not? and Line width formatting standard), but I haven't been able to ... |
A PHP array can have arrays for its elements. And those arrays can have arrays and so on and so forth. Is there a way to find out the maximum nesting that exists in a PHP array? An example would be a function that returns 1 if the initial array does not have arrays as elements, 2 if at least one element is an array, an... | Yes, you can determine the maximum nesting level of a PHP array by recursively traversing the array and keeping track of the current depth. Here’s a function that does just that:
```php
function getMaxNestingLevel(array $array, $level = 1) {
$maxLevel = $level;
foreach ($array as $element) {
if (is_ar... | 35,603 | [
{
"from": "human",
"value": "A PHP array can have arrays for its elements. And those arrays can have arrays and so on and so forth. Is there a way to find out the maximum nesting that exists in a PHP array? An example would be a function that returns 1 if the initial array does not have arrays as elements, ... |
If I have several Section elements in an XML document, what XQuery do I use to get a list of all the name values?
<Section name="New Clients" filePath="XNEWCUST.TXT" skipSection="False">
| To retrieve a list of all the `name` attributes from multiple `<Section>` elements in an XML document using XQuery, you can use the following query:
```xquery
for $section in //Section
return $section/@name
```
This query does the following:
1. The `for $section in //Section` part selects all `<Section>` elements in... | 39,244 | [
{
"from": "human",
"value": "If I have several Section elements in an XML document, what XQuery do I use to get a list of all the name values?\n<Section name=\"New Clients\" filePath=\"XNEWCUST.TXT\" skipSection=\"False\">\n\n"
},
{
"from": "gpt",
"value": "To retrieve a list of all the `name` a... |
How would I go about creating a real world form creation class that I can use to display a new form with fields of different types, as how many fields I want, I can use drop downs and I can do all of this by using OOP?
| Creating a real-world form creation class in an object-oriented programming (OOP) paradigm involves several steps. Below is a conceptual guide and a sample implementation in Python to illustrate how you might design and build such a class. The following example will focus on the basics and can be expanded based on your... | 34,137 | [
{
"from": "human",
"value": "How would I go about creating a real world form creation class that I can use to display a new form with fields of different types, as how many fields I want, I can use drop downs and I can do all of this by using OOP?\n"
},
{
"from": "gpt",
"value": "Creating a real... |
I can't figure out why the following wont work, any ideas??
public interface IFieldSimpleItem
{ }
public interface IFieldNormalItem : IFieldSimpleItem
{ }
public class Person
{
public virtual T Create<T>()
where T : IFieldSimpleItem
{
return default(T);
}
}
public class Bose : Person
{
... | The issue you are encountering is due to the way generic type constraints work in C#. In your `Person` class, the `Create<T>()` method is defined with a constraint that `T` must implement `IFieldSimpleItem`. When you override that method in the `Bose` class, you are trying to change the constraint to require `T` to imp... | 35,059 | [
{
"from": "human",
"value": "I can't figure out why the following wont work, any ideas??\npublic interface IFieldSimpleItem\n{ }\n\npublic interface IFieldNormalItem : IFieldSimpleItem\n{ }\n\npublic class Person\n{\n public virtual T Create<T>()\n where T : IFieldSimpleItem\n {\n return... |
I have a problem of playing FLV file which id embed in my swf when i place it on server, swf plays correctly but not FLV
any solution will be highly appreciated.
thanks for all replys, its works in All browesers other than IE 6 now ,
i will paste the code here for the flv to chk .
var videopath:String;
var flvtime:S... | It looks like you’re dealing with an issue where your SWF file correctly plays FLV files in most browsers, except for Internet Explorer 6. Here are some possible troubleshooting steps and solutions to consider:
### 1. **Check File Paths**
Ensure that the path to your FLV file is correct. The path should be accessible ... | 33,564 | [
{
"from": "human",
"value": "I have a problem of playing FLV file which id embed in my swf when i place it on server, swf plays correctly but not FLV\nany solution will be highly appreciated.\n\nthanks for all replys, its works in All browesers other than IE 6 now , \ni will paste the code here for the flv... |
How can I validate a username and password against Active Directory? I simply want to check if a username and password are correct.
| Validating a username and password against Active Directory (AD) typically involves using the LDAP (Lightweight Directory Access Protocol) to authenticate the credentials. Below, I provide a simple example using Python with the `ldap3` library, which is widely used for LDAP operations, including authentication against ... | 34,856 | [
{
"from": "human",
"value": "How can I validate a username and password against Active Directory? I simply want to check if a username and password are correct.\n"
},
{
"from": "gpt",
"value": "Validating a username and password against Active Directory (AD) typically involves using the LDAP (Li... |
I am building Windows apps for a few clients. I read Joel on Software and took the Joel Test and realized I don't quite measure up. One place I am lacking is automated builds. What should I use to have automated builds? I have Windows apps that use .NET 1.1, 2.0, and 3.5. Also, I need to be able to build my .vdpro... | For setting up automated builds for your Windows applications using .NET 1.1, 2.0, and 3.5, you have a few options that are free and suitable for a solo developer. Below are some recommended tools and approaches to get you started:
### 1. **MSBuild**
Since you are already working with .NET Framework projects, MSBuild ... | 35,762 | [
{
"from": "human",
"value": "I am building Windows apps for a few clients. I read Joel on Software and took the Joel Test and realized I don't quite measure up. One place I am lacking is automated builds. What should I use to have automated builds? I have Windows apps that use .NET 1.1, 2.0, and 3.5. A... |
I know if you run in rsync
rsync some.domain.com::
It will return me a list of the rsync depots. Is there any way of getting it to return the details of the depot, the path specifically.
Thanks
| When you use `rsync some.domain.com::`, it lists the available modules (depots) on the server. However, to get detailed information about a specific module, including the path or any other configurations, you typically can't do this directly through `rsync` commands.
Here’s what you can do to gather more information ... | 37,634 | [
{
"from": "human",
"value": "I know if you run in rsync\nrsync some.domain.com::\nIt will return me a list of the rsync depots. Is there any way of getting it to return the details of the depot, the path specifically.\nThanks\n"
},
{
"from": "gpt",
"value": "When you use `rsync some.domain.com::... |
Is it possible to call a constructor from another (within the same class, not from a subclass)? If yes how? And what could be the best way to call another constructor (if there are several ways to do it)?
| Yes, in many programming languages that support object-oriented programming, you can call one constructor from another constructor within the same class. This is commonly referred to as constructor chaining. This practice allows you to reduce code duplication and ensure that common initialization logic is handled in a ... | 34,678 | [
{
"from": "human",
"value": "Is it possible to call a constructor from another (within the same class, not from a subclass)? If yes how? And what could be the best way to call another constructor (if there are several ways to do it)?\n"
},
{
"from": "gpt",
"value": "Yes, in many programming lang... |
Often times I find myself using std::pair to define logical groupings of two related quantities as function arguments/return values. Some examples: row/col, tag/value, etc.
Often times I should really be rolling my own class instead of just using std::pair. It's pretty easy to see when things start breaking down - when... | You've already outlined a number of approaches for creating meaningful abstractions around the `std::pair` type. Each of your solutions has trade-offs, and while there's no one-size-fits-all answer, I can offer some suggestions and improvements that may address some of the concerns you've raised.
### Approach 1: Comp... | 31,868 | [
{
"from": "human",
"value": "Often times I find myself using std::pair to define logical groupings of two related quantities as function arguments/return values. Some examples: row/col, tag/value, etc.\nOften times I should really be rolling my own class instead of just using std::pair. It's pretty easy to ... |
The code below works. But if I comment out the line Dim objRequest As MSXML2.XMLHTTP and uncomment the line Dim objRequest As Object it fails with the error message :
The parameter is incorrect
Why, and what (if anything) can I do about it?
Public Function GetSessionId(strApiId, strUserName, strPassword) As String
... | The issue you're encountering is related to how the `XMLHTTP` object is being created and used in your code when you declare `objRequest` as a generic `Object` type versus the specific `MSXML2.XMLHTTP` type.
When you declare `objRequest` as a specific type (`MSXML2.XMLHTTP`), you get strong typing, and the compiler kn... | 35,674 | [
{
"from": "human",
"value": "The code below works. But if I comment out the line Dim objRequest As MSXML2.XMLHTTP and uncomment the line Dim objRequest As Object it fails with the error message :\n\nThe parameter is incorrect\n\nWhy, and what (if anything) can I do about it?\nPublic Function GetSessionId(st... |
I'm using the WorldPay payment gateway on a website I'm working on. It handles all the credit card authorisation, and then calls a PHP file on my server with information about the transaction. It grabs the output from my script and displays it in the WorldPay chrome.
I don't know the inner workings, but I imagine that ... | The issue you're encountering where `simplexml_load_file('./info.xml')` returns false when called from the WorldPay payment system might be related to the file path and permissions rather than the cURL itself. Here are some steps and considerations to troubleshoot and resolve the issue:
### 1. Check File Path
Ensure t... | 35,235 | [
{
"from": "human",
"value": "I'm using the WorldPay payment gateway on a website I'm working on. It handles all the credit card authorisation, and then calls a PHP file on my server with information about the transaction. It grabs the output from my script and displays it in the WorldPay chrome.\nI don't kn... |
Firstly I'm extending an existing class structure and cannot alter the original, with that caveat:
I would like to do this:
class a
{
int val;
... // usual constructor, etc...
public int displayAlteredValue(int inp)
{
return (val*inp);
}
}
class b extends a
{
... // usual constructor, etc...
... | You can achieve the desired behavior by overriding the `displayAlteredValue` method in class `b` while also allowing it to accept two parameters instead of one. To do this, you can use the `@Override` annotation and call `super.displayAlteredValue(inp1)` to maintain compatibility with the original method in class `a`. ... | 34,988 | [
{
"from": "human",
"value": "Firstly I'm extending an existing class structure and cannot alter the original, with that caveat:\nI would like to do this:\nclass a\n{\n int val;\n\n ... // usual constructor, etc...\n\n public int displayAlteredValue(int inp)\n {\n return (val*inp);\n }\n}\n\ncl... |
When we remote a method (that is using generics) the remoting sink cannot seem to discover our method from the other identical named ones. Debugging with .net source code attached I've got it to where there is a MethodInfo.MakeGenericMethod call. However I cannot look at any of the surrounding data as its been jit opti... | It sounds like you are looking for a way to disable Just-In-Time (JIT) optimizations in the .NET runtime to aid in debugging your code. When JIT optimizations are enabled, the runtime may alter the structure of your code at runtime, making it difficult to debug because the debugger may not reflect the source code's log... | 35,657 | [
{
"from": "human",
"value": "When we remote a method (that is using generics) the remoting sink cannot seem to discover our method from the other identical named ones. Debugging with .net source code attached I've got it to where there is a MethodInfo.MakeGenericMethod call. However I cannot look at any of ... |
I would like to share 2 folders of content ('stylesheets' and 'graphics') between multiple asp.net projects in a solution.
Is there a way to do this and have studio display the graphics and such appropriately at design time?
| Yes, you can share folders like `stylesheets` and `graphics` across multiple ASP.NET projects within a solution in a way that allows Visual Studio to recognize and display the contents at design time. Here are a couple of methods to achieve this:
### Method 1: Use a Shared Project
1. **Create a Shared Project**:
- ... | 23,366 | [
{
"from": "human",
"value": "I would like to share 2 folders of content ('stylesheets' and 'graphics') between multiple asp.net projects in a solution.\nIs there a way to do this and have studio display the graphics and such appropriately at design time?\n"
},
{
"from": "gpt",
"value": "Yes, you... |
I'm a C/Python programmer in C++ land working with the STL for the first time.
In Python, extending a list with another list uses the .extend method:
>>> v = [1, 2, 3]
>>> v_prime = [4, 5, 6]
>>> v.extend(v_prime)
>>> print(v)
[1, 2, 3, 4, 5, 6]
I currently use this algorithmic approach to extend vectors in C++:
v.res... | Your current approach for extending a `std::vector` in C++ is indeed valid, but there are more idiomatic and simpler ways to achieve the same result using the Standard Template Library (STL).
Instead of manually resizing the vector and copying elements, you can use the `insert` member function provided by `std::vecto... | 36,093 | [
{
"from": "human",
"value": "I'm a C/Python programmer in C++ land working with the STL for the first time.\nIn Python, extending a list with another list uses the .extend method:\n>>> v = [1, 2, 3]\n>>> v_prime = [4, 5, 6]\n>>> v.extend(v_prime)\n>>> print(v)\n[1, 2, 3, 4, 5, 6]\n\nI currently use this alg... |
I've got a maintenance plan that executes weekly in the off hours. It's always reporting success, but the old backups don't get deleted. I don't want the drive filling up.
DB Server info: SQL Server Standard Edition 9.00.3042.00
There is a "Maintenance Cleanup Task" set to
"Search folder and delete files based on an ... | Given the information you provided, it seems that your **Maintenance Cleanup Task** in SQL Server is indeed set up to delete old backup files based on age. However, the issue you're facing with backups being stored in subfolders may be the root cause of the problem. Here’s a detailed explanation of why that might be ha... | 37,250 | [
{
"from": "human",
"value": "I've got a maintenance plan that executes weekly in the off hours. It's always reporting success, but the old backups don't get deleted. I don't want the drive filling up.\nDB Server info: SQL Server Standard Edition 9.00.3042.00 \nThere is a \"Maintenance Cleanup Task\" set to ... |
I don't understand...
BitmapImage img = new BitmapImage(myUri);
Console.WriteLine("Width: {0}, Height: {1}", img.Width, img.Height);
Output: "Width: 1, Height: 1".
I've tried PixelWidth/PixelHeight, I've tried manually creating it with BeginInit/EndInit and also setting PreservePixelFormat... nothing works.
(Except, e... | It sounds like you're encountering an issue where the `BitmapImage` is initialized with the wrong dimensions during the first attempt, but behaves correctly after that. This could be caused by several factors, such as the image not being fully loaded when you attempt to access its dimensions, or the URI not pointing to... | 37,120 | [
{
"from": "human",
"value": "I don't understand...\nBitmapImage img = new BitmapImage(myUri);\nConsole.WriteLine(\"Width: {0}, Height: {1}\", img.Width, img.Height);\n\nOutput: \"Width: 1, Height: 1\".\nI've tried PixelWidth/PixelHeight, I've tried manually creating it with BeginInit/EndInit and also settin... |
I would like to update a dll for a server process without stopping the service. How do I do that?
A bit like how asp.net automatically picks up new dlls placed in the bin folder.
| Updating a DLL for a server process without stopping the service can be challenging and depends on the architecture of the application and the specific technologies in use. Here are some common strategies you might consider:
### 1. **Shadow Copying** (for ASP.NET applications)
In ASP.NET, the framework uses shadow cop... | 36,190 | [
{
"from": "human",
"value": "I would like to update a dll for a server process without stopping the service. How do I do that?\nA bit like how asp.net automatically picks up new dlls placed in the bin folder.\n"
},
{
"from": "gpt",
"value": "Updating a DLL for a server process without stopping t... |
I'm looking to patch a piece of abandonware with some code.
The software is carbon based, so I can not use an InputManager (at least, I do not think I can). My idea was to add a dylib reference to the mach-o header, and launch a new thread when the initialization routine is called.
I have mucked around with the mach-o ... | When you add a `LC_LOAD_DYLIB` load command to a Mach-O file, there are indeed several considerations that must be taken into account, particularly with regards to the Mach-O file's symbol table and relocation entries. The error message you're encountering, "dyld: bad external relocation length," indicates a problem re... | 36,843 | [
{
"from": "human",
"value": "I'm looking to patch a piece of abandonware with some code.\nThe software is carbon based, so I can not use an InputManager (at least, I do not think I can). My idea was to add a dylib reference to the mach-o header, and launch a new thread when the initialization routine is cal... |
I want to create a simple bit of JS code that creates an image element in the background and doesn't display anything. The image element will call a tracking URL (such as Omniture) and needs to be simple and robust and work in IE 6 =< only. Here is the code I have:
var oImg = document.createElement("img");
oImg.setAt... | Your code is quite close to what you want, but there are a few improvements you could make to ensure that the image is completely hidden and the code runs smoothly in older browsers like IE6.
1. You should set the CSS properties to ensure the image is completely hidden.
2. Adding `onerror` event handling can be helpfu... | 39,219 | [
{
"from": "human",
"value": "I want to create a simple bit of JS code that creates an image element in the background and doesn't display anything. The image element will call a tracking URL (such as Omniture) and needs to be simple and robust and work in IE 6 =< only. Here is the code I have:\nvar oImg =... |
I'm having problems with cross theme compatibility in windows forms. If you don't set the font for a control on a windows form, it will use the system font with correct typeface and size. If you want to make the font bold, it hard codes in the rest of the system font values for the current theme you're programming wi... | In Windows Forms, if you want to use the default system font while altering its style or size, you can retrieve the current font being used by the control and then modify the specific properties (like style and size) instead of hardcoding a new font.
### Making the Default Font Bold
To make the default font bold, you... | 38,324 | [
{
"from": "human",
"value": "I'm having problems with cross theme compatibility in windows forms. If you don't set the font for a control on a windows form, it will use the system font with correct typeface and size. If you want to make the font bold, it hard codes in the rest of the system font values fo... |
I'm trying to measure height of some text for table printing purpose.
Here's the code. In my case it prints different numbers in preview and on actual page.
I can't try on any printers other than Microsoft Office Document Image Writer right now, but I'm pretty sure it isn't a printer issue.
Perhaps somebody have found ... | The discrepancy you're observing between the print preview and the actual printed page can often be attributed to the way different graphics environments handle measurements and rendering. This is especially common in cases involving different DPI (dots per inch) settings for the display and printer. The code snippet y... | 37,364 | [
{
"from": "human",
"value": "I'm trying to measure height of some text for table printing purpose.\nHere's the code. In my case it prints different numbers in preview and on actual page.\nI can't try on any printers other than Microsoft Office Document Image Writer right now, but I'm pretty sure it isn't a ... |
Which is a better way to force GC on ThreadLocal instance?
| Forcing garbage collection in Java, including for objects that are referenced via `ThreadLocal`, is generally not recommended because it goes against the principles of garbage collection and can lead to unpredictable behavior. However, if you need to explicitly clean up `ThreadLocal` instances, there are a few methods ... | 36,875 | [
{
"from": "human",
"value": "Which is a better way to force GC on ThreadLocal instance?\n"
},
{
"from": "gpt",
"value": "Forcing garbage collection in Java, including for objects that are referenced via `ThreadLocal`, is generally not recommended because it goes against the principles of garbage... |
Can somebody please give me an example of a unidirectional @OneToOne primary-key mapping in Hibernate ? I've tried numerous combinations, and so far the best thing I've gotten is this :
@Entity
@Table(name = "paper_cheque_stop_metadata")
@org.hibernate.annotations.Entity(mutable = false)
public class PaperChequeStopMet... | It seems you're trying to create a unidirectional `@OneToOne` mapping in Hibernate, where one entity's primary key is also a foreign key to another entity. In your case, it seems like the key mapping is not quite right. The way you're setting it up suggests that you're not fully specifying the relationship.
Here's a p... | 37,071 | [
{
"from": "human",
"value": "Can somebody please give me an example of a unidirectional @OneToOne primary-key mapping in Hibernate ? I've tried numerous combinations, and so far the best thing I've gotten is this :\n@Entity\n@Table(name = \"paper_cheque_stop_metadata\")\n@org.hibernate.annotations.Entity(mu... |
Running IIS5 (yes, really). I'd like to remove the eTag http header that IIS generates for me. MS has an article on how to sync eTags across the web farm, but not how to remove them ( http://support.microsoft.com/?id=922733 ).
Is there a way to remove eTags?
| In IIS 5, there is no built-in setting or option available through the UI to directly remove the ETag HTTP header. However, you can achieve this by modifying the HTTP headers using either a custom ISAPI filter or by using a third-party tool to intercept and modify headers.
### Option 1: Custom ISAPI Filter
1. **Creat... | 34,955 | [
{
"from": "human",
"value": "Running IIS5 (yes, really). I'd like to remove the eTag http header that IIS generates for me. MS has an article on how to sync eTags across the web farm, but not how to remove them ( http://support.microsoft.com/?id=922733 ). \nIs there a way to remove eTags? \n"
},
{
... |
I am using Apache Felix and its Declarative Services (SCR) to wire the service dependencies between bundles.
For example, if I need access to a java.util.Dictionary I can say the following to have SCR provide one:
/**
* @scr.reference name=properties interface=java.util.Dictionary
*/
protected void bindProperties(Dict... | In Apache Felix Declarative Services (SCR), you can specify service properties directly in your `@scr.reference` annotation to filter the services you want to bind. To filter for a specific `Dictionary` service based on a service property, such as "name", you can use the `policy` and `cardinality` attributes along with... | 35,670 | [
{
"from": "human",
"value": "I am using Apache Felix and its Declarative Services (SCR) to wire the service dependencies between bundles.\nFor example, if I need access to a java.util.Dictionary I can say the following to have SCR provide one:\n/**\n* @scr.reference name=properties interface=java.util.Dicti... |
I came across PHP way of doing the trick:
my_bool reconnect = 1;
mysql_options(&mysql, MYSQL_OPT_RECONNECT, &reconnect);
but no luck with MySQLdb (python-mysql).
Can anybody please give a clue? Thanks.
| In Python, when using MySQLdb (or its fork `mysqlclient`), there isn't a direct equivalent to the `MYSQL_OPT_RECONNECT` option you see in C. However, you can handle reconnections manually.
The typical approach when working with MySQL connections in Python is to catch exceptions related to lost connections and then at... | 38,151 | [
{
"from": "human",
"value": "I came across PHP way of doing the trick:\nmy_bool reconnect = 1;\nmysql_options(&mysql, MYSQL_OPT_RECONNECT, &reconnect);\n\nbut no luck with MySQLdb (python-mysql).\nCan anybody please give a clue? Thanks.\n"
},
{
"from": "gpt",
"value": "In Python, when using MySQ... |
I need to determine which pages of a Word document that a keyword occurs on. I have some tools that can get me the text of the document, but nothing that tells me which pages the text occurs on. Does anyone have a good starting place for me? I'm using .NET
Thanks!
edit: Additional constraint: I can't use any of the ... | If you need to find the pages where a keyword occurs in a Word document using .NET without relying on Interop, you can consider using a library called **DocX** or **Open XML SDK**. However, it's important to note that neither of these libraries will directly provide you with page numbers since they deal with the docume... | 34,622 | [
{
"from": "human",
"value": "I need to determine which pages of a Word document that a keyword occurs on. I have some tools that can get me the text of the document, but nothing that tells me which pages the text occurs on. Does anyone have a good starting place for me? I'm using .NET\nThanks!\nedit: Add... |
I need a tool for collecting feedback and new ideas inside our company regarding our internal IS product. The problem is the acceptance level for such a tool.
Most of our colleagues are not IT oriented, so a solution like BugZilla or Jira is way to complicated for them to use. You need to create an account, take care o... | It sounds like you need a user-friendly feedback tool that's accessible for all your colleagues, regardless of their technical background. Here are a few suggestions that meet your criteria:
1. **Google Forms**:
- **No login needed**: Users can submit responses without a Google account.
- **Few fields**: You can... | 34,300 | [
{
"from": "human",
"value": "I need a tool for collecting feedback and new ideas inside our company regarding our internal IS product. The problem is the acceptance level for such a tool.\nMost of our colleagues are not IT oriented, so a solution like BugZilla or Jira is way to complicated for them to use. ... |
I am not very good with Regex but I am learning.
I would like to remove some html tag by the class name. This is what I have so far :
<div class="footer".*?>(.*?)</div>
The first .*? is because it might contain other attribute and the second is it might contain other html stuff.
What am I doing wrong? I have try a lot... | It looks like you're on the right track for removing HTML tags by class name, but you might need to adjust your regex slightly to correctly match the `<div>` tag with a specific class and handle multiline content properly.
### Here’s a corrected version of your regex:
```regex
<div[^>]*class=["'][^"']*footer[^"']*["'... | 35,832 | [
{
"from": "human",
"value": "I am not very good with Regex but I am learning.\nI would like to remove some html tag by the class name. This is what I have so far :\n<div class=\"footer\".*?>(.*?)</div>\n\nThe first .*? is because it might contain other attribute and the second is it might contain other html... |
I have a just one table mapped in a datacontext. Here's the property and attribute on the column of interest:
[Column(Storage="_CustomerNumber", DbType="VarChar(25)")]
public string CustomerNumber
{
This column is, in fact, a varchar(25) and has an index.
I've got some simple code:
DataClasses1DataContext myDC = new ... | To address the issue of parameter type conversion in your LINQ query, you have a couple of options, especially since you're allowed to modify the query and the DBML but not the underlying database schema.
### Option 1: Change the LINQ Query
One straightforward approach is to explicitly cast the `CustomerNumber` to `v... | 36,414 | [
{
"from": "human",
"value": "I have a just one table mapped in a datacontext. Here's the property and attribute on the column of interest:\n[Column(Storage=\"_CustomerNumber\", DbType=\"VarChar(25)\")]\npublic string CustomerNumber\n{\n\nThis column is, in fact, a varchar(25) and has an index.\nI've got so... |
Aside from using the region to infer which carrier the user is under.
| In addition to using the region to infer which carrier a user is under, there are several other methods and data points that can help identify a user's mobile carrier:
1. **Mobile Network Code (MNC) and Mobile Country Code (MCC):** These codes are part of the International Mobile Subscriber Identity (IMSI) and can be ... | 37,940 | [
{
"from": "human",
"value": "Aside from using the region to infer which carrier the user is under.\n"
},
{
"from": "gpt",
"value": "In addition to using the region to infer which carrier a user is under, there are several other methods and data points that can help identify a user's mobile carri... |
In converting from short to a byte array I found the following solution on the web but could not quite understand the logic involved.
//buffer is an array of bytes, bytes[]
buffer[position] = (byte)(sample & 0xff);
buffer[position+1] = (byte)((sample >> 8) & 0xff);
Can someone tell me why 0xff (256) is being anded to ... | In your code, the goal is to convert a `short` value into a byte array. Each `short` in Java (or C#) is 2 bytes (16 bits) long, and you want to extract these individual bytes.
Here's a breakdown of the code:
```java
buffer[position] = (byte)(sample & 0xff);
buffer[position+1] = (byte)((sample >> 8) & 0xff);
```
### ... | 35,849 | [
{
"from": "human",
"value": "In converting from short to a byte array I found the following solution on the web but could not quite understand the logic involved.\n//buffer is an array of bytes, bytes[]\nbuffer[position] = (byte)(sample & 0xff);\nbuffer[position+1] = (byte)((sample >> 8) & 0xff);\n\nCan som... |
Wanted to generate a UI diagram (with nice layout) depicting relationships amongst network components. Which is the best Java based API to do such layouts with minimum fuss and light codebase.
| For generating UI diagrams that depict relationships among network components in Java, several libraries can be utilized, each with its own strengths. Here are some of the best options that provide good layout capabilities with minimal fuss and a relatively light codebase:
1. **JGraphX (formerly JGraph)**:
- **Desc... | 33,682 | [
{
"from": "human",
"value": "Wanted to generate a UI diagram (with nice layout) depicting relationships amongst network components. Which is the best Java based API to do such layouts with minimum fuss and light codebase.\n"
},
{
"from": "gpt",
"value": "For generating UI diagrams that depict re... |
I'm working on a game where I need to let the player look at a plane (e.g., a wall) through a lens (e.g., a magnifying glass). The game is to run on the iPhone, so my choices are Core Animation or OpenGL ES.
My first idea (that I have not yet tried) is to do this using Core Animation.
Create the wall and objects on i... | Your approach using Core Animation to simulate the effect of looking through a lens is a valid one, especially since you're more familiar with it. Here are some considerations, potential pitfalls, and suggestions for improvement:
### Considerations and Potential Pitfalls:
1. **Performance**:
- **Image Rendering**:... | 32,091 | [
{
"from": "human",
"value": "I'm working on a game where I need to let the player look at a plane (e.g., a wall) through a lens (e.g., a magnifying glass). The game is to run on the iPhone, so my choices are Core Animation or OpenGL ES.\nMy first idea (that I have not yet tried) is to do this using Core An... |
Which one would you use to draw stuff on a winform? Format32bppRgb or Format24bppRgb or something else?
in any .net version
Format24bppRgb
Specifies that the format is 24 bits per pixel; 8 bits each are used for the red, green, and blue components.
Format32bppRgb
Specifies that the format is 32 bits per pixel; 8 bits ... | When deciding between `Format32bppRgb` and `Format24bppRgb` for drawing in a WinForms application, the choice generally depends on a few factors, including the need for transparency and performance considerations.
### `Format24bppRgb`
- **Description**: This format uses 24 bits per pixel, with 8 bits each for red, gre... | 38,600 | [
{
"from": "human",
"value": "Which one would you use to draw stuff on a winform? Format32bppRgb or Format24bppRgb or something else?\nin any .net version\nFormat24bppRgb\nSpecifies that the format is 24 bits per pixel; 8 bits each are used for the red, green, and blue components.\n\nFormat32bppRgb\nSpecifie... |
It's a tricky question I was asked the other day... We're working on a pretty complex telephony (SIP) application with mixed C++ and PHP code with MySQL databases and several open source components.
A telecom engineer asked us to estimate the performance of the application (which is not ready yet). He went like 'well, ... | Estimating application performance before actual testing can be quite challenging, especially for complex applications like a telephony system that relies on multiple components and external factors. However, while it's difficult to provide an exact number, you can follow a structured approach to arrive at a reasoned e... | 34,844 | [
{
"from": "human",
"value": "It's a tricky question I was asked the other day... We're working on a pretty complex telephony (SIP) application with mixed C++ and PHP code with MySQL databases and several open source components.\nA telecom engineer asked us to estimate the performance of the application (whi... |
Yes, I know you could use regular objects as associative arrays in JavaScript, but I'd like to use something closer to java's Map's implementation (HashMap, LinkedHashMap etc). Something that could have any kind of data used as key. Are there any good hash(code/table) in JavaScript implementation out there?
| In JavaScript, the native `Map` object is a suitable option if you need a collection of key-value pairs where keys can be of any type (including objects). Unlike regular objects, which have string keys, `Map` allows any value (including functions, objects, and other primitive types) to be used as a key. It maintains th... | 36,658 | [
{
"from": "human",
"value": "Yes, I know you could use regular objects as associative arrays in JavaScript, but I'd like to use something closer to java's Map's implementation (HashMap, LinkedHashMap etc). Something that could have any kind of data used as key. Are there any good hash(code/table) in JavaScr... |
Is it possible to create a final route that catches all .. and bounces the user to a 404 view in ASP.NET MVC?
NOTE: I don't want to set this up in my IIS settings.
| Yes, in ASP.NET MVC, you can create a final route that catches all requests that do not match any of your defined routes and directs them to a 404 view. This is often done using a catch-all route and a custom error handling mechanism.
### Step 1: Define a Catch-All Route
In your `RouteConfig.cs`, you can add a catch-... | 37,055 | [
{
"from": "human",
"value": "Is it possible to create a final route that catches all .. and bounces the user to a 404 view in ASP.NET MVC?\nNOTE: I don't want to set this up in my IIS settings.\n"
},
{
"from": "gpt",
"value": "Yes, in ASP.NET MVC, you can create a final route that catches all re... |
I cannot figure out a way to disable a container AND its children in Swing. Is Swing really missing this basic feature?
If I do setEnabled(false) on a container, its children are still enabled.
My GUI structure is pretty complex, and doing a traversion of all elements below the container is not an option. Neither is a ... | In Swing, calling `setEnabled(false)` on a container does indeed disable the container itself, but it does not recursively disable all of its children. This can be frustrating when you have a complex UI structure, as you've experienced.
However, there is a simple solution to this issue using a custom utility method th... | 37,438 | [
{
"from": "human",
"value": "I cannot figure out a way to disable a container AND its children in Swing. Is Swing really missing this basic feature?\nIf I do setEnabled(false) on a container, its children are still enabled.\nMy GUI structure is pretty complex, and doing a traversion of all elements below th... |
I have a .net winforms app which has a few animation effects, fade ins and scroll animations etc. These work fine however if I'm in a Remote Desktop Protocol session the animations start to grate.
Can someone suggest a way of determining whether or not an app is running across an RDP session so I can turn the effects ... | To determine if your .NET WinForms application is running in a Remote Desktop Protocol (RDP) session, you can check the `SystemInformation.TerminalServerSession` property. This property returns a boolean value indicating whether the application is running in a terminal services session.
Here's an example of how you ca... | 37,985 | [
{
"from": "human",
"value": "I have a .net winforms app which has a few animation effects, fade ins and scroll animations etc. These work fine however if I'm in a Remote Desktop Protocol session the animations start to grate.\nCan someone suggest a way of determining whether or not an app is running across... |
What open source projects would you recommend as a good place for a starting open source developer? Factors that I think would be important are some obvious ones like well written code and a community that is helpful to newbies. But it might be nice if the code base is such that I can start hacking some small problems ... | Starting your journey in open source development is a great way to learn and contribute to meaningful projects. Here are some open source projects that meet your criteria of having a helpful community, well-written code, and allowing beginners to make contributions without needing to fully understand the entire codebas... | 28,026 | [
{
"from": "human",
"value": "What open source projects would you recommend as a good place for a starting open source developer? Factors that I think would be important are some obvious ones like well written code and a community that is helpful to newbies. But it might be nice if the code base is such that... |
I can't seem to find an answer to this problem, and I'm wondering if one exists. Simplified example:
Consider a string "nnnn", where I want to find all matches of "nn" - but also those that overlap with each other. So the regex would provide the following 3 matches:
nnnn
nnnn
nnnn
I realize this is not exactly what r... | To find overlapping matches in a string using regular expressions in Python, you can use a technique that involves iterating through the string while using the `re` module to find all occurrences. Regular expressions themselves do not directly support overlapping matches, but you can achieve the desired result by utili... | 38,519 | [
{
"from": "human",
"value": "I can't seem to find an answer to this problem, and I'm wondering if one exists. Simplified example:\nConsider a string \"nnnn\", where I want to find all matches of \"nn\" - but also those that overlap with each other. So the regex would provide the following 3 matches:\n\nnnnn... |
Can I use two different back ends for an .net Entity Framework project?
I need to support the full programmability support of stored procedures on SQL server when available. I need to support only table structures in a .mdb file when SQL server is not available.
All business logic above the Entity Framework uses the en... | Yes, it is possible to use two different backends in a .NET Entity Framework project to support both SQL Server with full programmability (including stored procedures) and an Access (.mdb) file which is more limited in terms of programmability but can handle simple table structures. Your approach involves creating two ... | 35,859 | [
{
"from": "human",
"value": "Can I use two different back ends for an .net Entity Framework project?\nI need to support the full programmability support of stored procedures on SQL server when available. I need to support only table structures in a .mdb file when SQL server is not available.\nAll business l... |
I'm trying to set up a loop where an animation runs a certain number of times, and a function is run before each iteration of the animation. The timing ends up being off, though -- it runs the callback n times, then runs the animation n times. For example:
for (var i=0;i<3;i++) {
console.log(i);
$('#blerg').animat... | In jQuery, the animation methods like `.animate()` do not provide a built-in way to run a callback function before each iteration of the animation within a loop as you are trying to implement. This is because the animations are executed asynchronously, meaning the loop completes before any animations finish.
To achiev... | 36,195 | [
{
"from": "human",
"value": "I'm trying to set up a loop where an animation runs a certain number of times, and a function is run before each iteration of the animation. The timing ends up being off, though -- it runs the callback n times, then runs the animation n times. For example:\nfor (var i=0;i<3;i++... |
I'm developing a SOAP application that integrates with a 3rd party. I think the WSDL of this third party is very strange. I'm pretty new to SOAP, so I don't want to go asking them to fix it if it isn't broken. Here's some things I've noticed that I consider wrong about it, though I'm sure it's technically a valid do... | You’ve raised some valid points regarding the WSDL and the design choices of the third-party SOAP service. Here’s an evaluation of each of your concerns based on best practices in SOAP web services:
1. **Multiple SOAP Versions in the Same WSDL**: It is technically valid to include both SOAP 1.1 and SOAP 1.2 in the sam... | 35,666 | [
{
"from": "human",
"value": "I'm developing a SOAP application that integrates with a 3rd party. I think the WSDL of this third party is very strange. I'm pretty new to SOAP, so I don't want to go asking them to fix it if it isn't broken. Here's some things I've noticed that I consider wrong about it, th... |
I am using a SqlCommandBuilder object to generate update statements from Select statements in a SqlDataAdapter.
My problem is that in my Select statement I am selecting from a view called vwUsers. the SqlCommandBuilder object I used generated an update statement for the table Users not the view vwUsers. How can I overr... | The behavior you're encountering with `SqlCommandBuilder` is expected, as it generates SQL statements based on the underlying table of the `DataAdapter`. When you use `SqlCommandBuilder`, it typically maps operations to the base table rather than any view. To work around this issue and generate update statements that t... | 35,702 | [
{
"from": "human",
"value": "I am using a SqlCommandBuilder object to generate update statements from Select statements in a SqlDataAdapter.\nMy problem is that in my Select statement I am selecting from a view called vwUsers. the SqlCommandBuilder object I used generated an update statement for the table U... |
I'm running SQL Server 2008 Express on Windows XP on a VirtualPC instance inside a Windows XP host. I want to be able to connect to databases on the guest instance using SSMS on the host. When I go to connect from SSMS on the host, and browse for servers, I see the instance of SQL Server on the guest. Yet when I try... | It sounds like you faced a common challenge when trying to connect from a host machine to a SQL Server instance running on a guest virtual machine. Given that you've resolved the issue, I'd still like to provide a summary of the possible causes and solutions for anyone else facing similar problems:
### Possible Causes... | 36,773 | [
{
"from": "human",
"value": "I'm running SQL Server 2008 Express on Windows XP on a VirtualPC instance inside a Windows XP host. I want to be able to connect to databases on the guest instance using SSMS on the host. When I go to connect from SSMS on the host, and browse for servers, I see the instance of... |
We recently had a code review . One of my classes was used so that I could return/pass more than one type of data from/to methods . The only methods that the class had were getters/setters . One of the team's members ( whose opinion I respect ) said that having a class like that is bad practice ( and not very OOP ) . W... | Your team member’s feedback regarding the use of a class with only getters and setters to return multiple types of data raises several important points about object-oriented programming (OOP) principles and best practices. Here are some key reasons why this might be considered bad practice:
1. **Encapsulation and Abst... | 35,704 | [
{
"from": "human",
"value": "We recently had a code review . One of my classes was used so that I could return/pass more than one type of data from/to methods . The only methods that the class had were getters/setters . One of the team's members ( whose opinion I respect ) said that having a class like that... |
Basically I want to have our installer also install the .NET framework and any other pre-reqs as neccessary will minimal user interaction, so ideally, just run, accept license agreement and everything else is taken care of automatically. Is this possible? Using WiX most likely with a bootstrapper or some sort.
| Yes, it is definitely possible to create a bootstrapper using WiX that installs the .NET Framework and any other prerequisites with minimal user interaction. The WiX Toolset provides a component called Burn, which is a bootstrapper that can orchestrate the installation of your main application along with its prerequisi... | 35,766 | [
{
"from": "human",
"value": "Basically I want to have our installer also install the .NET framework and any other pre-reqs as neccessary will minimal user interaction, so ideally, just run, accept license agreement and everything else is taken care of automatically. Is this possible? Using WiX most likely... |
I need to check whether a page is being redirected or not without actually downloading the content. I just need the final URL. What's the best way of doing this is Python?
Thanks!
| You can check for URL redirections in Python using the `requests` library without downloading the full content of the page. The `head` request method is typically used to fetch headers only, which is useful for this purpose since it avoids downloading the body of the page.
Here’s a simple example to get the final URL ... | 38,968 | [
{
"from": "human",
"value": "I need to check whether a page is being redirected or not without actually downloading the content. I just need the final URL. What's the best way of doing this is Python?\nThanks!\n"
},
{
"from": "gpt",
"value": "You can check for URL redirections in Python using th... |
I'm working with LINQ to objects and have a function where in some cases I need to modify the underlying collection before calling Aggregate(...) and then return it to its original state before the funciton returns the results of Aggregate(...). My current code looks something like this:
bool collectionModified = false... | Your approach of using `.ToArray()` is a valid and straightforward solution for forcing the evaluation of a LINQ query and ensuring that you return the collection to its original state before the results are enumerated. This way, you're effectively capturing the results of the LINQ query in an array, which avoids any p... | 36,678 | [
{
"from": "human",
"value": "I'm working with LINQ to objects and have a function where in some cases I need to modify the underlying collection before calling Aggregate(...) and then return it to its original state before the funciton returns the results of Aggregate(...). My current code looks something l... |
I commonly find myself extracting common behavior out of classes into helper/utility classes that contain nothing but a set of static methods. I've often wondered if I should be declaring these classes as abstract, since I can't really think of a valid reason to ever instantiate these?
What would the Pros and Cons b... | Declaring a utility class as abstract is a common consideration among developers, and it's important to understand the implications of this design choice. Let's examine the pros and cons of making a utility class abstract:
### Pros of Declaring a Utility Class as Abstract
1. **Clarifies Intent**: By declaring a class... | 36,098 | [
{
"from": "human",
"value": "I commonly find myself extracting common behavior out of classes into helper/utility classes that contain nothing but a set of static methods. I've often wondered if I should be declaring these classes as abstract, since I can't really think of a valid reason to ever instantiat... |
I'me looking for a function that would receive a time and would round it to the next/previous hour / half-hour / quarter / minute.
| Certainly! Below are Python functions that round a given time to the next/previous hour, half-hour, quarter, or minute. You can specify the direction for rounding (up or down) and the unit (hour, half-hour, quarter, or minute).
### Python Code
```python
from datetime import datetime, timedelta
def round_time(input_t... | 31,754 | [
{
"from": "human",
"value": "I'me looking for a function that would receive a time and would round it to the next/previous hour / half-hour / quarter / minute.\n"
},
{
"from": "gpt",
"value": "Certainly! Below are Python functions that round a given time to the next/previous hour, half-hour, qua... |
I would like to provide my users the ability to send an image/picture (displayed through a UIImageView in the app) to their friends via email using the built-in Mail app.
In a way, I want a very similar user experience to the way the Photos app does this. User clicks on a button, the image/picture is copied onto a new ... | As of my last knowledge update, iOS does not provide a direct way to pre-fill an email compose window with an image from within your app using the built-in Mail app. However, you can achieve a similar result using the `MFMailComposeViewController` class from the `MessageUI` framework. This allows you to present a mail ... | 31,360 | [
{
"from": "human",
"value": "I would like to provide my users the ability to send an image/picture (displayed through a UIImageView in the app) to their friends via email using the built-in Mail app.\nIn a way, I want a very similar user experience to the way the Photos app does this. User clicks on a butto... |
Let's say I have a char* str = "0123456789" and I want to cut the first and the last three letters and print just the middle, what is the simplest, and safest, way of doing it?
Now the trick: The portion to cut and the portion to print are of variable size, so I could have a very long char*, or a very small one.
| To safely cut the first and last few characters from a C-style string (i.e., `char*`), you need to consider a few factors, such as the length of the string and the size of the portions you want to remove. Given that you want the solution to be adaptable to different sizes, the approach must also ensure that you do not ... | 34,117 | [
{
"from": "human",
"value": "Let's say I have a char* str = \"0123456789\" and I want to cut the first and the last three letters and print just the middle, what is the simplest, and safest, way of doing it?\nNow the trick: The portion to cut and the portion to print are of variable size, so I could have a ... |
What are differences between enabling and disabling "Enable 32-Bit applications" in websites application pools under IIS7 on x64 machine?
Mostly I'm thinking about memory usage.
Thanks in advance
| When you are working with IIS7 on a 64-bit Windows operating system, you have the option to enable or disable the "Enable 32-Bit Applications" setting for application pools. This setting can have significant implications on memory usage, application compatibility, and performance. Here's a breakdown of the differences:... | 35,310 | [
{
"from": "human",
"value": "What are differences between enabling and disabling \"Enable 32-Bit applications\" in websites application pools under IIS7 on x64 machine?\nMostly I'm thinking about memory usage.\nThanks in advance\n"
},
{
"from": "gpt",
"value": "When you are working with IIS7 on ... |
I believe there's a way to find the kth largest element in an unsorted array of length n in O(n). Or perhaps it's "expected" O(n) or something. How can we do this?
| Yes, you're correct! The Kth largest element in an unsorted array can be found in expected O(n) time using a randomized algorithm known as Quickselect. Quickselect is related to the QuickSort sorting algorithm but focuses on finding the Kth largest (or smallest) element without fully sorting the array.
Here's how Quic... | 34,219 | [
{
"from": "human",
"value": "I believe there's a way to find the kth largest element in an unsorted array of length n in O(n). Or perhaps it's \"expected\" O(n) or something. How can we do this?\n"
},
{
"from": "gpt",
"value": "Yes, you're correct! The Kth largest element in an unsorted array ... |
Does Visual Studio .NET have a way to toggle word-wrap on and off?
I am used to this feature in Eclipse which allows you to right click and toggle word wrap on and off so that when you have long lines that extend out to the right, you don't have to move the bottom scroll bar right and left to read your code/html:
http:... | Yes, Visual Studio .NET has a way to toggle word wrap on and off. While it's not as straightforward as a right-click menu option like in Eclipse, you can easily enable or disable word wrap through the options in the settings.
Here are the steps to toggle word wrap in Visual Studio:
1. Open Visual Studio.
2. Go to the... | 39,604 | [
{
"from": "human",
"value": "Does Visual Studio .NET have a way to toggle word-wrap on and off?\nI am used to this feature in Eclipse which allows you to right click and toggle word wrap on and off so that when you have long lines that extend out to the right, you don't have to move the bottom scroll bar ri... |
I have a page (page1.html) which references a css file (style1.css)
All is good.
I need Page1.html to additionally reference Style2.css
However when I add the reference, some stuff on Page1.html screws up.
How can I determine what it is about Style2.css that is causing this problem?
Some diff Tool?
Some Process?
| When you encounter issues after adding a new CSS file (like `style2.css`) to your HTML page, there are several strategies you can use to diagnose the problem. Here’s a step-by-step approach to help you identify the conflicting styles:
### Step 1: Check for Overlapping Styles
1. **Inspect Element Tool**: Use the browse... | 30,478 | [
{
"from": "human",
"value": "I have a page (page1.html) which references a css file (style1.css)\nAll is good.\nI need Page1.html to additionally reference Style2.css\nHowever when I add the reference, some stuff on Page1.html screws up.\nHow can I determine what it is about Style2.css that is causing this ... |
I'm trying to do Ruby password input with the Highline gem and since I have the user input the password twice, I'd like to eliminate the duplication on the blocks I'm passing in. For example, a simple version of what I'm doing right now is:
new_pass = ask("Enter your new password: ") { |prompt| prompt.echo = false }
ve... | You can achieve the desired behavior by using a block syntax with the `&` operator to pass a `Proc` to the `ask` method. Here’s how you can do it with the Highline gem:
1. Define your `Proc` for the password prompt behavior.
2. Use the `&` operator when calling `ask` to pass the `Proc` as a block.
Here’s an example o... | 39,403 | [
{
"from": "human",
"value": "I'm trying to do Ruby password input with the Highline gem and since I have the user input the password twice, I'd like to eliminate the duplication on the blocks I'm passing in. For example, a simple version of what I'm doing right now is:\nnew_pass = ask(\"Enter your new passw... |
Can an XML-RPC call be made and the resulting XML response be utilized by Adobe's Flex?
Would Flex be better served by a non-XML response and if so what format?
| Yes, an XML-RPC call can be made from Adobe Flex, and the resulting XML response can be utilized within a Flex application. Flex has built-in support for working with XML, and you can parse the XML response to extract the necessary data and use it within your application.
However, there are a few considerations to kee... | 38,319 | [
{
"from": "human",
"value": "Can an XML-RPC call be made and the resulting XML response be utilized by Adobe's Flex?\nWould Flex be better served by a non-XML response and if so what format?\n"
},
{
"from": "gpt",
"value": "Yes, an XML-RPC call can be made from Adobe Flex, and the resulting XML ... |
Mac OS X stores some files with resource forks. I need to create a file with a resource fork. The trouble is, I need to create this file on the command line. Is anyone aware of how you can create a file with a resource fork on the command line in Mac OS X?
| Creating a file with a resource fork on the command line in macOS (formerly Mac OS X) can be done using the `xattr` command, which is used to manipulate extended attributes, including resource forks. Here’s how you can create a file with a resource fork:
### Step 1: Create a Regular File
First, create a regular file.... | 37,244 | [
{
"from": "human",
"value": "Mac OS X stores some files with resource forks. I need to create a file with a resource fork. The trouble is, I need to create this file on the command line. Is anyone aware of how you can create a file with a resource fork on the command line in Mac OS X?\n"
},
{
"fr... |
I've been wondering if it's possible to have Fluent-NHibernate communicate with stored procedures that already exist and assign mapping from the result set to my own domain objects.
Also is Fluent-NHibernate able to directly execute procedures with no result set returned?
Basically I've been considering the implication... | Fluent NHibernate (FNH) can indeed work with stored procedures, and you can map the results of those procedures to your own domain objects. This allows you to leverage the existing stored procedures while still using the benefits of a domain-driven design. Here's how you can work with stored procedures using Fluent NHi... | 36,297 | [
{
"from": "human",
"value": "I've been wondering if it's possible to have Fluent-NHibernate communicate with stored procedures that already exist and assign mapping from the result set to my own domain objects.\nAlso is Fluent-NHibernate able to directly execute procedures with no result set returned?\nBasi... |
I have some program settings that are currently stored in HKEY_LOCAL_MACHINE. Due to Vista and locked down users, some users don't have permission to HKEY_LOCAL_MACHINE, and those values don't really belong to HKEY_LOCAL_USER either (it has to be the same for all users), what's the best alternative location for storing... | Given your requirements, you might want to consider storing your application settings in the **HKEY_LOCAL_MACHINE\Software** hive for the application, but ensure that the permissions are correctly set so that all users can read those values. However, if modifying permissions is not feasible due to security policies or ... | 35,346 | [
{
"from": "human",
"value": "I have some program settings that are currently stored in HKEY_LOCAL_MACHINE. Due to Vista and locked down users, some users don't have permission to HKEY_LOCAL_MACHINE, and those values don't really belong to HKEY_LOCAL_USER either (it has to be the same for all users), what's ... |
I really appreciate it if you could ask my question.
After I call myObjectContext.myEntitySet.ToList() method in my entity framework context, the password part from connectionstring in myObjectContext.Connection.ConnectionString is gone.is it a bug?
thanks very much for your help.
| When you call `myObjectContext.myEntitySet.ToList()` in Entity Framework, it executes a query against the database, which could involve opening a connection to the database. During this process, Entity Framework may modify the `ConnectionString` property in the `Connection` object.
The removal of the password from the... | 38,119 | [
{
"from": "human",
"value": "I really appreciate it if you could ask my question.\nAfter I call myObjectContext.myEntitySet.ToList() method in my entity framework context, the password part from connectionstring in myObjectContext.Connection.ConnectionString is gone.is it a bug?\nthanks very much for your h... |
I have this piece of Javascript and it just won't work. I allready checked JSlint but that said everything works. Still doesn't work. The javascript is located not in the HTML but is linked in the <head>
note: I am working with a local server, so pageload in instant.
function changeVisibility() {
var a = document.g... | It looks like you resolved your issue by ensuring that your JavaScript runs after the DOM is fully loaded. This is a common issue when trying to access DOM elements that may not yet exist when your script is executed. Here’s a summary of the best practices for handling this situation, along with your final code for cla... | 36,615 | [
{
"from": "human",
"value": "I have this piece of Javascript and it just won't work. I allready checked JSlint but that said everything works. Still doesn't work. The javascript is located not in the HTML but is linked in the <head>\nnote: I am working with a local server, so pageload in instant.\nfunction ... |
I need to store sensitive data across few pages (run over https) per session.
I can't use session object, for the primary reason being that the session store is designed as just as backup store (primarily make service calls and load the session). If the session has been restarted or in other words that the key in the s... | When it comes to handling sensitive data across pages in a web application, especially without a persistent store, you must consider both security and performance implications. Let's analyze the options you presented:
### 1. Storing Encrypted Data in ViewState
- **Pros:**
- By encrypting the sensitive data, you prov... | 31,629 | [
{
"from": "human",
"value": "I need to store sensitive data across few pages (run over https) per session.\nI can't use session object, for the primary reason being that the session store is designed as just as backup store (primarily make service calls and load the session). If the session has been restart... |
I'm using the StAX event based API's to modify an XML stream.
The stream represents an HTML document, complete with DTD declaration. I would like to copy this DTD declaration into the output document (written using an XMLEventWriter).
When I ask the factory to disregard DTD's, it will not download the DTD, but it remov... | To handle XML processing using StAX without fetching external DTDs, you can implement a custom `EntityResolver`. The resolver can be set to return an empty input stream for external DTDs, which will prevent them from being fetched but allow you to retain the DTD declaration in your output.
Here’s a step-by-step guide ... | 36,102 | [
{
"from": "human",
"value": "I'm using the StAX event based API's to modify an XML stream.\nThe stream represents an HTML document, complete with DTD declaration. I would like to copy this DTD declaration into the output document (written using an XMLEventWriter).\nWhen I ask the factory to disregard DTD's,... |
I have an AliasRecord creating using the Alias Manager function FSNewAlias(fromFSRef, targetFSRef, &aliasRecordHandle). My understanding is that the resulting alias record will contain information for a relative path search (relative to fromFSRef). Because my users are on networked home directories and mobile accounts,... | The behavior you're observing stems from how the alias records work and the underlying file system structure of macOS, particularly with networked home directories and mobile accounts. When you create an alias using `FSNewAlias`, it indeed stores a reference that is relative to the original `fromFSRef`. However, since ... | 37,189 | [
{
"from": "human",
"value": "I have an AliasRecord creating using the Alias Manager function FSNewAlias(fromFSRef, targetFSRef, &aliasRecordHandle). My understanding is that the resulting alias record will contain information for a relative path search (relative to fromFSRef). Because my users are on networ... |
I'm trying to make a setup program for an ASP.NET web site. I need to make sure the target machine has sqlxml installed.
I must verify the target machine has the software installed, and if not, launch a .msi file either before or after the main installation.
I'm a complete newbie with setup projects, so maybe this is o... | Creating a setup program that checks for prerequisites, like SQLXML, and installs them if they are not present can be done in several ways. Since you're looking for a simpler solution and might not want to dive too deep into WiX or other more complex installers, here are a few approaches you could consider:
### Approa... | 35,099 | [
{
"from": "human",
"value": "I'm trying to make a setup program for an ASP.NET web site. I need to make sure the target machine has sqlxml installed.\nI must verify the target machine has the software installed, and if not, launch a .msi file either before or after the main installation.\nI'm a complete new... |
How to generate the Symbols file of a PowerBuilder program for dump analysis?
| Generating the Symbols file for a PowerBuilder program is essential for effective dump analysis, particularly when you need to debug a crash or an unexpected behavior in your PowerBuilder application. Here's how you can generate the Symbols file:
### Steps to Generate a Symbols File in PowerBuilder:
1. **Compile Your... | 36,877 | [
{
"from": "human",
"value": "How to generate the Symbols file of a PowerBuilder program for dump analysis?\n"
},
{
"from": "gpt",
"value": "Generating the Symbols file for a PowerBuilder program is essential for effective dump analysis, particularly when you need to debug a crash or an unexpecte... |
Four 2D points in an array. I need to sort them in clockwise order. I think it can be done with just one swap operation but I have not been able to put this down formally.
Edit: The four points are a convex polygon in my case.
Edit: The four points are the vertices of a convex polygon. They need not be in order.
| To sort four 2D points that are the vertices of a convex polygon in clockwise order, you can achieve this with one swap operation if they are already close to the desired order. Here’s a step-by-step outline of how you could formalize this process:
### Step 1: Calculate the Centroid
First, calculate the centroid (geom... | 33,522 | [
{
"from": "human",
"value": "Four 2D points in an array. I need to sort them in clockwise order. I think it can be done with just one swap operation but I have not been able to put this down formally.\nEdit: The four points are a convex polygon in my case.\nEdit: The four points are the vertices of a convex... |
I'm going to have my website hosted soon on a VPS or dedicated server (with Windows 2008), so I'm trying to plan ahead. I wonder whether the built-in SMTP server that comes with IIS7 is reliable enough for a production server or should I look for an alternative? I heard good things about hmailserver and best of all it'... | When it comes to using the built-in SMTP server in IIS 7 on Windows Server 2008 for a production environment, there are several factors to consider:
### Built-in SMTP Server in IIS 7
**Advantages:**
- **Integration:** The built-in SMTP server is well-integrated with other Microsoft services and can be configured thro... | 31,514 | [
{
"from": "human",
"value": "I'm going to have my website hosted soon on a VPS or dedicated server (with Windows 2008), so I'm trying to plan ahead. I wonder whether the built-in SMTP server that comes with IIS7 is reliable enough for a production server or should I look for an alternative? I heard good thi... |
What's the simplest way to join one or more arrays (or ArrayLists) in Visual Basic?
I'm using .NET 3.5, if that matters much.
| In Visual Basic .NET (VB.NET), particularly in .NET 3.5, the simplest way to join one or more arrays (or ArrayLists) is to use the `Concat` method available in the `System.Linq` namespace. However, note that `System.Linq` is not available by default in .NET 3.5 for `ArrayList`.
Here’s how you can join arrays and Arra... | 34,916 | [
{
"from": "human",
"value": "What's the simplest way to join one or more arrays (or ArrayLists) in Visual Basic?\nI'm using .NET 3.5, if that matters much.\n"
},
{
"from": "gpt",
"value": "In Visual Basic .NET (VB.NET), particularly in .NET 3.5, the simplest way to join one or more arrays (or Ar... |
I'm sure there is a quick and easy way to calculate the sum of a column of values on Unix systems (using something like awk or xargs perhaps), but writing a shell script to parse the rows line by line is the only thing that comes to mind at the moment.
For example, what's the simplest way to modify the command below to... | You can easily compute the total of the SEGSZ column using `awk` in a Unix shell. Here's how you can modify your command to achieve this:
```bash
ipcs -mb | awk 'NR>6 { sum += $7 } END { print sum }'
```
### Explanation:
- `ipcs -mb` displays the memory segment information.
- `awk 'NR>6 { sum += $7 }` processes the o... | 39,583 | [
{
"from": "human",
"value": "I'm sure there is a quick and easy way to calculate the sum of a column of values on Unix systems (using something like awk or xargs perhaps), but writing a shell script to parse the rows line by line is the only thing that comes to mind at the moment.\nFor example, what's the s... |
I'm trying to wrap my head around how to search for something that appears in the middle of a word / expression - something like searching for "LIKE %book% " - but in SQL Server (2005) full text catalog.
How can I do that? It almost appears as if both CONTAINS and FREETEXT really don't support wildcard at the beginning... | In SQL Server, Full Text Search has some limitations when it comes to using wildcards and searching for substrings in the middle of words. Here's a breakdown of how Full Text Search works regarding your question:
1. **FREETEXT**: This function is designed to search for terms in a natural language manner. When you use ... | 36,500 | [
{
"from": "human",
"value": "I'm trying to wrap my head around how to search for something that appears in the middle of a word / expression - something like searching for \"LIKE %book% \" - but in SQL Server (2005) full text catalog.\nHow can I do that? It almost appears as if both CONTAINS and FREETEXT re... |
Both static_cast and reinterpret_cast seem to work fine for casting void* to another pointer type. Is there a good reason to favor one over the other?
| Yes, there are important differences between `static_cast` and `reinterpret_cast` in C++, and the choice between them can affect the safety and clarity of your code. Here's a breakdown of both casts with respect to casting `void*` to another pointer type:
### `static_cast`
- **Type Safety**: `static_cast` performs so... | 36,892 | [
{
"from": "human",
"value": "Both static_cast and reinterpret_cast seem to work fine for casting void* to another pointer type. Is there a good reason to favor one over the other?\n"
},
{
"from": "gpt",
"value": "Yes, there are important differences between `static_cast` and `reinterpret_cast` i... |
In classic ASP there is a global object called "Application" that is accessed simultaniously by all sessions.
As the "Application" object is a shared resource, can it cause dead locks?
EDIT: If not, why does it has lock and unlock methods for? Reference
| In classic ASP, the `Application` object serves as a shared resource that can be accessed by all users (sessions) of the web application. While you generally don't have to worry about deadlocks in the context of the `Application` object, it's important to understand how locking works with this object to prevent race co... | 36,607 | [
{
"from": "human",
"value": "In classic ASP there is a global object called \"Application\" that is accessed simultaniously by all sessions.\nAs the \"Application\" object is a shared resource, can it cause dead locks?\nEDIT: If not, why does it has lock and unlock methods for? Reference\n"
},
{
"fr... |
Not strictly a programming question, but I was programming at the time and couldn't find an answer, so I thought, "Hey, I'll give StackOverflow a try!"
So I'm connected to my Windows XP work PC over a Remote Desktop connection through VPN. In a command window (on the remote PC), I foolishly type ipconfig /release. A ... | If you accidentally ran `ipconfig /release` on your Windows XP work PC, it would have released the current IP address assigned to that machine. This could effectively disconnect your Remote Desktop session because the machine no longer has a valid IP address on the network.
Here are a few potential steps you can take ... | 34,212 | [
{
"from": "human",
"value": "Not strictly a programming question, but I was programming at the time and couldn't find an answer, so I thought, \"Hey, I'll give StackOverflow a try!\"\nSo I'm connected to my Windows XP work PC over a Remote Desktop connection through VPN. In a command window (on the remote ... |
It's a trivial task to find out if an object is referenced by something else or not. What I'd like to do is identify whether or not it's actually being used.
My solution originally involved a combination of a table that held a list of objects in the database and an hourly job.
The job did two things. First, it looked ... | Monitoring the usage of database objects is indeed an important task, especially when dealing with legacy systems and ensuring that the databases remain optimized and free of unused objects. Here are several methods that you could consider to keep track of the usage of tables, views, stored procedures, and functions in... | 35,053 | [
{
"from": "human",
"value": "It's a trivial task to find out if an object is referenced by something else or not. What I'd like to do is identify whether or not it's actually being used.\nMy solution originally involved a combination of a table that held a list of objects in the database and an hourly job.... |
I have an application, written in C++ using MFC and Stingray libraries. The application works with a wide variety of large data types, which are all currently serialized based on MFC Document/View serialize derived functionality. I have also added options for XML serialization based on the Stingray libraries, which i... | For efficient XML serialization in a C++ application that uses MFC and works with large data sets, you might want to consider the following options:
1. **TinyXML2**: This is a lightweight, simple, and efficient XML parser. TinyXML2 provides a straightforward API and is very easy to integrate. It doesn’t require you to... | 36,079 | [
{
"from": "human",
"value": "I have an application, written in C++ using MFC and Stingray libraries. The application works with a wide variety of large data types, which are all currently serialized based on MFC Document/View serialize derived functionality. I have also added options for XML serialization... |
I've got a small piece of code that is parsing an index value to determine a cell input into Excel. It's got me thinking...
What's the difference between
xlsSheet.Write("C" + rowIndex.ToString(), null, title);
and
xlsSheet.Write(string.Format("C{0}", rowIndex), null, title);
Is one "better" than the other? And why?... | Both approaches you provided are valid ways to format strings in C# for writing to an Excel sheet, but they have some differences in syntax and potential use cases. Let's look at each one closely:
1. **String Concatenation:**
```csharp
xlsSheet.Write("C" + rowIndex.ToString(), null, title);
```
- This uses... | 38,056 | [
{
"from": "human",
"value": "I've got a small piece of code that is parsing an index value to determine a cell input into Excel. It's got me thinking...\nWhat's the difference between \nxlsSheet.Write(\"C\" + rowIndex.ToString(), null, title);\n\nand\nxlsSheet.Write(string.Format(\"C{0}\", rowIndex), null,... |
What does STRAIGHT_JOIN do in this code ?
SELECT STRAIGHT_JOIN ClosingBalance
FROM Accounts
WHERE idAccounts = FidDebit;
| In MySQL, the `STRAIGHT_JOIN` keyword is used to force the query optimizer to join the tables in the order in which they are listed in the SQL query, rather than letting the optimizer determine the order. This can be beneficial in certain situations where you believe that the optimizer might make a suboptimal choice re... | 36,434 | [
{
"from": "human",
"value": "What does STRAIGHT_JOIN do in this code ?\nSELECT STRAIGHT_JOIN ClosingBalance \nFROM Accounts \nWHERE idAccounts = FidDebit;\n\n"
},
{
"from": "gpt",
"value": "In MySQL, the `STRAIGHT_JOIN` keyword is used to force the query optimizer to join the tables in the... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.