instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
I am trying to sort a dict based on its key and return an iterator to the values from within an overridden iter method in a class. Is there a nicer and more efficient way of doing this than creating a new list, inserting into the list as I sort through the keys?
You can achieve the desired behavior without creating a new list by using Python's `sorted` function in combination with a generator expression. This allows you to create an iterator that yields values from the dictionary sorted by its keys, all while maintaining efficiency. Here's a simple implementation of a class t...
10,056
[ { "from": "human", "value": "I am trying to sort a dict based on its key and return an iterator to the values from within an overridden iter method in a class. Is there a nicer and more efficient way of doing this than creating a new list, inserting into the list as I sort through the keys?\n" }, { ...
Is it possible to automount a TrueCrypt volume when logging in to Ubuntu 8.04? It's already storing the wireless network keys using the Seahorse password manager. Could TrueCrypt be made to fetch its volume password from the same keyring? Currently this would seem like the most convenient way to store my source code on...
Automounting a TrueCrypt volume on login in Ubuntu 8.04 can be a bit complex, especially considering that TrueCrypt is not integrated into the system like some other disk encryption tools. However, you can achieve this with a combination of scripts and the GNOME Keyring. Here's a step-by-step guide on how you could se...
8,099
[ { "from": "human", "value": "Is it possible to automount a TrueCrypt volume when logging in to Ubuntu 8.04? It's already storing the wireless network keys using the Seahorse password manager. Could TrueCrypt be made to fetch its volume password from the same keyring? Currently this would seem like the most ...
I'm giving a presentation to a Java User's Group on Groovy and I'm going to be doing some coding during the presentation to show some side-by-side Java/Groovy. I really like the GroovyConsole as it's simple and I can resize the text easily. I'm wondering if there is anything similar for Java? I know I could just us...
If you're looking for a lightweight and simple alternative to GroovyConsole for Java coding during your presentation, here are a few options you might consider: 1. **JShell**: - Java 9 introduced JShell, a REPL (Read-Eval-Print Loop) tool that allows you to run Java code snippets interactively. It's great for expe...
11,617
[ { "from": "human", "value": "I'm giving a presentation to a Java User's Group on Groovy and I'm going to be doing some coding during the presentation to show some side-by-side Java/Groovy. I really like the GroovyConsole as it's simple and I can resize the text easily. \nI'm wondering if there is anything...
I'm working on a setup which wants to include the Microsoft.Web.Services3 (WSE 3.0) DLL. However, I typically do not like including Microsoft DLL's in our installs except by way of Microsoft's redistributables. There is both a developer and a redist install package available from Microsoft. So, as a best practice, shou...
When it comes to including Microsoft DLLs in your installations, best practices generally recommend using the official redistributable packages whenever possible. Here are some considerations to help you decide: 1. **Licensing and Support**: Including the DLL directly can create potential issues with licensing or supp...
7,269
[ { "from": "human", "value": "I'm working on a setup which wants to include the Microsoft.Web.Services3 (WSE 3.0) DLL. However, I typically do not like including Microsoft DLL's in our installs except by way of Microsoft's redistributables. There is both a developer and a redist install package available fro...
I want to write a small utility to call arbitrary functions from a C shared library. User should be able to list all the exported functions similar to what objdump or nm does. I checked these utilities' source but they are intimidating. Couldn't find enough information on google, if dl library has this functionality ei...
To create a small utility to call arbitrary functions from a C shared library (a `.so` file) and list the exported functions, you can use the `libdl` library in Linux, along with some other techniques for listing the symbols in a shared library. Here's a step-by-step guide to implementing this: ### Step 1: Listing Ex...
6,731
[ { "from": "human", "value": "I want to write a small utility to call arbitrary functions from a C shared library. User should be able to list all the exported functions similar to what objdump or nm does. I checked these utilities' source but they are intimidating. Couldn't find enough information on google...
I use the Boost Test framework for my C++ code but there are two problems with it that are probably common to all C++ test frameworks: There is no way to create automatic test stubs (by extracting public functions from selected classes for example). You cannot run a single test - you have to run the entire 'suite' of ...
You're correct that many C++ test frameworks, including Boost.Test, can sometimes lack features that developers enjoy in Java or .NET environments, particularly around automatic test stub creation and selective test execution. However, there are other C++ testing frameworks and tools that may address some of your conce...
6,405
[ { "from": "human", "value": "I use the Boost Test framework for my C++ code but there are two problems with it that are probably common to all C++ test frameworks:\n\nThere is no way to create automatic test stubs (by extracting public functions from selected classes for example).\nYou cannot run a single t...
I'm considering using Flash but I'm pretty addicted to autocomplete and Step-at-a-time debugging.
If you're considering using Flash (presumably referring to Adobe Flash or ActionScript) but are concerned about the lack of modern features like autocomplete and step-by-step debugging, there are a few points to consider: 1. **Development Environment**: Ensure that you are using a robust IDE that supports ActionScript...
9,435
[ { "from": "human", "value": "I'm considering using Flash but I'm pretty addicted to autocomplete and Step-at-a-time debugging.\n" }, { "from": "gpt", "value": "If you're considering using Flash (presumably referring to Adobe Flash or ActionScript) but are concerned about the lack of modern featu...
At work we have an application to play 2K (2048*1556px) OpenEXR film sequences. It works well.. apart from when sequences that are over 3GB (quite common), then it has to unload old frames from memory, despite the fact all machines have 8-16GB of memory (which is addressable via the linux BIGMEM stuff). The frames have...
Caching more than 3GB of data in memory on a 32-bit system can be quite challenging due to the per-process memory limit. However, there are strategies you can consider to work around this limitation. Here are some possible approaches: ### 1. **Multiple Processes**: You can indeed spread your memory usage across multip...
7,293
[ { "from": "human", "value": "At work we have an application to play 2K (2048*1556px) OpenEXR film sequences. It works well.. apart from when sequences that are over 3GB (quite common), then it has to unload old frames from memory, despite the fact all machines have 8-16GB of memory (which is addressable via...
There's something very unsatisfactory about this code: /* Given a command string in which the first 8 characters are the command name padded on the right with whitespace, construct the appropriate kind of Command object. */ public class CommandFactory { public Command getCommand(String cmd) { cmdName = c...
You're on the right track considering how to improve the structure of your `CommandFactory` while avoiding the repetitiveness of multiple `if` statements. Here’s a step-by-step approach to refactor your code for better maintainability and clarity, without necessarily relying on reflection. ### Step 1: Use a Command In...
8,709
[ { "from": "human", "value": "There's something very unsatisfactory about this code:\n/*\nGiven a command string in which the first 8 characters are the command name\npadded on the right with whitespace, construct the appropriate kind of \nCommand object.\n*/\npublic class CommandFactory {\n public Comma...
How would you create a database in Microsoft Access that is searchable only by certain fields and controlled by only a few (necessary) text boxes and check boxes on a form so it is easy to use - no difficult queries? Example: You have several text boxes and several corresponding check boxes on a form, and when the che...
Creating a user-friendly database in Microsoft Access that allows searching by specific fields via a form with checkboxes and text boxes involves several steps. Here's a guide on how to set this up: ### Step 1: Create the Table 1. **Open Microsoft Access** and create a new database. 2. **Create a table** by going to ...
6,849
[ { "from": "human", "value": "How would you create a database in Microsoft Access that is searchable only by certain fields and controlled by only a few (necessary) text boxes and check boxes on a form so it is easy to use - no difficult queries?\nExample: \nYou have several text boxes and several correspond...
I have several nested X Windows - let's say - a scrollable window within a scrollable window (see the example below). In such case the main window contains (at least) the major scroll bars and the (major) drawing area they control. This drawing area on its turn contains (at least) a scrollable window batch - a (minor) ...
In your scenario, handling nested scrollable areas with proper redrawing and clipping is indeed a common challenge in GUI programming, especially when using a system like X Windows. You want to ensure that when you scroll the inner window, the correct content is displayed without leaving artifacts or having empty areas...
6,414
[ { "from": "human", "value": "I have several nested X Windows - let's say - a scrollable window within a scrollable window (see the example below). In such case the main window contains (at least) the major scroll bars and the (major) drawing area they control. This drawing area on its turn contains (at leas...
I have a web application that is able to open an excel template, push data into a worksheet and send the file to a user. When the file is opened a VBA Macro will refresh a pivot table based on the data that was pushed into the template. The user receives the standard File Open / Save dialog. In Internet Explorer (ver...
The issue you are encountering with Internet Explorer 6 arises from the way that the browser handles temporary files when a user chooses the 'Open' option from the file download dialog. When a file is downloaded and opened directly, it may not retain the correct file path required for the VBA Macro to refresh the pivot...
3,716
[ { "from": "human", "value": "I have a web application that is able to open an excel template, push data into a worksheet and send the file to a user. When the file is opened a VBA Macro will refresh a pivot table based on the data that was pushed into the template.\nThe user receives the standard File Open...
Is it possible to get notifications using SQL Server Reporting Services? Say for example I have a report that I want by mail if has for example suddenly shows more than 10 rows or if a specific value drop below 100 000. Do I need to tie Notification Services into it and how do I do that? Please provide as much technica...
In SQL Server Reporting Services (SSRS), there is functionality that allows you to receive notifications based on conditions within your reports. However, SQL Server Notification Services, which was a separate component provided by Microsoft to generate and deliver notifications based on event data, has been deprecated...
7,664
[ { "from": "human", "value": "Is it possible to get notifications using SQL Server Reporting Services? Say for example I have a report that I want by mail if has for example suddenly shows more than 10 rows or if a specific value drop below 100 000. Do I need to tie Notification Services into it and how do I...
I'm trying to convert old QuickTime framework code to the 64-bit Cocoa-based QTKit on OS X, which means that I can't drop down to the straight C function calls at any time. Specifically, I'm trying to find a way to write QuickTime VR movies with QTKit, as they require some special metadata to set the display controlle...
In QTKit, creating QuickTime VR movies directly isn't fully supported as the QTKit API is focused more on the higher-level multimedia handling features. However, there are ways to handle QuickTime VR metadata, albeit with some limitations. To write QuickTime VR movies in a Cocoa-based application using QTKit, you can ...
7,017
[ { "from": "human", "value": "I'm trying to convert old QuickTime framework code to the 64-bit Cocoa-based QTKit on OS X, which means that I can't drop down to the straight C function calls at any time. Specifically, I'm trying to find a way to write QuickTime VR movies with QTKit, as they require some spec...
The documentation with the module itself is pretty thin, and just tends to point to MOP.
It sounds like you're dealing with a module that has limited documentation and relies heavily on the Meta Object Protocol (MOP). This can be quite common in programming languages and frameworks where advanced features are built on top of a more abstract layer, such as MOP in Common Lisp or similar paradigms in other la...
5,643
[ { "from": "human", "value": "The documentation with the module itself is pretty thin, and just tends to point to MOP.\n" }, { "from": "gpt", "value": "It sounds like you're dealing with a module that has limited documentation and relies heavily on the Meta Object Protocol (MOP). This can be quit...
What update rate should I run my fixed-rate game logic at? I've used 60 updates per second in the past, but that's hard because it's not an even number of updates per second (16.666666). My current games uses 100, but that seems like overkill for most things.
The choice of update rate for your game logic can depend on several factors, including the type of game you are making, the complexity of your game mechanics, and the capabilities of your target hardware. Here are some considerations that may help you decide: 1. **Common Update Rates**: - **30 updates per second**...
6,846
[ { "from": "human", "value": "What update rate should I run my fixed-rate game logic at?\nI've used 60 updates per second in the past, but that's hard because it's not an even number of updates per second (16.666666). My current games uses 100, but that seems like overkill for most things.\n" }, { "f...
Using Django's built in models, how would one create a triple-join between three models. For example: Users, Roles, and Events are the models. Users have many Roles, and Roles many Users. (ManyToMany) Events have many Users, and Users many Events. (ManyToMany) But for any given Event, any User may have only one Role....
To create a triple-join scenario in Django where you have `Users`, `Roles`, and `Events`, you can use Django's `ManyToManyField` with an intermediary model for the association between `Users`, `Roles`, and `Events`. Here’s how you can structure your models: ### Step 1: Define the Models 1. **User** - This represents ...
8,104
[ { "from": "human", "value": "Using Django's built in models, how would one create a triple-join between three models.\nFor example:\n\nUsers, Roles, and Events are the models.\nUsers have many Roles, and Roles many Users. (ManyToMany)\nEvents have many Users, and Users many Events. (ManyToMany)\nBut for an...
I'm having a problem with an application hanging and giving me the default "Please tell Microsoft about this problem" popup, instead of the "unhandled exception" dialog in the application. In the application code, the Application.ThreadException and AppDomain.CurrentDomain.UnhandledException are both redirected to a me...
It sounds like you've identified a crucial aspect of your application's error handling. Based on what you've described, here's a summary of the issue and further suggestions: ### Key Points of Your Issue: 1. **Unhandled Exception**: Your application was failing with an `ArgumentOutOfRangeException`, but the default Wi...
8,422
[ { "from": "human", "value": "I'm having a problem with an application hanging and giving me the default \"Please tell Microsoft about this problem\" popup, instead of the \"unhandled exception\" dialog in the application.\nIn the application code, the Application.ThreadException and AppDomain.CurrentDomain....
What is currently the best way to get a favicon to display in all browsers that currently support it? Please include: Which image formats are supported by which browsers. Which lines are needed in what places for the various browsers.
Creating a favicon that displays correctly across all modern browsers involves utilizing different image formats and including the appropriate HTML link tags. Here’s a comprehensive guide: ### Supported Image Formats 1. **ICO Format** - **Supported by:** All browsers (Chrome, Firefox, Safari, Edge, Internet Explor...
4,869
[ { "from": "human", "value": "What is currently the best way to get a favicon to display in all browsers that currently support it?\nPlease include:\n\nWhich image formats are supported by which browsers.\nWhich lines are needed in what places for the various browsers.\n\n" }, { "from": "gpt", "v...
What does the explicit keyword mean in C++?
In C++, the `explicit` keyword is used to indicate that a constructor or conversion operator should not be used for implicit conversions. It is primarily applied to constructors that can be called with a single argument, and it prevents the compiler from automatically converting other types to that type when needed in ...
9,571
[ { "from": "human", "value": "What does the explicit keyword mean in C++?\n" }, { "from": "gpt", "value": "In C++, the `explicit` keyword is used to indicate that a constructor or conversion operator should not be used for implicit conversions. It is primarily applied to constructors that can be ...
There is a lot of relativity involved in working with exceptions. Beyond low level APIs where exceptions cover errors raised from hardware and the OS there is a shady area where the programmer decides what constitutes an exception and what is a normal condition. How do you decide when to use exceptions? Do you have a c...
Deciding when to use exceptions in programming involves a combination of factors, including the nature of the error, the context of the application, and coding conventions. Here are some guidelines that can help establish a consistent policy regarding exceptions: ### 1. **Distinction between Errors and Normal Control ...
6,878
[ { "from": "human", "value": "There is a lot of relativity involved in working with exceptions. Beyond low level APIs where exceptions cover errors raised from hardware and the OS there is a shady area where the programmer decides what constitutes an exception and what is a normal condition.\nHow do you deci...
Javascript code can be tough to maintain. I am looking for tools that will help me ensure a reasonable quality level. So far I have found JsUNit, a very nice unit test framework for javascript. Tests can be run automatically from ant on any browser available. I have not found yet some javascript equivalent of PMD, chec...
Yes, there are several static code analysis tools specifically designed for JavaScript that can help you maintain code quality and ensure best practices. Here are some popular ones: 1. **ESLint**: One of the most widely used static analysis tools for JavaScript. It helps identify and report on patterns found in ECMASc...
8,211
[ { "from": "human", "value": "Javascript code can be tough to maintain.\nI am looking for tools that will help me ensure a reasonable quality level.\nSo far I have found JsUNit, a very nice unit test framework for javascript. Tests can be run automatically from ant on any browser available.\nI have not found...
On a website if I have a form where the user can input some text and then a page which displays what the user has entered. I know to html encode the values the user has entered to prevent scripting attacks. If the form was sending emails addresses I presume I would do the same but is there any special cases for emails ...
When dealing with user inputs such as email addresses, it's crucial to ensure that you handle them correctly to prevent any potential security vulnerabilities. Here are some key points to consider regarding HTML encoding and email addresses: 1. **HTML Encoding**: Always HTML encode any user-generated content before di...
9,119
[ { "from": "human", "value": "On a website if I have a form where the user can input some text and then a page which displays what the user has entered. I know to html encode the values the user has entered to prevent scripting attacks. If the form was sending emails addresses I presume I would do the same b...
So the controller context depends on some asp.net internals. What are some ways to cleanly mock these up for unit tests? Seems like its very easy to clog up tests with tons of setup when I only need, for example, Request.HttpMethod to return "GET". I've seen some examples/helpers out on the nets, but some are dated. Fi...
Mocking ASP.NET internals, particularly in the context of unit tests for controllers, can be challenging, especially with the underlying complexities of the framework. However, with tools like Rhino Mocks, you can create clean and maintainable tests without cluttering them with excessive setup. Below are some strategie...
4,552
[ { "from": "human", "value": "So the controller context depends on some asp.net internals. What are some ways to cleanly mock these up for unit tests? Seems like its very easy to clog up tests with tons of setup when I only need, for example, Request.HttpMethod to return \"GET\".\nI've seen some examples/hel...
The unzip command doesn't have an option for recursively unzipping archives. If I have the following directory structure and archives: /Mother/Loving.zip /Scurvy/Sea Dogs.zip /Scurvy/Cures/Limes.zip And I want to unzip all of the archives into directories with the same name as each archive: /Mother/Loving/1.txt /Mot...
To recursively unzip all ZIP archives in the specified directories and create subdirectories for each archive with the same name, you can use a combination of `find`, `mkdir`, and `unzip` commands. The following command line will accomplish this task while handling filenames with spaces correctly: ```bash find /Mother...
8,432
[ { "from": "human", "value": "The unzip command doesn't have an option for recursively unzipping archives.\nIf I have the following directory structure and archives:\n\n/Mother/Loving.zip\n/Scurvy/Sea Dogs.zip\n/Scurvy/Cures/Limes.zip\n\nAnd I want to unzip all of the archives into directories with the same ...
I want to grab the value of a hidden input field in HTML. <input type="hidden" name="fooId" value="12-3456789-1111111111" /> I want to write a regular expression in Python that will return the value of fooId, given that I know the line in the HTML follows the format <input type="hidden" name="fooId" value="**[id is he...
Certainly! You can use the `re` module in Python to write a regular expression that captures the value of the `fooId` hidden input field from the provided HTML. Here's how you can do that: ```python import re # Sample HTML string html = '<input type="hidden" name="fooId" value="12-3456789-1111111111" />' # Regular e...
9,361
[ { "from": "human", "value": "I want to grab the value of a hidden input field in HTML.\n<input type=\"hidden\" name=\"fooId\" value=\"12-3456789-1111111111\" />\n\nI want to write a regular expression in Python that will return the value of fooId, given that I know the line in the HTML follows the format\n<...
How do I detect if the system has a default recording device installed? I bet this can be done through some calls to the Win32 API, anyone has any experience with this? I'm talking about doing this through code, not by opening the control panel and taking a look under sound options.
Yes, you can detect if the system has a default recording device installed by using the Windows Core Audio API, specifically through the `MMDeviceEnumerator` class which is part of the Windows Core Audio APIs. Here is how you can do it in C++: 1. Include the necessary headers. 2. Initialize the COM library. 3. Use `M...
6,570
[ { "from": "human", "value": "How do I detect if the system has a default recording device installed?\nI bet this can be done through some calls to the Win32 API, anyone has any experience with this?\nI'm talking about doing this through code, not by opening the control panel and taking a look under sound op...
This may seem like a programming 101 question and I had thought I knew the answer but now find myself needing to double check. In this piece of code below, will the exception thrown in the first catch block then be caught by the general Exception catch block below? try { // Do something } catch(IOException e) { thr...
In Java, the behavior you're encountering is as follows: when you throw an exception in one `catch` block (like `ApplicationException` in your case), it will not be caught by the subsequent `catch` block that catches a broader exception type (like `Exception`). Here’s the flow of your code: 1. The `try` block is exec...
11,683
[ { "from": "human", "value": "This may seem like a programming 101 question and I had thought I knew the answer but now find myself needing to double check. In this piece of code below, will the exception thrown in the first catch block then be caught by the general Exception catch block below?\ntry {\n // ...
Using C++ (and Qt), I need to process a big amount of 3D coordinates. Specifically, when I receive a 3D coordinate (made of 3 doubles), I need to check in a list if this coordinate has already been processed. If not, then I process it and add it to the list (or container). The amount of coordinates can become very big,...
For efficiently checking and storing 3D coordinates in C++, you can use a `std::unordered_set` or a `std::set`, where the 3D coordinates are represented as a custom struct or a class that implements the necessary operators. Using a set is advantageous because it allows for average O(1) time complexity for lookups (in ...
6,105
[ { "from": "human", "value": "Using C++ (and Qt), I need to process a big amount of 3D coordinates.\nSpecifically, when I receive a 3D coordinate (made of 3 doubles), I need to check in a list if this coordinate has already been processed.\nIf not, then I process it and add it to the list (or container).\nTh...
We are now using NHibernate to connect to different database base on where our software is installed. So I am porting many SQL Procedures to Oracle. SQL Server has a nice function called DateDiff which takes a date part, startdate and enddate. Date parts examples are day, week, month, year, etc. . . What is the Oracl...
In Oracle, there is no direct equivalent to SQL Server's `DATEDIFF` function. However, you can achieve similar functionality using date arithmetic and the `TRUNC` function to extract components of dates. Here are some methods to calculate the difference between two dates in terms of various parts (day, month, year, etc...
7,697
[ { "from": "human", "value": "We are now using NHibernate to connect to different database base on where our software is installed. So I am porting many SQL Procedures to Oracle.\nSQL Server has a nice function called DateDiff which takes a date part, startdate and enddate.\nDate parts examples are day, wee...
This is what I've got. It works. But, is there a simpler or better way? ASPX Page… <asp:Repeater ID="RepeaterBooks" runat="server"> <HeaderTemplate> <table class="report"> <tr> <th>Published</th> <th>Title</th> <th>Author</th> <th...
Your code is functional, but there are a few opportunities to simplify and improve it. Below are some recommendations for streamlining the code and enhancing maintainability. ### Recommendations: 1. **Use a Data Binding Expression**: Instead of setting the text of each `Literal` control in the `ItemDataBound` event, ...
7,476
[ { "from": "human", "value": "This is what I've got. It works. But, is there a simpler or better way?\nASPX Page…\n<asp:Repeater ID=\"RepeaterBooks\" runat=\"server\">\n <HeaderTemplate>\n <table class=\"report\">\n <tr>\n <th>Published</th>\n <th>Title</t...
I've gotten to grips with the basics of Python and I've got a small holiday which I want to use some of to learn a little more Python. The problem is that I have no idea what to learn or where to start. I'm primarily web development but in this case I don't know how much difference it will make.
It's great to hear that you're diving deeper into Python! Given your focus on web development, there are several areas you could explore that will enhance your skills and improve your understanding of both Python and web development. Here’s a roadmap with some suggestions: ### 1. **Web Frameworks** - **Flask**: A m...
7,967
[ { "from": "human", "value": "I've gotten to grips with the basics of Python and I've got a small holiday which I want to use some of to learn a little more Python. The problem is that I have no idea what to learn or where to start. I'm primarily web development but in this case I don't know how much differe...
What are your best usability testing tips? I need quick & cheap.
Sure! Here are some quick and cost-effective usability testing tips: 1. **Define Clear Objectives**: Know what you want to learn from the test. Focus on specific tasks or features. 2. **Use Real Users**: Recruit users who represent your target audience. This can be done through social media or local community boards....
10,983
[ { "from": "human", "value": "What are your best usability testing tips? \nI need quick & cheap. \n" }, { "from": "gpt", "value": "Sure! Here are some quick and cost-effective usability testing tips:\n\n1. **Define Clear Objectives**: Know what you want to learn from the test. Focus on specific t...
I am looking into game programming in Java to see if it is feasible. When googling for it I find several old references to Java2D, Project Darkstar (Sun's MMO-server) and some books on Java game programming. But alot of the information seems to be several years old. So the question I am asking, is anyone creating any g...
Yes, game development in Java is still feasible and there are many developers creating games using Java SE 1.5 and above. Although Java may not be the first language that comes to mind for game development (with languages like C# and C++ being more common for AAA games), it still has a robust ecosystem for indie and ed...
6,749
[ { "from": "human", "value": "I am looking into game programming in Java to see if it is feasible. When googling for it I find several old references to Java2D, Project Darkstar (Sun's MMO-server) and some books on Java game programming. But alot of the information seems to be several years old.\nSo the ques...
I want to highlight C/C++/Java/C# etc source codes in my website. How can I do this? Is it a CPU intensive job to highlight the source code?
Highlighting source code on a website can be done effectively using various libraries and tools designed for syntax highlighting. Here are some common approaches and tools you can use to achieve this: ### 1. Use a JavaScript Library There are several popular JavaScript libraries that can highlight code syntax on your...
7,263
[ { "from": "human", "value": "I want to highlight C/C++/Java/C# etc source codes in my website.\nHow can I do this?\nIs it a CPU intensive job to highlight the source code?\n" }, { "from": "gpt", "value": "Highlighting source code on a website can be done effectively using various libraries and t...
How to get an instance's member's values? With propertyInfos there is a propertyInfo.GetValue(instance, index), but no such thing exists in memberInfo. I searched the net, but it seems to stop at getting the member's name and type.
To get an instance's member values in C#, you need to differentiate between different types of members—fields, properties, methods, etc.—because each member type is accessed differently. You're right that `PropertyInfo` has the `GetValue` method for properties, but `MemberInfo` does not directly provide a way to get th...
8,857
[ { "from": "human", "value": "How to get an instance's member's values?\nWith propertyInfos there is a propertyInfo.GetValue(instance, index), but no such thing exists in memberInfo.\nI searched the net, but it seems to stop at getting the member's name and type.\n" }, { "from": "gpt", "value": "...
It can be either at compile time or at run-time using a config file. Is there a more elegant way than simple (and many) if statements? I am targeting especially sets of UI controls that comes for a particular feature.
Certainly! Using multiple `if` statements can lead to code that is hard to read and maintain. There are several more elegant approaches to handling dynamic UI control configurations based on features. Here are some suggestions: ### 1. **Strategy Pattern** The Strategy Pattern allows you to define a family of algorithm...
6,838
[ { "from": "human", "value": "It can be either at compile time or at run-time using a config file. Is there a more elegant way than simple (and many) if statements?\nI am targeting especially sets of UI controls that comes for a particular feature.\n" }, { "from": "gpt", "value": "Certainly! Usi...
I wonder why would a C++, C#, Java developer want to learn a dynamic language? Assuming the company won't switch its main development language from C++/C#/Java to a dynamic one what use is there for a dynamic language? What helper tasks can be done by the dynamic languages faster or better after only a few days of lear...
Learning a dynamic programming language can provide several tangible benefits, both for the individual developer and for the organization. Here are some justifiable reasons for employers to finance this learning, especially when the company primarily uses statically typed languages like C++, C#, or Java: 1. **Rapid Pr...
4,059
[ { "from": "human", "value": "I wonder why would a C++, C#, Java developer want to learn a dynamic language?\nAssuming the company won't switch its main development language from C++/C#/Java to a dynamic one what use is there for a dynamic language?\nWhat helper tasks can be done by the dynamic languages fas...
I have one applicationContext.xml file, and it has two org.springframework.orm.jpa.JpaTransactionManager (each with its own persistence unit, different databases) configured in a Spring middleware custom application. I want to use annotation based transactions (@Transactional), to not mess around with TransactionStatus...
Using multiple `JpaTransactionManager` instances in a Spring application is certainly possible, but it can introduce complexities when using annotations like `@Transactional`. Here’s how you can manage this situation effectively: ### Configuration of Multiple Transaction Managers In your `applicationContext.xml`, you...
7,274
[ { "from": "human", "value": "I have one applicationContext.xml file, and it has two org.springframework.orm.jpa.JpaTransactionManager (each with its own persistence unit, different databases) configured in a Spring middleware custom application.\nI want to use annotation based transactions (@Transactional),...
How would you reccommend handling RSS Feeds in ASP.NET MVC? Using a third party library? Using the RSS stuff in the BCL? Just making an RSS view that renders the XML? Or something completely different?
Handling RSS feeds in ASP.NET MVC can be approached in several ways, and the best approach largely depends on your specific use case, requirements, and preferences. Here are some common strategies to consider: ### 1. Using the Built-in RSS Support in BCL The Base Class Library (BCL) has built-in support for handling ...
3,042
[ { "from": "human", "value": "How would you reccommend handling RSS Feeds in ASP.NET MVC? Using a third party library? Using the RSS stuff in the BCL? Just making an RSS view that renders the XML? Or something completely different?\n" }, { "from": "gpt", "value": "Handling RSS feeds in ASP.NE...
I'm wondering if there are any good .NET recommendation algorithms available in open source projects, whether attached to a search engine or not. By recommendation I mean something that accepts a full-text article and recommends other articles from its index based on keyword similarity. At the high end there are docum...
There are several open-source projects and libraries in the .NET ecosystem that can help you implement recommendation algorithms based on keyword similarity or other metrics. Here are some options you might find useful: ### 1. **ML.NET** - **Description**: ML.NET is a machine learning framework for .NET that allows yo...
5,877
[ { "from": "human", "value": "I'm wondering if there are any good .NET recommendation algorithms available in open source projects, whether attached to a search engine or not. By recommendation I mean something that accepts a full-text article and recommends other articles from its index based on keyword si...
How would one configure trac to allow anonymous submission of tickets?
To configure Trac to allow anonymous submission of tickets, you'll need to adjust the `trac.ini` configuration file and possibly modify the permissions in your Trac environment. Here’s how to do it: ### Steps to Allow Anonymous Ticket Submission in Trac 1. **Locate the `trac.ini` File:** The `trac.ini` file is typ...
9,584
[ { "from": "human", "value": "How would one configure trac to allow anonymous submission of tickets? \n" }, { "from": "gpt", "value": "To configure Trac to allow anonymous submission of tickets, you'll need to adjust the `trac.ini` configuration file and possibly modify the permissions in your Tr...
When using Linq to SQL and stored procedures, the class generated to describe the proc's result set uses char properties to represent char(1) columns in the SQL proc. I'd rather these be strings - is there any easy way to make this happen?
In LINQ to SQL, when you generate classes from a database that includes stored procedures, the resulting class properties for SQL `char(1)` columns are typically generated as `char` types. If you want these to be represented as `string` types instead, you can use a couple of approaches: ### Option 1: Modify the Genera...
8,236
[ { "from": "human", "value": "When using Linq to SQL and stored procedures, the class generated to describe the proc's result set uses char properties to represent char(1) columns in the SQL proc. I'd rather these be strings - is there any easy way to make this happen?\n" }, { "from": "gpt", "va...
I have the following code: Dim obj As New Access.Application obj.OpenCurrentDatabase (CurrentProject.Path & "\Working.mdb") obj.Run "Routine" obj.CloseCurrentDatabase Set obj = Nothing The problem I'm experimenting is a pop-up that tells me Access can't set the focus on the other database. As you can see from the code...
It sounds like you are experiencing intermittent focus issues when trying to run a routine in another Access database. The specific issue arises when a user interacts with the first database, causing focus issues when the second database tries to show a message box. Here are several approaches you can consider to miti...
8,398
[ { "from": "human", "value": "I have the following code:\nDim obj As New Access.Application\nobj.OpenCurrentDatabase (CurrentProject.Path & \"\\Working.mdb\")\nobj.Run \"Routine\"\nobj.CloseCurrentDatabase\nSet obj = Nothing\n\nThe problem I'm experimenting is a pop-up that tells me Access can't set the focu...
I need to find the frequency of a sample, stored (in vb) as an array of byte. Sample is a sine wave, known frequency, so I can check), but the numbers are a bit odd, and my maths-foo is weak. Full range of values 0-255. 99% of numbers are in range 235 to 245, but there are some outliers down to 0 and 1, and up to 255 ...
Your description is quite clear, and I can help guide you through the steps needed to normalize your sine wave sample to remove outliers and calculate zero-crossings to find the frequency. ### Steps to Normalize Data and Calculate Frequency: 1. **Normalization to Remove Outliers:** - First, determine the range of ...
7,867
[ { "from": "human", "value": "I need to find the frequency of a sample, stored (in vb) as an array of byte. Sample is a sine wave, known frequency, so I can check), but the numbers are a bit odd, and my maths-foo is weak. \nFull range of values 0-255. 99% of numbers are in range 235 to 245, but there are som...
Let's say that you want to create a dead simple BlogEditor and, one of your ideas, is to do what Live Writer does and ask only the URL of the persons Blog. How can you detect what type of blog is it? Basic detection can be done with the URL itself, such as “http://myblog.blogger.com” etc. But what if it's self hosted? ...
Detecting the type of blog from a given URL, especially if it's self-hosted, requires analyzing the content of the website and looking for specific indicators that are associated with popular blogging platforms. Below are steps you can follow to implement this detection mechanism in Java: ### 1. **URL Parsing** Sta...
5,238
[ { "from": "human", "value": "Let's say that you want to create a dead simple BlogEditor and, one of your ideas, is to do what Live Writer does and ask only the URL of the persons Blog. How can you detect what type of blog is it?\nBasic detection can be done with the URL itself, such as “http://myblog.blogge...
That's it. If you want to document a function or a class, you put a string just after the definition. For instance: def foo(): """This function does nothing.""" pass But what about a module? How can I document what a file.py does?
In Python, you can document a module (which is essentially a file containing Python code) using a module docstring. A module docstring is placed at the very top of the file, right after the `#!/usr/bin/env python` shebang line (if present) and before any imports or code. Here's how you can do it: ```python """This mod...
11,053
[ { "from": "human", "value": "That's it. If you want to document a function or a class, you put a string just after the definition. For instance:\ndef foo():\n \"\"\"This function does nothing.\"\"\"\n pass\n\nBut what about a module? How can I document what a file.py does?\n" }, { "from": "gpt...
In SQL Server 2000/2005, Is it possible to force the default value to be written to already existing rows when adding a new column to a table without using NOT NULL on the new column?
In SQL Server 2000 and 2005, when you add a new column to an existing table without specifying `NOT NULL`, you can indeed set a default value for that column. However, this default value will only apply to new rows inserted into the table after the column is added, not to the existing rows. To update the existing row...
8,535
[ { "from": "human", "value": "In SQL Server 2000/2005,\nIs it possible to force the default value to be written to already existing rows when adding a new column to a table without using NOT NULL on the new column?\n" }, { "from": "gpt", "value": "In SQL Server 2000 and 2005, when you add a new c...
In Vista Task Manager, I understand the available page file is listed like this: Page File inUse M / available M In XP it's listed as the Commit Charge Limit. I had thought that: Available Virtual Memory = Physical Memory Total + Sum of Page Files But on my machine I've got Physical Memory = 2038M, Page Files = 40...
Your understanding of the available virtual memory calculation is generally correct, but there are a few nuances that might explain the discrepancy you're observing in Vista Task Manager regarding available memory. 1. **Available Virtual Memory**: The total available virtual memory on a system is indeed generally calc...
9,634
[ { "from": "human", "value": "In Vista Task Manager, I understand the available page file is listed like this:\n Page File inUse M / available M\nIn XP it's listed as the Commit Charge Limit.\nI had thought that:\nAvailable Virtual Memory = Physical Memory Total + Sum of Page Files\nBut on my machine I'v...
I'm working on a page has an ol with nested p's, div's, and li's. Internet Explorer 6 and 7 both render the numbers for the ol tag after the p element at the end (at the very, very bottom of the li tag) rather than at the top of the outermost li as expected. I'm working on a PowerPC Mac and can't do any testing. Is the...
The issue you're experiencing with the `ol` rendering differently in Internet Explorer 6 and 7 compared to modern browsers, like Firefox, is a common problem with these older versions of IE. Specifically, they have problems with the box model and rendering of nested elements within list items. To address this issue, h...
8,373
[ { "from": "human", "value": "I'm working on a page has an ol with nested p's, div's, and li's. Internet Explorer 6 and 7 both render the numbers for the ol tag after the p element at the end (at the very, very bottom of the li tag) rather than at the top of the outermost li as expected. I'm working on a Pow...
I have a page upon which a user can choose up to many different paragraphs. When the link is clicked (or button), an email will open up and put all those paragraphs into the body of the email, address it, and fill in the subject. However, the text can be too long for a mailto link. Any way around this? We were think...
Based on your requirements, it sounds like creating a custom email form would be the best solution. This way, users can review and edit their message before sending it out, while also overcoming the limitations of the `mailto` link. Here’s a high-level overview of how you might implement this solution: ### Steps to Cr...
4,209
[ { "from": "human", "value": "I have a page upon which a user can choose up to many different paragraphs. When the link is clicked (or button), an email will open up and put all those paragraphs into the body of the email, address it, and fill in the subject. However, the text can be too long for a mailto ...
Does anybody have links to site or pre built report running on the SQL Analysis Service provided by TFS2008? Creating a meaningful Excel report or a new report sometime is a very boring and difficult taks, maybe finding a way to share reports could be a good idea?
Creating reports from SQL Analysis Services (SSAS) in TFS 2008 can be challenging, but there are several resources and approaches you can consider to help streamline the process. Here are some suggestions for finding pre-built reports or resources: ### 1. **Official Documentation and Samples** - **Microsoft Documen...
8,386
[ { "from": "human", "value": "Does anybody have links to site or pre built report running on the SQL Analysis Service provided by TFS2008?\nCreating a meaningful Excel report or a new report sometime is a very boring and difficult taks, maybe finding a way to share reports could be a good idea?\n" }, { ...
I recently asked a question about what I called "method calls". The answer referred to "messages". As a self-taught hobby programmer trying to phrase questions that don't make me look like an idiot, I'm realizing that the terminology that I use reveals a lot about how I learned to program. Is there a distinction betwee...
You've touched on an interesting aspect of programming languages and their associated terminology, particularly in the realm of object-oriented (OO) programming. Let's break this down a bit. ### Terminology in Object-Oriented Programming 1. **Methods**: In the context of OO programming, a method is a function that is...
7,223
[ { "from": "human", "value": "I recently asked a question about what I called \"method calls\". The answer referred to \"messages\". As a self-taught hobby programmer trying to phrase questions that don't make me look like an idiot, I'm realizing that the terminology that I use reveals a lot about how I lear...
I've read the book Programming Collective Intelligence and found it fascinating. I'd recently heard about a challenge amazon had posted to the world to come up with a better recommendation engine for their system. The winner apparently produced the best algorithm by limiting the amount of information that was being fe...
Building an effective recommendation system is a multifaceted task that involves understanding user behavior, leveraging data effectively, and continuously refining the model. Here are some best practices and approaches to consider when building a recommendation system: ### 1. **Define Your Goals Clearly** - Unders...
8,291
[ { "from": "human", "value": "I've read the book Programming Collective Intelligence and found it fascinating. I'd recently heard about a challenge amazon had posted to the world to come up with a better recommendation engine for their system.\nThe winner apparently produced the best algorithm by limiting t...
Say a user is browsing a website, and then performs some action which changes the database (let's say they add a comment). When the request to actually add the comment comes in, however, we find we need to force them to login before they can continue. Assume the login page asks for a username and password, and redirect...
Handling this scenario where a user must log in after attempting to submit a form with HTTP POST data can be tricky, but there are established patterns to deal with it. Here’s a comprehensive approach to manage this: ### 1. Store POST Data Temporarily One effective way to handle this situation is to temporarily store...
6,441
[ { "from": "human", "value": "Say a user is browsing a website, and then performs some action which changes the database (let's say they add a comment). When the request to actually add the comment comes in, however, we find we need to force them to login before they can continue.\nAssume the login page asks...
The collection of fonts available to a web developer is depressingly limited. I remember reading long ago about TrueDoc, as a way of shipping fonts alongside a website - but it seems to have languished. Has anybody used this, or something similar? Is it supported by enough browsers? Am I missing a good solution? Note t...
You're correct in observing that the availability of fonts on the web can be quite limited, and managing font usage across different platforms and browsers has historically been a challenge for web developers. **TrueDoc** was indeed an early attempt to allow web developers to use custom fonts on their websites by embe...
7,323
[ { "from": "human", "value": "The collection of fonts available to a web developer is depressingly limited. I remember reading long ago about TrueDoc, as a way of shipping fonts alongside a website - but it seems to have languished. Has anybody used this, or something similar? Is it supported by enough brows...
For part of my application I have a need to create an image of a certain view and all of its subviews. To do this I'm creating a context that wraps a bitmap with the same-size as the view, but I'm unsure how to draw the view hierarchy into it. I can draw a single view just be setting the context and explicitly calling ...
To render an entire NSView along with its subviews into a bitmap context, you can utilize the `NSBitmapImageRep` class combined with the `-cacheDisplayInRect:toBitmapImageRep:` method of `NSView`. This method allows you to render the view hierarchy, including all its subviews, into a bitmap image. Here’s a step-by-ste...
6,747
[ { "from": "human", "value": "For part of my application I have a need to create an image of a certain view and all of its subviews.\nTo do this I'm creating a context that wraps a bitmap with the same-size as the view, but I'm unsure how to draw the view hierarchy into it. I can draw a single view just be s...
. Inspiration -- Southpark game (very popular if you see download count on download.com ,,, did he ask for permission ??) I am making a 2d game based on dexter's lab theme. I've got the sprite of dexter from GSA. basically I'm not an artist, so I have to depend on already available sprites, backgrounds, sfx on websi...
Using existing sprites, artwork, and assets from copyrighted games and media without permission can potentially infringe on copyright laws. Here are some key points to consider regarding your project: 1. **Copyrighted Material**: The sprite of Dexter from "Dexter's Laboratory" is likely protected by copyright, as is t...
8,340
[ { "from": "human", "value": ".\nInspiration -- Southpark game \n(very popular if you see download count on download.com ,,, did he ask for permission ??) \nI am making a 2d game based on dexter's lab theme. I've got the sprite of dexter from GSA. basically I'm not an artist, so I have to depend on already ...
Does anyone know is there a way to open a project in Eclipse in read-only mode? If there is a lot of similar projects open it is easy to make changes to a wrong one.
Yes, you can open a project in Eclipse in a read-only mode, although Eclipse does not have a direct "open in read-only mode" feature. However, there are some workarounds you can use to achieve a similar effect: ### 1. **Set the Project to Read-Only:** You can mark the project itself as read-only: 1. **Close the Proje...
8,840
[ { "from": "human", "value": "Does anyone know is there a way to open a project in Eclipse in read-only mode? If there is a lot of similar projects open it is easy to make changes to a wrong one.\n" }, { "from": "gpt", "value": "Yes, you can open a project in Eclipse in a read-only mode, although...
I've run into what appears to be a variable scope issue I haven't encountered before. I'm using Perl's CGI module and a call to DBI's do() method. Here's the code structure, simplified a bit: use DBI; use CGI qw(:cgi-lib); &ReadParse; my $dbh = DBI->connect(...............); my $test = $in{test}; $dbh->do(qq{INSERT INT...
The issue you're encountering with the `%in` hash and the `do()` method is indeed related to how the `ReadParse` function from the CGI module manipulates the variable scopes. Let’s break down the situation step-by-step and address your concerns. ### Understanding the Scope Issue When `ReadParse` is called, it uses a ...
5,409
[ { "from": "human", "value": "I've run into what appears to be a variable scope issue I haven't encountered before. I'm using Perl's CGI module and a call to DBI's do() method. Here's the code structure, simplified a bit:\nuse DBI;\nuse CGI qw(:cgi-lib);\n&ReadParse;\nmy $dbh = DBI->connect(...............);...
I have recently upgraded some of my web applications to ASP.NET 3.5 by installing the framework on the server and setting up my web applications acrodingly and all is well, however. On some pages, I want to clear the current contents of the response buffer with code like this: Response.Clear(); // Output some stuff Res...
In ASP.NET 3.5, the behavior of the `Response.Clear()` and `Response.End()` methods is generally the same as in ASP.NET 2.0. However, there are a few things that you may want to check or consider if you are experiencing issues with clearing the response buffer. ### Common Issues and Workarounds: 1. **Check for Respon...
3,444
[ { "from": "human", "value": "I have recently upgraded some of my web applications to ASP.NET 3.5 by installing the framework on the server and setting up my web applications acrodingly and all is well, however.\nOn some pages, I want to clear the current contents of the response buffer with code like this:\...
What is the C# version of VB.NET's InputBox?
In VB.NET, the `InputBox` function is a convenient way to prompt the user for input through a dialog box. C# does not have a built-in equivalent of `InputBox`, but you can create a similar functionality using a custom form. Here's a simple example of how to implement an `InputBox` in C# using Windows Forms: 1. Create...
8,978
[ { "from": "human", "value": "What is the C# version of VB.NET's InputBox?\n" }, { "from": "gpt", "value": "In VB.NET, the `InputBox` function is a convenient way to prompt the user for input through a dialog box. C# does not have a built-in equivalent of `InputBox`, but you can create a similar ...
I was reading a research paper about Haskell and how HList is implemented and wondering when the techniques described are and are not decidable for the type checker. Also, because you can do similar things with GADTs, I was wondering if GADT type checking is always decidable. I would prefer citations if you have them ...
Haskell’s type system, including HLists and GADTs, employs sophisticated type-checking techniques that can lead to both decidable and undecidable behavior depending on the constructs and usage patterns in your code. ### HLists and Decidability HLists (heterogeneous lists) allow you to create lists where each element ...
7,594
[ { "from": "human", "value": "I was reading a research paper about Haskell and how HList is implemented and wondering when the techniques described are and are not decidable for the type checker. Also, because you can do similar things with GADTs, I was wondering if GADT type checking is always decidable.\n...
I'm running Eclipse Europa (3.3). I leave the "Build Automatically" setting, under the Project menu, on all the time. Once in awhile my code isn't compiling, and I puzzle over it and then pull down the Project menu ... lo and behold, it's not set anymore. What gives? Is this a bug, or is there something else I'm do...
The issue you're experiencing with the "Build Automatically" setting being disabled intermittently in Eclipse can be attributed to a few factors. Although it's difficult to pinpoint the exact cause without more context, here are some potential reasons and solutions: 1. **Workspace Corruption**: Sometimes the Eclipse w...
9,265
[ { "from": "human", "value": "I'm running Eclipse Europa (3.3). I leave the \"Build Automatically\" setting, under the Project menu, on all the time. Once in awhile my code isn't compiling, and I puzzle over it and then pull down the Project menu ... lo and behold, it's not set anymore. What gives? Is th...
We have a small embedded system without any video or serial ports (i.e. we can't output text via printf). We would like to track the progress of our code through the initialization sequence. Is there some simple things we can do to help with this. It is not running any OS, and the hardware platform is somewhat customiz...
Tracking the progress of your code in an embedded system without standard output options can be a challenge, but there are several techniques you can use to get feedback during the initialization sequence. Here are a few suggestions: 1. **LED Indicators**: Use available GPIO pins to control LEDs. You can blink differe...
7,126
[ { "from": "human", "value": "We have a small embedded system without any video or serial ports (i.e. we can't output text via printf).\nWe would like to track the progress of our code through the initialization sequence.\nIs there some simple things we can do to help with this.\nIt is not running any OS, an...
Is there a way to turn this 'feature' off?
Could you please provide more context or specify which feature you're referring to? That way, I can give you a more accurate response or guidance on how to disable it.
13,860
[ { "from": "human", "value": "Is there a way to turn this 'feature' off? \n" }, { "from": "gpt", "value": "Could you please provide more context or specify which feature you're referring to? That way, I can give you a more accurate response or guidance on how to disable it." } ]
We have a case where clients seem to be eternally caching versions of applets. We're making use of the <param name="cache_version"> tag correctly within our <object> tag, or so we think. We went from a version string of 7.1.0.40 to 7.1.0.42 and this triggered a download for only about half of our clients. It doesn't ...
It sounds like you're experiencing a common challenge related to Java applet caching and versioning. When dealing with the `<param name="cache_version">` tag, there are a few key points to consider to ensure more reliable cache management: 1. **Correct Use of `cache_version`**: The `cache_version` parameter is intende...
7,518
[ { "from": "human", "value": "We have a case where clients seem to be eternally caching versions of applets. We're making use of the <param name=\"cache_version\"> tag correctly within our <object> tag, or so we think. We went from a version string of 7.1.0.40 to 7.1.0.42 and this triggered a download for ...
If I have a collection of database tables (in an Access file, for example) and need to validate each table in this collection against a rule set that has both common rules across all tables as well as individual rules specific to one or a subset of tables, can someone recommend a good design pattern to look into? Speci...
To address your validation requirements for your database tables, you might want to consider using the **Strategy Pattern** or the **Command Pattern**. Both patterns can help you to manage the validation logic in a more modular and reusable way, while also allowing you to separate common rules from specific ones. ### ...
5,096
[ { "from": "human", "value": "If I have a collection of database tables (in an Access file, for example) and need to validate each table in this collection against a rule set that has both common rules across all tables as well as individual rules specific to one or a subset of tables, can someone recommend ...
Is there a way to combine a previous translation when extracting the csv file from an application? Or any other tool that could do this job for me? I can’t really see how could i use locbaml if i had to translate everything from scratch every time i add a new control in my application.
When managing translations for an application, especially as new controls are added, it's important to have a streamlined process to avoid redundancy and ensure consistency. Here are some strategies and tools that can help you combine previous translations when exporting to CSV files or managing localization in general...
7,832
[ { "from": "human", "value": "Is there a way to combine a previous translation when extracting the csv file from an application? \nOr any other tool that could do this job for me? \nI can’t really see how could i use locbaml if i had to translate everything from scratch every time i add a new control in my a...
Can a (||any) proxy server cache content that is requested by a client over https? As the proxy server can't see the querystring, or the http headers, I reckon they can't. I'm considering a desktop application, run by a number of people behind their companies proxy. This application may access services across the inter...
Caching of HTTPS content by a proxy server is fundamentally different from caching HTTP content due to the encryption provided by HTTPS. Let's break down your concerns and ideas: ### HTTPS and Proxy Caching 1. **HTTPS Encryption**: - When a client sends an HTTPS request, the entire payload (including query strings...
4,949
[ { "from": "human", "value": "Can a (||any) proxy server cache content that is requested by a client over https? As the proxy server can't see the querystring, or the http headers, I reckon they can't.\nI'm considering a desktop application, run by a number of people behind their companies proxy. This applic...
I would like to open a small video file and map every frames in memory (to apply some custom filter). I don't want to handle the video codec, I would rather let the library handle that for me. I've tried to use Direct Show with the SampleGrabber filter (using this sample http://msdn.microsoft.com/en-us/library/ms787867...
If you're experiencing issues with using DirectShow and the SampleGrabber filter, consider a few points to improve your frame grabbing approach. It seems like you're trying to grab each frame from the video, but the way you're managing the playback and the event waiting might not yield every frame due to timing or buff...
4,555
[ { "from": "human", "value": "I would like to open a small video file and map every frames in memory (to apply some custom filter). I don't want to handle the video codec, I would rather let the library handle that for me.\nI've tried to use Direct Show with the SampleGrabber filter (using this sample http:/...
I have a pair of Sun web servers (iws6) sitting behind a load balancer. It likes to know if the web servers are up and continually asks for /alive.html. That is fine but how do I not log that in my access log? Failing that, how could I have the archiver strip out that accesses when it roles the file over? I would prefe...
To prevent access logs from recording requests for `/alive.html` on your Sun web servers, you have a few options. Below are some approaches that you can consider: ### Option 1: Use Conditional Logging If your web server supports conditional logging, you can set up a condition to not log certain requests. For instance...
7,984
[ { "from": "human", "value": "I have a pair of Sun web servers (iws6) sitting behind a load balancer. It likes to know if the web servers are up and continually asks for /alive.html.\nThat is fine but how do I not log that in my access log?\nFailing that, how could I have the archiver strip out that accesses...
What is the most efficient, secure way to pipe the contents of a postgresSQL database into a compressed tarfile, then copy to another machine? This would be used for localhosting development, or backing up to a remote server, using *nix based machines at both ends.
To efficiently and securely pipe the contents of a PostgreSQL database into a compressed tar file and then copy it to another machine, you can use a combination of `pg_dump`, `tar`, and `ssh`. Below are the steps and the command you can use for this process: ### Steps 1. **Dump the Database**: Use `pg_dump` to export...
7,338
[ { "from": "human", "value": "What is the most efficient, secure way to pipe the contents of a postgresSQL database into a compressed tarfile, then copy to another machine?\nThis would be used for localhosting development, or backing up to a remote server, using *nix based machines at both ends.\n" }, { ...
I'm currently looping through a datareader and calling the System.Net.Mail.SmtpClient's Send() method. The problem with this is that it's slow. Each email takes about 5-10 seconds to send (it's possible this is just an issue with my host). I had to override the executionTimeout default in my web.config file (it default...
When dealing with slow email sending in a scenario like yours, there are several strategies you can implement to improve performance. Here are some approaches to consider: ### 1. **Batch Processing with Asynchronous Sending** Instead of sending emails one at a time within your loop, you can implement asynchronous send...
5,997
[ { "from": "human", "value": "I'm currently looping through a datareader and calling the System.Net.Mail.SmtpClient's Send() method. The problem with this is that it's slow. Each email takes about 5-10 seconds to send (it's possible this is just an issue with my host). I had to override the executionTimeout ...
I followed this tutorial on configuring the Rails plugin ExceptionNotifier. I know that I have ActionMailer configured correctly because I am getting mail from other forms. I even have local_addresses.clear set so that it should be delivering mail no matter what. I am using Apache with a mongrel_cluster running in the ...
It sounds like you've done a good job configuring ActionMailer, but there may be some steps or settings that are specifically needed for ExceptionNotifier to work correctly. Here are some troubleshooting steps and suggestions you can follow to help resolve the issue: 1. **Check ExceptionNotifier Configuration**: En...
8,045
[ { "from": "human", "value": "I followed this tutorial on configuring the Rails plugin ExceptionNotifier.\nI know that I have ActionMailer configured correctly because I am getting mail from other forms. I even have local_addresses.clear set so that it should be delivering mail no matter what.\nI am using Ap...
I have a three-tier application which is installed in corporate environments. With every server version update, all clients have to be updated, too. Currently, I provide an MSI package which is automatically deployed via Active Directory, however my customers (mostly with 20-300 users each) seem to hate the MSI solutio...
It sounds like you're facing some significant challenges with the deployment and update process for your three-tier application in corporate environments. Below are several strategies you might consider for making updates easier and more user-friendly: ### 1. **Self-Updating Mechanism**: Create a self-updating mechani...
5,788
[ { "from": "human", "value": "I have a three-tier application which is installed in corporate environments. With every server version update, all clients have to be updated, too. Currently, I provide an MSI package which is automatically deployed via Active Directory, however my customers (mostly with 20-300...
What I have is a collection of classes that all implement the same interface but can be pretty wildly different under the hood. I want to have a config file control which of the classes go into the collection upon starting the program, taking something that looks like : <class1 prop1="foo" prop2="bar"/> and turning th...
Yes, C# provides several ways to achieve meta-programming through reflection, which allows you to dynamically access properties and fields of objects. Here's a step-by-step guide on how you can implement this functionality to instantiate classes and set their properties based on a configuration file (e.g., XML). ### 1...
3,897
[ { "from": "human", "value": "What I have is a collection of classes that all implement the same interface but can be pretty wildly different under the hood. I want to have a config file control which of the classes go into the collection upon starting the program, taking something that looks like :\n<class1...
I'm creating a ToolTip window and adding tools to it using the flags TTF_IDISHWND | TTF_SUBCLASS. (c++, win32) I have a manifest file such that my program uses the new WindowsXP themes (comctrl32 version 6). When I hover over a registered tool, the tip appears. Good. When I click the mouse, the tip disappears. Ok. Howe...
It seems that you've done quite a bit of research and experimentation to understand the behavior changes between the old and new versions of the Common Controls library, especially regarding ToolTips. The behavior you're encountering is indeed related to the changes introduced with the new version of comctl32. Here ar...
7,971
[ { "from": "human", "value": "I'm creating a ToolTip window and adding tools to it using the flags\nTTF_IDISHWND | TTF_SUBCLASS. (c++, win32)\nI have a manifest file such that my program uses the new WindowsXP themes\n(comctrl32 version 6).\nWhen I hover over a registered tool, the tip appears.\nGood.\nWhen ...
There is a limitation on Windows Server 2003 that prevents you from copying extremely large files, in proportion to the amount of RAM you have. The limitation is in the CopyFile and CopyFileEx functions, which are used by xcopy, Explorer, Robocopy, and the .NET FileInfo class. Here is the error that you get: Cannot c...
The limitation you're encountering when copying large files on Windows Server 2003 is indeed due to the way the `CopyFile` and `CopyFileEx` functions manage memory. When you try to copy files that exceed a certain size relative to your available RAM, you'll run into the "Insufficient system resources" error. Here are ...
7,836
[ { "from": "human", "value": "There is a limitation on Windows Server 2003 that prevents you from copying extremely large files, in proportion to the amount of RAM you have. The limitation is in the CopyFile and CopyFileEx functions, which are used by xcopy, Explorer, Robocopy, and the .NET FileInfo class.\...
I would prefer that a console app would default to multithreaded debug. warning level 4. build browse information. no resource folder. Does anyone know of any technique that would allow me to create a console app, with my desired options, without manually setting it.
To create a console application in Visual Studio with your specific desired configurations (multithreaded debug, warning level 4, build browse information, and no resource folder) without manually setting these options each time, you can automate the process using a combination of project templates and pre-defined sett...
6,812
[ { "from": "human", "value": "I would prefer that a console app would default to \nmultithreaded debug.\nwarning level 4.\nbuild browse information.\nno resource folder.\nDoes anyone know of any technique that would allow me to create a console app, with my desired options, without manually setting it.\n" ...
I currently have speakers set up both in my office and in my living room, connected to my PC via two sound cards, and would like to switch the set of speakers I'm outputting to on the fly. Anyone know an application or a windows API call that I can use to change the default sound output device? It is currently a bit of...
You can switch between audio output devices easily on Windows using a couple of different methods. Here are some options you can consider: ### 1. Third-Party Applications There are several third-party applications available that make it easy to switch between audio output devices without delving into the Control Panel...
6,995
[ { "from": "human", "value": "I currently have speakers set up both in my office and in my living room, connected to my PC via two sound cards, and would like to switch the set of speakers I'm outputting to on the fly.\nAnyone know an application or a windows API call that I can use to change the default sou...
Suppose someone worked for a company that put up an HTTP proxy preventing internet access without password authentication (NTLM, I think). Also suppose that this password rotated on a daily basis, which added very little security, but mostly served to annoy the employees. How would one get started writing a Firefox add...
Creating a Firefox add-on to automate password entry for an HTTP proxy with a rotating password scheme involves several steps. Below is a high-level outline of the process you might take, along with some sample code to get you started. ### Step 1: Understand the Proxy Authentication Flow Before writing any code, you ...
5,895
[ { "from": "human", "value": "Suppose someone worked for a company that put up an HTTP proxy preventing internet access without password authentication (NTLM, I think). Also suppose that this password rotated on a daily basis, which added very little security, but mostly served to annoy the employees. How wo...
First off: I'm using a rather obscure implementation of javascript embedded as a scripting engine for Adobe InDesign CS3. This implementation sometimes diverges from "standard" javascript, hence my problem. I'm using John Resig's jsdiff library (source here) to compare selections of text between two documents. jsdiff u...
In JavaScript, when you're working with objects as associative arrays, you might run into issues when the keys you want to use collide with reserved properties or methods. In your case, the word "reflect" is a built-in property of objects, leading to issues when you try to assign a value to `ns['reflect']`. To work ar...
8,513
[ { "from": "human", "value": "First off: I'm using a rather obscure implementation of javascript embedded as a scripting engine for Adobe InDesign CS3. This implementation sometimes diverges from \"standard\" javascript, hence my problem.\nI'm using John Resig's jsdiff library (source here) to compare select...
I get an error everytime I upload my webapp to the provider. Because of the customErrors mode, all I see is the default "Runtime error" message, instructing me to turn off customErrors to view more about the error. Exasperated, I've set my web.config to look like this: <?xml version="1.0"?> <configuration> <system....
It sounds like you're facing issues with the `customErrors` configuration in your `web.config` file. Here are a few steps you can take to troubleshoot and resolve this issue: 1. **Ensure the Right Environment**: Make sure you're deploying your web application to an environment that allows you to control the custom err...
7,422
[ { "from": "human", "value": "I get an error everytime I upload my webapp to the provider. Because of the customErrors mode, all I see is the default \"Runtime error\" message, instructing me to turn off customErrors to view more about the error.\nExasperated, I've set my web.config to look like this:\n<?xml...
How can I format Floats in Java so that the float component is displayed only if it's not zero? For example: 123.45 -> 123.45 99.0 -> 99 23.2 -> 23.2 45.0 -> 45 Edit: I forgot to mention - I'm still on Java 1.4 - sorry!
In Java 1.4, you don't have access to some of the newer features available in later versions, such as `DecimalFormat` with custom patterns that allow for conditional formatting directly. However, you can achieve the desired formatting manually by checking if the float has a fractional part and formatting accordingly. ...
10,831
[ { "from": "human", "value": "How can I format Floats in Java so that the float component is displayed only if it's not zero? For example:\n\n123.45 -> 123.45\n99.0 -> 99\n23.2 -> 23.2\n45.0 -> 45\n\nEdit: I forgot to mention - I'm still on Java 1.4 - sorry!\n" }, { "from": "gpt", "value": ...
I have a web application that is dynamically loading PDF files for viewing in the browser. Currently, it uses "innerHTML" to replace a div with the PDF Object. This works. But, is there a better way to get the ID of the element and set the "src" or "data" parameter for the Object / Embed and have it instantly load up...
Yes, there is a better way to update the `src` or `data` parameter of a PDF Object or Embed element without replacing the entire element, which can improve performance and user experience. Instead of using `innerHTML`, you can directly manipulate the `data` attribute of the existing object/embed element. This will allo...
9,125
[ { "from": "human", "value": "I have a web application that is dynamically loading PDF files for viewing in the browser.\nCurrently, it uses \"innerHTML\" to replace a div with the PDF Object. This works.\nBut, is there a better way to get the ID of the element and set the \"src\" or \"data\" parameter for...
Under what circumstances - if any - does adding programmers to a team actually speed development of an already late project?
Adding programmers to a team can sometimes speed up the development of an already late project, but this is contingent on several factors. The idea that adding more people to a late project will accelerate progress is often referred to as Brooks' Law, which states that "adding manpower to a late software project makes ...
9,334
[ { "from": "human", "value": "Under what circumstances - if any - does adding programmers to a team actually speed development of an already late project?\n" }, { "from": "gpt", "value": "Adding programmers to a team can sometimes speed up the development of an already late project, but this is c...
Has anyone figured out how to use Crystal Reports with Linq to SQL?
Yes, it is possible to use Crystal Reports with LINQ to SQL, although it requires some additional steps because Crystal Reports does not natively support LINQ to SQL as a direct data source. Here are the general steps you can follow to integrate Crystal Reports with LINQ to SQL: 1. **Create LINQ to SQL Data Context:**...
9,733
[ { "from": "human", "value": "Has anyone figured out how to use Crystal Reports with Linq to SQL?\n" }, { "from": "gpt", "value": "Yes, it is possible to use Crystal Reports with LINQ to SQL, although it requires some additional steps because Crystal Reports does not natively support LINQ to SQL ...
I have some code like this in a winforms app I was writing to query a user's mail box Storage Quota. DirectoryEntry mbstore = new DirectoryEntry( @"LDAP://" + strhome, m_serviceaccount, [m_pwd], AuthenticationTypes.Secure); No matter what approach I tried (like SecureString), I am easily abl...
Storing sensitive information such as passwords in a local application, especially in a WinForms application, can be challenging due to the potential for reverse engineering and various attack vectors. Here are some strategies you can employ to enhance the security of storing the password while considering your require...
4,811
[ { "from": "human", "value": "I have some code like this in a winforms app I was writing to query a user's mail box Storage Quota.\nDirectoryEntry mbstore = new DirectoryEntry(\n @\"LDAP://\" + strhome, \n m_serviceaccount, \n [m_pwd], \n AuthenticationTypes.Secure);\n\nNo matter what app...
What I'm trying to do with MRS is to teach myself some basic AI; what I want to do is to make a rocket entity, with things such as vectored exhaust, and staging. Anyone have an idea on how to make an entity that can fly? Or do I just need to constantly apply a force upwards?
Creating a rocket entity in a simulation environment like MRS (Modular Rocket System) involves several steps, especially if you want to incorporate features such as vectored thrust and staging. Here’s a basic outline to help you get started: ### 1. Basic Physics Principles To make a rocket fly, you need to understand ...
6,979
[ { "from": "human", "value": "What I'm trying to do with MRS is to teach myself some basic AI; what I want to do is to make a rocket entity, with things such as vectored exhaust, and staging. Anyone have an idea on how to make an entity that can fly? Or do I just need to constantly apply a force upwards?\n" ...
I've seen binary trees and binary searching mentioned in several books I've read lately, but as I'm still at the beginning of my studies in Computer Science, I've yet to take a class that's really dealt with algorithms and data structures in a serious way. I've checked around the typical sources (Wikipedia, Google) and...
Binary trees, particularly binary search trees (BSTs) and their self-balancing counterparts like Red-Black trees, are fundamental data structures in computer science. Let's break down their usefulness, why certain types are preferred, and provide a sample implementation. ### Why Use Binary Trees? 1. **Organizing Data...
3,281
[ { "from": "human", "value": "I've seen binary trees and binary searching mentioned in several books I've read lately, but as I'm still at the beginning of my studies in Computer Science, I've yet to take a class that's really dealt with algorithms and data structures in a serious way.\nI've checked around t...
I'm looking for a way to do a substring replace on a string in LaTeX. What I'd like to do is build a command that I can call like this: \replace{File,New} and that would generate something like \textbf{File}$\rightarrow$\textbf{New} This is a simple example, but I'd like to be able to put formatting/structure in a s...
In LaTeX, you can achieve substring replacement with the help of the `xparse` package for flexible argument handling and `pgf` for string manipulation. Below is an example of how to create a command that takes a string with comma-separated values and replaces commas with a right arrow while wrapping each part in `\text...
9,112
[ { "from": "human", "value": "I'm looking for a way to do a substring replace on a string in LaTeX. What I'd like to do is build a command that I can call like this:\n\\replace{File,New}\n\nand that would generate something like\n\\textbf{File}$\\rightarrow$\\textbf{New}\n\nThis is a simple example, but I'd...
How do I get the key of the current element in a foreach loop in C#? For example: PHP foreach ($array as $key => $value) { echo("$value is assigned to key: $key"); } What I'm trying to do in C#: int[] values = { 5, 14, 29, 49, 99, 150, 999 }; foreach (int val in values) { if(search <= val && !stop) { ...
In C#, you can achieve similar functionality to PHP's `foreach` loop with key-value pairs using a `for` loop, especially if you want to access both the index (which acts as the key) and the value of the elements in the array. Here’s how you can do it: ### Using a `for` loop You can use a `for` loop to access both the...
8,116
[ { "from": "human", "value": "How do I get the key of the current element in a foreach loop in C#?\nFor example:\nPHP\nforeach ($array as $key => $value)\n{\n echo(\"$value is assigned to key: $key\");\n}\n\nWhat I'm trying to do in C#:\nint[] values = { 5, 14, 29, 49, 99, 150, 999 };\n\nforeach (int val ...
Does anybody know a good tutorial about Squid plug-in development?
Yes! While specific tutorials can vary, there are several resources that you can use to get started with Squid plugin (or adapter) development: 1. **Official Squid Documentation**: The [Squid Cache documentation](http://www.squid-cache.org/Doc/) provides a wealth of information about the architecture and features of S...
11,582
[ { "from": "human", "value": "Does anybody know a good tutorial about Squid plug-in development?\n" }, { "from": "gpt", "value": "Yes! While specific tutorials can vary, there are several resources that you can use to get started with Squid plugin (or adapter) development:\n\n1. **Official Squid ...
Is there anything like ELMAH for Windows Forms? I'm looking for a standard way to process unhandled exceptions and grab a screenshot and other environment information before packaging that up for support.
Yes, while ELMAH (Error Logging Modules and Handlers) is primarily designed for ASP.NET applications, you can achieve similar functionality for Windows Forms applications by implementing custom exception handling and logging mechanisms. Below are some steps and libraries you might consider using: ### 1. Global Excepti...
7,196
[ { "from": "human", "value": "Is there anything like ELMAH for Windows Forms? \nI'm looking for a standard way to process unhandled exceptions and grab a screenshot and other environment information before packaging that up for support.\n" }, { "from": "gpt", "value": "Yes, while ELMAH (Error Log...
Just like it reads.
It seems like you're referencing something specific or perhaps asking for clarification. Could you provide more context or elaborate on what you're referring to? I'm here to help!
13,903
[ { "from": "human", "value": "Just like it reads.\n" }, { "from": "gpt", "value": "It seems like you're referencing something specific or perhaps asking for clarification. Could you provide more context or elaborate on what you're referring to? I'm here to help!" } ]
The located assembly's manifest definition does not match the assembly reference getting this when running nunit through ncover. Any idea?
The error "The located assembly's manifest definition does not match the assembly reference" typically indicates a version mismatch between an assembly that your application or test is referencing and the actual assembly that is being loaded at runtime. This is a common issue in .NET applications when there are differe...
9,469
[ { "from": "human", "value": "The located assembly's manifest definition does not match the assembly reference\ngetting this when running nunit through ncover. Any idea?\n" }, { "from": "gpt", "value": "The error \"The located assembly's manifest definition does not match the assembly reference\"...
Does somebody know a Java library which serializes a Java object hierarchy into Java code which generates this object hierarchy? Like Object/XML serialization, only that the output format is not binary/XML but Java code.
Yes, there are several libraries and approaches you can use to serialize a Java object hierarchy into Java code that can reconstruct that hierarchy. One of the most prominent libraries that can help with this is **Jackson**, particularly its ability to serialize and deserialize objects. While Jackson primarily targets ...
10,547
[ { "from": "human", "value": "Does somebody know a Java library which serializes a Java object hierarchy into Java code which generates this object hierarchy? Like Object/XML serialization, only that the output format is not binary/XML but Java code.\n" }, { "from": "gpt", "value": "Yes, there ar...
Do I risk losing sales by disabling SSL 2.0 and PCT 1.0 in IIS5? Clarification: Sales would be lost by client not being able to connect via SSL to complete ecommerce transaction because SSL 2.0 or PCT 1.0 is disabled on the web server. Microsoft kbase article: http://support.microsoft.com/kb/187498
Disabling SSL 2.0 and PCT 1.0 in IIS 5 may potentially lead to issues for a small subset of clients who still use older browsers or clients that only support these outdated protocols. SSL 2.0 and PCT 1.0 are considered insecure and have numerous known vulnerabilities, which is why it is generally recommended to disable...
8,899
[ { "from": "human", "value": "Do I risk losing sales by disabling SSL 2.0 and PCT 1.0 in IIS5?\nClarification: Sales would be lost by client not being able to connect via SSL to complete ecommerce transaction because SSL 2.0 or PCT 1.0 is disabled on the web server. \nMicrosoft kbase article: http://support....
My team builds reusable libraries for other (internal) software development teams. We use FlexBuilder 3 as our development environment. Our SCM standards state that these projects must include test harnesses and a unit test runner, and (of course) we want to be able to use the debugger. For that reason, all the proje...
It sounds like you're facing a classic issue in working with FlexBuilder (or similar development environments) when trying to structure your projects for optimal reuse and ease of debugging. Here are some strategies to streamline your workflow while ensuring that you can effectively debug and build your reusable librar...
8,546
[ { "from": "human", "value": "My team builds reusable libraries for other (internal) software development teams. We use FlexBuilder 3 as our development environment. Our SCM standards state that these projects must include test harnesses and a unit test runner, and (of course) we want to be able to use the ...