instruction stringlengths 14 27.6k | completion stringlengths 3 38.3k | __original_row_idx int64 0 50k | conversations listlengths 2 2 |
|---|---|---|---|
I've got several developers about to start working on the front end of a jquery-based web application. How can we structure the application so that multiple developers can work on the ui at the same time. The end result for the user will just be one web "page", but I don't all of the client development to occur in one ... | To facilitate multiple developers working on the front end of a jQuery-based web application without conflicts and maintain a modular structure, consider the following strategies:
### 1. Modular Structure
#### a. Component-Based Approach
- **Break Down UI into Components**: Identify reusable components (e.g., navigat... | 25,447 | [
{
"from": "human",
"value": "I've got several developers about to start working on the front end of a jquery-based web application. How can we structure the application so that multiple developers can work on the ui at the same time. The end result for the user will just be one web \"page\", but I don't all... |
Can anyone suggest some references or other resources that are useful in learning MCML?
I have a small pet project I have been working on for a while using C# and .Net 3.5. I have reached a point where I want to be able to send output from it to Windows Media Center, but I have been having a hard time finding coherent ... | Learning MCML (Media Center Markup Language) can be a bit challenging, especially when looking to integrate it with C# and .NET. Here are some resources and references that might help you in your project:
1. **Official Documentation:**
- **Windows Media Center SDK:** Start with the official [Windows Media Center SD... | 24,662 | [
{
"from": "human",
"value": "Can anyone suggest some references or other resources that are useful in learning MCML?\nI have a small pet project I have been working on for a while using C# and .Net 3.5. I have reached a point where I want to be able to send output from it to Windows Media Center, but I have... |
I have an exception handler .
In my asp.net application.
It’s written in Global.asax.
In the the Application_Error() method.
It works for Exceptions that happen in the context of pages and classes that are called as a result of a request to the application.
But if I spawn a thread, as a result of a request (or other ... | Handling exceptions in threads spawned from an ASP.NET application can indeed be tricky, as unhandled exceptions in those threads can crash the application domain. The `Application_Error` method in `Global.asax` only handles exceptions that occur in the request processing pipeline and not in background threads.
Here a... | 25,656 | [
{
"from": "human",
"value": "I have an exception handler .\nIn my asp.net application. \nIt’s written in Global.asax. \nIn the the Application_Error() method.\nIt works for Exceptions that happen in the context of pages and classes that are called as a result of a request to the application.\nBut if I spawn... |
I'd like to set up a large linear programming model to solve an interesting problem. I would be most comfortable in Java. What tools/libraries are available?
| There are several libraries and tools in Java that you can use for solving linear programming problems. Here are some of the most popular ones:
1. **Apache Commons Math**:
- This is a versatile library that includes various mathematical tools and algorithms, including optimization algorithms. While it is not solel... | 27,425 | [
{
"from": "human",
"value": "I'd like to set up a large linear programming model to solve an interesting problem. I would be most comfortable in Java. What tools/libraries are available?\n"
},
{
"from": "gpt",
"value": "There are several libraries and tools in Java that you can use for solving... |
I've been having a lot of problems with JSEclipse in Ganymede, but I haven't had much luck finding an alternative that's compatible with Ganymede (eclipse 3.4).
All I'm really looking for is code-highlighting. Anyone have any good alternatives, or do I just need to suck it up and get on with it?
| If you're experiencing issues with JSEclipse in Eclipse Ganymede (3.4) and are looking for alternatives that offer code highlighting for JavaScript, you have a few options to consider:
1. **JavaScript Development Tools (JSDT)**: While newer versions of Eclipse come with JSDT, you might be able to find an older version... | 29,770 | [
{
"from": "human",
"value": "I've been having a lot of problems with JSEclipse in Ganymede, but I haven't had much luck finding an alternative that's compatible with Ganymede (eclipse 3.4).\nAll I'm really looking for is code-highlighting. Anyone have any good alternatives, or do I just need to suck it up a... |
There's not a lot to add to the subject really.
I am after a free task board/ burndown reporting tool for Windows.
| There are several free task board and burndown reporting tools that you can use on Windows. Here are a few options:
1. **Trello**:
- Trello is a popular task management tool that uses boards, lists, and cards to organize tasks. While it primarily operates in a web browser, it also has desktop applications for Windo... | 26,730 | [
{
"from": "human",
"value": "There's not a lot to add to the subject really.\nI am after a free task board/ burndown reporting tool for Windows.\n"
},
{
"from": "gpt",
"value": "There are several free task board and burndown reporting tools that you can use on Windows. Here are a few options:\n\... |
Is it possible to create a user with permissions of both a local administrator and NETWORK SERVICE?
I've got a Sharepoint timer job which runs stsadm for which it needs local administrator permissions. On the other hand temer jobs are also used by other services which need NETWORK SERVICE permissions and those to sets ... | Creating a user with the combined permissions of both a local administrator and NETWORK SERVICE isn't directly feasible in Windows. Local administrator rights provide elevated privileges that are not typically granted to standard user accounts, while NETWORK SERVICE is a built-in account that has limited permissions an... | 28,747 | [
{
"from": "human",
"value": "Is it possible to create a user with permissions of both a local administrator and NETWORK SERVICE?\nI've got a Sharepoint timer job which runs stsadm for which it needs local administrator permissions. On the other hand temer jobs are also used by other services which need NETW... |
Is there a way to create/edit a table using MSHTML without resorting to editing the underlying HTML?
| Yes, you can create and edit a table using MSHTML (Microsoft HTML) without directly editing the underlying HTML by manipulating the Document Object Model (DOM) via JavaScript. Here are some methods you can use to create and edit a table programmatically:
### Creating a Table
1. **Using JavaScript to Create a Table**:... | 24,637 | [
{
"from": "human",
"value": "Is there a way to create/edit a table using MSHTML without resorting to editing the underlying HTML?\n"
},
{
"from": "gpt",
"value": "Yes, you can create and edit a table using MSHTML (Microsoft HTML) without directly editing the underlying HTML by manipulating the D... |
I'm looking for a make utility for building large java programs. I'm aware of ANT already, but want to see what else is available.
Ideally, it should be able to handle the .java->.class package directory weirdness that fouls up GNU Make.
Win32, but cross platform is a plus.
EDIT:
I see some cons to using ANT, which is ... | If you're looking for alternatives to Apache Ant for building large Java programs and you have concerns regarding its XML verbosity and complexity, here are several options you might consider:
1. **Maven**:
- **Description**: Maven is a widely used build automation tool for Java projects that uses a Project Object ... | 16,497 | [
{
"from": "human",
"value": "I'm looking for a make utility for building large java programs. I'm aware of ANT already, but want to see what else is available.\nIdeally, it should be able to handle the .java->.class package directory weirdness that fouls up GNU Make.\nWin32, but cross platform is a plus.\nE... |
In Eclipse (Ganymede) I'm debugging some code that uses Apache Commons HttpClient and would like to step into the HttpClient code. I've downloaded the source code and tried to attach it in the normal fashion (CTRL-click on the method name and use the Attach Source button). I've tried to attach both as external file and... | Debugging issues related to attaching source code in Eclipse can be quite frustrating, especially when you have successfully done it in the past. Below are some suggestions to help troubleshoot the issue you’re facing with attaching the source to the Apache Commons HttpClient library.
### 1. Check the Structure of Sou... | 23,692 | [
{
"from": "human",
"value": "In Eclipse (Ganymede) I'm debugging some code that uses Apache Commons HttpClient and would like to step into the HttpClient code. I've downloaded the source code and tried to attach it in the normal fashion (CTRL-click on the method name and use the Attach Source button). I've ... |
I just, quite anxiously, downloaded the spankin new WCF REST starter kit. The installed failed. Anyone else had this problem?
http://msdn.microsoft.com/en-us/netframework/cc950529.aspx
Edit: The install fails during the template installation. The VS JIT debugger window pops up. Nothing else is running the PC, I am runn... | It sounds like you're experiencing a frustrating issue with the WCF REST Starter Kit installation. Here are some troubleshooting steps you can take to try to resolve the installation failure:
1. **Ensure Visual Studio is Closed**: Make sure Visual Studio is completely closed before running the installer. Sometimes, ha... | 26,312 | [
{
"from": "human",
"value": "I just, quite anxiously, downloaded the spankin new WCF REST starter kit. The installed failed. Anyone else had this problem?\nhttp://msdn.microsoft.com/en-us/netframework/cc950529.aspx\nEdit: The install fails during the template installation. The VS JIT debugger window pops up... |
I'd like to how to upgrade the default python installation(2.5.2) supplied with ubuntu 8.04 to python 2.6rc2. I'd like to make 2.6 the default python version on the system and migrate all the other useful installed python libraries installed on 2.5.2 to python 2.6rc2. Please let me know how I can achieve this.
Thanks
D... | Upgrading the default Python version on an older Ubuntu system like 8.04 can be tricky, especially since many system components rely on the default Python interpreter. Here’s a general approach to upgrading Python while keeping your system functional, but please note that Ubuntu 8.04 is an extremely old release, and ma... | 21,541 | [
{
"from": "human",
"value": "I'd like to how to upgrade the default python installation(2.5.2) supplied with ubuntu 8.04 to python 2.6rc2. I'd like to make 2.6 the default python version on the system and migrate all the other useful installed python libraries installed on 2.5.2 to python 2.6rc2. Please let... |
I am working on a web application (ASP.NET) game that would consist of a single page, and on that page, there would be a game board akin to Monopoly. I am trying to determine what the best architectural approach would be. The main requirements I have identified thus far are:
Up to six users share a single game state... | Creating a web-based game similar to Monopoly can be an exciting project! When considering the architecture for handling concurrent users and keeping the game state synchronized, it’s important to find the right balance between performance and maintainability. Let's explore the considerations and potential solutions fo... | 25,742 | [
{
"from": "human",
"value": "I am working on a web application (ASP.NET) game that would consist of a single page, and on that page, there would be a game board akin to Monopoly. I am trying to determine what the best architectural approach would be. The main requirements I have identified thus far are:\n... |
Is there a correct way in Windows Forms to flash a titlebar without having to drop to P/Invoking FlashWindow?
I'm using .NET 2.0 for compatibility and size reasons, so maybe I just missed the method because it's in newer versions of the .NET framework.
| In .NET Framework 2.0, there isn't a built-in method for flashing a title bar or taskbar button. The typical way to achieve this effect is through platform invocation (P/Invoke) to call the `FlashWindow` function from the user32.dll.
If you want to avoid P/Invoke and remain purely in managed code, you won't find a dir... | 27,801 | [
{
"from": "human",
"value": "Is there a correct way in Windows Forms to flash a titlebar without having to drop to P/Invoking FlashWindow?\nI'm using .NET 2.0 for compatibility and size reasons, so maybe I just missed the method because it's in newer versions of the .NET framework.\n"
},
{
"from": "... |
What is the best jQuery status message plugin?
I like jGrowl and Purr, but jGrowl doesn't have the feature to remain sticky (not close automatially) and Purr doesn't seem to work right in IE 6.
I would like to show messages like... the site is about to go down for maintenance, your such and such job has completed, and ... | For displaying status messages with the ability to remain sticky and support across various browsers, you might want to consider the following jQuery plugins:
1. **Noty**: Noty is a notification plugin that provides a simple and customizable way to create notifications. It has options for sticky notifications, meaning... | 27,220 | [
{
"from": "human",
"value": "What is the best jQuery status message plugin?\nI like jGrowl and Purr, but jGrowl doesn't have the feature to remain sticky (not close automatially) and Purr doesn't seem to work right in IE 6.\nI would like to show messages like... the site is about to go down for maintenance,... |
I have 2 databases, and I want to transport an existing table containing a CHAR column from database A to database B.
Database A is Oracle 9i, has encoding WE8ISO8859P1, and contains a table "foo" with at least 1 column of type CHAR(1 char). I can not change the table on database A because it is part of a third party ... | It looks like you've already identified and solved your issue with the CHAR data type while transferring data between two Oracle databases with different character encodings. The conversion of `CHAR(1 char)` to `CHAR(3 char)` and the resulting padding with spaces was indeed likely due to incompatibilities between Oracl... | 28,770 | [
{
"from": "human",
"value": "I have 2 databases, and I want to transport an existing table containing a CHAR column from database A to database B.\nDatabase A is Oracle 9i, has encoding WE8ISO8859P1, and contains a table \"foo\" with at least 1 column of type CHAR(1 char). I can not change the table on dat... |
We're running on .NET 3.5 SP1.
Recently, in IE, some of our users started getting "Out of Memory" errors once in a while. This doesn't happen all the time. I managed to replicate it a couple times and I found that this code, from the AjaxControlToolkit.Common.Common.js file, was causing an infinite loop:
AjaxControlTo... | It sounds like you've encountered a tricky bug related to AJAX history management and the way the AjaxControlToolkit handles control wrappers. Your analysis of the situation is insightful, particularly regarding the distinction between the local and remote environments, and the significance of `CombineScripts`.
### Ke... | 20,644 | [
{
"from": "human",
"value": "We're running on .NET 3.5 SP1. \nRecently, in IE, some of our users started getting \"Out of Memory\" errors once in a while. This doesn't happen all the time. I managed to replicate it a couple times and I found that this code, from the AjaxControlToolkit.Common.Common.js file,... |
I need to do a few very simple URL manipulations in Java. Like get the value for a parameter in the query, or update it, ... I was expecting to find a simple utility class doing that in the commons-lang package, but no. I know it is a simple problem, but if there is something already written, why do it again ? Do you k... | You are correct that manipulating URLs in Java can be a bit cumbersome, and while the Apache Commons libraries have many utilities, they do not specifically address URL parameter manipulation in the way you described. However, you can create your own utility class to handle these tasks effectively.
Here's an example i... | 25,392 | [
{
"from": "human",
"value": "I need to do a few very simple URL manipulations in Java. Like get the value for a parameter in the query, or update it, ... I was expecting to find a simple utility class doing that in the commons-lang package, but no. I know it is a simple problem, but if there is something al... |
In Netbeans 6.5, I've got two different C++ application projects - my application and the unit tests. I want to set it up so that if my main application is rebuilt, the unit tests are rebuilt as well (and vice versa).
Netbeans is good at resolving the dependencies for library projects, and rebuilding them if necessary... | In NetBeans 6.5, managing dependencies between two separate C++ application projects can indeed be challenging since the IDE does not directly provide a way to link application projects like it does with library projects. However, there are a few strategies you can consider to ensure that when one application project i... | 27,532 | [
{
"from": "human",
"value": "In Netbeans 6.5, I've got two different C++ application projects - my application and the unit tests. I want to set it up so that if my main application is rebuilt, the unit tests are rebuilt as well (and vice versa).\nNetbeans is good at resolving the dependencies for library ... |
I am trying to to set up the login control to remember the login credentials of a user who has previously entered their user name and password successfully. I set the remember me property to true, but it doesnt seem to triger any events where I could read the cookie and auto login the user.
Is there a straightforward ... | To implement a "Remember Me" functionality in your login system, you generally need to follow these steps:
1. **Set Up the Login Form**: Ensure your login form has a checkbox for "Remember Me" that users can select when they log in.
2. **Process the Login Request**: When the user submits the login form, check if the ... | 19,337 | [
{
"from": "human",
"value": "I am trying to to set up the login control to remember the login credentials of a user who has previously entered their user name and password successfully. I set the remember me property to true, but it doesnt seem to triger any events where I could read the cookie and auto log... |
I'm using Delphi 6, and I want a database bound list box with multiselect. I found three types of List boxes: TListBox, TDBListBox and TDBLookupListBox.
As far as I can understand, TListbox is not bound to database. TDBListBox and TDBLookupListBox can't be multiselected.
Is there a way to get a multiselect listbox b... | In Delphi 6, the built-in components for list boxes (TDBListBox and TDBLookupListBox) do not support multi-selection out of the box. However, you can achieve a multi-select functionality with a TListBox combined with a database component by manually managing the data bindings.
Here's a way to implement a multi-select ... | 25,415 | [
{
"from": "human",
"value": "I'm using Delphi 6, and I want a database bound list box with multiselect. I found three types of List boxes: TListBox, TDBListBox and TDBLookupListBox. \nAs far as I can understand, TListbox is not bound to database. TDBListBox and TDBLookupListBox can't be multiselected.\nIs... |
I have several std::vector, all of the same length. I want to sort one of these vectors, and apply the same transformation to all of the other vectors. Is there a neat way of doing this? (preferably using the STL or Boost)? Some of the vectors hold ints and some of them std::strings.
Pseudo code:
std::vector<int> Ind... | You can achieve the desired transformation using the STL by creating an index vector and using `std::sort` alongside `std::vector::iterator` to re-arrange other vectors accordingly. Here's how you can implement this in C++:
```cpp
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <u... | 27,418 | [
{
"from": "human",
"value": "I have several std::vector, all of the same length. I want to sort one of these vectors, and apply the same transformation to all of the other vectors. Is there a neat way of doing this? (preferably using the STL or Boost)? Some of the vectors hold ints and some of them std::s... |
Whenever I add a web reference for any Sharepoint web service in VS 2008, the preview window while adding the web reference shows the proper method names:
Note CreateFolder:
Before: alt text http://img134.imageshack.us/img134/5286/vs20081bq7.png
And after, the CreateFolder method is not there
After http://img134.images... | It looks like you're trying to add a web reference to a SharePoint web service in Visual Studio 2008, but the `CreateFolder` method is not appearing in the web reference preview after you've added it.
Here are some possible reasons and solutions for this issue:
1. **Service Version**: Ensure that you are using the co... | 28,328 | [
{
"from": "human",
"value": "Whenever I add a web reference for any Sharepoint web service in VS 2008, the preview window while adding the web reference shows the proper method names:\nNote CreateFolder:\nBefore: alt text http://img134.imageshack.us/img134/5286/vs20081bq7.png\nAnd after, the CreateFolder me... |
I'm responsible for several (rather small) programs, which share a lot of code via different libraries. I'm wondering what the best repository layout is to develop the different prorgrams (and libraries), and keep the libraries in sync across all the programs.
For the sake of argument let's say there are two programs w... | Your scenario is a common one in software development, especially when dealing with shared libraries across multiple projects. Managing dependencies and ensuring consistent updates while minimizing conflicts can indeed be challenging. Here’s a recommended approach to repository layout and workflow that balances flexibi... | 23,759 | [
{
"from": "human",
"value": "I'm responsible for several (rather small) programs, which share a lot of code via different libraries. I'm wondering what the best repository layout is to develop the different prorgrams (and libraries), and keep the libraries in sync across all the programs.\nFor the sake of a... |
What's the easiest way to get the UTC offset in PHP, relative to the current (system) timezone?
| To get the UTC offset relative to the current system timezone in PHP, you can use the `DateTime` class along with the `DateTimeZone` class. Here's a simple way to achieve this:
```php
<?php
// Create a new DateTime object for the current time
$dateTime = new DateTime('now');
// Get the current timezone
$timezone = $d... | 28,460 | [
{
"from": "human",
"value": "What's the easiest way to get the UTC offset in PHP, relative to the current (system) timezone?\n"
},
{
"from": "gpt",
"value": "To get the UTC offset relative to the current system timezone in PHP, you can use the `DateTime` class along with the `DateTimeZone` class... |
I've got two tables:
Employees:
uid (number) | first_name (string) | last_name (string) | ...
Projects:
uid | project_title (string) | point_of_contact_id (FK: Employees.uid) | ...
I'd like to create a form for Projects with a "Point of Contact" combo box (dropdown) field. The display values should be "first_name la... | To create a form that displays a user's first and last name but saves the UID of the selected employee in the "Point of Contact" field, you can achieve this with a combination of SQL queries (or ORM, depending on the technology stack) and the front-end form design. Here's a step-by-step guide to set it up:
### Step 1:... | 27,213 | [
{
"from": "human",
"value": "I've got two tables:\nEmployees:\nuid (number) | first_name (string) | last_name (string) | ...\n\nProjects:\nuid | project_title (string) | point_of_contact_id (FK: Employees.uid) | ...\n\nI'd like to create a form for Projects with a \"Point of Contact\" combo box (dropdown) f... |
I have recently discovered the incredibly useful Eclipse Memory Analysis Tool, which makes quick work of finding memory leaks in Java applications. Unfortunately, after switching my JDK to 1.6 (under Mac OS 10.5), the JVM terminates immediately upon startup. All that appears is a dialog stating "JVM terminated" with ... | The issue you’re encountering with the Eclipse Memory Analysis Tool (MAT) crashing on startup with JDK 1.6 can occur due to compatibility issues between the tool and the JDK version you're using. Here are some suggestions to help you resolve the issue:
### 1. **Check Eclipse Version Compatibility**
Ensure that your ve... | 27,882 | [
{
"from": "human",
"value": "I have recently discovered the incredibly useful Eclipse Memory Analysis Tool, which makes quick work of finding memory leaks in Java applications. Unfortunately, after switching my JDK to 1.6 (under Mac OS 10.5), the JVM terminates immediately upon startup. All that appears i... |
I feel that using GetEnumerator() and casting IEnumerator.Current is expensive. Any better suggestions?
I'm open to using a different data structure if it offers similiar capabilities with better performance.
After thought:
Would a generic stack be a better idea so that the cast isn't necessary?
| Using `GetEnumerator()` and casting `IEnumerator.Current` can indeed introduce performance overhead, particularly if done frequently in a tight loop. If you're looking for better performance with similar capabilities, considering a different data structure can be a good approach.
### Here are a few alternatives:
1. *... | 26,830 | [
{
"from": "human",
"value": "I feel that using GetEnumerator() and casting IEnumerator.Current is expensive. Any better suggestions?\nI'm open to using a different data structure if it offers similiar capabilities with better performance.\nAfter thought:\nWould a generic stack be a better idea so that the c... |
Is there any good reason that an empty set of round brackets (parentheses) isn't valid for calling the default constructor in C++?
MyObject object; // ok - default ctor
MyObject object(blah); // ok
MyObject object(); // error
I seem to type "()" automatically everytime. Is there a good reason this isn't allowed?... | The behavior you are observing in C++ is due to a peculiarity of the language's grammar regarding the interpretation of declarations. In C++, when you write `MyObject object();`, it is interpreted as a declaration of a function named `object` that takes no parameters and returns an object of type `MyObject`. This is kn... | 23,725 | [
{
"from": "human",
"value": "Is there any good reason that an empty set of round brackets (parentheses) isn't valid for calling the default constructor in C++?\nMyObject object; // ok - default ctor\nMyObject object(blah); // ok\n\nMyObject object(); // error\n\nI seem to type \"()\" automatically ever... |
How do I check if a number is a palindrome?
Any language. Any algorithm. (except the algorithm of making the number a string and then reversing the string).
| You can check if a number is a palindrome without converting it to a string by reversing the number mathematically. Here’s a straightforward algorithm to do this in Python:
### Algorithm:
1. If the number is negative, it can't be a palindrome.
2. Initialize a variable `reversed_num` to 0.
3. Use a loop to extract digi... | 27,117 | [
{
"from": "human",
"value": "How do I check if a number is a palindrome?\nAny language. Any algorithm. (except the algorithm of making the number a string and then reversing the string).\n"
},
{
"from": "gpt",
"value": "You can check if a number is a palindrome without converting it to a string ... |
System.InvalidOperationException: DragDrop registration did not
succeed. ---> System.Threading.ThreadStateException:
What does this exception mean? I get it at this line trying to add a panel to a panel at runtime...
splitReport.Panel1.Controls.Add(ChartPanel);
Working in VS2008 C#
| The `System.InvalidOperationException` with the message "DragDrop registration did not succeed" usually indicates that there is an issue with the drag-and-drop registration process in Windows Forms. This exception is often caused by performing certain UI operations in a thread other than the main UI thread. The subsequ... | 27,135 | [
{
"from": "human",
"value": "\nSystem.InvalidOperationException: DragDrop registration did not\n succeed. ---> System.Threading.ThreadStateException:\n\nWhat does this exception mean? I get it at this line trying to add a panel to a panel at runtime...\nsplitReport.Panel1.Controls.Add(ChartPanel);\n\nWork... |
Session variables are normally keept in the web server RAM memory.
In a cluster, each request made by a client can be handled by a different cluster node. right?!
So, in this case...
What happens with session variables? Aren't they stored in the nodes RAM memory?
How the other nodes will handled my request correctl... | You're correct in identifying that session variables are typically stored in the web server's RAM, and in a clustered environment, handling sessions across different nodes can pose challenges. Here’s how this is usually managed and the solutions available, including for Classic ASP.
### Session Management in a Cluster... | 24,584 | [
{
"from": "human",
"value": "Session variables are normally keept in the web server RAM memory.\nIn a cluster, each request made by a client can be handled by a different cluster node. right?!\nSo, in this case... \n\nWhat happens with session variables? Aren't they stored in the nodes RAM memory? \nHow th... |
What would be the quickest way to construct a Python binding to a C or C++ library?
(I am using Windows if this matters.)
| Creating Python bindings to a C or C++ library can be accomplished using several different tools and techniques. The "quickest" method can depend on your specific requirements, library complexity, and familiarity with various tools. Here are some of the most popular options for creating bindings:
### 1. **Using SWIG (... | 24,605 | [
{
"from": "human",
"value": "What would be the quickest way to construct a Python binding to a C or C++ library?\n(I am using Windows if this matters.)\n"
},
{
"from": "gpt",
"value": "Creating Python bindings to a C or C++ library can be accomplished using several different tools and techniques... |
Should I create two CFile objects and copy one into the other character by character? Or is there something in the library that will do this for me?
| In C++, if you are working with file operations and want to copy the contents of one `CFile` object to another, you generally do not need to handle it character by character manually. The standard libraries, along with specific features provided by the framework you might be using (such as MFC with `CFile`), typically ... | 23,687 | [
{
"from": "human",
"value": "Should I create two CFile objects and copy one into the other character by character? Or is there something in the library that will do this for me?\n"
},
{
"from": "gpt",
"value": "In C++, if you are working with file operations and want to copy the contents of one... |
Is there a .NET Framework compiler for the Ruby language? I've heard of the DLR (Dynamic Language Runtime), is this going to enable Ruby to be used with .NET development?
| Yes, there is a .NET Framework compiler for the Ruby language called **IronRuby**. IronRuby is an implementation of the Ruby programming language that is built on top of the .NET Framework, leveraging the Dynamic Language Runtime (DLR).
The DLR is a part of the .NET Framework that provides support for dynamic typing ... | 30,334 | [
{
"from": "human",
"value": "Is there a .NET Framework compiler for the Ruby language? I've heard of the DLR (Dynamic Language Runtime), is this going to enable Ruby to be used with .NET development?\n"
},
{
"from": "gpt",
"value": "Yes, there is a .NET Framework compiler for the Ruby language c... |
Shell scripts are often used as glue, for automation and simple one-off tasks. What are some of your favorite "hidden" features of the Bash shell/scripting language?
One feature per answer
Give an example and short description of the feature, not just a link to documentation
Label the feature using bold title as the f... | **Process Substitution**
Process substitution allows you to treat the output of a command as if it were a file. This can be very useful when you want to compare or combine the output of commands without creating temporary files.
Example:
```bash
diff <(ls dir1) <(ls dir2)
```
In this example, `ls dir1` and `ls dir2`... | 31,279 | [
{
"from": "human",
"value": "Shell scripts are often used as glue, for automation and simple one-off tasks. What are some of your favorite \"hidden\" features of the Bash shell/scripting language?\n\nOne feature per answer\nGive an example and short description of the feature, not just a link to documentati... |
I have just installed PostgreSQL 8.3.4 on Mac OS X 10.5 (using ports), but I cannot figure out how to enable PL/Python. When I run the CREATE LANGUAGE plpythonu I get the following errors:
ERROR: could not access file "$libdir/plpython": No such file or directory
STATEMENT: CREATE LANGUAGE plpythonu;
psql:<stdin>:18:... | To enable PL/Python in your PostgreSQL 8.3.4 installation on Mac OS X using MacPorts, you need to ensure that the PL/Python extension is installed alongside PostgreSQL. The error message you are receiving indicates that the PL/Python shared library (`plpython`) is missing, which typically means it wasn't built or insta... | 26,780 | [
{
"from": "human",
"value": "I have just installed PostgreSQL 8.3.4 on Mac OS X 10.5 (using ports), but I cannot figure out how to enable PL/Python. When I run the CREATE LANGUAGE plpythonu I get the following errors:\nERROR: could not access file \"$libdir/plpython\": No such file or directory\nSTATEMENT:... |
My event logs on my production front end servers are getting filled with error messages:
"Failed to determine definition for Feature with ID"
Now, I've found the offending feature on one of the development servers - it is an InfoPath form with some code behind. But, it is nowhere to be found on the production servers.... | The error message "Failed to determine definition for Feature with ID" indicates that a SharePoint feature is still referenced in the configuration database but is not properly installed or is missing from the production environment. Since you've identified that the offending feature is associated with an InfoPath form... | 25,187 | [
{
"from": "human",
"value": "My event logs on my production front end servers are getting filled with error messages:\n\"Failed to determine definition for Feature with ID\"\nNow, I've found the offending feature on one of the development servers - it is an InfoPath form with some code behind. But, it is n... |
Does anyone have a copy of MSIINV.EXE (The MSI Inventory tool)? The site where it used to be available is down(http://www.huydao.net/). I'm trying to uninstall some components in order to force the Visual Studio Setup to reinstall them. I apologize as this is not strictly a programming question but I figured anyone tha... | MSIINV.EXE is a tool that was used to inventory and manage Windows Installer packages. However, it seems that the original site hosting the tool is down. You may still be able to find MSIINV.EXE through a few alternative methods:
1. **Archive Sites**: Sometimes older versions of tools can be found on archive websites ... | 27,790 | [
{
"from": "human",
"value": "Does anyone have a copy of MSIINV.EXE (The MSI Inventory tool)? The site where it used to be available is down(http://www.huydao.net/). I'm trying to uninstall some components in order to force the Visual Studio Setup to reinstall them. I apologize as this is not strictly a prog... |
I am using the SoundEngine sample code from Apple in the CrashLanding sample to play back multiple audio files. Using the sample caf files included with CrashLanding everything works fine but when I try and use my own samplesconverted to CAF using afconvert all I get is a stony silence ;)
Does anyone have settings for ... | When converting audio files to CAF format for playback using OpenAL, it's important to ensure that the settings you use with `afconvert` are compatible with the requirements of OpenAL. Here are some steps and settings you can try to ensure your audio files are playable:
### Recommended `afconvert` Settings
You can us... | 28,924 | [
{
"from": "human",
"value": "I am using the SoundEngine sample code from Apple in the CrashLanding sample to play back multiple audio files. Using the sample caf files included with CrashLanding everything works fine but when I try and use my own samplesconverted to CAF using afconvert all I get is a stony ... |
I'm having a JBoss EJB3 Application and a Swing client, running in 32-bit Java 6 VM's. We now have to change the Server JVM to 64 bit. May this combination of JVM's cause any trouble (do I need to use 64-bit JVM on the client, too)?
Greetings,
buzztee
| Using a 32-bit Java Virtual Machine (JVM) for your Swing client while running a JBoss EJB3 application server on a 64-bit JVM generally should not cause issues in terms of functionality. The two JVMs can communicate over a network using standard protocols, and the EJB client stubs generated for your application will be... | 29,614 | [
{
"from": "human",
"value": "I'm having a JBoss EJB3 Application and a Swing client, running in 32-bit Java 6 VM's. We now have to change the Server JVM to 64 bit. May this combination of JVM's cause any trouble (do I need to use 64-bit JVM on the client, too)? \nGreetings,\nbuzztee\n"
},
{
"from": ... |
Here is some simple Perl to count the number of times a value occurs in an array. This runs without any warnings.
use warnings;
use strict;
my @data = qw(1 1 2 3 4 5 5 5 9);
my %histogram;
foreach (@data)
{
$histogram{$_}++;
}
When the loop body is changed to
$histogram{$_} = $histogram{$_} + 1;
Perl warns "Use ... | In Perl, when you use the `++` operator on a hash element that doesn't exist yet, Perl automatically initializes that element to zero before performing the increment. This is because `++` is designed to be a more "friendly" operation for counting and incrementing, and it takes care of uninitialized values in a way that... | 27,681 | [
{
"from": "human",
"value": "Here is some simple Perl to count the number of times a value occurs in an array. This runs without any warnings.\nuse warnings;\nuse strict;\n\nmy @data = qw(1 1 2 3 4 5 5 5 9);\nmy %histogram;\nforeach (@data)\n{\n $histogram{$_}++;\n}\n\nWhen the loop body is changed to\n$... |
How to use data mining feature of SQL Server 2008 with ASP.Net
| Using the data mining features of SQL Server 2008 in an ASP.NET application involves several steps. SQL Server 2008 introduced various data mining algorithms, which can be accessed programmatically through SQL queries, Analysis Services, or by using the SQL Server Management Studio (SSMS) for building and testing your ... | 21,665 | [
{
"from": "human",
"value": "How to use data mining feature of SQL Server 2008 with ASP.Net\n"
},
{
"from": "gpt",
"value": "Using the data mining features of SQL Server 2008 in an ASP.NET application involves several steps. SQL Server 2008 introduced various data mining algorithms, which can be... |
For homework, I was given the following 8 code fragments to analyze and give a Big-Oh notation for the running time. Can anybody please tell me if I'm on the right track?
//Fragment 1
for(int i = 0; i < n; i++)
sum++;
I'm thinking O(N) for fragment 1
//Fragment 2
for(int i = 0; i < n; i+=2)
sum++;
O(N) for... | Let's go through each of the code fragments and analyze their time complexity one by one:
### Fragment 1
```cpp
for(int i = 0; i < n; i++)
sum++;
```
**Analysis:** This loop runs `n` times.
- **Big-Oh Notation:** O(n)
---
### Fragment 2
```cpp
for(int i = 0; i < n; i+=2)
sum++;
```
**Analysis:** This loop ru... | 21,838 | [
{
"from": "human",
"value": "For homework, I was given the following 8 code fragments to analyze and give a Big-Oh notation for the running time. Can anybody please tell me if I'm on the right track? \n//Fragment 1\nfor(int i = 0; i < n; i++)\n sum++;\n\nI'm thinking O(N) for fragment 1\n//Fragment 2\n... |
I have a form I am submitting using jQuery's ajaxSubmit function from the Forms plugin. I'm trying to add a form name/value pair to the form data just before submission occurs. My plan is to modify the form data in the beforeSubmit event handler.
Given a function that looks like:
function handleActionFormBeforeSubmit(f... | To add a name/value pair to the `formData` array in your `handleActionFormBeforeSubmit` function, you can use the `push` method to append a new object representing the name/value pair to the existing `formData` array.
Here's how you can do it:
```javascript
function handleActionFormBeforeSubmit(formData, form, option... | 29,591 | [
{
"from": "human",
"value": "I have a form I am submitting using jQuery's ajaxSubmit function from the Forms plugin. I'm trying to add a form name/value pair to the form data just before submission occurs. My plan is to modify the form data in the beforeSubmit event handler.\nGiven a function that looks lik... |
On POSIX systems rename(2) provides for an atomic rename operation, including overwriting of the destination file if it exists and if permissions allow.
Is there any way to get the same semantics on Windows? I know about MoveFileTransacted() on Vista and Server 2008, but I need this to support Win2k and up.
The key wor... | On Windows systems prior to Vista and Server 2008, achieving an atomic rename operation with overwriting semantics is indeed problematic. The Win32 API does provide some functions that could be used to implement a rename operation, but they don't guarantee atomicity, especially when dealing with existing files.
### Th... | 28,334 | [
{
"from": "human",
"value": "On POSIX systems rename(2) provides for an atomic rename operation, including overwriting of the destination file if it exists and if permissions allow.\nIs there any way to get the same semantics on Windows? I know about MoveFileTransacted() on Vista and Server 2008, but I need... |
I'm trying to generate code coverage reports with EMMA using tests of which some use JMockit as a mocking framework. For the most part, it works, but a few of my tests crash with a ClassFormatError, like so:
java.lang.ClassFormatError
at sun.instrument.InstrumentationImpl.redefineClasses0(Native Method)
at sun.... | The issue you're encountering with `ClassFormatError` when using EMMA alongside JMockit is not uncommon, and it generally stems from the way both tools modify or instrument bytecode.
### Possible Reasons for the Error:
1. **Bytecode Manipulation Conflicts**: Both EMMA and JMockit rely on bytecode instrumentation. Whe... | 27,561 | [
{
"from": "human",
"value": "I'm trying to generate code coverage reports with EMMA using tests of which some use JMockit as a mocking framework. For the most part, it works, but a few of my tests crash with a ClassFormatError, like so:\njava.lang.ClassFormatError\n at sun.instrument.InstrumentationImpl.... |
I'm trying to export a Crystal Report to an HTML file, but when I call the Export method, I immediately get this error:
Source: Crystal Reports ActiveX Designer
Description: Failed to export the report.
I have tried both crEFTHTML40 and crEFTHTML32Standard as export format types - and both result in the same error.
... | When encountering the "Failed to export the report" error while trying to export a Crystal Report to HTML format, there are several common issues and troubleshooting steps you can consider. Here are some suggestions that might help you resolve the issue:
### 1. Check Crystal Reports Version Compatibility
Make sure tha... | 27,537 | [
{
"from": "human",
"value": "I'm trying to export a Crystal Report to an HTML file, but when I call the Export method, I immediately get this error:\n\nSource: Crystal Reports ActiveX Designer \nDescription: Failed to export the report.\n\nI have tried both crEFTHTML40 and crEFTHTML32Standard as export form... |
I would like to experiment with ideas about distributed file synchronization/replication. To make it efficient when the user is working, I would like to implement some kind of daemon to monitor changes in some directory (e.g. /home/user/dirToBeMonitored or c:\docs and setts\user\dirToBeMonitored). So, I could be able t... | Yes, it's entirely possible to implement a daemon for monitoring changes in a directory using several high to medium level programming languages. Different operating systems provide APIs to detect changes in filesystem directories. Below are a few languages and corresponding libraries or APIs that can be used for this ... | 21,397 | [
{
"from": "human",
"value": "I would like to experiment with ideas about distributed file synchronization/replication. To make it efficient when the user is working, I would like to implement some kind of daemon to monitor changes in some directory (e.g. /home/user/dirToBeMonitored or c:\\docs and setts\\us... |
When I add a reference to Microsoft.Office.Interop.Excel on my computer, Visual Studio adds this to the project file:
<COMReference Include="Excel">
<Guid>{00020813-0000-0000-C000-000000000046}</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor>5</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>primary</WrapperToo... | The two methods you've described for using Excel Interop in your project have distinct differences in how they handle the reference to the Excel library, and each has its pros and cons.
### Differences between the Two Methods:
1. **COMReference vs. Reference**:
- **COMReference**: This entry is used to reference a... | 24,938 | [
{
"from": "human",
"value": "When I add a reference to Microsoft.Office.Interop.Excel on my computer, Visual Studio adds this to the project file:\n<COMReference Include=\"Excel\">\n <Guid>{00020813-0000-0000-C000-000000000046}</Guid>\n <VersionMajor>1</VersionMajor>\n <VersionMinor>5</VersionMinor>\n <... |
I have a static object at runtime that is basically a list of other objects (ints, strings, Dictionary, other objects, etc). Is there way to determine the memory used by my static "list of other objects" object at runtime? This would be handy for instrumentation and reporting purposes.
| To determine the memory usage of a static object that acts as a list of other objects in .NET (assuming you're using C#), you can use the `GC.GetTotalMemory` method to get the total memory used by the managed heap. However, for a more accurate measurement of a specific object and its contained objects, you can use a me... | 22,622 | [
{
"from": "human",
"value": "I have a static object at runtime that is basically a list of other objects (ints, strings, Dictionary, other objects, etc). Is there way to determine the memory used by my static \"list of other objects\" object at runtime? This would be handy for instrumentation and reportin... |
I am getting a DC for a window handle of an object in another program using win32gui.GetDC which returns an int/long. I need to blit this DC into a memory DC in python. The only thing I can't figure out how to do is get a wxDC derived object from the int/long that win32gui returns. None of the wxDC objects allow me ... | In wxPython, you can use a raw device context (DC) from a Windows handle, but you need to go through the `wx.GraphicsContext` or create a bitmap and then use a `wx.MemoryDC` to draw onto it. However, wxPython's API does not directly allow you to pass a raw device context handle (an integer from `win32gui.GetDC`) to its... | 25,246 | [
{
"from": "human",
"value": "I am getting a DC for a window handle of an object in another program using win32gui.GetDC which returns an int/long. I need to blit this DC into a memory DC in python. The only thing I can't figure out how to do is get a wxDC derived object from the int/long that win32gui ret... |
We are developing a C# application for a web-service client. This will run on Windows XP PC's.
One of the fields returned by the web service is a DateTime field. The server returns a field in GMT format i.e. with a "Z" at the end.
However, we found that .NET seems to do some kind of implicit conversion and the time was... | To handle the conversion of a GMT DateTime to New Zealand local time (including adjustments for Daylight Saving Time), you can utilize the `TimeZoneInfo` class in .NET. This class allows you to account for the local time zone, including whether Daylight Saving Time is in effect at the time of conversion.
Here is how ... | 22,582 | [
{
"from": "human",
"value": "We are developing a C# application for a web-service client. This will run on Windows XP PC's.\nOne of the fields returned by the web service is a DateTime field. The server returns a field in GMT format i.e. with a \"Z\" at the end.\nHowever, we found that .NET seems to do some... |
Since I've started to use jQuery, I have been doing a lot more JavaScript development.
I have the need to parse different date formats and then to display them into another format.
Do you know of any good tool to do this?
Which one would you recommend?
| For parsing and formatting dates in JavaScript, one of the most popular and powerful libraries is **date-fns**. It offers a wide range of date utility functions that are modular, allowing you to import only what you need, which helps keep your project lightweight.
Another excellent choice is **Moment.js**, but keep i... | 28,576 | [
{
"from": "human",
"value": "Since I've started to use jQuery, I have been doing a lot more JavaScript development.\nI have the need to parse different date formats and then to display them into another format.\nDo you know of any good tool to do this?\nWhich one would you recommend?\n"
},
{
"from":... |
I want to get the full path of the running process (executable) without having root permission using C++ code. Can someone suggest a way to achieve this.
on Linux platforms i can do it by using following way.
char exepath[1024] = {0};
char procid[1024] = {0};
char exelink[1024] = {0};
sprintf(procid, "%u", getpid());
... | On HP-UX, you can retrieve the full path of the currently running executable using the `getexecname()` function provided in the `<unistd.h>` header. This function returns the name of the currently executing program. However, it will give you just the executable name, not the full path. To get the full path, you can use... | 29,035 | [
{
"from": "human",
"value": "I want to get the full path of the running process (executable) without having root permission using C++ code. Can someone suggest a way to achieve this.\non Linux platforms i can do it by using following way.\nchar exepath[1024] = {0};\nchar procid[1024] = {0};\nchar exelink[10... |
Here's the situation:
I'm developing a simple application with the following structure:
FormMain (startup point)
FormNotification
CompleFunctions
Right?
Well, in FormMain I have the following function:
private void DoItInNewThread(ParameterizedThreadStart pParameterizedThreadStart, object pParameters, ThreadPriority ... | The issue you're experiencing is related to how Windows Forms handles threading and the visibility of forms. When you create a new thread to run your `DoSomething` method in `ComplexFunctions`, any operations that involve UI components (like showing a form) should be executed on the main UI thread. If you try to show t... | 19,169 | [
{
"from": "human",
"value": "Here's the situation:\nI'm developing a simple application with the following structure:\n\nFormMain (startup point)\nFormNotification\nCompleFunctions\n\nRight?\nWell, in FormMain I have the following function:\nprivate void DoItInNewThread(ParameterizedThreadStart pParameteriz... |
I'm writing a Windows Forms Application in C#.NET
On startup, the application displays a splash screen which is running in a separate thread. Whilst the splash screen is showing, the main application is initialising.
Once the main application has finished initialising, the main form of the application is displayed, an... | This behavior typically occurs due to how Windows manages window focus and thread priorities. In your case, it sounds like the main window of your application is not being properly brought to the foreground after the splash screen is closed. This can happen if:
1. The main application window doesn't explicitly request... | 23,787 | [
{
"from": "human",
"value": "I'm writing a Windows Forms Application in C#.NET\nOn startup, the application displays a splash screen which is running in a separate thread. Whilst the splash screen is showing, the main application is initialising.\nOnce the main application has finished initialising, the ma... |
I'm looking for one line code examples in various languages for getting a valid MD5 result (as a string, not a bytehash or what have you). For instance:
PHP:
$token = md5($var1 . $var2);
I found VB especially troublesome to do in one line.
| Certainly! Here are one-liner examples for generating an MD5 hash in various programming languages, returning the result as a string:
### PHP
```php
$token = md5($var1 . $var2);
```
### Python
```python
import hashlib; token = hashlib.md5((var1 + var2).encode()).hexdigest()
```
### JavaScript (Node.js)
```javascript... | 27,680 | [
{
"from": "human",
"value": "I'm looking for one line code examples in various languages for getting a valid MD5 result (as a string, not a bytehash or what have you). For instance:\nPHP:\n$token = md5($var1 . $var2);\nI found VB especially troublesome to do in one line.\n"
},
{
"from": "gpt",
... |
Has anyone else had any problems using google's Domain Tracking API, I am specifically talking about the _link() method.
The documentation is here
The example provided shows that the _link() method should be used in the onclick event like this:
<a href="http://www.newsite.com" onclick="pageTracker._link('http://www.new... | The issue you are encountering with the `_link()` method in Google Analytics' (GA) Domain Tracking API is a common point of confusion. The `_link()` method is designed to track link clicks, but its functionality has changed over time, and it might not work as expected in every context.
Here are some things to consider... | 26,663 | [
{
"from": "human",
"value": "Has anyone else had any problems using google's Domain Tracking API, I am specifically talking about the _link() method.\nThe documentation is here\nThe example provided shows that the _link() method should be used in the onclick event like this:\n<a href=\"http://www.newsite.co... |
There are truckloads of counters available in perfmon for ASP.NET. What are the best (I am thinking of choosing 5-10) that will be the best to monitor in our test environment so that we can feed back to developers.
I am thinking of things like request time, request queue length, active sessions etc.
| When monitoring an ASP.NET application using Performance Monitor (PerfMon), there are several counters that can provide valuable insights into the performance and behavior of your application. Here are 10 of the most useful ASP.NET performance counters to monitor in your test environment:
1. **Requests/Sec**: Measures... | 27,545 | [
{
"from": "human",
"value": "There are truckloads of counters available in perfmon for ASP.NET. What are the best (I am thinking of choosing 5-10) that will be the best to monitor in our test environment so that we can feed back to developers.\nI am thinking of things like request time, request queue lengt... |
Is there a wchar_t version of exec[lv][pe] (i.e. an exec that uses wchar_t as path and wchar_t as arguments)?
In Windows, I can just do CreateProcessW(process, cmdline), but in *nix, I'm stuck (i.e. no pure POSIX equivalent).
I'm trying to add UTF-16 support to my program (an autorun).
| In POSIX-compliant systems, there is no direct equivalent of `exec*` functions that specifically operate on `wchar_t` (wide characters). The standard `exec` family of functions (e.g., `execl`, `execv`, `execle`, `execve`, etc.) primarily operates with `char*` arguments, and the POSIX standard does not provide direct su... | 25,405 | [
{
"from": "human",
"value": "Is there a wchar_t version of exec[lv][pe] (i.e. an exec that uses wchar_t as path and wchar_t as arguments)?\nIn Windows, I can just do CreateProcessW(process, cmdline), but in *nix, I'm stuck (i.e. no pure POSIX equivalent).\nI'm trying to add UTF-16 support to my program (an ... |
I have a bunch of questions to post regarding the issue of separating the view from logic when creating a GUI.
The following is a minimal example of what I would do for a simple dialog that has a label and a button using the "Humble Dialog" approach. Pressing the button should show some text on the label. I have used C... | Your implementation of the "Humble Dialog" approach using C++ and Qt demonstrates an interesting balance between separating concerns (view and logic) and practical considerations regarding event handling in GUI applications. Below are some thoughts and answers to your questions.
### 1. Use of Multiple Inheritance
Usin... | 26,154 | [
{
"from": "human",
"value": "I have a bunch of questions to post regarding the issue of separating the view from logic when creating a GUI.\nThe following is a minimal example of what I would do for a simple dialog that has a label and a button using the \"Humble Dialog\" approach. Pressing the button shoul... |
After some find and replace refactoring I ended up with this gem:
const class A
{
};
What does "const class" mean? It seems to compile ok.
| In C++, the phrase `const class` does not have a standard meaning, as `const` is typically used with variables, pointers, or references to indicate that the value cannot be modified. However, in this context, `const class A` would be a declaration of a class `A` with the `const` keyword preceding it.
While it may comp... | 30,018 | [
{
"from": "human",
"value": "After some find and replace refactoring I ended up with this gem:\nconst class A\n{\n};\n\nWhat does \"const class\" mean? It seems to compile ok.\n"
},
{
"from": "gpt",
"value": "In C++, the phrase `const class` does not have a standard meaning, as `const` is typica... |
I"m looking for something (Win API calls or whatever) to notify me when a file becomes available for editing (i.e. no longer in use). Should I set up a timer to check the files on some interval or is there a good way to set up a watch on the file?
| In Windows, the most effective way to monitor a file for changes, including when it becomes available for editing, is to use the `FileSystemWatcher` class in .NET, or the `ReadDirectoryChangesW` API in the Win32 API.
### 1. Using `FileSystemWatcher` in .NET
If you are working within a .NET environment, the `FileSyste... | 23,222 | [
{
"from": "human",
"value": "I\"m looking for something (Win API calls or whatever) to notify me when a file becomes available for editing (i.e. no longer in use). Should I set up a timer to check the files on some interval or is there a good way to set up a watch on the file?\n"
},
{
"from": "gpt"... |
I'm not exactly sure how to ask this question really, and I'm no where close to finding an answer, so I hope someone can help me.
I'm writing a Python app that connects to a remote host and receives back byte data, which I unpack using Python's built-in struct module. My problem is with the strings, as they include mu... | To process strings with multiple encodings like the one you've described, you can create a function that will parse the string, detect the encoding based on the escape characters, and then decode the respective segments into Unicode.
Here's a step-by-step approach to handle this:
1. **Define the Mapping of Escape Cha... | 20,640 | [
{
"from": "human",
"value": "I'm not exactly sure how to ask this question really, and I'm no where close to finding an answer, so I hope someone can help me. \nI'm writing a Python app that connects to a remote host and receives back byte data, which I unpack using Python's built-in struct module. My probl... |
Microsoft's new Windows Live Application Based Storage API is a RESTful API.
More info is here.
Why did they choose not to support WebDAV?
| While I don't have specific details on Microsoft's internal decision-making regarding the choice not to support WebDAV for their Windows Live Application Based Storage API, I can provide some general insights into possible reasons based on the context of API design and technology trends:
1. **Simplicity and Ease of Us... | 26,890 | [
{
"from": "human",
"value": "Microsoft's new Windows Live Application Based Storage API is a RESTful API.\nMore info is here.\nWhy did they choose not to support WebDAV?\n"
},
{
"from": "gpt",
"value": "While I don't have specific details on Microsoft's internal decision-making regarding the cho... |
I guess I need to know what I need in the classpath (what jar) in order to execute WebSphere 6.1 ant tasks. If someone can provide an example that would be perfect.
| To execute Ant tasks for IBM WebSphere Application Server (WAS) 6.1, you'll need to set up your classpath properly by including the necessary JAR files from the WebSphere installation directory. The typical Ant tasks you'll be using could include managing application deployments, server configurations, and other admini... | 23,527 | [
{
"from": "human",
"value": "I guess I need to know what I need in the classpath (what jar) in order to execute WebSphere 6.1 ant tasks. If someone can provide an example that would be perfect.\n"
},
{
"from": "gpt",
"value": "To execute Ant tasks for IBM WebSphere Application Server (WAS) 6.1, ... |
I am using fscanf to read a file which has lines like
Number <-whitespace-> string <-whitespace-> optional_3rd_column
I wish to extract the number and string out of each column, but ignore the 3rd_column if it exists
Example Data:
12 foo something
03 bar
24 something #randomcomment
I would want to extract 12,foo;... | To read your file line by line and extract the number and string while ignoring the optional third column (regardless of whether it exists or not), you can use `fscanf` in a way that accounts for varying numbers of columns. A more robust approach is to use `fgets` to read the entire line first, and then process it acco... | 27,878 | [
{
"from": "human",
"value": "I am using fscanf to read a file which has lines like\nNumber <-whitespace-> string <-whitespace-> optional_3rd_column \nI wish to extract the number and string out of each column, but ignore the 3rd_column if it exists\nExample Data:\n12 foo something\n03 bar\n24 something ... |
I remember reading somewhere on the internets about a half-assed tiny django CMS app, which was basically built on 'snippets' of text.
The idea was, that in the admin, you make a snippet (say a description of a product), give it a name (such as 'google_desc') and call it in a template with something like {% snippet goo... | It sounds like you're looking for **django-chunks**. This Django app allows you to manage and use snippets of text (referred to as "chunks") in your Django project easily. With django-chunks, you can create snippets in the admin interface and call them in your templates with a simple template tag.
You can find the dja... | 28,117 | [
{
"from": "human",
"value": "I remember reading somewhere on the internets about a half-assed tiny django CMS app, which was basically built on 'snippets' of text.\nThe idea was, that in the admin, you make a snippet (say a description of a product), give it a name (such as 'google_desc') and call it in a t... |
How do you handle a TimeoutException that is generated when calling WebServices using the SoapClient?
There doesn't seem to be any event to be handled in order to catch any Exceptions generated when calling web services.
Is it possible to catch any Exceptions thrown, especially the TimeoutException??
I also posted this... | Handling a `TimeoutException` in a Silverlight application that uses `SoapClient` to call web services involves implementing proper error handling in your asynchronous web service calls. Here's how you can do it:
1. **Error Handling with the Completed Event**: When you call a web service method using `SoapClient`, it ... | 27,630 | [
{
"from": "human",
"value": "How do you handle a TimeoutException that is generated when calling WebServices using the SoapClient?\nThere doesn't seem to be any event to be handled in order to catch any Exceptions generated when calling web services.\nIs it possible to catch any Exceptions thrown, especiall... |
I have a string containing a date, and another string containing the date format of the first string. Is there a function that I can call to convert that date into something like a SYSTEMTIME structure? Basically, I'd like the opposite of GetDateFormat().
| In Windows programming, you can convert a date string to a `SYSTEMTIME` structure by using the `GetSystemTime` function in combination with `StringToFileTime` or `GetDateFormat` along with `GetTimeFormat`. However, there isn't a direct function that performs the conversion from a formatted date string directly to `SYST... | 23,472 | [
{
"from": "human",
"value": "I have a string containing a date, and another string containing the date format of the first string. Is there a function that I can call to convert that date into something like a SYSTEMTIME structure? Basically, I'd like the opposite of GetDateFormat().\n"
},
{
"from":... |
Trying to get an ASP application deployed; it worked for a while but then started coming up with errors whenever the page is accessed:
Server Error in '/AppNameHere' Application.
Security Exception Description: The application attempted to perform
an operation not allowed by the security policy. To grant this
appl... | The error message you are encountering indicates a `SecurityException` that is caused by the ASP.NET application's inability to acquire the necessary permissions to run. This typically suggests that the trust level is not properly set, or that some underlying security settings have changed, which may lead to these inte... | 26,286 | [
{
"from": "human",
"value": "Trying to get an ASP application deployed; it worked for a while but then started coming up with errors whenever the page is accessed:\n\nServer Error in '/AppNameHere' Application.\nSecurity Exception Description: The application attempted to perform\n an operation not allowed... |
I'm a pretty active command line user and I have shell accounts all over the place. MacBooks, Linux desktop machines, Linux servers, Cygwin on XP, you name it.
How can I keep my shell configuration (.bashrc, .vimrc etc.) in sync across all these machines using the limited tools available across all platforms?
I have be... | Synchronizing shell configurations across multiple machines can be a bit of a challenge, especially with the diversity of platforms you're using. Here’s a general strategy that incorporates several tools and practices to help you achieve a more standardized environment:
### 1. Version Control with Git
Use Git to manag... | 24,667 | [
{
"from": "human",
"value": "I'm a pretty active command line user and I have shell accounts all over the place. MacBooks, Linux desktop machines, Linux servers, Cygwin on XP, you name it.\nHow can I keep my shell configuration (.bashrc, .vimrc etc.) in sync across all these machines using the limited tools... |
Apologies if any of what I'm about to say makes no sense or overlooks something obvious - my knowledge of CLR internals is spotty.
If I understand correctly, then if I just build a solution for 'AnyCPU' in VS2K5 (or point MSBuild at that .sln file with those settings) then the binaries only compile as far as MSIL. They... | You're on the right track with your understanding of the Common Language Runtime (CLR) and how assemblies work with regards to being platform-agnostic (AnyCPU) and the JIT (Just-In-Time) compilation process. Let's clarify a few things.
### Key Points:
1. **AnyCPU Compilation**:
- When you compile a .NET assembly w... | 29,457 | [
{
"from": "human",
"value": "Apologies if any of what I'm about to say makes no sense or overlooks something obvious - my knowledge of CLR internals is spotty.\nIf I understand correctly, then if I just build a solution for 'AnyCPU' in VS2K5 (or point MSBuild at that .sln file with those settings) then the ... |
In response to a rightMouse event I want to call a function that displays a context menu, runs it, and responds to the selected menu item. In Windows I can use TrackPopupMenu with the TPM_RETURNCMD flag.
What is the easiest way to implement this in Cocoa? It seems NSMenu:popUpContextMenu wants to post an event to the... | In Cocoa, the process of displaying a context menu in response to a right mouse button event is a bit different from the approach taken in Windows with `TrackPopupMenu`. In Cocoa, you would typically use `NSMenu` along with `NSView` to handle the display and interaction with the context menu.
### Implementation Steps
... | 25,770 | [
{
"from": "human",
"value": "In response to a rightMouse event I want to call a function that displays a context menu, runs it, and responds to the selected menu item. In Windows I can use TrackPopupMenu with the TPM_RETURNCMD flag.\nWhat is the easiest way to implement this in Cocoa? It seems NSMenu:popU... |
What is the best way to send e-mail using outlook express from the command line? It has to be an automated operation with no user interaction. There will be some .jpg files in attachment.
Thanks.
| Outlook Express does not have built-in command line options for sending emails directly. However, you can automate the process by using a combination of scripting (e.g., VBScript) and the Microsoft CDO (Collaboration Data Objects) library to send emails, including attachments, without user interaction. Here's how you c... | 27,147 | [
{
"from": "human",
"value": "What is the best way to send e-mail using outlook express from the command line? It has to be an automated operation with no user interaction. There will be some .jpg files in attachment.\nThanks.\n"
},
{
"from": "gpt",
"value": "Outlook Express does not have built-i... |
Besides the unit testing benefits, what I heard regarding MVP pattern was that the reusability of the presentation layer. So, you would design one presentation layer and use it for WinForms (rich) and Web.
I am currently working on a windows forms application in .NET with possibility of creating a web UI in the future... | The idea of a reusable presentation layer in the context of the MVP (Model-View-Presenter) pattern is appealing, especially for applications that might need to support multiple user interfaces, such as Windows Forms and web applications. However, whether the benefits of this reusability pan out in real-world scenarios ... | 24,782 | [
{
"from": "human",
"value": "Besides the unit testing benefits, what I heard regarding MVP pattern was that the reusability of the presentation layer. So, you would design one presentation layer and use it for WinForms (rich) and Web.\nI am currently working on a windows forms application in .NET with poss... |
I'm trying to construct a query that will include a column indicating whether or not a user has downloaded a document. I have a table called HasDownloaded with the following columns: id, documentID, memberID. Finding out whether a user has downloaded a specific document is easy; but I need to generate a query where the... | It looks like you want to use a `LEFT JOIN` to get all documents regardless of whether the user has downloaded them, but you should not include the condition on `HasDownloaded.memberID` in the `WHERE` clause. Instead, you should include it in the `ON` clause of the `LEFT JOIN`. This way, you can still retrieve all docu... | 26,094 | [
{
"from": "human",
"value": "I'm trying to construct a query that will include a column indicating whether or not a user has downloaded a document. I have a table called HasDownloaded with the following columns: id, documentID, memberID. Finding out whether a user has downloaded a specific document is easy;... |
I have a protected Excel worksheet, without a password.
What I'd like to do is trap the event that a user unprotects the worksheet, so that I can generate a message (and nag 'em!). I can setup event checking for the application, for when new workbooks are opened, etc., but not for Unprotect.
Does anyone have an idea?
| In Excel, the Worksheet Protection feature does not provide a direct event that you can hook into for when a worksheet is unprotected. However, there are a couple of approaches you might consider to work around this limitation:
### Method 1: Use a Worksheet Change Event
You can employ the `Worksheet_Change` event as ... | 25,652 | [
{
"from": "human",
"value": "I have a protected Excel worksheet, without a password. \nWhat I'd like to do is trap the event that a user unprotects the worksheet, so that I can generate a message (and nag 'em!). I can setup event checking for the application, for when new workbooks are opened, etc., but not... |
Let's say we have 2 php variables:
$name = 'caption';
$url = 'http://domain.com/photo.jpg';
The input string of '{@url,<img src="," alt="{@name}" />}' should return:
'<img src="http://domain.com/photo.jpg" alt="caption" />'
The {tag} takes up to 3 parameters: {@variable[,text_before][,text_after]}.
What regex would b... | To achieve the desired string transformation using PHP and regex, you can use the following approach. The regex will capture the nested `{@..}` tag and allow for replacements with the values of the variables. Here's how you can do this step-by-step.
1. Define the PHP variables.
2. Create a regex pattern that captures ... | 25,980 | [
{
"from": "human",
"value": "Let's say we have 2 php variables:\n\n$name = 'caption';\n$url = 'http://domain.com/photo.jpg';\n\nThe input string of '{@url,<img src=\",\" alt=\"{@name}\" />}' should return:\n'<img src=\"http://domain.com/photo.jpg\" alt=\"caption\" />'\nThe {tag} takes up to 3 parameters: {@... |
What is the best way to convert between HTML, XML, and XSL-FO in C#?
I already have the HTML (piped in from FCKEditor) and I'd like to print a PDF (I have an XSL->PDF converter). I just can't seem to find a library that will convert from HTML into anything XSL friendly.
| Converting HTML to XSL-FO (Extensible Stylesheet Language Formatting Objects) can be a bit tricky, as there aren't many libraries that support this conversion directly. However, you can follow a multi-step process to achieve this in C#. Here’s a common approach:
### Steps to Convert HTML to XSL-FO
1. **HTML to XML Co... | 22,696 | [
{
"from": "human",
"value": "What is the best way to convert between HTML, XML, and XSL-FO in C#?\nI already have the HTML (piped in from FCKEditor) and I'd like to print a PDF (I have an XSL->PDF converter). I just can't seem to find a library that will convert from HTML into anything XSL friendly.\n"
},... |
Can I call a stored procedure in Oracle via a database link?
The database link is functional so that syntax such as...
SELECT * FROM myTable@myRemoteDB
is functioning. But is there a syntax for...
EXECUTE mySchema.myPackage.myProcedure('someParameter')@myRemoteDB
| In Oracle, you cannot directly call a stored procedure over a database link using the `EXECUTE` command or similar procedure call syntax in the same way you would for a local procedure. However, there are a few workarounds you can use to execute a remote stored procedure via a database link. Here are the common methods... | 28,344 | [
{
"from": "human",
"value": "Can I call a stored procedure in Oracle via a database link?\nThe database link is functional so that syntax such as...\nSELECT * FROM myTable@myRemoteDB\n\nis functioning. But is there a syntax for...\nEXECUTE mySchema.myPackage.myProcedure('someParameter')@myRemoteDB\n\n"
}... |
Should it be used for all sizable forms, or only when it is not easy to guess that a form is sizable? Is there a GUI convention to use it?
Any link to a documentation would be appreciated.
| It seems you are asking about the use of the term "sizable" in the context of GUI (Graphical User Interface) design. Typically, in GUI design, the concept of whether a form (or window) should be resizable (or "sizable") depends on several factors:
1. **Content**: If the content of the form benefits from being resizabl... | 29,384 | [
{
"from": "human",
"value": "Should it be used for all sizable forms, or only when it is not easy to guess that a form is sizable? Is there a GUI convention to use it?\nAny link to a documentation would be appreciated.\n"
},
{
"from": "gpt",
"value": "It seems you are asking about the use of the... |
While working on a project, I came across a JS-script created by a former employee that basically creates a report in the form of
Name : Value
Name2 : Value2
etc.
The peoblem is that the values can sometimes be floats (with different precision), integers, or even in the form 2.20011E+17. What I want to output are pure... | You can create a JavaScript function that takes a mixed array of values (which can include floats, integers, and exponential notation) and converts them all to integers. The approach involves parsing the value and converting it to an integer using `Math.round()`, `Math.floor()`, or `Math.ceil()`, depending on your roun... | 28,657 | [
{
"from": "human",
"value": "While working on a project, I came across a JS-script created by a former employee that basically creates a report in the form of\nName : Value\nName2 : Value2\n\netc.\nThe peoblem is that the values can sometimes be floats (with different precision), integers, or even in the fo... |
How do I remove the key 'bar' from an array foo so that 'bar' won't show up in
for(key in foo){alert(key);}
| To remove a key (or property) from an object in JavaScript, you can use the `delete` operator. However, it's important to clarify that an array in JavaScript is a special kind of object. If you want to remove an indexed element from an array (like removing a key from an object), you would typically use `splice` or `pop... | 29,923 | [
{
"from": "human",
"value": "How do I remove the key 'bar' from an array foo so that 'bar' won't show up in\nfor(key in foo){alert(key);}\n\n"
},
{
"from": "gpt",
"value": "To remove a key (or property) from an object in JavaScript, you can use the `delete` operator. However, it's important to c... |
What are some resources that will help get me up and running quickly with the Excel interop in C#?
| Getting started with Excel Interop in C# can be straightforward with the right resources. Here are some helpful materials and tools that can assist you in getting up and running quickly:
### Official Documentation
1. **Microsoft Documentation on Excel Interop**:
- The official Microsoft documentation provides a com... | 24,981 | [
{
"from": "human",
"value": "What are some resources that will help get me up and running quickly with the Excel interop in C#?\n"
},
{
"from": "gpt",
"value": "Getting started with Excel Interop in C# can be straightforward with the right resources. Here are some helpful materials and tools tha... |
I really want to put in some sort of section handler into App.config that will execute some code before the application actually starts executing at Main. Is there any way to do such a thing?
| Yes, you can achieve this by using a combination of a custom configuration section handler in your `App.config` and some initialization code in your application. This will allow you to execute specific code before the `Main` method is called.
Here's a step-by-step guide on how you can set this up:
### Step 1: Define ... | 26,595 | [
{
"from": "human",
"value": "I really want to put in some sort of section handler into App.config that will execute some code before the application actually starts executing at Main. Is there any way to do such a thing?\n"
},
{
"from": "gpt",
"value": "Yes, you can achieve this by using a comb... |
Drop-down lists, menus and combo boxes are all very common user interface elements. Users are accustomed to seeing these elements in native applications and sometimes web apps, but there are a few problems with them.
You have to aim the mouse. Some menus collapse when you mouse out, and some have submenus that you ha... | You're not alone in your frustrations with drop-down menus, and many designers and users have experienced similar issues. Here are several strategies and alternative UI elements that can help make navigation easier and more user-friendly while still presenting a long list of options in limited space:
### 1. **Scrollab... | 22,388 | [
{
"from": "human",
"value": "Drop-down lists, menus and combo boxes are all very common user interface elements. Users are accustomed to seeing these elements in native applications and sometimes web apps, but there are a few problems with them. \n\nYou have to aim the mouse. Some menus collapse when you mo... |
Does anyone have a library or JavaScript snippet to validate the check digit of credit cards before the user hits Submit?
| Yes, you can validate the check digit of credit cards using the Luhn algorithm, which is a simple checksum formula used to validate various identification numbers, including credit card numbers. Below is a JavaScript snippet that implements the Luhn algorithm to validate a credit card number:
```javascript
function is... | 26,866 | [
{
"from": "human",
"value": "Does anyone have a library or JavaScript snippet to validate the check digit of credit cards before the user hits Submit?\n"
},
{
"from": "gpt",
"value": "Yes, you can validate the check digit of credit cards using the Luhn algorithm, which is a simple checksum formu... |
My father died recently and I've inherited his Mac. I'd love to put it to use in my own life, but I don't want to wipe its brains out just so I can reconfigure it to use in my network, etc. His old files are historically important to me—I trust you can understand my desire to keep them.
I can log in as I had an account... | I'm sorry to hear about your father's passing. It's understandable that you want to preserve his files while also configuring the Mac for your own use. Here are some steps you can take to access the files without wiping the machine:
### Step 1: Accessing Files
Since you have your own account on the Mac, you can access... | 20,937 | [
{
"from": "human",
"value": "My father died recently and I've inherited his Mac. I'd love to put it to use in my own life, but I don't want to wipe its brains out just so I can reconfigure it to use in my network, etc. His old files are historically important to me—I trust you can understand my desire to ke... |
I want do something like this:
Result = 'MyString' in [string1, string2, string3, string4];
This can't be used with strings and I don't want to do something like this:
Result = (('MyString' = string1) or ('MyString' = string2));
Also I think that creating a StringList to do just this is too complex.
Is there some oth... | In many programming languages, you can achieve the functionality you are looking for using built-in functions or methods without needing to create a string list or use complex structures. Since you haven't specified a programming language, I'll provide examples in a few common ones.
### Python
In Python, you can use t... | 25,987 | [
{
"from": "human",
"value": "I want do something like this:\nResult = 'MyString' in [string1, string2, string3, string4];\n\nThis can't be used with strings and I don't want to do something like this:\nResult = (('MyString' = string1) or ('MyString' = string2));\n\nAlso I think that creating a StringList to... |
I need to change the app name based on what configuration I'm using in Visual Studio. For example, if I'm in Debug configuration, I want the app name to show as 'App_Debug' in the Application field in the Elmah_Error table. Does anyone have any experience with this? Or is there another way to do it?
| Yes, you can achieve this by using build configurations and the preprocessor directives in C#. This way, you can define different application names based on the configuration you're using in Visual Studio.
Here’s how you can do it:
1. **Define Constants in Build Configuration:**
First, you need to set up the appl... | 27,239 | [
{
"from": "human",
"value": "I need to change the app name based on what configuration I'm using in Visual Studio. For example, if I'm in Debug configuration, I want the app name to show as 'App_Debug' in the Application field in the Elmah_Error table. Does anyone have any experience with this? Or is there ... |
I'd like something like a generic, re-usable getPosition() method that will tell me the number of bytes read from the starting point of the stream. Ideally, I would prefer this to work with all InputStreams, so that I don't have to wrap each and every one of them as I get them from disparate sources.
Does such a beast... | Java's standard `InputStream` does not provide a built-in method for tracking the number of bytes read from the start of the stream. However, you can create a reusable counting input stream by extending `FilterInputStream`. Here’s a simple implementation of a `CountingInputStream` that counts the number of bytes read:
... | 27,571 | [
{
"from": "human",
"value": "I'd like something like a generic, re-usable getPosition() method that will tell me the number of bytes read from the starting point of the stream. Ideally, I would prefer this to work with all InputStreams, so that I don't have to wrap each and every one of them as I get them ... |
What is the single most important performance tuning area for a WCF Web service?
ASP.net Thread settings?
WCF throttling?
| The single most important performance tuning area for a WCF (Windows Communication Foundation) web service is **WCF throttling**.
WCF throttling settings allow you to control the number of concurrent calls, sessions, and instances that your service can handle, which directly impacts its performance and scalability. B... | 30,786 | [
{
"from": "human",
"value": "What is the single most important performance tuning area for a WCF Web service? \n\nASP.net Thread settings?\nWCF throttling?\n\n"
},
{
"from": "gpt",
"value": "The single most important performance tuning area for a WCF (Windows Communication Foundation) web servi... |
This'll be my first question on this platform. I've done lots of development using Flex, WebORB and ASP.NET. We have solved Concurrency problems with messaging (Pessimistic Concurrency Control). This works pretty good but it also makes the whole application dependent of the messaging. No messaging, no concurrency contr... | Your concerns about managing concurrency in a Rich Internet Application (RIA) while ensuring efficient use of resources are valid and common in application development. Let's discuss some strategies to handle this effectively.
### 1. **Optimistic Concurrency Control with Versioning**
Using version numbers (or timesta... | 26,169 | [
{
"from": "human",
"value": "This'll be my first question on this platform. I've done lots of development using Flex, WebORB and ASP.NET. We have solved Concurrency problems with messaging (Pessimistic Concurrency Control). This works pretty good but it also makes the whole application dependent of the mess... |
I am pretty new to VB.NET - and I'm struggling to convert the signature of the method in the following code snippet. The Expression<...>> bit.
Thanks in advance.
[QueryInterceptor("Orders")]
public Expression<Func<Orders,bool>> OnQueryOrders()
{
return o => o.Customer.ContactName ==
HttpContext.Curren... | In VB.NET, you can convert the C# code snippet to its VB.NET equivalent by following these steps. The method signature in C# uses `Expression<Func<Orders, bool>>`, which corresponds to `Expression(Of Func(Of Orders, Boolean))` in VB.NET.
Here's how you can convert your code:
```vb
<QueryInterceptor("Orders")>
Public... | 30,502 | [
{
"from": "human",
"value": "I am pretty new to VB.NET - and I'm struggling to convert the signature of the method in the following code snippet. The Expression<...>> bit.\nThanks in advance.\n [QueryInterceptor(\"Orders\")]\n public Expression<Func<Orders,bool>> OnQueryOrders()\n {\n return o => o.Cust... |
I'm working with an existing XML document which has a structure (in part) like so:
<Group>
<Entry>
<Name> Bob </Name>
<ID> 1 </ID>
</Entry>
<Entry>
<Name> Larry </Name>
</Entry>
</Group>
I'm using LINQ to XML to query the XDocument to retrieve all these entries as follows:
var i... | Yes, there is a cleaner way to achieve this using LINQ to XML without having to count the elements explicitly. Instead of checking the count of the `ID` elements, you can simply use a null check to determine if the `ID` element exists. This can make your code more concise and readable.
Here's how you can modify your L... | 30,065 | [
{
"from": "human",
"value": "I'm working with an existing XML document which has a structure (in part) like so:\n<Group>\n <Entry>\n <Name> Bob </Name>\n <ID> 1 </ID>\n </Entry>\n <Entry>\n <Name> Larry </Name>\n </Entry>\n</Group>\n\nI'm using LINQ to XML to query the XDocu... |
I work on a Fedora Linux box.
I have a whole host of binaries and libraries that I've installed locally under my home directory.
I'd like to set my system up so installing software there functions the same way (for me) as if the root user installed it without a prefix.
I can run binaries installed in ~/local/bin just f... | To set up your Fedora system to automatically find libraries in your local directories (`~/local/lib` and `~/local/lib64`) during the compilation phase, you can use the `PKG_CONFIG_PATH` environment variable for `pkg-config`, and `C_INCLUDE_PATH` and `CPLUS_INCLUDE_PATH` for C and C++ headers. However, to ensure that l... | 27,910 | [
{
"from": "human",
"value": "I work on a Fedora Linux box.\nI have a whole host of binaries and libraries that I've installed locally under my home directory.\nI'd like to set my system up so installing software there functions the same way (for me) as if the root user installed it without a prefix.\nI can ... |
Every time I do an hg diff file.ext I end up using a console diff application. I would like to use Kdiff3 or WinMerge (I'm using Windows).
Is there a way to change that? I can't find a reference in Mercurial documentation (I'm not talking about merge!).
| Yes, you can configure Mercurial to use an external diff tool like KDiff3 or WinMerge for displaying differences. Here's how you can set that up:
### For KDiff3
1. Open your Mercurial configuration file, which is usually located at `C:\Users\<YourUsername>\Mercurial.ini` or `C:\Users\<YourUsername>\.hgrc`. You can al... | 24,215 | [
{
"from": "human",
"value": "Every time I do an hg diff file.ext I end up using a console diff application. I would like to use Kdiff3 or WinMerge (I'm using Windows).\nIs there a way to change that? I can't find a reference in Mercurial documentation (I'm not talking about merge!). \n"
},
{
"from":... |
div#thing {
position: absolute;
top: 0px;
z-index: 2;
margin: 0 auto;
}
<div id="thing">
<p>text text text with no fixed size, variable font</p>
</div>
The div is at the top, but I can't center it with <center> or margin: 0 auto;
| The issue you're experiencing with centering a `div` with `position: absolute;` is that the `margin: 0 auto;` method does not work when the element is positioned absolutely. This is because `margin: auto;` only works with block elements that have a specified width, and with absolute positioning, the element is removed ... | 26,644 | [
{
"from": "human",
"value": "div#thing {\n position: absolute;\n top: 0px;\n z-index: 2;\n margin: 0 auto;\n}\n\n<div id=\"thing\">\n <p>text text text with no fixed size, variable font</p>\n</div>\n\nThe div is at the top, but I can't center it with <center> or margin: 0 auto;\n"
},
{
"from":... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.