instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
I have taken over a large code base and would like to get an overview how and where certain classes and their methods are used. Is there any good tool that can somehow visualize the dependencies and draw a nice call tree or something similar? The code is in C++ in Visual Studio if that helps narrow down any selection.
Taking over a large codebase can be daunting, but there are several tools and features available in Visual Studio and third-party tools that can help you visualize dependencies and call trees for C++ code. ### 1. **Visual Studio Built-in Features** - **Code Map**: Visual Studio includes a feature called Code Map (ava...
7,440
[ { "from": "human", "value": "I have taken over a large code base and would like to get an overview how and where certain classes and their methods are used.\nIs there any good tool that can somehow visualize the dependencies and draw a nice call tree or something similar?\nThe code is in C++ in Visual Studi...
Is it possible for ASP.NET to mix up which user is associated with which session variable on the server? Are session variables immutably tied to the original user that created them across time, space & dimension?
In ASP.NET, session variables are designed to be tied to a specific user session. Each user's session is typically identified by a unique session ID stored in a cookie or passed in the URL. This mechanism ensures that session variables associated with one user are not accessible to another user, thus maintaining sessio...
7,660
[ { "from": "human", "value": "Is it possible for ASP.NET to mix up which user is associated with which session variable on the server? Are session variables immutably tied to the original user that created them across time, space & dimension?\n" }, { "from": "gpt", "value": "In ASP.NET, session v...
I'm looking for a way to add multiple properties to the SecureCustomProperties value in my .msi installer's property table. I've tried comma delimiting, semi-colon delimiting, and even space delimiters. None of the above seem to work. Hints?
When dealing with the `SecureCustomProperties` property in a Windows Installer (.msi) package, it's important to note that you typically need to define secure properties individually. The `SecureCustomProperties` property is a list of property names that should be treated as secure, and they should be separated by a se...
8,863
[ { "from": "human", "value": "I'm looking for a way to add multiple properties to the SecureCustomProperties value in my .msi installer's property table. I've tried comma delimiting, semi-colon delimiting, and even space delimiters. None of the above seem to work.\nHints?\n" }, { "from": "gpt", ...
Ruby has two different exceptions mechanisms: Throw/Catch and Raise/Rescue. Why do we have two? When should you use one and not the other?
In Ruby, the two exception mechanisms—`throw/catch` and `raise/rescue`—serve different purposes and are designed to handle different types of control flow and error management. Here’s an overview of both mechanisms, why we have them, and when to use each. ### `throw/catch` - **Purpose**: The `throw/catch` mechanism i...
7,104
[ { "from": "human", "value": "Ruby has two different exceptions mechanisms: Throw/Catch and Raise/Rescue.\nWhy do we have two?\nWhen should you use one and not the other? \n" }, { "from": "gpt", "value": "In Ruby, the two exception mechanisms—`throw/catch` and `raise/rescue`—serve different purp...
This came to my mind after I learned the following from this question: where T : struct We, C# developers, all know the basics of C#. I mean declarations, conditionals, loops, operators, etc. Some of us even mastered the stuff like Generics, anonymous types, lambdas, LINQ, ... But what are the most hidden features or ...
C# is a rich language with many features, some of which are lesser-known even among experienced developers. Here are several hidden features, tricks, or aspects of C# that may not be widely recognized: ### Language Features 1. **Attributes on Parameters**: You can decorate parameters with attributes in method signatu...
5,652
[ { "from": "human", "value": "This came to my mind after I learned the following from this question:\nwhere T : struct\n\nWe, C# developers, all know the basics of C#. I mean declarations, conditionals, loops, operators, etc.\nSome of us even mastered the stuff like Generics, anonymous types, lambdas, LINQ, ...
Are the any task tracking systems with command-line interface? Here is a list of features I'm interested in: Simple task template Something like plain-text file with property:type pairs, for example: description:string some-property:integer required command line interface for example: // Creates task <tas...
There are several task tracking systems with command-line interfaces that may meet your requirements. However, given the specific features you mentioned, including simple task templates, a command-line interface, XCOPY deployment, and multi-user support, the options may be limited. Here are a few possibilities that you...
7,394
[ { "from": "human", "value": "Are the any task tracking systems with command-line interface? \nHere is a list of features I'm interested in:\n\nSimple task template\nSomething like plain-text file with property:type pairs, for example:\n\n\ndescription:string \nsome-property:integer required\n\n\n\ncommand ...
I've never used any of the .NET generics in my work, but I understand that they are fairly popular. Does anyone have any good links or book suggestions for learning them? As a bonus; I only vaguely understand what .NET generic collections are and what they do...does anyone have any practical examples of how they migh...
Absolutely, .NET generics are a powerful feature that allows you to define classes, methods, and interfaces with a placeholder for the data type, providing type safety and code reusability without compromising performance. Here's a breakdown of learning resources and practical examples of how generics, especially gener...
4,681
[ { "from": "human", "value": "I've never used any of the .NET generics in my work, but I understand that they are fairly popular. Does anyone have any good links or book suggestions for learning them? As a bonus; I only vaguely understand what .NET generic collections are and what they do...does anyone hav...
My attempts to install modperl under the default vanilla Leopard Apache 2 have failed and all I can find online are variations on this: I would like if possible not to rely on MacPorts or Fink, though if they can be made to work with the default Apache 2 install that would probably be ok.
Installing mod_perl on macOS Leopard (10.5) with the default Apache 2 installation can be a bit tricky, especially if you want to avoid using package managers like MacPorts or Fink. However, it's possible to compile and install mod_perl from source with a vanilla Apache installation. Here’s a step-by-step guide to help...
5,046
[ { "from": "human", "value": "My attempts to install modperl under the default vanilla Leopard Apache 2 have failed and all I can find online are variations on this:\nI would like if possible not to rely on MacPorts or Fink, though if they can be made to work with the default Apache 2 install that would prob...
Often, I find myself wanting to write a unit test for a portion of code that accesses HTTP resources as part of its normal function. Have you found any good ways to write these kinds of tests?
Absolutely! When writing unit tests for code that interacts with HTTP resources, it’s important to isolate the unit of work being tested from external dependencies like network calls. Here are some effective strategies to accomplish this: ### 1. Mocking HTTP Calls One of the most common approaches is to use a mocking ...
4,808
[ { "from": "human", "value": "Often, I find myself wanting to write a unit test for a portion of code that accesses HTTP resources as part of its normal function. Have you found any good ways to write these kinds of tests?\n" }, { "from": "gpt", "value": "Absolutely! When writing unit tests for c...
I have a class with a string property that's actually several strings joined with a separator. I'm wondering if it is good form to have a proxy property like this: public string ActualProperty { get { return actualProperty; } set { actualProperty = value; } } public string[] IndividualStrings { get { retur...
Your approach of creating a proxy property to handle the split and join operations for a string property is a common pattern. However, there are a few considerations and potential risks you should be aware of: 1. **Inconsistent State**: If `ActualProperty` is changed directly (for example, through some other method), ...
7,989
[ { "from": "human", "value": "I have a class with a string property that's actually several strings joined with a separator.\nI'm wondering if it is good form to have a proxy property like this:\npublic string ActualProperty\n{\n get { return actualProperty; }\n set { actualProperty = value; }\n}\n\npu...
Hallo, i am using WSS 3.0 and i need to display certain entries of a website's navigation ("Quicklaunch") to specified groups only. According to this blogpost this can be done using properties of the SPNavigationNode - but it seems the solution to the problem is 'MOSS only'. Is there a way to do this in WSS?
In Windows SharePoint Services (WSS) 3.0, there are limited built-in capabilities for customizing navigation elements such as the Quick Launch based on user permissions or group memberships. Unlike Microsoft Office SharePoint Server (MOSS) where you could use more advanced features and customizations, WSS 3.0 lacks som...
7,481
[ { "from": "human", "value": "Hallo, i am using WSS 3.0 and i need to display certain entries of a website's navigation (\"Quicklaunch\") to specified groups only. According to this blogpost this can be done using properties of the SPNavigationNode - but it seems the solution to the problem is 'MOSS only'. I...
I feel like I have a very basic/stupid question, yet I never saw/read/heard anything in this direction. Say I have a table users(userId, name) and a table preferences(id, userId, language). The example is trivial but could be extended to a situation with multi-level relations and way more tables.. When my UI requests t...
Your intuition is on the right track in recognizing the complexities of relational data management and the importance of user interfaces communicating potential impacts of data deletions. However, there are better ways to approach this scenario that avoid the drawbacks and complexity of dynamically changing database co...
7,049
[ { "from": "human", "value": "I feel like I have a very basic/stupid question, yet I never saw/read/heard anything in this direction.\nSay I have a table users(userId, name) and a table preferences(id, userId, language). The example is trivial but could be extended to a situation with multi-level relations a...
In a multitasking operating system context, sometimes you hear the term round-robin scheduling. What does it refer to? What other kind of scheduling is there?
Round-robin scheduling is a CPU scheduling algorithm used in multitasking operating systems that allows each process to have a fair share of the CPU time. In this approach, each process is assigned a fixed time slot (or quantum) in which it can execute. Once a process's time slot expires, the CPU scheduler moves on to ...
7,610
[ { "from": "human", "value": "In a multitasking operating system context, sometimes you hear the term round-robin scheduling. What does it refer to?\nWhat other kind of scheduling is there?\n" }, { "from": "gpt", "value": "Round-robin scheduling is a CPU scheduling algorithm used in multitasking ...
An OleDB provider is a binary implementing COM interfaces provided by Microsoft. From that it seems to be possible to create a provider using C#. Is that correct? Is there a sample demonstrating that? If not, would you discourage me from doing that? I see that there are multiple unmanaged samples but I can't find any m...
Yes, it is technically possible to create an OLE DB provider using C#. However, doing so involves a complex integration of unmanaged code and COM Interop, which can be challenging and is generally not the typical use case for C#. Most OLE DB providers are implemented in C or C++ due to the need for low-level memory man...
6,612
[ { "from": "human", "value": "An OleDB provider is a binary implementing COM interfaces provided by Microsoft. From that it seems to be possible to create a provider using C#. Is that correct? Is there a sample demonstrating that? If not, would you discourage me from doing that? I see that there are multiple...
In an Outlook 2003 macro; Is there a way to move a message between folders without changing the ReceivedTime-header? I currently use the method MailItem.Move. But that automatically sets the ReceivedTime property to the current time, which isn't really what I want.
In Outlook 2003, when you use the `MailItem.Move` method to move an email message between folders, it does indeed update the `ReceivedTime` property to the current time, which can be problematic if you want to preserve the original received date and time. Unfortunately, Outlook's object model does not provide a direct...
6,343
[ { "from": "human", "value": "In an Outlook 2003 macro; Is there a way to move a message between folders without changing the ReceivedTime-header?\nI currently use the method MailItem.Move. But that automatically sets the ReceivedTime property to the current time, which isn't really what I want.\n" }, { ...
I would like to pass an argument(s) to a method being defined using define_method, how would I do that?
In Ruby, you can use `define_method` to define a method dynamically and pass arguments to it. When you use `define_method`, you define a method within the context of a class or module, and you can specify any number of parameters just like you would with a regular method. Here's an example of how to do this: ```ruby ...
5,728
[ { "from": "human", "value": "I would like to pass an argument(s) to a method being defined using define_method, how would I do that?\n" }, { "from": "gpt", "value": "In Ruby, you can use `define_method` to define a method dynamically and pass arguments to it. When you use `define_method`, you de...
Are there any real world applications written in the Clean programming language? Either open source or proprietary.
Clean is a functional programming language that emphasizes purity and strong type systems. While it is not as widely used as other functional languages like Haskell or Scala, there are some applications and projects developed using Clean, both open source and proprietary. 1. **Open Source Projects**: There are some s...
10,883
[ { "from": "human", "value": "Are there any real world applications written in the Clean programming language? Either open source or proprietary.\n" }, { "from": "gpt", "value": "Clean is a functional programming language that emphasizes purity and strong type systems. While it is not as widely u...
Is it possible to select from show tables in MySQL? SELECT * FROM (SHOW TABLES) AS `my_tables` Something along these lines, though the above does not work (on 5.0.51a, at least).
In MySQL, the `SHOW TABLES` command is a statement and not a regular table. Therefore, you cannot use it directly in a `SELECT` statement like that. The syntax you attempted will not work because `SHOW TABLES` does not return a result set that can be treated like a table. However, if you want to retrieve the list of t...
11,493
[ { "from": "human", "value": "Is it possible to select from show tables in MySQL?\nSELECT * FROM (SHOW TABLES) AS `my_tables`\n\nSomething along these lines, though the above does not work (on 5.0.51a, at least).\n" }, { "from": "gpt", "value": "In MySQL, the `SHOW TABLES` command is a statement ...
I'm attempting to use an existing CAS server to authenticate login for a Perl CGI web script and am using the AuthCAS Perl module (v 1.3.1). I can connect to the CAS server to get the service ticket but when I try to connect to validate the ticket my script returns with the following error from the IO::Socket::SSL mod...
Based on the information you provided and the error message you're seeing, it looks like the issue might be related to the hostname resolution or the SSL configuration when the script runs in the CGI environment (like under a web server) versus in the command line. Here are a few steps to troubleshoot and possibly res...
6,548
[ { "from": "human", "value": "I'm attempting to use an existing CAS server to authenticate login for a Perl CGI web script and am using the AuthCAS Perl module (v 1.3.1). I can connect to the CAS server to get the service ticket but when I try to connect to validate the ticket my script returns with the fol...
I would like to display an RTF document in an SWT (actually Eclipse RCP) application. I know there is a Swing widget for displaying and editing RTF text, but it is Swing and quite alien in look and feel when used in the otherwise platform (not to mention that to the last of my knowledge it did not display images and ha...
Displaying RTF documents within an Eclipse RCP application can be challenging due to the limitations of SWT in handling rich text formats natively. Here are several options you can consider for displaying rich documents in your application: 1. **Using JavaFX WebView**: Since SWT supports embedding JavaFX components, y...
7,375
[ { "from": "human", "value": "I would like to display an RTF document in an SWT (actually Eclipse RCP) application.\nI know there is a Swing widget for displaying and editing RTF text, but it is Swing and quite alien in look and feel when used in the otherwise platform (not to mention that to the last of my ...
How can I tell in JavaScript what path separator is used in the OS where the script is running?
In JavaScript, you can determine the path separator used by the operating system by checking the `path` module if you are running in a Node.js environment. The `path` module provides utilities for working with file and directory paths, and it has a property `sep` that gives you the correct path separator based on the O...
10,653
[ { "from": "human", "value": "How can I tell in JavaScript what path separator is used in the OS where the script is running?\n" }, { "from": "gpt", "value": "In JavaScript, you can determine the path separator used by the operating system by checking the `path` module if you are running in a Nod...
Programming PHP in Eclipse PDT is predominately a joy: code completion, templates, method jumping, etc. However, one thing that drives me crazy is that I can't get my lines in PHP files to word wrap so on long lines I'm typing out indefinitely to the right. I click on Windows|Preferences and type in "wrap" and get: - J...
To enable word wrapping in Eclipse PDT for PHP files, you can follow these steps: 1. **Open Preferences**: - Go to `Window` > `Preferences`. 2. **Navigate to PHP Editor Settings**: - In the Preferences dialog, expand the `PHP` category on the left side. - Then click on `Editor`. 3. **Enable Word Wrap**: ...
10,141
[ { "from": "human", "value": "Programming PHP in Eclipse PDT is predominately a joy: code completion, templates, method jumping, etc.\nHowever, one thing that drives me crazy is that I can't get my lines in PHP files to word wrap so on long lines I'm typing out indefinitely to the right.\nI click on Windows|...
What are the biggest pros and cons of Apache Thrift vs Google's Protocol Buffers?
Apache Thrift and Google Protocol Buffers (protobuf) are both popular frameworks for serialization and communication in distributed systems. Each has its own set of advantages and disadvantages. Here are some of the biggest pros and cons of each: ### Apache Thrift #### Pros: 1. **Multi-language Support**: Thrift supp...
6,727
[ { "from": "human", "value": "What are the biggest pros and cons of Apache Thrift vs Google's Protocol Buffers?\n" }, { "from": "gpt", "value": "Apache Thrift and Google Protocol Buffers (protobuf) are both popular frameworks for serialization and communication in distributed systems. Each has it...
I have a service contract that defines a method with a parameter of type System.Object (xs:anyType in the WSDL). I want to be able to pass simple types as well as complex types in this parameter. Simple types work fine, but when I try to pass a complex type that is defined in my WSDL, I get this error: Element 'http:...
In WCF (Windows Communication Foundation), when you are trying to pass complex types through a method that accepts a parameter of type `System.Object` (or `xs:anyType` in WSDL), you may run into issues with the serialization of the complex types. This is particularly true when the types being passed aren't automaticall...
6,337
[ { "from": "human", "value": "I have a service contract that defines a method with a parameter of type System.Object (xs:anyType in the WSDL). I want to be able to pass simple types as well as complex types in this parameter. Simple types work fine, but when I try to pass a complex type that is defined in ...
I have written a message handler function in Outlook's Visual Basic (we're using Outlook 2003 and Exchange Server) to help me sort out incoming email. It is working for me, except sometimes the rule fails and Outlook deactivates it. Then I turn the rule back on and manually run it on my Inbox to catch up. The rule sp...
If your VBA message handler function in Outlook 2003 is causing rules to spontaneously deactivate, it could be due to several reasons. Below are some troubleshooting tips and suggestions to help you fix this issue: ### 1. Debugging the VBA Code Make sure your VBA code is robust and handles all possible scenarios. Here...
5,032
[ { "from": "human", "value": "I have written a message handler function in Outlook's Visual Basic (we're using Outlook 2003 and Exchange Server) to help me sort out incoming email. \nIt is working for me, except sometimes the rule fails and Outlook deactivates it. \nThen I turn the rule back on and manually ...
Any suggestions on the best way to ensure thread safety when changing the properties on Form controls? I have been using Me. Invoke in the past, and I was wondering if you have pros/cons, comments, suggestions, etc.
When it comes to updating Windows Forms controls from a different thread (i.e., a thread that is not the UI thread), you must ensure thread safety to avoid potential issues such as exceptions or unpredictable behavior. Here are some options, including the use of `Invoke`, along with their pros and cons: ### 1. Using `...
5,507
[ { "from": "human", "value": "Any suggestions on the best way to ensure thread safety when changing the properties on Form controls? I have been using Me. Invoke in the past, and I was wondering if you have pros/cons, comments, suggestions, etc.\n" }, { "from": "gpt", "value": "When it comes to u...
While creating classes in Java I often find myself creating instance-level collections that I know ahead of time will be very small - less than 10 items in the collection. But I don't know the number of items ahead of time so I typically opt for a dynamic collection (ArrayList, Vector, etc). class Foo { ArrayList<Bar...
Your concern about using dynamic collections for small, fixed-size collections in Java is understandable, particularly if you want to be efficient in both performance and memory usage. However, the choice of data structure often depends on the specific use case and desired functionality. For your case where the collec...
6,632
[ { "from": "human", "value": "While creating classes in Java I often find myself creating instance-level collections that I know ahead of time will be very small - less than 10 items in the collection. But I don't know the number of items ahead of time so I typically opt for a dynamic collection (ArrayList, ...
While searching the interweb for a solution for my VB.net problems I often find helpful articles on a specific topic, but the code is C#. That is no big problem but it cost some time to convert it to VB manually. There are some sites that offer code converters from C# to VB and vice versa, but to fix all the flaws afte...
Yes, code conversion between C# and VB.NET can be a hassle, and while online converters can be helpful, they often don't produce perfect code that requires little to no modification. Here are some better options you can consider: 1. **Telerik Code Converter**: This is a popular and reliable online converter for C# to ...
7,344
[ { "from": "human", "value": "While searching the interweb for a solution for my VB.net problems I often find helpful articles on a specific topic, but the code is C#. That is no big problem but it cost some time to convert it to VB manually.\nThere are some sites that offer code converters from C# to VB and...
In Ruby, like in many other OO programming languages, operators are overloadable. However, only certain character operators can be overloaded. This list may be incomplete but, here are some of the operators that cannot be overloaded: !, not, &&, and, ||, or
In Ruby, operator overloading allows you to define how operators behave for instances of your custom classes. However, there are indeed some operators that cannot be overloaded. As you mentioned, the following logical operators are examples of operators that Ruby does not allow you to overload: - `!` (logical NOT) - `...
9,515
[ { "from": "human", "value": "In Ruby, like in many other OO programming languages, operators are overloadable. However, only certain character operators can be overloaded.\nThis list may be incomplete but, here are some of the operators that cannot be overloaded: \n!, not, &&, and, ||, or\n\n" }, { ...
When I run indent with various options I want against my source, it does what I want but also messes with the placement of *s in pointer types: -int send_pkt(tpkt_t* pkt, void* opt_data); -void dump(tpkt_t* bp); +int send_pkt(tpkt_t * pkt, void *opt_data); +void dump(tpkt * bp); I know my placement of *s next ...
To address your concern with `indent` and the positioning of the asterisk (`*`) in pointer types, it's important to understand that `indent` applies a set of formatting rules that may not align with your preferences for pointer declaration style. While `indent` doesn't offer a direct option to preserve your pointer sty...
7,860
[ { "from": "human", "value": "When I run indent with various options I want against my source, it does what I want but also messes with the placement of *s in pointer types:\n -int send_pkt(tpkt_t* pkt, void* opt_data);\n -void dump(tpkt_t* bp);\n +int send_pkt(tpkt_t * pkt, void *opt_data);\n +void dump...
Say I have the following methods: def methodA(arg, **kwargs): pass def methodB(arg, *args, **kwargs): pass In methodA I wish to call methodB, passing on the kwargs. However, it seems that if I define methodA as follows, the second argument will be passed on as positional rather than named variable arguments. ...
To pass `**kwargs` from `methodA` to `methodB`, you need to unpack the `kwargs` dictionary. When calling `methodB`, you can use the `**` syntax to achieve this. Here's how you can do it: ```python def methodA(arg, **kwargs): methodB("argvalue", **kwargs) def methodB(arg, *args, **kwargs): print("Positional a...
11,000
[ { "from": "human", "value": "Say I have the following methods:\ndef methodA(arg, **kwargs):\n pass\n\ndef methodB(arg, *args, **kwargs):\n pass\n\nIn methodA I wish to call methodB, passing on the kwargs. However, it seems that if I define methodA as follows, the second argument will be passed on as p...
When I do a clean build my C# project, the produced dll is different then the previously built one (which I saved separately). No code changes were made, just clean and rebuild. Diff shows some bytes in the DLL have changes -- few near the beginning and few near the end, but I can't figure out what these represent. Do...
It's not uncommon to see differences in a DLL after a clean rebuild, even when no code changes have been made. Here are several factors that could be contributing to the differences you're observing, along with suggestions on how to mitigate them: ### 1. Timestamp When you build a project in Visual Studio, the compile...
7,410
[ { "from": "human", "value": "When I do a clean build my C# project, the produced dll is different then the previously built one (which I saved separately). No code changes were made, just clean and rebuild. \nDiff shows some bytes in the DLL have changes -- few near the beginning and few near the end, but I...
Attended an interesting demo on REST today, however, I couldn't think of a single reason (nor was one presented) why REST is in anyway better or simpler to use and implement than a SOAP based Services stack. What are some of the reasons Why anyone in the "real world" use REST instead of the SOAP based Services?
Both REST (Representational State Transfer) and SOAP (Simple Object Access Protocol) are popular methods for building web services, but they have different characteristics that may make one more suitable than the other depending on the requirements of a given project. Here are some reasons why many developers and organ...
6,424
[ { "from": "human", "value": "Attended an interesting demo on REST today, however, I couldn't think of a single reason (nor was one presented) why REST is in anyway better or simpler to use and implement than a SOAP based Services stack.\nWhat are some of the reasons Why anyone in the \"real world\" use REST...
I'm wondering about MP3 decoding/encoding, and I was hoping to pull this off in Flash using AS3 I'm sure it'll be a right pain... I have no idea where to start, can anyone offer any pointers? reference material? ----much later--- Thank you all very much for your input... It seems I have a long road ahead of me yet!
Working with MP3 encoding and decoding in ActionScript 3 (AS3) can indeed be a challenge, especially since Flash isn't primarily designed for audio processing at that level. However, here are some pointers and resources to help you get started: ### Understanding MP3 Encoding/Decoding 1. **Basics of MP3 Format**: Fami...
6,613
[ { "from": "human", "value": "I'm wondering about MP3 decoding/encoding, and I was hoping to pull this off in Flash using AS3\nI'm sure it'll be a right pain...\nI have no idea where to start, can anyone offer any pointers? reference material?\n----much later---\nThank you all very much for your input... It ...
How do you create a "dockable" form, similar to the windows in Visual Studio?
Creating a "dockable" form similar to the windows in Visual Studio requires implementing a system that allows windows (or panels) to be dragged and docked to the edges of a main window or be floated freely. This functionality can be achieved using various approaches depending on the framework you are using. Below are e...
4,416
[ { "from": "human", "value": "How do you create a \"dockable\" form, similar to the windows in Visual Studio?\n" }, { "from": "gpt", "value": "Creating a \"dockable\" form similar to the windows in Visual Studio requires implementing a system that allows windows (or panels) to be dragged and dock...
I have the following query: select column_name, count(column_name) from table group by column_name having count(column_name) > 1; What would be the difference if I replaced all calls to count(column_name) to count(*)? This question was inspired by How do I find duplicate values in a table in Oracle?. To clarify the a...
In SQL, the `COUNT()` function can be used in different ways, and understanding how it works with `NULL` values is key to your question. Here's a breakdown of the two variations of the query: 1. **Using `COUNT(column_name)`**: - This counts the number of non-NULL values in `column_name`. - If `column_name` con...
7,657
[ { "from": "human", "value": "I have the following query:\nselect column_name, count(column_name)\nfrom table\ngroup by column_name\nhaving count(column_name) > 1;\n\nWhat would be the difference if I replaced all calls to count(column_name) to count(*)?\nThis question was inspired by How do I find duplicate...
just wondering what it is. Edit: I know it's not a type of array but just a feature. So what does it mean by one-element-too-large ?
The term "one-element-too-large" typically refers to a situation in programming or data structures where an operation attempts to accommodate more elements than the underlying structure can handle, often leading to errors or unexpected behavior. For example, in the context of data structures like arrays, lists, or st...
11,148
[ { "from": "human", "value": "just wondering what it is.\nEdit: I know it's not a type of array but just a feature. So what does it mean by one-element-too-large ?\n" }, { "from": "gpt", "value": "The term \"one-element-too-large\" typically refers to a situation in programming or data structures...
What's the fastest way to count the number of keys/properties of an object? Is it possible to do this without iterating over the object? I.e., without doing: var count = 0; for (k in myobj) if (myobj.hasOwnProperty(k)) ++count; (Firefox did provide a magic __count__ property, but this was removed somewhere around ver...
In JavaScript, the fastest way to count the number of properties (keys) of an object is to use the `Object.keys()` method, which returns an array of the object's own enumerable property names. You can then simply get the length of that array. Here's how you can do it: ```javascript const myobj = { a: 1, b: 2, c: 3 }; ...
10,840
[ { "from": "human", "value": "What's the fastest way to count the number of keys/properties of an object? Is it possible to do this without iterating over the object? I.e., without doing:\nvar count = 0;\nfor (k in myobj) if (myobj.hasOwnProperty(k)) ++count;\n\n(Firefox did provide a magic __count__ proper...
I've made many different seperate parts of a GUI system for the Nintendo DS, like buttons and textboxes and select boxes, but I need a way of containing these classes in one Gui class, so that I can draw everything to the screen all at once, and check all the buttons at once to check if any are being pressed. My questi...
Your approach to creating a `Gui` class that manages various GUI components is a good starting point, but there are indeed several improvements and refinements that can be made to better organize your GUI system. Below are some suggestions for your `Gui` class design, including better memory management, flexibility, an...
3,795
[ { "from": "human", "value": "I've made many different seperate parts of a GUI system for the Nintendo DS, like buttons and textboxes and select boxes, but I need a way of containing these classes in one Gui class, so that I can draw everything to the screen all at once, and check all the buttons at once to ...
I have an app that I've written in C#/WinForms (my little app). To make it cross-platform, I'm thinking of redoing it in Adobe AIR. Are there any arguments in favor of WinForms as a cross-platform app? Is there a cross-platform future for Winforms (e.g., Mono, etc.)? Suggestions for cross-platform UI development? By cr...
WinForms is primarily a Windows-centric technology, and while there are efforts like Mono and Xamarin that allow some level of cross-platform support, it's important to understand the limitations and considerations involved. Here's a breakdown of your questions regarding cross-platform development: ### 1. Arguments in...
6,924
[ { "from": "human", "value": "I have an app that I've written in C#/WinForms (my little app). To make it cross-platform, I'm thinking of redoing it in Adobe AIR. Are there any arguments in favor of WinForms as a cross-platform app? Is there a cross-platform future for Winforms (e.g., Mono, etc.)? Suggestions...
I support a third party system that uses COM, classic ASP, and SQL Server. Our company has gone to using TFS as our source control provider - which pushes things through Visual Studio. So, what's the best way to get a classic asp front-end into Visual Studio?
Integrating a classic ASP application into Visual Studio and using TFS for source control can be a bit tricky since Visual Studio is primarily designed for more modern development environments. However, there are ways to set up a workflow that allows you to effectively manage your classic ASP code in Visual Studio and ...
2,524
[ { "from": "human", "value": "I support a third party system that uses COM, classic ASP, and SQL Server. Our company has gone to using TFS as our source control provider - which pushes things through Visual Studio. So, what's the best way to get a classic asp front-end into Visual Studio?\n" }, { "...
I have a simple SQL 'Select' query, and I'd like to dump the results into an Excel file. I'm only able to save as .csv and converting to .xls creates some super ugly output. In any case, as far as I can tell (using Google) this doesn't seem to be so straight forward. Any help would be greatly appreciated.
Exporting SQL query results directly into an Excel file (XLSX format) can be tricky since many SQL clients and tools offer a straightforward way to export data as CSV files. However, you can achieve this using a few different methods. Here are a couple of options: ### Option 1: Using Python and Pandas If you're famil...
6,179
[ { "from": "human", "value": "I have a simple SQL 'Select' query, and I'd like to dump the results into an Excel file. I'm only able to save as .csv and converting to .xls creates some super ugly output. In any case, as far as I can tell (using Google) this doesn't seem to be so straight forward. Any help wo...
How do I format a string to title case?
To format a string to title case, where the first letter of each major word is capitalized, you can use various programming languages or libraries. Below are examples in several popular programming languages: ### Python You can use the `title()` method or a custom function to capitalize each word properly: ```python ...
2,979
[ { "from": "human", "value": "How do I format a string to title case?\n" }, { "from": "gpt", "value": "To format a string to title case, where the first letter of each major word is capitalized, you can use various programming languages or libraries. Below are examples in several popular programm...
I've got to do some significant development in a large, old, spaghetti-ridden ASP system. I've been away from ASP for a long time, focusing my energies on Rails development. One basic step I've taken is to refactor pages into subs and functions with meaningful names, so that at least it's easy to understand @ the top o...
Refactoring a large and complex ASP application can indeed be challenging, but with a systematic approach, you can make it more manageable and even lay the groundwork for a potential rewrite in the future. Here are some suggestions on how to improve your existing ASP code while gradually introducing best practices: ##...
4,458
[ { "from": "human", "value": "I've got to do some significant development in a large, old, spaghetti-ridden ASP system. I've been away from ASP for a long time, focusing my energies on Rails development.\nOne basic step I've taken is to refactor pages into subs and functions with meaningful names, so that at...
I'm working on building a development tool that is written in JavaScript. This will not be an open source project and will be sold (hopefully) as a commercial product. I'm looking for the best way to protect my investment. Is using an obfuscator (code mangler) enough to reasonably secure the code? Are there other alter...
When developing a commercial product in JavaScript, protecting your investment is crucial. Here are some strategies you can consider, including the use of obfuscation, but also going beyond that: ### 1. Code Obfuscation Obfuscation is indeed a common practice to make your code harder to read and understand for anyone ...
5,644
[ { "from": "human", "value": "I'm working on building a development tool that is written in JavaScript.\nThis will not be an open source project and will be sold (hopefully) as a commercial product.\nI'm looking for the best way to protect my investment. Is using an obfuscator (code mangler) enough to reason...
Without calculating them, I mean?
It seems like your question is incomplete. Could you please provide more context or clarify what you are asking about? This will help me give you a more accurate response.
12,524
[ { "from": "human", "value": "Without calculating them, I mean?\n" }, { "from": "gpt", "value": "It seems like your question is incomplete. Could you please provide more context or clarify what you are asking about? This will help me give you a more accurate response." } ]
I've got my Rails (2.1) app setup to send email via Gmail, however whenever I send an email no matter what I set the from address to in my ActionMailer the emails always come as if sent from my Gmail email address. Is this a security restriction they've put in place at Gmail to stop spammers using their SMTP? Note: I'v...
Yes, you are correct. Gmail has security restrictions in place that prevent you from sending emails that appear to be from an address that you do not own. This is to prevent spoofing and reduce spam. When you use Gmail's SMTP server to send emails, it enforces that the "From" address must match the account you are auth...
7,760
[ { "from": "human", "value": "I've got my Rails (2.1) app setup to send email via Gmail, however whenever I send an email no matter what I set the from address to in my ActionMailer the emails always come as if sent from my Gmail email address. Is this a security restriction they've put in place at Gmail to ...
For <script> HTML tags, what is the technical difference between lang=Javascript and type=text/javascript? I usually use both, because I've always assumed that older browsers need one or the other.
The attributes `lang` and `type` in the `<script>` tag serve different purposes, and understanding their technical differences is important. 1. **`type` Attribute**: - The `type` attribute specifies the scripting language of the contained code. For JavaScript, the correct and widely used value is `text/javascript`....
9,949
[ { "from": "human", "value": "For <script> HTML tags, what is the technical difference between lang=Javascript and type=text/javascript?\nI usually use both, because I've always assumed that older browsers need one or the other.\n" }, { "from": "gpt", "value": "The attributes `lang` and `type` in...
I can create the following and reference it using area[0].states[0] area[0].cities[0] var area = [ { "State" : "Texas", "Cities" : ['Austin','Dallas','San Antonio'] }, { "State" :"Arkansas", "Cities" : ['Little Rock','Texarkana','Hot Springs'] ...
To achieve your goal of selecting a state and then populating a second select box with the associated cities, you'll want to restructure your data so that you can easily reference cities by state name. Here's a way to do it: ### Restructuring the Data Instead of an array of objects, you can use an object with state na...
7,662
[ { "from": "human", "value": "I can create the following and reference it using\narea[0].states[0] \narea[0].cities[0]\n\nvar area = [\n {\n \"State\" : \"Texas\",\n \"Cities\" : ['Austin','Dallas','San Antonio']\n },\n {\n \"State\" :\"Arkansas\",\n ...
I have been working with Struts for some time, but for a project I am finishing I was asked to separate Templates (velocity .vm files), configs (struts.xml, persistence.xml) from main WAR file. I have all in default structure like: application |-- META-INF -- Some configs are here |-- WEB-INF ...
To separate your templates (Velocity `.vm` files) and configuration files from your main WAR file in a Struts application, you can set up external locations for these resources. This allows designers to modify templates without needing to redeploy the entire application. Here are the steps you can take to achieve this ...
5,289
[ { "from": "human", "value": "I have been working with Struts for some time, but for a project I am finishing I was asked to separate Templates (velocity .vm files), configs (struts.xml, persistence.xml) from main WAR file.\nI have all in default structure like: \n\n application\n |-- META-INF ...
I'm trying to run some queries to get rid of XSS in our database using Web Data Administrator but I keep running into this Potentially Dangerous Request crap. How do I disable validation of the query in Web Data Administrator?
When you encounter the "Potentially Dangerous Request" error in ASP.NET applications, it typically relates to the validation of data inputs that might be considered unsafe, such as those that can lead to Cross-Site Scripting (XSS) attacks. However, when you're working with the Web Data Administrator (or any web-based t...
7,238
[ { "from": "human", "value": "I'm trying to run some queries to get rid of XSS in our database using Web Data Administrator but I keep running into this Potentially Dangerous Request crap.\nHow do I disable validation of the query in Web Data Administrator?\n" }, { "from": "gpt", "value": "When y...
I'm using python and CherryPy to create a simple internal website that about 2 people use. I use the built in webserver with CherryPy.quickstart and never messed with the config files. I recently changed machines so I installed the latest Python and cherrypy and when I run the site I can access it from localhost:8080 b...
When using CherryPy's built-in server, by default, it binds to `localhost` (or `127.0.0.1`), which means it is only accessible from the machine it is running on. If you want to make your CherryPy application accessible from other machines on your network, you need to bind it to `0.0.0.0` (which means it will listen on ...
9,266
[ { "from": "human", "value": "I'm using python and CherryPy to create a simple internal website that about 2 people use. I use the built in webserver with CherryPy.quickstart and never messed with the config files. I recently changed machines so I installed the latest Python and cherrypy and when I run the s...
I have a stateless bean something like: @Stateless public class MyStatelessBean implements MyStatelessLocal, MyStatelessRemote { @PersistenceContext(unitName="myPC") private EntityManager mgr; @TransationAttribute(TransactionAttributeType.SUPPORTED) public void processObjects(List<Object> objs) { ...
You're correct in your understanding that EJB transaction management is handled at the bean level in a stateless session bean. This means that when a transaction context is established (or not established) for a bean, it applies to all method calls made within that same bean instance, regardless of the transaction attr...
6,736
[ { "from": "human", "value": "I have a stateless bean something like:\n@Stateless\npublic class MyStatelessBean implements MyStatelessLocal, MyStatelessRemote {\n @PersistenceContext(unitName=\"myPC\")\n private EntityManager mgr;\n\n @TransationAttribute(TransactionAttributeType.SUPPORTED)\n pub...
The question says it all basically. I want in a class MyClass to listen to a routed event. Can it be done ?
Yes, you can definitely listen to a routed event in a class, such as `MyClass`, in a WPF (Windows Presentation Foundation) application or similar XAML-based frameworks. In WPF, routed events can be handled in a variety of ways, including handling the event at the class level by subscribing to it. Here’s a basic exampl...
6,119
[ { "from": "human", "value": "The question says it all basically. \nI want in a \nclass MyClass \n\nto listen to a routed event. Can it be done ?\n" }, { "from": "gpt", "value": "Yes, you can definitely listen to a routed event in a class, such as `MyClass`, in a WPF (Windows Presentation Foundat...
How does one convert an image from one color profile to another (screen to printer, or scanner to screen). In Visual C++ you would use the function in ICM.h, is there a managed way to do this with GDI+? I need to use GDI+, not WPF. I'd prefer to have a managed solution, but if it is not available, I guess PInkvoke wi...
Converting images between different color profiles in GDI+ is not directly supported in the same way that ICM (Image Color Management) provides functions in unmanaged code. However, you can use the `ColorConverter` and `Bitmap` classes to handle image processing, but there's no built-in method for color profile convers...
5,727
[ { "from": "human", "value": "How does one convert an image from one color profile to another (screen to printer, or scanner to screen). In Visual C++ you would use the function in ICM.h, is there a managed way to do this with GDI+?\nI need to use GDI+, not WPF. I'd prefer to have a managed solution, but i...
I was just assigned to do a CMS using ASP.net 3.5 and MySQL. I am kind of new to ASP.NET development (quite sufficient with C#) and I am wondering what major ASP.NET and general .NET features I am losing when I don't have the option to use Microsoft SQL Server. I know already from quick Googling that I lose LINQ (and I...
Using ASP.NET 3.5 with MySQL instead of Microsoft SQL Server does come with certain trade-offs and limitations, especially regarding features that are more tightly integrated with SQL Server. Here’s a breakdown of some major features and conveniences you might miss out on: 1. **LINQ to SQL**: As you mentioned, LINQ (L...
7,905
[ { "from": "human", "value": "I was just assigned to do a CMS using ASP.net 3.5 and MySQL. I am kind of new to ASP.NET development (quite sufficient with C#) and I am wondering what major ASP.NET and general .NET features I am losing when I don't have the option to use Microsoft SQL Server.\nI know already f...
I have always wondered how people update a previous line in a command line. a great example of this is when using the wget command in linux. It creates an ASCII loading bar of sorts that looks like this: [======>                    ] 37% and of course the loading bar moves and the percent changes, But it doesn't make...
To create an updating line in a command line interface (CLI) like the loading bar you see with `wget`, you can use special control characters. The key is to use the carriage return character (`\r`) to move the cursor back to the beginning of the line without advancing to a new line. Here’s a simple example in Python t...
10,069
[ { "from": "human", "value": "I have always wondered how people update a previous line in a command line. a great example of this is when using the wget command in linux. It creates an ASCII loading bar of sorts that looks like this:\n\n[======>                    ] 37%\n\nand of course the loading bar moves...
I have recently written an application(vb.net) that stores and allows searching for old council plans. Now while the application works well, the other day I was having a look at the routine that I use to generate the SQL string to pass the database and frankly, it was bad. I was just posting a question here to see if ...
Hi Nathan, It sounds like you're looking for a way to dynamically build a LINQ query based on the state of your form controls, which can indeed be done in a more efficient way than a series of `if...then...else` statements. Here are some approaches that can help you create your query dynamically: ### 1. Use a Diction...
4,914
[ { "from": "human", "value": "I have recently written an application(vb.net) that stores and allows searching for old council plans. \nNow while the application works well, the other day I was having a look at the routine that I use to generate the SQL string to pass the database and frankly, it was bad.\nI ...
I have a file (fasta file to be specific) that I would like to index, so that I can quickly locate any substring within the file and then find the location within the original fasta file. This would be easy to do in many cases, using a Trie or substring array, unfortunately the strings I need to index are 800+ MBs whic...
To create an efficient on-disk index for locating substrings in large FASTA files (specifically headers), we can implement a disk-based inverted index. Given the constraints of memory usage and operating system compatibility, here's a feasible approach you could take in Java. ### Overview of the Solution 1. **Extract...
6,051
[ { "from": "human", "value": "I have a file (fasta file to be specific) that I would like to index, so that I can quickly locate any substring within the file and then find the location within the original fasta file.\nThis would be easy to do in many cases, using a Trie or substring array, unfortunately the...
As a lot of people pointed out in this question, Lisp is mostly used as a learning experience. Nevertheless, it would be great if I could somehow use my Lisp algorithms and combine them with my C# programs. In college my profs never could tell me how to use my Lisp routines in a program (no, not writing a GUI in Lisp,...
To integrate your Lisp algorithms with C# programs, you have several options. Here are a few common approaches to achieve this integration: ### 1. **Inter-Process Communication (IPC)** You can run your Lisp program as a separate process and communicate with it via standard input/output or use sockets. This way, you c...
5,758
[ { "from": "human", "value": "As a lot of people pointed out in this question, Lisp is mostly used as a learning experience. Nevertheless, it would be great if I could somehow use my Lisp algorithms and combine them with my C# programs.\nIn college my profs never could tell me how to use my Lisp routines in...
I would like to be able to do such things as var m1 = new UnitOfMeasureQuantityPair(123.00, UnitOfMeasure.Pounds); var m2 = new UnitOfMeasureQuantityPair(123.00, UnitOfMeasure.Liters); m1.ToKilograms(); m2.ToPounds(new Density(7.0, DensityType.PoundsPerGallon); If there isn't something like this already, anybody inte...
It sounds like you're interested in creating a system for handling unit conversions, specifically for quantities with associated units of measure. This could be a useful tool for many applications, such as scientific calculations, engineering, and data analysis. Here's a rough outline of how you might design such a sy...
6,791
[ { "from": "human", "value": "I would like to be able to do such things as\nvar m1 = new UnitOfMeasureQuantityPair(123.00, UnitOfMeasure.Pounds);\nvar m2 = new UnitOfMeasureQuantityPair(123.00, UnitOfMeasure.Liters);\n\nm1.ToKilograms();\nm2.ToPounds(new Density(7.0, DensityType.PoundsPerGallon);\n\nIf there...
I have a sprite loaded as a texture and I need to animate it, allowing it to "face" left or right -- essentially sometimes I need to "flip" it. I know that OpenGL has a gltranslate which repositions an object, and glrotate which rotates it. Is there a method that simply flips it across one axis? If not, how would ...
OpenGL doesn't provide a direct method to "flip" a texture across an axis, but you can achieve this effect by using the transformation matrix or by adjusting the texture coordinates. Here are two methods to accomplish a flip effect: ### Method 1: Flipping Using Transformation Matrix To flip the sprite horizontally (f...
8,065
[ { "from": "human", "value": "I have a sprite loaded as a texture and I need to animate it, allowing it to \"face\" left or right -- essentially sometimes I need to \"flip\" it. I know that OpenGL has a gltranslate which repositions an object, and glrotate which rotates it. Is there a method that simply ...
Best recommendations for accessing and manipulation of sqlite databases from JavaScript.
Accessing and manipulating SQLite databases in JavaScript can be done effectively using various libraries and tools. Here are some of the best recommendations: ### For Client-Side JavaScript (e.g., in the browser) 1. **SQLite.js (sql.js)**: - **Description**: A JavaScript library that runs SQLite in the browser us...
3,353
[ { "from": "human", "value": "Best recommendations for accessing and manipulation of sqlite databases from JavaScript.\n" }, { "from": "gpt", "value": "Accessing and manipulating SQLite databases in JavaScript can be done effectively using various libraries and tools. Here are some of the best re...
Is there any way to convert a bmp image to jpg/png without losing the quality in C#? Using Image class we can convert bmp to jpg but the quality of output image is very poor. Can we gain the quality level as good as an image converted to jpg using photoshop with highest quality?
When converting a BMP image to a JPG or PNG format in C#, you can control the quality of the output image, especially for JPG, by using the `Encoder` class in the `System.Drawing.Imaging` namespace. ### For JPG Conversion When converting to JPG, you can specify the quality of the JPEG output using the `EncoderParamet...
7,334
[ { "from": "human", "value": "Is there any way to convert a bmp image to jpg/png without losing the quality in C#? Using Image class we can convert bmp to jpg but the quality of output image is very poor. Can we gain the quality level as good as an image converted to jpg using photoshop with highest quality?...
We're using WatiN for testing our UI, but one page (which is unfortunately not under our teams control) takes forever to finish loading. Is there a way to get WatiN to click a link on the page before the page finishes rendering completely?
Yes, WatiN (Web Application Testing in .NET) allows you to interact with web elements before the page fully loads. You can accomplish this by utilizing the `WaitUntilComplete` method or simply by using an explicit wait or a timeout mechanism to give your tests a chance to interact with the elements before the page has ...
7,688
[ { "from": "human", "value": "We're using WatiN for testing our UI, but one page (which is unfortunately not under our teams control) takes forever to finish loading. Is there a way to get WatiN to click a link on the page before the page finishes rendering completely?\n" }, { "from": "gpt", "va...
Is there a way to determine how many capture groups there are in a given regular expression? I would like to be able to do the follwing: def groups(regexp, s): """ Returns the first result of re.findall, or an empty default >>> groups(r'(\d)(\d)(\d)', '123') ('1', '2', '3') >>> groups(r'(\d)(\d)(\d)', ...
To implement the `num_of_groups` function in Python, you can use the `re` module's capabilities to access the information about the groups defined in a regular expression. You can use `re.compile()` to create a regex object and then access the `groups` method of that object to determine the number of capturing groups. ...
10,025
[ { "from": "human", "value": "Is there a way to determine how many capture groups there are in a given regular expression?\nI would like to be able to do the follwing:\ndef groups(regexp, s):\n \"\"\" Returns the first result of re.findall, or an empty default\n\n >>> groups(r'(\\d)(\\d)(\\d)', '123')\...
Why does this javascript return 108 instead of 2008? it gets the day and month correct but not the year? myDate = new Date(); year = myDate.getYear(); year = 108?
The issue you're encountering is due to the use of the `getYear()` method in JavaScript, which has been deprecated and can lead to confusion. The `getYear()` method does not return the full year as you might expect (like 2008). Instead, it returns the year minus 1900. So, for example, if the current year is 2008, `ge...
11,521
[ { "from": "human", "value": "Why does this javascript return 108 instead of 2008? it gets the day and month correct but not the year?\nmyDate = new Date();\nyear = myDate.getYear();\n\nyear = 108?\n" }, { "from": "gpt", "value": "The issue you're encountering is due to the use of the `getYear()`...
I know you can do redirection based on the domain or path to rewrite the URI to point at a site-specific location and I've also seen some brutish if and elif statements for every site as shown in the following code, which I would like to avoid. if site == 'site1': ... elif site == 'site2: ... What are some goo...
When running multiple sites from a single instance of a Python web framework, it's essential to organize your code in a way that maintains clarity and modularity. Here are several strategies to achieve this without relying on cumbersome `if` and `elif` statements: ### 1. **URL Routing with Patterns** Use URL routing ...
4,672
[ { "from": "human", "value": "I know you can do redirection based on the domain or path to rewrite the URI to point at a site-specific location and I've also seen some brutish if and elif statements for every site as shown in the following code, which I would like to avoid.\nif site == 'site1':\n ...\neli...
I'd like a dead simple explanation of policy injection for less-informed co-workers. Where is a good resource for this? I learned about policy injection from the entlib help files, which I'm sure aren't the best option.
Policy injection is a design pattern used in software development to separate the decision-making logic (policies) from the core functionality of an application. This allows developers to change, add, or remove policies without altering the underlying code. Essentially, it enables a more flexible and maintainable codeb...
9,317
[ { "from": "human", "value": "I'd like a dead simple explanation of policy injection for less-informed co-workers. Where is a good resource for this? I learned about policy injection from the entlib help files, which I'm sure aren't the best option.\n" }, { "from": "gpt", "value": "Policy injec...
I'm trying to install faac and am running into errors. Here are the errors I get when trying to build it: [root@test faac]# ./bootstrap configure.in:11: warning: underquoted definition of MY_DEFINE run info '(automake)Extending aclocal' or see http://sources.redhat.com/automake/automake.html#Extending-aclocal a...
The errors you are encountering during the installation of FAAC stem from a few issues related to the versions of tools you are using (autoconf, automake, and libtool) and possibly missing macros required for the build process. ### Here’s a step-by-step guide to help you resolve these issues: 1. **Update Autoconf, Au...
7,605
[ { "from": "human", "value": "I'm trying to install faac and am running into errors. Here are the errors I get when trying to build it:\n\n[root@test faac]# ./bootstrap \nconfigure.in:11: warning: underquoted definition of MY_DEFINE\nrun info '(automake)Extending aclocal' \nor see http://sources.redhat.co...
In podcast #15, Jeff mentioned he twittered about how to run a regular event in the background as if it was a normal function - unfortunately I can't seem to find that through twitter. Now I need to do a similar thing and are going to throw the question to the masses. My current plan is when the first user (probably me...
In ASP.NET, Jeff likely used a feature called a "background task" or "timer" to schedule regular events. In the .NET framework, a common approach is to use the `System.Threading.Timer` class or background services in ASP.NET Core to run tasks at specified intervals without blocking incoming requests. Here's a general...
5,626
[ { "from": "human", "value": "In podcast #15, Jeff mentioned he twittered about how to run a regular event in the background as if it was a normal function - unfortunately I can't seem to find that through twitter. Now I need to do a similar thing and are going to throw the question to the masses.\nMy curren...
Is there an easy way of using the RegularExpressionValidator control while ignoring white space? I can use a custom validator control with Regex and IgnorePatternWhitespace, but it would be good to just have an option in the RegularExpressionValidator control.
The `RegularExpressionValidator` control in ASP.NET does not have a built-in option to ignore whitespace directly. However, you can modify your regular expression pattern to account for whitespace. Here are a few approaches you can consider: ### 1. Modify Your Regex Pattern You can create a regex pattern that matches ...
7,190
[ { "from": "human", "value": "Is there an easy way of using the RegularExpressionValidator control while ignoring white space?\nI can use a custom validator control with Regex and IgnorePatternWhitespace, but it would be good to just have an option in the RegularExpressionValidator control.\n" }, { "...
Are there any good database schema comparison tools out there that support Sybase SQL Anywhere version 10? I've seen a litany of them for SQL Server, a few for MySQL and Oracle, but nothing that supports SQL Anywhere correctly. I tried using DB Solo, but it turned all my non-unique indexes into unique ones, and I di...
Finding good database schema comparison tools that specifically support Sybase SQL Anywhere can indeed be a challenge, especially for older versions like version 10. However, here are a few tools and approaches you might consider: 1. **Aqua Data Studio**: This tool supports various database systems, including Sybase S...
6,933
[ { "from": "human", "value": "Are there any good database schema comparison tools out there that support Sybase SQL Anywhere version 10? I've seen a litany of them for SQL Server, a few for MySQL and Oracle, but nothing that supports SQL Anywhere correctly. \nI tried using DB Solo, but it turned all my non...
I would like to create an application wide keyboard shortcut for a Java Swing application. Looping over all components and adding the shortcut on each, has focus related side effects, and seems like a brute force solution. Anyone has a cleaner solution?
Creating a global keyboard shortcut for a Java Swing application can indeed be challenging, especially if you want to avoid the complexity and potential side effects of looping over all components. Instead of adding a key listener to each component, you can take advantage of the Java Swing `InputMap` and `ActionMap` to...
7,692
[ { "from": "human", "value": "I would like to create an application wide keyboard shortcut for a Java Swing application.\nLooping over all components and adding the shortcut on each, has focus related side effects, and seems like a brute force solution.\nAnyone has a cleaner solution?\n" }, { "from":...
I am wondering what makes sense in relation to what objects to expose through a WCF service - should I add WCF Serialization specifications to my business entities or should I implement a converter that maps my business entities to the DataContracts that I want to expose through my WCF service? Right now I have entitie...
When designing a WCF service, especially in relation to how you expose your objects, it's essential to consider both best practices and maintainability. Here are some insights on the approaches you're considering: ### 1. **Using DataContracts for WCF Serialization** Using DataContracts to define what you expose throu...
3,606
[ { "from": "human", "value": "I am wondering what makes sense in relation to what objects to expose through a WCF service - should I add WCF Serialization specifications to my business entities or should I implement a converter that maps my business entities to the DataContracts that I want to expose through...
I'm looking at using a Windows SharePoint Services 3.0 wiki as a metadata repository. We basically want a community-driven dictionary and for various reasons we're using Sharepoint instead of say MediaWiki. What can I do to customize or completely replace searchresults.aspx? Features I'd add if I knew how: Automatica...
Customizing the search results in Windows SharePoint Services 3.0 can be challenging, especially if you're looking to modify the `searchresults.aspx` page. However, there are a few approaches you can take to create a custom search results page that meets your needs. Here’s a step-by-step guide to help you get started...
4,790
[ { "from": "human", "value": "I'm looking at using a Windows SharePoint Services 3.0 wiki as a metadata repository. We basically want a community-driven dictionary and for various reasons we're using Sharepoint instead of say MediaWiki.\nWhat can I do to customize or completely replace searchresults.aspx?\n...
I'm trying to make a context menu for a control that is "linked" to a main menu item. There are two fixed menu items that are always there and an arbitrary number of additional menu items that might need to be on the menu. I've tried solving the problem by keeping a class-level reference to the fixed menu items and a ...
The issue you are experiencing with the `ContextMenuStrip` not displaying the items as expected on the first right-click is due to how the `Opening` event works in relation to the `ContextMenuStrip`. By the time the `Opening` event is triggered, the `ContextMenuStrip` has already processed its items, and any modificati...
8,184
[ { "from": "human", "value": "I'm trying to make a context menu for a control that is \"linked\" to a main menu item. There are two fixed menu items that are always there and an arbitrary number of additional menu items that might need to be on the menu.\nI've tried solving the problem by keeping a class-le...
Is there any way in the Servlet API to access properties specified in web.xml (such as initialization parameters) from within a Bean or Factory class that is not associated at all with the web container? For example, I'm writing a Factory class, and I'd like to include some logic within the Factory to check a hierarchy...
In Java EE (Jakarta EE) applications, there is no direct way to access the `ServletConfig` or other servlet-related configurations from a plain Java object (like a Bean or Factory class) that is not managed by the servlet container. This is because the lifecycle and context of servlets are tightly coupled with the serv...
7,320
[ { "from": "human", "value": "Is there any way in the Servlet API to access properties specified in web.xml (such as initialization parameters) from within a Bean or Factory class that is not associated at all with the web container?\nFor example, I'm writing a Factory class, and I'd like to include some log...
Are there any programs or IDEs that support refactoring for Ruby or RoR?
Yes, there are several Integrated Development Environments (IDEs) and text editors that support refactoring for Ruby and Ruby on Rails (RoR). Here are some popular ones: 1. **RubyMine**: - Developed by JetBrains, RubyMine is a powerful IDE specifically designed for Ruby and Rails development. It offers extensive re...
7,871
[ { "from": "human", "value": "Are there any programs or IDEs that support refactoring for Ruby or RoR?\n" }, { "from": "gpt", "value": "Yes, there are several Integrated Development Environments (IDEs) and text editors that support refactoring for Ruby and Ruby on Rails (RoR). Here are some popul...
Is there a standard X / Gnome program that will display the X,Y width and depth in pixels of a window that I select? Something similar to the way an xterm shows you the width and depth of the window (in lines) as you resize it. I'm running on Red Hat Enterprise Linux 4.4. Thanks!
On Red Hat Enterprise Linux 4.4, you can use the `xev` utility to gather information about X events and window properties, including the size and position of windows. However, `xev` may not provide a direct way to display the width and depth in pixels of a selected window continuously as it is resized. An alternative ...
8,491
[ { "from": "human", "value": "Is there a standard X / Gnome program that will display the X,Y width and depth in pixels of a window that I select? Something similar to the way an xterm shows you the width and depth of the window (in lines) as you resize it.\nI'm running on Red Hat Enterprise Linux 4.4.\nTha...
I am looking for a high-performance graphic library for .NET and Mono. I have taken a look at Tao framework and, while it is very complete, it's quite lacking in terms of usability. It should be cross-platform compatible. What other alternatives worked for you?
There are several high-performance graphics libraries that are cross-platform compatible and work well with .NET and Mono. Here are a few alternatives you might consider: 1. **MonoGame**: This is a popular open-source game development framework that's very approachable for those familiar with XNA. It provides support ...
8,214
[ { "from": "human", "value": "I am looking for a high-performance graphic library for .NET and Mono. I have taken a look at Tao framework and, while it is very complete, it's quite lacking in terms of usability. It should be cross-platform compatible.\nWhat other alternatives worked for you?\n" }, { ...
How can I create a new database from my C# application? I'm assuming once I create it, I can simply generate a connection string on the fly and connect to it, and the issue all the CREATE TABLE statements.
Creating a new database from your C# application typically involves executing SQL commands to create the database itself and any necessary tables within it. Below is a step-by-step guide on how to do this using C# with a SQL Server database as an example. The process is similar for other databases, but the SQL syntax m...
1,609
[ { "from": "human", "value": "How can I create a new database from my C# application?\nI'm assuming once I create it, I can simply generate a connection string on the fly and connect to it, and the issue all the CREATE TABLE statements.\n" }, { "from": "gpt", "value": "Creating a new database fr...
I've just read up on Thread.IsBackground and if I understand it correctly, when it's set to false the Thread is a foreground thread which means it should stay alive until it has finished working even though the app have been exited out. Now I tested this with a winform app and it works as expected but when used with a ...
The behavior of `Thread.IsBackground` in .NET does not differ between a Windows Forms application and a console application; it should work the same way in both environments in terms of foreground and background thread behavior. However, the main reason you're observing different behavior in your console application co...
7,369
[ { "from": "human", "value": "I've just read up on Thread.IsBackground and if I understand it correctly, when it's set to false the Thread is a foreground thread which means it should stay alive until it has finished working even though the app have been exited out. Now I tested this with a winform app and i...
Is there something like InstallShield that I can use for free?
Yes, there are several free alternatives to InstallShield that you can use to create installers for your applications. Here are a few popular options: 1. **Inno Setup**: A free script-driven installation system created in Delphi. It is very powerful and allows for creating complex installations with an easy-to-use scr...
10,813
[ { "from": "human", "value": "Is there something like InstallShield that I can use for free?\n" }, { "from": "gpt", "value": "Yes, there are several free alternatives to InstallShield that you can use to create installers for your applications. Here are a few popular options:\n\n1. **Inno Setup**...
OK, I know there have already been questions about getting started with TDD.. However, I guess I kind of know the general concensus is to just do it , However, I seem to have the following problems getting my head into the game: When working with collections, do will still test for obvious add/remove/inserts successfu...
It’s great to hear you’re interested in Test-Driven Development (TDD)! Your questions and concerns are quite common among those starting out with TDD. Let’s address each of your points and provide some personal insights into how to navigate these challenges. ### 1. Testing Collections with Generics When dealing with c...
2,999
[ { "from": "human", "value": "OK, I know there have already been questions about getting started with TDD.. However, I guess I kind of know the general concensus is to just do it , However, I seem to have the following problems getting my head into the game:\n\nWhen working with collections, do will still te...
App needs to run on the .Net Compact Framework v.3.5. Video can be any format, but I do need to be able to know when it's finished playing, so I can start another one. I'm hoping for a method that doesn't involve unmanaged code, if possible.
When working with the .NET Compact Framework (CF), especially version 3.5, you have limited options compared to the full .NET Framework, especially for multimedia tasks. However, you can still use some managed code to play videos and detect when they finish playing. For video playback, you can utilize the `Windows Med...
7,727
[ { "from": "human", "value": "App needs to run on the .Net Compact Framework v.3.5. Video can be any format, but I do need to be able to know when it's finished playing, so I can start another one.\nI'm hoping for a method that doesn't involve unmanaged code, if possible.\n" }, { "from": "gpt", "...
I have reached the point where I've decided to replace my custom-built replication system with a system that has been built by someone else, mainly for reliability purposes. Can anyone recommend any replication system that is worth it? Is FiBRE any good? What I need might be a little away from a generic system, though....
When looking for a replication system that fits your specific requirements, it's essential to consider both the nature of your data and how the departments interact with it. Given your scenario with sporadic internet connections and the need for bi-directional data flow, here are a few solutions that may work well for ...
3,336
[ { "from": "human", "value": "I have reached the point where I've decided to replace my custom-built replication system with a system that has been built by someone else, mainly for reliability purposes. Can anyone recommend any replication system that is worth it? Is FiBRE any good?\nWhat I need might be a ...
What is a recommended architecture for providing storage for a dynamic logical database schema? To clarify: Where a system is required to provide storage for a model whose schema may be extended or altered by its users once in production, what are some good technologies, database models or storage engines that will all...
Designing a storage architecture for a dynamic logical database schema requires careful consideration of the use cases, scalability, and performance requirements. Below are some recommended architectures and technologies that can facilitate a dynamic schema approach. ### Recommended Approaches 1. **Schema-less Databa...
6,260
[ { "from": "human", "value": "What is a recommended architecture for providing storage for a dynamic logical database schema?\nTo clarify: Where a system is required to provide storage for a model whose schema may be extended or altered by its users once in production, what are some good technologies, databa...
On Windows, is there any way to programatically approve a USB device after insertion, if it is of a certain type (say Removable Drive) allow its use, otherwise not? Also not to allow running of drivers, only allow usage of the device in an approved way? I.E. We want to allow the insertion of USB drives, but not have t...
To achieve your goal of allowing only certain types of USB devices (like Removable Drives) and restricting the installation of drivers on a Windows system (especially in a kiosk environment), you'll want to follow a multifaceted approach, leveraging Group Policy, Device Installation Restrictions, and possibly a custom ...
5,736
[ { "from": "human", "value": "On Windows, is there any way to programatically approve a USB device after insertion, if it is of a certain type (say Removable Drive) allow its use, otherwise not? Also not to allow running of drivers, only allow usage of the device in an approved way?\nI.E. We want to allow t...
What are some of the ways? What frameworks can you use?
To answer your question more effectively, it would be helpful to know the context in which you're asking about "ways" and "frameworks." However, I can provide you with a few general categories and examples where frameworks are commonly used: ### 1. **Project Management** - **Agile**: A flexible framework focusing o...
6,883
[ { "from": "human", "value": "What are some of the ways? What frameworks can you use?\n" }, { "from": "gpt", "value": "To answer your question more effectively, it would be helpful to know the context in which you're asking about \"ways\" and \"frameworks.\" However, I can provide you with a few ...
I'm using Google App Engine and Django templates. I have a table that I want to display the objects look something like: Object Result: Items = [item1,item2] Users = [{name='username',item1=3,item2=4},..] The Django template is: <table> <tr align="center"> <th>user</th> {% for item in result.items %} ...
The issue you're encountering is due to how you're trying to access the item values in the nested loop. In your code, you're using `{{ user.item }}`, which attempts to access the property `item` of the `user` dictionary. However, what you actually want is to access each specific item associated with the user dynamicall...
9,176
[ { "from": "human", "value": "I'm using Google App Engine and Django templates.\nI have a table that I want to display the objects look something like:\nObject Result:\n Items = [item1,item2]\n Users = [{name='username',item1=3,item2=4},..]\n\nThe Django template is:\n<table>\n<tr align=\"center\">\n ...
On these questions: Which Vista edition is best for a developer machine? Vista or XP for Dev Machine People are recommending 64 bit, can you explain why? Is it just so you can have more then 3GB of addressable RAM that 32 bit gives you? And how does Visual Studio benefit from all this extra RAM? I went from 64 bit XP...
When considering the best edition of Windows Vista for a developer machine, there are several factors to take into account: ### Best Vista Edition for Development 1. **Windows Vista Ultimate**: This edition includes all features of Vista, both Home and Business editions. It is especially beneficial for developers who ...
8,829
[ { "from": "human", "value": "On these questions:\n\nWhich Vista edition is best for a developer machine?\nVista or XP for Dev Machine\n\nPeople are recommending 64 bit, can you explain why? Is it just so you can have more then 3GB of addressable RAM that 32 bit gives you?\nAnd how does Visual Studio benefit...
I've implemented a stopwatch that works fine without considering that bank holidays and weekends shouldn't be counted in the total duration. I was looking for some open-source library where I could get the elapsed time, passing a start instant, end instant and a set of bank holidays (weekends aren't counted in). The on...
For your requirement of calculating elapsed time while excluding weekends and bank holidays, there are a few Java libraries and approaches you can consider, in addition to `net.sf.jtemporal`. Here are some options: 1. **Java 8's `java.time` Package**: - If you are using Java 8 or later, you can utilize the `java.ti...
8,457
[ { "from": "human", "value": "I've implemented a stopwatch that works fine without considering that bank holidays and weekends shouldn't be counted in the total duration. I was looking for some open-source library where I could get the elapsed time, passing a start instant, end instant and a set of bank holi...
The situation: I have a pieceofcrapuous laptop. One of the things that make it pieceofcrapuous is that the battery is dead, and the power cable pulls out of the back with little effort. I recently received a non-pieceofcrapuous laptop, and I am in the process of copying everything from old to new. I'm trying to xcopy c...
While `xcopy` does not have a built-in switch that directly accomplishes the opposite of `/U` (which only copies files that already exist in the destination), you can achieve the desired result by using a combination of `xcopy` and the `/D` switch along with specifying a date that is earlier than the files in the sourc...
6,438
[ { "from": "human", "value": "The situation: I have a pieceofcrapuous laptop. One of the things that make it pieceofcrapuous is that the battery is dead, and the power cable pulls out of the back with little effort.\nI recently received a non-pieceofcrapuous laptop, and I am in the process of copying everyth...
I know I can call the GetVersionEx Win32 API function to retrieve the Windows version. In most cases, the returned value reflects the version of my Windows, but sometimes that is not so. If a user runs my application under the compatibility layer, then GetVersionEx won't be reporting the real version but the version en...
In Windows, when an application runs under a compatibility mode, the system can alter the reported version number using the `GetVersionEx` function to match the compatibility settings. However, you can bypass this limitation to retrieve the actual version of the operating system. ### Method 1: Use `RtlGetVersion` A m...
6,610
[ { "from": "human", "value": "I know I can call the GetVersionEx Win32 API function to retrieve the Windows version. In most cases, the returned value reflects the version of my Windows, but sometimes that is not so.\nIf a user runs my application under the compatibility layer, then GetVersionEx won't be rep...
What is the fastest way of transferring few thousand rows of data from one DataTable to another? Would be great to see some sample code snippets. Edit: I need to explain a bit more. There is a filtering condition for copying the rows. So, a plain Copy() will not work.
When you need to transfer a subset of rows from one `DataTable` to another based on a filtering condition, a common approach is to iterate through the source `DataTable`, check for the filtering condition, and then import the matching rows into the destination `DataTable`. Here’s a quick example using C# and the `Dat...
6,871
[ { "from": "human", "value": "What is the fastest way of transferring few thousand rows of data from one DataTable to another? Would be great to see some sample code snippets.\nEdit: I need to explain a bit more. There is a filtering condition for copying the rows. So, a plain Copy() will not work.\n" }, ...
I am writing a simple checkers game in Java. When I mouse over the board my processor ramps up to 50% (100% on a core). I would like to find out what part of my code(assuming its my fault) is executing during this. I have tried debugging, but step-through debugging doesn't work very well in this case. Is there any too...
If you're experiencing high CPU usage when hovering over your checkers game board in Java, it’s likely due to an inefficient rendering loop or an event listener that triggers frequently during mouse movements. Since debugging via stepping through code can be difficult in this situation, you can use profiling tools to a...
6,160
[ { "from": "human", "value": "I am writing a simple checkers game in Java. When I mouse over the board my processor ramps up to 50% (100% on a core).\nI would like to find out what part of my code(assuming its my fault) is executing during this.\nI have tried debugging, but step-through debugging doesn't wo...
I'm making an example for someone who hasn't yet realized that controls like ListBox don't have to contain strings; he had been storing formatted strings and jumping through complicated parsing hoops to get the data back out of the ListBox and I'd like to show him there's a better way. I noticed that if I have an objec...
The issue you're encountering is that the ListBox doesn't automatically re-draw its items when the underlying data changes. The `ToString()` method is called when the ListBox needs to display the items, but once the items are added to the ListBox, their string representation is cached. Even though you are updating the ...
3,033
[ { "from": "human", "value": "I'm making an example for someone who hasn't yet realized that controls like ListBox don't have to contain strings; he had been storing formatted strings and jumping through complicated parsing hoops to get the data back out of the ListBox and I'd like to show him there's a bett...
Is there a way to read a locked file across a network given that you are the machine admin on the remote machine? I haven't been able to read the locked file locally, and attempting it over the network adds another layer of difficulty.
Accessing a locked file on a remote machine, even with administrative privileges, requires careful consideration of the operating system and the nature of the lock on the file. Here are some general approaches you might consider, depending on your specific situation: ### For Windows: 1. **Using Process Explorer:** ...
7,220
[ { "from": "human", "value": "Is there a way to read a locked file across a network given that you are the machine admin on the remote machine? I haven't been able to read the locked file locally, and attempting it over the network adds another layer of difficulty.\n" }, { "from": "gpt", "value":...
We have a project with over 500,000 lines of VB.NET that we need to convert to C#. Any recommendations, based on experience, for tools to use? We are using Visual Studio 2008 and we're targeting 3.5 .
Converting a large codebase from VB.NET to C# can be a complex task, but there are several tools and strategies that can help streamline the process. Here are some recommendations based on common practices and available tools: ### Tools for Conversion 1. **Telerik Code Converter**: - A web-based tool that allows y...
4,348
[ { "from": "human", "value": "We have a project with over 500,000 lines of VB.NET that we need to convert to C#. Any recommendations, based on experience, for tools to use? We are using Visual Studio 2008 and we're targeting 3.5 .\n" }, { "from": "gpt", "value": "Converting a large codebase from ...