instruction stringlengths 14 27.6k | completion stringlengths 3 38.3k | __original_row_idx int64 0 50k | conversations listlengths 2 2 |
|---|---|---|---|
Most of my users have email addresses associated with their profile in /etc/passwd. They are always in the 5th field, which I can grab, but they appear at different places within a comma-separated list in the 5th field.
Can somebody give me a regex to grab just the email address (delimeted by commas) from a line in th... | To extract just the email addresses from the 5th field of the `/etc/passwd`-like file entries you've provided, you can use a combination of `grep` and `sed` (or just `sed` alone).
Here’s a regex that matches the email addresses in the 5th field:
1. Use `grep` to filter out only the relevant lines.
2. Use `sed` to ca... | 9,034 | [
{
"from": "human",
"value": "Most of my users have email addresses associated with their profile in /etc/passwd. They are always in the 5th field, which I can grab, but they appear at different places within a comma-separated list in the 5th field.\nCan somebody give me a regex to grab just the email addre... |
I'm currently trying to port a SIP stack library (pjSIP) to the PSP Console (using the PSPSDK toolchain), but I'm having too much trouble with the makefiles (making the proper changes and solving linking issues).
Does anyone know a good text, book or something to get some insight on porting libraries?
The only documen... | Porting a library like pjSIP to a platform such as the PSP can indeed be challenging, especially when dealing with build systems and makefiles. Here are some resources and strategies that may help you with the process:
### Books and Texts
1. **"The Art of Software Porting" by Dan Harkins**: This book covers fundament... | 5,814 | [
{
"from": "human",
"value": "I'm currently trying to port a SIP stack library (pjSIP) to the PSP Console (using the PSPSDK toolchain), but I'm having too much trouble with the makefiles (making the proper changes and solving linking issues). \nDoes anyone know a good text, book or something to get some insi... |
I've writen an Excel-based, database reporting tool. Currentely, all the VBA code is associated with a single XLS file. The user generates the report by clicking a button on the toolbar. Unfortunately, unless the user has saved the file under another file name, all the reported data gets wiped-out.
When I have created ... | Yes, you can package and distribute your VBA code in Excel using an Excel Add-In. An Excel Add-In can contain VBA code, custom functions, and even custom UI elements, which can be accessed from any workbook that references the Add-In. Here’s how you can create and use an Excel Add-In to achieve what you're looking for:... | 7,260 | [
{
"from": "human",
"value": "I've writen an Excel-based, database reporting tool. Currentely, all the VBA code is associated with a single XLS file. The user generates the report by clicking a button on the toolbar. Unfortunately, unless the user has saved the file under another file name, all the reported ... |
I need to be able to retrieve a CREATE TABLE script to recreate a specific table in a SQL Server (2000) database, programmatically (I'm using C#). Obviously you can do this with Enterprise Manager but I would like to automate it.
I've been playing around with SQLDMO which offers a Backup command, but I'm not sure if t... | To retrieve a `CREATE TABLE` script for a specific table in SQL Server 2000 programmatically using C#, you can use SQL-DMO (SQL Distributed Management Objects). While SQL-DMO does not provide a direct method to generate a `CREATE TABLE` script, you can retrieve the necessary information about the table and then constru... | 6,511 | [
{
"from": "human",
"value": "I need to be able to retrieve a CREATE TABLE script to recreate a specific table in a SQL Server (2000) database, programmatically (I'm using C#). Obviously you can do this with Enterprise Manager but I would like to automate it. \nI've been playing around with SQLDMO which offe... |
I thought I'd found the solution a while ago (see my blog):
If you ever get the JavaScript (or should that be JScript) error "Can't execute code from a freed script" - try moving any meta tags in the head so that they're before your script tags.
...but based on one of the most recent blog comments, the fix I suggest... | The error "Can't execute code from a freed script" typically occurs in Internet Explorer (IE) or older versions of Microsoft Edge and can be attributed to issues related to the lifecycle of scripts in the browser. The error suggests that the script that the browser is trying to execute has already been garbage collecte... | 3,265 | [
{
"from": "human",
"value": "I thought I'd found the solution a while ago (see my blog):\n\nIf you ever get the JavaScript (or should that be JScript) error \"Can't execute code from a freed script\" - try moving any meta tags in the head so that they're before your script tags. \n\n...but based on one of t... |
I'm missing the boat on something here, kids. This keeps rearing its head and I don't know what's going on with it, so I hope my homeys here can help.
When working in Silverlight, when I create bindings in my c# code, they never hold up when the application is running. The declarative bindings from my xaml seem ok, b... | It looks like you're having issues with your C# bindings in Silverlight not behaving as expected. Let's go through your code and see if we can identify any potential problems.
From your snippet:
```csharp
TextBlock tb = new TextBlock();
Binding b = new Binding("FontSize");
b.Source = this;
tb.SetBinding(TextBlock.Fon... | 5,702 | [
{
"from": "human",
"value": "I'm missing the boat on something here, kids. This keeps rearing its head and I don't know what's going on with it, so I hope my homeys here can help.\nWhen working in Silverlight, when I create bindings in my c# code, they never hold up when the application is running. The de... |
Is anyone aware of a script/class (preferably in PHP) that would parse a given MySQL table's structure and then fill it with x number of rows of random test data based on the field types?
I have never seen or heard of something like this and thought I would check before writing one myself.
| Yes, there are scripts and libraries available in PHP that can help you generate random test data based on a MySQL table's structure. While you might not find a one-size-fits-all solution, you can build your own script using PHP's PDO extension to fetch the table's structure and then generate random data according to t... | 3,324 | [
{
"from": "human",
"value": "Is anyone aware of a script/class (preferably in PHP) that would parse a given MySQL table's structure and then fill it with x number of rows of random test data based on the field types? \nI have never seen or heard of something like this and thought I would check before writin... |
I'm thinking in particular of how to display pagination controls, when using a language such as C# or Java.
If I have x items which I want to display in chunks of y per page, how many pages will be needed?
| To determine how many pages are needed when you have `x` items and you want to display them in chunks of `y` items per page, you can use the following formula:
\[
\text{number of pages} = \lceil \frac{x}{y} \rceil
\]
Where:
- \( x \) is the total number of items.
- \( y \) is the number of items to display per page.
... | 8,039 | [
{
"from": "human",
"value": "I'm thinking in particular of how to display pagination controls, when using a language such as C# or Java.\nIf I have x items which I want to display in chunks of y per page, how many pages will be needed?\n"
},
{
"from": "gpt",
"value": "To determine how many pages... |
I recently came across an issue with Windows 2003 (apparently it also exists in other versions too), where if an SSL/TLS server is requesting client certificate authentication and it has more than 16KB of trusted certificate DNs, Internet Explorer (or any other app that uses schannel.dll) is unable to complete the SSL ... | To solve your issue of determining the total ASN.1-format length of the distinguished names (DNs) of your trusted certificates, you can indeed use OpenSSL to extract the necessary information from your PEM files. Below is a step-by-step guide on how to achieve this.
1. **Extract DNs from Certificates**: You can use `o... | 6,282 | [
{
"from": "human",
"value": "I recently came across an issue with Windows 2003 (apparently it also exists in other versions too), where if an SSL/TLS server is requesting client certificate authentication and it has more than 16KB of trusted certificate DNs, Internet Explorer (or any other app that uses sch... |
I'm writting a financial C# application which receive messages from the network, translate them into different object according to the message type and finaly apply the application business logic on them.
The point is that after the business logic is applied, I'm very sure I will never need this instance again. Rather ... | In C#, you don't have direct control over memory management like in languages such as C or C++. Instead, you work within the managed environment of the .NET runtime, which includes a garbage collector (GC) that automatically manages memory for you. While you cannot explicitly "delete" objects as you might in other lang... | 4,768 | [
{
"from": "human",
"value": "I'm writting a financial C# application which receive messages from the network, translate them into different object according to the message type and finaly apply the application business logic on them.\nThe point is that after the business logic is applied, I'm very sure I wi... |
I originally asked this question on RefactorMyCode, but got no responses there...
Basically I'm just try to load an XmlNodeList into an XmlDocument and I was wondering if there's a more efficient method than looping.
Private Function GetPreviousMonthsXml(ByVal months As Integer, ByVal startDate As Date, ByVal xDoc As ... | To improve the efficiency and readability of your `GetPreviousMonthsXml` function, particularly in the block that imports the `XmlNodeList` into a new `XmlDocument`, we can eliminate the nested loops used to remove nodes. Instead, we can create a temporary list of nodes to delete, and then remove them in one go. Additi... | 3,794 | [
{
"from": "human",
"value": "I originally asked this question on RefactorMyCode, but got no responses there... \nBasically I'm just try to load an XmlNodeList into an XmlDocument and I was wondering if there's a more efficient method than looping.\nPrivate Function GetPreviousMonthsXml(ByVal months As Integ... |
I'm trying to write a bzr post-commit hook for my private bugtracker, but I'm stuck at the function signature of
post_commit(local, master, old_revno, old_revid, new_revno, mew_revid)
How can I extract the commit message for the branch from this with bzrlib in Python?
| In a Bazaar (bzr) post-commit hook, you can extract the commit message using the `local` parameter, which represents the branch being committed to. Specifically, the commit message can be obtained by accessing the `commit` method of the branch. Below is an example of how you can implement this in your post-commit hook:... | 8,735 | [
{
"from": "human",
"value": "I'm trying to write a bzr post-commit hook for my private bugtracker, but I'm stuck at the function signature of \npost_commit(local, master, old_revno, old_revid, new_revno, mew_revid)\n\nHow can I extract the commit message for the branch from this with bzrlib in Python?\n"
... |
Can someone explain this result to me. The first test succeeds but the second fails, although the variable tested is changed in the first test.
>>> class MyTest(unittest.TestCase):
def setUp(self):
self.i = 1
def testA(self):
self.i = 3
self.assertEqual(self.i, 3)
def testB(self):
... | The behavior you're observing is due to the way the `unittest` framework manages test case instances and the `setUp` method. Here’s a step-by-step explanation of what’s happening:
1. **Test Case Class Initialization**: Each test method (`testA` and `testB`) runs in a separate instance of the `MyTest` class. This means... | 6,611 | [
{
"from": "human",
"value": "Can someone explain this result to me. The first test succeeds but the second fails, although the variable tested is changed in the first test.\n>>> class MyTest(unittest.TestCase):\n def setUp(self):\n self.i = 1\n def testA(self):\n self.i = 3\n self... |
Given two different image files (in whatever format I choose), I need to write a program to predict the chance if one being the illegal copy of another. The author of the copy may do stuff like rotating, making negative, or adding trivial details (as well as changing the dimension of the image).
Do you know any algorit... | Yes, there are several approaches and algorithms you can use to detect if one image is an illegal copy of another, even after transformations like rotation, scaling, or slight modifications. Here are some strategies that you can consider:
### 1. **Feature Matching using Keypoints:**
- **SIFT (Scale-Invariant Featur... | 4,553 | [
{
"from": "human",
"value": "Given two different image files (in whatever format I choose), I need to write a program to predict the chance if one being the illegal copy of another. The author of the copy may do stuff like rotating, making negative, or adding trivial details (as well as changing the dimensi... |
Is it possible to set the title of a page when it's simply a loaded SWF?
| Yes, it is possible to set the title of a webpage that loads a SWF (Shockwave Flash) file, but the method depends on how the SWF is incorporated into the HTML page.
When you load a SWF file into a webpage using HTML, you can set the title of the page using the `<title>` tag in the HTML `<head>` section. Here's a simpl... | 6,625 | [
{
"from": "human",
"value": "Is it possible to set the title of a page when it's simply a loaded SWF?\n"
},
{
"from": "gpt",
"value": "Yes, it is possible to set the title of a webpage that loads a SWF (Shockwave Flash) file, but the method depends on how the SWF is incorporated into the HTML pa... |
I am looking for a CMS that would be incredibly user-friendly and would have the following features:
really simple message board (no login required)
family tree
story telling area
photo section
news section
Is there anything out there like this that is really easily configurable? I've already messed around with Mambo... | Finding a Content Management System (CMS) that meets all your specific requirements can be challenging, especially when you want it to be user-friendly for family members who may not be tech-savvy. Here are a few options that you might consider, based on your requirements:
### 1. **WordPress with Plugins**
- **Over... | 4,320 | [
{
"from": "human",
"value": "I am looking for a CMS that would be incredibly user-friendly and would have the following features:\n\nreally simple message board (no login required)\nfamily tree\nstory telling area\nphoto section\nnews section\n\nIs there anything out there like this that is really easily co... |
I am working on a project converting a "spreadsheet application" to a database solution. A macro was written that takes screen shots of each page and pastes them into a PowerPoint presentation. Because of the nice formatting options in Excel, the presentation looks very pretty.
The problem I'm having is that I haven'... | Jason, it sounds like you're dealing with a complex situation where you need to balance aesthetics, functionality, and automation when generating your reports. Here are a few considerations to help guide your decision:
### Access Reports vs. Excel & PowerPoint
1. **Access Reports:**
- **Formatting Limitations:** W... | 7,087 | [
{
"from": "human",
"value": "I am working on a project converting a \"spreadsheet application\" to a database solution. A macro was written that takes screen shots of each page and pastes them into a PowerPoint presentation. Because of the nice formatting options in Excel, the presentation looks very pret... |
I've noticed that there seems to be quite a bit of hostility towards Linq To Entities particularly from the Alt.Net folks. I understand the resistance to more "drag and drop" programming, but from my understanding, Linq To Entities doesn't require it.
We're currently using Linq to SQL, and we are using the DBML docu... | Linq to Entities and Linq to SQL are both Object-Relational Mapping (ORM) technologies from Microsoft that allow developers to work with databases using .NET objects and LINQ syntax. While they share similarities, there are some fundamental differences that can lead to different opinions about them in various developer... | 7,003 | [
{
"from": "human",
"value": "I've noticed that there seems to be quite a bit of hostility towards Linq To Entities particularly from the Alt.Net folks. I understand the resistance to more \"drag and drop\" programming, but from my understanding, Linq To Entities doesn't require it. \nWe're currently using... |
My application has a need to let the user choose a date from a list of dates conforming to a certain pattern. For instance, they may need to choose a monday from a list Monday's for a month. Is there a way to get a UIDatePicker to limit date choices to a certain subset or should I just use a UIPickerView?
| The `UIDatePicker` in iOS is designed for selecting a single date and does not allow you to customize the available options directly. It provides a complete range of dates based on its mode (like date, time, or both), but it doesn't provide a way to filter the selectable options to a specific subset, such as only Monda... | 5,465 | [
{
"from": "human",
"value": "My application has a need to let the user choose a date from a list of dates conforming to a certain pattern. For instance, they may need to choose a monday from a list Monday's for a month. Is there a way to get a UIDatePicker to limit date choices to a certain subset or should... |
This is probably best shown with an example. I have an enum with attributes:
public enum MyEnum {
[CustomInfo("This is a custom attrib")]
None = 0,
[CustomInfo("This is another attrib")]
ValueA,
[CustomInfo("This has an extra flag", AllowSomething = true)]
ValueB,
}
I want to get to those at... | Yes, you can achieve this without converting the enum value to a string by using the `Enum` class to obtain the `FieldInfo` directly, which allows you to avoid the string conversion. Here's an updated version of your `GetInfo` method that does exactly that:
```csharp
using System;
using System.Linq;
using System.Refle... | 7,118 | [
{
"from": "human",
"value": "This is probably best shown with an example. I have an enum with attributes:\npublic enum MyEnum {\n\n [CustomInfo(\"This is a custom attrib\")]\n None = 0,\n\n [CustomInfo(\"This is another attrib\")]\n ValueA,\n\n [CustomInfo(\"This has an extra flag\", AllowSom... |
In a web application, I have a page that contains a DIV that has an auto-width depending on the width of the browser window.
I need an auto-height for the object. The DIV starts about 300px from the top screen, and its height should make it stretch to the bottom of the browser screen. I have a max height for the cont... | Sure! You can achieve this functionality with a combination of CSS and JavaScript. Here's a step-by-step approach.
### Step 1: CSS
First, let's set up your CSS for the container `div`. You should set a `max-height`, `min-height`, and use `calc` to ensure the `div` stretches from 300px to the bottom of the viewport. H... | 6,174 | [
{
"from": "human",
"value": "In a web application, I have a page that contains a DIV that has an auto-width depending on the width of the browser window.\nI need an auto-height for the object. The DIV starts about 300px from the top screen, and its height should make it stretch to the bottom of the browser... |
I'm using start.jar and stop.jar to stop and start my jetty instance.
I restart by calling stop.jar, then start.jar.
The problem is, if I don't sleep long enough between stop.jar and start.jar I start getting these random ClassNotFoundExceptions and the application doesn't work correctly.
Sleeping for a longer period o... | Restarting Jetty in a clean and efficient way is important to avoid issues like `ClassNotFoundExceptions`. Here are a few strategies you might consider to improve your restart process without relying on arbitrary sleeps:
1. **Use Jetty's Management APIs**: Jetty has built-in APIs to manage its lifecycle. Instead of us... | 8,181 | [
{
"from": "human",
"value": "I'm using start.jar and stop.jar to stop and start my jetty instance.\nI restart by calling stop.jar, then start.jar.\nThe problem is, if I don't sleep long enough between stop.jar and start.jar I start getting these random ClassNotFoundExceptions and the application doesn't wor... |
I need to copy the newest file in a directory to a new location. So far I've found resources on the forfiles command, a date-related question here, and another related question. I'm just having a bit of trouble putting the pieces together! How do I copy the newest file in that directory to a new place?
| You can use a combination of command-line tools available in Windows to copy the newest file from a directory to a new location. One common approach is to use the `for` command in conjunction with `xcopy` or `copy`. Here's how you can do it step by step:
### Using Command Prompt
1. Open Command Prompt (you can search... | 9,606 | [
{
"from": "human",
"value": "I need to copy the newest file in a directory to a new location. So far I've found resources on the forfiles command, a date-related question here, and another related question. I'm just having a bit of trouble putting the pieces together! How do I copy the newest file in that d... |
I'm managing an instance of Wordpress where the URLs are in the following format:
http://www.example.com/example-category/blog-post-permalink/
The blog author did an inconsistent job of adding categories to posts, so while some of them had legitimate categories in their URLS, at least half are "uncategorised".
I can ... | To create a `mod_rewrite` rule that redirects the old URL format to the new one while honoring the real WordPress directories, you can add the following rules to your `.htaccess` file located in your WordPress root directory. Make sure that you place these rules above the existing WordPress rules to ensure they are exe... | 6,450 | [
{
"from": "human",
"value": "I'm managing an instance of Wordpress where the URLs are in the following format:\n\nhttp://www.example.com/example-category/blog-post-permalink/\n\nThe blog author did an inconsistent job of adding categories to posts, so while some of them had legitimate categories in their UR... |
I work on quite a few DotNetNuke sites, and occasionally (I haven't figured out the common factor yet), when I use the Database Publishing Wizard from Microsoft to create scripts for the site I've created on my Dev server, after running the scripts at the host (usually GoDaddy.com), and uploading the site files, I get ... | Deploying DotNetNuke (DNN) sites can sometimes be tricky, especially when using tools like the Database Publishing Wizard to script your database changes. Here are some common issues you might encounter during deployment, along with troubleshooting steps to help identify and resolve the problem:
### Common Issues and ... | 6,395 | [
{
"from": "human",
"value": "I work on quite a few DotNetNuke sites, and occasionally (I haven't figured out the common factor yet), when I use the Database Publishing Wizard from Microsoft to create scripts for the site I've created on my Dev server, after running the scripts at the host (usually GoDaddy.c... |
Before you answer: Yes I have read the jtable tutorial over at Sun. No, it did not help me. Yes, I am a dolt. Please don't answer with a reference to that document. What I am specifically interested in is how to dynamically add rows and columns to my Jtable via the Netbeans IDE. I already have an object that contains a... | To dynamically add rows and columns to a `JTable` in a Java Swing application using NetBeans, you typically need to work with a table model. The `DefaultTableModel` class is a common choice for this purpose, as it allows for easy manipulation of the data structure backing the table. Given that you have a `Vector` of ob... | 6,781 | [
{
"from": "human",
"value": "Before you answer: Yes I have read the jtable tutorial over at Sun. No, it did not help me. Yes, I am a dolt. Please don't answer with a reference to that document. What I am specifically interested in is how to dynamically add rows and columns to my Jtable via the Netbeans IDE.... |
Plone has a beautiful search box with a "Google suggest" like functionality for its site. It even indexes uploaded documents like PDFs. Does anyone know of a module that can provide this kind of functionality in a Django site?
| Yes, there are several Django packages that can provide functionality similar to Plone's search capabilities, including indexing and searching through documents like PDFs. Here are a few popular options:
1. **Haystack**: Django Haystack is a search abstraction layer that lets you integrate various search backends (suc... | 7,661 | [
{
"from": "human",
"value": "Plone has a beautiful search box with a \"Google suggest\" like functionality for its site. It even indexes uploaded documents like PDFs. Does anyone know of a module that can provide this kind of functionality in a Django site?\n"
},
{
"from": "gpt",
"value": "Yes... |
Does a caching-nameserver usually cache the negative DNS response SERVFAIL?
EDIT:
To clarify the question, I can see the caching nameserver caching negative responses NXDOMAIN, NODATA. But it does not do this for SERVFAIL responses. Is this intentional?
| Yes, it is intentional that caching DNS servers do not cache negative responses with the status of SERVFAIL.
### Explanation:
1. **Types of Negative Responses:**
- **NXDOMAIN**: Indicates that the domain name does not exist. This response can be cached for a period of time, as it means that a specific domain name ... | 9,171 | [
{
"from": "human",
"value": "Does a caching-nameserver usually cache the negative DNS response SERVFAIL? \nEDIT:\nTo clarify the question, I can see the caching nameserver caching negative responses NXDOMAIN, NODATA. But it does not do this for SERVFAIL responses. Is this intentional?\n"
},
{
"from"... |
I would like to make an ajax call to a different server (same domain and box, just a different port.)
e.g.
My page is
http://localhost/index.html
I would like to make a ajax get request to:
http://localhost:7076/?word=foo
I am getting this error:
Access to restricted URI denied (NS_ERROR_DOM_BAD_URI)
I know that... | Yes, you are correct that making AJAX calls to a different port on the same domain (often referred to as "Cross-Origin Requests") is subject to the Same-Origin Policy in web browsers. When you try to make an AJAX request from `http://localhost` to `http://localhost:7076`, it is treated as a cross-origin request because... | 7,438 | [
{
"from": "human",
"value": "I would like to make an ajax call to a different server (same domain and box, just a different port.)\ne.g.\nMy page is\n\nhttp://localhost/index.html\n\nI would like to make a ajax get request to:\n\nhttp://localhost:7076/?word=foo\n\nI am getting this error:\n\nAccess to restr... |
.NET, Java and other high level database API's in various language often provide techniques known as prepared statements and parameter binding as opposed to sending plain text commands to the Database server. What I would like to know is what happens when you execute a statement like this:
SqlCommand cmd = new SqlComma... | When you use prepared statements and parameter binding in a database interaction (like in your example with ADO.NET), there are several important things happening under the hood that contribute to both security and performance. Here's a breakdown of the process:
### 1. Command Preparation
When you create a `SqlComman... | 7,364 | [
{
"from": "human",
"value": ".NET, Java and other high level database API's in various language often provide techniques known as prepared statements and parameter binding as opposed to sending plain text commands to the Database server. What I would like to know is what happens when you execute a statement... |
Does javascript use immutable or mutable strings? Do I need a "string builder"?
| In JavaScript, strings are immutable. This means that once a string is created, it cannot be changed. When you perform operations that seem to modify a string (like concatenation or slicing), what actually happens is that a new string is created instead of modifying the existing one.
For example:
```javascript
let st... | 9,184 | [
{
"from": "human",
"value": "Does javascript use immutable or mutable strings? Do I need a \"string builder\"?\n"
},
{
"from": "gpt",
"value": "In JavaScript, strings are immutable. This means that once a string is created, it cannot be changed. When you perform operations that seem to modify a ... |
aspnet mvc has the HandleError filter that will return a view if an error occurs, but if an error occurs when calling a JsonResult Action how can I return a JSON object that represents an error?
I don't want to wrap the code in each action method that returns a JsonResult in a try/catch to accomplish it, I'd rather do ... | In ASP.NET MVC, you can create a custom action filter to handle errors specifically for actions that return `JsonResult`. This allows you to avoid wrapping your action methods in `try/catch` blocks. By creating a custom filter, you can catch exceptions and return a standardized JSON error response.
Here's how to creat... | 8,113 | [
{
"from": "human",
"value": "aspnet mvc has the HandleError filter that will return a view if an error occurs, but if an error occurs when calling a JsonResult Action how can I return a JSON object that represents an error?\nI don't want to wrap the code in each action method that returns a JsonResult in a ... |
Suppose I have a COM object which users can access via a call such as:
Set s = CreateObject("Server")
What I'd like to be able to do is allow the user to specify an event handler for the object, like so:
Function ServerEvent
MsgBox "Event handled"
End Function
s.OnDoSomething = ServerEvent
Is this possible and,... | Yes, it is possible to expose event handling functionality for a COM object, allowing users to specify an event handler. In your case, you would implement a method to allow the user to set a callback function for the event and then invoke this function when the event occurs.
To accomplish this in C++ using Borland C++... | 3,188 | [
{
"from": "human",
"value": "Suppose I have a COM object which users can access via a call such as:\nSet s = CreateObject(\"Server\")\n\nWhat I'd like to be able to do is allow the user to specify an event handler for the object, like so:\nFunction ServerEvent\n\n MsgBox \"Event handled\"\n\nEnd Function\... |
I noticed that my Designer.vb file of one of my forms has a lot of controls that aren't even used or visible on my form. This is probably from copying controls from my other forms. Is there a way to clean up the Designer.vb file and get rid of all the unused controls?
**UPDATE: This is for a Windows Form project.
| Yes, in a Windows Forms project, it's not uncommon to have unused controls left over in the `Designer.vb` file, especially after copying controls or making changes to the form. While there's no automated tool to clean up unused controls directly in the `Designer.vb` file, you can manually remove them by following these... | 8,132 | [
{
"from": "human",
"value": "I noticed that my Designer.vb file of one of my forms has a lot of controls that aren't even used or visible on my form. This is probably from copying controls from my other forms. Is there a way to clean up the Designer.vb file and get rid of all the unused controls?\n**UPDAT... |
Is it possible to create Windows CE 5.0 images (ie: nk.bin) from VS2005/VS2008 without using Platform Builder? If so, how? Can a vendor BSP for WinCE 5 be loaded into VS2005/2008? Are there the parts to do this available for download from Microsoft (ie: the SDK), or must you buy the special bits (a la PB) from a "sp... | Creating a bootable Windows CE 5.0 image (like `nk.bin`) typically requires the use of Platform Builder, which is an integrated development environment specifically designed for developing Windows Embedded CE OS images. The reason for this is that Platform Builder provides essential tools for building the OS, including... | 10,654 | [
{
"from": "human",
"value": "Is it possible to create Windows CE 5.0 images (ie: nk.bin) from VS2005/VS2008 without using Platform Builder? If so, how? Can a vendor BSP for WinCE 5 be loaded into VS2005/2008? Are there the parts to do this available for download from Microsoft (ie: the SDK), or must you ... |
Where can I find some good pointers on best practices for running ASP.NET MVC on IIS6?
I haven't seen any realistic options for web-hosts who provide IIS7-hosting yet. Mostly because I don't live in the U.S.
So I was wondering on how you best build applications in ASP.NET MVC and make it easily available to deploy on b... | Running ASP.NET MVC applications on IIS6 presents some unique challenges, especially considering the routing system used in ASP.NET MVC. Below are best practices and tips for deploying your application in a way that is compatible with both IIS6 and IIS7:
### 1. **Routing Compatibility**
IIS6 does not support the defau... | 4,125 | [
{
"from": "human",
"value": "Where can I find some good pointers on best practices for running ASP.NET MVC on IIS6?\nI haven't seen any realistic options for web-hosts who provide IIS7-hosting yet. Mostly because I don't live in the U.S.\nSo I was wondering on how you best build applications in ASP.NET MVC ... |
I work on a complex application where different teams work on their own modules with a degree of overlap. A while back we got a Mediawiki instance set up, partly at my prompting. I have a hard job getting people to actually use it, let alone contribute.
I can see a lot of benefit in sharing information. It may at least... | Getting teams to adopt a MediaWiki instance for collaboration can be challenging, especially in a complex application environment. Here are several strategies you can employ to encourage usage and contributions:
### 1. **Promote the Benefits**
- **Highlight Use Cases:** Showcase specific examples where the wiki has... | 5,210 | [
{
"from": "human",
"value": "I work on a complex application where different teams work on their own modules with a degree of overlap. A while back we got a Mediawiki instance set up, partly at my prompting. I have a hard job getting people to actually use it, let alone contribute.\nI can see a lot of benef... |
I am having problem that even though I specify the level to ERROR in the root tag, the specified appender logs all levels (debug, info, warn) to the file regardless the settings. I am not a Log4j expert so any help is appreciated.
I have checked the classpath for log4j.properties (there is none) except the log4j.xml.
H... | It looks like you are experiencing an issue with Log4j where the specified log level for the root logger is not being respected, leading to all log levels being written to your `error.log`. Let's go through your configuration and identify potential areas for improvement.
### Understanding the Configuration
1. **Root ... | 5,368 | [
{
"from": "human",
"value": "I am having problem that even though I specify the level to ERROR in the root tag, the specified appender logs all levels (debug, info, warn) to the file regardless the settings. I am not a Log4j expert so any help is appreciated.\nI have checked the classpath for log4j.properti... |
The scenario
You have developed a webapp using EJBs version 3.
The system is deployed, delivered and is used by the customer.
If you would have to rewrite the system from scratch, would you use EJBs again?
No: Don't answer this question, answer this one instead.
Yes: Provide one important, real problem that EJBs solv... | Yes: One important problem that EJBs solved is transaction management. EJBs provide built-in support for declarative transaction management, allowing developers to easily define transaction boundaries without needing to write boilerplate code. This feature significantly reduces the complexity of handling database trans... | 11,719 | [
{
"from": "human",
"value": "The scenario\n\nYou have developed a webapp using EJBs version 3.\nThe system is deployed, delivered and is used by the customer.\n\nIf you would have to rewrite the system from scratch, would you use EJBs again?\nNo: Don't answer this question, answer this one instead.\nYes: Pr... |
User kokos answered the wonderful Hidden Features of C# question by mentioning the using keyword. Can you elaborate on that? What are the uses of using?
| Certainly! The `using` keyword in C# has two primary uses: managing resources and creating namespaces. Here’s a detailed explanation of both:
### 1. Managing Resources with `using` Statement
The `using` statement is primarily used to ensure that unmanaged resources are properly disposed of when they are no longer nee... | 6,873 | [
{
"from": "human",
"value": "User kokos answered the wonderful Hidden Features of C# question by mentioning the using keyword. Can you elaborate on that? What are the uses of using?\n"
},
{
"from": "gpt",
"value": "Certainly! The `using` keyword in C# has two primary uses: managing resources and... |
I have a scenario wherein, for example, I need to repeat a list of US states and display a table of cities and city populations after the name of each state. The design requirement dictates that every outer repetition must be the name of a state followed by a table of cities, and that requirement cannot be changed at t... | Nesting a `GridView` within a `Repeater` and binding each `GridView` during the `Repeater`'s `ItemDataBound` event can be a workable solution for displaying a list of states with their corresponding cities and populations. However, there are some disadvantages and considerations to keep in mind with this approach:
###... | 5,762 | [
{
"from": "human",
"value": "I have a scenario wherein, for example, I need to repeat a list of US states and display a table of cities and city populations after the name of each state. The design requirement dictates that every outer repetition must be the name of a state followed by a table of cities, an... |
I am attempting to set an asp.net textbox to a SQL 2005 money data type field, the initial result displayed to the user is 40.0000 instead of 40.00.
In my asp.net textbox control I would like to only display the first 2 numbers after the decimal point e.g. 40.00
What would be the best way to do this?
My code is below:
... | To ensure that your ASP.NET TextBox control displays the value from your SQL Server 2005 `money` data type field with two decimal places, you should format the value when you are retrieving it from the data reader. The default behavior of the `ToString()` method will not enforce a specific decimal format, which is why ... | 6,170 | [
{
"from": "human",
"value": "I am attempting to set an asp.net textbox to a SQL 2005 money data type field, the initial result displayed to the user is 40.0000 instead of 40.00.\nIn my asp.net textbox control I would like to only display the first 2 numbers after the decimal point e.g. 40.00\nWhat would be ... |
Simply setting the SVN_EDITOR variable to "mate" does not get the job done. It opens TextMate when appropriate, but then when I save the message and exit, I'm prompted to continue, abort or try again. It seems like the buffer isn't returned to the svn command for use.
| When using SVN with an editor like TextMate, setting the `SVN_EDITOR` variable to `"mate"` alone may not be sufficient for smooth integration. TextMate might be opening in a way that doesn't allow SVN to capture the output correctly, particularly if the editor does not exit cleanly or if it's not set to work with stand... | 9,402 | [
{
"from": "human",
"value": "Simply setting the SVN_EDITOR variable to \"mate\" does not get the job done. It opens TextMate when appropriate, but then when I save the message and exit, I'm prompted to continue, abort or try again. It seems like the buffer isn't returned to the svn command for use.\n"
}... |
I've been writing PHP for about six years now and have got to a point where I feel I should be doing more to write better code. I know that Object Oriented code is the way to go but I can't get my head around the concept.
Can anyone explain in terms that any idiot can understand, OO and how it works in PHP or point me ... | Absolutely! Object-Oriented Programming (OOP) can seem daunting at first, but once you break it down into simpler concepts, it becomes much clearer. Let's go through the basics of OOP in PHP in an easy-to-understand way.
### What is Object-Oriented Programming (OOP)?
OOP is a programming paradigm based on the concept... | 3,951 | [
{
"from": "human",
"value": "I've been writing PHP for about six years now and have got to a point where I feel I should be doing more to write better code. I know that Object Oriented code is the way to go but I can't get my head around the concept.\nCan anyone explain in terms that any idiot can understan... |
I have been researching asynchronous messaging, and I like the way it elegantly deals with some problems within certain domains and how it makes domain concepts more explicit. But is it a viable pattern for general domain-driven development (at least in the service/application/controller layer), or is the design overhe... | Asynchronous messaging can be a powerful pattern in domain-driven development (DDD), and its applicability goes beyond just service-oriented architecture (SOA) or distributed systems. Here are some considerations to help you determine whether to adopt asynchronous messaging more broadly in your application architecture... | 7,901 | [
{
"from": "human",
"value": "I have been researching asynchronous messaging, and I like the way it elegantly deals with some problems within certain domains and how it makes domain concepts more explicit. But is it a viable pattern for general domain-driven development (at least in the service/application/c... |
When attempting to understand how a SQL statement is executing, it is sometimes recommended to look at the explain plan. What is the process one should go through in interpreting (making sense) of an explain plan? What should stand out as, "Oh, this is working splendidly?" versus "Oh no, that's not right."
| Interpreting an explain plan is a crucial skill for database developers and administrators to understand how SQL queries are executed by the database engine. Here’s a structured approach to interpreting an explain plan and identifying issues or confirmations of efficient execution.
### Steps to Interpret an Explain Pl... | 5,586 | [
{
"from": "human",
"value": "When attempting to understand how a SQL statement is executing, it is sometimes recommended to look at the explain plan. What is the process one should go through in interpreting (making sense) of an explain plan? What should stand out as, \"Oh, this is working splendidly?\" ver... |
I'm looking for a technique or tool which we can use to obfuscate or somehow secure our compiled c# code. The goal is not for user/data security but to hinder reverse engineering of some of the technology in our software.
This is not for use on the web, but for a desktop application.
So, do you know of any tools avail... | Obfuscating your compiled C# code is a common practice to hinder reverse engineering efforts. Here are some popular tools and techniques you can use:
### 1. **Obfuscation Tools**
- **ConfuserEx**: This is a free and open-source obfuscator for .NET applications. It provides various obfuscation techniques, such as rena... | 6,373 | [
{
"from": "human",
"value": "I'm looking for a technique or tool which we can use to obfuscate or somehow secure our compiled c# code. The goal is not for user/data security but to hinder reverse engineering of some of the technology in our software. \nThis is not for use on the web, but for a desktop appli... |
Can anyone provide a good explanation of the volatile keyword in C#? Which problems does it solve and which it doesn't? In which cases will it save me the use of locking?
| In C#, the `volatile` keyword is used to indicate that a field can be accessed by multiple threads. When a field is declared as `volatile`, it tells the compiler and the runtime that this field may be read from and written to by different threads, and as such, the compiler should not optimize accesses to this field. Th... | 6,467 | [
{
"from": "human",
"value": "Can anyone provide a good explanation of the volatile keyword in C#? Which problems does it solve and which it doesn't? In which cases will it save me the use of locking?\n"
},
{
"from": "gpt",
"value": "In C#, the `volatile` keyword is used to indicate that a field ... |
Any suggestions for tools to monitor page load times/errors and other performance metrics for a PHP application?
I am aware of the FireBug and YSlow tools, but this is for more server monitoring.
| Certainly! Monitoring the performance of a PHP application involves tracking server performance, page load times, and errors. Here are some tools that can help you with those metrics:
### APM (Application Performance Management) Tools
1. **New Relic**: This powerful tool provides deep insights into application perform... | 7,057 | [
{
"from": "human",
"value": "Any suggestions for tools to monitor page load times/errors and other performance metrics for a PHP application?\nI am aware of the FireBug and YSlow tools, but this is for more server monitoring.\n"
},
{
"from": "gpt",
"value": "Certainly! Monitoring the performance... |
How do I find out what directory my console app is running in with C#?
| In a C# console application, you can determine the directory from which your application is running by using the `System.IO` namespace. There are several ways to find the current directory, depending on your specific needs. Here are a few common methods:
### 1. Using `Directory.GetCurrentDirectory()`
This method retu... | 9,546 | [
{
"from": "human",
"value": "How do I find out what directory my console app is running in with C#?\n"
},
{
"from": "gpt",
"value": "In a C# console application, you can determine the directory from which your application is running by using the `System.IO` namespace. There are several ways to f... |
Is output buffering enabled by default in Python's interpreter for sys.stdout?
If the answer is positive, what are all the ways to disable it?
Suggestions so far:
Use the -u command line switch
Wrap sys.stdout in an object that flushes after every write
Set PYTHONUNBUFFERED env var
sys.stdout = os.fdopen(sys.stdout.fi... | Yes, output buffering is enabled by default in Python's interpreter for `sys.stdout`. The buffering behavior can depend on whether the output is to a terminal or a file. By default, `sys.stdout` is line-buffered when outputting to a terminal and fully buffered when outputting to a file.
Here are several ways to disab... | 8,082 | [
{
"from": "human",
"value": "Is output buffering enabled by default in Python's interpreter for sys.stdout?\nIf the answer is positive, what are all the ways to disable it?\nSuggestions so far:\n\nUse the -u command line switch\nWrap sys.stdout in an object that flushes after every write\nSet PYTHONUNBUFFER... |
Is there a canonical ordering of submatch expressions in a regular
expression?
For example: What is the order of the submatches in
"(([0-9]{3}).([0-9]{3}).([0-9]{3}).([0-9]{3}))\s+([A-Z]+)" ?
a. (([0-9]{3})\.([0-9]{3})\.([0-9]{3})\.([0-9]{3}))\s+([A-Z]+)
(([0-9]{3})\.([0-9]{3})\.([0-9]{3})\.([0-9]{3}))
([A-Z... | In regular expressions, submatch expressions (often called capture groups) are ordered based on their appearance in the regular expression, with the outermost group being the first, followed by its inner groups in the order they appear.
For the provided regex pattern:
`(([0-9]{3}).([0-9]{3}).([0-9]{3}).([0-9]{3}))\s... | 7,898 | [
{
"from": "human",
"value": "Is there a canonical ordering of submatch expressions in a regular\nexpression? \nFor example: What is the order of the submatches in\n\"(([0-9]{3}).([0-9]{3}).([0-9]{3}).([0-9]{3}))\\s+([A-Z]+)\" ?\na. (([0-9]{3})\\.([0-9]{3})\\.([0-9]{3})\\.([0-9]{3}))\\s+([A-Z]+) \n (([0-9... |
In the past, I used Microsoft Web Application Stress Tool and Pylot to stress test web applications. I'd written a simple home page, login script, and site walkthrough (in an ecommerce site adding a few items to a cart and checkout).
Just hitting the homepage hard with a handful of developers would almost always locate... | Stress testing web applications is indeed a crucial part of ensuring scalability and performance. While you've had experience with tools like Microsoft Web Application Stress Tool and Pylot, there are many other modern tools and methodologies available today that can complement or replace these tools.
### Tools for St... | 3,903 | [
{
"from": "human",
"value": "In the past, I used Microsoft Web Application Stress Tool and Pylot to stress test web applications. I'd written a simple home page, login script, and site walkthrough (in an ecommerce site adding a few items to a cart and checkout).\nJust hitting the homepage hard with a handfu... |
I'm trying to test a simple WebForms (asp.net) based UI, and follow the MVP pattern to allow my UI to be more testable.
As I follow the TDD methodology for backend algorithms, I find that there are some unit test refactorings that happen in the spirit of the DRY principle (Don't Repeat Yourself). As I try to apply thi... | When working with MVP (Model-View-Presenter) in a WebForms application and employing TDD (Test-Driven Development) methodologies, refactoring your tests to avoid repetition is definitely encouraged, much like you would in the production code. Here are some strategies and considerations on how to effectively refactor yo... | 5,986 | [
{
"from": "human",
"value": "I'm trying to test a simple WebForms (asp.net) based UI, and follow the MVP pattern to allow my UI to be more testable. \nAs I follow the TDD methodology for backend algorithms, I find that there are some unit test refactorings that happen in the spirit of the DRY principle (Don... |
I am using gcc for windows. The OS is windows XP.
How do I import the homepath variable into my c program so I can write to c:\%homepath%\desktop? I would like to use something similar to:
fd = fopen("C:\\%%homepath%%\\desktop\\helloworld.txt","w");
| To use the `%HOMEPATH%` environment variable in your C program, you need to retrieve the environment variable at runtime using the `getenv` function provided in the C standard library. The `fopen` function can then use this value to create a file path dynamically.
Here's how you can achieve this:
1. Include the nece... | 7,805 | [
{
"from": "human",
"value": "I am using gcc for windows. The OS is windows XP.\nHow do I import the homepath variable into my c program so I can write to c:\\%homepath%\\desktop? I would like to use something similar to:\nfd = fopen(\"C:\\\\%%homepath%%\\\\desktop\\\\helloworld.txt\",\"w\");\n"
},
{
... |
Problem (simplified to make things clearer):
1. there is one statically-linked static.lib that has a function that increments:
extern int CallCount = 0;
int TheFunction()
{
void *p = &CallCount
printf("Function called");
return CallCount++;
}
2. static.lib is linked into a m... | Your understanding of the situation is correct. In .NET, each AppDomain is intended to isolate the execution environment of managed code, but this isolation does not extend to unmanaged code. When you link a static library (like `static.lib`) into your managed C++/CLI DLL (`managed.dll`), any static variables (like `Ca... | 7,454 | [
{
"from": "human",
"value": "Problem (simplified to make things clearer):\n\n1. there is one statically-linked static.lib that has a function that increments:\n\n\n extern int CallCount = 0;\n int TheFunction()\n {\n void *p = &CallCount\n printf(\"Function called\");\n return ... |
I'm running VisualSVN as my SVN server and using TortoiseSVN as the client. I've just renamed the server from mach1 to mach2 and now can't use SVN because it's looking for the repositories at http://mach1:81/ instead of the new name http://mach2:81/
Any idea how to fix this?
| When you rename your server and it's still looking for the old server name in your TortoiseSVN client, it's likely because the old repository URL is still cached in your working copies or in your TortoiseSVN configuration. Here are some steps you can take to fix this issue:
### Step 1: Update Repository URLs in Existi... | 7,629 | [
{
"from": "human",
"value": "I'm running VisualSVN as my SVN server and using TortoiseSVN as the client. I've just renamed the server from mach1 to mach2 and now can't use SVN because it's looking for the repositories at http://mach1:81/ instead of the new name http://mach2:81/\nAny idea how to fix this?\n"... |
Greetings!
I'm working on wrapping my head around LINQ. If I had some XML such as this loaded into an XDocument object:
<Root>
<GroupA>
<Item attrib1="aaa" attrib2="000" attrib3="true" />
</GroupA>
<GroupB>
<Item attrib1="bbb" attrib2="111" attrib3="true" />
<Item attrib1="ccc" attri... | Yes, you are indeed missing something in your LINQ query. The reason you only get the first `Item` element in your result is because you are using `thegroup.Element("Item")`, which returns only the first `Item` element found under `thegroup`.
To retrieve all `Item` elements and their attributes, you should use `thegro... | 10,175 | [
{
"from": "human",
"value": "Greetings!\nI'm working on wrapping my head around LINQ. If I had some XML such as this loaded into an XDocument object:\n<Root>\n <GroupA>\n <Item attrib1=\"aaa\" attrib2=\"000\" attrib3=\"true\" />\n </GroupA>\n <GroupB>\n <Item attrib1=\"bbb\" attrib2=\... |
Encouraged by SO, I'm trying to write an ASP.NET site that uses OpenID for user authentication. It's a regular WinForms site (not MVC.NET), using the DotNetOpenId library for authentication.
Is it safe for me to permit/deny administrative functions on the site by simply comparing the current session's "ClaimedID" (as ... | When it comes to implementing user authentication and authorization in an ASP.NET site using OpenID, there are a few key security principles to keep in mind regarding your approach to administrative privileges:
1. **Permitting/Denying Access**: It's generally safe to permit or deny access to administrative functions b... | 5,821 | [
{
"from": "human",
"value": "Encouraged by SO, I'm trying to write an ASP.NET site that uses OpenID for user authentication. It's a regular WinForms site (not MVC.NET), using the DotNetOpenId library for authentication.\nIs it safe for me to permit/deny administrative functions on the site by simply compar... |
I have an XML that I want to load to objects, manipulate those objects (set values, read values) and then save those XMLs back.
It is important for me to have the XML in the structure (xsd) that I created.
One way to do that is to write my own serializer, but is there a built in support for it or open source in C# that... | In C#, you have several options for working with XML in a way that allows you to load, manipulate, and save XML while adhering to a specific XML Schema Definition (XSD). Here are some built-in tools and open-source libraries you can use:
### 1. **System.Xml.Serialization**
The .NET Framework provides built-in support... | 6,034 | [
{
"from": "human",
"value": "I have an XML that I want to load to objects, manipulate those objects (set values, read values) and then save those XMLs back.\nIt is important for me to have the XML in the structure (xsd) that I created.\nOne way to do that is to write my own serializer, but is there a built ... |
The server.xml which controls the startup of Apache Tomcat's servlet container contains a debug attribute for nearly every major component. The debug attribute is more or less verbose depending upon the number you give it, zero being least and 99 being most verbose. How does the debug level affect Tomcat's speed when... | Yes, you're correct in your understanding of how the debug attribute in `server.xml` affects Apache Tomcat's performance. The debug levels determine the verbosity of logging and debugging information that Tomcat produces during its operation.
1. **Impact on Performance**:
- **Debug Level 0**: When set to zero, Tomc... | 9,065 | [
{
"from": "human",
"value": "The server.xml which controls the startup of Apache Tomcat's servlet container contains a debug attribute for nearly every major component. The debug attribute is more or less verbose depending upon the number you give it, zero being least and 99 being most verbose. How does t... |
I'm trying out ASP.NET MVC routing and have of course stumbled across a problem. I have a section, /Admin/Pages/, and this is also accessible through /Pages/, which it shouldn't. What could I be missing?
The routing code in global.asax:
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRo... | It looks like the routing issue you're facing is due to the fact that your `/Pages/` route is not properly restricted to the `/Admin/Pages/` section. As a result, both routes are being matched by the default route.
To fix this, you need to ensure that the `/Admin/Pages/` route is not being overridden by the default r... | 8,377 | [
{
"from": "human",
"value": "I'm trying out ASP.NET MVC routing and have of course stumbled across a problem. I have a section, /Admin/Pages/, and this is also accessible through /Pages/, which it shouldn't. What could I be missing?\nThe routing code in global.asax:\npublic static void RegisterRoutes(RouteC... |
I have an application on which I am implementing localization.
I now need to dynamically reference a name in the resouce file.
assume I have a resource file called Login.resx, an a number of strings: foo="hello", bar="cruel" and baz="world"
normally, I will refer as:
String result =Login.foo;
and result=="hello";
my p... | In .NET, if you want to dynamically access the values from a resource file (like `Login.resx`), you can use the `ResourceManager` class to achieve this. The `ResourceManager` allows you to retrieve resource strings using their names as strings.
Here's an example of how you can implement this:
1. Make sure you have th... | 9,105 | [
{
"from": "human",
"value": "I have an application on which I am implementing localization.\nI now need to dynamically reference a name in the resouce file.\nassume I have a resource file called Login.resx, an a number of strings: foo=\"hello\", bar=\"cruel\" and baz=\"world\"\nnormally, I will refer as: \n... |
We have a production machine and are trying to slowly introduce some 3.0 and up features on our web application. 3.5 is installed but I would like to upgrade to SP1, I would just like to know if it requires a restart of the machine in the end so I can schedule some down time.
Thanks!
EDIT: so it did require the restart... | Yes, when you upgrade from .NET Framework 3.5 to SP1, it typically requires a restart of the machine. This is because the update often involves changes to system files that can't be fully applied until the system is restarted.
Since you mentioned your hosting company doesn't give you the rights to restart the machine... | 10,075 | [
{
"from": "human",
"value": "We have a production machine and are trying to slowly introduce some 3.0 and up features on our web application. 3.5 is installed but I would like to upgrade to SP1, I would just like to know if it requires a restart of the machine in the end so I can schedule some down time.\nT... |
I want to dynamically hide/show some of the columns in a NSTableView, based on the data that is going to be displayed - basically, if a column is empty I'd like the column to be hidden. I'm currently populating the table with a controller class as the delegate for the table.
Any ideas? I see that I can set the column h... | To dynamically hide/show columns in an `NSTableView` based on whether they contain data, you can implement this in your controller class by overriding the relevant delegate methods and implementing logic to check the data source.
Here's a general approach:
1. **Implement your data source**: Make sure your data source... | 5,175 | [
{
"from": "human",
"value": "I want to dynamically hide/show some of the columns in a NSTableView, based on the data that is going to be displayed - basically, if a column is empty I'd like the column to be hidden. I'm currently populating the table with a controller class as the delegate for the table.\nAn... |
In VB.net I'm using the TcpClient to retrieve a string of data. I'm constantly checking the .Connected property to verify if the client is connected but even if the client disconnects this still returns true. What can I use as a workaround for this?
This is a stripped down version of my current code:
Dim client as Tc... | The issue you're experiencing with the `TcpClient.Connected` property is a common one. It does not always reflect the actual connection state accurately after a connection is established. The `.Connected` property may still return `True` even if the other side has disconnected, especially in cases where the socket is s... | 7,482 | [
{
"from": "human",
"value": "In VB.net I'm using the TcpClient to retrieve a string of data. I'm constantly checking the .Connected property to verify if the client is connected but even if the client disconnects this still returns true. What can I use as a workaround for this?\nThis is a stripped down ve... |
How to get a counter inside xsl:for-each loop that would reflect the number of current element processed.
For example my source XML is
<books>
<book>
<title>The Unbearable Lightness of Being </title>
</book>
<book>
<title>Narcissus and Goldmund</title>
</book>
<book>
<title>C... | You can use the `position()` function to get the current index of the element being processed within the `xsl:for-each` loop. Here's the modified XSLT:
```xml
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<... | 10,577 | [
{
"from": "human",
"value": "How to get a counter inside xsl:for-each loop that would reflect the number of current element processed.\nFor example my source XML is\n<books>\n <book>\n <title>The Unbearable Lightness of Being </title>\n </book>\n <book>\n <title>Narcissus and Goldmund... |
Hey all. Newbie question time. I'm trying to setup JMXQuery to connect to my MBean, so far this is what I got.
java -classpath jmxquery org.nagios.JMXQuery -U service:jmx:rmi:///jndi/rmi://localhost:8004/jmxrmi -O java.lang:type=Memory -A "NonHeapMemoryUsage"
Here's what I get.
JMX CRITICAL Authentication failed! Crede... | To connect to your JMX MBean with authentication using `JMXQuery`, you need to pass the username and password as part of the URL or as separate arguments. The typical way to include credentials in the JMX connection string is to use the `service:jmx:rmi:///jndi/rmi://<host>:<port>/jmxrmi` format while also appending th... | 9,675 | [
{
"from": "human",
"value": "Hey all. Newbie question time. I'm trying to setup JMXQuery to connect to my MBean, so far this is what I got.\njava -classpath jmxquery org.nagios.JMXQuery -U service:jmx:rmi:///jndi/rmi://localhost:8004/jmxrmi -O java.lang:type=Memory -A \"NonHeapMemoryUsage\"\nHere's what I g... |
I would like to get opinions or suggestions regarding embedded databases in Java.
In particular I was looking at H2, HSQLDB and Derby.
Have you use any of these in a production project?
Do you have comment or recommendations to select one over the others?
Thanks
Edit: I am currently evaluating these options to use in o... | When evaluating embedded databases in Java like H2, HSQLDB, and Apache Derby, each has its unique strengths and weaknesses, and your choice will depend on several factors, including performance, ease of use, features, and community support. Below are some insights and comparisons based on general experiences with these... | 6,589 | [
{
"from": "human",
"value": "I would like to get opinions or suggestions regarding embedded databases in Java.\nIn particular I was looking at H2, HSQLDB and Derby.\nHave you use any of these in a production project?\nDo you have comment or recommendations to select one over the others?\nThanks\nEdit: I am ... |
Using C# and ASP.NET I want to programmatically fill in some values (4 text boxes) on a web page (form) and then 'POST' those values. How do I do this?
Edit: Clarification: There is a service (www.stopforumspam.com) where you can submit ip, username and email address on their 'add' page. I want to be able to create a l... | To programmatically fill in and submit a form on another website (like the one on stopforumspam.com) using C#, you'd typically utilize HTTP requests rather than actually filling out a web page in a browser. This means you would send an HTTP POST request with the necessary form data to the target endpoint. Here’s how yo... | 6,715 | [
{
"from": "human",
"value": "Using C# and ASP.NET I want to programmatically fill in some values (4 text boxes) on a web page (form) and then 'POST' those values. How do I do this?\nEdit: Clarification: There is a service (www.stopforumspam.com) where you can submit ip, username and email address on their '... |
I am aware of CocoaMySQL but I have not seen a Mac GUI for SQLite, is there one?
My Google search didn't turn up any Mac related GUI's which is why I'm asking here rather than Google.
| Yes, there are several GUI tools available for managing SQLite databases on macOS. Here are some popular options:
1. **DB Browser for SQLite**: This is a free, open-source tool that provides a user-friendly interface for creating, designing, and editing SQLite database files. It's cross-platform and works well on macO... | 10,077 | [
{
"from": "human",
"value": "I am aware of CocoaMySQL but I have not seen a Mac GUI for SQLite, is there one?\nMy Google search didn't turn up any Mac related GUI's which is why I'm asking here rather than Google.\n"
},
{
"from": "gpt",
"value": "Yes, there are several GUI tools available for ma... |
I use this code in my Windows Service to be notified of USB disk drives being inserted and removed:
WqlEventQuery query = new WqlEventQuery("__InstanceOperationEvent",
"TargetInstance ISA 'Win32_LogicalDisk' AND TargetInstance.DriveType=2");
query.WithinInterval = TimeSpan.FromSeconds(1);
_deviceWatcher = new Mana... | The sound you are hearing on Windows XP is likely due to the continuous polling that occurs with the `WithinInterval` property of the `WqlEventQuery`. The query is set to fire every second, which can cause the system to poll for changes very frequently, leading to the hard drive accessing its files repeatedly.
To avoi... | 6,869 | [
{
"from": "human",
"value": "I use this code in my Windows Service to be notified of USB disk drives being inserted and removed:\nWqlEventQuery query = new WqlEventQuery(\"__InstanceOperationEvent\", \n \"TargetInstance ISA 'Win32_LogicalDisk' AND TargetInstance.DriveType=2\");\nquery.WithinInterval = Ti... |
Visual Basic code does not render correctly with prettify.js from Google.
on Stack Overflow:
Partial Public Class WebForm1
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'set page title
Page.Title = "Something"
End Su... | As of the last information available, PrettyPrint.js (or prettify.js) does not natively support Visual Basic or VB.NET syntax highlighting directly through a `lang-vb` or `lang-basic` class. The library primarily supports a predefined list of languages, as you've noted, but Visual Basic is not included in that list.
#... | 3,271 | [
{
"from": "human",
"value": "Visual Basic code does not render correctly with prettify.js from Google.\non Stack Overflow:\nPartial Public Class WebForm1\n Inherits System.Web.UI.Page\n\n Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load\n 'set page ti... |
In a ColdFusion Component (CFC), is it necessary to use fully qualified names for variables-scoped variables?
Am I going to get myself into trouble if I change this:
<cfcomponent>
<cfset variables.foo = "a private instance variable">
<cffunction name = "doSomething">
<cfset var bar = "a function local ... | In ColdFusion, using fully qualified names for variables (i.e., prefixing variable names with their scope) is generally a good practice for clarity and avoiding potential naming conflicts. However, it is not strictly necessary for accessing instance variables within a component.
### Your Original Code:
```coldfusion
<... | 8,077 | [
{
"from": "human",
"value": "In a ColdFusion Component (CFC), is it necessary to use fully qualified names for variables-scoped variables?\nAm I going to get myself into trouble if I change this:\n<cfcomponent>\n <cfset variables.foo = \"a private instance variable\">\n\n <cffunction name = \"doSometh... |
I have a table with a "Date" column, and I would like to do a query that does the following:
If the date is a Monday, Tuesday, Wednesday, or Thursday, the displayed date should be shifted up by 1 day, as in DATEADD(day, 1, [Date]) On the other hand, if it is a Friday, the displayed date should be incremented by 3 days... | To achieve the desired date adjustments based on the day of the week in SQL Server 2000, you can use the `CASE` statement in your `SELECT` query. The `DATEADD` function will be used to add the appropriate number of days depending on whether the date falls on a Monday, Tuesday, Wednesday, Thursday, or Friday.
Here's ho... | 9,194 | [
{
"from": "human",
"value": "I have a table with a \"Date\" column, and I would like to do a query that does the following:\nIf the date is a Monday, Tuesday, Wednesday, or Thursday, the displayed date should be shifted up by 1 day, as in DATEADD(day, 1, [Date]) On the other hand, if it is a Friday, the di... |
For example, right now I have a roll-my-own solution that uses data files that include blocks like:
PlayerCharacter Fighter
Hitpoints 25
Strength 10
StartPosition (0, 0, 0)
Art
Model BigBuffGuy
Footprint LargeFootprint
end
InventoryItem Sword
InventoryItem Shield
InventoryItem HealthPotion
end
... | Yes, there are several well-known data serialization formats and solutions that can meet or exceed your requirements for a human-editable, resilient, nested, and fast data representation. Here are some suggestions:
### 1. **JSON (JavaScript Object Notation)**
- **Human-Readable**: JSON is plain text and easy to read ... | 6,115 | [
{
"from": "human",
"value": "For example, right now I have a roll-my-own solution that uses data files that include blocks like:\nPlayerCharacter Fighter\n Hitpoints 25\n Strength 10\n StartPosition (0, 0, 0)\n Art\n Model BigBuffGuy\n Footprint LargeFootprint\n end\n InventoryItem Sword\n Inve... |
Does anyone see server-side JavaScript taking off? There are a couple of implementations out there, but it all seems to be a bit of a stretch (as in, "doing it BECAUSE WE CAN" type of attitude).
I'm curious to know if anyone actually writes JavaScript for the server-side and what their experiences with it have been to... | Server-side JavaScript has indeed gained significant traction in recent years, especially with the rise of Node.js. Here are some insights regarding the use of JavaScript on the server-side, along with some personal experiences and general consensus about stability:
### Popularity and Use Cases
1. **Node.js**: This is... | 5,535 | [
{
"from": "human",
"value": "Does anyone see server-side JavaScript taking off? There are a couple of implementations out there, but it all seems to be a bit of a stretch (as in, \"doing it BECAUSE WE CAN\" type of attitude). \nI'm curious to know if anyone actually writes JavaScript for the server-side and... |
MSDN says that you should use structs when you need lightweight objects. Are there any other scenarios when a struct is preferable over a class?
Some people might have forgotten that:
structs can have methods.
structs cannot be inherited.
I understand the technical differences between structs and classes, I just don'... | Structs and classes in languages like C# (which seems to be the context you are referring to) serve different purposes and are suited to different use cases. Here are some scenarios where using a struct may be preferable over a class:
1. **Immutability**: If you want to create a small data structure that is logically ... | 5,001 | [
{
"from": "human",
"value": "MSDN says that you should use structs when you need lightweight objects. Are there any other scenarios when a struct is preferable over a class?\nSome people might have forgotten that:\n\nstructs can have methods.\nstructs cannot be inherited.\n\nI understand the technical diffe... |
I have two identical tables and need to copy rows from table to another. What is the best way to do that? (I need to programmatically copy just a few rows, I don't need to use the bulk copy utility).
| To programmatically copy a few rows from one table to another in a database, you can use a simple SQL `INSERT INTO ... SELECT` statement. This is a commonly used approach in SQL databases for transferring data between tables, especially when both tables have the same structure.
Here’s a general outline of the steps to... | 6,666 | [
{
"from": "human",
"value": "I have two identical tables and need to copy rows from table to another. What is the best way to do that? (I need to programmatically copy just a few rows, I don't need to use the bulk copy utility).\n"
},
{
"from": "gpt",
"value": "To programmatically copy a few row... |
I have the following config in my lighttpd.conf:
$HTTP["host"] == "trac.domain.tld" {
server.document-root = "/usr/home/daniels/trac/htdocs/"
fastcgi.server = ( "/trac" =>
( "trac" =>
( "socket" => "/tmp/trac-fastcgi.sock",
... | To make your Trac application run at the root of your domain (i.e., `trac.domain.tld/` instead of `trac.domain.tld/trac/`), you will need to adjust your `lighttpd.conf` configuration to set up the FastCGI settings to serve requests directly from the root.
Here's how you can modify your existing configuration:
1. Cha... | 7,891 | [
{
"from": "human",
"value": "I have the following config in my lighttpd.conf:\n$HTTP[\"host\"] == \"trac.domain.tld\" {\n server.document-root = \"/usr/home/daniels/trac/htdocs/\"\n fastcgi.server = ( \"/trac\" =>\n ( \"trac\" =>\n ( \"so... |
I have VB application that requires visual service pack 6 to run , now when I install visualstudio.net (any version of .net) Its debugger doesn't work properly ,I am able to create windows/web application in visualstudio.net but not able to debug anything , so I have to keep 2 computers , one for VB and one for .net ... | The issue you are encountering with Visual Basic 6 (VB6) and Visual Studio .NET is likely due to conflicts between the two development environments, as they use different debugging techniques and frameworks. Here are some potential causes and fixes for your issue:
### Potential Causes:
1. **Conflicting Components:** V... | 8,024 | [
{
"from": "human",
"value": "I have VB application that requires visual service pack 6 to run , now when I install visualstudio.net (any version of .net) Its debugger doesn't work properly ,I am able to create windows/web application in visualstudio.net but not able to debug anything , so I have to keep 2... |
We're currently having a debate whether it's better to throw faults over a WCF channel, versus passing a message indicating the status or the response from a service.
Faults come with built-in support from WCF where by you can use the built-in error handlers and react accordingly. This, however, carries overhead as thr... | The choice between using fault contracts and returning a custom message object, like your `ReturnItemDTO<T>`, often hinges on the specific requirements of your application, including how errors and business rules should be communicated to the clients. Here are some considerations and thoughts to help guide your decisio... | 6,219 | [
{
"from": "human",
"value": "We're currently having a debate whether it's better to throw faults over a WCF channel, versus passing a message indicating the status or the response from a service.\nFaults come with built-in support from WCF where by you can use the built-in error handlers and react according... |
Is there a 7-Zip command-line switch that prevents the filenames from echoing to the screen as they are added to the archive?
| Yes, 7-Zip provides a command-line option to suppress the output of filenames when adding files to an archive. You can use the `-bsp1` switch to prevent the filenames from being echoed to the screen during the operation.
Here's how you can use it in a command:
```bash
7z a -bsp1 archive.7z file1.txt file2.txt
```
I... | 10,852 | [
{
"from": "human",
"value": "Is there a 7-Zip command-line switch that prevents the filenames from echoing to the screen as they are added to the archive?\n"
},
{
"from": "gpt",
"value": "Yes, 7-Zip provides a command-line option to suppress the output of filenames when adding files to an archiv... |
Is there any way that I can programmatically create (and I guess access) hidden folders on a storage device from within c#?
| Yes, you can programmatically create hidden folders on a storage device using C#. The process involves using the `System.IO` namespace to create the folder and then setting its attributes to hidden.
Here is a step-by-step guide on how to do this:
1. **Create the Folder**: Use `Directory.CreateDirectory` to create the... | 8,213 | [
{
"from": "human",
"value": "Is there any way that I can programmatically create (and I guess access) hidden folders on a storage device from within c#?\n"
},
{
"from": "gpt",
"value": "Yes, you can programmatically create hidden folders on a storage device using C#. The process involves using t... |
In Delphi, I want to be able to create an private object that's associated with a class, and access it from all instances of that class. In Java, I'd use:
public class MyObject {
private static final MySharedObject mySharedObjectInstance = new MySharedObject();
}
Or, if MySharedObject needed more complicated init... | In Delphi, you can achieve the behavior you're looking for using a class variable. A class variable in Delphi is similar to a static variable in Java, and it allows you to store data that is shared among all instances of a class. Below is an example illustrating how to create a shared object that is accessible from all... | 4,906 | [
{
"from": "human",
"value": "In Delphi, I want to be able to create an private object that's associated with a class, and access it from all instances of that class. In Java, I'd use:\npublic class MyObject {\n private static final MySharedObject mySharedObjectInstance = new MySharedObject();\n}\n\nOr, ... |
I'm using Ctrl+Left / Ctrl+Right in a GreaseMonkey script as a hotkey to turn back / forward pages. It seems to works fine, but I want to disable this behavior if I'm in a text edit area. I'm trying to use document.activeElement to get the page active element and test if it's an editable area, but it always returns "un... | To disable the hotkey behavior when you're inside a text edit area (like an `<input>`, `<textarea>`, or any content-editable element), you can check `document.activeElement` and see if it corresponds to one of these editable types. If you're seeing "undefined", it might be due to how you're checking it.
Here's an exam... | 5,491 | [
{
"from": "human",
"value": "I'm using Ctrl+Left / Ctrl+Right in a GreaseMonkey script as a hotkey to turn back / forward pages. It seems to works fine, but I want to disable this behavior if I'm in a text edit area. I'm trying to use document.activeElement to get the page active element and test if it's an... |
From time to time I get a System.Threading.ThreadStateException when attempting to restart a thread. The code in question is as follows:
// Make sure the thread is done stopping
while (this.mThread.ThreadState == ThreadState.Running)
{
Thread.Sleep(0);
}
// Respawn a thread if the current one is stopped or doesn't... | The code snippet you've shared attempts to manage a `Thread` instance by checking its state and then starting it if it's stopped or null. However, it seems there are a few issues that could lead to a `ThreadStateException`, as well as some best practices that you should consider.
### Issues with the Current Code
1. *... | 6,427 | [
{
"from": "human",
"value": "From time to time I get a System.Threading.ThreadStateException when attempting to restart a thread. The code in question is as follows:\n// Make sure the thread is done stopping\nwhile (this.mThread.ThreadState == ThreadState.Running)\n{ \n Thread.Sleep(0);\n}\n// Respawn a ... |
I'm working with LINQ for the first time and wanted to get the Mapping to work when I have a money type in SQL, but my domain object property is of type double. How can I express this in the XML file, or in code so that the mapping does not throw the usual "invalid cast" exception?
| When working with LINQ to SQL or Entity Framework, if you have a SQL `money` type and you want to map it to a `double` in your domain model, you'll need to ensure that the conversion between these types is handled correctly.
### Using LINQ to SQL with XML Mapping
If you are using LINQ to SQL with XML mapping, you can... | 7,437 | [
{
"from": "human",
"value": "I'm working with LINQ for the first time and wanted to get the Mapping to work when I have a money type in SQL, but my domain object property is of type double. How can I express this in the XML file, or in code so that the mapping does not throw the usual \"invalid cast\" exce... |
There is a legacy CVS repository, which contains a large number of directories, sub-directories, and paths. There is also a large number of branches and tags that do not necessarilly cover all paths & files - usually a subset. How can I find out, which branch / tag covers, which files and paths?
CVS log already provide... | To achieve the task of mapping files to their respective CVS tags and branches, you can indeed create a script to automate the process, and there are also tools and methods available that may help you. Here are some approaches you could consider:
### 1. **Using CVS Commands in a Script:**
You can leverage CVS commands... | 2,221 | [
{
"from": "human",
"value": "There is a legacy CVS repository, which contains a large number of directories, sub-directories, and paths. There is also a large number of branches and tags that do not necessarilly cover all paths & files - usually a subset. How can I find out, which branch / tag covers, which... |
I'm looking for a light version of REST for a Java web application I'm developing.
I've looked at RESTlet (www.restlet.org) and the REST plugin for Struts 2, but I haven't made up my mind. I'm leaning towards RESTlet, as it seems to be lighter.
Has anyone implemented a RESTful layer without any of the the frameworks o... | When considering a light version of REST for your Java web application, you have several options, including frameworks like RESTlet and alternatives like JAX-RS (e.g., Jersey, RESTEasy). Here are some insights based on common experiences and considerations:
### Implementing REST Without Frameworks
1. **Custom Impleme... | 6,082 | [
{
"from": "human",
"value": "I'm looking for a light version of REST for a Java web application I'm developing. \nI've looked at RESTlet (www.restlet.org) and the REST plugin for Struts 2, but I haven't made up my mind. I'm leaning towards RESTlet, as it seems to be lighter.\nHas anyone implemented a RESTfu... |
Can you use CMFCVisualManager with a dialog based application to change the applications appearance? If so how is it done?
The idea is to change the shape, colour etc. of controls such as push buttons using the MFC Feature Pack released with MSVC 2008.
| Yes, you can use `CMFCVisualManager` in a dialog-based application to change the application's appearance, including the shape and color of controls like push buttons. The MFC Feature Pack introduced in Visual Studio 2008 provides support for enhanced visuals and themes.
Here’s a step-by-step guide on how to implement... | 6,923 | [
{
"from": "human",
"value": "Can you use CMFCVisualManager with a dialog based application to change the applications appearance? If so how is it done?\nThe idea is to change the shape, colour etc. of controls such as push buttons using the MFC Feature Pack released with MSVC 2008.\n"
},
{
"from": "... |
I would like to create a stored procedure in MySQL that took a list as argument. For example, say that I would like to be able to set multiple tags for an item in one call, then what I want to do is to define a procedure that takes the ID of the item and a list of tags to set. However, I can't seem to find any way to d... | You're correct that MySQL does not have a built-in list or array data type. However, you can achieve similar functionality by using a comma-separated string and then processing that string within a stored procedure.
Here's a common approach to handling a list of items in MySQL by using a comma-separated string, which ... | 4,802 | [
{
"from": "human",
"value": "I would like to create a stored procedure in MySQL that took a list as argument. For example, say that I would like to be able to set multiple tags for an item in one call, then what I want to do is to define a procedure that takes the ID of the item and a list of tags to set. H... |
I am getting this error when trying to run internet information services on a Virtual Machine running windows XP. Anyone have any idea?
| Running Internet Information Services (IIS) on Windows XP can present a few challenges, especially since it's an older operating system that is no longer supported by Microsoft. Here are some troubleshooting steps and potential solutions to address common issues when trying to run IIS on a Windows XP virtual machine:
... | 6,896 | [
{
"from": "human",
"value": "I am getting this error when trying to run internet information services on a Virtual Machine running windows XP. Anyone have any idea?\n"
},
{
"from": "gpt",
"value": "Running Internet Information Services (IIS) on Windows XP can present a few challenges, especially... |
I'm looking for a PHP library that will allow me to create a print-ready PDF. The imposition should include 1-up, 4-up, 24-up, etc. layouts, and crop marks.
FPDF, TCPDF and PHP's included PDF libraries allow me to create an image and plop it on a PDF, but the more advanced layouts and crop marks are a bit beyond me.
T... | For creating print-ready PDFs with advanced layouts and features like imposition and crop marks in PHP, you might want to consider using a more specialized library. Here are some options that can help you achieve your goals:
### 1. **FPDI with FPDF or TCPDF**
- **FPDI** allows you to import existing PDFs, which can b... | 7,843 | [
{
"from": "human",
"value": "I'm looking for a PHP library that will allow me to create a print-ready PDF. The imposition should include 1-up, 4-up, 24-up, etc. layouts, and crop marks.\nFPDF, TCPDF and PHP's included PDF libraries allow me to create an image and plop it on a PDF, but the more advanced lay... |
I have a case where a VB.Net winforms app needs to play WMV files from across the network. The user running the app cannot be given direct access to the network share. Through impersonation, I can see that the files exist (without impersonation, File.Exists returns false for the files on the network share). When I then... | Using Windows Media Player control in a WinForms application to play files from a network location while dealing with impersonation can indeed be tricky due to how security contexts are managed in Windows.
When you use impersonation in a .NET application, the impersonation token is associated with the managed threads.... | 2,494 | [
{
"from": "human",
"value": "I have a case where a VB.Net winforms app needs to play WMV files from across the network. The user running the app cannot be given direct access to the network share. Through impersonation, I can see that the files exist (without impersonation, File.Exists returns false for the... |
How do I remove a USB drive using the Win32 API? I do a lot of work on embedded systems and on one of these I have to copy my programs on a USB stick and insert it into the target hardware.
Since I mostly work on the console I don't like to use the mouse and click on the small task-bar icon hundred times a day.
I'd lo... | To safely remove a USB drive using the Win32 API, you can use the `CreateFile`, `DeviceIoControl`, and `CloseHandle` functions. The idea is to send an I/O control request to the operating system to eject the drive. Below is a simple example of how you can accomplish this in C++:
1. First, you will need to include the ... | 5,057 | [
{
"from": "human",
"value": "How do I remove a USB drive using the Win32 API? I do a lot of work on embedded systems and on one of these I have to copy my programs on a USB stick and insert it into the target hardware.\nSince I mostly work on the console I don't like to use the mouse and click on the small ... |
I am working on an application and one design approach involves extremely heavy use of the instanceof operator. While I know that OO design generally tries to avoid using instanceof, that is a different story and this question is purely related to performance. I was wondering if there is any performance impact? Is is j... | When considering the performance implications of using the `instanceof` operator in Java, it’s good to keep a few key points in mind.
### Performance of `instanceof`
1. **JVM Optimization**: The Java Virtual Machine (JVM) is generally efficient at handling `instanceof` checks. The operation performs a simple type chec... | 8,245 | [
{
"from": "human",
"value": "I am working on an application and one design approach involves extremely heavy use of the instanceof operator. While I know that OO design generally tries to avoid using instanceof, that is a different story and this question is purely related to performance. I was wondering if... |
I found What are mvp and mvc and what is the difference but it didn't really answer this question.
I've recently started using MVC because it's part of the framework that myself and my work-partner are going to use. We chose it because it looked easy and separated process from display, are there advantages besides this... | MVC (Model-View-Controller) is a software architectural pattern that separates an application into three interconnected components. This separation helps in managing complexity, promoting organized code, and enhancing maintainability. Here’s a closer look at the advantages and disadvantages, particularly focusing on MV... | 5,602 | [
{
"from": "human",
"value": "I found What are mvp and mvc and what is the difference but it didn't really answer this question.\nI've recently started using MVC because it's part of the framework that myself and my work-partner are going to use. We chose it because it looked easy and separated process from ... |
When I use the default java locale on my linux machine it comes out with the US locale settings, where do I change this so that it comes out with the correct locale?
| To change the default locale for Java on a Linux machine, you will need to adjust the system locale settings. Here are the steps to change your locale settings, which will also affect Java:
### Step 1: Check Current Locale Settings
You can check your current locale settings by running the following command in your ter... | 5,784 | [
{
"from": "human",
"value": "When I use the default java locale on my linux machine it comes out with the US locale settings, where do I change this so that it comes out with the correct locale?\n"
},
{
"from": "gpt",
"value": "To change the default locale for Java on a Linux machine, you will n... |
I have a Progress database that I'm performing an ETL from. One of the tables that I'm reading from does not have a unique key on it, so I need to access the ROWID to be able to uniquely identify the row. What is the syntax for accessing the ROWID in Progress?
I understand there are problems with using ROWID for row ... | In a Progress (OpenEdge) database, you can use the `ROWID` attribute of a record to uniquely identify rows in a table that doesn't have a unique key. To access the `ROWID`, you need to use the `ROWID` function or the `ROWID` field directly in your Progress ABL (Advanced Business Language) code.
Here’s a simple example... | 9,780 | [
{
"from": "human",
"value": "I have a Progress database that I'm performing an ETL from. One of the tables that I'm reading from does not have a unique key on it, so I need to access the ROWID to be able to uniquely identify the row. What is the syntax for accessing the ROWID in Progress?\nI understand th... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.