instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
As the local subversion czar i explain to everyone to keep only source code and non-huge text files in the repository, not huge binary data files. Smaller binary files that are parts of tests, maybe. Unfortunately i work with humans! Someone is likely to someday accidentally commit a 800MB binary hulk. This slows...
You're correct that in Subversion (SVN), once a file is committed to the repository, it remains in the history even if you later remove it. However, there are ways to permanently delete a file from the repository to reduce its size. Here are a couple of options to consider: ### 1. Using `svnadmin` to Modify History W...
12,420
[ { "from": "human", "value": "As the local subversion czar i explain to everyone to keep only source code and non-huge text files in the repository, not huge binary data files. Smaller binary files that are parts of tests, maybe. \nUnfortunately i work with humans! Someone is likely to someday accidenta...
I know the #warning directive does not exist in vb.net... is there anything like it? I want to be able to throw messages (warnings) at compiler time.
In VB.NET, there isn't a direct equivalent to the C# `#warning` directive that generates compiler warnings. However, you can achieve a similar effect using the `#If DEBUG` preprocessor directive combined with `Throw New Exception` for runtime warnings. For compile-time warnings, the common approach is to use the `Opti...
24,719
[ { "from": "human", "value": "I know the #warning directive does not exist in vb.net... is there anything like it?\nI want to be able to throw messages (warnings) at compiler time.\n" }, { "from": "gpt", "value": "In VB.NET, there isn't a direct equivalent to the C# `#warning` directive that gene...
We have inherited VB6 dll which we need to make changes to. We have the code but don't have VB6 compiler. How can we rebuild the dll? Where can we download the VB6 environment/compiler from? Thanks in advance.
Visual Basic 6 (VB6) is an older programming environment, and while it is not officially available for download from Microsoft anymore, there are a few options you can consider: 1. **Legacy Installation**: If you or someone in your organization has an old copy of the Visual Basic 6 installation media (CD or ISO), you ...
23,363
[ { "from": "human", "value": "We have inherited VB6 dll which we need to make changes to. We have the code but don't have VB6 compiler. How can we rebuild the dll? Where can we download the VB6 environment/compiler from?\nThanks in advance.\n" }, { "from": "gpt", "value": "Visual Basic 6 (VB6) is...
I need to convert a bunch of files to utf-8 in Python, and I have trouble with the "converting the file" part. I'd like to do the equivalent of: iconv -t utf-8 $file > converted/$file # this is shell code Thanks!
You can achieve the same functionality in Python using the `open()` function to read and write files with different encodings. Below is a simple script that converts a bunch of files to UTF-8 encoding: ```python import os def convert_to_utf8(input_file, output_file): # Open the input file with the current encodin...
21,623
[ { "from": "human", "value": "I need to convert a bunch of files to utf-8 in Python, and I have trouble with the \"converting the file\" part.\nI'd like to do the equivalent of:\niconv -t utf-8 $file > converted/$file # this is shell code\n\nThanks!\n" }, { "from": "gpt", "value": "You can achiev...
How do I run a .jar executable java file from outside NetBeans IDE? (Windows Vista). My project has a .jar file created by Netbeans. We'd like to run it. Either: how do we run the file or how do we create a 'proper' executable file in NetBeans 6.1?
To run a `.jar` executable Java file from outside NetBeans IDE on Windows Vista, follow these steps: ### Step 1: Ensure Java is Installed First, make sure you have Java installed on your machine. You can check this by opening a command prompt and typing: ```bash java -version ``` If Java is installed, you will see t...
22,457
[ { "from": "human", "value": "How do I run a .jar executable java file from outside NetBeans IDE? (Windows Vista). My project has a .jar file created by Netbeans. We'd like to run it. Either: how do we run the file or how do we create a 'proper' executable file in NetBeans 6.1?\n" }, { "from": "gp...
I have a script that slides a div down from behind the menu, when people click on the tab. However its in jquery and I want to use mootools (lots of reasons I wont go into here). However im stuck with mootools 1.1 at present. But for some reason my attempt is not working :( The html print("code sample"); <div id="pa...
It looks like you're on the right track with your MooTools code, but there are a few adjustments you can make to ensure it works correctly with MooTools 1.1. Here's a corrected version of your MooTools script: ```html <script type="text/javascript"> window.addEvent('domready', function(){ // Initialize the Fx.Sli...
24,010
[ { "from": "human", "value": "I have a script that slides a div down from behind the menu, when people click on the tab. However its in jquery and I want to use mootools (lots of reasons I wont go into here). However im stuck with mootools 1.1 at present. But for some reason my attempt is not working :(\nThe...
I have a table that looks like that: The rows are sorted by CLNDR_DATE DESC. I need to find a CLNDR_DATE that corresponds to the highlighted row, in other words: Find the topmost group of rows WHERE EFFECTIVE_DATE IS NOT NULL, and return the CLNR_DATE of a last row of that group. Normally I would open a cursor and cyc...
Yes, you can achieve this with a single SQL query using the `MAX` function in conjunction with a `WHERE` clause that filters out the rows based on the condition of `EFFECTIVE_DATE` being NOT NULL. Assuming your table is called `your_table`, you can use the following SQL statement: ```sql SELECT MAX(CLNDR_DATE) AS Last...
22,920
[ { "from": "human", "value": "I have a table that looks like that:\n\nThe rows are sorted by CLNDR_DATE DESC.\nI need to find a CLNDR_DATE that corresponds to the highlighted row, in other words:\nFind the topmost group of rows WHERE EFFECTIVE_DATE IS NOT NULL,\nand return the CLNR_DATE of a last row of that...
What I want to do is set the focus to a specific control (specifically a TextBox) on a tab page when that tab page is selected. I've tried to call Focus during the Selected event of the containing tab control, but that isn't working. After that I tried to call focus during the VisibleChanged event of the control itself...
Setting focus to a specific control (like a TextBox) on a tab page in a tab control can sometimes be tricky, especially with timing issues related to the controls being rendered and being able to receive focus. When a tab page is selected, there can be a slight delay before the controls become visible and ready to rece...
20,202
[ { "from": "human", "value": "What I want to do is set the focus to a specific control (specifically a TextBox) on a tab page when that tab page is selected.\nI've tried to call Focus during the Selected event of the containing tab control, but that isn't working. After that I tried to call focus during the ...
If I create classes, that are used at the moment only in a single thread, should I make them thread-safe, even if I don't need that at the moment? It could be happen, that I later use this class in multiple threads, and at that time I could get race conditions and may have a hard time to find them if I didn't made the ...
Your question touches on a key design decision in software engineering, especially in multi-threaded environments. Here are several considerations and recommendations that can help you make an informed decision about thread safety for your classes. ### 1. **Design for Future Use Cases** - **Anticipate Change**: While ...
23,580
[ { "from": "human", "value": "If I create classes, that are used at the moment only in a single thread, should I make them thread-safe, even if I don't need that at the moment? It could be happen, that I later use this class in multiple threads, and at that time I could get race conditions and may have a har...
I need a programmatic way of creating a SQL Server ODBC Data Source. I can do this by directly accessing the Registry. It would be better if this could be done via an available (SQL Server/Windows) API to protect against changes in the registry keys or values with updated SQL Server drivers. Accepted Answer Note: Using...
To create an ODBC Data Source for SQL Server programmatically, the preferred method is indeed to use the `SQLConfigDataSource` function from the ODBC API, which abstracts away the complexity of directly manipulating the registry. This provides a more robust and future-proof solution since it relies on the ODBC API to h...
20,593
[ { "from": "human", "value": "I need a programmatic way of creating a SQL Server ODBC Data Source. I can do this by directly accessing the Registry. It would be better if this could be done via an available (SQL Server/Windows) API to protect against changes in the registry keys or values with updated SQL Se...
I have a PHP form (mortgage app) that is about 400 fields, traffic on the site will be low. What is the ideal Session size for 400 fields going into a MySQL db? In php.ini what do I set? Anything I should set that I am missing?
When dealing with a PHP form that has a large number of fields, like a mortgage application with 400 fields, it's important to configure your PHP settings appropriately, especially concerning session handling and data size. Below are some recommendations for setting your PHP environment and some considerations for hand...
21,186
[ { "from": "human", "value": "I have a PHP form (mortgage app) that is about 400 fields, traffic on the site will be low.\nWhat is the ideal Session size for 400 fields going into a MySQL db?\nIn php.ini what do I set?\nAnything I should set that I am missing?\n" }, { "from": "gpt", "value": "Whe...
I'm sorry, but this keyword doesn't mean anything to me... Can someone give me a definition? Thanks in advance...
Of course! I'd be happy to help you with a definition. However, it seems like you haven't mentioned the specific keyword you need help with. Could you please provide the keyword you're curious about?
28,387
[ { "from": "human", "value": "I'm sorry, but this keyword doesn't mean anything to me... Can someone give me a definition?\nThanks in advance...\n" }, { "from": "gpt", "value": "Of course! I'd be happy to help you with a definition. However, it seems like you haven't mentioned the specific keywor...
I'm trying to teach myself how to use Modern Persistence Patterns (OR/M, Repository, etc) and development practices (TDD, etc). Because the best way (for me) to learn is by doing, I'd like to build some sort of demo application for myself. The problem is, I've got no idea what sort of application to build. I'd like to...
That sounds like a great endeavor! Building a demo application while learning Modern Persistence Patterns and development practices can provide valuable insights and experiences. Here are some project ideas that might inspire you: 1. **Personal Finance Tracker**: - Build an application where users can track their i...
22,792
[ { "from": "human", "value": "I'm trying to teach myself how to use Modern Persistence Patterns (OR/M, Repository, etc) and development practices (TDD, etc). \nBecause the best way (for me) to learn is by doing, I'd like to build some sort of demo application for myself. The problem is, I've got no idea what...
I have a Rails 2.0.2 application running with a postgresql db. The machine will receive data on a TCP port. I already have coded a working ruby multithreaded tcp server to receive the requests, but I need this code to run alongside my Rails app. So I guess I need to know how to span a new process inside Rails, or how t...
To integrate your multithreaded TCP server with a Rails 2.0.2 application, you can utilize a background thread or a separate process. Below are both approaches to help you get started. ### Approach 1: Running a Background Thread within Rails You can create a background thread in an initializer. This will allow you to...
12,668
[ { "from": "human", "value": "I have a Rails 2.0.2 application running with a postgresql db. The machine will receive data on a TCP port. I already have coded a working ruby multithreaded tcp server to receive the requests, but I need this code to run alongside my Rails app.\nSo I guess I need to know how to...
So, bitfields. Specifically, large bitfields. I understand how to manipulate individual values in a bitfield, but how would I go about doing this on a large set, such as say: uint[] bitfield = new uint[4] { 0x0080000, 0x00FA3020, 0x00C8000, 0x0FF00D0 }; The specific problem I'm having is doing left and right shifts th...
To manipulate large bitfields that span multiple `uint` elements, you generally need to handle the carrying of bits between elements explicitly, as you've started to do in your provided algorithm. There aren't built-in methods specifically designed for this in most programming languages, including C#, but your approach...
17,401
[ { "from": "human", "value": "So, bitfields. Specifically, large bitfields. I understand how to manipulate individual values in a bitfield, but how would I go about doing this on a large set, such as say:\nuint[] bitfield = new uint[4] { 0x0080000, 0x00FA3020, 0x00C8000, 0x0FF00D0 };\n\nThe specific problem ...
I need to, preferably in C# - but c++ will do, find a way to filter the list of printers in the windows print dialog for any windows printing. I have come across WinAPIOverride and have figured I am going to have to write my own dll which overrides the method to get the printers list, then filter it and return it. I wo...
Filtering the list of printers in the Windows print dialog can indeed be quite complex since it involves hooking into low-level system calls. Here's a high-level overview of your options, along with some practical considerations. ### Option 1: Using WinAPI Hooks with a DLL Injection While you mentioned you've explore...
14,211
[ { "from": "human", "value": "I need to, preferably in C# - but c++ will do, find a way to filter the list of printers in the windows print dialog for any windows printing.\nI have come across WinAPIOverride and have figured I am going to have to write my own dll which overrides the method to get the printer...
What type of exception is caught by the beanshell catch(ex): Exception or Throwable?. Example: try { .... } catch (ex) { }
In BeanShell, the catch statement can catch exceptions of type `Exception` or any subclass of `Exception`, but it does not directly catch `Throwable`, which is the superclass of all errors and exceptions in Java. When you write a catch block like this: ```java try { // code that may throw an exception } catch (ex...
24,392
[ { "from": "human", "value": "What type of exception is caught by the beanshell catch(ex): Exception or Throwable?.\nExample:\ntry {\n .... } catch (ex) { }\n\n" }, { "from": "gpt", "value": "In BeanShell, the catch statement can catch exceptions of type `Exception` or any subclass of `Exc...
These for-loops are among the first basic examples of formal correctness proofs of algorithms. They have different but equivalent termination conditions: 1 for ( int i = 0; i != N; ++i ) 2 for ( int i = 0; i < N; ++i ) The difference becomes clear in the postconditions: The first one gives the strong guarantee t...
In the context of the two for-loop constructs you provided, the first termination condition (`i != N`) is generally preferred for several reasons: 1. **Strong Termination Guarantee**: As you mentioned, the first loop guarantees that `i == N` at the end of the loop. This strong postcondition can provide clearer and mor...
20,522
[ { "from": "human", "value": "These for-loops are among the first basic examples of formal correctness proofs of algorithms. They have different but equivalent termination conditions:\n1 for ( int i = 0; i != N; ++i )\n\n2 for ( int i = 0; i < N; ++i )\n\nThe difference becomes clear in the postcondition...
Which types of objects fall into the domain of "subscriptable"?
In programming, particularly in languages like Python, "subscriptable" refers to objects that support indexing or slicing, which allows you to access their elements using square brackets (`[]`). Here are some common types of subscriptable objects: 1. **Lists**: A list is an ordered collection of items, and you can acc...
21,955
[ { "from": "human", "value": "Which types of objects fall into the domain of \"subscriptable\"?\n" }, { "from": "gpt", "value": "In programming, particularly in languages like Python, \"subscriptable\" refers to objects that support indexing or slicing, which allows you to access their elements u...
Long winded title, short question: If one wants to develop for Windows but not have to rely on any external dependency (no runtime, thus ruling out .net), what supported, alive and fully functioning* alternatives are there? Visual Basic 6 is dead, Visual C++ is obvious and Delphi seems to be the prime choice for that, ...
If you're looking for options to develop for Windows without relying on external dependencies like .NET, and want to use languages and frameworks that are alive, supported, and capable of utilizing Windows features directly, here are some alternatives: 1. **C/C++ with Win32 API**: - Using native C or C++, you can ...
21,889
[ { "from": "human", "value": "Long winded title, short question:\nIf one wants to develop for Windows but not have to rely on any external dependency (no runtime, thus ruling out .net), what supported, alive and fully functioning* alternatives are there?\nVisual Basic 6 is dead, Visual C++ is obvious and Del...
I have the following before_filter: def find_current_membership respond_to do |wants| wants.html { @current_membership = @group.memberships.for(@current_user) } wants.rss {} wants.js { @current_membership = @group.memberships.for(@current_user) } end end I would like to share the code ...
In your scenario, since you're trying to share the logic for handling both HTML and JS requests, and since `wants.all` does not exist in Rails' respond_to mechanism, one straightforward approach would indeed be to extract the common logic into a separate method. However, you can also simplify it slightly while avoiding...
25,589
[ { "from": "human", "value": "I have the following before_filter:\n def find_current_membership\n respond_to do |wants|\n wants.html { @current_membership = @group.memberships.for(@current_user) }\n wants.rss {}\n wants.js { @current_membership = @group.memberships.for(@current_user) }\...
Is there a way to hide the text limit line in netbeans 6.5?
In NetBeans 6.5, the line that indicates the text limit (often referred to as the "hard limit" or "soft limit") is a visual aid to help developers maintain consistent line lengths, usually for readability and code standards. To hide or change the appearance of the text limit line in NetBeans 6.5, you would typically f...
20,335
[ { "from": "human", "value": "Is there a way to hide the text limit line in netbeans 6.5?\n" }, { "from": "gpt", "value": "In NetBeans 6.5, the line that indicates the text limit (often referred to as the \"hard limit\" or \"soft limit\") is a visual aid to help developers maintain consistent lin...
I'm trying to call the SQL statement below but get the following error: System.Data.SqlClient.SqlException: Conversion failed when converting the varchar value '+@buildingIDs+' to data type int. @"SELECT id, startDateTime, endDateTime FROM tb_bookings WHERE buildingID IN ('+@buildingIDs+') AND startD...
The error you're encountering occurs because you're trying to construct a SQL query that includes a varchar value (in this case, the string `'+@buildingIDs+'`), but `buildingID` is an integer column in the database. The way you are concatenating the string for the SQL query is incorrect, and it is leading to a syntax e...
21,349
[ { "from": "human", "value": "I'm trying to call the SQL statement below but get the following error:\n\nSystem.Data.SqlClient.SqlException: Conversion failed when converting\n the varchar value '+@buildingIDs+' to data type int.\n\n@\"SELECT id, startDateTime, endDateTime \n FROM tb_bookings \n WHERE ...
In the early days of C++ when it was bolted on top of C, you could not use NULL as it was defined as (void*)0. You could not assign NULL to any pointer other than void*, which made it kind of useless. Back in those days, it was accepted that you used 0 (zero) for null pointers. To this day, I have continued to use zero...
The debate between using `0` and `NULL` (or `nullptr` in modern C++) as null pointer constants has been a longstanding one in C++ programming. Here are some points that outline the considerations for both sides: ### Using `0`: 1. **Simplicity**: Using `0` is straightforward and clearly conveys the intent of a null poi...
23,110
[ { "from": "human", "value": "In the early days of C++ when it was bolted on top of C, you could not use NULL as it was defined as (void*)0. You could not assign NULL to any pointer other than void*, which made it kind of useless. Back in those days, it was accepted that you used 0 (zero) for null pointers.\...
I have three tables, A, B, C, where A is many to one B, and B is many to one C. I'd like a list of all C's in A. My tables are something like this: A[id, valueA, lookupB], B[id, valueB, lookupC], C[id, valueC]. I've written a query with two nested SELECTs, but I'm wondering if it's possible to do INNER JOIN with DISTI...
Yes, you can achieve the same result using `INNER JOIN` without the need for subqueries. Given the relationships you described, we can utilize a more efficient query structure. Here’s how you could write the query using `INNER JOIN` while focusing on obtaining distinct values from table C directly: ```sql SELECT DIS...
25,222
[ { "from": "human", "value": "I have three tables, A, B, C, where A is many to one B, and B is many to one C. I'd like a list of all C's in A. \nMy tables are something like this: A[id, valueA, lookupB], B[id, valueB, lookupC], C[id, valueC]. I've written a query with two nested SELECTs, but I'm wondering if...
We have a WPF XBAP application that we want to change the configuration on the server after it is deployed. Since the config file is embedded in the deployment files, how is this possible? For example, we want to change the database connection strings the deployed app is connected to or we want to update the WCF servi...
Changing the configuration of a deployed WPF XBAP application can be tricky since the application's configuration settings are typically embedded within the deployment package. However, there are several approaches you can take to modify your application's settings after deployment without requiring a recompilation. He...
21,675
[ { "from": "human", "value": "We have a WPF XBAP application that we want to change the configuration on the server after it is deployed. Since the config file is embedded in the deployment files, how is this possible?\nFor example, we want to change the database connection strings the deployed app is conne...
Is it possible to implement the Visitor Pattern respecting the Open/Closed Principle, but still be able to add new visitable classes? The Open/Closed Principle states that "software entities (classes, modules, functions, etc.) should be open for extension, but closed for modification". struct ConcreteVisitable1; struct...
Yes, you can implement the Visitor Pattern in such a way that it respects the Open/Closed Principle while allowing the addition of new visitable classes without modifying existing classes. The key is to use a combination of polymorphism and some form of type registration or a generic visitor pattern. One approach is t...
15,122
[ { "from": "human", "value": "Is it possible to implement the Visitor Pattern respecting the Open/Closed Principle, but still be able to add new visitable classes?\nThe Open/Closed Principle states that \"software entities (classes, modules, functions, etc.) should be open for extension, but closed for modif...
foreach($arrayOne as $value){ do function } In the above example, I'd like to pass $arrayOne into a loop, have a function operate that removes some elements of $arrayOne and then have the loop pass over the reduced $arrayOne on the elements that are left until the loop returns false. Recommendations?
You can achieve this by using a loop along with a function that modifies the array while iterating over it. One way to do this is to use a `while` loop, which continues until the loop condition (e.g., returning false) is met. In each iteration, you can call a function that modifies the array and check if any elements a...
23,184
[ { "from": "human", "value": "foreach($arrayOne as $value){\n do function\n}\n\nIn the above example, I'd like to pass $arrayOne into a loop, have a function operate that removes some elements of $arrayOne and then have the loop pass over the reduced $arrayOne on the elements that are left until the loop ...
I'm using a lot of JQuery in a web application that I am building for a client and I want to find an javascript implementation of a modal dialog that is reasonably stable across the following browser set. IE 7+ FF 2+ Chrome and Safari I've tried a couple of jQuery plugins but there always seems to be artifacts in one o...
If you're looking for a stable and reliable modal dialog implementation that works well across a range of older browsers, including IE 7, Firefox 2, Chrome, and Safari, here are a few recommendations: ### 1. **jQuery UI Dialog** One of the most stable options is the dialog component from jQuery UI. It provides a lot o...
18,428
[ { "from": "human", "value": "I'm using a lot of JQuery in a web application that I am building for a client and I want to find an javascript implementation of a modal dialog that is reasonably stable across the following browser set.\nIE 7+\nFF 2+\nChrome and Safari\nI've tried a couple of jQuery plugins bu...
I've seen some Python programmers use the following style fairly consistently (we'll call it style 1): import some_module # Use some_module.some_identifier in various places. For support of this style, you can cite the "explicit is better than implicit" maxim. I've seen other programmers use this style (style 2): from...
Both styles you’ve described have their own strengths and weaknesses, and the choice between them often depends on the specific context of your code and personal/team preferences. Let’s break down the considerations for both styles in more detail: ### Style 1: `import some_module` ```python import some_module # Use s...
20,749
[ { "from": "human", "value": "I've seen some Python programmers use the following style fairly consistently (we'll call it style 1):\nimport some_module\n# Use some_module.some_identifier in various places.\n\nFor support of this style, you can cite the \"explicit is better than implicit\" maxim. I've seen o...
Is there any Win32/MFC API to get the CSIDL_LOCAL_APPDATA for any user that I want (not only the currently logged on one)? Let's say I have a list of users in the form "domain\user" and I want to get a list of their paths - is that possible?
In Win32/MFC, there isn't a direct API that allows you to retrieve the CSIDL_LOCAL_APPDATA (which translates to the local application data folder) for a user that is not currently logged in. The `SHGetFolderPath` function (or its modern counterpart `SHGetKnownFolderPath`) retrieves paths based on the currently logged i...
17,460
[ { "from": "human", "value": "Is there any Win32/MFC API to get the CSIDL_LOCAL_APPDATA for any user that I want (not only the currently logged on one)? Let's say I have a list of users in the form \"domain\\user\" and I want to get a list of their paths - is that possible?\n" }, { "from": "gpt", ...
I am working on a geometry problem that requires finding the intersection of two parabolic arcs in any rotation. I was able to intesect a line and a parabolic arc by rotating the plane to align the arc with an axis, but two parabolas cannot both align with an axis. I am working on deriving the formulas, but I would l...
Finding the intersection of two parabolic arcs can indeed be complex, especially when they are rotated at arbitrary angles. While there may not be a specific resource dedicated solely to this problem, there are several approaches and resources that can help you solve it. 1. **Coordinate Transformation**: The key to so...
23,819
[ { "from": "human", "value": "I am working on a geometry problem that requires finding the intersection of two parabolic arcs in any rotation. I was able to intesect a line and a parabolic arc by rotating the plane to align the arc with an axis, but two parabolas cannot both align with an axis. I am workin...
I am learning LINQ and have a very simple question that I think will help my understand the technology better. How can I find the product of an array of ints? For example, what is the LINQ way to do: int[] vals = { 1, 3, 5 }; return vals[0] * vals[1] * vals[2];
You can use LINQ to find the product of an array of integers by leveraging the `Aggregate` method. The `Aggregate` method applies an accumulator function over a sequence. For your case, you can use it to multiply all the elements of the array together. Here’s how you can do it: ```csharp using System; using System.Li...
26,024
[ { "from": "human", "value": "I am learning LINQ and have a very simple question that I think will help my understand the technology better. How can I find the product of an array of ints?\nFor example, what is the LINQ way to do:\nint[] vals = { 1, 3, 5 };\nreturn vals[0] * vals[1] * vals[2];\n\n" }, { ...
What is currying? How can currying be done in C++? Please Explain binders in STL container?
### What is Currying? Currying is a functional programming technique where a function with multiple arguments is transformed into a series of functions that each take a single argument. In other words, instead of taking all arguments at once, a curried function takes the first argument and returns another function tha...
20,133
[ { "from": "human", "value": "What is currying?\nHow can currying be done in C++?\nPlease Explain binders in STL container?\n" }, { "from": "gpt", "value": "### What is Currying?\n\nCurrying is a functional programming technique where a function with multiple arguments is transformed into a serie...
I have a script which calls mysql_connect() to connect to a MySQL DB. When I run the script in a browser, it works. However, when I run it from a command line I receive the following error: Call to undefined function mysql_connect() This seems completely paradoxical. Anyone have any ideas as how I can run it from the...
The issue you're facing with the `mysql_connect()` function is likely due to the fact that PHP is configured differently when running from the command line (CLI) compared to running through a web server (like Apache or Nginx). Here are a few steps you can take to resolve this issue: 1. **Check PHP Version**: Make sur...
18,879
[ { "from": "human", "value": "I have a script which calls mysql_connect() to connect to a MySQL DB. When I run the script in a browser, it works. However, when I run it from a command line I receive the following error:\nCall to undefined function mysql_connect()\n\nThis seems completely paradoxical. Anyone...
I have a URL, and I'm trying to match it to a regular expression to pull out some groups. The problem I'm having is that the URL can either end or continue with a "/" and more URL text. I'd like to match URLs like this: http://server/xyz/2008-10-08-4 http://server/xyz/2008-10-08-4/ http://server/xyz/2008-10-08-4/123/m...
To construct a regular expression that matches the specified URLs and captures the desired groups, we need to clarify how we want to treat the URL patterns. Specifically, we want to: 1. Match URLs that include a date in the format "YYYY-MM-DD" followed by a dash and a number (e.g., "2008-10-08-4"). 2. Allow URLs that ...
20,892
[ { "from": "human", "value": "I have a URL, and I'm trying to match it to a regular expression to pull out some groups. The problem I'm having is that the URL can either end or continue with a \"/\" and more URL text. I'd like to match URLs like this:\n\nhttp://server/xyz/2008-10-08-4\nhttp://server/xyz/2008...
I'm developing a system that needs to execute Intersystems Cache Terminal Scripts. When I run a routine inside the regular Caché terminal or a telnet terminal, Cache executes the routine until the end with no problems. But when I try to run the same routine, but this time calling the routine within a Caché terminal Scr...
When using InterSystems Caché to execute scripts in a terminal, a few factors can lead to unexpected disconnections, especially when compared to running the same routine directly in the terminal. Here are some possible causes and solutions: ### Possible Causes for Disconnection: 1. **Timeout Settings**: While you ment...
21,789
[ { "from": "human", "value": "I'm developing a system that needs to execute Intersystems Cache Terminal Scripts.\nWhen I run a routine inside the regular Caché terminal or a telnet terminal, Cache executes the routine until the end with no problems. But when I try to run the same routine, but this time calli...
This is the unabashed attempt of a similar C# question. So what are your favorite F# hidden (or not) features? Most of the features I've used so far aren't exactly hidden but have been quite refreshing. Like how trivial it is to overload operators compared to say C# or VB.NET. And Async<T> has helped me shave off some ...
F# is a powerful language with many features that can enhance productivity and code clarity. Here are some of my favorite features, including both common and less commonly highlighted ones: 1. **Pattern Matching**: F# has a robust pattern matching syntax that allows for concise and expressive code. This feature is oft...
19,836
[ { "from": "human", "value": "This is the unabashed attempt of a similar C# question.\nSo what are your favorite F# hidden (or not) features?\nMost of the features I've used so far aren't exactly hidden but have been quite refreshing. Like how trivial it is to overload operators compared to say C# or VB.NET....
I am looking for specific guidelines for when to use Web Services frameworks versus a well-documented custom protocol that communicates using XML over HTTP. I am less concerned about performance than I am about maintainability and ease-of-development both for client-side and server-side code. For example, I can develop...
When deciding whether to use Web Services frameworks (such as SOAP, REST, or GraphQL) or a custom protocol that communicates using XML over HTTP, consider the following features and factors that Web Services bring to the table. The trade-offs between using established frameworks and creating a custom solution can signi...
19,497
[ { "from": "human", "value": "I am looking for specific guidelines for when to use Web Services frameworks versus a well-documented custom protocol that communicates using XML over HTTP.\nI am less concerned about performance than I am about maintainability and ease-of-development both for client-side and se...
I am checking whether the new name already exists or not. Code 1 if(cmbxExistingGroups.Properties.Items.Cast<string>().ToList().Exists(txt => txt==txtNewGroup.Text.Trim())) { MessageBox.Show("already exists.", "Add new group"); } Otherwise I could have written: Code 2 foreach(var str in cmbxExistingGroup...
When comparing the two code snippets you've provided, there are some differences in terms of performance and readability that you might want to consider. ### Code 1 Analysis ```csharp if(cmbxExistingGroups.Properties.Items.Cast<string>().ToList().Exists(txt => txt == txtNewGroup.Text.Trim())) { MessageBox.Show("al...
19,333
[ { "from": "human", "value": "I am checking whether the new name already exists or not.\nCode 1\nif(cmbxExistingGroups.Properties.Items.Cast<string>().ToList().Exists(txt => txt==txtNewGroup.Text.Trim())) {\n MessageBox.Show(\"already exists.\", \"Add new group\");\n }\n\nOtherwise I could have w...
I work on a small web team where I am the only .NET developer currently using Visual Studio 2008 Professional to build and maintain a few web applications. I am about to start training another member of our team so we purchased him a copy of Visual Studio 2008 Professional. I've looked into Visual Source Safe, but I'm...
Given your requirements for a source control system that integrates with Visual Studio 2008, works well with SQL Server 2005, and is Windows-based, here are a few options you can consider: 1. **Team Foundation Server (TFS)**: - TFS is a comprehensive solution from Microsoft that integrates well with Visual Studio. ...
19,350
[ { "from": "human", "value": "I work on a small web team where I am the only .NET developer currently using Visual Studio 2008 Professional to build and maintain a few web applications. I am about to start training another member of our team so we purchased him a copy of Visual Studio 2008 Professional. I'v...
I am considering creating some JSP-tags that will always give the same output. For example: <foo:bar>baz</foo:bar> Will always output: <div class="bar">baz</div> Is there any way to get a JSP-tag to behave just like static output in the generated servlet? For example: out.write("<div class=\"bar\">"); ... out.write("...
Creating custom JSP tags that behave like static output can be accomplished with "simple" or "static" tags. These are implemented in a straightforward way and can generate HTML without the overhead that comes with a more complex tag handling mechanism. Here’s how you can implement such a tag and ensure it performs effi...
22,687
[ { "from": "human", "value": "I am considering creating some JSP-tags that will always give the same output. For example:\n<foo:bar>baz</foo:bar>\n\nWill always output:\n<div class=\"bar\">baz</div>\n\nIs there any way to get a JSP-tag to behave just like static output in the generated servlet?\nFor example:...
using MVP, what is the normal order of construction and dependency injection. normally you create a presenter for each view and pass the view into the presenter on constructor. But what if you have: A Service that multiple views need to listen to events on. Multiple views all pointing to the same data model cache. c...
In the Model-View-Presenter (MVP) pattern, the structure of the application is designed to separate concerns, with each component serving a specific purpose. Here’s a flow of information from a user click to receiving data from a service in a setup where multiple views may share a service and a data model cache. ### C...
17,539
[ { "from": "human", "value": "using MVP, what is the normal order of construction and dependency injection.\nnormally you create a presenter for each view and pass the view into the presenter on constructor. But what if you have:\n\nA Service that multiple views need to listen to events on.\nMultiple views ...
I have two NSURLConnections. The second one depends on the content of the first, so handling the data received from the connection will be different for the two connections. I'm just picking up Objective-C and I would like to know what the proper way to implement the delegates is. Right now I'm using: NSURL *url=[NSU...
Hi Brian, It's great to see you're getting into Objective-C and working with `NSURLConnection`. To manage multiple connections with different delegate handlers, you can create separate classes for each handler. Each of these classes would implement the `NSURLConnectionDelegate` methods needed for handling the respecti...
19,714
[ { "from": "human", "value": "I have two NSURLConnections. The second one depends on the content of the first, so handling the data received from the connection will be different for the two connections. \nI'm just picking up Objective-C and I would like to know what the proper way to implement the delegates...
This seems like the most basic question in the world, but damned if I can find an answer. Is there a keyboard shortcut, either native to Visual Studio or through Code Rush or other third-party plug-in, to wrap the current selection with an HTML tag? I'm tired of typing the opening tag, cutting the misplaced closing tag...
In Visual Studio, wrapping a selection with an HTML tag doesn't have a native keyboard shortcut by default, but there are a few ways to achieve this functionality either through extensions or by creating your own shortcuts. ### Using Extensions 1. **HTML Snippet Pack**: This is an extension available in the Visual St...
21,987
[ { "from": "human", "value": "This seems like the most basic question in the world, but damned if I can find an answer.\nIs there a keyboard shortcut, either native to Visual Studio or through Code Rush or other third-party plug-in, to wrap the current selection with an HTML tag? I'm tired of typing the open...
I have few asynchronous tasks running and I need to wait until at least one of them is finished (in the future probably I'll need to wait util M out of N tasks are finished). Currently they are presented as Future, so I need something like /** * Blocks current thread until one of specified futures is done and returns ...
In Java, there isn't a built-in equivalent of C#'s `WaitHandle.WaitAny()` for `Future` objects, but you've identified several possible workarounds that can help achieve similar functionality. Since you've redesigned your system to allow access to the `Future` creation and added a `CountDownLatch`, you now have a clean ...
20,440
[ { "from": "human", "value": "I have few asynchronous tasks running and I need to wait until at least one of them is finished (in the future probably I'll need to wait util M out of N tasks are finished).\nCurrently they are presented as Future, so I need something like\n/**\n * Blocks current thread until o...
I am getting this error but only very occasionally. 99.9% of the time it works fine: Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints. Does anyone have any idea on what the cause could be? I only use that datatable for viewing and not updating so is ...
The error you are encountering, "Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints," typically occurs when you are working with a DataTable that has constraints defined, such as primary keys, foreign keys, or non-nullable columns. Here are a few possibl...
21,652
[ { "from": "human", "value": "I am getting this error but only very occasionally. 99.9% of the time it works fine:\nFailed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.\nDoes anyone have any idea on what the cause could be? I only use that da...
I need to do some command lines through a browser. What I need to do in a command-line would be: $login <login name> <password> $passwd <old password> <new password> <retype new password> So, how can I do this using the proc_open function? Or should I use another function to do this? Adam Wright, I've tried your exam...
To interact with command-line interfaces from a web application using PHP, `proc_open` is indeed a powerful function. However, managing user credentials (especially passwords) requires careful handling to ensure security. ### Using `proc_open` Here's a basic example of how you can use `proc_open` to run command-line ...
22,321
[ { "from": "human", "value": "I need to do some command lines through a browser.\nWhat I need to do in a command-line would be:\n$login\n<login name>\n<password>\n$passwd\n<old password>\n<new password>\n<retype new password>\n\nSo, how can I do this using the proc_open function?\nOr should I use another fun...
How can I have a dynamic variable setting the amount of rows to return in SQL Server? Below is not valid syntax in SQL Server 2005+: DECLARE @count int SET @count = 20 SELECT TOP @count * FROM SomeTable
In SQL Server 2005 and later, you cannot use a variable directly in the `TOP` clause like you attempted. However, you can achieve the desired behavior using either dynamic SQL or by using a `ROW_NUMBER()` approach in combination with a Common Table Expression (CTE) or a subquery. ### Using Dynamic SQL Dynamic SQL all...
25,174
[ { "from": "human", "value": "How can I have a dynamic variable setting the amount of rows to return in SQL Server? Below is not valid syntax in SQL Server 2005+:\nDECLARE @count int\nSET @count = 20\n\nSELECT TOP @count * FROM SomeTable\n\n" }, { "from": "gpt", "value": "In SQL Server 2005 and l...
I have some C++ source code with templates maybe like this - doxygen runs without errors but none of the documentation is added to the output, what is going on? /// /// A class /// class A { /// /// A typedef /// typedef B<C<D>> SomeTypedefOfTemplates; };
When using Doxygen to generate documentation for C++ code, it is important to ensure that the comments used for documentation are correctly formatted and that the relevant constructs are being documented as expected. In your case, the Doxygen comments appear to be formatted correctly, but there could be a few reasons w...
22,476
[ { "from": "human", "value": "I have some C++ source code with templates maybe like this - doxygen runs without errors but none of the documentation is added to the output, what is going on?\n///\n/// A class\n///\nclass A\n{\n ///\n /// A typedef\n ///\n typedef B<C<D>> SomeTypedefOfTemplates;\n};\n\n" ...
I am looking for a simple, clean, correct XML parser to use in my C++ project. Should I write my own?
Writing your own XML parser can be a complex and time-consuming task, particularly if you want to ensure it handles all the nuances of the XML specification correctly. Instead of creating your own parser, it is generally a better approach to use an existing, well-tested library. Here are a few popular XML parsing libra...
14,315
[ { "from": "human", "value": "I am looking for a simple, clean, correct XML parser to use in my C++ project. Should I write my own?\n" }, { "from": "gpt", "value": "Writing your own XML parser can be a complex and time-consuming task, particularly if you want to ensure it handles all the nuances ...
Backstory: I have a PKCS#12 (p12) certificate with a symmetric cipher (password) that I used OpenSSL to convert to a PEM; opening that as text I see it contains both a BEGIN/END CERTIFICATE section as well as BEGIN/END RSA PRIVATE KEY. The .NET Framework X509Certificate class only supports the "ASN.1 DER" format, so I...
To use a PEM file that contains both a private key and a certificate in a way that retains the private key information when converting to DER format, you will need to convert the private key and the certificate into a single PKCS#12 (p12) file. This PKCS#12 file can then be loaded in .NET and used for SSL connections w...
21,396
[ { "from": "human", "value": "Backstory: I have a PKCS#12 (p12) certificate with a symmetric cipher (password) that I used OpenSSL to convert to a PEM; opening that as text I see it contains both a BEGIN/END CERTIFICATE section as well as BEGIN/END RSA PRIVATE KEY. The .NET Framework X509Certificate class o...
I've never had to do IPC on Windows before. I'm developing a pair of programs, a standard GUI/CLI app, and a windows service. The app has to tell the service what to do. So, assuming the communication is local only, what would be the best communication method for these two processes? By best I mean more robust and less...
For inter-process communication (IPC) on Windows, considering your requirements for robustness and minimizing errors, **Named Pipes** would be an excellent choice. Here are some of the reasons why Named Pipes might be the best option for your specific case: ### Advantages of Named Pipes 1. **Designed for IPC**: Named...
18,233
[ { "from": "human", "value": "I've never had to do IPC on Windows before. I'm developing a pair of programs, a standard GUI/CLI app, and a windows service. The app has to tell the service what to do. So, assuming the communication is local only, what would be the best communication method for these two proce...
How feasible is to change a C/C++ cgi application to Fastcgi? Does this require only change in code? Or will it require a change in the setup of apache server? What will be the obvious benefits of the change? Is the change from cgi to Fastcgi worth the benefits?
Changing a C/C++ CGI application to FastCGI can be a feasible project, but it does require some work both in terms of code changes and server configuration. Here's a detailed overview of the considerations involved, benefits, and whether the transition is worth it. ### Feasibility of Changing CGI to FastCGI 1. **Code...
21,890
[ { "from": "human", "value": "How feasible is to change a C/C++ cgi application to Fastcgi? Does this require only change in code? Or will it require a change in the setup of apache server?\nWhat will be the obvious benefits of the change? Is the change from cgi to Fastcgi worth the benefits?\n" }, { ...
I have a program I've written in VB.NET 2005, it saves statistics in an XML file. I use this program on multiple computers. I'd like to set up a webserver where I can upload my XML file, or just the data, and add it to the server ignoring duplicate entries already on the server. What do I need for to learn for th...
Setting up a web server to manage and store your XML data involves a few key components and technologies. Here's a general guide to get you started: ### 1. **Web Server Setup** You need to set up a web server that can handle requests for uploading and managing your XML file. There are several options available: - **...
22,841
[ { "from": "human", "value": "I have a program I've written in VB.NET 2005, it saves statistics in an XML file. \nI use this program on multiple computers. I'd like to set up a webserver where I can upload my XML file, or just the data, and add it to the server ignoring duplicate entries already on the se...
My AS3-heavy project tests fine in the IDE, but some parts don't work in the browser when published. Any ideas what could be causing this?
When your ActionScript 3 (AS3) project runs fine in the IDE but encounters issues in the browser when published, several factors could be at play. Here are some common causes and suggestions to troubleshoot the issue: 1. **Cross-Domain Policy**: If your project makes network requests (like loading assets or data from ...
22,050
[ { "from": "human", "value": "My AS3-heavy project tests fine in the IDE, but some parts don't work in the browser when published. Any ideas what could be causing this?\n" }, { "from": "gpt", "value": "When your ActionScript 3 (AS3) project runs fine in the IDE but encounters issues in the browse...
The non-virtual interface idiom describes how the virtual methods are nonpublic customisation points, and public methods are nonvirtual to allow the base class to control at all times how the customisation points are called. This is an elegant idiom and I like to use it, but how does it work if the derived class is a ...
The non-virtual interface (NVI) idiom is a design pattern in C++ that promotes encapsulation and allows a base class to manage how its derived classes can customize functionality. This idiom typically involves defining public non-virtual methods in the base class, which internally call protected or private virtual meth...
20,475
[ { "from": "human", "value": "The non-virtual interface idiom describes how the virtual methods are nonpublic customisation points, and public methods are nonvirtual to allow the base class to control at all times how the customisation points are called. \nThis is an elegant idiom and I like to use it, but h...
I'm subclassing a native window (the edit control of a combobox...) oldWndProc = SetWindowLong(HandleOfCbEditControl, GWL_WNDPROC, newWndProc); In my subclassing wndproc, I'll have code like this, right, but I can't figure out the syntax for calling the oldWndProc. int MyWndProc(int Msg, int wParam, int lParam) ...
In the Win32 API, when you subclass a control (like an edit control in a combo box), you're replacing the window procedure (WndProc) for that control with your own function. The original WndProc is saved in a variable (often called `oldWndProc`) which you will call from your custom procedure to ensure that the default ...
20,783
[ { "from": "human", "value": "I'm subclassing a native window (the edit control of a combobox...)\noldWndProc = SetWindowLong(HandleOfCbEditControl, GWL_WNDPROC, newWndProc);\nIn my subclassing wndproc, I'll have code like this, right, but I can't figure out the syntax for calling the oldWndProc.\n int My...
I have a postgres table. I need to delete some data from it. I was going to create a temporary table, copy the data in, recreate the indexes and the delete the rows I need. I can't delete data from the original table, because this original table is the source of data. In one case I need to get some results that depends...
In PostgreSQL, while it doesn't have a direct `CREATE TABLE ... LIKE ... INCLUDING INDEXES` syntax, you can achieve a similar effect by using a combination of commands. Here's a way to create a complete copy of a table including its structure, data, and indexes: 1. **Create a copy of the table structure** (without dat...
19,426
[ { "from": "human", "value": "I have a postgres table. I need to delete some data from it. I was going to create a temporary table, copy the data in, recreate the indexes and the delete the rows I need. I can't delete data from the original table, because this original table is the source of data. In one cas...
What references offer a good summary/tutorial for using RDF/OWL? There seem to be enough tools (Protege, Topbraid, Jena, etc.) that knowing the syntax of the markup languages is not necessary, but knowing the concepts is, of course, still critical. I'm working through the w3c documents (particularly the RDF Primer) ...
Certainly! Understanding RDF (Resource Description Framework) and OWL (Web Ontology Language) concepts is indeed crucial for effectively working with semantic web technologies. Here are several resources that can help you grasp the concepts of RDF and OWL, as well as practical applications and tutorials. ### Books: 1....
21,534
[ { "from": "human", "value": "What references offer a good summary/tutorial for using RDF/OWL? There seem to be enough tools (Protege, Topbraid, Jena, etc.) that knowing the syntax of the markup languages is not necessary, but knowing the concepts is, of course, still critical. \nI'm working through the w3...
Are there any good (and preferably free) code coverage tools out there for Perl?
Yes, there are several good code coverage tools available for Perl, and many of them are free to use. Here are some of the most commonly used options: 1. **Devel::Cover**: This is perhaps the most popular code coverage tool for Perl. It provides detailed reports on which lines of code are executed during testing. Deve...
23,844
[ { "from": "human", "value": "Are there any good (and preferably free) code coverage tools out there for Perl?\n" }, { "from": "gpt", "value": "Yes, there are several good code coverage tools available for Perl, and many of them are free to use. Here are some of the most commonly used options:\n\...
I've been using Programmer's notepad for a while now, I find it to be an amazingly simple tool and I prefer to use it on projects where I know I don't need most of the standard IDE overhead. However, I've recently run into this problem when running the program on Windows Vista. I find that when running the built in "ma...
The issue you're experiencing with Programmer's Notepad (PN) not capturing the output from `make.exe` could be due to several reasons. Here are some troubleshooting steps and potential solutions you can try: 1. **Check Output Capture Settings**: Ensure that the "Capture Output" option is correctly set in Programmer's ...
21,932
[ { "from": "human", "value": "I've been using Programmer's notepad for a while now, I find it to be an amazingly simple tool and I prefer to use it on projects where I know I don't need most of the standard IDE overhead. However, I've recently run into this problem when running the program on Windows Vista.\...
Most Java-XML binding frameworks and code generators need XML Schema Defintions. Can you suggest the best way to generate binding code from DTD. I know that the XJC in JAXB 2 supports DTD but it is considered experimental. In the spirit of Stack Overflow, one suggestion per answer please - to be voted up or down instea...
One effective way to generate binding code from DTD is to use **JAXB with an intermediate conversion** process. Here's a step-by-step approach: 1. **Convert DTD to XML Schema (XSD)**: Use a tool that converts DTD to XSD. There are several tools available for this, such as Trang or xsdgen. This step is crucial as JAXB ...
25,565
[ { "from": "human", "value": "Most Java-XML binding frameworks and code generators need XML Schema Defintions. Can you suggest the best way to generate binding code from DTD.\nI know that the XJC in JAXB 2 supports DTD but it is considered experimental.\nIn the spirit of Stack Overflow, one suggestion per an...
I'm writing a query to summarize some data. I have a flag in the table that is basically boolean, so I need some sums and counts based on one value of it, and then the same thing for the other value, like so: select location ,count(*) ,sum(duration) from my.table where type = 'X' and location = @location an...
To achieve what you're looking for without running into the issues you're facing, and to avoid the error with `count(a.*)` in DB2, it’s better to utilize conditional aggregation instead of joining the same table twice. This way, you can summarize the data for both `type = 'X'` and `type = 'Y'` in a single query while s...
23,921
[ { "from": "human", "value": "I'm writing a query to summarize some data. I have a flag in the table that is basically boolean, so I need some sums and counts based on one value of it, and then the same thing for the other value, like so:\nselect\n location\n ,count(*)\n ,sum(duration)\nfrom my.table\nw...
I have a few batch files I need to run frequently in developing a certain project. I'd like to create a Visual Studio toolbar called "MyProject" and have commands underneath to execute these batch files. What is the easiest way to accomplish this?
Creating a custom toolbar in Visual Studio to run your batch files is a great way to streamline your workflow. Here’s a step-by-step guide on how to achieve this: ### Step 1: Create a Macro (if applicable) Visual Studio has removed support for macros starting with Visual Studio 2013. However, if you're using an older...
21,063
[ { "from": "human", "value": "I have a few batch files I need to run frequently in developing a certain project. I'd like to create a Visual Studio toolbar called \"MyProject\" and have commands underneath to execute these batch files. What is the easiest way to accomplish this?\n" }, { "from": "gpt"...
I am trying to install Subtext in a medium trust level environment (host: Crystaltech) and am getting the following error (see below). I was able to do the administration setup but when it tries to go to the blog for actual use, boom. I know I could "upgrade" the environment to a full trust level but I want to underst...
The error message you're encountering is indicative of a permission issue related to the medium trust level in ASP.NET environments. When running in a medium trust environment, your application has a limited set of permissions, which can cause operations that require higher privileges to fail. ### Understanding Trust ...
20,736
[ { "from": "human", "value": "I am trying to install Subtext in a medium trust level environment (host: Crystaltech) and am getting the following error (see below). I was able to do the administration setup but when it tries to go to the blog for actual use, boom.\nI know I could \"upgrade\" the environment...
I'm having trouble understanding why a WSDL would be so beneficial, when the truth is that the service definition is not that human-readable, and most developers will use automated tools to consume it to generate objects in the application. Why isn't it easier for a service provider to define a simple XML schema, and j...
You're raising some valid points, and many developers share your sentiment about the complexity of WSDL (Web Services Description Language) and SOAP (Simple Object Access Protocol) compared to simpler RESTful APIs. Let's break down the reasons for WSDL's existence and its benefits, as well as some considerations regard...
23,345
[ { "from": "human", "value": "I'm having trouble understanding why a WSDL would be so beneficial, when the truth is that the service definition is not that human-readable, and most developers will use automated tools to consume it to generate objects in the application. Why isn't it easier for a service prov...
We're using Mercurial where I work and I want to have a setup similar to how I used SVN: Trunk Tags Production Branches Since Mercurial supports branches natively, I know how to create a named branch, but I can't find any documentation on how to repeatedly merge 'Trunk' with 'Production'. Quite simply, I want to ...
In Mercurial (Hg), you can manage your branches and merging similarly to how you would in SVN, but with some differences in workflow. Here’s a guide to help you set up and manage a development branch (like your "Trunk") and a production branch while merging changes regularly. ### Setup 1. **Create a Development Branc...
18,641
[ { "from": "human", "value": "We're using Mercurial where I work and I want to have a setup similar to how I used SVN:\n\nTrunk\nTags\n\n\nProduction\n\nBranches\n\nSince Mercurial supports branches natively, I know how to create a named branch, but I can't find any documentation on how to repeatedly merge '...
I'm not a newbie since I've been programming on and off since 1983, but I only have real experience with scripting languages like Applescript, ARexx, HyperTalk and Bash. I write scripts to automate data entry, batch process images and convert file formats. I dabble at Processing, Ruby and Python. Most of the programs I...
Given your background and goals, it's great to see that you are looking to improve your programming practices. Let's address your question about unit tests in the context of writing small to medium-sized procedural scripts. ### Unit Testing in Small Programs 1. **Value of Unit Testing**: - **Early Catching of Bugs...
22,971
[ { "from": "human", "value": "I'm not a newbie since I've been programming on and off since 1983, but I only have real experience with scripting languages like Applescript, ARexx, HyperTalk and Bash.\nI write scripts to automate data entry, batch process images and convert file formats. I dabble at Processin...
Similar to this question, after running the following code the browser dialog does appear with all the correct buttons, but the selection area that usally displays available folders is missing: [void] [Reflection.Assembly]::LoadWithPartialName( 'System.Windows.Forms' ) $d = New-Object Windows.Forms.FolderBrowserDialog ...
When using the `FolderBrowserDialog` in a Windows Forms application, there are certain properties that need to be set in order for the dialog to function correctly. The missing folder selection area may be due to the way the dialog is being instantiated or shown. Below is an example of how to correctly set up and disp...
21,840
[ { "from": "human", "value": "Similar to this question, after running the following code the browser dialog does appear with all the correct buttons, but the selection area that usally displays available folders is missing:\n[void] [Reflection.Assembly]::LoadWithPartialName( 'System.Windows.Forms' )\n$d = Ne...
So I have an Access application, and I'd like some forms to be maximised when they are opened, and others to be medium-sized when they are opened. However, if I try something like this: Private Sub Form_Activate() DoCmd.Maximize End Sub or Private Sub Form_Activate() DoCmd.Restore End Sub it has the effect of ma...
In Microsoft Access, to control the size of individual forms independently when they open, you can use the `Form_Open` event to set the form's window state. This way, you avoid the side effects of maximizing or restoring all open forms. Here's how you can accomplish this: 1. **Maximize a Form:** To maximize a spec...
22,129
[ { "from": "human", "value": "So I have an Access application, and I'd like some forms to be maximised when they are opened, and others to be medium-sized when they are opened. However, if I try something like this:\nPrivate Sub Form_Activate()\n DoCmd.Maximize\nEnd Sub\n\nor\nPrivate Sub Form_Activate()\n...
I've never learnt JavaScript, but I imagine this is quite a simple problem. Just wanted to know which method is most advised these days.
I'd be happy to help! However, you didn't specify the problem you're dealing with. Could you provide more details about what you're trying to accomplish with JavaScript? This way, I can recommend the most suitable methods or practices for your situation.
26,116
[ { "from": "human", "value": "I've never learnt JavaScript, but I imagine this is quite a simple problem. Just wanted to know which method is most advised these days.\n" }, { "from": "gpt", "value": "I'd be happy to help! However, you didn't specify the problem you're dealing with. Could you prov...
Because of several iframes, XUL browser elements, and so forth, I have a number of window objects in my XULRunner application. I'm looking for the best way to find the window object that a specified node belongs to using JavaScript. So, to be more specific, given node x, I need to find the specific window object that c...
In a XULRunner application (which is based on the Mozilla platform), you can find the window object that contains a specific DOM node using the `ownerDocument` property of the node. The `ownerDocument` property returns the document that the node is associated with, and you can then access the `defaultView` property of ...
24,532
[ { "from": "human", "value": "Because of several iframes, XUL browser elements, and so forth, I have a number of window objects in my XULRunner application. I'm looking for the best way to find the window object that a specified node belongs to using JavaScript.\nSo, to be more specific, given node x, I need...
Brief: convert ( -size 585x128 gradient: ) NewImage.png How do I change the above ImageMagick command so it takes the width and height from an existing image? I need it to remain a one line command. Details: I'm trying to programatically create an image reflection using ImageMagick. The effect I am looking for is si...
To modify your ImageMagick command so that it automatically uses the dimensions of an existing image instead of hardcoding them, you can use the `identify` command to get the dimensions and then pass those dimensions dynamically into your `convert` command. However, since you want to keep it a single line command, you...
25,075
[ { "from": "human", "value": "Brief:\nconvert ( -size 585x128 gradient: ) NewImage.png\n\nHow do I change the above ImageMagick command so it takes the width and height from an existing image? I need it to remain a one line command.\n\nDetails:\nI'm trying to programatically create an image reflection using...
I have found that SP2 doesn't execute from within SP1 when SP1 is executed. Below is the structure of SP1: ALTER PROCEDURE SP1 AS BEGIN Declare c1 cursor.... open c1 fetch next from c1 ... while @@fetch_status = 0 Begin ... Fetch Next from c1 end close c1 deallocate c1 exec sp2 end I see non of the PRINT sta...
It seems like you're encountering an issue where the output of `PRINT` statements in stored procedure `SP2` is not displayed when `SP2` is executed from within `SP1`. There are a few things to consider regarding your situation in SQL Server 2005. ### Possible Reasons and Solutions: 1. **Execution Context**: When y...
20,500
[ { "from": "human", "value": "I have found that SP2 doesn't execute from within SP1 when SP1 is executed.\nBelow is the structure of SP1:\nALTER PROCEDURE SP1 AS BEGIN\n\nDeclare c1 cursor....\n\nopen c1 fetch next from c1 ...\n\nwhile @@fetch_status = 0 Begin\n\n...\n\nFetch Next from c1 end\n\nclose c1\n\n...
There is a long running habit here where I work that the connection string lives in the web.config, a Sql Connection object is instantiated in a using block with that connection string and passed to the DataObjects constructor (via a CreateInstance Method as the constructor is private). Something like this: using(SqlCo...
Your instincts about the design you described are valid, and it’s worth exploring best practices when it comes to connection management and the responsibilities of different components in your application architecture. Let's look at some design considerations and the principles of separation of concerns and single resp...
20,717
[ { "from": "human", "value": "There is a long running habit here where I work that the connection string lives in the web.config, a Sql Connection object is instantiated in a using block with that connection string and passed to the DataObjects constructor (via a CreateInstance Method as the constructor is p...
I have looked at some resources already and just want to clarify and get an opinion. First of all to totally avoid any problems we could just not bother using identity columns as primary keys instead have them generated ourselves and just have those values replicated both ways presuming they are always unique at any ti...
Yes, your understanding is correct. When setting up transactional replication with identity columns in a SQL Server environment, you can avoid primary key conflicts by configuring identity ranges for each server. ### Here's how it works: 1. **Identity Ranges**: You allocate specific ranges of identity values to each ...
24,930
[ { "from": "human", "value": "I have looked at some resources already and just want to clarify and get an opinion.\nFirst of all to totally avoid any problems we could just not bother using identity columns as primary keys instead have them generated ourselves and just have those values replicated both ways ...
Once a user starts a session (or logs in, for a registered user, to associate over multiple sessions), their specific page views are followed. The data can then be used in a number of ways from targeted advertisements to email updates to often-visited sections of the site. Would this be wrong, as long as this was noted...
Using session tracking and monitoring user behavior can be ethical and legal, provided you adhere to certain principles and regulations. Here are some key considerations: 1. **Transparency**: You must clearly communicate your data collection practices in your Privacy Policy. Users should understand what data is being ...
23,762
[ { "from": "human", "value": "Once a user starts a session (or logs in, for a registered user, to associate over multiple sessions), their specific page views are followed. The data can then be used in a number of ways from targeted advertisements to email updates to often-visited sections of the site.\nWoul...
I'm getting tired of clearing the Debugging->Exceptions option Break when thrown to get past an exception I handle properly, then setting the Break when thrown option to find the source of a subsequent exception not handled properly. I would like a way to exclude certain try blocks from Break when thrown, with somethin...
In Visual Studio, there isn't a built-in feature that allows you to selectively disable the "Break when thrown" behavior on a per-try block or method basis. However, there are some strategies you can use to mitigate the issue you're experiencing. ### Possible Workarounds 1. **Conditional Compilation**: While you can'...
23,320
[ { "from": "human", "value": "I'm getting tired of clearing the Debugging->Exceptions option Break when thrown to get past an exception I handle properly, then setting the Break when thrown option to find the source of a subsequent exception not handled properly.\nI would like a way to exclude certain try bl...
Given an HTML page that has a complex table-based layout and many tags that are duplicated and wasteful, e.g.: td align="left" class="tableformat" width="65%" style="border-bottom:1px solid #ff9600; border-right:1px solid #ff9600; background-color:#FDD69E" nowrap etc. Are there tools to aide the task of refactoring th...
Refactoring a complex and bloated HTML page can indeed be a daunting task, but there are several tools and strategies that can help streamline the process. Here are some recommendations: ### Tools for Refactoring HTML/CSS 1. **HTML Minifiers and Beautifiers**: - Tools like [HTML Tidy](https://www.w3.org/People/Rag...
17,575
[ { "from": "human", "value": "Given an HTML page that has a complex table-based layout and many tags that are duplicated and wasteful, e.g.:\ntd align=\"left\" class=\"tableformat\" width=\"65%\" style=\"border-bottom:1px solid #ff9600; border-right:1px solid #ff9600; background-color:#FDD69E\" nowrap etc.\n...
I want to write a default structure, N times, to a file, using fwrite. typedef struct foo_s { uint32 A; uint32 B; char desc[100]; }foo_t; void init_file(FILE *fp, int N) { foo_t foo_struct = {0}; foo_struct.A = -1; foo_struct.B = 1; fwrite(&foo_struct, sizeof(foo_struct), N, fp); } The above cod...
To write the `foo_struct` structure N times to a file in a single call to `fwrite`, you can modify the approach slightly. Instead of writing the same instance of `foo_struct` repeatedly, you can create an array of `foo_t` structures and initialize each element in the array before writing them to the file. Here’s how yo...
25,018
[ { "from": "human", "value": "I want to write a default structure, N times, to a file, using fwrite.\ntypedef struct foo_s {\n\n uint32 A;\n uint32 B;\n char desc[100];\n\n}foo_t;\n\nvoid init_file(FILE *fp, int N)\n{\n foo_t foo_struct = {0};\n foo_struct.A = -1;\n foo_struct.B = 1;\n\n fwrite(&foo...
I have to rename a complete folder tree recursively so that no uppercase letter appears anywhere (it's C++ source code, but that shouldn't matter). Bonus points for ignoring CVS and Subversion version control files/folders. The preferred way would be a shell script, since a shell should be available on any Linux box. T...
You can use a simple shell script to recursively rename files and directories in a folder tree, converting all uppercase letters to lowercase while ignoring specific version control directories like `CVS` and `.svn`. Below is a script that accomplishes this task. ```bash #!/bin/bash # Function to rename files and dir...
22,384
[ { "from": "human", "value": "I have to rename a complete folder tree recursively so that no uppercase letter appears anywhere (it's C++ source code, but that shouldn't matter).\nBonus points for ignoring CVS and Subversion version control files/folders. The preferred way would be a shell script, since a she...
I wonder if there's a way to do the following: I have a structure containing a member which is a pointer to a block of memory allocated by the kernel when I pass the structure to an API function (the structure is a WAVEHDR, the member is the reserved field.) I can set a data breakpoint on the value of the reserved memb...
Visual Studio’s macro capabilities, especially in the context of handling breakpoints, have some limitations. However, you can achieve what you want by using Visual Studio's debugging features more programmatically via the Visual Studio DTE (Development Tools Environment) or using the extension model to create custom t...
21,098
[ { "from": "human", "value": "I wonder if there's a way to do the following: I have a structure containing a member which is a pointer to a block of memory allocated by the kernel when I pass the structure to an API function (the structure is a WAVEHDR, the member is the reserved field.)\nI can set a data br...
What business cases are there for using Markov chains? I've seen the sort of play area of a markov chain applied to someone's blog to write a fake post. I'd like some practical examples though? E.g. useful in business or prediction of stock market, or the like... Edit: Thanks to all who gave examples, I upvoted each ...
Markov chains are powerful mathematical models used for predicting a variety of processes that involve probabilistic transitions between states. Here are several practical business use cases where Markov chains can be applied: 1. **Customer Behavior Prediction**: - Markov chains can model customer journeys through ...
18,258
[ { "from": "human", "value": "What business cases are there for using Markov chains? I've seen the sort of play area of a markov chain applied to someone's blog to write a fake post. I'd like some practical examples though? E.g. useful in business or prediction of stock market, or the like...\nEdit: Thanks...
I have written the following simple test in trying to learn Castle Windsor's Fluent Interface: using NUnit.Framework; using Castle.Windsor; using System.Collections; using Castle.MicroKernel.Registration; namespace WindsorSample { public class MyComponent : IMyComponent { public MyComponent(int start_at) {...
The issue you're encountering appears to be related to a mismatch in the versions of the Castle Windsor library and its dependencies. Here are some steps you can take to troubleshoot and resolve the issue: 1. **Verify Library Versions**: Make sure that you are using compatible versions of `Castle.Windsor` and `Castle....
21,639
[ { "from": "human", "value": "I have written the following simple test in trying to learn Castle Windsor's Fluent Interface:\nusing NUnit.Framework;\nusing Castle.Windsor;\nusing System.Collections;\nusing Castle.MicroKernel.Registration;\n\nnamespace WindsorSample {\n public class MyComponent : IMyCompon...
I am new to python and struggling to find how to control the amount of memory a python process can take? I am running python on a Cento OS machine with more than 2 GB of main memory size. Python is taking up only 128mb of this and I want to allocate it more. I tried to search all over the internet on this for last half...
Controlling the memory usage of a Python process directly is not straightforward because Python does not have built-in mechanisms for limiting the amount of memory it can use. The Python interpreter allocates memory as needed based on the operations performed in your script and the objects you create. ### Memory Manag...
22,781
[ { "from": "human", "value": "I am new to python and struggling to find how to control the amount of memory a python process can take? I am running python on a Cento OS machine with more than 2 GB of main memory size. Python is taking up only 128mb of this and I want to allocate it more. I tried to search al...
Are there any existing solutions for remote execution of commands on a windows server from Java natively? psexec.exe is not an option since the java application has to be cross platform. Even a preexisting solution using Java RM would be sufficient. Currently, I'm using an SSH client library to ssh through java into a ...
For executing remote commands on a Windows server from a Java application without relying on `psexec.exe`, you have a few options to consider, especially focusing on cross-platform compatibility. Here are some approaches you might take: ### 1. Java Remote Management (JMX) If you have control over the Windows server an...
21,887
[ { "from": "human", "value": "Are there any existing solutions for remote execution of commands on a windows server from Java natively? psexec.exe is not an option since the java application has to be cross platform.\nEven a preexisting solution using Java RM would be sufficient.\nCurrently, I'm using an SSH...
One of the biggest challenges that I've encountered with SharePoint is that it doesn't lend itself nicely to the typical project environment, which, at minimum, contain development and production environments. The issues I've run into the most are that content and lists are so tightly coupled that it makes it difficul...
You're definitely not alone in facing these challenges with SharePoint, especially when it comes to managing development and production environments. Here are some strategies that can help mitigate the difficulties you've encountered: 1. **Use of Site Templates**: Create site and list templates without content wheneve...
23,642
[ { "from": "human", "value": "One of the biggest challenges that I've encountered with SharePoint is that it doesn't lend itself nicely to the typical project environment, which, at minimum, contain development and production environments. The issues I've run into the most are that content and lists are so ...
I find that most books concerning C++ templates don't tell anything about whether it's possible or not to use initialization list in constructor of a template class. For example, I have code like this: template <class T> class Stack { T* data; std::size_t count; std::size_t capacity; enum {INIT = 5}; pu...
Yes, you can absolutely use an initializer list in the constructor of a template class in C++. In fact, using an initializer list is often a more efficient way to initialize member variables, particularly for complex types. Here's how you can rewrite your `Stack` constructor using an initializer list: ```cpp template...
24,598
[ { "from": "human", "value": "I find that most books concerning C++ templates don't tell anything about whether it's possible or not to use initialization list in constructor of a template class.\nFor example, I have code like this:\ntemplate <class T>\nclass Stack {\n T* data;\n std::size_t count;\n ...
I am wondering what security concerns there are to implementing a PHP evaluator like this: <?php eval($_POST['codeInput']); %> This is in the context of making a PHP sandbox so sanitising against DB input etc. isn't a massive issue. Users destroying the server the file is hosted on is. I've seen Ruby simulators so I w...
Implementing a PHP evaluator using `eval()` to execute user-submitted code is a significant security risk and is generally considered a bad practice. Here are several key concerns and considerations: ### Security Risks 1. **Remote Code Execution (RCE):** - `eval()` executes any PHP code it receives as input. If an...
18,716
[ { "from": "human", "value": "I am wondering what security concerns there are to implementing a PHP evaluator like this:\n<?php eval($_POST['codeInput']); %>\n\nThis is in the context of making a PHP sandbox so sanitising against DB input etc. isn't a massive issue.\nUsers destroying the server the file is h...
I understand the mantra of "don't roll your own" when it comes to site security frameworks. For most cases anyway. I'm going to be collaborating on a site that integrates text-messaging into the system. I'd like to use an existing, well-tested security framework to protect the users data, but I need it to also protect ...
You're right to be cautious about handling sensitive user data like phone numbers. Using a well-tested security framework is essential to protect user information, including phone numbers. Here are some suggestions to help you securely manage phone numbers in your application: ### 1. **Use Well-Established Libraries a...
17,542
[ { "from": "human", "value": "I understand the mantra of \"don't roll your own\" when it comes to site security frameworks.\nFor most cases anyway.\nI'm going to be collaborating on a site that integrates text-messaging into the system.\nI'd like to use an existing, well-tested security framework to protect ...
Does anyone know a good resource to concisely explain the different types of lists available in C# and when their usage is appropriate? For example, List, Hashtable, Dictionaries etc. I'm never quite sure when I should be using what.
Certainly! In C#, collections come in various types, each suited for different use cases. Here's a concise overview of the most common collection types, along with guidelines on when to use each: ### 1. **List<T>** - **Description**: A generic collection that maintains the order of elements and allows duplicates. - **...
18,775
[ { "from": "human", "value": "Does anyone know a good resource to concisely explain the different types of lists available in C# and when their usage is appropriate?\nFor example, List, Hashtable, Dictionaries etc.\nI'm never quite sure when I should be using what.\n" }, { "from": "gpt", "value":...
I would like to generate a list of differences between 2 instances of the the same object. Object in question: public class Step { [DataMember] public StepInstanceInfo InstanceInfo { get; set; } [DataMember] public Collection<string> AdHocRules { get; set; } [DataMember] public Collection<Ste...
To generate a detailed list of differences between two instances of the `Step` object, you can implement a method that compares each property of the object and provides a summary of changes. This approach will let you capture specific changes in collections, such as additions or removals of items. Here’s a possible ap...
19,545
[ { "from": "human", "value": "I would like to generate a list of differences between 2 instances of the the same object. Object in question:\npublic class Step\n{\n [DataMember]\n public StepInstanceInfo InstanceInfo { get; set; }\n\n [DataMember]\n public Collection<string> AdHocRules { get; se...
My Django app has a Person table, which contains the following text in a field named details: <script>alert('Hello');</script> When I call PersonForm.details in my template, the page renders the script accordingly (a.k.a., an alert with the word "Hello" is displayed). I'm confused by this behavior because I always tho...
In Django, template variables are auto-escaped by default, which means that any HTML tags or scripts should be rendered as plain text instead of being executed. However, if you are seeing that the `<script>` tags are executed when you output `{{ person_form.details }}`, it may be due to how the form field is rendered. ...
19,534
[ { "from": "human", "value": "My Django app has a Person table, which contains the following text in a field named details:\n<script>alert('Hello');</script>\nWhen I call PersonForm.details in my template, the page renders the script accordingly (a.k.a., an alert with the word \"Hello\" is displayed). I'm c...
I'm building a form with php/mysql. I've got a table with a list of locations and sublocations. Each sublocation has a parent location. A column "parentid" references another locationid in the same table. I now want to load these values into a dropdown in the following manner: --Location 1 ----Sublocation 1 ----Subloca...
Certainly! You can achieve this by querying your database and organizing the results in a structured way to create a hierarchical dropdown. Here’s a step-by-step guide to help you implement this in PHP with MySQL: ### Step 1: Database Structure Assuming you have a simple structure for your table `locations`: | id | n...
19,328
[ { "from": "human", "value": "I'm building a form with php/mysql. I've got a table with a list of locations and sublocations. Each sublocation has a parent location. A column \"parentid\" references another locationid in the same table. I now want to load these values into a dropdown in the following manner:...
From Apache, you can use the "mod_jk" module to send HTTP requests to Tomcat using the "AJP" protocol, which is far more efficient that HTTP itself. I want to do the same, but from a Java program. I want to use "AJP" because of its good performances (and Tomcat is not bad after all). Does someone know about a Java impl...
If you're looking to implement an AJP (Apache JServ Protocol) client in Java to communicate with a Tomcat server, you may find that there aren't many widely-used libraries specifically designed for AJP in Java, as it's more common to see AJP used on the server side, typically with Apache HTTP Server and mod_jk. Howeve...
20,131
[ { "from": "human", "value": "From Apache, you can use the \"mod_jk\" module to send HTTP requests to Tomcat using the \"AJP\" protocol, which is far more efficient that HTTP itself.\nI want to do the same, but from a Java program. I want to use \"AJP\" because of its good performances (and Tomcat is not bad...
A while back I was reading the W3C article on 'Re-using Strings in Scripted Content', which contains some useful advice on internationalisation, but which strikes me as at odds iwth the DRY (Don't Repeat Yourself) principle of eliminating repetitive code. To take their example, we might have some code like this... prin...
You've touched on a common challenge that developers face when balancing the principles of DRY (Don't Repeat Yourself) and the need for internationalization (i18n) in their code. The key lies in finding a balance between reusability and adaptability for localization. Here’s a general approach that can help maintain th...
18,422
[ { "from": "human", "value": "A while back I was reading the W3C article on 'Re-using Strings in Scripted Content', which contains some useful advice on internationalisation, but which strikes me as at odds iwth the DRY (Don't Repeat Yourself) principle of eliminating repetitive code.\nTo take their example,...
I'm trying to debug an application (under PostgreSQL) and came across the following error: "current transaction is aborted, commands ignored". As far as I can understand a "transaction" is just a notion related to the underlying database connection. If the connection has an auto commit "false", you can execute queries ...
The error message "current transaction is aborted, commands ignored" indicates that a previous command in your transaction has failed, causing the entire transaction to enter an error state. Once in this state, any subsequent commands executed in that transaction will be ignored until you explicitly roll back the trans...
19,126
[ { "from": "human", "value": "I'm trying to debug an application (under PostgreSQL) and came across the following error:\n\"current transaction is aborted, commands ignored\".\nAs far as I can understand a \"transaction\" is just a notion related to the underlying database connection.\nIf the connection has ...
I recall hearing that the way Microsoft had to implement the JSON serialization for their AJAX framework was different than most other libraries out there. Is this true? And, if so, how is it different?
Yes, Microsoft’s implementation of JSON serialization in their AJAX framework (particularly in ASP.NET) had some notable differences compared to other libraries, particularly during its early versions. 1. **Data Types**: One of the primary differences is how the Microsoft AJAX library handles JavaScript data types. Fo...
21,097
[ { "from": "human", "value": "I recall hearing that the way Microsoft had to implement the JSON serialization for their AJAX framework was different than most other libraries out there. Is this true? And, if so, how is it different?\n" }, { "from": "gpt", "value": "Yes, Microsoft’s implementation...
I'd like to check ancestry using two jQuery objects. They don't have IDs, and are only going to be available as jQuery objects (or DOM nodes if you called get()). jQuery's is() only works with expressions, so this code would be ideal but will not work: var someDiv = $('#div'); $('a').click(function() { if ($(this...
To check if a jQuery object is a child of another jQuery object, you can use the `has()` method along with `is()`. The `has()` method can be used to check if any of the selected elements contain a certain element, and this works without needing IDs. Here's how you can modify your code to achieve that: ```javascript v...
26,395
[ { "from": "human", "value": "I'd like to check ancestry using two jQuery objects. They don't have IDs, and are only going to be available as jQuery objects (or DOM nodes if you called get()). jQuery's is() only works with expressions, so this code would be ideal but will not work:\nvar someDiv = $('#div');...