instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
Assume I have an ASP.NET MVC app that's not doing anything too fancy (no P/Invoke, no unsafe, etc). I've considered the idea of running on Mono to support Linux, among other platforms. I haven't used Mono in a long time. What are the top issues I'm likely to face?
Running an ASP.NET MVC application on Mono can offer cross-platform capabilities, but there are several challenges and potential issues you might encounter. Here are some of the top issues you may face when transitioning your ASP.NET MVC app to run on Mono: 1. **Framework Compatibility**: While Mono has made strides i...
49,318
[ { "from": "human", "value": "Assume I have an ASP.NET MVC app that's not doing anything too fancy (no P/Invoke, no unsafe, etc).\nI've considered the idea of running on Mono to support Linux, among other platforms. I haven't used Mono in a long time. What are the top issues I'm likely to face?\n" }, { ...
I have a large .NET web application. The system has projects for different intentions (e.g. CMS, Forum, eCommerce), and I have noticed a (naive) pattern of calling on another project's class. For example, the ecommerce module needs functionality to generate a file on the fly for products, and I call and reference a met...
Reducing coupling in a large .NET application, especially one that has multiple distinct modules (like CMS, Forum, eCommerce), can significantly improve maintainability and scalability. Here are some strategies you can implement to achieve this, along with explanations of how they help reduce coupling: ### 1. **Interf...
44,126
[ { "from": "human", "value": "I have a large .NET web application. The system has projects for different intentions (e.g. CMS, Forum, eCommerce), and I have noticed a (naive) pattern of calling on another project's class. For example, the ecommerce module needs functionality to generate a file on the fly for...
I need to be able to export Trac tickets from a report or custom query to Excel, including the ticket description. The catch is that the description must be formatted as defined by the wiki syntax rather than displaying the raw text.
Exporting Trac tickets to Excel while retaining the formatted wiki syntax for descriptions can be accomplished with a few steps. Here’s a general approach to achieving this: ### Step 1: Custom Query 1. **Create a Custom Query in Trac:** - Go to the `Query` page in Trac. - Write a custom query to filter the tick...
47,785
[ { "from": "human", "value": "I need to be able to export Trac tickets from a report or custom query to Excel, including the ticket description. The catch is that the description must be formatted as defined by the wiki syntax rather than displaying the raw text.\n" }, { "from": "gpt", "value": "...
what is the best way to track and lower GDI windows handles . .
Tracking and lowering GDI (Graphics Device Interface) handles in Windows can be crucial for maintaining system stability and performance, especially in applications that create and manage a large number of graphical objects, such as windows, icons, or fonts. Here are some strategies for tracking and lowering GDI handle...
45,933
[ { "from": "human", "value": "what is the best way to track and lower GDI windows handles . . \n" }, { "from": "gpt", "value": "Tracking and lowering GDI (Graphics Device Interface) handles in Windows can be crucial for maintaining system stability and performance, especially in applications tha...
How effective is naive Bayesian filtering for filtering spam? I heard that spammers easily bypass them by stuffing extra non-spam-related words. What programming techniques can you use with Bayesian filters to prevent that?
Naive Bayes filtering is a popular technique for spam detection due to its simplicity, efficiency, and ability to handle large datasets. It works by calculating the probability that an email is spam based on the occurrence of certain words or phrases, learning from a dataset of labeled emails. However, like any method,...
48,634
[ { "from": "human", "value": "How effective is naive Bayesian filtering for filtering spam?\nI heard that spammers easily bypass them by stuffing extra non-spam-related words. What programming techniques can you use with Bayesian filters to prevent that?\n" }, { "from": "gpt", "value": "Naive Ba...
I've got a couple simple Windows Forms apps that I'd like to add crash reporting to. Something that will give me info on what crashes are happening on user's machines (wrt my app, of course), including stack traces, logs, and screenshots, and a UI component for asking the user whether they want to upload it, etc. My ap...
For adding crash reporting to your Windows Forms applications, there are a few free options you can consider that provide crash logging, stack traces, logs, and sometimes even user interface components for feedback. Here are some suggestions: ### 1. **ELMAH (Error Logging Modules and Handlers)** While originally desig...
48,635
[ { "from": "human", "value": "I've got a couple simple Windows Forms apps that I'd like to add crash reporting to. Something that will give me info on what crashes are happening on user's machines (wrt my app, of course), including stack traces, logs, and screenshots, and a UI component for asking the user w...
I'm loading the XML in, and I'm able to read the XML nodes into text fields in my flash. It is also loading the URL, but the last one from the loop. It's not loading the one that I click on. I tried using event.target, but that is not working. I'm pretty close to figuring it out, I'm just not sure where to look. // loa...
It looks like you're close to the solution! The issue you're facing is that the `trackURL` isn't being dynamically associated with the clicked track. You need to correctly reference the corresponding URL for the clicked item in the `onClickLoadData` function. In your current code, you're playing the URL from `tracksA...
48,731
[ { "from": "human", "value": "I'm loading the XML in, and I'm able to read the XML nodes into text fields in my flash. It is also loading the URL, but the last one from the loop. It's not loading the one that I click on. I tried using event.target, but that is not working. I'm pretty close to figuring it out...
I am considering using Maven for a Java open source project I manage. In the past, however, Maven has not always had the best reputation. What are your impressions of Maven, at this time?
Maven has long been a popular build automation tool for Java projects, and it has both its strengths and weaknesses. As of my last knowledge update in October 2023, here are some insights into Maven's current standing and considerations for using it in your open-source project: ### Strengths of Maven: 1. **Standardiza...
48,575
[ { "from": "human", "value": "I am considering using Maven for a Java open source project I manage.\nIn the past, however, Maven has not always had the best reputation. What are your impressions of Maven, at this time? \n" }, { "from": "gpt", "value": "Maven has long been a popular build automat...
What's the best way to view the data that LoadPostData event is loading to the controls in ASP.NET?
In ASP.NET Web Forms, the `LoadPostData` event is part of the ASP.NET page lifecycle and is primarily used for custom input handling, especially when dealing with complex controls or when you want to manually process posted data before it is bound to controls. When this event is triggered, the server is receiving data ...
48,250
[ { "from": "human", "value": "What's the best way to view the data that LoadPostData event is loading to the controls in ASP.NET? \n" }, { "from": "gpt", "value": "In ASP.NET Web Forms, the `LoadPostData` event is part of the ASP.NET page lifecycle and is primarily used for custom input handling,...
I just finished reading this post: https://developer.yahoo.com/performance/rules.html#flush and have already implemented a flush after the top portion of my page loads (head, css, top banner/search/nav). Is there any performance hit in flushing? Is there such a thing as doing it too often? What are the best practices? ...
Flushing content in web development refers to the practice of sending part of the response to the client before the entire document is fully generated. This can enhance perceived performance by allowing users to see and interact with parts of the webpage sooner. However, there are some considerations to keep in mind re...
46,468
[ { "from": "human", "value": "I just finished reading this post: https://developer.yahoo.com/performance/rules.html#flush and have already implemented a flush after the top portion of my page loads (head, css, top banner/search/nav).\nIs there any performance hit in flushing? Is there such a thing as doing i...
I'm working on a JavaScript image resizing feature which rely on the IE only DXImageTransform addon. Wanting to address modern browsers as well, I gave a shot to canvas, with pretty good results. However, I face an issue in my resize function, which is the following: function Resize(oObj, flMultiplier) { var ...
You're encountering a common issue when using a canvas for image resizing, especially when the resized image might exceed the canvas dimensions. Here are two strategies you can try to solve the problem: ### Option 1: Adjusting the Canvas Size Dynamically You can adjust the size of the canvas element dynamically based...
48,696
[ { "from": "human", "value": "I'm working on a JavaScript image resizing feature which rely on the IE only DXImageTransform addon.\nWanting to address modern browsers as well, I gave a shot to canvas, with pretty good results.\nHowever, I face an issue in my resize function, which is the following:\n\nfuncti...
How can I send a DELETE request with delphi 7 and the ICS component so that I can access a REST api?
To send a DELETE request to a REST API using Delphi 7 with the ICS (Internet Component Suite), you will need to set up the appropriate components provided by the ICS library. Here's a step-by-step guide to accomplish this: 1. **Install ICS**: Make sure you have the ICS library installed in your Delphi 7 environment. Y...
47,454
[ { "from": "human", "value": "How can I send a DELETE request with delphi 7 and the ICS component so that I can access a REST api?\n" }, { "from": "gpt", "value": "To send a DELETE request to a REST API using Delphi 7 with the ICS (Internet Component Suite), you will need to set up the appropriat...
I'm currently developing an OSGi based application (using Equinox) by trying to mavenize a web tutorial I've found on OSGi+Equinox. In this project, there are bundles depending on other bundles (quote-service depends on quote). The compile phase does succeed, but the package phase does not. Maven complains the followin...
The error you are facing indicates that the `quote-service` bundle cannot resolve its dependency on the `quote` bundle during the package phase. This could stem from a few potential issues in your Maven POMs or the bundle manifest files. Here are some steps to troubleshoot and fix the problem: ### 1. Correct Import-Pa...
49,422
[ { "from": "human", "value": "I'm currently developing an OSGi based application (using Equinox) by trying to mavenize a web tutorial I've found on OSGi+Equinox. In this project, there are bundles depending on other bundles (quote-service depends on quote).\nThe compile phase does succeed, but the package ph...
Can an Ajax-enabled WCF Service pass back a DataTable as a Sys.Data.DataTable? Like this but in WCF. My OperationContract looks like: [OperationContract] public DataTable GetEmployees() { NorthwindService ns = new NorthwindService(); return ns.GetEmployees(); } Through the Firefox error...
In WCF, returning a `DataTable` directly as a return type is not a common practice. WCF typically serializes data types into XML or JSON format, and a `DataTable` may not serialize cleanly out of the box for AJAX calls. Instead of using `DataTable`, it's often better to create a custom data transfer object (DTO) that r...
47,597
[ { "from": "human", "value": "Can an Ajax-enabled WCF Service pass back a DataTable as a Sys.Data.DataTable?\nLike this but in WCF.\nMy OperationContract looks like:\n [OperationContract]\n public DataTable GetEmployees()\n {\n NorthwindService ns = new NorthwindService();\n return ns....
A common argument against using .NET for high volume, transactional enterprise systems is that IIS does not compare to the likes of Weblogic and websphere for java. Is this true? Unfortunately for .NET web apps IIS is the only option as an application server. Does anyone have any arguments against this? I would like to...
Promoting .NET for high-volume, transactional enterprise systems can be a viable option, and it's important to address the common concerns, particularly regarding IIS as the primary web server. Here are some arguments and points to consider that can strengthen your case for .NET in the enterprise: ### 1. **Performance...
47,958
[ { "from": "human", "value": "A common argument against using .NET for high volume, transactional enterprise systems is that IIS does not compare to the likes of Weblogic and websphere for java. Is this true? Unfortunately for .NET web apps IIS is the only option as an application server. Does anyone have an...
Does anybody have an implementation of Cuckoo hashing in C? If there was an Open Source, non GPL version it would be perfect! Since Adam mentioned it in his comment, anyone knows why it is not much used? Is it just a matter of implementation or the good theoretical properties do not materialize in practice?
Cuckoo hashing is a great choice for a hash table due to its efficient space usage and average constant-time lookups. If you're looking for a C implementation that is open source and not GPL, consider looking at repositories under permissive licenses like MIT, Apache, or BSD. Here’s a simple implementation of Cuckoo ha...
35,277
[ { "from": "human", "value": "Does anybody have an implementation of Cuckoo hashing in C? If there was an Open Source, non GPL version it would be perfect!\nSince Adam mentioned it in his comment, anyone knows why it is not much used? Is it just a matter of implementation or the good theoretical properties d...
This is often situation, but here is latest example: Companies have various contact data (addresses, phone numbers, e-mails...) when they make job ad, they have checkboxes where they choose how they want to be contacted. It is basically descriptive data. User when reading an ad sees something like "You can apply by ma...
In scenarios where you have a set of contact options with mostly uniform behavior but with some that have special conditions (like "email" and "web portal"), you can manage this complexity through a combination of data structure, validation, and user interface design. Here are some steps to achieve this: ### 1. Define...
47,469
[ { "from": "human", "value": "This is often situation, but here is latest example: \nCompanies have various contact data (addresses, phone numbers, e-mails...) when they make job ad, they have checkboxes where they choose how they want to be contacted. It is basically descriptive data. User when reading an a...
I have a 'loader app' that loads a menu and when user clicks the menu image button a list view opens based on the text (if text = employee) (Go to class A) (Go to class B) ... ... (Show List View Window) if he clicks again on the same button it opens again, I would like to prevent this. i.e but this ...
In a WPF application, if you want to prevent the user from opening the same ListView window multiple times by clicking the same menu button, you can use a boolean flag to track the state of the opened window or simply check if the window is already open before creating a new instance of it. Here's an example of how yo...
49,434
[ { "from": "human", "value": "I have a 'loader app' that loads a menu and when user clicks the menu image button a list view opens based on the text \n(if text = employee) \n(Go to class A) \n(Go to class B) \n ...\n ...\n (Show List View Window) \n\nif he clicks again on the same button it opens a...
I still have a large number of floppies. On some of them there probably is source code I don't want to lose. I also don't want to take look at each one individually, as that's going to take a lot of time. What software would be best for copying all data to a hard disk, preferably while creating an index at the same tim...
To help you transfer your floppy disk data to a hard disk while creating an index, you have a few options for both Windows and Mac. Here’s a breakdown: ### For Windows: 1. **WinImage**: - WinImage can create images of floppy disks and supports various disk formats. You can automate the process using command-line a...
49,518
[ { "from": "human", "value": "I still have a large number of floppies. On some of them there probably is source code I don't want to lose. I also don't want to take look at each one individually, as that's going to take a lot of time. What software would be best for copying all data to a hard disk, preferabl...
It's been a while since I was in college and knew how to calculate a best fit line, but I find myself needing to. Suppose I have a set of points, and I want to find the line that is the best of those points. What is the equation to determine a best fit line? How would I do that with PHP?
The best fit line for a set of points in two-dimensional space can be determined using linear regression, specifically by calculating the line that minimizes the sum of the squared distances (the vertical distances) from the points to the line. The equation of the best fit line can be expressed in the form: \[ y = mx ...
45,041
[ { "from": "human", "value": "It's been a while since I was in college and knew how to calculate a best fit line, but I find myself needing to. Suppose I have a set of points, and I want to find the line that is the best of those points.\nWhat is the equation to determine a best fit line?\nHow would I do tha...
I have a form in which the user can choose a component type from a combo box, and depending on that component they may or may not be able to choose a data type from another combo box. When the user selects a component type, client-side javascript fires on the change and sets the value of the data-type combo box if requ...
The behavior you're experiencing is indeed tied to how browsers handle form submissions with disabled form elements. When you disable a form element (like your combo box), it will not be included in the form submission. This means that if the combo box is disabled, its value won't be sent to the server, which is why yo...
45,753
[ { "from": "human", "value": "I have a form in which the user can choose a component type from a combo box, and depending on that component they may or may not be able to choose a data type from another combo box.\nWhen the user selects a component type, client-side javascript fires on the change and sets th...
I have a recordset that contains only 1 record but I need to display the result (10 fields) in 2 columns with matching label the textbox doesn't have a datasetname property. how can i display 10 fields in 2 columns ?
To display a single recordset containing 10 fields in two columns with matching labels, you can create a simple layout in a form or a report using a combination of textboxes and labels. Here’s how you can achieve this in different environments: ### In a Windows Forms Application (C#): 1. **Create your layout**: - ...
45,931
[ { "from": "human", "value": "I have a recordset that contains only 1 record but I need to display the result (10 fields)\nin 2 columns with matching label\nthe textbox doesn't have a datasetname property.\nhow can i display 10 fields in 2 columns ?\n" }, { "from": "gpt", "value": "To display a s...
The JFileChooser seems to be missing a feature: a way to suggest the file name when saving a file (the thing that usually gets selected so that it would get replaced when the user starts typing). Is there a way around this?
In Java's `JFileChooser`, you can indeed set a default file name for a save operation, but it won't be selected automatically as the user types. However, you can work around this limitation by using the `setSelectedFile()` method to suggest a default file name. When you do this, the suggested file name will appear in t...
49,253
[ { "from": "human", "value": "The JFileChooser seems to be missing a feature: a way to suggest the file name when saving a file (the thing that usually gets selected so that it would get replaced when the user starts typing).\nIs there a way around this?\n" }, { "from": "gpt", "value": "In Java's...
I need to know how I can search an array for some literal text and have it used as a condition whether to continue. Here's why: Each time I execute a function I am pushing the ID of the property it acts upon into an array. I need my function to check if that ID is in the array already and if it is, remove it and execut...
It looks like you want to create a function that checks if an ID is already present in a 2D array, and based on that, either remove it and execute an "opposite" function or add it and execute a different function. However, the `grep` method isn't available in JavaScript. Instead, you can use the `Array.prototype.some()...
47,287
[ { "from": "human", "value": "I need to know how I can search an array for some literal text and have it used as a condition whether to continue.\nHere's why:\nEach time I execute a function I am pushing the ID of the property it acts upon into an array. I need my function to check if that ID is in the array...
I'm refactoring some client-server code and it uses the terms Response, Result & Reply for the same thing (an answer from the server). And although its not really that important it's become hard to guess which word to use while writing new code, so I'd like to unify the three terms into one and do the appropriate refac...
When it comes to naming conventions in client-server communication, the choice between "Response," "Result," and "Reply" can influence clarity and consistency in your code. Here’s a breakdown of each term and recommendations for unifying them: 1. **Response**: - This term is widely used in various communication pr...
49,682
[ { "from": "human", "value": "I'm refactoring some client-server code and it uses the terms Response, Result & Reply for the same thing (an answer from the server). And although its not really that important it's become hard to guess which word to use while writing new code, so I'd like to unify the three te...
I hope someone can guide me as I'm stuck... I need to write an emergency broadcast system that notifies workstations of an emergency and pops up a little message at the bottom of the user's screen. This seems simple enough but there are about 4000 workstations over multiple subnets. The system needs to be almost realti...
You're dealing with a challenging situation, especially with the scale of your deployment and the limitations of your network infrastructure. Here are some potential solutions and considerations that might help you move forward with your emergency broadcast system: ### 1. **Use a Centralized Messaging System** Instead...
48,600
[ { "from": "human", "value": "I hope someone can guide me as I'm stuck... I need to write an emergency broadcast system that notifies workstations of an emergency and pops up a little message at the bottom of the user's screen. This seems simple enough but there are about 4000 workstations over multiple subn...
I'm getting the following error when trying to compile C++ projects using intel compiler version 10.0.025 on vista business edition (sp1) in vs2008: unable to obtain mapped memory (see pch_diag.txt) There is no such file as pch_diag, so that's a bit disheartening. If I try to just use the microsoft compiler, all of ...
The error message you're encountering, "unable to obtain mapped memory," often indicates that the Intel compiler is having trouble allocating the memory it needs to process precompiled headers. Since you're using an older version of the Intel compiler (10.0.025) on Windows Vista, there are a few steps you can take to t...
49,219
[ { "from": "human", "value": "I'm getting the following error when trying to compile C++ projects using intel compiler version 10.0.025 on vista business edition (sp1) in vs2008:\nunable to obtain mapped memory (see pch_diag.txt)\n\nThere is no such file as pch_diag, so that's a bit disheartening. \nIf I tr...
I have a business user who tried his hand at writing his own SQL query for a report of project statistics (e.g. number of tasks, milestones, etc.). The query starts off declaring a temp table of 80+ columns. There are then almost 70 UPDATE statements to the temp table over almost 500 lines of code that each contain the...
Improving the performance and maintainability of the SQL query while ensuring it adheres to best practices involves multiple strategies. Here are some key areas to focus on: ### 1. **Analyze the Temp Table Structure** - **Column Reduction**: Evaluate whether all 80 columns are necessary. Reducing the number of colu...
48,007
[ { "from": "human", "value": "I have a business user who tried his hand at writing his own SQL query for a report of project statistics (e.g. number of tasks, milestones, etc.). The query starts off declaring a temp table of 80+ columns. There are then almost 70 UPDATE statements to the temp table over almos...
I have a local git repository which tracks a remote SVN repository via git svn. I have made and committed some changes in the local git repository, but now I'd like to create a branch that reflects SVN HEAD in order to make some changes to the code as it stands in SVN, because I don't want to propagate the changes in ...
To create a branch in your local Git repository that reflects the current state of the SVN repository (SVN HEAD), follow these steps: 1. **Fetch the latest from SVN** to ensure your local git-svn repository is up-to-date. This does not change your working directory or branches: ```bash git svn fetch ``` 2...
45,788
[ { "from": "human", "value": "I have a local git repository which tracks a remote SVN repository via git svn. I have made and committed some changes in the local git repository, but now I'd like to create a branch that reflects SVN HEAD in order to make some changes to the code as it stands in SVN, because ...
Anyone know of a control for asp.net that can achieve this either server or ajax. I have a hierarchy of school, division and programme area. Unfortunately this hierarchy has complexities such that a programme area can appear in more than one school. As it is for reporting I would like to give the end user options acro...
It sounds like you've found a solution for your dropdown hierarchy issue by using SQL wildcard searches with the `LIKE` operator to accommodate the "ANY/ALL" selections. That approach can work effectively for your reporting needs in ASP.NET. If you're looking for more advanced or user-friendly ways to implement this ...
48,045
[ { "from": "human", "value": "Anyone know of a control for asp.net that can achieve this either server or ajax.\nI have a hierarchy of school, division and programme area. Unfortunately this hierarchy has complexities such that a programme area can appear in more than one school. \nAs it is for reporting I w...
I am writing a simple application in SilverLight2, which needs to draw an ellipse inside a canvas element - the ellipse position, height and width are computed during runtime. What I need to fix is the clipping of the ellipse. If it gets to big it is drawn partially outside the canvas, above other UI elements. I want t...
In Silverlight, when you want to restrict the drawing of an element such as an ellipse to a specific area (like a Canvas), you can use the `Clip` property of the ellipse. To ensure that the ellipse is clipped to fit within the bounds of the Canvas, you should create a rectangle geometry that matches the size of the can...
47,620
[ { "from": "human", "value": "I am writing a simple application in SilverLight2, which needs to draw an ellipse inside a canvas element - the ellipse position, height and width are computed during runtime.\nWhat I need to fix is the clipping of the ellipse. If it gets to big it is drawn partially outside the...
I wish to put some text on a page and hide some data in that text. Does anybody know of any methods / patterns that have been used in the past to solve this problem? Example: I have the following text: "The cat sat on the dog and was happy." I also have the number 123. I want to hide this number in that sentence such t...
There are several methods to hide data within text while maintaining its readability. Here are some techniques you can consider: ### 1. **Steganography in Text:** - **Capitalization Method:** Use the case of letters to encode information. For example, capitalizing specific letters can represent binary data (1 for u...
48,891
[ { "from": "human", "value": "I wish to put some text on a page and hide some data in that text. Does anybody know of any methods / patterns that have been used in the past to solve this problem?\nExample: I have the following text:\n\"The cat sat on the dog and was happy.\"\nI also have the number 123. I wa...
I'm trying to animate a block level element using jQuery. The page loads with the element styled with display: none. Id like it to slideDown whilst transparent and then fadeIn the content using the callback, however slideDown appears to set the visibility to full before fadeIn is called, resulting in the content being ...
Yes, you can achieve the desired effect by using a combination of jQuery's `slideDown` and `fadeIn` methods while controlling the opacity of the element. Since `slideDown` does set the element's display to block, you can first animate the `opacity` and then use a callback to `slideDown`. Here’s how you can do it: 1. S...
48,661
[ { "from": "human", "value": "I'm trying to animate a block level element using jQuery. The page loads with the element styled with display: none. Id like it to slideDown whilst transparent and then fadeIn the content using the callback, however slideDown appears to set the visibility to full before fadeIn i...
How do you access a MySQL relation using RoR?
Accessing a MySQL relation using Ruby on Rails (RoR) involves several steps, including setting up your database, creating models, and executing queries. Below is a step-by-step guide on how to do this: ### 1. Setup Your Rails Application First, ensure you have a Rails application set up. If you don’t have one yet, yo...
48,415
[ { "from": "human", "value": "How do you access a MySQL relation using RoR?\n" }, { "from": "gpt", "value": "Accessing a MySQL relation using Ruby on Rails (RoR) involves several steps, including setting up your database, creating models, and executing queries. Below is a step-by-step guide on ho...
I have an winforms application that was built using MVC. The controller is subscribing to all of the events from the view (button clicks, etc) and connects multiple views with the model. The problem is that the controller is now about 3000 lines of (hard to unit test) code. What is the best practice to avoid getting ...
The situation you're facing is a common issue in applications that use the Model-View-Controller (MVC) design pattern. When controllers become bloated with responsibilities, it can lead to maintainability, readability, and testability issues. Here are some best practices to help you refactor your controller and manage ...
45,289
[ { "from": "human", "value": "I have an winforms application that was built using MVC. The controller is subscribing to all of the events from the view (button clicks, etc) and connects multiple views with the model. \nThe problem is that the controller is now about 3000 lines of (hard to unit test) code.\n...
I am writing the data to the output browser using Response.write(some byte arrary) Response.ContentType = "application/ms-excel"; Response.ContentEncoding = System.Text.Encoding.Default; Response.OutputStream.Write(report, 0, report.Length); Response.Flush(); Response.Close(); I...
To correctly write an Excel file containing ANSI characters, there are a few key steps and considerations you should follow. The main goal here is to ensure that the encoding is set correctly, and that the data written to the response is properly formatted for Excel. ### Steps to write ANSI characters to Excel 1. **U...
47,370
[ { "from": "human", "value": "I am writing the data to the output browser using Response.write(some byte arrary)\n Response.ContentType = \"application/ms-excel\";\n Response.ContentEncoding = System.Text.Encoding.Default;\n Response.OutputStream.Write(report, 0, report.Length);\n ...
I have a solution of mixed VB.NET and C++ projects. When using Visual Studio 2005 you can set the "Tools->Option->Projects and Solutions->VC++ Directories" to help the compiler find your include files. When building the same solution with MSBuild I don't see how to pass these settings. The C++ won't compile without thi...
To pass include paths to MSBuild for a mixed VB.NET and C++ solution, you typically need to specify those paths in your project files (`.vcproj` or `.vcxproj` for C++ projects). Here's how you can do this: ### 1. Modify the C++ Project File You can manually add the additional include directories to your C++ project f...
48,949
[ { "from": "human", "value": "I have a solution of mixed VB.NET and C++ projects. When using Visual Studio 2005 you can set the \"Tools->Option->Projects and Solutions->VC++ Directories\" to help the compiler find your include files. When building the same solution with MSBuild I don't see how to pass these ...
I'm a C++ developer with basic Python skills. Here's the task, a friend of mine is running a small company and he asked me if I can make a website for him. I have no real deadline so I think it's a perfect opportunity to try sth new and do some web development. User has to be able to add photos, change texts ect. Do yo...
Django is a powerful web framework that offers many features, which can be beneficial for building a custom website. Given your requirements—allowing users to add photos, change texts, and possibly manage content—Django is a suitable option, even if you have no prior experience with it. Here are a few considerations to...
46,609
[ { "from": "human", "value": "I'm a C++ developer with basic Python skills. Here's the task, a friend of mine is running a small company and he asked me if I can make a website for him. I have no real deadline so I think it's a perfect opportunity to try sth new and do some web development.\nUser has to be a...
I have found many tutorials about using Windows Server 2003 as a development machine, and very little information about Windows Server 2008 for the same purpose. For a nicer experience, I have followed the steps from Convert your Windows Server 2008 to a Workstation. I am searching for the requirements and installation...
To set up a development environment on Windows Server 2008 with IIS 7 in compatibility mode, .NET Framework 3.5 SP1, SQL Server 2005 SP2 (with Reporting Services and Analysis Services), and Visual Studio 2008 SP1, you should follow a specific installation order. Here are the requirements and recommended steps: ### 1. ...
43,456
[ { "from": "human", "value": "I have found many tutorials about using Windows Server 2003 as a development machine, and very little information about Windows Server 2008 for the same purpose.\nFor a nicer experience, I have followed the steps from Convert your Windows Server 2008 to a Workstation.\nI am sear...
Details are as follows: Environment: SSRS 2008 Server, SQL Server 2008 for database, Report Developed in SQL Server Business Intelligence Devlopment Studio - Reporting Project Error Messages: "An error occurred during client rendering." "An error has occurred during report processing." "Query execution failed for data...
The error messages you're encountering in SSRS 2008 suggest there are issues with query execution that are related to parameter handling. Since the report and data source worked well in SSRS 2005 and in your development environment, it indicates that there might be some differences in how SSRS 2008 is processing these ...
47,018
[ { "from": "human", "value": "Details are as follows:\nEnvironment:\nSSRS 2008 Server, SQL Server 2008 for database, Report Developed in SQL Server Business Intelligence Devlopment Studio - Reporting Project\nError Messages: \n\"An error occurred during client rendering.\"\n\"An error has occurred during rep...
This has got to be something simple: I set up a frames page with two possible sources for the target frame based on a form with two options. I used the OnClick event to trap the user's click to show the appropriate page. It works fine in Internet Explorer 7, swapping the two source pages. FireFox 3 and Chrome show ...
It looks like you're using an `<iframe>` or similar element for `RatesFrame`, but your JavaScript function is not properly determining which radio button is selected because you're only checking one specific radio button (with the ID 'County'). In your current implementation, the `document.getElementById('County')` wou...
46,572
[ { "from": "human", "value": "This has got to be something simple: I set up a frames page with two possible sources for the target frame based on a form with two options. I used the OnClick event to trap the user's click to show the appropriate page. It works fine in Internet Explorer 7, swapping the two ...
My application has a series of table views based on some hierarchical data. For example, the user selects "Browse by XYZ" on my CategoryListController, and then I load my DocumentListController based on that selection. Right now I'm getting the list through a web service that returns some JSON data, but that's beside t...
In your scenario, using `-viewWillAppear:` to refresh your data can be appropriate, but there are some nuances you might want to consider for a cleaner and more efficient implementation. ### Considerations and Recommendations: 1. **Use `-viewWillAppear:` Wisely**: While using `-viewWillAppear:` allows you to fetch da...
49,340
[ { "from": "human", "value": "My application has a series of table views based on some hierarchical data. For example, the user selects \"Browse by XYZ\" on my CategoryListController, and then I load my DocumentListController based on that selection.\nRight now I'm getting the list through a web service that...
I want to read an xml file, apply a transform, then write to another file. The best way I can think of is this: using (XmlTextReader reader = new XmlTextReader(new FileStream(_source, FileMode.Open))) using (XmlTextWriter writer = new XmlTextWriter(new StreamWriter(_destination))) { _xslTransform.Transform(reader, w...
Using `XslCompiledTransform` to perform transformations on XML data and wanting to report progress can be a bit tricky, especially since XML transformations typically process data in a streaming manner. Unfortunately, `XslCompiledTransform` does not provide a built-in way to report progress during the transformation p...
47,745
[ { "from": "human", "value": "I want to read an xml file, apply a transform, then write to another file. The best way I can think of is this:\nusing (XmlTextReader reader = new XmlTextReader(new FileStream(_source, FileMode.Open)))\nusing (XmlTextWriter writer = new XmlTextWriter(new StreamWriter(_destinatio...
I am parsing a document using XSLT. Within the XSLT I am loading a reference document using the document() function, and I can access items from both documents. Both the source document and the reference document have an attribute called name. How do I compare one to the other. I have got around this by declaring a...
To compare the `@league` attribute from the source document and the reference document in your XSLT without using a variable, you can directly include the comparison within the context of an XPath expression. However, given that you're looking for a way to express this without defining variables, you can use a direct X...
46,363
[ { "from": "human", "value": "I am parsing a document using XSLT. Within the XSLT I am loading a reference document using the document() function, and I can access items from both documents. Both the source document and the reference document have an attribute called name. How do I compare one to the othe...
Our web-based application is installed at end-customers. Typically these customers do not have access to the internet. Part of the next version of our application is Silverlight 2.0 based. When a browser without the Silverlight 2.0 plugin tries to access our the Silverlight portion of our app, the customer gets the sta...
To provide users with a seamless experience when they don't have the Silverlight 2.0 plugin installed, you'll want to customize the behavior of your web application when it detects that the plugin is missing. Unfortunately, you cannot directly control the standard "Install Microsoft Silverlight" page that is presented ...
49,802
[ { "from": "human", "value": "Our web-based application is installed at end-customers. Typically these customers do not have access to the internet. Part of the next version of our application is Silverlight 2.0 based.\nWhen a browser without the Silverlight 2.0 plugin tries to access our the Silverlight por...
I need to determine in the page is loading in a partial rendering mode (when posting back from within an UpdatePanel). Any suggestions?
To determine if a page is loading in a partial rendering mode, particularly when using ASP.NET AJAX and an `UpdatePanel`, you can follow these strategies: ### 1. Use the `__EVENTTARGET` Hidden Field When an ASP.NET UpdatePanel performs a partial postback, it updates certain hidden fields, including the `__EVENTTARGET...
49,339
[ { "from": "human", "value": "I need to determine in the page is loading in a partial rendering mode (when posting back from within an UpdatePanel).\nAny suggestions?\n" }, { "from": "gpt", "value": "To determine if a page is loading in a partial rendering mode, particularly when using ASP.NET AJ...
I'm looking at writing a tool for generating code based on the contents of a stored procedure. Like the parameters and stuff. I was wondering if anybody knew of an open source library that has a all the regex's and stuff to parse all this easily. Thanks.
When it comes to parsing SQL stored procedures, there isn't a single dedicated open-source library that covers all SQL dialects and intricacies out of the box. However, you have a few options that you can consider, depending on your specific needs: 1. **ANTLR (Another Tool for Language Recognition)**: - ANTLR is a ...
49,603
[ { "from": "human", "value": "I'm looking at writing a tool for generating code based on the contents of a stored procedure. Like the parameters and stuff.\nI was wondering if anybody knew of an open source library that has a all the regex's and stuff to parse all this easily.\nThanks.\n" }, { "from...
What do you guys think about this for a generic singleton? using System; using System.Reflection; // Use like this /* public class Highlander : Singleton<Highlander> { private Highlander() { Console.WriteLine("There can be only one..."); } } */ public class Singleton<T> where T : class { priva...
Your implementation of a generic singleton in C# is generally good, but there are some areas for improvement and considerations to keep in mind. Let's review your code step-by-step: ### Pros: 1. **Generic Implementation**: The use of generics allows this singleton pattern to be reused for any class by inheriting from ...
47,272
[ { "from": "human", "value": "What do you guys think about this for a generic singleton?\nusing System;\nusing System.Reflection;\n\n// Use like this\n/*\npublic class Highlander : Singleton<Highlander>\n{\n private Highlander()\n {\n Console.WriteLine(\"There can be only one...\");\n }\n}\n*...
I am stuck at properly aligning the generalization arrow between the classes. I could not make them appear as in the UML books.
In UML (Unified Modeling Language), proper alignment of generalization arrows is important for clarity and readability in class diagrams. Here are some tips to help you align the generalization arrow correctly: 1. **Use Straight Lines**: Ensure that the generalization arrow is a straight line that points from the subc...
49,656
[ { "from": "human", "value": "I am stuck at properly aligning the generalization arrow between the classes. I could not make them appear as in the UML books.\n" }, { "from": "gpt", "value": "In UML (Unified Modeling Language), proper alignment of generalization arrows is important for clarity and...
My users are presented a basically a stripped down version of a spreadsheet. There are textboxes in each row in the grid. When they change a value in a textbox, I'm performing validation on their input, updating the collection that's driving the grid, and redrawing the subtotals on the page. This is all handled by the...
To address the race condition you're encountering without resorting to busy loops or semaphores, you can use a flag to indicate whether the validation is currently in progress. This approach ensures that the `SaveForm` function will only execute once the validation is complete. Here's a modified version of your code t...
48,526
[ { "from": "human", "value": "My users are presented a basically a stripped down version of a spreadsheet. There are textboxes in each row in the grid. When they change a value in a textbox, I'm performing validation on their input, updating the collection that's driving the grid, and redrawing the subtotals...
I have a SQL Server 2005 database that I'm trying to access as a limited user account, using Windows authentication. I've got BUILTIN\Users added as a database user (before I did so, I couldn't even open the database). I'm working under the assumption that everybody is supposed to have permissions for the "public" ro...
In SQL Server, the `CONTROL` permission is a powerful permission that essentially grants the ability to manage a specific securable (in this case, a table). When you grant `CONTROL` permission on a table, it provides the grantee with all permissions on that table, including SELECT, INSERT, UPDATE, DELETE, EXECUTE (on p...
48,441
[ { "from": "human", "value": "I have a SQL Server 2005 database that I'm trying to access as a limited user account, using Windows authentication. I've got BUILTIN\\Users added as a database user (before I did so, I couldn't even open the database). I'm working under the assumption that everybody is suppos...
Is there a Pythonic way to have only one instance of a program running? The only reasonable solution I've come up with is trying to run it as a server on some port, then second program trying to bind to same port - fails. But it's not really a great idea, maybe there's something more lightweight than this? (Take int...
Yes, there are several Pythonic ways to ensure that only one instance of a program is running at a time. Using a server on a port is one approach, but you can use other methods that might be more lightweight and suitable for your needs. Here are a few approaches: ### 1. Using a Lock File with a Try-Except Block While...
47,360
[ { "from": "human", "value": "Is there a Pythonic way to have only one instance of a program running? \nThe only reasonable solution I've come up with is trying to run it as a server on some port, then second program trying to bind to same port - fails. But it's not really a great idea, maybe there's somethi...
I have a GridView Control that for other functionality has to be inside an update panel. The site is using the Ajax Control Toolkit and the "EnableSortingAndPagingCallbacks" property on the Grid is set to false. However, when I execute a paging call it is still doing it as a callback instead of a postback. How do I fix...
If your `GridView` control is within an `UpdatePanel` and you want to ensure that the paging calls result in a full postback instead of a partial callback, you can accomplish this by explicitly configuring the behavior of the `UpdatePanel` and the `GridView`. Here are steps you can take to ensure paging triggers a pos...
48,674
[ { "from": "human", "value": "I have a GridView Control that for other functionality has to be inside an update panel. The site is using the Ajax Control Toolkit and the \"EnableSortingAndPagingCallbacks\" property on the Grid is set to false. However, when I execute a paging call it is still doing it as a c...
Does anyone know what the difference is between adding an appropriate JAR-file (eg. Apache XALAN) to a JRE's endorsed directory and adding it to the application's classpath? Is it possible to take a jar-file that can be added to the endorsed lib and instead add it to the classpath?
Yes, there is a difference between adding a JAR file to the JRE's endorsed directory and adding it to an application's classpath. Let's break down the concepts: ### Endorsed Directory 1. **Purpose**: The endorsed directory mechanism allows you to override certain Java standard classes with your own implementations. T...
47,043
[ { "from": "human", "value": "Does anyone know what the difference is between adding an appropriate JAR-file (eg. Apache XALAN) to a JRE's endorsed directory and adding it to the application's classpath?\nIs it possible to take a jar-file that can be added to the endorsed lib and instead add it to the classp...
I have a table (SQL 2000) with over 10,000,000 records. Records get added at a rate of approximately 80,000-100,000 per week. Once a week a few reports get generated from the data. The reports are typically fairly slow to run because there are few indexes (presumably to speed up the INSERTs). One new report could r...
When you're adding an index in SQL Server, especially on a large table like yours, there are several factors to consider that might be impacting the performance of your queries even after adding the index. Here are some steps and considerations to help troubleshoot and potentially improve the performance: 1. **Check I...
47,758
[ { "from": "human", "value": "I have a table (SQL 2000) with over 10,000,000 records. Records get added at a rate of approximately 80,000-100,000 per week. Once a week a few reports get generated from the data. The reports are typically fairly slow to run because there are few indexes (presumably to speed...
In the admin section of a website i am building i would like to put together a dashboard page, or 'quick look' type page where the most recent changes/additions/etc in several different areas can be viewed. I was thinking the best way to do this would be to use partials and have each partial contain the markup for the ...
Using partials to create a dashboard page is a great approach, as it promotes reusability and maintains a clean separation of concerns. By keeping your logic in the controller and your presentation in the partials, you make the code easier to manage and understand. Here’s how you can achieve this separation of logic a...
45,179
[ { "from": "human", "value": "In the admin section of a website i am building i would like to put together a dashboard page, or 'quick look' type page where the most recent changes/additions/etc in several different areas can be viewed.\nI was thinking the best way to do this would be to use partials and hav...
I'm using Altera Quartus 2 to do a custom 8 bit processor and it takes forever to compile on my laptop. I'm only using simulations and making my processor in schematic (block diagram) and VHDL. Right now it takes around 10 minutes to compile, which is a pain since I'm more on the debugging phase of the project where I ...
Compiling in Altera Quartus can indeed be slow, especially when you're in a debugging phase and making frequent changes to your design. Here are some suggestions to help speed up the compilation process, particularly since you're only using simulations and not targeting an FPGA: 1. **Disable Fitter and Assembler Phase...
43,685
[ { "from": "human", "value": "I'm using Altera Quartus 2 to do a custom 8 bit processor and it takes forever to compile on my laptop. I'm only using simulations and making my processor in schematic (block diagram) and VHDL. Right now it takes around 10 minutes to compile, which is a pain since I'm more on th...
I am using the standard outputcache tag in my MVC app which works great but I need to force it to be dumped at certain times. How do I achieve this? The page that gets cached is built from a very simple route {Controller}/{PageName} - so most pages are something like this: /Pages/About-Us Here is the output cache tag...
To manually clear the output cache in an ASP.NET MVC application, you can use the `OutputCache` class in the controller or an action that you designate for this purpose. Here’s how you can do it. ### Step 1: Use Cache Settings in OutputCache First, make sure your OutputCache directive is set correctly to support cach...
48,100
[ { "from": "human", "value": "I am using the standard outputcache tag in my MVC app which works great but I need to force it to be dumped at certain times. How do I achieve this? The page that gets cached is built from a very simple route {Controller}/{PageName} - so most pages are something like this: /Pa...
I've never done it myself, and I've never subscribed to a feed, but it seems that I'm going to have to create one, so I'm wondering. The only way that seems apparent to me is that when the system is updated with a new item (blog post, news item, whatever), a new element should be written to the rss file. Or alternative...
Creating an RSS feed in PHP (with CodeIgniter and MySQL) involves a few key steps. You can indeed choose to dynamically generate the RSS feed whenever it is requested, rather than updating a static file whenever a new item is added. This often simplifies the management of the feed and ensures that the content is always...
41,457
[ { "from": "human", "value": "I've never done it myself, and I've never subscribed to a feed, but it seems that I'm going to have to create one, so I'm wondering. The only way that seems apparent to me is that when the system is updated with a new item (blog post, news item, whatever), a new element should b...
I want to switch between vertical and horizontal table layout for same data. Although it is possible to do it by making applying the same CSS for the first column for the vertical layout as the css applied for the header row for the Horizontal layout. Is there is any way where we can make the webpage render the way we ...
You can achieve a dynamic switch between vertical and horizontal table layouts using a combination of HTML, CSS, and JavaScript. Below is a simple implementation demonstrating how to toggle between a horizontal and vertical layout using a button click. ### HTML Structure ```html <!DOCTYPE html> <html lang="en"> <head...
45,402
[ { "from": "human", "value": "I want to switch between vertical and horizontal table layout for same data.\nAlthough it is possible to do it by making applying the same CSS for the first column for the vertical layout as the css applied for the header row for the Horizontal layout.\nIs there is any way where...
We have a huge data of about 300 million records, which will get updated every 3-6 months.We need to query this data(continously, real time) to get some information.What are the options - a RDBMS(mysql) , or some other option like Hadoop.Which will be better?
When dealing with a large dataset of about 300 million records that requires real-time querying, the choice between a traditional RDBMS like MySQL and other options like Hadoop depends on several factors, including the nature of the queries, the structure of the data, and the specific use cases. Here’s a breakdown of t...
47,665
[ { "from": "human", "value": "We have a huge data of about 300 million records, which will get updated every 3-6 months.We need to query this data(continously, real time) to get some information.What are the options - a RDBMS(mysql) , or some other option like Hadoop.Which will be better?\n" }, { "fr...
I am trying to build a C#.net program that works like a RPG Subfile on the AS400. Have the general subfile part working. I can display and then edit and update existing records. Am blowing up in my code where I am trying to insert a new record. Blowing up on the cmd.ExecuteNonQuery(); If you want to see how this work...
It looks like you are trying to insert a record into a DB2 database using C#. However, since you are encountering issues with the `cmd.ExecuteNonQuery()`, there are a few points to consider in order to troubleshoot this. ### Common Issues to Check 1. **Parameter Derivation**: Ensure that the parameters are being corr...
44,843
[ { "from": "human", "value": "I am trying to build a C#.net program that works like a RPG Subfile on the AS400.\nHave the general subfile part working. I can display and then edit and update existing records. \nAm blowing up in my code where I am trying to insert a new record. Blowing up on the \ncmd.Execute...
Below is a stored procedure to check if there is a duplicate entry in the database based upon checking all the fields individually (don't ask why I should do this, it just has to be this way). It sounds perfectly straightforward but the SP fails. The problem is that some parameters passed into the SP may have a null v...
To handle potential NULL values in your stored procedure and check for duplicates while treating NULLs properly, you can use a combination of `IS NULL` checks and `COALESCE` or `CASE` statements for each parameter. Here is the modified version of your stored procedure that checks for duplicates in a way that accounts f...
47,369
[ { "from": "human", "value": "Below is a stored procedure to check if there is a duplicate entry in the database based upon checking all the fields individually (don't ask why I should do this, it just has to be this way). \nIt sounds perfectly straightforward but the SP fails.\nThe problem is that some para...
Most programming houses / managers i know of can only define quality in terms of the no of bugs made / resolved in retrospect. However most good programmers can innately sense quality once they start meddling with the code.(right?) Has any programming houses that you know of, successfully translated this information ...
Measuring quality in software development is indeed a complex challenge, and many organizations struggle to define and quantify it beyond the simple metrics of bugs reported and resolved. However, there are various metrics and tools that can help organizations assess software quality more holistically. Here are some co...
46,119
[ { "from": "human", "value": "Most programming houses / managers i know of can only define quality in terms of the no of bugs made / resolved in retrospect. \nHowever most good programmers can innately sense quality once they start meddling with the code.(right?) \nHas any programming houses that you know of...
I'm thinking about SEDA. We design at the moment an application (which is running on a server as a service) which must be multithreaded and message / event based. The SEDA idea is very intresting and should match. But I cannot find articles etc. writing about experiences made with it. My question(s) now is(are): Do ...
SEDA (Staged Event-Driven Architecture) is indeed an interesting and effective architectural pattern for building scalable and responsive applications, especially in multi-threaded environments. Here are some insights and experiences regarding your questions: ### 1. Queue Implementation #### Using ActiveMQ or MSMQ - *...
45,609
[ { "from": "human", "value": "I'm thinking about SEDA. We design at the moment an application (which is running on a server as a service) which must be multithreaded and message / event based.\nThe SEDA idea is very intresting and should match. But I cannot find articles etc. writing about experiences made w...
All, I am trying to uninstall a software remotely, it is working fine in the test machines, but i got problem in production servers. test machines i have used windows xp, windows 2003 server, production machine : windows server 2003. what could be the cause of this error, any help would be more appreciated. if y...
The error message "System.Management.ManagementException: Invalid class" suggests that there is an issue with the WMI (Windows Management Instrumentation) query you're using to identify the product on the production server. Here are a few potential reasons and solutions for the issue you're facing: ### Potential Cause...
46,479
[ { "from": "human", "value": "All,\n I am trying to uninstall a software remotely, it is working fine in the test machines, but i got problem in production servers. \ntest machines i have used windows xp, windows 2003 server,\nproduction machine : windows server 2003.\nwhat could be the cause of this er...
I'm using the jQuery Treeview plugin for navigation on a site with nested levels of categories. In each category there are then products, each of which have one or more information types. So my URLs can be either: foo.com/view/cat_id/ foo.com/view/cat_id/prod_id/ foo.com/view/cat_id/prod_id/info_id/ Trouble is, the n...
You can definitely achieve what you're looking for by using JavaScript with a regular expression (regex) to extract the `cat_id` from the URL. Here's a simple approach to do that: 1. Get the current URL. 2. Use regex to match and extract the `cat_id`. 3. Pass that `cat_id` to your Treeview plugin to open the relevant ...
47,411
[ { "from": "human", "value": "I'm using the jQuery Treeview plugin for navigation on a site with nested levels of categories. In each category there are then products, each of which have one or more information types.\nSo my URLs can be either:\n\nfoo.com/view/cat_id/\nfoo.com/view/cat_id/prod_id/\nfoo.com/v...
Here's a fictitious example of the problem I'm trying to solve. If I'm working in C#, and have XML like this: <?xml version="1.0" encoding="utf-8"?> <Cars> <Car> <StockNumber>1020</StockNumber> <Make>Nissan</Make> <Model>Sentra</Model> </Car> <Car> <StockNumber>1010</StockNumber> <Make>Toyota...
In C#, you cannot directly deserialize a part of an XML document into a property of a class using `XmlSerializer` while keeping the rest of the XML raw. However, you can achieve your goal using a combination of `XmlReader` and `XmlSerializer`. Here's how you can do it: 1. Use an `XmlReader` to read the XML document....
47,496
[ { "from": "human", "value": "Here's a fictitious example of the problem I'm trying to solve. If I'm working in C#, and have XML like this:\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Cars>\n <Car>\n <StockNumber>1020</StockNumber>\n <Make>Nissan</Make>\n <Model>Sentra</Model>\n </Car>\n <Car>...
The Replace Temp with Query refactoring method is recommended quite widely now but seems to be very inefficient for very little gain. The method from the Martin Fowler's site gives the following example: Extract the expression into a method. Replace all references to the temp with the expression. The new method can t...
You raise a valid concern regarding the overhead of repeated calculations and function calls when using the "Replace Temp with Query" refactoring method. However, there are several reasons why this refactoring technique is considered beneficial, and it's important to understand its purpose and advantages. 1. **Improve...
48,200
[ { "from": "human", "value": "The Replace Temp with Query refactoring method is recommended quite widely now but \nseems to be very inefficient for very little gain. \nThe method from the Martin Fowler's site gives the following example:\nExtract the expression into a method. Replace all references to the te...
Just need to use find a simple way to have AD authenticate as the login for a Sharepoint site. This fairly quick and simple to get going ? Thanks!
To set up Active Directory (AD) authentication for a SharePoint site, follow these general steps. The process may vary slightly depending on whether you're using SharePoint Online (part of Microsoft 365) or SharePoint Server (on-premises). Below, I'll outline the steps for both scenarios. ### For SharePoint Online (Mi...
49,892
[ { "from": "human", "value": "Just need to use find a simple way to have AD authenticate as the login for a Sharepoint site. This fairly quick and simple to get going ? \nThanks! \n" }, { "from": "gpt", "value": "To set up Active Directory (AD) authentication for a SharePoint site, follow these g...
I'm executing a query like this select field from table; In that query, there is a loop running on many tables. So, if the field is not present in a table I get a Runtime Error 3061 How can I by pass this error such as that on this error flow should go to another point? This is the code I have recently after going ...
Based on the provided code and the errors you're encountering, it appears that you are indeed mixing up DAO (Data Access Objects) and ADO (ActiveX Data Objects). In VBA, these two libraries have different recordset types, and using them interchangeably can lead to issues. To fix the `Type Mismatch Runtime Error`, you ...
45,834
[ { "from": "human", "value": "I'm executing a query like this\nselect field from table;\n\nIn that query, there is a loop running on many tables. So, if the field is not present in a table I get a \n\nRuntime Error 3061\n\nHow can I by pass this error such as that on this error flow should go to another poin...
Using the FileHelper library for .Net, can I somehow skip a number of columns from the source file? According to docs and samples, I have to add fields for all columns. Alas, I have an excel sheet with 216 columns to import, from which as few as 13 are necessary.
Yes, you can skip columns when using the FileHelpers library for .NET, even though it requires defining all fields in your class. To achieve this, you can create a custom class that includes only the fields you need from the source file, effectively ignoring the other columns. Here’s how you can do this: 1. **Define ...
46,418
[ { "from": "human", "value": "Using the FileHelper library for .Net, can I somehow skip a number of columns from the source file?\nAccording to docs and samples, I have to add fields for all columns. Alas, I have an excel sheet with 216 columns to import, from which as few as 13 are necessary.\n" }, { ...
well the thing is i am having a scheduled script that checks some changes in a different database (Oracle), if the change happens I need to cancel /kill/ stop a workflow if it is in progress on a specific item of my list How to do that?
To cancel or stop a workflow in a system, you need to follow a few general steps. Since you mentioned you're working with an Oracle database and possibly a workflow management system, here are the broad steps you would take. Adjust the specifics based on your environment and technologies used: ### 1. Identify the Work...
45,174
[ { "from": "human", "value": "well the thing is i am having a scheduled script that checks some changes in a different database (Oracle), if the change happens\nI need to cancel /kill/ stop a workflow if it is in progress on a specific item of my list\nHow to do that?\n" }, { "from": "gpt", "valu...
is there some open source Java API (ideally not GPL) for creating an object model from an XQuery string? thanks
There are several libraries in Java that can help you create an object model from an XQuery string. While the specific requirements (like avoiding GPL) may narrow your choices, here are some options that you might find useful: 1. **XQJ (XQuery API for Java)**: - **License**: Apache License 2.0 - XQJ is a standar...
46,387
[ { "from": "human", "value": "is there some open source Java API (ideally not GPL) for creating an object model from an XQuery string? \nthanks\n" }, { "from": "gpt", "value": "There are several libraries in Java that can help you create an object model from an XQuery string. While the specific ...
Right now, I am trying to create a plug-in of Eclipse which depends on other jar; therefore, I created a plug-in base on the jar and deployed it under my Eclipses' plugin foler. It works well when I start it from my working environment via an Eclipse. However, as soon as I have exported it into a jar and have deployed ...
When you create an Eclipse plugin that depends on an external JAR, you need to ensure that the dependent JAR is included correctly in your plugin's manifest and its build path. Here are some steps to help you troubleshoot the issue: 1. **Check Manifest File (MANIFEST.MF)**: Ensure that your `MANIFEST.MF` file in your ...
49,320
[ { "from": "human", "value": "Right now, I am trying to create a plug-in of Eclipse which depends on other jar; therefore, I created a plug-in base on the jar and deployed it under my Eclipses' plugin foler. It works well when I start it from my working environment via an Eclipse. However, as soon as I have ...
Merging project/solution files is a well-known disaster among developers/SCM admins performing merges in their source control. Take, for example, a common scenario: development is done on a project/solution in two different branches. When time comes to merge back into a main development line, there is a very small res...
You've touched on a well-known issue among developers working with Visual Studio project files. The inconsistency in the ordering of elements in `.vcproj` and `.sln` files can indeed lead to a nightmare during merges, especially when multiple branches are involved. Here’s a deeper look into potential workarounds, sugge...
45,883
[ { "from": "human", "value": "Merging project/solution files is a well-known disaster among developers/SCM admins performing merges in their source control. \nTake, for example, a common scenario: development is done on a project/solution in two different branches. When time comes to merge back into a main d...
Each client is identified by a hash, passed along with every request to the server. What's the best way to handle tracking a users session in this case? I'm using restful_authentication for user accounts etc. A large percentage of requests are expected to originate without a user account but just the unique hash. My un...
When you're dealing with a scenario where users are identified by a unique hash rather than traditional session IDs or user accounts, you can implement a solution that focuses on tracking sessions using that unique identifier. Here are the steps you can take to effectively manage sessions in this context: ### 1. **Has...
48,797
[ { "from": "human", "value": "Each client is identified by a hash, passed along with every request to the server. What's the best way to handle tracking a users session in this case?\nI'm using restful_authentication for user accounts etc. A large percentage of requests are expected to originate without a us...
I'm doing some research in code generation from xsd schema files. My requirements: Must generate C# 2.0 code (or above), using generic collections where needed. Must generate comments from the xsd comments Must generate fully serializable code. Should be able to generate resuable basetypes when generating from multip...
It sounds like you're looking for a tool that meets a specific set of requirements for generating C# code from XSD schema files. Based on your criteria, let’s evaluate some of the tools you mentioned and explore any alternatives: 1. **xsd.exe**: This is a basic tool included with the .NET SDK and Visual Studio. It can...
48,515
[ { "from": "human", "value": "I'm doing some research in code generation from xsd schema files. \nMy requirements:\n\nMust generate C# 2.0 code (or above), using generic collections where needed.\nMust generate comments from the xsd comments\nMust generate fully serializable code.\nShould be able to generate...
I'm creating a Q&A application in CakePHP, and I want to exclude my associations in some cases. Imagine the following: I'm listing all questions on the first page using $this->Question->findAll();. Since I have the following association in my model: public $hasMany = array('Answer' => array('className' => 'Answ...
In CakePHP, you can customize your queries to exclude associations when you don't need them. Since you want to list all questions without fetching the associated answers, you can simply use the `contain` method to limit the associated data you fetch or avoid it entirely. ### Example Code Instead of using `$this->Ques...
49,291
[ { "from": "human", "value": "I'm creating a Q&A application in CakePHP, and I want to exclude my associations in some cases. Imagine the following:\nI'm listing all questions on the first page using $this->Question->findAll();. Since I have the following association in my model:\npublic $hasMany = array('An...
We use MSMQ to capture all the event thrown by our asp.net site and store the data into our database. Throughout the day, we can see the event id 1003 with Title = "Application compilation is starting" in our logging database. However, we don't see the corresponding event 1004 which is "Application compilation ends"...
Hello Herman, The event ID 1003 with the title "Application compilation is starting" indicates that the ASP.NET application is starting up, which can happen for various reasons. Given that you are using the precompiled option (with the "update allow" setting), this typically means that the application is being deploye...
49,303
[ { "from": "human", "value": "We use MSMQ to capture all the event thrown by our asp.net site and store the data into our database. Throughout the day, we can see the event id 1003 with Title = \"Application compilation is starting\" in our logging database. \nHowever, we don't see the corresponding event ...
in Web 2.0 applications many users usually want to stay logged in ('remember me' flag) and on the other hand their cookie can give access to very private data. Is there a way to prevent that somebody who steals the cookie - directly from the computer or via sniffing - can use the cookie to get access to the user's data...
The challenge of securing cookies, especially in a Web 2.0 context where users want to remain logged in while minimizing the risk of unauthorized access, can be quite complex. While the ideal solution often involves using HTTPS (to protect data in transit) and IP address validation, you’ve stated those options are not ...
48,107
[ { "from": "human", "value": "in Web 2.0 applications many users usually want to stay logged in ('remember me' flag) and on the other hand their cookie can give access to very private data. Is there a way to prevent that somebody who steals the cookie - directly from the computer or via sniffing - can use th...
What is the advantage of doing a logical/soft delete of a record (i.e. setting a flag stating that the record is deleted) as opposed to actually or physically deleting the record? Is this common practice? Is this secure?
### Advantages of Logical/Soft Deletes 1. **Data Recovery**: Logical deletes allow for easy recovery of deleted records. If a record is mistakenly marked as deleted, it can be quickly restored without the need for backup restoration. 2. **Audit Trail**: Maintaining historical data is useful for auditing purposes. Wit...
49,864
[ { "from": "human", "value": "What is the advantage of doing a logical/soft delete of a record (i.e. setting a flag stating that the record is deleted) as opposed to actually or physically deleting the record?\nIs this common practice?\nIs this secure?\n" }, { "from": "gpt", "value": "### Advanta...
I have a body of text that I have to scan and each line contains at least 2 and sometimes four parts of information. The problem is that each line can be 1 out of 15-20 different actions. in ruby the current code looks somewhat like this: text.split("\n").each do |line| #around 20 times.. .............. expre...
It sounds like you're dealing with a performance-intensive task that involves parsing a structured text format (in this case, poker hand histories) into a more manageable format (like XML). Since you've tried both Ruby and C++ with varying degrees of success, here are a few strategies and approaches to improve your par...
48,493
[ { "from": "human", "value": "I have a body of text that I have to scan and each line contains at least 2 and sometimes four parts of information. The problem is that each line can be 1 out of 15-20 different actions.\nin ruby the current code looks somewhat like this:\n\ntext.split(\"\\n\").each do |line| ...
I keep getting this NPE in my application and I can't seem to get rid of it because it is not showing up in any of my source code. As you can see from the stacktrace it is not happening in my code but in the Swing plaf. Has any of you had this problem and maybe figured out what is happening here? 11:28:23,273 [AWT-E...
A NullPointerException (NPE) occurring in the Swing PLAF (Pluggable Look-and-Feel) can be challenging to debug, especially when the stack trace points to an internal method. Here are several approaches you can take to diagnose and potentially fix the issue: ### 1. Check Your Table Model The NPE is most likely due to a...
46,565
[ { "from": "human", "value": "I keep getting this NPE in my application and I can't seem to get rid of it because it is not showing up in any of my source code. As you can see from the stacktrace it is not happening in my code but in the Swing plaf. Has any of you had this problem and maybe figured out what ...
I want to check the following with regular expression {Today,Format} Today - will be remains as it is. In the place of Format, we can allow the digits from 0 to 12. for example: we have to allow {Today,0} {Today,1} {Today,2} ... {Today,12} and also have to allow {Today,} {Today,Format} Please help me and also refer...
You can use the following regular expression to match the specified patterns: ```regex \{Today,(0|1[0-2]|[0-9])?\} ``` ### Explanation of the Regular Expression: 1. `\{` and `\}`: Match the literal curly braces `{` and `}`. The backslashes `\` are used to escape these characters since they have special meanings in r...
49,353
[ { "from": "human", "value": "I want to check the following with regular expression\n{Today,Format}\n\nToday - will be remains as it is.\nIn the place of Format, we can allow the digits from 0 to 12.\nfor example: we have to allow\n{Today,0}\n{Today,1}\n{Today,2}\n...\n{Today,12}\n\nand also have to allow \n...
I am struggling with the best way to handle a WPF application that has dynamic data updates. Should I use the rich data binding provided by WPF or not? I will simplify my problem domain as much as possible in the discussion below, and briefly mention some solutions. I am very interested in whatever comments this commu...
Handling dynamic data updates in a WPF application can indeed be challenging, particularly when the frequency of updates is high, as in your case with 60 updates per second. The rich data binding capabilities provided by WPF can be very beneficial in achieving a clean and maintainable architecture, but you also need to...
45,445
[ { "from": "human", "value": "I am struggling with the best way to handle a WPF application that has dynamic data updates. Should I use the rich data binding provided by WPF or not? \nI will simplify my problem domain as much as possible in the discussion below, and briefly mention some solutions. I am very ...
A lot of programs log things into a text file in a format something like this: 11/19/2008 13:29:01 DEBUG Opening connection to localhost. 11/19/2008 13:29:01 DEBUG Sending login message for user 'ADMIN'. 11/19/2008 13:29:03 DEBUG Received login response 'OK' for user 'ADMIN'. ... However, I prefer something more struct...
If you're looking for a way to implement structured logging in .NET similar to your existing VB6 setup, you have a few options that can help you get the structured logging capabilities you desire without having to completely rewrite your existing code from scratch. Here are a few approaches you can consider: ### 1. Us...
46,645
[ { "from": "human", "value": "A lot of programs log things into a text file in a format something like this:\n11/19/2008 13:29:01 DEBUG Opening connection to localhost.\n11/19/2008 13:29:01 DEBUG Sending login message for user 'ADMIN'.\n11/19/2008 13:29:03 DEBUG Received login response 'OK' for user 'ADMIN'....
I have to use both IDEs and I would like to use the Eclipse style of syntax highlighting in Netbeans. Does any one know how to import it (or change any configuration file)? I've already set Netbeans to use the Eclipse key bindings. Is there any better way than manually changing the colors of every keyword for the Java ...
To achieve Eclipse-style syntax highlighting in NetBeans, you will need to manually adjust the color settings, as there is no built-in feature to directly import Eclipse color settings into NetBeans. However, you can make the process easier by using a combination of predefined color schemes and manual adjustments. ###...
47,532
[ { "from": "human", "value": "I have to use both IDEs and I would like to use the Eclipse style of syntax highlighting in Netbeans. Does any one know how to import it (or change any configuration file)? I've already set Netbeans to use the Eclipse key bindings.\nIs there any better way than manually changing...
I'm working on a project that has a rich object model with various sets of aggregate roots. We're using the Castle stack (Monorail through to nHibernate with ActiveRecord). We have marked the aggregate roots as lazy [ActiveRecord(Lazy = true)] and have customized 'eager' routines on our Repository to eager fetch an ob...
In NHibernate, when you're using lazy loading and eager fetching, it can sometimes lead to confusion, especially when dealing with multiple levels of lazy-loaded entities. The key thing to understand is that the lazy loading setting on an entity influences how NHibernate handles loading for that entity and its related ...
47,158
[ { "from": "human", "value": "I'm working on a project that has a rich object model with various sets of aggregate roots. \nWe're using the Castle stack (Monorail through to nHibernate with ActiveRecord).\nWe have marked the aggregate roots as lazy [ActiveRecord(Lazy = true)] and have customized 'eager' rout...
I am going to have a daemon that will run on a FreeBSD server, which will exchange small amounts of data with a list of URIs every minute. I am thinking to use the curl_multi functions to run them all at once, or in groups, every minute, using a post. I am open to other ideas though. I will have to do some benchmark...
Using `curl_multi` for handling multiple concurrent HTTP requests can be an efficient way to manage several small POST requests, especially since you're planning to do this every minute. Here are some considerations and alternatives regarding resource usage and performance: ### Resource Considerations 1. **Network Ove...
46,367
[ { "from": "human", "value": "I am going to have a daemon that will run on a FreeBSD server, which will exchange small amounts of data with a list of URIs every minute.\nI am thinking to use the curl_multi functions to run them all at once, or in groups, every minute, using a post. I am open to other ideas ...
What's the best method to pass parameters to SQLCommand? You can do: cmd.Parameters.Add("@Name", SqlDbType.VarChar, 20).Value = "Bob"; or cmd.Parameters.Add("@Name", SqlDbType.VarChar).Value = "Bob"; or cmd.Parameters.Add("@Name").Value = "Bob"; It seems like the first one might be somehow "better" either performanc...
When it comes to passing parameters to an `SqlCommand` in ADO.NET, all three methods you've mentioned are valid, but they have different implications regarding performance, error checking, and clarity. Here’s a detailed look at each approach: ### 1. Using `SqlDbType` and Size ```csharp cmd.Parameters.Add("@Name", SqlD...
45,844
[ { "from": "human", "value": "What's the best method to pass parameters to SQLCommand? You can do:\ncmd.Parameters.Add(\"@Name\", SqlDbType.VarChar, 20).Value = \"Bob\";\n\nor\ncmd.Parameters.Add(\"@Name\", SqlDbType.VarChar).Value = \"Bob\";\n\nor\ncmd.Parameters.Add(\"@Name\").Value = \"Bob\";\n\nIt seems ...
I am currently working on a web application that uses PHP and MySQL, but I do not have shell access to the server (working on that problem already...). Currently, I have source control with subversion on my local computer and I have a database on the local computer that I make all changes to. Then, once I've tested a...
Given your constraints of not having shell access to the server and the current manual deployment process, here are some options to streamline your deployment workflow while avoiding the issues with `.svn` files: ### 1. Use a Deployment Tool with FTP Support Since you're already using FileZilla for manual uploads, co...
43,917
[ { "from": "human", "value": "I am currently working on a web application that uses PHP and MySQL, but I do not have shell access to the server (working on that problem already...). Currently, I have source control with subversion on my local computer and I have a database on the local computer that I make ...
I noticed C++ will not compile the following: class No_Good { static double const d = 1.0; }; However it will happily allow a variation where the double is changed to an int, unsigned, or any integral type: class Happy_Times { static unsigned const u = 1; }; My solution was to alter it to read: class Now_Good { ...
The behavior you're observing is rooted in the C++ language's rules regarding the initialization of static class members. Here's a breakdown of why you can have static `const` integral types but not static `const` floating-point types in a class definition: ### Static Const Members in C++ 1. **Integral Types Initiali...
49,112
[ { "from": "human", "value": "I noticed C++ will not compile the following:\nclass No_Good {\n static double const d = 1.0;\n};\n\nHowever it will happily allow a variation where the double is changed to an int, unsigned, or any integral type:\nclass Happy_Times {\n static unsigned const u = 1;\n};\n\nMy s...
I'd like to create an XPS document for storing and printing. What is the easiest way to create an XPS document (for example with a simple grid with some data inside) in my program, and to pass it around?
Creating an XPS (XML Paper Specification) document can be done using various programming languages and libraries. If you're looking for an easy way to generate an XPS document containing a simple grid of data, you can use C# with the .NET framework, as it provides built-in support for XPS documents. Below is a step-by-...
44,758
[ { "from": "human", "value": "I'd like to create an XPS document for storing and printing.\nWhat is the easiest way to create an XPS document (for example with a simple grid with some data inside) in my program, and to pass it around?\n" }, { "from": "gpt", "value": "Creating an XPS (XML Paper Sp...
Using a macro I have consolidated info from several workbooks into one sheet in new workbook. In one column I have created a named range called ColRange. That column has numbers ranging from -350 to 500. How do I change the color of the cells based on the value of the text in the cell. red(0-500) yellow(-5-0) green(...
To change the color of the cells based on the values in the named range `ColRange`, you can use Conditional Formatting in Excel. Here’s how to set it up: ### Step-by-Step Instructions: 1. **Select Your Range**: - Click on any cell in the column where your numbers are (the one associated with the named range `ColRa...
46,715
[ { "from": "human", "value": "Using a macro I have consolidated info from several workbooks into one sheet in new workbook.\nIn one column I have created a named range called ColRange. That column has numbers ranging from -350 to 500.\nHow do I change the color of the cells based on the value of the text i...
I'd like to give my boyfriend a taste of programming. If it was up to me, I'd teach Scheme, Haskell or F# but since he'd rather learn something that can be useful in his job as a fiscal consultant, i.e. programming Excel. What are the options for programming Excel? Which one would you recommend for someone who's just l...
Programming Excel can be a great way to introduce someone to coding while also providing them with practical skills for their job. Here are a few options for programming in Excel, along with recommendations tailored to both your boyfriend’s needs and your own experience: ### Options for Programming Excel: 1. **Excel ...
46,819
[ { "from": "human", "value": "I'd like to give my boyfriend a taste of programming. If it was up to me, I'd teach Scheme, Haskell or F# but since he'd rather learn something that can be useful in his job as a fiscal consultant, i.e. programming Excel.\nWhat are the options for programming Excel? Which one wo...
How can I use Windsor in my .net 3.5 solution? Can I use the binaries built for .net 2.0? Do I need to compile the Castle Windsor source myself, targeting 3.5?
Castle Windsor is an Inversion of Control (IoC) container that can be used in .NET applications, including those targeting the .NET Framework 3.5. Here’s how you can use Windsor in your .NET 3.5 solution: ### 1. Using Binaries Built for .NET 2.0 You can use binaries built for .NET 2.0 in a .NET 3.5 project. .NET 3.5 ...
48,682
[ { "from": "human", "value": "How can I use Windsor in my .net 3.5 solution? Can I use the binaries built for .net 2.0? Do I need to compile the Castle Windsor source myself, targeting 3.5?\n" }, { "from": "gpt", "value": "Castle Windsor is an Inversion of Control (IoC) container that can be used...
We have an app that monitors a folder for file drop and need to initiate a virus scan before using any incoming files. This needs to be a part of the Delphi app and the file must pass the Virus Scan otherwise we delete the file. I know that there are command shell options available, however this must be a direct API ca...
Integrating virus scanning functionality directly into your Delphi application requires using an API from a third-party antivirus solution. Here are some suggestions on antivirus engines that provide APIs which you can leverage for your purpose: ### 1. **Windows Defender API** Windows Defender has an API that allows d...
47,970
[ { "from": "human", "value": "We have an app that monitors a folder for file drop and need to initiate a virus scan before using any incoming files.\nThis needs to be a part of the Delphi app and the file must pass the Virus Scan otherwise we delete the file.\nI know that there are command shell options avai...
I want to exceute a simple command which works from the shell but doesn't work from Java. This is the command I want to execute, which works fine: soffice -headless "-accept=socket,host=localhost,port=8100;urp;" This is the code I am excecuting from Java trying to run this command: String[] commands = new String[] {"...
The issue you're encountering is related to how you are passing the command-line arguments to the `ProcessBuilder`. When you invoke a command through Java, the arguments must be passed separately, without additional quotes around them. The way you've constructed your command is incorrect because you're enclosing the th...
49,865
[ { "from": "human", "value": "I want to exceute a simple command which works from the shell but doesn't work from Java.\nThis is the command I want to execute, which works fine:\nsoffice -headless \"-accept=socket,host=localhost,port=8100;urp;\" \n\nThis is the code I am excecuting from Java trying to run th...
Can I get some constructive feedback about the following architecture? Simplified Architecture Summary: Return XML from your SQL Server (using FOR XML) and pass it straight into a XSL transform to produce a rich HTML web site. What are the pro’s and con’s of such a system when compared with a conventional 3-tier ASP.N...
Your proposed architecture of returning XML from SQL Server and using XSLT for transforming that XML into HTML has its own set of advantages and disadvantages when compared to a conventional 3-tier ASP.NET architecture. Here’s a breakdown: ### Pros of XML and XSLT Approach: 1. **Simplicity of Data Transfer**: - Us...
47,286
[ { "from": "human", "value": "Can I get some constructive feedback about the following architecture? \nSimplified Architecture Summary:\nReturn XML from your SQL Server (using FOR XML) and pass it straight into a XSL transform to produce a rich HTML web site.\nWhat are the pro’s and con’s of such a system wh...