instruction stringlengths 14 27.6k | completion stringlengths 3 38.3k | __original_row_idx int64 0 50k | conversations listlengths 2 2 |
|---|---|---|---|
Do you know managed tools for manipulating PowerPoint files?
The tool should be 100% managed code and offer the option to
handle .ppt and .pptx files.
| Yes, there are several managed libraries and tools for manipulating PowerPoint files (.ppt and .pptx) in .NET. Here are some of the most popular ones:
1. **Open XML SDK**:
- **Description**: This is a Microsoft library specifically designed for working with Open XML documents, including PowerPoint presentations. It... | 4,867 | [
{
"from": "human",
"value": "Do you know managed tools for manipulating PowerPoint files?\nThe tool should be 100% managed code and offer the option to\nhandle .ppt and .pptx files.\n"
},
{
"from": "gpt",
"value": "Yes, there are several managed libraries and tools for manipulating PowerPoint fi... |
I have designed database tables (normalised, on an MS SQL server) and created a standalone windows front end for an application that will be used by a handful of users to add and edit information. We will add a web interface to allow searching accross our production area at a later date.
I am concerned that if two user... | Handling concurrent edits in a database application is a common challenge, and you're right to consider the potential issues of lost updates due to concurrent editing. Here are some strategies you can employ, each with their pros and cons:
### 1. **Optimistic Concurrency Control**
This is the approach you've mentioned... | 3,085 | [
{
"from": "human",
"value": "I have designed database tables (normalised, on an MS SQL server) and created a standalone windows front end for an application that will be used by a handful of users to add and edit information. We will add a web interface to allow searching accross our production area at a la... |
When you're doing a usual gdb session on an executable file on the same computer, you can give the run command and it will start the program over again.
When you're running gdb on an embedded system, as with the command target localhost:3210, how do you start the program over again without quitting and restarting your ... | When using GDB to debug an embedded system through a remote target, such as connecting to a target using `target localhost:3210`, you can use the `run` command to start the program again, but there are some important steps to follow.
Here's how to restart your program without quitting GDB:
1. **Ensure you have loaded... | 6,582 | [
{
"from": "human",
"value": "When you're doing a usual gdb session on an executable file on the same computer, you can give the run command and it will start the program over again.\nWhen you're running gdb on an embedded system, as with the command target localhost:3210, how do you start the program over a... |
I'm working on a game where I create a random map of provinces (a la Risk or Diplomacy). To create that map, I'm first generating a series of semi-random points, then figuring the Delaunay triangulations of those points.
With that done, I am now looking to create a Voronoi diagram of the points to serve as a startin... | Creating a Voronoi diagram from a set of points is a fundamental problem in computational geometry and can indeed be done without needing to directly integrate with the Delaunay triangulation. Below, I'll outline a straightforward method to generate a Voronoi diagram using just the original points, and I'll also refere... | 4,764 | [
{
"from": "human",
"value": "I'm working on a game where I create a random map of provinces (a la Risk or Diplomacy). To create that map, I'm first generating a series of semi-random points, then figuring the Delaunay triangulations of those points. \nWith that done, I am now looking to create a Voronoi d... |
How does unix handle full path name with space and arguments ?
In windows we quote the path and add the command-line arguments after, how is it in unix?
"c:\foo folder with space\foo.exe" -help
update:
I meant how do I recognize a path from the command line arguments.
| In Unix-like systems (Linux, macOS, etc.), handling paths that contain spaces requires a different approach than in Windows. Here are the common methods to handle paths with spaces and to recognize command-line arguments:
### Quoting
You can enclose the entire path with single (`'`) or double quotes (`"`), which allo... | 4,662 | [
{
"from": "human",
"value": "How does unix handle full path name with space and arguments ?\nIn windows we quote the path and add the command-line arguments after, how is it in unix?\n \"c:\\foo folder with space\\foo.exe\" -help\n\nupdate:\nI meant how do I recognize a path from the command line arguments.... |
Let me start by saying that I do not advocate this approach, but I saw it recently and I was wondering if there was a name for it I could use to point the guilty party to. So here goes.
Now you have a method, and you want to return a value. You also want to return an error code. Of course, exceptions are a much bett... | The pattern you described is often referred to as the **Result Pattern** or **Result Type**. This pattern is commonly used in programming to encapsulate the outcome of a function that can either return a successful result or an error state without throwing exceptions.
In many languages, this pattern takes the form of... | 7,270 | [
{
"from": "human",
"value": "Let me start by saying that I do not advocate this approach, but I saw it recently and I was wondering if there was a name for it I could use to point the guilty party to. So here goes.\nNow you have a method, and you want to return a value. You also want to return an error co... |
How do I use RelativeSource with WPF bindings and what are the different use-cases?
| In WPF (Windows Presentation Foundation), the `RelativeSource` markup extension is a powerful feature used in data binding. It allows you to bind properties to elements in the visual tree that are not directly related in the object model. This is particularly useful when you want to access properties of ancestor elemen... | 4,021 | [
{
"from": "human",
"value": "How do I use RelativeSource with WPF bindings and what are the different use-cases?\n"
},
{
"from": "gpt",
"value": "In WPF (Windows Presentation Foundation), the `RelativeSource` markup extension is a powerful feature used in data binding. It allows you to bind prop... |
We have need for a "rating" system in a project we are working on, similar to the one in SO. However, in ours there are multiple entities that need to be "tagged" with a vote up (only up, never down, like an increment). Sometimes we will need to show all of the entities in order of what is rated highest, regardless of ... | To implement a voting/rating system that allows for multiple entities to be "tagged" with upvotes while also enabling mixed sorting based on ratings, you can consider the following data structures and algorithms:
### Data Structures
1. **Entity Representation**:
- Use a class or a structured object to represent ea... | 2,115 | [
{
"from": "human",
"value": "We have need for a \"rating\" system in a project we are working on, similar to the one in SO. However, in ours there are multiple entities that need to be \"tagged\" with a vote up (only up, never down, like an increment). Sometimes we will need to show all of the entities in o... |
In another question I posted yesterday, I got very good advice on how a Python script could be run as a service in Windows. What I'm left wondering is: How is Windows aware of the services that can be managed in the native tools ("services" window in "administrative tools"). I. e. what is the Windows equivalent of putt... | In Windows, services are managed using the Service Control Manager (SCM), and their information is stored in the Windows Registry. To create a service that can be managed in the Services management console, you need to register the service correctly, which involves specifying the service's executable and relevant confi... | 4,442 | [
{
"from": "human",
"value": "In another question I posted yesterday, I got very good advice on how a Python script could be run as a service in Windows. What I'm left wondering is: How is Windows aware of the services that can be managed in the native tools (\"services\" window in \"administrative tools\").... |
I want to scrape some information off a football (soccer) web page using simple python regexp's. The problem is that players such as the first chap, ÄÄRITALO, comes out as ÄÄRITALO!
That is, html uses escaped markup for the special characters, such as Ä
Is there a simple way of reading the html into the... | Yes, there is a simple way to handle HTML entities like `Ä` in Python, even when using regular expressions. Python provides libraries that can decode HTML entities into their corresponding characters. The `html` module in the standard library is one of the easiest ways to achieve this.
You can use the `html.unesc... | 6,207 | [
{
"from": "human",
"value": "I want to scrape some information off a football (soccer) web page using simple python regexp's. The problem is that players such as the first chap, ÄÄRITALO, comes out as ÄÄRITALO!\nThat is, html uses escaped markup for the special characters, such as Ä\nIs ther... |
I understand what System.WeakReference does, but what I can't seem to grasp is a practical example of what it might be useful for. The class itself seems to me to be, well, a hack. It seems to me that there are other, better means of solving a problem where a WeakReference is used in examples I've seen. What's the ca... | You're correct that `System.WeakReference` can often feel like a hack, and it’s true that in many cases there are alternative approaches to managing memory and references in .NET. However, there are still scenarios where `WeakReference` can be particularly useful. Here are a few canonical examples:
### 1. Caching Obje... | 3,833 | [
{
"from": "human",
"value": "I understand what System.WeakReference does, but what I can't seem to grasp is a practical example of what it might be useful for. The class itself seems to me to be, well, a hack. It seems to me that there are other, better means of solving a problem where a WeakReference is u... |
I have Carbide.c++ Developer from Nokia and I want to create applications for my S60 phone.
I've looked at the samples that goes with the different SDK's for S60 but I haven't found any simple explanation on how strings, called descriptors, are used in Symbian.
One of the problems are that I'm visually impaired and the... | Certainly! Working with strings in Symbian OS can be a bit tricky if you're coming from a background where strings are handled differently. In Symbian, strings are represented by a class called `TDes`, which stands for "Descriptor." Here's a simplified explanation of how descriptors work, along with some key points and... | 5,867 | [
{
"from": "human",
"value": "I have Carbide.c++ Developer from Nokia and I want to create applications for my S60 phone.\nI've looked at the samples that goes with the different SDK's for S60 but I haven't found any simple explanation on how strings, called descriptors, are used in Symbian.\nOne of the prob... |
I have a bulletin board (punBB based) that I was running out of the root directory for a couple of years. I foolishly decided to do a little gardening and in the process moved the punbb code into it's own subdirectory. The code works great; as long as you point the browser at the new subdirectory. The issue is that the... | You can achieve the desired behavior using URL rewriting with mod_rewrite in your `.htaccess` file. Here’s how you can set it up to redirect users to your PunBB installation in the subdirectory while allowing them to access it as if it were in the root.
### Option 1: Redirect users from the root to the subdirectory
I... | 5,922 | [
{
"from": "human",
"value": "I have a bulletin board (punBB based) that I was running out of the root directory for a couple of years. I foolishly decided to do a little gardening and in the process moved the punbb code into it's own subdirectory. The code works great; as long as you point the browser at th... |
Anybody has an idea what this custom table is used for and what is the meaning of this column in particular? Documentation is silent about it and the info on the Net is scarce.
| To provide a meaningful response, I would need more specific details about the custom table and the particular column you're referring to. If you can share the name of the table, the column in question, and any relevant context (such as the application or system it is related to), I can help you interpret its possible ... | 8,583 | [
{
"from": "human",
"value": "Anybody has an idea what this custom table is used for and what is the meaning of this column in particular? Documentation is silent about it and the info on the Net is scarce.\n"
},
{
"from": "gpt",
"value": "To provide a meaningful response, I would need more speci... |
I have two separate mercurial repositories. At this point it makes sense that they "become one" because I want to work on the two projects simultaneously.
I'd really like the two projects to each be a subdirectory in the new repository.
How do I merge the two projects?
Is this a good idea, or should I
keep them separa... | Merging two Mercurial repositories into one can be a practical decision if you plan to work on both projects simultaneously and find it beneficial to have them under one roof. There are different ways to approach this, and you should consider the following points before proceeding:
### Considerations Before Merging
1.... | 4,356 | [
{
"from": "human",
"value": "I have two separate mercurial repositories. At this point it makes sense that they \"become one\" because I want to work on the two projects simultaneously.\nI'd really like the two projects to each be a subdirectory in the new repository.\n\nHow do I merge the two projects?\nIs... |
What are some real world places that call for delegates? I'm curious what situations or patterns are present where this method is the best solution. No code required.
| Delegates, or representative decision-making systems, are used in various real-world scenarios to streamline processes, involve multiple stakeholders, and ensure that a broader perspective is considered. Here are some examples of situations and patterns where delegates are beneficial:
1. **Political Systems:**
- **... | 4,655 | [
{
"from": "human",
"value": "What are some real world places that call for delegates? I'm curious what situations or patterns are present where this method is the best solution. No code required.\n"
},
{
"from": "gpt",
"value": "Delegates, or representative decision-making systems, are used in... |
I want to limit my users to a directory and its sub directories but the "Parent Directory" button allows them to browse to an arbitrary directory.
How should I go about doing that?
| To limit users to a specific directory and its subdirectories, preventing them from navigating up to the parent directory, you can use a combination of user permissions and configuration settings depending on your server environment. Here are some common methods based on the type of server you are using.
### For Apach... | 4,041 | [
{
"from": "human",
"value": "I want to limit my users to a directory and its sub directories but the \"Parent Directory\" button allows them to browse to an arbitrary directory.\nHow should I go about doing that?\n"
},
{
"from": "gpt",
"value": "To limit users to a specific directory and its sub... |
Is there a list of 3D cards available that provide full scene antialiasing as well as which are able to do it in hardware (decent performance)?
| Full Scene Antialiasing (FSAA) is a technique used in 3D graphics to smooth out the edges of rendered objects, reducing the jagged edges that can occur due to pixelation. Here’s a general overview of 3D graphics cards that support FSAA in hardware and are known for decent performance:
### NVIDIA Graphics Cards:
1. **N... | 5,100 | [
{
"from": "human",
"value": "Is there a list of 3D cards available that provide full scene antialiasing as well as which are able to do it in hardware (decent performance)?\n"
},
{
"from": "gpt",
"value": "Full Scene Antialiasing (FSAA) is a technique used in 3D graphics to smooth out the edges ... |
What's the best way to get user input in a C program where the choices are of a limited number?
Say for example the choices are:
A) Print the list.
B) Add 99 to the end of the list.
C) Delete all duplicates.
5) Reset 5 times.
Entering "A" and then Enter is OK.
Or, just a single keystroke would work as well.
| When designing a C program to get user input for a limited number of choices, it's important to provide a clear prompt and handle input correctly. Based on your requirements, I'll show you how to implement this, allowing the user to input their choice by pressing a key followed by Enter, or using single keystrokes.
He... | 5,003 | [
{
"from": "human",
"value": "What's the best way to get user input in a C program where the choices are of a limited number?\nSay for example the choices are:\nA) Print the list.\nB) Add 99 to the end of the list.\nC) Delete all duplicates.\n5) Reset 5 times.\nEntering \"A\" and then Enter is OK.\nOr, just ... |
How do I avoid read locks in my database?
Answers for multiple databases welcome!
| Avoiding read locks in your database can be essential for improving performance and ensuring that your applications remain responsive. Here are strategies tailored to various types of databases:
### General Strategies
1. **Use Non-blocking Reads:**
- In many databases, you can utilize snapshot isolation or versioni... | 5,025 | [
{
"from": "human",
"value": "How do I avoid read locks in my database?\nAnswers for multiple databases welcome!\n"
},
{
"from": "gpt",
"value": "Avoiding read locks in your database can be essential for improving performance and ensuring that your applications remain responsive. Here are strateg... |
I have seen simple example Ajax source codes in many online tutorials. What I want to know is whether using the source code in the examples are perfectly alright or not?
Is there anything more to be added to the code that goes into a real world application?
What all steps are to be taken to make the application more ro... | Using example AJAX source code, like the one you've provided, is common for learning purposes, but there are several considerations to keep in mind when adapting such code for real-world applications. Here are some key points to enhance the robustness and security of your AJAX implementation:
### 1. Error Handling:
- ... | 2,421 | [
{
"from": "human",
"value": "I have seen simple example Ajax source codes in many online tutorials. What I want to know is whether using the source code in the examples are perfectly alright or not?\nIs there anything more to be added to the code that goes into a real world application?\nWhat all steps are ... |
When doing an INSERT with a lot of data, ie:
INSERT INTO table (mediumtext_field) VALUES ('...lots of text here: about 2MB worth...')
MySQL returns
"OperationalError: (2006, 'MySQL server has gone away')"
This is happening within a minute of starting the script, so it is not a timeout issue. Also, mediumtext_field ... | The error "OperationalError: (2006, 'MySQL server has gone away')" typically indicates that the MySQL server has closed the connection or is unable to handle the request you are trying to perform. There are several possible reasons for this error, especially when inserting a large amount of data. Here are some common c... | 4,250 | [
{
"from": "human",
"value": "When doing an INSERT with a lot of data, ie:\nINSERT INTO table (mediumtext_field) VALUES ('...lots of text here: about 2MB worth...')\n\nMySQL returns \n\n\"OperationalError: (2006, 'MySQL server has gone away')\"\n\nThis is happening within a minute of starting the script, so ... |
Need to show a credits screen where I want to acknowledge the many contributors to my application.
Want it to be an automatically scrolling box, much like the credits roll at the end of the film.
| Creating an automatically scrolling credits screen can be a great way to acknowledge contributors in your application. Below, I'll outline a simple example using HTML and CSS for the layout, along with some JavaScript to handle the scrolling effect.
Here's a basic implementation:
### HTML
```html
<!DOCTYPE html>
<h... | 2,114 | [
{
"from": "human",
"value": "Need to show a credits screen where I want to acknowledge the many contributors to my application. \nWant it to be an automatically scrolling box, much like the credits roll at the end of the film.\n"
},
{
"from": "gpt",
"value": "Creating an automatically scrolling ... |
I want to consolidate all the loose information of the company I work for into a knowledge base. A wiki seems to be the way to go, but most of the relevant information is buried inside PST files, and it would take ages to convince people to manually translate their emails one by one (including attachments) into wiki pa... | Creating a knowledge base from existing email data is indeed a challenging task, especially when dealing with PST files. Fortunately, there are a few options you can consider for a wiki engine that supports page creation via email.
### Existing Wiki Engines with Email Support
1. **TiddlyWiki**
- **Description**: W... | 2,498 | [
{
"from": "human",
"value": "I want to consolidate all the loose information of the company I work for into a knowledge base. A wiki seems to be the way to go, but most of the relevant information is buried inside PST files, and it would take ages to convince people to manually translate their emails one by... |
Is there a system stored procedure to get the version #?
| Yes, in SQL Server, you can use the system stored procedure `sp_version` to get the version number of the SQL Server instance. However, `sp_version` is deprecated, and a more common way to retrieve the version information is to use the following command:
```sql
SELECT @@VERSION;
```
This command returns detailed info... | 8,201 | [
{
"from": "human",
"value": "Is there a system stored procedure to get the version #?\n"
},
{
"from": "gpt",
"value": "Yes, in SQL Server, you can use the system stored procedure `sp_version` to get the version number of the SQL Server instance. However, `sp_version` is deprecated, and a more co... |
The cvsnt manual provides a detailed list of parameters than can be passed to the postcommand module, but none of them specify the file name.
Is anybody aware of an option not listed here that would provide the name of the file being checked in?
ColinYounger - The %c command is just the command, e.g. "Commit"
| In CVSNT, when using the post-command hooks like the `postcommand` module, it’s common to want to get details about the files being committed, such as their names. Unfortunately, the standard parameters that you can access in the post-command hooks do not explicitly include the name of the files being checked in.
Howe... | 6,786 | [
{
"from": "human",
"value": "The cvsnt manual provides a detailed list of parameters than can be passed to the postcommand module, but none of them specify the file name.\nIs anybody aware of an option not listed here that would provide the name of the file being checked in?\nColinYounger - The %c command i... |
I have the following code snippet.
$items['A'] = "Test";
$items['B'] = "Test";
$items['C'] = "Test";
$items['D'] = "Test";
$index = 0;
foreach($items as $key => $value)
{
echo "$index is a $key containing $value\n";
$index++;
}
Expected output:
0 is a A containing Test
1 is a B containing Test
2 is a C contai... | Yes, you can achieve the expected output without explicitly using an `$index` variable by utilizing the `array_keys` function in combination with a `foreach` loop. Here’s how you can do it:
```php
$items['A'] = "Test";
$items['B'] = "Test";
$items['C'] = "Test";
$items['D'] = "Test";
foreach (array_keys($items) as $i... | 4,783 | [
{
"from": "human",
"value": "I have the following code snippet.\n$items['A'] = \"Test\";\n$items['B'] = \"Test\";\n$items['C'] = \"Test\";\n$items['D'] = \"Test\";\n\n$index = 0;\nforeach($items as $key => $value)\n{\n echo \"$index is a $key containing $value\\n\";\n $index++;\n}\n\nExpected output:\... |
In the herding code podcast 14 someone mentions that stackoverflow displayed the queries that were executed during a request at the bottom of the page.
It sounds like an excellent idea to me. Every time a page loads I want to know what sql statements are executed and also a count of the total number of DB round trips.... | Your solution for logging SQL queries executed during a request and displaying them at the bottom of the page is a solid approach, especially for development and debugging purposes. Here are some additional suggestions and considerations to enhance your implementation:
### Enhancements
1. **Conditional Logging**: You... | 5,099 | [
{
"from": "human",
"value": "In the herding code podcast 14 someone mentions that stackoverflow displayed the queries that were executed during a request at the bottom of the page. \nIt sounds like an excellent idea to me. Every time a page loads I want to know what sql statements are executed and also a co... |
Is there a way to make a TSQL variable constant?
| In T-SQL (Transact-SQL), there is no built-in way to define a variable as a constant in the strict sense (like you might find in other programming languages). Once a variable is declared, it can be reassigned or changed. However, you can adopt certain practices to emulate the behavior of constants:
1. **Use `DECLARE` ... | 5,453 | [
{
"from": "human",
"value": "Is there a way to make a TSQL variable constant?\n"
},
{
"from": "gpt",
"value": "In T-SQL (Transact-SQL), there is no built-in way to define a variable as a constant in the strict sense (like you might find in other programming languages). Once a variable is declare... |
I'm currently using DPack as this adds a "Collapse All Projects" option to the Solution node in Solution Explorer. It works pretty well but can take a while to execute and doesn't always collapse everything fully.
Are there any better alternatives? Preferably free and easy to install/setup. There are lots out there but... | If you're looking for alternatives to DPack that provide a "Collapse All Projects" functionality in Visual Studio, there are a few options you can consider, many of which are free and relatively easy to set up:
1. **Visual Studio Extensions Marketplace**: Check for other extensions that specifically target Solution Ex... | 3,140 | [
{
"from": "human",
"value": "I'm currently using DPack as this adds a \"Collapse All Projects\" option to the Solution node in Solution Explorer. It works pretty well but can take a while to execute and doesn't always collapse everything fully.\nAre there any better alternatives? Preferably free and easy to... |
Alan Storm's comments in response to my answer regarding the with statement got me thinking. I've seldom found a reason to use this particular language feature, and had never given much thought to how it might cause trouble. Now, I'm curious as to how I might make effective use of with, while avoiding its pitfalls.
Whe... | The `with` statement in Python is a context manager that simplifies resource management by ensuring that resources are properly acquired and released. This is especially useful for handling resources like file streams, network connections, and locks. Here are some common scenarios where the `with` statement shines, alo... | 3,127 | [
{
"from": "human",
"value": "Alan Storm's comments in response to my answer regarding the with statement got me thinking. I've seldom found a reason to use this particular language feature, and had never given much thought to how it might cause trouble. Now, I'm curious as to how I might make effective use ... |
We have a SharePoint WSS site and some of our users on on the Mac OSX platform. Are there any tips or tricks to get a similar experience to Windows with document shares and calendars on the Mac?
Edit: Browsing a SharePoint WSS site on a Mac, whether using Firefox or Safari, has a very similar look and feel as it does ... | Integrating SharePoint WSS with Mac OS X to achieve a similar experience as Windows can be challenging, but there are several strategies you can employ to improve your workflow with document libraries and calendars. Here are some tips and tricks to get started:
### 1. **Use Microsoft Outlook for Mac:**
- If your or... | 5,594 | [
{
"from": "human",
"value": "We have a SharePoint WSS site and some of our users on on the Mac OSX platform. Are there any tips or tricks to get a similar experience to Windows with document shares and calendars on the Mac?\nEdit: Browsing a SharePoint WSS site on a Mac, whether using Firefox or Safari, ha... |
I am reading in CSV file and translating it to an SQL Table. The kicker is that one of the columns in the table is of data type ID that needs to be set to a constant (in this case 2). I am not sure how to do this.
| To read a CSV file and translate it into an SQL table with a constant value for a specific column, you can follow these steps. I'll provide a general approach using Python's `pandas` library for reading the CSV file and `SQLAlchemy` for inserting the data into the database.
### Steps to Insert Data into SQL with a Con... | 4,228 | [
{
"from": "human",
"value": "I am reading in CSV file and translating it to an SQL Table. The kicker is that one of the columns in the table is of data type ID that needs to be set to a constant (in this case 2). I am not sure how to do this.\n"
},
{
"from": "gpt",
"value": "To read a CSV file ... |
If the owner of a web site wants to track who their users are as much as possible, what things can they capture (and how). You might want to know about this in order to capture information on a site you create or, as a user, to prevent a site from capturing data on you.
Here is a starting list, but I'm sure I have miss... | Here’s one item that can be captured by website owners to track users:
### Geolocation Data
**Description**: Websites can access a user's geographic location through the Geolocation API, which is built into most modern browsers. This requires user consent, as the browser will prompt the user to allow the site to acce... | 7,922 | [
{
"from": "human",
"value": "If the owner of a web site wants to track who their users are as much as possible, what things can they capture (and how). You might want to know about this in order to capture information on a site you create or, as a user, to prevent a site from capturing data on you.\nHere is... |
I'm writing a CMS application in PHP and one of the requirements is that it must be able to interface with the customer's Exchange server. I've written up this functionality a few times before and have always used WebDAV to do it, but now I'm leaning away from that.
I will be running the site on IIS OR Apache (no pref... | You're not being silly at all; it's good that you're considering the long-term maintainability and support of your solution. Here are a few alternatives to WebDAV for interfacing with an Exchange server that you might find useful:
### 1. **Exchange Web Services (EWS) API**
The Exchange Web Services API is the modern w... | 2,744 | [
{
"from": "human",
"value": "I'm writing a CMS application in PHP and one of the requirements is that it must be able to interface with the customer's Exchange server. I've written up this functionality a few times before and have always used WebDAV to do it, but now I'm leaning away from that.\nI will be ... |
I am trying to create a query string of variable assignments separated by the & symbol (ex: "var1=x&var2=y&..."). I plan to pass this string into an embedded flash file.
I am having trouble getting an & symbol to show up in XSLT. If I just type & with no tags around it, there is a problem rendering the XSLT document. I... | In XSLT, special characters like `&` need to be properly encoded to avoid rendering issues in the resulting XML or HTML. The correct way to represent an `&` symbol in an XSLT document is to use `&`, but you need to ensure you're using it in the correct context to get it in your output.
If you want to create a quer... | 6,439 | [
{
"from": "human",
"value": "I am trying to create a query string of variable assignments separated by the & symbol (ex: \"var1=x&var2=y&...\"). I plan to pass this string into an embedded flash file.\nI am having trouble getting an & symbol to show up in XSLT. If I just type & with no tags around it, there... |
What is a good way to select all or select no items in a listview without using:
foreach (ListViewItem item in listView1.Items)
{
item.Selected = true;
}
or
foreach (ListViewItem item in listView1.Items)
{
item.Selected = false;
}
I know the underlying Win32 listview common control supports LVM_SETITEMSTATE message... | If you're looking to select all items in a `ListView` without using a `foreach` loop, you can take advantage of the `ListView`'s built-in `SelectedIndices` property. You can add all the indices to this collection to effectively select all items.
Here's how you can implement both selecting all items and deselecting all... | 6,598 | [
{
"from": "human",
"value": "What is a good way to select all or select no items in a listview without using:\nforeach (ListViewItem item in listView1.Items)\n{\n item.Selected = true;\n}\n\nor\nforeach (ListViewItem item in listView1.Items)\n{\n item.Selected = false;\n}\n\nI know the underlying Win32 list... |
How would you programmacially abbreviate XHTML to an arbitrary number of words without leaving unclosed or corrupted tags?
i.e.
<p>
Proin tristique dapibus neque. Nam eget purus sit amet leo
tincidunt accumsan.
</p>
<p>
Proin semper, orci at mattis blandit, augue justo blandit nulla.
<span>Quisque ante ... | To abbreviate XHTML content while ensuring that tags remain properly closed and are not corrupted, you can follow a systematic approach in a programming language like Python. Here's a step-by-step method to achieve this:
1. **Parse the XHTML**: Use a library to parse the XHTML and manipulate the text nodes while prese... | 4,557 | [
{
"from": "human",
"value": "How would you programmacially abbreviate XHTML to an arbitrary number of words without leaving unclosed or corrupted tags?\ni.e.\n<p>\n Proin tristique dapibus neque. Nam eget purus sit amet leo\n tincidunt accumsan.\n</p>\n<p>\n Proin semper, orci at mattis blandit, au... |
Is there a way of getting the process id of my C++ application? I am using the Carbon framework, but not Cocoa…
| Yes, you can get the process ID of your C++ application while using the Carbon framework on macOS. In Carbon, you can use the `GetCurrentProcess` function to obtain the current process and then retrieve its process ID using the `GetProcessID` function.
Here’s a simple example demonstrating how to do this:
```cpp
#inc... | 7,353 | [
{
"from": "human",
"value": "Is there a way of getting the process id of my C++ application? I am using the Carbon framework, but not Cocoa…\n"
},
{
"from": "gpt",
"value": "Yes, you can get the process ID of your C++ application while using the Carbon framework on macOS. In Carbon, you can use ... |
What's the easiest way to profile a PHP script?
I'd love tacking something on that shows me a dump of all function calls and how long they took but I'm also OK with putting something around specific functions.
I tried experimenting with the microtime function:
$then = microtime();
myFunc();
$now = microtime();
echo sp... | Profiling a PHP script to measure function call times can be accomplished in several ways, and you have a few options that can help you gather more comprehensive data without needing to sprinkle timing code throughout your functions manually. Below are a couple of approaches that you can use to profile your PHP script ... | 3,612 | [
{
"from": "human",
"value": "What's the easiest way to profile a PHP script?\nI'd love tacking something on that shows me a dump of all function calls and how long they took but I'm also OK with putting something around specific functions.\nI tried experimenting with the microtime function:\n$then = microti... |
The first time I load the website in the production web server, it start very slow, subsequent pages load very quickly (included the home page).
I precompiled the site, but nothing changes.
I don't have any code at Application start.
I don't have cached items.
Any ideas? How can I find out what is happening?
| When a web application behaves differently on the first load compared to subsequent requests, it can be due to several reasons. Here are some common factors that can contribute to the initial slow performance, along with suggestions on how to diagnose and improve it:
### 1. **Cold Start**:
- **Reason**: The first r... | 3,557 | [
{
"from": "human",
"value": "The first time I load the website in the production web server, it start very slow, subsequent pages load very quickly (included the home page).\nI precompiled the site, but nothing changes. \nI don't have any code at Application start.\nI don't have cached items.\nAny ideas? Ho... |
Is there any way to have a binary compiled from an ActionScript 3 project print stuff to stdout when executed?
From what I've gathered, people have been going around this limitation by writing hacks that rely on local socket connections and AIR apps that write to files in the local filesystem, but that's pretty much it... | In ActionScript 3, particularly when working with Flash Player, the limitations for printing to stdout or interacting with the system's console directly are indeed quite strict due to the sandboxing nature of Flash. AIR applications offer more flexibility compared to the browser-based Flash Player, but even in AIR, the... | 6,239 | [
{
"from": "human",
"value": "Is there any way to have a binary compiled from an ActionScript 3 project print stuff to stdout when executed?\nFrom what I've gathered, people have been going around this limitation by writing hacks that rely on local socket connections and AIR apps that write to files in the l... |
When writing C/C++ code, in order to debug the binary executable the debug option must be enabled on the compiler/linker. In the case of GCC, the option is -g. When the debug option is enabled, how does the affect the binary executable? What additional data is stored in the file that allows the debugger to function ... | When you compile C/C++ code with the `-g` option using GCC (GNU Compiler Collection), it enables the inclusion of debugging information in the generated binary executable. This additional information allows debuggers, such as GDB (GNU Debugger), to provide more insights and functionality when debugging the program. Her... | 5,710 | [
{
"from": "human",
"value": "When writing C/C++ code, in order to debug the binary executable the debug option must be enabled on the compiler/linker. In the case of GCC, the option is -g. When the debug option is enabled, how does the affect the binary executable? What additional data is stored in the f... |
Is it possible to compile and run OpenGL programs from under Cygwin? If yes, how?
| Yes, it is possible to compile and run OpenGL programs using Cygwin. Cygwin provides a Unix-like environment on Windows, which includes a collection of tools and libraries, including the necessary libraries for OpenGL. Below are the steps to set up your Cygwin environment for OpenGL development.
### Step 1: Install Cy... | 2,318 | [
{
"from": "human",
"value": "Is it possible to compile and run OpenGL programs from under Cygwin? If yes, how?\n"
},
{
"from": "gpt",
"value": "Yes, it is possible to compile and run OpenGL programs using Cygwin. Cygwin provides a Unix-like environment on Windows, which includes a collection of ... |
I just read up on a performance of LINQ, and there is a HUGE amount to be gained by using Compiled LINQ.
Now, why won't I always use compiled LINQ?
| Compiled LINQ can indeed provide performance improvements in certain scenarios, especially for complex queries that are executed frequently. However, there are several reasons why you might not always want to use compiled LINQ:
1. **Initial Compilation Overhead**: Compiled LINQ queries require an initial compilation s... | 1,884 | [
{
"from": "human",
"value": "I just read up on a performance of LINQ, and there is a HUGE amount to be gained by using Compiled LINQ.\nNow, why won't I always use compiled LINQ?\n"
},
{
"from": "gpt",
"value": "Compiled LINQ can indeed provide performance improvements in certain scenarios, espec... |
I am trying to refactor some code I have for software that collects current status of agents in a call queue. Currently, for each of the 6 or so events that I listen to, I check in a Mnesia table if an agent exists and change some values in the row depending on the event or add it as new if the agent doesn't exist. Cur... | To achieve the goal of refactoring your code for handling the agent statuses in a call queue, you can create a function `change_agent/2` that modifies the existing agent record or creates a new record if the agent doesn't already exist. In Erlang, records are typically defined at compile time, and they cannot be modifi... | 3,471 | [
{
"from": "human",
"value": "I am trying to refactor some code I have for software that collects current status of agents in a call queue. Currently, for each of the 6 or so events that I listen to, I check in a Mnesia table if an agent exists and change some values in the row depending on the event or add ... |
Does anyone know if it is possible to display a prompt to a user/administrator when activating or installing a sharepoint feature?
I am writing a custom webpart and it is connecting to a separate database, I would like to allow the administrator to select or type in a connection string when installing the .wsp file o... | In SharePoint, activating or installing a feature does not provide a built-in mechanism to prompt an administrator for input. However, you can create a workaround to achieve a similar result by combining several approaches:
1. **Use a Custom Web Part for Configuration**: Instead of asking for the connection string dur... | 5,098 | [
{
"from": "human",
"value": "Does anyone know if it is possible to display a prompt to a user/administrator when activating or installing a sharepoint feature? \nI am writing a custom webpart and it is connecting to a separate database, I would like to allow the administrator to select or type in a connect... |
I constantly hear how bad reflection is to use. While I generally avoid reflection and rarely find situations where it is impossible to solve my problem without it, I was wondering...
For those who have used reflection in applications, have you measured performance hits and, is it really so bad?
| Reflection in programming, particularly in languages like Java, C#, and others, allows you to inspect and manipulate the structure of classes, methods, and fields at runtime. While it provides powerful capabilities, such as dynamic method invocation and accessing private fields, it can have several downsides that are w... | 4,477 | [
{
"from": "human",
"value": "I constantly hear how bad reflection is to use. While I generally avoid reflection and rarely find situations where it is impossible to solve my problem without it, I was wondering... \nFor those who have used reflection in applications, have you measured performance hits and,... |
What recommendations can you give for a system which must do the following:
Load Plugins (and eventually execute them) but have 2 methods of loading these plugins:
Load only authorized plugins
(developed by the owner of the
software)
Load all plugins
And we need to be reasonably secure that the authorized plugins a... | Creating a secure plugin system requires careful consideration of how plugins are loaded, verified, and executed. Below are several recommendations for implementing a plugin architecture that addresses your requirements for loading both authorized and all plugins while ensuring the integrity and authenticity of the aut... | 2,326 | [
{
"from": "human",
"value": "What recommendations can you give for a system which must do the following:\nLoad Plugins (and eventually execute them) but have 2 methods of loading these plugins:\n\nLoad only authorized plugins\n(developed by the owner of the\nsoftware) \nLoad all plugins\n\nAnd we need to b... |
How do I make a user's browser blink/flash/highlight in the task bar using JavaScript? For example, if I make an AJAX request every 10 seconds to see if the user has any new messages on the server, I want the user to know it right away, even if he is using another application at the time.
Edit: These users do want to b... | To make a user's browser tab blink or flash in the taskbar when there’s a new message, you can utilize the `document.title` to change the tab text and create a notification sound. Here's a basic example of how you can implement this using JavaScript:
### HTML Structure
```html
<!DOCTYPE html>
<html lang="en">
<head>
... | 5,095 | [
{
"from": "human",
"value": "How do I make a user's browser blink/flash/highlight in the task bar using JavaScript? For example, if I make an AJAX request every 10 seconds to see if the user has any new messages on the server, I want the user to know it right away, even if he is using another application at... |
What is the best way to use PyGame (SDL) within a PyGTK application?
I'm searching for a method that allows me to have a drawing area in the GTK window and at the same time being able to manage both GTK and SDL events.
| Integrating PyGame (which is built on SDL) into a PyGTK application can be challenging since both libraries manage their own event loops. However, you can achieve this by embedding a PyGame surface inside a PyGTK widget and managing both GTK and SDL events appropriately. Here's a basic outline of how to set it up:
###... | 1,087 | [
{
"from": "human",
"value": "What is the best way to use PyGame (SDL) within a PyGTK application?\nI'm searching for a method that allows me to have a drawing area in the GTK window and at the same time being able to manage both GTK and SDL events.\n"
},
{
"from": "gpt",
"value": "Integrating Py... |
In C# documentation tags allow you to produce output similar to MSDN. What are a list of allowable tags for use inside the /// (triple slash) comment area above classes, methods, and properties?
| In C#, XML documentation comments (which use the `///` syntax) support a variety of tags that help structure and describe code elements such as classes, methods, and properties. Here’s a list of common XML documentation tags that you can use:
1. `<summary>`: A summary of what the class, method, or property does.
2. `<... | 5,498 | [
{
"from": "human",
"value": "In C# documentation tags allow you to produce output similar to MSDN. What are a list of allowable tags for use inside the /// (triple slash) comment area above classes, methods, and properties?\n"
},
{
"from": "gpt",
"value": "In C#, XML documentation comments (whi... |
I have a ComboBox that I bind to a standard HTTPService, I would like to add an event listener so that I can run some code after the ComboBox is populated from the data provider.
How can I do this?
| To run code after a ComboBox is populated from a data provider when you're using an HTTPService in Flex (or ActionScript), you can listen for the `result` event of the HTTPService. After the data is retrieved and the ComboBox is populated, you can execute your desired logic.
Here’s a step-by-step guide on how to achi... | 5,183 | [
{
"from": "human",
"value": "I have a ComboBox that I bind to a standard HTTPService, I would like to add an event listener so that I can run some code after the ComboBox is populated from the data provider.\nHow can I do this?\n"
},
{
"from": "gpt",
"value": "To run code after a ComboBox is pop... |
If I remove all the ' characters from a SQL query, is there some other way to do a SQL injection attack on the database?
How can it be done? Can anyone give me examples?
| SQL injection is a technique used to exploit vulnerabilities in applications that construct SQL queries from user inputs. Removing single quotes (`'`) from a SQL query can make it more challenging to execute a typical SQL injection attack; however, it doesn't necessarily prevent all forms of SQL injection.
### Potenti... | 4,875 | [
{
"from": "human",
"value": "If I remove all the ' characters from a SQL query, is there some other way to do a SQL injection attack on the database?\nHow can it be done? Can anyone give me examples?\n"
},
{
"from": "gpt",
"value": "SQL injection is a technique used to exploit vulnerabilities in... |
I want to put a copyright notice in the footer of a web site, but I think it's incredibly tacky for the year to be outdated.
How would I make the year update automatically with PHP
| To automatically update the copyright year in the footer of your website using PHP, you can use the `date()` function, which retrieves the current year based on the server's local date and time. Here’s a simple example of how to implement it:
1. Open your PHP file where you want to place the copyright notice, typicall... | 5,556 | [
{
"from": "human",
"value": "I want to put a copyright notice in the footer of a web site, but I think it's incredibly tacky for the year to be outdated.\nHow would I make the year update automatically with PHP\n"
},
{
"from": "gpt",
"value": "To automatically update the copyright year in the fo... |
I have a network C++ program in Windows that I'd like to test for network disconnects at various times. What are my options?
Currently I am:
Actually disconnecting the network wire from the back of my computer
using ipconfig /release
Using the cports program to close out the socket completely
None of these methods t... | To test your network C++ program under various conditions such as network disconnects, read/write failures, and connection issues, there are several options and tools that can help you emulate network problems without physically unplugging cables or disrupting your actual network connection. Here are some strategies an... | 3,113 | [
{
"from": "human",
"value": "I have a network C++ program in Windows that I'd like to test for network disconnects at various times. What are my options?\nCurrently I am:\n\nActually disconnecting the network wire from the back of my computer\nusing ipconfig /release\nUsing the cports program to close out ... |
For example: Updating all rows of the customer table because you forgot to add the where clause.
What was it like, realizing it and reporting it to your coworkers or customers?
What were the lessons learned?
| Realizing that I had accidentally updated all rows in the customer table was a moment filled with a mix of panic and regret. It often feels like time freezes in those moments as the weight of the mistake sinks in. I quickly checked the database to confirm the extent of the changes, and my heart sank when I saw the resu... | 3,566 | [
{
"from": "human",
"value": "For example: Updating all rows of the customer table because you forgot to add the where clause.\n\nWhat was it like, realizing it and reporting it to your coworkers or customers? \nWhat were the lessons learned?\n\n"
},
{
"from": "gpt",
"value": "Realizing that I ha... |
On all my Windows servers, except for one machine, when I execute the following code to allocate a temporary files folder:
use CGI;
my $tmpfile = new CGITempFile(1);
print "tmpfile='", $tmpfile->as_string(), "'\n";
The variable $tmpfile is assigned the value '.\CGItemp1' and this is what I want. But on one of my serve... | It sounds like you've encountered some quirky behavior with the CGI module in Perl, particularly with how it determines the location for temporary files on your problematic server. Given that the other servers behave correctly while this one does not, it seems to be a combination of environment variables, folder permis... | 3,974 | [
{
"from": "human",
"value": "On all my Windows servers, except for one machine, when I execute the following code to allocate a temporary files folder:\nuse CGI;\nmy $tmpfile = new CGITempFile(1);\nprint \"tmpfile='\", $tmpfile->as_string(), \"'\\n\";\n\nThe variable $tmpfile is assigned the value '.\\CGIte... |
Is there any tool which will allow me to perform a free text search over a system's code, but only over the code which was actually executed during a particular invocation?
To give a bit of background, when learning my way around a new system, I frequently find myself wanting to discover where some particular value cam... | What you are looking for is often referred to as "dynamic code analysis" or "runtime code analysis," which allows you to focus your search on the code that is executed during a specific run of your application. Here are some tools and techniques that you might find useful for Perl and Java, as well as some general appr... | 4,746 | [
{
"from": "human",
"value": "Is there any tool which will allow me to perform a free text search over a system's code, but only over the code which was actually executed during a particular invocation?\nTo give a bit of background, when learning my way around a new system, I frequently find myself wanting t... |
Does anyone have battle stories to share trying to use Visual Studio to develop applications for Unix? And I'm not talking using .NET with a Mono or Wine virtual platform running beneath.
Our company has about 20 developers all running Windows XP/Vista and developing primarily for Linux & Solaris. Until recently we a... | It sounds like you've embarked on quite a journey with using Visual Studio for cross-platform development! Many developers have experienced similar challenges when trying to use a tool primarily designed for Windows to develop for Unix-like systems. Here are some thoughts and shared experiences from others who have fac... | 3,937 | [
{
"from": "human",
"value": "Does anyone have battle stories to share trying to use Visual Studio to develop applications for Unix? And I'm not talking using .NET with a Mono or Wine virtual platform running beneath.\nOur company has about 20 developers all running Windows XP/Vista and developing primarily... |
I have a vb6 form with an ocx control on it. The ocx control has a button on it that I want to press from code. How do I do this?
I have:
Dim b As CommandButton
Set b = ocx.GetButton("btnPrint")
SendMessage ocx.hwnd, WM_COMMAND, GetWindowLong(b.hwnd, GWL_ID), b.hwnd
but it doesn't seem to work.
| To programmatically trigger a button on an OCX control in VB6, you can use the method that is exposed by the control itself, rather than sending a message directly to the control. The `SendMessage` approach may not work reliably with ActiveX controls due to the way they handle their events.
Here's how you might do thi... | 5,627 | [
{
"from": "human",
"value": "I have a vb6 form with an ocx control on it. The ocx control has a button on it that I want to press from code. How do I do this?\nI have:\nDim b As CommandButton\nSet b = ocx.GetButton(\"btnPrint\")\nSendMessage ocx.hwnd, WM_COMMAND, GetWindowLong(b.hwnd, GWL_ID), b.hwnd\n\nbut... |
I've been trying to understand how to read the memory of other processes on Mac OS X, but I'm not having much luck. I've seen many examples online using ptrace with PEEKDATA and such, however it doesn't have that option on BSD [man ptrace].
int pid = fork();
if (pid > 0) {
// mess around with child-process's memory... | Reading and writing to the memory of another process on macOS (which is a variant of BSD) is not as straightforward as using `ptrace` since it does not provide the `PEEKDATA` option found in some other UNIX-like systems. Instead, macOS provides the `mach_vm_read` and `mach_vm_write` functions for interacting with memor... | 706 | [
{
"from": "human",
"value": "I've been trying to understand how to read the memory of other processes on Mac OS X, but I'm not having much luck. I've seen many examples online using ptrace with PEEKDATA and such, however it doesn't have that option on BSD [man ptrace].\nint pid = fork();\nif (pid > 0) {\n ... |
I am looking for a powerful meta-language to describa behaviour for an application i intend to use in offline mode (google-gears + javascript) and server side sqlite + (php/ruby/java etc) and looking for a good format to describe the model's behaviour which can be easily converted to the target languages.
Am I complete... | You're not completely off track; in fact, it's a reasonable approach to seek a powerful meta-language to describe the behavior of your application in both offline and server-side environments. However, there are several strategies and tools you can leverage that might align better with your requirements. Here are some ... | 4,650 | [
{
"from": "human",
"value": "I am looking for a powerful meta-language to describa behaviour for an application i intend to use in offline mode (google-gears + javascript) and server side sqlite + (php/ruby/java etc) and looking for a good format to describe the model's behaviour which can be easily convert... |
I am making a simple game in order to learn a new language. I am in the process of collecting some music for the game and would like to use the MIDI format so that I can control the flow of the track (i.e., I would like to have an introduction that only plays once and does not play again when the song loops.)
I am hav... | To modify MIDI files and insert control change messages directly, you can use a MIDI editor or a DAW (Digital Audio Workstation) that allows for detailed editing of MIDI data. Here are some steps and tools you can use to achieve your goal:
### Step-by-Step Guide:
1. **Choose a MIDI Editor/DAW**:
- There are severa... | 3,518 | [
{
"from": "human",
"value": "I am making a simple game in order to learn a new language. I am in the process of collecting some music for the game and would like to use the MIDI format so that I can control the flow of the track (i.e., I would like to have an introduction that only plays once and does not ... |
Ok, I've run across my first StackOverflowError since joining this site, I figured this is a must post :-). My environment is Seam 2.0.1.GA, JBoss 4.2.2.GA and I'm using JSF. I am in the process of converting from a facelets view to JSP to take advantage of some existing JSP tags used on our existing site. I chang... | The `StackOverflowError` you are encountering typically arises from infinite recursion in your code. Given that you're transitioning from Facelets to JSP and have modified your `faces-config.xml` and `web.xml` configuration files, it's possible that there's a misconfiguration or issue in the way that requests are being... | 4,987 | [
{
"from": "human",
"value": "Ok, I've run across my first StackOverflowError since joining this site, I figured this is a must post :-). My environment is Seam 2.0.1.GA, JBoss 4.2.2.GA and I'm using JSF. I am in the process of converting from a facelets view to JSP to take advantage of some existing JSP t... |
The most common method for corrupting compressed files is to inadvertently do an ASCII-mode FTP transfer, which causes a many-to-one trashing of CR and/or LF characters.
Obviously, there is information loss, and the best way to fix this problem is to transfer again, in FTP binary mode.
However, if the original is lost,... | Recovering corrupted compressed files that have suffered from ASCII-mode FTP transfer can be quite challenging. The issue arises from the fact that newline characters (CR and LF) are altered or truncated, leading to data loss or corruption. While some corruption might be easily fixable, in many cases, it may lead to si... | 5,273 | [
{
"from": "human",
"value": "The most common method for corrupting compressed files is to inadvertently do an ASCII-mode FTP transfer, which causes a many-to-one trashing of CR and/or LF characters.\nObviously, there is information loss, and the best way to fix this problem is to transfer again, in FTP bina... |
I work with C# at work but dislike how with webforms it spews out a lot of JavaScript not including the many lines for viewstate that it creates.
That's why I like coding with PHP as I have full control.
But I was just wondering how this sites HTML is so clean and elegant?
Does using MVC have something to do with it? I... | It sounds like you're interested in understanding how to achieve clean and elegant HTML with ASP.NET, particularly in the context of MVC (Model-View-Controller) versus Web Forms. Let's break down some of the factors that contribute to clean HTML output when using ASP.NET MVC:
### 1. ASP.NET MVC vs. Web Forms
- **Separ... | 4,101 | [
{
"from": "human",
"value": "I work with C# at work but dislike how with webforms it spews out a lot of JavaScript not including the many lines for viewstate that it creates.\nThat's why I like coding with PHP as I have full control.\nBut I was just wondering how this sites HTML is so clean and elegant?\nDo... |
Emacs: C-U (79) # » a pretty 79 character length divider
VIM: 79-i-# » see above
Textmate: ????
Or is it just assumed that we'll make a Ruby call or have a snippet somewhere?
| In TextMate, there isn't a built-in command like in Emacs or Vim for inserting a specific length divider. However, you can create your own snippets or commands to achieve this.
### Option 1: Custom Snippet
You can create a snippet that generates a line of 79 characters. Here's how to do it:
1. Open TextMate and go t... | 6,463 | [
{
"from": "human",
"value": "Emacs: C-U (79) # » a pretty 79 character length divider\nVIM: 79-i-# » see above\nTextmate: ????\nOr is it just assumed that we'll make a Ruby call or have a snippet somewhere?\n"
},
{
"from": "gpt",
"value": "In TextMate, there isn't a built-in command like in Em... |
This is actually a two part question. First,does the HttpContext.Current correspond to the current System.UI.Page object?
And the second question, which is probably related to the first, is why can't I use the following to see if the current page implements an interface:
private IWebBase FindWebBase()
{
if (HttpCon... | To address your questions, let's break them down one by one.
### Part 1: Does `HttpContext.Current` correspond to the current `System.UI.Page` object?
No, `HttpContext.Current` does not directly correspond to a `System.Web.UI.Page` object. The `HttpContext` class provides information about the current HTTP request an... | 4,536 | [
{
"from": "human",
"value": "This is actually a two part question. First,does the HttpContext.Current correspond to the current System.UI.Page object?\nAnd the second question, which is probably related to the first, is why can't I use the following to see if the current page implements an interface:\npriva... |
You do AssignProcessToJobObject and it fails with "access denied" but only when you are running in the debugger. Why is this?
| The `AssignProcessToJobObject` function in Windows can return an "access denied" error for several reasons, particularly when run under a debugger. Here are some common causes for this behavior:
1. **Security Context**: When you run a process under a debugger, it might inherit different security contexts or access tok... | 5,704 | [
{
"from": "human",
"value": "You do AssignProcessToJobObject and it fails with \"access denied\" but only when you are running in the debugger. Why is this?\n"
},
{
"from": "gpt",
"value": "The `AssignProcessToJobObject` function in Windows can return an \"access denied\" error for several reaso... |
I know you can use several different view engines with ASP.NET MVC:
ASPX, obviously
NVelocity
Brail
NHaml
et al...
The default ASPX view engine seems to make the most sense to me, coming from an ASP.NET WebForms background.
But, I wanted to get an idea of the pros and cons of each and see what most people are using... | ASP.NET MVC supports multiple view engines, each with its own strengths and weaknesses. Here's a brief overview of some of the popular view engines you mentioned, along with their pros and cons:
### 1. **ASPX (Web Forms View Engine)**
- **Pros:**
- Familiar to developers coming from ASP.NET WebForms.
- Full access... | 4,499 | [
{
"from": "human",
"value": "I know you can use several different view engines with ASP.NET MVC:\n\nASPX, obviously\nNVelocity\nBrail\nNHaml\net al...\n\nThe default ASPX view engine seems to make the most sense to me, coming from an ASP.NET WebForms background. \nBut, I wanted to get an idea of the pros a... |
How can I get line numbers to print in Visual Studio 2005 when printing code listings?
| In Visual Studio 2005, you can enable line numbers to print when you print code listings by following these steps:
1. **Open your code file**: First, ensure that the code file you want to print is open in the editor.
2. **Access the Print Dialog**: Go to the `File` menu and select `Print...` or simply press `Ctrl + P... | 3,522 | [
{
"from": "human",
"value": "How can I get line numbers to print in Visual Studio 2005 when printing code listings?\n"
},
{
"from": "gpt",
"value": "In Visual Studio 2005, you can enable line numbers to print when you print code listings by following these steps:\n\n1. **Open your code file**: F... |
This would be a question for anyone who has code in the App_Code folder and uses a hardware load balancer. Its true the hardware load balancer could be set to sticky sessions to solve the issue, but in a perfect world, I would like the feature turned off.
When a file in the App_Code folder, and the site is not pre-comp... | The challenge you're facing is due to the way ASP.NET handles dynamic compilation of files in the App_Code folder. Each time an ASP.NET application is started, it generates temporary assemblies with random names for the files in the App_Code folder. This causes issues in a load-balanced environment where sticky session... | 4,503 | [
{
"from": "human",
"value": "This would be a question for anyone who has code in the App_Code folder and uses a hardware load balancer. Its true the hardware load balancer could be set to sticky sessions to solve the issue, but in a perfect world, I would like the feature turned off.\nWhen a file in the App... |
So I have a function that looks something like this:
float function(){
float x = SomeValue;
return x / SomeOtherValue;
}
At some point, this function overflows and returns a really large negative value. To try and track down exactly where this was happening, I added a cout statement so that the function looke... | What you experienced is an interesting phenomenon related to how the optimization and the compiler's behavior can change based on whether or not you have an observable side effect, such as printing a value to the console.
In your original function, when the code is:
```cpp
float function() {
float x = SomeValue;
... | 6,800 | [
{
"from": "human",
"value": "So I have a function that looks something like this:\nfloat function(){\n float x = SomeValue;\n return x / SomeOtherValue;\n}\n\nAt some point, this function overflows and returns a really large negative value. To try and track down exactly where this was happening, I ad... |
I regularly access Windows domains that have been set up to use a domain under the .local top level name. This conflicts with Bonjour/Zeroconf which reserves .local for it's own use. A number of platforms support Bonjour out of the box (including Mac OS, iPhone, and Ubuntu) and there's numerous name resolution issues w... | To address the conflict between `.local` and your domain (e.g., `ntdomain.local`) when using mDNS, you can set up an intermediary service that resolves requests for your specific domain via a unicast DNS server while allowing mDNS to handle other requests.
Here are some possible approaches, including the use of Avahi... | 1,502 | [
{
"from": "human",
"value": "I regularly access Windows domains that have been set up to use a domain under the .local top level name. This conflicts with Bonjour/Zeroconf which reserves .local for it's own use. A number of platforms support Bonjour out of the box (including Mac OS, iPhone, and Ubuntu) and ... |
I've computed the mean & variance of a set of values, and I want to pass along the value that represents the # of std deviations away from mean for each number in the set. Is there a better term for this, or should I just call it num_of_std_devs_from_mean ...
| The value that represents the number of standard deviations a particular data point is from the mean is commonly referred to as the **z-score**. The z-score is calculated using the formula:
\[
z = \frac{(X - \mu)}{\sigma}
\]
where:
- \(X\) is the value,
- \(\mu\) is the mean,
- \(\sigma\) is the standard deviation.
... | 8,325 | [
{
"from": "human",
"value": "I've computed the mean & variance of a set of values, and I want to pass along the value that represents the # of std deviations away from mean for each number in the set. Is there a better term for this, or should I just call it num_of_std_devs_from_mean ...\n"
},
{
"f... |
Consider these two function definitions:
void foo() { }
void foo(void) { }
Is there any difference between these two? If not, why is the void argument there? Aesthetic reasons?
| No, there is no functional difference between the two function definitions in C or C++. Both definitions declare a function named `foo` that takes no parameters and returns nothing.
Here’s a breakdown:
1. **`void foo() { }`** - This defines a function `foo` that takes no arguments. The empty parentheses `()` indicate... | 7,169 | [
{
"from": "human",
"value": "Consider these two function definitions:\nvoid foo() { }\n\nvoid foo(void) { }\n\nIs there any difference between these two? If not, why is the void argument there? Aesthetic reasons?\n"
},
{
"from": "gpt",
"value": "No, there is no functional difference between the ... |
I've been working on a project that accesses the WMI to get information about the software installed on a user's machine. We've been querying Win32_Product only to find that it doesn't exist in 64-bit versions of Windows because it's an "optional component".
I know there are a lot of really good alternatives to queryin... | The WMI (Windows Management Instrumentation) service does not come with a redistributable package, as it is tightly integrated into the Windows operating system. Specifically, the `Win32_Product` class is part of the WMI Installer Provider, which is an optional feature in some editions of Windows, particularly in 64-bi... | 3,122 | [
{
"from": "human",
"value": "I've been working on a project that accesses the WMI to get information about the software installed on a user's machine. We've been querying Win32_Product only to find that it doesn't exist in 64-bit versions of Windows because it's an \"optional component\".\nI know there are ... |
Here's a coding problem for those that like this kind of thing. Let's see your implementations (in your language of choice, of course) of a function which returns a human readable String representation of a specified Integer. For example:
humanReadable(1) returns "one".
humanReadable(53) returns "fifty-three".
humanRe... | Sure! I'll provide an implementation of the `humanReadable` function in Python. This function will convert an integer to its English words representation. Let's break down how we can handle different ranges of numbers and build the string step by step.
Here's one way to implement this:
```python
def humanReadable(num... | 1,959 | [
{
"from": "human",
"value": "Here's a coding problem for those that like this kind of thing. Let's see your implementations (in your language of choice, of course) of a function which returns a human readable String representation of a specified Integer. For example:\n\nhumanReadable(1) returns \"one\".\nhu... |
From time to time am I working in a completely disconnected environment with a Macbook Pro. For testing purposes I need to run a local DNS server in a VMWare session. I've configured the lookup system to use the DNS server (/etc/resolve.conf and through the network configuration panel, which is using configd underneath... | It sounds like you're encountering a common issue with how macOS handles DNS resolution in certain contexts, particularly in versions like macOS 10.4 that you're using. In newer macOS versions, the DNS resolution is typically managed by the system's networking stack, which may not always reference `/etc/resolv.conf` di... | 5,380 | [
{
"from": "human",
"value": "From time to time am I working in a completely disconnected environment with a Macbook Pro. For testing purposes I need to run a local DNS server in a VMWare session. I've configured the lookup system to use the DNS server (/etc/resolve.conf and through the network configuration... |
What is the simplest way to install memcached on CentOS for someone new to the world of Linux? What is the best way to enable it for Apache and PHP
| Installing Memcached on CentOS and enabling it for Apache and PHP is a relatively straightforward process. Here’s a step-by-step guide for someone new to Linux.
### Step 1: Update Your System
First, it's a good idea to update your system's package manager to ensure you have the latest information on available package... | 3,944 | [
{
"from": "human",
"value": "What is the simplest way to install memcached on CentOS for someone new to the world of Linux? What is the best way to enable it for Apache and PHP\n"
},
{
"from": "gpt",
"value": "Installing Memcached on CentOS and enabling it for Apache and PHP is a relatively str... |
I want to create a regexp in Emacs that matches exactly 3 digits. For example, I want to match the following:
123
345
789
But not
1234
12
12 23
If I use [0-9]+ I match any single string of digits. I thought [0-9]{3} would work, but when tested in re-builder it doesn't match anything.
| To match exactly 3 digits in Emacs using regular expressions, you should use `^\([0-9]\{3\}\)$`. Here's how the components work:
- `^` asserts that we are at the start of a line.
- `\([0-9]\{3\}\)` matches exactly 3 digits (0-9).
- `$` asserts that we are at the end of a line.
Putting it all together, the regular exp... | 7,480 | [
{
"from": "human",
"value": "I want to create a regexp in Emacs that matches exactly 3 digits. For example, I want to match the following:\n123\n345\n789\n\nBut not\n1234\n12\n12 23\n\nIf I use [0-9]+ I match any single string of digits. I thought [0-9]{3} would work, but when tested in re-builder it do... |
Having a set of (2D) points from a GIS file (a city map), I need to generate the polygon that defines the 'contour' for that map (its boundary). Its input parameters would be the points set and a 'maximum edge length'. It would then output the corresponding (probably non-convex) polygon.
The best solution I found so fa... | Generating a polygon that defines the contour of a set of 2D points with a specified maximum edge length can be approached in several ways. Your current method of using Delaunay triangulation is valid, but indeed, it may not be the most efficient approach. Here are some alternative techniques you might consider:
### 1... | 3,605 | [
{
"from": "human",
"value": "Having a set of (2D) points from a GIS file (a city map), I need to generate the polygon that defines the 'contour' for that map (its boundary). Its input parameters would be the points set and a 'maximum edge length'. It would then output the corresponding (probably non-convex)... |
I'm early in development on a web application built in VS2008. I have both a desktop PC (where most of the work gets done) and a laptop (for occasional portability) on which I use AnkhSVN to keep the project code synced. What's the best way to keep my development database (SQL Server Express) synced up as well?
I have ... | Managing a development database across multiple environments can be challenging, especially when dealing with schema changes and sample data. Here are some strategies to keep your SQL Server Express database in sync between your desktop and laptop without resorting to placing .MDF and .LDF files under source control:
... | 5,109 | [
{
"from": "human",
"value": "I'm early in development on a web application built in VS2008. I have both a desktop PC (where most of the work gets done) and a laptop (for occasional portability) on which I use AnkhSVN to keep the project code synced. What's the best way to keep my development database (SQL S... |
Problem:
I have two spreadsheets that each serve different purposes but contain one particular piece of data that needs to be the same in both spreadsheets. This piece of data (one of the columns) gets updated in spreadsheet A but needs to also be updated in spreadsheet B.
Goal:
A solution that would somehow link the... | Linking two spreadsheets on separate LAN shares so that updates in one reflect in the other can be a complex task, especially in older versions like Office 2003 and 2007. However, you can use a combination of features in Excel, along with some macros or scripts, to achieve the desired functionality. Here are several po... | 2,598 | [
{
"from": "human",
"value": "Problem: \nI have two spreadsheets that each serve different purposes but contain one particular piece of data that needs to be the same in both spreadsheets. This piece of data (one of the columns) gets updated in spreadsheet A but needs to also be updated in spreadsheet B.\nG... |
Just wondering
| Sure! What are you wondering about? Feel free to ask any questions or share your thoughts. | 9,660 | [
{
"from": "human",
"value": "Just wondering\n"
},
{
"from": "gpt",
"value": "Sure! What are you wondering about? Feel free to ask any questions or share your thoughts."
}
] |
In vxWorks, I can issue the "i" command in the shell, and I get the list of tasks in my system along with some information like the following example:
NAME ENTRY TID PRI STATUS PC SP ERRNO DELAY
---------- ------------ -------- --- ---------- -------- -------- ------- -----
tJobTa... | In VxWorks, if you want to determine what tasks are pended on (e.g., a semaphore, message queue, or other synchronization mechanism), you can use the `taskInfoGet()` function to get detailed information about a specific task.
To find out what a task is pended on, you can follow these steps:
1. Use the `i` command in ... | 6,379 | [
{
"from": "human",
"value": "In vxWorks, I can issue the \"i\" command in the shell, and I get the list of tasks in my system along with some information like the following example:\n\n NAME ENTRY TID PRI STATUS PC SP ERRNO DELAY\n---------- ------------ -------- --- ---... |
I've been utlising a "web browser control" in desktop based applications (in my case Windows Forms .NET) for a number of years. I mostly use it to create a familiar flow-based user interface that also allows a seamless transition to the internet where required.
I'm really tired of the IE browser control because of the... | If you’re looking for alternatives to the Internet Explorer (IE) Web Browser control for your Windows Forms applications, there are several options available that can provide more modern web rendering capabilities and features. Here are some of the most popular alternatives:
1. **WebView2**:
- **Description**: WebV... | 2,916 | [
{
"from": "human",
"value": "I've been utlising a \"web browser control\" in desktop based applications (in my case Windows Forms .NET) for a number of years. I mostly use it to create a familiar flow-based user interface that also allows a seamless transition to the internet where required.\nI'm really ti... |
Is there a way to get the tests inside of a TestCase to run in a certain order? For example, I want to separate the life cycle of an object from creation to use to destruction but I need to make sure that the object is set up first before I run the other tests.
| In general, it's not recommended to rely on a specific order for unit tests, as unit tests are meant to be independent of one another. However, if you find it necessary to run tests in a certain order, you can achieve this with some workarounds. The method to do so can vary depending on the testing framework you're usi... | 4,909 | [
{
"from": "human",
"value": "Is there a way to get the tests inside of a TestCase to run in a certain order? For example, I want to separate the life cycle of an object from creation to use to destruction but I need to make sure that the object is set up first before I run the other tests.\n"
},
{
"... |
I'm looking for a way to poll different servers and check that SQL server is up and running. I'm writing my code in C#. I don't particularly care about individual databases, just that SQL server is running and responsive.
Any ideas?
| Certainly! You can use a simple C# application to poll different SQL Server instances to check if they are running and responsive. One way to do this is by attempting to establish a connection using `SqlConnection`. If the connection is successful, it means the SQL Server is up and running; if not, you can handle any e... | 1,794 | [
{
"from": "human",
"value": "I'm looking for a way to poll different servers and check that SQL server is up and running. I'm writing my code in C#. I don't particularly care about individual databases, just that SQL server is running and responsive.\nAny ideas?\n"
},
{
"from": "gpt",
"value": "... |
How do I get the path of the directory in which a Bash script is located, inside that script?
I want to use a Bash script as a launcher for another application. I want to change the working directory to the one where the Bash script is located, so I can operate on the files in that directory, like so:
$ ./application
| To get the path of the directory where your Bash script is located, you can use the following command inside your script:
```bash
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
```
Here's a breakdown of what this command does:
- `BASH_SOURCE[0]`: This is a special variable that holds the name of the script bein... | 6,374 | [
{
"from": "human",
"value": "How do I get the path of the directory in which a Bash script is located, inside that script?\nI want to use a Bash script as a launcher for another application. I want to change the working directory to the one where the Bash script is located, so I can operate on the files in ... |
I have an object that is mapped to a cookie as a serialized base-64 string. I only want to write out a new cookie if there are changes made to the object stored in the cookie on server-side.
What I want to do is get a hash code when the object is pulled from the cookie/initialized and compare the original hash code to ... | In your scenario, the goal is to avoid sending a cookie if the object has not changed since the last time it was serialized and sent to the client. While overriding `Object.GetHashCode()` is one approach, it might not be the most straightforward or safest way to implement change detection, especially if your object con... | 2,191 | [
{
"from": "human",
"value": "I have an object that is mapped to a cookie as a serialized base-64 string. I only want to write out a new cookie if there are changes made to the object stored in the cookie on server-side.\nWhat I want to do is get a hash code when the object is pulled from the cookie/initiali... |
I have three unordered lists that have been created as Scriptaculous Sortables so that the user can drag items within the lists and also between them:
var lists = ["pageitems","rowitems","columnitems"];
Sortable.create("pageitems", { dropOnEmpty: true, containment: lists, constraint: false });
Sortable.create("... | To allow users to drag items back into an empty list with Scriptaculous Sortables, you'll need to adjust the configuration of your sortable lists. By default, some versions of Scriptaculous may prevent items from being dropped into an empty list. To address this issue, you can use the `accept` option in the `Sortable.c... | 6,941 | [
{
"from": "human",
"value": "I have three unordered lists that have been created as Scriptaculous Sortables so that the user can drag items within the lists and also between them:\nvar lists = [\"pageitems\",\"rowitems\",\"columnitems\"]; \nSortable.create(\"pageitems\", { dropOnEmpty: true, containment:... |
Any good suggestions? Input will be the name of a header file and output should be a list (preferably a tree) of all files including it directly or indirectly.
| To achieve a list of all files that include a given header file, either directly or indirectly, you can use various methods depending on your development environment and tools available. Here's a general approach using a script that you can adapt to your needs:
### Using Python and `clang.cindex` for a Tree Structure
... | 2,314 | [
{
"from": "human",
"value": "Any good suggestions? Input will be the name of a header file and output should be a list (preferably a tree) of all files including it directly or indirectly.\n"
},
{
"from": "gpt",
"value": "To achieve a list of all files that include a given header file, either di... |
How do I write code where a company icon appears on the left side next to the URL address in the browser's address bar?
| To have an icon appear next to your website's URL in the browser's address bar, you'll need to create a favicon. A favicon is a small image that represents your website and is displayed in various places in the browser, including the tab and the address bar. Here are the steps to add a favicon to your website:
### Ste... | 4,505 | [
{
"from": "human",
"value": "How do I write code where a company icon appears on the left side next to the URL address in the browser's address bar?\n"
},
{
"from": "gpt",
"value": "To have an icon appear next to your website's URL in the browser's address bar, you'll need to create a favicon. A... |
Has anybody used the MS Project Gantt chart control in C#?
If yes, can you share some resources regarding this?
| Yes, many developers have utilized Microsoft Project's Gantt chart features within C# applications, often through the Microsoft Project Interop libraries or similar libraries. Here are some resources and guidance to help you get started with using Gantt charts in C#:
### 1. **Microsoft Project Interop**
Microsoft prov... | 4,312 | [
{
"from": "human",
"value": "Has anybody used the MS Project Gantt chart control in C#?\nIf yes, can you share some resources regarding this?\n"
},
{
"from": "gpt",
"value": "Yes, many developers have utilized Microsoft Project's Gantt chart features within C# applications, often through the Mic... |
I've heard that creating a new process on a Windows box is more expensive than on Linux. Is this true? Can somebody explain the technical reasons for why it's more expensive and provide any historical reasons for the design decisions behind those reasons?
| The perception that creating a new process is more expensive on Windows compared to Linux can be attributed to a variety of factors related to the design and implementation of the operating systems. Here's a breakdown of some technical and historical reasons for these differences:
### Technical Reasons
1. **Process C... | 3,719 | [
{
"from": "human",
"value": "I've heard that creating a new process on a Windows box is more expensive than on Linux. Is this true? Can somebody explain the technical reasons for why it's more expensive and provide any historical reasons for the design decisions behind those reasons?\n"
},
{
"from... |
I have a tomcat instance setup but the database connection I have configured in context.xml keeps dying after periods of inactivity.
When I check the logs I get the following error:
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException:
The last packet successfully received from the server was68051 seconds
ago. The... | The issue you are encountering is a common one when using connection pools with databases that have a timeout configuration. Even though you have `autoReconnect=true` in your JDBC URL, this doesn't solve the underlying problem that the connections are being closed by the database server due to inactivity. The `autoReco... | 5,628 | [
{
"from": "human",
"value": "I have a tomcat instance setup but the database connection I have configured in context.xml keeps dying after periods of inactivity.\nWhen I check the logs I get the following error:\ncom.mysql.jdbc.exceptions.jdbc4.CommunicationsException: \nThe last packet successfully receive... |
In my C/C++ program, I'm using OpenCV to capture images from my webcam. The camera (Logitech QuickCam IM) can capture at resolutions 320x240, 640x480 and 1280x960. But, for some strange reason, OpenCV gives me images of resolution 320x240 only. Calls to change the resolution using cvSetCaptureProperty() with other reso... | When using OpenCV to capture images from a webcam, you may sometimes encounter issues with setting the desired resolution, especially if the camera does not support the resolution you are trying to set or if there are compatibility issues. Here are some steps and tips to troubleshoot and successfully set the camera res... | 2,200 | [
{
"from": "human",
"value": "In my C/C++ program, I'm using OpenCV to capture images from my webcam. The camera (Logitech QuickCam IM) can capture at resolutions 320x240, 640x480 and 1280x960. But, for some strange reason, OpenCV gives me images of resolution 320x240 only. Calls to change the resolution usi... |
I'm working on an email validation check and we need to decided whether to allow user@localhost and user@example (notice no .anything) to be validated as a valid email address. This is for an open source project that has a number of use cases on both the web at large and intranets.
RFC 2822 (Internet Message Format Sta... | When considering whether to allow `user@localhost` and `user@example` as valid email addresses in your email validation check, it's important to weigh both practical usability and adherence to standards.
### RFC Compliance
1. **RFC 2822 (Internet Message Format)**: This RFC defines the syntax of email addresses and d... | 3,687 | [
{
"from": "human",
"value": "I'm working on an email validation check and we need to decided whether to allow user@localhost and user@example (notice no .anything) to be validated as a valid email address. This is for an open source project that has a number of use cases on both the web at large and intrane... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.