instruction stringlengths 14 27.6k | completion stringlengths 3 38.3k | __original_row_idx int64 0 50k | conversations listlengths 2 2 |
|---|---|---|---|
I've been working on figuring out how to receive HTTP Headers via a request made with NSURLConnection. Typically a request is made with something as simple as the following:
NSURLConnection *connection = [[NSURLConnection alloc]
initWithRequest:request
delegate:self];
The only way I've personally found... | Yes, you can definitely retrieve HTTP response headers using the asynchronous approach with `NSURLConnection`. The key is to implement the appropriate delegate methods provided by `NSURLConnection`.
When you create a `NSURLConnection` with a delegate, you can use the `connection:didReceiveResponse:` delegate method to... | 35,418 | [
{
"from": "human",
"value": "I've been working on figuring out how to receive HTTP Headers via a request made with NSURLConnection. Typically a request is made with something as simple as the following:\n NSURLConnection *connection = [[NSURLConnection alloc]\n initWithRequest:request\n delegat... |
Given my current .htaccess file, how would I modify it to check for an additional URL path like '/src/pub/' and rewrite it to '/' without affecting the current rewrite?
Here's the original .htaccess file:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index... | To achieve the desired URL rewriting from `/src/pub/` to `/` without affecting your existing rules, you'll need to adjust the `RewriteRule` that you created. Specifically, you should avoid using a leading slash in your `RewriteRule`, and also ensure that the new rule is placed before the existing rewrite rules so that ... | 35,855 | [
{
"from": "human",
"value": "Given my current .htaccess file, how would I modify it to check for an additional URL path like '/src/pub/' and rewrite it to '/' without affecting the current rewrite?\nHere's the original .htaccess file:\nRewriteEngine on\n\nRewriteCond %{REQUEST_FILENAME} !-f\nRewriteCond %{R... |
I need recommendations on what to use in Delphi (I use Delphi 2009) to handle very large XML files (e.g. 100 MB) as fast as possible.
I need to input the XML, access and update the data in it from my program, and then export the modified XML again.
Hopefully the input and output could be done within a few seconds on a... | When handling very large XML files in Delphi (especially with Delphi 2009), using the Document Object Model (DOM) is a common approach, but it may not always be the most efficient way to handle massive files due to high memory usage and slow parsing speeds. Since you require fast in-memory access and updates, here's a ... | 36,688 | [
{
"from": "human",
"value": "I need recommendations on what to use in Delphi (I use Delphi 2009) to handle very large XML files (e.g. 100 MB) as fast as possible. \nI need to input the XML, access and update the data in it from my program, and then export the modified XML again.\nHopefully the input and out... |
I am using the following generic code to save entities.
using (ITransaction tx = session.BeginTransaction())
{
try
{
entity.DateModified = DateTime.Now;
session.SaveOrUpdate(entity);
session.Flush();
tx.Commit();
return entity;
}
catch (Exception)
{
tx.Rollb... | The behavior you're observing can be attributed to how NHibernate manages transactions, particularly when using the `ITransaction` interface. Here's what happens:
1. **Automatic Transaction Management**: If you are using NHibernate in conjunction with certain configurations (like automatic transaction management), it ... | 37,061 | [
{
"from": "human",
"value": "I am using the following generic code to save entities.\nusing (ITransaction tx = session.BeginTransaction())\n{\n try\n {\n entity.DateModified = DateTime.Now;\n session.SaveOrUpdate(entity);\n session.Flush();\n tx.Commit();\n return entity;... |
We're getting new servers. Trying to figure out the AMD vs Intel holy war. Is there anywhere to find unbiased performance comparisons of these two processor families? Should I quit worrying about this and file it into the "it doesn't matter" category.
| The AMD vs. Intel debate has been ongoing for years, with both companies offering competitive processors for various applications. When evaluating which processor family to choose for your new servers, there are several factors to consider:
### 1. **Use Case**:
- **Workload Types**: Different workloads (e.g., virtu... | 38,511 | [
{
"from": "human",
"value": "We're getting new servers. Trying to figure out the AMD vs Intel holy war. Is there anywhere to find unbiased performance comparisons of these two processor families? Should I quit worrying about this and file it into the \"it doesn't matter\" category.\n"
},
{
"from": "... |
I use SourceGear Vault and applyLabel="true" for a project so when it builds it will create a label in SourceGear Vault for the corresponding project.My questions are
I have a nightly builds so what if i don't have any changes made to that project for that day then how do I define my settings....
<sourcecontrol type="... | To achieve the desired behavior of applying labels only when there are changes to your project in SourceGear Vault during your nightly builds, you can incorporate a couple of strategies to check for changes before applying the label.
Here are some options you could consider:
### Option 1: Use a Pre-build Script
1. *... | 35,166 | [
{
"from": "human",
"value": "I use SourceGear Vault and applyLabel=\"true\" for a project so when it builds it will create a label in SourceGear Vault for the corresponding project.My questions are\nI have a nightly builds so what if i don't have any changes made to that project for that day then how do I d... |
Is there a way to get all methods (private, privileged, or public) of a javascript object from within? Here's the sample object:
var Test = function() {
// private methods
function testOne() {}
function testTwo() {}
function testThree() {}
// public methods
function getMethods() {
for (i in this) ... | In JavaScript, especially in the context of closures and function scopes, it's not possible to retrieve the names of private variables or private methods from within the same scope. This is due to how JavaScript manages variable scoping; private variables and functions are not properties of the object but are instead p... | 36,659 | [
{
"from": "human",
"value": "Is there a way to get all methods (private, privileged, or public) of a javascript object from within? Here's the sample object:\nvar Test = function() {\n// private methods\n function testOne() {}\n function testTwo() {}\n function testThree() {}\n// public methods\n ... |
I have some code like this:
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Save([Bind(Prefix="")]Person person)
{
String s = person.property;
/* ... */
}
But it throws the error: "Cannot use local variable 'person' before it is declared".
What simple thing am I missing?
| The error message "Cannot use local variable 'person' before it is declared" suggests that there might be an issue with how the `person` variable is being accessed in the `Save` method. However, your declaration of the `person` parameter appears to be correct.
One possible explanation for this issue is that you might ... | 37,460 | [
{
"from": "human",
"value": "I have some code like this:\n[AcceptVerbs(HttpVerbs.Post)]\npublic ActionResult Save([Bind(Prefix=\"\")]Person person)\n{\n String s = person.property;\n /* ... */\n}\n\nBut it throws the error: \"Cannot use local variable 'person' before it is declared\".\nWhat simple thi... |
Does anyone have recommendations/experience of how to find people willing to do usability testing of web based apps? I suspect I may need people who might actually be potential users, because mine is a commercial/vertical app which contains some processes and terminology which may not mean much to the average joe/jane... | Finding the right participants for usability testing, especially for a specialized application like yours, can be challenging but there are several strategies you can use to recruit potential users who fit your target audience. Here are some recommendations:
1. **Professional Networks:**
- **LinkedIn:** Utilize Lin... | 34,475 | [
{
"from": "human",
"value": "Does anyone have recommendations/experience of how to find people willing to do usability testing of web based apps? I suspect I may need people who might actually be potential users, because mine is a commercial/vertical app which contains some processes and terminology which ... |
Does anyone know how I can disable the System Context Menu when a user right clicks in a DataGridViewTextBoxCell? I have tried to override the WndProc at the DataGridView level (as there is no WndProc to override on the Cell level), but nothing seems to work. Any help would be greatly appreciated.
The following is w... | To disable the system context menu when a user right-clicks in a `DataGridViewTextBoxCell`, you will need to override the `WndProc` method in a custom `DataGridView` class. When a user right-clicks inside the cell, the `DataGridView` processes the context menu message, and you can intercept this message to prevent the ... | 34,677 | [
{
"from": "human",
"value": "Does anyone know how I can disable the System Context Menu when a user right clicks in a DataGridViewTextBoxCell? I have tried to override the WndProc at the DataGridView level (as there is no WndProc to override on the Cell level), but nothing seems to work. Any help would b... |
Inside my code I'm generating hashes of URLs, (which are practically of unbounded length). I'm currently using sha1(), which I know has a tiny chance of a collision, but I have up to 255 bytes to store the hash in so feel that I might as well use that available space to lower the chance of collision even further.
Is t... | Using SHA-1 for hashing URLs can work for many applications, but it does come with a few caveats regarding security and collision resistance. If you're dealing with unbounded-length inputs, you might want to consider alternatives for a lower chance of collisions, especially if you're storing a significant number of uni... | 38,422 | [
{
"from": "human",
"value": "Inside my code I'm generating hashes of URLs, (which are practically of unbounded length). I'm currently using sha1(), which I know has a tiny chance of a collision, but I have up to 255 bytes to store the hash in so feel that I might as well use that available space to lower t... |
I'm working on a GUI application in WxPython, and I am not sure how I can ensure that only one copy of my application is running at any given time on the machine. Due to the nature of the application, running more than once doesn't make any sense, and will fail quickly. Under Win32, I can simply make a named mutex and ... | To ensure that only one instance of your wxPython application is running on a Linux system, you can use a combination of a lock file and file locking. This way, the lock file will automatically be released if your application crashes. Here's how you can implement this:
1. **Create a lock file**: When your application ... | 36,080 | [
{
"from": "human",
"value": "I'm working on a GUI application in WxPython, and I am not sure how I can ensure that only one copy of my application is running at any given time on the machine. Due to the nature of the application, running more than once doesn't make any sense, and will fail quickly. Under Wi... |
How do I check that I have an open network connection and can contact a specific ip address in c#? I have seen example in VB.Net but they all use the 'My' structure.
Thank you.
| To check if you have an open network connection and can contact a specific IP address in C#, you can use the `Ping` class from the `System.Net.NetworkInformation` namespace. This allows you to send an Internet Control Message Protocol (ICMP) echo request to the specified IP address and receive a reply if the host is re... | 36,755 | [
{
"from": "human",
"value": "How do I check that I have an open network connection and can contact a specific ip address in c#? I have seen example in VB.Net but they all use the 'My' structure.\nThank you.\n"
},
{
"from": "gpt",
"value": "To check if you have an open network connection and can... |
Is there an HTML editor which automatically changes the end tag when you edit the start tag?
| Yes, many modern HTML editors and Integrated Development Environments (IDEs) feature functionality that allows for automatic synchronization of start and end tags when editing HTML. Here are a few popular options that offer this functionality:
1. **Visual Studio Code**: With the right extensions (like HTML Snippets or... | 39,997 | [
{
"from": "human",
"value": "Is there an HTML editor which automatically changes the end tag when you edit the start tag?\n"
},
{
"from": "gpt",
"value": "Yes, many modern HTML editors and Integrated Development Environments (IDEs) feature functionality that allows for automatic synchronization ... |
I have a somewhat complex WPF application which seems to be 'hanging' or getting stuck in a Wait call when trying to use the dispatcher to invoke a call on the UI thread.
The general process is:
Handle the click event on a button
Create a new thread (STA) which: creates a new instance of the presenter and UI, then cal... | It seems that you've made progress towards a solution by calling `System.Windows.Threading.Dispatcher.Run()` at the end of your thread delegate. This is indeed a necessary step when using a new thread to create a WPF UI component, as it sets up the message loop required for the Dispatcher to function properly.
To prov... | 37,522 | [
{
"from": "human",
"value": "I have a somewhat complex WPF application which seems to be 'hanging' or getting stuck in a Wait call when trying to use the dispatcher to invoke a call on the UI thread.\nThe general process is:\n\nHandle the click event on a button\nCreate a new thread (STA) which: creates a n... |
in a web application I am building I need to upload photos without using a form, otherwise it will come up with form embedded in an outer from which is not permitted in XHTML.
I think uploading files is what jQuery.post should be able to do, but I currently can't figure out how to do this using jQuery.
| To upload photos without using a traditional form, you can use AJAX to send the file data to your server. jQuery's `$.ajax` method can be used to accomplish this. However, keep in mind that you will need to utilize the `FormData` object to properly handle file uploads, as it allows you to construct a set of key/value p... | 30,005 | [
{
"from": "human",
"value": "in a web application I am building I need to upload photos without using a form, otherwise it will come up with form embedded in an outer from which is not permitted in XHTML.\nI think uploading files is what jQuery.post should be able to do, but I currently can't figure out how... |
VS 2008 - Visual Basic .NET (C# example is fine, as I can read that as well)
I have an asp:DropDownList that is 100px wide, however some of my list items are much wider than that.
How can I expand the drop down area of the list so it shows all of the text of the list items? The control itself must stay at 100px - only ... | To achieve the desired behavior where the drop-down portion of an `asp:DropDownList` expands to fit the text of its items while keeping the control itself fixed at 100 pixels wide, you will need to employ some CSS and possibly JavaScript.
Unfortunately, the default ASP.NET `DropDownList` does not support this behavior... | 32,961 | [
{
"from": "human",
"value": "VS 2008 - Visual Basic .NET (C# example is fine, as I can read that as well)\nI have an asp:DropDownList that is 100px wide, however some of my list items are much wider than that.\nHow can I expand the drop down area of the list so it shows all of the text of the list items? Th... |
I have an XML schema that represents a product in a DB, and I am trying to figure out the best way to store the product image references as XML nodes. There will be a primary image, and then alternate images, each of them with sequences (display order). Would this be an appropriate format, or are there better approache... | Your XML schema is a good start for representing product images, but you are correct in considering how to structure it to accommodate multiple sizes (thumbnail, medium, large) for each image.
To handle this, you might want to nest the image sizes under each image node, allowing for a clearer representation of differ... | 32,899 | [
{
"from": "human",
"value": "I have an XML schema that represents a product in a DB, and I am trying to figure out the best way to store the product image references as XML nodes. There will be a primary image, and then alternate images, each of them with sequences (display order). Would this be an appropri... |
I have a web application project (wap) that is successfully being deployed to a development server by our tfsbuild server.
I'd like the build server to run our collection of webtests after deployment.
What is a best practice (or ANY practice) for doing this?
| Running web tests after deploying a web application is a good practice to ensure that your deployment has not introduced any issues. Here are some best practices and steps you can follow to run your web tests after deployment using TFS Build:
### 1. **Set Up Web Tests**
Ensure that you have your web tests created a... | 34,064 | [
{
"from": "human",
"value": "I have a web application project (wap) that is successfully being deployed to a development server by our tfsbuild server.\nI'd like the build server to run our collection of webtests after deployment.\nWhat is a best practice (or ANY practice) for doing this?\n"
},
{
"f... |
This is a simplification of the issue (there are lots of ways of doing things), but among applications that need to talk to a database I have usually seen one of two patterns:
Object-Relational Mapping (ORM), where (usually) each table in the database has a corresponding "row wrapper" class with public properties that... | The choice between Object-Relational Mapping (ORM) and DataTables/DataSets often depends on the specific requirements of the application, the development team’s expertise, and the context in which the data will be used. Here are some factors to consider for both approaches:
### Advantages of ORM:
1. **Strong Typing a... | 35,364 | [
{
"from": "human",
"value": "This is a simplification of the issue (there are lots of ways of doing things), but among applications that need to talk to a database I have usually seen one of two patterns:\n\nObject-Relational Mapping (ORM), where (usually) each table in the database has a corresponding \"ro... |
In MSSQL, when I want to ignore an empty filter parameter, I do the following
SELECT * FROM Table WHERE EmployeeName = ISNULL(@EmployeeName, EmployeeName);
How would I achieve this in MySQL?
| In MySQL, you can achieve similar functionality by using the `COALESCE` function or by directly checking the parameter in your WHERE clause. Here’s how you can do it:
### Using COALESCE
You can use the `COALESCE` function to return either the parameter value or the column value. The SQL query would look like this:
``... | 39,185 | [
{
"from": "human",
"value": "In MSSQL, when I want to ignore an empty filter parameter, I do the following\nSELECT * FROM Table WHERE EmployeeName = ISNULL(@EmployeeName, EmployeeName);\n\nHow would I achieve this in MySQL?\n"
},
{
"from": "gpt",
"value": "In MySQL, you can achieve similar funct... |
I am doing 2^1000 and I am getting this:
1.07151e+301
Is there any way to actually turn this into a proper number without the e+301, or at least can anyone show me where I can see how to turn this in to a real number, by some way working with the e+301 part?
| The notation \(1.07151e+301\) is a scientific notation, where \(e\) stands for "exponent" and represents powers of 10. The expression \(1.07151e+301\) means \(1.07151 \times 10^{301}\).
To convert it into a more "proper" number, you can do the following:
1. **Recognize the meaning of the exponent**: The \(e+301\) mea... | 36,488 | [
{
"from": "human",
"value": "I am doing 2^1000 and I am getting this:\n1.07151e+301\nIs there any way to actually turn this into a proper number without the e+301, or at least can anyone show me where I can see how to turn this in to a real number, by some way working with the e+301 part?\n"
},
{
"f... |
I want to see how long a function takes to run. What's the easiest way to do this in PLT-Scheme? Ideally I'd want to be able to do something like this:
> (define (loopy times)
(if (zero? times)
0
(loopy (sub1 times))))
> (loopy 5000000)
0 ;(after about a second)
> (timed (loopy 50000... | In PLT Scheme (now known as Racket), you can achieve the desired timing functionality using the `current-inexact-milliseconds` function to measure the time before and after running your function. Here’s how you can define a `timed` function to wrap around your `loopy` function:
```scheme
#lang racket
(define (loopy t... | 36,346 | [
{
"from": "human",
"value": "I want to see how long a function takes to run. What's the easiest way to do this in PLT-Scheme? Ideally I'd want to be able to do something like this:\n> (define (loopy times)\n (if (zero? times)\n 0\n (loopy (sub1 times)))) \n> (loopy 5000000)\n0 ... |
How can I solve the problem of soft hyphens on my web pages? In text, there can be long words which I might want to line break with a hyphen, but I do not want the hyphen to show if the whole word is on the same line. I have heard of ­ and of <wbr>.
According to comments on this page <wbr> is a non-standard "tag so... | Using soft hyphens effectively on web pages can be a bit tricky, especially when considering cross-browser compatibility and standards compliance. Here are a few approaches you can use to handle long words without displaying hyphens when they are not needed.
### Using `­` (Soft Hyphen)
The most common method for ... | 34,274 | [
{
"from": "human",
"value": "How can I solve the problem of soft hyphens on my web pages? In text, there can be long words which I might want to line break with a hyphen, but I do not want the hyphen to show if the whole word is on the same line. I have heard of ­ and of <wbr>.\nAccording to comments on... |
I'm mostly a .Net person at the moment, but I've been playing with Java some lately-- exploring what's out there.
Now I'm looking for the Java equivalent for WPF. I know I could find an OpenGL library or two out there, but that's not really as rich or simple as the WPF system.
| If you're looking for a Java equivalent to WPF (Windows Presentation Foundation), which provides a rich set of features for building desktop applications with a focus on UI design, there are several frameworks and libraries to consider:
1. **JavaFX**: This is the most direct equivalent to WPF in the Java ecosystem. Ja... | 34,644 | [
{
"from": "human",
"value": "I'm mostly a .Net person at the moment, but I've been playing with Java some lately-- exploring what's out there.\nNow I'm looking for the Java equivalent for WPF. I know I could find an OpenGL library or two out there, but that's not really as rich or simple as the WPF system.... |
I would like to make my application somewhat REST compliant. I am using Rails on the backend and GWT on the frontend. I would like to do updates and deletes. I realize I can do something like mydomain.com/:id/delete (GET) and accomplish the same thing. However, as I stated previously, I would like to have a REST co... | To achieve REST compliance while using GWT (Google Web Toolkit) and Rails, you want to ensure that your application can correctly handle DELETE and other HTTP verbs like PUT and PATCH, especially since not all browsers or HTTP clients support these methods natively.
### Rails Side Configuration
In your Rails applicat... | 36,514 | [
{
"from": "human",
"value": "I would like to make my application somewhat REST compliant. I am using Rails on the backend and GWT on the frontend. I would like to do updates and deletes. I realize I can do something like mydomain.com/:id/delete (GET) and accomplish the same thing. However, as I stated p... |
ASP.NET 3.5 SP1 adds a great new ScriptCombining feature to the ScriptManager object as demonstrated on this video. However he only demonstrates how to use the feature with the ScriptManager on the same page. I'd like to use this feature on a site where the scriptmanager is on the master page but can't figure out how t... | Certainly! Using the ScriptCombining feature in ASP.NET 3.5 SP1 with a `ScriptManager` on a master page requires a slight adjustment in how you add scripts to the `ScriptManager` from the content pages. Here’s a basic approach to help you get started.
### Steps to Add Scripts to a ScriptManager on a Master Page
1. **... | 34,153 | [
{
"from": "human",
"value": "ASP.NET 3.5 SP1 adds a great new ScriptCombining feature to the ScriptManager object as demonstrated on this video. However he only demonstrates how to use the feature with the ScriptManager on the same page. I'd like to use this feature on a site where the scriptmanager is on t... |
I'm trying to write a vba macro for a group tha
has one workbook where they daily create new worksheets, and also have
Sheet 1, Sheet 2 and Sheet 3 at the end of their long list of sheets.
I need to create a external cell reference in a new column in a different workbook where this information is being summarized.
S... | To create a VBA macro that finds the last non-empty worksheet in a workbook, and then uses that to create an external reference in a summary workbook, follow the steps below.
### Step 1: Define Your Workbooks
Assuming you have two workbooks:
- **Source Workbook**: where daily worksheets are created
- **Summary Workbo... | 34,966 | [
{
"from": "human",
"value": "I'm trying to write a vba macro for a group tha\n\nhas one workbook where they daily create new worksheets, and also have\nSheet 1, Sheet 2 and Sheet 3 at the end of their long list of sheets. \n\nI need to create a external cell reference in a new column in a different workbook... |
A page executes a number of tasks and takes a long time to process. We want to give the user feedback as each task is completed.
In ASP.NET webforms we used Response.Flush()
What way would you a approach this in ASP.NET MVC?
| In ASP.NET MVC, providing feedback to users during a long-running process can be achieved using a couple of different approaches, since traditional `Response.Flush()` from ASP.NET Web Forms doesn't directly apply. Here are some recommended strategies for achieving a similar effect:
### 1. **Using SignalR for Real-Time... | 23,283 | [
{
"from": "human",
"value": "A page executes a number of tasks and takes a long time to process. We want to give the user feedback as each task is completed. \nIn ASP.NET webforms we used Response.Flush()\nWhat way would you a approach this in ASP.NET MVC?\n"
},
{
"from": "gpt",
"value": "In ASP... |
So, we're building a multi-tenant system to run as a service. We're starting from the ground up. We're following DDD; the domain has (at the moment) ~20 entities in it, and later there will be more. It is to be hosted by us, geographically redundant (n+1 of everything except SQL queries ;-) ), and of flexible desig... | Building a multi-tenant system with extensible entities and support for multiple languages is certainly a complex task, especially when adhering to Domain-Driven Design (DDD) principles. Below, I'll outline a strategy that should help guide your implementation in .NET.
### High-Level Architecture
1. **Domain Model De... | 24,314 | [
{
"from": "human",
"value": "So, we're building a multi-tenant system to run as a service. We're starting from the ground up. We're following DDD; the domain has (at the moment) ~20 entities in it, and later there will be more. It is to be hosted by us, geographically redundant (n+1 of everything except ... |
I'm in the process of creating a class that stores metadata about a particular data source. The metadata is structured in a tree, very similar to how XML is structured. The metadata values can be integer, decimal, or string values.
I'm curious if there is a good way in C++ to store variant data for a situation like t... | A better approach for your use case would be to leverage C++'s `std::variant`, which is part of the C++17 standard library. This provides a type-safe union that can hold multiple types without the need for manual type checking and conversions, which improves the readability of your code and eliminates the need for the ... | 34,197 | [
{
"from": "human",
"value": "I'm in the process of creating a class that stores metadata about a particular data source. The metadata is structured in a tree, very similar to how XML is structured. The metadata values can be integer, decimal, or string values.\nI'm curious if there is a good way in C++ to... |
I am trying to build a generic form submission system using ASP.NET MVC. I'd like to make it as easy as possible to create forms with a form view and a "success" view. Using the WebForms method, this was easy and could be accomplished with templates or multiviews. With MVC, I'm a bit stuck.
Here's what I'd like to emul... | Creating a generic form submission system in ASP.NET MVC can indeed be challenging, especially when you want it to handle both standard form submission and Ajax requests. Below, I'll guide you through creating a reusable form component using Partial Views, ViewModels, and custom HTML Helpers. This will help you achieve... | 32,353 | [
{
"from": "human",
"value": "I am trying to build a generic form submission system using ASP.NET MVC. I'd like to make it as easy as possible to create forms with a form view and a \"success\" view. Using the WebForms method, this was easy and could be accomplished with templates or multiviews. With MVC, I'... |
I have a number of generated .sql files that I want to run in succession. I'd like to run them from a SQL statement in a query (i.e. Query Analyzer/Server Management Studio).
Is it possible to do something like this and if so what is the syntax for doing this?
I'm hoping for something like:
exec 'c:\temp\file01.sql'
... | In SQL Server, you can't directly execute a `.sql` file from a SQL statement like you would with an `EXEC` command. However, you can achieve your goal by using the `sqlcmd` utility or a SQL Server Agent job. Since you're using SQL Server Management Studio, here are a couple of alternatives you can use:
### Option 1: U... | 31,542 | [
{
"from": "human",
"value": "I have a number of generated .sql files that I want to run in succession. I'd like to run them from a SQL statement in a query (i.e. Query Analyzer/Server Management Studio).\nIs it possible to do something like this and if so what is the syntax for doing this?\nI'm hoping for ... |
I've never liked wrapping the
mysql_real_escape_string
function around input I expect to be integer for inclusion in a MySQL query.
Recently I came across the
filter_var
function. Nice!
I'm currently using the code:
if (isset($idUserIN)
&& filter_var($idUserIN, FILTER_VALIDATE_INT)
&& 0 < filter_var($id... | Your code snippet is on the right track for validating and sanitizing input intended to be used in a MySQL query. However, there are a few considerations and potential improvements to make it more secure and robust.
1. **Use Prepared Statements**: The best way to prevent SQL injection attacks is to use prepared state... | 37,451 | [
{
"from": "human",
"value": "I've never liked wrapping the \nmysql_real_escape_string \n\nfunction around input I expect to be integer for inclusion in a MySQL query.\nRecently I came across the \nfilter_var \n\nfunction. Nice!\nI'm currently using the code:\nif (isset($idUserIN) \n && filter_var($idUser... |
I have recently been web-researching quantum computing.
Will we see these in our lifetimes (ever?) (The error correction issue, for example, seems intractable to me).
| Quantum computing is a rapidly evolving field, and while there are still significant challenges to overcome, including error correction and qubit stability, many experts believe that we will see practical applications of quantum computing within our lifetimes.
1. **Error Correction**: You're right that quantum error c... | 39,881 | [
{
"from": "human",
"value": "I have recently been web-researching quantum computing. \nWill we see these in our lifetimes (ever?) (The error correction issue, for example, seems intractable to me).\n"
},
{
"from": "gpt",
"value": "Quantum computing is a rapidly evolving field, and while there ar... |
Can I integrate my exsisting C++ library in an iPhone application?
| Yes, you can integrate an existing C++ library into an iPhone application. However, there are some steps and considerations you need to follow. Here’s a general outline of how to do this:
### Steps to Integrate a C++ Library into an iPhone Application
1. **Create an Objective-C++ Wrapper:**
- Since Swift and Objec... | 35,492 | [
{
"from": "human",
"value": "Can I integrate my exsisting C++ library in an iPhone application?\n"
},
{
"from": "gpt",
"value": "Yes, you can integrate an existing C++ library into an iPhone application. However, there are some steps and considerations you need to follow. Here’s a general outlin... |
This is one of the minor CSS problems that plague me constantly.
How do folks around Stack Overflow vertically align checkboxes and their labels consistently cross-browser?
Whenever I align them correctly in Safari (usually using vertical-align: baseline on the input), they're completely off in Firefox and IE.
Fix it i... | Vertically aligning checkboxes with their labels can indeed be a bit tricky due to differences in rendering across browsers. Below, I'll provide a solution that should work consistently across major browsers like Chrome, Firefox, Safari, and Edge.
### HTML Structure
Your HTML is fine as it is. Just ensure the structur... | 37,866 | [
{
"from": "human",
"value": "This is one of the minor CSS problems that plague me constantly.\nHow do folks around Stack Overflow vertically align checkboxes and their labels consistently cross-browser?\nWhenever I align them correctly in Safari (usually using vertical-align: baseline on the input), they're... |
How would you describe the running time of this sort, given a function sorted which returns True if the list is sorted that runs in O(n):
def sort(l):
while not sorted(l): random.shuffle(l)
Assume shuffling is perfectly random.
Would this be written in big-O notation? Or is there some other way of categorizing al... | The algorithm you provided is a form of a **randomized sort** known as **Bogosort** or **stochastic sort**. It repeatedly shuffles the list until it is sorted.
To analyze the running time, let's break down the behavior of this algorithm:
1. The `sorted(l)` function checks if the list is sorted and runs in \( O(n) \) ... | 37,482 | [
{
"from": "human",
"value": "How would you describe the running time of this sort, given a function sorted which returns True if the list is sorted that runs in O(n):\ndef sort(l):\n while not sorted(l): random.shuffle(l)\n\nAssume shuffling is perfectly random. \nWould this be written in big-O notation?... |
Is there a way to hide private data members of a C++ class away from its users, in the cpp file? I think of the private members as part of the implementation and it seems a little backwards to declare them in the header file.
| In C++, you can indeed hide the implementation details, including private data members, from users of a class by using the Pimpl idiom (Pointer to Implementation). This approach allows you to define the private members in a `.cpp` file instead of in the header file, which helps in encapsulating the implementation detai... | 30,316 | [
{
"from": "human",
"value": "Is there a way to hide private data members of a C++ class away from its users, in the cpp file? I think of the private members as part of the implementation and it seems a little backwards to declare them in the header file.\n"
},
{
"from": "gpt",
"value": "In C++,... |
I have a .net 3.5 application running on windows mobile professional that uses sql server ce 3.5 and merge replication with sql server 2005 sp2, it not yet a 1.0 product. Every couple of minutes or so it starts a merge replication using a timer control. I suppose down the line I'll have to have some kind of push sena... | In Windows Mobile, when a device goes into standby, it generally suspends all running applications, including your .NET application. Unfortunately, there’s no straightforward way to prevent a Windows Mobile device from going into standby while still allowing the app to keep running. However, you can try the following a... | 36,671 | [
{
"from": "human",
"value": "I have a .net 3.5 application running on windows mobile professional that uses sql server ce 3.5 and merge replication with sql server 2005 sp2, it not yet a 1.0 product. Every couple of minutes or so it starts a merge replication using a timer control. I suppose down the line... |
When using TFS with a tool outside of Visual Studio (Specifially ORMS), modifications to the project file to include a new file will not cause the file to be added to source control.
Does anything exist that could potentially say "Warning: You are about to check in change to a project file which include a file which is... | In Team Foundation Server (TFS), there isn't a built-in mechanism that directly warns you about unversioned files that are being added to a project file. However, there are a few approaches and tools you can consider to help manage this situation:
1. **Manual Checks**: Before checking in changes, manually verify that ... | 39,655 | [
{
"from": "human",
"value": "When using TFS with a tool outside of Visual Studio (Specifially ORMS), modifications to the project file to include a new file will not cause the file to be added to source control.\nDoes anything exist that could potentially say \"Warning: You are about to check in change to a... |
We're writing a records management product for schools and one of the requirements is the ability to manage course schedules. I haven't looked at the code for how we deal with this (I'm on a different project at the moment), but nonetheless I started wondering how best to handle one particular part of this requirement,... | When it comes to storing multi-valued data like days of the week in a relational database, the best approach is to adhere to normalization principles, which improve data integrity and querying flexibility. Here's a more elegant and commonly used solution:
### Proposed Solution: Use a Junction Table
1. **Create a Days... | 36,088 | [
{
"from": "human",
"value": "We're writing a records management product for schools and one of the requirements is the ability to manage course schedules. I haven't looked at the code for how we deal with this (I'm on a different project at the moment), but nonetheless I started wondering how best to handle... |
To send a serial string character to the serial port. I would need to call WriteFile(handle, "A", strlen("A"), ...)
However, what if I want to specify and send a hex or binary number? For example, I want to send WriteFile(handle, 0x41, sizeOf(0x41), ...) ?
Is there a function that allow me to do this?
| In the context of Windows API and serial port communication, when you're using the `WriteFile` function to send data, you need to provide a pointer to the data you want to write. This means you cannot directly pass a hexadecimal or binary literal like `0x41` as the first argument to `WriteFile`. Instead, you need to st... | 37,473 | [
{
"from": "human",
"value": "To send a serial string character to the serial port. I would need to call WriteFile(handle, \"A\", strlen(\"A\"), ...)\nHowever, what if I want to specify and send a hex or binary number? For example, I want to send WriteFile(handle, 0x41, sizeOf(0x41), ...) ?\nIs there a fun... |
Does anyone know why this error occurs and how to resolve it?
It only seems to occur when we hit an exception.
[#|2008-11-14T14:49:12.482+0800|WARNING|sun-appserver-pe8.2|javax.enterprise.system.stream.err|_ThreadID=12;|
MQRA:MC:Warning:createConnection API used w/o username, password for Application Auth|#]
| The warning message you're seeing is indicating that an attempt was made to create a connection to a messaging system (likely a message queue) without providing the necessary credentials (username and password). This could potentially lead to security issues or authentication failures when trying to communicate with th... | 39,313 | [
{
"from": "human",
"value": "Does anyone know why this error occurs and how to resolve it?\nIt only seems to occur when we hit an exception.\n\n[#|2008-11-14T14:49:12.482+0800|WARNING|sun-appserver-pe8.2|javax.enterprise.system.stream.err|_ThreadID=12;|\n MQRA:MC:Warning:createConnection API used w/o u... |
I used setItemsCount() method to manage height of the bin in my SimpleHistogram from JFreeChart. Yet, it does something weird: when I set for example 1, it shows 1.4
Besides this method's argument is Integer, while I need double
| It sounds like you're working with JFreeChart and trying to manage the bin height in a `SimpleHistogram`. The `setItemsCount(int)` method is indeed designed to accept an integer value representing the count of bins, which can lead to confusion if you're looking for control over the height (which can be a double value).... | 36,325 | [
{
"from": "human",
"value": "I used setItemsCount() method to manage height of the bin in my SimpleHistogram from JFreeChart. Yet, it does something weird: when I set for example 1, it shows 1.4\nBesides this method's argument is Integer, while I need double\n"
},
{
"from": "gpt",
"value": "It s... |
In a program that I'm writing, I wanted to make a ConfigParser that's read only so that it can safely be used globally. I didn't realize this, but apparently the SafeConfigParser is an old-style class, thus I had to subclass it like this:
class ConstParser(SafeConfigParser, object):
"""This is a implementation of... | Your approach to subclassing `SafeConfigParser` to create a read-only configuration parser is fundamentally sound, but there are some nuances and considerations you should be aware of, especially regarding the use of old-style classes and the design of your `ConstParser`.
### Key Points:
1. **Old-style vs. New-style... | 38,061 | [
{
"from": "human",
"value": "In a program that I'm writing, I wanted to make a ConfigParser that's read only so that it can safely be used globally. I didn't realize this, but apparently the SafeConfigParser is an old-style class, thus I had to subclass it like this:\nclass ConstParser(SafeConfigParser, ob... |
By default concurrent manager jobs are run under the APPS user. Is it possible to configure it to run as another user? I'd like to be able to isolate some of my stored procedures.
| In Oracle E-Business Suite, the Concurrent Manager typically runs jobs under the APPS user account by default. However, if you want to run specific concurrent programs or stored procedures under a different user context for isolation or security reasons, you can use the following approaches:
1. **Using "Define User" i... | 38,726 | [
{
"from": "human",
"value": "By default concurrent manager jobs are run under the APPS user. Is it possible to configure it to run as another user? I'd like to be able to isolate some of my stored procedures.\n"
},
{
"from": "gpt",
"value": "In Oracle E-Business Suite, the Concurrent Manager t... |
How can you convert a byte array to a hexadecimal string and vice versa?
| To convert a byte array to a hexadecimal string and vice versa in programming, you can follow different approaches depending on the language you are using. Here are examples in Python and Java:
### In Python
1. **Convert Byte Array to Hexadecimal String:**
```python
# Function to convert byte array to hex string
def... | 37,657 | [
{
"from": "human",
"value": "How can you convert a byte array to a hexadecimal string and vice versa?\n"
},
{
"from": "gpt",
"value": "To convert a byte array to a hexadecimal string and vice versa in programming, you can follow different approaches depending on the language you are using. Here ... |
Could someone explain? I understand the basic concepts behind them but I often see them used interchangeably and I get confused.
And now that we're here, how do they differ from a regular function?
| It sounds like you might be asking about the differences between **functions**, **methods**, and potentially **callbacks** or **lambda functions**. Let's clarify these concepts and see how they differ, especially in the context of programming.
### Functions
A **function** is a reusable piece of code that performs a s... | 37,212 | [
{
"from": "human",
"value": "Could someone explain? I understand the basic concepts behind them but I often see them used interchangeably and I get confused. \nAnd now that we're here, how do they differ from a regular function?\n"
},
{
"from": "gpt",
"value": "It sounds like you might be asking... |
What is the best way to get the TAPI version and additional TAPI information with C#?
| To retrieve the Telephony Application Programming Interface (TAPI) version and additional TAPI information in C#, you can use the `TAPI3Lib` or `TAPI3` library provided by Microsoft. This library allows access to TAPI functionalities through COM interop.
Here's a step-by-step approach to getting the TAPI version and a... | 38,070 | [
{
"from": "human",
"value": "What is the best way to get the TAPI version and additional TAPI information with C#? \n"
},
{
"from": "gpt",
"value": "To retrieve the Telephony Application Programming Interface (TAPI) version and additional TAPI information in C#, you can use the `TAPI3Lib` or `TA... |
I have all the forms in one folder and all the code modules in an other folder in VB6. How do I create a better folder structure for the source files?
For example if I have twenty forms and twenty code modules, how can I create subfolders Main, Sales, and Employees and put the source files under those subfolders?
| Organizing your Visual Basic 6 (VB6) project into a well-structured folder hierarchy can greatly improve maintainability and readability. Given that you have various forms and code modules, you can create a more systematic folder structure. Here’s how you can create a better folder structure for your VB6 source files:
... | 35,805 | [
{
"from": "human",
"value": "I have all the forms in one folder and all the code modules in an other folder in VB6. How do I create a better folder structure for the source files?\nFor example if I have twenty forms and twenty code modules, how can I create subfolders Main, Sales, and Employees and put the ... |
I need to loop through all the matches in say the following string:
<a href='/Product/Show/{ProductRowID}'>{ProductName}</a>
I am looking to capture the values in the {} including them, so I want {ProductRowID} and {ProductName}
Here is my code so far:
Dim r As Regex = New Regex("{\w*}", RegexOptions.IgnoreCase)
Dim m ... | Your regex pattern is almost correct, but it could be improved for clarity and to ensure it captures the full contents within the curly braces. The current pattern `"{\w*}"` will work, but it will only match sequences of word characters (letters, digits, and underscores). It won't match the curly braces properly in the... | 38,977 | [
{
"from": "human",
"value": "I need to loop through all the matches in say the following string:\n<a href='/Product/Show/{ProductRowID}'>{ProductName}</a>\nI am looking to capture the values in the {} including them, so I want {ProductRowID} and {ProductName}\nHere is my code so far:\nDim r As Regex = New R... |
From kernel mode in Windows I'm able to intercept and monitor virtually all actions performed on a particular disk. When a file is opened for any purpose I get an event.
Now I want to trace which application that opened it. I think this should be possible but don't know how.
I'm using the standard file management funct... | To trace which application opened a file from kernel mode in Windows, you can leverage the fact that every thread has an associated process, which you can query to identify the application responsible for the file access.
Here's a high-level approach to achieve this:
### 1. Capture the IRP (I/O Request Packet)
Since... | 35,971 | [
{
"from": "human",
"value": "From kernel mode in Windows I'm able to intercept and monitor virtually all actions performed on a particular disk. When a file is opened for any purpose I get an event.\nNow I want to trace which application that opened it. I think this should be possible but don't know how.\nI... |
I'm writing an error handling module for a fairly complex system architected into layers. Sometimes our data layer throws obscure exceptions.
It would be really handy to log out the values of the parameters of the method that threw the exception.
I can reflect on the TargetSite property of the exception to find the me... | To log the parameter values of the method that threw an exception, you can use the `MethodBase` class along with reflection to get the parameter information, but unfortunately, the .NET `Exception` class does not directly provide parameter values. However, you can achieve this by wrapping your method calls in a try-cat... | 35,963 | [
{
"from": "human",
"value": "I'm writing an error handling module for a fairly complex system architected into layers. Sometimes our data layer throws obscure exceptions.\nIt would be really handy to log out the values of the parameters of the method that threw the exception. \nI can reflect on the TargetSi... |
std::next_permutation (and std::prev_permutation) permute all values in the range [first, last) given for a total of n! permutations (assuming that all elements are unique).
is it possible to write a function like this:
template<class Iter>
bool next_permutation(Iter first, Iter last, Iter choice_last);
That permutes ... | Yes, implementing a function that generates permutations of a subset of elements from a larger collection is indeed possible. Your approach using indices is valid, and you've discovered an even better approach using the standard library's capabilities. Let's expand on your final thoughts and provide a clearer implement... | 36,447 | [
{
"from": "human",
"value": "std::next_permutation (and std::prev_permutation) permute all values in the range [first, last) given for a total of n! permutations (assuming that all elements are unique).\nis it possible to write a function like this:\ntemplate<class Iter>\nbool next_permutation(Iter first, I... |
When I profile my application using SQL Server Profiler, I am seeing lots of Audit Login and Audit Logout messages for connections to the same database. I am wondering, does this indicate that something is wrong with my connection pooling? The reason I ask, is because I found this in the MSDN documentation in regards... | The presence of many `Audit Login` and `Audit Logout` events in SQL Server Profiler for your application can indicate that connections are being opened and closed frequently, rather than being reused from the connection pool. This behavior can suggest potential issues with connection pooling, such as:
1. **Connection ... | 33,792 | [
{
"from": "human",
"value": "When I profile my application using SQL Server Profiler, I am seeing lots of Audit Login and Audit Logout messages for connections to the same database. I am wondering, does this indicate that something is wrong with my connection pooling? The reason I ask, is because I found ... |
I need to test if a file is a shortcut. I'm still trying to figure out how stuff will be set up, but I might only have it's path, I might only have the actual contents of the file (as a byte[]) or I might have both.
A few complications include that I it could be in a zip file (in this cases the path will be an internal... | To determine if a file is a shortcut (typically a Windows shortcut file with the `.lnk` extension) based on its path or its contents, you can follow a systematic approach. Below are the steps to consider, along with code examples in C#.
### 1. Check the File Extension
If you have the path of the file, the simplest f... | 37,065 | [
{
"from": "human",
"value": "I need to test if a file is a shortcut. I'm still trying to figure out how stuff will be set up, but I might only have it's path, I might only have the actual contents of the file (as a byte[]) or I might have both.\nA few complications include that I it could be in a zip file (... |
Currently we're using hand-rolled SQL in Data-Access objects and a lot of stored-procedures and triggers which amount to around 20k lines of code. We're finding that simple changes are causing a couple of days' work to fix, and its causing deadlines to slip.
Changes include modifications to tables to cope with addition... | Managing schema evolution in relational databases can be challenging, especially in an environment with frequent changes and complex dependencies, such as yours. Here are some best practices and strategies that you can consider to improve your approach and cope with schema evolution more effectively:
### 1. **Version ... | 36,228 | [
{
"from": "human",
"value": "Currently we're using hand-rolled SQL in Data-Access objects and a lot of stored-procedures and triggers which amount to around 20k lines of code. We're finding that simple changes are causing a couple of days' work to fix, and its causing deadlines to slip.\nChanges include mod... |
If I have java-webapp (servlets), what is the best way to create automated tests for this application?
Should I start a server? But that is very fragile. Should I call the servlets directly? But how can this be done? I don't know how to create a ServletResponse/ServletRequest.
And what is the best way to test the funct... | Automated testing for a Java web application using servlets can indeed be tricky. However, there are several approaches you can consider, each with its own advantages and disadvantages. Here are some best practices and techniques for testing a Java web application effectively:
### 1. Unit Testing Servlets
- **Mocking... | 36,790 | [
{
"from": "human",
"value": "If I have java-webapp (servlets), what is the best way to create automated tests for this application?\nShould I start a server? But that is very fragile. Should I call the servlets directly? But how can this be done? I don't know how to create a ServletResponse/ServletRequest.\... |
I am using Visual Studio 2005 and StarTeam 2008 (cross-platform client and VS integration). At some point, I added an 'App.config' to a project. I notice now that this file will not check-in.
The 'StarTeam Pending Checkins' window in VS reports the file 'Not in View'. Selecting it for check in and clicking 'Check In F... | It sounds like you are facing a common issue with the integration between Visual Studio and StarTeam, specifically with the handling of the `App.config` file. Here are some steps you can take to troubleshoot and potentially resolve the issue:
1. **Refresh Visual Studio Project**: Sometimes Visual Studio does not refre... | 36,978 | [
{
"from": "human",
"value": "I am using Visual Studio 2005 and StarTeam 2008 (cross-platform client and VS integration). At some point, I added an 'App.config' to a project. I notice now that this file will not check-in.\n\nThe 'StarTeam Pending Checkins' window in VS reports the file 'Not in View'. Selecti... |
Does anybody know what's going on here:
I run hibernate 3.2.6 against a PostgreSQL 8.3 (installed via fink) database on my Mac OS X. The setup works fine when I use Java 6 and the JDBC 4 driver (postgresql-8.3-603.jdbc4). However, I need this stuff to work with Java 5 and (hence) JDBC 3 (postgresql-8.3-603.jdbc3). When... | It looks like you're encountering a `java.sql.SQLException: No suitable driver` error when switching from JDBC 4 to JDBC 3 with Hibernate and Java 5. This suggests that the PostgreSQL JDBC driver might not be properly registered in your environment for the Java 5 setup.
Here are a few suggestions to troubleshoot and r... | 37,664 | [
{
"from": "human",
"value": "Does anybody know what's going on here:\nI run hibernate 3.2.6 against a PostgreSQL 8.3 (installed via fink) database on my Mac OS X. The setup works fine when I use Java 6 and the JDBC 4 driver (postgresql-8.3-603.jdbc4). However, I need this stuff to work with Java 5 and (henc... |
Does anyone have a good algorithm for taking an ordered list of integers, i.e.:
[1, 3, 6, 7, 8, 10, 11, 13, 14, 17, 19, 23, 25, 27, 28]
into a given number of evenly sized ordered sublists, i.e. for 4 it will be:
[1, 3, 6] [7, 8, 10, 11] [13, 14, 17, 19] [23, 25, 27, 28]
The requirement being that each of the sublists ... | You can achieve the desired partitioning of the ordered list into evenly sized sublists using a simple algorithm. Here's how you can do it step by step:
1. Determine the total number of integers in the input list.
2. Calculate the ideal size for each sublist by dividing the total number of integers by the number of de... | 38,298 | [
{
"from": "human",
"value": "Does anyone have a good algorithm for taking an ordered list of integers, i.e.:\n[1, 3, 6, 7, 8, 10, 11, 13, 14, 17, 19, 23, 25, 27, 28]\ninto a given number of evenly sized ordered sublists, i.e. for 4 it will be:\n[1, 3, 6] [7, 8, 10, 11] [13, 14, 17, 19] [23, 25, 27, 28]\nThe... |
I'm learning functional programming, and have tried to solve a couple problems in a functional style. One thing I experienced, while dividing up my problem into functions, was it seemed I had two options: use several disparate functions with similar parameter lists, or using nested functions which, as closures, can sim... | You're touching on some important concepts in functional programming, specifically around immutability, pure functions, and the use of closures. Let's break down your concerns.
### Closures vs. Disparate Functions
1. **Closures**: When you define inner functions that capture variables from their parent scope, they ar... | 37,547 | [
{
"from": "human",
"value": "I'm learning functional programming, and have tried to solve a couple problems in a functional style. One thing I experienced, while dividing up my problem into functions, was it seemed I had two options: use several disparate functions with similar parameter lists, or using nes... |
I have this code:
db = "C:\Dokumente und Einstellungen\hom\Anwendungsdaten\BayWotch4\Neuer Ordner\baywotch.db5"
TextExportFile = "C:\Dokumente und Einstellungen\hom\Anwendungsdaten\BayWotch4\Neuer Ordner\Exp.txt"
Set cn = CreateObject("ADODB.Connection")
Set rs = CreateObject("ADODB.Recordset")
cn.Open _
"Provider... | It seems you're experiencing two separate issues with your script. First, let’s tackle the issue of the query and the text export.
### 1. Resolving the Query Issue
The first thing you mentioned is that initially you had a problem with `tblAuction1`, but now it works fine. Since you mentioned that `tblAuction1` is a ... | 36,772 | [
{
"from": "human",
"value": "I have this code:\ndb = \"C:\\Dokumente und Einstellungen\\hom\\Anwendungsdaten\\BayWotch4\\Neuer Ordner\\baywotch.db5\"\nTextExportFile = \"C:\\Dokumente und Einstellungen\\hom\\Anwendungsdaten\\BayWotch4\\Neuer Ordner\\Exp.txt\"\n\nSet cn = CreateObject(\"ADODB.Connection\")\n... |
Currently I have subversion set up so that when I make changes in Eclipse PDT, I can commit the changes and they will be saved in /home/administrator/Project File. This file has the /branches /tags and /trunk directories recommended by subversion. I have no problem properly uploading files to the repository, but do I... | You're correct in your understanding that it’s generally not advisable to have your live website (the `/var/www` directory) serve files directly from your Subversion repository. Instead, it’s a common practice to separate the codebase (stored in version control) from the deployment environment.
Here are some approache... | 33,976 | [
{
"from": "human",
"value": "Currently I have subversion set up so that when I make changes in Eclipse PDT, I can commit the changes and they will be saved in /home/administrator/Project File. This file has the /branches /tags and /trunk directories recommended by subversion. I have no problem properly up... |
I have a unit test where I have statically defined a quite large byte array (over 8000 bytes) as the byte data of a file I don't want to read every time I run my unit test.
private static final byte[] FILE_DATA = new byte[] {
12,-2,123,................
}
This compiles fine within Eclipse, but when compiling via Ant sc... | The issue you're encountering with the "code too large" error is due to the fact that the Java compiler has limits on the size of code blocks, including the size of static initializers. The size limit for a single method (including static initializers) is 64 KB. When you have a large byte array defined statically in a ... | 39,465 | [
{
"from": "human",
"value": "I have a unit test where I have statically defined a quite large byte array (over 8000 bytes) as the byte data of a file I don't want to read every time I run my unit test.\nprivate static final byte[] FILE_DATA = new byte[] {\n12,-2,123,................\n}\n\nThis compiles fine... |
Hi I want to create sidebar in Firefox 3 but have no clue how to do this.
I find tutorial on MDC (https://developer.mozilla.org/en/Creating_a_Firefox_sidebar) but after installation extension do not work with "not compatible with Firefox 3.0.3" error.
Does anybody have any tip or link to some resource about how to mak... | Creating a sidebar for Firefox 3 can be a bit tricky since the extension system went through significant changes with different Firefox versions. Although the tutorial on MDC (Mozilla Developer Center) provides useful information, it may not be applicable to Firefox 3 directly due to compatibility issues.
Here are som... | 32,949 | [
{
"from": "human",
"value": "Hi I want to create sidebar in Firefox 3 but have no clue how to do this. \nI find tutorial on MDC (https://developer.mozilla.org/en/Creating_a_Firefox_sidebar) but after installation extension do not work with \"not compatible with Firefox 3.0.3\" error.\nDoes anybody have any ... |
I've seen two different implementation of memento on .NET.
One is pretty straightforward - The object creates another instance of itself.
The other is serializing the object using BinaryFormatter and MemoryStream.
Which is the preferred method? Can anyone point out advantages/disadvantages of each approach?
By the wa... | When considering the two different implementations of the Memento pattern in .NET you've described—creating a new instance of the object versus serializing the object using `BinaryFormatter` and `MemoryStream`—it's essential to evaluate both approaches based on resource usage and developer productivity.
### 1. Manual ... | 35,433 | [
{
"from": "human",
"value": "I've seen two different implementation of memento on .NET.\nOne is pretty straightforward - The object creates another instance of itself.\nThe other is serializing the object using BinaryFormatter and MemoryStream.\nWhich is the preferred method? Can anyone point out advantage... |
Let's assume I have a model called "product." Let's assume that product has three fields. These fields are 'name' (type string), 'cost' (type integer), and 'is_visible' (type bool).
1) How can I do a search query using the Rails "find" method (if there is another method, that's fine) so that I can search for all prod... | In Rails, you can use Active Record query methods to perform searches without having to write raw SQL. For your two scenarios, you can use the `where` method to build the desired queries.
### 1) Search for all products with a cost greater than 100 AND `is_visible` is true
You can achieve this using the `where` method... | 39,470 | [
{
"from": "human",
"value": "Let's assume I have a model called \"product.\" Let's assume that product has three fields. These fields are 'name' (type string), 'cost' (type integer), and 'is_visible' (type bool).\n1) How can I do a search query using the Rails \"find\" method (if there is another method, ... |
If this question has already been asked I appologies, please point me in the right direction.
I was wondering if anyone has any insight into how StackOverflow pops up the "n new answers have been posted, load new answers" thing at the top of a question when you are adding a post. This seems like a very useful function ... | Stack Overflow's "n new answers have been posted, load new answers" feature is implemented using a combination of AJAX (Asynchronous JavaScript and XML) and WebSockets or long polling to check for new content in real time. Here's a general overview of how you might implement a similar feature for your forum website:
#... | 34,417 | [
{
"from": "human",
"value": "If this question has already been asked I appologies, please point me in the right direction.\nI was wondering if anyone has any insight into how StackOverflow pops up the \"n new answers have been posted, load new answers\" thing at the top of a question when you are adding a p... |
My clipboard seems to be 'stuck' - after some time of usage of my machine it simply stops working - any software trying to access it sticks or throws an exception on Ctrl + C or Ctrl + V. The problem persists when I try to access it through the .Net framework or Win32API (an exception is thrown - something like 'Clipbo... | It sounds like you're experiencing issues with the Windows clipboard, which can be frustrating. Here are some steps you can take to troubleshoot and potentially resolve the problem:
1. **Restart Windows Explorer**: Sometimes, the clipboard issues can be tied to the Windows Explorer process. You can restart it:
- Pr... | 38,241 | [
{
"from": "human",
"value": "My clipboard seems to be 'stuck' - after some time of usage of my machine it simply stops working - any software trying to access it sticks or throws an exception on Ctrl + C or Ctrl + V. The problem persists when I try to access it through the .Net framework or Win32API (an exc... |
I have an entry in my .vimrc which makes it page down the viewport when I hit the spacebar. It looks like this:
map <Space> <PageDown>
I want to create another key mapping which pages the viewport up when holding shift and hitting the spacebar. I have tried the following entries:
map <Shift><Space> <PageUp>
map <S-Spa... | To create a mapping in Vim that pages the viewport up when you hold Shift and press the Spacebar, you can use the following command in your `.vimrc`:
```vim
map <S-Space> <C-b>
```
Here's the breakdown:
- `<S-Space>` corresponds to Shift + Space.
- `<C-b>` is the command in Vim that scrolls the viewport up by one pa... | 39,375 | [
{
"from": "human",
"value": "I have an entry in my .vimrc which makes it page down the viewport when I hit the spacebar. It looks like this:\nmap <Space> <PageDown>\n\nI want to create another key mapping which pages the viewport up when holding shift and hitting the spacebar. I have tried the following ent... |
I am using ANTLRWorks to create ANTLR grammars. I have a valid grammar and the parser and lexer source files are generated as well. I have also tried debugging the generated code and the output is as expected in the debugger output.
But when I try to invoke the __Test__ class generated by the debugger nothing is comi... | It sounds like you are experiencing issues with the output when running the `__Test__` class generated by ANTLRWorks. Here are some troubleshooting steps and resources that might help you resolve the issue:
### Troubleshooting Steps
1. **Check Input**: Ensure that you are providing valid input to the parser when invo... | 35,684 | [
{
"from": "human",
"value": "I am using ANTLRWorks to create ANTLR grammars. I have a valid grammar and the parser and lexer source files are generated as well. I have also tried debugging the generated code and the output is as expected in the debugger output. \nBut when I try to invoke the __Test__ class... |
M sending the parameters from the jsp page, the code is
<s:url id="url" action="searchAction">
<s:param name="id">"${cgConsultant.id}"</s:param>
</s:url>
and m getting it in the url as..
http://localhost:8080/search/searchAction.html?id="1"
I need to get it in the action class how do i get it..
please do ... | To access the parameters sent from the JSP page in your action class, you can use Struts 2's built-in functionality. Here's how you can achieve this step by step:
### Step 1: Update JSP Code
Your JSP code is currently sending the `id` parameter with double quotes, which is unnecessary. You need to modify it slightly ... | 35,713 | [
{
"from": "human",
"value": "M sending the parameters from the jsp page, the code is \n <s:url id=\"url\" action=\"searchAction\">\n <s:param name=\"id\">\"${cgConsultant.id}\"</s:param>\n </s:url>\n\nand m getting it in the url as..\nhttp://localhost:8080/search/searchAction.html?id=\"1\"\n\nI need... |
Up till now all my programming experience has been desktop development (mostly C/C++ with OpenGL/DirectX) but I'm interested in trying my hand at some web dev.
The two directions I'm considering are Ruby on Rails and ASP.net.
Which is most widely used?
Which would be a more marketable skill to have?
Thanks!
| Both Ruby on Rails and ASP.NET are popular frameworks for web development, but they cater to different ecosystems and have their own strengths and weaknesses. Here are some factors to consider for both:
### Usage and Popularity
1. **Ruby on Rails**:
- Ruby on Rails (RoR) has a strong following, particularly among ... | 37,329 | [
{
"from": "human",
"value": "Up till now all my programming experience has been desktop development (mostly C/C++ with OpenGL/DirectX) but I'm interested in trying my hand at some web dev.\nThe two directions I'm considering are Ruby on Rails and ASP.net. \nWhich is most widely used?\nWhich would be a more... |
Whenever I create a method signature in VS 2008 (C#), I type the two braces:
public void Something() {}
This leaves the cursor to the right of the closing brace. Then I have to use the arrow keys to reposition the cursor in between the braces. Is there a better way to do this without using the arrow keys?
I'd expect ... | In Visual Studio 2008, there's a feature called "auto-insertion of closing braces" that doesn't automatically place the cursor between the braces when you type the closing brace. However, there are a couple of ways to streamline your workflow to avoid using the arrow keys.
1. **Typing `Enter` after typing the closing ... | 36,640 | [
{
"from": "human",
"value": "Whenever I create a method signature in VS 2008 (C#), I type the two braces:\npublic void Something() {}\nThis leaves the cursor to the right of the closing brace. Then I have to use the arrow keys to reposition the cursor in between the braces. Is there a better way to do thi... |
A common pattern in C++ is to create a class that wraps a lock - the lock is either implicitly taken when object is created, or taken explicitly afterwards. When object goes out of scope, dtor automatically releases the lock.
Is it possible to do this in C#? As far as I understand there are no guarantees on when dtor i... | Yes, you can implement a similar pattern in C# using the `IDisposable` interface combined with a `using` statement. The key to achieving your goal of automatically releasing a lock when exiting a scope is to rely on the `Dispose` method of the `IDisposable` interface, which is called deterministically at the end of a `... | 38,004 | [
{
"from": "human",
"value": "A common pattern in C++ is to create a class that wraps a lock - the lock is either implicitly taken when object is created, or taken explicitly afterwards. When object goes out of scope, dtor automatically releases the lock.\nIs it possible to do this in C#? As far as I underst... |
I love grids - especially the cool third party ones like Devex, C1 etc..
Our programmer doesn't think end users can handle them - so he always designs his forms with read-only grids (with read-only classes). Choosing to edit an item in the grid opens up a detail form that allows editing.
This app is going to be used... | It's great that you're considering user experience and how it aligns with your audience's capabilities. Here are some points to help you navigate this situation:
1. **User Familiarity**: Since your target audience is composed of general business users who are proficient with Excel, they likely have a comfort level wit... | 36,858 | [
{
"from": "human",
"value": "I love grids - especially the cool third party ones like Devex, C1 etc..\nOur programmer doesn't think end users can handle them - so he always designs his forms with read-only grids (with read-only classes). Choosing to edit an item in the grid opens up a detail form that allo... |
I have a list of images that i’ve loaded with the Loader class, but I’m having a tough time assigning them unique names.
I need unique names because I want to remove certain images after a while.
Is there a way to assign loaders a name or some unique tag so i can remove them later? thanks.
Here's part of my code
for (v... | It looks like you're trying to assign unique names to the `Loader` instances so that you can later retrieve and manipulate them. However, `getChildByName` works on the display list (e.g., on display objects added to the stage or a specific parent), so it won't work directly on the `Loader` instances unless they are add... | 36,984 | [
{
"from": "human",
"value": "I have a list of images that i’ve loaded with the Loader class, but I’m having a tough time assigning them unique names.\nI need unique names because I want to remove certain images after a while.\nIs there a way to assign loaders a name or some unique tag so i can remove them l... |
I'm working on an app that takes data from our DB and outputs an xml file using the FOR XML AUTO, ELEMENTS on the end of the generated query, followed by an XSLT to transform it the way we want. However in a particular case where we are generating some data using an sql scalar function, it always puts that element int... | The behavior you're experiencing with the SQL Server XML output can often be influenced by how the SQL query is structured and how SQL Server interprets the relationships between tables and nodes in the XML hierarchy. The extra node layer (like having `<Table2>` wrapping the result of your scalar function) typically oc... | 37,828 | [
{
"from": "human",
"value": "I'm working on an app that takes data from our DB and outputs an xml file using the FOR XML AUTO, ELEMENTS on the end of the generated query, followed by an XSLT to transform it the way we want. However in a particular case where we are generating some data using an sql scalar ... |
What's the best way to implement friendly URL in ASP.net?
| Implementing friendly URLs in an ASP.NET application can significantly enhance both user experience and SEO. Friendly URLs are human-readable URLs that provide context about the content of the page rather than simply being an identifier.
### Here are a few ways to implement friendly URLs in ASP.NET:
#### 1. **Using A... | 34,308 | [
{
"from": "human",
"value": "What's the best way to implement friendly URL in ASP.net?\n"
},
{
"from": "gpt",
"value": "Implementing friendly URLs in an ASP.NET application can significantly enhance both user experience and SEO. Friendly URLs are human-readable URLs that provide context about th... |
Could someone please point me toward a cleaner method to generate a random enum member. This works but seems ugly.
Thanks!
public T RandomEnum<T>()
{
string[] items = Enum.GetNames(typeof( T ));
Random r = new Random();
string e = items[r.Next(0, items.Length - 1)];
return (T)Enum.Parse(typeof (T), e, true);
}
... | Certainly! Your current method works, but it can indeed be improved for clarity and efficiency. Here's a cleaner approach to randomly select a member from an enum using the `Enum.GetValues` method, which avoids the need for string parsing and improves type safety.
Here’s a revised version of your `RandomEnum` method:
... | 38,049 | [
{
"from": "human",
"value": "Could someone please point me toward a cleaner method to generate a random enum member. This works but seems ugly.\nThanks!\npublic T RandomEnum<T>()\n{\n string[] items = Enum.GetNames(typeof( T ));\n Random r = new Random();\n string e = items[r.Next(0, items.Length - 1)];\... |
I'm fairly new to unit testing. I have a site built in the 3-tier architecture, UI -> BLL -> DAL. And I used the asp.net Provider Model, so by making changes to web.config I can switch to DAL dll to target different data sources, to be complete the DAL is written with Entity Framework.
Now, my question is how do I un... | Unit testing in a 3-tier architecture, especially with the usage of the ASP.NET Provider Model and Entity Framework, can be a bit challenging due to the dependencies on configuration settings, such as connection strings and provider configurations. Here's a guide on how to effectively set up your unit testing environme... | 34,562 | [
{
"from": "human",
"value": "I'm fairly new to unit testing. I have a site built in the 3-tier architecture, UI -> BLL -> DAL. And I used the asp.net Provider Model, so by making changes to web.config I can switch to DAL dll to target different data sources, to be complete the DAL is written with Entity F... |
When I look at a directory in Windows Explorer, I can see a ProductName and ProductVersion property for the DLL's in that directory.
I need to export this DLL list with ProductName and ProductVersion into a text file.
If I do c:\>dir *.dll > test.log, the test.log does not have the ProductName and ProductVersion.
Could... | To export the `ProductName` and `ProductVersion` properties of DLL files in a directory to a text file in Windows, you can use PowerShell, which is built into Windows 7 and later versions. Here’s how you can do that:
### Using PowerShell
1. **Open PowerShell:**
- Press `Win + X` and select `Windows PowerShell` (or... | 39,128 | [
{
"from": "human",
"value": "When I look at a directory in Windows Explorer, I can see a ProductName and ProductVersion property for the DLL's in that directory.\nI need to export this DLL list with ProductName and ProductVersion into a text file.\nIf I do c:\\>dir *.dll > test.log, the test.log does not ha... |
I'm starting to learn about using Memcached with PHP and I was wondering; is there a point at which you should start using it? Is it always more efficient to cache data or does it only become effective once your site gets a certain number of hits? Presumably there is an overhead associated with Memcached, so when does ... | Using Memcached can indeed offer significant performance benefits for web applications, particularly those built with PHP, but whether you should start using it depends on several factors related to your application's architecture, the data being accessed, and your traffic patterns. Here's a breakdown of when it makes ... | 35,592 | [
{
"from": "human",
"value": "I'm starting to learn about using Memcached with PHP and I was wondering; is there a point at which you should start using it? Is it always more efficient to cache data or does it only become effective once your site gets a certain number of hits? Presumably there is an overhead... |
I have a POCO object that goes 4 levels deep contained objects (like Invoice has line items that have taxes that have gl entries), and I want to turn the entire thing into a DataSet. So there would be 4 tables, each with constraints being applied to the parent table.
Does anyone know of something that would automated t... | To convert a deeply nested Plain Old CLR Object (POCO) structure into a `DataSet` with related tables, you can automate the process using C#. However, there isn't a built-in method in .NET that does this for you directly, so you would typically write a custom method to handle it.
Here’s a rough outline of how you can ... | 32,787 | [
{
"from": "human",
"value": "I have a POCO object that goes 4 levels deep contained objects (like Invoice has line items that have taxes that have gl entries), and I want to turn the entire thing into a DataSet. So there would be 4 tables, each with constraints being applied to the parent table.\nDoes anyon... |
I am having troubles creating a fulltext index on a view in SQL Server 2005. Reviewing the documentation I have not found the problem. The error message I receive is: "'Id' is not a valid index to enforce a full-text search key. A full-text search key must be a unique, non-nullable, single-column index which is not o... | In SQL Server 2005, full-text indexing can be somewhat tricky when dealing with views. The error message you're encountering is related to the requirements for the "full-text search key." Let's address the points raised in your setup and clarify the issue:
1. **Unique, Non-Nullable, Single-Column Index**: You need a u... | 37,173 | [
{
"from": "human",
"value": "I am having troubles creating a fulltext index on a view in SQL Server 2005. Reviewing the documentation I have not found the problem. The error message I receive is: \"'Id' is not a valid index to enforce a full-text search key. A full-text search key must be a unique, non-nu... |
I recently came across this in some code - basically someone trying to create a large object, coping when there's not enough heap to create it:
try {
// try to perform an operation using a huge in-memory array
byte[] massiveArray = new byte[BIG_NUMBER];
} catch (OutOfMemoryError oome) {
// perform the opera... | You've raised some interesting points about memory management in Java and the handling of `OutOfMemoryError`. Let's break down the issues and explore potential solutions.
### Catching `OutOfMemoryError`
1. **Catching `Error`:** It is generally discouraged to catch `Error` and its subclasses (like `OutOfMemoryError`) ... | 39,090 | [
{
"from": "human",
"value": "I recently came across this in some code - basically someone trying to create a large object, coping when there's not enough heap to create it:\ntry {\n // try to perform an operation using a huge in-memory array\n byte[] massiveArray = new byte[BIG_NUMBER];\n} catch (OutO... |
How do I check if the timestamp date of a record is before midnight today?
datediff is driving me nuts...
| To check if a timestamp date of a record is before midnight today, you can compare the timestamp directly with the start of the current day. The approach can differ depending on the programming language or database you are using, but here are some examples in SQL and Python.
### SQL Example
In SQL, you can use a comp... | 40,059 | [
{
"from": "human",
"value": "How do I check if the timestamp date of a record is before midnight today?\ndatediff is driving me nuts...\n"
},
{
"from": "gpt",
"value": "To check if a timestamp date of a record is before midnight today, you can compare the timestamp directly with the start of the... |
I am translating SQL Server SQL Statements into their ANSI generic equivalent at present, and am stuck with a recursive statement using a WITH statement.
For the sake of concentrating on the issue, I'll simplify the issue as follows
If I have two tables
ReportingUnit
col1: Key
col2: ParentReportingUnitKey
Facility
... | To achieve this with a recursive query that works across multiple SQL platforms, you'll need to use a common table expression (CTE). While the ANSI SQL standard does not explicitly specify recursive queries, many databases, including Oracle, SQL Server, and DB2, support them.
Assuming the parameter for the reporting u... | 36,078 | [
{
"from": "human",
"value": "I am translating SQL Server SQL Statements into their ANSI generic equivalent at present, and am stuck with a recursive statement using a WITH statement.\nFor the sake of concentrating on the issue, I'll simplify the issue as follows\nIf I have two tables\n\nReportingUnit\n\ncol... |
How to find and remove unused Delphi runtime packages from a project that uses packages?
I have a Delphi project that is made up of several packages, in the requires part of the packages there are several Borland/3rd party packages listed (rtl.dcp, vcl.dcp ect) I know I need most of them, but there are ones I know I do... | Removing unused Delphi runtime packages from a project can help streamline your application by reducing its size and improving load times. However, this task can be a bit complex because it involves understanding the dependencies of your code and components. Here's a step-by-step guide to help you identify and remove u... | 36,494 | [
{
"from": "human",
"value": "How to find and remove unused Delphi runtime packages from a project that uses packages?\nI have a Delphi project that is made up of several packages, in the requires part of the packages there are several Borland/3rd party packages listed (rtl.dcp, vcl.dcp ect) I know I need mo... |
I'm currently working on a very short project on Prolog, and just got stuck trying to apply a "filter" I have created to a list. I have what you could call the filter ready, but I can't apply it. It'd be better if I illustrate:
filter(A, B)
...outputs 'true' if certain conditions are met.
filterList(A, [X, Y, Z])
..... | Sure! I can help you outline the Prolog function that implements your `filterList/2` predicate based on the criteria you've provided. The idea is to traverse the input list and use the `filter/2` predicate to determine which elements should be excluded from the output list.
Here's a basic outline of the `filterList/2`... | 38,512 | [
{
"from": "human",
"value": "I'm currently working on a very short project on Prolog, and just got stuck trying to apply a \"filter\" I have created to a list. I have what you could call the filter ready, but I can't apply it. It'd be better if I illustrate:\nfilter(A, B) \n\n...outputs 'true' if certain co... |
I have an html form that a user will fill out and print. Once printed, these forms will be faxed or mailed to a government agency, and need to look close enough like the original form published by said agency that a government bureaucrat doesn't spot that this is a reproduction. The data entered in the form is not sa... | You cannot directly change the appearance of radio buttons in a way that they print as square checkboxes instead of round buttons. However, there is a workaround that allows you to achieve a similar visual effect by using CSS and a little JavaScript.
### Method: Using Custom Elements
1. **Hide the Original Radio Butt... | 33,985 | [
{
"from": "human",
"value": "I have an html form that a user will fill out and print. Once printed, these forms will be faxed or mailed to a government agency, and need to look close enough like the original form published by said agency that a government bureaucrat doesn't spot that this is a reproduction... |
At my work everyone has sql snippets that they use to answer questions. Some are specific to a customer, while some are generic for a given database. I want to consolidate those queries into a library/repository that can be accessed by anyone on the team. The requirements would be:
Accessible
Searchable
Tagable (multi... | Creating a centralized library for SQL snippets is a great way to enhance collaboration and productivity within your team. Here are some recommendations based on practices that have been successful in other team environments:
### Platform Options
1. **GitHub or GitLab**:
- **Pros**: Version control, collaboration ... | 34,063 | [
{
"from": "human",
"value": "At my work everyone has sql snippets that they use to answer questions. Some are specific to a customer, while some are generic for a given database. I want to consolidate those queries into a library/repository that can be accessed by anyone on the team. The requirements would ... |
I'm using a logging module that can have reporting enabled/disabled at runtime. Calls generally go something like:
WARN(
"Danger Will Robinson! There are "
+ boost::lexical_cast<string>(minutes)
+ " minutes of oxygen left!"
);
I'm using an inline function for WARN, but I'm curious as to how much optimiz... | In C++, the compiler does not automatically optimize away the argument evaluation in function calls, regardless of whether the function ultimately does anything with those arguments or not. When you pass a string to your `WARN` function, even if the string is constructed purely from constant expressions and has no side... | 37,851 | [
{
"from": "human",
"value": "I'm using a logging module that can have reporting enabled/disabled at runtime. Calls generally go something like:\nWARN(\n \"Danger Will Robinson! There are \"\n + boost::lexical_cast<string>(minutes)\n + \" minutes of oxygen left!\"\n);\n\nI'm using an inline funct... |
Very simply, what is tail-call optimization?
More specifically, what are some small code snippets where it could be applied, and where not, with an explanation of why?
| Tail-call optimization (TCO) is a technique used by some programming languages and compilers to optimize recursive functions. It allows the compiler or interpreter to reuse the current function's stack frame for a tail-recursive call, instead of creating a new one. This can prevent stack overflow and improve performanc... | 37,558 | [
{
"from": "human",
"value": "Very simply, what is tail-call optimization?\nMore specifically, what are some small code snippets where it could be applied, and where not, with an explanation of why?\n"
},
{
"from": "gpt",
"value": "Tail-call optimization (TCO) is a technique used by some programm... |
Ive recently been asked to recommend a .NET framework version to use in a (GUI based) project for an XP machine.
Can anyone explain the differences between all the .NET versions?
OR,
Does anyone have a good reference to a site that details (briefly) the differences?
| When it comes to recommending a .NET framework version for a project on a Windows XP machine, you should consider the following:
### .NET Framework Versions Overview
1. **.NET Framework 1.0**
- Released in 2002.
- Introduced the common language runtime (CLR) and base class libraries.
- Primarily supports Win... | 37,108 | [
{
"from": "human",
"value": "Ive recently been asked to recommend a .NET framework version to use in a (GUI based) project for an XP machine.\nCan anyone explain the differences between all the .NET versions?\nOR,\nDoes anyone have a good reference to a site that details (briefly) the differences?\n"
},
... |
I am working on a website with lots of images (think smugmug/flickr) and from what I read, flickr is using squid as the image cache. My images will be stored on Amazon S3, so a caching server will help saving the hosting money as well. I'd like to hear ideas on it is do-able with the following configuration.
My ASP.N... | Yes, what you're proposing is definitely doable and is a common setup for improving image delivery and reducing costs associated with serving assets directly from an origin server like Amazon S3.
### Proposed Architecture
1. **Client Request:** Users access your website (let's assume your domain is `example.com`).
2.... | 27,793 | [
{
"from": "human",
"value": "I am working on a website with lots of images (think smugmug/flickr) and from what I read, flickr is using squid as the image cache. My images will be stored on Amazon S3, so a caching server will help saving the hosting money as well. I'd like to hear ideas on it is do-able wi... |
I am embarking on a new RIA project with Java on the backend. I'm the only developer, and the app is a line-of-business application. My current stack looks like this:
MySQL || Spring(JdbcTemplate for data access) || BlazeDS (remoting) || Flex(Cairngorm)
My question is: what changes can I make to improve productivity? M... | Improving productivity in your RIA project can be achieved through various strategies and frameworks that streamline development processes and reduce boilerplate code. Here are some suggestions for enhancing your stack:
### 1. **Use an ORM Framework**:
Instead of manually coding SQL and server-side entity objects, con... | 37,385 | [
{
"from": "human",
"value": "I am embarking on a new RIA project with Java on the backend. I'm the only developer, and the app is a line-of-business application. My current stack looks like this:\nMySQL || Spring(JdbcTemplate for data access) || BlazeDS (remoting) || Flex(Cairngorm)\nMy question is: what ch... |
Is it possible for a JPA entity class to contain two embedded (@Embedded) fields? An example would be:
@Entity
public class Person {
@Embedded
public Address home;
@Embedded
public Address work;
}
public class Address {
public String street;
...
}
In this case a Person can contain two Address... | Yes, it is indeed possible for a JPA entity class to contain two embedded fields. However, as you noted, Hibernate might not generate the correct schema for both embedded fields as you would expect by default. To achieve this, you can use the `@AttributeOverrides` annotation to explicitly specify how the fields in the ... | 38,928 | [
{
"from": "human",
"value": "Is it possible for a JPA entity class to contain two embedded (@Embedded) fields? An example would be:\n@Entity\npublic class Person {\n @Embedded\n public Address home;\n\n @Embedded\n public Address work;\n}\n\npublic class Address {\n public String street;\n ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.