instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
I'm having some issues with producing an int matrix without creating memory leaks. I want to be able to make a given (global) matrix into any size dynamically via read_matrix(). But then i want to be able to free the memory later on. So in my main method the second printf should result in a bus error since it should no...
You're on the right track with dynamically allocating memory for your matrix, but there are a couple of key issues in your code that need addressing to avoid memory leaks and ensure proper memory management. Here's a refined version of your code, along with explanations of the changes: ### Corrected Code: ```c #inclu...
13,727
[ { "from": "human", "value": "I'm having some issues with producing an int matrix without creating memory leaks. I want to be able to make a given (global) matrix into any size dynamically via read_matrix(). But then i want to be able to free the memory later on. So in my main method the second printf should...
I have an AIR application that takes command-line arguments via onInvoke. All is good, but I cannot figure out how to print some status messages back to the user (to stdout / console, so to speak). Is it possible? Even a default log file for traces would be fine, but I can't find any info about it anywhere. Do I need t...
In AIR applications, especially those that are running on the desktop, there isn't a built-in mechanism to print messages directly to stdout or to a console like you might expect in other programming environments. However, you do have a few options for logging or displaying status messages to the user. ### 1. **Using ...
20,308
[ { "from": "human", "value": "I have an AIR application that takes command-line arguments via onInvoke. All is good, but I cannot figure out how to print some status messages back to the user (to stdout / console, so to speak). Is it possible?\nEven a default log file for traces would be fine, but I can't fi...
VB 2008. I have several text boxes on a form and I want each of them to use the same event handler. I know how to manually wire each one up to the handler, but I'm looking for a more generic way so if I add more text boxes they will automatically be hooked up to the event handler. Ideas? EDIT: Using the C# sample from ...
It looks like you've already come up with a good solution using a loop to associate the `TextChanged` event for all `TextBox` controls on your form. Here's a complete example of how you might implement this in your form: 1. Call the `AssociateTextboxEventHandler` method during the form's initialization (e.g., in the `...
21,656
[ { "from": "human", "value": "VB 2008.\nI have several text boxes on a form and I want each of them to use the same event handler. I know how to manually wire each one up to the handler, but I'm looking for a more generic way so if I add more text boxes they will automatically be hooked up to the event handl...
I asked before about pixel-pushing, and have now managed to get far enough to get noise to show up on the screen. Here's how I init: CGDataProviderRef provider; bitmap = malloc(320*480*4); provider = CGDataProviderCreateWithData(NULL, bitmap, 320*480*4, NULL); CGColorSpaceRef colorSpaceRef; colorSpaceRef = CGColorSpace...
Yes, it is indeed possible to achieve full-screen pixel-based graphics and update them at 30fps without using the 3D chip, but there are several optimizations you can apply to improve the performance of your current implementation. Here are some suggestions: ### 1. Avoid Recreating the Image Every Frame Currently, you...
18,096
[ { "from": "human", "value": "I asked before about pixel-pushing, and have now managed to get far enough to get noise to show up on the screen. Here's how I init:\nCGDataProviderRef provider;\nbitmap = malloc(320*480*4);\nprovider = CGDataProviderCreateWithData(NULL, bitmap, 320*480*4, NULL);\nCGColorSpaceRe...
I wonder why no browser out there has such simple but essential feature. Am I missing something? Is there a technical reason? I'm tired of all those javascript/flash/java hacks out there ...
It sounds like you're referring to a specific feature that you feel is essential for browsers but is currently not widely implemented. While you didn't specify the feature, there are several reasons why certain features may not be widely adopted in browsers: 1. **Compatibility and Standards**: Browsers aim to adhere t...
24,535
[ { "from": "human", "value": "I wonder why no browser out there has such simple but essential feature. Am I missing something? Is there a technical reason?\nI'm tired of all those javascript/flash/java hacks out there ...\n" }, { "from": "gpt", "value": "It sounds like you're referring to a speci...
I have a custom user control with a textbox on it and I'd like to expose the baseline (of the text in the textbox) snapline outside of the custom control. I know that you create a designer (inherited from ControlDesigner) and override SnapLines to get access to the snaplines, but I'm wondering how to get the text base...
To expose the baseline snapline of a TextBox in your custom user control, you'll need to follow these steps: 1. **Create a Custom User Control**: Ensure your custom user control contains a `TextBox`. 2. **Implement a Control Designer**: Create a designer class that inherits from `ControlDesigner` or `ControlDesigner`...
10,583
[ { "from": "human", "value": "I have a custom user control with a textbox on it and I'd like to expose the baseline (of the text in the textbox) snapline outside of the custom control. I know that you create a designer (inherited from ControlDesigner) and override SnapLines to get access to the snaplines, b...
I'm working with a datagrid and adapter that correspond with an MSAccess table through a stored query (named "UpdatePaid", 3 paramaters as shown below) like so: OleDbCommand odc = new OleDbCommand("UpdatePaid", connection); OleDbParameter param; odc.CommandType = CommandType.StoredProcedure; param = ...
The behavior you're observing with the `Prepare()` method is related to how command execution is optimized in ADO.NET when working with databases. Let's break down your questions: ### Do I need to call `Prepare()` every time with OleDb? - **`Prepare()` Method**: When you call `Prepare()` on an `OleDbCommand`, you are...
21,123
[ { "from": "human", "value": "I'm working with a datagrid and adapter that correspond with an MSAccess table through a stored query (named \"UpdatePaid\", 3 paramaters as shown below) like so:\n OleDbCommand odc = new OleDbCommand(\"UpdatePaid\", connection);\n\n OleDbParameter param;\n\n odc.Comman...
By default, I think my vimrc setttings enable the auto-wrapping. However, sometimes, I would like to see text lines are not wrapped. Is there any command I toggle the text line wrapping enabled and disabled? This would avoid me to exit and to change settings.
Yes, in Vim, you can toggle line wrapping on and off without needing to exit or modify your `.vimrc`. To toggle line wrapping, you can use the following command: 1. Press `Esc` to ensure you're in Normal mode. 2. Type `:set wrap!` and then press `Enter`. This command will toggle the `wrap` setting, enabling wrapping ...
25,358
[ { "from": "human", "value": "By default, I think my vimrc setttings enable the auto-wrapping. However, sometimes, I would like to see text lines are not wrapped. Is there any command I toggle the text line wrapping enabled and disabled? This would avoid me to exit and to change settings.\n" }, { "fr...
I am using Symphony framework and I have the default sandbox inside the Eclipse IDE. When I double click schema.yml instead of open in Eclipse it requests Windows to select a program to choose. I am a Visual Studio guy and I do not understand why it doesn't open in Eclipse, what should I do?
It sounds like the file association for `.yml` (YAML) files is not properly set in your Windows environment, which is why double-clicking the `schema.yml` file prompts you to select a program to open it instead of opening it directly in Eclipse. Here's how you can resolve this issue so that `.yml` files open in Eclips...
21,414
[ { "from": "human", "value": "I am using Symphony framework and I have the default sandbox inside the Eclipse IDE. When I double click schema.yml instead of open in Eclipse it requests Windows to select a program to choose. I am a Visual Studio guy and I do not understand why it doesn't open in Eclipse, what...
We have developed our website(Business users website) in .net Framework 2.0 Our client us to migrate to .net Framework 3.5. I am not interested in developing the same thing in both the frameworks. Please anyone tell me some of the new features like card space, work flow, presentation foundation concepts in .net frame...
Migrating from .NET Framework 2.0 to .NET Framework 3.5 can provide you with access to several new features and enhancements that can improve your application's functionality, performance, and maintainability. Below are some notable features in .NET Framework 3.5, along with potential real-time use cases: ### 1. Langu...
17,815
[ { "from": "human", "value": "We have developed our website(Business users website) in .net Framework 2.0 Our client us to \nmigrate to .net Framework 3.5. \nI am not interested in developing the same thing in both the frameworks.\nPlease anyone tell me some of the new features like card space, work flow, pr...
I have a internal website that users log into. This data is saved as a cookie. From there the users go on their merry way. Every so often the application(s) will query the authentication record to determine what permissions the user has. My question is this: Is it more efficent to just query the cookie for the user...
When considering whether to use cookies, ViewState, or Session to manage user authentication data and permissions in your internal website, there are several factors to keep in mind. Let's evaluate each option: ### Cookies - **Pros**: - **Persistent**: Cookies can persist across sessions (until expiration), allowing...
16,868
[ { "from": "human", "value": "I have a internal website that users log into. This data is saved as a cookie. From there the users go on their merry way. Every so often the application(s) will query the authentication record to determine what permissions the user has. \nMy question is this: Is it more effi...
I have never really found the design view in Visual Studio useful when developing aspx pages, and so I basically never use it. Am I missing something or is it just one of those features that isn't particularly useful? Do you use the design view? If so, how do you find it useful? If not, why not?
Many developers have mixed feelings about the Design View in Visual Studio when working with ASPX pages. Here are some common perspectives: ### Reasons Some Developers Avoid Design View: 1. **Limited Control**: Design View can often abstract away the underlying HTML and CSS, which might lead to confusion if changes m...
22,130
[ { "from": "human", "value": "I have never really found the design view in Visual Studio useful when developing aspx pages, and so I basically never use it.\nAm I missing something or is it just one of those features that isn't particularly useful? Do you use the design view? If so, how do you find it usef...
Can you get the distinct combination of 2 different fields in a database table? if so, can you provide the SQL example.
Yes, you can retrieve distinct combinations of two different fields in a database table using SQL. The `SELECT DISTINCT` statement is used for this purpose. Here is an example SQL query that demonstrates how to do this. Suppose you have a table named `Employees` with the following fields: - `Department` - `JobTitle` ...
25,128
[ { "from": "human", "value": "Can you get the distinct combination of 2 different fields in a database table? if so, can you provide the SQL example.\n" }, { "from": "gpt", "value": "Yes, you can retrieve distinct combinations of two different fields in a database table using SQL. The `SELECT DI...
How exactly do DLL files work? There seems to be an awful lot of them, but I don't know what they are or how they work. So, what's the deal with them?
Dynamic Link Libraries (DLLs) are a crucial part of the Windows operating system and application development. Here's a breakdown of what they are, how they work, and their significance: ### What are DLL Files? 1. **Definition**: A DLL file is a collection of small programs, functions, or resources that can be used by...
19,731
[ { "from": "human", "value": "How exactly do DLL files work? There seems to be an awful lot of them, but I don't know what they are or how they work.\nSo, what's the deal with them?\n" }, { "from": "gpt", "value": "Dynamic Link Libraries (DLLs) are a crucial part of the Windows operating system a...
Is there an easy way of cloning entire installed debian/ubuntu system? I want to have identical installation in terms of installed packages and as much as possible of settings. I've looked into options of aptitude, apt-get, synaptic but have found nothing.
Yes, there are several methods you can use to clone an entire installed Debian/Ubuntu system. Below are a few approaches that can help you achieve a complete clone of your system, including installed packages and configuration files. ### Method 1: Using `dpkg` and `rsync` 1. **Create a Package List**: You can generat...
19,780
[ { "from": "human", "value": "Is there an easy way of cloning entire installed debian/ubuntu system?\nI want to have identical installation in terms of installed packages and as much as possible of settings.\nI've looked into options of aptitude, apt-get, synaptic but have found nothing. \n" }, { "fr...
I must implement a web service which expose a list of values (integers, custom classes etc). My working solution returns a List<T>, and according to FxCop it is better to return a Collection<T> or ReadOnlyCollection<T>. If I choose to return a ReadOnlyCollection<T>, the web service shows an error like: To be XML seria...
To expose a list of values via a web service while adhering to the recommendations from FxCop (by returning a `Collection<T>` or `ReadOnlyCollection<T>`) and maintaining internal use of `List<T>`, you can encapsulate the list within a class that provides a read-only view of the collection. Since you're constrained to ....
20,267
[ { "from": "human", "value": "I must implement a web service which expose a list of values (integers, custom classes etc).\nMy working solution returns a List<T>, and according to FxCop it is better to return a Collection<T> or ReadOnlyCollection<T>.\nIf I choose to return a ReadOnlyCollection<T>, the web se...
Here's the scenario-- you've got a JSON object on the browser, and let's say it has a boolean property, called "Active". We want to create a new JSON object that contains only items that have Active = True. Is there an easy way to do this, other than looping through the entire JSON object? I'm basically trying to use A...
In JavaScript, if you have a JSON object (or an array of objects) and you want to filter it based on a boolean property (in this case, `Active`), you can use the `filter` method. This method creates a new array with all elements that pass the test implemented by the provided function, which makes it a very efficient wa...
23,195
[ { "from": "human", "value": "Here's the scenario-- you've got a JSON object on the browser, and let's say it has a boolean property, called \"Active\". We want to create a new JSON object that contains only items that have Active = True. Is there an easy way to do this, other than looping through the entire...
I'm working on a sparse matrix class that needs to use an array of LinkedList to store the values of a matrix. Each element of the array (i.e. each LinkedList) represents a row of the matrix. And, each element in the LinkedList array represents a column and the stored value. In my class, I have a declaration of the arr...
You're encountering a common issue in Java related to generic types and array creation. Let's break down your questions: ### 1. What are you doing wrong? In Java, you cannot directly create an array of a generic type like `LinkedList<IntegerNode>`. This is due to type erasure in Java's generics, which means that at r...
22,071
[ { "from": "human", "value": "I'm working on a sparse matrix class that needs to use an array of LinkedList to store the values of a matrix. Each element of the array (i.e. each LinkedList) represents a row of the matrix. And, each element in the LinkedList array represents a column and the stored value.\nIn...
Using Oracle, if a column value can be 'YES' or 'NO' is it possible to constrain a table so that only one row can have a 'YES' value? I would rather redesign the table structure but this is not possible. [UDPATE] Sadly, null values are not allowed in this table.
Yes, you can enforce a constraint in Oracle to ensure that only one row in a table can have a 'YES' value in a specific column. Since you've mentioned that redesigning the table is not possible, we can achieve this by using a combination of a **unique constraint** and a **check constraint**. Here’s how you can do it: ...
21,413
[ { "from": "human", "value": "Using Oracle, if a column value can be 'YES' or 'NO' is it possible to constrain a table so that only one row can have a 'YES' value?\nI would rather redesign the table structure but this is not possible.\n[UDPATE] Sadly, null values are not allowed in this table.\n" }, { ...
I use ClearCase. I have a snapshot view. Is there a way to compare this view with stream to find changed files? In TortoiseSVN this is called "Check for modifications" and shows all difference between local copy and what we have in the repo.
In IBM Rational ClearCase, comparing a snapshot view with a stream to find changed files can be done, but the process is different from tools like TortoiseSVN. ClearCase does not have a direct equivalent to the "Check for modifications" feature of TortoiseSVN, but you can achieve similar results using command-line tool...
21,672
[ { "from": "human", "value": "I use ClearCase. I have a snapshot view. Is there a way to compare this view with stream to find changed files? \nIn TortoiseSVN this is called \"Check for modifications\" and shows all difference between local copy and what we have in the repo.\n" }, { "from": "gpt", ...
How do I write unit tests in .NET? Specifically Visual Studio 2005?
Writing unit tests in .NET, specifically using Visual Studio 2005, involves several steps. Here’s a guide to help you set up and write your unit tests: ### Step 1: Set Up Your Project 1. **Create a New Solution or Open an Existing One**: - Start Visual Studio 2005. - You can either create a new solution for you...
19,292
[ { "from": "human", "value": "How do I write unit tests in .NET? \nSpecifically Visual Studio 2005?\n" }, { "from": "gpt", "value": "Writing unit tests in .NET, specifically using Visual Studio 2005, involves several steps. Here’s a guide to help you set up and write your unit tests:\n\n### Step ...
Within a table cell that is vertical-align:bottom, I have one or two divs. Each div is floated right. Supposedly, the divs should not align to the bottom, but they do (which I don't understand, but is good). However, when I have two floated divs in the cell, they align themselves to the same top line. I want the first...
To achieve your desired layout where the "@" sign sits at the bottom of the cell next to the yellow div, we can use a combination of CSS properties. Since you're working with floated elements and the `vertical-align` property can be tricky with them, the following approach should resolve your issues: 1. **Make the par...
16,435
[ { "from": "human", "value": "Within a table cell that is vertical-align:bottom, I have one or two divs. Each div is floated right.\nSupposedly, the divs should not align to the bottom, but they do (which I don't understand, but is good).\nHowever, when I have two floated divs in the cell, they align themse...
I know about Application.Exit() but what if I'm not in a windows forms application but in a simple class library, how do I signal for the application to exit?
In a class library, there isn't a direct way to signal an entire application to exit since the library does not have context about the application it is running in. However, you can achieve this by defining a mechanism that communicates your intent to exit to the host application. Here are a few approaches you can con...
21,148
[ { "from": "human", "value": "I know about Application.Exit() but what if I'm not in a windows forms application but in a simple class library, how do I signal for the application to exit?\n" }, { "from": "gpt", "value": "In a class library, there isn't a direct way to signal an entire applicatio...
There are some nice things about it (like it encapsulates the concept of Cyclomatic complexity), and I was wondering if anyone has used it in "real life". If so, what are your experiences? Is it a useful measure of size (as opposed to KLOC or Function Points)? For those wondering what I'm smoking: Here's a link to so...
The AbcMetric is indeed an interesting metric for measuring code complexity and size. It combines several factors, such as lines of code, control flow complexity (cyclomatic complexity), and other attributes that can provide a more nuanced understanding of code quality than traditional metrics like KLOC (thousand lines...
22,954
[ { "from": "human", "value": "There are some nice things about it (like it encapsulates the concept of Cyclomatic complexity), and I was wondering if anyone has used it in \"real life\". If so, what are your experiences? Is it a useful measure of size (as opposed to KLOC or Function Points)?\nFor those won...
I am using wxWidgets and Visual C++ to create functionality similar to using Unix "tail -f" with rich formatting (colors, fonts, images) in a GUI. I am targeting both wxMSW and wxMAC. The obvious answer is to use wxTextCtrl with wxTE_RICH, using calls to wxTextCtrl::SetDefaultStyle() and wxTextCtrl::WriteText(). How...
It sounds like you're facing performance issues with `wxTextCtrl` when displaying a high-frequency log output in your GUI application. Given the nature of your application, you have a few different strategies you can consider to improve performance while maintaining the rich formatting you desire. ### Considerations a...
17,372
[ { "from": "human", "value": "I am using wxWidgets and Visual C++ to create functionality similar to using Unix \"tail -f\" with rich formatting (colors, fonts, images) in a GUI. I am targeting both wxMSW and wxMAC.\nThe obvious answer is to use wxTextCtrl with wxTE_RICH, using calls to wxTextCtrl::SetDefau...
I am doing an InternetConnect (Wininet) to an FTP server that happens to be running on an iPhone. When the user is on a normal WiFi network it works fine for him. When he has an ad hoc network with his iPhone he gets an ERROR_INTERNET_TIMEOUT. I presume this is some kind of routing problem. I am curious as to why t...
To understand why you are getting `ERROR_INTERNET_TIMEOUT` instead of `ERROR_INTERNET_CANNOT_CONNECT` in your FTP connection attempt to an iPhone running an FTP server over an ad hoc network, it's important to break down the TCP/IP connection process and what these errors signify. ### TCP Connection Overview When you...
16,938
[ { "from": "human", "value": "I am doing an InternetConnect (Wininet) to an FTP server that happens to be running on an iPhone. When the user is on a normal WiFi network it works fine for him. When he has an ad hoc network with his iPhone he gets an ERROR_INTERNET_TIMEOUT. I presume this is some kind of r...
Is there a better way to profile code then: $start1 = microtime(TRUE); for($i=0;$i<count($array);$i++) { //do something } $time1 = microtime(TRUE) - $start1;
Yes, while using `microtime(TRUE)` is a straightforward way to measure the execution time of a code block in PHP, there are more sophisticated profiling techniques and tools that can give you deeper insights into performance. Here are some alternatives and enhancements you might consider: ### 1. Use a Profiler **Xdeb...
20,909
[ { "from": "human", "value": "Is there a better way to profile code then:\n$start1 = microtime(TRUE);\nfor($i=0;$i<count($array);$i++)\n {\n //do something\n }\n$time1 = microtime(TRUE) - $start1;\n\n" }, { "from": "gpt", "value": "Yes, while using `microtime(TRUE)` is a straightforward way to...
In Model-View-Presenter pattern where should we write validations of user input.
In the Model-View-Presenter (MVP) pattern, the responsibilities of each component are clearly defined. Here's how user input validation typically fits into this pattern: 1. **View**: The View is responsible for displaying data to the user and capturing user input. It should have basic validation such as ensuring requi...
22,893
[ { "from": "human", "value": "In Model-View-Presenter pattern where should we write validations of user input.\n" }, { "from": "gpt", "value": "In the Model-View-Presenter (MVP) pattern, the responsibilities of each component are clearly defined. Here's how user input validation typically fits in...
neither <?php system('php file.php'); ?> nor <?php system('/usr/bin/php file.php'); ?> worked. Why? I tried with -q, with !#/usr/bin/php etc.
There could be several reasons why both of your attempts to execute `file.php` using `system()` in PHP did not work. Here are some common troubleshooting steps and potential issues to check: 1. **File Permissions**: Ensure that `file.php` has the correct permissions to be executed. The user under which the web server ...
19,183
[ { "from": "human", "value": "neither\n<?php system('php file.php'); ?>\n\nnor\n<?php system('/usr/bin/php file.php'); ?>\n\nworked. Why?\nI tried with -q, with !#/usr/bin/php etc.\n" }, { "from": "gpt", "value": "There could be several reasons why both of your attempts to execute `file.php` usin...
What are some practical uses for the "Curiously Recurring Template Pattern"? The "counted class" example commonly shown just isn't a convincing example to me.
The Curiously Recurring Template Pattern (CRTP) is a design pattern in C++ that allows a class to inherit from a template instantiation of itself. It can be quite useful in several scenarios, beyond the common "counted class" example. Here are some practical uses of the CRTP: 1. **Static Polymorphism**: CRTP enables a...
18,147
[ { "from": "human", "value": "What are some practical uses for the \"Curiously Recurring Template Pattern\"? The \"counted class\" example commonly shown just isn't a convincing example to me.\n" }, { "from": "gpt", "value": "The Curiously Recurring Template Pattern (CRTP) is a design pattern in...
Using C# .NET 2.0, I have an owner-drawn ListView where I'm overriding the OnDrawColumnHeader, OnDrawItem and OnDrawSubitem events. If I set the View property to Details at design-time, everything works beautifully and I can switch the View property and all view modes display as they should (I'm not using Tile view). ...
This issue typically arises because the ListView control's drawing behavior depends on its current view mode. If you start in a view mode other than Details (like LargeIcon, SmallIcon, or List), certain properties and methods related to the drawing of items and subitems may not be triggered correctly. To fix this issu...
22,439
[ { "from": "human", "value": "Using C# .NET 2.0, I have an owner-drawn ListView where I'm overriding the OnDrawColumnHeader, OnDrawItem and OnDrawSubitem events. If I set the View property to Details at design-time, everything works beautifully and I can switch the View property and all view modes display a...
I am working on a collection MATLAB, Java, and C/C++ components that all inter-operate, but have distinctly different compilation/installation steps. We currently don't compile anything for MATLAB, use maven2 for our Java build and unit tests, and use autotools for our C/C++ build and unit tests. I would like to move ...
Integrating different build systems such as Maven, Autotools, and potentially others can indeed be challenging. However, it is possible to maintain a mixed build environment while leveraging the strengths of each system without having to rip everything out and start over. Here are some strategies to consider: ### 1. M...
17,935
[ { "from": "human", "value": "I am working on a collection MATLAB, Java, and C/C++ components that all inter-operate, but have distinctly different compilation/installation steps. We currently don't compile anything for MATLAB, use maven2 for our Java build and unit tests, and use autotools for our C/C++ bu...
I see a bunch of lines in the .log files in the postgres pg_log directory that say something like: ERROR: prepared statement "pdo_pgsql_stmt_09e097f4" does not exist What are prepared statements, and what kinds of things can cause these error messages to be displayed?
Prepared statements are a feature in PostgreSQL and many other relational database management systems that allow you to create a template for a SQL query. When you prepare a statement, the database server parses, analyzes, and optimizes the query just once, and then you can execute that query multiple times with differ...
13,600
[ { "from": "human", "value": "I see a bunch of lines in the .log files in the postgres pg_log directory that say something like:\n\nERROR: prepared statement \"pdo_pgsql_stmt_09e097f4\" does not exist\n\nWhat are prepared statements, and what kinds of things can cause these error messages to be displayed?\n...
I'm wondering what is the best way to handle error messages in my application. Currently I'm working on a web application and all error messages are stored in the database and we get them by ID, negative is an error , and positive are success messages. the problem is that is hard to maintain and keep tracking of text ...
Handling error messages effectively is crucial for maintaining a good user experience in a web application. Here are some approaches to improve the management of error messages in your application: ### 1. **Centralized Error Handling** - **Custom Error Classes:** Create custom error classes that extend from standard ...
9,740
[ { "from": "human", "value": "I'm wondering what is the best way to handle error messages in my application. \nCurrently I'm working on a web application and all error messages are stored in the database and we get them by ID, negative is an error , and positive are success messages.\nthe problem is that is ...
It seems redundant to have zlib compress a web page during every request. It is also the bottleneck of my files' response times. Is there a way to cache the zlib'd file so that it is compressed only once at each modification? Or should I just keep wishing?
Caching compressed responses is a common practice to improve performance in web applications, and you don't need to keep wishing—there are ways to implement it effectively. Here are some approaches you can consider: ### 1. **Server-Side Caching**: - Use a caching mechanism on your server to cache the compressed ver...
18,566
[ { "from": "human", "value": "It seems redundant to have zlib compress a web page during every request. It is also the bottleneck of my files' response times. Is there a way to cache the zlib'd file so that it is compressed only once at each modification? Or should I just keep wishing?\n" }, { "from"...
I'd like to call methods of my DAOs by AJAX. I'm quite new in that so I would like to ask what is the best way to do that. Is it possible to publish my beans as web services and call them with e.g. jQuery? I think it is not possible :) I've also read about Direct Web Remoting but I don't know which way to go... As I s...
Certainly! Calling Data Access Objects (DAOs) via AJAX is a common practice when building web applications. It allows you to interact with the server asynchronously, fetching data or sending updates without requiring a page refresh. Here are some approaches you can consider: ### 1. RESTful Web Services One of the mos...
16,834
[ { "from": "human", "value": "I'd like to call methods of my DAOs by AJAX. I'm quite new in that so I would like to ask what is the best way to do that. Is it possible to publish my beans as web services and call them with e.g. jQuery? I think it is not possible :) I've also read about Direct Web Remoting bu...
I'm used to python, so this is a bit confusing to me. I'm trying to take in input, line-by-line, until a user inputs a certain number. The numbers will be stored in an array to apply some statistical maths to them. Currently, I have a main class, the stats classes, and an "reading" class. Two Questions: I can't seem t...
No problem! It looks like you're making good progress, but there are a few adjustments needed to get your code working correctly. I'll address your questions step-by-step. ### 1. Input Loop To read input line-by-line until a specific number is inputted, you can use a loop that continues until the user enters that num...
10,053
[ { "from": "human", "value": "I'm used to python, so this is a bit confusing to me. I'm trying to take in input, line-by-line, until a user inputs a certain number. The numbers will be stored in an array to apply some statistical maths to them. Currently, I have a main class, the stats classes, and an \"read...
What are differences between declaring a method in a base type "virtual" and then overriding it in a child type using the "override" keyword as opposed to simply using the "new" keyword when declaring the matching method in the child type?
In object-oriented programming, particularly in languages like C# (or similar languages), the distinction between using `virtual`/`override` and `new` keywords has to do with how method resolution works in the context of inheritance. Here’s a breakdown of the differences between the two approaches: ### `virtual` and `...
20,667
[ { "from": "human", "value": "What are differences between declaring a method in a base type \"virtual\" and then overriding it in a child type using the \"override\" keyword as opposed to simply using the \"new\" keyword when declaring the matching method in the child type? \n" }, { "from": "gpt", ...
Should the "visibility" for the __destruct() function be public or something else? I'm trying to write a standards doc for my group and this question came up.
In PHP, the `__destruct()` function is a magic method that is automatically called when an object is destroyed or goes out of scope. As for its visibility, it is recommended to use `public` visibility for the `__destruct()` method. Here are some key points to consider: 1. **Public Visibility**: The `__destruct()` met...
23,951
[ { "from": "human", "value": "Should the \"visibility\" for the __destruct() function be public or something else? I'm trying to write a standards doc for my group and this question came up.\n" }, { "from": "gpt", "value": "In PHP, the `__destruct()` function is a magic method that is automatical...
I need to be able to take a string like: '''foo, bar, "one, two", three four''' into: ['foo', 'bar', 'one, two', 'three four'] I have an feeling (with hints from #python) that the solution is going to involve the shlex module.
You are correct that the `shlex` module can be useful for this kind of parsing, especially when you want to handle quoted strings and commas properly. The `shlex.split()` function is designed to split strings in a shell-like manner, which makes it suitable for this task. Here's how you can use `shlex` to achieve the d...
23,672
[ { "from": "human", "value": "I need to be able to take a string like:\n'''foo, bar, \"one, two\", three four'''\n\ninto:\n['foo', 'bar', 'one, two', 'three four']\n\nI have an feeling (with hints from #python) that the solution is going to involve the shlex module.\n" }, { "from": "gpt", "value"...
The System.Collections.Specialized.NameObjectCollectionBase class is used extensively at my company as the basis of collection classes. (Let's not get into questioning why.) I recently came across a situation where I needed to add an object at a specific index, but the functionality wasn't there. At first I wondered wh...
The design of `NameObjectCollectionBase` in .NET was likely influenced by several considerations, which might explain the absence of an "insert at specific index" method: 1. **Underlying Data Structure**: `NameObjectCollectionBase` is built on a combination of a `Hashtable` (for key-based lookups) and an `ArrayList` (...
23,090
[ { "from": "human", "value": "The System.Collections.Specialized.NameObjectCollectionBase class is used extensively at my company as the basis of collection classes. (Let's not get into questioning why.) I recently came across a situation where I needed to add an object at a specific index, but the functiona...
I had a problem with committing changes after merging two branches of my project using TortoiseSVN. Here are details: I did a merge branch to trunk of project which I am working on. Project includes main repository and libraries joint to main repository as svn external (libraries are also branched) as subdirectory of ...
The issue you're experiencing with TortoiseSVN and the error message about the inability to lock the `lib` directory seems to stem from how SVN handles externals and working copies, particularly when there are multiple directories involved in a commit. Here are a few points to consider regarding the issue: 1. **SVN E...
22,572
[ { "from": "human", "value": "I had a problem with committing changes after merging two branches of my project using TortoiseSVN.\nHere are details:\nI did a merge branch to trunk of project which I am working on. \nProject includes main repository and libraries joint to main repository as svn external (libr...
Starting new .NET projects always involves a bit of work. You have to create the solution, add projects for different tiers (Domain, DAL, Web, Test), set up references, solution structure, copy javascript files, css templates and master pages etc etc. What I'd like is an easy way of cloning any given solution. If you ...
You're right that starting new .NET projects can be a tedious task if you have to set up everything from scratch every time. While Visual Studio provides project templates, there isn't a built-in feature for solution templates that includes renaming all namespaces and GUIDs automatically. However, you can achieve what...
19,060
[ { "from": "human", "value": "Starting new .NET projects always involves a bit of work. You have to create the solution, add projects for different tiers (Domain, DAL, Web, Test), set up references, solution structure, copy javascript files, css templates and master pages etc etc.\nWhat I'd like is an easy w...
If I have two variables: Object obj; String methodName = "getName"; Without knowing the class of obj, how can I call the method identified by methodName on it? The method being called has no parameters, and a String return value. It's a getter for a Java bean.
To call a method on an object using reflection in Java when you don't know the object's class at compile time, you can use the `java.lang.reflect` package. Here's how you can do it for the specified scenario: 1. Use `getClass()` to retrieve the class of the object. 2. Use `getMethod()` to find the method by its name a...
22,238
[ { "from": "human", "value": "If I have two variables:\nObject obj;\nString methodName = \"getName\";\n\nWithout knowing the class of obj, how can I call the method identified by methodName on it?\nThe method being called has no parameters, and a String return value. It's a getter for a Java bean.\n" }, ...
public class Item { ... } public class Order { public List<Item> Items ... } public class Customer { public List<Order> Orders ... } Now, using LINQ I need to get all items that a customer bought. How can I? I tried something like var items = from o in cust.Orders select o.Items; but r...
To retrieve all items that a customer has bought using LINQ while avoiding nested loops, you can use the `SelectMany` method. This method allows you to flatten the results into a single collection. Here's how you can do it: ```csharp var items = cust.Orders.SelectMany(o => o.Items); ``` In this code: - `cust.Orders`...
24,960
[ { "from": "human", "value": "public class Item\n {\n ...\n }\npublic class Order\n{\n public List<Item> Items\n ...\n}\n\npublic class Customer\n{\n public List<Order> Orders\n ...\n}\n\nNow, using LINQ I need to get all items that a customer bought. How can I?\nI tried something li...
A quick Google search of this issue shows it's common, I just can't for the life of me figure out the solution in my case. I have a straight forward install of wxWidgets 2.8.8 for Windows straight from the wxWidgets website. Whenever I try to compile anything (such as the sample app described in "First Programs for wxW...
The error you are encountering (`wx/setup.h: No such file or directory`) typically indicates that the wxWidgets library is not properly built or configured. Here's a step-by-step guide to help you resolve the issue: 1. **Ensure wxWidgets is Built**: - The `setup.h` file is generated during the build process of wxWi...
15,082
[ { "from": "human", "value": "A quick Google search of this issue shows it's common, I just can't for the life of me figure out the solution in my case.\nI have a straight forward install of wxWidgets 2.8.8 for Windows straight from the wxWidgets website.\nWhenever I try to compile anything (such as the samp...
I'm having trouble wrapping my head around this. Right now I have some models that looks kind of like this: def Review(models.Model) ...fields... overall_score = models.FloatField(blank=True) def Score(models.Model) review = models.ForeignKey(Review) question = models.TextField() grade = models.I...
Using Django's signal dispatcher can indeed provide benefits in your case. While overriding the `save` method to recalculate the `overall_score` works, utilizing signals can provide a cleaner and more modular approach. Here's a breakdown of the benefits and considerations when using signals: ### Benefits of Using Djan...
20,085
[ { "from": "human", "value": "I'm having trouble wrapping my head around this. Right now I have some models that looks kind of like this:\n def Review(models.Model)\n ...fields...\n overall_score = models.FloatField(blank=True)\n\ndef Score(models.Model)\n review = models.ForeignKey(Review)\n qu...
I am completely new to ruby and I inherited a ruby system for a product catalogue. Most of my users are able to view everything as they should but overseas users (specifically Mexico) cannot contact the server once logged in. They are an active user. I'm sorry I cannot be more specific, and the system is private so I c...
While it's difficult to diagnose the issue without more specific details about your Ruby system and its architecture, there are a few potential reasons why overseas users, specifically in Mexico, might be experiencing connectivity issues after logging in. Here are some areas you could investigate: ### 1. **Network Iss...
21,684
[ { "from": "human", "value": "I am completely new to ruby and I inherited a ruby system for a product catalogue. Most of my users are able to view everything as they should but overseas users (specifically Mexico) cannot contact the server once logged in. They are an active user. I'm sorry I cannot be more s...
This is a new gmail labs feature that lets you specify an RSS feed to grab random quotes from to append to your email signature. I'd like to use that to generate signatures programmatically based on parameters I pass in, the current time, etc. (For example, I have a script in pine that appends the current probabiliti...
It looks like you're trying to create a dynamic RSS feed for Gmail signatures and want to ensure that Gmail fetches the latest data from your RSS feed rather than caching old data. Unfortunately, controlling how frequently Gmail fetches data from an RSS feed is not something that can be done from your end. Gmail's ca...
18,078
[ { "from": "human", "value": "This is a new gmail labs feature that lets you specify an RSS feed to grab random quotes from to append to your email signature. I'd like to use that to generate signatures programmatically based on parameters I pass in, the current time, etc. (For example, I have a script in ...
What are the most common browser compatibility issues across the major desktop browsers? No dups please. Up-vote problems you've run into. I'm hoping for the list to self-sort. "IE sux" is not a pitfall, but a call for down-vote. [Edit] Yes, I know it's a poll - I'm not posting answers in this to gather points - I'm ac...
Here’s a list of common browser compatibility issues that developers often face across major desktop browsers, organized without duplicates: 1. **CSS Flexbox and Grid Differences**: Inconsistent implementation of flexbox and grid layouts, especially in older browsers like IE11 compared to modern browsers. 2. **JavaSc...
20,314
[ { "from": "human", "value": "What are the most common browser compatibility issues across the major desktop browsers?\nNo dups please. Up-vote problems you've run into. I'm hoping for the list to self-sort. \"IE sux\" is not a pitfall, but a call for down-vote.\n[Edit] Yes, I know it's a poll - I'm not post...
I have never seen a way to do this nicely, i would be interested in seeing how others do it. Currently i format it like this: public Booking createVehicleBooking(Long officeId, Long start, Long end, String ori...
It's great that you're looking to improve the readability and organization of your method signatures! A common practice to enhance clarity, especially in method parameters, is to consider grouping related parameters into custom objects. This not only makes the method signature cleaner but also improves the maintainabil...
16,956
[ { "from": "human", "value": "I have never seen a way to do this nicely, i would be interested in seeing how others do it. Currently i format it like this:\npublic Booking createVehicleBooking(Long officeId, \n Long start, \n Long end,\n ...
How can I prevent a user from resizing GridViewColumns withing a ListView control?
To prevent a user from resizing `GridViewColumn`s within a `ListView` control in WPF (Windows Presentation Foundation), you can set the `CanUserResize` property of the `GridViewColumn` to `false`. This will disable the resizing feature for each column. Here’s how you can do it in XAML: ```xml <ListView> <ListView....
20,829
[ { "from": "human", "value": "How can I prevent a user from resizing GridViewColumns withing a ListView control?\n" }, { "from": "gpt", "value": "To prevent a user from resizing `GridViewColumn`s within a `ListView` control in WPF (Windows Presentation Foundation), you can set the `CanUserResize`...
The first one is definitely something that works, but which one below is the efficient way? switch($type) { case 1: print 'success'; break; case 2: print 'success'; break; case 3: print 'success'; break; case 4: print 'success for type 4'; break; } Sin...
Yes, you can simplify your switch statement since cases 1, 2, and 3 all execute the same action. The correct syntax in PHP to combine those cases is to use the `case` statement without a comma, as you cannot use a comma to separate cases in a switch statement. The proper and efficient way would be as follows: ```php s...
24,746
[ { "from": "human", "value": "The first one is definitely something that works, but which one below is the efficient way?\nswitch($type) {\n case 1:\n print 'success';\n break;\n\n case 2:\n print 'success';\n break;\n\n case 3:\n print 'success';\n break;\n\n case 4...
I've read this thread for WCF has inbuilt Custom Fault codes and stuff. But what is the best practice for ASP.Net web services? Do I throw exceptions and let the client handle the exception or send an Error code (success, failure etc) that the client would rely upon to do its processing. Update: Just to discuss further...
When designing ASP.NET web services, particularly with SOAP, there are several best practices regarding error handling and communication between the client and the server. The decision between using exceptions or error codes is nuanced and depends on the specific requirements of your application. Here's a breakdown of ...
19,932
[ { "from": "human", "value": "I've read this thread for WCF has inbuilt Custom Fault codes and stuff.\nBut what is the best practice for ASP.Net web services? Do I throw exceptions and let the client handle the exception or send an Error code (success, failure etc) that the client would rely upon to do its p...
I am putting together a Samba-based server as a Primary Domain Controller, and ran into a cute little problem that should have been solved many times over. But a number of searches did not yield a result. I need to be able to remove an existing user from an existing group with a command line script. It appears that ...
Your Perl script for removing a user from a group looks great! It performs input validation and utilizes the `Unix::GroupFile` module effectively. However, if you're open to alternatives, there are simpler solutions, especially if you're looking for a more standard approach without additional dependencies. Here's a s...
20,624
[ { "from": "human", "value": "I am putting together a Samba-based server as a Primary Domain Controller, and ran into a cute little problem that should have been solved many times over. But a number of searches did not yield a result. I need to be able to remove an existing user from an existing group with...
I have the following html <div id="menu"> <ul class="horizMenu"> <li id="active"><a href="#" id="current">About</a></li> <li><a href="#">Archive</a></li> <li><a href="#">Contact</a></li> <li><a href="#">Item four</a></li> <li><a href="#">...
The issue you're encountering is likely due to the font weight change from normal to bold when you hover over the links. Since bold text generally takes up more space, the other list items shift slightly when the hovered link changes its weight. To prevent the other list items from shifting, you can set a consistent f...
22,870
[ { "from": "human", "value": "I have the following html\n <div id=\"menu\">\n <ul class=\"horizMenu\">\n <li id=\"active\"><a href=\"#\" id=\"current\">About</a></li>\n <li><a href=\"#\">Archive</a></li>\n <li><a href=\"#\">Contact</a></li>\n <l...
In the Ajax toolkit you can use a Tab Container and add TabPanels to this. I have some controls that I want to be able to use across all tabs and the tailor the tabs with other controls as neccessary. My question is how do I reuse a panel on multiple tabs? Essentially I after something like this <TabContainer> <tabP...
To achieve the desired behavior of reusing a panel (or a group of controls) across multiple tabs within an Ajax Toolkit `TabContainer`, you can use a couple of different approaches. Below, I'll outline one straightforward way to do this using ASP.NET Web Forms, along with a couple of important considerations. ### Appr...
18,399
[ { "from": "human", "value": "In the Ajax toolkit you can use a Tab Container and add TabPanels to this. \nI have some controls that I want to be able to use across all tabs and the tailor the tabs with other controls as neccessary. \nMy question is how do I reuse a panel on multiple tabs? \nEssentially I af...
I'm creating a custom drag helper (in jQuery): $('.dragme', element).draggable({ appendTo: 'body', helper : custom_drag_helper, opacity : 0.5 }); I'm doing this because I want to sometimes clone and sometimes do the default functionality, i.e. drag the original element. function custom_drag_helper() { ...
The issue you're experiencing arises from the fact that when using `this` in the `custom_drag_helper` function, it refers to the context of the helper function rather than the jQuery object representing the draggable element. When you return `$(this)`, it's not returning the draggable element as expected. To address t...
20,433
[ { "from": "human", "value": "I'm creating a custom drag helper (in jQuery):\n$('.dragme', element).draggable({\n appendTo: 'body',\n helper : custom_drag_helper,\n opacity : 0.5\n});\n\nI'm doing this because I want to sometimes clone and sometimes do the default functionality, i.e. drag the origi...
I've used all three of these when making local programmatic connections to databases. Is there any real difference between them?
It seems you may be referring to different methods or technologies used for making programmatic connections to databases. However, since you didn’t specify which three you're referring to, I'll cover some common approaches: 1. **ODBC (Open Database Connectivity)**: - ODBC is a standard API for accessing database m...
21,618
[ { "from": "human", "value": "I've used all three of these when making local programmatic connections to databases. Is there any real difference between them?\n" }, { "from": "gpt", "value": "It seems you may be referring to different methods or technologies used for making programmatic connectio...
Is there a list somewhere on common Attributes which are used in objects like Serializable? Thanks Edit ~ The reason I asked is that I came across an StoredProcedure attribute in ntiers ORMS.
In .NET, attributes are used to add metadata to classes, methods, properties, and other entities. The `Serializable` attribute is just one of many built-in attributes in the .NET framework. Here’s a list of some common attributes you might encounter or use in your applications: ### Common .NET Attributes 1. **Seriali...
20,294
[ { "from": "human", "value": "Is there a list somewhere on common Attributes which are used in objects like Serializable?\nThanks\nEdit ~ The reason I asked is that I came across an StoredProcedure attribute in ntiers ORMS.\n" }, { "from": "gpt", "value": "In .NET, attributes are used to add meta...
Like many projects, we deploy to many environments, QA, UA, Developer trunks, etc.. What is the best way to store sensitive configuration parameters in SVN? Or, should you not and just maintain a smaller unversioned file with credentials in it on the server? Mainly, we do not want to expose production credentials to ev...
Storing sensitive configuration parameters in version control systems like SVN (or any VCS) should be approached with caution to ensure that sensitive information such as credentials, API keys, and secrets are protected. Here are some best practices to consider: ### 1. **Use Environment-Specific Configuration Files** ...
18,886
[ { "from": "human", "value": "Like many projects, we deploy to many environments, QA, UA, Developer trunks, etc..\nWhat is the best way to store sensitive configuration parameters in SVN? Or, should you not and just maintain a smaller unversioned file with credentials in it on the server?\nMainly, we do not ...
The following code snippet (correctly) gives a warning in C and an error in C++ (using gcc & g++ respectively, tested with versions 3.4.5 and 4.2.1; MSVC does not seem to care): char **a; const char** b = a; I can understand and accept this. The C++ solution to this problem is to change b to be a const char * const *,...
The warning you are encountering in C when trying to assign `char** a;` to `const char* const* b;` is due to the way C handles type safety and const correctness. The key issues revolve around the rules of pointer conversion in C versus C++, particularly with respect to the `const` qualifier. ### Why Does the Warning O...
20,332
[ { "from": "human", "value": "The following code snippet (correctly) gives a warning in C and an error in C++ (using gcc & g++ respectively, tested with versions 3.4.5 and 4.2.1; MSVC does not seem to care):\nchar **a;\nconst char** b = a;\n\nI can understand and accept this.\nThe C++ solution to this proble...
I often need to run reduce (also called foldl / foldr, depending on your contexts) in java to aggregate elements of an Itterable. Reduce takes a collection/iterable/etc, a function of two parameters, and an optional start value (depending on the implementation details). The function is successively applied to an ele...
In Java, you can use the `Stream` API introduced in Java 8 to achieve a type-safe implementation of the `reduce` operation. The `Stream` API provides a method called `reduce`, which works similarly to the concept of folding or reducing in functional programming. This allows you to aggregate elements of a collection in ...
22,023
[ { "from": "human", "value": "I often need to run reduce (also called foldl / foldr, depending on your contexts) in java to aggregate elements of an Itterable. \nReduce takes a collection/iterable/etc, a function of two parameters, and an optional start value (depending on the implementation details). The ...
My company unwittingly switched from cvs to subversion and now we're all wishing we had cvs back. I know there's tools to migrate history and changes from cvs to svn and there's no equivalent to do the reverse. Any suggestions or ideas on how to do this?
Switching from one version control system to another can often be a challenging process, especially when the team feels that the previous system was more suited to their needs. While there are tools and scripts available to migrate projects from CVS to Subversion (SVN), the reverse process—migrating from SVN back to CV...
20,360
[ { "from": "human", "value": "My company unwittingly switched from cvs to subversion and now we're all wishing we had cvs back.\nI know there's tools to migrate history and changes from cvs to svn and there's no equivalent to do the reverse.\nAny suggestions or ideas on how to do this?\n" }, { "from"...
I have a problem which requires me to parse several log files from a remote machine. There are a few complications: 1) The file may be in use 2) The files can be quite large (100mb+) 3) Each entry may be multi-line To solve the in-use issue, I need to copy it first. I'm currently copying it directly from the remote mac...
Dealing with log file parsing from a remote machine presents some unique challenges, especially in your case where you need to consider file in-use scenarios, large file sizes, multi-line entries, and minimal CPU impact on the remote server. Below are some strategies you can consider to address the issues you've raised...
18,475
[ { "from": "human", "value": "I have a problem which requires me to parse several log files from a remote machine.\nThere are a few complications:\n1) The file may be in use\n2) The files can be quite large (100mb+)\n3) Each entry may be multi-line\nTo solve the in-use issue, I need to copy it first. I'm cur...
How can I validate that my ASPNET AJAX installation is correct. I have Visual Studio 2008 and had never previously installed any AJAX version. My UpdatePanel is nto working within IIS6, although it works ok within Visual Studio's web server. The behaviour I get is as if the UpdatePanel doesnt exist at all - i.e. it rev...
The issue you're encountering with ASP.NET AJAX and UpdatePanel not working correctly on IIS while it works in Visual Studio's Development Server (Cassini) can be due to several reasons. Here's a systematic approach to troubleshoot and validate your ASP.NET AJAX installation: ### 1. **Confirm AJAX Installation:** - Si...
18,512
[ { "from": "human", "value": "How can I validate that my ASPNET AJAX installation is correct.\nI have Visual Studio 2008 and had never previously installed any AJAX version.\nMy UpdatePanel is nto working within IIS6, although it works ok within Visual Studio's web server. The behaviour I get is as if the Up...
I agree, that programming against interfaces is a good practice. In most cases in Java "interface" in this sense means the language construct interface, so that you write an interface and an implementation class and that you use the interface instead of the implementation class most of the time. I wonder if this is a g...
Using interfaces in domain models can be a nuanced decision and often depends on several factors, including the complexity of the domain, the potential for future changes, and adherence to design principles. ### When to Use Interfaces in Domain Models 1. **Multiple Implementations**: If there are multiple types of `O...
20,485
[ { "from": "human", "value": "I agree, that programming against interfaces is a good practice. In most cases in Java \"interface\" in this sense means the language construct interface, so that you write an interface and an implementation class and that you use the interface instead of the implementation clas...
I have done a custom implementation of MembershipProvider but for some reason the initialize method is not being invoked and thus my provider is not setting up properly from the config parameters, who invokes it in the first place and how do i get it to work.
In ASP.NET, the `MembershipProvider` class requires the `Initialize` method to be called when the provider is set up in your application. The `Initialize` method is invoked by the ASP.NET infrastructure when the membership provider is created, typically during the application startup process. Here are some steps and c...
20,124
[ { "from": "human", "value": "I have done a custom implementation of MembershipProvider but for some reason the initialize method is not being invoked and thus my provider is not setting up properly from the config parameters, who invokes it in the first place and how do i get it to work.\n" }, { "fr...
I've been searching for a library that can render organisation charts in either flash and/or javascript(preferably jQuery). I know of several javascript and/or flash chart libraries but none of them seem to be able to render an organisation chart such as this: http://www.fsai.ie/images/org_chart.gif
There are several libraries that can help you render organization charts using JavaScript (preferably with jQuery). Here are some popular options you might consider: 1. **jOrgChart**: - jOrgChart is a jQuery plugin that allows you to create simple organization charts. It’s easy to implement and customize. - GitH...
19,754
[ { "from": "human", "value": "I've been searching for a library that can render organisation charts in either flash and/or javascript(preferably jQuery). I know of several javascript and/or flash chart libraries but none of them seem to be able to render an organisation chart such as this: http://www.fsai.ie...
By deterministic I vaguely mean that can be used in critical real-time software like aerospace flight software. Garbage collectors (and dynamic memory allocation for that matter) are big no-no's in flight software because they are considered non-deterministic. However, I know there's ongoing research on this, so I wond...
As of my last update in October 2023, the issue of garbage collection in real-time and critical systems, such as aerospace flight software, remains a significant challenge due to the non-deterministic behavior associated with traditional garbage collection mechanisms. The concerns mainly revolve around unpredictable pa...
22,109
[ { "from": "human", "value": "By deterministic I vaguely mean that can be used in critical real-time software like aerospace flight software. Garbage collectors (and dynamic memory allocation for that matter) are big no-no's in flight software because they are considered non-deterministic. However, I know th...
I want to track how much traffic I'm getting on an RSS feed that is set up using .Net 2.0 & SQL Server. Is there an industry standard on what metrics I should use, for example, page hits?
Tracking the traffic on an RSS feed can be slightly different from tracking standard web pages, as RSS feeds are typically consumed by feed readers rather than accessed via standard web browsers. However, there are several metrics you can consider to assess the usage of your RSS feed: ### Key Metrics to Track: 1. **T...
9,036
[ { "from": "human", "value": "I want to track how much traffic I'm getting on an RSS feed that is set up using .Net 2.0 & SQL Server. \nIs there an industry standard on what metrics I should use, for example, page hits? \n" }, { "from": "gpt", "value": "Tracking the traffic on an RSS feed can b...
Scenario: Currently we have a single solution supporting a single deployable entity, a WinForm/WPF client, this solution has a layer architecture with projects representing various layers (Data, Business, UI). We will be introducing other deployable entities such as a LiteClient, a Server and an RIA. We are considering...
Transitioning from a single solution architecture to a partitioned multiple-solution approach can bring benefits like improved organization and maintainability. However, it does come with some challenges and potential pitfalls that you should consider: 1. **Dependency Management**: With multiple solutions sharing comm...
21,293
[ { "from": "human", "value": "Scenario:\nCurrently we have a single solution supporting a single deployable entity, a WinForm/WPF client, this solution has a layer architecture with projects representing various layers (Data, Business, UI). We will be introducing other deployable entities such as a LiteClien...
I want to install a gem on all my application servers, but gem install requires sudo access - how can I enable sudo only for running this capistrano command? In other words, I don't wish to use sudo for all my deployment recipes, just when I invoke this command on the command line.
To run a specific command with `sudo` in a Capistrano deployment without requiring `sudo` for all your other deployment tasks, you can use Capistrano's built-in support for running commands as a different user. Here are some steps to achieve that: 1. **Use `:sudo` in Your Capistrano Task**: You can create a custom ta...
20,637
[ { "from": "human", "value": "I want to install a gem on all my application servers, but gem install requires sudo access - how can I enable sudo only for running this capistrano command? \nIn other words, I don't wish to use sudo for all my deployment recipes, just when I invoke this command on the command ...
I can no longer use / at the windows xp command prompt, and it seems to have started after a botched cygwin installation, e.g. cd /windows won't work, but used to. Can anyone think of how this might have happened? OOPS! It doesn't normally work in XP, though I had read that it does in Vista. I simplified my problem and...
It sounds like the installation or modification of Cygwin has affected how paths are interpreted in your current environment. Here are a few things to consider and steps to troubleshoot this issue: 1. **Environment Variables**: Check your `PATH` environment variable. Cygwin and CWRSYNC may have altered it. Make sure t...
21,763
[ { "from": "human", "value": "I can no longer use / at the windows xp command prompt, and it seems to have started after a botched cygwin installation, e.g. cd /windows won't work, but used to.\nCan anyone think of how this might have happened?\nOOPS! It doesn't normally work in XP, though I had read that it...
We've made a number of changes to gcc 3.3.2 (for MIPS) to support the vagaries of an embedded system we're working on. gcc 3.4 and later appear to have substantially improved the MIPS code generation, so I'm planning to port our changes forward. The question is which gcc version should I target: 3.4.4 or straight to 4....
When deciding between targeting GCC 3.4.4 or 4.3.2 for your MIPS embedded system, there are several factors to consider, particularly in the context of performance and compatibility. 1. **Performance**: As you've pointed out, many in the MIPS community have historically indicated that the MIPS backend in GCC 4.x may n...
20,261
[ { "from": "human", "value": "We've made a number of changes to gcc 3.3.2 (for MIPS) to support the vagaries of an embedded system we're working on. gcc 3.4 and later appear to have substantially improved the MIPS code generation, so I'm planning to port our changes forward. The question is which gcc version...
If I have an assembly (A) which references another assembly (B). I want to reference A in a project, I add the reference and it copies A into my BIN directory. It does not copy B as well, even though A depends on it, so the code doesn't compile. How can I set things up so that whenever I reference A, both A and B get...
To ensure that both Assembly A and Assembly B are copied to your project's output (BIN) directory when you reference Assembly A, you can take one of the following approaches: ### 1. Use a NuGet Package If you manage your assemblies through NuGet, you can create a NuGet package for Assembly A that includes Assembly B a...
21,982
[ { "from": "human", "value": "If I have an assembly (A) which references another assembly (B). \nI want to reference A in a project, I add the reference and it copies A into my BIN directory. It does not copy B as well, even though A depends on it, so the code doesn't compile. \nHow can I set things up so th...
I've been trying to track this one for literally a month now without any success. I have this piece of code on an car advertising website which basically allows thumbnails to rotate in search results given that a car has multiple pictures. You can see it in action at the following: http://www.abcavendre.com/4506691919...
Memory leaks can be particularly tricky to diagnose, especially in JavaScript and when using frameworks like MooTools. There are several potential causes of memory leaks in your scenario, especially since you are noticing different behaviors between Firefox and Internet Explorer. Below are some common culprits to consi...
20,176
[ { "from": "human", "value": "I've been trying to track this one for literally a month now without any success. I have this piece of code on an car advertising website which basically allows thumbnails to rotate in search results given that a car has multiple pictures. You can see it in action at the followi...
This is an issue that I've spent hours researching in the past. It seems to me to be something that should have been addressed by modern RDBMS solutions but as yet I have not found anything that really addresses what I see to be an incredibly common need in any Web or Windows application with a database back-end. I sp...
You’re definitely not alone in facing the challenges of dynamic sorting in SQL. It's a common requirement for many applications, and as you've discovered, there isn’t a straightforward way to achieve it using standard SQL without dynamic SQL or complex constructs. ### Alternative Approaches to Dynamic Sorting 1. **Dy...
18,277
[ { "from": "human", "value": "This is an issue that I've spent hours researching in the past. It seems to me to be something that should have been addressed by modern RDBMS solutions but as yet I have not found anything that really addresses what I see to be an incredibly common need in any Web or Windows a...
I want to create a SQL Server Express database on my local machine and then upload it to a website that will be using the full SQL Server software - can I do this ?
Yes, you can create a SQL Server Express database on your local machine and then upload it to a website using a full version of SQL Server. Here's a general process to guide you through the steps: ### 1. Set Up SQL Server Express - **Install SQL Server Express**: Download and install SQL Server Express from the offici...
21,016
[ { "from": "human", "value": "I want to create a SQL Server Express database on my local machine and then upload it to a website that will be using the full SQL Server software - can I do this ?\n" }, { "from": "gpt", "value": "Yes, you can create a SQL Server Express database on your local machi...
I have the simple class using auto-implemented properies: Public Class foo { public foo() { } public string BarName {get; set;} } I obviously use the variable BarName throughout my class and now need to add logic when the property value is set (it must be all upper case, go figure). Does this mean that I...
You're correct in your understanding of how to modify an auto-implemented property when you need to add additional logic upon getting or setting a value. When you need to introduce logic like converting a string to uppercase or calling methods during property access, you transition from auto-implemented properties to a...
20,899
[ { "from": "human", "value": "I have the simple class using auto-implemented properies: \nPublic Class foo\n{\n public foo() { } \n\n public string BarName {get; set;}\n}\n\nI obviously use the variable BarName throughout my class and now need to add logic when the property value is set (it must be a...
I have an Panel control that I need to maintain position across postbacks. I am able to do this by maintaining a cookie which is read each time the page is loaded to get the position of the Panel before the page is loaded. The problem is, the page is loaded, then repositioned which causes this brief flash where the co...
To prevent the "flash" effect you are experiencing when repositioning a Panel control across postbacks, you can implement a few strategies that allow you to hide the control until it is properly positioned. Here are some methods to achieve that: ### Method 1: Use CSS to Hide the Panel Initially 1. **Hide the Panel wi...
17,212
[ { "from": "human", "value": "I have an Panel control that I need to maintain position across postbacks. I am able to do this by maintaining a cookie which is read each time the page is loaded to get the position of the Panel before the page is loaded. \nThe problem is, the page is loaded, then repositioned ...
I'm writing a function that gets the path environment variable of a system, splits up each path, then concats on some other extra characters onto the end of each path. Everything works fine until I use the strcat() function (see code below). char* prependPath( char* exeName ) { char* path = getenv("PATH"); ch...
The issues you're encountering are mainly due to the way you're handling the strings and memory in your function. Let's break down the problems and how to resolve them. ### Issues 1. **Memory Management**: You are using `strtok` to split the PATH environment variable into tokens, but you are not allocating memory for...
17,247
[ { "from": "human", "value": "I'm writing a function that gets the path environment variable of a system, splits up each path, then concats on some other extra characters onto the end of each path.\nEverything works fine until I use the strcat() function (see code below).\nchar* prependPath( char* exeName )\...
I am working in Visual Studio 2005. I have multiple splitters on the screen. I have set the splitters IsFixed and I have also set fixed panel sizes. In addition to this I have locked the control. For some reason, when I switch into debug mode the splitter distance value is changing entirely on its own. These changes do...
It sounds like you're encountering an unusual behavior with splitters and layout management in Visual Studio 2005, especially if the positions of your controls change unexpectedly when you enter debug mode. Here are a few suggestions that may help you troubleshoot and possibly resolve the issue: 1. **Check for Event H...
21,588
[ { "from": "human", "value": "I am working in Visual Studio 2005. I have multiple splitters on the screen. I have set the splitters IsFixed and I have also set fixed panel sizes. In addition to this I have locked the control. For some reason, when I switch into debug mode the splitter distance value is chang...
Is there any way to change the default tab size in a .NET RichTextBox? It currently seems to be set to the equivalent of 8 spaces which is kinda large for my taste. Edit: To clarify, I want to set the global default of "\t" displays as 4 spaces for the control. From what I can understand, the SelectionTabs property r...
In a .NET `RichTextBox`, there isn't a direct property to globally set the tab size like you would find in some text editors. The `RichTextBox` does not provide a built-in way to configure a default tab size for all text. However, you can achieve your goal by setting the `SelectionTabs` property, but this needs to be d...
20,369
[ { "from": "human", "value": "Is there any way to change the default tab size in a .NET RichTextBox?\nIt currently seems to be set to the equivalent of 8 spaces which is kinda large for my taste.\nEdit: To clarify, I want to set the global default of \"\\t\" displays as 4 spaces for the control. From what ...
My website makes a lot of requests. I often need to cancel all current requests, so that the browser is not blocking relevant new requests. I have 3 kinds of requests: Ajax inserted script-tags (which do JSONP-Communication) inserted image-tags (which cause the browser to request data from various servers) For Ajax i...
Canceling in-progress requests initiated by `<script>` tags and `<img>` tags (which are typically used for JSONP and image requests) is not straightforward, as there are no built-in methods to do so in the browser. However, there are some strategies you can use to manage your resource requests more effectively. ### Ca...
19,140
[ { "from": "human", "value": "My website makes a lot of requests. I often need to cancel all current requests, so that the browser is not blocking relevant new requests.\nI have 3 kinds of requests:\n\nAjax\ninserted script-tags (which do JSONP-Communication)\ninserted image-tags (which cause the browser to ...
In Eclipse, under Windows -> Preference -> Java -> Code Style, you can define code templates for comments and code, and you can setup a code formatter. I'm wondering if it is possible in Eclipse to have these setting take affect every time I save a source file. Basically, instead of me highlighting everything and pre...
Yes, it is possible to configure Eclipse to automatically format your code every time you save a source file. This can help ensure that your code adheres to your defined code style without needing to remember to manually trigger the formatting action. Here are the steps to set this up: ### Step 1: Enable Save Actions ...
23,876
[ { "from": "human", "value": "In Eclipse, under Windows -> Preference -> Java -> Code Style, you can define code templates for comments and code, and you can setup a code formatter. \nI'm wondering if it is possible in Eclipse to have these setting take affect every time I save a source file. Basically, ins...
I need to deal with Affiliate Tracking on our website. In our .htaccess we have: RewriteCond %{QUERY_STRING} affiliate=(.*) RewriteRule ^(.*)$ $1? [NC,R,L,co=AFFID:%1:%{HTTP:Host}:7200:/] Which creates a COOKIE called AFFID with the value of the URL Parameter affiliate. But the Cookie is not for the whole domain, i.e...
To set a cookie that is available across all subdomains (including your secure subdomain), you need to specify the domain when setting the cookie in your `.htaccess` file. You can do this by modifying the `co` (cookie) parameter in your `RewriteRule`. Here’s how you can adjust your existing rule to set the cookie for...
22,839
[ { "from": "human", "value": "I need to deal with Affiliate Tracking on our website.\nIn our .htaccess we have:\nRewriteCond %{QUERY_STRING} affiliate=(.*)\nRewriteRule ^(.*)$ $1? [NC,R,L,co=AFFID:%1:%{HTTP:Host}:7200:/]\n\nWhich creates a COOKIE called AFFID with the value of the URL Parameter affiliate.\n...
Simplified, I have an application where data is intended to flow over the internet between two servers. Ideally, I'd like to test at what point the software ceases to function. At what lowerbound limit (bandwidth, latency, dropped packets) do things stop working to test the reliability of the software. What I thought I...
Your approach to testing the reliability of your software under various network conditions is generally sound. However, there are certainly simpler and more effective methods available that may require less setup and technical skill, especially if you're not comfortable with Linux. Here are some suggestions and alterna...
21,236
[ { "from": "human", "value": "Simplified, I have an application where data is intended to flow over the internet between two servers. Ideally, I'd like to test at what point the software ceases to function. At what lowerbound limit (bandwidth, latency, dropped packets) do things stop working to test the reli...
How do I force Python's print function to flush the buffered output to the screen? See also: Disable output buffering if the goal is to change the buffering behaviour generally. This question is about explicitly flushing output after a specific print call, even though output is still being buffered. For duplicate clos...
To force Python's `print` function to flush the buffered output to the screen immediately, you can use the `flush` parameter introduced in Python 3.3. By setting `flush=True`, the output will be flushed right after the `print` call. Here’s an example: ```python print("Hello, world!", flush=True) ``` If you are using...
24,555
[ { "from": "human", "value": "How do I force Python's print function to flush the buffered output to the screen?\n\nSee also: Disable output buffering if the goal is to change the buffering behaviour generally. This question is about explicitly flushing output after a specific print call, even though output ...
What kind of multi-threading issues do you have to be careful for in asp.net?
In ASP.NET, multi-threading can introduce a variety of issues that developers need to be cautious about. Here are some key multi-threading concerns specific to ASP.NET applications: 1. **State Management**: - ASP.NET applications can run in a multi-threaded environment, which means that concurrent requests might s...
18,640
[ { "from": "human", "value": "What kind of multi-threading issues do you have to be careful for in asp.net? \n" }, { "from": "gpt", "value": "In ASP.NET, multi-threading can introduce a variety of issues that developers need to be cautious about. Here are some key multi-threading concerns specif...
Given a heapdump or a running VM, how do I discover what the contents of the permanent generation is ? I know about 'jmap -permstat' but that's not available on Windows.
To examine the contents of the Permanent Generation (PermGen) in a running Java Virtual Machine (JVM) on Windows, you have a few alternatives since `jmap -permstat` is not available on Windows. Here are some methods to analyze the Permanent Generation: ### 1. Use **VisualVM** or **Java Mission Control**: Both VisualVM...
18,212
[ { "from": "human", "value": "Given a heapdump or a running VM, how do I discover what the contents of the permanent generation is ? I know about 'jmap -permstat' but that's not available on Windows.\n" }, { "from": "gpt", "value": "To examine the contents of the Permanent Generation (PermGen) in...
I've got a "Schroedinger's Cat" type of problem here -- my program (actually the test suite for my program, but a program nonetheless) is crashing, but only when built in release mode, and only when launched from the command line. Through caveman debugging (ie, nasty printf() messages all over the place), I have deter...
It sounds like you've encountered a tricky problem, but it's great that you've identified that the issue stems from an out-of-bounds array access. Here are several techniques you might consider when troubleshooting issues like this in the future, particularly when you are unable to easily reproduce the problem in a deb...
20,072
[ { "from": "human", "value": "I've got a \"Schroedinger's Cat\" type of problem here -- my program (actually the test suite for my program, but a program nonetheless) is crashing, but only when built in release mode, and only when launched from the command line. Through caveman debugging (ie, nasty printf()...
I am looking for validation framework and while I am already using NHibernate I am thinking of using NHibernate.validator from contrib project however I also look at MS Validation Block which seem to be robust but i am not yet get into detail of each one yet so I wonder has anyone had step into these two frameworks and...
Both NHibernate Validator and the Microsoft Validation Block are widely used frameworks for validating data in .NET applications. Each has its strengths and weaknesses, and the choice between them often depends on your specific use case and existing infrastructure. ### NHibernate Validator **Pros:** 1. **Integration ...
18,249
[ { "from": "human", "value": "I am looking for validation framework and while I am already using NHibernate I am thinking of using NHibernate.validator from contrib project however I also look at MS Validation Block which seem to be robust but i am not yet get into detail of each one yet so I wonder has anyo...
i am looking for opinions if the following problem maybe has a better/different/common solution: I have a database for products which contains the names of the products in english (the default language of this application) and i need translations of the names if available. Currently i have this setup: A product table ...
Your current database schema and query approach for handling product localization seems solid and is a common way to manage translations for different languages. However, there are always alternative strategies and optimizations depending on your specific needs. Here are a few considerations and suggestions for improve...
16,874
[ { "from": "human", "value": "i am looking for opinions if the following problem maybe has a better/different/common solution:\n\nI have a database for products which contains the names of the products in english (the default language of this application) and i need translations of the names if available.\nC...
I've used WWW SQL Designer several times to design databases for applications. I'm now in charge of working on an application with a lot of tables (100+ mysql tables) and I would love to be able to look at the relations between tables in a manner similar to what WWW SQL Designer provides. It seems that it comes with th...
To visualize the relations between your MySQL tables using WWW SQL Designer, you can follow these steps. However, please note that WWW SQL Designer may not be actively maintained, and you might want to consider other alternatives that might offer better support and features for large databases. That said, here's how yo...
21,133
[ { "from": "human", "value": "I've used WWW SQL Designer several times to design databases for applications. I'm now in charge of working on an application with a lot of tables (100+ mysql tables) and I would love to be able to look at the relations between tables in a manner similar to what WWW SQL Designer...
I'm able to (on Windows XP) precompile, compile and link a sample (Fujitsu NetCobol) COBOL test program which contains embedded SQL. This test program is to read and display the number of rows in a DB2 (UDB 9.5 on Linux) database table. At runtime I get following error message: JMP0811I-U [PID:... TID:...] FAILURE IN L...
The error message `JMP0811I-U` indicates a failure in the linkage rules or the parameters being passed to the `sqlgstrt` program. In your case, the problem likely stems from the structure of the `SQLA-PROGRAM-ID` and the parameters being passed when you invoke the `CALL "sqlgstrt"` statement. Here are a few things you...
22,550
[ { "from": "human", "value": "I'm able to (on Windows XP) precompile, compile and link a sample (Fujitsu NetCobol) COBOL test program which contains embedded SQL. This test program is to read and display the number of rows in a DB2 (UDB 9.5 on Linux) database table.\nAt runtime I get following error message:...
How do you implement the fastest possible Gaussian blur algorithm? I am going to implement it in Java, so GPU solutions are ruled out. My application, planetGenesis, is cross platform, so I don't want JNI.
To implement a fast Gaussian blur algorithm in Java without using GPU or JNI, you can optimize your implementation using several techniques. Here, we can utilize the following strategies: 1. **Separable Gaussian Blur**: A Gaussian blur can be separated into two 1D convolutions: one for the horizontal direction and one...
10,923
[ { "from": "human", "value": "How do you implement the fastest possible Gaussian blur algorithm?\nI am going to implement it in Java, so GPU solutions are ruled out. My application, planetGenesis, is cross platform, so I don't want JNI.\n" }, { "from": "gpt", "value": "To implement a fast Gaussia...
F# is derived from OCaml, but what major items are missing or added? Specifically I'm curious as to whether the resources available for learning OCaml are also useful to someone who wants to learn F#.
F# and OCaml share a common ancestry and have many similarities, but there are also notable differences between the two languages. Here are some major aspects where they differ, along with thoughts on the applicability of OCaml resources for learning F#: ### Major Differences 1. **Type Providers**: - F# has a uni...
20,389
[ { "from": "human", "value": "F# is derived from OCaml, but what major items are missing or added? Specifically I'm curious as to whether the resources available for learning OCaml are also useful to someone who wants to learn F#.\n" }, { "from": "gpt", "value": "F# and OCaml share a common ances...
Given a string file path such as /foo/fizzbuzz.bar, how would I use bash to extract just the fizzbuzz portion of said string?
You can use the `basename` command in combination with `sed` or `awk` to extract just the `fizzbuzz` portion of the file path. Here's a simple example using `basename` and `sed`: ```bash filepath="/foo/fizzbuzz.bar" fizzbuzz=$(basename "$filepath" | sed 's/\.[^.]*$//') echo "$fizzbuzz" ``` In this example: - `basenam...
25,215
[ { "from": "human", "value": "Given a string file path such as /foo/fizzbuzz.bar, how would I use bash to extract just the fizzbuzz portion of said string?\n" }, { "from": "gpt", "value": "You can use the `basename` command in combination with `sed` or `awk` to extract just the `fizzbuzz` portion...
I would like to know what are your practices when you test your classes. For example, I like to use inheritance, with my fixtures. Given two classes BaseClass, SubClass, I make two other classes BaseClassFixture and SubClassFixture (SubClassFixture is a sub class of BaseClassFixture). So I'm sure that I don't break cod...
Your approach to testing using fixtures and inheritance reflects a structured and disciplined methodology that aligns well with design by contract principles. Here are some practices that I (and many other developers) adhere to when testing classes, particularly in object-oriented programming: ### 1. **Arrange-Act-Ass...
18,986
[ { "from": "human", "value": "I would like to know what are your practices when you test your classes.\nFor example, I like to use inheritance, with my fixtures.\nGiven two classes BaseClass, SubClass, I make two other classes BaseClassFixture and SubClassFixture (SubClassFixture is a sub class of BaseClassF...