instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
I recently had to work on a project where the previous developer modified the wp-admin directory. It seems like a bad idea to me, since Wordpress is constantly updated. Am I just not at that level of expertise with modifying Wordpress?
You're correct to be cautious about modifying the `wp-admin` directory in WordPress. This directory contains core files that are integral to the WordPress administration interface, and making direct modifications can lead to several issues: 1. **Updates**: WordPress frequently releases updates that can overwrite any m...
20,011
[ { "from": "human", "value": "I recently had to work on a project where the previous developer modified the wp-admin directory. It seems like a bad idea to me, since Wordpress is constantly updated. Am I just not at that level of expertise with modifying Wordpress?\n" }, { "from": "gpt", "value":...
I got a simple page with a HtmlInputHidden field. I use a javascript to update that value and when posting back the page i want to read the value of that HtmlInputHidden field. The Value property of that HtmlInputHidden field is on postback the default value (the value it had when the page got created, not the value re...
In ASP.NET Web Forms, when you manipulate the value of a hidden field using JavaScript, the updated value will not be reflected on the server side unless you ensure that the updated value is sent back to the server on postback. Here are a few methods to solve this issue: ### 1. Ensure the Hidden Field is in the Form ...
16,621
[ { "from": "human", "value": "I got a simple page with a HtmlInputHidden field. I use a javascript to update that value and when posting back the page i want to read the value of that HtmlInputHidden field.\nThe Value property of that HtmlInputHidden field is on postback the default value (the value it had w...
I have a database in ISO-8859-2 format, but I need to create XML in UTF-8. This means that I must encode the database before printing in UTF-8. I know very little about ASP.Net. In PHP I would do something like this: db_connect(); mysql_query("SET NAMES 'UTF8'"); mysql_query("SET character_set_client='UTF8'"); This i...
To encode data from an ISO-8859-2 encoded database to UTF-8 in ASP.NET, you will need to handle the conversion explicitly in your application. In .NET, the `System.Text.Encoding` class provides methods for converting between different character encodings. Here’s how you can modify your existing code to ensure that the...
18,628
[ { "from": "human", "value": "I have a database in ISO-8859-2 format, but I need to create XML in UTF-8. This means that I must encode the database before printing in UTF-8. I know very little about ASP.Net.\nIn PHP I would do something like this:\ndb_connect();\nmysql_query(\"SET NAMES 'UTF8'\");\nmysql_qu...
I am after documentation on using wildcard or regular expressions (not sure on the exact terminology) with a jQuery selector. I have looked for this myself but have been unable to find information on the syntax and how to use it. Does anyone know where the documentation for the syntax is? EDIT: The attribute filters al...
In jQuery, you can use attribute selectors to select elements based on the presence and value of their attributes. While jQuery does not directly support wildcard or regular expressions in the same way you might use them in languages like Python or JavaScript's `RegExp`, it does provide some attribute selectors that ca...
17,414
[ { "from": "human", "value": "I am after documentation on using wildcard or regular expressions (not sure on the exact terminology) with a jQuery selector.\nI have looked for this myself but have been unable to find information on the syntax and how to use it. Does anyone know where the documentation for the...
I'm dealing with a MySQL table that defines the JobName column as UNIQUE. If somebody tries to save a new Job to the database using a JobName that is already in the database, MySQL throws a warning. I would like to be able to detect this warning, just like an error, in my PHP script and deal with it appropriately. Id...
In MySQL, when you attempt to insert a row into a table with a unique constraint on a column and the value already exists, MySQL doesn't throw an error; instead, it generates a warning. This can make handling the situation in PHP a bit tricky, as PHP's error handling mechanisms are typically more geared towards catchin...
14,559
[ { "from": "human", "value": "I'm dealing with a MySQL table that defines the JobName column as UNIQUE. If somebody tries to save a new Job to the database using a JobName that is already in the database, MySQL throws a warning.\nI would like to be able to detect this warning, just like an error, in my PHP ...
I'm writing a website that will sell items from one of my classes. It will be linked to a SQL Server db where I will pull pricing, item name, quantity and description. If I wanted to display the items from the database in a thinkgeek fashion, what would be the best control to use so I can custimize the display to actua...
When designing a website to display items from a SQL Server database in a visually appealing way (similar to ThinkGeek), you have several options to consider for the front-end control. Here are a few approaches that can help you customize the display effectively: ### 1. **Using a Grid or Card Layout**: A card layout i...
16,845
[ { "from": "human", "value": "I'm writing a website that will sell items from one of my classes. It will be linked to a SQL Server db where I will pull pricing, item name, quantity and description. If I wanted to display the items from the database in a thinkgeek fashion, what would be the best control to us...
I'm looking for a good way to visualize ASP.NET session state data stored in SQL server, preferably without creating a throwaway .aspx page. Is there a good way to get a list of the keys (and serialized data, if possible) directly from SQL server? Ideally, I'd like to run some T-SQL commands directly against the databa...
Certainly! When you use SQL Server to store ASP.NET session state, the session data is stored in a specific table, typically named `ASPStateTempSessions` if you're using the default configuration. To retrieve session state data, you can use T-SQL queries directly against this table. Here's how you can achieve that: ...
19,113
[ { "from": "human", "value": "I'm looking for a good way to visualize ASP.NET session state data stored in SQL server, preferably without creating a throwaway .aspx page. Is there a good way to get a list of the keys (and serialized data, if possible) directly from SQL server?\nIdeally, I'd like to run some ...
I'm writing a program to read from a POP3 mailbox and upload the email message into my ticketing system. I would like to then take the attachments and upload them as well. I've got all the information I need except the file size. Is there a way to determine the file size from the mail message? I am taking the attach...
To determine the file size of email attachments in a POP3 mailbox using C#, you can access the `Content-Disposition` header of the attachment, which often includes the size of the file. However, if you're decoding the base64 string to a byte array, you can also determine the size directly after the decoding process. H...
17,451
[ { "from": "human", "value": "I'm writing a program to read from a POP3 mailbox and upload the email message into my ticketing system. I would like to then take the attachments and upload them as well. I've got all the information I need except the file size.\nIs there a way to determine the file size from...
What is .net dynamic data and why would I use it?
.NET Dynamic Data is a framework in the .NET ecosystem that simplifies the development of data-driven web applications. It leverages the dynamic capabilities of the .NET platform to allow developers to create web applications that automatically generate data-driven user interfaces based on the underlying data model. #...
19,286
[ { "from": "human", "value": "What is .net dynamic data and why would I use it?\n" }, { "from": "gpt", "value": ".NET Dynamic Data is a framework in the .NET ecosystem that simplifies the development of data-driven web applications. It leverages the dynamic capabilities of the .NET platform to al...
How do I convert a hex string to an integer? "0xffff" ⟶ 65535 "ffff" ⟶ 65535
You can convert a hexadecimal string to an integer in Python using the built-in `int()` function. The function allows you to specify the base of the number you are converting. For hexadecimal, you would use base 16. Here's how you can do it for both cases you provided: ```python # Example hex strings hex_string1 = "0x...
21,416
[ { "from": "human", "value": "How do I convert a hex string to an integer?\n\"0xffff\" ⟶ 65535\n\"ffff\" ⟶ 65535\n\n" }, { "from": "gpt", "value": "You can convert a hexadecimal string to an integer in Python using the built-in `int()` function. The function allows you to specify the ba...
I work in a Microsoft environment, so I can use my C# hammer on any nails I come across. That being said, what languages (compiled, interpreted, scripting, functional, any types!) complement knowing C#, and for what purposes? For example, I've moved a lot of script functionality away from compiled console apps and into...
As a C# developer in a Microsoft-centric environment, you have a rich set of languages and tools at your disposal that can complement your primary skills. Here are some languages and the niches they fill, along with their potential use cases: ### 1. **F# (Functional Programming)** - **Use Case**: Data analysis, financ...
14,141
[ { "from": "human", "value": "I work in a Microsoft environment, so I can use my C# hammer on any nails I come across. That being said, what languages (compiled, interpreted, scripting, functional, any types!) complement knowing C#, and for what purposes? For example, I've moved a lot of script functionality...
In C++/CLI , you can use native types in a managed class by it is not allowed to hold a member of a native class in a managed class : you need to use pointers in that case. Here is an example : class NativeClass { .... }; public ref class ManagedClass { private: NativeClass mNativeClass; // Not allowed ! NativeC...
In C++/CLI, the language interoperability with managed and native types leads to certain restrictions, especially when dealing with resource management for native types. Since managed types (e.g., `ref class`) cannot directly contain native types (e.g., `NativeClass`), you can use pointers to native types. While you c...
18,881
[ { "from": "human", "value": "In C++/CLI , you can use native types in a managed class by it is not allowed to hold a member of a native class in a managed class : you need to use pointers in that case.\nHere is an example :\nclass NativeClass\n{\n....\n};\n\n\npublic ref class ManagedClass\n{\nprivate:\n N...
Is there a way to execute a full ASPX source file where the page source is from a string/database/resource and not a file on the file system? It's straightfoward to render dynamic content/images/etc using HTTP Handlers and Modules and writing to the Response, but there doesn't seem to be a way to execute/compile ASPX ...
Executing ASPX pages from a string in ASP.NET is not directly supported out of the box, primarily because ASP.NET web forms are designed around a file system approach where pages are stored as physical files. However, there are some approaches you can take to achieve similar functionality, although they are not trivial...
20,153
[ { "from": "human", "value": "Is there a way to execute a full ASPX source file where the page source is from a string/database/resource and not a file on the file system? It's straightfoward to render dynamic content/images/etc using HTTP Handlers and Modules and writing to the Response, but there doesn't ...
ZeroC's ICE (www.zeroc.com) looks interesting and I am interested in looking at it and comparing it to our existing software that uses WCF. In particular, our WCF app uses server callbacks (via HTTP). Anybody who's compared them? How did it go? I'm particularly interested in the performance aspect, since interoperabili...
ZeroC's ICE (Internet Communication Engine) and Microsoft's Windows Communication Foundation (WCF) both serve similar purposes in enabling communication between distributed applications, but they have different architectures and performance characteristics. ### Key Comparisons 1. **Communication Model**: - **WCF**...
15,177
[ { "from": "human", "value": "ZeroC's ICE (www.zeroc.com) looks interesting and I am interested in looking at it and comparing it to our existing software that uses WCF. In particular, our WCF app uses server callbacks (via HTTP).\nAnybody who's compared them? How did it go? I'm particularly interested in th...
I'm designing a user interface for a large touchscreen device running Linux. What would be the best toolkit/developer kit/SDK to use? The only requirement is that its able to run on a semi-low performace device, and that there is a Linux version. Nice-to-haves would be build in support for effects/animations and a mo...
For designing a user interface for a large touchscreen device running Linux, you have several options for toolkits and frameworks that cater to low-performance devices while providing a modern look-and-feel, including support for effects and animations. Here are some popular choices: ### 1. **Qt** - **Overview**: Qt i...
19,599
[ { "from": "human", "value": "I'm designing a user interface for a large touchscreen device running Linux. What would be the best toolkit/developer kit/SDK to use? The only requirement is that its able to run on a semi-low performace device, and that there is a Linux version.\nNice-to-haves would be build ...
How do you detect the number of physical processors/cores in .net?
In .NET, you can detect the number of physical processors and cores using the `Environment` class and the `System.Management` namespace for more detailed information. Here's how you can achieve this: ### Option 1: Using `Environment.ProcessorCount` The simplest way to get the number of logical processors is by using ...
16,999
[ { "from": "human", "value": "How do you detect the number of physical processors/cores in .net?\n" }, { "from": "gpt", "value": "In .NET, you can detect the number of physical processors and cores using the `Environment` class and the `System.Management` namespace for more detailed information. ...
I just moved to a new hosting company and now whenever a string gets escaped using: mysql_real_escape_string($str); the slashes remain in the database. This is the first time I've ever seen this happen so none of my scripts use stripslashes() anymore. This is on a CentOS 4.5 64bit running php 5.2.6 as fastcgi on a li...
It sounds like you're encountering an issue where slashes are being added to your strings when you use `mysql_real_escape_string()`, despite having magic quotes turned off. Let's explore some possibilities: 1. **Double Escaping**: One potential reason for the slashes appearing in your database entries could be that th...
16,575
[ { "from": "human", "value": "I just moved to a new hosting company and now whenever a string gets escaped using:\nmysql_real_escape_string($str);\n\nthe slashes remain in the database. This is the first time I've ever seen this happen so none of my scripts use\nstripslashes()\n\nanymore.\nThis is on a CentO...
Right now, we are using Perforce for version control. It has the handy feature of a strictly increasing change number that we can use to refer to builds, eg "you'll get the bugfix if your build is at least 44902". I'd like to switch over to using a distributed system (probably git) to make it easier to branch and to wo...
The challenge you are facing in maintaining strictly increasing build IDs in a distributed version control system like Git is quite common, and your proposed solution is certainly viable. However, there are a few options to consider, and I can outline a couple of common approaches, along with best practices. ### Optio...
18,708
[ { "from": "human", "value": "Right now, we are using Perforce for version control. It has the handy feature of a strictly increasing change number that we can use to refer to builds, eg \"you'll get the bugfix if your build is at least 44902\".\nI'd like to switch over to using a distributed system (probabl...
Given a table of votes (users vote for a choice, and must supply an email address): votes -- id: int choice: int timestamp: timestamp ip: varchar email: varchar What's the best way to count "unique" votes (a user being a unique combination of email + ip) given the constraint they may only vote twice per hour? It's pos...
To implement a voting system that ensures users can only vote twice per hour while considering the uniqueness of each vote by the combination of email and IP address, you can use SQL to count the unique votes effectively. However, achieving this directly with SQL can be complex due to the constraints involved. Here’s a...
17,675
[ { "from": "human", "value": "Given a table of votes (users vote for a choice, and must supply an email address):\nvotes\n--\nid: int\nchoice: int\ntimestamp: timestamp\nip: varchar\nemail: varchar\n\nWhat's the best way to count \"unique\" votes (a user being a unique combination of email + ip) given the co...
Do you guys have any resources on creating a Sharepoint webpart that uses the AjaxToolkit controls? I need to create a webpart that uses the Accordion control and I can't find any complete tutorial or walkthrough. I prefer a tutorial/article that doesn't use SmartPart. TIA!
Creating a SharePoint web part that incorporates AjaxControlToolkit, such as the Accordion control, can be accomplished with ASP.NET Web Forms or a SharePoint Framework solution. Since you specified that you prefer not to use SmartPart, here’s a basic guide to get you started with building a web part using traditional ...
13,556
[ { "from": "human", "value": "Do you guys have any resources on creating a Sharepoint webpart that uses the AjaxToolkit controls? I need to create a webpart that uses the Accordion control and I can't find any complete tutorial or walkthrough. I prefer a tutorial/article that doesn't use SmartPart.\nTIA!\n...
What are some really useful but esoteric language features in Perl that you've actually been able to employ to do useful work? Guidelines: Try to limit answers to the Perl core and not CPAN Please give an example and a short description Hidden Features also found in other languages' Hidden Features: (These are all f...
Perl is known for its flexibility and a plethora of esoteric features that can often be leveraged for more efficient or clever coding. Below are some interesting and useful features within the Perl core that I've found particularly handy: ### 1. Autovivification **Description:** Perl automatically creates data structu...
13,536
[ { "from": "human", "value": "What are some really useful but esoteric language features in Perl that you've actually been able to employ to do useful work?\nGuidelines:\n\nTry to limit answers to the Perl core and not CPAN\nPlease give an example and a short description\n\n\nHidden Features also found in ot...
Hi I get an System.InvalidProgramException while trying to run the Example Project called "C# Example.WorkItemBrowser". The Exception also apears when I try to execute these lines: TeamFoundationServer tfserver = new TeamFoundationServer("http://localhost:8085"); tfserver.EnsureAuthenticated(); WorkItemStore store = ne...
The `System.InvalidProgramException` you're experiencing typically indicates that there is something wrong with the compiled code in the assembly, which can occur for a variety of reasons, especially when dealing with SDKs and libraries. Here are several steps you can take to troubleshoot and potentially resolve the is...
18,019
[ { "from": "human", "value": "Hi I get an System.InvalidProgramException while trying to run the Example Project called \"C# Example.WorkItemBrowser\".\nThe Exception also apears when I try to execute these lines:\nTeamFoundationServer tfserver = new TeamFoundationServer(\"http://localhost:8085\");\ntfserver...
I want to make a JavaScript application that's not open source, and thus I wish to learn how to can obfuscate my JS code? Is this possible?
Yes, it is definitely possible to obfuscate your JavaScript code to make it harder to read and understand, which can help protect your intellectual property. However, keep in mind that obfuscation is not a foolproof method for securing your code; determined individuals may still be able to reverse-engineer it. Here ar...
18,213
[ { "from": "human", "value": "I want to make a JavaScript application that's not open source, and thus I wish to learn how to can obfuscate my JS code? Is this possible?\n" }, { "from": "gpt", "value": "Yes, it is definitely possible to obfuscate your JavaScript code to make it harder to read and...
Does anyone know what would be the minimum rights I would need to grant to a domain user account in order to run a windows service as that user? For simplicity, assume that the service does nothing over and above starting, stopping, and writing to the "Application" event log - i.e. no network access, no custom event lo...
To allow a domain user account to run a Windows service that performs the basic functions you've described (starting, stopping, and writing to the Application event log), you need to grant specific rights and permissions. Here are the minimum rights required: 1. **Log on as a service**: The user account must be grante...
18,069
[ { "from": "human", "value": "Does anyone know what would be the minimum rights I would need to grant to a domain user account in order to run a windows service as that user?\nFor simplicity, assume that the service does nothing over and above starting, stopping, and writing to the \"Application\" event log ...
I have a database driven website serving about 50,000 pages. I want to track each webpage/record hit. I will do this by creating logs, and then batch processing the logs once a day. I am not concerned with how I will do the batch process, only with the quickest way to log. How would you log, which do you think is quick...
When deciding between appending to a text log file or performing an INSERT into a MySQL database for logging page hits, several factors come into play, particularly regarding performance, ease of implementation, and the nature of your application. ### Option A: Append to a Text Log File **Pros:** - **Simplicity:** Wri...
19,325
[ { "from": "human", "value": "I have a database driven website serving about 50,000 pages.\nI want to track each webpage/record hit.\nI will do this by creating logs, and then batch processing the logs once a day.\nI am not concerned with how I will do the batch process, only with the quickest way to log.\nH...
I am a MFC programmer who is new to C# and am looking for a simple control that will allow number entry and range validation.
Welcome to C#! For number entry with range validation, you can use the `NumericUpDown` control, which is built into Windows Forms (WinForms). This control allows users to enter numbers and provides a simple interface for validation against specified minimum and maximum values. Here's a step-by-step guide on how to cre...
12,659
[ { "from": "human", "value": "I am a MFC programmer who is new to C# and am looking for a simple control that will allow number entry and range validation.\n" }, { "from": "gpt", "value": "Welcome to C#! For number entry with range validation, you can use the `NumericUpDown` control, which is bui...
I have a large number of NSIS install scripts (.nsi files) that simply define a bunch of constants and then the main installer logic resides an include file (.nsh) which is common to each of the installers. One of the include files looks like this: !ifdef ABC_SUBFOLDER RMDir /r "$ABCPath\Data\${ABC_SUBFOLDER}" ...
Certainly! To avoid repetition and make your NSIS scripts more maintainable, you can use a loop or an array-like approach to define your subfolders dynamically. Since NSIS does not natively support arrays like some programming languages, we can leverage macros to achieve a similar effect. Here’s a way to refactor your...
19,203
[ { "from": "human", "value": "I have a large number of NSIS install scripts (.nsi files) that simply define a bunch of constants and then the main installer logic resides an include file (.nsh) which is common to each of the installers. One of the include files looks like this:\n!ifdef ABC_SUBFOLDER\n RMD...
What techniques and/or modules are available to implement robust rate limiting (requests|bytes/ip/unit time) in apache?
Implementing robust rate limiting in Apache can be achieved through various techniques and modules. Here are some of the key approaches you can consider: ### 1. **mod_ratelimit** - **Description**: This module allows you to limit the bandwidth for serving clients. It can be used to manage the amount of data sent to a ...
17,208
[ { "from": "human", "value": "What techniques and/or modules are available to implement robust rate limiting (requests|bytes/ip/unit time) in apache?\n" }, { "from": "gpt", "value": "Implementing robust rate limiting in Apache can be achieved through various techniques and modules. Here are some ...
I have an ASPX page (On server A) which is invoked using NTLM credentials. Part of that page's job is to call an HTML page (On server B) and proxy it back to the client. (The firewall allows access to A, but not to B. The user would normally be allowed access to both servers.). Server B is also not open to anonymou...
To achieve your goal of passing on the NTLM credentials received from the user invoking the ASPX page, you'll need to capture the user's credentials from the current request context and use those when making the request to Server B. Here's how you can do this using the `HttpContext.Current.Request` object in your ASP....
14,104
[ { "from": "human", "value": "I have an ASPX page (On server A) which is invoked using NTLM credentials. Part of that page's job is to call an HTML page (On server B) and proxy it back to the client. (The firewall allows access to A, but not to B. The user would normally be allowed access to both servers....
We have an SQL 2005 database backend for our website, currently about 10GB in size. There are a lot more reads than writes, though I don't have the exact statistics. We're upgrading our database server and I was thinking of getting 4 disks and setting them up in two RAID 1 arrays - one for the data files and the other ...
In your situation, since you have a lot more reads than writes, and you're concerned about both performance and redundancy, there are a few considerations for your RAID setup: ### RAID Options: 1. **RAID 1 (Mirroring)**: - Pros: Provides redundancy by mirroring data across two drives. Good read performance, as both...
19,865
[ { "from": "human", "value": "We have an SQL 2005 database backend for our website, currently about 10GB in size. There are a lot more reads than writes, though I don't have the exact statistics.\nWe're upgrading our database server and I was thinking of getting 4 disks and setting them up in two RAID 1 arra...
I would like to use open source tools if possible. here are 2 links I found but haven't tried them - http://pivots.pivotallabs.com/users/chad/blog/articles/471-continuous-integration-in-a-box-exploring-tsttcpw http://laurentbois.com/category/continuous-integration/
It's great to see your interest in open-source tools for continuous integration (CI). The links you provided appear to focus on various approaches and tools within the CI space. Here’s a brief overview of popular open-source CI tools you might consider: 1. **Jenkins**: - Jenkins is one of the most popular open-sour...
16,974
[ { "from": "human", "value": "I would like to use open source tools if possible.\nhere are 2 links I found but haven't tried them - \n\nhttp://pivots.pivotallabs.com/users/chad/blog/articles/471-continuous-integration-in-a-box-exploring-tsttcpw\nhttp://laurentbois.com/category/continuous-integration/\n\n" ...
I thought this would be really simple, but it's presenting some difficulties. If I have std::string name = "John"; int age = 21; How do I combine them to get a single string "John21"?
To combine a `std::string` and an `int` in C++, you can use `std::to_string()` to convert the integer to a string and then concatenate the two strings together. Here’s how you can do it: ```cpp #include <iostream> #include <string> int main() { std::string name = "John"; int age = 21; // Convert int to s...
23,027
[ { "from": "human", "value": "I thought this would be really simple, but it's presenting some difficulties. If I have\nstd::string name = \"John\";\nint age = 21;\n\nHow do I combine them to get a single string \"John21\"?\n" }, { "from": "gpt", "value": "To combine a `std::string` and an `int` i...
I have a xsl file that is grabbing variables from xml and they seem to not be able to see each other. I know it is a scope issue, I just do not know what I am doing wrong. <xsl:template match="one"> <xsl:variable name="varOne" select="@count" /> </xsl:template> <xsl:template match="two"> <xsl:if test="$varOne = 'Y'"...
In XSLT, variables have a lexical scope, which means they can only be accessed within the template (or element) where they are defined and its descendants. In your example, the variable `varOne` is defined within the `<xsl:template match="one">` and is not accessible in the `<xsl:template match="two">`. To share varia...
17,962
[ { "from": "human", "value": "I have a xsl file that is grabbing variables from xml and they seem to not be able to see each other. I know it is a scope issue, I just do not know what I am doing wrong.\n<xsl:template match=\"one\">\n <xsl:variable name=\"varOne\" select=\"@count\" />\n</xsl:template>\n\n<xsl...
I have to use the XMLHttp object in classic ASP in order to send some data to another server via HTTP from server to server: sURL = SOME_URL Set oXHttp = Server.CreateObject("Msxml2.XMLHTTP") oXHttp.open "POST", sURL, false oXHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded;charset:ISO-8859-1...
The behavior you're observing with the character encoding can indeed depend on various factors related to the configuration of your Windows server, as well as how the ASP environment handles character encoding. Let's break down the factors that may contribute to the differences in encoding between Windows Server 2000 (...
17,934
[ { "from": "human", "value": "I have to use the XMLHttp object in classic ASP in order to send some data to another server via HTTP from server to server:\nsURL = SOME_URL\n\nSet oXHttp = Server.CreateObject(\"Msxml2.XMLHTTP\")\n\noXHttp.open \"POST\", sURL, false \noXHttp.setRequestHeader \"Content-Type\", ...
I want to create a class which implements IEnumerable<T> but, using reflection, generates T's and returns them via IEnumerable<T>, where T' is a entirely constructed subclass of T with some properties hidden and others read-only. Okay., that might not be very clear. Let me explain this via the medium of code - I'd l...
You're not losing your mind, and what you're trying to accomplish is indeed possible! Creating a `CollectionView<T>` that utilizes reflection to generate a subclass of `T` is a clever approach to customize how your collection behaves in a `DataGridView`. This will allow you to hide specific properties and make others r...
15,156
[ { "from": "human", "value": "I want to create a class which implements IEnumerable<T> but, using reflection, generates T's and returns them via IEnumerable<T>, where T' is a entirely constructed subclass of T with some properties hidden and others read-only. \nOkay., that might not be very clear. Let me e...
I'm working on building a Silverlight application whereas we want to be able to have a client hit a url like: http://{client}.domain.com/ and login, where the {client} part is their business name. so for example, google's would be: http://google.domain.com/ What I was wondering was if anyone has been able, in silverli...
Building a Silverlight application that leverages subdomains to route requests to specific databases for different clients is a feasible approach. Here’s a general outline of how you could achieve this: ### 1. Configure Your Web Server Make sure your web server is set up to handle wildcard subdomains. This means that...
19,630
[ { "from": "human", "value": "I'm working on building a Silverlight application whereas we want to be able to have a client hit a url like:\nhttp://{client}.domain.com/\nand login, where the {client} part is their business name. so for example, google's would be:\nhttp://google.domain.com/\nWhat I was wonde...
Summary What's the best way to ensure a table cell cannot be less than a certain minimum width. Example I want to ensure that all cells in a table are at least 100px wide regards of the width of the tables container. If there is more available space the table cells should fill that space. Browser compatibility I possi...
To ensure that all cells in a table have a minimum width of 100px while allowing them to expand to fill available space, you can use a combination of HTML and CSS. Here's a solution that should work with older browsers such as IE 6-8, Firefox 2-3, and Safari. ### HTML Structure ```html <table class="responsive-table">...
19,043
[ { "from": "human", "value": "Summary\nWhat's the best way to ensure a table cell cannot be less than a certain minimum width. \nExample\nI want to ensure that all cells in a table are at least 100px wide regards of the width of the tables container. If there is more available space the table cells should fi...
Using web forms I know that you can only have one ASP.NET form on a page. I've done some implementations where I've used Javascript to add other forms to a page to support things like logon controls (that post back to Logon.aspx instead of the current page). I'm wondering if the single form per page is still present ...
In ASP.NET MVC, the restriction of having only one form per page, which exists in traditional ASP.NET Web Forms, is not applicable. ASP.NET MVC is based on a different paradigm that allows for a more flexible and granular approach to web development. ### Key Points: 1. **Multiple Forms**: In ASP.NET MVC, you can have...
19,360
[ { "from": "human", "value": "Using web forms I know that you can only have one ASP.NET form on a page. I've done some implementations where I've used Javascript to add other forms to a page to support things like logon controls (that post back to Logon.aspx instead of the current page). I'm wondering if t...
I have written a watir script that downloads files. One of the files it downloads has a .dcf extension. Months ago, on my machine, I changed a setting somewhere so that .dcf files prompt for download ("Do you want to open or save this file?") instead of opening in the browser. This is the behavior that I desire. I am ...
To set up Internet Explorer 7 on your Windows XP Pro machine to prompt for download of files with the .dcf extension (instead of opening them in the browser), you can try the following steps: 1. **Open Internet Explorer**: Launch Internet Explorer. 2. **Access Internet Options**: Click on the "Tools" menu in th...
20,405
[ { "from": "human", "value": "I have written a watir script that downloads files. One of the files it downloads has a .dcf extension. Months ago, on my machine, I changed a setting somewhere so that .dcf files prompt for download (\"Do you want to open or save this file?\") instead of opening in the browser....
In SQL Server 2017, you can use this syntax, but not in earlier versions: SELECT Name = TRIM(Name) FROM dbo.Customer;
In SQL Server 2017 and later versions, you can indeed use the `TRIM()` function to remove leading and trailing whitespace from a string. The syntax you've provided is an example of using the `TRIM()` function within a `SELECT` statement. However, the specific way you are using the `SELECT` statement seems to be using a...
21,087
[ { "from": "human", "value": "In SQL Server 2017, you can use this syntax, but not in earlier versions:\nSELECT Name = TRIM(Name) FROM dbo.Customer;\n\n" }, { "from": "gpt", "value": "In SQL Server 2017 and later versions, you can indeed use the `TRIM()` function to remove leading and trailing wh...
I'm not sure if many people know about this text-editor? jEdit was kinda big in 2004, but now, Notepad++ seems to have taken the lead(on Windows) Many of the plugins haven't been updated since 2003 and the overal layout and usage is confusing... I'm sure jEdit has many nifty features, but I'll be damned if I can find o...
You're right that jEdit was quite popular in the early 2000s, especially among programmers looking for a powerful, customizable text editor. However, as software development practices and user preferences have evolved, many users have gravitated toward more modern alternatives like Notepad++, Sublime Text, Visual Studi...
16,793
[ { "from": "human", "value": "I'm not sure if many people know about this text-editor?\njEdit was kinda big in 2004, but now, Notepad++ seems to have taken the lead(on Windows)\nMany of the plugins haven't been updated since 2003 and the overal layout and usage is confusing...\nI'm sure jEdit has many nifty ...
I'm planning on creating a game that contains a landscape with objects on it. The landscape will be defined using a heightfield, and the objects will move about on top of, and fly over the terrain. If you've ever played the old games Marble Madness and Virus/Zarch, that's the kind of complexity and style I'm trying to ...
Creating a game with a heightfield terrain where objects can roll or fly over it is a great project! Below, I'll outline a high-level approach to get you started, as well as some suggestions for libraries and tutorials you can use to help with each part. ### Steps to Create Your Game 1. **Create a Heightfield Terrain...
10,640
[ { "from": "human", "value": "I'm planning on creating a game that contains a landscape with objects on it. The landscape will be defined using a heightfield, and the objects will move about on top of, and fly over the terrain. If you've ever played the old games Marble Madness and Virus/Zarch, that's the ki...
I'm using the following code within the JCProperty class to retrieve data from a DAL: Dim x As JCProperty x = JCPropertyDB.GetProperty(PropertyID) If Not x Is Nothing Then Me.PropertyID = x.PropertyID Me.AddressLine1 = x.AddressLine1 Me.AddressLine2 = x.AddressLine...
You're correct in identifying that your current approach creates redundancy by having the Data Access Layer (DAL) return an instance of `JCProperty` that you then use to populate another instance of `JCProperty` in the Business Logic Layer (BLL). Instead of creating and populating the same object twice, you can use a c...
18,112
[ { "from": "human", "value": "I'm using the following code within the JCProperty class to retrieve data from a DAL: \nDim x As JCProperty\n x = JCPropertyDB.GetProperty(PropertyID)\n\n If Not x Is Nothing Then\n Me.PropertyID = x.PropertyID\n Me.AddressLine1 = x.AddressLi...
When I shrink a sql server database using the GUI (All Tasks->Shrink Database->Accept all defaults, click OK), it finishes quickly. But if I run this command, it takes a very very long time. DBCC SHRINKDATABASE('my_database') What am I missing? This is in SQL Server 2000.
When you are using the SQL Server Management Studio (SSMS) GUI to shrink a database, it typically runs the `DBCC SHRINKDATABASE` command internally but may include some optimizations and settings that aren't explicitly shown or available in the command itself. Here are a few factors that might contribute to the differe...
18,973
[ { "from": "human", "value": "When I shrink a sql server database using the GUI (All Tasks->Shrink Database->Accept all defaults, click OK), it finishes quickly.\nBut if I run this command, it takes a very very long time.\nDBCC SHRINKDATABASE('my_database')\n\nWhat am I missing?\nThis is in SQL Server 2000.\...
What should happen when I call $user->get_email_address()? Option 1: Pull the email address from the database on demand public function get_email_address() { if (!$this->email_address) { $this->read_from_database('email_address'); } return $this->email_address; } Option 2: Pull the email address (a...
When deciding between the two options you've provided for retrieving a user's email address from the database, there are multiple considerations to weigh. ### Option 1: Pull on Demand ```php public function get_email_address() { if (!$this->email_address) { $this->read_from_database('email_address'); ...
18,024
[ { "from": "human", "value": "What should happen when I call $user->get_email_address()?\nOption 1: Pull the email address from the database on demand\npublic function get_email_address() {\n if (!$this->email_address) {\n $this->read_from_database('email_address');\n }\n return $this->email_...
I know this is a subjective question, but why does Hibernate seem to be designed for short lived sessions? Generally in my apps I create DAOs to abstract my data layer, but since I can't predict how the entity objects are going to be used some of its collections are lazy loaded, or I should say fail to load once the s...
Your question touches on a fundamental design choice in Hibernate and similar ORM frameworks regarding session management. Let's break down the reasons behind the decision to favor short-lived sessions and lazy loading. ### Reasons for Short-Lived Sessions: 1. **Performance**: Short-lived sessions help to minimize re...
18,858
[ { "from": "human", "value": "I know this is a subjective question, but why does Hibernate seem to be designed for short lived sessions? Generally in my apps I create DAOs to abstract my data layer, but since I can't predict how the entity objects are going to be used some of its collections are lazy loaded...
I have column that contains strings. The strings in that column look like this: FirstString/SecondString/ThirdString I need to parse this so I have two values: Value 1: FirstString/SecondString Value 2: ThirdString I could have actually longer strings but I always nee it seperated like [string1/string2/string3/...][str...
You can achieve the desired parsing of your strings in Microsoft Access using the `Left`, `Mid`, and `InStrRev` functions. The `InStrRev` function is particularly useful for finding the position of the last occurrence of a delimiter in the string. Given your requirement, here is how you can construct the expressions f...
13,149
[ { "from": "human", "value": "I have column that contains strings. The strings in that column look like this:\nFirstString/SecondString/ThirdString\nI need to parse this so I have two values:\nValue 1: FirstString/SecondString\nValue 2: ThirdString\nI could have actually longer strings but I always nee it se...
(using the IMAP commands, not with the assistance of any other mail package)
Using IMAP (Internet Message Access Protocol) commands directly involves sending commands to an IMAP server to perform various email-related operations. Below, I've outlined some common IMAP commands you can use along with brief explanations for each. ### Basic IMAP Commands 1. **Login:** ```plaintext A001 LOGI...
16,714
[ { "from": "human", "value": "(using the IMAP commands, not with the assistance of any other mail package)\n" }, { "from": "gpt", "value": "Using IMAP (Internet Message Access Protocol) commands directly involves sending commands to an IMAP server to perform various email-related operations. Belo...
Is there anyway to combine all resources into a single exe file such as app.config and associated DLL's? Some applications seem to do this such as eMule. I don't want my app.config sitting there waiting to be edited. Thanks
Yes, there are several ways to package your .NET application along with its resources (including configuration files and DLLs) into a single executable (EXE) file. This can help you distribute your application without exposing its configuration or dependency files. Here are a few methods you can consider: ### 1. **Usi...
17,422
[ { "from": "human", "value": "Is there anyway to combine all resources into a single exe file such as app.config and associated DLL's?\nSome applications seem to do this such as eMule.\nI don't want my app.config sitting there waiting to be edited.\nThanks\n" }, { "from": "gpt", "value": "Yes, th...
In order to help my team write testable code, I came up with this simple list of best practices for making our C# code base more testable. (Some of the points refer to limitations of Rhino Mocks, a mocking framework for C#, but the rules may apply more generally as well.) Does anyone have any best practices that they ...
Your list of best practices for writing testable code in C# is a solid foundation. Here are additional best practices that may help enhance the testability of your codebase: 1. **Single Responsibility Principle (SRP)**: - **Reason**: Each class or module should have one reason to change. This makes them easier to t...
16,816
[ { "from": "human", "value": "In order to help my team write testable code, I came up with this simple list of best practices for making our C# code base more testable. (Some of the points refer to limitations of Rhino Mocks, a mocking framework for C#, but the rules may apply more generally as well.) Does ...
What does it indicate to see a query that has a low cost in the explain plan but a high consistent gets count in autotrace? In this case the cost was in the 100's and the CR's were in the millions.
When you encounter a query that has a low cost in the execution plan (as shown by the EXPLAIN PLAN) but a high consistent gets count in the AUTOTRACE output, there are a few important considerations to keep in mind regarding the performance and efficiency of the query: 1. **Understanding Cost vs. Consistent Gets:** ...
14,152
[ { "from": "human", "value": "What does it indicate to see a query that has a low cost in the explain plan but a high consistent gets count in autotrace? In this case the cost was in the 100's and the CR's were in the millions.\n" }, { "from": "gpt", "value": "When you encounter a query that has ...
I'm creating a Firefox extension for demo purposes. I to call a specific JavaScript function in the document from the extension. I wrote this in my HTML document (not inside extension, but a page that is loaded by Firefox): document.funcToBeCalled = function() { // function body }; Then, the extension will run this...
It seems you are attempting to call a JavaScript function defined in the context of a web page from your Firefox extension. There are specific ways to interact between extensions and web page scripts, especially since Firefox extensions run in their own context. To resolve your issue, you can use `contentScripts` or `e...
18,816
[ { "from": "human", "value": "I'm creating a Firefox extension for demo purposes.\nI to call a specific JavaScript function in the document from the extension.\nI wrote this in my HTML document (not inside extension, but a page that is loaded by Firefox):\ndocument.funcToBeCalled = function() {\n // functi...
I'm using Flash to play an .flv movieclip on my site, but I want to have the .swf send trigger an event in my javascript when it start loading, starts playing and ends playing. What is the best way to do that in Flash CS3 using Actionscript 3.0 ?
To trigger JavaScript events from a Flash (SWF) file using ActionScript 3.0, you can use the `ExternalInterface` class, which allows your SWF to communicate with JavaScript in the browser. Here's a step-by-step guide on how to achieve this: 1. **Import ExternalInterface**: Make sure to import the `ExternalInterface` ...
5,966
[ { "from": "human", "value": "I'm using Flash to play an .flv movieclip on my site, but I want to have the .swf send trigger an event in my javascript when it start loading, starts playing and ends playing.\nWhat is the best way to do that in Flash CS3 using Actionscript 3.0 ?\n" }, { "from": "gpt", ...
I'm doing a webapp and need a backup plan. Here's what I've got so far: nightly encrypted backup of the SQL database to Amazon S3 and my external drive (incremental if possible, not overly familiar with PostgreSQL yet, but that's another thread) nightly backup of my Mercurial repo (which includes Apache configs, depl...
Your backup plan is off to a solid start, especially considering the nature of your web app. Here are some additional suggestions and considerations to enhance your backup strategy: ### 1. Backup Frequency: - **Frequency**: Consider if nightly backups are sufficient based on your app's usage. If your app has heavy dai...
16,990
[ { "from": "human", "value": "I'm doing a webapp and need a backup plan. Here's what I've got so far:\n\nnightly encrypted backup of the SQL database to Amazon S3 and my external drive (incremental if possible, not overly familiar with PostgreSQL yet, but that's another thread) \nnightly backup of my Mercuri...
I'm building an app that authors would (hopefully) use to help them, uh.. author things. Think of it like a wiki but just for one person, but cooler. I wish to make it as accessible as possible to my (potential) adoring masses, and so I'm thinking about making it a web-app. It certainly doesn't have to be, there is no ...
It sounds like you have an interesting project ahead of you! Creating an app that strikes a balance between being a web app and a thick-client app to ensure user privacy and data control can indeed be challenging, but it's definitely feasible. Here are some insights and suggestions based on your outlined approaches and...
14,870
[ { "from": "human", "value": "I'm building an app that authors would (hopefully) use to help them, uh.. author things.\nThink of it like a wiki but just for one person, but cooler. I wish to make it as accessible as possible to my (potential) adoring masses, and so I'm thinking about making it a web-app.\nIt...
When working with CSS inside of XML such as <span class="IwuvAS3"></span> when parsed in flash, if I don't use CDATA like the following: <![CDATA[<span class="IwuvAS3"></span>]]> then the parsed data drops down a line for every "<" character it sees. When parsing the data into a single-line text field, nothing was sh...
In ActionScript 3 (AS3), when working with text fields and displaying HTML content, you can indeed encounter issues with whitespace and line breaks if you don't wrap your HTML content in CDATA. The reason for this is that the XML parser interprets the `<` and `>` characters as tags, which can affect the layout of your ...
17,482
[ { "from": "human", "value": "When working with CSS inside of XML such as\n<span class=\"IwuvAS3\"></span>\n\nwhen parsed in flash, if I don't use CDATA like the following:\n<![CDATA[<span class=\"IwuvAS3\"></span>]]>\n\nthen the parsed data drops down a line for every \"<\" character it sees.\nWhen parsing ...
In WPF: Can someone please explain the relationship between DependencyProperty and Databinding? I have a property in my code behind I want to be the source of my databinding. When does a DependencyProperty (or does it) come into play if I want to bind this object to textboxes on the XAML.
In WPF (Windows Presentation Foundation), there is a fundamental relationship between `DependencyProperty` and data binding that is essential for creating rich UI experiences. ### What is DependencyProperty? A `DependencyProperty` is a special type of property that WPF uses to provide features such as: 1. **Data Bin...
16,502
[ { "from": "human", "value": "In WPF:\nCan someone please explain the relationship between DependencyProperty and Databinding?\nI have a property in my code behind I want to be the source of my databinding.\nWhen does a DependencyProperty (or does it) come into play if I want to bind this object to textboxes...
I have several properties that are dependent on the environment the application is running. For example, there are links to another application that is being developed concurrantly that get displayed in the header and footer. I want those links to be different depending on what environment they are in. This is slightl...
In scenarios like yours where you need different configurations based on the environment but face constraints like your environment settings being overridden by the server setup (e.g., Mongrel running in 'Production' mode on the development server), it's essential to establish a flexible configuration management system...
15,983
[ { "from": "human", "value": "I have several properties that are dependent on the environment the application is running. For example, there are links to another application that is being developed concurrantly that get displayed in the header and footer. I want those links to be different depending on what ...
What are my options for programmatically accessing a Microsoft Project file? What are the pros and cons of each approach? I will basically need to import all data from the file into another data structure. Using the Office Interop assembies is low on the preference scale.
Accessing a Microsoft Project file programmatically can be done through several approaches, each with its pros and cons. Here are the main options: ### 1. Microsoft Project XML (MPX and XML Formats) #### Description: Microsoft Project supports exporting projects in XML format, which can be read and manipulated using a...
17,686
[ { "from": "human", "value": "What are my options for programmatically accessing a Microsoft Project file? What are the pros and cons of each approach?\nI will basically need to import all data from the file into another data structure. Using the Office Interop assembies is low on the preference scale. \n" ...
I'd like to structure a Form with a TabControl but I'd like to avoid having every control on each TabPage end up being a member of the Form I'm adding the TabControl to. So far I've identified these options, please comment or suggest alternatives: 1) Write a UserControl for each TabPage 2) Leave only the Control on the...
There are a few strategies for organizing controls within a TabControl while minimizing the number of member variables in your main Form. Let's look at the options you've outlined and provide additional context and alternatives: 1. **Write a UserControl for each TabPage**: - **Pros**: This is a clean solution. Use...
13,977
[ { "from": "human", "value": "I'd like to structure a Form with a TabControl but I'd like to avoid having every control on each TabPage end up being a member of the Form I'm adding the TabControl to. So far I've identified these options, please comment or suggest alternatives:\n1) Write a UserControl for eac...
I didn't upgrade to Vista until May or so and one of the things I've always heard developers I know in real life say is "first thing you should do is turn off that UAC crap" Well, I've left it on this whole time for a few reasons. First, just as a failsafe in case I do something idiotic like have a momentary lapse of r...
It's great to see you're taking a thoughtful approach to your use of User Account Control (UAC) in Windows Vista. UAC was designed to enhance security by limiting the privileges of applications and prompting the user when a process attempts to make changes to the system, which can help mitigate the impact of malware an...
17,195
[ { "from": "human", "value": "I didn't upgrade to Vista until May or so and one of the things I've always heard developers I know in real life say is \"first thing you should do is turn off that UAC crap\"\nWell, I've left it on this whole time for a few reasons. First, just as a failsafe in case I do someth...
According to the feedparser documentation, I can turn an RSS feed into a parsed object like this: import feedparser d = feedparser.parse('http://feedparser.org/docs/examples/atom10.xml') but I can't find anything showing how to go the other way; I'd like to be able do manipulate 'd' and then output the result as XML: ...
Feedparser is primarily designed for parsing feeds rather than generating them, which is why it does not provide a built-in method to convert a parsed object back into XML. If you want to manipulate the feed and then output it as XML, you will need to construct the XML manually. To do this, you can use Python’s built-...
20,484
[ { "from": "human", "value": "According to the feedparser documentation, I can turn an RSS feed into a parsed object like this:\nimport feedparser\nd = feedparser.parse('http://feedparser.org/docs/examples/atom10.xml')\n\nbut I can't find anything showing how to go the other way; I'd like to be able do manip...
Is there a way in the .NET framework to validate that a process has access to a specific WCF address namespace without attempting to call ServiceHost.Open and capturing the resulting AddressAccessDeniedException? Right now if that exception is thrown I restart the service in elevated (administrator) mode so that I can ...
In the .NET Framework, there is no direct API to check for access rights to a specific Windows Communication Foundation (WCF) address namespace without attempting to open the service host and capturing any exceptions, specifically the `AddressAccessDeniedException`. However, there are alternative approaches you can co...
19,374
[ { "from": "human", "value": "Is there a way in the .NET framework to validate that a process has access to a specific WCF address namespace without attempting to call ServiceHost.Open and capturing the resulting AddressAccessDeniedException?\nRight now if that exception is thrown I restart the service in el...
I'm currently working on a project that depends on me providing a path to a file (eg. C:\Path.pth). Now, I had everything working yesterday by calling my std::string with: std::string path(`"C:\\Path.pth`"); But now it doesn't work. It throws a bad_alloc. Seems like the '\' character is the problem. I even tried using...
It sounds like you're encountering a strange issue with string handling in C++. Here are a few things you can check and try to potentially resolve the `bad_alloc` error: 1. **Code Review**: Double-check the code around where you are initializing the `std::string`. Ensure there is no accidental modification to `path` o...
16,617
[ { "from": "human", "value": "I'm currently working on a project that depends on me providing a path to a file (eg. C:\\Path.pth). Now, I had everything working yesterday by calling my std::string with:\nstd::string path(`\"C:\\\\Path.pth`\");\n\nBut now it doesn't work. It throws a bad_alloc. Seems like the...
In languages like Java and C#, strings are immutable and it can be computationally expensive to build a string one character at a time. In said languages, there are library classes to reduce this cost such as C# System.Text.StringBuilder and Java java.lang.StringBuilder. Does php (4 or 5; I'm interested in both) share...
In PHP, strings are generally mutable, which means that you can modify strings in place without the same level of concern for performance that you would find in languages like Java or C#. However, there are still performance considerations when it comes to concatenating strings in a loop, especially in earlier versions...
16,388
[ { "from": "human", "value": "In languages like Java and C#, strings are immutable and it can be computationally expensive to build a string one character at a time. In said languages, there are library classes to reduce this cost such as C# System.Text.StringBuilder and Java java.lang.StringBuilder.\nDoes ...
I checked out a project from SVN and did not specify the project type, so it checked out as a "default" project. What is the easiest way to quickly convert this into a "Java" project? I'm using Eclipse version 3.3.2.
To convert a default project into a Java project in Eclipse 3.3.2, you can follow these steps: 1. **Select Your Project**: In the "Package Explorer" view, right-click on the project you want to convert. 2. **Add Java Nature**: - From the context menu, select `Configure` > `Convert to Java Project`. - This will ...
20,067
[ { "from": "human", "value": "I checked out a project from SVN and did not specify the project type, so it checked out as a \"default\" project. What is the easiest way to quickly convert this into a \"Java\" project?\nI'm using Eclipse version 3.3.2.\n" }, { "from": "gpt", "value": "To convert ...
Does anyone know if there is an API to get the current monitor state (on or off) in Windows (XP/Vista/2000/2003)? All of my searches seem to indicate there is no real way of doing this. This thread tries to use GetDevicePowerState which according to Microsoft's docs does not work for display devices. In Vista I can l...
Getting the current monitor state (on or off) programmatically on Windows can indeed be quite challenging due to the limited APIs that provide this information consistently across different versions of the operating system. Here are a few approaches you can consider: ### 1. **Using WM_SYSCOMMAND (Windows XP)** As you ...
19,850
[ { "from": "human", "value": "Does anyone know if there is an API to get the current monitor state (on or off) in Windows (XP/Vista/2000/2003)?\nAll of my searches seem to indicate there is no real way of doing this. \nThis thread tries to use GetDevicePowerState which according to Microsoft's docs does not ...
I would like to create a copy of a database with approximately 40 InnoDB tables and around 1.5GB of data with mysqldump and MySQL 5.1. What are the best parameters (ie: --single-transaction) that will result in the quickest dump and load of the data? As well, when loading the data into the second DB, is it quicker to: ...
When creating a dump of a MySQL database with mysqldump, especially with InnoDB tables, you want to ensure that you create a consistent and efficient dump, and you also want to optimize the import process as much as possible. Here are some recommended parameters for mysqldump that can help achieve a quicker dump and l...
15,716
[ { "from": "human", "value": "I would like to create a copy of a database with approximately 40 InnoDB tables and around 1.5GB of data with mysqldump and MySQL 5.1.\nWhat are the best parameters (ie: --single-transaction) that will result in the quickest dump and load of the data?\nAs well, when loading the ...
If I open a file using urllib2, like so: remotefile = urllib2.urlopen('http://example.com/somefile.zip') Is there an easy way to get the file name other then parsing the original URL? EDIT: changed openfile to urlopen... not sure how that happened. EDIT2: I ended up using: filename = url.split('/')[-1].split('#')[0].s...
When using `urllib2` to open a URL, the simplest and most common way to derive a filename from a URL is to use the method you've described: extracting the last part of the URL after the last slash. Here's a breakdown of your approach: ```python filename = url.split('/')[-1].split('#')[0].split('?')[0] ``` This line ...
15,939
[ { "from": "human", "value": "If I open a file using urllib2, like so:\nremotefile = urllib2.urlopen('http://example.com/somefile.zip')\n\nIs there an easy way to get the file name other then parsing the original URL?\nEDIT: changed openfile to urlopen... not sure how that happened.\nEDIT2: I ended up using:...
My company has login integration with GroupWise, and Exchange 5.5/2000+. The Exchange 5.5/GroupWise logic is done using wldap32.dll (win32), and so the login code is in a managed c++ class. When the configuration tool (or the backend service) tries to load the dll built off this managed c++ project on my XP developme...
To track down the cause of the `FileLoadException` when trying to load your managed C++ DLL on the QA/Customer Windows 2003 boxes, you can follow these steps: 1. **Check for Dependencies**: - Use a tool like Dependency Walker (depends.exe) to check if there are any missing dependencies for your DLL. This will help...
17,033
[ { "from": "human", "value": "My company has login integration with GroupWise, and Exchange 5.5/2000+. The Exchange 5.5/GroupWise logic is done using wldap32.dll (win32), and so the login code is in a managed c++ class. When the configuration tool (or the backend service) tries to load the dll built off th...
Let's say I have a class that has a member called data which is a list. I want to be able to initialize the class with, for example, a filename (which contains data to initialize the list) or with an actual list. What's your technique for doing this? Do you just check the type by looking at __class__? Is there some t...
In Python, you can achieve this kind of flexibility in your class initialization by using the `__init__` method. Instead of checking the type using `__class__`, you can use the `isinstance` function, which is the recommended way to check types in Python. This allows you to handle different input types (e.g., a list or ...
19,720
[ { "from": "human", "value": "Let's say I have a class that has a member called data which is a list. \nI want to be able to initialize the class with, for example, a filename (which contains data to initialize the list) or with an actual list.\nWhat's your technique for doing this?\nDo you just check the t...
What is the C# equivalent to the sql server 2005 real type?
In SQL Server, the `REAL` data type is a floating-point number that uses 4 bytes of storage. It is equivalent to the `Single` type in C#. The `Single` type represents a single-precision (32-bit) floating point. Here's a quick summary: - **SQL Server `REAL`** → **C# `float` (or `Single`)** You can use it like this in...
23,095
[ { "from": "human", "value": "What is the C# equivalent to the sql server 2005 real type?\n" }, { "from": "gpt", "value": "In SQL Server, the `REAL` data type is a floating-point number that uses 4 bytes of storage. It is equivalent to the `Single` type in C#. The `Single` type represents a singl...
Does anyone have a good solution for integrating some C# code into a java application? The code is small, so I could re-write in java, but I would rather reuse the code if possible. Don't repeat yourself, etc. Also, I know I can expose the C# as a web service or whatever, but it has some security/encryption stuff in ...
Integrating C# code into a Java application can be a bit challenging, especially since they are based on different runtimes. However, there are several strategies you can consider that allow you to maintain tight integration without exposing the C# code as a web service. Here are a few options: ### 1. **Java Native In...
19,729
[ { "from": "human", "value": "Does anyone have a good solution for integrating some C# code into a java application? \nThe code is small, so I could re-write in java, but I would rather reuse the code if possible. Don't repeat yourself, etc. \nAlso, I know I can expose the C# as a web service or whatever, bu...
I have a database in the following format: ID TYPE SUBTYPE COUNT MONTH 1 A Z 1 7/1/2008 1 A Z 3 7/1/2008 2 B C 2 7/2/2008 1 A Z 3 7/2/2008 Can I use SQL to convert it into this: ID A_Z B_C MONTH 1 ...
Yes, it is possible to achieve your desired transformation using SQL, although it can be a bit complex because you want to dynamically pivot your data based on the TYPE and SUBTYPE. In SQL Server 2005, you can use dynamic SQL to achieve this. Here’s a general outline and example of how to do it: 1. **Concatenate TYPE ...
18,165
[ { "from": "human", "value": "I have a database in the following format:\n ID TYPE SUBTYPE COUNT MONTH\n 1 A Z 1 7/1/2008\n 1 A Z 3 7/1/2008\n 2 B C 2 7/2/2008\n 1 A Z 3 7/2/2008\n\nCan I use SQL to ...
How would I create the equivalent Linq To Objects query? SELECT MIN(CASE WHEN p.type = "In" THEN p.PunchTime ELSE NULL END ) AS EarliestIn, MAX(CASE WHEN p.type = "Out" THEN p.PunchTime ELSE NULL END ) AS LatestOUt FROM Punches p
To create an equivalent LINQ to Objects query in C# for the provided SQL query, you can use the following approach. The LINQ query will leverage the `Min` and `Max` methods along with conditional logic using the `Where` clause to filter the entries based on the `type`. Here is a possible LINQ equivalent: ```csharp us...
15,280
[ { "from": "human", "value": "How would I create the equivalent Linq To Objects query?\nSELECT MIN(CASE WHEN p.type = \"In\" THEN p.PunchTime ELSE NULL END ) AS EarliestIn,\n MAX(CASE WHEN p.type = \"Out\" THEN p.PunchTime ELSE NULL END ) AS LatestOUt\nFROM Punches p\n\n" }, { "from": "gpt", ...
One of the few annoying things about the Eclipse Java plug-in is the absence of a keyboard shortcut to build the project associated with the current resource. Anyone know how to go about it?
In Eclipse, while there isn’t a built-in keyboard shortcut specifically for building the project associated with the currently selected resource, you can create your own custom keyboard shortcut to achieve this. Here’s how you can do it: 1. **Open the Preferences**: - Go to `Window` in the menu bar (or `Eclipse` on...
20,778
[ { "from": "human", "value": "One of the few annoying things about the Eclipse Java plug-in is the absence of a keyboard shortcut to build the project associated with the current resource. Anyone know how to go about it?\n" }, { "from": "gpt", "value": "In Eclipse, while there isn’t a built-in k...
I'm starting a project which requires reading outlook msg files in c#. I have the specs for compound documents but am having trouble reading them in c#. Any pointers would be greatly appreciated. Thanks.
Reading Outlook `.msg` files (which are in the Compound File Binary Format) in C# can be challenging, but there are several libraries that can help you with this. Here are a few approaches you might consider: ### 1. **Using a Third-Party Library** There are libraries specifically designed to read `.msg` files. Some p...
18,589
[ { "from": "human", "value": "I'm starting a project which requires reading outlook msg files in c#. I have the specs for compound documents but am having trouble reading them in c#. Any pointers would be greatly appreciated.\nThanks.\n" }, { "from": "gpt", "value": "Reading Outlook `.msg` file...
I have built an application in C# that I would like to be optimized for multiple cores. I have some threads, should I do more? Updated for more detail C# 2.0 Run on Windows Vista and Windows Server 2003 Updated again This code is running as a service I do not want to have the complete code... my goal here is to get ...
Optimizing a C# application for multi-core processing is an excellent way to improve performance, especially when dealing with tasks that can be parallelized. Here are some strategies you can consider, given your environment and constraints: ### 1. **Utilize Thread Pooling** Instead of manually creating and managing t...
15,454
[ { "from": "human", "value": "I have built an application in C# that I would like to be optimized for multiple cores. I have some threads, should I do more?\nUpdated for more detail\n\nC# 2.0\nRun on Windows Vista and Windows Server 2003\n\nUpdated again\n\nThis code is running as a service\nI do not want to...
For example, I'm writing tests against a CsvReader. It's a simple class that enumerates and splits rows of text. Its only raison d'être is ignoring commas within quotes. It's less than a page. By "black box" testing the class, I've checked things like What if the file doesn't exist? What if I don't have permission ...
It sounds like you are grappling with the distinction between black-box and glass-box (or white-box) testing, and you're right to consider how to apply these approaches effectively to your `CsvReader` class. ### Understanding the Testing Approaches 1. **Black-Box Testing**: This approach tests the functionality of th...
19,559
[ { "from": "human", "value": "For example, I'm writing tests against a CsvReader. It's a simple class that enumerates and splits rows of text. Its only raison d'être is ignoring commas within quotes. It's less than a page.\nBy \"black box\" testing the class, I've checked things like\n\nWhat if the file d...
How do most people handle updating ASP.NET applications running in a webfarm? I am having the problem that because the app is in use and the request affitnity is not sticky, when we push the update users run into errors as the process requests the request might be handled by the wrong version of the application. How d...
Updating ASP.NET applications running in a web farm can be challenging, especially when you want to minimize downtime while avoiding issues related to mismatched application versions. Here are several strategies to handle updates in a web farm environment effectively: ### 1. **Blue-Green Deployment:** - **Overview:...
14,750
[ { "from": "human", "value": "How do most people handle updating ASP.NET applications running in a webfarm? I am having the problem that because the app is in use and the request affitnity is not sticky, when we push the update users run into errors as the process requests the request might be handled by th...
I have two scripts that often need to be run with the same parameter: $ populate.ksh 9241 && check.ksh 9241 When I need to change the parameter (9241 in this example), I can go back and edit the line in history. But since I need to change the number in two places, I sometimes make a typo. I'd like to be able to chan...
You can achieve this in several ways. Here are a couple of approaches you could consider for managing parameters more effectively in your shell scripts: ### Option 1: Use a Variable You can assign the parameter to a variable, which you then use in your commands. This way, you only need to change it in one place. ```...
19,205
[ { "from": "human", "value": "I have two scripts that often need to be run with the same parameter:\n$ populate.ksh 9241 && check.ksh 9241\n\nWhen I need to change the parameter (9241 in this example), I can go back and edit the line in history. But since I need to change the number in two places, I sometim...
I am taking my first steps programming in Lua and get this error when I run my script: attempt to index upvalue 'base' (a function value) It's probably due to something very basic that I haven't grasped yet, but I can't find any good information about it when googling. Could someone explain to me what it means?
The error message you're encountering, "attempt to index upvalue 'base' (a function value)", typically indicates that you're trying to access a field or property on a value that is actually a function, rather than a table (or a userdata) as you might expect. In Lua, upvalues are variables that are accessible within a ...
19,952
[ { "from": "human", "value": "I am taking my first steps programming in Lua and get this error when I run my script:\nattempt to index upvalue 'base' (a function value)\n\nIt's probably due to something very basic that I haven't grasped yet, but I can't find any good information about it when googling. Could...
I'm using Crystal Reports 9.0. It has a subreport which is shared by 2 master reports. I modified the subreport as a result of fixing one of the master reports. When I try to re-import that subreport into my 2nd Master report I'm getting the error: Access denied then Re-importing the subreport failed. Does anyone kn...
It sounds like you are experiencing some issues with the subreport import process in Crystal Reports 9.0. Here are some steps and considerations to help troubleshoot and potentially resolve the issue: 1. **Check File Permissions**: Even though you mentioned that the reports are checked out, it’s important to ensure th...
18,497
[ { "from": "human", "value": "I'm using Crystal Reports 9.0. It has a subreport which is shared by 2 master reports. I modified the subreport as a result of fixing one of the master reports. When I try to re-import that subreport into my 2nd Master report I'm getting the error: Access denied then Re-impor...
I need to print out data into a pre-printed A6 form (1/4 the size of a landsacpe A4). I do not need to print paragraphs of text, just short lines scattered about on the page. All the stuff on MSDN is about priting paragraphs of text. Thanks for any help you can give, Roberto
Printing on a pre-printed form requires a bit of precision to ensure that your text aligns correctly with the existing layout. Below are some steps and example code using C# and the `System.Drawing` namespace, which can help you print short lines of text at specific locations on your A6 form. ### Steps to Print on A6 ...
11,089
[ { "from": "human", "value": "I need to print out data into a pre-printed A6 form (1/4 the size of a landsacpe A4). I do not need to print paragraphs of text, just short lines scattered about on the page.\nAll the stuff on MSDN is about priting paragraphs of text. \nThanks for any help you can give,\nRoberto...
I have the following code that shows either a bug or a misunderstanding on my part. I sent the same list, but modified over an ObjectOutputStream. Once as [0] and other as [1]. But when I read it, I get [0] twice. I think this is caused by the fact that I am sending over the same object and ObjectOutputStream must b...
The behavior you are observing is indeed related to how Java's serialization mechanism works, especially with the `ObjectOutputStream`. When you send the same object multiple times, Java's serialization mechanism treats the second write of the same object as a reference to the first one, which results in both reads ret...
18,066
[ { "from": "human", "value": "I have the following code that shows either a bug or a misunderstanding on my part.\nI sent the same list, but modified over an ObjectOutputStream. Once as [0] and other as [1]. But when I read it, I get [0] twice. I think this is caused by the fact that I am sending over the...
I'm doing some research into databases and I'm looking at some limitations of relational DBs. I'm getting that joins of large tables is very expensive, but I'm not completely sure why. What does the DBMS need to do to execute a join operation, where is the bottleneck? How can denormalization help to overcome this expe...
Joining large tables in a relational database management system (RDBMS) can indeed be an expensive operation, primarily due to a combination of factors including data volume, join types, and execution methods. Here’s a breakdown of why joins are costly and how denormalization and other optimization techniques can help....
15,152
[ { "from": "human", "value": "I'm doing some research into databases and I'm looking at some limitations of relational DBs. \nI'm getting that joins of large tables is very expensive, but I'm not completely sure why. What does the DBMS need to do to execute a join operation, where is the bottleneck?\nHow can...
The in-house application framework we use at my company makes it necessary to put every SQL query into transactions, even though if I know that none of the commands will make changes in the database. At the end of the session, before closing the connection, I commit the transaction to close it properly. I wonder if the...
When using SQL transactions, especially in a database like Oracle, there are some important considerations regarding the behavior of transactions, particularly when executing read-only operations. ### Key Points: 1. **Transactions in Oracle**: In Oracle, a transaction is a sequence of SQL statements that Oracle treat...
19,013
[ { "from": "human", "value": "The in-house application framework we use at my company makes it necessary to put every SQL query into transactions, even though if I know that none of the commands will make changes in the database. At the end of the session, before closing the connection, I commit the transact...
I want to be able to track completed downloads served by my glassfish server. I couldn't find a 100% correct solution using servlet life cycle listeners. Does anyone have a better idea?
To track completed downloads served by your GlassFish server, you might consider a few different approaches beyond using servlet lifecycle listeners, which can be complex and may not cover all scenarios. ### Option 1: Use a Filter Using a servlet filter can be a more straightforward approach to track file downloads. ...
14,956
[ { "from": "human", "value": "I want to be able to track completed downloads served by my glassfish server. I couldn't find a 100% correct solution using servlet life cycle listeners.\nDoes anyone have a better idea? \n" }, { "from": "gpt", "value": "To track completed downloads served by your Gl...
Pardon my ASP ignorance, but what's the difference?
It seems like you're asking about ASP, but you didn't specify which aspect or context you're referring to. ASP can mean different things, such as: 1. **ASP (Active Server Pages)**: This is a server-side scripting technology developed by Microsoft for dynamically generating web pages. It allows developers to write serv...
21,929
[ { "from": "human", "value": "Pardon my ASP ignorance, but what's the difference?\n" }, { "from": "gpt", "value": "It seems like you're asking about ASP, but you didn't specify which aspect or context you're referring to. ASP can mean different things, such as:\n\n1. **ASP (Active Server Pages)**...
I have a production server running with the following flag: -XX:+HeapDumpOnOutOfMemoryError Last night it generated a java-38942.hprof file when our server encountered a heap error. It turns out that the developers of the system knew of the flag but no way to get any useful information from it. Any ideas?
When your Java application runs out of memory and generates a heap dump file (like `java-38942.hprof`), it contains a snapshot of the Java heap memory at the time of the OutOfMemoryError. This file can be analyzed to diagnose memory issues such as memory leaks, excessive object retention, and more. Here are some steps ...
18,905
[ { "from": "human", "value": "I have a production server running with the following flag: -XX:+HeapDumpOnOutOfMemoryError\nLast night it generated a java-38942.hprof file when our server encountered a heap error. It turns out that the developers of the system knew of the flag but no way to get any useful inf...
I want to delete a folder that contains thousands of files and folders. If I use Windows Explorer to delete the folder it can take 10-15 minutes (not always, but often). Is there a faster way in Windows to delete folders? Other details: I don't care about the recycle bin. It's an NTFS drive.
If you want to delete a folder and its contents quickly in Windows without worrying about the Recycle Bin, you can use the Command Prompt or PowerShell. Both methods are generally faster than using Windows Explorer for deleting large directories with numerous files and subfolders. ### Method 1: Using Command Prompt 1...
19,136
[ { "from": "human", "value": "I want to delete a folder that contains thousands of files and folders. If I use Windows Explorer to delete the folder it can take 10-15 minutes (not always, but often). Is there a faster way in Windows to delete folders? \nOther details:\n\nI don't care about the recycle bin.\n...
I have a project in subversion, which I'm developing using Eclipse. I did the original checkout from the svn repository from inside Eclipse. All was well for some weeks then for some unknown reason, Eclipse (specifically: subclipse in Ganymede) no longer recognizes my project as being under svn control. The team contex...
In Eclipse, particularly with the Subclipse plugin, the version control information is generally stored in the project's metadata. Here are a few places you can check to help diagnose and potentially fix the issue with your SVN project: 1. **SVN Metadata**: Subclipse stores version control information in a hidden `.sv...
19,185
[ { "from": "human", "value": "I have a project in subversion, which I'm developing using Eclipse. I did the original checkout from the svn repository from inside Eclipse. All was well for some weeks then for some unknown reason, Eclipse (specifically: subclipse in Ganymede) no longer recognizes my project as...
I'm investigating the following java.lang.VerifyError: java.lang.VerifyError: (class: be/post/ehr/wfm/application/serviceorganization/report/DisplayReportServlet, method: getMonthData signature: (IILjava/util/Collection;Ljava/util/Collection;Ljava/util/HashMap;Ljava/util/Collection;Ljava/util/Locale;Lorg/apache/struts/...
The `java.lang.VerifyError` you are experiencing indicates a problem with the bytecode of the class not being verifiable. This can occur due to several reasons. Below are some troubleshooting steps and potential solutions that you can consider: ### Possible Causes and Solutions: 1. **Bytecode Incompatibility**: -...
16,857
[ { "from": "human", "value": "I'm investigating the following java.lang.VerifyError:\njava.lang.VerifyError: (class: be/post/ehr/wfm/application/serviceorganization/report/DisplayReportServlet, method: getMonthData signature: (IILjava/util/Collection;Ljava/util/Collection;Ljava/util/HashMap;Ljava/util/Collec...
I'm a .Net developer and want to get into developing Silverlight applications. I have VS 2008 but wanted to know if I should/need expression blend. What are pros/cons of having blend along side VS?
As a .NET developer interested in Silverlight application development, using both Visual Studio (VS) 2008 and Expression Blend can greatly enhance your development experience, but there are pros and cons to consider. ### Pros of Using Expression Blend with VS 2008: 1. **Design-Driven Development:** - Expression Bl...
16,745
[ { "from": "human", "value": "I'm a .Net developer and want to get into developing Silverlight applications. I have VS 2008 but wanted to know if I should/need expression blend. What are pros/cons of having blend along side VS? \n" }, { "from": "gpt", "value": "As a .NET developer interested i...
What is the best way to maniupulate richtext / *.rtf data in SQL server 2005 / 2008 I have looked at ocx solutions. Maybe creating some CLR stored procs?? The problem is that I have several notes written in richtext that need to be combined for ease of reporting. Like SELECT @Notes = @Notes + RTFColumn FROM Notestable ...
Manipulating RTF (Rich Text Format) data directly in SQL Server can be a bit challenging since SQL Server doesn't natively understand RTF syntax. If you need to combine multiple RTF notes stored in a SQL Server database, you have several options. Below, I'll outline a few methods including using SQL CLR stored procedur...
15,180
[ { "from": "human", "value": "What is the best way to maniupulate richtext / *.rtf data in SQL server 2005 / 2008\nI have looked at ocx solutions. Maybe creating some CLR stored procs??\nThe problem is that I have several notes written in richtext that need to be combined for ease of reporting.\nLike\nSELECT...
What are the differences in implementing interfaces implicitly and explicitly in C#? When should you use implicit and when should you use explicit? Are there any pros and/or cons to one or the other? Microsoft's official guidelines (from first edition Framework Design Guidelines) states that using explicit implementat...
In C#, interfaces can be implemented in two ways: **implicitly** and **explicitly**. Each method has its own characteristics, use cases, advantages, and disadvantages. Let's explore the differences and when to use each approach. ### Implicit Implementation **Definition**: When you implement an interface implicitly, y...
11,573
[ { "from": "human", "value": "What are the differences in implementing interfaces implicitly and explicitly in C#?\nWhen should you use implicit and when should you use explicit?\nAre there any pros and/or cons to one or the other?\n\nMicrosoft's official guidelines (from first edition Framework Design Guide...
I'm writing a library which is to be dynamically loaded in C++. I'd like to read argc and argv (for debugging reasons) from within my code, however I do not have access to the main function. Is there any way to retrieve the command line (both Windows and Linux solution would be nice). Thanks, Dan
In C++, if you're writing a dynamically loaded library (shared library or DLL), you don't have direct access to `argc` and `argv` as you would in a typical `main()` function. However, there are platform-specific ways to retrieve command line arguments both on Windows and Linux. ### For Linux On Linux, you can access ...
17,223
[ { "from": "human", "value": "I'm writing a library which is to be dynamically loaded in C++. \nI'd like to read argc and argv (for debugging reasons) from within my code, however I do not have access to the main function. Is there any way to retrieve the command line (both Windows and Linux solution would b...
I am learning and using Emacs. What I found annoying is that Ctrl-Space input will be stolen by Windows XP to switch the language bar instead of setting the mark in Emacs. The "language bar" is the native input languages selection such as Chinese keyboard other than English keyboard. Is there a way to temporarily pr...
It seems that you are encountering a common issue with keyboard shortcuts in Windows XP that conflict with Emacs. While you've already disabled the language bar from the Regional and Language Options, you can try a few additional methods to manage this behavior: ### Method 1: Change Language Switching Hotkey 1. **Acc...
18,551
[ { "from": "human", "value": "I am learning and using Emacs. What I found annoying is that Ctrl-Space input will be stolen by Windows XP to switch the language bar instead of setting the mark in Emacs. The \"language bar\" is the native input languages selection such as Chinese keyboard other than English ...
It appears that in PHP objects are passed by reference. Even assignment operators do not appear to be creating a copy of the Object. Here's a simple, contrived proof: <?php class A { public $b; } function set_b($obj) { $obj->b = "after"; } $a = new A(); $a->b = "before"; $c = $a; //i would especially expect thi...
In PHP, objects are indeed passed by reference, meaning that if you assign an object to another variable, both variables will refer to the same object in memory. Consequently, changes made to the object through one variable will be reflected when accessing the object through another variable. In your code example, whe...
19,017
[ { "from": "human", "value": "It appears that in PHP objects are passed by reference. Even assignment operators do not appear to be creating a copy of the Object.\nHere's a simple, contrived proof:\n<?php\n\nclass A {\n public $b;\n}\n\n\nfunction set_b($obj) { $obj->b = \"after\"; }\n\n$a = new A();\n$a-...
I have a .net 2.0 ascx control with a start time and end time textboxes. The data is as follows: txtStart.Text = 09/19/2008 07:00:00 txtEnd.Text = 09/19/2008 05:00:00 I would like to calculate the total time (hours and minutes) in JavaScript then display it in a textbox on the page.
To calculate the total time difference between two datetime strings in JavaScript, you can follow these steps: 1. Parse the datetime strings into `Date` objects. 2. Calculate the difference in milliseconds. 3. Convert that difference into hours and minutes. 4. Display the result in a textbox. Below is a sample JavaSc...
16,397
[ { "from": "human", "value": "I have a .net 2.0 ascx control with a start time and end time textboxes. The data is as follows: \ntxtStart.Text = 09/19/2008 07:00:00\ntxtEnd.Text = 09/19/2008 05:00:00\nI would like to calculate the total time (hours and minutes) in JavaScript then display it in a textbox on t...