instruction stringlengths 14 27.6k | completion stringlengths 3 38.3k | __original_row_idx int64 0 50k | conversations listlengths 2 2 |
|---|---|---|---|
What do you think is the best way to implement an interactive grid similar to a Sudoku board for a native iPhone application? I did not see an object to fill this need in the SDK.
Should I make a custom control for an individual cell, then initialize as many of them as I need in a grid form?
(source: 4thewww.com)
An... | Creating an interactive grid similar to a Sudoku board in a native iPhone application is a great project! Since there is no built-in object specifically for this purpose in the iOS SDK, you can certainly create a custom solution. Here are some steps and tips on how to approach this:
### 1. Use a UICollectionView
One ... | 38,407 | [
{
"from": "human",
"value": "What do you think is the best way to implement an interactive grid similar to a Sudoku board for a native iPhone application? I did not see an object to fill this need in the SDK.\nShould I make a custom control for an individual cell, then initialize as many of them as I need ... |
how do i make an autocomplete textbox in asp?
but i need to get the autocomplete data by querying the database.
I dont really know how to explain this, sory if theres not enough detail.
i cant use ajax, because i think i will have compability issues with my old app.
so im thinking of doing this using java script. or ... | Creating an autocomplete textbox in ASP.NET without using AJAX can be challenging since traditional postbacks will cause a full page refresh. However, you can still achieve this using a combination of a `TextBox`, a `ListBox` for displaying autocomplete suggestions, and some server-side logic in your ASP.NET code-behin... | 40,404 | [
{
"from": "human",
"value": "how do i make an autocomplete textbox in asp?\nbut i need to get the autocomplete data by querying the database. \nI dont really know how to explain this, sory if theres not enough detail. \ni cant use ajax, because i think i will have compability issues with my old app.\nso im ... |
I've got about 200k images in a bucket. They all have expires headers of 2050 but I've read you shouldn't send an expires header older than a year. I want to schedule a script to run every month and set the headers to 6 months away. Anything out there? Obviously I'd like to avoid iterating 200k objects.
| If you have a large number of images in a storage bucket (like AWS S3, Google Cloud Storage, etc.), and you want to update their expiration headers without iterating through all 200,000 objects every month, you have a few options. However, you should note that most approaches will still require some degree of iteration... | 41,192 | [
{
"from": "human",
"value": "I've got about 200k images in a bucket. They all have expires headers of 2050 but I've read you shouldn't send an expires header older than a year. I want to schedule a script to run every month and set the headers to 6 months away. Anything out there? Obviously I'd like to avoi... |
Is it possible to get the expiry DateTime of an HttpRuntime.Cache object?
If so, what would be the best approach?
| In ASP.NET, the `HttpRuntime.Cache` does not provide a direct way to retrieve the expiry DateTime of a cached item. When you add an item to the cache, you can specify a sliding or absolute expiration policy, but the cache itself does not expose the expiration time after the item has been cached.
### Workaround Approac... | 41,342 | [
{
"from": "human",
"value": "Is it possible to get the expiry DateTime of an HttpRuntime.Cache object?\nIf so, what would be the best approach?\n"
},
{
"from": "gpt",
"value": "In ASP.NET, the `HttpRuntime.Cache` does not provide a direct way to retrieve the expiry DateTime of a cached item. Whe... |
Can anyone recommend a decent SFTP library for use with Windows C++ apps? If a cross-platform one is available then all the better, but it's not essential. It's for use with a commercial application, so paying for something isn't an issue.
I am using the superb Ultimate TCP/IP library which supports FTP-S but not SFT... | There are several SFTP libraries you can consider for your Windows C++ application, and many of them also support cross-platform development. Here are some recommendations:
1. **Chilkat SFTP**: As you've already mentioned, Chilkat is a solid option. It is well-documented, easy to use, and supports multiple platforms. ... | 44,704 | [
{
"from": "human",
"value": "Can anyone recommend a decent SFTP library for use with Windows C++ apps? If a cross-platform one is available then all the better, but it's not essential. It's for use with a commercial application, so paying for something isn't an issue.\nI am using the superb Ultimate TCP/I... |
I would like to show some links only to authenticated users in an asp.net mvc web application.
I use the template for an asp.net mvc web application in Visual Studio 2008 that came with the beta release of asp.net mvc.
I use forms authentication.
I would like to add something like the following to an existing view:
... | In an ASP.NET MVC application using Forms Authentication, you can easily conditionally display content based on whether a user is authenticated or not. To show a link only to authenticated users, you can use the `User.Identity.IsAuthenticated` property in your Razor view.
Here’s how you can modify your view to display... | 44,649 | [
{
"from": "human",
"value": "I would like to show some links only to authenticated users in an asp.net mvc web application.\n\nI use the template for an asp.net mvc web application in Visual Studio 2008 that came with the beta release of asp.net mvc.\nI use forms authentication.\nI would like to add somethi... |
This is kind of an unorthodox question.
I'm kinda new to using IDA Pro.
Is there a way to edit the assembly code and then have IDA save the result as an executable?
Is there some kind of plugin maybe that does that? because it seems that IDA doesn't want to save as an EXE.
Or do I need to manually edit it in some oth... | Editing the assembly code in IDA Pro and then exporting it as a runnable executable is a complex process. IDA Pro primarily serves as a disassembler and debugger, and while it allows for some level of editing, it does not directly support saving your modifications as an executable file.
Here are some approaches to ach... | 42,704 | [
{
"from": "human",
"value": "This is kind of an unorthodox question. \nI'm kinda new to using IDA Pro.\nIs there a way to edit the assembly code and then have IDA save the result as an executable?\nIs there some kind of plugin maybe that does that? because it seems that IDA doesn't want to save as an EXE.\... |
What is the masked text provider used for? Why is it different from regex?
Is it possible to translate the regex format to mask or vise versa ?
Thanks
| A **masked text provider** is commonly used in user interfaces to control and format user input, especially for fields like phone numbers, dates, social security numbers, and other structured data. It allows you to specify a format that dictates how the user can enter their input, such as placing certain characters in ... | 43,114 | [
{
"from": "human",
"value": "What is the masked text provider used for? Why is it different from regex?\nIs it possible to translate the regex format to mask or vise versa ?\nThanks\n"
},
{
"from": "gpt",
"value": "A **masked text provider** is commonly used in user interfaces to control and for... |
As a follow-up to this question, I need help with the following scenario:
In Oracle, given a simple data table:
create table data (
id VARCHAR2(255),
key VARCHAR2(255),
value CLOB);
I am using the following merge command:
merge into data
using (
select
? id,
? key,
... | The error message `ORA-01461: cannot bind a LONG value for insert into a long column` occurs because Oracle JDBC expects `CLOB` data to be passed as a `java.sql.Clob` object for larger strings. When you use placeholders (`?`) in a prepared statement for large CLOB values, you should ensure that the input values are han... | 40,673 | [
{
"from": "human",
"value": "As a follow-up to this question, I need help with the following scenario:\nIn Oracle, given a simple data table:\ncreate table data (\n id VARCHAR2(255),\n key VARCHAR2(255),\n value CLOB);\n\nI am using the following merge command:\nmerge into data\nusing... |
So, I've been tasked with making a kiosk for the office for showing statistics about our SCRUM progress, build server status, rentability and so forth. It should ideally run a slideshow with bunch of different pages, some of them showing text, some showing graphs and so on.
What is the best approach for this? I first ... | Creating a kiosk for displaying SCRUM progress and build server status is a great way to keep the team informed and engaged. While PowerPoint is a versatile tool, it might not be the best choice for a dynamic dashboard that needs to pull data from external sources. Here are a few alternative approaches and tools that m... | 43,316 | [
{
"from": "human",
"value": "So, I've been tasked with making a kiosk for the office for showing statistics about our SCRUM progress, build server status, rentability and so forth. It should ideally run a slideshow with bunch of different pages, some of them showing text, some showing graphs and so on. \nWh... |
I'm getting an error compiling my VSTO (Visual Studio Tools for Office) project in VS.
It says "Value does not fall within the expected range." and "There was an error during installation"
| The error message "Value does not fall within the expected range." during the compilation of a VSTO (Visual Studio Tools for Office) project can arise due to several reasons. Here are some potential solutions you can try to resolve the issue:
### 1. Check Project References
Ensure that all the project references are v... | 40,307 | [
{
"from": "human",
"value": "I'm getting an error compiling my VSTO (Visual Studio Tools for Office) project in VS.\nIt says \"Value does not fall within the expected range.\" and \"There was an error during installation\"\n"
},
{
"from": "gpt",
"value": "The error message \"Value does not fall ... |
If I am storing the Subversion user names and passwords for repository access in a text file in the conf folder, what is the maximum length of the passwords I can use? That is to say, how long can the secrets in the following file be?
[users]
harry = harryssecret
sally = sallyssecret
| Subversion (SVN) does not impose a strict limit on the length of usernames and passwords in its configuration files, such as the `authz` file or the `svnserve.conf` file. However, in practical scenarios, the length of passwords is usually constrained by the underlying systems and protocols rather than by Subversion its... | 48,212 | [
{
"from": "human",
"value": "If I am storing the Subversion user names and passwords for repository access in a text file in the conf folder, what is the maximum length of the passwords I can use? That is to say, how long can the secrets in the following file be?\n[users]\nharry = harryssecret\nsally = sall... |
For a WPF application which will need 10 - 20 small icons and images for illustrative purposes, is storing these in the assembly as embedded resources the right way to go?
If so, how do I specify in XAML that an Image control should load the image from an embedded resource?
| Storing small icons and images as embedded resources in your WPF application can be a good approach, especially if you want to keep your application self-contained and avoid external file dependencies. This method makes it easier to manage resources and ensures that they are included with your application during deploy... | 44,515 | [
{
"from": "human",
"value": "For a WPF application which will need 10 - 20 small icons and images for illustrative purposes, is storing these in the assembly as embedded resources the right way to go?\nIf so, how do I specify in XAML that an Image control should load the image from an embedded resource?\n"
... |
Does anyone know of a library or set of classes for splines - specifically b-splines and NURBS (optional).
A fast, efficient b-spline library would be so useful for me at the moment.
| Yes, there are several libraries that provide implementations of B-splines and NURBS that you can use for various applications. Here are some options:
### C++
1. **Eigen**: While Eigen is primarily a linear algebra library, it includes support for B-splines through external modules. You may have to look for community... | 42,726 | [
{
"from": "human",
"value": "Does anyone know of a library or set of classes for splines - specifically b-splines and NURBS (optional). \nA fast, efficient b-spline library would be so useful for me at the moment.\n"
},
{
"from": "gpt",
"value": "Yes, there are several libraries that provide imp... |
How can I compile/run C or C++ code in a Unix console or a Mac terminal?
| To compile and run C or C++ code in a Unix console or a Mac terminal, you can use a C/C++ compiler such as GCC (GNU Compiler Collection) or Clang. Most Unix-like systems and macOS come with these compilers pre-installed or can easily have them installed. Below are steps to compile and run C or C++ code.
### 1. Check f... | 42,499 | [
{
"from": "human",
"value": "How can I compile/run C or C++ code in a Unix console or a Mac terminal?\n"
},
{
"from": "gpt",
"value": "To compile and run C or C++ code in a Unix console or a Mac terminal, you can use a C/C++ compiler such as GCC (GNU Compiler Collection) or Clang. Most Unix-like... |
I'm using interface builder's tag feature to access some UILabels I'm instantiating in a xib file. Since this a UITextViewCell I want to avoid superfluous method calls, but I want to do it right too. Thus when I do:
UILabel *label = (UILabel *)[cell viewWithTag:1];
I'm wondering if I should wrap it up like so:
if([[ce... | When you're using the `viewWithTag:` method in UIKit, it's essential to ensure that you're retrieving the correct type of view and handling any potential issues that might arise if the view with the specified tag does not exist or is of a different type.
Your code snippet as it stands has a couple of issues:
1. You a... | 46,522 | [
{
"from": "human",
"value": "I'm using interface builder's tag feature to access some UILabels I'm instantiating in a xib file. Since this a UITextViewCell I want to avoid superfluous method calls, but I want to do it right too. Thus when I do:\nUILabel *label = (UILabel *)[cell viewWithTag:1];\n\nI'm wonde... |
System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+. at
System.Drawing.Image.Save(String filename, ImageCodecInfo encoder, EncoderParameters encoderParams) at
System.Drawing.Image.Save(String filename, ImageFormat format) at
System.Drawing.Image.Save(String filename) at
Content.btnAddImag... | The `System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+` error typically indicates an issue with the GDI+ library when trying to save an image in a .NET application. Since you mentioned that this works on a PC but not on macOS, here are several potential reasons and solutions you can con... | 42,992 | [
{
"from": "human",
"value": "System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+. at\nSystem.Drawing.Image.Save(String filename, ImageCodecInfo encoder, EncoderParameters encoderParams) at\nSystem.Drawing.Image.Save(String filename, ImageFormat format) at\nSystem.Drawing.Image... |
I'm looking at using CompositeWPF (http://www.codeplex.com/CompositeWPF) - aka Prism, to build an application I am working on.
The application isn't a traditional LOB application, however it does present data and state information to the user.
One thing which I am unsure of is if CompositeWPF supports more than one Win... | Yes, Composite WPF (Prism) can support multiple windows or shells, including the scenarios you've described. Here’s how you can achieve your goals:
### 1. Multiple Windows or Shells
Prism is designed to facilitate a modular architecture, which means you can manage multiple windows in your application. You can create s... | 41,562 | [
{
"from": "human",
"value": "I'm looking at using CompositeWPF (http://www.codeplex.com/CompositeWPF) - aka Prism, to build an application I am working on.\nThe application isn't a traditional LOB application, however it does present data and state information to the user.\nOne thing which I am unsure of is... |
I have made it so that when I double click on certain images in Visio, it will take you to another page. Is there a way that the image can be identified as being linked so that if i sent it to someone, they would know to click on it?
| Yes, there are a few methods to indicate that an image in Visio is linked to another page. Here are some suggestions:
1. **Visual Cues:**
- **Borders or Effects:** You can add a border or shadow effect around the images to make them stand out.
- **Icons or Symbols:** Add a small icon (like a chain link or arrow... | 45,689 | [
{
"from": "human",
"value": "I have made it so that when I double click on certain images in Visio, it will take you to another page. Is there a way that the image can be identified as being linked so that if i sent it to someone, they would know to click on it?\n"
},
{
"from": "gpt",
"value": ... |
I'm looking for some good resources to ramp up on the animation/storyboard concepts used in WPF/Silverlight. Any pointers?
| Certainly! If you're looking to ramp up on animation and storyboard concepts in WPF (Windows Presentation Foundation) and Silverlight, there are several resources and learning materials that can help you get started:
### Books
1. **"Pro WPF in C# 2010: Advanced Application Development" by Matthew MacDonald** - This bo... | 44,029 | [
{
"from": "human",
"value": "I'm looking for some good resources to ramp up on the animation/storyboard concepts used in WPF/Silverlight. Any pointers?\n"
},
{
"from": "gpt",
"value": "Certainly! If you're looking to ramp up on animation and storyboard concepts in WPF (Windows Presentation Found... |
I have the handler of an open window which wasn't necessarily open by my process. How can I add a button to that window and make the button call a certain application (.exe) when clicked? The button could be next to the system menu or the minimize button. This should work for both XP and Vista (a different approach for... | Modifying the UI of another application's window (like adding a button) can be complex and is generally not recommended due to potential instability and compatibility issues. However, if you want to experiment with this approach, you can use the Windows API for this purpose. Below is a general outline for how you could... | 42,943 | [
{
"from": "human",
"value": "I have the handler of an open window which wasn't necessarily open by my process. How can I add a button to that window and make the button call a certain application (.exe) when clicked? The button could be next to the system menu or the minimize button. This should work for bo... |
I'm writing an ASP.NET 3.5 web application. There is a rather complex input form (30 input controls - TextBoxes, Dropdownlists, ...).
Now, different clients use the same form in their customized application and there are different mandatory fields for some clients.
Now, I'd like to programmatically create/activate cert... | You can definitely achieve dynamic validation in an ASP.NET 3.5 web application by creating validators programmatically based on your configuration settings. This way, you can avoid having to define all validators on the page upfront. Here’s how you can go about it.
### Step-by-Step Approach
1. **Configuration Setup*... | 42,179 | [
{
"from": "human",
"value": "I'm writing an ASP.NET 3.5 web application. There is a rather complex input form (30 input controls - TextBoxes, Dropdownlists, ...).\nNow, different clients use the same form in their customized application and there are different mandatory fields for some clients.\nNow, I'd li... |
In SSIS, how do I step through a foreach loop in debug to see each step within it individually? I've added breakpoints, but they don't seem to break on them in debug?
Thanks!
| Debugging a Foreach Loop Container in SQL Server Integration Services (SSIS) can be a bit tricky since the container iterates through a collection and the breakpoints might not always trigger as expected within the loop's iterations. Here are some steps and tips to effectively debug a Foreach Loop in SSIS:
### 1. Set ... | 42,470 | [
{
"from": "human",
"value": "In SSIS, how do I step through a foreach loop in debug to see each step within it individually? I've added breakpoints, but they don't seem to break on them in debug?\nThanks!\n"
},
{
"from": "gpt",
"value": "Debugging a Foreach Loop Container in SQL Server Integrati... |
I have read the documentation for the CI Caching but still don't understand much about it. What exactly does it do, and what is the use of caching a dynamic website?
| CI Caching refers to caching mechanisms used in CodeIgniter (CI), a popular PHP framework. Caching is a technique used to store and reuse previously fetched data to improve the performance of web applications. Here’s a breakdown of what CI Caching does and its significance for dynamic websites:
### What CI Caching Doe... | 40,687 | [
{
"from": "human",
"value": "I have read the documentation for the CI Caching but still don't understand much about it. What exactly does it do, and what is the use of caching a dynamic website?\n"
},
{
"from": "gpt",
"value": "CI Caching refers to caching mechanisms used in CodeIgniter (CI), a... |
I'm following iPhone dev courses from Stanford Open-University, and I've been blocked for 2 days on assignment3, maybe someone can help me here?
The tasks are:
Create a custom UIView subclass that will display your PolygonShape object
Give your view class access to the PolygonShape object so that it can retrieve the ... | To give your `CustomView` class access to the `PolygonShape` object defined in your `Controller`, you can follow these steps:
1. **Define a Property in Your Custom View**: Modify your `CustomView` class to include a property for the `PolygonShape`. This way, you can set the polygon object from your controller.
2. **S... | 40,818 | [
{
"from": "human",
"value": "I'm following iPhone dev courses from Stanford Open-University, and I've been blocked for 2 days on assignment3, maybe someone can help me here?\nThe tasks are:\n\nCreate a custom UIView subclass that will display your PolygonShape object \nGive your view class access to the Pol... |
I have been using LINQ to SQL for a while, and there is one thing that has always bothered me. Whenever I modify the schema of a table, in order to refresh it in the designer, I have to delete it and then add it back. That's fine, but this means I have to actually find the table in the designer. I have about 100+ tab... | Yes, there is a way to refresh the table schema in the LINQ to SQL designer without having to delete and re-add the table manually each time. Instead of going through the cumbersome process of finding the table, you can follow these steps to refresh the schema more efficiently:
### Method 1: Using the "Update Model fr... | 42,086 | [
{
"from": "human",
"value": "I have been using LINQ to SQL for a while, and there is one thing that has always bothered me. Whenever I modify the schema of a table, in order to refresh it in the designer, I have to delete it and then add it back. That's fine, but this means I have to actually find the tabl... |
I have been trying to tackle this problem, but I am having difficulty understanding it:
Let φ be Euler's totient function, i.e. for a natural number n, φ(n) is the number of k, 1 <= k <= n, for which gcd(k,n) = 1.
By iterating φ, each positive integer generates a decreasing chain of numbers ending in 1.
E.g. if we sta... | Let's clarify your understanding of Euler's totient function \( \phi(n) \) and how it generates chains of numbers.
1. **Understanding Euler's Totient Function**: The function \( \phi(n) \) gives the count of integers \( k \) in the range \( 1 \leq k \leq n \) such that \( \gcd(k, n) = 1 \). This means those integers a... | 41,528 | [
{
"from": "human",
"value": "I have been trying to tackle this problem, but I am having difficulty understanding it:\n\nLet φ be Euler's totient function, i.e. for a natural number n, φ(n) is the number of k, 1 <= k <= n, for which gcd(k,n) = 1.\nBy iterating φ, each positive integer generates a decreasing ... |
I'm using QUnit to test some JQuery, and I've got Watin to load up the test page and parse out the test results, but I'm wondering if there's a way to dynamically generate the tests from the page using the MS Test suite rather than having to write a Test function for each test?
I'm just trying to reduce the amount of c... | Yes, you can dynamically generate tests in the MS Test suite (or similar frameworks) by leveraging reflection and metadata about the tests defined on your QUnit page. This allows you to avoid having to write a separate test function for each QUnit test explicitly. Below is a general approach you can take to achieve thi... | 43,068 | [
{
"from": "human",
"value": "I'm using QUnit to test some JQuery, and I've got Watin to load up the test page and parse out the test results, but I'm wondering if there's a way to dynamically generate the tests from the page using the MS Test suite rather than having to write a Test function for each test?\... |
Windows Mobile pops up a "busy wheel" - a rotating colour disk - when things are happening . I can't find in the documentation how this is done - can someone point me in the right direction?
We have a situation where we need to prompt the user to say we're doing stuff for a while, but we don't know how long it will ta... | In Windows Mobile development, showing a busy indicator like a rotating disk or "busy wheel" is typically done using a `ProgressIndicator` control or by displaying a custom loading animation. Here’s how you can implement this in your application:
### Using a Progress Indicator
1. **Add the Progress Indicator Control*... | 41,236 | [
{
"from": "human",
"value": "Windows Mobile pops up a \"busy wheel\" - a rotating colour disk - when things are happening . I can't find in the documentation how this is done - can someone point me in the right direction?\nWe have a situation where we need to prompt the user to say we're doing stuff for a ... |
When using Google Reader and browsing RSS entries in the "Expanded" view, entries will automatically be marked as 'read' once a certain percentage of the div is visible on the screen (difficult to tell what percentage has to be visible in the case of Google Reader). So, as I scroll down line-by-line, the javascript cod... | To determine if a div (or any other HTML element) has scrolled into view and how much of it is visible, you can use the intersection observer API or manually calculate the position of the element relative to the viewport. Below, I'll provide both approaches, starting with the Intersection Observer as it's the more mode... | 43,033 | [
{
"from": "human",
"value": "When using Google Reader and browsing RSS entries in the \"Expanded\" view, entries will automatically be marked as 'read' once a certain percentage of the div is visible on the screen (difficult to tell what percentage has to be visible in the case of Google Reader). So, as I s... |
VBScript doesn't appear to have a way to include a common file of functions.
Is there a way to achieve this?
| VBScript does not have a built-in mechanism for including files (like `#include` in C/C++ or `import` in Python), but you can achieve similar functionality by using a couple of workarounds. Here are a few methods to use common functions in multiple VBScript files:
### 1. Use a Function Library Script
You can create a... | 42,782 | [
{
"from": "human",
"value": "VBScript doesn't appear to have a way to include a common file of functions.\nIs there a way to achieve this?\n"
},
{
"from": "gpt",
"value": "VBScript does not have a built-in mechanism for including files (like `#include` in C/C++ or `import` in Python), but you ca... |
I am creating my textbox with these options. I can Copy / Cut / Paste / Undo, but when I hit Select All it doesn't select all. I can right click and click Select All but CTRL + A doesn't do anything. Why?
wnd = CreateWindow("EDIT", 0,
WS_CHILD | WS_VISIBLE | ES_MULTILINE | WS_HSCROLL | WS_VSCROLL | ES_AUTOHSCROLL |... | The issue you're experiencing with `CTRL + A` not functioning as expected for selecting all text in your `EDIT` control is likely due to the fact that you have not handled the keyboard input messages properly. Windows does not automatically handle keyboard shortcuts like `CTRL + A` for you unless you've set up the nece... | 42,282 | [
{
"from": "human",
"value": "I am creating my textbox with these options. I can Copy / Cut / Paste / Undo, but when I hit Select All it doesn't select all. I can right click and click Select All but CTRL + A doesn't do anything. Why?\nwnd = CreateWindow(\"EDIT\", 0,\n WS_CHILD | WS_VISIBLE | ES_MULTILINE... |
I'm trying to come up with a simple and efficient way to create a smooth surface which intersects a number of given "sample" points.
For any X,Y point on the surface, I identify up to 4 sample points in each of the 4 directions (the next higher and lower points on the X, and then the Y axes). Given this point, I want ... | To create a smooth surface that interpolates through a set of sample points using their Z values based on their X and Y coordinates, you can employ bilinear interpolation or a more general method called inverse distance weighting (IDW). Here’s a step-by-step breakdown of both methods, starting with bilinear interpolati... | 36,053 | [
{
"from": "human",
"value": "I'm trying to come up with a simple and efficient way to create a smooth surface which intersects a number of given \"sample\" points.\nFor any X,Y point on the surface, I identify up to 4 sample points in each of the 4 directions (the next higher and lower points on the X, and ... |
I currently have a listview and I want to add an appropriate icon to each entry.
I have created an icon within the Project resources and called it 'errorIcon.ico'. How can I reference this icon/resource and use it within a listview?
| To use an icon from your project's resources in a ListView in a Windows Forms application, you can follow these steps. Below, I'll provide an example of how to do this in C#.
1. **Add the Icon to Your Project Resources**:
Ensure that your icon file (`errorIcon.ico`) is added to your project resources. You can do t... | 43,552 | [
{
"from": "human",
"value": "I currently have a listview and I want to add an appropriate icon to each entry.\nI have created an icon within the Project resources and called it 'errorIcon.ico'. How can I reference this icon/resource and use it within a listview?\n"
},
{
"from": "gpt",
"value": "... |
There's an existing function that ends in the following, where d is a dictionary:
return d.iteritems()
that returns an unsorted iterator for a given dictionary. I would like to return an iterator that goes through the items sorted by key. How do I do that?
| To return an iterator that goes through the items of a dictionary sorted by key, you can modify your function to sort the dictionary items before returning them. You can use the `sorted()` function on the dictionary's keys to achieve this.
Here's how you can implement that:
```python
def sorted_items(d):
return ... | 45,003 | [
{
"from": "human",
"value": "There's an existing function that ends in the following, where d is a dictionary:\nreturn d.iteritems()\n\nthat returns an unsorted iterator for a given dictionary. I would like to return an iterator that goes through the items sorted by key. How do I do that?\n"
},
{
"f... |
Suppose I have a page that I am writing a javascript plugin for on the domain first.com. The javascript plugin injects an iframe pointing to a login page (of domain second.com) into the first.com page and displays it as a popup so that the user can login.
Is there anyway for me to hide/close the iframe after the user ... | Using iframes for cross-origin communication does present challenges due to the same-origin policy, which prevents scripts in one origin from accessing properties and methods of documents from another origin. However, there are several techniques you can use to facilitate communication between the iframe and the parent... | 41,819 | [
{
"from": "human",
"value": "Suppose I have a page that I am writing a javascript plugin for on the domain first.com. The javascript plugin injects an iframe pointing to a login page (of domain second.com) into the first.com page and displays it as a popup so that the user can login.\nIs there anyway for m... |
I have a query that selects all appropriate record in a table 'hotels' and then for each hotel looks for booked room of certain type in table 'booked_rooms' and all of that for certain period.
So first I'm taking out all hotel_ids from 'hotel_table', based on the location provided from the search form, and for each ho... | It looks like there are a few issues in your code that could be causing the problem you're experiencing. Let's break it down and address the concerns:
1. **SQL Query Syntax**: The `SELECT` statement that retrieves `hotel_id` from the `hotels` table uses single quotes (`'`) instead of backticks (`` ` ``). In SQL, singl... | 42,866 | [
{
"from": "human",
"value": "I have a query that selects all appropriate record in a table 'hotels' and then for each hotel looks for booked room of certain type in table 'booked_rooms' and all of that for certain period.\nSo first I'm taking out all hotel_ids from 'hotel_table', based on the location prov... |
Anyone have any experience creating a modal dialog box using AJAX and ASP.NET MVC? I am looking to create a Yes/Cancel confirmation dialog when a user deletes an item. In standard ASP.NET I could just use the ModalPopup extender, but I am not sure how to do this in MVC.
Thanks
| Creating a modal dialog box for confirmation in an ASP.NET MVC application using AJAX is straightforward and can be achieved with a combination of HTML, CSS, and JavaScript (or jQuery). Here’s a step-by-step guide to create a Yes/Cancel confirmation dialog when a user attempts to delete an item.
### Step 1: Setup Your... | 37,513 | [
{
"from": "human",
"value": "Anyone have any experience creating a modal dialog box using AJAX and ASP.NET MVC? I am looking to create a Yes/Cancel confirmation dialog when a user deletes an item. In standard ASP.NET I could just use the ModalPopup extender, but I am not sure how to do this in MVC.\nThank... |
I'm trying to use reflection to get a property from a class. Here is some sample code of what I'm seeing:
using System.Reflection;
namespace ConsoleApplication
{
class Program
{
static void Main(string[] args)
{
PropertyInfo[] tmp2 = typeof(TestClass).GetProperties();
P... | The behavior you are observing stems from the binding flags you are using when trying to retrieve the property information. Let's clarify what's happening in your code.
1. When you call `GetProperties()` without specifying binding flags, it defaults to `BindingFlags.Public | BindingFlags.Instance`, which means it will... | 44,808 | [
{
"from": "human",
"value": "I'm trying to use reflection to get a property from a class. Here is some sample code of what I'm seeing:\n\nusing System.Reflection;\nnamespace ConsoleApplication\n{\n class Program\n {\n static void Main(string[] args)\n {\n PropertyInfo[] tmp2 ... |
What's the best way to implement a classic curry function in actionscript with a nice syntax?
I've tried:
Function.prototype.curry = function()
{
return "helloWorld";
}
trace((function():void {}).curry());
...approach but that didn't work.
I guess I'm stuck with a ugly approach such as:
FunctionUtils.curry(fp, ... a... | Curry is a powerful concept in functional programming that allows you to transform a function that takes multiple arguments into a series of functions that each take a single argument. In ActionScript 3, you can implement a curry function on the `Function.prototype`. Here's a way to do this while maintaining a clean sy... | 44,256 | [
{
"from": "human",
"value": "What's the best way to implement a classic curry function in actionscript with a nice syntax?\nI've tried:\nFunction.prototype.curry = function()\n{\nreturn \"helloWorld\";\n}\n\ntrace((function():void {}).curry());\n\n...approach but that didn't work. \nI guess I'm stuck with a... |
I am just finishing up an Artificial Intelligence course where, as part of the assignments, I was able to program bot in a multi-player environment (BZFlags).
What I was able to do was to program the bot to interface with the world and play capture the flag against other bots or even humans.
What I would like to know i... | There are several environments and platforms where you can program bots for gaming and simulation, similar to what you've done with BZFlags. Here are some options to consider:
1. **OpenAI Gym**: This is a toolkit for developing and comparing reinforcement learning algorithms. It provides various environments for train... | 42,443 | [
{
"from": "human",
"value": "I am just finishing up an Artificial Intelligence course where, as part of the assignments, I was able to program bot in a multi-player environment (BZFlags).\nWhat I was able to do was to program the bot to interface with the world and play capture the flag against other bots o... |
I'm using IIS 6 with EPiserver CMS which requires all requests to go through aspnet_isapi.dll.
I want to gzip all my static files (js, css mainly). Trying to setup compression in IIS didn't work.
Is there a setting in EPiServer that will allow me to achieve this?
Can .net framework compress files automatically?
| In IIS 6, enabling GZIP compression for static files like JavaScript and CSS requires a few specific configurations, as the built-in IIS compression features aren't as straightforward to set up as in later versions of IIS. Here are a few options you can consider for enabling GZIP compression for your static files:
###... | 41,863 | [
{
"from": "human",
"value": "I'm using IIS 6 with EPiserver CMS which requires all requests to go through aspnet_isapi.dll.\nI want to gzip all my static files (js, css mainly). Trying to setup compression in IIS didn't work.\nIs there a setting in EPiServer that will allow me to achieve this? \nCan .net fr... |
When the page displayed in our CDHtmlDialog does an Asp.Net AJAX UpdatePanel we get a navigate event, but everything after that seems to be lost. We don't have a document anymore or get any mouse events on the page.
| When using a `CDHtmlDialog` to host a web page that employs ASP.NET AJAX and UpdatePanel, handling navigation events and maintaining the interaction state can indeed be tricky. Here are some steps and suggestions that might help address the issues you're experiencing:
### 1. Understand the Issue
When an AJAX request i... | 43,373 | [
{
"from": "human",
"value": "When the page displayed in our CDHtmlDialog does an Asp.Net AJAX UpdatePanel we get a navigate event, but everything after that seems to be lost. We don't have a document anymore or get any mouse events on the page.\n"
},
{
"from": "gpt",
"value": "When using a `CDHt... |
We have SQL Server 2005 running on Win2003/64, and we push it hard. We generate real time reports on several tables with a couple million records using asp.net 3.5, and they will periodically time out.
I'd like to increase our memory from 8GB to 16GB or even 32GB to see how that helps, but I need to justify this to th... | Justifying an upgrade to your SQL Server infrastructure involves not only the technical benefits but also the potential return on investment (ROI) that increased memory could provide. Here are some key points and resources you can use to make your case:
### 1. **Understanding SQL Server Memory Usage:**
- SQL Server... | 42,990 | [
{
"from": "human",
"value": "We have SQL Server 2005 running on Win2003/64, and we push it hard. We generate real time reports on several tables with a couple million records using asp.net 3.5, and they will periodically time out.\nI'd like to increase our memory from 8GB to 16GB or even 32GB to see how th... |
I'm developing an application with Adobe Flex and AIR, and I've been banging my head against the wall trying to figure out how to solve a scrolling issue.
The basic structure of my main application window (simplified greatly) is this:
<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.a... | It sounds like you're trying to manage the scrollbars for your layout in Adobe Flex/AIR correctly. The goal is to allow scrolling only in the `MainContent` VBox, while preventing scrollbars from appearing on the entire application window. Here's how you can achieve that:
### Step-by-Step Solution:
1. **Use a `Scrolle... | 43,557 | [
{
"from": "human",
"value": "I'm developing an application with Adobe Flex and AIR, and I've been banging my head against the wall trying to figure out how to solve a scrolling issue.\nThe basic structure of my main application window (simplified greatly) is this:\n<?xml version=\"1.0\" encoding=\"utf-8\"?>... |
Is there a way to easily duplicate a SharePoint list code wise?
| Yes, duplicating a SharePoint list programmatically can be achieved using various methods. Below are a couple of approaches you can use, depending on your requirements and environment:
### 1. Using PowerShell
If you have administrative privileges, you can use PowerShell with the SharePoint Online Management Shell or t... | 43,461 | [
{
"from": "human",
"value": "Is there a way to easily duplicate a SharePoint list code wise?\n"
},
{
"from": "gpt",
"value": "Yes, duplicating a SharePoint list programmatically can be achieved using various methods. Below are a couple of approaches you can use, depending on your requirements an... |
Suppose I want to count the lines of code in a project. If all of the files are in the same directory I can execute:
cat * | wc -l
However, if there are sub-directories, this doesn't work. For this to work cat would have to have a recursive mode. I suspect this might be a job for xargs, but I wonder if there is a more... | Yes, there are more elegant solutions that can count lines of code in a project, including those in subdirectories. One of the simplest methods is to use the `find` command in combination with `wc`. Here are a few approaches:
### Using `find` and `wc`
You can use the `find` command to recursively locate files and then... | 44,468 | [
{
"from": "human",
"value": "Suppose I want to count the lines of code in a project. If all of the files are in the same directory I can execute:\ncat * | wc -l\n\nHowever, if there are sub-directories, this doesn't work. For this to work cat would have to have a recursive mode. I suspect this might be a jo... |
Why should companies invest in refactoring components, though it is not going to add any new feature to the product ?
I agree it is to clean the code, fix bugs and remove dead code - but what is the take ??
| Investing in refactoring components, even when it does not directly lead to new features, can provide several significant benefits to a company. Here are some key reasons why it is worth the investment:
1. **Improved Code Quality**: Refactoring enhances the overall quality of the codebase. Clean, well-organized code i... | 42,371 | [
{
"from": "human",
"value": "Why should companies invest in refactoring components, though it is not going to add any new feature to the product ?\nI agree it is to clean the code, fix bugs and remove dead code - but what is the take ?? \n"
},
{
"from": "gpt",
"value": "Investing in refactoring ... |
In Django 1.0, what is the best way to catch and show an error if user enters only whitespace (" ") in a form field?
class Item(models.Model):
description = models.CharField(max_length=100)
class ItemForm(ModelForm):
class Meta:
model = Item
if user enters only whitespace (" ") in description CharFiel... | In Django, you can enforce validation rules directly on your form or model by using either custom validation methods or field validators. Since you want to ensure that a user doesn't enter only whitespace for the `description` field in your `ItemForm`, you have a couple of options.
### Option 1: Override `clean` metho... | 39,155 | [
{
"from": "human",
"value": "In Django 1.0, what is the best way to catch and show an error if user enters only whitespace (\" \") in a form field?\nclass Item(models.Model):\n description = models.CharField(max_length=100)\n\nclass ItemForm(ModelForm):\n class Meta:\n model = Item\n\nif user e... |
Whilst debugging my program in VS 2008 I have come across the following error:
The CLR has been unable to transition from COM context 0x34fc1a0 to COM context 0x34fc258 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running... | The error you're encountering seems to be related to the way you're using the `System.Timers.Timer` in your application. The specific issue is that the `Elapsed` event handler is likely causing the `RequestWork` method to be called in a context that is not pumping messages properly, which can lead to deadlock scenarios... | 42,635 | [
{
"from": "human",
"value": "Whilst debugging my program in VS 2008 I have come across the following error:\nThe CLR has been unable to transition from COM context 0x34fc1a0 to COM context 0x34fc258 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pump... |
I have a fairly huge database with a master table with a single column GUID (custom GUID like algorithm) as primary key and 8 child tables that have foreign key relationships with this GUID column. All the tables have approximately 3-8 million records. None of these tables have any BLOB/CLOB/TEXT or any other fancy dat... | Certainly! Migrating a large database while maintaining data integrity can be a challenging task, especially with the considerations you've outlined. Let's address your questions step by step.
### 1. Is there a better way?
Given your context, a better way would be to minimize downtime and avoid unnecessary complexity... | 39,850 | [
{
"from": "human",
"value": "I have a fairly huge database with a master table with a single column GUID (custom GUID like algorithm) as primary key and 8 child tables that have foreign key relationships with this GUID column. All the tables have approximately 3-8 million records. None of these tables have ... |
I've tried with Postsharp, but their current implementation targets 2.0, and it's getting painful to make it work. Should I roll out my own AoP implementation (I'm thinking of a very VERY basic and utilitarian implementation here)
Or there is an alternative I'm not aware of?
| If you're facing challenges with PostSharp and its current version limitations, there are a few options you might consider before rolling out your own Aspect-Oriented Programming (AoP) implementation.
### Alternatives to PostSharp:
1. **Fody**: Fody is a popular tool for weaving .NET assemblies that allows you to imp... | 44,005 | [
{
"from": "human",
"value": "I've tried with Postsharp, but their current implementation targets 2.0, and it's getting painful to make it work. Should I roll out my own AoP implementation (I'm thinking of a very VERY basic and utilitarian implementation here)\nOr there is an alternative I'm not aware of?\n"... |
How to capture user clicks in a winform application without making the code very complicated? is AOP the answer? How to track instrumentations?
| Capturing user clicks in a WinForms application can be accomplished in a straightforward manner without needing to resort to complex solutions like Aspect-Oriented Programming (AOP). However, if you are looking for a more modular and reusable approach to track instrumentations or events, there are simpler methods that ... | 40,580 | [
{
"from": "human",
"value": "How to capture user clicks in a winform application without making the code very complicated? is AOP the answer? How to track instrumentations?\n"
},
{
"from": "gpt",
"value": "Capturing user clicks in a WinForms application can be accomplished in a straightforward... |
If I am inserting elements into a wrap panel and there is still space in the panel before it overflows on the next line, can I specifically make it wrap over so that the subsequent elements are on the next line?
I am looking for something like this:
<WrapPanel>
<Element/>
<Element/>
<NewLine???/>
<Element/>
... | In XAML, a `WrapPanel` does not provide a built-in way to explicitly create a new line between elements. However, you can achieve a similar effect by using a dummy `UIElement` as a separator. The idea is to add a transparent element or a spacer control that forces the subsequent elements to wrap onto a new line.
Here'... | 44,507 | [
{
"from": "human",
"value": "If I am inserting elements into a wrap panel and there is still space in the panel before it overflows on the next line, can I specifically make it wrap over so that the subsequent elements are on the next line?\nI am looking for something like this:\n<WrapPanel>\n <Element/>\n... |
Is there an elegant way to do this:
SELECT Cols from MyTable WHERE
zip = 90210 OR
zip = 23310 OR
zip = 74245 OR
zip = 77427 OR
zip = 18817 OR
zip = 94566 OR
zip = 34533 OR
zip = 96322 OR
zip = 34566 OR
zip = 52214 OR
zip = 73455 OR
zip = 52675 OR
zip = 54724 OR
zip = 98566 OR
zip = 92344 OR
zip = 90432 OR
zip = 91532 ... | Yes, there is a more elegant way to write that SQL query using the `IN` clause. The `IN` clause allows you to specify multiple values in a `WHERE` condition, which makes the query more concise and readable. Here’s how you can rewrite your query:
```sql
SELECT Cols
FROM MyTable
WHERE zip IN (
90210, 23310, 74245,... | 48,646 | [
{
"from": "human",
"value": "Is there an elegant way to do this:\nSELECT Cols from MyTable WHERE \nzip = 90210 OR\nzip = 23310 OR\nzip = 74245 OR\nzip = 77427 OR\nzip = 18817 OR\nzip = 94566 OR\nzip = 34533 OR\nzip = 96322 OR\nzip = 34566 OR\nzip = 52214 OR\nzip = 73455 OR\nzip = 52675 OR\nzip = 54724 OR\nz... |
Using LINQ to Entities sounds like a great way to query against a database and get actual CLR objects that I can modify, data bind against and so forth. But if I perform the same query a second time do I get back references to the same CLR objects or an entirely new set?
I do not want multiple queries to generate an e... | When using LINQ to Entities, especially with the Entity Framework, the behavior regarding the retrieval of entities from the database and their identity management can be summarized as follows:
1. **Context and Change Tracking**: Entity Framework operates within the context of a `DbContext`. When you execute a LINQ qu... | 42,493 | [
{
"from": "human",
"value": "Using LINQ to Entities sounds like a great way to query against a database and get actual CLR objects that I can modify, data bind against and so forth. But if I perform the same query a second time do I get back references to the same CLR objects or an entirely new set? \nI do ... |
In a brand new program where space isn't really that big a deal, is it better to delete a row or to disable a row by let's say a boolean "Disabled" and have the program just ignore it?
For example, if I wanted to remove a user from a program.
| When deciding between deleting a row or marking it as "disabled" with a boolean flag, there are several factors to consider. Each approach has its own advantages and disadvantages, and the best choice often depends on the specific requirements of your program, including functionality, data integrity, auditability, and ... | 43,341 | [
{
"from": "human",
"value": "In a brand new program where space isn't really that big a deal, is it better to delete a row or to disable a row by let's say a boolean \"Disabled\" and have the program just ignore it?\nFor example, if I wanted to remove a user from a program.\n"
},
{
"from": "gpt",
... |
I am developing an in-house app that would use XInput or DirectInput to read from the Xbox 360 controller. (I think it'll be the cheapest/easiest way to get multiple controls in the operator's hands.)
I will need to source-control all source and tools, which means also the SDK's. I'd rather not take all of DirectX --... | Yes, XInput and DirectInput can be used independently from the full DirectX SDK. However, there are some nuances to consider:
1. **XInput**: XInput is a part of the Windows SDK, and it's specifically designed for Xbox controllers. It is available by default with Windows and does not require you to install the full Dir... | 45,297 | [
{
"from": "human",
"value": "I am developing an in-house app that would use XInput or DirectInput to read from the Xbox 360 controller. (I think it'll be the cheapest/easiest way to get multiple controls in the operator's hands.)\nI will need to source-control all source and tools, which means also the SDK... |
I am writing an applicaton that will be a standalone WPF application and also a cut down version that will work as Silverlight and so be hosted in browsers. I want the Silverlight application to access data from the cloud. The WPF application needs to work against a local database but then be able to sync with the same... | The scenario you described involves building a WPF application that operates primarily with a local database while also supporting data synchronization with a cloud-based service. At the same time, you want a Silverlight application that can directly interact with the cloud data. Here’s a breakdown of how you could ach... | 42,099 | [
{
"from": "human",
"value": "I am writing an applicaton that will be a standalone WPF application and also a cut down version that will work as Silverlight and so be hosted in browsers. I want the Silverlight application to access data from the cloud. The WPF application needs to work against a local databa... |
I'm using Microsoft Visual C++ 2008 Express, and have a pretty annoying problem. It doesn't seem to happen in XP but in Vista I can't find a way around it. Whenever I declare variables non-dynamically, if their combined size exceeds about 30mb, the program will crash immediately at start-up. I know that Vista limits no... | The issue you're encountering is related to the way memory is handled in different operating systems, particularly in how stack memory is allocated. In your case, when you declare large arrays like `int foo[1000][1000]`, you're allocating memory on the stack. The default stack size for an application in Windows is typi... | 43,861 | [
{
"from": "human",
"value": "I'm using Microsoft Visual C++ 2008 Express, and have a pretty annoying problem. It doesn't seem to happen in XP but in Vista I can't find a way around it. Whenever I declare variables non-dynamically, if their combined size exceeds about 30mb, the program will crash immediately... |
Here's my code:
<asp:TemplateField HeaderText="* License Setup Date">
<EditItemTemplate>
<asp:RequiredFieldValidator ID="LicenseSetupDateRequired"
ErrorMessage="License Setup Date can't be blank."
ValidationGroup="EditClientDetails"
ControlToValidate="BeginDate"
... | It looks like there is a small mistake in your `RangeValidator` configuration for the `MinimumValue` and `MaximumValue`. The `MaximumValue` is currently set to "12/31/2002", which means that any date beyond that will not pass validation. However, the dates you're testing (e.g., "01/01/2008" and "02/02/2008") are both o... | 45,071 | [
{
"from": "human",
"value": "Here's my code:\n<asp:TemplateField HeaderText=\"* License Setup Date\">\n <EditItemTemplate>\n <asp:RequiredFieldValidator ID=\"LicenseSetupDateRequired\" \n ErrorMessage=\"License Setup Date can't be blank.\"\n ValidationGroup=\"EditClientDetail... |
When developing a plug-in to application, using the application API which doesn't run independently of the application, is unit-testing even a possibility? What are strategies to test a plug-in that is tightly integrated with an application?
| Unit testing a plug-in that tightly integrates with an application can be challenging, especially if the plug-in depends on the application's API and does not run independently. However, there are several strategies you can employ to facilitate effective testing of such plug-ins. Here are some approaches:
### 1. **Moc... | 43,244 | [
{
"from": "human",
"value": "When developing a plug-in to application, using the application API which doesn't run independently of the application, is unit-testing even a possibility? What are strategies to test a plug-in that is tightly integrated with an application?\n"
},
{
"from": "gpt",
"v... |
i remember there being a way of marking a section of code in eclipse (special comment or annotation?) which made the autoformatter ignore that section. Or I may have drempt this...
Used mainly when I have strings which wrap onto several lines and i don't want the autoformatter to rearrange this.
| In Eclipse, you can use specific annotations to instruct the formatter to ignore certain sections of your code. While there isn’t a built-in feature that universally ignores all formatting within a code block, you can use comments to control formatting for specific cases.
Here’s how you can do this with Java code usin... | 45,316 | [
{
"from": "human",
"value": "i remember there being a way of marking a section of code in eclipse (special comment or annotation?) which made the autoformatter ignore that section. Or I may have drempt this...\nUsed mainly when I have strings which wrap onto several lines and i don't want the autoformatter ... |
I wrote below code to remove checked item from radio group in my form by double click.
$("input[type='radio']").each(function(){
$(this).dblclick(function(){
$(this).removeAttr("checked");
});
});
but this code doesn't work in FireFox but work in IE.
anybody know what's ... | The issue you are encountering is due to how different browsers handle the `checked` attribute for radio buttons. In Firefox, when you remove the `checked` attribute using `removeAttr("checked")`, it does not uncheck the radio button. Instead, you should use the `.prop()` method to modify the `checked` property directl... | 46,202 | [
{
"from": "human",
"value": "I wrote below code to remove checked item from radio group in my form by double click.\n$(\"input[type='radio']\").each(function(){\n $(this).dblclick(function(){\n $(this).removeAttr(\"checked\");\n });\n });\n\nbut this code doesn't ... |
I'm porting a relatively simple console program written for Unix to the Windows platform (Visual C++ 8.0). All the source files include "unistd.h", which doesn't exist. Removing it, I get complaints about missing prototypes for 'srandom', 'random', and 'getopt'.
I know I can replace the random functions, and I'm prett... | Porting Unix-specific code to Windows can indeed be challenging due to differences in available libraries and APIs. While there's no official "unistd.h" for Windows, there are some alternatives and methods to achieve similar functionality.
### Options for Compatibility:
1. **Custom Header**: As you mentioned, creatin... | 43,965 | [
{
"from": "human",
"value": "I'm porting a relatively simple console program written for Unix to the Windows platform (Visual C++ 8.0). All the source files include \"unistd.h\", which doesn't exist. Removing it, I get complaints about missing prototypes for 'srandom', 'random', and 'getopt'.\nI know I can... |
You'll have to forgive my ignorance, but I'm not used to using wide character sets in c++, but is there a way that I can use wide string literals in c++ without putting an L in front of each literal?
If so, how?
| Yes, in C++, you can use wide string literals (i.e., `std::wstring` or `wchar_t` strings) without having to prefix each string literal with `L`. One way to accomplish this is by creating a custom user-defined literal or by using a wrapper function or macro.
### Option 1: Using a User-Defined Literal
You can define a ... | 42,756 | [
{
"from": "human",
"value": "You'll have to forgive my ignorance, but I'm not used to using wide character sets in c++, but is there a way that I can use wide string literals in c++ without putting an L in front of each literal?\nIf so, how?\n"
},
{
"from": "gpt",
"value": "Yes, in C++, you can ... |
Is it possible to use InfoPath forms within a SharePoint workflow for all but one of the workflow tasks? Our customer wants a particular task to use the default sharepoint page for editing that list item but disabling the form I was using for that task just makes the workflow default to the Task0_FormURN defined inside... | Using InfoPath forms in a SharePoint workflow while mixing them with the default SharePoint task forms can be challenging due to the way SharePoint workflows are designed to handle task forms. When a workflow is defined to use an InfoPath form for tasks, it typically expects that form to be used for all tasks within th... | 44,007 | [
{
"from": "human",
"value": "Is it possible to use InfoPath forms within a SharePoint workflow for all but one of the workflow tasks? Our customer wants a particular task to use the default sharepoint page for editing that list item but disabling the form I was using for that task just makes the workflow de... |
I need to create a request for a web page delivered to our web sites, but I need to be able to set the host header information too. I have tried this using HttpWebRequest, but the Header information is read only (Or at least the Host part of it is). I need to do this because we want to perform the initial request for... | To set the `Host` header in an HTTP request using `HttpWebRequest`, you can use the `RequestUri` property, but you will need to set it indirectly since the `Host` header is derived from the URL you are requesting. However, you can create a workaround by using a `HttpWebRequest` to a known URL (e.g., the IP address) and... | 43,820 | [
{
"from": "human",
"value": "I need to create a request for a web page delivered to our web sites, but I need to be able to set the host header information too. I have tried this using HttpWebRequest, but the Header information is read only (Or at least the Host part of it is). I need to do this because w... |
How do I implement this method (see below)? I'm new to Objective-C and I'm just not getting it right.
From: http://lists.apple.com/archives/Webkitsdk-dev/2008/Apr/msg00027.html
By default databases have a quota of 0; this quota must be increased before any database will be stored on disk.
WebKit clients should impleme... | To implement the `webView:frame:exceededDatabaseQuotaForSecurityOrigin:database:` method in Objective-C, you will need to follow these steps. This method is a part of the `WebUIDelegate` protocol and allows you to handle situations when a web view exceeds its database quota. Here's how you can do that:
1. **Ensure you... | 42,597 | [
{
"from": "human",
"value": "How do I implement this method (see below)? I'm new to Objective-C and I'm just not getting it right.\nFrom: http://lists.apple.com/archives/Webkitsdk-dev/2008/Apr/msg00027.html\n\nBy default databases have a quota of 0; this quota must be increased before any database will be s... |
I created 26 JButton in an anonymous actionListener labeled as each letter of the alphabet.
for (int i = 65; i < 91; i++){
final char c = (char)i;
final JButton button = new JButton("" + c);
alphabetPanel.add(button);
button.addActionListener(
new ActionListener () {
public void acti... | Yes, it's definitely possible to disable a JButton based on the letter pressed on the keyboard, even with your current implementation. To achieve this, you will need to keep track of the buttons so that you can disable them based on keyboard input. Here's how you can modify your code to accomplish this:
1. **Store the... | 40,708 | [
{
"from": "human",
"value": "I created 26 JButton in an anonymous actionListener labeled as each letter of the alphabet.\nfor (int i = 65; i < 91; i++){\n final char c = (char)i;\n final JButton button = new JButton(\"\" + c);\n alphabetPanel.add(button);\n button.addActionListener(\n new... |
Any tricks for using project explorer in VIM?
How can I search from all files in project? I tried \g \G but they dont work .
How to toggle on off Project explorer window?
I am using Project explorer and taglist and when I open both then there are two windows on left side ,this makes very much cluttered .Is it possible... | Certainly! Here are some tips and tricks for using project exploration and searching in Vim, particularly when working with plugins like Project Explorer, Taglist, and MiniBufExplorer.
### 1. Searching Across All Files in the Project
For searching through files in your project, you can use the following methods:
- *... | 41,143 | [
{
"from": "human",
"value": "Any tricks for using project explorer in VIM?\nHow can I search from all files in project? I tried \\g \\G but they dont work .\nHow to toggle on off Project explorer window?\nI am using Project explorer and taglist and when I open both then there are two windows on left side ,... |
I am using a JEditorPane as an editor to write comments in my application. The content type is set "text/plain". When I am writing text in it and the text fills the available space and I go on typing, the text is not moving upward to show the cursor. So I dont know where I am typing and what I am typing since it would ... | To ensure that the caret remains visible in a `JEditorPane` as you type, you can programmatically scroll the view to the caret position whenever text is added. One way to achieve this is to listen for changes in the document and then call the `JEditorPane.scrollToCaret()` method to ensure the caret is always visible.
... | 37,119 | [
{
"from": "human",
"value": "I am using a JEditorPane as an editor to write comments in my application. The content type is set \"text/plain\". When I am writing text in it and the text fills the available space and I go on typing, the text is not moving upward to show the cursor. So I dont know where I am ... |
On a Unix systems it's very easy to compile the CLASSPATH by using find:
LIBDIR=`find lib/ -name \*.jar`
for DIR in $LIBDIR:
do
CLASSPATH="$CLASSPATH:$DIR"
done
java -classpath $CLASSPATH com.example.MyClass
What would be the aquivalent in a Windows batchfile?
| To achieve the same result in a Windows batch file, you can use the `for` command combined with the `dir` command to find `.jar` files and compile the `CLASSPATH`. Here’s how you can do it:
```batch
@echo off
setlocal
set "CLASSPATH="
for /r lib %%f in (*.jar) do (
set "CLASSPATH=!CLASSPATH!;%%f"
)
rem Removing... | 43,904 | [
{
"from": "human",
"value": "On a Unix systems it's very easy to compile the CLASSPATH by using find:\nLIBDIR=`find lib/ -name \\*.jar`\nfor DIR in $LIBDIR:\ndo\n CLASSPATH=\"$CLASSPATH:$DIR\"\ndone\n\njava -classpath $CLASSPATH com.example.MyClass\n\nWhat would be the aquivalent in a Windows batchfile?\... |
I have coded a MS Access 2000 report that displays a calendar with one month per page and projects added to particular days. The only data in the underlying record source is a list of months. The structure is created via the On Page event, which also reads in other data.
When this report is opened, I've noticed that th... | It sounds like you're encountering a common challenge with MS Access report design and events, especially when dealing with the On Page event and the export functionality. Here are some suggestions to help you ensure that your report exports correctly and behaves consistently across pages:
1. **Understand Event Trigge... | 42,861 | [
{
"from": "human",
"value": "I have coded a MS Access 2000 report that displays a calendar with one month per page and projects added to particular days. The only data in the underlying record source is a list of months. The structure is created via the On Page event, which also reads in other data.\nWhen t... |
Is there any built-in, add-in solution for visual studio to compare two files and display result with differences? I could't find one...
| Yes, Visual Studio includes a built-in tool for comparing files, but it may not be immediately obvious how to access it. Here’s how you can compare two files within Visual Studio:
### Using Visual Studio Built-in File Comparison
1. **Open Visual Studio**: Start Visual Studio and open any project or solution.
2. **Ac... | 44,983 | [
{
"from": "human",
"value": "Is there any built-in, add-in solution for visual studio to compare two files and display result with differences? I could't find one...\n"
},
{
"from": "gpt",
"value": "Yes, Visual Studio includes a built-in tool for comparing files, but it may not be immediately ob... |
We're looking at using Oracle Hierarchical queries to model potentially very large tree structures (potentially infinitely wide, and depth of 30+). My understanding is that hierarchal queries provide a method to write recursively joining SQL but they it does not provide any real performance enhancements over if you wer... | Oracle Hierarchical Queries, particularly those using the `CONNECT BY` clause, provide a convenient way to work with tree-structured data. While they do not necessarily provide intrinsic performance enhancements over manually crafted recursive joins, there are several considerations and experiences regarding their use:... | 42,457 | [
{
"from": "human",
"value": "We're looking at using Oracle Hierarchical queries to model potentially very large tree structures (potentially infinitely wide, and depth of 30+). My understanding is that hierarchal queries provide a method to write recursively joining SQL but they it does not provide any real... |
I'd like to externalize all of the strings used in the project into one file and be able to use it inside aspx, C# code behind and on the client side in JavaScript.
The reason I want to do it is because many strings are shared, i.e. the same in two places.
Is it possible? Is there a better way?
| Yes, it is possible to externalize strings used across different layers of an ASP.NET project (ASPX, C# code-behind, and JavaScript) into a single file. This approach helps maintain consistency and reduces duplication.
### Strategy for Externalizing Strings
1. **Resource File (RESX)**: A common approach in .NET appli... | 37,360 | [
{
"from": "human",
"value": "I'd like to externalize all of the strings used in the project into one file and be able to use it inside aspx, C# code behind and on the client side in JavaScript.\nThe reason I want to do it is because many strings are shared, i.e. the same in two places. \nIs it possible? Is... |
I know that you can install your Windows Service via the VS deployment system which I've done. But how do you deploy updates after that? Each time I deploy a new version, it says that the service already exists and exits.
I tried to add a little DOS CMD file with the following:
net stop [ServiceName]
sc delete [Servic... | To deploy updates for a Windows Service created with Visual Studio, you need to ensure that the service is properly stopped and uninstalled before installing the new version. Below are some methods to handle updates effectively:
### Method 1: Modify the Installer Project
1. **Add a Custom Action:**
- Open your Vis... | 40,440 | [
{
"from": "human",
"value": "I know that you can install your Windows Service via the VS deployment system which I've done. But how do you deploy updates after that? Each time I deploy a new version, it says that the service already exists and exits.\nI tried to add a little DOS CMD file with the following... |
Unit testing with C/C++:
What do you teach people who either did not do unit testing before or come from Java/Junit?
What is the single most important lesson / thing to remember/ practice from your point of view that saves a lot of time or stress (especially regarding C/C++)?
| When transitioning to unit testing in C/C++ from a Java/JUnit background, or for those who are completely new to the concept, there are several key lessons and practices to emphasize. Here’s a summary of what to teach and the most important lesson to remember:
### Key Concepts to Teach:
1. **Understanding the Need fo... | 43,483 | [
{
"from": "human",
"value": "Unit testing with C/C++:\nWhat do you teach people who either did not do unit testing before or come from Java/Junit?\nWhat is the single most important lesson / thing to remember/ practice from your point of view that saves a lot of time or stress (especially regarding C/C++)?\... |
I have an array in PHP which holds a bunch of unix timestamps.
As a simplified example, here is an array of 10 values.
$array = [
1510790277,
1586522582,
1572272336,
1650049585,
1591332330,
1698088238,
1646561226,
1639050043,
1652067570,
1548161804,
];
I need to produce an array containing the inde... | You can achieve this in PHP by using the `array_keys` function in combination with the `array_sort` function. Here's how to do it step by step:
1. Sort the array in descending order while keeping track of the original keys.
2. Retrieve the keys of the three largest values.
Here's the code to accomplish this:
```php
... | 44,637 | [
{
"from": "human",
"value": "I have an array in PHP which holds a bunch of unix timestamps.\nAs a simplified example, here is an array of 10 values.\n$array = [\n 1510790277,\n 1586522582,\n 1572272336,\n 1650049585,\n 1591332330,\n 1698088238,\n 1646561226,\n 1639050043,\n 1652067570,\n 154816180... |
I am implementing an asynchronous command pattern for the "client" class in a client/server application. I have done some socket coding in the past and I like the new Async pattern that they used in the Socket / SocketAsyncEventArgs classes.
My async method looks like this: public bool ExecuteAsync(Command cmd); It ret... | In the context of your asynchronous command pattern, whether to invoke the `OnCompleted` callback when an exception occurs during the execution of `ExecuteAsync` is an important design decision. Let's consider the implications of both approaches: calling the callback even when there's an exception versus throwing excep... | 43,101 | [
{
"from": "human",
"value": "I am implementing an asynchronous command pattern for the \"client\" class in a client/server application. I have done some socket coding in the past and I like the new Async pattern that they used in the Socket / SocketAsyncEventArgs classes.\nMy async method looks like this: p... |
I was trying to create a pseudo super struct to print array of structs. My basic
structures are as follows.
/* Type 10 Count */
typedef struct _T10CNT
{
int _cnt[20];
} T10CNT;
...
/* Type 20 Count */
typedef struct _T20CNT
{
long _cnt[20];
} T20CNT;
...
I created the below struct to print the array of abov... | Your approach to creating a common function for printing statistics from different struct types is interesting, but there are a few issues in your code that need to be addressed to avoid dereferencing void pointer errors and to achieve the desired functionality. Here's a corrected and improved version of your code:
##... | 39,287 | [
{
"from": "human",
"value": "I was trying to create a pseudo super struct to print array of structs. My basic \nstructures are as follows.\n/* Type 10 Count */\ntypedef struct _T10CNT\n{\n int _cnt[20];\n} T10CNT;\n\n...\n\n/* Type 20 Count */\ntypedef struct _T20CNT\n{\n long _cnt[20];\n} T20CNT;\n..... |
Kind of a weird question, but. I need to have a list of strings i need to make sure that every string in that list is the same.
E.g:
a = ['foo', 'foo', 'boo'] #not valid
b = ['foo', 'foo', 'foo'] #valid
Whats the best way to go about doing that?
FYI, i don't know how many strings are going to be in the list. Also this... | No worries! This is a straightforward task. You can check if all the strings in the list are the same by using Python's built-in functions. Here are a couple of methods you can use:
### Method 1: Using `set()`
You can convert the list to a set and check if the length of the set is 1. If it is, then all elements are t... | 44,460 | [
{
"from": "human",
"value": "Kind of a weird question, but. I need to have a list of strings i need to make sure that every string in that list is the same.\nE.g:\na = ['foo', 'foo', 'boo'] #not valid\nb = ['foo', 'foo', 'foo'] #valid\n\nWhats the best way to go about doing that?\nFYI, i don't know how many... |
I have a requirement to dynamically change a ASP.NET MVC route depending on the contents of the URL.
For example:
routes.MapRoute(
"Default",
"{controller}/{action}/{id}/{value}",
new { controller = "Home", action = "Index", id = 0, value = "" }
);
I'd like to use the above route for most scenarios but also allo... | In ASP.NET MVC, you can achieve dynamic routing based on the contents of the URL by defining multiple routes in your `RouteConfig` file and using route constraints or custom route handlers to control which route is matched based on the incoming request. Here's how you can set this up:
### Step 1: Define Your Routes
Y... | 44,148 | [
{
"from": "human",
"value": "I have a requirement to dynamically change a ASP.NET MVC route depending on the contents of the URL.\nFor example:\nroutes.MapRoute(\n \"Default\",\n \"{controller}/{action}/{id}/{value}\",\n new { controller = \"Home\", action = \"Index\", id = 0, value = \"\" }\n);\n\nI'd l... |
Does python have the ability to create dynamic keywords?
For example:
qset.filter(min_price__usd__range=(min_price, max_price))
I want to be able to change the usd part based on a selected currency.
| Yes, Python allows you to create dynamic keyword arguments in a way that you can construct them based on variables. In the context of Django's querysets (like `qset.filter`), you can use the `**` operator to unpack a dictionary of keyword arguments.
Here's how you can achieve your goal of dynamically changing the curr... | 46,878 | [
{
"from": "human",
"value": "Does python have the ability to create dynamic keywords?\nFor example:\nqset.filter(min_price__usd__range=(min_price, max_price))\n\nI want to be able to change the usd part based on a selected currency.\n"
},
{
"from": "gpt",
"value": "Yes, Python allows you to crea... |
A weird bug was occurring in production which I was asked to look into. The issue was tracked down to a couple of variables being declared within a For loop and not being initialized on each iteration. An assumption had been made that due to the scope of their declaration they would be "reset" on each iteration. Could ... | Welcome to the world of programming discussions! It sounds like you’ve encountered a classic issue related to variable scope and initialization within loops, especially in the context of maintaining state across iterations.
### Explanation
In your example, the variables `testDecimal` and `testString` are declared ins... | 41,910 | [
{
"from": "human",
"value": "A weird bug was occurring in production which I was asked to look into. The issue was tracked down to a couple of variables being declared within a For loop and not being initialized on each iteration. An assumption had been made that due to the scope of their declaration they w... |
I am using slideDown animation to show some divs in a newly added table row:
$("div", newRow).slideDown(10000, UpdateHours(response.d.Hours));
however the UpdateHours() function is called long before the divs are finished animating. This is causing me a problem because the Updated Hours then get covered by the sliding... | The issue you're experiencing is due to how you're invoking the `UpdateHours` function. In your current code, you're calling `UpdateHours` immediately and passing its return value to `slideDown`, rather than passing a reference to the function that should be executed after the animation completes.
To ensure that `Upda... | 47,824 | [
{
"from": "human",
"value": "I am using slideDown animation to show some divs in a newly added table row:\n$(\"div\", newRow).slideDown(10000, UpdateHours(response.d.Hours));\n\nhowever the UpdateHours() function is called long before the divs are finished animating. This is causing me a problem because the... |
I am wondering what server control people generally use for surrounding and separating blocks of related controls and content in a Web Forms scenario. Often times I need to surround a block of HTML and related Server controls with a 'panel' that I can show or hide based upon some UI logic in the code behind. I am usu... | In ASP.NET Web Forms, managing the visibility and grouping of related controls can sometimes present challenges, especially within specific HTML structures like tables. Here are some common approaches you can consider for your scenario:
1. **Use the `Panel` Control with `Table` Tag**:
While the `Panel` control does... | 41,303 | [
{
"from": "human",
"value": "I am wondering what server control people generally use for surrounding and separating blocks of related controls and content in a Web Forms scenario. Often times I need to surround a block of HTML and related Server controls with a 'panel' that I can show or hide based upon so... |
I just got burned by the Cygwin X11R7.4 update and I find the official mailing lists hostile and clunky. So I thought I'd ask here.
If you have survived the upgrade (or at least made progress on fixing things), what steps did you take to make things work?
| I can help with some common issues and steps that may help you resolve problems after upgrading Cygwin X11R7.4. Here are some general troubleshooting steps you can take:
### 1. **Reinstall Cygwin X Packages:**
- Open the Cygwin installer (`setup-x86_64.exe` or `setup-x86.exe`).
- Select the "X11" category and en... | 43,274 | [
{
"from": "human",
"value": "I just got burned by the Cygwin X11R7.4 update and I find the official mailing lists hostile and clunky. So I thought I'd ask here.\nIf you have survived the upgrade (or at least made progress on fixing things), what steps did you take to make things work?\n"
},
{
"from... |
how do you go about saving images and displaying them from a SQL Server Image field when using ASP.NET MVC?
Many thanks
Nick
| To save and display images stored in a SQL Server `Image` field (or more appropriately, the `VARBINARY` type since `Image` is deprecated) in an ASP.NET MVC application, you can follow these general steps:
### Step 1: Set Up Your Database
Ensure you have a table set up in your SQL Server database that can store image ... | 39,153 | [
{
"from": "human",
"value": "how do you go about saving images and displaying them from a SQL Server Image field when using ASP.NET MVC?\nMany thanks\nNick\n"
},
{
"from": "gpt",
"value": "To save and display images stored in a SQL Server `Image` field (or more appropriately, the `VARBINARY` typ... |
Let's say at your job your boss says,
That system over there, which has lost all institutional knowledge but seems to run pretty good right now, could we dump double the data in it and survive?
You're completely unfamiliar with the system.
It's in SQL Server 2000 (primarily a database app).
There's no test environmen... | To assess whether the SQL Server 2000 system can handle double the data without negatively impacting performance, and to gather enough information to present to your manager, I would focus on the following three steps:
### 1. **Assess Current Performance Metrics**
- **Activity Monitoring:** Use SQL Server’s built-i... | 41,131 | [
{
"from": "human",
"value": "Let's say at your job your boss says,\n\nThat system over there, which has lost all institutional knowledge but seems to run pretty good right now, could we dump double the data in it and survive?\n\nYou're completely unfamiliar with the system.\nIt's in SQL Server 2000 (primari... |
I have a sql database that stores some documents.
A user can sign into the application, and view a list of their documents.
When clicking a linkbutton download in a gridview of their docs, I get the file from the database, write it to the file system, and then execute this code.
System.IO.FileInfo file = new System... | It looks like you're trying to serve files for download through an ASP.NET Web Forms application, but you're encountering issues where the response is sending back the HTML of the webpage instead of the actual file. This is a common issue that can occur when the response isn't properly configured, or if there's a mista... | 41,040 | [
{
"from": "human",
"value": "I have a sql database that stores some documents.\nA user can sign into the application, and view a list of their documents.\nWhen clicking a linkbutton download in a gridview of their docs, I get the file from the database, write it to the file system, and then execute this cod... |
Well I am querying my DB, a table called bookBilling, to get a value under the column of billingID.
In my first query I get the customer ID from a table based on what value the cookie holds.
In my second query I take that custID value and am looking to get the billingID associated with it.
query = "SELECT custID FROM... | It looks like you're encountering an issue with retrieving the `billingID` from your database after executing the second query. Based on the provided code, I see a few potential reasons for this issue and some suggestions to resolve it.
### Issues
1. **Recordset Object Reuse**: In your code, you're executing a second ... | 44,157 | [
{
"from": "human",
"value": "Well I am querying my DB, a table called bookBilling, to get a value under the column of billingID. \nIn my first query I get the customer ID from a table based on what value the cookie holds.\nIn my second query I take that custID value and am looking to get the billingID asso... |
I have a request that returns a JSON object with a single property which is an array. How can I test if the array is empty?
With jQuery code like:
$.getJSON(
jsonUrl,
function(data) {
if (data.RoleOwners == [ ]) {
$('<tr><td>' + noRoleOwnersText + '</td></tr... | To check if an array is empty in JavaScript (or jQuery), you should compare the `length` property of the array rather than comparing it to an empty array. In your case, you can modify the condition in your `if` statement to check if the length of `data.RoleOwners` is zero.
Here's the updated code:
```javascript
$.get... | 47,008 | [
{
"from": "human",
"value": "I have a request that returns a JSON object with a single property which is an array. How can I test if the array is empty?\nWith jQuery code like:\n $.getJSON(\n jsonUrl,\n function(data) {\n if (data.RoleOwners == [ ]) {\n ... |
How do I add a certain number of days to the current date in PHP?
I already got the current date with:
$today = date('y:m:d');
Just need to add x number of days to it
| To add a certain number of days to the current date in PHP, you can use the `DateTime` class, which provides a flexible way to manipulate date and time. Here's how you can do it:
```php
// Get the current date
$today = date('Y-m-d'); // Use 'Y-m-d' for full year
// Number of days to add
$x = 5; // Example: adding 5 d... | 44,769 | [
{
"from": "human",
"value": "How do I add a certain number of days to the current date in PHP?\nI already got the current date with:\n$today = date('y:m:d');\n\nJust need to add x number of days to it\n"
},
{
"from": "gpt",
"value": "To add a certain number of days to the current date in PHP, yo... |
I need to convert a list (or a dict) into a comma-separated list for passing to another language.
Is there a nicer way of doing this than:
result = ''
args = ['a', 'b', 'c', 'd']
i = 0
for arg in args:
if i != 0: result += arg
else: result += arg + ', '
i += 1
result = 'function (' + re... | Yes, there is a simpler and more Pythonic way to create a comma-separated string from a list (or dictionary) using the `join` method. Here's how you can do it:
### For a List:
```python
args = ['a', 'b', 'c', 'd']
result = 'function(' + ', '.join(args) + ')'
print(result)
```
### For a Dictionary:
If you want to conv... | 45,610 | [
{
"from": "human",
"value": "I need to convert a list (or a dict) into a comma-separated list for passing to another language.\nIs there a nicer way of doing this than:\n result = ''\n args = ['a', 'b', 'c', 'd']\n\n i = 0\n for arg in args:\n if i != 0: result += arg\n else: result += ar... |
I have a test in Excel VBA:
If (test1) And (test2) And (test3) Then
'do something
End If
In C, Java, etc. test1 would be run first, then test2, then test3. Critically, if test1 is false the whole test is false so the remaining tests do not run.
Does that happen in this case with VBA? If so, in which order are the... | Yes, in VBA (Visual Basic for Applications), the evaluation of the logical condition using the `And` operator is similar to other programming languages like C and Java, which employ short-circuit evaluation. This means that if the first condition (`test1`) evaluates to `False`, then the subsequent conditions (`test2` a... | 42,268 | [
{
"from": "human",
"value": "I have a test in Excel VBA:\n\nIf (test1) And (test2) And (test3) Then\n 'do something\nEnd If\n\nIn C, Java, etc. test1 would be run first, then test2, then test3. Critically, if test1 is false the whole test is false so the remaining tests do not run.\nDoes that happen in t... |
I will take the example of the SO site. To go to the list of questions, the url is www.stackoverflow.com/questions. Behind the scene, this goes to a controller (whose name is unknown) and to one of its actions. Let's say that this is controller=home and action=questions.
How to prevent the user to type www.stackoverflo... | To prevent users from accessing a URL like `www.stackoverflow.com/home/questions` while still allowing them to use `www.stackoverflow.com/questions`, you can implement a combination of redirect rules and routing configuration to ensure that the preferred URL structure is maintained and to enhance SEO by avoiding duplic... | 43,676 | [
{
"from": "human",
"value": "I will take the example of the SO site. To go to the list of questions, the url is www.stackoverflow.com/questions. Behind the scene, this goes to a controller (whose name is unknown) and to one of its actions. Let's say that this is controller=home and action=questions.\nHow to... |
I am trying to set up my tab order on the html side of my project. How do I set the tab order. Usually in visual basic, the option is in the menu bar under view/tab Order. How do I do this in asp?
| In HTML and ASP, the tab order of elements is managed using the `tabindex` attribute. The `tabindex` attribute specifies the order in which elements receive focus when the user navigates through the page using the keyboard (Tab key).
Here’s how you can set the tab order using the `tabindex` attribute:
1. **Using `tab... | 44,222 | [
{
"from": "human",
"value": "I am trying to set up my tab order on the html side of my project. How do I set the tab order. Usually in visual basic, the option is in the menu bar under view/tab Order. How do I do this in asp?\n"
},
{
"from": "gpt",
"value": "In HTML and ASP, the tab order of ... |
I'll preface this by saying I'm a C# programmer who inherited horrible code with no documentation. I have an unmanaged C++ library wrapped with managed code that worked fine in VS2003 with .Net 1.1 Framework. I'm trying to get it upgraded to at least .Net 2.0.
I have the unmanaged C++ library that was compiled with "... | When dealing with interoperability between different versions of Visual Studio, especially with unmanaged C++ libraries, there are several considerations you need to take into account.
### Compatibility
1. **ABI Changes**: Different versions of Visual Studio can have different Application Binary Interfaces (ABI). Thi... | 42,533 | [
{
"from": "human",
"value": "I'll preface this by saying I'm a C# programmer who inherited horrible code with no documentation. I have an unmanaged C++ library wrapped with managed code that worked fine in VS2003 with .Net 1.1 Framework. I'm trying to get it upgraded to at least .Net 2.0.\nI have the unma... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.