instruction stringlengths 14 27.6k | completion stringlengths 3 38.3k | __original_row_idx int64 0 50k | conversations listlengths 2 2 |
|---|---|---|---|
I need to have one column as the primary key and another to auto increment an order number field. Is this possible?
EDIT: I think I'll just use a composite number as the order number. Thanks anyways.
| Yes, it is definitely possible to have one column as the primary key while having another column that auto-increments for an order number in a database. Here’s a brief overview of how you can achieve this in a typical relational database management system (RDBMS):
### Example in SQL (e.g., MySQL, PostgreSQL)
1. **Cre... | 45,241 | [
{
"from": "human",
"value": "I need to have one column as the primary key and another to auto increment an order number field. Is this possible?\nEDIT: I think I'll just use a composite number as the order number. Thanks anyways.\n"
},
{
"from": "gpt",
"value": "Yes, it is definitely possible to... |
How do I disable the support for JavaScript keypress events in iframes?
I need keypress events disabled only in specific iframes, so doing a catch-all-events-and-make-em-do-nothing solution is not an option.
| To disable keypress events in specific iframes without affecting the rest of the page, you can listen for keypress events on the target iframe and prevent their default actions. Below is a method to achieve this using JavaScript.
### Example Implementation:
1. **Add an Event Listener**: You need to access the content... | 41,043 | [
{
"from": "human",
"value": "How do I disable the support for JavaScript keypress events in iframes?\nI need keypress events disabled only in specific iframes, so doing a catch-all-events-and-make-em-do-nothing solution is not an option.\n"
},
{
"from": "gpt",
"value": "To disable keypress event... |
I have an application that has to deal with getting "special" characters in its URL (like &, +, %, etc). When I'm sending a request to the application using these characters (of course I'm sending them escaped) I'm getting "Bad Request" response code with the message "ASP.NET detected invalid characters in the URL". Tr... | In ASP.NET, request validation is designed to protect your application from potentially harmful content (such as cross-site scripting) being sent in the request. However, if you need to disable request validation for specific scenarios—such as when you're working with special characters in URLs—you can do so at differe... | 46,796 | [
{
"from": "human",
"value": "I have an application that has to deal with getting \"special\" characters in its URL (like &, +, %, etc). When I'm sending a request to the application using these characters (of course I'm sending them escaped) I'm getting \"Bad Request\" response code with the message \"ASP.N... |
After trying to setup my site for Google Webmaster Tools I found that my Custom ASP.NET 404 page was not returning the 404 status code. It displayed the correct custom page and told the browser that everything is OK. This is consider a soft 404 or false 404. Google doesn't like this. So I found many articles on the iss... | It sounds like you're encountering an issue with properly setting the HTTP status code for your custom 404 error page in an ASP.NET application. When you're using a master page and the custom error pages are configured in the `web.config`, it's crucial to ensure that the status code is set correctly before any output i... | 43,792 | [
{
"from": "human",
"value": "After trying to setup my site for Google Webmaster Tools I found that my Custom ASP.NET 404 page was not returning the 404 status code. It displayed the correct custom page and told the browser that everything is OK. This is consider a soft 404 or false 404. Google doesn't like ... |
What should I keep in mind when converting my projects from C to C++? Is there any reason to use C at all? The only thing in my mind now is to make sure it's friendly to DLLs so I can create a C interface if I need it.
Note: I know C++ just fine. Templates, partial specialization, why multiple inheritance is bad (I've ... | When converting your projects from C to C++, there are several factors and best practices to keep in mind:
### Key Considerations When Transitioning from C to C++
1. **C Compatibility**:
- Ensure that your code remains compatible with C when necessary, especially if you plan on exposing a C interface for DLLs. Us... | 39,906 | [
{
"from": "human",
"value": "What should I keep in mind when converting my projects from C to C++? Is there any reason to use C at all? The only thing in my mind now is to make sure it's friendly to DLLs so I can create a C interface if I need it.\nNote: I know C++ just fine. Templates, partial specializati... |
I am setting up an alert with a text field in it so players can enter their name for a high score. The game is oriented in landscape mode, but when I call to show the alert, the alert pops up in portrait mode while two keyboards are displayed, one in landscape and one(that's the size of the landscape one) in portrait ... | It looks like you're using the `UIAlertView`, which is somewhat outdated and doesn't support custom layouts or orientations directly. Instead, it's recommended to use `UIAlertController`, which provides a more modern and flexible approach to handling alerts.
Here's how you can achieve what you're looking for using `UI... | 47,380 | [
{
"from": "human",
"value": "I am setting up an alert with a text field in it so players can enter their name for a high score. The game is oriented in landscape mode, but when I call to show the alert, the alert pops up in portrait mode while two keyboards are displayed, one in landscape and one(that's th... |
I'm new to database indexing, if I have 2 columns in a table that are good choices for indexing like for example,
[Posts](
[PostID] [int] IDENTITY(1,1) NOT NULL,
[UserName] [nvarchar](64) NOT NULL,
[ApplicationType] [smallint] NOT NULL,
...
)
in this case PostID would be the PRIMARY KEY CLUSTERED index... | Hi Ray,
When it comes to indexing in a database, there are several considerations to make, particularly regarding which columns to index and how to index them. Let's break down your questions:
### 1. Individual Indexes vs. Composite Indexes
**Individual Indexes**:
- Creating individual indexes on `UserName` and `Ap... | 46,391 | [
{
"from": "human",
"value": "I'm new to database indexing, if I have 2 columns in a table that are good choices for indexing like for example,\n[Posts]( \n [PostID] [int] IDENTITY(1,1) NOT NULL,\n [UserName] [nvarchar](64) NOT NULL,\n [ApplicationType] [smallint] NOT NULL,\n ...\n)\n\nin this cas... |
Is it possible to use something like:
require 'serialport.o'
with Shoes? serialport.o is compiled c code as a ruby extension.
When I attempt to run the following code in shoes, I see no visible output to the screen and shoes crashes on OS X.
Thank you
CODE:
require "serialport.o"
port = "/dev/tty.usbserial-A1001O0o"... | Using C extensions like `serialport.o` in a Shoes application can lead to compatibility issues, especially if the extension isn't designed to work within the Shoes environment or if it's not thread-safe. Shoes has its own event loop and UI handling which can conflict with blocking operations like reading from or writin... | 44,591 | [
{
"from": "human",
"value": "Is it possible to use something like:\nrequire 'serialport.o'\n\nwith Shoes? serialport.o is compiled c code as a ruby extension.\nWhen I attempt to run the following code in shoes, I see no visible output to the screen and shoes crashes on OS X.\nThank you\nCODE:\nrequire \"se... |
Will be starting a web app that will have to provide many different HTML forms for data entry, so I was wondering if there is a web framework out there that does this in a clever way. generally when you have forms you have many considerations like navigation, validation, etc. that are not handled very efficiently by he... | Yes, there are several web frameworks and libraries that aim to simplify the process of creating, validating, and managing forms in web applications. Below are a few options that have been well-received in the developer community:
### 1. **Django (Python)**
Django provides a robust forms framework that simplifies form... | 47,578 | [
{
"from": "human",
"value": "Will be starting a web app that will have to provide many different HTML forms for data entry, so I was wondering if there is a web framework out there that does this in a clever way. generally when you have forms you have many considerations like navigation, validation, etc. th... |
I'd like to define a generic type, whose actual type parameter can only be
One of the numeric primitive wrapper classes (Long, Integer, Float, Double)
String
I can meet the first requirement with a definition like this
public final class MyClass<T extends Number> {
// Implementation omitted
}
But I can't figure ... | You're correct in observing that Java generics don't support "or" semantics directly in the type parameter constraints. You cannot define a type parameter that allows for multiple distinct types like `Number` subclasses and `String` simultaneously with a single generic type declaration.
However, you can achieve the de... | 47,223 | [
{
"from": "human",
"value": "I'd like to define a generic type, whose actual type parameter can only be\n\nOne of the numeric primitive wrapper classes (Long, Integer, Float, Double)\nString\n\nI can meet the first requirement with a definition like this\npublic final class MyClass<T extends Number> {\n ... |
I have configured Tomcat to use LDAP / AD.
How can I get more details about the logged in user; the userid is returned by request.getRemoteUser() but not the full name that I need.
How do I get the actual "displayName" (full name) from AD ?
I am using ldap/activedirectory/tomcat 5.5
| To retrieve additional user attributes like the display name from Active Directory while using LDAP with Tomcat, you will need to perform a custom LDAP query after the user is authenticated. The `request.getRemoteUser()` method will only provide the username, but you can use the LDAP context to fetch additional attribu... | 44,016 | [
{
"from": "human",
"value": "I have configured Tomcat to use LDAP / AD.\nHow can I get more details about the logged in user; the userid is returned by request.getRemoteUser() but not the full name that I need.\nHow do I get the actual \"displayName\" (full name) from AD ?\nI am using ldap/activedirectory... |
In Informix I can run SQL statement that use other database:
INSERT INTO other_db:mytable ...
I would like "unite" both databases, but I would like do it "step by step".
At first I want to move all data from other_db to main database
and make alias that other_db = main_database. This way I will have
time to remove "ot... | In Informix, you can create an alias for a database by using the `CREATE DATABASE` statement to create a new database that points to your existing database. However, to make your current database act as an alias for another database, Informix does not directly support database aliases in the way that you might be think... | 48,486 | [
{
"from": "human",
"value": "In Informix I can run SQL statement that use other database:\nINSERT INTO other_db:mytable ...\n\nI would like \"unite\" both databases, but I would like do it \"step by step\".\nAt first I want to move all data from other_db to main database\nand make alias that other_db = main... |
Possible Duplicate:
Bootstrapping a language
What's the importance of having an interpreter for a given language written in the target language (for example, PyPy)?
| Having an interpreter for a programming language written in that same language (like PyPy for Python) is significant for several reasons:
1. **Self-Hosting**: Writing an interpreter in the target language allows for self-hosting, which means that the language can be implemented using itself. This can simplify the deve... | 48,351 | [
{
"from": "human",
"value": "\nPossible Duplicate:\nBootstrapping a language \n\nWhat's the importance of having an interpreter for a given language written in the target language (for example, PyPy)?\n"
},
{
"from": "gpt",
"value": "Having an interpreter for a programming language written in th... |
This one is for a coworker:
We are having a problem with one of our wireframe sets (a Visio file). Basically, the file continues to increase in size and is currently at 43 MB (yes, forty three!), when the average of our other sets are at about 5-10 MB each. When I saved a copy to my desktop and deleted all of the pa... | Subject: Assistance Needed with Large Visio File
Hi [Coworker's Name],
I hope this message finds you well. I wanted to reach out regarding an issue we're experiencing with one of our wireframe sets in the Visio file. The file size has ballooned to 43 MB, while our other sets typically range from 5 to 10 MB.
I tried... | 48,245 | [
{
"from": "human",
"value": "This one is for a coworker:\n\nWe are having a problem with one of our wireframe sets (a Visio file). Basically, the file continues to increase in size and is currently at 43 MB (yes, forty three!), when the average of our other sets are at about 5-10 MB each. When I saved a c... |
Every now and then I get an error when I set up states in an MXML file. The error I get says that mx:states could not be resolved to a component implementation.
I read, at the following url, that this issue is caused by extending components - that somehow throws off the compiler's ability to resolve mx:states. I don'... | The issue you're experiencing with the `mx:states` tag in MXML is indeed related to how the Flex compiler resolves namespaces and component implementations, particularly when dealing with custom or extended components.
When you use the `mx:` prefix, the Flex compiler expects to find `states` as a part of the `mx` nam... | 46,227 | [
{
"from": "human",
"value": "Every now and then I get an error when I set up states in an MXML file. The error I get says that mx:states could not be resolved to a component implementation.\nI read, at the following url, that this issue is caused by extending components - that somehow throws off the compil... |
My post below asked what the curly quotation marks were and why my app wouldn't work with them, my question now is how can I replace them when my program comes across them, how can I do this in C#? Are they special characters?
curly-quotation-marks-vs-square-quotation-marks-what-gives
Thanks
| Curly quotation marks (also known as smart quotes) are indeed special characters that are typically used in formatted text to make quotes look nicer. In Unicode, they are represented as:
- Left double quotation mark: `“` (U+201C)
- Right double quotation mark: `”` (U+201D)
- Left single quotation mark: `‘` (U+2018)
- ... | 47,187 | [
{
"from": "human",
"value": "My post below asked what the curly quotation marks were and why my app wouldn't work with them, my question now is how can I replace them when my program comes across them, how can I do this in C#? Are they special characters?\ncurly-quotation-marks-vs-square-quotation-marks-wha... |
When I hit /// in Visual Studio, is it possible to change the resulting snippet from this:
/// <summary>
///
/// </summary>
to this?:
/// <summary></summary>
| In Visual Studio, the default behavior when you type `///` and hit Enter is to generate an XML documentation comment that includes the `<summary>` tag with line breaks. However, as of my last knowledge update, there isn't a built-in option to change this behavior directly in Visual Studio settings to generate a more co... | 46,212 | [
{
"from": "human",
"value": "When I hit /// in Visual Studio, is it possible to change the resulting snippet from this:\n/// <summary>\n/// \n/// </summary>\n\nto this?:\n/// <summary></summary>\n\n"
},
{
"from": "gpt",
"value": "In Visual Studio, the default behavior when you type `///` and hit... |
I have methods with more than one parameter that are guarded against bad input by throwing ArgumentNullExceptions and ArgumentExceptions whenever any parameter is null.
So there are two obvious ways to test this:
One test per Parameter using the [ExpectedException] attribute
One test for all parameters using multiple ... | Testing multiple parameters for null values in a single test case while maintaining code coverage can be a bit tricky. You want to ensure that each parameter is validated correctly without having dead lines of code (LoCs) that aren’t reached.
One effective way to achieve this without using multiple try-catch blocks is... | 48,439 | [
{
"from": "human",
"value": "I have methods with more than one parameter that are guarded against bad input by throwing ArgumentNullExceptions and ArgumentExceptions whenever any parameter is null.\nSo there are two obvious ways to test this:\n\nOne test per Parameter using the [ExpectedException] attribute... |
Is it possible is asp to detect from the MobileCapabilities object if the device support arabic or not
| In ASP.NET, the `MobileCapabilities` class provides properties that allow you to detect the capabilities of mobile devices. However, it does not directly provide a property to check if a device supports the Arabic language.
To determine if a mobile device supports Arabic, you typically need to consider the following a... | 49,234 | [
{
"from": "human",
"value": "Is it possible is asp to detect from the MobileCapabilities object if the device support arabic or not\n"
},
{
"from": "gpt",
"value": "In ASP.NET, the `MobileCapabilities` class provides properties that allow you to detect the capabilities of mobile devices. However... |
I know that I can make a setter that checks to see if a value is NULL and do something. Example:
<TextBlock>
<TextBlock.Style>
<Style>
<Style.Triggers>
<DataTrigger Binding="{Binding SomeField}" Value="{x:Null}">
<Setter Property="TextBlock.Text" Value="It's NULL Baby!" />
</DataTr... | In pure XAML, you can't directly create a `DataTrigger` that checks for a "not" condition (e.g., "not null" or "not equal to a specific value") using a single `DataTrigger`. However, you can achieve this behavior by using a combination of `DataTriggers` or by utilizing a `MultiDataTrigger`.
Here are two approaches you... | 44,135 | [
{
"from": "human",
"value": "I know that I can make a setter that checks to see if a value is NULL and do something. Example:\n<TextBlock>\n <TextBlock.Style>\n <Style>\n <Style.Triggers>\n <DataTrigger Binding=\"{Binding SomeField}\" Value=\"{x:Null}\">\n <Setter Property=\"TextBlo... |
I'm attempting to create a Wizard type control in VB6 and have run into a stumbling block.
I'd like to allow users of the control to be able to add and manage CWizardPage(s) to the design time control using a property page.
The first approach I used was to add the Wizard pages to the OCX directly using a Collection, ho... | In VB6, you can programmatically add controls to a form at design time without relying on drag-and-drop by using the `Controls.Add` method. However, this is limited, and you might encounter restrictions when trying to dynamically create instances of your user controls (like `CWizardPage`). Below are some steps and tips... | 44,286 | [
{
"from": "human",
"value": "I'm attempting to create a Wizard type control in VB6 and have run into a stumbling block.\nI'd like to allow users of the control to be able to add and manage CWizardPage(s) to the design time control using a property page.\nThe first approach I used was to add the Wizard pages... |
I have a netbook running Linux and a large collection of computer books and reference material as HTML. I'd like some compact way of storing these books which can be browed without unpacking them first. This would save space and reduce wear on my small SSD.
If there was some way to convince Firefox to browse files cont... | You have several options to browse HTML files contained in ZIP archives on your Linux netbook without unpacking them. Here are a few solutions you can consider:
### 1. **Using a Local Web Server with ZIP Support**
You can set up a lightweight web server (like `Python's http.server`) and serve files directly from ZIP ... | 43,982 | [
{
"from": "human",
"value": "I have a netbook running Linux and a large collection of computer books and reference material as HTML. I'd like some compact way of storing these books which can be browed without unpacking them first. This would save space and reduce wear on my small SSD.\nIf there was some wa... |
I have a WPF TabControl with two TabItems. Each TabItem contains a ListBox with a separate ObservableCollection as its ItemsSource. Each ListBox has a different ItemTemplate.
No matter which TabItem I set to be selected at startup, that tab will be displayed fine, but when I click on the other tab the application c... | The issue you're experiencing seems to be related to how WPF handles data templates and the data context of the controls within your `TabControl`. The "Exception has been thrown by the target of an invocation" error is a generic error that can occur due to various reasons. In your case, it might be because the controls... | 45,107 | [
{
"from": "human",
"value": "I have a WPF TabControl with two TabItems. Each TabItem contains a ListBox with a separate ObservableCollection as its ItemsSource. Each ListBox has a different ItemTemplate. \nNo matter which TabItem I set to be selected at startup, that tab will be displayed fine, but when ... |
I learned a lot of Perl RegEx syntax rules, but probably the only way to actually be able to write them is to do a bunch of 'RegEx' related exercises.
I looked over the other "Learn RegEx" threads on StackOverflow, but haven't found anything similar.
Is there any collection of such exercises? In form of book, HTML, wit... | Yes, there are several resources available that provide exercises and challenges for practicing regular expressions (RegEx), including Perl RegEx syntax. Here are a few suggestions:
1. **RegexOne**: This interactive tutorial provides a series of exercises that help you learn and practice regular expressions. It's web-... | 48,607 | [
{
"from": "human",
"value": "I learned a lot of Perl RegEx syntax rules, but probably the only way to actually be able to write them is to do a bunch of 'RegEx' related exercises.\nI looked over the other \"Learn RegEx\" threads on StackOverflow, but haven't found anything similar.\nIs there any collection ... |
I'm getting the following error when I try to Serialize an HttpWebRequest
Type 'System.Net.KnownHttpVerb' in
Assembly 'System, Version=2.0.0.0,
Culture=neutral,
PublicKeyToken=b77a5c561934e089' is
not marked as serializable.
Using .Net Framework 2.0
This is one of the properties that my class holds. It's a re... | The error you are encountering indicates that while `HttpWebRequest` itself is marked as serializable, it contains a member (`KnownHttpVerb`) that is not marked as serializable. This means that attempting to serialize an instance of `HttpWebRequest` directly will fail because of its non-serializable members.
### Worka... | 44,519 | [
{
"from": "human",
"value": "I'm getting the following error when I try to Serialize an HttpWebRequest\n\nType 'System.Net.KnownHttpVerb' in\n Assembly 'System, Version=2.0.0.0,\n Culture=neutral,\n PublicKeyToken=b77a5c561934e089' is\n not marked as serializable.\n\nUsing .Net Framework 2.0\nThis is on... |
I finally have a hardware guy that is insterested in controlling the firmware.
This is for vxworks firmware. The tornado (2.2.1) gui creates a project file that has a list of files that were modified but they seem to be from all over the directory tree.
So I am tempted to just controll those files.
| It's great to hear that you have a hardware person interested in controlling the firmware! Working with VxWorks and the Tornado IDE can be a bit complex, especially when it comes to managing project files and version control. Here are some steps and best practices you might consider for managing your firmware project:
... | 46,723 | [
{
"from": "human",
"value": "I finally have a hardware guy that is insterested in controlling the firmware.\nThis is for vxworks firmware. The tornado (2.2.1) gui creates a project file that has a list of files that were modified but they seem to be from all over the directory tree.\nSo I am tempted to jus... |
Is there a way to just tell the compiler, that I want my objects to be serializable by default?
| In many programming languages, especially those that have a built-in concept of serialization, you cannot directly set a global default for all objects to be serializable. However, there are some strategies you can use depending on the language and the specific serialization library or framework you're working with.
#... | 47,455 | [
{
"from": "human",
"value": "Is there a way to just tell the compiler, that I want my objects to be serializable by default?\n"
},
{
"from": "gpt",
"value": "In many programming languages, especially those that have a built-in concept of serialization, you cannot directly set a global default fo... |
After upgrading a few gems via terminal on my mac, I have created a new rails project backed up by a mysql database. Upon starting the app, the regular welcome aboard page appears.
Here's the problem - I tried clicking the link entitled "About your application's environment", I receive the following output in my brows... | It seems like you're running into a series of issues while trying to install the `mysql` gem for your Rails application on macOS. The main problems stem from compatibility issues between your Ruby environment and the MySQL client libraries. Below are steps to help you troubleshoot and resolve these issues.
### Step 1:... | 43,077 | [
{
"from": "human",
"value": "After upgrading a few gems via terminal on my mac, I have created a new rails project backed up by a mysql database. Upon starting the app, the regular welcome aboard page appears. \nHere's the problem - I tried clicking the link entitled \"About your application's environment\"... |
How can I extract information from a website (http://tv.yahoo.com/listings) and then create an XML file out of it? I want to save it so to parse later and display information using JavaScript?
I am quite new to Perl and I have no idea about how to do it.
| To extract information from a website and create an XML file using Perl, you'll typically follow these steps:
1. **Install Required Perl Modules**: You may need some Perl modules to fetch data from the web and parse HTML. The common modules are `LWP::UserAgent` for fetching web pages and `HTML::TreeBuilder` or `HTML::... | 41,521 | [
{
"from": "human",
"value": "How can I extract information from a website (http://tv.yahoo.com/listings) and then create an XML file out of it? I want to save it so to parse later and display information using JavaScript?\nI am quite new to Perl and I have no idea about how to do it.\n"
},
{
"from... |
I am working working on the early release of Azure from Microsoft and am not able to write to a memory stream. Keep getting an exception. I fixed the issue by using a different technique to achieve my end goal, however I wanted to know if there is a way to do it. Given that Azure is a shared infrastructure I cannot cha... | When working with Azure and encountering issues writing to a memory stream, there are several potential reasons for the exception you might be experiencing. Although you mentioned you found a workaround, let's explore some possible solutions that might help you understand or resolve the issue with writing to a memory s... | 43,988 | [
{
"from": "human",
"value": "I am working working on the early release of Azure from Microsoft and am not able to write to a memory stream. Keep getting an exception. I fixed the issue by using a different technique to achieve my end goal, however I wanted to know if there is a way to do it. Given that Azur... |
I got a little stuck and I'm hoping someone can point me in the right direction. I have an NSMutableArray that stores a sequence. I created an enumerator so that a while loop can get the content of the array one by one.
Everything works fine however I want the methods to be called with a 10 second gap in between each c... | To introduce a delay between method calls in Objective-C, you can use Grand Central Dispatch (GCD) to schedule your method calls asynchronously with a delay. Instead of a `while` loop, you'll want to create a recursive method that calls itself after a delay. Here's an example of how you can achieve this:
1. Use a disp... | 45,745 | [
{
"from": "human",
"value": "I got a little stuck and I'm hoping someone can point me in the right direction. I have an NSMutableArray that stores a sequence. I created an enumerator so that a while loop can get the content of the array one by one.\nEverything works fine however I want the methods to be cal... |
Is there any performance penalty for the following code snippet?
for (int i=0; i<someValue; i++)
{
Object o = someList.get(i);
o.doSomething;
}
Or does this code actually make more sense?
Object o;
for (int i=0; i<someValue; i++)
{
o = someList.get(i);
o.doSomething;
}
If in byte code these two are to... | In terms of performance, the two code snippets you provided are effectively equivalent in most cases, especially if we consider modern Java compilers and Just-In-Time (JIT) compilation optimizations.
Here's a breakdown of both snippets:
1. **First Snippet:**
```java
for (int i = 0; i < someValue; i++) {
... | 49,080 | [
{
"from": "human",
"value": "Is there any performance penalty for the following code snippet?\nfor (int i=0; i<someValue; i++)\n{\n Object o = someList.get(i);\n o.doSomething;\n}\n\nOr does this code actually make more sense?\nObject o;\nfor (int i=0; i<someValue; i++)\n{\n o = someList.get(i);\n ... |
I’ve just found out that the execution plan performance between the following two select statements are massively different:
select * from your_large_table
where LEFT(some_string_field, 4) = '2505'
select * from your_large_table
where some_string_field like '2505%'
The execution plans are 98% and 2% respectively. Bit... | The performance difference you're observing between the two SQL queries can be attributed to how the SQL Server (or any SQL database) optimizes and executes the queries based on the functions used.
### Reasons for Performance Difference
1. **Function Use and Indexing**:
- When you use `LEFT(some_string_field, 4) =... | 47,207 | [
{
"from": "human",
"value": "I’ve just found out that the execution plan performance between the following two select statements are massively different:\nselect * from your_large_table\nwhere LEFT(some_string_field, 4) = '2505'\n\nselect * from your_large_table\nwhere some_string_field like '2505%'\n\nThe ... |
When I try to run the following code (from the REPL) in Clojure:
(dotimes [i 5]
(.start
(Thread.
(fn []
(Thread/sleep (rand 1000))
(println (format "Finished %d on %s" i (Thread/currentThread)))))))
I get the following error:
java.lang.Exception: Unable to resolve symbol: i in this context
clojure... | The issue you're encountering is related to the scoping of the variable `i` within the anonymous function you're passing to the `Thread`. In Clojure, when you define a function with `fn`, the scope of the variables is limited to the enclosing form, and they are not automatically accessible in nested contexts like the o... | 46,527 | [
{
"from": "human",
"value": "When I try to run the following code (from the REPL) in Clojure:\n(dotimes [i 5]\n (.start\n (Thread.\n (fn []\n (Thread/sleep (rand 1000))\n (println (format \"Finished %d on %s\" i (Thread/currentThread)))))))\n\nI get the following error:\njava.lang.Exception:... |
Is it possible to have a report which has grouping on the underlying data but for which you can disable the grouping via a button or something on the report? Basically I want to have a "Summary Report" which is grouped, but then be able to view the detail beneath when required without having a separate report for it.
| Yes, it is definitely possible to create a report that has grouping functionality but also allows users to toggle between a summary view and a detailed view. This can be achieved in various reporting tools and platforms. Here are a few ways you can implement this:
### 1. **Using Drill-Down Features:**
Many reporting t... | 46,498 | [
{
"from": "human",
"value": "Is it possible to have a report which has grouping on the underlying data but for which you can disable the grouping via a button or something on the report? Basically I want to have a \"Summary Report\" which is grouped, but then be able to view the detail beneath when required... |
I have 2 wav files that I want to concatenate into one file with the two sound tracks.
Is there any api for that task or some built in commands in .NET that can I can use in some genius way to make this task possible?
Many thanks for the help. :)
| Yes, you can concatenate two WAV files in .NET using built-in libraries or third-party libraries. Below, I'll demonstrate how to achieve this using the NAudio library, which is a popular audio library for .NET.
### Using NAudio
1. **Install NAudio**:
You can install NAudio via NuGet. Open your Package Manager Cons... | 47,415 | [
{
"from": "human",
"value": "I have 2 wav files that I want to concatenate into one file with the two sound tracks. \nIs there any api for that task or some built in commands in .NET that can I can use in some genius way to make this task possible?\nMany thanks for the help. :)\n"
},
{
"from": "gpt"... |
What would you suggest as a replacement to the Maven Java build toolset? Just plain Ant scripts? SCons?
| Choosing a replacement for Maven largely depends on your project's specific requirements, team preferences, and the complexity of your build processes. Here are some alternatives to consider:
1. **Gradle**:
- **Pros**: Gradle is a popular choice that provides a more flexible and powerful build system compared to M... | 48,058 | [
{
"from": "human",
"value": "What would you suggest as a replacement to the Maven Java build toolset? Just plain Ant scripts? SCons?\n"
},
{
"from": "gpt",
"value": "Choosing a replacement for Maven largely depends on your project's specific requirements, team preferences, and the complexity of ... |
I don't want my window to be resized either "only horizontally" or "only vertically." Is there a property I can set on my window that can enforce this, or is there a nifty code-behind trick I can use?
| To prevent a window from being resized either horizontally or vertically, you can set the window's resizing properties to restrict it to a fixed size. The method to achieve this depends on the framework or technology you're using. Here's how you can do it in a few common environments:
### 1. **WPF (Windows Presentatio... | 48,693 | [
{
"from": "human",
"value": "I don't want my window to be resized either \"only horizontally\" or \"only vertically.\" Is there a property I can set on my window that can enforce this, or is there a nifty code-behind trick I can use?\n"
},
{
"from": "gpt",
"value": "To prevent a window from bein... |
I've been stuck with this query for some time now. The SQL returns the result that I want, but I cannot work out how to express the query in HQL.
Here's the SQL:
select thread.ThreadId,
thread.Title,
thread.CreatedOn,
thread.ViewCount,
thread.CreatedBy,
... | To convert your SQL query into HQL using NHibernate, you need to ensure that you're capturing the logic of the correlated subqueries correctly.
Your SQL can be decomposed into two main components:
1. A subquery to filter threads based on posts created by a specific user.
2. A condition to ensure that the last post in... | 45,621 | [
{
"from": "human",
"value": "I've been stuck with this query for some time now. The SQL returns the result that I want, but I cannot work out how to express the query in HQL.\nHere's the SQL:\nselect thread.ThreadId,\n thread.Title,\n thread.CreatedOn, \n thread.ViewCou... |
I've been handing a design for a webpage which I'm trying to implement correctly. This design contains navigation elements which are partially or entirely duplicated all over the page - in particular, links to the main 3 categories for navigation are present on the page no less than 4 times.
I'm no web design expert, ... | It's great that you're considering best practices in your HTML structure! You are correct to be cautious about duplicating content within your HTML. From an accessibility and SEO perspective, it's generally best to avoid duplicate content whenever possible.
While CSS is primarily used for styling and layout, it cannot... | 46,214 | [
{
"from": "human",
"value": "I've been handing a design for a webpage which I'm trying to implement correctly. This design contains navigation elements which are partially or entirely duplicated all over the page - in particular, links to the main 3 categories for navigation are present on the page no less... |
I have some .NET remoting code where a factory method, implemented in some server side class, returns interfaces to concrete objects, also executing on the very same server. .NET remoting automagically creates proxies and allows me to pass the interfaces across to the client, which can then call them directly.
Example ... | In WCF, the concept of passing around interfaces and using them like you did with .NET Remoting is somewhat different because WCF is based on service contracts, which are implemented as classes that the WCF runtime exposes to clients. However, you can achieve a similar pattern by using interfaces along with WCF service... | 45,714 | [
{
"from": "human",
"value": "I have some .NET remoting code where a factory method, implemented in some server side class, returns interfaces to concrete objects, also executing on the very same server. .NET remoting automagically creates proxies and allows me to pass the interfaces across to the client, wh... |
I'm trying to do some research on flash objects in browsers. For example memory usage etc.
With Adobe Flex Builder 3 im trying to do some profiling on swf files but the problem is that I can only do this on debug swfs. Almost all adds/games/video are release version. Is there a way to some testing on those?
| Profiling release SWF files can be a bit challenging because many profiling tools, including those in Adobe Flex Builder, typically require debug versions of the SWFs to provide detailed memory and performance metrics. However, there are some approaches you can take to analyze memory usage and performance for release S... | 48,754 | [
{
"from": "human",
"value": "I'm trying to do some research on flash objects in browsers. For example memory usage etc.\nWith Adobe Flex Builder 3 im trying to do some profiling on swf files but the problem is that I can only do this on debug swfs. Almost all adds/games/video are release version. Is there a... |
I'm currently dynamically building an asp:table which contains checkboxes
these checkboxes have a CheckChanged event as an auto postback.
v_articleCheckBox.CheckedChanged += new EventHandler(v_articleCheckBox_CheckedChanged);
I am storing the checkbox states in the viewstate and I am rebuilding the table every page lo... | The issue you're encountering with the first checkbox not triggering the `CheckedChanged` event on unchecking could be related to several factors. Here are some potential reasons and solutions that you might want to consider:
### 1. Ensure Proper Control ID
ASP.NET requires unique IDs for controls within the same nami... | 38,256 | [
{
"from": "human",
"value": "I'm currently dynamically building an asp:table which contains checkboxes\nthese checkboxes have a CheckChanged event as an auto postback.\nv_articleCheckBox.CheckedChanged += new EventHandler(v_articleCheckBox_CheckedChanged);\n\nI am storing the checkbox states in the viewstat... |
can you use ms access as the backend of a asp.net dynamic data project website. Any links or examples?
| Yes, you can use Microsoft Access as the backend for an ASP.NET Dynamic Data project. However, it is important to note that using Access for web applications, especially in production environments, is generally not recommended due to limitations in scalability, concurrency, and performance. Nonetheless, for small appli... | 43,414 | [
{
"from": "human",
"value": "can you use ms access as the backend of a asp.net dynamic data project website. Any links or examples?\n"
},
{
"from": "gpt",
"value": "Yes, you can use Microsoft Access as the backend for an ASP.NET Dynamic Data project. However, it is important to note that using ... |
I have a Dictionary that when I add multiple values to it, the items that were entered before take the values of the item added. I am using the .Net 3.5 Here is the code:
public static Dictionary<string, Neighborhoods> Families()
{
if (File.Exists(calculatePath() + "Family.txt")){}
else {File.Create... | The issue you are encountering stems from the use of static fields in your `Neighborhoods` class. When you define fields as static, they belong to the class itself rather than to instances of the class. As a result, when you create a new instance of `Neighborhoods` (e.g., with `temp = new Neighborhoods()`), you are mod... | 47,693 | [
{
"from": "human",
"value": "I have a Dictionary that when I add multiple values to it, the items that were entered before take the values of the item added. I am using the .Net 3.5 Here is the code:\npublic static Dictionary<string, Neighborhoods> Families()\n {\n if (File.Exists(calculatePath() ... |
I have a structured XML file format that needs to be mapped to a flatter XML format. Ordinarily I would create a custom XSLT file for this and have the BizTalk map use it. However, I do like the idea of using the graphical maps where possible - it's all too easy to dive straight into XSLT but not so easy for those foll... | Mapping a hierarchical XML structure to a flatter one in BizTalk can indeed be challenging, especially when dealing with external schemas. However, using a combination of functoids can help achieve your goal without diving into XSLT. Here’s how you can approach the mapping using BizTalk’s graphical mapper with functoid... | 46,139 | [
{
"from": "human",
"value": "I have a structured XML file format that needs to be mapped to a flatter XML format. Ordinarily I would create a custom XSLT file for this and have the BizTalk map use it. However, I do like the idea of using the graphical maps where possible - it's all too easy to dive straight... |
When possible.. do you leave parentheses in or out in Ruby?
| In Ruby, whether to use parentheses or not is largely a matter of style and readability. Ruby allows you to omit parentheses in many cases, particularly when calling methods. Here are some guidelines to help you decide when to include or omit them:
### When to Omit Parentheses
1. **DSLs (Domain Specific Languages)**:... | 47,331 | [
{
"from": "human",
"value": "When possible.. do you leave parentheses in or out in Ruby? \n"
},
{
"from": "gpt",
"value": "In Ruby, whether to use parentheses or not is largely a matter of style and readability. Ruby allows you to omit parentheses in many cases, particularly when calling method... |
I'm trying to do XHTML DOM parsing with JTidy, and it seems to be rather counterintuitive task. In particular, there's a method to parse HTML:
Node Tidy.parse(Reader, Writer)
And to get the <body /> of that Node, I assume, I should use
Node Node.findBody(TagTable)
Where should I get an instance of that TagTable? (Con... | In JTidy, the `TagTable` is a core component responsible for defining HTML tags and their properties, and as you've pointed out, the `TagTable` constructor is protected, making it challenging to create an instance directly.
In JTidy 8.0-SNAPSHOT, `TagTable` is typically not intended to be instantiated directly by user... | 42,947 | [
{
"from": "human",
"value": "I'm trying to do XHTML DOM parsing with JTidy, and it seems to be rather counterintuitive task. In particular, there's a method to parse HTML:\nNode Tidy.parse(Reader, Writer)\n\nAnd to get the <body /> of that Node, I assume, I should use\nNode Node.findBody(TagTable)\n\nWhere ... |
The net is overflowing with explanations of the "dreaded diamond problem".
So is StackOverflow. I think I understand that bit, but I fail to translate that knowledge into comprehending something similar yet different.
My question begins as a pure C++ question, but the answer might well branch over into MS-COM specific... | The scenario you've described involves a few different concepts in C++ inheritance, particularly around virtual inheritance and the mechanics of interfaces in COM (Component Object Model).
### Understanding Virtual Inheritance in C++
In traditional inheritance (non-virtual inheritance), when you inherit from a base c... | 43,286 | [
{
"from": "human",
"value": "The net is overflowing with explanations of the \"dreaded diamond problem\". \nSo is StackOverflow. I think I understand that bit, but I fail to translate that knowledge into comprehending something similar yet different.\nMy question begins as a pure C++ question, but the answe... |
My application allows the user to enter a numeric value (currency) in a UITextField control, but the keyboard layout that I wish was available is unfortunately not one of the built-in options, so I had to choose the "Numbers & Punctuation" option in Interface Builder. Here's the corresponding dialog window in IB:
So w... | To validate currency values entered into a `UITextField`, you'll want to ensure that the input only contains valid characters (digits and possibly a decimal point) and that it conforms to the expected format of a currency value.
Here's a general approach to validate the input for currency values:
1. **Input Filtering... | 45,917 | [
{
"from": "human",
"value": "My application allows the user to enter a numeric value (currency) in a UITextField control, but the keyboard layout that I wish was available is unfortunately not one of the built-in options, so I had to choose the \"Numbers & Punctuation\" option in Interface Builder. Here's t... |
I have two tables on a page that I want to display side by side, and then center them within the page (actually within another div, but this is the simplest I could come up with):
<style>
#outer { text-align: center; }
#inner { text-align: left; margin: 0 auto; }
.t { float: left; }
table { border: 1px solid bl... | The issue you're facing is indeed related to the floating of the tables, which is affecting their alignment within the containing div. To achieve your goal of having the two tables side by side and centered in the outer div, you can follow a different approach. Here are some modifications to your CSS and HTML:
1. **Us... | 42,790 | [
{
"from": "human",
"value": "I have two tables on a page that I want to display side by side, and then center them within the page (actually within another div, but this is the simplest I could come up with):\n<style>\n #outer { text-align: center; }\n #inner { text-align: left; margin: 0 auto; }\n .t { ... |
Notepad++ has a neat feature that combines search and highlighting. When you select a word, it is highlighted wherever else it shows up on the page, so it is an implicit search, which I find very very useful.
Is there a way to get that into VS?
I would also be interested in having these highlightings stick so that I c... | Visual Studio does not have a built-in feature that exactly replicates Notepad++'s implicit search and highlight functionality, but there are a few ways you can achieve similar results using extensions or built-in features. Below are a couple of suggestions for highlighting keywords in Visual Studio:
### 1. **Using Ex... | 45,641 | [
{
"from": "human",
"value": "Notepad++ has a neat feature that combines search and highlighting. When you select a word, it is highlighted wherever else it shows up on the page, so it is an implicit search, which I find very very useful. \nIs there a way to get that into VS?\nI would also be interested in h... |
I have looked at NHibernate and EntitySpaces and they both seem to work differently.
In EntitySpaces, you define the database tables and table relationships and the classes are generated for you.
In NHibernate, you define the classes and the table relationships are generated for you. This is what I am looking for.
Are ... | Yes, there are several ORM (Object-Relational Mapping) frameworks in the ASP.NET ecosystem that allow you to define your classes and then generate the database schema from those classes, similar to NHibernate. Here are a few recommendations:
1. **Entity Framework (EF) Core**:
- Entity Framework Core is one of the m... | 48,059 | [
{
"from": "human",
"value": "I have looked at NHibernate and EntitySpaces and they both seem to work differently.\nIn EntitySpaces, you define the database tables and table relationships and the classes are generated for you.\nIn NHibernate, you define the classes and the table relationships are generated f... |
I have a web service (WCF or ASMX doesn't matter)... I have made a Console application, right-clicked, added service referrence. So far, so good.
However, I cannot for the life of me pass "security" credentials across to my service. This is my client code:
var client = new MyClient();
client.ClientCredentials.UserName... | Passing security credentials from a client to a web service can sometimes be tricky, especially with WCF (Windows Communication Foundation) services. Here are a few steps and considerations that can help you troubleshoot the issue and ensure that credentials are transmitted properly.
### 1. Ensure the Binding Supports... | 45,899 | [
{
"from": "human",
"value": "I have a web service (WCF or ASMX doesn't matter)... I have made a Console application, right-clicked, added service referrence. So far, so good.\nHowever, I cannot for the life of me pass \"security\" credentials across to my service. This is my client code:\nvar client = new M... |
I'm trying to add a special markup to Python documentation strings in emacs (python-mode).
Currently I'm able to extract a single line with:
(font-lock-add-keywords
'python-mode
'(("\\(\"\\{3\\}\\.+\"\\{3\\}\\)"
1 font-lock-doc-face prepend)))
This works now:
"""Foo"""
But as soon there is a newline like:
"""
F... | To modify your Emacs configuration so that it can match multi-line documentation strings in Python (triple double quotes), you'll need to adjust your regular expression to account for newlines. In Emacs Lisp, you can use the `.*?` pattern in a way that allows it to match everything, including newlines.
Here's how you ... | 44,942 | [
{
"from": "human",
"value": "I'm trying to add a special markup to Python documentation strings in emacs (python-mode).\nCurrently I'm able to extract a single line with:\n(font-lock-add-keywords\n 'python-mode\n '((\"\\\\(\\\"\\\\{3\\\\}\\\\.+\\\"\\\\{3\\\\}\\\\)\"\n 1 font-lock-doc-face prepend)))\n\nT... |
I am wondering if it is possible to validate parameters to (custom) .net attributes. eg: If I had an attribute that takes a positive integer, could I force a compile time error when a negative value was supplied?
[DonkeyAttribute(1)] //OK
[DonkeyAttribute(-828)] //error
In this example I could use an unsigned integer ... | In .NET, custom attributes are defined using classes that inherit from `System.Attribute`, and attribute parameters are validated at runtime, not compile-time. This means you cannot enforce compile-time checks directly on the values passed to attributes in the way you're describing. However, there are a few approaches ... | 48,664 | [
{
"from": "human",
"value": "I am wondering if it is possible to validate parameters to (custom) .net attributes. eg: If I had an attribute that takes a positive integer, could I force a compile time error when a negative value was supplied?\n[DonkeyAttribute(1)] //OK\n[DonkeyAttribute(-828)] //error\nIn t... |
Is it good practice to have more than one try{} catch{} statement per method?
| Using multiple `try-catch` statements within a single method can be both good and bad practice, depending on the context and purpose of the error handling. Here are some considerations to help you determine whether it's appropriate in your specific case:
### When It May Be Good Practice:
1. **Granularity of Error Han... | 45,847 | [
{
"from": "human",
"value": "Is it good practice to have more than one try{} catch{} statement per method?\n"
},
{
"from": "gpt",
"value": "Using multiple `try-catch` statements within a single method can be both good and bad practice, depending on the context and purpose of the error handling. ... |
I have been trying to encrypt soap message and send to the server, so that the server can decrypt, process the message, encrypt the response again and send back to the client...
I short i want to implement security in ASMX web services....
Please help me
Thanks
Sandeep
| Implementing encryption for ASMX web services can be a good way to secure your SOAP messages. Below are general steps to achieve this, including encryption of the request and response messages.
### Step 1: Encrypt the SOAP Request
You can use various encryption algorithms, but for simplicity, let's use AES (Advanced ... | 42,640 | [
{
"from": "human",
"value": "I have been trying to encrypt soap message and send to the server, so that the server can decrypt, process the message, encrypt the response again and send back to the client...\nI short i want to implement security in ASMX web services....\nPlease help me\nThanks \nSandeep\n"
... |
We are trying to develop an application to view and annotate PDF files in ASP.net.
The function involves capturing x,y coordinates from a click and placing the annotation on that specific location.
Are there available components to do this?
Thanks in advance.
| Yes, there are several libraries and components available that can help you develop an application to view and annotate PDF files in ASP.NET. Here are some popular options:
### 1. **PDF.js**
- **Description**: An open-source JavaScript library created by Mozilla for rendering PDF documents in web applications.
- **Usa... | 44,266 | [
{
"from": "human",
"value": "We are trying to develop an application to view and annotate PDF files in ASP.net. \nThe function involves capturing x,y coordinates from a click and placing the annotation on that specific location.\nAre there available components to do this?\nThanks in advance.\n"
},
{
... |
I have an array filled with values (twitter ids) and I would like to find the missing data between the lowest id and the highest id? Any care to share a simple function or idea on how to do this?
Also, I was wondering if I can do the same with mySQL? I have the key indexed. The table contains 250k rows right now, so a ... | Certainly! Let’s tackle both your requests: finding missing IDs in an array and querying MySQL efficiently.
### Finding Missing IDs in an Array
Here’s a simple function in Python that will help you find the missing Twitter IDs between the minimum and maximum ID in your array:
```python
def find_missing_ids(twitter_i... | 45,066 | [
{
"from": "human",
"value": "I have an array filled with values (twitter ids) and I would like to find the missing data between the lowest id and the highest id? Any care to share a simple function or idea on how to do this?\nAlso, I was wondering if I can do the same with mySQL? I have the key indexed. The... |
In our project the Java webservice communicate with the backend program written in C and Perl to process. We are using the ProcessBuilderto execute a backend (UNIX) job FrameworkHandler.
ProcessBuilder process;
process.Start(FrameworkHandler -a ACTION)
FrameworkHandler invokes a Perl script to perform some action. Th... | The issue you are experiencing appears to stem from the way standard error output is handled when executing the Perl script via the Java web service. When you run the Perl script in a Unix shell, the terminal can handle the output and any potential blocking issues differently compared to when it is executed through a J... | 45,311 | [
{
"from": "human",
"value": "In our project the Java webservice communicate with the backend program written in C and Perl to process. We are using the ProcessBuilderto execute a backend (UNIX) job FrameworkHandler.\nProcessBuilder process;\nprocess.Start(FrameworkHandler -a ACTION)\n\nFrameworkHandler invo... |
$(document).ready(function() {
$("span.link").mouseover(function(e){
$(this.children).css("display","inline");
});
});
I'm not a javascript expert, but I've cobbled together a few functions using jQuery.
In this case, the stylesheet hides some controls. When the user mouses over, thi... | It looks like you're trying to change the display property of child elements when the user hovers over a specific span. The issue you're facing in Firefox may be due to the way you're accessing the child elements. Specifically, the `this.children` is not being used correctly in jQuery.
Instead of using `this.children`... | 47,310 | [
{
"from": "human",
"value": "$(document).ready(function() {\n $(\"span.link\").mouseover(function(e){\n $(this.children).css(\"display\",\"inline\"); \n });\n }); \n\nI'm not a javascript expert, but I've cobbled together a few functions using jQuery. \nIn this case, the styleshe... |
This is a purely theoretical question.
Given three simple classes:
class Base {
}
class Sub extends Base {
}
class SubSub extends Sub {
}
And a function meant to operate on these classes:
public static void doSomething(Base b) {
System.out.println("BASE CALLED");
}
public static void doSomething(Sub b) {
Sys... | In Java, method resolution for overloaded methods is determined by the most specific applicable method during compile time. When you call a method with an argument of a specific type, the Java compiler will look at the available method overloads and choose the one that is the most specific match for the argument type. ... | 48,113 | [
{
"from": "human",
"value": "This is a purely theoretical question.\nGiven three simple classes:\nclass Base {\n}\n\nclass Sub extends Base {\n} \n\nclass SubSub extends Sub {\n}\n\nAnd a function meant to operate on these classes:\npublic static void doSomething(Base b) {\n System.out.println(\"BASE CA... |
I want to place this UserControl at Canvas.Left="168", Canvas.Top="213".
However, the control appears at a corner. What should I do?
If I put the values at the point of usage for this class, the values are returned as NaN
In that case how can I get the correct Left and Top Values?
Usage:
<Canvas x:Name="DesignerCa... | In WPF, when placing a control in a `Canvas`, the `Canvas.Left` and `Canvas.Top` attached properties must be set directly on the control that you're placing inside the `Canvas`. Setting `Canvas.Left` and `Canvas.Top` directly on a `UserControl` or any container that has child elements won't affect the positioning of th... | 45,856 | [
{
"from": "human",
"value": "I want to place this UserControl at Canvas.Left=\"168\", Canvas.Top=\"213\".\nHowever, the control appears at a corner. What should I do?\nIf I put the values at the point of usage for this class, the values are returned as NaN\nIn that case how can I get the correct Left and T... |
I was wondering if there is a JOptionPane where you can get multiple inputs from a user instead of just one? If not, how could i accomplish this using some type of prompt. I am creating Battleship, and wanted to prompt the user to specify locations to place each ship.
Thanks,
Tomek
| JOptionPane does not directly support multiple input fields in a single dialog; however, you can create a custom dialog that allows you to collect multiple inputs from the user. Below, I'll provide an example of how you can accomplish this by creating a custom dialog to collect the ship locations for your Battleship ga... | 42,697 | [
{
"from": "human",
"value": "I was wondering if there is a JOptionPane where you can get multiple inputs from a user instead of just one? If not, how could i accomplish this using some type of prompt. I am creating Battleship, and wanted to prompt the user to specify locations to place each ship.\nThanks,\n... |
When I am creating a test project in Visual Studio, do I just create a C# console project type, then import Nunit?
Does the GUI then hook into this project somehow?
There seems to be tons of nunit related .dll's, which ones do I need?
| When you want to create a test project using NUnit in Visual Studio, you typically follow these steps:
### Creating the Test Project
1. **Create a New Project**:
- Open Visual Studio.
- Go to `File` > `New` > `Project`.
- Choose **Test** from the project types, and select **NUnit Test Project**. This project... | 43,655 | [
{
"from": "human",
"value": "When I am creating a test project in Visual Studio, do I just create a C# console project type, then import Nunit?\nDoes the GUI then hook into this project somehow?\nThere seems to be tons of nunit related .dll's, which ones do I need?\n"
},
{
"from": "gpt",
"value"... |
I want to match any line that does not end with 'CA' or 'CA[any number]'. How can I do that using rlike in MySQL? (Note it doesn't support ?! etc).
Here's the regex for a positive match, I just need a way to negate it: '^.*[C][A][0-9]?$'
(Due to an embarrassing architecture limitation, I don't want to use not rlike ... | In MySQL, since you cannot use negative lookaheads with `rlike`, you can achieve your goal by crafting a regular expression that matches any line that does **not** end with 'CA' or 'CA' followed by any number.
To do this, you need to create a regex that matches lines that do not conform to the patterns you want to exc... | 47,502 | [
{
"from": "human",
"value": "I want to match any line that does not end with 'CA' or 'CA[any number]'. How can I do that using rlike in MySQL? (Note it doesn't support ?! etc).\nHere's the regex for a positive match, I just need a way to negate it: '^.*[C][A][0-9]?$'\n(Due to an embarrassing architecture... |
is there really a MVC PetShop application? ScottGu mentioned something, but was he kidding?
Update
Yes, but have they done it in 3.5?
| Yes, there is a well-known MVC PetShop application that has been referenced in various ASP.NET documentation and talks, including those by Scott Guthrie (ScottGu). The PetShop application is often used as a sample application to demonstrate various concepts of the ASP.NET MVC framework.
The original PetShop sample was... | 49,638 | [
{
"from": "human",
"value": "is there really a MVC PetShop application? ScottGu mentioned something, but was he kidding?\n\nUpdate\n\nYes, but have they done it in 3.5?\n"
},
{
"from": "gpt",
"value": "Yes, there is a well-known MVC PetShop application that has been referenced in various ASP.NET... |
I have a dataset in MySQL where using limit is already an expensive query, and finding the number of results is expensive as well. Thus, I'd like to avoid doing another query to find the number of results. I cannot use MYSQL_CALC_FOUND_ROWS because the limit is inside a subquery:
SELECT * FROM items,
(
SELECT
i... | When dealing with pagination in a scenario where you cannot afford the overhead of running additional queries to determine the total count of results, and when `MYSQL_CALC_FOUND_ROWS` is not feasible due to the use of subqueries, you can consider a few alternative approaches:
### 1. Approximate Total Count
Instead of ... | 43,762 | [
{
"from": "human",
"value": "I have a dataset in MySQL where using limit is already an expensive query, and finding the number of results is expensive as well. Thus, I'd like to avoid doing another query to find the number of results. I cannot use MYSQL_CALC_FOUND_ROWS because the limit is inside a subque... |
I have a virtual path (example: "~/Images/Banner.jpg") and I want to make that an absolute web path (example: "/ApplicationRoot/Images/Banner.jpg"). There is a method that will do this, I believe in a class called something like HTTPUtility or similar name. Though ever time I need this method, it takes me hours sea... | To convert a virtual path (like `~/Images/Banner.jpg`) to an absolute web path in ASP.NET, you can use the `VirtualPathUtility` class, which is part of the `System.Web` namespace. The method you're looking for is `VirtualPathUtility.ToAbsolute`.
Here's how you can use it:
```csharp
using System.Web;
string virtualPa... | 49,361 | [
{
"from": "human",
"value": "I have a virtual path (example: \"~/Images/Banner.jpg\") and I want to make that an absolute web path (example: \"/ApplicationRoot/Images/Banner.jpg\"). There is a method that will do this, I believe in a class called something like HTTPUtility or similar name. Though ever t... |
Previous programmer left me with "beautiful" piece of code and he kind of forgot to apply something to it. There is a query which selects several items from several tables.
6 Items can be chosen. It means 6 tables can be chosen, however there can be more tables - even 20 of them. I need to get that list of tables from ... | In SQL, there's no built-in command that will directly return the list of tables used in a query after it has been executed, especially if the query has been processed and executed by the database. However, there are a few ways you can approach this issue, depending on the database system you are using and how you want... | 46,345 | [
{
"from": "human",
"value": "Previous programmer left me with \"beautiful\" piece of code and he kind of forgot to apply something to it. There is a query which selects several items from several tables.\n6 Items can be chosen. It means 6 tables can be chosen, however there can be more tables - even 20 of t... |
I have very simple html report generated from one of my objects on server. I generate html code at PageLoad because I need to clear that object from session and don't want ask external web service for data after user clicks on link button.
Roughly idea is that user clicks on button on page and the report will be disp... | To achieve your goal of displaying an HTML report in a new window without saving it to the file system, you have a few options. Given your requirements and constraints, I suggest using the following approach:
1. **Store HTML in a ViewState or Session**: You can store the generated HTML string in the `ViewState` or `Se... | 46,797 | [
{
"from": "human",
"value": "I have very simple html report generated from one of my objects on server. I generate html code at PageLoad because I need to clear that object from session and don't want ask external web service for data after user clicks on link button. \nRoughly idea is that user clicks on ... |
I am trying to open an InfoPath 2007 file programmatically from a Windows service, but I get the following error:
System.Runtime.InteropServices.COMException
(0x80043000): InfoPath cannot open the
following file: C:\path\datafile.xml.
Not enough storage is available to
complete this operation.
This file open... | Running Microsoft Office applications, like InfoPath, from a Windows service can lead to various issues because of differences in the execution environment. Here are some potential issues and solutions to consider:
### 1. Permissions and User Context
Windows services typically run under the Local System account, which... | 44,655 | [
{
"from": "human",
"value": "I am trying to open an InfoPath 2007 file programmatically from a Windows service, but I get the following error:\n\nSystem.Runtime.InteropServices.COMException\n (0x80043000): InfoPath cannot open the\n following file: C:\\path\\datafile.xml. \n Not enough storage is availab... |
I've generated a certificate request, submitted it to the Microsoft Certificate Services program. It issues the certificate. I downloaded it to conf/ssl/server.cert
I configured it in apache to using
SSLCertificateFile conf/ssl/server.cert
SSLCertificateKeyFile conf/ssl/server.key
When I start the server with this co... | It looks like you are trying to configure Apache to use a certificate issued by Microsoft Certificate Services but are encountering issues with the SSL setup. Here's how to troubleshoot and fix the configuration:
### 1. Certificate and Key Files
Make sure your certificate and key files are correctly specified in your... | 44,924 | [
{
"from": "human",
"value": "I've generated a certificate request, submitted it to the Microsoft Certificate Services program. It issues the certificate. I downloaded it to conf/ssl/server.cert\nI configured it in apache to using \nSSLCertificateFile conf/ssl/server.cert\nSSLCertificateKeyFile conf/ssl/serv... |
Our company currently runs two Windows 2003 servers (a web server & a MSSQL 8 database server). We're planning to add another couple of servers for redundancy / availability purposes in a web farm setup. Our web sites are predominately ASP.NET, we do have a few PHP sites, but these are mainly static with no DB.
Does an... | Upgrading your infrastructure from Windows Server 2003 to Windows Server 2008 (or later) is a significant step, and there are many factors to consider in terms of redundancy, availability, and performance for your web applications. Here are some "gotchas" and points to consider, as well as the benefits of moving to Win... | 43,314 | [
{
"from": "human",
"value": "Our company currently runs two Windows 2003 servers (a web server & a MSSQL 8 database server). We're planning to add another couple of servers for redundancy / availability purposes in a web farm setup. Our web sites are predominately ASP.NET, we do have a few PHP sites, but th... |
We have a button that saves asynchronously using AjaxToolKit/C#/.NET. I'm getting this in my Error Console:
Error: [Exception... "'Sys.WebForms.PageRequestManagerServerErrorException: Sys.WebForms.PageRequestManagerServerErrorException:
An unknown error occurred while processing the request on the server. The status c... | It sounds like you encountered a classic case of issues arising from changes in the server-side processing of your ASP.NET application with AJAX. The behavior you're experiencing can often stem from data validation or control updates that inadvertently affect how your application behaves across different environments.
... | 45,881 | [
{
"from": "human",
"value": "We have a button that saves asynchronously using AjaxToolKit/C#/.NET. I'm getting this in my Error Console:\nError: [Exception... \"'Sys.WebForms.PageRequestManagerServerErrorException: Sys.WebForms.PageRequestManagerServerErrorException:\nAn unknown error occurred while proces... |
What options do I have to read the roles of the current user from my JSP pages? I'm aware of the visibleOnUserRole="myRole" attribute on Tomahawk components, but I need roles for a bit more complicated things than simple visibility.
| To read and manage user roles in JSP pages, particularly in a Java EE environment, there are several options you can explore. Here are a few approaches that you can consider:
### 1. **Using Java EE Security Context**
If you are running a Java EE application, you can leverage the `javax.annotation.security` and `javax.... | 41,434 | [
{
"from": "human",
"value": "What options do I have to read the roles of the current user from my JSP pages? I'm aware of the visibleOnUserRole=\"myRole\" attribute on Tomahawk components, but I need roles for a bit more complicated things than simple visibility.\n"
},
{
"from": "gpt",
"value": ... |
I have a button inside an update panel that I would like to update the whole page. I have set ChildrenAsTriggers="false" and UpdateMode="Conditional".
I have some sample code here that demonstrates my problem.
<asp:UpdatePanel ID="myFirstPanel" runat="server" ChildrenAsTriggers="false" UpdateMode="Conditional">
<Con... | To achieve the desired functionality of updating a label outside an `UpdatePanel` when clicking a button inside another `UpdatePanel`, you need to ensure that the postback triggered by the second button can also trigger the update of the label outside the `UpdatePanel`.
Since you have set `ChildrenAsTriggers` to `fals... | 43,996 | [
{
"from": "human",
"value": "I have a button inside an update panel that I would like to update the whole page. I have set ChildrenAsTriggers=\"false\" and UpdateMode=\"Conditional\".\nI have some sample code here that demonstrates my problem.\n<asp:UpdatePanel ID=\"myFirstPanel\" runat=\"server\" ChildrenA... |
PHP5.2.x back end. The text data transfer is using JSON objects.
Am looking at how best to transfer around 10, 30kB PNG images from the server to the iPhone client.
Have looked at Base64 encoding the images on the server and using JSON to transport. However this does come with a 30% overhead in increased filesize.
P... | When transferring images, especially when considering mobile clients like an iPhone, there are several factors to consider: efficiency, performance, and user experience. Here are some points to consider regarding your options for transferring 30kB PNG images from the server to the client:
### Base64 Encoding
1. **Pro... | 47,222 | [
{
"from": "human",
"value": "PHP5.2.x back end. The text data transfer is using JSON objects.\nAm looking at how best to transfer around 10, 30kB PNG images from the server to the iPhone client.\nHave looked at Base64 encoding the images on the server and using JSON to transport. However this does come w... |
I'm performing a bulk insert with an ADO.NET 2.0 SqlBulkCopy object from a C# method into a MS SQL 2005 database, using a database user with limited permissions. When I try to run the operation, I get the error message:
Bulk copy failed. User does not have
ALTER TABLE permission on table
'theTable'. ALTER
TABLE... | The issue you're facing is related to SQL Server's security model for bulk copy operations, particularly concerning permissions and the presence of triggers or check constraints on the target table.
### Explanation:
When performing a bulk insert operation using `SqlBulkCopy`, SQL Server requires the user to have `ALTE... | 46,423 | [
{
"from": "human",
"value": "I'm performing a bulk insert with an ADO.NET 2.0 SqlBulkCopy object from a C# method into a MS SQL 2005 database, using a database user with limited permissions. When I try to run the operation, I get the error message:\n\nBulk copy failed. User does not have\n ALTER TABLE per... |
Many of our transactions are comprised of calculations that are comprised of other calculations. How did you represent the hierarchy / execution graph to users? Was there a specific control you found that worked well?
How would you project the result of a change to one of the formulas before committing that alterat... | To effectively represent a hierarchy or execution graph of transactions that rely on complex calculations, it's essential to use a visual approach that allows users to easily comprehend relationships and dependencies between different calculations. Here are some strategies and controls that can work well:
### 1. **Vis... | 40,635 | [
{
"from": "human",
"value": "Many of our transactions are comprised of calculations that are comprised of other calculations. How did you represent the hierarchy / execution graph to users? Was there a specific control you found that worked well? \nHow would you project the result of a change to one of t... |
I am wondering if including image thumbnail information in the model makes sense. Like specifying what sizes of thumbnails you would like to be created. Thumbnail directory. Etc.
Also when working with thumbnails and a database, Is it advisable to store all created thumbnails as new records in the database. Say you hav... | Including image thumbnail information in your model can make a lot of sense, especially if your application frequently uses thumbnails and you want to maintain a consistent approach to managing them. Here are a few considerations regarding thumbnail management:
### Including Thumbnail Information in the Model
1. **Th... | 47,914 | [
{
"from": "human",
"value": "I am wondering if including image thumbnail information in the model makes sense. Like specifying what sizes of thumbnails you would like to be created. Thumbnail directory. Etc.\nAlso when working with thumbnails and a database, Is it advisable to store all created thumbnails a... |
I want to make a simple app, ideally in Python, that would run in the background on KDE, listening to all keystrokes being done by the user, so that the app goes to the foreground if a specific combination of keys is pressed. Is that doable? Can anyone point me to such resource?
| Creating an application that listens to all keystrokes and reacts to a specific combination of keys involves handling low-level keyboard events, which can raise privacy and security concerns. Nonetheless, if you are aware of the implications and have the proper permissions, you can implement such functionality on a KDE... | 44,250 | [
{
"from": "human",
"value": "I want to make a simple app, ideally in Python, that would run in the background on KDE, listening to all keystrokes being done by the user, so that the app goes to the foreground if a specific combination of keys is pressed. Is that doable? Can anyone point me to such resource?... |
Ok, what I'm trying to do is build a web app that allows students to visually organize their class calendar using drag and drop. but They have to be able to drag and drop to specific locations (when those classes are available), not just anywhere.
This would be a 'fixed week' calendar. I was considering using a table, ... | Building a web app that allows students to visually organize their class calendar with drag-and-drop functionality is a great idea! Here are some considerations, suggestions, and possible implementations you might want to explore:
### Implementation Suggestions
1. **Grid-Based Layout**:
- Using a **CSS Grid** layo... | 43,674 | [
{
"from": "human",
"value": "Ok, what I'm trying to do is build a web app that allows students to visually organize their class calendar using drag and drop. but They have to be able to drag and drop to specific locations (when those classes are available), not just anywhere.\nThis would be a 'fixed week' c... |
I'm trying to write a macro that would allow me to do something like: FORMAT(a << "b" << c << d), and the result would be a string -- the same as creating an ostringstream, inserting a...d, and returning .str(). Something like:
string f(){
ostringstream o;
o << a << "b" << c << d;
return o.str()
}
Essentially... | The issue you're encountering with your `FORMAT` macro is primarily due to how C++ handles temporary objects and the way you are attempting to use an `ostringstream` in a macro context. Let's address your concerns step by step.
### Explanation of Issues
1. **First Macro Attempt**:
```cpp
#define FORMAT(items) (... | 46,166 | [
{
"from": "human",
"value": "I'm trying to write a macro that would allow me to do something like: FORMAT(a << \"b\" << c << d), and the result would be a string -- the same as creating an ostringstream, inserting a...d, and returning .str(). Something like:\nstring f(){\n ostringstream o;\n o << a << \... |
I've read a lot of comments mention in passing that the BlackBerry threading model deviates from the Java standard and can cause issues, but no amount of googling has enlightened me on what this means exactly.
I've been developing a fairly large business application for the BlackBerry and, although I don't really have ... | The BlackBerry platform indeed has a unique threading model compared to the standard Java framework, which can lead to some challenges for developers who are accustomed to standard Java multi-threading. Here are some key differences and considerations for working with threads on BlackBerry:
### Key Differences in Blac... | 45,405 | [
{
"from": "human",
"value": "I've read a lot of comments mention in passing that the BlackBerry threading model deviates from the Java standard and can cause issues, but no amount of googling has enlightened me on what this means exactly.\nI've been developing a fairly large business application for the Bla... |
I'm using Parsley IoC in my current Flex project. So I'd like to embed the container configuration XML onto the result SWF.
How could I load embedded XML file into action script XML object?
| To load an embedded XML file into an ActionScript XML object in your Flex project, you can follow these steps:
1. **Embed the XML file**: Use the `@Embed` metadata tag to embed your XML file into your ActionScript class. Here’s an example of how to do that:
```actionscript
package {
import flash.displ... | 49,136 | [
{
"from": "human",
"value": "I'm using Parsley IoC in my current Flex project. So I'd like to embed the container configuration XML onto the result SWF. \nHow could I load embedded XML file into action script XML object?\n"
},
{
"from": "gpt",
"value": "To load an embedded XML file into an Actio... |
I feel like developers talk about memory leaks but when you ask them what that means many have no idea. To prevent these situations, let's decide on one.
Please no Wikipedia definitions...
What is your best definition of a
memory leak and what is the best way
to prevent them?
| A **memory leak** occurs when a program allocates memory but fails to release it back to the system after it's no longer needed. This leads to a gradual increase in memory usage, which can eventually exhaust available memory resources and slow down or crash the application. Memory leaks often happen when references to ... | 48,576 | [
{
"from": "human",
"value": "I feel like developers talk about memory leaks but when you ask them what that means many have no idea. To prevent these situations, let's decide on one.\nPlease no Wikipedia definitions...\n\nWhat is your best definition of a\n memory leak and what is the best way\n to preve... |
I've got a question about renaming a file after it's been uploaded in Zend. I don't know where to put the Rename Filter. Here's what I've got. I've tried moving things around, but I'm lost. Currently it does upload the file to my photos folder, but it doesn't rename it. Thanks for any help!
if($this->_request->isPost()... | It looks like you're using Zend Framework's file upload functionality, and you want to apply a Rename filter to the uploaded file. The Rename filter should be applied before you call the `receive()` method, and it should use the correct original file name and desired destination.
Here's an adjusted version of your cod... | 47,383 | [
{
"from": "human",
"value": "I've got a question about renaming a file after it's been uploaded in Zend. I don't know where to put the Rename Filter. Here's what I've got. I've tried moving things around, but I'm lost. Currently it does upload the file to my photos folder, but it doesn't rename it. Thanks f... |
I have a text file with dos elements - hex(00) for example. I need to read it and convert it. I have tried to use utf8toansi, but this removes the whole line with hex(00). Are there any way to convert to text in the whole file ?
I am using win32, RadStudio2007, Delphi.
| In Delphi, specifically using RadStudio 2007, if you are dealing with a text file that contains DOS elements represented by hex(00), you would want to read the file while preserving the other content, but removing or replacing the null characters (hex(00)).
Here’s a step-by-step guide to read the file and convert it p... | 48,776 | [
{
"from": "human",
"value": "I have a text file with dos elements - hex(00) for example. I need to read it and convert it. I have tried to use utf8toansi, but this removes the whole line with hex(00). Are there any way to convert to text in the whole file ? \nI am using win32, RadStudio2007, Delphi.\n"
},... |
Given a DOM element how do I find its nearest parent with a given css class?
$(".editButton").click(function() {
(magic container selector goes here).addClass("editing");
});
I don't want to use lots or $(...).parent().parent() since I don't want to be bound to a particular dom structure.
| To find the nearest parent element with a specific CSS class in jQuery, you can use the `.closest()` method. This method traverses up the DOM tree from the current element and returns the first ancestor that matches the specified selector.
Here's how you can use it in your code:
```javascript
$(".editButton").click(f... | 49,675 | [
{
"from": "human",
"value": "Given a DOM element how do I find its nearest parent with a given css class?\n$(\".editButton\").click(function() {\n (magic container selector goes here).addClass(\"editing\");\n});\n\nI don't want to use lots or $(...).parent().parent() since I don't want to be bound to a pa... |
I'm writing a small and inadequate linear algebra library in C++ for a project (I'm sorry). I'm implementing matrices and operations using double precision numbers. I'm doing right? Should I implement a template class instead? Is there a more precise type around?
| It's great that you're taking on the challenge of creating a linear algebra library in C++! Using double precision (i.e., `double`) is a common and often suitable choice for many applications. However, whether you should implement a template class or use a specific type depends on your goals for the library.
### Consi... | 47,975 | [
{
"from": "human",
"value": "I'm writing a small and inadequate linear algebra library in C++ for a project (I'm sorry). I'm implementing matrices and operations using double precision numbers. I'm doing right? Should I implement a template class instead? Is there a more precise type around?\n"
},
{
... |
If I'm trying to match a quote-delimited string with a regex, which of the following is "better" (where "better" means both more efficient and less likely to do something unexpected):
/"[^"]+"/ # match quote, then everything that's not a quote, then a quote
or
/".+?"/ # match quote, then *anything* (non-greedy), the... | When comparing the two regex patterns you provided for matching quote-delimited strings, we can analyze their efficiency and potential for unexpected behavior.
1. **Pattern 1: `/"[^"]+"/`**
- This pattern matches a double quote, followed by one or more characters that are not double quotes, and then another double ... | 48,870 | [
{
"from": "human",
"value": "If I'm trying to match a quote-delimited string with a regex, which of the following is \"better\" (where \"better\" means both more efficient and less likely to do something unexpected):\n/\"[^\"]+\"/ # match quote, then everything that's not a quote, then a quote\n\nor\n/\".+?... |
The only plug-ins I use are the ones required to do my job like SoapUI, Maven and SVN. I'm wondering if maybe there are some plug-ins out there that might make my life easier. Are there any Eclipse plug-ins that you find invaluable?
| Certainly! Eclipse has a rich ecosystem of plugins that can enhance your development experience and productivity. Here are some invaluable plugins that might make your life easier:
1. **Eclipse Code Recommenders**: This plugin provides intelligent code completion and suggestions based on the context, which can help sp... | 46,858 | [
{
"from": "human",
"value": "The only plug-ins I use are the ones required to do my job like SoapUI, Maven and SVN. I'm wondering if maybe there are some plug-ins out there that might make my life easier. Are there any Eclipse plug-ins that you find invaluable? \n"
},
{
"from": "gpt",
"value"... |
I don't use a mac much so my exposure is minimal but can I safely presume that IE on the Mac is dead?
I know that Microsoft isn't developing it any further and that Firefox, Safari (Opera and Camino) all run on Mac (and from my stats they are most used, in that order)...
So the question is: Is it dead? and if so, when ... | Yes, you can safely presume that Internet Explorer (IE) on the Mac is effectively dead. Microsoft discontinued support for Internet Explorer for Mac in 2003, and the last version (IE 5.2) was released back then. Since then, Microsoft has not developed or maintained any versions of Internet Explorer for macOS.
The gene... | 49,574 | [
{
"from": "human",
"value": "I don't use a mac much so my exposure is minimal but can I safely presume that IE on the Mac is dead?\nI know that Microsoft isn't developing it any further and that Firefox, Safari (Opera and Camino) all run on Mac (and from my stats they are most used, in that order)...\nSo th... |
The GUI for managing plugins in Eclipse got a bit of an overhaul in version 3.4.0.
This GUI is accessed via the "Software Updates..." option in the Help menu.
The option to remove the selected Mylyn plugin is greyed out. In fact, this is true of virtually every installed plugin. I know that the Mylyn plugins are option... | In Eclipse, when you encounter a situation where the option to remove installed plugins is greyed out, it usually indicates a few potential issues:
1. **Plugin Dependencies**: Some plugins depend on others to function correctly. If the Mylyn plugin or any of its components are tied to other installed plugins or featur... | 48,115 | [
{
"from": "human",
"value": "The GUI for managing plugins in Eclipse got a bit of an overhaul in version 3.4.0.\nThis GUI is accessed via the \"Software Updates...\" option in the Help menu.\nThe option to remove the selected Mylyn plugin is greyed out. In fact, this is true of virtually every installed plu... |
How do i unset a already set flag using fcntl?
For e.g. I can set the socket to nonblocking mode using
fcntl(sockfd, F_SETFL, flags | O_NONBLOCK)
Now, i want to unset the O_NONBLOCK flag.
I tried fcntl(sockfd, F_SETFL, flags | ~O_NONBLOCK). It gave me error EINVAL
| To unset a flag using `fcntl` on a file descriptor (like a socket), you need to retrieve the current flags, manipulate them to remove the desired flag, and then set the modified flags back.
The issue with your attempt (`fcntl(sockfd, F_SETFL, flags | ~O_NONBLOCK)`) is that the bitwise OR operation (`|`) does not corr... | 49,232 | [
{
"from": "human",
"value": "How do i unset a already set flag using fcntl?\nFor e.g. I can set the socket to nonblocking mode using \nfcntl(sockfd, F_SETFL, flags | O_NONBLOCK)\n\nNow, i want to unset the O_NONBLOCK flag.\nI tried fcntl(sockfd, F_SETFL, flags | ~O_NONBLOCK). It gave me error EINVAL\n"
},... |
I am trying to dynamically generate links to files on a network share that will work in both IE and safari. In IE, doing href=\\networksharename\foldername\filename works fine, and we thought this worked fine on safari in our initial testing, but our safari users are reporting page cannot be displayed. These are pdf ... | When trying to create links to network shares that work across different browsers, such as Internet Explorer and Safari, you may encounter compatibility issues due to how different browsers handle file URLs.
### Why the Issue Occurs:
1. **URL Format**: The format `href=\\networksharename\foldername\filename` is specif... | 48,556 | [
{
"from": "human",
"value": "I am trying to dynamically generate links to files on a network share that will work in both IE and safari. In IE, doing href=\\\\networksharename\\foldername\\filename works fine, and we thought this worked fine on safari in our initial testing, but our safari users are report... |
I have a little utility that does a search of a number of files. I had to create it because both Google & Windows desktop searches were not finding the appropriate lines in files. The searching works fine (I am willing to improve on it) but one of the things I would like to add to my util is a batch find/replace.
So ho... | To implement a batch find/replace functionality in your utility, you'll want to read the contents of the file line by line, check each line against the search term, and replace the line if it meets the criteria. Then you would write the updated lines back to the file. Below is a simple implementation in Python to illus... | 45,331 | [
{
"from": "human",
"value": "I have a little utility that does a search of a number of files. I had to create it because both Google & Windows desktop searches were not finding the appropriate lines in files. The searching works fine (I am willing to improve on it) but one of the things I would like to add ... |
In Flash, I can prompt the user for a location to save a file and write a file to that location. In my case, the user wants to download a large set of files. Is there a way to let the user choose a directory once and download a number of files into that directory without prompting the user for each file?
| In Flash, specifically in ActionScript, there is no direct way to allow users to choose a directory for saving multiple files without prompting them for each individual file. Flash's security model restricts file system access, and it only allows file saving through user prompts for each file, primarily to maintain use... | 47,947 | [
{
"from": "human",
"value": "In Flash, I can prompt the user for a location to save a file and write a file to that location. In my case, the user wants to download a large set of files. Is there a way to let the user choose a directory once and download a number of files into that directory without promp... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.