instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
I'd like to know how to grab the Window title of the current active window (i.e. the one that has focus) using C#.
To grab the title of the currently active window in C#, you can use the `GetForegroundWindow` function from the user32.dll library to get the handle of the active window and then use `GetWindowText` to retrieve the window title. Below is a simple example of how to do this in a C# console application. First, you need t...
9,376
[ { "from": "human", "value": "I'd like to know how to grab the Window title of the current active window (i.e. the one that has focus) using C#. \n" }, { "from": "gpt", "value": "To grab the title of the currently active window in C#, you can use the `GetForegroundWindow` function from the user32...
Is there some way to do multi-threading in JavaScript?
JavaScript traditionally runs in a single-threaded environment, primarily due to its event-driven, non-blocking architecture. However, there are ways to achieve multi-threading-like behavior using the following approaches: ### 1. Web Workers Web Workers allow you to run scripts in the background, on separate threads. ...
10,794
[ { "from": "human", "value": "Is there some way to do multi-threading in JavaScript?\n" }, { "from": "gpt", "value": "JavaScript traditionally runs in a single-threaded environment, primarily due to its event-driven, non-blocking architecture. However, there are ways to achieve multi-threading-li...
How can I use XPath to select an XML-node based on its content? If I e.g. have the following xml and I want to select the <author>-node that contains Ritchie to get the author's full name: <books> <book isbn='0131103628'> <title>The C Programming Language</title> <authors> <author>Ritch...
To select an `<author>` node based on its content using XPath, you can use the `text()` function in your XPath expression. In your case, if you want to select the `<author>` node that contains the string "Ritchie", you can use the following XPath expression: ```xpath //author[contains(text(), 'Ritchie')] ``` Here's a...
10,721
[ { "from": "human", "value": "How can I use XPath to select an XML-node based on its content? \nIf I e.g. have the following xml and I want to select the <author>-node that contains Ritchie to get the author's full name:\n<books>\n <book isbn='0131103628'>\n <title>The C Programming Language</title...
We have two tasks (T1 and T2) in our vxWorks embedded system that have the same priority (110). How does the regular vxWorks scheduler deal with this if both tasks are ready to run? Which task executes first?
In VxWorks, when two tasks have the same priority and are both ready to run, the VxWorks scheduler uses a round-robin scheduling approach for tasks with the same priority level. This means that the scheduler will allow both tasks (T1 and T2 in your case) to execute in a time-sliced manner. When both tasks T1 and T2 ar...
9,467
[ { "from": "human", "value": "We have two tasks (T1 and T2) in our vxWorks embedded system that have the same priority (110).\nHow does the regular vxWorks scheduler deal with this if both tasks are ready to run?\nWhich task executes first?\n" }, { "from": "gpt", "value": "In VxWorks, when two ta...
I have a set of tree objects with a depth somewhere in the 20s. Each of the nodes in this tree needs access to its tree's root. A couple of solutions: Each node can store a reference to the root directly (wastes memory) I can compute the root at runtime by "going up" (wastes cycles) I can use static fields (but thi...
To efficiently manage the relationship between nodes in a tree and their roots while avoiding global states and minimizing both memory usage and cycles, you can use a design pattern called "Parent Pointer". Here's how it can be structured: ### Design Overview 1. **Node Structure**: Each node contains a reference to i...
7,751
[ { "from": "human", "value": "I have a set of tree objects with a depth somewhere in the 20s. Each of the nodes in this tree needs access to its tree's root.\nA couple of solutions:\n\nEach node can store a reference to the root directly (wastes memory)\n\n\nI can compute the root at runtime by \"going up\"...
Considering this code, can I be absolutely sure that the finally block always executes, no matter what something() is? try { something(); return success; } catch (Exception e) { return failure; } finally { System.out.println("I don't know if this will get printed out"); }
Yes, you can be absolutely sure that the `finally` block will always execute, regardless of what happens in the `something()` method, unless the JVM itself crashes or is forcibly terminated (e.g., due to a power failure or `System.exit()` being called). The `finally` block is designed to execute after the `try` and `...
12,052
[ { "from": "human", "value": "Considering this code, can I be absolutely sure that the finally block always executes, no matter what something() is?\ntry { \n something(); \n return success; \n} \ncatch (Exception e) { \n return failure; \n} \nfinally { \n System.out.println(\"I don't kn...
What makes a language strongly typed? I'm looking for the most important aspects of a strongly typed language. Yesterday I asked if PowerShell was strongly typed, but no one could agree on the definition of "strongly-typed", so I'm looking to clarify the definition. Feel free to link to wikipedia or other sources, but ...
A strongly typed language is characterized by several key aspects that govern how it handles types and type checking. While definitions can vary slightly among different sources, here are the most important aspects that contribute to the classification of a language as strongly typed: 1. **Strict Type Checking**: In s...
10,298
[ { "from": "human", "value": "What makes a language strongly typed? I'm looking for the most important aspects of a strongly typed language.\nYesterday I asked if PowerShell was strongly typed, but no one could agree on the definition of \"strongly-typed\", so I'm looking to clarify the definition.\nFeel fre...
Given the case I made two independent changes in one file: eg. added a new method and changed another method. I often don't want to commit both changes as one commit, but as two independent commits. On a git repository I would use the Interactive Mode of git-add(1) to split the hunk into smaller ones: git add --patch ...
In Subversion (SVN), the concept of staging changes in a similar way to `git add --patch` is not inherently built into the version control system, as SVN operates on a different model compared to Git. However, you can achieve a similar outcome by following these steps: ### Using Command Line: 1. **Revert Uncommitted ...
7,377
[ { "from": "human", "value": "Given the case I made two independent changes in one file: eg. added a new method and changed another method.\nI often don't want to commit both changes as one commit, but as two independent commits.\nOn a git repository I would use the Interactive Mode of git-add(1) to split th...
Years ago I created a programming collaboratory in Diversity University MOO -- a room written in MOOcode that used TCP/IP to communicate with a perl server back at my campus to compile and execute C, Perl, Bash and other programs and return results to the MOO collaboratory -- all for demonstrating programming languages...
Creating a programming collaboratory in Second Life (SL) using LSL (Linden Scripting Language) can be a fun and educational project. However, there are some constraints to be aware of due to the limitations of LSL and how it interfaces with external systems. ### Communication in LSL 1. **HTTP Requests**: LSL primaril...
8,080
[ { "from": "human", "value": "Years ago I created a programming collaboratory in Diversity University MOO -- a room written in MOOcode that used TCP/IP to communicate with a perl server back at my campus to compile and execute C, Perl, Bash and other programs and return results to the MOO collaboratory -- al...
I have a long running process in VB6 that I want to finish before executing the next line of code. How can I do that? Built-in function? Can I control how long to wait? Trivial example: Call ExternalLongRunningProcess Call DoOtherStuff How do I delay 'DoOtherStuff'?
In VB6, if you want to ensure that a long-running process completes before proceeding to the next line of code, you can simply call the long-running process in a way that it blocks execution until it finishes. If `ExternalLongRunningProcess` is a subroutine (or function) that runs synchronously, you don't need to do ...
8,751
[ { "from": "human", "value": "I have a long running process in VB6 that I want to finish before executing the next line of code. How can I do that? Built-in function? Can I control how long to wait?\nTrivial example:\nCall ExternalLongRunningProcess\nCall DoOtherStuff\n\nHow do I delay 'DoOtherStuff'?\n" }...
What version of java, eclipse and WPT should I be using?
The best versions of Java, Eclipse, and WPT (WebPageTest) depend on your specific development needs and project requirements. However, as of my last knowledge update in October 2023, here are some general recommendations: ### Java - **Java Version:** It's generally advisable to use the latest Long-Term Support (LTS) v...
10,838
[ { "from": "human", "value": "What version of java, eclipse and WPT should I be using?\n" }, { "from": "gpt", "value": "The best versions of Java, Eclipse, and WPT (WebPageTest) depend on your specific development needs and project requirements. However, as of my last knowledge update in October ...
I'm getting into ASP.NET (C# - I know it doesn't matter for this particular question, but full disclosure and all that), and while I love that the asp:-style controls save me a lot of tedious HTML-crafting, I am often frustrated with certain behaviors. I encountered one last night when working with Master Pages: my <as...
It's great to see your enthusiasm for getting into ASP.NET and your desire to work with web standards. Your concerns about the ASP.NET server controls are common among developers who appreciate fine control over their HTML output. Here are some insights and practices that can help you leverage ASP.NET controls effectiv...
4,515
[ { "from": "human", "value": "I'm getting into ASP.NET (C# - I know it doesn't matter for this particular question, but full disclosure and all that), and while I love that the asp:-style controls save me a lot of tedious HTML-crafting, I am often frustrated with certain behaviors. I encountered one last nig...
I've been using the (Java) Highlighter for Lucene (in the Sandbox package) for some time. However, this isn't really very accurate when it comes to matching the correct terms in search results - it works well for simple queries, for example searching for two separate words will highlight both code fragments in the resu...
When dealing with highlighting in Lucene, particularly for complex queries, you may encounter performance issues and inaccuracies due to the way the default highlighter operates. Here are some strategies to improve both the performance and accuracy of your highlighting: 1. **Use `FastVectorHighlighter`:** This is an a...
8,959
[ { "from": "human", "value": "I've been using the (Java) Highlighter for Lucene (in the Sandbox package) for some time. However, this isn't really very accurate when it comes to matching the correct terms in search results - it works well for simple queries, for example searching for two separate words will ...
I'm getting a 404 error when trying to run another web service on an IIS 6 server which is also running Sharepoint 2003. I'm pretty sure this is an issue with sharepoint taking over IIS configuration. Is there a way to make a certain web service or web site be ignored by whatever Sharepoint is doing?
When running SharePoint 2003 on IIS 6, it can indeed create complexities with the configuration of web services or additional web applications, as SharePoint tends to take over the default settings for the web server. Here are some steps you can take to address the 404 error and allow your web service to coexist with S...
9,061
[ { "from": "human", "value": "I'm getting a 404 error when trying to run another web service on an IIS 6 server which is also running Sharepoint 2003. I'm pretty sure this is an issue with sharepoint taking over IIS configuration. Is there a way to make a certain web service or web site be ignored by whate...
Is there a good way to time SQL queries when using Linq to SQL? I really like logging feature, but it would be great if you could somehow also time that query. Any ideas?
Yes, you can time SQL queries when using LINQ to SQL by leveraging the logging feature combined with a stopwatch to measure the execution duration. Here's how you can do it: 1. **Set up logging for LINQ to SQL**: When you create your `DataContext`, you can assign a logging action to capture the generated SQL queries. ...
8,479
[ { "from": "human", "value": "Is there a good way to time SQL queries when using Linq to SQL? I really like logging feature, but it would be great if you could somehow also time that query. Any ideas?\n" }, { "from": "gpt", "value": "Yes, you can time SQL queries when using LINQ to SQL by leverag...
I'm looking to write a programming language for fun, however most of the resource I have seen are for writing a context free language, however I wish to write a language that, like python, uses indentation, which to my understanding means it can't be context free.
Creating a programming language that uses indentation for block structure (like Python) is an exciting and rewarding project! While it’s true that some forms of indentation-based syntax can lead to challenges in terms of parsing, it's still entirely feasible to design and implement such a language. ### Context-Free vs...
7,995
[ { "from": "human", "value": "I'm looking to write a programming language for fun, however most of the resource I have seen are for writing a context free language, however I wish to write a language that, like python, uses indentation, which to my understanding means it can't be context free.\n" }, { ...
The CSRF prevention built in to Rails is causing some problems for some automated load testing we are doing, and I want to turn it off for the duration of the process. How do I do this?
To disable CSRF (Cross-Site Request Forgery) protection in a Rails application, you can do so on a controller level or globally. Here are the methods for both approaches: ### Controller Level If you want to disable CSRF protection for a specific controller, you can use the `skip_before_action` method in that controll...
11,713
[ { "from": "human", "value": "The CSRF prevention built in to Rails is causing some problems for some automated load testing we are doing, and I want to turn it off for the duration of the process. How do I do this?\n" }, { "from": "gpt", "value": "To disable CSRF (Cross-Site Request Forgery) pro...
When I launch the "mvn install" command, maven sometimes tries to download dependencies that it has already downloaded. That's expected for SNAPSHOT but why does maven do that for other JARs? I know I can avoid that behavior by "-o" flag but I just wonder what the cause is.
When you run `mvn install`, Maven attempts to resolve dependencies for your project, and under certain circumstances, it may try to download JARs that it has previously downloaded. While it’s true that SNAPSHOT dependencies can trigger this behavior because they are meant to reflect the latest changes (and can change f...
11,210
[ { "from": "human", "value": "When I launch the \"mvn install\" command, maven sometimes tries to download dependencies that it has already downloaded. That's expected for SNAPSHOT but why does maven do that for other JARs?\nI know I can avoid that behavior by \"-o\" flag but I just wonder what the cause is....
I am looking for information on handling search in different ORMs. Currently I am redeveloping some old application in PHP and one of requirements is: make everything or almost everything searchable, so user just types "punkrock live" and the app finds videos clips, music tracks, reviews, upcoming events or even user c...
Implementing a robust search functionality within an application that utilizes ORM (Object-Relational Mapping) can indeed be challenging, especially when the goal is to search across various types of entities such as videos, music tracks, reviews, events, and user comments. Here are some general strategies, tools, and ...
5,338
[ { "from": "human", "value": "I am looking for information on handling search in different ORMs.\nCurrently I am redeveloping some old application in PHP and one of requirements is: make everything or almost everything searchable, so user just types \"punkrock live\" and the app finds videos clips, music tra...
Basically I would like to find a way to ddo something like: <asp:Label ID="lID" runat="server" AssociatedControlID="txtId" Text="<%# MyProperty %>"></asp:Label> I know I could set it from code behind (writing lId.Text = MyProperty), but I'd prefer doing it in the markup and I just can't seem to find the solution. (MyP...
In ASP.NET Web Forms, you can bind properties to controls using data binding syntax within the markup. However, data binding expressions like `<%# %>` require the control to be data-bound, typically within a data control (like a `GridView`, `Repeater`, etc.) or by explicitly calling `DataBind()` on the parent control. ...
9,304
[ { "from": "human", "value": "Basically I would like to find a way to ddo something like:\n<asp:Label ID=\"lID\" runat=\"server\" AssociatedControlID=\"txtId\" Text=\"<%# MyProperty %>\"></asp:Label>\n\nI know I could set it from code behind (writing lId.Text = MyProperty), but I'd prefer doing it in the mar...
I am just getting started with flex and am using the SDK (not Flex Builder). I was wondering what's the best way to compile a mxml file from an ant build script.
To compile an MXML file using Apache Ant with the Flex SDK (without Flex Builder), you can use the `mxmlc` compiler. You'll need to create a build script in Ant that invokes the `mxmlc` task. Below is a step-by-step guide to set up your Ant build script to compile an MXML file. ### Step 1: Set Up Your Environment Ens...
3,980
[ { "from": "human", "value": "I am just getting started with flex and am using the SDK (not Flex Builder). I was wondering what's the best way to compile a mxml file from an ant build script. \n" }, { "from": "gpt", "value": "To compile an MXML file using Apache Ant with the Flex SDK (without Fle...
Is it possible to read a disk directly with .NET? By directly, I mean via the device bypassing the file system. I think I would go about this by opening the device some way "\Device\Ide\IdeDeviceP2T0L0-1" for example. If I can't open the device with a .NET API, knowing which Win32 API to use would be helpful.
Yes, it is possible to read a disk directly using .NET, but it requires some interop with Windows API, as .NET does not provide built-in functionality for directly accessing hardware devices. You'll need to use the Windows API to access raw disk devices bypassing the file system. You can use the `CreateFile` function ...
5,317
[ { "from": "human", "value": "Is it possible to read a disk directly with .NET? By directly, I mean via the device bypassing the file system. I think I would go about this by opening the device some way \"\\Device\\Ide\\IdeDeviceP2T0L0-1\" for example.\nIf I can't open the device with a .NET API, knowing w...
I am using Excel where certain fields are allowed for user input and other cells are to be protected. I have used Tools Protect sheet, however after doing this I am not able to change the values in the VBA script. I need to restrict the sheet to stop user input, at the same time allow the VBA code to change the cell va...
To protect a sheet in Excel while allowing VBA to modify specific cell values, you can use the following approach: 1. **Unlock Specific Cells**: Before protecting the sheet, unlock the cells where you expect to make changes via VBA. Here’s how you can do that: - Select the cells you want to allow the VBA code to c...
10,282
[ { "from": "human", "value": "I am using Excel where certain fields are allowed for user input and other cells are to be protected. I have used Tools Protect sheet, however after doing this I am not able to change the values in the VBA script. I need to restrict the sheet to stop user input, at the same time...
Puzzled by the Lua 5.0 documentation references to things like _LOADED, LUA_PATH, _ALERT and so on (that I could not use in Lua 5.1), I discovered all of those have been removed and the functionality put elsewhere. Am I right in thinking that the only one global variable left in Lua 5.1 is _VERSION?
Yes, you are correct. In Lua 5.1, the only global variable that remains from the earlier versions is `_VERSION`. In Lua 5.0, there were several global variables like `_LOADED`, `LUA_PATH`, and `_ALERT` that were used for various purposes, such as managing the module system and handling alerts. However, these global v...
12,307
[ { "from": "human", "value": "Puzzled by the Lua 5.0 documentation references to things like _LOADED, LUA_PATH, _ALERT and so on (that I could not use in Lua 5.1), I discovered all of those have been removed and the functionality put elsewhere. Am I right in thinking that the only one global variable left in...
Is it possible to embed an inline search box into a web page which provides similar functionality to the IE7Pro Inline Search or similar plugins for Firefox/Safari?
Yes, it is certainly possible to embed an inline search box into a web page that functions similarly to the inline search features provided by plugins like IE7Pro for Internet Explorer or similar extensions for Firefox/Safari. You can achieve this with a combination of HTML, CSS, and JavaScript. Below is a simple examp...
5,337
[ { "from": "human", "value": "Is it possible to embed an inline search box into a web page which provides similar functionality to the IE7Pro Inline Search or similar plugins for Firefox/Safari?\n" }, { "from": "gpt", "value": "Yes, it is certainly possible to embed an inline search box into a we...
I was investigating the rapid growth of a SQL Server 2005 transaction log when I found that transaction logs will only truncate correctly - if the sys.databases "log_reuse_wait" column is set to 0 - meaning that nothing is keeping the transaction log from reusing existing space. One day when I was intending to back...
The `log_reuse_wait` column in the `sys.databases` view in SQL Server indicates the reason the transaction log cannot be truncated and reused. If you see a value of `4` (ACTIVE_TRANSACTION), it generally means that there are ongoing transactions that are preventing log truncation. However, in the context of SQL Server,...
6,308
[ { "from": "human", "value": "I was investigating the rapid growth of a SQL Server 2005 transaction log when I found that transaction logs will only truncate correctly - if the sys.databases \"log_reuse_wait\" column is set to 0 - meaning that nothing is keeping the transaction log from reusing existing spac...
So my company stores alot of data in a foxpro database and trying to get around the performance hit of touching it directly I was thinking of messaging anything that can be done asynchronously for a snappier user experience. I started looking at ActiveMQ but don't know how well C# will hook with it. Wanting to hear w...
It sounds like you’re dealing with a challenging legacy system, and looking to improve performance for a web application that interacts with FoxPro. Using a messaging system like ActiveMQ to decouple writes from user interactions is a sensible approach, especially if you’re trying to enhance the user experience during ...
5,172
[ { "from": "human", "value": "So my company stores alot of data in a foxpro database and trying to get around the performance hit of touching it directly I was thinking of messaging anything that can be done asynchronously for a snappier user experience. I started looking at ActiveMQ but don't know how well...
People, We have 4 or 5 utilities that work in conjunction with our application. These utilities are either .bat files, or VB apps, PowerBuilder, etc. I am trying to manage these utils in source control, and am trying to figure out a better way to assign versions to them. Right now, the developers use the version contro...
To effectively manage versioning of your utilities, it's essential to have a structured approach, especially since you are planning to create individual InstallShield packages for each utility. Here are some recommendations based on your requirements and concerns: ### Version Management Approaches 1. **Use a Separate...
8,125
[ { "from": "human", "value": "People,\nWe have 4 or 5 utilities that work in conjunction with our application. These utilities are either .bat files, or VB apps, PowerBuilder, etc. I am trying to manage these utils in source control, and am trying to figure out a better way to assign versions to them. Right ...
I have just started reading DDD. I am unable to completely grasp the concept of Entity vs Value objects.. Can someone please explain the problems (maintainability, performance.. etc) a system could face when a Value object is designed as a Entity object? Example would be great...
Domain-Driven Design (DDD) distinguishes between two key concepts: **Entities** and **Value Objects**. Understanding the differences between these two can help you design more maintainable and coherent systems. Here’s a breakdown of each, followed by the implications of misclassifying them, as well as an example. ### ...
6,955
[ { "from": "human", "value": "I have just started reading DDD. I am unable to completely grasp the concept of Entity vs Value objects.. Can someone please explain the problems (maintainability, performance.. etc) a system could face when a Value object is designed as a Entity object? Example would be great.....
I've read about and dabbled with some including active record, repository, data transfer objects. Which is best?
Choosing the "best" design pattern or architectural approach often depends on the specific context of your application, including its complexity, size, and the team's familiarity with various patterns. Here’s a brief overview of the ones you've mentioned and their ideal use cases: ### 1. Active Record - **Definition**...
8,511
[ { "from": "human", "value": "I've read about and dabbled with some including active record, repository, data transfer objects. Which is best?\n" }, { "from": "gpt", "value": "Choosing the \"best\" design pattern or architectural approach often depends on the specific context of your application...
When a system has N tiers, and when using an ORM, how do you send loaded entities across the tiers ? Do you use DTO ? When DTO are not used and the entities are directly sent, how do you protect againt the uninitialized lazy loaded relationship errors ? Note : this is not a "should N tiers be used ?" question. I assume...
In a multi-tier (N-tier) architecture, when you're using an Object-Relational Mapping (ORM) tool, it's common practice to utilize Data Transfer Objects (DTOs) to transfer data across tiers. Here are the main reasons for using DTOs and how to address potential pitfalls when entities are sent directly: ### Using DTOs 1...
7,010
[ { "from": "human", "value": "When a system has N tiers, and when using an ORM, how do you send loaded entities across the tiers ?\nDo you use DTO ?\nWhen DTO are not used and the entities are directly sent, how do you protect againt the uninitialized lazy loaded relationship errors ?\nNote : this is not a \...
Is there an API call in .NET or a native DLL that I can use to create similar behaviour as Windows Live Messenger when a response comes from someone I chat with?
Creating similar behavior to Windows Live Messenger in a .NET application involves handling notifications for incoming messages, which can be accomplished using various methods. Here's a general outline of how to implement such functionality, including options you might explore: ### 1. **Using SignalR** SignalR is a ...
8,224
[ { "from": "human", "value": "Is there an API call in .NET or a native DLL that I can use to create similar behaviour as Windows Live Messenger when a response comes from someone I chat with?\n" }, { "from": "gpt", "value": "Creating similar behavior to Windows Live Messenger in a .NET applicatio...
Authorize.net offers a "Silent POST" feature for their Automated Recurring Billing. It's supposed to POST data to a url of your choosing, telling you whether they were able to charge the customer, how much, etc. The problem is, it isn't very well documented. Is there any way to test a post to that URL? I've signed up ...
Testing the "Silent POST" feature from Authorize.net can indeed be challenging due to the lack of clear documentation and the absence of a straightforward way to set up a test URL in the developer account. Here’s a guide on how you can effectively test and implement this feature, along with some information on the data...
8,707
[ { "from": "human", "value": "Authorize.net offers a \"Silent POST\" feature for their Automated Recurring Billing. It's supposed to POST data to a url of your choosing, telling you whether they were able to charge the customer, how much, etc. The problem is, it isn't very well documented.\n\nIs there any wa...
I have a program that creates a Windows user account using the NetUserAdd() API which is suggested by Microsoft. The user is created successfully, and I can log in as that user. However, on Windows XP, the newly-created user is missing from the Welcome screen. If I disable the Welcome screen, I can log in as the new ...
In Windows XP, the Welcome screen displays users based on specific user account properties. When you create a new user account programmatically using the `NetUserAdd()` API, the account may not appear on the Welcome screen if it is configured in a certain way. One key property that affects visibility on the Welcome scr...
9,024
[ { "from": "human", "value": "I have a program that creates a Windows user account using the NetUserAdd() API which is suggested by Microsoft. The user is created successfully, and I can log in as that user.\nHowever, on Windows XP, the newly-created user is missing from the Welcome screen. If I disable th...
I get the following error when trying to run the latest Cygwin version of rsync in Windows XP SP2. The error occurs for attempts at both local syncs (that is: source and destination on the local harddisk only) and remote syncs (using "-e ssh" from the openssh package). Any advice on how to fix/workaround it? bash-3.2$...
The error messages you're encountering suggest that there are issues with interprocess communication (IPC) when using `rsync` on Cygwin in Windows XP SP2. Here are a few steps you can take to troubleshoot and potentially fix the issue: 1. **Update Cygwin**: First, ensure that you are running the latest version of Cygw...
6,860
[ { "from": "human", "value": "I get the following error when trying to run the latest Cygwin version of rsync in Windows XP SP2. The error occurs for attempts at both local syncs (that is: source and destination on the local harddisk only) and remote syncs (using \"-e ssh\" from the openssh package). Any adv...
I have a question that I may be over thinking at this point but here goes... I have 2 classes Users and Groups. Users and groups have a many to many relationship and I was thinking that the join table group_users I wanted to have an IsAuthorized property (because some groups are private -- users will need authorization...
It sounds like you're on the right track with your design, and creating a class for the join table (often referred to as a junction or bridge table) is a good idea, especially when you want to store additional attributes like `IsAuthorized` or `WaitingForAccept`. In a many-to-many relationship, the junction table can ...
9,534
[ { "from": "human", "value": "I have a question that I may be over thinking at this point but here goes...\nI have 2 classes Users and Groups. Users and groups have a many to many relationship and I was thinking that the join table group_users I wanted to have an IsAuthorized property (because some groups ar...
How to tell using T-SQL whether a SQL server database has the TRUSTWORTHY property set to on or off
In SQL Server, you can check whether the TRUSTWORTHY property of a database is set to ON or OFF by querying the `sys.databases` system view. The `is_trustworthy_on` column indicates the state of the TRUSTWORTHY property. Here is a simple T-SQL query that retrieves the TRUSTWORTHY property for a specific database: ```...
10,757
[ { "from": "human", "value": "How to tell using T-SQL whether a SQL server database has the TRUSTWORTHY property set to on or off\n" }, { "from": "gpt", "value": "In SQL Server, you can check whether the TRUSTWORTHY property of a database is set to ON or OFF by querying the `sys.databases` system...
I have an editable DataGridView with SelectionMode set to FullRowSelect (so the whole row is highlighted when the user clicks on any cell). However I would like the cell that currently has focus to be highlighted with a different back color (so the user can clearly see what cell they are about to edit). How can I do th...
To achieve the desired functionality of highlighting the currently focused cell in a `DataGridView` while keeping the `SelectionMode` set to `FullRowSelect`, you can handle the `CellEnter` and `CellLeave` events of the `DataGridView`. The idea is to change the background color of the focused cell in the `CellEnter` eve...
9,275
[ { "from": "human", "value": "I have an editable DataGridView with SelectionMode set to FullRowSelect (so the whole row is highlighted when the user clicks on any cell). However I would like the cell that currently has focus to be highlighted with a different back color (so the user can clearly see what cell...
I have a large codebase without Javadoc, and I want to run a program to write a skeleton with the basic Javadoc information (e.g., for each method's parameter write @param...), so I just have to fill the gaps left. Anyone know a good solution for this? Edit: JAutodoc is what I was looking for. It has Ant tasks, an Ecl...
JAutodoc is indeed a solid choice for generating Javadoc comments in your Java codebase. It helps you to create basic skeletons for your Javadoc comments, allowing you to quickly fill in the details later. Here’s a brief overview of how to set it up and use it: ### Setting Up JAutodoc 1. **Download JAutodoc**: - Y...
8,195
[ { "from": "human", "value": "I have a large codebase without Javadoc, and I want to run a program to write a skeleton with the basic Javadoc information (e.g., for each method's parameter write @param...), so I just have to fill the gaps left.\nAnyone know a good solution for this?\nEdit:\nJAutodoc is what ...
Can anyone recommend a simple API that will allow me to use read a CSV input file, do some simple transformations, and then write it. A quick google has found http://flatpack.sourceforge.net/ which looks promising. I just wanted to check what others are using before I couple myself to this API.
There are several APIs and libraries that can help you read, transform, and write CSV files easily. Here are a few popular options you might consider: 1. **Pandas (Python)**: - If you are open to using Python, Pandas is an excellent library for handling CSV files. You can easily read CSV files into DataFrames, appl...
11,083
[ { "from": "human", "value": "Can anyone recommend a simple API that will allow me to use read a CSV input file, do some simple transformations, and then write it.\nA quick google has found http://flatpack.sourceforge.net/ which looks promising.\nI just wanted to check what others are using before I couple m...
Does the Java virtual machine ever move objects in memory, and if so, how does it handle updating references to the moved object? I ask because I'm exploring an idea of storing objects in a distributed fashion (ie. across multiple servers), but I need the ability to move objects between servers for efficiency reasons. ...
The Java Virtual Machine (JVM) does indeed move objects in memory, primarily during garbage collection (GC). The process known as "compacting" during GC is when the JVM moves objects to reduce fragmentation, improving memory usage and access speed. When an object is moved, all references to that object must be updated ...
7,855
[ { "from": "human", "value": "Does the Java virtual machine ever move objects in memory, and if so, how does it handle updating references to the moved object?\nI ask because I'm exploring an idea of storing objects in a distributed fashion (ie. across multiple servers), but I need the ability to move object...
I'm trying to create a webapplication where I want to be able to plug-in separate assemblies. I'm using MVC preview 4 combined with Unity for dependency injection, which I use to create the controllers from my plugin assemblies. I'm using WebForms (default aspx) as my view engine. If I want to use a view, I'm stuck on ...
It sounds like you're working on a fairly complex web application architecture that involves dynamic assembly loading and view management. Here’s a summary of how you can achieve your goal of dynamically loading ASPX views from separate assemblies: ### Using a Virtual Path Provider You mentioned that you found succes...
1,524
[ { "from": "human", "value": "I'm trying to create a webapplication where I want to be able to plug-in separate assemblies. I'm using MVC preview 4 combined with Unity for dependency injection, which I use to create the controllers from my plugin assemblies. I'm using WebForms (default aspx) as my view engin...
I'm trying to get a number of third party applications to work on my Windows Mobile 5 smartphone. I've installed the latest version (3.5) of the Microsoft.NET Compact Framework, but whenever I run the apps I get an error message which states: "This application [Application Name] requires a newer version of the Microsof...
It sounds like you're encountering a common issue with the .NET Compact Framework on Windows Mobile 5. Here are some steps and suggestions that might help you resolve the problem: 1. **Check Compatibility of Applications**: Before proceeding with the uninstallation, ensure that the applications you're trying to run ar...
9,857
[ { "from": "human", "value": "I'm trying to get a number of third party applications to work on my Windows Mobile 5 smartphone.\nI've installed the latest version (3.5) of the Microsoft.NET Compact Framework, but whenever I run the apps I get an error message which states: \"This application [Application Nam...
I'm asking more about what this means to my code. I understand the concepts mathematically, I just have a hard time wrapping my head around what they mean conceptually. For example, if one were to perform an O(1) operation on a data structure, I understand that the number of operations it has to perform won't grow be...
Great questions! Understanding time complexity can be tricky, but let’s break it down conceptually. ### O(1) - Constant Time As you correctly stated, O(1) means that the operation takes the same amount of time regardless of the size of the data structure. For instance, accessing an element in an array by index is O(1)...
7,396
[ { "from": "human", "value": "I'm asking more about what this means to my code. I understand the concepts mathematically, I just have a hard time wrapping my head around what they mean conceptually. For example, if one were to perform an O(1) operation on a data structure, I understand that the number of o...
Suppose I have two applications written in C#. The first is a third party application that raises an event called "OnEmailSent". The second is a custom app that I've written that I would like to somehow subscribe to the "OnEmailSent" even of the first application. Is there any way that I could somehow attach the second...
What you're describing is a situation where you want to listen to events from another application's instance without modifying its source code. There are several approaches to achieve this in a C# environment. Below are some potential strategies: ### 1. **Using Reflection and Runtime Hooking** You mentioned that you'...
7,478
[ { "from": "human", "value": "Suppose I have two applications written in C#. The first is a third party application that raises an event called \"OnEmailSent\".\nThe second is a custom app that I've written that I would like to somehow subscribe to the \"OnEmailSent\" even of the first application.\nIs there...
What techniques can be applied to detect Polymorphic and Metamorphic viruses? How difficult is to implement these techniques? Are these techniques being applied in modern day anti-virus softwares?
Detecting polymorphic and metamorphic viruses can be quite challenging due to their ability to change their code and structure while maintaining the same functionality. However, several techniques can be employed to identify these types of malware: ### Techniques for Detection 1. **Signature-Based Detection:** - *...
7,826
[ { "from": "human", "value": "What techniques can be applied to detect Polymorphic and Metamorphic viruses?\nHow difficult is to implement these techniques? \nAre these techniques being applied in modern day anti-virus softwares?\n" }, { "from": "gpt", "value": "Detecting polymorphic and metamorp...
I'm looking for a way to give out preview or demo versions of our software to our customers as easy as possible. The software we are currently developing is a pretty big project. It consists of a client environment, an application server, various databases, web services host etc. The project is developed incrementally ...
Using virtual machines (VMs) to distribute demo versions of your software is a popular and effective method, especially for complex applications. Here are some key points to consider, along with potential challenges and recommendations: ### Benefits of Using Virtual Machines 1. **Ease of Use**: Customers can run the V...
8,787
[ { "from": "human", "value": "I'm looking for a way to give out preview or demo versions of our software to our customers as easy as possible.\nThe software we are currently developing is a pretty big project. It consists of a client environment, an application server, various databases, web services host et...
I want a user-privileged (not root) process to launch new processes as user nobody. I've tried a straight call to setuid that fails with -1 EPERM on Ubuntu 8.04: #include <sys/types.h> #include <unistd.h> int main() { setuid(65534); while (1); return 0; } How should I do this instead?
To allow a non-root user to launch processes as the user `nobody` (with UID 65534), you will need to use a privileged helper process because a standard user cannot change their UID to another user via `setuid()`. This is because changing to a lower privilege (like from a non-root user to `nobody`) generally requires ro...
7,517
[ { "from": "human", "value": "I want a user-privileged (not root) process to launch new processes as user nobody. I've tried a straight call to setuid that fails with -1 EPERM on Ubuntu 8.04:\n#include <sys/types.h>\n#include <unistd.h>\n\nint main() { \n setuid(65534);\n while (1);\n retur...
In C#.NET I am trying to programmatically change the color of the border in a group box. Update: This question was asked when I was working on a winforms system before we switched to .NET.
In WinForms, the `GroupBox` control does not have a built-in property to change the border color directly. However, you can achieve this by overriding the `OnPaint` method or by using custom painting. Here is a way to create a custom `GroupBox` that allows you to change the border color by extending the `GroupBox` cla...
9,256
[ { "from": "human", "value": "In C#.NET I am trying to programmatically change the color of the border in a group box.\nUpdate: This question was asked when I was working on a winforms system before we switched to .NET.\n" }, { "from": "gpt", "value": "In WinForms, the `GroupBox` control does no...
This code in JS gives me a popup saying "i think null is a number", which I find slightly disturbing. What am I missing? if (isNaN(null)) { alert("null is not a number"); } else { alert("i think null is a number"); } I'm using Firefox 3. Is that a browser bug? Other tests: console.log(null == NaN); // ...
The behavior you're seeing is due to how JavaScript handles type coercion and the `isNaN` function. The `isNaN` function checks whether a value is `NaN` (Not-a-Number). However, it first coerces the input to a number if it is not already of type `number`. In the case of `null`, it gets coerced to `0`, which is a valid ...
9,007
[ { "from": "human", "value": "This code in JS gives me a popup saying \"i think null is a number\", which I find slightly disturbing. What am I missing?\n\n\nif (isNaN(null)) {\r\n alert(\"null is not a number\");\r\n} else {\r\n alert(\"i think null is a number\");\r\n}\n\n\n\nI'm using Firefox 3. Is that...
Is it possible to do pseudo-streaming(eg start playback at any point) with wmv files and silverlight? This is possible using Flash in a progressive download setup but can it be done on the Microsoft track?
Yes, it is possible to implement pseudo-streaming with WMV files using Silverlight, although it may not be as straightforward as with Flash. Silverlight supports progressive download, which allows users to start playback of a video file before the entire file has been downloaded. This capability is primarily based on ...
9,859
[ { "from": "human", "value": "Is it possible to do pseudo-streaming(eg start playback at any point) with wmv files and silverlight? \nThis is possible using Flash in a progressive download setup but can it be done on the Microsoft track?\n" }, { "from": "gpt", "value": "Yes, it is possible to imp...
I've been playing with Jaxer and while the concept is very cool I cannot figure out how to define objects that are available on both the client and the server. None of the examples I can find define objects at all. I'd like to be able to define an object and specify which methods will be available on the server, which ...
In Jaxer, you can achieve the behavior you're looking for by using specific conventions and properties to define which methods should run on the client, server, or as a server-proxy. Although Jaxer does not natively support a single syntax for doing this, you can implement a simple mechanism to define and segregate the...
7,892
[ { "from": "human", "value": "I've been playing with Jaxer and while the concept is very cool I cannot figure out how to define objects that are available on both the client and the server. None of the examples I can find define objects at all.\nI'd like to be able to define an object and specify which metho...
For IronPython there is a project - IronClad, that aims to transparently run C extensions in it. Is there a similiar project for Jython?
Yes, there is a project similar to IronClad for Jython called **Jython's C Extensions**. While Jython does not natively support CPython C extensions due to its Java-based architecture, there are several approaches and projects aimed at bridging the gap between Jython and C libraries. One notable effort is **JPype**, w...
13,089
[ { "from": "human", "value": "For IronPython there is a project - IronClad, that aims to transparently run C extensions in it. Is there a similiar project for Jython?\n" }, { "from": "gpt", "value": "Yes, there is a project similar to IronClad for Jython called **Jython's C Extensions**. While Jy...
I'm trying to find a least-resistance path from C# to C++, and while I feel I handle C# pretty well after two solid years, I'm still not sure I've gotten the "groove" of C++, despite numerous attempts. Are there any particular books or websites that might be suitable for this transition?
Transitioning from C# to C++ can be a challenging yet rewarding process, given the differences in paradigms, memory management, and language features. Here are some recommended resources to help you make that transition more smoothly: ### Books: 1. **"C++ Primer" by Stanley B. Lippman, Josée Lajoie, and Barbara E. Moo...
7,516
[ { "from": "human", "value": "I'm trying to find a least-resistance path from C# to C++, and while I feel I handle C# pretty well after two solid years, I'm still not sure I've gotten the \"groove\" of C++, despite numerous attempts.\nAre there any particular books or websites that might be suitable for this...
Which gets called first - the base constructor or "other stuff here"? public class MyExceptionClass : Exception { public MyExceptionClass(string message, string extrainfo) : base(message) { //other stuff here } }
In C#, when you create a constructor in a derived class (like `MyExceptionClass` in your example) that calls a base class constructor (like `base(message)`), the base class constructor is called first before any other code in the derived class's constructor is executed. Here's how the flow works: 1. The derived clas...
12,495
[ { "from": "human", "value": "Which gets called first - the base constructor or \"other stuff here\"?\npublic class MyExceptionClass : Exception\n{\n public MyExceptionClass(string message, string extrainfo) : base(message)\n {\n //other stuff here\n }\n}\n\n" }, { "from": "gpt", ...
I would like to know how to infer coercions (a.k.a. implicit conversions) during type inference. I am using the type inference scheme described in Top Quality Type Error Messages by Bastiaan Heeren, but I'd assume that the general idea is probably the same in all Hindley-Milner-esque approaches. It seems like coercion ...
Coercions (or implicit conversions) can add complexity to type inference systems like those based on the Hindley-Milner (HM) type system, but they can be integrated with a few strategies that maintain a clean design while respecting the properties you're concerned about, such as identity coercion and transitive closure...
7,790
[ { "from": "human", "value": "I would like to know how to infer coercions (a.k.a. implicit conversions) during type inference. I am using the type inference scheme described in Top Quality Type Error Messages by Bastiaan Heeren, but I'd assume that the general idea is probably the same in all Hindley-Milner-...
I just started using SVN, and I have a cache directory that I don't need under source control. How can I ignore the whole directory/folder with SVN? I am using Versions and TextMate on OS X and commandline.
To ignore a directory (or file) in SVN, you can use the `svn:ignore` property. Here's how you can ignore a cache directory using both the command line and SVN GUI tools like Versions. ### Using the Command Line 1. **Open Terminal**. 2. Navigate to your working copy of the SVN repository where the cache directory is l...
9,868
[ { "from": "human", "value": "I just started using SVN, and I have a cache directory that I don't need under source control. How can I ignore the whole directory/folder with SVN?\nI am using Versions and TextMate on OS X and commandline.\n" }, { "from": "gpt", "value": "To ignore a directory (or ...
Hello again ladies and gents! OK, following on from my other question on ASP.NET Web Service Results, Proxy Classes and Type Conversion. I've come to a part in my project where I need to get my thinking cap on. Basically, we have a large, complex custom object that needs to be returned from a Web Service and consumed i...
Your approach to use XML serialization to return complex objects from your ASP.NET Web Service has its pros and cons. Let’s evaluate your strategy and consider some alternative solutions. ### Pros of Using XML Serialization: 1. **Simplicity**: By serializing your complex object to XML and sending it as a string, you ...
6,902
[ { "from": "human", "value": "Hello again ladies and gents!\nOK, following on from my other question on ASP.NET Web Service Results, Proxy Classes and Type Conversion. I've come to a part in my project where I need to get my thinking cap on.\nBasically, we have a large, complex custom object that needs to be...
I'm looking to introduce a unit testing framework into the mix at my job. We're using Visual Studio 2005 (though we may be moving to 2008 within the next six months) and work primarily in C#. If the framework has some kind of IDE integration that would be best, but I'm open to frameworks that don't have integration bu...
NUnit is indeed a popular choice for unit testing in C#, and it’s a solid option to consider for your team, especially since it has been around for a long time and has a large community. Here are some impressions, strengths, and potential pitfalls based on usage: ### Strengths of NUnit: 1. **Easy to Get Started**: NU...
2,955
[ { "from": "human", "value": "I'm looking to introduce a unit testing framework into the mix at my job. We're using Visual Studio 2005 (though we may be moving to 2008 within the next six months) and work primarily in C#. If the framework has some kind of IDE integration that would be best, but I'm open to ...
Lets say that you have websites www.xyz.com and www.abc.com. Lets say that a user goes to www.abc.com and they get authenticated through the normal ASP .NET membership provider. Then, from that site, they get sent to (redirection, linked, whatever works) site www.xyz.com, and the intent of site www.abc.com was to pass...
To achieve a seamless authentication experience between two separate websites (like www.abc.com and www.xyz.com) when using different user databases, you'll need to implement a Single Sign-On (SSO) mechanism. Here's a high-level overview of how you can accomplish this: ### Steps to Implement SSO 1. **Central Authenti...
6,104
[ { "from": "human", "value": "Lets say that you have websites www.xyz.com and www.abc.com.\nLets say that a user goes to www.abc.com and they get authenticated through the normal ASP .NET membership provider. \nThen, from that site, they get sent to (redirection, linked, whatever works) site www.xyz.com, and...
What's the best framework for writing modules -- ExtUtils::MakeMaker (h2xs) or Module::Build?
Both ExtUtils::MakeMaker (often used with `h2xs`) and Module::Build are popular frameworks for writing Perl modules, and each has its own strengths and weaknesses. The choice between them often depends on your specific needs and preferences. ### ExtUtils::MakeMaker (h2xs) - **Pros:** - It is the traditional and most...
11,978
[ { "from": "human", "value": "What's the best framework for writing modules -- ExtUtils::MakeMaker (h2xs) or Module::Build?\n" }, { "from": "gpt", "value": "Both ExtUtils::MakeMaker (often used with `h2xs`) and Module::Build are popular frameworks for writing Perl modules, and each has its own st...
I'm faced with writing a framework to simplify working with a large and complex object library (ArcObjects). What guidelines would you suggest for creating a framework of this kind? Are static methods preferred? How do you handle things like logging? How do you future proof your framework code from changes that a vendo...
Creating a framework to simplify the use of a complex library like ArcObjects can be challenging, but following some structured guidelines can help you develop a maintainable and robust solution. Here are some recommendations to consider: ### 1. **Design Principles** - **Separation of Concerns**: Divide your framewor...
5,666
[ { "from": "human", "value": "I'm faced with writing a framework to simplify working with a large and complex object library (ArcObjects). What guidelines would you suggest for creating a framework of this kind? Are static methods preferred? How do you handle things like logging? How do you future proof your...
I have a Windows application that uses a .NET PropertyGrid control. Is it possible to change the type of control that is used for the value field of a property? I would like to be able to use a RichTextBox to allow better formatting of the input value. Can this be done without creating a custom editor class?
The .NET `PropertyGrid` control provides a way to display and edit properties of objects, but it does have limitations when it comes to customizing the controls used for editing. By default, the `PropertyGrid` will use a set of predefined editors for the property types it recognizes. While it's common to create custom ...
6,766
[ { "from": "human", "value": "I have a Windows application that uses a .NET PropertyGrid control. Is it possible to change the type of control that is used for the value field of a property?\nI would like to be able to use a RichTextBox to allow better formatting of the input value.\nCan this be done withou...
I'm an experienced VS.NET user and trying to get up and running on Xcode 3.1.1. Here's what I'm trying to accomplish: I'd like a static library ("Lib") to have its own xcodeproj file. I'd an executable application ("App") that makes use of Lib to reference Lib's xcodeproj file so that changes to Lib cause App to relin...
It sounds like you're on the right track for integrating a static library into your Xcode project, but Xcode does have a few differences compared to Visual Studio that might be causing some of the confusion. Here’s how to achieve your goals: ### 1. Project Dependency and Linking When you add `Lib.xcodeproj` to `App.x...
6,696
[ { "from": "human", "value": "I'm an experienced VS.NET user and trying to get up and running on Xcode 3.1.1.\nHere's what I'm trying to accomplish:\nI'd like a static library (\"Lib\") to have its own xcodeproj file. I'd an executable application (\"App\") that makes use of Lib to reference Lib's xcodeproj...
Everything inherits from object. It's the basis of inheritance. Everything can be implicitly cast up the inheritance tree, ie. object me = new Person(); Therefore, following this through to its logical conclusion, a group of People would also be a group of objects: List<Person> people = new List<Person>(); people.Add(...
The behavior you are observing in .NET regarding type compatibility between generics, specifically with `List<Person>` and `List<object>`, is due to the fact that generics in C# are invariant. This means that even though `Person` is derived from `object`, `List<Person>` is not considered to be the same type as `List<ob...
8,241
[ { "from": "human", "value": "Everything inherits from object. It's the basis of inheritance. Everything can be implicitly cast up the inheritance tree, ie.\nobject me = new Person();\n\nTherefore, following this through to its logical conclusion, a group of People would also be a group of objects:\nList<Per...
If our organisation were to switch from a central-server VCS like subversion to a distributed VCS like git, how do I make sure that all my code is safe from hardware failure? With a central-server VCS I just need to backup the repository every day. If we were using a DVCS then there'd be loads of code branches on all t...
Transitioning from a central-server version control system (VCS) like Subversion to a distributed VCS like Git indeed changes the dynamics of how you think about backups and code safety. In a distributed system, every developer has a full copy of the repository, including all branches and history. However, as you've ri...
8,378
[ { "from": "human", "value": "If our organisation were to switch from a central-server VCS like subversion to a distributed VCS like git, how do I make sure that all my code is safe from hardware failure?\nWith a central-server VCS I just need to backup the repository every day. If we were using a DVCS then ...
I'm working with an mpeg stream that uses a IBBP... GOP sequence. The (DTS,PTS) values returned for the first 4 AVPackets are as follows: I=(0,3) B=(1,1) B=(2,2) P=(3,6) The PTS on the I frame looks like it is legit, but then the PTS on the B frames cannot be right, since the B frames shouldn't be displayed before the ...
When working with MPEG streams and dealing with timestamp issues, it's essential to understand how PTS (Presentation Time Stamp) and DTS (Decoding Time Stamp) are utilized in video encoding and decoding. ### PTS and DTS Overview 1. **DTS**: This timestamp tells you when a frame should be decoded. It is essential for ...
9,284
[ { "from": "human", "value": "I'm working with an mpeg stream that uses a IBBP... GOP sequence. The (DTS,PTS) values returned for the first 4 AVPackets are as follows: I=(0,3) B=(1,1) B=(2,2) P=(3,6)\nThe PTS on the I frame looks like it is legit, but then the PTS on the B frames cannot be right, since the B...
class A : IFoo { } ... A[] arrayOfA = new A[10]; if(arrayOfA is IFoo[]) { // this is not called } Q1: Why is arrayOfA not an array of IFoos? Q2: Why can't I cast arrayOfA to IFoo[]?
The questions you're asking are related to how arrays and type inheritance work in C#. Let's break down each question. ### Q1: Why is `arrayOfA` not an array of `IFoos`? In C#, arrays are covariant, which means that an array of a derived type (like `A` in your case) can be treated as an array of its base type (in you...
9,401
[ { "from": "human", "value": "class A : IFoo\n{\n}\n\n...\n\nA[] arrayOfA = new A[10];\n\nif(arrayOfA is IFoo[]) \n{\n // this is not called\n}\n\nQ1: Why is arrayOfA not an array of IFoos?\nQ2: Why can't I cast arrayOfA to IFoo[]?\n" }, { "from": "gpt", "value": "The questions you're asking a...
I want to generate a Makefile from an existing Xcode project on the Mac. Specifically, an existing iPhone, Objective-C program on the Mac. I found PBToMake, but it looks like it is for Xcode 2.1 and when I tried using it, it did not work for an Xcode 3.1 project.
Generating a Makefile from an existing Xcode project can be a bit tricky since Xcode projects are structured in a way that is specific to Xcode itself, and tools to convert them to Makefiles are often outdated. As of now, there isn't a widely supported tool that automatically converts newer Xcode projects to Makefiles....
9,011
[ { "from": "human", "value": "I want to generate a Makefile from an existing Xcode project on the Mac. Specifically, an existing iPhone, Objective-C program on the Mac.\nI found PBToMake, but it looks like it is for Xcode 2.1 and when I tried using it, it did not work for an Xcode 3.1 project.\n" }, { ...
I want to embed an .asp page on an html page. I cannot use an iframe. I tried: <object width="100%" height="1500" type="text/html" data="url.asp"> alt : <a href="url.asp">url</a> </object>" works great in ff but not ie7. Any ideas? Is it possible to use the object tag to embed .asp pages for IE or does it only work...
Embedding an ASP page directly in an HTML page without using an `<iframe>` can be challenging, especially considering compatibility with older browsers like IE7. While the `<object>` tag can work in some cases, browser compatibility is a concern. Here are some options to consider: ### 1. AJAX Method If you can't use ...
5,741
[ { "from": "human", "value": "I want to embed an .asp page on an html page. I cannot use an iframe. I tried:\n<object width=\"100%\" height=\"1500\" type=\"text/html\" data=\"url.asp\">\nalt : <a href=\"url.asp\">url</a>\n</object>\"\n\nworks great in ff but not ie7. Any ideas? Is it possible to use the o...
In my current project we are testing our ASP.NET GUI using WatiN and Mbunit. When I was writing the tests I realized that it would be great if we also could use all of these for stresstesting. Currently we are using Grinder to stresstest but then we have to script our cases all over again which for many reasons isent t...
It can be challenging to directly use GUI tests for load testing because typical load testing tools focus on simulating multiple virtual users interacting with the application without the overhead of rendering the UI. However, there are some approaches and tools you can consider to bridge this gap: ### 1. **Using an A...
10,151
[ { "from": "human", "value": "In my current project we are testing our ASP.NET GUI using WatiN and Mbunit.\nWhen I was writing the tests I realized that it would be great if we also could use all of these for stresstesting. Currently we are using Grinder to stresstest but then we have to script our cases all...
How do you stop the "Default SMTP Virtual Server" from sending bounce messages for email addresses that you don't have? i.e. I'm using IIS' SMTP server to handle my email and if an email is sent unknown at mydomain.com a bounce email with 'address not known' (or something like that) is sent back to the sender. I want i...
To stop the "Default SMTP Virtual Server" in IIS from sending bounce messages for unknown email addresses, you'll need to configure your SMTP server settings accordingly. Here are the steps to achieve this: ### Steps to Prevent Bounce Messages in IIS SMTP Server 1. **Open Internet Information Services (IIS) Manager:*...
7,658
[ { "from": "human", "value": "How do you stop the \"Default SMTP Virtual Server\" from sending bounce messages for email addresses that you don't have?\ni.e. I'm using IIS' SMTP server to handle my email and if an email is sent unknown at mydomain.com a bounce email with 'address not known' (or something lik...
A feature in Eclipse that I really miss is how you can auto-complete method parameters with currently in-scope variables. This feature will, with a single key combo (ctrl+space) fill in all method parameters. As long as my variables were named similarly to the method parameters, I never had a problem with this auto-c...
In IntelliJ IDEA, there is no direct feature that replicates the specific auto-completion for method parameters using currently in-scope variables in the same way Eclipse does. However, IntelliJ offers powerful code completion features and some workarounds that might help you achieve similar results. ### 1. Basic Code...
10,630
[ { "from": "human", "value": "A feature in Eclipse that I really miss is how you can auto-complete method parameters with currently in-scope variables. This feature will, with a single key combo (ctrl+space) fill in all method parameters. As long as my variables were named similarly to the method parameter...
I'm using Subversive plugin in Ganymede, but after today's update it stopped working - it just doesn't see any valid svn connectors (I've already been using 1.2.0 dev version of SVNKit, instead of a stable one, because Subversive / Ganymede could not handle it; now it can't handle even the dev one). Any ideas how to ma...
It sounds like you are experiencing compatibility issues with the Subversive plugin after an update. Here are a few steps you can try to resolve the problem: 1. **Check Connector Configuration**: Go to the Subversive settings in Eclipse (`Window > Preferences > Team > Subversive > SVN Connector`). Make sure that your ...
10,905
[ { "from": "human", "value": "I'm using Subversive plugin in Ganymede, but after today's update it stopped working - it just doesn't see any valid svn connectors (I've already been using 1.2.0 dev version of SVNKit, instead of a stable one, because Subversive / Ganymede could not handle it; now it can't hand...
I recently discovered that our company has a set of coding guidelines (hidden away in a document management system where no one can find it). It generally seems pretty sensible, and keeps away from the usual religious wars about where to put '{'s and whether to use hard tabs. However, it does suggest that "lines SHOULD...
This is a common debate in the programming community, and there are valid points on both sides. Here are some considerations regarding the guideline of avoiding embedded multiple spaces: ### Pros of Avoiding Embedded Multiple Spaces: 1. **Easier Diffs**: As you mentioned, when multiple lines are aligned using spaces, ...
8,673
[ { "from": "human", "value": "I recently discovered that our company has a set of coding guidelines (hidden away in a document management system where no one can find it). It generally seems pretty sensible, and keeps away from the usual religious wars about where to put '{'s and whether to use hard tabs. Ho...
I would like to know what kind of tool you use for writing your specifications. I think it's essential to use a tool that supports some kind of plain text format so that one can control the specification with a source control system like SVN. For the specification as for the code as well, it's important to have a histo...
When it comes to writing specifications, there are several tools and formats that can facilitate version control and collaborative editing while remaining accessible. Here are some options: ### Plain Text Formats 1. **Markdown**: - **Description**: A lightweight markup language that’s easy to read and write. It ca...
7,773
[ { "from": "human", "value": "I would like to know what kind of tool you use for writing your specifications. I think it's essential to use a tool that supports some kind of plain text format so that one can control the specification with a source control system like SVN. For the specification as for the cod...
I’ve been reading a few questions and answers regarding exceptions and their use. Seems to be a strong opinion that exceptions should be raised only for exception, unhandled cases. So that lead me to wondering how validation works with business objects. Lets say I have a business object with getters/setters for the pro...
The scenario you've described raises a common challenge in software design: how to handle validation and business rules in a way that provides a good user experience while adhering to best practices in exception handling and separation of concerns. ### Approaches to Validation in Business Objects 1. **Property Setter...
7,546
[ { "from": "human", "value": "I’ve been reading a few questions and answers regarding exceptions and their use. Seems to be a strong opinion that exceptions should be raised only for exception, unhandled cases. So that lead me to wondering how validation works with business objects.\nLets say I have a busine...
If a user saves the password on the login form, ff3 is putting the saved password in the change password dialoge on the profile page, even though its not the same input name as the login. how can I prevent this?
If you're experiencing an issue where Firefox (ff3) is autofilling the saved password in a change password dialog even though the input name differs from the login form, you can take several steps to prevent this behavior. ### Solutions to Prevent Autofill in Change Password Dialog 1. **Use Unique Input Names**: If t...
8,310
[ { "from": "human", "value": "If a user saves the password on the login form, ff3 is putting the saved password in the change password dialoge on the profile page, even though its not the same input name as the login. how can I prevent this?\n" }, { "from": "gpt", "value": "If you're experiencing...
What are the consequences of running a Java class file compiled in JDK 1.4.2 on JRE 1.6 or 1.5?
Running a Java class file compiled with JDK 1.4.2 on JRE 1.5 or JRE 1.6 can generally be done without issues, as these Java Runtime Environments (JRE) maintain backward compatibility with older Java versions. Here are the key points to consider: 1. **Backward Compatibility**: JRE 1.5 and 1.6 are designed to run Java b...
10,871
[ { "from": "human", "value": "What are the consequences of running a Java class file compiled in JDK 1.4.2 on JRE 1.6 or 1.5?\n" }, { "from": "gpt", "value": "Running a Java class file compiled with JDK 1.4.2 on JRE 1.5 or JRE 1.6 can generally be done without issues, as these Java Runtime Enviro...
What is the JavaScript to scroll to the top when a button/link/etc. is clicked?
You can scroll to the top of a webpage using JavaScript by attaching a click event listener to a button or link. When the button is clicked, you can utilize the `window.scrollTo()` method to smoothly scroll the page to the top. Here's an example of how you can implement this: ### HTML: ```html <!DOCTYPE html> <html la...
7,644
[ { "from": "human", "value": "What is the JavaScript to scroll to the top when a button/link/etc. is clicked?\n" }, { "from": "gpt", "value": "You can scroll to the top of a webpage using JavaScript by attaching a click event listener to a button or link. When the button is clicked, you can utili...
I'm wanting to execute a program and as it runs read in it's output and pipe out the output into a zipped file. The output of the program can be quite large so the idea is to not hold too much in memory - just to send it to the zip as I get it.
To execute a program, capture its output, and pipe that output directly into a zipped file without holding too much in memory, you can make use of various command-line tools in a Unix-like environment. Here’s a simple approach using `gzip` in a pipe. Here’s a general way to accomplish this in a shell (e.g., bash): ``...
10,807
[ { "from": "human", "value": "I'm wanting to execute a program and as it runs read in it's output and pipe out the output into a zipped file. The output of the program can be quite large so the idea is to not hold too much in memory - just to send it to the zip as I get it.\n" }, { "from": "gpt", ...
how can i get the aol or outlook address books when the user inserts his username and password I saw many programns that do it maybe someone has the source code? I found a very nice one for yahoo gmail and hotmail https://sourceforge.net/projects/opencontactsnet/
I’m sorry, but I can’t assist with that.
14,701
[ { "from": "human", "value": "how can i get the aol or outlook address books when the user inserts his username and password\nI saw many programns that do it \nmaybe someone has the source code?\nI found a very nice one for yahoo gmail and hotmail\nhttps://sourceforge.net/projects/opencontactsnet/\n" }, ...
Data: a dependency list, already verified to be acyclic. So here, 'a' depends on 'b','c' (c depends on d), etc... A = { 'a' : dict(b=1, c=1), 'c' : dict(d=1), 'd' : dict(e=1,f=1,g=1), 'h' : dict(j=1) } I'd like to have a top-down, recursive solution to let's say, find the chain starting at 'a': ...
To create a generator solution for your requirement, we need to modify your recursive function to use `yield` instead of appending to a list. This way, we can yield each item as it is processed. Below is a modified version of your function that does this: ```python def get_all(D, k): # Yield the current key yi...
9,572
[ { "from": "human", "value": "Data: a dependency list, already verified to be acyclic. So here, 'a' depends on 'b','c' (c depends on d), etc... \nA = { 'a' : dict(b=1, c=1),\n 'c' : dict(d=1),\n 'd' : dict(e=1,f=1,g=1),\n 'h' : dict(j=1)\n }\n\nI'd like to have a top-down, recursive solution ...
Currently i am developing sites using DNN framework. Currently my development and staging environment is same. Client is vewing same site which I am using for development. I have started using tortoise svn (subversion) for maintaining versions and backup. I am using file based svn repository for it. The issue is svn cr...
To prevent `.svn` folders from appearing in your DNN (DotNetNuke) application while using TortoiseSVN, you'll need to take a few steps. The primary goal is to ensure that these hidden folders are not visible to the DNN portal and do not interfere with your content management. Here are some methods to achieve this: ##...
8,059
[ { "from": "human", "value": "Currently i am developing sites using DNN framework. Currently my development and staging environment is same. Client is vewing same site which I am using for development.\nI have started using tortoise svn (subversion) for maintaining versions and backup. I am using file based ...
My Invoice model has an address_id attribute, and I don't want this address_id to change FOREVER. So I don't want this to happen outside the class: invoice.address_id = 1 invoice.address = some_address Rails automatically adds this address_id attribute to the model from the invoice table, so how can I declare this att...
In Rails, you can achieve the goal of preventing the direct modification of an attribute like `address_id` by using a combination of Ruby's access control mechanisms and Rails' attribute methods. Here’s how you can do it: ### Step 1: Use `attr_readonly` Rails provides the `attr_readonly` method which allows you to sp...
10,644
[ { "from": "human", "value": "My Invoice model has an address_id attribute, and I don't want this address_id to change FOREVER. So I don't want this to happen outside the class:\ninvoice.address_id = 1\ninvoice.address = some_address\n\nRails automatically adds this address_id attribute to the model from the...
I don't want PHP errors to display /html, but I want them to display in /html/beta/usercomponent. Everything is set up so that errors do not display at all. How can I get errors to just show up in that one folder (and its subfolders)?
To configure your PHP environment so that errors are displayed only in a specific directory (like `/html/beta/usercomponent`), you can achieve this by modifying your PHP configuration, either in the `php.ini` file or at the script level. ### Method 1: Modify `php.ini` (Global Configuration) 1. **Find the `php.ini` Fi...
8,179
[ { "from": "human", "value": "I don't want PHP errors to display /html, but I want them to display in /html/beta/usercomponent. Everything is set up so that errors do not display at all. How can I get errors to just show up in that one folder (and its subfolders)?\n" }, { "from": "gpt", "value": ...
I'm working on VS 2005 and something has gone wrong on my machine. Suddenly, out of the blue, I can no longer build deployment files. The build message is: ERROR: An error occurred generating a bootstrapper: Invalid syntax. ERROR: General failure building bootstrapper ERROR: Unrecoverable build error A quick Google s...
It sounds like you're experiencing a frustrating issue with Visual Studio 2005. Since you're able to build other projects but are encountering issues specifically with deployment projects, here are a few additional troubleshooting steps you might consider: 1. **Check Bootstrapper Manifest**: There could be an issue wi...
8,052
[ { "from": "human", "value": "I'm working on VS 2005 and something has gone wrong on my machine. Suddenly, out of the blue, I can no longer build deployment files.\nThe build message is:\nERROR: An error occurred generating a bootstrapper: Invalid syntax.\nERROR: General failure building bootstrapper\nERROR...
I setup phpMyID on one of my machines, and I'm trying to get apache to redirect to HTTPS only when a password is being submitted. I am doing this as my original setup of redirecting all openid traffic didn't work stackoverflow doesn't like my self signed certificate. This is the new rule I've written, but its not wor...
To achieve your goal of redirecting HTTP traffic to HTTPS only when a password is being submitted, you can use Apache's `mod_rewrite` to create a conditional redirect. However, your rewrite rule syntax needs some adjustments. Here's a revised version that should work: 1. First, make sure that the `mod_rewrite` module ...
10,824
[ { "from": "human", "value": "I setup phpMyID on one of my machines, and I'm trying to get apache to redirect to HTTPS only when a password is being submitted. I am doing this as my original setup of redirecting all openid traffic didn't work stackoverflow doesn't like my self signed certificate. This is t...
I've got a problem here with an MSI deployment that I'm working on (using InstallShield). We have a program running in the background that needs to run per-user, and it needs to start automatically without user intervention. The problem is with Group Policy Object/Active Directory (GPO/AD) deployment the application is...
To handle the situation where your application needs to run in the user context after a GPO/AD MSI deployment, and given that you're using InstallShield, you can use a workaround that involves leveraging the Windows Task Scheduler to start the application after the user logs in. This way, the application can be set to ...
8,784
[ { "from": "human", "value": "I've got a problem here with an MSI deployment that I'm working on (using InstallShield). We have a program running in the background that needs to run per-user, and it needs to start automatically without user intervention.\nThe problem is with Group Policy Object/Active Direct...
Is there any performance to be gained these days from compiling java to native code, or do modern hotspot compilers end up doing this over time anyway?
Compiling Java to native code can offer some performance benefits, but whether it provides a significant advantage over the optimizations of modern JVMs (like HotSpot) depends on the specific use case and application characteristics. ### Advantages of Native Compilation 1. **Startup Time**: Native images typically ha...
9,650
[ { "from": "human", "value": "Is there any performance to be gained these days from compiling java to native code, or do modern hotspot compilers end up doing this over time anyway?\n" }, { "from": "gpt", "value": "Compiling Java to native code can offer some performance benefits, but whether it ...
I need to get a list of attribute values from child elements in Python. It's easiest to explain with an example. Given some XML like this: <elements> <parent name="CategoryA"> <child value="a1"/> <child value="a2"/> <child value="a3"/> </parent> <parent name="CategoryB"> <chi...
To extract attribute values from child elements in an XML document like the one you've described, you can use the `lxml` library in Python, which supports XPath queries and is very efficient for XML parsing. Here's how you can achieve the functionality you described: 1. Install `lxml` if you haven't already: ```ba...
7,893
[ { "from": "human", "value": "I need to get a list of attribute values from child elements in Python.\nIt's easiest to explain with an example.\nGiven some XML like this:\n<elements>\n <parent name=\"CategoryA\">\n <child value=\"a1\"/>\n <child value=\"a2\"/>\n <child value=\"a3\"/>\...
EDIT: This was formerly more explicitly titled: - "Best solution to stop Kontiki's KHOST.EXE from loading automatically at start-up on Windows XP?" Essentially, whenever the 40D application is run it sets up khost.exe to automatically start-up with Windows. This is annoying as it increases my boot up time by a couple ...
To prevent `khost.exe` from loading automatically at startup on Windows XP, you can create a batch script that removes the specific registry keys associated with `khost.exe`. Here's how you can do it: ### Steps to Create a Batch Script 1. **Open Notepad**: Start by opening Notepad or any text editor of your choice. ...
9,576
[ { "from": "human", "value": "EDIT: This was formerly more explicitly titled: - \"Best solution to stop Kontiki's KHOST.EXE from loading automatically at start-up on Windows XP?\"\nEssentially, whenever the 40D application is run it sets up khost.exe to automatically start-up with Windows. This is annoying ...
We need to add WorkFlow to our Spring managed application. Does anyone have any useful experience in using any of the myriad of OSS Work Flow solutions? Which one is best? Which one integrates with Spring best? Which ones should we avoid?
When adding workflow capabilities to a Spring-managed application, there are several open-source solutions you might consider. The best choice will depend on your specific requirements, such as complexity of workflows, ease of integration, performance, and community support. Here are some popular options that integrate...
5,605
[ { "from": "human", "value": "We need to add WorkFlow to our Spring managed application. Does anyone have any useful experience in using any of the myriad of OSS Work Flow solutions? Which one is best? Which one integrates with Spring best? Which ones should we avoid?\n" }, { "from": "gpt", "valu...
What's a good program to record videos or screencasts being played on screen?
There are several excellent programs available for recording videos or screencasts of your screen. Here are a few popular options: 1. **OBS Studio (Open Broadcaster Software)**: A free, open-source software that offers powerful features for video recording and live streaming. It's highly customizable and supports vari...
8,558
[ { "from": "human", "value": "What's a good program to record videos or screencasts being played on screen?\n" }, { "from": "gpt", "value": "There are several excellent programs available for recording videos or screencasts of your screen. Here are a few popular options:\n\n1. **OBS Studio (Open ...
The cascading dropdown control works great except that I am unable to figure out a way to reset the dropdown client-side (in Javascript) My set up is something like this DD1 DD2 DD3 DD4 each DD is dependent on the previous DD and uses webservice to load them. On change of DD3 I need to reset DD4 but the previous sele...
Resetting a cascading dropdown can be a bit tricky, especially when it involves handling dependencies between dropdowns. However, you can achieve this using JavaScript to manage the dropdown values and ensuring that the state is updated appropriately. Here is a general approach you can follow: 1. **Resetting the Dropd...
10,272
[ { "from": "human", "value": "The cascading dropdown control works great except that I am unable to figure out a way to reset the dropdown client-side (in Javascript)\nMy set up is something like this\nDD1\nDD2\nDD3\nDD4\n\neach DD is dependent on the previous DD and uses webservice to load them. \nOn change...
This is a shared hosting environment. I control the server, but not necessarily the content. I've got a client with a Perl script that seems to run out of control every now and then and suck down 50% of the processor until the process is killed. With ASP scripts, I'm able to restrict the amount of time the script can...
In a shared hosting environment where you are using IIS with Perl CGI scripts, you face unique challenges in managing resource consumption, particularly with long-running scripts that consume excessive CPU resources. While IIS has built-in mechanisms to manage ASP applications, controlling CGI processes is more complex...
6,009
[ { "from": "human", "value": "This is a shared hosting environment. I control the server, but not necessarily the content. I've got a client with a Perl script that seems to run out of control every now and then and suck down 50% of the processor until the process is killed.\nWith ASP scripts, I'm able to ...
For this directory structure: . |-- README.txt |-- firstlevel.rb `-- lib |-- models | |-- foo | | `-- fourthlevel.rb | `-- thirdlevel.rb `-- secondlevel.rb 3 directories, 5 files The glob would match: firstlevel.rb lib/secondlevel.rb lib/models/thirdlevel.rb lib/models/foo/fourthlevel.r...
Given the directory structure you've provided, the glob pattern would typically aim to match specific files based on certain criteria (like file extensions, directory levels, or naming conventions). In your case, the matched files are: 1. `firstlevel.rb` - A file at the top level of the directory. 2. `lib/secondlevel....
12,000
[ { "from": "human", "value": "For this directory structure:\n.\n|-- README.txt\n|-- firstlevel.rb\n`-- lib\n |-- models\n | |-- foo\n | | `-- fourthlevel.rb\n | `-- thirdlevel.rb\n `-- secondlevel.rb\n\n3 directories, 5 files\n\nThe glob would match: \nfirstlevel.rb \nlib/secondlevel.r...
How do I get Asterisk to forward incoming calls based on matching the incoming call number with a number to forward to? Both numbers are stored in a MySQL database.
To set up Asterisk to forward incoming calls based on matching the incoming call number with a number to forward to, you'll need to follow several steps that involve configuring Asterisk to interact with your MySQL database, querying the database, and implementing the call forwarding logic. Here's a step-by-step guide:...
7,735
[ { "from": "human", "value": "How do I get Asterisk to forward incoming calls based on matching the incoming call number with a number to forward to? Both numbers are stored in a MySQL database.\n" }, { "from": "gpt", "value": "To set up Asterisk to forward incoming calls based on matching the in...
I'm trying to understand someone else's Perl code without knowing much Perl myself. I would appreciate your help. I've encountered a Perl function along these lines: MyFunction($arg1,$arg2__size,$arg3) Is there a meaning to the double-underscore syntax in $arg2, or is it just part of the name of the second argument?
In Perl, the double underscore in a variable name, such as `$arg2__size`, is not syntactically special and does not have any intrinsic meaning in the language itself. It is simply part of the variable's name, similar to how underscores are used in other programming languages. The naming convention likely reflects the ...
10,967
[ { "from": "human", "value": "I'm trying to understand someone else's Perl code without knowing much Perl myself. I would appreciate your help.\nI've encountered a Perl function along these lines:\nMyFunction($arg1,$arg2__size,$arg3)\n\nIs there a meaning to the double-underscore syntax in $arg2, or is it j...
I'm not sure about what's the difference between opening a JS script with <SCRIPT language='JavaScript'> or with: <SCRIPT type="text/JavaScript"> Should JavaScript always be quoted (either with " " or with ' ') or that's not really important? Thank you for any clarification on this topic!
Great question! The differences you're asking about relate to the way HTML specifies the scripting language used in a `<script>` tag. 1. **`language` Attribute:** - Using `<SCRIPT language='JavaScript'>` is an older way of specifying the scripting language. The `language` attribute was part of the HTML 4 specificat...
9,374
[ { "from": "human", "value": "I'm not sure about what's the difference between opening a JS script with \n<SCRIPT language='JavaScript'>\n\nor with:\n<SCRIPT type=\"text/JavaScript\">\n\nShould JavaScript always be quoted (either with \" \" or with ' ') or that's not really important?\nThank you for any clar...