instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
I am looking for any examples or guides to using Linq over WCF (n-tier application). Please specify if you are showing something for Linq-to-SQL or Linq-to-entities. I would like to see usage examples for both. I am wondering how things like deffered execution works over WCF (if it works at all)? Cyclic references sup...
Sure! Below is a quick start guide to using LINQ over WCF for both LINQ-to-SQL and LINQ-to-Entities. This will cover examples, deferred execution, cyclic references, and other considerations. ### Overview of LINQ with WCF When using LINQ with WCF, you'll typically use either LINQ-to-SQL or LINQ-to-Entities (Entity Fr...
14,083
[ { "from": "human", "value": "I am looking for any examples or guides to using Linq over WCF (n-tier application). Please specify if you are showing something for Linq-to-SQL or Linq-to-entities. I would like to see usage examples for both. \nI am wondering how things like deffered execution works over WCF (...
I have returned to php development from Moose and I really miss CLOS like object model for php. Is there some kind of syntaxtic sugar which would allow me to write less code in php when dealing with objects? Just to stress this requirement a bit more. I don't want to write one thing in several places. I can live with p...
If you're looking for a more expressive object model in PHP that reduces boilerplate code and provides features like mixins (roles) and introspection, there are several libraries and frameworks that can help you achieve that. ### 1. **Symfony's Traits** PHP 5.4 introduced traits, which can be used for code reuse. Tra...
15,894
[ { "from": "human", "value": "I have returned to php development from Moose and I really miss CLOS like object model for php. Is there some kind of syntaxtic sugar which would allow me to write less code in php when dealing with objects?\nJust to stress this requirement a bit more. I don't want to write one ...
I have an application (an IP conferencing service) that I need to scale. It has quite a few independent components/applications, written in different languages (mainly C++ and PHP, some Perl). Currently a single installation runs on 5 machines, with 1-2 components sharing a single box. The configuration of each box the...
Scaling applications, especially those with independent components, can indeed be challenging. There are several strategies you can consider, each with its pros and cons. Here's a high-level overview of the options available to you and resources to help guide your decision. ### 1. Monolithic vs. Distributed Approach Y...
15,350
[ { "from": "human", "value": "I have an application (an IP conferencing service) that I need to scale. It has quite a few independent components/applications, written in different languages (mainly C++ and PHP, some Perl). Currently a single installation runs on 5 machines, with 1-2 components sharing a sing...
In VB.NET I often Catch…When: Try … Catch e As ArgumentNullException When e.ParamName.ToUpper() = "SAMPLES" … End Try Is there a C# equivalent to Catch…When? I don't want to resort to using an if statement inside a catch if possible.
In C#, there isn't a direct equivalent of the `Catch...When` construct found in VB.NET. However, you can achieve similar functionality using pattern matching with the `is` operator in conjunction with the `if` statement. Here's how you can write a similar structure in C# using a try-catch block: ```csharp try { /...
18,693
[ { "from": "human", "value": "In VB.NET I often Catch…When:\nTry\n …\nCatch e As ArgumentNullException When e.ParamName.ToUpper() = \"SAMPLES\"\n …\nEnd Try\n\nIs there a C# equivalent to Catch…When?\nI don't want to resort to using an if statement inside a catch if possible.\n" }, { "from": "g...
In Guile 1.6.*, the function scm_istring2number(char *str,int strlen,int radix) does the work. However, this function does not exist in Guile 1.8.. How can I accomplish the same task in Guile 1.8.? This is not trivial because the function scm_string_to_number(SCM str,int radix) does not convert numbers larger than ...
In Guile 1.8, the function `scm_string_to_number` is indeed available, but it may not support conversions for large integers directly. For handling large integers, you might need to use a different approach, as Guile 1.8 introduced changes in the handling of numbers and string conversions. Here’s how you can achieve t...
15,600
[ { "from": "human", "value": "In Guile 1.6.*, the function scm_istring2number(char *str,int strlen,int radix) does the work. \nHowever, this function does not exist in Guile 1.8..\nHow can I accomplish the same task in Guile 1.8.? \nThis is not trivial because the function scm_string_to_number(SCM str,int ...
This is really two questions, but they are so similar, and to keep it simple, I figured I'd just roll them together: Firstly: Given an established C# project, what are some decent ways to speed it up beyond just plain in-code optimization? Secondly: When writing a program from scratch in C#, what are some good ways t...
When it comes to optimizing C# applications—whether modifying an established project or building one from scratch—there are several C#-specific techniques and approaches to consider. ### For an Established C# Project 1. **Profile the Application**: Use profiling tools like Visual Studio Profiler, dotTrace, or ANTS Pe...
16,201
[ { "from": "human", "value": "This is really two questions, but they are so similar, and to keep it simple, I figured I'd just roll them together:\n\nFirstly: Given an established C# project, what are some decent ways to speed it up beyond just plain in-code optimization?\nSecondly: When writing a program f...
The popular design pattern MVC (Model/View/Controller) has an extended cousin MVC-ARS (Action/Representation/State). The added components all live within the database layer and while are not part of the model, they are invoked by it. Details are as follows: State, as in state machine. This follows the classic state...
Yes, the MVC-ARS (Action/Representation/State) extension provides a structured approach to managing the complexities of data handling in a way that can help prevent the overloading of the traditional MVC model and controller components. Here's a breakdown of how each component contributes to this separation of concerns...
17,405
[ { "from": "human", "value": "The popular design pattern MVC (Model/View/Controller) has an extended cousin MVC-ARS (Action/Representation/State). The added components all live within the database layer and while are not part of the model, they are invoked by it. Details are as follows:\n\nState, as in sta...
Is there any way to change the background color of the Solution Explorer in Visual Studio using a Theme? - or any other way for that matter? I can change it by changing windows-wide color settings, but obviously that affects too much.
As of my last knowledge update in October 2023, Visual Studio does not natively provide an option to change the background color of the Solution Explorer specifically through built-in theme settings. Visual Studio themes allow for changing the overall color scheme of the IDE, but they do not typically allow for granula...
17,475
[ { "from": "human", "value": "Is there any way to change the background color of the Solution Explorer in Visual Studio using a Theme? - or any other way for that matter?\nI can change it by changing windows-wide color settings, but obviously that affects too much.\n" }, { "from": "gpt", "value"...
I've having trouble directly accessing the Win32_OperatingSystem management class that is exposed via WMI. It is a singleton class, and I'm pretty certain "Win32_OperatingSystem=@" is the correct path syntax to get the instance of a singleton. The call to InvokeMethod produces the exception listed at the bottom of the ...
It looks like you're attempting to access the singleton instance of `Win32_OperatingSystem` in WMI using an incorrect path format. The correct syntax for accessing a singleton instance in WMI does not include the `=` sign. Instead, you should just specify the class name without the `@` or any other suffix. Here's how y...
15,384
[ { "from": "human", "value": "I've having trouble directly accessing the Win32_OperatingSystem management class that is exposed via WMI.\nIt is a singleton class, and I'm pretty certain \"Win32_OperatingSystem=@\" is the correct path syntax to get the instance of a singleton.\nThe call to InvokeMethod produc...
What are the pros/cons of doing either way. Is there One Right Way(tm) ?
It seems like you're asking about a decision or a method, but you haven't specified what "either way" refers to. The pros and cons can vary greatly depending on the context—be it a decision in personal life, business, technology, or any other field. Here are some general considerations for making choices: ### Pros a...
13,627
[ { "from": "human", "value": "What are the pros/cons of doing either way. Is there One Right Way(tm) ?\n" }, { "from": "gpt", "value": "It seems like you're asking about a decision or a method, but you haven't specified what \"either way\" refers to. The pros and cons can vary greatly depending ...
In several cases I want to add a toolbar to the top of the iPhone keyboard (as in iPhone Safari when you're navigating form elements, for example). Currently I am specifying the toolbar's rectangle with constants but because other elements of the interface are in flux - toolbars and nav bars at the top of the screen ...
Yes, you can programmatically determine the position of the keyboard in relation to your current view in iOS. To add a toolbar above the keyboard that adjusts correctly to the keyboard’s position, you should listen for keyboard notifications and adjust your toolbar’s position accordingly. Here's how you can do it step...
13,995
[ { "from": "human", "value": "In several cases I want to add a toolbar to the top of the iPhone keyboard (as in iPhone Safari when you're navigating form elements, for example). \nCurrently I am specifying the toolbar's rectangle with constants but because other elements of the interface are in flux - toolb...
Is there a way to modify existing .NET assemblies without resorting to 3rd party tools? I know that PostSharp makes this possible but I find it incredibly wasteful that the developler of PostSharp basically had to rewrite the functionality of the whole System.Reflection namespace in order to make existing assemblies mo...
Modifying existing .NET assemblies directly is indeed a challenging task due to the limitations of the .NET Framework's built-in capabilities. As you've pointed out, `System.Reflection.Emit` allows the creation of new assemblies but does not support modifying existing ones. ### Potential Approaches to Modify Existing ...
14,856
[ { "from": "human", "value": "Is there a way to modify existing .NET assemblies without resorting to 3rd party tools? I know that PostSharp makes this possible but I find it incredibly wasteful that the developler of PostSharp basically had to rewrite the functionality of the whole System.Reflection namespac...
I'm making a simple scheduler with C# in .Net. All it does is execute a simple select statement on a table in a SQL Server DB once per minute (this does not need to scale or anything... the db does not have a high load). Here is my proposed implementation: static void Main(string[] args) { while (true) { ...
Your proposed implementation using a `while (true)` loop with `Thread.Sleep` is a simple approach, but it has a few drawbacks that you should consider: 1. **Blocking the Thread**: Your `Main` thread is blocked while sleeping, which isn't ideal for scalability or responsiveness. If your application ever needs to be ext...
16,464
[ { "from": "human", "value": "I'm making a simple scheduler with C# in .Net. All it does is execute a simple select statement on a table in a SQL Server DB once per minute (this does not need to scale or anything... the db does not have a high load). Here is my proposed implementation:\nstatic void Main(st...
Summary: C#/.NET is supposed to be garbage collected. C# has a destructor, used to clean resources. What happen when an object A is garbage collected the same line I try to clone one of its variable members? Apparently, on multiprocessors, sometimes, the garbage collector wins... The problem Today, on a training sessio...
The issue described revolves around the unpredictability of garbage collection in C#, particularly in multithreaded environments and how finalizers operate. The core of the problem is that the C# garbage collector may finalize an object (in this case, the instance of `Example`) before its properties have been fully acc...
18,493
[ { "from": "human", "value": "Summary: C#/.NET is supposed to be garbage collected. C# has a destructor, used to clean resources. What happen when an object A is garbage collected the same line I try to clone one of its variable members? Apparently, on multiprocessors, sometimes, the garbage collector wins.....
Some people want to move code from user space to kernel space in Linux for some reason. A lot of times the reason seems to be that the code should have particularly high priority or simply "kernel space is faster". This seems strange to me. When should I consider writing a kernel module? Are there a set of criterias? H...
Moving code from user space to kernel space in Linux is a significant decision and should be approached with caution. While there are scenarios where a kernel module may be appropriate, there are important considerations to keep in mind. Here are some criteria that can help you decide whether to write a kernel module o...
15,754
[ { "from": "human", "value": "Some people want to move code from user space to kernel space in Linux for some reason. A lot of times the reason seems to be that the code should have particularly high priority or simply \"kernel space is faster\".\nThis seems strange to me. When should I consider writing a ke...
I just played with Java file system API, and came down with the following function, used to copy binary files. The original source came from the Web, but I added try/catch/finally clauses to be sure that, should something wrong happen, the Buffer Streams would be closed (and thus, my OS ressources freed) before quiting...
You're correct in observing that Java's exception handling can lead to verbose and, at times, complex code, especially when it comes to resource management. However, starting from Java 7, the language introduced the **try-with-resources** statement, which greatly simplifies resource management and ensures that resource...
18,144
[ { "from": "human", "value": "I just played with Java file system API, and came down with the following function, used to copy binary files. The original source came from the Web, but I added try/catch/finally clauses to be sure that, should something wrong happen, the Buffer Streams would be closed (and thu...
I have this Task model: class Task < ActiveRecord::Base acts_as_tree :order => 'sort_order' end And I have this test class TaskTest < Test::Unit::TestCase def setup @root = create_root end def test_destroying_a_task_should_destroy_all_of_its_descendants d1 = create_task(:parent_id => @root.id, :sort_o...
The issue you're encountering arises from the fact that the `before_save` callback `update_descendants_if_necessary` is being executed before the `destroy` method is fully processed for the `d1` task. Here's a deeper look into the problem: 1. **Callbacks and Destroy**: In ActiveRecord, when you call `destroy`, it runs...
14,882
[ { "from": "human", "value": "I have this Task model:\nclass Task < ActiveRecord::Base\n acts_as_tree :order => 'sort_order'\nend\n\nAnd I have this test\nclass TaskTest < Test::Unit::TestCase\n def setup\n @root = create_root\n end\n\n def test_destroying_a_task_should_destroy_all_of_its_descendants\...
I am in the process of designing a .net windows forms application that uses metadata to drive the UI. Apart from finding http://msdn.microsoft.com/en-us/library/ms954610.aspx, I have nothing much to look forward to. Anyone here worked on metadata driven User interfaces? What are the implications of following this metho...
Designing a Windows Forms application that uses metadata to drive the user interface can be a powerful approach, allowing for greater flexibility and adaptability of the UI based on varying requirements or data sources. Here are some implications, benefits, and pointers to consider when adopting a metadata-driven appro...
9,241
[ { "from": "human", "value": "I am in the process of designing a .net windows forms application that uses metadata to drive the UI. Apart from finding http://msdn.microsoft.com/en-us/library/ms954610.aspx, I have nothing much to look forward to. Anyone here worked on metadata driven User interfaces? What are...
I'm working on a project that's been accepted as a proof of concept and is now on the schedule as an actual production project. I'm curious how others approach this transition. I've heard from various sources that when a project starts as a proof of concept it's often a good idea to trash all of the code written durin...
The transition from a proof of concept (PoC) to a production project is a critical stage, and there are several factors to consider when deciding whether to start fresh or refactor existing code. Here’s an overview of some approaches and considerations that can help guide your decision: ### Starting Fresh **Advantages...
13,245
[ { "from": "human", "value": "I'm working on a project that's been accepted as a proof of concept and is now on the schedule as an actual production project. I'm curious how others approach this transition.\nI've heard from various sources that when a project starts as a proof of concept it's often a good i...
I work on an application that uses DCOM to communicate between what are essentially several peers; in the course of normal use, instances on separate machines serve a variety of objects to one another. Historically, for this to work we have used some magic incantations, chief among which is that on every machine the u...
Understanding DCOM (Distributed Component Object Model) authentication is crucial for developing robust applications that communicate over a network. Below is a summary of how DCOM authentication works and some resources for further reading. ### DCOM Authentication Overview 1. **Identity and Authentication**: - D...
14,261
[ { "from": "human", "value": "I work on an application that uses DCOM to communicate between what are essentially several peers; in the course of normal use, instances on separate machines serve a variety of objects to one another. Historically, for this to work we have used some magic incantations, chief a...
Let's say I have data structures that're something like this: Public Class AttendenceRecord Public CourseDate As Date Public StudentsInAttendence As Integer End Class Public Class Course Public Name As String Public CourseID As String Public Attendance As List(Of AttendenceRecord) End Class And I want a tab...
To achieve a horizontally scrollable table where the "Course Name" and "Course ID" remain fixed while the attendance records are scrollable, you can implement this in both ASP.NET (using a GridView with CSS) and WinForms (using a DataGridView). ### ASP.NET Solution You can use a `GridView` and CSS to create a fixed h...
9,728
[ { "from": "human", "value": "Let's say I have data structures that're something like this:\nPublic Class AttendenceRecord\n Public CourseDate As Date\n Public StudentsInAttendence As Integer\nEnd Class\n\nPublic Class Course\n Public Name As String\n Public CourseID As String\n Public Attendance As Lis...
Does the novell gina install a specific security provider that can be used via SSPI? Does it have to called out specifically or is SPNEGO good enough? Will that support single sign on if the novell gina is installed on the remote server?
The Novell GINA (Graphical Identification and Authentication) is a component used in Novell's networking solutions, particularly for integrating Novell services with Windows environments. It acts as a replacement for the standard Windows GINA, enabling authentication to Novell networks and services. ### Security Provi...
18,710
[ { "from": "human", "value": "Does the novell gina install a specific security provider that can be used via SSPI? Does it have to called out specifically or is SPNEGO good enough? Will that support single sign on if the novell gina is installed on the remote server?\n" }, { "from": "gpt", "val...
I have a ASP.NET 2.0 webpage with 2 UserControls (.ascx). Each UserControl contains a bunch of validators. Placing a ValidationSummary on the page will display all validation errors, of both UserControl's. Placing a ValidationSummary in each UserControl will display all the errors of both controls twice. What I want i...
To achieve the desired functionality where each `UserControl` has its own `ValidationSummary` displaying only the validation errors for that particular `UserControl`, you indeed need to use the `ValidationGroup` property effectively. It appears that you're on the right track by dynamically setting the `ValidationGroup`...
12,005
[ { "from": "human", "value": "I have a ASP.NET 2.0 webpage with 2 UserControls (.ascx). Each UserControl contains a bunch of validators. Placing a ValidationSummary on the page will display all validation errors, of both UserControl's. Placing a ValidationSummary in each UserControl will display all the erro...
I know there are HTML entities for 1/2, 1/4, and 3/4, but are there others? Like 1/3 or 1/8? Is there a good way to encode arbitrary fractions?
HTML entities are predefined character codes that represent specific characters in HTML documents. The commonly used HTML entities for fractions include: - `&frac12;` for ½ (one-half) - `&frac14;` for ¼ (one-quarter) - `&frac34;` for ¾ (three-quarters) Unfortunately, there are no standard HTML entities for other frac...
14,776
[ { "from": "human", "value": "I know there are HTML entities for 1/2, 1/4, and 3/4, but are there others? Like 1/3 or 1/8? Is there a good way to encode arbitrary fractions?\n" }, { "from": "gpt", "value": "HTML entities are predefined character codes that represent specific characters in HTML do...
Under Linux, my C++ application is using fork() and execv() to launch multiple instances of OpenOffice so as to view some powerpoint slide shows. This part works. Next I want to be able to move the OpenOffice windows to specific locations on the display. I can do that with the XMoveResizeWindow() function but I need to...
Thank you for sharing your solution for finding X11 windows associated with a specific process ID (PID). It is indeed a useful approach for users who need to manipulate window positions and sizes based on their PID. For those who might be looking at this solution, here’s a brief overview of how the code works: 1. **C...
18,015
[ { "from": "human", "value": "Under Linux, my C++ application is using fork() and execv() to launch multiple instances of OpenOffice so as to view some powerpoint slide shows. This part works.\nNext I want to be able to move the OpenOffice windows to specific locations on the display. I can do that with the ...
Assuming I have only the class name of a generic as a string in the form of "MyCustomGenericCollection(of MyCustomObjectClass)" and don't know the assembly it comes from, what is the easiest way to create an instance of that object? If it helps, I know that the class implements IMyCustomInterface and is from an assemb...
To create an instance of a generic class using a class name in the form of a string, you can follow these steps: 1. Parse the class name to extract the generic type and the type argument. 2. Use reflection to get the type and create an instance of the generic class. Here's a code example in C# to demonstrate how to a...
13,340
[ { "from": "human", "value": "Assuming I have only the class name of a generic as a string in the form of \"MyCustomGenericCollection(of MyCustomObjectClass)\" and don't know the assembly it comes from, what is the easiest way to create an instance of that object? \nIf it helps, I know that the class impleme...
How can I configure an application, or even an entire machine, to use either the server or workstation flavor of the CLR's garbage collection?
To configure an application or an entire machine to use either the server or workstation flavor of the Common Language Runtime (CLR) garbage collection (GC) in .NET, you can utilize several approaches depending on the version of .NET you're working with and whether you want to set this up for individual applications or...
16,042
[ { "from": "human", "value": "How can I configure an application, or even an entire machine, to use either the server or workstation flavor of the CLR's garbage collection? \n" }, { "from": "gpt", "value": "To configure an application or an entire machine to use either the server or workstation f...
Suppose that two tables exist: users and groups. How does one provide "simple search" in which a user enters text and results contain both users and groups whose names contain the text? The result of the search must distinguish between the two types.
To implement a simple search that returns both users and groups based on a text input, you would typically perform two separate queries—one for the `users` table and one for the `groups` table. Then, you would combine the results, making sure to distinguish between the two types in the final output. Here's a general a...
16,165
[ { "from": "human", "value": "Suppose that two tables exist: users and groups.\nHow does one provide \"simple search\" in which a user enters text and results contain both users and groups whose names contain the text?\nThe result of the search must distinguish between the two types.\n" }, { "from": ...
Earlier this week I ask a question about filtering out duplicate values in sequence at run time. Had some good answers but the amount of data I was going over was to slow and not feasible. Currently in our database, event values are not filtered. Resulting in duplicate data values (with varying timestamps). We need to ...
It sounds like you are dealing with a complex scenario where you need to filter duplicate state values (1 or 0) for an event based on incoming timestamps. Your challenges stem from the fact that incoming data can be out of sequence, and your goal is to ensure that only unique state changes are stored in the database, w...
15,088
[ { "from": "human", "value": "Earlier this week I ask a question about filtering out duplicate values in sequence at run time. Had some good answers but the amount of data I was going over was to slow and not feasible.\nCurrently in our database, event values are not filtered. Resulting in duplicate data val...
What are the basic minimum set of Code Analysis rules that you would recommend for a 200K LOC solution? We're using unit testing but code analysis has been turned off. Ideally all rules would be turned on by default but I'd like to do this gently and turn on rules in batches so we do not have to deal with everything a...
When enabling code analysis for a 200K LOC solution, it's wise to approach it gradually to avoid overwhelming your team and to allow them to focus on fixing the most critical issues first. Here’s a recommended minimum set of code analysis rules that you can start with, categorized by priority: ### 1. **Critical Rules ...
17,950
[ { "from": "human", "value": "What are the basic minimum set of Code Analysis rules that you would recommend for a 200K LOC solution? We're using unit testing but code analysis has been turned off. \nIdeally all rules would be turned on by default but I'd like to do this gently and turn on rules in batches s...
This question is not so much programming related as it is deployment related. I find myself conversing a lot with the group in my company whose job it is to maintain our production Windows servers and deploy our code on them. For legal and compliance reasons, I do not have direct visibility or any control over the serv...
In your situation, where you can't directly access the servers and need a reliable way to determine the installed .NET Framework versions, there are several methods you can use. Here's a combination of approaches that could provide a more accurate check for installed .NET versions: ### 1. Registry Check The most reli...
16,175
[ { "from": "human", "value": "This question is not so much programming related as it is deployment related.\nI find myself conversing a lot with the group in my company whose job it is to maintain our production Windows servers and deploy our code on them. For legal and compliance reasons, I do not have dire...
I am VERY new to ASP.NET. I come from a VB6 / ASP (classic) / SQL Server 2000 background. I am reading a lot about Visual Studio 2008 (have installed it and am poking around). I have read about "reflection" and would like someone to explain, as best as you can to an older developer of the technologies I've written a...
Welcome to ASP.NET and the world of .NET development! It's great that you're diving into new technologies. Let's break down what Reflection is and why it's useful. ### What is Reflection? Reflection is a feature in the .NET framework that allows you to inspect and interact with the metadata of types (classes, interfa...
14,751
[ { "from": "human", "value": "I am VERY new to ASP.NET. I come from a VB6 / ASP (classic) / SQL Server 2000 background. I am reading a lot about Visual Studio 2008 (have installed it and am poking around). I have read about \"reflection\" and would like someone to explain, as best as you can to an older d...
What's the difference between the Enabled and the ReadOnly-properties of an asp:TextBox control?
In ASP.NET, the `asp:TextBox` control has several properties that control its behavior and appearance. Two of these properties are `Enabled` and `ReadOnly`. Here’s how they differ: ### Enabled Property - **Definition**: The `Enabled` property determines whether the control is functional and can receive user input. - ...
15,506
[ { "from": "human", "value": "What's the difference between the Enabled and the ReadOnly-properties of an asp:TextBox control?\n" }, { "from": "gpt", "value": "In ASP.NET, the `asp:TextBox` control has several properties that control its behavior and appearance. Two of these properties are `Enabl...
Consider: var something = { wtf: null, omg: null }; My JavaScript knowledge is still horribly patchy since I last programmed with it, but I think I've relearned most of it now. Except for this. I don't recall ever seeing this before. What is it? And where can I learn more about it?
What you are seeing is the declaration of an object in JavaScript using object literal notation. In your example, `something` is an object with two properties: `wtf` and `omg`. Both of these properties are initialized to `null`. Here’s a breakdown of the code: - `var something`: This declares a variable named `someth...
18,282
[ { "from": "human", "value": "Consider:\nvar something = {\n\n wtf: null,\n omg: null\n};\n\nMy JavaScript knowledge is still horribly patchy since I last programmed with it, but I think I've relearned most of it now. Except for this. I don't recall ever seeing this before. What is it? And where ca...
Word 2007 saves its documents in .docx format which is really a zip file with a bunch of stuff in it including an xml file with the document. I want to be able to take a .docx file and drop it into a folder in my asp.net web app and have the code open the .docx file and render the (xml part of the) document as a web pa...
To render the contents of a `.docx` file as HTML in your ASP.NET web application, you'll need to first extract the relevant XML from the `.docx` file, and then convert that XML to HTML. Below, I will address your questions and provide some guidance on how to achieve this. ### 1. Extraction of XML from .docx A `.docx` ...
14,461
[ { "from": "human", "value": "Word 2007 saves its documents in .docx format which is really a zip file with a bunch of stuff in it including an xml file with the document.\nI want to be able to take a .docx file and drop it into a folder in my asp.net web app and have the code open the .docx file and render ...
I have the following preprocessor divective: #ifndef NDEBUG #define TRACE printf #else #define TRACE(...) #endif and example of usage is: TRACE("TRACE: some parameter = %i\n", param); In C all works perfectly well when I build both debug and release versions, but in C++ compiler emits the following: warning: invalid ...
The issue you're facing in C++ stems from the way variadic macros are defined and used. In C++, the variadic macro syntax has some restrictions, and using `...` as a parameter in the `#define` statement can lead to errors. Here's how to modify your `TRACE` macro definition to work correctly in both C and C++: ```cpp ...
18,981
[ { "from": "human", "value": "I have the following preprocessor divective:\n#ifndef NDEBUG\n#define TRACE printf\n#else\n#define TRACE(...)\n#endif\n\nand example of usage is:\nTRACE(\"TRACE: some parameter = %i\\n\", param);\n\nIn C all works perfectly well when I build both debug and release versions, but ...
Ruby has a wealth of conditional constructs, including if/unless, while/until etc. The while block from C: while (condition) { ... } can be directly translated to Ruby: while condition ... end However, I can't seem to find a built-in equivalent in Ruby for a C-like do ... while block in which the block conte...
In Ruby, there isn't a built-in `do ... while` construct like in C, but you can achieve the same behavior using a combination of a `begin ... end` block and `while`. The `begin ... end` structure allows the code inside to execute at least once before checking the condition. Here's how you can do it: ```ruby begin ...
17,621
[ { "from": "human", "value": "Ruby has a wealth of conditional constructs, including if/unless, while/until etc.\nThe while block from C:\nwhile (condition) {\n ...\n}\n\ncan be directly translated to Ruby:\nwhile condition \n ...\nend\n\nHowever, I can't seem to find a built-in equivalent in Ruby for ...
I'm writing a desktop application that communicates with a web service. Would you name all web-service functions that that fetch data LoadXXXX, since they take a while to execute. Or would you use GetXXXX, for instance when getting just a single object.
When naming web service functions, it's essential to choose names that are both intuitive and descriptive of their behavior. Here are some considerations for using `LoadXXXX` versus `GetXXXX`: 1. **Use Case and Performance**: - If the operation generally takes a significant amount of time and may involve loading l...
17,442
[ { "from": "human", "value": "I'm writing a desktop application that communicates with a web service. Would you name all web-service functions that that fetch data LoadXXXX, since they take a while to execute. Or would you use GetXXXX, for instance when getting just a single object.\n" }, { "from": "...
I would like to avoid using native libaries if at all possible. Surely there is a better way to solve this issue for Linux, Windows and Mac OS X.
To provide a more tailored solution, it would be helpful to know what specific issue you're trying to solve. However, here are some general approaches to avoid using native libraries across different operating systems: ### 1. Cross-Platform Frameworks Consider using a cross-platform framework that abstracts away the ...
13,792
[ { "from": "human", "value": "I would like to avoid using native libaries if at all possible. Surely there is a better way to solve this issue for Linux, Windows and Mac OS X.\n" }, { "from": "gpt", "value": "To provide a more tailored solution, it would be helpful to know what specific issue yo...
Okay, I've seen but haven't programmed in C# before. You can assume I'm competent in C++, and advanced in C (for what good that'll do me). I understand inheritance, polymorphism, etc so OO concepts aren't going to be a huge problem. Let's say I've been given a task to prototype a quick and dirty program that won't be...
Hi Adam, Welcome to the world of C#! Since you have a solid background in C and C++, you should find C# relatively easy to pick up. Here are some steps and suggestions to help you get started on your prototype application. ### Database Options For a quick and simple database solution, you might consider the followin...
8,478
[ { "from": "human", "value": "Okay, I've seen but haven't programmed in C# before. You can assume I'm competent in C++, and advanced in C (for what good that'll do me). I understand inheritance, polymorphism, etc so OO concepts aren't going to be a huge problem.\nLet's say I've been given a task to prototy...
I'm looking at introducing multi-lingual support to a mature CGI application written in Perl. I had originally considered rolling my own solution using a Perl hash (stored on disk) for translation files but then I came across a CPAN module which appears to do just what I want (i18n). Does anyone have any experience ...
When it comes to internationalization (i18n) in Perl, using a well-established module from CPAN is generally a good approach, as it saves you the time and effort of rolling your own solution and ensures that you're using a system that's already been tested and refined. The `i18n` module you've mentioned is indeed one ...
16,906
[ { "from": "human", "value": "I'm looking at introducing multi-lingual support to a mature CGI application written in Perl. I had originally considered rolling my own solution using a Perl hash (stored on disk) for translation files but then I came across a CPAN module which appears to do just what I want (...
I'm doing a website for a family member's wedding. A feature they requested was a photo section where all the guests could go after the wedding and upload their snaps. I said this was a stellar idea and I went off to build it. Well there's just the one problem: logistics. Upload speeds are slow and photos from modern c...
Creating a user-friendly, client-side photo upload solution is definitely a great idea for a wedding website. Since you are looking for a solution that involves rotating, resizing, and uploading images while being easy for guests to use, I recommend considering HTML5 and JavaScript, which are more modern alternatives t...
13,558
[ { "from": "human", "value": "I'm doing a website for a family member's wedding. A feature they requested was a photo section where all the guests could go after the wedding and upload their snaps. I said this was a stellar idea and I went off to build it.\nWell there's just the one problem: logistics. Uploa...
I am coming from an Enterprise Java background which involves a fairly heavyweight software stack, and have recently discovered the Stripes framework; my initial impression is that this seems to do a good job of minimising the unpleasant parts of building a web application in Java. Has anyone used Stripes for a projec...
Stripes is a lightweight framework for building web applications in Java that focuses on simplicity and developer productivity. Many developers who come from a heavy Enterprise Java background appreciate Stripes for its streamlined approach, which minimizes boilerplate code and provides a more intuitive way to handle H...
14,553
[ { "from": "human", "value": "I am coming from an Enterprise Java background which involves a fairly heavyweight software stack, and have recently discovered the \nStripes framework; my initial impression is that this seems to do a good job of minimising the unpleasant parts of building a web application in ...
When I have a regular textbox in a UpdatePanel (not an ASP.NET control) with some JavaScript events on it, after the UpdatePanel updates my events are gone. Is there a way to re-attach my events after the update? (Preferably without putting my events inline).
When working with ASP.NET's `UpdatePanel`, the partial postbacks caused by updates can lead to loss of JavaScript event handlers that were attached to elements inside the `UpdatePanel`. This is because the content of the `UpdatePanel` is re-rendered, replacing the previous DOM elements with new ones. To re-attach your...
17,070
[ { "from": "human", "value": "When I have a regular textbox in a UpdatePanel (not an ASP.NET control) with some JavaScript events on it, after the UpdatePanel updates my events are gone. Is there a way to re-attach my events after the update? (Preferably without putting my events inline).\n" }, { "fr...
I am trying to set my DOS environment variable in Ruby, and have it persist after the script exits. For example, if I want a ruby script set_abc_env.rb to set environment variable 'ABC' to 'blah', I expect to run the following: C:> echo %ABC% C:> set_abc_env.rb C:> echo %ABC% blah How do I do this?
In Windows, when you set an environment variable in a script (like a Ruby script), the variable only persists for the duration of the script's execution. Once the script exits, the environment variable you set will not persist in the calling command prompt. To set a persistent environment variable from a Ruby script, ...
17,333
[ { "from": "human", "value": "I am trying to set my DOS environment variable in Ruby, and have it persist after the script exits. For example, if I want a ruby script set_abc_env.rb to set environment variable 'ABC' to 'blah', I expect to run the following:\nC:> echo %ABC%\nC:> set_abc_env.rb\nC:> echo %ABC%...
I'm looking for a code snippet that can delete all emails and text messages on a Windows Mobile device. Preferably the code would delete items in the Sent and Draft folders as well as the Inbox. My platform is Windows Mobile (5.0 SDK) and .net 2.0 compact framework (C# / VB.NET)
To delete emails and text messages on a Windows Mobile device using C# with the .NET Compact Framework, you'll typically use the Microsoft.WindowsMobile.Status and Microsoft.WindowsMobile.PocketOutlook namespaces, as these provide access to the device's messaging and email functionality. Here's an example of how you c...
13,568
[ { "from": "human", "value": "I'm looking for a code snippet that can delete all emails and text messages on a Windows Mobile device. Preferably the code would delete items in the Sent and Draft folders as well as the Inbox. \nMy platform is Windows Mobile (5.0 SDK) and .net 2.0 compact framework (C# / VB.NE...
So I've been thinking of going for Microsoft certification and I have to make a choice (for now) between Windows Forms and WPF for developing Windows applications. I have had good exposure to Windows Forms but never tried WPF before. Furthermore, most of the job postings where I live seem to be WinForms-oriented. That ...
When considering whether to focus on Windows Forms (WinForms) or Windows Presentation Foundation (WPF) for your Microsoft certification and career path, here are some insights to help you make a decision: ### Current Job Market - **WinForms**: Given that you have seen more job postings for WinForms, it indicates a ste...
14,962
[ { "from": "human", "value": "So I've been thinking of going for Microsoft certification and I have to make a choice (for now) between Windows Forms and WPF for developing Windows applications. I have had good exposure to Windows Forms but never tried WPF before. Furthermore, most of the job postings where I...
I'd like to rank a collection of landscape images by making a game whereby site visitors can rate them, in order to find out which images people find the most appealing. What would be a good method of doing that? Hot-or-Not style? I.e. show a single image, ask the user to rank it from 1-10. As I see it, this allows m...
Both methods you mentioned have their merits, but given the scale of your image collection and the engagement goals, I would recommend using the A-or-B (pairwise comparison) method for several reasons: ### Benefits of the A-or-B Method: 1. **Simplicity**: Users only have to make a binary choice rather than assigning s...
15,917
[ { "from": "human", "value": "I'd like to rank a collection of landscape images by making a game whereby site visitors can rate them, in order to find out which images people find the most appealing.\nWhat would be a good method of doing that?\n\nHot-or-Not style? I.e. show a single image, ask the user to r...
I'm trying to profile SQL reporting services, used from ASP.NET application. In SQL profiler all the SQL run by ASP.NET shows up. It looks like the reporting SQL (from the RDL) doesn't show. Is there some setting or filter I'm missing?
When profiling SQL Server Reporting Services (SSRS) from an ASP.NET application using SQL Profiler, you might not see the SQL queries generated by the SSRS if the profiler settings are not correctly configured. Here are some steps to ensure you're capturing the necessary SQL queries: 1. **Enable the Correct Events**: ...
12,808
[ { "from": "human", "value": "I'm trying to profile SQL reporting services, used from ASP.NET application. In SQL profiler all the SQL run by ASP.NET shows up. It looks like the reporting SQL (from the RDL) doesn't show. Is there some setting or filter I'm missing?\n" }, { "from": "gpt", "value":...
I want to double buffer a custom control which contains buttons. I have tried various ways to double buffer the control; SetStyle, BufferedGraphicsContext, and drawing to a bitmap. These all work fine for the custom drawing of the control, but none of them handle drawing the button to a back buffer. How do I achieve ...
To double buffer a custom control that contains buttons, you'll want to ensure that you handle the painting of both the custom control and its buttons correctly. While the techniques you've mentioned (like `SetStyle` for double buffering or using `BufferedGraphicsContext`) are good for custom drawing, handling the butt...
15,229
[ { "from": "human", "value": "I want to double buffer a custom control which contains buttons. I have tried various ways to double buffer the control; SetStyle, BufferedGraphicsContext, and drawing to a bitmap. These all work fine for the custom drawing of the control, but none of them handle drawing the b...
I am running Visual Studio Team Edition 2008. When I create a new website, I get a new file I've never seen before: vwd.webinfo. The contents of this file is as follows: <?xml version="1.0" encoding="UTF-8"?> <VisualWebDeveloper> <!-- Visual Studio global web project settings. --> <StartupServices> <...
The `vwd.webinfo` file in Visual Studio Web Developer (VWD) is used to store global settings and information about the web project. It contains metadata that helps Visual Studio manage and configure various aspects of the project. Here's a breakdown of its purpose and contents: ### Purpose of `vwd.webinfo` 1. **Startu...
17,908
[ { "from": "human", "value": "I am running Visual Studio Team Edition 2008.\n\n\n\nWhen I create a new website, I get a new file I've never seen before: vwd.webinfo.\nThe contents of this file is as follows:\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<VisualWebDeveloper>\n <!-- Visual Studio global web ...
I can get rootmenuitemlefthtml and rootmenuitemrighthtml to emit but not separator. Tried CDATA wrapping and setting SeparatorCssClass. I just want pipes between root menu items. <dnn:SOLPARTMENU runat="server" id="dnnSOLPARTMENU" Separator="<![CDATA[|]]>" SeparatorCssClass="MainMenu_SeparatorCSS" usearrows="fa...
It looks like you're working with a `SolPartMenu` control in DotNetNuke (DNN) and you're trying to add separators between your root menu items. From your description, it seems like the `Separator` property isn't working as expected. Here are a few things you can try to resolve this issue: 1. **Check Separator Proper...
18,833
[ { "from": "human", "value": "I can get rootmenuitemlefthtml and rootmenuitemrighthtml to emit but not separator. Tried CDATA wrapping and setting SeparatorCssClass. I just want pipes between root menu items.\n<dnn:SOLPARTMENU runat=\"server\" id=\"dnnSOLPARTMENU\" Separator=\"<![CDATA[|]]>\" SeparatorCssCla...
I have a few controls that inherit from ASP.NET buttons and use onserverclick. If the user clicks twice, the button fires two server side events. How can I prevent this? I tried setting this.disabled='true' after the click (in the onclick attribute) via javascript, but that blocks the first postback as well.
To prevent double clicks on your ASP.NET buttons while ensuring that the first click properly triggers the server-side event, you can implement a simple JavaScript solution. The idea is to disable the button immediately after it is clicked, but only after a slight delay to allow the first click to complete its postback...
19,818
[ { "from": "human", "value": "I have a few controls that inherit from ASP.NET buttons and use onserverclick.\nIf the user clicks twice, the button fires two server side events. How can I prevent this?\nI tried setting this.disabled='true' after the click (in the onclick attribute) via javascript, but that bl...
In C#, I find myself occasionally wanting to register a method for an event in the middle of a dispatch of that same event. For example, if I have a class that transitions states based on successive dispatches of the same event, I might want the first state's handler to unregister itself and register the second handle...
Yes, the behavior you're observing is indeed guaranteed by the C# language specification and is consistent across different implementations of the language, including Mono. When you add an event handler during the invocation of that event, the addition is handled in a way that the newly added handler is not invoked unt...
18,662
[ { "from": "human", "value": "In C#, I find myself occasionally wanting to register a method for an event in the middle of a dispatch of that same event. For example, if I have a class that transitions states based on successive dispatches of the same event, I might want the first state's handler to unregis...
Let me first say that being able to take 17 million records from a flat file, pushing to a DB on a remote box and having it take 7 minutes is amazing. SSIS truly is fantastic. But now that I have that data up there, how do I remove duplicates? Better yet, I want to take the flat file, remove the duplicates from the fla...
You're right that SSIS (SQL Server Integration Services) can be a powerful tool for moving and transforming data, and removing duplicates is a common requirement in ETL processes. To remove duplicates from a flat file and output the unique records to another flat file, you can follow these steps in an SSIS Data Flow Ta...
14,254
[ { "from": "human", "value": "Let me first say that being able to take 17 million records from a flat file, pushing to a DB on a remote box and having it take 7 minutes is amazing. SSIS truly is fantastic. But now that I have that data up there, how do I remove duplicates?\nBetter yet, I want to take the fla...
I would like to sort a matrix according to a particular column. There is a sort function, but it sorts all columns independently. For example, if my matrix data is: 1 3 5 7 -1 4 Then the desired output (sorting by the first column) would be: -1 4 1 3 5 7 But the output of sort(data) is: -1...
To sort a matrix by a specific column while keeping the rows intact, you can use various methods depending on the programming language you're using. Below are examples in Python using NumPy, and MATLAB. ### In Python with NumPy: You can use the `argsort` function to get the indices that would sort the array based on t...
19,133
[ { "from": "human", "value": "I would like to sort a matrix according to a particular column. There is a sort function, but it sorts all columns independently.\nFor example, if my matrix data is:\n 1 3\n 5 7\n-1 4\n\nThen the desired output (sorting by the first column) would be:\n-1 4\n 1 ...
I'm using the jquery library to load the content of an html file. Something like this: $("#Main").load("login.html") If the file (in this case 'login.html') does not exist, I would like to detect it so that I can redirect the user to an error page for example. Any ideas how I can detect if the file to load exists or no...
You can achieve this by using the jQuery `.load()` method along with a callback function that checks for any errors that may occur during the loading process. If the file does not exist, you can handle that scenario and redirect the user to an error page. Here’s a sample code snippet to illustrate how to do this: ```...
19,528
[ { "from": "human", "value": "I'm using the jquery library to load the content of an html file. Something like this:\n$(\"#Main\").load(\"login.html\")\nIf the file (in this case 'login.html') does not exist, I would like to detect it so that I can redirect the user to an error page for example. Any ideas ho...
I know this is a long shot - but is there any way at all to get code folding into Delphi 7? I'm working on some .. "suboptimal" .. code. Sometimes I really need to fold bits away to grok a stupid-long procedure. Currently I'm pasting code into Notepad++, which works, but it would be nice to have it in the IDE.
Delphi 7 doesn't have built-in support for code folding, as it was released long before this feature became common in IDEs. However, there are some workarounds and third-party tools you can use to enhance your coding experience in Delphi 7: ### 1. **Third-Party IDE Add-ons** There are several third-party add-ons that ...
17,046
[ { "from": "human", "value": "I know this is a long shot - but is there any way at all to get code folding into Delphi 7?\nI'm working on some .. \"suboptimal\" .. code. Sometimes I really need to fold bits away to grok a stupid-long procedure. Currently I'm pasting code into Notepad++, which works, but it w...
I believe I need a DTD to define the schema and an XSLT if I want to display it in a browser and have it look "pretty". But I'm not sure what else I would need to have a well-defined XML document that can be queried using XQuery and displayed in a web browser.
To create a well-defined XML document that can be queried using XQuery and displayed in a web browser, you're on the right track with the DTD (Document Type Definition) and XSLT (Extensible Stylesheet Language Transformations). Here’s a more comprehensive breakdown of what you might need: 1. **XML Document**: This is ...
11,174
[ { "from": "human", "value": "I believe I need a DTD to define the schema and an XSLT if I want to display it in a browser and have it look \"pretty\". But I'm not sure what else I would need to have a well-defined XML document that can be queried using XQuery and displayed in a web browser.\n" }, { ...
Is it possible to define a timestamp column in a MySQL table that will automatically be updated every time a field in the same row is modified? Ideally this column should initially be set to the time a row was inserted. Cheers, Don
Yes, it is possible to define a timestamp column in a MySQL table that automatically updates to the current timestamp whenever any field in the same row is modified. You can achieve this using `TIMESTAMP` or `DATETIME` columns combined with appropriate default and on-update expressions. Here's how you can define such ...
18,778
[ { "from": "human", "value": "Is it possible to define a timestamp column in a MySQL table that will automatically be updated every time a field in the same row is modified? Ideally this column should initially be set to the time a row was inserted.\nCheers,\nDon\n" }, { "from": "gpt", "value": "...
I need to merge a forked project. Unfortunately, the CVS $Id lines are different so the merge tools I tried report that all the files are different (and 95% of them have only this line different) Is there a merge tool that can be configured to ignore line comparison results based on a pattern ? [edit] I discovered tha...
It’s great to hear that you found a solution with WinMerge! Indeed, using line filters is an effective way to handle cases where certain lines, such as the `$Id$` tags in CVS, differ across versions of files but do not affect the actual content. For other users who might face similar issues, here are a few additional ...
19,362
[ { "from": "human", "value": "I need to merge a forked project. \nUnfortunately, the CVS $Id lines are different so the merge tools I tried report that all the files are different (and 95% of them have only this line different)\nIs there a merge tool that can be configured to ignore line comparison results b...
Is there a simpler way than: List<String> newList = new ArrayList<String>(); newList.addAll(listOne); newList.addAll(listTwo); Conditions: Do not modify the original lists. JDK only. No external libraries. Bonus points for a one-liner or a JDK 1.3 version.
Yes, you can create a simpler way to concatenate two lists while adhering to the conditions specified. A more concise method involves using the `Arrays.asList()` and `Collections.addAll()` methods, but for strict JDK 1.3 compatibility, a basic approach using a single line of code can be implemented. ### JDK 1.5 and Ab...
16,800
[ { "from": "human", "value": "Is there a simpler way than:\nList<String> newList = new ArrayList<String>();\nnewList.addAll(listOne);\nnewList.addAll(listTwo);\n\nConditions:\n\nDo not modify the original lists.\nJDK only.\nNo external libraries.\n\nBonus points for a one-liner or a JDK 1.3 version.\n" }, ...
Our CF server occasionally stops processing mail. This is problematic, as many of our clients depend on it. We found suggestions online that mention zero-byte files in the undeliverable folder, so I created a task that removes them every three minutes. However, the stoppage has occurred again. I am looking for sugg...
Diagnosing and fixing issues with mail processing in ColdFusion 8 can be quite challenging, especially when there are no clear error messages or logs to indicate what might be going wrong. Below are some steps and suggestions to help you troubleshoot and potentially resolve the problem: ### 1. **Check ColdFusion Logs*...
14,648
[ { "from": "human", "value": "Our CF server occasionally stops processing mail. This is problematic, as many of our clients depend on it. \nWe found suggestions online that mention zero-byte files in the undeliverable folder, so I created a task that removes them every three minutes. However, the stoppage...
I am trying to copy a file using the following code: File targetFile = new File(targetPath + File.separator + filename); ... targetFile.createNewFile(); fileInputStream = new FileInputStream(fileToCopy); fileOutputStream = new FileOutputStream(targetFile); byte[] buffer = new byte[64*1024]; int i = 0; while((i = fileIn...
The exception you're encountering, `java.io.IOException: The filename, directory name, or volume label syntax is incorrect`, can be caused by several issues when creating a file in Java. Here are some potential reasons why this error might occur, along with troubleshooting steps you can take: 1. **Invalid Characters i...
18,715
[ { "from": "human", "value": "I am trying to copy a file using the following code:\nFile targetFile = new File(targetPath + File.separator + filename);\n...\ntargetFile.createNewFile();\nfileInputStream = new FileInputStream(fileToCopy);\nfileOutputStream = new FileOutputStream(targetFile);\nbyte[] buffer = ...
To pop up the UAC dialog in Vista when writing to the HKLM registry hive, we opt to not use the Win32 Registry API, as when Vista permissions are lacking, we'd need to relaunch our entire application with administrator rights. Instead, we do this trick: ShellExecute(hWnd, "runas" /* display UAC prompt on Vista */, wind...
Yes, it is possible to launch a 64-bit application from a 32-bit application without it being constrained to the WOW64 subsystem, which would otherwise redirect the registry writes to the Wow6432Node. One way to achieve this is to use the `CreateProcess` function instead of `ShellExecute`. With `CreateProcess`, you ca...
14,233
[ { "from": "human", "value": "To pop up the UAC dialog in Vista when writing to the HKLM registry hive, we opt to not use the Win32 Registry API, as when Vista permissions are lacking, we'd need to relaunch our entire application with administrator rights. Instead, we do this trick:\nShellExecute(hWnd, \"run...
What is a non recursive algorithm for deciding whether a passed in amount can be built additively from a set of numbers. In my case I'm determining whether a certain currency amount (such as $40) can be met by adding up some combination of a set of bills (such as $5, $10 and $20 bills). That is a simple example, but t...
To determine whether a specific amount can be constructed from a given set of bills using a non-recursive algorithm, you can use a dynamic programming approach similar to the "knapsack problem". The idea is to build a table that keeps track of whether a certain amount can be formed by the available bills. Here's a non...
10,113
[ { "from": "human", "value": "What is a non recursive algorithm for deciding whether a passed in amount can be built additively from a set of numbers.\nIn my case I'm determining whether a certain currency amount (such as $40) can be met by adding up some combination of a set of bills (such as $5, $10 and $2...
In the linker the binary destination is specified as: $(OutDir)\$(ProjectName).exe I've looked through every setting and I can't see where OutDir is defined. How do I change this?
In a Visual Studio project, the `$(OutDir)` macro specifies the output directory for your build artifacts (like executables, object files, etc.). By default, `OutDir` is usually defined based on the configuration type (Debug/Release) and the project's directory structure. To change the `OutDir` for your project, you c...
18,959
[ { "from": "human", "value": "In the linker the binary destination is specified as:\n$(OutDir)\\$(ProjectName).exe\nI've looked through every setting and I can't see where OutDir is defined. How do I change this?\n" }, { "from": "gpt", "value": "In a Visual Studio project, the `$(OutDir)` macro s...
I have not used generics much and so cannot figure out if it is possible to turn the following three methods into one using generics to reduce duplication. Actually my code currently has six methods but if you can solve it for the three then the rest should just work anyway with the same solution. private object Ev...
You can definitely consolidate your methods using generics! The key is to define a generic method that takes two parameters of a generic type, and a delegate (Func) to handle the arithmetic operations, which will allow us to apply the right operation based on the `Operation` enum. Below is how you can refactor your cod...
15,023
[ { "from": "human", "value": "I have not used generics much and so cannot figure out if it is possible to turn the following three methods into one using generics to reduce duplication. Actually my code currently has six methods but if you can solve it for the three then the rest should just work anyway with...
I want to set a breakpoint on the __DoPostBack method, but it's a pain to find the correct file to set the breakpoint in. The method __DoPostBack is contained in an auto-generated js file called something like: ScriptResource.axd?d=P_lo2... After a few post-backs visual studio gets littered with many of these files,...
Setting breakpoints in auto-generated JavaScript files like those served from `ScriptResource.axd` can indeed be challenging because they are dynamically created and can vary each time the page is loaded. However, here are some strategies you can use to effectively manage this: ### 1. **Use Browser Developer Tools** M...
12,906
[ { "from": "human", "value": "I want to set a breakpoint on the __DoPostBack method, but it's a pain to find the correct file to set the breakpoint in.\nThe method __DoPostBack is contained in an auto-generated js file called something like: \nScriptResource.axd?d=P_lo2...\n\nAfter a few post-backs visual s...
Do you use code-generation tools (aside from those used to generate proxies and from designers built-in to visual studio)? What part(s) of your application do you generate? Do you typically roll your own generator? If so, what type of generator do you write (asp templates, coddom etc.). If not, what 3rd party tools d...
Code generation can significantly speed up development and reduce human error, especially in repetitive tasks. Based on the experiences of various developers, here are some insights into the use of code-generation tools and practices: ### Custom Code Generators vs. Third-Party Tools 1. **Custom Code Generators**: ...
11,873
[ { "from": "human", "value": "Do you use code-generation tools (aside from those used to generate proxies and from designers built-in to visual studio)? \nWhat part(s) of your application do you generate? \nDo you typically roll your own generator? If so, what type of generator do you write (asp templates, c...
Obviously the Java API reference, but what else is there that you all use? I've been doing web development my entire career. Lately I've been messing around a lot with Groovy and I've decided to do a small application in Griffon just to experiment more with Groovy and also break some ground in desktop development. ...
Getting started with desktop application development using Groovy and Griffon can be exciting! Here are some resources and tips that can help you get up to speed: ### Griffon Documentation and Resources: 1. **Griffon User Guide**: This is the official documentation for Griffon, where you can learn about the framework'...
15,711
[ { "from": "human", "value": "Obviously the Java API reference, but what else is there that you all use? \nI've been doing web development my entire career. Lately I've been messing around a lot with Groovy and I've decided to do a small application in Griffon just to experiment more with Groovy and also b...
How can I add an instance variable to a defined class at runtime, and later get and set its value from outside of the class? I'm looking for a metaprogramming solution that allows me to modify the class instance at runtime instead of modifying the source code that originally defined the class. A few of the solutions e...
You can achieve this in Ruby using metaprogramming techniques to define instance variables dynamically at runtime. Specifically, you can use `instance_variable_set` and `instance_variable_get` methods to add and retrieve instance variables respectively. Here's a step-by-step example to illustrate how to add an instan...
17,424
[ { "from": "human", "value": "How can I add an instance variable to a defined class at runtime, and later get and set its value from outside of the class?\nI'm looking for a metaprogramming solution that allows me to modify the class instance at runtime instead of modifying the source code that originally de...
I'm looking for a way to do query auto-completion/suggestions in Lucene. I've Googled around a bit and played around a bit, but all of the examples I've seen seem to be setting up filters in Solr. We don't use Solr and aren't planning to move to using Solr in the near future, and Solr is obviously just wrapping around ...
To implement query auto-completion or suggestions in Lucene without using Solr, you can use a combination of indexing with `EdgeNGramFilter` and a search mechanism that retrieves suggestions based on the input query. Here's a step-by-step guide on how to accomplish this: ### Step 1: Indexing with EdgeNGramFilter 1. *...
12,862
[ { "from": "human", "value": "I'm looking for a way to do query auto-completion/suggestions in Lucene. I've Googled around a bit and played around a bit, but all of the examples I've seen seem to be setting up filters in Solr. We don't use Solr and aren't planning to move to using Solr in the near future, an...
I'm working on a .NET WinForms app that needs to print a FEDEX shipping label. As part of the FedEx api, I can get raw label data for the printer. I just don't know how to send that data to the printer through .NET (I'm using C#). To be clear, the data is already pre formatted into ZPL (Zebra printer language) I ju...
To print raw ZPL (Zebra Programming Language) data directly to a printer in a .NET WinForms application, you can use the `RawPrint` method of the `PrintDocument` class. Here's a basic implementation of how to send ZPL data to a printer without Windows interfering with the raw data format. Here’s how you can do it in C...
13,814
[ { "from": "human", "value": "I'm working on a .NET WinForms app that needs to print a FEDEX shipping label. As part of the FedEx api, I can get raw label data for the printer. \nI just don't know how to send that data to the printer through .NET (I'm using C#). To be clear, the data is already pre formatt...
Assume my objects are in perfect working order (i.e. TDD makes me think they work). I have a list that I create like this (except indented properly): var result = from v in vendors from p in v.Products orderby p.Name select p; This works - I get all products from all vendors. Now...
You're correct in observing that the way you've structured the loop with the `Where` clause only retains the condition for the last attribute in the `requiredAttributes` list. This happens because each iteration of the loop overwrites `result` with a filtered version based on the current attribute. To achieve the desi...
17,384
[ { "from": "human", "value": "Assume my objects are in perfect working order (i.e. TDD makes me think they work).\nI have a list that I create like this (except indented properly):\nvar result = from v in vendors\n from p in v.Products\n orderby p.Name\n select p;\n\nThis ...
I'd like to be able to hook into a 3rd party application to see what SQL Statements are being executed. Specifically, it is a VB6 application running on SQL Server 2005. For example, when the application fills out a grid, I'd like to be able to see exactly what query produced that data.
To capture SQL statements executed by a VB6 application interfacing with SQL Server 2005, you can use several approaches. Here are some methods you can consider: ### 1. SQL Server Profiler SQL Server Profiler is a powerful tool included with SQL Server that allows you to monitor SQL Server events in real-time. Here’s ...
9,878
[ { "from": "human", "value": "I'd like to be able to hook into a 3rd party application to see what SQL Statements are being executed. Specifically, it is a VB6 application running on SQL Server 2005.\nFor example, when the application fills out a grid, I'd like to be able to see exactly what query produced ...
Suppose we have a stylesheet which pulls in metadata using the key() function. In other words we have instance documents like this: <items> <item type="some_type"/> <item type="another_type"/> </items> and a table of additional data we would like to associate with items during processing: <item-meta> <item type="...
You're correct that using key/keyref in XML Schema to refer to elements or attributes in an external document (like your `item-meta` data) isn't supported, as key/keyref only allows referencing elements within the same instance document. This limitation can complicate scenarios like yours, where you want to validate ty...
10,149
[ { "from": "human", "value": "Suppose we have a stylesheet which pulls in metadata using the key() function. In other words we have instance documents like this:\n<items>\n\n<item type=\"some_type\"/>\n\n<item type=\"another_type\"/>\n\n</items>\n\nand a table of additional data we would like to associate w...
I have an excel file which has more than 65536 rows. However, I can see only first 65536 of them. Is it possible to see all of them in Excel 2007?
In Excel 2007 and later versions, the maximum number of rows in a worksheet is 1,048,576. If you can only see the first 65,536 rows, it may be because: 1. **File Format**: If your Excel file is in the older `.xls` format (Excel 97-2003), it is limited to 65,536 rows. You will need to save or convert the file to the `....
20,651
[ { "from": "human", "value": "I have an excel file which has more than 65536 rows. However, I can see only first 65536 of them. Is it possible to see all of them in Excel 2007?\n" }, { "from": "gpt", "value": "In Excel 2007 and later versions, the maximum number of rows in a worksheet is 1,048,57...
In a VB.Net Windows Service I'm currently pooling units of work with: ThreadPool.QueueUserWorkItem(operation, nextQueueID) In each unit of work (or thread I'll use for ease of understanding), it will make a couple MSSQL operations like so: Using sqlcmd As New SqlCommand("", New SqlConnection(ConnString)) ...
In ADO.NET, connection pooling is managed on a per-connection-string basis within a single application domain. This means that all connections that use the same connection string (including the same database, server, and authentication settings) will share a single connection pool. Therefore, in your case, all threads ...
15,612
[ { "from": "human", "value": "In a VB.Net Windows Service I'm currently pooling units of work with: \nThreadPool.QueueUserWorkItem(operation, nextQueueID) \n\nIn each unit of work (or thread I'll use for ease of understanding), it will make a couple MSSQL operations like so: \n Using sqlcmd As New SqlC...
What is the difference between the search() and match() functions in the Python re module? I've read the Python 2 documentation (Python 3 documentation), but I never seem to remember it.
In Python's `re` module, both `search()` and `match()` functions are used to find patterns in strings using regular expressions, but they serve different purposes based on where they look for the pattern in the input string. ### Key Differences: 1. **Location of Search:** - **`match()`**: This function checks for ...
18,365
[ { "from": "human", "value": "What is the difference between the search() and match() functions in the Python re module?\nI've read the Python 2 documentation (Python 3 documentation), but I never seem to remember it.\n" }, { "from": "gpt", "value": "In Python's `re` module, both `search()` and `...
I've not used C++ very much in the past, and have recently been doing a lot of C#, and I'm really struggling to get back into the basics of C++ again. This is particularly tricky as work mandates that none of the most handy C++ constructs can be used, so all strings must be char *'s, and there is no provision for STL l...
Certainly! In C++, managing strings as `char*` can be a bit tricky since it requires you to manually manage memory and ensure that you have proper string management. Below, I'll walk you through how to implement a basic registry of names using `char*` and some basic dynamic memory allocation without using STL. ### Ove...
12,548
[ { "from": "human", "value": "I've not used C++ very much in the past, and have recently been doing a lot of C#, and I'm really struggling to get back into the basics of C++ again. This is particularly tricky as work mandates that none of the most handy C++ constructs can be used, so all strings must be char...
I want to be able to quickly check whether I both have sudo access and my password is already authenticated. I'm not worried about having sudo access specifically for the operation I'm about to perform, but that would be a nice bonus. Specifically what I'm trying to use this for is a script that I want to be runnable b...
To accomplish your goal of checking if you have `sudo` access and whether your password is already authenticated, while allowing for a fallback to ask for the root password, you can follow a specific approach. ### Overview 1. **Check for Sudo Access**: Use the `sudo -n true` command to check if the user has sudo acce...
16,743
[ { "from": "human", "value": "I want to be able to quickly check whether I both have sudo access and my password is already authenticated. I'm not worried about having sudo access specifically for the operation I'm about to perform, but that would be a nice bonus.\nSpecifically what I'm trying to use this fo...
Does SubSonic.SqlQuery have a between/and for date ranges? If not, what would be the best way to get a range.
SubSonic is an ORM (Object-Relational Mapping) framework for .NET that simplifies database interactions. When you're working with date ranges in a SubSonic `SqlQuery`, you typically use a combination of where clauses, specifically `BETWEEN` or using `>=` and `<=`. While SubSonic itself may not provide a direct method ...
18,510
[ { "from": "human", "value": "Does SubSonic.SqlQuery have a between/and for date ranges? If not, what would be the best way to get a range.\n" }, { "from": "gpt", "value": "SubSonic is an ORM (Object-Relational Mapping) framework for .NET that simplifies database interactions. When you're workin...
A while ago I read the Mocks Aren't Stubs article by Martin Fowler and I must admit I'm a bit scared of external dependencies with regards to added complexity so I would like to ask: What is the best method to use when unit testing? Is it better to always use a mock framework to automatically mock the dependencies of t...
When it comes to unit testing, the choice between using a mock framework, stubs, or other forms of test doubles largely depends on the specific requirements of your tests, the complexity of the system, and your team's preferences. Here's a breakdown to help you make an informed decision: ### Understanding Test Doubles...
14,755
[ { "from": "human", "value": "A while ago I read the Mocks Aren't Stubs article by Martin Fowler and I must admit I'm a bit scared of external dependencies with regards to added complexity so I would like to ask:\nWhat is the best method to use when unit testing?\nIs it better to always use a mock framework ...
My team is starting to document our C code using doxygen, paying particular attention to our public API headers. There appears to be a lot of flexibility and different special commands in doxygen, which is great, but it's not clear what's a good thing and what's a bad thing without trial and error. What are your favou...
One of the must-do practices for documenting your C code with Doxygen is to ensure consistency in your comments. This applies not only to the formatting and style of the comments themselves, but also to the terminology and structure used across your API documentation. ### Top Tip #1: Consistency is Key Make sure to us...
13,358
[ { "from": "human", "value": "My team is starting to document our C code using doxygen, paying particular attention to our public API headers. There appears to be a lot of flexibility and different special commands in doxygen, which is great, but it's not clear what's a good thing and what's a bad thing wit...
My team is trying to setup an Apache reverse proxy from a customer's site into one of our web applications. http://www.example.com/app1/some-path maps to http://internal1.example.com/some-path Inside our application we use struts and have redirect = true set on certain actions in order to provide certain functionalit...
To properly handle the redirection and ensure that the users stay within the Apache reverse proxy when your application sends a 302 status message, you can configure your Apache server to rewrite the `Location` header in the response. This way, it will modify the redirect URL to point to the external URL instead of the...
17,912
[ { "from": "human", "value": "My team is trying to setup an Apache reverse proxy from a customer's site into one of our web applications. \nhttp://www.example.com/app1/some-path maps to http://internal1.example.com/some-path \nInside our application we use struts and have redirect = true set on certain actio...
In ruby the library path is provided in $:, in perl it's in @INC - how do you get the list of paths that Python searches for modules when you do an import?
In Python, you can get the list of paths that Python searches for modules during an import by inspecting the `sys.path` list. Here's how you can do it: 1. Import the `sys` module. 2. Print or access `sys.path`. Here’s a simple example: ```python import sys # Print the list of paths that Python searches for modules ...
21,461
[ { "from": "human", "value": "In ruby the library path is provided in $:, in perl it's in @INC - how do you get the list of paths that Python searches for modules when you do an import?\n" }, { "from": "gpt", "value": "In Python, you can get the list of paths that Python searches for modules duri...
Is there any way so that i can echo password when asked for in unix shell without use of external binaries ? Something like simple function triggered when password prompt is displayed
In a Unix shell, password prompts (like when using `sudo`, `su`, or other commands) are designed to not echo input for security reasons. However, if you want to create a custom command or function that handles password input without echoing, you can use built-in shell features. Here's how you can do it with a simple s...
19,613
[ { "from": "human", "value": "Is there any way so that i can echo password when asked for in unix shell without use of external binaries ? Something like simple function triggered when password prompt is displayed\n" }, { "from": "gpt", "value": "In a Unix shell, password prompts (like when using...
I have an AdvancedDataGrid with a GroupingCollection and a SummaryRow. How do I display the summary row data in bold? Below is my code: <mx:AdvancedDataGrid width="100%" height="100%" id="adg" defaultLeafIcon="{null}" > <mx:dataProvider> <mx:GroupingCollection id="gc" source="{dataProvider}"> ...
To display the summary row data in bold within an `AdvancedDataGrid` with a `SummaryRow`, you will need to customize the rendering of that row. This typically involves using a custom item renderer to style the summary row according to your needs. Here's how you can implement it: 1. **Create a custom item renderer** t...
16,310
[ { "from": "human", "value": "I have an AdvancedDataGrid with a GroupingCollection and a SummaryRow. How do I display the summary row data in bold? Below is my code:\n<mx:AdvancedDataGrid width=\"100%\" height=\"100%\" id=\"adg\" defaultLeafIcon=\"{null}\" > \n <mx:dataProvider>\n <mx:GroupingColl...
When I measure request times on "the inside" of an Asp.Net application and compare it to timings on "the outside" of the app, I get different values -- 1000-5000ms strange overheads from time to time. Maybe the requests are beeing queued up in front of IIS? Or something strange is going on in an HttpModule? The quest...
Yes, there are several ways to inspect the ASP.NET request pipeline and trace where time is spent before your application logic is hit. Here are some approaches you can take to diagnose the issue: ### 1. **ASP.NET Tracing** ASP.NET provides built-in tracing capabilities that allow you to log the time taken by various ...
16,239
[ { "from": "human", "value": "When I measure request times on \"the inside\" of an Asp.Net application and compare it to timings on \"the outside\" of the app, I get different values -- 1000-5000ms strange overheads from time to time. \nMaybe the requests are beeing queued up in front of IIS? \nOr something ...
I have a project that I'm working on and I need to be able to print out ID cards from the program. Are there any products out there that are reasonably priced so I can design a document for print and use it in .NET? I'm trying to avoid using System.Drawing from having to do it manually because when the company I work f...
Certainly! There are several products and libraries available that can help you design and print ID cards within a .NET environment without having to manually manipulate graphics through `System.Drawing`. Here are some options: ### 1. **Crystal Reports** Crystal Reports is a powerful reporting tool that allows you to ...
15,977
[ { "from": "human", "value": "I have a project that I'm working on and I need to be able to print out ID cards from the program. Are there any products out there that are reasonably priced so I can design a document for print and use it in .NET? I'm trying to avoid using System.Drawing from having to do it m...
I am using Infopath forms to collect information to trigger my Windows Workflow sitting on Sharepoint 2007. The Infopath forms have logo's and branding which only show up on the Sharepoint portal but the infopath forms which are emailed when tasks are created during the workflow look different as in the background colo...
When dealing with InfoPath forms and SharePoint 2007 workflows, it's not uncommon to encounter issues with branding and formatting, especially when forms are rendered in different contexts (like SharePoint vs. email). Here are some troubleshooting tips and ideas to help you address the discrepancy in appearance between...
16,904
[ { "from": "human", "value": "I am using Infopath forms to collect information to trigger my Windows Workflow sitting on Sharepoint 2007. The Infopath forms have logo's and branding which only show up on the Sharepoint portal but the infopath forms which are emailed when tasks are created during the workflow...
I'm implementing a simple service using datagrams over unix local sockets (AF_UNIX address family, i.e. not UDP). The server is bound to a public address, and it receives requests just fine. Unfortunately, when it comes to answering back, sendto fails unless the client is bound too. (the common error is Transport en...
In Unix domain sockets, there are two types: stream (SOCK_STREAM) and datagram (SOCK_DGRAM). The behavior you observed with datagram sockets is indeed a bit different than that of stream sockets when it comes to binding and addressing. ### Understanding the Issue: When you create a datagram socket and bind it to a spe...
13,096
[ { "from": "human", "value": "I'm implementing a simple service using datagrams over unix local sockets (AF_UNIX address family, i.e. not UDP). The server is bound to a public address, and it receives requests just fine. Unfortunately, when it comes to answering back, sendto fails unless the client is boun...
I am testing a web app that writes cookies to subdomain.thisdomain.com and several subfolders within that. I'm looking for JavaScript that I can put into a bookmarklet that will delete all cookies under that subdomain, regardless of the folder in which they exist. Any ideas?
Certainly! You can create a bookmarklet that will delete all cookies for a specific subdomain by using JavaScript to iterate through the `document.cookie` object and clear each cookie. Here’s a small snippet of code that you can convert into a bookmarklet to delete all cookies for `subdomain.thisdomain.com`. ### JavaS...
17,519
[ { "from": "human", "value": "I am testing a web app that writes cookies to subdomain.thisdomain.com and several subfolders within that. I'm looking for JavaScript that I can put into a bookmarklet that will delete all cookies under that subdomain, regardless of the folder in which they exist.\nAny ideas?\n"...
What is a good mobile programming platform to go with for a c++ developer? Is learning android a good option?
As a C++ developer, you have several good options for mobile programming platforms, and learning Android development can be a valuable choice. Here are some considerations: ### Android Development: 1. **Kotlin/Java**: The primary languages for Android development are Kotlin and Java. While these are not C++, learning ...
16,711
[ { "from": "human", "value": "What is a good mobile programming platform to go with for a c++ developer? \nIs learning android a good option?\n" }, { "from": "gpt", "value": "As a C++ developer, you have several good options for mobile programming platforms, and learning Android development can b...
We get sometimes the following error from our partner's database: <i>ORA-01438: value larger than specified precision allows for this column</i> The full response looks like the following: <?xml version="1.0" encoding="windows-1251"?> <response> <status_code></status_code> <error_text>ORA-01438: value larger than ...
The error message "ORA-01438: value larger than specified precision allows for this column" indicates that there is an attempt to insert or update a value in a database column that exceeds the defined precision for that column. This typically occurs in the context of numeric data types, where a column is defined with a...
19,063
[ { "from": "human", "value": "We get sometimes the following error from our partner's database:\n<i>ORA-01438: value larger than specified precision allows for this column</i>\n\nThe full response looks like the following:\n<?xml version=\"1.0\" encoding=\"windows-1251\"?>\n<response>\n <status_code></statu...
I've always handled optional parameters in JavaScript like this: function myFunc(requiredArg, optionalArg){ optionalArg = optionalArg || 'defaultValue'; // Do stuff } Is there a better way to do it? Are there any cases where using || like that is going to fail?
Yes, while your method of handling optional parameters using the logical OR (`||`) operator is commonly used in JavaScript, there are some considerations and potential pitfalls you should be aware of. ### Potential Issues with `||` for Default Values Using `||` can lead to unexpected results when the `optionalArg` c...
17,391
[ { "from": "human", "value": "I've always handled optional parameters in JavaScript like this:\nfunction myFunc(requiredArg, optionalArg){\n optionalArg = optionalArg || 'defaultValue';\n\n // Do stuff\n}\n\nIs there a better way to do it?\nAre there any cases where using || like that is going to fail?\n" ...
I am trying to convert an int into three bytes representing that int (big endian). I'm sure it has something to do with bit-wise and and bit shifting. But I have no idea how to go about doing it. For example: int myInt; // some code byte b1, b2 , b3; // b1 is most significant, then b2 then b3. *Note, I am aware tha...
You can convert an integer into three bytes representing that integer in big-endian order using bitwise operations and bit shifting. Since you want to represent a 4-byte integer using only 3 bytes, you will discard the least significant byte. Here's how you can do this in C: ```c #include <stdio.h> int main() { ...
18,375
[ { "from": "human", "value": "I am trying to convert an int into three bytes representing that int (big endian).\nI'm sure it has something to do with bit-wise and and bit shifting. But I have no idea how to go about doing it.\nFor example:\nint myInt;\n\n// some code\n\nbyte b1, b2 , b3; // b1 is most sign...
Hopefully this will not spark a religious war... We have a web based app in RoR based on an earlier version we build in .net 2.0. So we currently have both .net and RoR skills in house. We want to add a RIA app that interfaces with the rails web app. This should be capable of running offine, with some (perhaps relatio...
Hi Dominic, It's great that you're considering the strengths of your existing team while planning your new RIA (Rich Internet Application). Here are some thoughts to help you make a more informed decision regarding the technology stack for your application: 1. **Silverlight vs. Other Frameworks**: - **Silverlight...
17,112
[ { "from": "human", "value": "Hopefully this will not spark a religious war...\nWe have a web based app in RoR based on an earlier version we build in .net 2.0. So we currently have both .net and RoR skills in house. \nWe want to add a RIA app that interfaces with the rails web app. This should be capable of...
I'm writing some cross-platform code between Windows and Mac. If list::end() "returns an iterator that addresses the location succeeding the last element in a list" and can be checked when traversing a list forward, what is the best way to traverse the list backwards? This code works on the Mac but not on Windows (can...
In C++, the standard library `std::list` provides bidirectional iterators, which allows you to traverse the list in both forward and backward directions. However, when you use `list::end()`, it refers to an iterator that points one past the last element, and you cannot decrement this iterator beyond `end()`. ### Trave...
17,411
[ { "from": "human", "value": "I'm writing some cross-platform code between Windows and Mac.\nIf list::end() \"returns an iterator that addresses the location succeeding the last element in a list\" and can be checked when traversing a list forward, what is the best way to traverse the list backwards?\nThis ...