instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
I am trying to use a malloc hook to create a custom function my_malloc(). In my main program when I call malloc() I want it to call my_malloc() can someone please give me an example on how to do this in C
To create a custom memory allocation function in C using a `malloc` hook, you'll need to define your custom allocation function and then use the `malloc_hook` in the GNU C Library. However, please note that using hooks like this is not portable across different compilers and platforms and is not recommended for product...
29,379
[ { "from": "human", "value": "I am trying to use a malloc hook to create a custom function my_malloc(). In my main program when I call malloc() I want it to call my_malloc() can someone please give me an example on how to do this in C\n" }, { "from": "gpt", "value": "To create a custom memory all...
I have just started authoring web pages for use on "smart phones". I need to target Blackberry, WinCE, iPhone, etc. What resources or books would you recommend for someone with ample web and software development experience but no experience developing UI for these devices? What emulation kits would you recommend, an...
As you embark on mobile web development, especially for devices like Blackberry, WinCE, and iPhone, you'll want to familiarize yourself with best practices and tools tailored for the unique constraints and capabilities of mobile devices. Here are some resources and emulators to get you started: ### Resources & Books ...
18,274
[ { "from": "human", "value": "I have just started authoring web pages for use on \"smart phones\". I need to target Blackberry, WinCE, iPhone, etc. What resources or books would you recommend for someone with ample web and software development experience but no experience developing UI for these devices? ...
One of the PDC2008 presentations showed off the new VS2010 UI (not the same as the current beta) that was built with WPF. Some of the new code effects looked fairly nice (comment xml parsed and styled within the code editor). It got me wondering if Microsoft would ever change the VS UI to the Ribbon; like Office, the ...
The potential for Microsoft to adopt a Ribbon interface for Visual Studio, similar to what was done with Office, is an intriguing topic. Here are some considerations regarding such a change: ### Pros of Ribbon Interface: 1. **Context Sensitivity**: The Ribbon can adapt based on the context of the work being done. For...
30,940
[ { "from": "human", "value": "One of the PDC2008 presentations showed off the new VS2010 UI (not the same as the current beta) that was built with WPF. Some of the new code effects looked fairly nice (comment xml parsed and styled within the code editor).\nIt got me wondering if Microsoft would ever change ...
As I understand it, when asked to reserve a larger block of memory, the realloc() function will do one of three different things: if free contiguous block exists grow current block else if sufficient memory allocate new memory copy old memory to new free old memory else return null Growing the curr...
The `realloc()` function in C is designed to resize a previously allocated block of memory. While it may seem intuitive to want to control its behavior to avoid unnecessary copying, the C standard does not provide a direct way to predict the internal behavior of `realloc()` regarding whether it will be able to grow the...
21,557
[ { "from": "human", "value": "As I understand it, when asked to reserve a larger block of memory, the realloc() function will do one of three different things:\nif free contiguous block exists\n grow current block\nelse if sufficient memory\n allocate new memory\n copy old memory to new\n free ol...
Looking up LINQ and Or in google is proving somewhat difficult so here I am. I want to so the following: (from creditCard in AvailableCreditCards where creditCard.BillToName.ToLowerInvariant().Contains(txtFilter.Text.ToLowerInvariant()) **or creditCard.CardNumber.().Contains(txtFilter.Text)** orderby creditCard.BillTo...
It looks like you're trying to use LINQ to query a collection of credit cards based on two conditions: matching the `BillToName` or the `CardNumber` against some text from a text box. You also want to ensure that the case doesn't matter when doing the comparison for `BillToName`. Here's how you can write this LINQ que...
32,684
[ { "from": "human", "value": "Looking up LINQ and Or in google is proving somewhat difficult so here I am.\nI want to so the following:\n(from creditCard in AvailableCreditCards \nwhere creditCard.BillToName.ToLowerInvariant().Contains(txtFilter.Text.ToLowerInvariant())\n**or creditCard.CardNumber.().Contain...
By default, objects (tables, stored procedures, etc) are set up with the dbo owner/schema (I think ms sql 2000 calls it owner, while ms sql 2005 calls it schema) The owner/schema is really a role or user in the database. I've always left the default of dbo, but I've recently seen some examples in microsoft training bo...
Using different schemas (or owners, as they were referred to in earlier versions of SQL Server) in a database can provide several benefits, particularly in terms of organization, security, and management. Here are some reasons why you might want to use schemas other than `dbo`: ### 1. **Organization and Clarity** -...
30,468
[ { "from": "human", "value": "By default, objects (tables, stored procedures, etc) are set up with the dbo owner/schema (I think ms sql 2000 calls it owner, while ms sql 2005 calls it schema)\nThe owner/schema is really a role or user in the database. I've always left the default of dbo, but I've recently s...
I have a query that has 7 inner joins (because a lot of the information is distributed in other tables), a few coworkers have been surprised. I was wondering if they should be surprised or is having 7 inner joins normal?
The number of inner joins in a SQL query can vary widely depending on the complexity of the data model and the relationships between tables in a database. While having 7 inner joins may seem high at first glance, it is not uncommon in scenarios where: 1. **Normalized Data**: If your database is designed with normaliza...
30,828
[ { "from": "human", "value": "I have a query that has 7 inner joins (because a lot of the information is distributed in other tables), a few coworkers have been surprised. I was wondering if they should be surprised or is having 7 inner joins normal?\n" }, { "from": "gpt", "value": "The number of...
Is there any way to remove the dotted line rectangle, which indicates the keyboard focus, on a Win32 common control, without owner draw or subclass them? It seems that under WPF one can control the visual style of the focus rectangle, but I failed to find corresponding API on a Win32 common control.
In Win32 common controls, the dotted focus rectangle (also known as the focus rectangle) is a built-in feature that indicates which control currently has keyboard focus. Unfortunately, there is no direct API to completely disable the focus rectangle without subclassing the control or using owner-drawing. However, you ...
27,489
[ { "from": "human", "value": "Is there any way to remove the dotted line rectangle, which indicates the keyboard focus, on a Win32 common control, without owner draw or subclass them? \nIt seems that under WPF one can control the visual style of the focus rectangle, but I failed to find corresponding API on ...
I have a report in SQL Server Reporting Services (SSRS) that I'd like to schedule to run automatically as an email. I'd like the report to be attached as Excel file. According to the Microsoft overview this should be possible. Report delivery. SQL Server Reporting Services supports both on-demand (pull) and event-bas...
Yes, you can schedule an SSRS report to run automatically and have it delivered via email with the report attached in Excel format. Here’s a step-by-step guide on how to do it: ### Prerequisites: 1. **SSRS Installed**: Ensure you have SQL Server Reporting Services installed and configured. 2. **Email Configuration**: ...
30,121
[ { "from": "human", "value": "I have a report in SQL Server Reporting Services (SSRS) that I'd like to schedule to run automatically as an email. I'd like the report to be attached as Excel file.\nAccording to the Microsoft overview this should be possible.\n\nReport delivery. SQL Server Reporting Services ...
The IT department of a subsidiary of ours had a consulting company write them an ASP.NET application. Now it's having intermittent problems with mixing up who the current user is and has been known to show Joe some of Bob's data by mistake. The consultants were brought back to troubleshoot and we were invited to liste...
It sounds like you're right to have concerns about the technical understanding of the consulting team. Let's break down both issues you've raised: ### 1. Session Management and Asynchronous Behavior The first point regarding the session variable assignment and its alleged asynchronous nature raises several flags. In ...
30,955
[ { "from": "human", "value": "The IT department of a subsidiary of ours had a consulting company write them an ASP.NET application. Now it's having intermittent problems with mixing up who the current user is and has been known to show Joe some of Bob's data by mistake.\nThe consultants were brought back to...
I have a "Date of Birth" field, and trying to use the timespan() method to get the age in years. But returns "28 Years, 2 Months, 2 Weeks, 3 Days, 15 Hours, 16 Minutes". Any idea how I can just get the "28 Years" portion?
To extract just the "28 Years" portion from the output of the `timespan()` method, you can simply access the years property of the time span object. The exact approach may depend on the programming language or context in which you're working. Here are a few examples in different contexts: ### Example in C#: If you ar...
28,311
[ { "from": "human", "value": "I have a \"Date of Birth\" field, and trying to use the timespan() method to get the age in years. But returns \"28 Years, 2 Months, 2 Weeks, 3 Days, 15 Hours, 16 Minutes\".\nAny idea how I can just get the \"28 Years\" portion?\n" }, { "from": "gpt", "value": "To ex...
I use ASP.Net and I have a custom 404 page. When user pastes url that is not found it will redirected to the custom 404 page. However google indexes my custom 404 page. Search 404(page not found). Anyone have solution?
When Google indexes your custom 404 page, it indicates that it considers that page to be an actual page on your site, rather than an error page. To ensure that search engines treat your custom 404 page correctly and do not index it, you need to follow these guidelines: ### 1. Set the Correct HTTP Status Code Ensure t...
30,962
[ { "from": "human", "value": "I use ASP.Net and I have a custom 404 page. When user pastes url that is not found it will redirected to the custom 404 page. However google indexes my custom 404 page. Search 404(page not found).\nAnyone have solution?\n" }, { "from": "gpt", "value": "When Google in...
I've got an application that needs quite a bit of data (1000s of records) to do appropriate testing. The only way I've found to get a decent set of testable, sensible data is to use a subset of my production DB. I've converted this to YAML fixtures in the normal `test/fixtures' location. This works, but now I have a ...
Using a small subset of production data for testing can indeed lead to brittle tests, as you've noted. Here are several strategies to improve your testing setup, making it more robust and maintainable: ### 1. Use Factories Instead of Fixtures Instead of using YAML fixtures, consider using a library like [FactoryBot](...
25,803
[ { "from": "human", "value": "I've got an application that needs quite a bit of data (1000s of records) to do appropriate testing. The only way I've found to get a decent set of testable, sensible data is to use a subset of my production DB. I've converted this to YAML fixtures in the normal `test/fixtures...
How do I get a list of domain user accounts with win32 api? In particular, I can't get this list when the computer is not the domain controller. Instead it is a member of the domain.
To retrieve a list of domain user accounts from a computer that is a member of a domain, you can use the Windows API, specifically using the `NetUserEnum` function from the `Netapi32.dll` library. However, when working with domain accounts from a non-domain controller, you need to ensure that you provide the correct co...
29,099
[ { "from": "human", "value": "How do I get a list of domain user accounts with win32 api? \nIn particular, I can't get this list when the computer is not the domain controller. Instead it is a member of the domain. \n" }, { "from": "gpt", "value": "To retrieve a list of domain user accounts fro...
I have a Request object which contains a list of Approvers. An approver has a name and an approval position. Mathew Mark Luke John Ultimately, a request will move through this chain, starting at Mathew and ended at John. I need to be able to re-order these allowing adds and deletes as outlined below. An approver c...
To create an elegant solution for managing a list of approvers that allows for adding, deleting, and editing their positions, you can use a combination of a simple data structure (like a list) and methods to handle the operations. Below is a Python-based implementation that encapsulates the functionality you described:...
28,076
[ { "from": "human", "value": "I have a Request object which contains a list of Approvers. An approver has a name and an approval position.\n\nMathew \nMark \nLuke \nJohn\n\nUltimately, a request will move through this chain, starting at Mathew and ended at John.\nI need to be able to re-order these allowing ...
So .NET 3.0/3.5 provides us with lots of new ways to query, sort, and manipulate data, thanks to all the neat functions supplied with LINQ. Sometimes, I need to compare user-defined types that don't have a built-in comparison operator. In many cases, the comparison is really simple -- something like foo1.key ?= foo2....
You're correct in thinking that you can define a custom comparison inline using lambda functions in .NET, but the way to use it with LINQ is a bit different. The `Except` method requires an `IEqualityComparer<T>` implementation for comparing elements. While you cannot pass a lambda expression directly to `Except`, you ...
30,669
[ { "from": "human", "value": "So .NET 3.0/3.5 provides us with lots of new ways to query, sort, and manipulate data, thanks to all the neat functions supplied with LINQ. Sometimes, I need to compare user-defined types that don't have a built-in comparison operator. In many cases, the comparison is really s...
I have a C++ assembly with both managed and umanaged code compiled to a DLL. It is correctly imported into the project references as I can see all my classes and their members with the Object Browser. The problem is with the XAML Design view. In my XAML code I want to make a data bind with my C++ assembly so I have th...
The issue you're facing with the XAML design view in Visual Studio is not uncommon when working with mixed managed (CLI) and unmanaged code in a C++/CLI DLL. The design view often struggles with recognizing assemblies that are not fully .NET managed, which can lead to the error message you are seeing. Here are some po...
30,568
[ { "from": "human", "value": "I have a C++ assembly with both managed and umanaged code compiled to\na DLL. It is correctly imported into the project references as I can\nsee all my classes and their members with the Object Browser.\nThe problem is with the XAML Design view. In my XAML code I want to\nmake ...
I'm working through some homework and a question on a previous exam paper asks to name all of the abstract classes in a given UML diagram. Fairly straightforward, I suppose. There are one abstract class and three interfaces. Do these interfaces qualify as abstract classes, in general?
In general, interfaces and abstract classes are both used to define contracts in object-oriented programming, but they serve different purposes and have distinct characteristics. 1. **Abstract Classes**: These are classes that cannot be instantiated on their own and may contain abstract methods (methods without a body...
31,041
[ { "from": "human", "value": "I'm working through some homework and a question on a previous exam paper asks to name all of the abstract classes in a given UML diagram. Fairly straightforward, I suppose. There are one abstract class and three interfaces. Do these interfaces qualify as abstract classes, in ge...
We are replacing the exception handling system in our app in order to conform to Vista certification, but the problem is how to force certain exceptions to be thrown, so that we can check the response. Unfortunately the whole app was written without taking into consideration proper layering, abstraction or isolation pr...
It's great that you're looking for a way to test exception handling in your application. Given the constraints you've mentioned (tight timeline, lack of proper layering, etc.), using a configuration setting or compiler directive to trigger specific exceptions is a pragmatic approach. Here are a few ideas to implement t...
26,394
[ { "from": "human", "value": "We are replacing the exception handling system in our app in order to conform to Vista certification, but the problem is how to force certain exceptions to be thrown, so that we can check the response.\nUnfortunately the whole app was written without taking into consideration pr...
When it comes to code launches how do you handle developer access to the server? Do they have RDP access to the machines to deploy code and make changes? Are they only given ftps access to the servers docroots and any .NET configuration changes are handled by the sysadmins? Do the developers even have access to the ...
Handling developer access to servers, especially in a production environment, is a critical aspect of maintaining security, stability, and a well-managed deployment process. Here are some common approaches to managing developer access and deployment in various scenarios: ### 1. **Role-Based Access Control (RBAC)** ...
29,651
[ { "from": "human", "value": "When it comes to code launches how do you handle developer access to the server? Do they have RDP access to the machines to deploy code and make changes? Are they only given ftps access to the servers docroots and any .NET configuration changes are handled by the sysadmins? D...
I'm looking for best practices for using the same data in different places without repeating yourself - this could include configuration or business rules. Example 1. Data validation rules where you want to validate on the client using javascript, but you want to make sure by validating on the server. Example 2. Databa...
Using the same data in different places without repeating yourself is a key principle in software development, often referred to as DRY (Don't Repeat Yourself). Here are best practices to help you achieve this, particularly for scenarios like data validation and shared configurations: ### 1. Centralized Configuration ...
26,918
[ { "from": "human", "value": "I'm looking for best practices for using the same data in different places without repeating yourself - this could include configuration or business rules.\nExample 1. Data validation rules where you want to validate on the client using javascript, but you want to make sure by v...
Are there other possibilities besides IIS for hosting web sites and web services based on ASP.NET, which are recommended by Microsoft for small-scale environments?
Yes, besides Internet Information Services (IIS), there are several other options for hosting ASP.NET web applications and services that are suitable for small-scale environments. Here are a few alternatives that are recommended or commonly used in such scenarios: 1. **Kestrel**: - Kestrel is a cross-platform web s...
32,549
[ { "from": "human", "value": "Are there other possibilities besides IIS for hosting web sites and web services based on ASP.NET, which are recommended by Microsoft for small-scale environments?\n" }, { "from": "gpt", "value": "Yes, besides Internet Information Services (IIS), there are several ot...
I am using VC++. Is assert(false) ignored in release mode?
In VC++ (Visual C++), the `assert` macro is used for debugging purposes to check if a condition is true. If the condition is false, it will typically cause the program to terminate and provide a diagnostic message. However, `assert` behaves differently in Release mode compared to Debug mode. In Debug mode, `assert(fal...
30,048
[ { "from": "human", "value": "I am using VC++. Is assert(false) ignored in release mode?\n" }, { "from": "gpt", "value": "In VC++ (Visual C++), the `assert` macro is used for debugging purposes to check if a condition is true. If the condition is false, it will typically cause the program to term...
Similar to this question, but for VB.NET since I learned this is a language thing. For instance, would the compiler know to translate Dim s As String = "test " + "this " + "function" to Dim s As String = "test this function" and thus avoid the performance hit with the string concatenation?
In VB.NET, the compiler does indeed have the capability to optimize certain string concatenations at compile time. This means that in many cases, if you concatenate string literals (like in your example), the compiler will recognize this and generate a single string at compile time, avoiding the performance hit associa...
34,847
[ { "from": "human", "value": "Similar to this question, but for VB.NET since I learned this is a language thing.\nFor instance, would the compiler know to translate\n\nDim s As String = \"test \" + \"this \" +\n \"function\"\n\nto\nDim s As String = \"test this function\"\n\nand thus avoid the performance h...
I've done this a million times ... setting up a developer work station. Is there a best practices, or installation checklist for installing Microsoft development software on a work station? What about applying updates and/or service packs? Is there a specific order for doing this, in hopes of minimizing any install ...
Setting up a developer workstation with Microsoft development software involves several steps, and following best practices can help you minimize installation issues. Below is a checklist along with some recommendations for installation order, updates, and creating a system image for easy recovery. ### Installation Ch...
26,010
[ { "from": "human", "value": "I've done this a million times ... setting up a developer work station. \nIs there a best practices, or installation checklist for installing Microsoft development software on a work station? What about applying updates and/or service packs? Is there a specific order for doing...
What's the difference between the two and when should I use each: <person> <firstname>Joe</firstname> <lastname>Plumber</lastname> </person> versus <person firstname="Joe" lastname="Plumber" /> Thanks
The two XML formats you've presented represent the same data but in different ways, and the choice between them depends on your specific use case and preferences. Here's a breakdown of the differences and when to use each: ### 1. Verbose Element Structure ```xml <person> <firstname>Joe</firstname> <lastname...
30,844
[ { "from": "human", "value": "What's the difference between the two and when should I use each:\n<person>\n <firstname>Joe</firstname>\n <lastname>Plumber</lastname>\n</person>\n\nversus\n<person firstname=\"Joe\" lastname=\"Plumber\" />\n\nThanks\n" }, { "from": "gpt", "value": "The two ...
I have an application I am writing in PHP5, using the CodeIgniter framework. I have it running on both Windows (using Xampp) and Ubuntu (using standard Apache, PHP, MySQL stack). I have a form, that takes XML, parses it (using simpleXML) and posts the results into a database. On Windows - no problem, works as intended....
I'm glad to hear you were able to identify and resolve the issue related to the Suhosin patch in your PHP environment! This is a common problem when dealing with larger POST requests, especially when different server configurations behave differently. For anyone else facing similar issues, here are a few things to kee...
28,214
[ { "from": "human", "value": "I have an application I am writing in PHP5, using the CodeIgniter framework.\nI have it running on both Windows (using Xampp) and Ubuntu (using standard Apache, PHP, MySQL stack).\nI have a form, that takes XML, parses it (using simpleXML) and posts the results into a database.\...
I've got a WCF service that uses a LinqToSql DataContext to fetch some information out of a database. The return type of the operation is IEnumerable<DomainObject>, and I have a helper method that converts from the Table-derived LINQ object to a WCF data contract like so: [OperationContract] public IEnumerable<DomainOb...
What you are experiencing is indeed related to how WCF handles exceptions during serialization, especially when dealing with deferred execution of queries using LINQ to SQL. ### Key Points on the Behavior 1. **Deferred Execution in LINQ**: LINQ to SQL queries are executed in a deferred manner. This means that the ...
28,219
[ { "from": "human", "value": "I've got a WCF service that uses a LinqToSql DataContext to fetch some information out of a database. The return type of the operation is IEnumerable<DomainObject>, and I have a helper method that converts from the Table-derived LINQ object to a WCF data contract like so:\n[Oper...
I have a debug app I've been writing which receives data from a C-based process via UDP. One of the strings sent to me contains a ° character - Unicode U+00B0 (which incidentally breaks the StackOverflow search function!). When my wxPython application tries to append that string to a text box I get a UnicodeDecodeError...
To handle the `UnicodeDecodeError` when receiving strings containing special characters like the degree symbol (°) in your wxPython application, you'll need to implement a way to decode the incoming byte string appropriately. Here’s a step-by-step approach: 1. **Catch and Handle the Exception**: Instead of ignoring th...
30,295
[ { "from": "human", "value": "I have a debug app I've been writing which receives data from a C-based process via UDP. One of the strings sent to me contains a ° character - Unicode U+00B0 (which incidentally breaks the StackOverflow search function!). When my wxPython application tries to append that string...
I've got simple java-based ppt->swf sub-project that basically works. The open source software out there, OpenOffice.org and JODConverter do the job great. The thing is, to do this I need to install OO.o and run it in server mode. And to do that I have to install OO.o, which is allot of software (~160MB) just to conv...
Creating a custom distribution of OpenOffice (OO.o) for a specific purpose, such as converting PPT to SWF, can be a complex but achievable task. Here are some considerations and steps to help you with this project: ### 1. Custom Distribution of OpenOffice Creating a custom distribution of OpenOffice that minimizes si...
30,187
[ { "from": "human", "value": "I've got simple java-based ppt->swf sub-project that basically works. The open source software out there, OpenOffice.org and JODConverter do the job great.\nThe thing is, to do this I need to install OO.o and run it in server mode. And to do that I have to install OO.o, which ...
So let's say I have an eBay-type application where only the seller can edit his/her listing. How do I go about restricting access to the Edit action based on the Id of the item we're editing and the currently logged in user? As far as I can tell, the Authorize attribute only allows you to restrict access to controller...
In an eBay-type application where you want to restrict access to the Edit action based on the item's ID and the currently logged-in user, you can certainly implement this logic within the controller. However, there are a few strategies you can consider to keep your code clean and maintainable. ### 1. Check Ownership i...
30,684
[ { "from": "human", "value": "So let's say I have an eBay-type application where only the seller can edit his/her listing. How do I go about restricting access to the Edit action based on the Id of the item we're editing and the currently logged in user?\nAs far as I can tell, the Authorize attribute only a...
I am trying to create a report in SSRS2000 that will query an ORACLE database and pass one parameter, I am getting the following error message: ORA-01036: illegal variable name/number But have been unable to find much help elsewhere on the web with this error code I was hoping that this would be fairly simple to do, d...
The error message `ORA-01036: illegal variable name/number` indicates that there is an issue with the way variables or parameters are being used in your Oracle query. This can happen in a variety of situations, especially when working with parameters in SQL Server Reporting Services (SSRS) when querying an Oracle datab...
29,465
[ { "from": "human", "value": "I am trying to create a report in SSRS2000 that will query an ORACLE database and pass one parameter, I am getting the following error message:\nORA-01036: illegal variable name/number \nBut have been unable to find much help elsewhere on the web with this error code\nI was hopi...
It sounds a lot more complicated than it really is. So in Perl, you can do something like this: foreach my $var (@vars) { $hash_table{$var->{'id'}} = $var->{'data'}; } I have a JSON object and I want to do the same thing, but with a javascript associative array in jQuery. I've tried the following: hash_table = new ...
It seems that there are a couple of issues in your JavaScript code that might be causing the error and preventing you from correctly populating the associative array (`hash_table`). Here are the steps to fix your code: 1. The use of `new Array()` is not necessary; you can simply use an object to create an associative ...
31,344
[ { "from": "human", "value": "It sounds a lot more complicated than it really is.\nSo in Perl, you can do something like this:\nforeach my $var (@vars) {\n $hash_table{$var->{'id'}} = $var->{'data'};\n} \n\nI have a JSON object and I want to do the same thing, but with a javascript associative array in jQue...
Recent conversations with colleagues have produced varying points of view on this matter. What say you, SO members? I know, even the concept of scalability can be taken in so many different ways and contexts, but that was part of the discussion when this came up. Everyone seemed to have a different take on what scalabi...
Scalability is indeed a multifaceted concept that can vary significantly depending on the context in which it is applied. Here are several perspectives on what scalability can mean across different fields: 1. **Software Engineering**: In the context of software, scalability typically refers to the capability of a syst...
30,562
[ { "from": "human", "value": "Recent conversations with colleagues have produced varying points of view on this matter. What say you, SO members?\nI know, even the concept of scalability can be taken in so many different ways and contexts, but that was part of the discussion when this came up. Everyone seeme...
How can I write a C++ function returning true if a real number is exactly representable with a double? bool isRepresentable( const char* realNumber ) { bool answer = false; // what goes here? return answer; } Simple tests: assert( true==isRepresentable( "0.5" ) ); assert( false==isRepresentable( "0.1" ) );
To determine if a real number is exactly representable with a `double` in C++, you need to consider how floating-point numbers work, particularly how they are represented in the IEEE 754 standard. A double-precision floating-point number (double) can represent a finite number of decimal fractions exactly, but many de...
29,840
[ { "from": "human", "value": "How can I write a C++ function returning true if a real number is exactly representable with a double?\nbool isRepresentable( const char* realNumber )\n{\n bool answer = false;\n // what goes here?\n return answer;\n}\n\nSimple tests:\nassert( true==isRepresentable( \"0.5\...
I'm a PHPer, and am not writing object-oriented code. What are the advantages of OO over procedural code, and where can I learn how to apply these ideas to PHP?
Object-Oriented Programming (OOP) offers several advantages over procedural programming, especially in larger and more complex applications. Here are some key benefits: ### Advantages of OOP over Procedural Code 1. **Encapsulation**: OOP allows you to bundle data (attributes) and methods (functions) that operate on t...
26,178
[ { "from": "human", "value": "I'm a PHPer, and am not writing object-oriented code.\nWhat are the advantages of OO over procedural code, and where can I learn how to apply these ideas to PHP?\n" }, { "from": "gpt", "value": "Object-Oriented Programming (OOP) offers several advantages over procedu...
Is there a client event that I can use for when a DropDownList's data has been loaded/bound onto the control? I need to trigger event on their side when this happens. Basically, I am trying to lock out the controls while the data is being loaded as if there is a slowdown (not uncommon) a user can start inputting data ...
To handle the scenario you're describing, you can utilize JavaScript and jQuery (if you are using it) to manage the lock and unlock of your controls based on the data loading state of a DropDownList. Here's a general approach to achieve this: ### Step-by-Step Solution 1. **Lock Controls Before Data Load**: Use a func...
29,949
[ { "from": "human", "value": "Is there a client event that I can use for when a DropDownList's data has been loaded/bound onto the control? I need to trigger event on their side when this happens.\n\nBasically, I am trying to lock out the controls while the data is being loaded as if there is a slowdown (not...
I've got a Excel VSTO 2005 application I need to debug, I've tried attaching to the process EXCEL.EXE in Visual Studio 2005 to no avail. Does anyone know what to do in order to debug managed code running in a VSTO Excel Application?
Debugging a VSTO (Visual Studio Tools for Office) application in Excel can be a bit tricky, especially with older versions like Visual Studio 2005. Here are the steps you can follow to debug managed code in your Excel VSTO application: ### 1. Set up your project Ensure that your VSTO project is set up correctly in Vis...
30,420
[ { "from": "human", "value": "I've got a Excel VSTO 2005 application I need to debug, I've tried attaching to the process EXCEL.EXE in Visual Studio 2005 to no avail.\nDoes anyone know what to do in order to debug managed code running in a VSTO Excel Application?\n" }, { "from": "gpt", "value": "...
How do I do mv original.filename new.original.filename without retyping the original filename? I would imagine being able to do something like mv -p=new. original.filename or perhaps mv original.filename new.~ or whatever - but I can't see anything like this after looking at man mv / info mv pages. Of course, I could w...
In the `mv` command, there isn't a built-in flag that allows you to easily rename a file without typing the original filename more than once. However, there are some shell features and techniques that can help you achieve this without excessive typing. ### Option 1: Use Command Substitution You can use command substi...
32,052
[ { "from": "human", "value": "How do I do mv original.filename new.original.filename without retyping the original filename?\nI would imagine being able to do something like mv -p=new. original.filename or perhaps mv original.filename new.~ or whatever - but I can't see anything like this after looking at ma...
I've been working on an Eclipse plug-in project for a while now, and I've run into a situation where I need to split the project up to seperate the test cases from the plug-in package. I'm using git as version control. To describe this simply, I'm versioning the old project like this: workspace/ | +-- myplugin/ ...
Yes, you can relocate your Git repository and maintain the history of your project. Here’s a step-by-step guide on how to do this: ### Step 1: Backup Your Current State Before making any changes, ensure you have a backup of your current project state just in case anything goes wrong. You can do this by creating a copy...
29,102
[ { "from": "human", "value": "I've been working on an Eclipse plug-in project for a while now, and I've run into a situation where I need to split the project up to seperate the test cases from the plug-in package. I'm using git as version control.\nTo describe this simply, I'm versioning the old project lik...
I have a simple Word to Pdf converter as an MSBuild Task. The task takes Word files (ITaskItems) as input and Pdf files (ITaskItems) as output. The script uses a Target transform for conversion: <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> <UsingTask ...
The behavior you're observing with your MSBuild task indicates that the inputs and outputs are not being correlated correctly, particularly with respect to the recursive item specification and how the output files are being managed. ### Issue: The problem arises because you're using a wildcard to include the Word doc...
28,715
[ { "from": "human", "value": "I have a simple Word to Pdf converter as an MSBuild Task. The task takes Word files (ITaskItems) as input and Pdf files (ITaskItems) as output. The script uses a Target transform for conversion:\n<Project DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/ms...
I would like this to be the ultimate discussion on how to check if a table exists in SQL Server 2000/2005 using SQL Statements. Here are two possible ways of doing it. Which one is the standard/best way of doing it? First way: IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='...
In SQL Server, both methods you provided for checking if a table exists are commonly used, but they have different implications and contexts. Let's break them down: ### 1. Using `INFORMATION_SCHEMA.TABLES`: ```sql IF EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE TABLE'...
29,691
[ { "from": "human", "value": "I would like this to be the ultimate discussion on how to check if a table exists in SQL Server 2000/2005 using SQL Statements.\nHere are two possible ways of doing it. Which one is the standard/best way of doing it?\nFirst way:\nIF EXISTS (SELECT 1 \n FROM INFORMATION...
Here are my thoughts: The purpose of using MVC is seperation of concerns and testability of gui logic. View should be able to work with different models and model should be able to work with different views. I think controller class must implement an interface for mocking/testing reasons and view should call controller...
You've touched on some essential design principles and considerations when working with the Model-View-Controller (MVC) pattern. Let's break down your questions and thoughts. ### 1. Handling GUI Elements in the Controller When using interfaces for your controllers, you have a few approaches to consider: - **Expose G...
29,294
[ { "from": "human", "value": "Here are my thoughts: The purpose of using MVC is seperation of concerns and testability of gui logic. View should be able to work with different models and model should be able to work with different views.\nI think controller class must implement an interface for mocking/testi...
We have a Navigation Based WPF application. It works fine when running directly from Visual Studio, or even if we copy the files to another directory or another computer and run it there. We deploy the application over the internet using ClickOnce and most of the time this does not cause any problems. Every now and the...
The issue you're experiencing with your WPF ClickOnce application freezing during navigation can be quite challenging to diagnose, especially since it doesn't reproduce consistently. Here are several areas to investigate and potential solutions to explore: ### 1. **Check for UI Thread Blocking:** - Ensure that you'...
28,746
[ { "from": "human", "value": "We have a Navigation Based WPF application.\nIt works fine when running directly from Visual Studio,\nor even if we copy the files to another directory or another computer and run it there.\nWe deploy the application over the internet using ClickOnce and most\nof the time this d...
How do I execute a command-line program from C# and get back the STD OUT results? Specifically, I want to execute DIFF on two files that are programmatically selected and write the results to a text box.
To execute a command-line program from C# and capture the standard output (STDOUT), you can use the `Process` class in the `System.Diagnostics` namespace. Here’s an example of how to run the `diff` command on two files and display the results in a text box in a Windows Forms application. ### Example Code ```csharp us...
30,327
[ { "from": "human", "value": "How do I execute a command-line program from C# and get back the STD OUT results? Specifically, I want to execute DIFF on two files that are programmatically selected and write the results to a text box.\n" }, { "from": "gpt", "value": "To execute a command-line prog...
I am modifying ClearQuest database schema and I wonder is there a way to create a package for future deployment. If there isn't what are best practices for tracking and deployment of schema modifications?
IBM Rational ClearQuest does not have a built-in feature to package schema modifications for deployment, but you can follow best practices for tracking and deploying schema changes manually. Here are some recommended steps and practices: ### Best Practices for Tracking and Deploying Schema Modifications 1. **Version ...
29,690
[ { "from": "human", "value": "I am modifying ClearQuest database schema and I wonder is there a way to create a package for future deployment. If there isn't what are best practices for tracking and deployment of schema modifications?\n" }, { "from": "gpt", "value": "IBM Rational ClearQuest does ...
Situation: text: a string R: a regex that matches part of the string. This might be expensive to calculate. I want to both delete the R-matches from the text, and see what they actually contain. Currently, I do this like: import re ab_re = re.compile("[ab]") text="abcdedfe falijbijie bbbb laifsjelifjl" ab_re.fi...
You can achieve this in a single pass by using the `re.finditer()` method, which allows you to find all matches in the text while iterating through them. You can collect the matches and build a new string without the matches simultaneously. This way, you don't need to run the regex multiple times. Here's how you can do...
33,272
[ { "from": "human", "value": "Situation:\n\ntext: a string\nR: a regex that matches part of the string. This might be expensive to calculate. \n\nI want to both delete the R-matches from the text, and see what they actually contain. Currently, I do this like:\nimport re\nab_re = re.compile(\"[ab]\")\nte...
An application I am working on reads information from files to populate a database. Some of the characters in the files are non-English, for example accented French characters. The application is working fine in Windows but on our Solaris machine it is failing to recognise the special characters and is throwing an exce...
It sounds like you're dealing with character encoding issues due to the handling of non-English characters in your application. Here are a few suggestions that may help resolve the issue: 1. **Set the File Encoding Properly**: If the files you are reading from use UTF-8 encoding, ensure that you specify this encod...
29,729
[ { "from": "human", "value": "An application I am working on reads information from files to populate a database. Some of the characters in the files are non-English, for example accented French characters.\nThe application is working fine in Windows but on our Solaris machine it is failing to recognise the ...
I am just getting started with MVC, and it seems like it will be a great way to go, once I manage to switch my thinking to it. Most of the material I have come across seems to have a 1-1 relationship between models, views, and tables - ie each model represents a table and allows CRUD, plus more complex functions. What ...
You're right in identifying that the Model-View-Controller (MVC) architecture can take some time to get used to, especially when it comes to structuring your models and how they interact. Let's break down your questions and considerations: ### 1. Using Models in Different Contexts It's perfectly fine to use the same ...
29,475
[ { "from": "human", "value": "I am just getting started with MVC, and it seems like it will be a great way to go, once I manage to switch my thinking to it.\nMost of the material I have come across seems to have a 1-1 relationship between models, views, and tables - ie each model represents a table and allow...
Right now our test and production databases are on the same server, but with different names. Deploying has meant editing Web.config to change all the connection strings for the correct database. A step which I forget all too frequently... We've finally created a new database server for testing, and I'm moving the d...
It's great that you're looking to improve your deployment process and separate your test and production environments! Here are a few strategies you can consider for managing connection strings without having to manually edit the `Web.config` file each time you deploy: ### 1. Use `Web.config` Transformations ASP.NET su...
26,989
[ { "from": "human", "value": "Right now our test and production databases are on the same server, but with different names. Deploying has meant editing Web.config to change all the connection strings for the correct database. A step which I forget all too frequently... \nWe've finally created a new databas...
I need to be able to compile firefox and bundle it with a few extensions so when people download it the extensions are already there. I was wondering if anyone can point me to some documentation. I have been searching for hours and can't seem to find anything like that. Thanks, Sebastian
Compiling Firefox and bundling it with extensions is a bit involved, but it is definitely possible. Below is a general guideline on how to achieve this, along with some resources you may find useful. ### Steps to Compile Firefox 1. **Set Up Your Environment**: - Make sure you have the necessary build tools install...
31,143
[ { "from": "human", "value": "I need to be able to compile firefox and bundle it with a few extensions so when people download it the extensions are already there.\nI was wondering if anyone can point me to some documentation. I have been searching for hours and can't seem to find anything like that.\nThanks...
I have an array which is a list of domains, I want to print all of the items in the array except the one which contains $x. $x is variable so basically it never prints the array item when it contains $x. Can anyone help me? :)
Certainly! You can achieve this using a simple loop and a conditional check in most programming languages. Below is an example in Python, which demonstrates how to filter out the domains that contain a specified variable `$x`. Here is a code snippet for you: ```python # Sample list of domains domains = ['example.com'...
31,346
[ { "from": "human", "value": "I have an array which is a list of domains, I want to print all of the items in the array except the one which contains $x. $x is variable so basically it never prints the array item when it contains $x. Can anyone help me? :)\n" }, { "from": "gpt", "value": "Certain...
I know that PHP doesn't yet have native Enumerations. But I have become accustomed to them from the Java world. I would love to use enums as a way to give predefined values which IDEs' auto-completion features could understand. Constants do the trick, but there's the namespace collision problem and (or actually because...
As of PHP 8.1, native enumerations (enums) were introduced, providing a robust and type-safe way to define a set of named constants. This resolves many of the issues you mentioned, allowing you to define a set of predefined values with full support for type safety, autocompletion in IDEs, and no namespace collision pro...
30,782
[ { "from": "human", "value": "I know that PHP doesn't yet have native Enumerations. But I have become accustomed to them from the Java world. I would love to use enums as a way to give predefined values which IDEs' auto-completion features could understand.\nConstants do the trick, but there's the namespace ...
I'm trying to create Excel 2007 Documents programmatically. Now, there are two ways I've found: Manually creating the XML, as outlined in this post Using a Third Party Library like ExcelPackage. Currently, I use ExcelPackage, which has some really serious drawbacks and issues. As I do not need to create overly comple...
If you're looking to create Excel 2007 documents programmatically in .NET 3.0, and you'd like to avoid the limitations of using a third-party library like ExcelPackage or manually creating XML, here are a few alternatives that you could consider: 1. **Open XML SDK**: As you mentioned, this is primarily designed for .N...
27,363
[ { "from": "human", "value": "I'm trying to create Excel 2007 Documents programmatically. Now, there are two ways I've found:\n\nManually creating the XML, as outlined in this post\nUsing a Third Party Library like ExcelPackage.\n\nCurrently, I use ExcelPackage, which has some really serious drawbacks and is...
I'm making a twitter client, and I'm evaluating the various ways of protecting the user's login information. IMPORTANT: I need to protect the user's data from other other applications. For example imagine what happens if a bot starts going around stealing Twhirl passwords or Hotmail/GMail/Yahoo/Paypal from applications...
When creating a Twitter client that securely handles user login information, especially given the concern of protecting this information from other applications, consider implementing the following strategies: ### 1. **OAuth Authentication** Use OAuth for user authentication instead of handling passwords directly. OAu...
31,350
[ { "from": "human", "value": "I'm making a twitter client, and I'm evaluating the various ways of protecting the user's login information.\nIMPORTANT: I need to protect the user's data from other other applications. For example imagine what happens if a bot starts going around stealing Twhirl passwords or Ho...
I have an MSBuild project where within it I have a task that calls multiple projects where I set BuildInParallel = "true" Example: <Message Text="MSBuild project list = @(ProjList)" /> <!-- Compile in parallel --> <MSBuild Projects="@(ProjList)" Targets="Build" Properties="Configuration=$...
The behavior you're observing can be attributed to a combination of how MSBuild handles parallel execution and how your command-line tool (in this case, `compile.exe`) is being invoked within your projects. ### Explanation of the Behavior 1. **MSBuild Parallel Execution**: When you set `BuildInParallel="true"`, MSBui...
32,036
[ { "from": "human", "value": "I have an MSBuild project where within it I have a task that calls multiple projects where I set BuildInParallel = \"true\"\nExample:\n\n <Message Text=\"MSBuild project list = @(ProjList)\" />\n <!-- Compile in parallel -->\n <MSBuild Projects=\"@(ProjList)\" \n Ta...
What is the most efficient way to store large arrays (10000x100) in a database, say, hsqldb? I need to do this for a certain math program that I'm writing in java. Please help. The whole array will be retrieved and stored often (not so much individual elements). Also, some meta-data about the array needs to be stored a...
Storing large arrays efficiently in a database, particularly for frequent retrieval, requires careful consideration of how the data is structured and accessed. Given your requirements, here's a suggested approach for storing a 10,000x100 array in HSQLDB (or any SQL-based database): ### 1. Structure the Database You ca...
26,494
[ { "from": "human", "value": "What is the most efficient way to store large arrays (10000x100) in a database, say, hsqldb? I need to do this for a certain math program that I'm writing in java. Please help.\nThe whole array will be retrieved and stored often (not so much individual elements). Also, some meta...
I don't think this is possible, but if is then I need it :) I have a auto-generated proxy file from the wsdl.exe command line tool by Visual Studio 2008. The proxy output is partial classes. I want to override the default constructor that is generated. I would rather not modify the code since it is auto-generated. I tr...
You're correct that modifying auto-generated code directly is not advisable, as it would be overwritten every time the code is regenerated. Unfortunately, constructors cannot be overridden in C# because constructors are not virtual. However, there are still a couple of approaches you can take without modifying the auto...
31,617
[ { "from": "human", "value": "I don't think this is possible, but if is then I need it :)\nI have a auto-generated proxy file from the wsdl.exe command line tool by Visual Studio 2008.\nThe proxy output is partial classes. I want to override the default constructor that is generated. I would rather not modif...
I am developing a wizard for a machine that is to be used as a backup of other machines. When it replaces an existing machine, it needs to set its IP address, DNS, WINS, and host name to match the machine being replaced. Is there a library in .net (C#) which allows me to do this programatically? There are multiple NIC...
To set network configurations such as IP address, DNS, WINS, and hostname programmatically in a .NET application using C#, you can utilize the `System.Management` namespace. This allows you to work with Windows Management Instrumentation (WMI), which provides a standardized way to access management data in an enterpris...
21,898
[ { "from": "human", "value": "I am developing a wizard for a machine that is to be used as a backup of other machines. When it replaces an existing machine, it needs to set its IP address, DNS, WINS, and host name to match the machine being replaced.\nIs there a library in .net (C#) which allows me to do th...
I've created the following regex pattern in an attempt to match a string 6 characters in length ending in either "PRI" or "SEC", unless the string = "SIGSEC". For example, I want to match ABCPRI, XYZPRI, ABCSEC and XYZSEC, but not SIGSEC. (\w{3}PRI$|[^SIG].*SEC$) It is very close and sort of works (if I pass in "SINSE...
To achieve your goal of matching a string that is exactly 6 characters long, ends in either "PRI" or "SEC", and excludes the specific case of "SIGSEC", you can refine your regex pattern as follows: 1. **Match the Length**: You want to ensure the entire string is exactly 6 characters. 2. **Use Lookahead for Exclusions*...
31,795
[ { "from": "human", "value": "I've created the following regex pattern in an attempt to match a string 6 characters in length ending in either \"PRI\" or \"SEC\", unless the string = \"SIGSEC\". For example, I want to match ABCPRI, XYZPRI, ABCSEC and XYZSEC, but not SIGSEC.\n(\\w{3}PRI$|[^SIG].*SEC$)\n\nIt i...
I just installed SQL Server Express 2008 because of intellisense feature. It worked at first but than it stopped working. Looking for the option to check and later consulting Google I have found that it looks like Microsoft disabled intellisense if you connect to SQL Server 2005 databases. Is this absolutely correct ?...
Yes, you are correct that SQL Server Management Studio (SSMS) 2008 introduced IntelliSense features, but it has limitations when connecting to databases that are not SQL Server 2008 or newer. Specifically, IntelliSense is not supported for SQL Server 2005 and earlier databases. When you connect to a SQL Server 2005 dat...
33,779
[ { "from": "human", "value": "I just installed SQL Server Express 2008 because of intellisense feature. It worked at first but than it stopped working. Looking for the option to check and later consulting Google I have found that it looks like Microsoft disabled intellisense if you connect to SQL Server 200...
I would like to understand the way git works from a architects point of view. How are files stored, how are versions kept and how do changes happen (branches, merges, etc.)? I am not searching for information how to use it. (I already found a lot of pages with tutorials.) But I did not find any "behind the scenes" deta...
Certainly! Understanding Git from an architectural perspective involves delving into its underlying data structures, how it tracks changes, and how it manages branches and merges. Here’s a breakdown of its components: ### 1. Data Model Git's architecture revolves around several key concepts: - **Objects**: In Git, ev...
28,232
[ { "from": "human", "value": "I would like to understand the way git works from a architects point of view. How are files stored, how are versions kept and how do changes happen (branches, merges, etc.)?\nI am not searching for information how to use it. (I already found a lot of pages with tutorials.) But I...
I'm trying to get this sample for AJAX to WCF working, with the following code. When viewed in FF, nothing is displayed, and when viewed in IE, the time is displayed. I'm using IIS 7, btw. function getTime() { TimeService.TimeService.GetTimeFormatted("dd-mm-yyyy [hh:mm:ss]", onMethodCompleted, ...
Based on your description, it sounds like you are trying to make an AJAX call to a WCF service to retrieve the current time and display it in an HTML element. The fact that it works in Internet Explorer but not in Firefox suggests that there might be differences in how the two browsers handle certain aspects of your AJ...
27,025
[ { "from": "human", "value": "I'm trying to get this sample for AJAX to WCF working, with the following code. When viewed in FF, nothing is displayed, and when viewed in IE, the time is displayed.\nI'm using IIS 7, btw.\n function getTime() { \n TimeService.TimeService.GetTimeFormatted(...
As a subversion user you'll have a local configuration folder /<userhome>/.subversion/ in your user home. In there is a config file containing, among others, auto-props. These properties are applied to files that you add to the repository, e.g. by svn add <file> Now here's my question (actually two questions): How do...
To coordinate auto-props usage among a development team and manage different settings for various SVN servers, you can consider the following approaches: ### Coordinating Auto-Props Across the Development Team 1. **Documentation:** Maintain a well-documented guide that outlines the specific auto-props configurations ...
30,381
[ { "from": "human", "value": "As a subversion user you'll have a local configuration folder /<userhome>/.subversion/ in your user home. In there is a config file containing, among others, auto-props.\nThese properties are applied to files that you add to the repository, e.g. by\nsvn add <file>\n\nNow here's ...
Is there any way to force Outlook to display HTML in the desktop alert instead of text for a multi-part message? Is there any way to customize what text will appear? Or is it always the first 2 lines of the email?
Outlook's desktop alerts, also known as toast notifications, typically display a plain text version of the email content and do not support HTML rendering. The content that appears in the desktop alert is generally derived from the email's plain text or HTML body, but it will not show HTML formatting like images, color...
33,817
[ { "from": "human", "value": "\nIs there any way to force Outlook to display HTML in the desktop alert instead of text for a multi-part message?\nIs there any way to customize what text will appear? Or is it always the first 2 lines of the email?\n\n" }, { "from": "gpt", "value": "Outlook's deskt...
I'm looking for an application that would lock my computer and display a screensaver with an away message that I set when I lock it. The idea is that when I go off somewhere during work, my co-workers would know where I'm off to instead of puzzling over my empty desk. Does such an application exist? If not, how would ...
Creating a custom application that locks your computer and displays a screensaver with an away message is a unique idea. Here’s a breakdown of how you could implement this, including existing solutions and a simple way to create your own application if one doesn’t fit your needs. ### Existing Solutions 1. **Third-Par...
29,448
[ { "from": "human", "value": "I'm looking for an application that would lock my computer and display a screensaver with an away message that I set when I lock it. The idea is that when I go off somewhere during work, my co-workers would know where I'm off to instead of puzzling over my empty desk. \nDoes suc...
How would I compile the latest version of GTK# for Windows without using cygwin? Any and All help would be appreciated.
Compiling GTK# (GTK for .NET) on Windows without using Cygwin can be done using Windows Subsystem for Linux (WSL), native Windows tools, or using a Visual Studio setup. Here’s a general approach for compiling GTK# on Windows: ### Prerequisites 1. **Install Visual Studio**: Ensure you have Visual Studio installed with...
27,430
[ { "from": "human", "value": "How would I compile the latest version of GTK# for Windows without using cygwin?\nAny and All help would be appreciated.\n" }, { "from": "gpt", "value": "Compiling GTK# (GTK for .NET) on Windows without using Cygwin can be done using Windows Subsystem for Linux (WSL)...
if A is extension use case (not base use case), can A be directly referenced by the actor?
In use case modeling, particularly within the UML (Unified Modeling Language) framework, an extension use case is intended to add optional behavior to a base use case. Typically, the actor interacts directly with the base use case, and the extension use case is triggered by specific conditions within that base use case...
30,616
[ { "from": "human", "value": "if A is extension use case (not base use case), can A be directly referenced by the actor?\n" }, { "from": "gpt", "value": "In use case modeling, particularly within the UML (Unified Modeling Language) framework, an extension use case is intended to add optional beha...
I am porting an existing windows based C++ application to 64 bit environment, and this is one of those weird errors. In the code snippet you can that I am using openforwardonly and it used to work fine with our old setup but in the 64 bit environment it gives the problem of fetching only ONE recordset. Or it could be a...
Porting a C++ application that relies on ADO to a 64-bit environment can sometimes lead to unexpected issues, especially when changing cursor types. Let's take a closer look at your scenario, focusing on the differences between `adOpenForwardOnly` and `adOpenStatic`, and potential reasons for the behavior you are obser...
23,888
[ { "from": "human", "value": "I am porting an existing windows based C++ application to 64 bit environment, and this is one of those weird errors.\nIn the code snippet you can that I am using openforwardonly and it used to work fine with our old setup but in the 64 bit environment it gives the problem of fet...
I have a .rc file which is used to include some text data in my executable, like this: 1234 RCDATA myfile.txt This works fine: the content of the 'myfile.txt' is included in my executable. The problem is that no 0-terminator is added to the string, and I cannot add it to the file. Is there any way of adding a 0-termin...
In Windows resource files (.rc), the ability to manipulate how data is included, such as adding a null terminator to an RCDATA resource, is limited. Unfortunately, there isn't a direct way to append a null character to the resource data itself using a single entry in the resource script. Given your scenario, while you...
28,726
[ { "from": "human", "value": "I have a .rc file which is used to include some text data in my executable, like this:\n1234 RCDATA myfile.txt\n\nThis works fine: the content of the 'myfile.txt' is included in my executable.\nThe problem is that no 0-terminator is added to the string, and I cannot add it to th...
I would like to either prevent or handle a StackOverflowException that I am getting from a call to the XslCompiledTransform.Transform method within an Xsl Editor I am writing. The problem seems to be that the user can write an Xsl script that is infinitely recursive, and it just blows up on the call to the Transform me...
A `StackOverflowException` in .NET typically occurs when a program exceeds the call stack capacity, often due to deep or infinite recursion. Handling this type of exception gracefully is challenging because it's considered a fatal error, and there isn't a standard way to catch it like other exceptions. However, there a...
28,943
[ { "from": "human", "value": "I would like to either prevent or handle a StackOverflowException that I am getting from a call to the XslCompiledTransform.Transform method within an Xsl Editor I am writing. The problem seems to be that the user can write an Xsl script that is infinitely recursive, and it just...
I get the following compilation error: error: expected `;' before 'it'" Here's my code: #include <boost/function.hpp> #include <list> template< class T > void example() { std::list< boost::function<T ()> >::iterator it; } Why does this happen? How can I fix it?
The compilation error you are encountering, "expected `;' before 'it'", is likely due to the fact that the `boost::function` header you've included does not seem to have a proper definition for the `iterator` type, and you're missing the `std::` namespace prefix for `list::iterator`. However, this specific error can a...
33,657
[ { "from": "human", "value": "I get the following compilation error:\nerror: expected `;' before 'it'\"\n\nHere's my code:\n#include <boost/function.hpp>\n#include <list>\n\ntemplate< class T >\nvoid example() {\n std::list< boost::function<T ()> >::iterator it;\n}\n\nWhy does this happen? How can I fix i...
I need to do an HTTP GET request in JavaScript. What's the best way to do that? I need to do this in a Mac OS X dashcode widget.
To perform an HTTP GET request in JavaScript, especially in a macOS Dashcode widget, you have a couple of options. The most common way to make HTTP requests in JavaScript is to use the `XMLHttpRequest` object or the Fetch API. However, since Dashcode is quite old and primarily uses an older version of JavaScript, you m...
30,545
[ { "from": "human", "value": "I need to do an HTTP GET request in JavaScript. What's the best way to do that?\nI need to do this in a Mac OS X dashcode widget.\n" }, { "from": "gpt", "value": "To perform an HTTP GET request in JavaScript, especially in a macOS Dashcode widget, you have a couple o...
I have a project with two silverlight apps (foo1 and foo2) and an ASP.NET web service (foo.web). When I created foo1, I configured it to be hosted in my web app by selecting "Link this Silverlight control into an existing web site" and then choosing foo.web as the site. However when I created foo2, I chose "Automatic...
To host your Silverlight application (`foo2`) within your existing ASP.NET web application (`foo.web`) instead of a generated HTML page, you will need to make a few modifications to the project configuration. Here's a step-by-step guide on what you need to do: 1. **Remove the Test Page**: First, you can delete the aut...
28,139
[ { "from": "human", "value": "I have a project with two silverlight apps (foo1 and foo2) and an ASP.NET web service (foo.web). When I created foo1, I configured it to be hosted in my web app by selecting \"Link this Silverlight control into an existing web site\" and then choosing foo.web as the site. Howe...
The MSDN documentation says that public class SomeObject { public void SomeOperation() { lock(this) { //Access instance variables } } } is "a problem if the instance can be accessed publicly". I'm wondering why? Is it because the lock will be held longer than necessary? Or is there some more in...
The concern with using `lock(this)` in the `SomeObject` class stems from the potential for other parts of your code (or even other threads) to lock on the same instance of `SomeObject` from outside the class. This can lead to several issues: 1. **Locking on Public Objects**: When you use `lock(this)`, you are locking ...
32,396
[ { "from": "human", "value": "The MSDN documentation says that\npublic class SomeObject\n{\n public void SomeOperation()\n {\n lock(this)\n {\n //Access instance variables\n }\n }\n}\n\nis \"a problem if the instance can be accessed publicly\". I'm wondering why? Is it because the lock will ...
Can Apache HTTP Server serve only static content? Tomcat is used to serve Servlets/JSP. Can Tomcat serve other dynamic contents like perl, PHP etc?
Yes, Apache HTTP Server can serve only static content. In fact, one of its primary uses is to serve static files such as HTML, CSS, JavaScript, images, and other static assets efficiently. It excels in handling static content due to its lightweight architecture and ability to manage many simultaneous requests. As for ...
33,871
[ { "from": "human", "value": "Can Apache HTTP Server serve only static content? Tomcat is used to serve Servlets/JSP. Can Tomcat serve other dynamic contents like perl, PHP etc? \n" }, { "from": "gpt", "value": "Yes, Apache HTTP Server can serve only static content. In fact, one of its primary us...
Multistrings (double null-terminated string of null-separated strings) are common in the Windows API. What's a good method for converting a multistring returned from an API to a C# string collection and vice versa? I'm especially interested in proper handling of character encoding (Windows XP an later). The following m...
To properly convert a multistring (double null-terminated string) to a C# `List<string>` (or `string[]`) and vice versa, you need to ensure that you're handling the encoding properly. In Windows, the typical encoding for strings is UTF-16, which corresponds to the `string` type in C#. Here's how you can implement both...
28,545
[ { "from": "human", "value": "Multistrings (double null-terminated string of null-separated strings) are common in the Windows API. What's a good method for converting a multistring returned from an API to a C# string collection and vice versa?\nI'm especially interested in proper handling of character encod...
Here's the scenario: You have a Windows server that users remotely connect to via RDP. You want your program (which runs as a service) to know who is currently connected. This may or may not include an interactive console session. Please note that this is the not the same as just retrieving the current interactive user...
Yes, you can retrieve information about users currently connected to a Windows server via Remote Desktop Protocol (RDP) sessions by using the Windows Terminal Services API. Specifically, you can use the `WTSEnumerateSessions` function, which is part of the Windows Terminal Services API, to enumerate active sessions on ...
23,881
[ { "from": "human", "value": "Here's the scenario:\nYou have a Windows server that users remotely connect to via RDP. You want your program (which runs as a service) to know who is currently connected. This may or may not include an interactive console session.\nPlease note that this is the not the same as j...
We are using LINQ very widely in our system. Particularly LINQ-to-objects. So in some places we end up having a LINQ query in memory build up from some huge expressions. The problem comes when there's some bug in the expressions. So we get NullReferenceException and the stack trace leads us nowhere (to [Lightweight Fun...
Debugging LINQ queries, especially when using LINQ-to-Objects, can indeed be challenging due to the way LINQ translates expressions into dynamic methods. The fact that you get a `NullReferenceException` with a stack trace pointing to "[Lightweight Function]" can make it difficult to trace back to the actual source of t...
28,537
[ { "from": "human", "value": "We are using LINQ very widely in our system. Particularly LINQ-to-objects. So in some places we end up having a LINQ query in memory build up from some huge expressions. The problem comes when there's some bug in the expressions. So we get NullReferenceException and the stack tr...
I am attempting to create a Clipboard stack in C#. Clipboard data is stored in System.Windows.Forms.DataObject objects. I wanted to store each clipboard entry (IDataObject) directly in a Generic list. Due to the way Bitmaps (seem to be) stored I am thinking I need to perform a deep copy first before I add it to the li...
You're correct that the `System.Windows.Forms.DataObject` class is not marked as `[Serializable]`, which makes binary serialization not an option for creating deep copies of clipboard data. There are a few alternative approaches you can take to achieve a deep copy of the clipboard data in C#. ### Option 1: Manual Copy...
29,787
[ { "from": "human", "value": "I am attempting to create a Clipboard stack in C#. Clipboard data is stored in System.Windows.Forms.DataObject objects. I wanted to store each clipboard entry (IDataObject) directly in a Generic list. Due to the way Bitmaps (seem to be) stored I am thinking I need to perform a ...
I need to see if a string value matches with an object value, but why won't this work? public int countPacks(String flavour) { int counter = 0; for(int index = 0; index < packets.size(); index++) { if (packets.equals(flavour)) { counter ++; } else { Syst...
The issue in your `countPacks` method arises from the way you are checking for a match between the `flavour` string and the objects in the `packets` collection (presumably a list or similar structure). In your current code, you are using `packets.equals(flavour)`, which checks if the entire `packets` collection is equa...
33,720
[ { "from": "human", "value": "I need to see if a string value matches with an object value, but why won't this work?\npublic int countPacks(String flavour) {\n int counter = 0;\n for(int index = 0; index < packets.size(); index++) { \n if (packets.equals(flavour)) {\n counte...
We have been trying Scrum but for a while now and are trying to formalize it within as our own version of Agile Application Development. Here's how our current process works. There are two main drawbacks to it as it stands right now. Wanted to get input on whether you have a similar approach and if the community has an...
Your team is facing common challenges often encountered in Agile and Scrum implementations, particularly with regard to documentation and handling critical issues during a sprint. Here are some suggestions and practices to address the two main drawbacks you've highlighted: ### Capturing Story Details Effectively 1. *...
27,986
[ { "from": "human", "value": "We have been trying Scrum but for a while now and are trying to formalize it within as our own version of Agile Application Development. Here's how our current process works. There are two main drawbacks to it as it stands right now. Wanted to get input on whether you have a sim...
How can I check if a string ends with a particular character in JavaScript? Example: I have a string var str = "mystring#"; I want to know if that string is ending with #. How can I check it? Is there a endsWith() method in JavaScript? One solution I have is take the length of the string and get the last character a...
Yes, in JavaScript, you can easily check if a string ends with a particular character using the `endsWith()` method. This method is specifically designed for this purpose and provides a clear and concise way to check the ending of a string. Here's how you can use the `endsWith()` method in your example: ```javascript...
33,552
[ { "from": "human", "value": "How can I check if a string ends with a particular character in JavaScript?\nExample: I have a string \nvar str = \"mystring#\";\n\nI want to know if that string is ending with #. How can I check it?\n\nIs there a endsWith() method in JavaScript?\nOne solution I have is take the...
I have seen lots of chat examples in Erlang but what about lists, like a work queue? If I want to build a work queue system, like a project management system, is it possible to re-order messages in a process mailbox or do I have to use message priorities? Are there examples of workflow systems built in Erlang?
In Erlang, the process mailbox operates in a FIFO (First In, First Out) manner, meaning that messages are processed in the order they arrive. Unfortunately, this means you cannot directly reorder messages in a process mailbox. If your use case requires reordering, you would need to implement that functionality at a hig...
29,670
[ { "from": "human", "value": "I have seen lots of chat examples in Erlang but what about lists, like a work queue? If I want to build a work queue system, like a project management system, is it possible to re-order messages in a process mailbox or do I have to use message priorities? Are there examples of...
I have an app that is failing on the install. The vendor says I probably have ini_set() disabled. How can I check this?
To check if `ini_set()` is disabled in your PHP environment, you can follow these steps: 1. **Create a PHP Info File**: Create a new PHP file (e.g., `info.php`) in your web server's document root directory. You can use a text editor to create this file. Add the following content to it: ```php <?php phpinf...
29,505
[ { "from": "human", "value": "I have an app that is failing on the install. The vendor says I probably have ini_set() disabled. How can I check this?\n" }, { "from": "gpt", "value": "To check if `ini_set()` is disabled in your PHP environment, you can follow these steps:\n\n1. **Create a PHP Info...
Is there a way to customize Firebug's keyboard shortcuts? I love being able to step through JavaScript code using Firebug's Script panel, but it looks like I'm limited to either using the default keyboard shortcuts for stepping over/into/out of code or using the mouse to click the appropriate button. Am I missing so...
Firebug has traditionally offered a set of keyboard shortcuts to navigate through its debugging features, but customization options for these shortcuts are limited. Firebug itself does not provide a built-in interface for changing keyboard shortcuts within the add-on. However, there are a couple of potential approache...
32,214
[ { "from": "human", "value": "Is there a way to customize Firebug's keyboard shortcuts? I love being able to step through JavaScript code using Firebug's Script panel, but it looks like I'm limited to either using the default keyboard shortcuts for stepping over/into/out of code or using the mouse to click ...
Correct me if I am wrong, int is 4 bytes, with a range of values from -2,147,483,648 to 2,147,483,647 (2^31) long is 4 bytes, with a range of values from -2,147,483,648 to 2,147,483,647 (2^31) What is the difference in C++? Can they be used interchangeably?
Your understanding contains some inaccuracies regarding the size and range of `int` and `long` in C++. Let's clarify the details: 1. **`int`:** - Typically, on most platforms, `int` is 4 bytes (32 bits). - This provides a range of values from -2,147,483,648 to 2,147,483,647 (from `-2^31` to `2^31 - 1`). 2. **`l...
32,390
[ { "from": "human", "value": "Correct me if I am wrong,\nint is 4 bytes, with a range of values from -2,147,483,648 to 2,147,483,647 (2^31)\nlong is 4 bytes, with a range of values from -2,147,483,648 to 2,147,483,647 (2^31)\nWhat is the difference in C++? Can they be used interchangeably?\n" }, { "...
We have a website; which, till now had only HTML pages. Now we are redeveloping it in ASP .Net. This means that all the .html pages will be changed to .aspx extension. The problem is, there are a lot of external references to these pages, and we dont want to go and chage each and every link to aspx right away. Is there...
Yes, you can easily redirect requests from `.html` pages to their corresponding `.aspx` pages using URL rewriting or redirection techniques available in ASP.NET. Below are a couple of approaches you can use to achieve this. ### Option 1: Using URL Rewriting with `web.config` You can add URL rewriting rules in the `we...
32,186
[ { "from": "human", "value": "We have a website; which, till now had only HTML pages. Now we are redeveloping it in ASP .Net.\nThis means that all the .html pages will be changed to .aspx extension. The problem is, there are a lot of external references to these pages, and we dont want to go and chage each a...
I have a class which extends SWFLoader, I use it like a normal SWFLoader: var loader:MySWFLoader = new MySWFLoader(); loader.load("myFile.SWF"); myScene.addChild(loader); The loading works OK, except that it remains 0 because the width & height never change from 0. I had to override the width/height get properties to ...
The issue you are experiencing with the `width` and `height` properties of your `MySWFLoader` not reflecting the dimensions of the loaded SWF could indeed be related to several factors. Here are a few considerations to help diagnose and resolve the problem: 1. **SWF Content Structure**: If the SWF file contains multip...
30,504
[ { "from": "human", "value": "I have a class which extends SWFLoader, I use it like a normal SWFLoader:\nvar loader:MySWFLoader = new MySWFLoader();\nloader.load(\"myFile.SWF\");\nmyScene.addChild(loader);\n\nThe loading works OK, except that it remains 0 because the width & height never change from 0. I had...
I have a DataTrigger defined in my XAML which I want to use in several places. Is it possible to define it as a resource and then share it? Here's my trigger: <TextBlock.Style> <Style> <Style.Triggers> <DataTrigger Binding="{Binding HasCurrentTest}" Value="True"> <Setter Property...
Yes, you can definitely define a `DataTrigger` as a resource in your XAML so that you can reuse it across multiple controls. In order to share the `DataTrigger`, you'll need to encapsulate it in a `Style`, give it a key, and then apply that style to your controls. Here is a step-by-step guide on how to do this: 1. **...
31,309
[ { "from": "human", "value": "I have a DataTrigger defined in my XAML which I want to use in several places. Is it possible to define it as a resource and then share it?\nHere's my trigger:\n<TextBlock.Style>\n <Style>\n <Style.Triggers>\n <DataTrigger Binding=\"{Binding HasCurrentTest}\...
I was hoping to do something like this, but it appears to be illegal in C#: public Collection MethodThatFetchesSomething<T>() where T : SomeBaseClass { return T.StaticMethodOnSomeBaseClassThatReturnsCollection(); } I get a compile-time error: 'T' is a 'type parameter', which is not valid in the given context....
In C#, you cannot directly call a static method of a generic type parameter `T` using `T` itself, because static members are not associated with the type parameter at runtime. Instead, they belong to the actual type that the parameter represents. To achieve what you want, you have a couple of options: 1. **Use a typ...
27,954
[ { "from": "human", "value": "I was hoping to do something like this, but it appears to be illegal in C#:\npublic Collection MethodThatFetchesSomething<T>()\n where T : SomeBaseClass\n{\n return T.StaticMethodOnSomeBaseClassThatReturnsCollection();\n}\n\nI get a compile-time error:\n\n'T' is a 'type pa...
I've made a Django site, but I've drank the Koolaid and I want to make an IPhone version. After putting much thought into I've come up with two options: Make a whole other site, like i.xxxx.com. Tie it into the same database using Django's sites framework. Find some time of middleware that reads the user-agent, and ...
It sounds like you've made some solid progress in developing a mobile-friendly version of your Django site. Your approach of using middleware alongside conditional template rendering is a common and effective strategy for serving different content based on user agents, and it's great that you're using a library like `m...
30,434
[ { "from": "human", "value": "I've made a Django site, but I've drank the Koolaid and I want to make an IPhone version. After putting much thought into I've come up with two options:\n\nMake a whole other site, like i.xxxx.com. Tie it into the same database using Django's sites framework.\nFind some time o...
I wanted to make Map of Collections in Java, so I can make something like public void add(K key, V value) { if (containsKey(key)) { get(key).add(value); } else { Collection c = new Collection(); c.add(value); put(key, value); } } I've tried to make it with something like...
Your approach to creating a generic map that associates keys with collections of values (like `Set` or `List`) is correct. You've already outlined a good design with your abstract class `CollectionMap`, which allows for the flexibility of using different collection types without duplication of code. I'll provide a comp...
30,176
[ { "from": "human", "value": "I wanted to make Map of Collections in Java, so I can make something like \npublic void add(K key, V value) { \n if (containsKey(key)) {\n get(key).add(value);\n } else {\n Collection c = new Collection();\n c.add(value);\n put(key, value);\n ...
I want to do something like: exec sproc1 and sproc2 at the same time when they are both finished exec sproc3 I can do this in dts. Is there a way to do it in transact sql? Or is there a way to do it with a batch script (eg vbs or powershell)?
You can achieve parallel execution of stored procedures in SQL Server by using SQL Server Agent jobs or by executing multiple processes asynchronously. However, if you want to manage the execution and wait for both stored procedures to complete before executing a third, you might have to resort to other methods, as T-S...
29,726
[ { "from": "human", "value": "I want to do something like:\nexec sproc1 and sproc2 at the same time\nwhen they are both finished exec sproc3\n\nI can do this in dts.\nIs there a way to do it in transact sql?\nOr is there a way to do it with a batch script (eg vbs or powershell)?\n" }, { "from": "gpt"...
There's a cots (commercial off-the-shelf) application that I work on customizing, where a couple of pages take an extremely long time to load for certain distributions of data. (I'm talking approximately 3 minutes for a page to load in this instance... and the time is growing exponentially). Clearly this is unacceptab...
Yes, there are several studies and guidelines regarding acceptable response times for web applications and user interfaces. Here are some key findings and resources that you can reference: 1. **Nielsen Norman Group (NNG) Studies**: - Jakob Nielsen, a prominent user experience researcher, has suggested that response...
28,194
[ { "from": "human", "value": "There's a cots (commercial off-the-shelf) application that I work on customizing, where a couple of pages take an extremely long time to load for certain distributions of data. (I'm talking approximately 3 minutes for a page to load in this instance... and the time is growing ex...
I often marvel at how I can go to www.google.com, from anywhere in the world at any time, and get the returned page so fast. Sure, they compress their output and keep to a minimal design - that helps. But they must have millions of simultaneous hits to the box sitting on the web that DNS lists as "www.google.com". All ...
You’re right to marvel at the performance and scalability of services like Google. The speed and reliability of their web services are the result of a combination of advanced technologies, architecture, and practices. Here are some key components that help Google and similar services handle millions of requests efficie...
27,988
[ { "from": "human", "value": "I often marvel at how I can go to www.google.com, from anywhere in the world at any time, and get the returned page so fast.\nSure, they compress their output and keep to a minimal design - that helps.\nBut they must have millions of simultaneous hits to the box sitting on the w...
I have two C++ processes (A and B), executing under Windows, where one launches the other. I would like to effectively single-thread their execution. For example: Start process A A creates B A suspends B executes some fixed set of operations B suspends and A is resumed A executes some fixed set of operations A suspend...
To achieve single-threaded execution between two processes (A and B) in Windows, where they alternately suspend and resume each other, you can use a combination of Windows synchronization objects and inter-process communication (IPC) mechanisms. Below is a recommended approach using `Events` for synchronization and `Pr...
29,073
[ { "from": "human", "value": "I have two C++ processes (A and B), executing under Windows, where one launches the other. I would like to effectively single-thread their execution. For example:\n\nStart process A\nA creates B\nA suspends\nB executes some fixed set of operations\nB suspends and A is resumed\nA...
If I'm deep in a nest of loops I'm wondering which of these is more efficient: if (!isset($array[$key])) $array[$key] = $val; or $array[$key] = $val; The second form is much more desirable as far as readable code goes. In reality the names are longer and the array is multidimensional. So the first form ends up lookin...
When considering the performance of the two forms of code you've presented, it's important to analyze how each one functions, especially in a frequently-executed context. ### Code Forms 1. **First Form (Using `isset`)**: ```php if (!isset($array[$key])) $array[$key] = $val; ``` 2. **Second Form (Direct Assi...
23,674
[ { "from": "human", "value": "If I'm deep in a nest of loops I'm wondering which of these is more efficient:\nif (!isset($array[$key])) $array[$key] = $val;\n\nor\n$array[$key] = $val;\n\nThe second form is much more desirable as far as readable code goes. In reality the names are longer and the array is mul...
I have two applications under tomcat/webapps folder. tomcat/webapps/App1 tomcat/webapps/App2 Both applications share the same libraries. Which are stored for example in tomcat/webapps/App1/WEB-INF/lib. Are both libraries loaded twice in memory? Should I put these shared libraries in tomcat/server/lib?
When you deploy applications in Tomcat, each application has its own isolated classloader. This means that if you have two applications (e.g., App1 and App2) that each contain a copy of the same library in their respective `WEB-INF/lib` directories, those libraries will indeed be loaded separately for each application....
32,289
[ { "from": "human", "value": "I have two applications under tomcat/webapps folder. \ntomcat/webapps/App1\ntomcat/webapps/App2\n\nBoth applications share the same libraries. Which are stored for example in tomcat/webapps/App1/WEB-INF/lib.\nAre both libraries loaded twice in memory?\nShould I put these share...
The title is kind of obscure. What I want to know is if this is possible: string typeName = <read type name from somwhere>; Type myType = Type.GetType(typeName); MyGenericClass<myType> myGenericClass = new MyGenericClass<myType>(); Obviously, MyGenericClass is described as: public class MyGenericClass<T> Right now, ...
In C#, you cannot use a variable to specify a type parameter at compile time in a generic class instantiation. The type parameters for generics must be known at compile time, and using a variable such as `myType` as a type parameter does not meet this requirement. However, you can achieve similar functionality through...
30,522
[ { "from": "human", "value": "The title is kind of obscure. What I want to know is if this is possible:\nstring typeName = <read type name from somwhere>;\nType myType = Type.GetType(typeName);\n\nMyGenericClass<myType> myGenericClass = new MyGenericClass<myType>();\n\nObviously, MyGenericClass is described ...