instruction stringlengths 14 27.6k | completion stringlengths 3 38.3k | __original_row_idx int64 0 50k | conversations listlengths 2 2 |
|---|---|---|---|
How can I render after executing an action in a restful controller instead of redirecting.
I have a controller with standard actions, and I added a special action that adds data to the resource in question, via a form on the #show page (Think comments on a post). I am validating the input from the form and want to re-r... | It looks like you're on the right track, but you're encountering an issue with rendering the `show` action when there are validation errors. The key point is that when you want to render the `show` action after a validation error, you need to ensure that you provide the necessary instance variables that the `show` view... | 42,879 | [
{
"from": "human",
"value": "How can I render after executing an action in a restful controller instead of redirecting.\nI have a controller with standard actions, and I added a special action that adds data to the resource in question, via a form on the #show page (Think comments on a post). I am validatin... |
Is there a shortcut key to bring up the call hierarchy of a method inline with the code, in the quick menu format, rather than bringing up the call hierarchy panel?
| In many IDEs, there may not be a specific shortcut to bring up the call hierarchy inline with the code directly, as most IDEs tend to open the call hierarchy in a separate panel. However, you can usually find call hierarchy features through context menus or by using existing shortcuts that open the hierarchy panel.
Fo... | 47,329 | [
{
"from": "human",
"value": "Is there a shortcut key to bring up the call hierarchy of a method inline with the code, in the quick menu format, rather than bringing up the call hierarchy panel?\n"
},
{
"from": "gpt",
"value": "In many IDEs, there may not be a specific shortcut to bring up the ca... |
What's your opinion on whether one should write an application for a specific platform or use a cross platform approach and reach more potential clients?
It would be a GUI based application and I'm thinking of using Java.
Most of the applications that I've used built on Java don't run as smooth as the native applicatio... | The decision between developing a platform-specific application versus a cross-platform application depends on several factors, including your target audience, the functionality of the application, development resources, and personal preferences. Here are some considerations that might help you make a decision:
### Pl... | 41,012 | [
{
"from": "human",
"value": "What's your opinion on whether one should write an application for a specific platform or use a cross platform approach and reach more potential clients?\nIt would be a GUI based application and I'm thinking of using Java.\nMost of the applications that I've used built on Java d... |
I look for a JComponenet based RDF editor which I could embed in my application?
It does'n need to be fancy .
Thanks in advance.
| If you are looking for a simple JComponent-based RDF editor that can be embedded in your Java application, you may want to consider the following options:
1. **Apache Jena**: While Jena itself is primarily a framework for working with RDF data rather than a direct editor, you can utilize its APIs to create a simple RD... | 36,207 | [
{
"from": "human",
"value": "I look for a JComponenet based RDF editor which I could embed in my application?\nIt does'n need to be fancy .\nThanks in advance.\n"
},
{
"from": "gpt",
"value": "If you are looking for a simple JComponent-based RDF editor that can be embedded in your Java applicati... |
Basically, I would like to build a list comprehension over the "cartesian product" of two iterators. Think about the following Haskell code:
[(i,j) | i <- [1,2], j <- [1..4]]
which yields
[(1,1),(1,2),(1,3),(1,4),(2,1),(2,2),(2,3),(2,4)]
Can I obtain a similar behavior in Python in a concise way?
| Yes, you can achieve a similar behavior in Python using list comprehensions along with the `itertools.product` function. The `itertools.product` function computes the Cartesian product of input iterables. Here’s how you can do it:
```python
from itertools import product
# Define the iterators
i_values = [1, 2]
j_valu... | 45,760 | [
{
"from": "human",
"value": "Basically, I would like to build a list comprehension over the \"cartesian product\" of two iterators. Think about the following Haskell code:\n[(i,j) | i <- [1,2], j <- [1..4]]\n\nwhich yields\n[(1,1),(1,2),(1,3),(1,4),(2,1),(2,2),(2,3),(2,4)]\n\nCan I obtain a similar behavior... |
I'm looking at rewriting an eMbedded Visual Basic app I wrote years ago. I'm unsatisified with it because of various problems clients keep having with it now and then over the years, mostly along the lines of the app not loading anymore because a required dll/activex control has gone missing! This is so frustrating and... | Transitioning from eMbedded Visual Basic (eVB) to a more modern platform is a wise decision, especially given the frustrations you've encountered with dependencies and DLLs. Here are some insights that can help guide your decision:
### 1. **Moving to C# and .NET Compact Framework (CF)**:
- **Pros**:
- Familiar... | 42,606 | [
{
"from": "human",
"value": "I'm looking at rewriting an eMbedded Visual Basic app I wrote years ago. I'm unsatisified with it because of various problems clients keep having with it now and then over the years, mostly along the lines of the app not loading anymore because a required dll/activex control has... |
I'm working on a website that uses not just frames, but frames within frames (ew, I know, but I don't get to choose). It actually works OK most of the time, but I'm running into a problem with some of the frames within frames in Safari (only).
Some of the two-deep frames render in Safari with a small space on the righ... | The issue you're experiencing with frames rendering incorrectly in Safari, particularly the "small space on the right-hand side," can indeed be tricky to troubleshoot. Here are some common factors and potential solutions to consider:
### Common Issues and Solutions
1. **CSS Reset**: Safari has its own default styles ... | 40,666 | [
{
"from": "human",
"value": "I'm working on a website that uses not just frames, but frames within frames (ew, I know, but I don't get to choose). It actually works OK most of the time, but I'm running into a problem with some of the frames within frames in Safari (only).\nSome of the two-deep frames rende... |
I've tested in Chrome, do I need to test in Safari?
| Yes, it's important to test your website or application in Safari, especially if it is aimed at a broad audience. Here are a few reasons why:
1. **Browser Differences**: Different browsers can render HTML, CSS, and JavaScript differently. Testing in Safari helps you identify any inconsistencies or issues that may not ... | 46,896 | [
{
"from": "human",
"value": "I've tested in Chrome, do I need to test in Safari?\n"
},
{
"from": "gpt",
"value": "Yes, it's important to test your website or application in Safari, especially if it is aimed at a broad audience. Here are a few reasons why:\n\n1. **Browser Differences**: Different... |
Now I have a stack of free time on my hands, I wanna get into iphone dev fo real.
But Objective C scares me (a bit). It feels I'm going a bit back in time. I say this because I've spent the last 8 months coding in C++.
JSCocoa looks awesome, but does this actually work on the iphone?
What would need to be done to get t... | Getting into iPhone development is a great choice, and it’s understandable to feel a bit intimidated by Objective-C, especially after working with C++. However, it's worth noting that Apple's development ecosystem has evolved significantly, and you might want to consider learning Swift instead of Objective-C. Swift is ... | 42,709 | [
{
"from": "human",
"value": "Now I have a stack of free time on my hands, I wanna get into iphone dev fo real.\nBut Objective C scares me (a bit). It feels I'm going a bit back in time. I say this because I've spent the last 8 months coding in C++.\nJSCocoa looks awesome, but does this actually work on the ... |
I just got done working through the Django tutorials for the second time, and am understanding things much more clearly now. However, I'm still unclear how apps inside a site interact with one another.
For example, lets say I'm writing a blog application (a rather popular activity, apparently). Blog posts and comments ... | Your understanding of how Django apps can interact with each other is largely correct. Let’s break down your two examples and clarify how they work, and also touch upon the use of `GenericForeignKey` for more flexibility.
### 1. Basic Foreign Key Interaction
In your first example, you demonstrated a straightforward w... | 42,361 | [
{
"from": "human",
"value": "I just got done working through the Django tutorials for the second time, and am understanding things much more clearly now. However, I'm still unclear how apps inside a site interact with one another.\nFor example, lets say I'm writing a blog application (a rather popular activ... |
I have an asp.net mvc app running on a local iis website that is failing to send mail using SmtpClient from System.Net.Mail. I am trying to send a mail to my hotmail address and I get a socket exception. Any idea what the problem might be?
using(var message = new MailMessage())
{
message.Fro... | The error message you are encountering indicates that the SMTP client is trying to connect to the SMTP server on `127.0.0.1:25`, which is the local machine's IP address and default SMTP port. However, it seems that the local SMTP server is either not running or is not accepting connections on that port. Additionally, y... | 41,932 | [
{
"from": "human",
"value": "I have an asp.net mvc app running on a local iis website that is failing to send mail using SmtpClient from System.Net.Mail. I am trying to send a mail to my hotmail address and I get a socket exception. Any idea what the problem might be?\nusing(var message = new MailMessage())... |
How to create a windows toolbar-dockable application - like Winamp Desk Band - in .NET?
| Creating a toolbar-dockable application in .NET, akin to applications like Winamp Desk Band, involves several steps. The key concept is to create a COM object that can be registered as a Band Object, allowing it to be docked in the Windows taskbar.
### Overview of Steps
1. **Create a .NET Class Library Project**
2. *... | 41,354 | [
{
"from": "human",
"value": "How to create a windows toolbar-dockable application - like Winamp Desk Band - in .NET?\n"
},
{
"from": "gpt",
"value": "Creating a toolbar-dockable application in .NET, akin to applications like Winamp Desk Band, involves several steps. The key concept is to create ... |
I am looking for a method of changing the data source for a report in SQL Server Reporting Services.
Basically what functionality I am looking for is a drop down box (parameter) at the top of the report that permits the user of the report to select a different data source to run the report against (so when the drop dow... | In SQL Server Reporting Services (SSRS), directly changing the data source of a report dynamically based on a parameter is not straightforward, as SSRS does not allow for data source connections to be switched dynamically within a single report. However, there are some approaches you can consider to achieve similar fun... | 43,337 | [
{
"from": "human",
"value": "I am looking for a method of changing the data source for a report in SQL Server Reporting Services.\nBasically what functionality I am looking for is a drop down box (parameter) at the top of the report that permits the user of the report to select a different data source to ru... |
What is the command-line equivalent of "Switch Port Client User" as found in the p4win gui client?
I am already logged under one port but now I am attempting to connect to a different port on the same server in order to access a separate source control file depot. I assume it would involve using:
p4 login
However, re... | In Perforce, when using the command line interface (CLI), you can switch to a different port by setting the `P4PORT` environment variable or using the `-p` option directly with your commands.
Here's how you can do this:
1. **Using the `-p` option**: You can specify the port when executing Perforce commands by using t... | 46,151 | [
{
"from": "human",
"value": "What is the command-line equivalent of \"Switch Port Client User\" as found in the p4win gui client? \nI am already logged under one port but now I am attempting to connect to a different port on the same server in order to access a separate source control file depot. I assume i... |
I have a linux dev server I watch, and lately its chugging at some points so I'd like to keep a better eye on it. I used to use Gkrellm, but its been a pain to try get Gkrellm to build on my Mac.
Besides servering X remotely (which would not be optimal), I guess i'm looking for alternatives to Gkrellm.
I would like a ... | There are several alternatives to Gkrellm that you can use to monitor your Linux server's performance from your Mac without the need to run X11 over a remote connection. Here are some options:
### 1. **htop**
- **Description:** `htop` is an interactive process viewer for Unix systems. It's a more user-friendly version... | 42,071 | [
{
"from": "human",
"value": "I have a linux dev server I watch, and lately its chugging at some points so I'd like to keep a better eye on it. I used to use Gkrellm, but its been a pain to try get Gkrellm to build on my Mac. \nBesides servering X remotely (which would not be optimal), I guess i'm looking fo... |
I need to define the system requirements hardware and software for building a E-Commerce Web application with SSL (more than 40 bits). I have no experience with SSL, so i have no idea how to configure or what apache version do i need. This are my thoughts:
Operating System Linux
Web Server: Apache
DBMS: MySQL 5.0 or b... | Building an e-commerce web application with SSL support involves considering both hardware and software requirements. Given your proposed setup, here's a refined suggestion based on current best practices and requirements for SSL.
### System Requirements
#### Hardware Requirements
- **Operating System**: Linux (prefe... | 39,710 | [
{
"from": "human",
"value": "I need to define the system requirements hardware and software for building a E-Commerce Web application with SSL (more than 40 bits). I have no experience with SSL, so i have no idea how to configure or what apache version do i need. This are my thoughts: \nOperating System Lin... |
I'm looking at doing some work (for fun) in a compiled language to run some simple tests and benchmarks against php.
Basically I'd like to see what other people use for C++ CGI programming. (Including backend database, like mysql++ or something else)
| C++ can be an interesting choice for CGI programming and benchmarking against PHP. Here’s a guide on what you might consider for a C++ CGI setup, including libraries and tools you might use:
### 1. **Web Frameworks:**
While traditional CGI programming can be done using basic C++ without any frameworks, using a framewo... | 42,855 | [
{
"from": "human",
"value": "I'm looking at doing some work (for fun) in a compiled language to run some simple tests and benchmarks against php.\nBasically I'd like to see what other people use for C++ CGI programming. (Including backend database, like mysql++ or something else)\n"
},
{
"from": "gp... |
I have several small open-source projects that I wrote. All my attempts to find collaborators (looked on sourceforge.net and codeplex) failed miserably - I either couldn't find anyone, or I found people who either weren't interested or didn't contribute anything. Thus comes the question: how and where can I find people... | Finding collaborators for your open-source projects can be challenging, but there are several strategies and platforms you can use to connect with potential contributors. Here are some suggestions:
### 1. **GitHub/GitLab/Bitbucket**
- **Host Your Projects**: If you haven't already, consider moving your projects to pla... | 43,202 | [
{
"from": "human",
"value": "I have several small open-source projects that I wrote. All my attempts to find collaborators (looked on sourceforge.net and codeplex) failed miserably - I either couldn't find anyone, or I found people who either weren't interested or didn't contribute anything. Thus comes the ... |
I wonder what options there are for .NET (or C# specifically) code coverage, especially in the lower priced segment?
I am not looking for recommendations, but for a comparison of products based on facts. I know the following:
NCover
Seems to be very popular and looks quite good
Supports statement coverage and branch ... | Here's a comparison of various .NET (specifically C#) code coverage tools based on the information you've provided. Each tool is evaluated based on its pricing, features, and additional notes about support and development status.
### Code Coverage Tools Comparison
| Tool | Price | Cover... | 40,831 | [
{
"from": "human",
"value": "I wonder what options there are for .NET (or C# specifically) code coverage, especially in the lower priced segment?\nI am not looking for recommendations, but for a comparison of products based on facts. I know the following:\n\nNCover\n\nSeems to be very popular and looks quit... |
Does anyone know of an accurate source for an (E)BNF for the Java language? Preferably, it would be from an authorative source, e.g. Sun.
Thanks.
| Yes, the official Java language specification is the authoritative source for the syntax of the Java programming language, including its Extended Backus-Naur Form (EBNF) representation. The Java Language Specification (JLS) is published by Oracle (which acquired Sun Microsystems) and contains detailed descriptions of t... | 46,615 | [
{
"from": "human",
"value": "Does anyone know of an accurate source for an (E)BNF for the Java language? Preferably, it would be from an authorative source, e.g. Sun.\nThanks.\n"
},
{
"from": "gpt",
"value": "Yes, the official Java language specification is the authoritative source for the synta... |
I've got a TDictionary that stores a bunch of objects indexed by name, and I'd like to be able to examine all of the objects. So I tried this:
var enumerator: TMyObject;
begin
for enumerator in myDictionary do
But that wouldn't compile. "Incompatible types: 'TMyObject' and 'TPair'
So I tried it a bit differently:
... | It looks like you're trying to iterate over a `TDictionary` in Delphi, which is a common task. Based on your description and the issues you've encountered, here's how you can properly iterate through a `TDictionary<TKey, TValue>` using a `for .. in` loop.
Here's a general structure for doing that:
```pascal
uses
Sy... | 40,636 | [
{
"from": "human",
"value": "I've got a TDictionary that stores a bunch of objects indexed by name, and I'd like to be able to examine all of the objects. So I tried this:\nvar enumerator: TMyObject;\nbegin\n for enumerator in myDictionary do\n\nBut that wouldn't compile. \"Incompatible types: 'TMyObject... |
The term is getting 'hotter' with Microsoft Azure and Windows 7.
What are the benefits + how does the status quo of desktop computing now change? Does the machine no longer need an OS installation (or a highly stripped down version of a typical OS)... what is needed to interact with the 'Cloud' ?
Update: Received my f... | The transition towards cloud computing, particularly with platforms like Microsoft Azure, is reshaping the landscape of desktop computing. Here’s how the status quo is changing, along with the implications for operating systems and user experiences:
### 1. **Reduced Need for Local Processing Power**
- **Old Model:*... | 40,085 | [
{
"from": "human",
"value": "The term is getting 'hotter' with Microsoft Azure and Windows 7.\n What are the benefits + how does the status quo of desktop computing now change? Does the machine no longer need an OS installation (or a highly stripped down version of a typical OS)... what is needed to interac... |
Question says it all really...
I have tried changing the "Allow non-admin users to run this program" setting on the property pages, and have also given the non-admin user in question what looks like the correct privileges in Component Services -> DCOM Config.
Is there anything else I can do ?
This is on Server2003 BTW.... | When dealing with DCOM permissions and non-admin users on Windows Server 2003, you can follow several steps to troubleshoot and resolve the issue. Here are some additional approaches you can take:
1. **DCOM Configuration**:
- Open `Component Services` (type `dcomcnfg` in the Run dialog).
- Navigate to `Component... | 42,774 | [
{
"from": "human",
"value": "Question says it all really...\nI have tried changing the \"Allow non-admin users to run this program\" setting on the property pages, and have also given the non-admin user in question what looks like the correct privileges in Component Services -> DCOM Config.\nIs there anythi... |
C#: How do you pass an object in a function parameter?
public void MyFunction(TextBox txtField)
{
txtField.Text = "Hi.";
}
Would the above be valid? Or?
| Yes, the code you provided is valid in C#. You can pass an object, such as a `TextBox`, as a parameter to a function. In your example, you have defined a method `MyFunction` that takes a `TextBox` object as a parameter. Inside the function, you can manipulate the properties of the `TextBox` instance passed to it.
Her... | 46,369 | [
{
"from": "human",
"value": "C#: How do you pass an object in a function parameter?\npublic void MyFunction(TextBox txtField)\n{\n txtField.Text = \"Hi.\";\n}\n\nWould the above be valid? Or?\n"
},
{
"from": "gpt",
"value": "Yes, the code you provided is valid in C#. You can pass an object, suc... |
I'm using MS Access to create a database with over 5000 contacts. These contacts are separated up into which employee the contact belongs to, and then again into categories for easy searching. What I want to do is create a button that will open up a query in table form (simple), then have check boxes so an employee can... | Hi Kate,
Creating a solution for sending mass emails from an MS Access database with a user interface for selecting contacts can be a bit complex, especially for someone without a programming background, but I'll guide you through the essential steps you can follow.
### Step 1: Create a Form to Display Contacts
1. *... | 40,730 | [
{
"from": "human",
"value": "I'm using MS Access to create a database with over 5000 contacts. These contacts are separated up into which employee the contact belongs to, and then again into categories for easy searching. What I want to do is create a button that will open up a query in table form (simple),... |
I have a web application, written in ColdFusion, which periodically starts using 100% of the server's CPU and crashes the ColdFusion service.
Since I have been unable to reproduce the problem myself, I'd like to find a utility which will notify me by email when the CPU usage begins to climb, so I can hop on the server,... | To set up a solution that notifies you via email when your CPU usage climbs, you can utilize Windows Performance Monitor (perfmon) with a batch script to send an email alert. Here’s a step-by-step guide to help you configure this:
### Step 1: Create a Batch Script to Send Email
You can create a batch file that uses P... | 38,667 | [
{
"from": "human",
"value": "I have a web application, written in ColdFusion, which periodically starts using 100% of the server's CPU and crashes the ColdFusion service.\nSince I have been unable to reproduce the problem myself, I'd like to find a utility which will notify me by email when the CPU usage be... |
What is the difference between the concepts of "Code Re-entrancy" and "Thread Safety"? As per the link mentioned below, a piece of code can be either of them, both of them or neither of them.
Reentrant and Thread safe code
I was not able to understand the explaination clearly. Help would be appreciated.
| Certainly! Let's break down the concepts of "Code Re-entrancy" and "Thread Safety" and clarify how they differ:
### Code Re-entrancy
**Definition:**
Reentrant code is code that can be interrupted in the middle of its execution and safely called again ("re-entered") before its previous executions are complete. This me... | 43,197 | [
{
"from": "human",
"value": "What is the difference between the concepts of \"Code Re-entrancy\" and \"Thread Safety\"? As per the link mentioned below, a piece of code can be either of them, both of them or neither of them. \nReentrant and Thread safe code\nI was not able to understand the explaination cle... |
How to invoke the default browser with an URL from C#?
| To invoke the default web browser and open a specific URL in C#, you can use the `Process.Start` method from the `System.Diagnostics` namespace. Here's a simple example:
```csharp
using System;
using System.Diagnostics;
class Program
{
static void Main(string[] args)
{
string url = "https://www.exampl... | 45,124 | [
{
"from": "human",
"value": "How to invoke the default browser with an URL from C#?\n"
},
{
"from": "gpt",
"value": "To invoke the default web browser and open a specific URL in C#, you can use the `Process.Start` method from the `System.Diagnostics` namespace. Here's a simple example:\n\n```csh... |
I'm playing around with CodeIgniter; hoping to convert some of my old, ugly PHP into a more maintainable framework. However, I've come across a rather frustrating roadblock - I can't seem to define methods in my views. Any time I try I get a completely blank page, and when I look in the debug log the processing seemed ... | In CodeIgniter, views are primarily intended for displaying data and HTML, not for containing business logic or methods. Therefore, you cannot define methods directly within views, which is why you're encountering issues when you attempt to do so. The framework is designed to encourage a separation of concerns, which m... | 40,714 | [
{
"from": "human",
"value": "I'm playing around with CodeIgniter; hoping to convert some of my old, ugly PHP into a more maintainable framework. However, I've come across a rather frustrating roadblock - I can't seem to define methods in my views. Any time I try I get a completely blank page, and when I loo... |
I'm not a designer, so I'm looking for some free WPF themes.
Any suggestions?
| There are several resources available for free WPF themes and styles that you can use to enhance the appearance of your WPF applications. Here are some suggestions:
1. **MahApps.Metro**:
- A popular library for creating Metro-style applications in WPF. It provides a clean and modern design and includes various cont... | 42,629 | [
{
"from": "human",
"value": "I'm not a designer, so I'm looking for some free WPF themes.\nAny suggestions?\n"
},
{
"from": "gpt",
"value": "There are several resources available for free WPF themes and styles that you can use to enhance the appearance of your WPF applications. Here are some sug... |
Can anyone provide some pseudo code for a roulette selection function? How would I implement this: I don't really understand how to read this math notation.I want General algorithm to this.
| Certainly! Roulette selection is a popular method used in genetic algorithms for selecting individuals based on their fitness scores. The idea is to give individuals with higher fitness scores a higher chance of being selected for reproduction.
Here's a general outline of the algorithm for roulette selection, presente... | 39,719 | [
{
"from": "human",
"value": "Can anyone provide some pseudo code for a roulette selection function? How would I implement this: I don't really understand how to read this math notation.I want General algorithm to this.\n"
},
{
"from": "gpt",
"value": "Certainly! Roulette selection is a popular m... |
Given that Decimal.MaxValue = 79228162514264337593543950335m
Why does the next line give me 7922816251426433759354395034M in the Local window instead of 7922816251426433759354395033.5m as expected?
Decimal target = Decimal.MaxValue / 10m;
| The reason you see `7922816251426433759354395034M` instead of `7922816251426433759354395033.5m` when you divide `Decimal.MaxValue` by `10m` has to do with how decimal arithmetic works in C# and the precision limits of the `decimal` type.
The `decimal` type in C# is a 128-bit data type designed for high precision, part... | 44,116 | [
{
"from": "human",
"value": "Given that Decimal.MaxValue = 79228162514264337593543950335m\nWhy does the next line give me 7922816251426433759354395034M in the Local window instead of 7922816251426433759354395033.5m as expected?\nDecimal target = Decimal.MaxValue / 10m;\n"
},
{
"from": "gpt",
"va... |
In asp.net is there any benefit to including or not including an id property? Assume for this question that there is no programtic reason why we need an ID. (We are not manipulating the control in code behind, nor on the client).
My personal preference is only to include an Id property when I have a reason to manipulat... | Your perspective on including or excluding ID properties in ASP.NET controls is valid, especially if you have no plans to manipulate those controls programmatically. Here are some points to consider for both sides of the argument:
### Benefits of Including ID Properties
1. **Accessibility**:
- Unique IDs can enha... | 43,063 | [
{
"from": "human",
"value": "In asp.net is there any benefit to including or not including an id property? Assume for this question that there is no programtic reason why we need an ID. (We are not manipulating the control in code behind, nor on the client).\nMy personal preference is only to include an Id ... |
I would like to replace ">" with ">" and "<" with "<" but only when they occur outside "<pre>" and "</pre>". Is this possible?
$newText = preg_replace('>', '>', $text);
I would be using the preg_replace in PHP as above.
| Yes, it is possible to replace `>` with `>` and `<` with `<` outside of `<pre>` and `</pre>` tags using regular expressions in PHP. You can achieve this using a combination of `preg_replace_callback` and a regular expression to isolate the content outside of the `<pre>` tags.
Here’s how you can implement this in... | 44,034 | [
{
"from": "human",
"value": "I would like to replace \">\" with \">\" and \"<\" with \"<\" but only when they occur outside \"<pre>\" and \"</pre>\". Is this possible?\n$newText = preg_replace('>', '>', $text);\n\nI would be using the preg_replace in PHP as above.\n"
},
{
"from": "gpt",
"v... |
I'd like my datagridview cursor to move right to the next column instead of moving to the next row after entering data to a cell.
I've attempted to take control of the cursor by capturing the keys via dataGridView1_KeyDown event but this does not prevent the cursor from moving to the next row after entering data to a ... | To change the behavior of the DataGridView so that the cursor moves to the next column instead of moving to the next row after entering data into a cell, you can handle the `EditingControlShowing` event and override the behavior of the Enter key (or whichever key you choose to trigger the next column movement).
Here's... | 39,935 | [
{
"from": "human",
"value": "I'd like my datagridview cursor to move right to the next column instead of moving to the next row after entering data to a cell. \nI've attempted to take control of the cursor by capturing the keys via dataGridView1_KeyDown event but this does not prevent the cursor from moving... |
I am reading in numbers from a file and then trying to add them to an array. My problem is how do you increase the size of the array? For example I thought might be able to just do:
#include <iostream>
using namespace std;
int main() {
double *x;
x = new double[1];
x[0]=5;
x = new double[1];
x[1]=6... | To dynamically manage an array in C++, you'll need to handle memory allocation and resizing properly since C++ does not provide built-in dynamic arrays that automatically resize like some other languages do. One common approach is to create a new larger array, copy the existing elements to it, and then deallocate the o... | 43,473 | [
{
"from": "human",
"value": "I am reading in numbers from a file and then trying to add them to an array. My problem is how do you increase the size of the array? For example I thought might be able to just do:\n#include <iostream>\nusing namespace std;\n\nint main() {\n double *x;\n x = new double[1]... |
The scenario:
I dynamically create an iframe and a form inside it via JavaScript.
The form is submitted via JavaScript and sends a POST request to a server.
The request is received, but the browser stays on loading status (the progress bar at the bottom of the window keeps progressing and doesn't stop, only happens af... | The issue you’re experiencing is likely due to how the browser handles the loading state of iframes when they are involved in form submissions. When a form is submitted from an iframe, the iframe itself will attempt to navigate to the server's response, leading to the progress bar continuing to load until the request i... | 42,637 | [
{
"from": "human",
"value": "The scenario:\n\nI dynamically create an iframe and a form inside it via JavaScript.\nThe form is submitted via JavaScript and sends a POST request to a server.\nThe request is received, but the browser stays on loading status (the progress bar at the bottom of the window keeps ... |
I have a Flex App that allows you to dynamically build an animation. It has a UI and a display of the resulting animation, which is a custom Class extending UIComponent. Is there some way to allow users to save/export the dynamically generated Component to a SWF, for reuse in other Flash/Flex Apps?
| Exporting a dynamically generated Flex component to a SWF file for reuse in other Flash/Flex applications is not straightforward, as there is no direct built-in functionality in Flex or ActionScript to serialize a component to SWF format. However, there are a few approaches you can consider, although each comes with it... | 41,130 | [
{
"from": "human",
"value": "I have a Flex App that allows you to dynamically build an animation. It has a UI and a display of the resulting animation, which is a custom Class extending UIComponent. Is there some way to allow users to save/export the dynamically generated Component to a SWF, for reuse in ot... |
I'm using the built-in Domain Catalog database to list all the databases on a particular Domino server. I'm creating a custom view to show certain information about each database. What I'd like to have is a column that displays the creator of each database. However, if the Domain Catalog is keeping track of this inform... | In IBM Domino, the Domain Catalog does maintain information about databases, but it does not directly store the creator of each database as an explicit field. The Domain Catalog primarily contains metadata about databases, such as their names, file paths, and replication information, but creator information is not incl... | 42,923 | [
{
"from": "human",
"value": "I'm using the built-in Domain Catalog database to list all the databases on a particular Domino server. I'm creating a custom view to show certain information about each database. What I'd like to have is a column that displays the creator of each database. However, if the Domai... |
This is one is for any of you Doctrine users out there. I have a PHP CLI daemon process that checks a table every n seconds to find entries that haven't been processed. It's basically a FIFO. Anyways, I always exceed the memory allocated to PHP becuase Doctrine does not free it's resources. To combat this problem i... | Based on the code and the memory usage issue you're experiencing with Doctrine, there are a few suggestions and potential improvements you can try to optimize memory usage:
1. **Use `execute` with `fetchMode`**: You can modify the query to only retrieve the columns you need. Instead of fetching entire entities, fetch ... | 39,441 | [
{
"from": "human",
"value": "This is one is for any of you Doctrine users out there. I have a PHP CLI daemon process that checks a table every n seconds to find entries that haven't been processed. It's basically a FIFO. Anyways, I always exceed the memory allocated to PHP becuase Doctrine does not free ... |
I'm learning about Win32 programming, and the WinMain prototype looks like:
int WINAPI WinMain ( HINSTANCE instance, HINSTANCE prev_instance, PSTR cmd_line, int cmd_show )
I was confused as to what this WINAPI identifier was for and found:
#define WINAPI __stdcall
What does this do? I'm confused by this having ... | In Win32 programming, `WINAPI` is a macro that defines a calling convention for functions. Specifically, it resolves to `__stdcall`, which is one of several calling conventions used in C and C++ programming.
### Understanding Calling Conventions
1. **Calling Convention**: A calling convention is a set of rules that d... | 43,031 | [
{
"from": "human",
"value": "I'm learning about Win32 programming, and the WinMain prototype looks like:\nint WINAPI WinMain ( HINSTANCE instance, HINSTANCE prev_instance, PSTR cmd_line, int cmd_show )\n\nI was confused as to what this WINAPI identifier was for and found:\n#define WINAPI __stdcall\n\nW... |
Can the name and icon of an Eclipse view be programmatically changed? I am referring to the name and icon that appear in the tab for the view - which are specified as XML attributes "name" and "icon" in the <view> element in plugin.xml.
| Yes, you can programmatically change the name and icon of an Eclipse view's tab after it has been created. The name and icon specified in the `plugin.xml` are used as defaults, but you can override them dynamically using the `IWorkbenchPage` and `IViewPart` interfaces.
To change the view's name, you would typically us... | 41,577 | [
{
"from": "human",
"value": "Can the name and icon of an Eclipse view be programmatically changed? I am referring to the name and icon that appear in the tab for the view - which are specified as XML attributes \"name\" and \"icon\" in the <view> element in plugin.xml.\n"
},
{
"from": "gpt",
"va... |
If I have a button like the one in this image :
http://www.freeimagehosting.net/image.php?4cd775814c.png
how could I make the text display itself vertically ? As in
j
B
u
t
t
o
n
1
I would like to know how to do the same thing for JLabel . I'm sure there has to be a better way than to create as many labels as there ... | To display text vertically in a JButton or JLabel in Java, you don't need to create multiple labels for each character. Instead, you can override the `paintComponent` method of the component (e.g., JButton or JLabel) to customize how the text is rendered. Here’s how you can do it for both a JButton and a JLabel:
### V... | 40,762 | [
{
"from": "human",
"value": "If I have a button like the one in this image :\nhttp://www.freeimagehosting.net/image.php?4cd775814c.png\nhow could I make the text display itself vertically ? As in \n\nj\nB\nu\nt\nt\no\nn\n1\n\nI would like to know how to do the same thing for JLabel . I'm sure there has to b... |
I've enjoyed using the iTunes Store but I'm curious on what it was developed on (PHP & MySQL, Something Custom?).
| The iTunes Store, like many large-scale applications, was built using a combination of technologies. While Apple has not disclosed all the specific technologies used in the development of the iTunes Store, it's common for large platforms like this to use a mix of custom-built solutions and established technologies.
1.... | 45,764 | [
{
"from": "human",
"value": "I've enjoyed using the iTunes Store but I'm curious on what it was developed on (PHP & MySQL, Something Custom?). \n"
},
{
"from": "gpt",
"value": "The iTunes Store, like many large-scale applications, was built using a combination of technologies. While Apple has no... |
All the documentation I've found so far is to update keys that are already created:
arr['key'] = val;
I have a string like this: " name = oscar "
And I want to end up with something like this:
{ name: 'whatever' }
That is, split the string and get the first element, and then put that in a dictionary.
Code
var text... | In JavaScript, if you want to create a dictionary (or object) and assign a key-value pair to it, you should use an object instead of an array. Arrays are primarily designed for ordered collections of items, while objects are used for key-value pairs.
Here's how you can modify your code to achieve the desired result:
... | 45,343 | [
{
"from": "human",
"value": "All the documentation I've found so far is to update keys that are already created:\n arr['key'] = val;\n\nI have a string like this: \" name = oscar \" \nAnd I want to end up with something like this:\n{ name: 'whatever' }\n\nThat is, split the string and get the first element... |
I was wondering if you can give me sample (or snippet) code in OCR for Mobile Phones because i need to have an idea how to start my project. i know how to code it for the use in desktop PC's but my partner told me that mobile phones has a different platform. We are planning to use .net for mobile on this one.. hope yo... | Certainly! For mobile development with .NET, you might want to consider using Xamarin or .NET MAUI (Multi-platform App UI), which allows you to create cross-platform applications. To implement Optical Character Recognition (OCR) in a mobile app, you can use libraries like Tesseract or integrate cloud-based solutions li... | 40,026 | [
{
"from": "human",
"value": "I was wondering if you can give me sample (or snippet) code in OCR for Mobile Phones because i need to have an idea how to start my project. i know how to code it for the use in desktop PC's but my partner told me that mobile phones has a different platform. We are planning to ... |
I am trying to create a data connection in SSIS. I have the Sybase.Data.ASEClient.dll version 1.1.680 installed but this does not show as a .Net Provider.
Is it possible to use this ADO.NET provider with SSIS and if so how can I make it accessible?
| Yes, it is possible to use the Sybase ADO.NET provider (such as `Sybase.Data.ASEClient.dll`) with SQL Server Integration Services (SSIS), but it requires a few steps to make the provider accessible and visible in your SSIS environment. Below are the steps to achieve this:
### 1. **Install the ADO.NET Provider:**
En... | 42,862 | [
{
"from": "human",
"value": "I am trying to create a data connection in SSIS. I have the Sybase.Data.ASEClient.dll version 1.1.680 installed but this does not show as a .Net Provider. \nIs it possible to use this ADO.NET provider with SSIS and if so how can I make it accessible?\n"
},
{
"from": "gpt... |
A game that I play stores all of its data in a .DAT file. There has been some work done by people in examining the file. There are also some existing tools, but I'm not sure about their current state. I think it would be fun to poke around in the data myself, but I've never tried to examine a file, much less anything l... | Examining a file format, especially one that is binary like a .DAT file, can be a rewarding yet challenging endeavor. Here are some general tips to help you get started:
### 1. **Understand the Basics of File Formats**
- **File Structure**: Familiarize yourself with the basic components of file formats, such as hea... | 39,504 | [
{
"from": "human",
"value": "A game that I play stores all of its data in a .DAT file. There has been some work done by people in examining the file. There are also some existing tools, but I'm not sure about their current state. I think it would be fun to poke around in the data myself, but I've never trie... |
If I add an item to the cache named "foo", and then add another item named "foo" to the cache before the first expires, will this trigger the CacheItemRemoved event?
| In most caching implementations, if you add an item with the same key (in this case, "foo") before the first item expires, the original item will typically be replaced, and this could trigger a `CacheItemRemoved` event. However, whether the event is triggered or not depends on the specific caching library or framework ... | 47,911 | [
{
"from": "human",
"value": "If I add an item to the cache named \"foo\", and then add another item named \"foo\" to the cache before the first expires, will this trigger the CacheItemRemoved event?\n"
},
{
"from": "gpt",
"value": "In most caching implementations, if you add an item with the sam... |
I'd like to be able to place all my ASP Classic include files outside of the web root. This assures no include files can be called directly via the URL.
What is the best way to accomplish this?
I know I can use a virtual directory to reference an includes folder outside of web root, but doesn't that still allow direct... | You're correct in your understanding of virtual directories in that they can still be accessed via URLs if not properly configured. Placing your ASP Classic include files outside of the web root is a good strategy for enhancing security and preventing direct access. Here are some options for achieving this:
### 1. Pla... | 42,616 | [
{
"from": "human",
"value": "I'd like to be able to place all my ASP Classic include files outside of the web root. This assures no include files can be called directly via the URL. \nWhat is the best way to accomplish this?\nI know I can use a virtual directory to reference an includes folder outside of we... |
Here's the deal - I want a way to figure out specifically which methods were touched or changed within the last milestone/iteration so that the methods' Javadoc is checked for correct content, especially for the public API methods.
Any ideas on how to do this, perhaps with an SVN hook?
| To achieve the goal of identifying which methods were modified during the last milestone or iteration in order to check their Javadoc comments, you can utilize a combination of SVN hooks and code analysis tools. Here’s a step-by-step approach to implement this:
### Step 1: Use SVN Hooks
1. **Pre-commit Hook**: You can... | 43,216 | [
{
"from": "human",
"value": "Here's the deal - I want a way to figure out specifically which methods were touched or changed within the last milestone/iteration so that the methods' Javadoc is checked for correct content, especially for the public API methods.\nAny ideas on how to do this, perhaps with an S... |
How can you create a C# Winforms control which goes out of the bounds of its region? Such as a drop down box. Kind of like if you had a DropDownBox in a Small Sized Panel.
| In a WinForms application, controls typically stay within the bounds of their parent controls, which can limit their appearance when you have a small container like a panel. If you want to create a control (like a dropdown box) that visually extends outside the bounds of its parent control, you can use a combination of... | 42,350 | [
{
"from": "human",
"value": "How can you create a C# Winforms control which goes out of the bounds of its region? Such as a drop down box. Kind of like if you had a DropDownBox in a Small Sized Panel.\n"
},
{
"from": "gpt",
"value": "In a WinForms application, controls typically stay within the... |
I use XML serialization for the reading of my Config-POCOs.
To get intellisense support in Visual Studio for XML files I need a schema file. I can create the schema with xsd.exe mylibrary.dll and this works fine.
But I want that the schema is always created if I serialize an object to the file system. Is there any way... | If you want to automatically generate an XML schema (XSD) file whenever you serialize an object to the file system, without using `xsd.exe`, you can achieve this programmatically within your application.
### Steps to Automatically Generate XSD
1. **Use `XmlSerializer` to Serialize your Object**: When you serialize yo... | 42,667 | [
{
"from": "human",
"value": "I use XML serialization for the reading of my Config-POCOs. \nTo get intellisense support in Visual Studio for XML files I need a schema file. I can create the schema with xsd.exe mylibrary.dll and this works fine.\nBut I want that the schema is always created if I serialize an ... |
You know, sometimes it happens that you run out of ideas for your next hobbistic programming project, and then... you ask for help on StackOverflow :)
So: what would it be your suggestion for a rocking web application (it may be implemented using Google App Engine and it may use the new fresh Google Friend Connect APIs... | Absolutely! Here are a few ideas for web applications that could utilize Google App Engine and Google Friend Connect APIs. Each suggestion includes a brief outline of the concept and the features you could implement:
### 1. **Social Book Recommendation Platform**
- **Concept**: A platform where users can recommend,... | 42,062 | [
{
"from": "human",
"value": "You know, sometimes it happens that you run out of ideas for your next hobbistic programming project, and then... you ask for help on StackOverflow :)\nSo: what would it be your suggestion for a rocking web application (it may be implemented using Google App Engine and it may us... |
I understand they both don't change the URL that the client sees. Is there anything in them that makes one of them preferable over the other?
I'm planning to use it in the Application_BeginRequest in Global.asax, but also in regular aspx page.
| When considering whether to use URL rewriting or URL routing in your ASP.NET application, it’s important to understand the differences and implications of each approach. Both methods allow you to change how URLs are structured without changing what the user sees in the browser, but they have different use cases and adv... | 42,190 | [
{
"from": "human",
"value": "I understand they both don't change the URL that the client sees. Is there anything in them that makes one of them preferable over the other?\nI'm planning to use it in the Application_BeginRequest in Global.asax, but also in regular aspx page.\n"
},
{
"from": "gpt",
... |
I am making a C# app for a class project. I want to ensure a string has one of three values. Normally, in a web app, I would do validation with javascript on the client side. However, this is currently a console app. I know that I should do the validation early, but what are some good rules of thumb for validation?... | When validating user input in a console application, it's important to ensure that the validation process is both effective and user-friendly. Here are some rules of thumb you can follow:
1. **Define Clear Criteria**: Establish what the valid values are beforehand. In your case, you mentioned that the string should ma... | 41,093 | [
{
"from": "human",
"value": "I am making a C# app for a class project. I want to ensure a string has one of three values. Normally, in a web app, I would do validation with javascript on the client side. However, this is currently a console app. I know that I should do the validation early, but what are... |
When I browse code in Vim, I need to see opening and closing parenthesis/
brackets, and pressing % seems unproductive.
I tried :set showmatch, but it makes the cursor jump back and forth
when you type in a bracket. But what to do if I am browsing already written code?
| If you're using Vim and want to make it easier to navigate through matching parentheses and brackets without the cursor jumping around when typing, there are a few options you can consider:
### 1. Use `:set showmatch` with a Delay
You can modify the behavior of `showmatch` to reduce the jumpiness by adding a delay to... | 43,336 | [
{
"from": "human",
"value": "When I browse code in Vim, I need to see opening and closing parenthesis/\nbrackets, and pressing % seems unproductive.\nI tried :set showmatch, but it makes the cursor jump back and forth\nwhen you type in a bracket. But what to do if I am browsing already written code?\n"
},... |
Does anyone know of any optimization packages out there for R (similar to NUOPT for S+)?
| Yes, there are several optimization packages available in R that you can use for various optimization tasks, similar to NUOPT for S+. Here are some popular ones:
1. **nloptr**: This package provides an interface to the NLopt library, which implements various algorithms for nonlinear optimization. It's useful for both ... | 44,131 | [
{
"from": "human",
"value": "Does anyone know of any optimization packages out there for R (similar to NUOPT for S+)?\n"
},
{
"from": "gpt",
"value": "Yes, there are several optimization packages available in R that you can use for various optimization tasks, similar to NUOPT for S+. Here are so... |
I know I can update a single record like this - but then how to I get access to the id of the record that was updated? (I'm using MSSQL so I can't use Oracles RowId)
update myTable
set myCol = 'foo'
where itemId in (select top 1 itemId from myTable )
If I was peforming an Insert I could use getGeneratedKeys to get th... | When you're performing an `UPDATE` operation in SQL Server and want to get the ID of the updated record, you can use the `OUTPUT` clause. This allows you to capture the values of the updated rows, including their IDs, without needing to select them separately.
Here’s how you can modify your `UPDATE` statement to inclu... | 45,694 | [
{
"from": "human",
"value": "I know I can update a single record like this - but then how to I get access to the id of the record that was updated? (I'm using MSSQL so I can't use Oracles RowId)\nupdate myTable\nset myCol = 'foo'\nwhere itemId in (select top 1 itemId from myTable )\n\nIf I was peforming an... |
Strange error specific to a particular machine...
I have a app in which a combo box's text value is set to the path of a document (i.e...
cmbAIDFile.Text = clsTonyToolkit.GetSetting("ExportAIDFile",gtypmetadata.gcnnCentral) & ""
Forget about all the GetSetting procedure etc, just that it returns a line of text and wor... | The "Run-time error 0" can be quite elusive since it does not provide specific information about the underlying issue. Here are some potential causes and troubleshooting steps you can take to help identify and resolve the issue on the problematic Vista machine:
1. **Environment Variables**: Check if there are any envi... | 43,704 | [
{
"from": "human",
"value": "Strange error specific to a particular machine...\nI have a app in which a combo box's text value is set to the path of a document (i.e...\ncmbAIDFile.Text = clsTonyToolkit.GetSetting(\"ExportAIDFile\",gtypmetadata.gcnnCentral) & \"\"\n\nForget about all the GetSetting procedure... |
Alan Kay was quoted several years ago to the effect that there had been only three new things in software in the preceding 20 years (effectively the lifespan of PCs). One of them was Spreadsheets.
Does anyone remember the other two?
Who is Alan Kay? (a few may ask.) His work at Xerox Parc arguably did more to shape our... | Alan Kay is a computer scientist known for his pioneering work in object-oriented programming and his contributions to the development of personal computing. He is often associated with the concept of "the Dynabook," a portable computer concept that laid the groundwork for modern laptops and tablets. His work at Xerox ... | 45,364 | [
{
"from": "human",
"value": "Alan Kay was quoted several years ago to the effect that there had been only three new things in software in the preceding 20 years (effectively the lifespan of PCs). One of them was Spreadsheets.\nDoes anyone remember the other two?\nWho is Alan Kay? (a few may ask.) His work a... |
I have a class hierarchy, this one:
type
TMatrix = class
protected
//...
public
constructor Create(Rows, Cols: Byte);
//...
type
TMinMatrix = class(TMatrix)
private
procedure Allocate;
procedure DeAllocate;
public
constructor Create(Rows, Cols: Byte);
constructo... | In Delphi, it is indeed necessary to explicitly call the constructor of the base class in the derived class if the base class constructor requires parameters. This is similar to C++ in that you must specify how to initialize the base class when creating an instance of the derived class. However, Delphi does not automat... | 46,033 | [
{
"from": "human",
"value": "I have a class hierarchy, this one:\ntype\nTMatrix = class\n protected\n //...\n public\n constructor Create(Rows, Cols: Byte);\n //...\ntype\n TMinMatrix = class(TMatrix)\n private\n procedure Allocate;\n procedure DeAllocate;\n public\n ... |
I am binding a List to a DataGridView. One property of the SomeObject class will be a status code (ex. Red, Yellow, Green). Can I "bind" the status to the background color of a cell easily? How about binding to a tooltip also?
| Yes, you can bind a `List<T>` to a `DataGridView`, and you can conditionally change the background color of a cell based on a property, such as a status code. You can also set tooltips for the cells in a similar manner. Here’s how you can achieve both:
### Step 1: Define Your Class
Assuming you have a class `SomeObje... | 40,209 | [
{
"from": "human",
"value": "I am binding a List to a DataGridView. One property of the SomeObject class will be a status code (ex. Red, Yellow, Green). Can I \"bind\" the status to the background color of a cell easily? How about binding to a tooltip also?\n"
},
{
"from": "gpt",
"value": "Yes, ... |
I am extending a template class using C++ in Visual Studio 2005.
It is giving me an error when I try to extend the template base class with:
template <class K, class D>
class RedBlackTreeOGL : public RedBlackTree<K, D>::RedBlackTree // Error 1
{
public:
RedBlackTreeOGL();
~RedBlackTreeOGL();
and a second error w... | The issues you're encountering stem from a misunderstanding of how to extend a template class in C++. Let's go through both of your errors.
### Error 1:
The line that causes the first error is:
```cpp
class RedBlackTreeOGL : public RedBlackTree<K, D>::RedBlackTree
```
Here, `RedBlackTree<K, D>::RedBlackTree` is incor... | 44,471 | [
{
"from": "human",
"value": "I am extending a template class using C++ in Visual Studio 2005.\nIt is giving me an error when I try to extend the template base class with:\ntemplate <class K, class D>\nclass RedBlackTreeOGL : public RedBlackTree<K, D>::RedBlackTree // Error 1\n{\n public:\n RedBlackTreeOGL... |
I have an ASP.NET MVC project and I have a single action that accepts GET, POST, and DELETE requests. Each type of request is filtered via attributes on my controllers Action methods.
[ActionName(Constants.AdministrationGraphDashboardAction),
AcceptVerbs(HttpVerbs.Post)]
public ActionResult GraphAdd([ModelBinder(typeo... | To trigger an HTTP DELETE request in a web application using HTML, you typically can't use a standard `<form>` since forms only support GET and POST methods natively. However, you can accomplish this using JavaScript (or jQuery) to make an AJAX DELETE request when a link or button is clicked.
### Option 1: Using JavaS... | 43,714 | [
{
"from": "human",
"value": "I have an ASP.NET MVC project and I have a single action that accepts GET, POST, and DELETE requests. Each type of request is filtered via attributes on my controllers Action methods.\n[ActionName(Constants.AdministrationGraphDashboardAction),\nAcceptVerbs(HttpVerbs.Post)]\npub... |
I'm trying to verify that a parameter is an instance of a specific class in Rails:
def schedule(action, *args)
if arg.is_a? Aircraft
...
end
end
I'm doing this in a library class (the file is in lib/) and I get an uninitialized constant Aircraft error. Aircraft is a model class, with a corresponding aircraft.r... | In Rails, when you're working with classes in the `lib/` directory, you might run into issues with loading classes defined in other directories, such as `app/models`. This is especially true in testing environments like RSpec, where class loading behavior can differ from what you experience in the Rails console or web ... | 40,309 | [
{
"from": "human",
"value": "I'm trying to verify that a parameter is an instance of a specific class in Rails:\ndef schedule(action, *args)\n if arg.is_a? Aircraft\n ...\n end\nend\n\nI'm doing this in a library class (the file is in lib/) and I get an uninitialized constant Aircraft error. Aircraft i... |
In Microsoft Access I have a table called Time Sheet and in this I have Time sheet no. , waiter no. , date and hours worked. I have 10 waiters.
I have another table called Service Charge Distribution. In this table I have Service Charge No. , waiter no. , week no. and distribution amount.
There is a Bill table where ... | To calculate the distribution amount in the "Service Charge Distribution" table based on the hours worked by each waiter in the "Time Sheet" table, you can follow these steps. This guide assumes you are familiar with the basics of Microsoft Access forms, queries, and tables.
### Step 1: Create a Query to Calculate Tot... | 40,711 | [
{
"from": "human",
"value": "In Microsoft Access I have a table called Time Sheet and in this I have Time sheet no. , waiter no. , date and hours worked. I have 10 waiters. \nI have another table called Service Charge Distribution. In this table I have Service Charge No. , waiter no. , week no. and distribu... |
How do you retain the indentation of numbered lists? I have a page where the numbers are pushed off the page. How can I prevent this?
<ol style="padding: 0">
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ol>
| If your numbered list is getting pushed off the page, it's likely due to the way your styles are set up. The `<ol>` element (ordered list) typically comes with default styling that includes margin and padding that helps to position the numbers correctly. When you set `padding: 0` on the `<ol>`, you are removing the def... | 37,977 | [
{
"from": "human",
"value": "How do you retain the indentation of numbered lists? I have a page where the numbers are pushed off the page. How can I prevent this?\n<ol style=\"padding: 0\">\n <li>Item 1</li>\n <li>Item 2</li>\n <li>Item 3</li>\n</ol>\n\n"
},
{
"from": "gpt",
"value": ... |
I have a custom renderer in a JTable to display JCheckboxes for booleans. However, this causes a slight issue because when the user clicks in the table cell, but not in the checkbox, the checkbox is still checked.
Is there a way I can return the bounds of the actual JCheckbox that is rendered by the JTable at a partic... | Yes, you can achieve this by customizing the `JTable` and its `MouseListener`. When a mouse click occurs, you can check if the click falls within the bounds of the rendered `JCheckBox`. Here’s how you can do it:
1. **Override the `prepareRenderer` method**: This is where you customize the way your data is rendered in ... | 41,593 | [
{
"from": "human",
"value": "I have a custom renderer in a JTable to display JCheckboxes for booleans. However, this causes a slight issue because when the user clicks in the table cell, but not in the checkbox, the checkbox is still checked.\nIs there a way I can return the bounds of the actual JCheckbox ... |
I need help getting my head around the difference between my current OOP notion of state, and the way it would be done in a functional language like Haskell or Clojure.
To use a hackneyed example, let's say we're dealing with simplified bank account objects/structs/whatever. In an OOP language, I'd have some class hold... | You're right in identifying a fundamental difference between how state is managed in Object-Oriented Programming (OOP) versus functional programming languages like Haskell or Clojure. Let’s break it down further and address your specific questions.
### OOP vs. Functional Programming State Management
1. **Mutability v... | 42,702 | [
{
"from": "human",
"value": "I need help getting my head around the difference between my current OOP notion of state, and the way it would be done in a functional language like Haskell or Clojure.\nTo use a hackneyed example, let's say we're dealing with simplified bank account objects/structs/whatever. In... |
I'm trying to write a program to process the BSD-style process accounting file under Linux (/var/account/pacct).
When we start a script with either ./script_name or bash script_name, the process accounting record actually gets written out the the command bash. Presumably because that's the actual program doing the runn... | When you run a script in a shell, the process accounting system records the command of the executing shell (in this case, `bash`) rather than the script itself. This is because the shell is the parent process that directly invokes the script. Unfortunately, the BSD-style process accounting system does not have a built-... | 41,096 | [
{
"from": "human",
"value": "I'm trying to write a program to process the BSD-style process accounting file under Linux (/var/account/pacct).\nWhen we start a script with either ./script_name or bash script_name, the process accounting record actually gets written out the the command bash. Presumably becaus... |
I've been asked to find a way to connect from a Linux system to one of several Windows servers. What we need to do ideally is connect to whatever Windows server is causing the trouble, kill a process, and restart the process. Ideally, it would be something that could be put into a script that could be run from the Li... | Yes, it is indeed possible to manage Windows processes from a Linux system via command line. You can achieve this using a combination of tools. Below are a couple of options that you can consider for your situation:
### Option 1: Using PowerShell Remoting with SSH
1. **Enable PowerShell Remoting**: You need to ensure... | 43,359 | [
{
"from": "human",
"value": "I've been asked to find a way to connect from a Linux system to one of several Windows servers. What we need to do ideally is connect to whatever Windows server is causing the trouble, kill a process, and restart the process. Ideally, it would be something that could be put in... |
This question is related to my previous one.
Can you explain or provide a link to an explanation of how Excel VBA code password protection actually works in versions prior to 2007? What is the difference in Excel 2007 and previous versions in terms of password protection?
Also does Excel's password protection actually ... | ### Excel VBA Code Password Protection in Versions Prior to 2007
In versions of Excel prior to 2007, VBA projects could be protected with a password that prevented unauthorized users from viewing or editing the code. The password protection mechanism was relatively weak:
1. **Storage Method**: The password protection... | 41,098 | [
{
"from": "human",
"value": "This question is related to my previous one.\nCan you explain or provide a link to an explanation of how Excel VBA code password protection actually works in versions prior to 2007? What is the difference in Excel 2007 and previous versions in terms of password protection?\nAlso... |
another issue in IE 6... link
The navbar link list has a border applied to the left side of each element.
In fireforx/safari this matches up with the navbar background but in IE the border/element spills out below the navbar ( the border sticks out the bottom).
EDIT: ALSO, the navbar is the entire length of the blue h... | When dealing with layout issues in older browsers like Internet Explorer 6, there are a few common techniques and CSS adjustments that can help resolve the problems you're facing with the navbar link list. Here are some potential solutions for both issues you've described:
### 1. Border Overflow Issue
If the left bor... | 42,092 | [
{
"from": "human",
"value": "another issue in IE 6... link\nThe navbar link list has a border applied to the left side of each element. \nIn fireforx/safari this matches up with the navbar background but in IE the border/element spills out below the navbar ( the border sticks out the bottom).\nEDIT: ALSO, t... |
I have a solution that contains a good deal of projects,
I would like to remove the source control bindings completely, how can I do this?
Update:
What I really want to do is move one solution and its projects from TFS 2005 -> 2008. Thats why I am removing the bindings, is there a better way to do this?
| To remove source control bindings completely from a solution in Visual Studio, especially when you're moving from TFS 2005 to TFS 2008, you can follow these steps:
### Method 1: Remove Source Control Bindings Manually
1. **Open Visual Studio**: Load your solution in Visual Studio that is bound to TFS.
2. **Remove Bi... | 43,745 | [
{
"from": "human",
"value": "I have a solution that contains a good deal of projects, \nI would like to remove the source control bindings completely, how can I do this?\nUpdate:\nWhat I really want to do is move one solution and its projects from TFS 2005 -> 2008. Thats why I am removing the bindings, is t... |
While developing products, we often need to create proprietary tools to test some of their unique features or diagnose problems. In fact the tools can be at lest as interesting as the products themselves, and some of our internal groups have asked for copies of them.
So, aside from the obvious business-driven rules (e... | Building proprietary tools for internal use differs significantly from developing products intended for external sale. Here are some of the key differences and considerations:
### 1. **User Base and User Experience**:
- **Internal Tools**: The user base is typically smaller and consists of employees familiar with t... | 39,571 | [
{
"from": "human",
"value": "While developing products, we often need to create proprietary tools to test some of their unique features or diagnose problems. In fact the tools can be at lest as interesting as the products themselves, and some of our internal groups have asked for copies of them.\nSo, aside... |
I'm a .NET developer, and worked with VB6 before that. I've become very familiar with those environments, and working in the context of garbage collected languages. However, I now wish to bolster my skillset with native C++ and find myself a bit overwhelmed. Ironically, it's not what I'd imagine is the usual stumbli... | It's great that you're looking to enhance your skills with native C++. Your background in .NET and VB6 will certainly help you transition, especially since you already understand concepts like pointers and memory management. However, as you've identified, C++ does have its own set of challenges and intricacies. Below, ... | 38,492 | [
{
"from": "human",
"value": "I'm a .NET developer, and worked with VB6 before that. I've become very familiar with those environments, and working in the context of garbage collected languages. However, I now wish to bolster my skillset with native C++ and find myself a bit overwhelmed. Ironically, it's ... |
I am currently writing a Firefox extension that will sync your tab sessions across different instances of the browser. I am using a Ruby on Rails web application to sync the different URLS for each user.
The Firefox extension is using Javascript to parse out the current websites that are open. I need to send a user's... | Transferring sensitive information such as a user's login credentials and URLs securely from a Firefox extension to a Ruby on Rails application requires careful handling to prevent exposure. Here are some best practices and methods to achieve this:
### 1. Use HTTPS:
Ensure that your Rails application is served over HT... | 40,999 | [
{
"from": "human",
"value": "I am currently writing a Firefox extension that will sync your tab sessions across different instances of the browser. I am using a Ruby on Rails web application to sync the different URLS for each user.\nThe Firefox extension is using Javascript to parse out the current websit... |
Suddenly my Flex Apps can no longer connect to salesforce.com via its API, I am getting a security sandbox violation. Login credentials are correct, I have tried them via a different means, and I have obfuscated them below.
This was working fine earlier today and I have not been coding since then.
Anyone else come acr... | The error you're encountering is due to a "Security Sandbox Violation," which occurs when a Flex application tries to access a URL (in this case, the Salesforce API) that is not permitted by the Flash Player's security sandbox. Flash Player enforces strict security policies to protect users from potentially malicious a... | 43,348 | [
{
"from": "human",
"value": "Suddenly my Flex Apps can no longer connect to salesforce.com via its API, I am getting a security sandbox violation. Login credentials are correct, I have tried them via a different means, and I have obfuscated them below.\nThis was working fine earlier today and I have not be... |
I have a field (say, foo) in a table in a SQL Server database that was originally defined as nullable, but new requirements indicate that this field must be non-null.
What's the best way of updating this field to non-null via an update script without deleting the contents of the table? I tried generating a script from... | To change a column from nullable to non-nullable in a SQL Server database without losing existing data, you will need to ensure that there are no `NULL` values in that column before you can alter its definition. Here's a step-by-step approach to achieve that using a SQL script:
1. **Identify NULL values**: Check if th... | 40,683 | [
{
"from": "human",
"value": "I have a field (say, foo) in a table in a SQL Server database that was originally defined as nullable, but new requirements indicate that this field must be non-null.\nWhat's the best way of updating this field to non-null via an update script without deleting the contents of th... |
Can one specify XML attribute values as CDATA ? If yes - what would be the schema for the same. If not - why is this limitation not addressed in XML ?
| In XML, attributes cannot contain CDATA sections. The CDATA (Character Data) section is a way to include text in an XML document that should not be parsed by the XML parser, typically used for including text that might otherwise be treated as markup. However, CDATA sections are only valid in the content of elements, no... | 44,027 | [
{
"from": "human",
"value": "Can one specify XML attribute values as CDATA ? If yes - what would be the schema for the same. If not - why is this limitation not addressed in XML ?\n"
},
{
"from": "gpt",
"value": "In XML, attributes cannot contain CDATA sections. The CDATA (Character Data) sectio... |
I'll preface this question by saying this is for a Microsoft only shop.
If you were to write a console app to manage a data warehouse what would you use:
1) Writing a custom environment for PowerShell (ala the latest flavors of Exchange / SQL Server)
2) Write it as a C# Console App
If #2 are there any frameworks th... | When deciding between writing a custom environment for PowerShell versus a C# Console App for managing a data warehouse in a Microsoft-only shop, there are several factors to consider. Both approaches have their own merits, but based on your needs and team experience, here’s a breakdown:
### Option 1: Custom Environme... | 41,433 | [
{
"from": "human",
"value": "I'll preface this question by saying this is for a Microsoft only shop. \nIf you were to write a console app to manage a data warehouse what would you use:\n1) Writing a custom environment for PowerShell (ala the latest flavors of Exchange / SQL Server)\n2) Write it as a C# Con... |
I believe this is a common question / problem but have not been able to find a good clean concise answer.
The Problem
How to map entities that appear to have an inheritance relationship:
Company
Supplier
Manufacturer
Customer
However, a Supplier can be a Manufacturer.
or
Person
Doctor
Patient
Employee
Whe... | The problem you've described is a classic case of needing to model a situation where entities have overlapping responsibilities or roles, which can lead to complications with traditional inheritance structures. Since multiple inheritance isn't supported directly in languages like C# and Java, using composition with a "... | 39,683 | [
{
"from": "human",
"value": "I believe this is a common question / problem but have not been able to find a good clean concise answer.\nThe Problem\nHow to map entities that appear to have an inheritance relationship:\nCompany\n Supplier\n Manufacturer\n Customer\n\nHowever, a Supplier can be a Manufactu... |
Virtualizing the mobile is way different from virtualizing the server or the desktop, where in the the hardware components are almost standardized [like the keyboard, mouse , usb, LAN etc] so the hardware could be easily abstracted for any of the OS.
While on a mobile there is a multitude of hardware [like the iphone t... | Virtualizing mobile devices is indeed a more complex challenge compared to server or desktop virtualization, largely due to the variability in hardware and interaction mechanisms across different devices. However, there are several key drivers that motivate the pursuit of mobile virtualization:
1. **Development and Te... | 37,994 | [
{
"from": "human",
"value": "Virtualizing the mobile is way different from virtualizing the server or the desktop, where in the the hardware components are almost standardized [like the keyboard, mouse , usb, LAN etc] so the hardware could be easily abstracted for any of the OS.\nWhile on a mobile there is ... |
I need to create a wizard for a Flash 9/ActionScript 3.0 application. The wizard would be a set of dialogs/windows for each step and the buttons "back/next/cancel" for navigation through the wizard. Within the Adobe CS3 authoring environment there does not seem to be a straightforward way to create a set of dialogs or... | Creating a wizard in Adobe Flash CS3 using ActionScript 3.0 without utilizing Flex can indeed be challenging, but there are several alternative approaches you can consider beyond using separate timeline layers. Here are a few suggestions:
### 1. **Use MovieClips for Each Step:**
Instead of creating separate timeline l... | 42,320 | [
{
"from": "human",
"value": "I need to create a wizard for a Flash 9/ActionScript 3.0 application. The wizard would be a set of dialogs/windows for each step and the buttons \"back/next/cancel\" for navigation through the wizard. Within the Adobe CS3 authoring environment there does not seem to be a straig... |
What's the difference between the following type definitions
<E extends Number>
and
<? extends Number>
Cheers,
Don
| Hi Don,
The difference between `<E extends Number>` and `<? extends Number>` in Java generics primarily revolves around how they are used and their intended contexts.
1. **`<E extends Number>`**:
- This is a **type parameter declaration**. It defines a generic class, method, or interface that can operate on object... | 41,813 | [
{
"from": "human",
"value": "What's the difference between the following type definitions\n<E extends Number>\n\nand\n<? extends Number>\n\nCheers,\nDon\n"
},
{
"from": "gpt",
"value": "Hi Don,\n\nThe difference between `<E extends Number>` and `<? extends Number>` in Java generics primarily rev... |
Basically I have an admin CP I've coded for all my sites and I'd love to integrate the information gathered by Google Analytics on it to avoid having to look at both sites every morning.
BTW I'm using PHP, but I would assume if something like this exists it would just be exported as XML.
| Integrating Google Analytics data into your custom admin control panel (CP) is a great idea to streamline your workflow. Google Analytics provides a robust API that allows you to access your data programmatically. Here’s a step-by-step guide on how to achieve this using PHP.
### Step 1: Set Up Google Analytics API
1.... | 37,621 | [
{
"from": "human",
"value": "Basically I have an admin CP I've coded for all my sites and I'd love to integrate the information gathered by Google Analytics on it to avoid having to look at both sites every morning.\nBTW I'm using PHP, but I would assume if something like this exists it would just be export... |
How to I configure click-once to install apps for all users. On another forum I got to 'use MSI' - thanks - but how.
Also, the first installing user may not be admin - which may be a problem. And I want all users to trigger an update check.
No local storage, it's a WPF client to a WCF service.
We're XP, internal.
| To configure ClickOnce applications to be accessible to all users, you might want to consider some alternatives. ClickOnce is primarily designed for user-specific installations, but you can work around some of its limitations. Here’s a summary of your options:
### Using ClickOnce for All Users
Unfortunately, ClickOnc... | 41,857 | [
{
"from": "human",
"value": "How to I configure click-once to install apps for all users. On another forum I got to 'use MSI' - thanks - but how.\nAlso, the first installing user may not be admin - which may be a problem. And I want all users to trigger an update check.\nNo local storage, it's a WPF client ... |
Problem: a table of coordinate lat/lngs. Two rows can potentially have the same coordinate. We want a query that returns a set of rows with unique coordinates (within the returned set). Note that distinct is not usable because I need to return the id column which is, by definition, distinct. This sort of works (@maxcou... | To achieve the goal of returning a set of rows with unique coordinates (latitude and longitude) while also including the `id` column from your `Documents` table, you can utilize a Common Table Expression (CTE) or a subquery with a ranking function. The approach can involve using the `ROW_NUMBER()` window function to as... | 43,500 | [
{
"from": "human",
"value": "Problem: a table of coordinate lat/lngs. Two rows can potentially have the same coordinate. We want a query that returns a set of rows with unique coordinates (within the returned set). Note that distinct is not usable because I need to return the id column which is, by definiti... |
I am using IDataErrorInfo to validate and indicate errors in my text boxes. I am finding I have to tab once for the text box and once for the adornerdecorator.
I have an error template:
<ControlTemplate x:Key="ErrorTemplate">
<StackPanel KeyboardNavigation.IsTabStop="False" >
<Border KeyboardNavigation.... | It appears that the issue you're facing is due to the focus behavior and keyboard navigation in WPF when using `AdornerDecorator`. The `AdornerDecorator` wraps the control but can make the adornments focusable, which causes you to have to tab through them.
To resolve the issue, you can set `Focusable` to `False` on th... | 43,498 | [
{
"from": "human",
"value": "I am using IDataErrorInfo to validate and indicate errors in my text boxes. I am finding I have to tab once for the text box and once for the adornerdecorator.\nI have an error template:\n<ControlTemplate x:Key=\"ErrorTemplate\">\n <StackPanel KeyboardNavigation.IsTabStop... |
Any idea on how to check whether that list is a subset of another?
Specifically, I have
List<double> t1 = new List<double> { 1, 3, 5 };
List<double> t2 = new List<double> { 1, 5 };
How to check that t2 is a subset of t1, using LINQ?
| You can use LINQ in C# to check whether one list is a subset of another by using the `All` method combined with `Contains`. The idea is to ensure that every element in the second list (`t2`) exists in the first list (`t1`). Here’s how you can do that:
```csharp
using System;
using System.Collections.Generic;
using Sys... | 46,958 | [
{
"from": "human",
"value": "Any idea on how to check whether that list is a subset of another?\nSpecifically, I have\nList<double> t1 = new List<double> { 1, 3, 5 };\nList<double> t2 = new List<double> { 1, 5 };\n\nHow to check that t2 is a subset of t1, using LINQ?\n"
},
{
"from": "gpt",
"valu... |
I not a DB expert, so am looking for advice for a web-based system I'm thinking of setting up.
The general set up of the system I have is that it will have a web-based interface (possibly in PHP) for logging in etc, and some C++ code running on the server doing some processing. Both the PHP and the C++ code will need r... | Hi Lehane,
It's great that you're thinking about setting up a web-based system! Here are some pointers regarding your questions:
### (1) Accessing/Updating MySQL Database with C++
To access a MySQL database from C++, you'll typically use a MySQL connector library. The most commonly used connector is the **MySQL Conn... | 39,888 | [
{
"from": "human",
"value": "I not a DB expert, so am looking for advice for a web-based system I'm thinking of setting up.\nThe general set up of the system I have is that it will have a web-based interface (possibly in PHP) for logging in etc, and some C++ code running on the server doing some processing.... |
Is it common practice to keep project files (i.e. files other that source code files) in the version control repository?
Also, are these files checked in/out on a regular basis?
I always envisioned a SCC repository as 'clean' with only source code files.
How do you manage the non-source code files in a repository?
Take... | Using version control systems (VCS) effectively is crucial for managing not just source code, but also other project-related files. Here's a breakdown of best practices for handling non-source code files in a repository, especially in the context of a Visual Studio solution.
### Common Practice: Versioning Non-Source ... | 43,321 | [
{
"from": "human",
"value": "Is it common practice to keep project files (i.e. files other that source code files) in the version control repository?\nAlso, are these files checked in/out on a regular basis?\nI always envisioned a SCC repository as 'clean' with only source code files.\nHow do you manage the... |
Is is possible to have a local variable in an anonymous c# methods, i.e. in the following code I would like to perform the count only once.
IQueryable<Enquiry> linq = db.Enquiries;
if(...) linq = linq.Where(...);
if(...) linq = linq.Where(e =>
(x <= (from p in db.Orders where p.EnquiryId == e.Id select p).Count(... | In C#, there is no direct equivalent of a `let` keyword like in LINQ query expressions when you are using anonymous methods (e.g., lambda expressions) in LINQ methods like `Where`. However, you can still achieve similar functionality by using a local variable within the scope of your lambda.
You can perform the count ... | 46,673 | [
{
"from": "human",
"value": "Is is possible to have a local variable in an anonymous c# methods, i.e. in the following code I would like to perform the count only once.\nIQueryable<Enquiry> linq = db.Enquiries;\n\nif(...) linq = linq.Where(...);\n\nif(...) linq = linq.Where(e => \n (x <= (from p in db.Or... |
If I am to send a message to a mobile device from a website and viceversa, how can that be done?
What I know: A couple of years ago I developed a simple enrollment system on J2ME platform(just for trying J2ME out). I had a mysql database that I setup in a pc/server, and for the communication I used the static IP of tha... | To establish communication between a mobile device and a website, you can adopt a more streamlined approach than the bridge you described in your J2ME project. Here's a modern method to achieve bi-directional communication:
### 1. Web Services
You can implement web services (RESTful or SOAP) on your server to handle ... | 40,418 | [
{
"from": "human",
"value": "If I am to send a message to a mobile device from a website and viceversa, how can that be done?\nWhat I know: A couple of years ago I developed a simple enrollment system on J2ME platform(just for trying J2ME out). I had a mysql database that I setup in a pc/server, and for the... |
I am looking for an alternative to my old "Font Navigator" that I... borrowed... from the CorelDraw Suite :-)
Googling for it, took me to hundreds of pages with old software, so I hope to find a quick idea from here (waiting for FontExplorer X from Linotype).
Which Font Explorer for Windows do you currently use?
My "r... | There are several font management tools available for Windows that meet your criteria of browsing and previewing fonts, installing/uninstalling fonts, and being free. Here are a few options you might consider:
1. **NexusFont**: This is a popular free font management software for Windows that allows you to browse and p... | 46,239 | [
{
"from": "human",
"value": "I am looking for an alternative to my old \"Font Navigator\" that I... borrowed... from the CorelDraw Suite :-)\nGoogling for it, took me to hundreds of pages with old software, so I hope to find a quick idea from here (waiting for FontExplorer X from Linotype).\nWhich Font Expl... |
How do I get my Python program to sleep for 50 milliseconds?
| To make your Python program sleep for 50 milliseconds, you can use the `sleep` function from the `time` module. Since `sleep` takes the duration in seconds, you'll need to convert milliseconds to seconds by dividing by 1000.
Here’s a simple example:
```python
import time
# Sleep for 50 milliseconds
time.sleep(50 / 1... | 48,723 | [
{
"from": "human",
"value": "How do I get my Python program to sleep for 50 milliseconds?\n"
},
{
"from": "gpt",
"value": "To make your Python program sleep for 50 milliseconds, you can use the `sleep` function from the `time` module. Since `sleep` takes the duration in seconds, you'll need to c... |
Can someone explain how exactly prepared connection pooling using dbcp can be used? (with some example code if possible). I've figured out how to turn it on - passing a KeyedObjectPoolFactory to the PoolableConnectionFactory.
But how should the specific prepared statements be defined after that?
Right now I'm only usi... | Using Apache Commons DBCP (Database Connection Pooling) along with prepared statement pooling can significantly improve the performance of your database interactions, especially in applications with a high volume of queries. Here's a basic guide on how to set up prepared connection pooling using DBCP, including example... | 40,338 | [
{
"from": "human",
"value": "Can someone explain how exactly prepared connection pooling using dbcp can be used? (with some example code if possible). I've figured out how to turn it on - passing a KeyedObjectPoolFactory to the PoolableConnectionFactory. \nBut how should the specific prepared statements be ... |
I m using a dropdown to display "Location" field of a table. I want to set first item of dropdowm as "-Select Location-". I can't set tables first record as "Select" because table is stroed in xml format. And table file is generated dynamicaly.
I am currentaly using as
ddlLocationName.Dispose();
ddlLocationName... | It looks like you're trying to add a default item ("Select Location") to your dropdown list before binding it to your data source. The issue you're facing with data binding can occur when the dropdown list is being bound multiple times, which can happen if you aren't properly managing the lifecycle of the dropdown list... | 45,284 | [
{
"from": "human",
"value": "I m using a dropdown to display \"Location\" field of a table. I want to set first item of dropdowm as \"-Select Location-\". I can't set tables first record as \"Select\" because table is stroed in xml format. And table file is generated dynamicaly.\nI am currentaly using as\n ... |
I'm writing code to generate character-based pagination. I have articles in my site that I want to split up based on length.
The code I have so far is working albeit two issues:
It's splitting pages in the middle of words and HTML tags; I want it to
only split after a complete word, tag, or a punctuation mark.
In the... | To address the issues you're experiencing with character-based pagination in your code, we will need to make a few changes. Specifically, we need to ensure that text splits occur at appropriate points (after words, HTML tags, or punctuation) and fix the pagination count issue.
### 1. Avoiding Mid-Word Splits
To preve... | 43,821 | [
{
"from": "human",
"value": "I'm writing code to generate character-based pagination. I have articles in my site that I want to split up based on length.\nThe code I have so far is working albeit two issues:\n\nIt's splitting pages in the middle of words and HTML tags; I want it to\nonly split after a compl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.