instruction stringlengths 14 27.6k | completion stringlengths 3 38.3k | __original_row_idx int64 0 50k | conversations listlengths 2 2 |
|---|---|---|---|
We've got a few pages in our web systems that use the .net system.net.mail control to send emails. The thing has been working great, except it's now starting to look like the smptclient class may not actually be disconnecting from the server, such that the SMTP server leaves that connection open, and we ended up maxin... | It sounds like you're encountering a common issue with the `SmtpClient` class in .NET, particularly in older versions like .NET 2.0. There have been known limitations and quirks regarding connection management in the `SmtpClient` class that may lead to connections not being properly closed.
Here are a few approaches y... | 44,967 | [
{
"from": "human",
"value": "We've got a few pages in our web systems that use the .net system.net.mail control to send emails. The thing has been working great, except it's now starting to look like the smptclient class may not actually be disconnecting from the server, such that the SMTP server leaves th... |
I'm implementing a locking and copy protection system for my software. I've shut every hole that would allow someone to break my lock (well, that's a little too optimistic, I know!) but the last thing is this:
I hear crackers can change Windows DLLs like Kernel32.dll in a way that the API I use returns a value which is... | It's great to see that you're taking software protection seriously. While no system can be made perfectly secure, checking the integrity of your DLLs is a valid approach to mitigate certain types of tampering. Let's address your questions regarding Microsoft-signed DLLs and how to validate their signatures.
### 1. Doe... | 48,463 | [
{
"from": "human",
"value": "I'm implementing a locking and copy protection system for my software. I've shut every hole that would allow someone to break my lock (well, that's a little too optimistic, I know!) but the last thing is this:\nI hear crackers can change Windows DLLs like Kernel32.dll in a way t... |
I have a couple of array's:
const string a_strs[] = {"cr=1", "ag=2", "gnd=U", "prl=12", "av=123", "sz=345", "rc=6", "pc=12345"};
const string b_strs[] = {"cr=2", "sz=345", "ag=10", "gnd=M", "prl=11", "rc=6", "cp=34", "cv=54", "av=654", "ct=77", "pc=12345"};
which i then need to parse out for '=' and then put the value... | You can create a function to parse the arrays `a_strs` and `b_strs`, extract the key-value pairs, and populate the `predict_cache_key` struct accordingly. Below is a complete example in C++ demonstrating how to achieve this.
```cpp
#include <iostream>
#include <string>
#include <unordered_map>
#include <sstream>
stru... | 37,806 | [
{
"from": "human",
"value": "I have a couple of array's:\nconst string a_strs[] = {\"cr=1\", \"ag=2\", \"gnd=U\", \"prl=12\", \"av=123\", \"sz=345\", \"rc=6\", \"pc=12345\"};\nconst string b_strs[] = {\"cr=2\", \"sz=345\", \"ag=10\", \"gnd=M\", \"prl=11\", \"rc=6\", \"cp=34\", \"cv=54\", \"av=654\", \"ct=77... |
We're doing a full backup of each of our production databases every night.
We also have an hour replication occuring during the day to a report database.
It looks like the unc share ran out of space today. Is there an automated delete feature for the replication files? Or do I need to manually delete the replication ... | In most cases, automated deletion of replication files or backup files does not come enabled by default. The specifics may depend on the database system you are using (e.g., SQL Server, MySQL, PostgreSQL) and how you've configured your backups and replication processes. Here are a few general steps you can take:
### C... | 48,969 | [
{
"from": "human",
"value": "We're doing a full backup of each of our production databases every night.\nWe also have an hour replication occuring during the day to a report database.\nIt looks like the unc share ran out of space today. Is there an automated delete feature for the replication files? Or do... |
I have a form without caption, using on double click to maximize : Code looks like this:
procedure xxxxxx;
begin
if Form1.WindowState=wsNormal then
begin
Form1.WindowState:=wsMaximized;
Form1.SetBounds(0,0,screen.Width,screen.Height-getHeightOfTaskBar);
end
else
begin
... | To handle the taskbar visibility and to set the correct bounds for your form, you need to consider the case when the taskbar is either docked or auto-hidden. Your current method only retrieves the height of the taskbar based on its window rectangle, but it does not account for scenarios when the taskbar is hidden or no... | 46,915 | [
{
"from": "human",
"value": "I have a form without caption, using on double click to maximize : Code looks like this:\nprocedure xxxxxx; \nbegin\n if Form1.WindowState=wsNormal then\n begin\n Form1.WindowState:=wsMaximized;\n Form1.SetBounds(0,0,screen.Width,screen.Height-getHeightOfT... |
I use the pcapy/impacket library to decode network packets in Python. It has an IP decoder which knows about the syntax of IPv4 packets but apparently no IPv6 decoder.
Does anyone get one?
In a private correspondance, the Impacket maintainers say it may be better to start with Scapy
| If you're looking for an IPv6 decoder in Python and have been directed towards Scapy, you're on the right track. Scapy is a powerful library for packet manipulation and can handle a variety of protocols, including both IPv4 and IPv6.
### Using Scapy for IPv6 Decoding
To decode IPv6 packets using Scapy, you'll first n... | 47,441 | [
{
"from": "human",
"value": "I use the pcapy/impacket library to decode network packets in Python. It has an IP decoder which knows about the syntax of IPv4 packets but apparently no IPv6 decoder.\nDoes anyone get one? \nIn a private correspondance, the Impacket maintainers say it may be better to start wit... |
When we use datatable.newrow command, a new empty row added to bottom of rows. However I want newrow to added to top of datatable. How can I make it?
| In a DataTable, when you use the `NewRow()` method to create a new row, it doesn't directly add it to the DataTable; it simply creates an instance of a DataRow that you can populate with data. After creating the new row, you need to use the `Rows.InsertAt` method to add it at a specific position (such as at the top) in... | 47,721 | [
{
"from": "human",
"value": "When we use datatable.newrow command, a new empty row added to bottom of rows. However I want newrow to added to top of datatable. How can I make it?\n"
},
{
"from": "gpt",
"value": "In a DataTable, when you use the `NewRow()` method to create a new row, it doesn't d... |
I want to dynamically get the name of the current stored procedure inside itself for logging purposes.
| In SQL Server, you can retrieve the name of the currently executing stored procedure using the built-in function `OBJECT_NAME` in conjunction with `@@PROCID`. Here's how you can do this:
```sql
CREATE PROCEDURE YourStoredProcedureName
AS
BEGIN
DECLARE @ProcName NVARCHAR(128);
-- Get the name of the curren... | 49,787 | [
{
"from": "human",
"value": "I want to dynamically get the name of the current stored procedure inside itself for logging purposes.\n"
},
{
"from": "gpt",
"value": "In SQL Server, you can retrieve the name of the currently executing stored procedure using the built-in function `OBJECT_NAME` in c... |
I'm trying to process a credit card transaction in .net and it works perfectly in Safari, Opera, and IE. When I try the same transaction in Firefox it sends two requests and I end up with a double charged card. From a quick search on Google it seems that this is an issue with Firebug but I am unable to find a way to st... | The issue of double submissions in Firefox (or any browser) typically arises from the user clicking a submit button multiple times or from JavaScript triggering the submission multiple times due to event handling issues. Here are several strategies you can employ to mitigate the double submission issue:
### 1. Disable... | 41,476 | [
{
"from": "human",
"value": "I'm trying to process a credit card transaction in .net and it works perfectly in Safari, Opera, and IE. When I try the same transaction in Firefox it sends two requests and I end up with a double charged card. From a quick search on Google it seems that this is an issue with Fi... |
With a seriously big .NET site/solution (100's of assemblies), are there any tools available to recognise which assemblies have changed since the last build (using something more intelligent than file dates that will always change).
I need to change our deployment process to a) increment the version of changed assembli... | To streamline your deployment process for a large .NET solution with numerous assemblies, you can utilize a combination of tools and techniques that can help identify which assemblies have changed since the last build, automate versioning, and create a delta release. Here are some suggestions:
### Tools for Identifyin... | 45,423 | [
{
"from": "human",
"value": "With a seriously big .NET site/solution (100's of assemblies), are there any tools available to recognise which assemblies have changed since the last build (using something more intelligent than file dates that will always change).\nI need to change our deployment process to a)... |
If my domain objects implement IDataErrorInfo, and I am using M-V-VM, how do I propagate errors through the ViewModel into the View? If i was binding directly to the model, I would set the "ValidateOnExceptons" and "ValidateOnErrors" properties to true on my binding. But my ViewModel doesn't implement IDataErrorInfo. O... | In a Model-View-ViewModel (MVVM) architecture where your domain objects implement `IDataErrorInfo`, you can propagate validation errors from your model to the view through your view model. Here's how you can achieve this without modifying the existing codebase to implement `IDataErrorInfo` in the view model:
### Steps... | 43,894 | [
{
"from": "human",
"value": "If my domain objects implement IDataErrorInfo, and I am using M-V-VM, how do I propagate errors through the ViewModel into the View? If i was binding directly to the model, I would set the \"ValidateOnExceptons\" and \"ValidateOnErrors\" properties to true on my binding. But my ... |
I'm a simple soul with simple needs, and I'm trying to configure a form. I detest forms.
It needs to have JavaScript to transfer the data, it needs to send an e-mail with the data to an e-mail address, and it needs to redirect visitors to a pdf. CGI has always been confusing to me, and I don't know much JavaScript.
I... | I understand how frustrating it can be to deal with form submissions and JavaScript. Let me help you put together a simple HTML form with JavaScript to send the data via email and redirect to a PDF after submission. However, sending an email directly through JavaScript is not possible due to security reasons. Instead, ... | 44,247 | [
{
"from": "human",
"value": "I'm a simple soul with simple needs, and I'm trying to configure a form. I detest forms.\nIt needs to have JavaScript to transfer the data, it needs to send an e-mail with the data to an e-mail address, and it needs to redirect visitors to a pdf. CGI has always been confusing ... |
I'm working on a Django project that requires debugging on a multithreaded server. I've found mod_wsgi 2.0+ to be the easiest to work with, because of easy workarounds for python module reloading. Problem is can't get it to compile on Leopard. Is there anyone who has managed to do it so far, either for the builtin Apac... | Thank you for sharing your detailed instructions on compiling `mod_wsgi` for macOS Leopard. For anyone else facing similar issues, I'll summarize the key steps you've outlined along with some additional context.
### Compiling `mod_wsgi` 2.3 for Apache on macOS Leopard
If you're working on macOS Leopard (10.5) and nee... | 46,604 | [
{
"from": "human",
"value": "I'm working on a Django project that requires debugging on a multithreaded server. I've found mod_wsgi 2.0+ to be the easiest to work with, because of easy workarounds for python module reloading. Problem is can't get it to compile on Leopard. Is there anyone who has managed to ... |
How can I pad a string with spaces on the left when using printf?
For example, I want to print "Hello" with 40 spaces preceding it.
Also, the string I want to print consists of multiple lines. Do I need to print each line separately?
EDIT: Just to be clear, I want exactly 40 spaces printed before every line.
| To pad a string with spaces on the left in C using `printf`, you can use a formatted string that specifies the total width of the output, including the padding spaces. If you want to print "Hello" with 40 spaces preceding it, you can use the format specifier `%*s`, where `*` is replaced with the desired width.
Here’s ... | 47,317 | [
{
"from": "human",
"value": "How can I pad a string with spaces on the left when using printf?\nFor example, I want to print \"Hello\" with 40 spaces preceding it.\nAlso, the string I want to print consists of multiple lines. Do I need to print each line separately?\nEDIT: Just to be clear, I want exactly ... |
Academia has it that table names should be the singular of the entity that they store attributes of.
I dislike any T-SQL that requires square brackets around names, but I have renamed a Users table to the singular, forever sentencing those using the table to sometimes have to use brackets.
My gut feel is that it is... | The choice between using singular or plural names for database tables is often a matter of convention and personal or team preference. Here are some considerations to help you decide:
### Singular vs. Plural Naming
1. **Singular Naming**:
- Pros:
- Some argue that each row in a table represents a single entit... | 48,728 | [
{
"from": "human",
"value": "Academia has it that table names should be the singular of the entity that they store attributes of. \nI dislike any T-SQL that requires square brackets around names, but I have renamed a Users table to the singular, forever sentencing those using the table to sometimes have to... |
I'm trying to get Unicode working properly in rails using MySQL. Now, Rails displays the text correctly, but it shows up as ??? in MySQL. Additionally, I am not able to filter the text.
My MySQL database has been configured with the utf8 character set. My client character is also UTF8. Likewise, rails is set to use... | To properly handle Unicode data in a Rails application using MySQL, you need to ensure that your database, tables, columns, and Rails configurations are all set up to use UTF-8 encoding correctly. Here are the steps to configure everything properly:
### 1. Database Configuration
Make sure your MySQL database is confi... | 46,050 | [
{
"from": "human",
"value": "I'm trying to get Unicode working properly in rails using MySQL. Now, Rails displays the text correctly, but it shows up as ??? in MySQL. Additionally, I am not able to filter the text.\nMy MySQL database has been configured with the utf8 character set. My client character is... |
We've got a classic ASP application that is putting out some very large reports, where the resulting HTML is several MBs. We've made a lot of progress in trimming this down by reducing extraneous HTML, but I'd like to know if there's any way to enable GZIP compression on these dynamic .asp pages. I'm sure compressing t... | To enable GZIP compression for dynamic `.asp` pages in a classic ASP application, you'll want to use IIS (Internet Information Services) configuration settings or modify the application to utilize HTTP compression. Here's a step-by-step guide for enabling GZIP compression:
### Method 1: Enable GZIP Compression in IIS ... | 47,024 | [
{
"from": "human",
"value": "We've got a classic ASP application that is putting out some very large reports, where the resulting HTML is several MBs. We've made a lot of progress in trimming this down by reducing extraneous HTML, but I'd like to know if there's any way to enable GZIP compression on these d... |
The ISO C committee (ISO/IEC JTC1/SC21/WG14) has published TR 24731-1 and is working on TR 24731-2:
TR 24731-1: Extensions to the C Library Part I: Bounds-checking interfaces
WG14 is working on a TR on safer C library functions. This TR is oriented towards modifying existing programs, often by adding an extra paramete... | As an AI, I don't have personal experiences or the ability to use libraries or compilers directly. However, I can provide some context and considerations regarding the TR 24731-1 and TR 24731-2 efforts based on the information available.
1. **Library or Compiler Support**: Many modern compilers and libraries are gradu... | 46,389 | [
{
"from": "human",
"value": "The ISO C committee (ISO/IEC JTC1/SC21/WG14) has published TR 24731-1 and is working on TR 24731-2:\n\nTR 24731-1: Extensions to the C Library Part I: Bounds-checking interfaces\nWG14 is working on a TR on safer C library functions. This TR is oriented towards modifying existing... |
I am looking for a reliable service that has a good database of the hosting providers vs domain names. I guess some of the domains that are privately hosted cannot be resolved to a definite hosting provider (maybe just to ISP).
I have used webhosting.info (their power whois and advanced whois) which used to give host... | Finding reliable services for bulk lookups that can accurately identify hosting providers for domain names can be a bit challenging, especially since many domains are privately registered or hosted on shared IPs. However, here are some tools and services you might find useful for bulk lookups of hosting providers and r... | 48,249 | [
{
"from": "human",
"value": "I am looking for a reliable service that has a good database of the hosting providers vs domain names. I guess some of the domains that are privately hosted cannot be resolved to a definite hosting provider (maybe just to ISP). \nI have used webhosting.info (their power whois a... |
I'm making heavy use of PropertySheets in my application framework's configuration editor. I like them a lot because it's pretty easy to work with them (once you learn how) and make the editing bulletproof.
One of the things that I'm storing in my configuration are Python scripts. It's possible to edit a Python scrip... | Creating a better editor for Python scripts within a PropertySheet in a Windows Forms or WPF application can indeed enhance usability significantly. While there are several text editors and libraries designed for rich text editing, few directly integrate with PropertySheets and meet all your criteria.
### Options to C... | 44,989 | [
{
"from": "human",
"value": "I'm making heavy use of PropertySheets in my application framework's configuration editor. I like them a lot because it's pretty easy to work with them (once you learn how) and make the editing bulletproof.\nOne of the things that I'm storing in my configuration are Python scri... |
I would like to know is there any Free Ajax Framework other than AjaxPro and Microsoft Ajax Framework for ASP.Net 2.0. The feature that I am looking for is ease of use as provided by Microsoft Ajax Framework and speed as provided by AjaxPro.
| There are several free Ajax frameworks that you can consider for ASP.NET 2.0 that provide ease of use and good performance. While you've mentioned AjaxPro and the Microsoft Ajax Framework, here are a few more options to consider:
1. **jQuery Ajax**:
- **Description**: jQuery is a popular JavaScript library that si... | 49,151 | [
{
"from": "human",
"value": "I would like to know is there any Free Ajax Framework other than AjaxPro and Microsoft Ajax Framework for ASP.Net 2.0. The feature that I am looking for is ease of use as provided by Microsoft Ajax Framework and speed as provided by AjaxPro.\n"
},
{
"from": "gpt",
"v... |
What's the best way to move a document from one doc library to another? I don't care about version history or preserving CreatedBy and ModifiedBy metadata...
SPList lib1 = (SPDocumentLibrary) web.Lists["lib1"];
SPList lib2 = (SPDocumentLibrary) web.Lists["lib2"];
SPItem item1 = lib1.Items[0];
//insert code to move item... | To move a document from one document library to another in SharePoint, especially when you're not concerned about version history or metadata like CreatedBy and ModifiedBy, you can use the `CopyTo` method followed by the `Delete` method on the original item. The `SPItem.MoveTo()` method can be less straightforward in c... | 46,360 | [
{
"from": "human",
"value": "What's the best way to move a document from one doc library to another? I don't care about version history or preserving CreatedBy and ModifiedBy metadata...\nSPList lib1 = (SPDocumentLibrary) web.Lists[\"lib1\"];\nSPList lib2 = (SPDocumentLibrary) web.Lists[\"lib2\"];\nSPItem i... |
I am writing a set of database-driven applications in PHP. These applications will run on a Linux server as its own user. Other users will likely be on the system at times, but have very controlled access. Other servers they will not have access to at all. I will also expose a limit stored procedure API to develope... | Securing database connection strings is a critical aspect of application development, especially when deploying applications on a shared environment like a Linux server. Here are several best practices you can follow to secure your configuration files:
### 1. File Permissions
- **User Privileges**: Ensure that your c... | 46,647 | [
{
"from": "human",
"value": "I am writing a set of database-driven applications in PHP. These applications will run on a Linux server as its own user. Other users will likely be on the system at times, but have very controlled access. Other servers they will not have access to at all. I will also expose... |
I want to prevent users from browsing other users names, security (of course) and performance
| To prevent users from browsing other users' names while ensuring security and maintaining performance, you can implement several strategies. Here are some recommendations:
### 1. **Access Control**
- **Role-Based Access Control (RBAC)**: Implement roles that restrict access to user data based on the user's role in ... | 45,113 | [
{
"from": "human",
"value": "I want to prevent users from browsing other users names, security (of course) and performance \n"
},
{
"from": "gpt",
"value": "To prevent users from browsing other users' names while ensuring security and maintaining performance, you can implement several strategies... |
I ran into a scenario where LINQ to SQL acts very strangely. I would like to know if I'm doing something wrong. But I think there is a real possibility that it's a bug.
The code pasted below isn't my real code. It is a simplified version I created for this post, using the Northwind database.
A little background: I have... | Your issue is indeed related to how LINQ to SQL captures the variable used in the `Where` clause during the execution of the query. The behavior you are experiencing arises because the `oFilter` variable in the lambda expression is being captured by reference. Therefore, as the `foreach` loop iterates, the `oFilter` va... | 44,647 | [
{
"from": "human",
"value": "I ran into a scenario where LINQ to SQL acts very strangely. I would like to know if I'm doing something wrong. But I think there is a real possibility that it's a bug.\nThe code pasted below isn't my real code. It is a simplified version I created for this post, using the North... |
I'm running an upgrade script against a database hosted in Microsoft SQL Server. It's taking a while. Some of the queries are not worth optimising any further, for various reasons.
I'm the only person using this database: Is there a way that I can tell SQL Server to not bother with transactions/locking?
For instance, o... | In Microsoft SQL Server, transactions and locking are fundamental concepts that help maintain data integrity and ensure that concurrent operations do not lead to inconsistent results. While it may be tempting to bypass these mechanisms to speed up a long-running operation, it is generally not advisable to ignore transa... | 45,446 | [
{
"from": "human",
"value": "I'm running an upgrade script against a database hosted in Microsoft SQL Server. It's taking a while. Some of the queries are not worth optimising any further, for various reasons.\nI'm the only person using this database: Is there a way that I can tell SQL Server to not bother ... |
I always hear that using "lastInsertId" (or mysql_insert_id() if you're not using PDO) is evil. In case of triggers it obviously is, because it could return something that's totally not the last ID that your INSERT created.
$DB->exec("INSERT INTO example (column1) VALUES ('test')");
// Usually returns your newly create... | Using `lastInsertId()` can indeed lead to issues in certain scenarios, especially when triggers are involved, as you correctly pointed out. When a trigger inserts into another table and you call `lastInsertId()`, it might return the ID generated by the trigger's insert instead of the original insert.
To safely obtain ... | 40,471 | [
{
"from": "human",
"value": "I always hear that using \"lastInsertId\" (or mysql_insert_id() if you're not using PDO) is evil. In case of triggers it obviously is, because it could return something that's totally not the last ID that your INSERT created.\n$DB->exec(\"INSERT INTO example (column1) VALUES ('t... |
I have the following scenario
Have a web browser control which uses the Navigate method to call a web page. I have the need to post a large number of elements via FORM POST. The number of elements can be either 40-100 elements.
Is it advisable to encode this and send it via the the Navigate method?
Does one normally ... | When dealing with the need to submit a large number of form elements (40-100) via a web browser control using the `Navigate` method, there are a few considerations and best practices to keep in mind.
### Using FORM POST with Navigate Method
1. **Encoding Data**: It is possible to encode the data and send it using the... | 46,394 | [
{
"from": "human",
"value": "I have the following scenario\n\nHave a web browser control which uses the Navigate method to call a web page. I have the need to post a large number of elements via FORM POST. The number of elements can be either 40-100 elements.\n\nIs it advisable to encode this and send it vi... |
A few quick searches discovered that I'm obviously not the first person to have the thought "Can I unit test my CSS?".
I'm wondering if anyone here has taken on CSS Unit Testing successfully? If you've tried and failed, or just have your own theories, please tell me why it (apparently) hasn't been done yet?
| Unit testing CSS can be challenging for several reasons, but some people and tools have attempted to tackle the problem. Here's an overview of the current landscape regarding CSS unit testing:
### Challenges of CSS Unit Testing
1. **Declarative Nature**: CSS is inherently a declarative language focused on how element... | 49,015 | [
{
"from": "human",
"value": "A few quick searches discovered that I'm obviously not the first person to have the thought \"Can I unit test my CSS?\". \nI'm wondering if anyone here has taken on CSS Unit Testing successfully? If you've tried and failed, or just have your own theories, please tell me why it (... |
I want to get Visual Studio style tabs (you know, the ones where you can tab through the currently opened files).
Is there a 3rd party component that does this?
How hard would it be to do myself?
| If you're looking to implement Visual Studio-style tabs in your application, there are several options available to you, depending on the technology stack you're using (e.g., Windows Forms, WPF, or other frameworks). Here are some third-party components and insights on implementing it yourself.
### Third-Party Compone... | 44,260 | [
{
"from": "human",
"value": "I want to get Visual Studio style tabs (you know, the ones where you can tab through the currently opened files).\nIs there a 3rd party component that does this?\nHow hard would it be to do myself? \n"
},
{
"from": "gpt",
"value": "If you're looking to implement Vis... |
We are about to develop a web app from scratch using ASP.Net, and would like it to be as platform-agnostic as possible. As far as I know, the only two options for this are IIS on windows, and Mono (via Apache) on Linux.
The app will be follow the MVC architecture, so with all of this in mind, how difficult is it to dev... | Developing a platform-agnostic web application using ASP.NET from scratch is a feasible task, especially with ASP.NET Core, which is designed with cross-platform compatibility in mind. Here's a breakdown of how to approach this:
### 1. **Choose the Right Framework**
- **ASP.NET Core**: This is the modern, cross-platfo... | 46,107 | [
{
"from": "human",
"value": "We are about to develop a web app from scratch using ASP.Net, and would like it to be as platform-agnostic as possible. As far as I know, the only two options for this are IIS on windows, and Mono (via Apache) on Linux.\nThe app will be follow the MVC architecture, so with all o... |
We've developed a custom Outlook 2003 form based on ipmNote. I need a way to push this to all the other users in the organization. At the same time we'll also be installing a custom Add-in built with VSTO so we could do the form install as part of that.
Currently I can't use the Organizational Forms Library, because t... | Deploying a custom Outlook form to all users in an organization without using the Organizational Forms Library can be a bit challenging, especially in Outlook 2003. Here are some alternative methods you can consider to distribute your custom form along with your VSTO add-in:
### Option 1: Distributing the Form via Ema... | 45,620 | [
{
"from": "human",
"value": "We've developed a custom Outlook 2003 form based on ipmNote. I need a way to push this to all the other users in the organization. At the same time we'll also be installing a custom Add-in built with VSTO so we could do the form install as part of that. \nCurrently I can't use t... |
This case is going to sound complicated, but it's not that bad. The javascript at the end of this code seems to be sound.
EDIT: Here's the page running on a live server. The first example doesn't alternate between open and closed because I ripped out a lot of code in order to narrow the example down as much as I could.... | It sounds like you're dealing with a classic case of state management issues in ASP.NET Web Forms, particularly with the way JavaScript is being utilized alongside server-side postbacks. The key issue seems to be that each postback is unintentionally accumulating state or modifying elements in a way that leads to repea... | 47,082 | [
{
"from": "human",
"value": "This case is going to sound complicated, but it's not that bad. The javascript at the end of this code seems to be sound.\nEDIT: Here's the page running on a live server. The first example doesn't alternate between open and closed because I ripped out a lot of code in order to n... |
I have the following Linq to SQL query, in which I'm trying to do a multi-column GROUP BY:
return from revision in dataContext.Revisions
where revision.BranchID == sourceBranch.BranchID-1
&& !revision.HasBeenMerged
group revision by new Task(revision.TaskSourceCode.ToUpper(),
... | The `InvalidOperationException` you're encountering, specifically regarding ordering by the `Task` type, is a common issue in LINQ to SQL when it cannot determine how to compare or order instances of a custom type. Here are several approaches to resolve this issue:
### Option 1: Use a Composite Key for Grouping and Or... | 49,070 | [
{
"from": "human",
"value": "I have the following Linq to SQL query, in which I'm trying to do a multi-column GROUP BY:\nreturn from revision in dataContext.Revisions\n where revision.BranchID == sourceBranch.BranchID-1\n && !revision.HasBeenMerged\n group revision by new Task(rev... |
I've come across an issue where some images on a site load under https but do not load under http.
For example if you go to https://www.mydomain.com/myimage.gif, the image appears fine, but if you go to http://www.mydomain.com/myimage.gif the image comes back with a not found error. This happens to only certain images... | This issue could be related to several factors, particularly how the web server is configured to handle HTTP and HTTPS requests. Here are some potential reasons and solutions to address the problem you're experiencing with images loading correctly under HTTPS but not HTTP:
### 1. **File Permissions:**
- Ensure that... | 48,972 | [
{
"from": "human",
"value": "I've come across an issue where some images on a site load under https but do not load under http.\nFor example if you go to https://www.mydomain.com/myimage.gif, the image appears fine, but if you go to http://www.mydomain.com/myimage.gif the image comes back with a not found e... |
For HKey_Class_Root\CLSID I found the equivalent to be HKey_Current_User\Software\Classes\CLSID but looking in the registry I didn't see "Record" in the same location.
| The Windows registry stores various types of data, including information about classes (COM objects) identified by their CLSIDs (Class Identifiers). When you mentioned that you found "HKEY_CLASSES_ROOT\CLSID" and its equivalent in "HKEY_CURRENT_USER\Software\Classes\CLSID", it’s important to note that these keys can ha... | 44,273 | [
{
"from": "human",
"value": "For HKey_Class_Root\\CLSID I found the equivalent to be HKey_Current_User\\Software\\Classes\\CLSID but looking in the registry I didn't see \"Record\" in the same location.\n"
},
{
"from": "gpt",
"value": "The Windows registry stores various types of data, including... |
I'm not sure if Vim makes me more productive compared to other editors/ide's like Eclipse for example.
But somehow I get an empowering feeling when using Vim and noticed resistance to trying others editors.
Example: As soon a I see some cool feature in an other editor I'm thinking "Vi can do that (i just have to find t... | Benchmarking editor productivity is a subjective endeavor, as different editors cater to varying workflows, programming languages, and personal preferences. However, there are some strategies and metrics you can employ to evaluate editor productivity more objectively:
### 1. Task Completion Time
Measure the time it ta... | 45,026 | [
{
"from": "human",
"value": "I'm not sure if Vim makes me more productive compared to other editors/ide's like Eclipse for example.\nBut somehow I get an empowering feeling when using Vim and noticed resistance to trying others editors.\nExample: As soon a I see some cool feature in an other editor I'm thin... |
everybody; I have this problem in asp.net, I have a page where I insert and modify data, before saving I make a validation if it passes I save the data but if not I raise an exception and show it, the function goes like this;
protected void btnSave_Click(object sender, EventArgs e)
{
try
{
...
if(ValidData())
//Save
... | The behavior you're experiencing is because the JavaScript alert that you are setting in `JSLiteral` persists across postbacks. After you fix the data and click the save button again, the page is reloaded, and the alert with the old exception message is still present.
To solve this issue, you can clear the `JSLiteral`... | 49,594 | [
{
"from": "human",
"value": "everybody; I have this problem in asp.net, I have a page where I insert and modify data, before saving I make a validation if it passes I save the data but if not I raise an exception and show it, the function goes like this;\nprotected void btnSave_Click(object sender, EventArg... |
I want the equivalent online resource to DNS in Twenty-One Days. I need one evening's reading that will explain what the different record types do, how do propagation and caching work, what is an SoA, etc.
I don't want anything that begins by explaining what DNS is.
Can anybody please point me in the right direction t... | For a comprehensive yet concise resource on DNS that covers various record types, propagation, caching, and the Start of Authority (SoA) without diving into basic definitions, here are some recommended online resources you can explore:
1. **DigitalOcean Community Tutorials**:
- **"Understanding DNS: Records, Types,... | 43,388 | [
{
"from": "human",
"value": "I want the equivalent online resource to DNS in Twenty-One Days. I need one evening's reading that will explain what the different record types do, how do propagation and caching work, what is an SoA, etc.\nI don't want anything that begins by explaining what DNS is.\nCan anybo... |
In a C# program, I have an abstract base class with a static "Create" method. The Create method is used to create an instance of the class and store it locally for later use. Since the base class is abstract, implementation objects will always derive from it.
I want to be able to derive an object from the base class,... | In C#, while an abstract class cannot be instantiated directly, you can indeed create static methods in the abstract class that can create instances of derived classes. However, your idea of passing an instance of the derived class to the static method is not typically how you'd want to achieve this. Instead, you can u... | 48,625 | [
{
"from": "human",
"value": "In a C# program, I have an abstract base class with a static \"Create\" method. The Create method is used to create an instance of the class and store it locally for later use. Since the base class is abstract, implementation objects will always derive from it.\nI want to be a... |
This may seem like a stupid question, so here goes:
Other than parsing the string of FileInfo.FullPath for the drive letter to then use DriveInfo("c") etc to see if there is enough space to write this file. Is there a way to get the drive letter from FileInfo?
| It's not a stupid question at all! In fact, it's a common scenario when working with file paths in C#. Fortunately, there is a more straightforward way to get the drive letter from a `FileInfo` object without having to parse the string yourself.
You can use the `DriveInfo` class to get information about the drive that... | 49,094 | [
{
"from": "human",
"value": "This may seem like a stupid question, so here goes:\nOther than parsing the string of FileInfo.FullPath for the drive letter to then use DriveInfo(\"c\") etc to see if there is enough space to write this file. Is there a way to get the drive letter from FileInfo?\n"
},
{
... |
In a sorted table, it's common to have an up or a down arrow indicating the sort style. However, I'm having some trouble determining which direction the arrow should point. In an ASC sort, characters are sorted 1-9A-Za-z. Should the arrow point up or down?
I've found implementations of both on the web, so that didn't h... | The choice of using up or down arrows to indicate sorting direction in a table is indeed a matter of design preference, and as you’ve noted, both approaches have their advocates. However, here are some points to consider that might help clarify the decision:
### Common Conventions
1. **Up Arrow for Ascending Sort (AS... | 48,971 | [
{
"from": "human",
"value": "In a sorted table, it's common to have an up or a down arrow indicating the sort style. However, I'm having some trouble determining which direction the arrow should point. In an ASC sort, characters are sorted 1-9A-Za-z. Should the arrow point up or down?\nI've found implementa... |
I have a page which has a rectangular area with text and icons in it and the whole thing is clickable. The anchor tag is set to display: block. One of the icons has an onclick handler. If a person clicks on an icon, I just want the icon's onclick handler to run and not to actually activate the containing anchor tag.... | To prevent the enclosing anchor tag from being activated when clicking on a specific icon while still allowing the anchor to be clickable when clicking elsewhere, you can use `event.preventDefault()` in your icon's click handler. This method stops the default action of the event from occurring, which in this case is na... | 49,815 | [
{
"from": "human",
"value": "I have a page which has a rectangular area with text and icons in it and the whole thing is clickable. The anchor tag is set to display: block. One of the icons has an onclick handler. If a person clicks on an icon, I just want the icon's onclick handler to run and not to act... |
Ok so we have an upcoming development that will involve a level of off line processing of dynamic forms. Here's what we have to do:
Create a asp.net web application whereby users can download dynamic forms, fill them in then upload them to be published.
We also have a windows mobile application that will do something... | InfoPath is a Microsoft tool that allows users to design and fill out electronic forms. It's a powerful solution for creating dynamic forms, especially when tied into SharePoint. However, it's worth noting that InfoPath is designed primarily to work with SharePoint and is not really intended for standalone applications... | 48,567 | [
{
"from": "human",
"value": "Ok so we have an upcoming development that will involve a level of off line processing of dynamic forms. Here's what we have to do:\n\nCreate a asp.net web application whereby users can download dynamic forms, fill them in then upload them to be published. \nWe also have a windo... |
I have an app that is a combination of asp/asp.net, and both sides depend on the same cookies (they are in the same domain). There are some values in the cookies that I don't want going to the client anymore due to security concerns. What I was hoping to accomplish is to take out these values so they no longer go to ... | It sounds like you want to restrict sensitive data from being sent in cookies to the client while still maintaining the application’s functionality. While it is possible to manipulate cookies on the server side, there are some important considerations and alternative approaches that you might want to consider before pr... | 46,015 | [
{
"from": "human",
"value": "I have an app that is a combination of asp/asp.net, and both sides depend on the same cookies (they are in the same domain). There are some values in the cookies that I don't want going to the client anymore due to security concerns. What I was hoping to accomplish is to take ... |
I'm trying to write a greasemonkey script, and it would be preferable for it to be able to work with images (specifically, find the darkest pixel in an image). Is there a way to do this or must I embed flash?
| You can indeed accomplish this with a Greasemonkey script without needing to embed Flash. Instead, you can use the HTML5 `<canvas>` element to manipulate and analyze images directly in the browser. This approach allows you to retrieve pixel data from an image and find the darkest pixel.
Here’s a general outline of how... | 46,529 | [
{
"from": "human",
"value": "I'm trying to write a greasemonkey script, and it would be preferable for it to be able to work with images (specifically, find the darkest pixel in an image). Is there a way to do this or must I embed flash?\n"
},
{
"from": "gpt",
"value": "You can indeed accomplish... |
If I'd like to control the IP phone from my web application, how should I begin?
Let's say I have a standalone IP phone connected to the provider of IP telephony services. On the other side I have a server-side web application for the sales support. I'd like to initiate a call on my phone from this web application, on ... | To control an IP phone from your web application and achieve functionalities like initiating calls and displaying customer data on incoming calls, you'll typically work with APIs and protocols rather than traditional CTI standards like JTAPI or TAPI. Here’s how to get started:
### 1. **Choose Your Telephony Provider a... | 48,443 | [
{
"from": "human",
"value": "If I'd like to control the IP phone from my web application, how should I begin?\nLet's say I have a standalone IP phone connected to the provider of IP telephony services. On the other side I have a server-side web application for the sales support. I'd like to initiate a call ... |
app.config configuration sections are nice, but I often need multiple configuration sets, but with small difference.
what I want is:
Have one section with default configuration (this one is created with the designer, and thus has the auto-generated strongly-typed accessors in the Settings class
Another section with o... | To achieve your desired configuration setup with a default configuration section and an additional configuration section that overrides only specific values while inheriting others, you can follow these steps in a .NET application (be it a console app or a Windows service).
### Step 1: Define Your Default Configurati... | 44,826 | [
{
"from": "human",
"value": "app.config configuration sections are nice, but I often need multiple configuration sets, but with small difference. \nwhat I want is:\n\nHave one section with default configuration (this one is created with the designer, and thus has the auto-generated strongly-typed accessors ... |
My program will take arbitrary strings from the internet and use them for file names. Is there a simple way to remove the bad characters from these strings or do I need to write a custom function for this?
| To create safe file names from arbitrary strings, you can either write a custom function or use a more straightforward approach, such as using regular expressions or built-in string methods. Here's a simple way to clean up the strings in Python:
### Using Regular Expressions
You can use the `re` module to remove or r... | 49,210 | [
{
"from": "human",
"value": "My program will take arbitrary strings from the internet and use them for file names. Is there a simple way to remove the bad characters from these strings or do I need to write a custom function for this?\n"
},
{
"from": "gpt",
"value": "To create safe file names fr... |
Why does everyone tell me writing code like this is a bad practice?
if (foo)
Bar();
//or
for(int i = 0 i < count; i++)
Bar(i);
My biggest argument for omitting the curly braces is that it can sometimes be twice as many lines with them. For example, here is some code to paint a glow effect for a label in C#.
... | Your question raises several important points about coding style and best practices. Let's break down the concerns and arguments regarding the use of curly braces and compact syntax.
### Arguments For Using Curly Braces:
1. **Maintainability**:
- One of the strongest arguments for always using curly braces is main... | 44,322 | [
{
"from": "human",
"value": "Why does everyone tell me writing code like this is a bad practice?\nif (foo)\n Bar();\n\n//or\n\nfor(int i = 0 i < count; i++)\n Bar(i);\n\nMy biggest argument for omitting the curly braces is that it can sometimes be twice as many lines with them. For example, here is so... |
I have a web page with a flex component, the flex component is responsible for creating an image from user inputs.
Once an image is ready the user enter some more information in the HTML form and click on the send form button.
When this button is clicked, javascript calls a function on the flex components which returns... | Hi Greg,
Your approach to sending form data and an image (in base64 format) to your Django backend using AJAX is certainly a valid solution. However, there are some considerations and potential improvements you might want to take into account:
### 1. Base64 vs. File Uploads
- **Base64 Encoding:** While sending the im... | 44,713 | [
{
"from": "human",
"value": "I have a web page with a flex component, the flex component is responsible for creating an image from user inputs.\nOnce an image is ready the user enter some more information in the HTML form and click on the send form button.\nWhen this button is clicked, javascript calls a fu... |
I have the following project solution:
There is a ASP.NET MVC Web
Application where I have a SQL
database (mdf file) in the App_Data directory.
There is a class library where I
have some migrations from
migratordotnet. In my build file I
have to specify where the SQL
database is so it can run the
migrations.
For the ... | To handle your scenario of dynamically setting the path for your SQL database in the migrations while avoiding hardcoding paths, you can use a couple of methods to retrieve the `App_Data` directory path at runtime and then build your connection string accordingly.
Here are two approaches you can take:
### 1. Use Env... | 47,132 | [
{
"from": "human",
"value": "I have the following project solution:\n\nThere is a ASP.NET MVC Web\nApplication where I have a SQL\ndatabase (mdf file) in the App_Data directory.\nThere is a class library where I\nhave some migrations from\nmigratordotnet. In my build file I\nhave to specify where the SQL\nd... |
What I would like to do is use the elegance of LINQ while maintaining an iterator....
essentially
Class A
{
int Position;
string Name;
}
if I have a list of strings, i want to project them into List<A> but have the Position be populated in the projection...
List<string> names; //filled with strings
something lik... | Yes, you can achieve this using LINQ along with the `Select` method and `Select`'s overload that takes an index. This allows you to project your list of strings into a list of `A` objects while also populating the `Position` based on the index of the string in the original list.
Here’s how you can do it:
```csharp
us... | 46,337 | [
{
"from": "human",
"value": "What I would like to do is use the elegance of LINQ while maintaining an iterator....\nessentially \nClass A\n{\n int Position;\n string Name;\n}\n\nif I have a list of strings, i want to project them into List<A> but have the Position be populated in the projection...\nList<s... |
Everytime i retrieve data from a mysql stored procedure with a concat function an error will occur after binding the datagridview to the datatable that holds the returned rows.
| When you encounter issues retrieving data from a MySQL stored procedure that uses the `CONCAT` function and subsequently binding the result to a DataGridView, there could be several potential causes and solutions. Here are some common troubleshooting steps you can take:
1. **Check the Stored Procedure**: Ensure that t... | 46,250 | [
{
"from": "human",
"value": "Everytime i retrieve data from a mysql stored procedure with a concat function an error will occur after binding the datagridview to the datatable that holds the returned rows.\n"
},
{
"from": "gpt",
"value": "When you encounter issues retrieving data from a MySQL st... |
I have an application with a view containing several subviews. The subviews did not implement any touchesbegins logic. The Superview implemented all touchesbegins logic and manipulated each subview respectively if it was touched (determined by hit testing).
I have since been converting my subviews to layers. My pr... | In iOS development, layers (instances of `CALayer`) do not handle touch events directly. Touch events are handled at the UIView level, which is what you have observed. When you convert your subviews to layers and do not use views to represent those layers, you lose the ability to receive touch events on those layers si... | 48,348 | [
{
"from": "human",
"value": "I have an application with a view containing several subviews. The subviews did not implement any touchesbegins logic. The Superview implemented all touchesbegins logic and manipulated each subview respectively if it was touched (determined by hit testing). \nI have since bee... |
How can I convert a RGB Color to HSV using C#?
I've searched for a fast method without using any external library.
| You can convert RGB colors to HSV (Hue, Saturation, Value) using a straightforward method without needing any external libraries in C#. Below is a simple implementation of the RGB to HSV conversion algorithm:
```csharp
using System;
public class ColorConverter
{
public static void RgbToHsv(int r, int g, int b, ou... | 44,242 | [
{
"from": "human",
"value": "How can I convert a RGB Color to HSV using C#?\nI've searched for a fast method without using any external library.\n"
},
{
"from": "gpt",
"value": "You can convert RGB colors to HSV (Hue, Saturation, Value) using a straightforward method without needing any external... |
Does anyone know the powershell commands to restore a remote database from a local file?
| To restore a remote SQL Server database from a local file using PowerShell, you can utilize the `Invoke-Sqlcmd` cmdlet along with SQL commands. Here's how you can do it:
1. **Ensure you have the SQL Server Management Module installed.** If you haven't already, you can install the module using PowerShell:
```powers... | 47,817 | [
{
"from": "human",
"value": "Does anyone know the powershell commands to restore a remote database from a local file?\n"
},
{
"from": "gpt",
"value": "To restore a remote SQL Server database from a local file using PowerShell, you can utilize the `Invoke-Sqlcmd` cmdlet along with SQL commands. H... |
Is there anything better than a Trie for this situation?
Storing a list of ~100k English words
Needs to use minimal memory
Lookups need to be reasonable, but don't have to be lightning fast
I'm working with Java, so my first attempt was to just use a Set<String>. However, I'm targeting a mobile device and already run... | Given your requirements for storing a list of approximately 100,000 English words, needing minimal memory, and allowing reasonable lookup times, a Trie is a good option, but there are alternative data structures that may better fit your needs, especially with a focus on memory efficiency and your specific operations. H... | 49,288 | [
{
"from": "human",
"value": "Is there anything better than a Trie for this situation?\n\nStoring a list of ~100k English words\nNeeds to use minimal memory\nLookups need to be reasonable, but don't have to be lightning fast\n\nI'm working with Java, so my first attempt was to just use a Set<String>. However... |
When given a static set of objects (static in the sense that once loaded it seldom if ever changes) into which repeated concurrent lookups are needed with optimal performance, which is better, a HashMap or an array with a binary search using some custom comparator?
Is the answer a function of object or struct type? Ha... | When considering the best data structure for repeated concurrent lookups in a static set of objects, there are several factors to weigh when deciding between a `HashMap` (or `Dictionary` in C#) and an array with binary search.
### Key Considerations
1. **Lookup Complexity**:
- **HashMap (Dictionary)**: Average-cas... | 44,588 | [
{
"from": "human",
"value": "When given a static set of objects (static in the sense that once loaded it seldom if ever changes) into which repeated concurrent lookups are needed with optimal performance, which is better, a HashMap or an array with a binary search using some custom comparator?\nIs the answe... |
I have this jQuery code that queries an API on a keyup event (via keyterms.php). It works as it is, but I'm trying to figure out how to implement a "pause" so to speak such that it will only do a query after a certain amount of time (say 2sec.) after the last keyup. Any help will be much appreciated. Thanks!
$(docum... | To implement a "pause" or delay before executing the API query in response to a keyup event, you can use the `setTimeout` function to create a delay. You will also want to clear the previous timeout every time a new keyup event occurs. This way, the query will only be executed if there has been no keyup event in the sp... | 49,630 | [
{
"from": "human",
"value": "I have this jQuery code that queries an API on a keyup event (via keyterms.php). It works as it is, but I'm trying to figure out how to implement a \"pause\" so to speak such that it will only do a query after a certain amount of time (say 2sec.) after the last keyup. Any help... |
I need a simple SQL to accomplish the below:
Problem:
When a petrol bunk runs out of fuel, the admin makes note of the DateTime (RunOutDate) when it ran out of fuel and notes also the DateTime (ResupplyDate) when the fuel supply was back on.
I need to create a report on how many days the bunk ran out of fuel.
eg.
1/1/1... | To solve this problem, you can create a SQL query that calculates the number of unique days between the `RunOutDate` and the `ResupplyDate` for each petrol bunk. The approach involves extracting the distinct days from the start and end datetime values.
Here is a sample SQL query that accomplishes this task:
```sql
WI... | 48,296 | [
{
"from": "human",
"value": "I need a simple SQL to accomplish the below:\nProblem:\nWhen a petrol bunk runs out of fuel, the admin makes note of the DateTime (RunOutDate) when it ran out of fuel and notes also the DateTime (ResupplyDate) when the fuel supply was back on.\nI need to create a report on how m... |
Simple question; what's better and why?
out.resize( in.size() );
T1::iterator outit = out.begin();
for( inIt = in.begin() to end, ++inIt, ++outIt )
*outit = *inIt
OR
out.erase();
for( inIt = in.begin() to end, ++inIt )
out.push_back( inIt );
I'm assuming the memory assignment im... | In your original question, you provided two approaches to copying data from one container to another in C++. Let's analyze both options and their implications in the context of your specific `asciihex` function.
### The Two Options
1. **Resizing and Using Iterators**:
```cpp
out.resize(in.size());
T1::ite... | 47,687 | [
{
"from": "human",
"value": "Simple question; what's better and why?\n\n\n out.resize( in.size() );\n T1::iterator outit = out.begin();\n for( inIt = in.begin() to end, ++inIt, ++outIt )\n *outit = *inIt\nOR\n\n out.erase();\n for( inIt = in.begin() to end, ++inIt )\n out.push_ba... |
Ok, one for the SO hive mind...
I have code which has - until today - run just fine on many systems and is deployed at many sites. It involves threads reading and writing data from a serial port.
Trying to check out a new device, my code was swamped with 995 ERROR_OPERATION_ABORTED errors calling GetOverlappedResult ... | The `ERROR_OPERATION_ABORTED` error you're encountering when using `GetOverlappedResult` indicates that an I/O operation was canceled. In your case, since this is happening inconsistently and with a new device, it could potentially stem from several issues.
Here are some points to consider for troubleshooting:
1. **D... | 45,516 | [
{
"from": "human",
"value": "Ok, one for the SO hive mind...\nI have code which has - until today - run just fine on many systems and is deployed at many sites. It involves threads reading and writing data from a serial port. \nTrying to check out a new device, my code was swamped with 995 ERROR_OPERATION_... |
Been using the code below to return a single record from the database. I have read that ExecuteScalar is the right way to return a single record. I have never been able to get ExecuteScalar to work though. How would I change this to return a single value in VB.Net using ExecuteScalar?
Dim oracleConnection As New ... | To convert your existing code to use `ExecuteScalar` for returning a single value from a stored procedure in VB.Net, you'll want to make a few adjustments. First, note that `ExecuteScalar` is used when your stored procedure returns a single value, not a cursor. If your stored procedure is designed to return a cursor, y... | 49,855 | [
{
"from": "human",
"value": "Been using the code below to return a single record from the database. I have read that ExecuteScalar is the right way to return a single record. I have never been able to get ExecuteScalar to work though. How would I change this to return a single value in VB.Net using Execut... |
I've inherited a legacy web application that has no unit tests in it. I'd like to add some, but am at a loss of where to start. Should I add them to old code? Or just new code going forward? What if that code interacts with legacy code? What would you suggest?
| Inheriting a legacy web application without unit tests can be daunting, but it's great that you're considering adding tests. Here's a structured approach to tackle this situation:
### 1. Assess the Legacy Code
Before diving in, take some time to understand the existing codebase:
- **Familiarize Yourself**: Read throug... | 43,212 | [
{
"from": "human",
"value": "I've inherited a legacy web application that has no unit tests in it. I'd like to add some, but am at a loss of where to start. Should I add them to old code? Or just new code going forward? What if that code interacts with legacy code? What would you suggest?\n"
},
{
... |
If you have a C# function with Sqlaccess, is it mandatory to close all objects/handles, or is everything cleaned up automatically once you exit the function
For example:
void DoSqlStuff()
{
SqlConnection sqlConn = new SqlConnection(...);
SqlCommand cmd = new SqlCommand(...);
SqlDataReader sqlData= null;
... | In C#, it is highly recommended to properly manage resources such as database connections and data readers. While the garbage collector in .NET will eventually clean up unreferenced objects, relying on it for resource management can lead to performance issues and resource leaks.
In your example, you should explicitly ... | 49,755 | [
{
"from": "human",
"value": "If you have a C# function with Sqlaccess, is it mandatory to close all objects/handles, or is everything cleaned up automatically once you exit the function\nFor example:\nvoid DoSqlStuff()\n{\n SqlConnection sqlConn = new SqlConnection(...);\n SqlCommand cmd = new SqlComm... |
I noticed for a while now the following syntax in some of our code:
if( NULL == var){
//...
}
or
if( 0 == var){
//...
}
and similar things.
Can someone please explain why did the person who wrote this choose this notation instead of the common var == 0 way)?
Is it a matter of style, or does it somehow affect per... | The syntax you've encountered, where the constant is placed before the variable (e.g., `if (NULL == var)` or `if (0 == var)`), is often referred to as "Yoda conditions." This style is commonly used in some programming communities, and there are a few reasons why a developer might choose this notation:
1. **Prevention ... | 49,695 | [
{
"from": "human",
"value": "I noticed for a while now the following syntax in some of our code:\nif( NULL == var){\n //...\n}\n\nor\nif( 0 == var){\n //...\n}\n\nand similar things.\nCan someone please explain why did the person who wrote this choose this notation instead of the common var == 0 way)?\nI... |
Assuming the file exists (using os.path.exists(filename) to first make sure that it does), how do I display the time a file was last modified? This is on Linux if that makes any difference.
| To display the time a file was last modified in Linux using Python, you can utilize the `os.path` module to check if the file exists and the `os.path.getmtime()` function to retrieve the last modification time of the file. You can then format this timestamp for better readability using the `datetime` module.
Here is a... | 49,274 | [
{
"from": "human",
"value": "Assuming the file exists (using os.path.exists(filename) to first make sure that it does), how do I display the time a file was last modified? This is on Linux if that makes any difference.\n"
},
{
"from": "gpt",
"value": "To display the time a file was last modifie... |
I'm working on a web app (it is in asp.net mvc framework beta in visual studio 2008) and want to version control it. How do I version control the database files (*.mdf, binary) in the App_Data folder.
Is there a way to just store the tables-and-whatever definition of the database or do I really need to version contro... | Version controlling database files like `.mdf` files directly is generally not recommended due to the nature of binary files and the potential for conflicts when multiple developers are working on the same database. Instead, you should focus on version-controlling the schema of the database rather than its contents. He... | 46,324 | [
{
"from": "human",
"value": "I'm working on a web app (it is in asp.net mvc framework beta in visual studio 2008) and want to version control it. How do I version control the database files (*.mdf, binary) in the App_Data folder. \nIs there a way to just store the tables-and-whatever definition of the data... |
Is there a way for a Windows application to access another applications data, more specifically a text input field in the GUI, and grab the text there for processing in our own application?
If it is possible, is there a way to "shield" your application to prevent it?
EDIT: The three first answers seem to be about gett... | Accessing the data of another application’s GUI elements, such as text input fields, can be done using the Windows API. Specifically, you can use functions like `FindWindow`, `FindWindowEx`, and `GetWindowText` to interact with the target application.
Here’s a step-by-step approach to how you can access a specific te... | 47,210 | [
{
"from": "human",
"value": "Is there a way for a Windows application to access another applications data, more specifically a text input field in the GUI, and grab the text there for processing in our own application?\nIf it is possible, is there a way to \"shield\" your application to prevent it?\n\nEDIT:... |
I cloned a Git master and made a lot of changes on the clone. I have since committed these changes on the clone and now want the master to be a carbon copy of what is on the clone.
I've tried Git push on the clone to push the changes to the master - but nothing I do updates the master.
How can I make the master an exac... | To make the master branch in your remote repository a carbon copy of what you have in your local clone, follow these steps:
### Step 1: Verify Your Local Changes
Ensure that you have committed all your changes in your local clone. You can do this by checking the commit log:
```bash
git log
```
Make sure all changes... | 46,113 | [
{
"from": "human",
"value": "I cloned a Git master and made a lot of changes on the clone. I have since committed these changes on the clone and now want the master to be a carbon copy of what is on the clone.\nI've tried Git push on the clone to push the changes to the master - but nothing I do updates the... |
I'm currently trying to implement a marble maze game for a WM 5.0 device and have been struggling with developing a working prototype. The prototype would need the user to control the ball using the directional keys and display realistic acceleration and friction.
I was wondering if anyone has experience with this and... | Creating a marble maze game for a Windows Mobile (WM) 5.0 device can be a fun challenge! Here are some essential tips and guidance that might help you develop a working prototype:
### 1. Setting Up Your Development Environment
- **IDE**: Use Visual Studio 2005 as it was widely used for developing applications for Wind... | 46,023 | [
{
"from": "human",
"value": "I'm currently trying to implement a marble maze game for a WM 5.0 device and have been struggling with developing a working prototype. The prototype would need the user to control the ball using the directional keys and display realistic acceleration and friction. \nI was wonder... |
We have a DLL which is produced in house, and for which we have the associated static LIB of stubs.
We also have an EXE which uses this DLL using the simple method of statically linking to the DLL's LIB file (ie, not manually using LoadLibrary).
When we deploy the EXE we'd like the DLL file name to be changed for obfus... | To achieve your goal of renaming the DLL file for obfuscation while still allowing your EXE to work seamlessly with it, there are a few approaches you can consider. Since renaming the DLL and using a static LIB does not work due to the hardcoded name, you may need to explore one of these alternatives:
### 1. **Change ... | 33,045 | [
{
"from": "human",
"value": "We have a DLL which is produced in house, and for which we have the associated static LIB of stubs.\nWe also have an EXE which uses this DLL using the simple method of statically linking to the DLL's LIB file (ie, not manually using LoadLibrary).\nWhen we deploy the EXE we'd lik... |
The "ATL simple object" wizard doesn't provide a way to specify that a new class is derived from an existing coclass and its interface. In Visual Studio 2008, how do I make a new ATL COM class derived from an existing one (i.e. Base implements IBase, and I want to make a new Derived class derived from Base that impleme... | To derive a new ATL COM class (`CDerived`) from an existing class (`CBase`) that implements an interface (`IBase`), you'll need to consider the inheritance of both the base class's interfaces and its associated COM mapping and connection point information.
Here is how the `CDerived` class should be structured:
### De... | 43,082 | [
{
"from": "human",
"value": "The \"ATL simple object\" wizard doesn't provide a way to specify that a new class is derived from an existing coclass and its interface. In Visual Studio 2008, how do I make a new ATL COM class derived from an existing one (i.e. Base implements IBase, and I want to make a new D... |
I need to grab a value from the HttpCOntext.Items request cache, where should I do this?
Is there a particular event or contsructor I should override?
| In ASP.NET, `HttpContext.Items` is a key-value collection that is used to store data that is specific to a single HTTP request. This means that any data stored in `HttpContext.Items` will only be available during the lifetime of that request. If you need to grab a value from `HttpContext.Items`, you typically do this d... | 46,410 | [
{
"from": "human",
"value": "I need to grab a value from the HttpCOntext.Items request cache, where should I do this?\nIs there a particular event or contsructor I should override?\n"
},
{
"from": "gpt",
"value": "In ASP.NET, `HttpContext.Items` is a key-value collection that is used to store da... |
I am being powerfully tempted to use an unchecked exception as a short-circuit control-flow construct in a Java program. I hope somebody here can advise me on a better, cleaner way to handle this problem.
The idea is that I want to cut short the recursive exploration of sub-trees by a visitor without having to check a ... | Using unchecked exceptions for control flow can often lead to code that is difficult to read, maintain, and debug, as you've already discovered. Exceptions are generally meant for handling error cases, and using them as a regular flow control mechanism can obscure the intent of your code.
Here are some alternative app... | 46,921 | [
{
"from": "human",
"value": "I am being powerfully tempted to use an unchecked exception as a short-circuit control-flow construct in a Java program. I hope somebody here can advise me on a better, cleaner way to handle this problem.\nThe idea is that I want to cut short the recursive exploration of sub-tre... |
I have redirected some valuable information into a text file. How can I execute each line of that text file in a loop?
What im thinking is to double space my text file, then to use a loop to execute each line invidually. I'm hoping that when i double space the text file every string of commands will have their own lin... | To execute each line of commands stored in a text file, you can simplify your approach without needing to double space the lines. Instead, you can read the file line by line using a `while` loop in a Bash script. Here’s how you can do it:
1. **Create Your Command File**: Ensure that your text file (let's call it `comm... | 49,667 | [
{
"from": "human",
"value": "I have redirected some valuable information into a text file. How can I execute each line of that text file in a loop?\nWhat im thinking is to double space my text file, then to use a loop to execute each line invidually. I'm hoping that when i double space the text file every s... |
I'm thinking about how limiting it is for AJAX apps to have to poll for updates, when what would be ideal is for javascript to be able to set up a real two way connection to the server. I'm wondering if there is some method of integrating javascript with a browser plugin that can make a tcp connection so that I could p... | You're correct that traditional AJAX polling can be limiting for certain real-time applications. However, there are modern approaches that enable a more efficient two-way communication between the browser and the server without needing to resort to plugins or TCP connections. Here are some common methods:
1. **WebSock... | 48,362 | [
{
"from": "human",
"value": "I'm thinking about how limiting it is for AJAX apps to have to poll for updates, when what would be ideal is for javascript to be able to set up a real two way connection to the server. I'm wondering if there is some method of integrating javascript with a browser plugin that ca... |
I work at a smallish web agency (3 programmers, 2 project managers), we mostly make sites for marketing campaigns and also some larger sites. Most of our projects are a week, maybe two, in development. The majority of projects are only worked on by a single developer.
Up until now we've been using a spreadsheet in Goo... | It sounds like you've made some great progress with Redmine and are already adapting it to better fit your agency's needs. Given your specific requirements—managing many projects assigned to a few developers with an emphasis on individual workload and project overview—Redmine can indeed be a strong contender.
### Adv... | 47,216 | [
{
"from": "human",
"value": "I work at a smallish web agency (3 programmers, 2 project managers), we mostly make sites for marketing campaigns and also some larger sites. Most of our projects are a week, maybe two, in development. The majority of projects are only worked on by a single developer. \nUp until... |
I am really stuck with this Parser Error Message telling me "Could not load the assembly 'App_Web_amlohswi'. Make sure that it is compiled before accessing the page." I have been looking around for a few hours checking different posts here and googling information. I have found out that I need to set up a new Applica... | The error message you're seeing, "Could not load the assembly 'App_Web_amlohswi'. Make sure that it is compiled before accessing the page," typically indicates that there is a problem with the compilation of your ASP.NET application. This can happen for several reasons, but it's commonly related to the configuration of... | 47,910 | [
{
"from": "human",
"value": "I am really stuck with this Parser Error Message telling me \"Could not load the assembly 'App_Web_amlohswi'. Make sure that it is compiled before accessing the page.\" I have been looking around for a few hours checking different posts here and googling information. I have fo... |
When you're using a factory pattern, how do you inject dependencies into constructors at runtime?
I'm building Foos with different formats - boolean, array, freetext, matrix, etc. That format list will grow as we find different uses for Foo. Here's my basic core domain:
public interface IFoo
{
FooFormat Format { ... | To achieve what you're looking for, you can use a combination of a `Dictionary` to map formats to constructor parameters and a `params` approach in your factory methods. This way, you can keep the public API simple while allowing the consumer to pass in custom values or lists when needed.
Here’s how you can structure ... | 46,485 | [
{
"from": "human",
"value": "When you're using a factory pattern, how do you inject dependencies into constructors at runtime?\nI'm building Foos with different formats - boolean, array, freetext, matrix, etc. That format list will grow as we find different uses for Foo. Here's my basic core domain:\npubl... |
I have a complex iterative spreadsheet in which I want to use a UDF to calculate the heat transfer coefficient of a heat exchanger. The function has 5 arguments (2 strings and 3 doubles). The strings and 1 double pass just fine. The remaining two don't seem to go through at all. A watch on problematic arguments shows t... | It sounds like you are encountering issues with how Excel's UDF (User Defined Function) processes input arguments, particularly with dynamic or volatile cells that may change frequently. Here are several strategies and workarounds that you might consider to address this issue:
1. **Ensure Cell References are Updated**... | 37,852 | [
{
"from": "human",
"value": "I have a complex iterative spreadsheet in which I want to use a UDF to calculate the heat transfer coefficient of a heat exchanger. The function has 5 arguments (2 strings and 3 doubles). The strings and 1 double pass just fine. The remaining two don't seem to go through at all.... |
I am currently developing an application for live video streaming (www.livecliq.net) and I would like to add the feature for image capture and video zoom.
I've been looking around for the tutorials and resources about DirectShow but so far I have found only a book "Programming Microsoft DirectShow for Digital Video and... | To add features like image capture and video zoom to your live video streaming application using DirectShow, you can indeed achieve this with some coding and manipulation of the video stream. Here’s a high-level approach to guide you through the implementation.
### 1. Image Capture
To capture images from a video stre... | 47,212 | [
{
"from": "human",
"value": "I am currently developing an application for live video streaming (www.livecliq.net) and I would like to add the feature for image capture and video zoom.\nI've been looking around for the tutorials and resources about DirectShow but so far I have found only a book \"Programming... |
I have let's say 2 (but they'll become more in the future) fully decoupled systems: system A and system B.
Let's say every piece of information on each system has an informationID. There's nothing stopping the informationID to be the same on different systems. What univocally identifies a piece of information across al... | Your approach of using a message bus with message queues to facilitate communication between decoupled systems A and B is a solid one. However, as you've rightly pointed out, the challenge lies in ensuring that each piece of information can be uniquely identified, especially when it comes to importing/exporting data be... | 46,925 | [
{
"from": "human",
"value": "I have let's say 2 (but they'll become more in the future) fully decoupled systems: system A and system B.\nLet's say every piece of information on each system has an informationID. There's nothing stopping the informationID to be the same on different systems. What univocally i... |
Currently I am saving a UIImage to the photos album using UIImageWriteToSavedPhotosAlbum, which works fine.
Is there a way to then open the Photos app showing the just-saved photo? (I assume my app must close before opening Photos, which is fine.)
Simply opening the Photos app to the Saved Photos Album would be a not-q... | To open the Photos app and show a specific photo after saving it to the photo album, you can use the `PHPhotoLibrary` framework available in iOS. While you can't directly open a specific image using the Photos app from your app, you can open the Photos app to the "Albums" view instead.
To achieve this, you would typi... | 44,749 | [
{
"from": "human",
"value": "Currently I am saving a UIImage to the photos album using UIImageWriteToSavedPhotosAlbum, which works fine.\nIs there a way to then open the Photos app showing the just-saved photo? (I assume my app must close before opening Photos, which is fine.)\nSimply opening the Photos app... |
SaveFileDialog savefileDialog1 = new SaveFileDialog();
DialogResult result = savefileDialog1.ShowDialog();
switch(result == DialogResult.OK)
case true:
//do something
case false:
MessageBox.Show("are you sure?","",MessageBoxButtons.YesNo,MessageBoxIcon.Question);
How to show the messagebox ove... | In your current implementation, you are trying to show a `MessageBox` after the `SaveFileDialog` is canceled. However, the code you provided has a syntax issue and won't compile as is. To achieve your requirement of displaying the `MessageBox` while keeping the `SaveFileDialog` in the background, you can use the `Show(... | 48,751 | [
{
"from": "human",
"value": "SaveFileDialog savefileDialog1 = new SaveFileDialog();\nDialogResult result = savefileDialog1.ShowDialog();\nswitch(result == DialogResult.OK)\n case true:\n //do something\n case false:\n MessageBox.Show(\"are you sure?\",\"\",MessageBoxButtons.YesNo,Messag... |
We've got an application we'd like our users to download. Currently they click a link and download the EXE. What we'd like to do is have a launchpad/downloader application that would be small and fast to download, which would then download and install the main application.
In a perfect world the downloader would be a... | Creating a downloader application (often referred to as a bootstrapper) to facilitate the downloading and installation of a larger application is a common approach. Here are some steps and pointers to help you get started with developing a downloader application using MSI:
### Step 1: Choose a Bootstrapper Technology
... | 37,481 | [
{
"from": "human",
"value": "We've got an application we'd like our users to download. Currently they click a link and download the EXE. What we'd like to do is have a launchpad/downloader application that would be small and fast to download, which would then download and install the main application.\nIn... |
C#: How do you save a list of items like a Combobox to the .NET Settings file?
| In C#, you can save a list of items, such as those from a ComboBox, to the .NET Settings file using the `Properties.Settings` class. The settings can be of various types, but since you want to store a list, you'll typically use a `StringCollection` for a simple list of strings.
Here's a step-by-step guide on how to sa... | 47,794 | [
{
"from": "human",
"value": "C#: How do you save a list of items like a Combobox to the .NET Settings file?\n"
},
{
"from": "gpt",
"value": "In C#, you can save a list of items, such as those from a ComboBox, to the .NET Settings file using the `Properties.Settings` class. The settings can be of... |
I'm not brand new to the concept of unit testing but at the same time I've not yet mastered them either.
The one question that has been going through my head recently as I've been writing unit tests while writing my code using the TDD methodology is: to what level should I be testing?
Sometimes I wonder if I'm being ex... | You're asking some great questions that many developers grapple with while adopting TDD (Test-Driven Development) and trying to strike the right balance with unit testing. Here’s a framework to help guide you on what to test, how much to test, and where to draw the line:
### 1. **Testing Behavior vs. Implementation**
... | 43,993 | [
{
"from": "human",
"value": "I'm not brand new to the concept of unit testing but at the same time I've not yet mastered them either.\nThe one question that has been going through my head recently as I've been writing unit tests while writing my code using the TDD methodology is: to what level should I be t... |
I want to execute something in a linux shell under a few different conditions, and be able to output the execution time of each execution.
I know I could write a perl or python script that would do this, but is there a way I can do it in the shell? (which happens to be bash)
| Yes, you can definitely accomplish this using a bash script. You can use the `time` command to measure the execution time of the commands you want to run. Here's a basic example of how you can structure your script to execute commands under different conditions and record their execution time:
```bash
#!/bin/bash
# F... | 48,062 | [
{
"from": "human",
"value": "I want to execute something in a linux shell under a few different conditions, and be able to output the execution time of each execution.\nI know I could write a perl or python script that would do this, but is there a way I can do it in the shell? (which happens to be bash)\n"... |
I've created a generic lookless control with virtual property:
public abstract class TestControlBase<TValue> : Control
{
public static readonly DependencyProperty ValueProperty;
static TestControlBase()
{
ValueProperty = DependencyProperty.Register("Value", typeof(TValue),
... | The issue you're encountering with the WPF Designer and generics appears to stem from the fact that the designer struggles with certain scenarios involving generics, particularly when it comes to reflection and property resolution.
### Explanation of the Issue
1. **Generics and Reflection**: When you use generics in ... | 48,755 | [
{
"from": "human",
"value": "I've created a generic lookless control with virtual property:\npublic abstract class TestControlBase<TValue> : Control\n{\n public static readonly DependencyProperty ValueProperty;\n\n static TestControlBase()\n {\n ValueProperty = DependencyProperty.Register(\"... |
This question is coded in pseudo-PHP, but I really don't mind what language I get answers in (except for Ruby :-P), as this is purely hypothetical. In fact, PHP is quite possibly the worst language to be doing this type of logic in. Unfortunately, I have never done this before, so I can't provide a real-world example. ... | Your question addresses an important consideration in programming: the management of collections of objects when you need to frequently add and remove items, especially when dealing with parallel tasks like downloads. The issue of holes in your arrays when removing items is a common one.
Here are a few strategies you... | 44,011 | [
{
"from": "human",
"value": "This question is coded in pseudo-PHP, but I really don't mind what language I get answers in (except for Ruby :-P), as this is purely hypothetical. In fact, PHP is quite possibly the worst language to be doing this type of logic in. Unfortunately, I have never done this before, ... |
I have had a few problems with log files growing too big on my SQL Servers (2000). Microsoft doesn't recommend using auto shrink for log files, but since it is a feature it must be useful in some scenarios. Does anyone know when is proper to use the auto shrink property?
| Using the "Auto Shrink" feature in SQL Server, including older versions like SQL Server 2000, is generally not recommended for most production environments for several reasons, primarily due to performance implications. However, there are some scenarios where it might be considered appropriate, although these are quite... | 48,802 | [
{
"from": "human",
"value": "I have had a few problems with log files growing too big on my SQL Servers (2000). Microsoft doesn't recommend using auto shrink for log files, but since it is a feature it must be useful in some scenarios. Does anyone know when is proper to use the auto shrink property?\n"
... |
I have to maintain a server-side script written in JScript (NOT Javascript) that needs to discover the OS of the system that it's running on. How can I do this correctly and robustly?
| To determine the operating system in a server-side JScript environment, you typically utilize the Windows Script Host (WSH) environment or the ASP (Active Server Pages) environment if it's running on a web server. Here's how you can robustly retrieve the operating system information using JScript.
### Using Windows Sc... | 44,529 | [
{
"from": "human",
"value": "I have to maintain a server-side script written in JScript (NOT Javascript) that needs to discover the OS of the system that it's running on. How can I do this correctly and robustly?\n"
},
{
"from": "gpt",
"value": "To determine the operating system in a server-side... |
I'm using reCaptcha in my asp.net 2.0 web application.
I'm using onClientClick="return validateForm()" on my submit button.
validateForm does basic checking and stops the form from getting to the server if not needed...
For some reason, once the user passes the client side validation he always gets Page.IsValid="false"... | When you're using `onClientClick` in your ASP.NET web application, it's important to ensure that the return value of the JavaScript function directly influences the server-side validation process. In your case, it sounds like the `validateForm()` function might be returning `false` even when the client-side validation ... | 45,853 | [
{
"from": "human",
"value": "I'm using reCaptcha in my asp.net 2.0 web application.\nI'm using onClientClick=\"return validateForm()\" on my submit button.\nvalidateForm does basic checking and stops the form from getting to the server if not needed...\nFor some reason, once the user passes the client side ... |
I'm running a bunch of apps on discountasp.net with the subdomain addon. Since with shared hosting I can't have multiple IIS sites, I've also written an HTTP module that allows sites in subfolders to operate as if they are running in the root directory. So for example, instead of hosting my blog at dandoes.net/blog, I ... | To address the issue of generating URLs correctly in your ASP.NET MVC application hosted in a subfolder but accessed through a subdomain, you can customize the way the `HtmlHelper` generates URLs. Since you're dealing with a shared hosting environment where you can't have multiple IIS sites, your approach with the HTTP... | 45,731 | [
{
"from": "human",
"value": "I'm running a bunch of apps on discountasp.net with the subdomain addon. Since with shared hosting I can't have multiple IIS sites, I've also written an HTTP module that allows sites in subfolders to operate as if they are running in the root directory. So for example, instead o... |
What does generator comprehension do? How does it work? I couldn't find a tutorial about it.
| Generator comprehension is a concise way to create a generator in Python. It uses a syntax similar to list comprehensions but returns a generator object instead of a list. This means that the values are generated on-the-fly and only one at a time, which can be more memory efficient, especially when working with large d... | 45,104 | [
{
"from": "human",
"value": "What does generator comprehension do? How does it work? I couldn't find a tutorial about it.\n"
},
{
"from": "gpt",
"value": "Generator comprehension is a concise way to create a generator in Python. It uses a syntax similar to list comprehensions but returns a gener... |
My requirement
A table needs to maintain a status column.
This column represents one of 5 states.
initial design
I figured I can just make it an integer column and represent the states using a numeric value.
0 = start
1 = running
2 = crashed
3 = paused
4 = stopped
Since I don't want my app to maintain the mapping fr... | Using the `ENUM` type in MySQL can simplify the management of status values, but there are a few considerations and potential pitfalls to be aware of:
1. **Database Portability**: One of the primary downsides of using `ENUM` is that it creates a dependency on MySQL. If you ever need to migrate to another database syst... | 49,678 | [
{
"from": "human",
"value": "My requirement\nA table needs to maintain a status column.\nThis column represents one of 5 states.\n\ninitial design\nI figured I can just make it an integer column and represent the states using a numeric value.\n\n0 = start\n1 = running\n2 = crashed\n3 = paused\n4 = stopped\n... |
How can instantiated classes access the Document class?
Even after I name the Document class using the Properties bar in Flash, attempting to access it from other classes usually fails, saying "attempting to access an undefined property...
One solution is always casting the Document class to itself! eg.
Main(Main).glob... | When working with ActionScript in Flash, accessing properties or methods from the Document class (often named "Main" or "DocumentClass") in other instantiated classes requires you to have a proper reference to the instance of that Document class.
The issue you're facing, where you receive an "undefined property" erro... | 49,060 | [
{
"from": "human",
"value": "How can instantiated classes access the Document class?\nEven after I name the Document class using the Properties bar in Flash, attempting to access it from other classes usually fails, saying \"attempting to access an undefined property...\nOne solution is always casting the D... |
I have Windows Server 2008 installed on a Sony laptop and the brightness control doesn't work. I'd like to write a program to allow me to change it.
Currently what I have to do is open the Power control panel, click advanced settings, and fight through so many UAC boxes that anybody watching me must think I'm completel... | To control the brightness on a Windows machine programmatically, especially on a Windows Server environment, you can use the Windows Management Instrumentation (WMI) API. Windows Server 2008 has certain limitations regarding brightness control, especially when compared to regular client versions of Windows, but there a... | 46,675 | [
{
"from": "human",
"value": "I have Windows Server 2008 installed on a Sony laptop and the brightness control doesn't work. I'd like to write a program to allow me to change it.\nCurrently what I have to do is open the Power control panel, click advanced settings, and fight through so many UAC boxes that an... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.